Skip to content

Commit f4ca319

Browse files
authored
Test for RPC instead of checking hardcoded paths (wrf-model#1830)
Change to configure to test for RPC package instead of checking hardcoded paths, so that non-standard RPC installs can still be found. TYPE: enhancement KEYWORDS: configure, build, rpc, make, test SOURCE: Brian Vanderwende (NCAR) DESCRIPTION OF CHANGES: Problem: If an RPC library is installed in a non-standard prefix with a package manager like Spack, WRF will not be able to find it. Solution: Instead of checking hardcoded locations for `rpc/types.h`, compile a test program to check for one of the variants. Since symbolic linking hacks are occasionally done to make tirpc friendlier, it's also good to check constants to confirm the version used. LIST OF MODIFIED FILES (from develop): M Makefile M configure A tools/rpc_test.c TESTS CONDUCTED: 1. The success is determined by running `configure` on a system that uses Spack to install libtirpc. 2. The Jenkins tests have passed - no impact on other part of code. RELEASE NOTE: Test for RPC headers to support non-standard locations.
1 parent c747615 commit f4ca319

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,10 @@ fortran_2003_fflush_test:
10951095
fortran_2008_gamma_test:
10961096
@cd tools ; /bin/rm -f fortran_2008_gamma_test.{exe,o} ; $(SFC) -o fortran_2008_gamma_test.exe fortran_2008_gamma_test.F ; cd ..
10971097

1098+
# rule used by configure to test for RPC support
1099+
rpc_test:
1100+
@cd tools ; /bin/rm -f rpc_test.exe ; $(SCC) -DUSE_TIRPC -o rpc_test.exe rpc_test.c ; $(SCC) -o rpc_test.exe rpc_test.c; cd ..
1101+
10981102
toolsdir :
10991103
@ echo '--------------------------------------'
11001104
if [ $(WRF_PLUS_CORE) -eq 0 ] ; then \

configure

+10-5
Original file line numberDiff line numberDiff line change
@@ -1038,11 +1038,16 @@ if [ $retval -ne 0 ] ; then
10381038
fi
10391039

10401040
# testing for location of rpc/types.h file, used in landuse
1041-
if [ -f /usr/include/rpc/types.h ] ; then
1042-
sed -e '/^CFLAGS_LOCAL/s/#/-DRPC_TYPES=1 &/' configure.wrf > configure.wrf.edit
1043-
mv configure.wrf.edit configure.wrf
1044-
elif [ -f /usr/include/tirpc/rpc/types.h ] ; then
1045-
sed -e '/^CFLAGS_LOCAL/s/#/-DRPC_TYPES=2 &/' configure.wrf > configure.wrf.edit
1041+
make rpc_test > tools/rpc_test.log 2>&1
1042+
rm -f tools/rpc_test.log
1043+
1044+
if [ -f tools/rpc_test.exe ] ; then
1045+
rpc_type=`tools/rpc_test.exe`
1046+
if [ $rpc_type == "rpc" ]; then
1047+
sed -e '/^CFLAGS_LOCAL/s/#/-DRPC_TYPES=1 &/' configure.wrf > configure.wrf.edit
1048+
else
1049+
sed -e '/^CFLAGS_LOCAL/s/#/-DRPC_TYPES=2 &/' configure.wrf > configure.wrf.edit
1050+
fi
10461051
mv configure.wrf.edit configure.wrf
10471052
else
10481053
echo "************************** W A R N I N G ************************************"

tools/rpc_test.c

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
3+
#ifdef USE_TIRPC
4+
#include <tirpc/rpc/types.h>
5+
#else
6+
#include <rpc/types.h>
7+
#endif
8+
9+
/* Should confirm type to avoid symlink hack false positivies */
10+
int main()
11+
{
12+
#ifdef _RPC_TYPES_H
13+
printf("rpc\n");
14+
#endif
15+
16+
#ifdef _TIRPC_TYPES_H
17+
printf("tirpc\n");
18+
#endif
19+
return 0;
20+
}

0 commit comments

Comments
 (0)