diff options
author | Yang Tse <yangsita@gmail.com> | 2009-05-26 14:50:45 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-05-26 14:50:45 +0000 |
commit | 675d6ec5e6d9dc51b0ff9ad28c0e901a7516e2ef (patch) | |
tree | 3a7b101eb836ac68c28a0de8b37e7256a39281f2 /ares/m4 | |
parent | 1ad43c54c0bb03fbb2313954a984bbbeb7110528 (diff) |
c-ares's --enable-curldebug configure option decoupled from c-ares's --enable-debug
Diffstat (limited to 'ares/m4')
-rw-r--r-- | ares/m4/cares-compilers.m4 | 100 | ||||
-rw-r--r-- | ares/m4/cares-confopts.m4 | 44 |
2 files changed, 118 insertions, 26 deletions
diff --git a/ares/m4/cares-compilers.m4 b/ares/m4/cares-compilers.m4 index 5e5b3a82c..50c73c679 100644 --- a/ares/m4/cares-compilers.m4 +++ b/ares/m4/cares-compilers.m4 @@ -16,7 +16,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 51 +# serial 52 dnl CARES_CHECK_COMPILER @@ -1070,36 +1070,88 @@ squeeze() { ]) -dnl CARES_PROCESS_DEBUG_BUILD_OPTS +dnl CARES_CHECK_CURLDEBUG dnl ------------------------------------------------- -dnl Settings which depend on configure's debug given -dnl option, and further configure the build process. -dnl Don't use this macro for compiler dependant stuff. - -AC_DEFUN([CARES_PROCESS_DEBUG_BUILD_OPTS], [ - AC_REQUIRE([CARES_CHECK_OPTION_DEBUG])dnl +dnl Settings which depend on configure's curldebug given +dnl option, and other additional configure pre-requisites. +dnl Using the curl debug memory tracking feature in c-ares +dnl is a hack that actually can only be used/enabled when +dnl c-ares is built as a static library directly in curl's +dnl CVS tree along with an equally configured libcurl. + +AC_DEFUN([CARES_CHECK_CURLDEBUG], [ AC_REQUIRE([CARES_SHFUNC_SQUEEZE])dnl - AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl + cares_builddir=`pwd` + supports_curldebug="unknown" + if test "$want_curldebug" = "yes"; then + if test "x$enable_shared" != "xno" && + test "x$enable_shared" != "xyes"; then + AC_MSG_WARN([unknown enable_shared setting.]) + supports_curldebug="no" + fi + if test "x$enable_static" != "xno" && + test "x$enable_static" != "xyes"; then + AC_MSG_WARN([unknown enable_static setting.]) + supports_curldebug="no" + fi + if test "$supports_curldebug" != "no"; then + if test "$enable_shared" != "no"; then + AC_MSG_WARN([configured to build shared library.]) + supports_curldebug="no" + fi + if test "$enable_static" != "yes"; then + AC_MSG_WARN([configured to build no static library.]) + supports_curldebug="no" + fi + if test ! -f "$srcdir/../include/curl/curlbuild.h.dist"; then + AC_MSG_WARN([source not embedded in curl's CVS tree.]) + supports_curldebug="no" + elif test ! -f "$srcdir/../include/curl/Makefile.in"; then + AC_MSG_WARN([curl's buildconf has not been run.]) + supports_curldebug="no" + elif test ! -f "$cares_builddir/../libcurl.pc" || + test ! -f "$cares_builddir/../include/curl/curlbuild.h"; then + AC_MSG_WARN([curl's configure has not been run.]) + supports_curldebug="no" + elif test ! -f "$cares_builddir/../lib/config.h"; then + AC_MSG_WARN([libcurl's config.h is missing.]) + supports_curldebug="no" + elif test ! -f "$cares_builddir/../config.status"; then + AC_MSG_WARN([curl's config.status is missing.]) + supports_curldebug="no" + fi + if test "$supports_curldebug" != "no"; then + grep '^#define USE_ARES' "$cares_builddir/../lib/config.h" >/dev/null + if test "$?" -ne "0"; then + AC_MSG_WARN([libcurl configured without c-ares support.]) + supports_curldebug="no" + fi + fi + if test "$supports_curldebug" != "no"; then + grep 'CPPFLAGS.*CURLDEBUG' "$cares_builddir/../config.status" >/dev/null + if test "$?" -ne "0"; then + AC_MSG_WARN([libcurl configured without curldebug support.]) + supports_curldebug="no" + fi + fi + fi + fi # - if test "$want_debug" = "yes"; then - - dnl when doing the debug stuff, use static library only - AC_DISABLE_SHARED - - debugbuild="yes" - - dnl the entire --enable-debug is a hack that lives and runs on top of - dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier + if test "$want_curldebug" = "yes"; then + AC_MSG_CHECKING([if curl debug memory tracking can be enabled]) + test "$supports_curldebug" = "no" || supports_curldebug="yes" + AC_MSG_RESULT([$supports_curldebug]) + if test "$supports_curldebug" = "no"; then + AC_MSG_WARN([cannot enable curl debug memory tracking.]) + want_curldebug="no" + fi + fi + # + if test "$want_curldebug" = "yes"; then AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl]) - CPPFLAGS="$CPPFLAGS -DCURLDEBUG" - - dnl CHECKME: Do we still need so specify this include path here? - CPPFLAGS="$CPPFLAGS -I$srcdir/../include" - squeeze CPPFLAGS fi - # ]) diff --git a/ares/m4/cares-confopts.m4 b/ares/m4/cares-confopts.m4 index c34197a48..d265a4d18 100644 --- a/ares/m4/cares-confopts.m4 +++ b/ares/m4/cares-confopts.m4 @@ -1,7 +1,7 @@ #*************************************************************************** # $Id$ # -# Copyright (C) 2008 by Daniel Stenberg et al +# Copyright (C) 2008 - 2009 by Daniel Stenberg et al # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided @@ -16,7 +16,46 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 3 +# serial 4 + + +dnl CARES_CHECK_OPTION_CURLDEBUG +dnl ------------------------------------------------- +dnl Verify if configure has been invoked with option +dnl --enable-curldebug or --disable-curldebug, and set +dnl shell variable want_curldebug value as appropriate. + +AC_DEFUN([CARES_CHECK_OPTION_CURLDEBUG], [ + AC_BEFORE([$0],[CARES_CHECK_CURLDEBUG])dnl + AC_MSG_CHECKING([whether to enable curl debug memory tracking requested]) + OPT_CURLDEBUG_BUILD="default" + AC_ARG_ENABLE(curldebug, +AC_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking]) +AC_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]), + OPT_CURLDEBUG_BUILD=$enableval) + case "$OPT_CURLDEBUG_BUILD" in + no) + dnl --disable-curldebug option used + want_curldebug="no" + ;; + default) + dnl configure option not specified + want_curldebug="no" + ;; + *) + dnl --enable-curldebug option used. + dnl The use of this option value is a request to enable curl's + dnl debug memory tracking for the c-ares library. This is a big + dnl hack that can only be done when a whole bunch of requisites + dnl are simultaneously satisfied. Later on, these requisites are + dnl verified and if they are not fully satisfied the option will + dnl be ignored and act as if --disable-curldebug had been given + dnl setting shell variable want_curldebug to 'no'. + want_curldebug="yes" + ;; + esac + AC_MSG_RESULT([$want_curldebug]) +]) dnl CARES_CHECK_OPTION_DEBUG @@ -28,6 +67,7 @@ dnl variable want_debug value as appropriate. AC_DEFUN([CARES_CHECK_OPTION_DEBUG], [ AC_BEFORE([$0],[CARES_CHECK_OPTION_WARNINGS])dnl AC_BEFORE([$0],[CARES_CHECK_PROG_CC])dnl + AC_BEFORE([$0],[CARES_CHECK_CURLDEBUG])dnl AC_MSG_CHECKING([whether to enable debug build options]) OPT_DEBUG_BUILD="default" AC_ARG_ENABLE(debug, |