From: Evan Hunt Date: Tue, 9 Jul 2013 23:43:59 +0000 (-0700) Subject: [master] check for -ljson-c as well as -ljson X-Git-Tag: v9.10.0a1~228 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=4b13ea47db7d72596d3fa10c30b20c16b4936747;p=thirdparty%2Fbind9.git [master] check for -ljson-c as well as -ljson 3512. [port] Check whether to use -ljson or -ljson-c. [RT #34115] --- diff --git a/CHANGES b/CHANGES index 3096bc5de52..ce50611698b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +3512. [port] Check whether to use -ljson or -ljson-c. [RT #34115] + 3611. [bug] Improved resistance to a theoretical authentication attack based on differential timing. [RT #33939] diff --git a/configure b/configure index 01c27ea1391..47806e6aa39 100755 --- a/configure +++ b/configure @@ -16023,6 +16023,7 @@ else fi +have_libjson= case "$use_libjson" in no) libjson_libs="" @@ -16030,37 +16031,108 @@ case "$use_libjson" in 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 # diff --git a/configure.in b/configure.in index 4fa6fc68cdd..5ddbd4c9538 100644 --- a/configure.in +++ b/configure.in @@ -1501,6 +1501,7 @@ AC_ARG_WITH(libjson, [ --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="" @@ -1508,33 +1509,47 @@ case "$use_libjson" in 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 # diff --git a/lib/isc/include/isc/json.h b/lib/isc/include/isc/json.h index e3c875f8e2b..69ac4ffa18a 100644 --- a/lib/isc/include/isc/json.h +++ b/lib/isc/include/isc/json.h @@ -26,7 +26,7 @@ */ #ifdef HAVE_JSON -#include +#include #endif #define ISC_JSON_RENDERCONFIG 0x00000001 /* render config data */