summaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-05-26 14:50:45 +0000
committerYang Tse <yangsita@gmail.com>2009-05-26 14:50:45 +0000
commit675d6ec5e6d9dc51b0ff9ad28c0e901a7516e2ef (patch)
tree3a7b101eb836ac68c28a0de8b37e7256a39281f2 /ares
parent1ad43c54c0bb03fbb2313954a984bbbeb7110528 (diff)
downloadcurl-675d6ec5e6d9dc51b0ff9ad28c0e901a7516e2ef.tar.gz
c-ares's --enable-curldebug configure option decoupled from c-ares's --enable-debug
Diffstat (limited to 'ares')
-rw-r--r--ares/CHANGES6
-rw-r--r--ares/Makefile.am4
-rw-r--r--ares/RELEASE-NOTES1
-rw-r--r--ares/configure.ac10
-rw-r--r--ares/m4/cares-compilers.m4100
-rw-r--r--ares/m4/cares-confopts.m444
6 files changed, 133 insertions, 32 deletions
diff --git a/ares/CHANGES b/ares/CHANGES
index 45248ad3f..a095100bc 100644
--- a/ares/CHANGES
+++ b/ares/CHANGES
@@ -1,5 +1,11 @@
Changelog for the c-ares project
+* May 26 2009 (Yang Tse)
+- Added --enable-curldebug configure option to enable and disable building
+ with the low-level curl debug memory tracking 'feature' to allow decoupled
+ setting from --enable-debug, allowing again to build c-ares independently
+ out of the CVS tree.
+
* May 19 2009 (Yang Tse)
- Introduced ares_library_init() and ares_library_cleanup() functions.
diff --git a/ares/Makefile.am b/ares/Makefile.am
index 8dd89944c..2e26a3473 100644
--- a/ares/Makefile.am
+++ b/ares/Makefile.am
@@ -14,11 +14,13 @@ ACLOCAL_AMFLAGS = -I m4
# libcurl, but we do this anyway for convenience.
#
# $(top_builddir)/../include is for libcurl's generated curl/curlbuild.h file
+# $(top_srcdir)/../include is for libcurl's external include files
# $(top_builddir) is for c-ares's generated config.h file
# $(top_srcdir) is for c-ares's lib/setup.h and other "c-ares-private" files
if CURLDEBUG
INCLUDES = -I$(top_builddir)/../include \
+ -I$(top_srcdir)/../include \
-I$(top_builddir) \
-I$(top_srcdir)
else
@@ -33,7 +35,7 @@ man_MANS = $(MANPAGES)
MSVCFILES = vc/vc.dsw vc/acountry/acountry.dsp vc/adig/adig.dsp \
vc/ahost/ahost.dsp vc/areslib/areslib.dsp vc/areslib/areslib.dsw
-if DEBUGBUILD
+if CURLDEBUG
PROGS =
else
PROGS = ahost adig acountry
diff --git a/ares/RELEASE-NOTES b/ares/RELEASE-NOTES
index ec3d82f73..c1e23d641 100644
--- a/ares/RELEASE-NOTES
+++ b/ares/RELEASE-NOTES
@@ -8,6 +8,7 @@ Changed:
either AF_INET6 or AF_INET
o a build-time configured ares_socklen_t is now used instead of socklen_t
o new ares_library_init() and ares_library_cleanup() functions
+ o new --enable-curldebug configure option
Fixed:
diff --git a/ares/configure.ac b/ares/configure.ac
index c259e4e4f..e8dff99e7 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -13,6 +13,7 @@ AM_MAINTAINER_MODE
CARES_CHECK_OPTION_DEBUG
CARES_CHECK_OPTION_OPTIMIZE
CARES_CHECK_OPTION_WARNINGS
+CARES_CHECK_OPTION_CURLDEBUG
CARES_CHECK_PATH_SEPARATOR
@@ -94,11 +95,6 @@ esac
dnl support building of Windows DLLs
AC_LIBTOOL_WIN32_DLL
-CARES_PROCESS_DEBUG_BUILD_OPTS
-
-AM_CONDITIONAL(DEBUGBUILD, test x$want_debug = xyes)
-AM_CONDITIONAL(CURLDEBUG, test x$want_debug = xyes)
-
dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
case $host in
@@ -114,6 +110,10 @@ esac
dnl libtool setup
AC_PROG_LIBTOOL
+CARES_CHECK_CURLDEBUG
+
+AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
+
AC_MSG_CHECKING([if we need -no-undefined])
case $host in
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
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,