fi
+have_libjson=
case "$use_libjson" in
no)
libjson_libs=""
auto|yes)
if test -f "/usr/include/json/json.h"
then
- libjson_libs="-ljson"
libjson_cflags="-I /usr/include/json"
- else
- libjson_libs=""
+ have_libjson="yes"
+ elif test -f "/usr/include/json-c/json.h"
+ then
+ libjson_cflags="-I /usr/include/json-c"
+ have_libjson="yes"
fi
;;
*)
if test -f "${use_libjson}/include/json/json.h"
then
- libjson_libs="-L${use_libjson}/lib -ljson"
libjson_cflags="-I${use_libjson}/include/json"
- else
- as_fn_error $? "$use_libjson/include/json.h not found." "$LINENO" 5
+ LIBS="$LIBS -L${use_libjson}/lib"
+ have_libjson="yes"
+ elif test -f "${use_libjson}/include/json-c/json.h"
+ then
+ libjson_cflags="-I${use_libjson}/include/json-c"
+ LIBS="$LIBS -L${use_libjson}/lib"
+ have_libjson="yes"
+ else
+ as_fn_error $? "$use_libjson/include/json{,-c}/json.h not found." "$LINENO" 5
fi
;;
esac
-if test "X${libjson_libs}" != "X"
+if test "%${have_libjson}" != "X"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- CFLAGS="$CFLAGS $libjson_cflags"
- LIBS="$LIBS $libjson_libs"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing json_object_new_int" >&5
+$as_echo_n "checking for library containing json_object_new_int... " >&6; }
+if ${ac_cv_search_json_object_new_int+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-$as_echo "#define HAVE_JSON 1" >>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. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char json_object_new_int ();
+int
+main ()
+{
+return json_object_new_int ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' json json-c; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_json_object_new_int=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_json_object_new_int+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_json_object_new_int+:} false; then :
+
+else
+ ac_cv_search_json_object_new_int=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_json_object_new_int" >&5
+$as_echo "$ac_cv_search_json_object_new_int" >&6; }
+ac_res=$ac_cv_search_json_object_new_int
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: found libjson include but not library." >&5
+$as_echo "$as_me: WARNING: found libjson include but not library." >&2;}
+ have_libjson=""
+fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+if test "X${have_libjson}" != "X"
+then
+ CFLAGS="$CFLAGS $libjson_cflags"
+
+$as_echo "#define HAVE_JSON 1" >>confdefs.h
+
+fi
+
#
# In solaris 10, SMF can manage named service
#
[ --with-libjson[=PATH] Build with libjson0 library [yes|no|path]],
use_libjson="$withval", use_libjson="auto")
+have_libjson=
case "$use_libjson" in
no)
libjson_libs=""
auto|yes)
if test -f "/usr/include/json/json.h"
then
- libjson_libs="-ljson"
libjson_cflags="-I /usr/include/json"
- else
- libjson_libs=""
+ have_libjson="yes"
+ elif test -f "/usr/include/json-c/json.h"
+ then
+ libjson_cflags="-I /usr/include/json-c"
+ have_libjson="yes"
fi
;;
*)
if test -f "${use_libjson}/include/json/json.h"
then
- libjson_libs="-L${use_libjson}/lib -ljson"
libjson_cflags="-I${use_libjson}/include/json"
- else
- AC_MSG_ERROR([$use_libjson/include/json.h not found.])
+ LIBS="$LIBS -L${use_libjson}/lib"
+ have_libjson="yes"
+ elif test -f "${use_libjson}/include/json-c/json.h"
+ then
+ libjson_cflags="-I${use_libjson}/include/json-c"
+ LIBS="$LIBS -L${use_libjson}/lib"
+ have_libjson="yes"
+ else
+ AC_MSG_ERROR([$use_libjson/include/json{,-c}/json.h not found.])
fi
;;
esac
-if test "X${libjson_libs}" != "X"
+if test "%${have_libjson}" != "X"
then
AC_MSG_RESULT(yes)
- CFLAGS="$CFLAGS $libjson_cflags"
- LIBS="$LIBS $libjson_libs"
- AC_DEFINE(HAVE_JSON, 1, [Define if libjson was found])
+ AC_SEARCH_LIBS([json_object_new_int], [json json-c], [],
+ [AC_MSG_WARN([found libjson include but not library.])
+ have_libjson=""])
else
AC_MSG_RESULT(no)
fi
+if test "X${have_libjson}" != "X"
+then
+ CFLAGS="$CFLAGS $libjson_cflags"
+ AC_DEFINE(HAVE_JSON, 1, [Define if libjson was found])
+fi
+
#
# In solaris 10, SMF can manage named service
#