[postgis-tickets] r17878 - Fix lib detection with "--with-jsondir" flag

Raul raul at rmr.ninja
Mon Oct 7 04:41:55 PDT 2019


Author: algunenano
Date: 2019-10-07 04:41:55 -0700 (Mon, 07 Oct 2019)
New Revision: 17878

Modified:
   trunk/configure.ac
Log:
Fix lib detection with "--with-jsondir" flag

Patch by jabakobob
References #4528



Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2019-10-07 10:38:47 UTC (rev 17877)
+++ trunk/configure.ac	2019-10-07 11:41:55 UTC (rev 17878)
@@ -929,19 +929,23 @@
             else
                     AC_MSG_RESULT([Using user-specified json-c directory: $JSONDIR])
 
+                    JSON_LDFLAGS="-L$JSONDIR/lib"
+                    LIBS_SAVE="$LIBS"
+                    LIBS="$JSON_LDFLAGS"
                     AC_CHECK_FILE("$JSONDIR/include/json-c/json.h",
                                 [
                                     JSON_CPPFLAGS="-I$JSONDIR/include/json-c"
-                                    AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON_C=yes; JSON_LDFLAGS="-L$JSONDIR/lib -ljson-c"])
+                                    AC_CHECK_LIB([json-c], [json_object_get], [HAVE_JSON_C=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson-c"])
                                 ],
                                 [
                                     AC_CHECK_FILE("$JSONDIR/include/json/json.h",
                                     [
                                         JSON_CPPFLAGS="-I$JSONDIR/include/json"
-                                        AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="-L$JSONDIR/lib -ljson"])
+                                        AC_CHECK_LIB([json], [json_object_get], [HAVE_JSON=yes; JSON_LDFLAGS="${JSON_LDFLAGS} -ljson"])
                                     ],
                                     [AC_MSG_ERROR([Could not find header: json.h])])
                                 ])
+                    LIBS="$LIBS_SAVE"
             fi
     elif test ! -z "$PKG_CONFIG"; then
 	PKG_CHECK_MODULES([JSONC], [json-c], [



More information about the postgis-tickets mailing list