From b23c3facc963be3adaa1b24363b25988ec0564d3 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 9 Sep 2008 12:49:11 +0000 Subject: [PATCH] 2008-09-09 Tatsuhiro Tsujikawa Merged from stable-0.15 * m4/libcares.m4 Use pkg-config * m4/sqlite3.m4 --- ChangeLog | 8 ++++ configure | 111 +++++++++++++++++++++++++++++++++++++++++++++---- m4/libcares.m4 | 8 ++++ m4/sqlite3.m4 | 37 +++++++++++++---- 4 files changed, 148 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index b77ba5a2..d764b094 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-09-09 Tatsuhiro Tsujikawa + + Merged from stable-0.15 + * m4/libcares.m4 + + Use pkg-config + * m4/sqlite3.m4 + 2008-09-09 Tatsuhiro Tsujikawa Removed unnecessary if statement. diff --git a/configure b/configure index 71382f9c..5a0a48fe 100755 --- a/configure +++ b/configure @@ -5967,16 +5967,37 @@ if test "x$sqlite3_prefix" = "x"; then sqlite3_prefix="/usr" fi -sqlite3_prefix_lib=$sqlite3_prefix/lib -sqlite3_prefix_include=$sqlite3_prefix/include - LIBS_save=$LIBS CPPFLAGS_save=$CPPFLAGS -LIBS="-L$sqlite3_prefix_lib $LIBS" -CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS" +PKG_CONFIG="$sqlite3_prefix/bin/pkg-config" +if test -x $PKG_CONFIG; then + { echo "$as_me:$LINENO: checking checking availability of sqlite3 using pkg-config" >&5 +echo $ECHO_N "checking checking availability of sqlite3 using pkg-config... $ECHO_C" >&6; } + $PKG_CONFIG --exists sqlite3 + if test "$?" = "0"; then + # Use pkg-config to detect LIBS and CFLAGS + SQLITE3_LIBS=`$PKG_CONFIG --libs sqlite3` + SQLITE3_CFLAGS=`$PKG_CONFIG --cflags sqlite3` -{ echo "$as_me:$LINENO: checking for sqlite3_open in -lsqlite3" >&5 + LIBS="$SQLITE3_LIBS $LIBS" + CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS" + have_sqlite3=yes + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + fi +fi +if test "x$have_sqlite3" != "xyes"; then + sqlite3_prefix_lib=$sqlite3_prefix/lib + sqlite3_prefix_include=$sqlite3_prefix/include + + LIBS="-L$sqlite3_prefix_lib $LIBS" + CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS" + + { echo "$as_me:$LINENO: checking for sqlite3_open in -lsqlite3" >&5 echo $ECHO_N "checking for sqlite3_open in -lsqlite3... $ECHO_C" >&6; } if test "${ac_cv_lib_sqlite3_sqlite3_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -6041,14 +6062,17 @@ if test $ac_cv_lib_sqlite3_sqlite3_open = yes; then have_sqlite3=yes fi + if test "x$have_sqlite3" = "xyes"; then + SQLITE3_LIBS="-L$sqlite3_prefix_lib -lsqlite3" + SQLITE3_CPPFLAGS="-I$sqlite3_prefix_include" + fi +fi if test "x$have_sqlite3" = "xyes"; then cat >>confdefs.h <<\_ACEOF #define HAVE_SQLITE3 1 _ACEOF - SQLITE3_LIBS="-L$sqlite3_prefix_lib -lsqlite3" - SQLITE3_CPPFLAGS="-I$sqlite3_prefix_include" fi @@ -6964,6 +6988,74 @@ if test $ac_cv_lib_cares_ares_init = yes; then fi +if test "x$have_libcares" != "xyes"; then + { echo "$as_me:$LINENO: checking for ares_init in -lcares" >&5 +echo $ECHO_N "checking for ares_init in -lcares... $ECHO_C" >&6; } +if test "${ac_cv_lib_cares_ares_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcares -lrt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* 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. */ +#ifdef __cplusplus +extern "C" +#endif +char ares_init (); +int +main () +{ +return ares_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_cares_ares_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_cares_ares_init=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_cares_ares_init" >&5 +echo "${ECHO_T}$ac_cv_lib_cares_ares_init" >&6; } +if test $ac_cv_lib_cares_ares_init = yes; then + have_libcares=yes need_librt=yes +fi + +fi + if test "x$have_libcares" = "xyes"; then { echo "$as_me:$LINENO: checking whether ares_host_callback accepts timeouts(c-ares >= 1.5)" >&5 @@ -7033,6 +7125,9 @@ cat >>confdefs.h <<\_ACEOF _ACEOF LIBCARES_LIBS="-L$libcares_prefix_lib -lcares" + if test "x$need_librt" = "xyes"; then + LIBCARES_LIBS="$LIBCARES_LIBS -lrt" + fi LIBCARES_CPPFLAGS="-I$libcares_prefix_include" diff --git a/m4/libcares.m4 b/m4/libcares.m4 index b995ab3d..6fab7eae 100644 --- a/m4/libcares.m4 +++ b/m4/libcares.m4 @@ -20,6 +20,11 @@ CPPFLAGS="-I$libcares_prefix_include -Wall $CPPFLAGS" AC_CHECK_LIB([cares], [ares_init], [have_libcares=yes]) +if test "x$have_libcares" != "xyes"; then + AC_CHECK_LIB([cares], [ares_init], [have_libcares=yes need_librt=yes], [], + [-lrt]) +fi + if test "x$have_libcares" = "xyes"; then AC_MSG_CHECKING([whether ares_host_callback accepts timeouts(c-ares >= 1.5)]) @@ -42,6 +47,9 @@ if test "x$have_libcares" = "xyes"; then AC_DEFINE([HAVE_LIBCARES], [1], [Define to 1 if you have libcares.]) LIBCARES_LIBS="-L$libcares_prefix_lib -lcares" + if test "x$need_librt" = "xyes"; then + LIBCARES_LIBS="$LIBCARES_LIBS -lrt" + fi LIBCARES_CPPFLAGS="-I$libcares_prefix_include" AC_SUBST(LIBCARES_LIBS) AC_SUBST(LIBCARES_CPPFLAGS) diff --git a/m4/sqlite3.m4 b/m4/sqlite3.m4 index e1112225..aa987819 100644 --- a/m4/sqlite3.m4 +++ b/m4/sqlite3.m4 @@ -8,20 +8,41 @@ if test "x$sqlite3_prefix" = "x"; then sqlite3_prefix="/usr" fi -sqlite3_prefix_lib=$sqlite3_prefix/lib -sqlite3_prefix_include=$sqlite3_prefix/include - LIBS_save=$LIBS CPPFLAGS_save=$CPPFLAGS -LIBS="-L$sqlite3_prefix_lib $LIBS" -CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS" +PKG_CONFIG="$sqlite3_prefix/bin/pkg-config" +if test -x $PKG_CONFIG; then + AC_MSG_CHECKING([checking availability of sqlite3 using pkg-config]) + $PKG_CONFIG --exists sqlite3 + if test "$?" = "0"; then + # Use pkg-config to detect LIBS and CFLAGS + SQLITE3_LIBS=`$PKG_CONFIG --libs sqlite3` + SQLITE3_CFLAGS=`$PKG_CONFIG --cflags sqlite3` -AC_CHECK_LIB([sqlite3], [sqlite3_open], [have_sqlite3=yes]) -if test "x$have_sqlite3" = "xyes"; then - AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.]) + LIBS="$SQLITE3_LIBS $LIBS" + CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS" + have_sqlite3=yes + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi +fi +if test "x$have_sqlite3" != "xyes"; then + sqlite3_prefix_lib=$sqlite3_prefix/lib + sqlite3_prefix_include=$sqlite3_prefix/include + + LIBS="-L$sqlite3_prefix_lib $LIBS" + CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS" + + AC_CHECK_LIB([sqlite3], [sqlite3_open], [have_sqlite3=yes]) + if test "x$have_sqlite3" = "xyes"; then SQLITE3_LIBS="-L$sqlite3_prefix_lib -lsqlite3" SQLITE3_CPPFLAGS="-I$sqlite3_prefix_include" + fi +fi +if test "x$have_sqlite3" = "xyes"; then + AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.]) AC_SUBST(SQLITE3_LIBS) AC_SUBST(SQLITE3_CPPFLAGS) fi