Commit 675d6ec5 authored by Yang Tse's avatar Yang Tse
Browse files

c-ares's --enable-curldebug configure option decoupled from c-ares's --enable-debug

parent 1ad43c54
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
  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.

+3 −1
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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:

+5 −5
Original line number Diff line number Diff line
@@ -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*)
+76 −24
Original line number Diff line number Diff line
@@ -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
  #
  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
  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_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
  #
])


Loading