ogdi-3.2.0-rpc.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. From 52b4a972c164d6900584f147ba4bf73f02e0bbe7 Mon Sep 17 00:00:00 2001
  2. From: Dennis Schridde <devurandom@gmx.net>
  3. Date: Tue, 28 Nov 2017 23:25:41 +0100
  4. Subject: [PATCH 6/6] Fall back to libtirpc if libc does not provide rpc/rpc.h
  5. ---
  6. config/generic.mak.in | 4 +-
  7. configure | 245 +++++++++++++++++++++++++++++++++++++++++++++++++-
  8. configure.in | 6 ++
  9. ogdi-config.in | 4 +-
  10. ogdi.pc.in | 4 +-
  11. 5 files changed, 255 insertions(+), 8 deletions(-)
  12. diff --git a/config/generic.mak.in b/config/generic.mak.in
  13. index 3b671d7..6ff7e33 100644
  14. --- a/config/generic.mak.in
  15. +++ b/config/generic.mak.in
  16. @@ -35,7 +35,7 @@ AR = ar cr
  17. # Compilation and linking flags
  18. #
  19. SHLIB_CFLAGS = @C_PIC@
  20. -COMMON_CFLAGS = $(OPTIMIZATION) @CFLAGS@ @C_WFLAGS@ -DUNIX=1 @C_PIC@
  21. +COMMON_CFLAGS = $(OPTIMIZATION) @CFLAGS@ @C_WFLAGS@ -DUNIX=1 @C_PIC@ @RPC_CFLAGS@
  22. SHLIB_LDFLAGS = -shared
  23. COMMON_LDFLAGS = $(OPTIMIZATION)
  24. @@ -61,7 +61,7 @@ INST_BIN = @bindir@
  25. #
  26. #RPC_LINKLIB = -lrpcsvc -lnsl -lsocket
  27. #RPC_LINKLIB = -ldl -ldbmalloc
  28. -RPC_LINKLIB = @LIBS@
  29. +RPC_LINKLIB = @LIBS@ @RPC_LIBS@
  30. #
  31. # Endian definition, could be little or big
  32. diff --git a/configure b/configure
  33. index d7acc10..c6459e0 100755
  34. --- a/configure
  35. +++ b/configure
  36. @@ -634,6 +634,8 @@ PROJ_INCLUDE
  37. PROJ_SETTING
  38. BIG_ENDIAN
  39. RPC_INCLUDES
  40. +RPC_LIBS
  41. +RPC_CFLAGS
  42. EGREP
  43. GREP
  44. CPP
  45. @@ -643,6 +645,9 @@ CXX_PIC
  46. C_WFLAGS
  47. CXX_WFLAGS
  48. HAVE_ICONV
  49. +PKG_CONFIG_LIBDIR
  50. +PKG_CONFIG_PATH
  51. +PKG_CONFIG
  52. OBJEXT
  53. EXEEXT
  54. ac_ct_CC
  55. @@ -714,7 +719,12 @@ CFLAGS
  56. LDFLAGS
  57. LIBS
  58. CPPFLAGS
  59. -CPP'
  60. +PKG_CONFIG
  61. +PKG_CONFIG_PATH
  62. +PKG_CONFIG_LIBDIR
  63. +CPP
  64. +RPC_CFLAGS
  65. +RPC_LIBS'
  66. # Initialize some variables set by options.
  67. @@ -1343,7 +1353,14 @@ Some influential environment variables:
  68. LIBS libraries to pass to the linker, e.g. -l<library>
  69. CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
  70. you have headers in a nonstandard directory <include dir>
  71. + PKG_CONFIG path to pkg-config utility
  72. + PKG_CONFIG_PATH
  73. + directories to add to pkg-config's search path
  74. + PKG_CONFIG_LIBDIR
  75. + path overriding pkg-config's built-in search path
  76. CPP C preprocessor
  77. + RPC_CFLAGS C compiler flags for RPC, overriding pkg-config
  78. + RPC_LIBS linker flags for RPC, overriding pkg-config
  79. Use these variables to override the choices made by `configure' or to help
  80. it to find libraries and programs with nonstandard names/locations.
  81. @@ -2867,6 +2884,126 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
  82. +
  83. +
  84. +
  85. +
  86. +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
  87. + if test -n "$ac_tool_prefix"; then
  88. + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
  89. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
  90. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  91. +$as_echo_n "checking for $ac_word... " >&6; }
  92. +if ${ac_cv_path_PKG_CONFIG+:} false; then :
  93. + $as_echo_n "(cached) " >&6
  94. +else
  95. + case $PKG_CONFIG in
  96. + [\\/]* | ?:[\\/]*)
  97. + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
  98. + ;;
  99. + *)
  100. + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  101. +for as_dir in $PATH
  102. +do
  103. + IFS=$as_save_IFS
  104. + test -z "$as_dir" && as_dir=.
  105. + for ac_exec_ext in '' $ac_executable_extensions; do
  106. + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  107. + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
  108. + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  109. + break 2
  110. + fi
  111. +done
  112. + done
  113. +IFS=$as_save_IFS
  114. +
  115. + ;;
  116. +esac
  117. +fi
  118. +PKG_CONFIG=$ac_cv_path_PKG_CONFIG
  119. +if test -n "$PKG_CONFIG"; then
  120. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
  121. +$as_echo "$PKG_CONFIG" >&6; }
  122. +else
  123. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  124. +$as_echo "no" >&6; }
  125. +fi
  126. +
  127. +
  128. +fi
  129. +if test -z "$ac_cv_path_PKG_CONFIG"; then
  130. + ac_pt_PKG_CONFIG=$PKG_CONFIG
  131. + # Extract the first word of "pkg-config", so it can be a program name with args.
  132. +set dummy pkg-config; ac_word=$2
  133. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
  134. +$as_echo_n "checking for $ac_word... " >&6; }
  135. +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
  136. + $as_echo_n "(cached) " >&6
  137. +else
  138. + case $ac_pt_PKG_CONFIG in
  139. + [\\/]* | ?:[\\/]*)
  140. + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
  141. + ;;
  142. + *)
  143. + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  144. +for as_dir in $PATH
  145. +do
  146. + IFS=$as_save_IFS
  147. + test -z "$as_dir" && as_dir=.
  148. + for ac_exec_ext in '' $ac_executable_extensions; do
  149. + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  150. + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
  151. + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
  152. + break 2
  153. + fi
  154. +done
  155. + done
  156. +IFS=$as_save_IFS
  157. +
  158. + ;;
  159. +esac
  160. +fi
  161. +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
  162. +if test -n "$ac_pt_PKG_CONFIG"; then
  163. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
  164. +$as_echo "$ac_pt_PKG_CONFIG" >&6; }
  165. +else
  166. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  167. +$as_echo "no" >&6; }
  168. +fi
  169. +
  170. + if test "x$ac_pt_PKG_CONFIG" = x; then
  171. + PKG_CONFIG=""
  172. + else
  173. + case $cross_compiling:$ac_tool_warned in
  174. +yes:)
  175. +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
  176. +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
  177. +ac_tool_warned=yes ;;
  178. +esac
  179. + PKG_CONFIG=$ac_pt_PKG_CONFIG
  180. + fi
  181. +else
  182. + PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
  183. +fi
  184. +
  185. +fi
  186. +if test -n "$PKG_CONFIG"; then
  187. + _pkg_min_version=0.9.0
  188. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
  189. +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
  190. + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
  191. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  192. +$as_echo "yes" >&6; }
  193. + else
  194. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  195. +$as_echo "no" >&6; }
  196. + PKG_CONFIG=""
  197. + fi
  198. +fi
  199. +
  200. +
  201. +
  202. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
  203. $as_echo_n "checking for dlopen in -ldl... " >&6; }
  204. if ${ac_cv_lib_dl_dlopen+:} false; then :
  205. @@ -3045,7 +3182,6 @@ HAVE_ICONV=$HAVE_ICONV
  206. -
  207. ac_ext=c
  208. ac_cpp='$CPP $CPPFLAGS'
  209. ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  210. @@ -3443,6 +3579,111 @@ fi
  211. done
  212. +for ac_header in rpc/rpc.h
  213. +do :
  214. + ac_fn_c_check_header_mongrel "$LINENO" "rpc/rpc.h" "ac_cv_header_rpc_rpc_h" "$ac_includes_default"
  215. +if test "x$ac_cv_header_rpc_rpc_h" = xyes; then :
  216. + cat >>confdefs.h <<_ACEOF
  217. +#define HAVE_RPC_RPC_H 1
  218. +_ACEOF
  219. +
  220. +else
  221. +
  222. +pkg_failed=no
  223. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libtirpc" >&5
  224. +$as_echo_n "checking for libtirpc... " >&6; }
  225. +
  226. +if test -n "$RPC_CFLAGS"; then
  227. + pkg_cv_RPC_CFLAGS="$RPC_CFLAGS"
  228. + elif test -n "$PKG_CONFIG"; then
  229. + if test -n "$PKG_CONFIG" && \
  230. + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5
  231. + ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5
  232. + ac_status=$?
  233. + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  234. + test $ac_status = 0; }; then
  235. + pkg_cv_RPC_CFLAGS=`$PKG_CONFIG --cflags "libtirpc" 2>/dev/null`
  236. + test "x$?" != "x0" && pkg_failed=yes
  237. +else
  238. + pkg_failed=yes
  239. +fi
  240. + else
  241. + pkg_failed=untried
  242. +fi
  243. +if test -n "$RPC_LIBS"; then
  244. + pkg_cv_RPC_LIBS="$RPC_LIBS"
  245. + elif test -n "$PKG_CONFIG"; then
  246. + if test -n "$PKG_CONFIG" && \
  247. + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtirpc\""; } >&5
  248. + ($PKG_CONFIG --exists --print-errors "libtirpc") 2>&5
  249. + ac_status=$?
  250. + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  251. + test $ac_status = 0; }; then
  252. + pkg_cv_RPC_LIBS=`$PKG_CONFIG --libs "libtirpc" 2>/dev/null`
  253. + test "x$?" != "x0" && pkg_failed=yes
  254. +else
  255. + pkg_failed=yes
  256. +fi
  257. + else
  258. + pkg_failed=untried
  259. +fi
  260. +
  261. +
  262. +
  263. +if test $pkg_failed = yes; then
  264. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  265. +$as_echo "no" >&6; }
  266. +
  267. +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
  268. + _pkg_short_errors_supported=yes
  269. +else
  270. + _pkg_short_errors_supported=no
  271. +fi
  272. + if test $_pkg_short_errors_supported = yes; then
  273. + RPC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libtirpc" 2>&1`
  274. + else
  275. + RPC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libtirpc" 2>&1`
  276. + fi
  277. + # Put the nasty error message in config.log where it belongs
  278. + echo "$RPC_PKG_ERRORS" >&5
  279. +
  280. + as_fn_error $? "Package requirements (libtirpc) were not met:
  281. +
  282. +$RPC_PKG_ERRORS
  283. +
  284. +Consider adjusting the PKG_CONFIG_PATH environment variable if you
  285. +installed software in a non-standard prefix.
  286. +
  287. +Alternatively, you may set the environment variables RPC_CFLAGS
  288. +and RPC_LIBS to avoid the need to call pkg-config.
  289. +See the pkg-config man page for more details." "$LINENO" 5
  290. +elif test $pkg_failed = untried; then
  291. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  292. +$as_echo "no" >&6; }
  293. + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
  294. +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  295. +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
  296. +is in your PATH or set the PKG_CONFIG environment variable to the full
  297. +path to pkg-config.
  298. +
  299. +Alternatively, you may set the environment variables RPC_CFLAGS
  300. +and RPC_LIBS to avoid the need to call pkg-config.
  301. +See the pkg-config man page for more details.
  302. +
  303. +To get pkg-config, see <http://pkg-config.freedesktop.org/>.
  304. +See \`config.log' for more details" "$LINENO" 5; }
  305. +else
  306. + RPC_CFLAGS=$pkg_cv_RPC_CFLAGS
  307. + RPC_LIBS=$pkg_cv_RPC_LIBS
  308. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  309. +$as_echo "yes" >&6; }
  310. +
  311. +fi
  312. +fi
  313. +
  314. +done
  315. +
  316. +
  317. for ac_header in rpc/pmap_clnt.h float.h dlfcn.h
  318. do :
  319. as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
  320. diff --git a/configure.in b/configure.in
  321. index 68b1c92..d5fe134 100644
  322. --- a/configure.in
  323. +++ b/configure.in
  324. @@ -23,6 +23,7 @@ fi
  325. dnl Checks for programs.
  326. AC_PROG_CC
  327. +PKG_PROG_PKG_CONFIG
  328. dnl We always want to check /usr/local for stuff.
  329. dnl LIBS="$LIBS -L/usr/local/lib"
  330. @@ -38,6 +39,11 @@ AC_COMPILER_WFLAGS
  331. AC_COMPILER_PIC
  332. AC_LD_SHARED
  333. +dnl ---------------------------------------------------------------------------
  334. +dnl Do we have rpc/rpc.h
  335. +dnl ---------------------------------------------------------------------------
  336. +AC_CHECK_HEADERS([rpc/rpc.h],,
  337. + [PKG_CHECK_MODULES([RPC], [libtirpc])])
  338. dnl ---------------------------------------------------------------------------
  339. dnl Do we have rpc/pmap_clnt.h, float.h, dlfcn.h?
  340. diff --git a/ogdi-config.in b/ogdi-config.in
  341. index f3c9a03..c6dfc50 100644
  342. --- a/ogdi-config.in
  343. +++ b/ogdi-config.in
  344. @@ -13,8 +13,8 @@ exec_prefix="@exec_prefix@"
  345. libdir="@libdir@"
  346. includedir="@includedir@/ogdi"
  347. libs="-logdi"
  348. -all_libs="-logdi -lproj -lexpat -lz"
  349. -I_opts="-I${includedir}"
  350. +all_libs="-logdi -lproj -lexpat -lz @RPC_LIBS@"
  351. +I_opts="-I${includedir} @RPC_CFLAGS@"
  352. L_opts=""
  353. R_opts=""
  354. cppflags=""
  355. diff --git a/ogdi.pc.in b/ogdi.pc.in
  356. index 8b919de..1f290d9 100644
  357. --- a/ogdi.pc.in
  358. +++ b/ogdi.pc.in
  359. @@ -6,7 +6,7 @@ includedir=@includedir@
  360. Name: ogdi
  361. Description: Open Geographic Datastore Interface
  362. Version: @OGDI_VERSION@
  363. -Cflags: -I${includedir}/ogdi
  364. +Cflags: -I${includedir}/ogdi @RPC_CFLAGS@
  365. Libs: -L${libdir} -logdi
  366. -Libs.private: -lproj -lexpat -lz
  367. +Libs.private: -lproj -lexpat -lz @RPC_LIBS@
  368. --
  369. 2.15.0