summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/wrf/patches/3.9/tirpc_detect.patch
blob: 691059ff3e819f7adf55bdabc50a20878bdfb4bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
From 4e70e6f7fe782bb00266bd84dfc4c901cb67b560 Mon Sep 17 00:00:00 2001
From: Phil Tooley <phil.tooley@nag.co.uk>
Date: Thu, 15 Oct 2020 17:26:26 +0100
Subject: [PATCH] fix tirpc detection

---
 arch/Config_new.pl | 14 ++++++++++++++
 arch/postamble_new |  6 ++++--
 configure          | 29 ++++++++++++++++++++++++-----
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/arch/Config_new.pl b/arch/Config_new.pl
index 945288df..e614f7ef 100644
--- a/arch/Config_new.pl
+++ b/arch/Config_new.pl
@@ -7,6 +7,9 @@
 
 select((select(STDOUT), $|=1)[0]);
 $sw_perl_path = perl ;
+$sw_tirpc_inc = "";
+$sw_tirpc_lib = "";
+$sw_tirpc_libdir = "";
 $sw_netcdf_path = "" ;
 $sw_netcdff_path = "" ;
 $sw_pnetcdf_path = "" ;
@@ -61,6 +64,15 @@ while ( substr( $ARGV[0], 0, 1 ) eq "-" )
   {
     $sw_perl_path = substr( $ARGV[0], 6 ) ;
   }
+  if ( substr( $ARGV[0], 1, 10 ) eq "tirpc_inc=" )
+  {
+    $sw_tirpc_inc = substr( $ARGV[0], 11 ) ;
+  }
+  if ( substr( $ARGV[0], 1, 10 ) eq "tirpc_lib=" )
+  {
+    $sw_tirpc_libdir = substr( $ARGV[0], 11 ) ;
+    $sw_tirpc_lib = "-ltirpc" ;
+  }
   if ( substr( $ARGV[0], 1, 7 ) eq "netcdf=" )
   {
     $sw_netcdf_path = substr( $ARGV[0], 8 ) ;
@@ -450,6 +462,8 @@ while ( <CONFIGURE_DEFAULTS> )
   if ( $latchon == 1 )
   {
     $_ =~ s/CONFIGURE_PERL_PATH/$sw_perl_path/g ;
+    $_ =~ s/CONFIGURE_TIRPC_INC/$sw_tirpc_inc/g ;
+    $_ =~ s/CONFIGURE_TIRPC_LIB/$sw_tirpc_libdir $sw_tirpc_lib/g ;
     $_ =~ s/CONFIGURE_NETCDF_PATH/$sw_netcdf_path/g ;
     $_ =~ s/CONFIGURE_NETCDFF_PATH/$sw_netcdff_path/g ;
     $_ =~ s/CONFIGURE_PNETCDF_PATH/$sw_pnetcdf_path/g ;
diff --git a/arch/postamble_new b/arch/postamble_new
index 9c4ca327..9beb448d 100644
--- a/arch/postamble_new
+++ b/arch/postamble_new
@@ -29,7 +29,7 @@ ARCHFLAGS       =    $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZ
                       -DMAX_HISTORY=$(MAX_HISTORY) \
 		      -DNMM_NEST=$(WRF_NMM_NEST)
 CFLAGS          =    $(CFLAGS_LOCAL) CONFIGURE_DMPARALLEL CONFIGURE_STUBMPI \
-                      -DMAX_HISTORY=$(MAX_HISTORY) CONFIGURE_NMM_CORE
+                      -DMAX_HISTORY=$(MAX_HISTORY) CONFIGURE_NMM_CORE $(TIRPCINC)
 FCFLAGS         =    $(FCOPTIM) $(FCBASEOPTS)
 ESMF_LIB_FLAGS  =    ESMFLIBFLAG
 # ESMF 5 -- these are defined in esmf.mk, included above
@@ -63,7 +63,7 @@ CC_TOOLS_CFLAGS = CONFIGURE_NMM_CORE
 #NOWIN LIB_EXTERNAL    = \
 #NOWIN                      CONFIGURE_NETCDF_LIB_PATH CONFIGURE_PNETCDF_LIB_PATH CONFIGURE_GRIB2_LIB CONFIGURE_ATMOCN_LIB CONFIGURE_HDF5_LIB_PATH
 
-LIB             =    $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL) $(LIB_WRF_HYDRO)
+LIB             =    $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL) $(LIB_WRF_HYDRO) $(LIB_TIRPC)
 LDFLAGS         =    $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL) CONFIGURE_LDFLAGS
 ENVCOMPDEFS     =    CONFIGURE_COMPILEFLAGS
 CPPFLAGS        =    $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG) CONFIGURE_COMMS_INCLUDE
@@ -73,6 +73,8 @@ HDF5PATH        =    CONFIGURE_HDF5_PATH
 WRFPLUSPATH     =    CONFIGURE_WRFPLUS_PATH
 RTTOVPATH       =    CONFIGURE_RTTOV_PATH
 PNETCDFPATH     =    CONFIGURE_PNETCDF_PATH
+TIRPCINC        =    CONFIGURE_TIRPC_INC
+LIB_TIRPC       =    CONFIGURE_TIRPC_LIB
 
 bundled:  io_only CONFIGURE_ATMOCN
 external: io_only CONFIGURE_COMMS_EXTERNAL $(ESMF_TARGET)
diff --git a/configure b/configure
index 26abcc4e..f9040a60 100755
--- a/configure
+++ b/configure
@@ -635,16 +635,35 @@ elif command -v time > /dev/null 2>&1; then
   echo "Will use 'time' to report timing information"
 fi
 
+# Try to get an include dir for libtirpc, an empty string is acceptable...
+if [ -z $TIRPC_INCLUDE_DIR ]; then
+  TIRPC_INC=$(pkg-config --cflags-only-I libtirpc 2>/dev/null)
+else
+  echo Using passed TIRPC include path
+  TIRPC_INC="-I${TIRPC_INCLUDE_DIR}"
+fi
+echo "TIRPC_INC=${TIRPC_INC}"
+
+# Try to get an include dir for libtirpc, an empty string is acceptable...
+if [ -z $TIRPC_LIB_DIR ]; then
+  TIRPC_LIB=$(pkg-config --libs-only-L libtirpc 2>/dev/null)
+else
+  echo Using passed TIRPC include path
+  TIRPC_LIB="-L${TIRPC_LIB_DIR}"
+fi
+echo "TIRPC_LIB=${TIRPC_LIB}"
+
 # Found perl, so proceed with configuration
 if test -n "$PERL" ; then
    srch=`grep -i "^#ARCH.*$os" arch/configure_new.defaults | grep -i "$mach"`
    if [ -n "$srch" ] ; then
      $PERL arch/Config_new.pl -dmparallel=$COMMLIB -ompparallel=$OMP -perl=$PERL \
-          -netcdf=$NETCDF -netcdff=$NETCDFF -pnetcdf=$PNETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os \
-               -mach=$mach -ldflags=$ldflags -compileflags=$compileflags -opt_level=$opt_level \
-               -USENETCDFF=$USENETCDFF -USENETCDF=$USENETCDF -time=$FORTRAN_COMPILER_TIMER \
-               -tfl="$TFL" -cfl="$CFL" -config_line="$config_line" -wrf_core=$wrf_core \
-               -gpfs=$GPFS_PATH -curl=$CURL_PATH -dep_lib_path="$DEP_LIB_PATH"
+        -tirpc_inc=$TIRPC_INC -tirpc_lib=$TIRPC_LIB -netcdf=$NETCDF -netcdff=$NETCDFF \
+        -pnetcdf=$PNETCDF -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \
+        -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF \
+        -USENETCDF=$USENETCDF -time=$FORTRAN_COMPILER_TIMER -tfl="$TFL" -cfl="$CFL" \
+        -config_line="$config_line" -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH \
+        -dep_lib_path="$DEP_LIB_PATH"
      if test ! -f configure.wrf ; then
        echo "configure.wrf not created! Exiting configure script..."
        exit 1
-- 
2.28.0