aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheirix <theirix@gmail.com>2016-04-01 17:18:33 +0300
committertheirix <theirix@gmail.com>2016-04-01 17:18:33 +0300
commit6f95182751bcaee42260cfffe8ab891fc4406b95 (patch)
tree6c2af96ade52cb43c1e940be10531a3ff4d71731
parent41d7430442d0f64bd6465ddc87e876856e405e93 (diff)
Improved detection of json-c package.
- Improved detection code for json-c package to use pkg-config with custom search path that includes /usr/local - Added optional option --disable-json-c to disable json-c package for reducing runtime dependencies.
-rw-r--r--configure.ac26
1 files changed, 14 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index d2dfc4357..e65baea81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,17 +61,20 @@ else
fi
fi
-PKG_CONFIG=$(which pkg-config)
-
-if test -d /usr/local/include/json-c/; then :
- CFLAGS="$CFLAGS -I/usr/local/include/json-c/"
- LDFLAGS="$LDFLAGS -L/usr/local/lib -ljson-c"
-else
- if ! test -z "$PKG_CONFIG"; then :
- CFLAGS="$CFLAGS $(pkg-config --cflags json-c)"
- LDFLAGS="$LDFLAGS $(pkg-config --libs json-c)"
- fi
-fi
+AC_ARG_ENABLE([json-c],
+ AS_HELP_STRING([--disable-json-c], [Disable json-c support]))
+
+AS_IF([test "x$enable_json_c" != "xno"], [
+ PKG_CONFIG_PATH=/usr/local/share/pkgconfig:$PKG_CONFIG_PATH
+ pkg-config --exists json-c
+ AS_IF([test "$?" == "0"],
+ [
+ CFLAGS="$CFLAGS $(pkg-config --cflags json-c)"
+ LDFLAGS="$LDFLAGS $(pkg-config --libs json-c)"
+ AC_CHECK_LIB(json-c, json_object_new_object, AC_DEFINE_UNQUOTED(HAVE_JSON_C, 1, [The JSON-C library is present]))
+ ],
+ [])
+ ])
OLD_LIBS=$LIBS
LIBS="-L/opt/napatech3/lib $LIBS"
@@ -81,7 +84,6 @@ AC_CHECK_LIB([ntapi],
[], [] )
LIBS=$OLD_LIBS
-AC_CHECK_LIB(json-c, json_object_new_object, AC_DEFINE_UNQUOTED(HAVE_JSON_C, 1, [The JSON-C library is present]))
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))