added support json and json-c
[ppastats.git] / configure
index d5310d9..47c6a96 100755 (executable)
--- a/configure
+++ b/configure
@@ -628,6 +628,8 @@ am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
 HELP2MAN
+JSON_FALSE
+JSON_TRUE
 JSON_LIBS
 JSON_CFLAGS
 CURL_LIBS
@@ -6830,6 +6832,7 @@ fi
 
 
 # Checks JSON
+JSON_LIBS=
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JSON" >&5
@@ -6839,12 +6842,12 @@ if test -n "$JSON_CFLAGS"; then
     pkg_cv_JSON_CFLAGS="$JSON_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json ") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json " 2>/dev/null`
+  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json-c" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -6856,12 +6859,12 @@ if test -n "$JSON_LIBS"; then
     pkg_cv_JSON_LIBS="$JSON_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json \""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json ") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json " 2>/dev/null`
+  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json-c" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -6882,48 +6885,122 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json " 2>&1`
+               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c" 2>&1`
         else
-               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json " 2>&1`
+               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$JSON_PKG_ERRORS" >&5
 
-       as_fn_error $? "Package requirements (json ) were not met:
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"json-c missing\"" >&5
+$as_echo "$as_me: WARNING: \"json-c missing\"" >&2;}
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"json-c missing\"" >&5
+$as_echo "$as_me: WARNING: \"json-c missing\"" >&2;}
+else
+       JSON_CFLAGS=$pkg_cv_JSON_CFLAGS
+       JSON_LIBS=$pkg_cv_JSON_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-$JSON_PKG_ERRORS
+$as_echo "#define HAVE_JSON 1" >>confdefs.h
 
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
+fi
 
-Alternatively, you may set the environment variables JSON_CFLAGS
-and JSON_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
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+if test "$JSON_LIBS" == ""; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JSON" >&5
+$as_echo_n "checking for JSON... " >&6; }
+
+if test -n "$JSON_CFLAGS"; then
+    pkg_cv_JSON_CFLAGS="$JSON_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$JSON_LIBS"; then
+    pkg_cv_JSON_LIBS="$JSON_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$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 JSON_CFLAGS
-and JSON_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json" 2>&1`
+        else
+               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json" 2>&1`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$JSON_PKG_ERRORS" >&5
 
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"json0 missing\"" >&5
+$as_echo "$as_me: WARNING: \"json0 missing\"" >&2;}
+elif test $pkg_failed = untried; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"json0 missing\"" >&5
+$as_echo "$as_me: WARNING: \"json0 missing\"" >&2;}
 else
        JSON_CFLAGS=$pkg_cv_JSON_CFLAGS
        JSON_LIBS=$pkg_cv_JSON_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
+$as_echo "#define HAVE_JSON 1" >>confdefs.h
+
+
+$as_echo "#define HAVE_JSON_0 1" >>confdefs.h
+
+fi
+fi
+
+ if test -n "$JSON_LIBS"; then
+  JSON_TRUE=
+  JSON_FALSE='#'
+else
+  JSON_TRUE='#'
+  JSON_FALSE=
 fi
 
 
 
+
 ac_fn_c_check_type "$LINENO" "json_bool" "ac_cv_type_json_bool" "#include <json/json.h>
 "
 if test "x$ac_cv_type_json_bool" = xyes; then :
@@ -7104,6 +7181,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${JSON_TRUE}" && test -z "${JSON_FALSE}"; then
+  as_fn_error $? "conditional \"JSON\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0