From: Anthony PERARD <anthony.per...@vates.tech>

Signed-off-by: Anthony PERARD <anthony.per...@vates.tech>
---
 tools/configure    | 97 +++++++++++++++++++++++++++++-----------------
 tools/configure.ac | 12 +++---
 2 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/tools/configure b/tools/configure
index edd1701b2d..0eb7a0ab6a 100755
--- a/tools/configure
+++ b/tools/configure
@@ -9692,41 +9692,7 @@ fi
        # Put the nasty error message in config.log where it belongs
        echo "$libjsonc_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (json-c) were not met:
-
-$libjsonc_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables libjsonc_CFLAGS
-and libjsonc_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
-elif test $pkg_failed = untried; then
-       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s\n" "no" >&6; }
-       { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" 
>&5
-printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old.  Make 
sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables libjsonc_CFLAGS
-and libjsonc_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
-else
-       libjsonc_CFLAGS=$pkg_cv_libjsonc_CFLAGS
-       libjsonc_LIBS=$pkg_cv_libjsonc_LIBS
-        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s\n" "yes" >&6; }
-
-printf "%s\n" "#define HAVE_LIBJSONC 1" >>confdefs.h
-
-fi
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yajl_alloc in 
-lyajl" >&5
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yajl_alloc 
in -lyajl" >&5
 printf %s "checking for yajl_alloc in -lyajl... " >&6; }
 if test ${ac_cv_lib_yajl_yajl_alloc+y}
 then :
@@ -9772,6 +9738,67 @@ else $as_nop
   as_fn_error $? "Could not find yajl" "$LINENO" 5
 fi
 
+
+elif test $pkg_failed = untried; then
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for yajl_alloc 
in -lyajl" >&5
+printf %s "checking for yajl_alloc in -lyajl... " >&6; }
+if test ${ac_cv_lib_yajl_yajl_alloc+y}
+then :
+  printf %s "(cached) " >&6
+else $as_nop
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lyajl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+char yajl_alloc ();
+int
+main (void)
+{
+return yajl_alloc ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"
+then :
+  ac_cv_lib_yajl_yajl_alloc=yes
+else $as_nop
+  ac_cv_lib_yajl_yajl_alloc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: 
$ac_cv_lib_yajl_yajl_alloc" >&5
+printf "%s\n" "$ac_cv_lib_yajl_yajl_alloc" >&6; }
+if test "x$ac_cv_lib_yajl_yajl_alloc" = xyes
+then :
+  YAJL_LIBS=-lyajl
+
+
+printf "%s\n" "#define HAVE_LIBYAJL 1" >>confdefs.h
+
+else $as_nop
+  as_fn_error $? "Could not find yajl" "$LINENO" 5
+fi
+
+
+else
+       libjsonc_CFLAGS=$pkg_cv_libjsonc_CFLAGS
+       libjsonc_LIBS=$pkg_cv_libjsonc_LIBS
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+
+printf "%s\n" "#define HAVE_LIBJSONC 1" >>confdefs.h
+
+fi
+
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for deflateCopy in -lz" 
>&5
 printf %s "checking for deflateCopy in -lz... " >&6; }
 if test ${ac_cv_lib_z_deflateCopy+y}
diff --git a/tools/configure.ac b/tools/configure.ac
index bb40b5b3f0..7267d02a04 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -425,11 +425,13 @@ AC_SUBST([ZLIB_LIBS])
 AX_CHECK_EXTFS
 AX_CHECK_PTHREAD
 PKG_CHECK_MODULES([libjsonc], [json-c],
-    [AC_DEFINE([HAVE_LIBJSONC], [1], [Use library json-c])])
-AC_CHECK_LIB([yajl], [yajl_alloc],
-   [AC_SUBST([YAJL_LIBS],[-lyajl])
-    AC_DEFINE([HAVE_LIBYAJL],[1],[Define to 1 if you have the `yajl' library 
(-lyajl).])],
-    [AC_MSG_ERROR([Could not find yajl])])
+    [AC_DEFINE([HAVE_LIBJSONC], [1], [Use library json-c])],
+    [AC_CHECK_LIB([yajl], [yajl_alloc],
+        [AC_SUBST([YAJL_LIBS],[-lyajl])
+         AC_DEFINE([HAVE_LIBYAJL],[1],[Define to 1 if you have the `yajl' 
library (-lyajl).])],
+        [AC_MSG_ERROR([Could not find yajl])])
+])
+
 AC_CHECK_LIB([z], [deflateCopy], [], [AC_MSG_ERROR([Could not find zlib])])
 AC_CHECK_HEADER([argp.h], [
 AC_CHECK_LIB([argp], [argp_usage], [argp_ldflags="-largp"])
-- 
Anthony PERARD


Reply via email to