diff options
author | Yang Tse <yangsita@gmail.com> | 2009-06-09 17:59:28 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2009-06-09 17:59:28 +0000 |
commit | 065047dc62cba3efde597fa5420d112fc2f4c500 (patch) | |
tree | a6df8c37d2ed3605a81acfe7b2c3645778aa610c | |
parent | eba8d6d5f5be7a6a410b90903fb3965a46c5b86d (diff) |
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.
-rw-r--r-- | configure.ac | 24 | ||||
-rw-r--r-- | m4/curl-compilers.m4 | 82 | ||||
-rw-r--r-- | m4/curl-confopts.m4 | 56 |
3 files changed, 134 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac index 049df2439..1b4523302 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ AM_MAINTAINER_MODE CURL_CHECK_OPTION_DEBUG CURL_CHECK_OPTION_OPTIMIZE CURL_CHECK_OPTION_WARNINGS +CURL_CHECK_OPTION_CURLDEBUG CURL_CHECK_PATH_SEPARATOR @@ -155,8 +156,6 @@ AC_SYS_LARGEFILE dnl support building of Windows DLLs AC_LIBTOOL_WIN32_DLL -CURL_PROCESS_DEBUG_BUILD_OPTS - 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 @@ -172,18 +171,6 @@ esac dnl libtool setup AC_PROG_LIBTOOL -AC_MSG_CHECKING([if we need -no-undefined]) -case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - need_no_undefined=yes - ;; - *) - need_no_undefined=no - ;; -esac -AC_MSG_RESULT($need_no_undefined) -AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes) - AC_MSG_CHECKING([if we need -mimpure-text]) mimpure=no case $host in @@ -270,6 +257,12 @@ esac CURL_CHECK_COMPILER_HALT_ON_ERROR CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE +CURL_CHECK_NO_UNDEFINED +AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes) + +CURL_CHECK_CURLDEBUG +AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes) + dnl ********************************************************************** dnl Compilation based checks should not be done before this point. dnl ********************************************************************** @@ -2520,7 +2513,8 @@ squeeze CURL_LIBS squeeze LIBCURL_LIBS squeeze TEST_SERVER_LIBS -if test "x$want_debug" = "xyes" && test "x$HAVE_ARES" = "x1"; then +if test "x$want_curldebug_assumed" = "xyes" && + test "x$want_curldebug" = "xyes" && test "x$HAVE_ARES" = "x1"; then ac_configure_args="$ac_configure_args --enable-curldebug" fi diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4 index 9a0c66bf8..2e55dc803 100644 --- a/m4/curl-compilers.m4 +++ b/m4/curl-compilers.m4 @@ -22,7 +22,7 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 51 +# serial 52 dnl CURL_CHECK_COMPILER @@ -1076,22 +1076,82 @@ squeeze() { ]) -dnl CURL_PROCESS_DEBUG_BUILD_OPTS +dnl CURL_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([CURL_PROCESS_DEBUG_BUILD_OPTS], [ - AC_REQUIRE([CURL_CHECK_OPTION_DEBUG])dnl +dnl Settings which depend on configure's curldebug given +dnl option, and other additional configure pre-requisites. +dnl Actually the curl debug memory tracking feature can +dnl only be used/enabled when libcurl is built as a static +dnl library or as a shared one on those systems on which +dnl shared libraries support undefined symbols. + +AC_DEFUN([CURL_CHECK_CURLDEBUG], [ AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl - AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl + 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" = "yes" && + test "$need_no_undefined" = "yes"; then + supports_curldebug="no" + AC_MSG_WARN([shared library does not support undefined symbols.]) + fi + fi + fi # - if test "$want_debug" = "yes"; then + 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 CPPFLAGS="$CPPFLAGS -DCURLDEBUG" squeeze CPPFLAGS fi - # + if test "$want_debug" = "yes"; then + CPPFLAGS="$CPPFLAGS -DDEBUGBUILD" + squeeze CPPFLAGS + fi +]) + + +dnl CURL_CHECK_NO_UNDEFINED +dnl ------------------------------------------------- +dnl Checks if the -no-undefined flag must be used when +dnl building shared libraries. This is required on all +dnl systems on which shared libraries should not have +dnl references to undefined symbols. This check should +dnl not be done before AC-PROG-LIBTOOL. + +AC_DEFUN([CURL_CHECK_NO_UNDEFINED], [ + AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl + AC_MSG_CHECKING([if shared libraries need -no-undefined]) + need_no_undefined="no" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc* | *-*-aix*) + need_no_undefined="yes" + ;; + esac + if test "x$allow_undefined" = "xno"; then + need_no_undefined="yes" + elif test "x$allow_undefined_flag" = "xunsupported"; then + need_no_undefined="yes" + fi + AC_MSG_RESULT($need_no_undefined) ]) diff --git a/m4/curl-confopts.m4 b/m4/curl-confopts.m4 index 5ad3e1830..621d2df91 100644 --- a/m4/curl-confopts.m4 +++ b/m4/curl-confopts.m4 @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -22,7 +22,58 @@ #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. -# serial 4 +# serial 5 + + +dnl CURL_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([CURL_CHECK_OPTION_CURLDEBUG], [ + AC_BEFORE([$0],[CURL_CHECK_CURLDEBUG])dnl + AC_MSG_CHECKING([whether to enable curl debug memory tracking]) + 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" + AC_MSG_RESULT([no]) + ;; + default) + dnl configure's curldebug option not specified. Initially we will + dnl handle this as a a request to use the same setting as option + dnl --enable-debug. IOW, initially, for debug-enabled builds + dnl this will be handled as a request to enable curldebug if + dnl possible, and for debug-disabled builds this will be handled + dnl as a request to disable curldebug. + if test "$want_debug" = "yes"; then + AC_MSG_RESULT([not specified (assuming yes)]) + else + AC_MSG_RESULT([no]) + fi + want_curldebug_assumed="yes" + want_curldebug="$want_debug" + ;; + *) + 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 libcurl library. This can only + dnl be done when some requisites are simultaneously satisfied. + dnl Later on, these requisites are verified and if they are not + dnl not fully satisfied the option will be ignored and act as if + dnl --disable-curldebug had been given setting shell variable + dnl want_curldebug to 'no'. + want_curldebug="yes" + AC_MSG_RESULT([yes]) + ;; + esac +]) dnl CURL_CHECK_OPTION_DEBUG @@ -33,6 +84,7 @@ dnl variable want_debug value as appropriate. AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [ AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl + AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl AC_BEFORE([$0],[CURL_CHECK_PROG_CC])dnl AC_MSG_CHECKING([whether to enable debug build options]) OPT_DEBUG_BUILD="default" |