]> granicus.if.org Git - curl/commitdiff
added the better debug option logic from curl by adding acinclude.m4 to the
authorDaniel Stenberg <daniel@haxx.se>
Wed, 25 Feb 2004 14:32:39 +0000 (14:32 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 25 Feb 2004 14:32:39 +0000 (14:32 +0000)
configure stuff

ares/CHANGES
ares/FILES
ares/acinclude.m4 [new file with mode: 0644]
ares/aclocal.m4
ares/configure.ac

index be99f6867e373e8e4b6e72f42048ec835591317e..332369f47de49045204208292d1d59c74271c283 100644 (file)
@@ -1,6 +1,9 @@
 * February 25, 2004
 - Dan Fandrich found a flaw in the Feb 22 fix.
 
+- Added better configure --enable-debug logic (taken from the curl configure
+  script). Added acinclude.m4 to the tarball.
+
 * February 23, 2004
 - Removed ares_free_errmem(), the function, the file and the man page. It was
   not used and it did nothing.
index 72413ea6a7d311f8ce7a4d25811ffc3db13c5550..502fd02e2be7923f8de29bd343276546a4f86d4e 100644 (file)
@@ -8,6 +8,7 @@ CHANGES
 FILES
 maketgz
 aclocal.m4
+acinclude.m4
 Makefile.in
 install-sh
 mkinstalldirs
diff --git a/ares/acinclude.m4 b/ares/acinclude.m4
new file mode 100644 (file)
index 0000000..76ff0de
--- /dev/null
@@ -0,0 +1,100 @@
+
+dnl We create a function for detecting which compiler we use and then set as
+dnl pendantic compiler options as possible for that particular compiler. The
+dnl options are only used for debug-builds.
+
+dnl This is a copy of the original found in curl's configure script. Don't
+dnl modify this one, edit the one in curl and copy it back here when that one
+dnl is changed.
+
+AC_DEFUN([CURL_CC_DEBUG_OPTS],
+[
+    if test "$GCC" = "yes"; then
+
+       dnl figure out gcc version!
+       AC_MSG_CHECKING([gcc version])
+       gccver=`$CC -dumpversion`
+       num1=`echo $gccver | cut -d . -f1`
+       num2=`echo $gccver | cut -d . -f2`
+       gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
+       AC_MSG_RESULT($gccver)
+
+       AC_MSG_CHECKING([if this is icc in disguise])
+       AC_EGREP_CPP([^__ICC], [__ICC],
+         dnl action if the text is found, this it has not been replaced by the
+         dnl cpp
+         [ICC="no"]
+         AC_MSG_RESULT([no]),
+         dnl the text was not found, it was replaced by the cpp
+         [ICC="yes"]
+         AC_MSG_RESULT([yes])
+       )
+
+       if test "$ICC" = "yes"; then
+         dnl this is icc, not gcc.
+
+         dnl Warning 279 warns on static conditions in while expressions,
+         dnl ignore that.
+
+         WARN="-wd279"
+
+         if test "$gccnum" -gt "600"; then
+            dnl icc 6.0 and older doesn't have the -Wall flag, although it does
+            dnl have -wd<n>
+            WARN="-Wall $WARN"
+         fi
+       else dnl $ICC = yes
+         dnl 
+         WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Winline -Wmissing-declarations -Wmissing-prototypes -Wsign-compare"
+
+         dnl -Wcast-align is a bit too annoying ;-)
+
+         if test "$gccnum" -ge "296"; then
+           dnl gcc 2.96 or later
+           WARN="$WARN -Wfloat-equal"
+
+           if test "$gccnum" -gt "296"; then
+             dnl this option does not exist in 2.96
+             WARN="$WARN -Wno-format-nonliteral"
+           fi
+
+           dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
+           dnl on i686-Linux as it gives us heaps with false positives
+           if test "$gccnum" -ge "303"; then
+             dnl gcc 3.3 and later
+             WARN="$WARN -Wendif-labels -Wstrict-prototypes"
+           fi
+         fi
+
+         for flag in $CPPFLAGS; do
+           case "$flag" in
+            -I*)
+              dnl include path
+              add=`echo $flag | sed 's/^-I/-isystem /g'`
+              WARN="$WARN $add"
+              ;;
+           esac
+         done
+
+       fi dnl $ICC = no
+
+       CFLAGS="$CFLAGS $WARN"
+
+    fi dnl $GCC = yes
+
+    dnl strip off optimizer flags
+    NEWFLAGS=""
+    for flag in $CFLAGS; do
+      case "$flag" in
+      -O*)
+        dnl echo "cut off $flag"
+        ;;
+      *)
+        NEWFLAGS="$NEWFLAGS $flag"
+        ;;
+      esac
+    done
+    CFLAGS=$NEWFLAGS
+
+]) dnl end of AC_DEFUN()
+
index 96fcd435b4f890324bb3cf3390d453d0ef77ba01..b3a3bbb081531d48bed47c841062952973b84f3a 100644 (file)
-dnl $Id$
+# generated automatically by aclocal 1.8.2 -*- Autoconf -*-
 
-dnl Copyright 1996 by the Massachusetts Institute of Technology.
-dnl
-dnl Permission to use, copy, modify, and distribute this
-dnl software and its documentation for any purpose and without
-dnl fee is hereby granted, provided that the above copyright
-dnl notice appear in all copies and that both that copyright
-dnl notice and this permission notice appear in supporting
-dnl documentation, and that the name of M.I.T. not be used in
-dnl advertising or publicity pertaining to distribution of the
-dnl software without specific, written prior permission.
-dnl M.I.T. makes no representations about the suitability of
-dnl this software for any purpose.  It is provided "as is"
-dnl without express or implied warranty.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
-dnl This file provides local macros for packages which use specific
-dnl external libraries.  The public macros are:
-dnl
-dnl    ATHENA_UTIL_COM_ERR
-dnl            Generates error if com_err not found.
-dnl    ATHENA_UTIL_SS
-dnl            Generates error if ss not found.
-dnl    ATHENA_REGEXP
-dnl            Sets REGEX_LIBS if rx library used; ensures POSIX
-dnl            regexp support.
-dnl    ATHENA_MOTIF
-dnl            Sets MOTIF_LIBS and defines HAVE_MOTIF if Motif used.
-dnl    ATHENA_MOTIF_REQUIRED
-dnl            Generates error if Motif not found.
-dnl    ATHENA_AFS
-dnl            Sets AFS_LIBS and defines HAVE_AFS if AFS used.  Pass
-dnl            in an argument giving the desired AFS libraries;
-dnl            AFS_LIBS will be set to that value if AFS is found.
-dnl            AFS_DIR will be set to the prefix given.
-dnl    ATHENA_AFS_REQUIRED
-dnl            Generates error if AFS libraries not found.  AFS_DIR
-dnl            will be set to the prefix given.
-dnl    ATHENA_KRB4
-dnl            Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
-dnl    ATHENA_KRB4_REQUIRED
-dnl            Generates error if krb4 not found.  Sets KRB4_LIBS
-dnl            otherwise.  (Special behavior because krb4 libraries
-dnl            may be different if using krb4 compatibility libraries
-dnl            from krb5.)
-dnl    ATHENA_KRB5
-dnl            Sets KRB5_LIBS and defines HAVE_KRB5 if krb5 used.
-dnl    ATHENA_KRB5_REQUIRED
-dnl            Generates error if krb5 not found.
-dnl    ATHENA_HESIOD
-dnl            Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
-dnl            used.
-dnl    ATHENA_HESIOD_REQUIRED
-dnl            Generates error if Hesiod not found.
-dnl    ATHENA_ARES
-dnl            Sets ARES_LIBS and defines HAVE_ARES if libares
-dnl            used.
-dnl    ATHENA_ARES_REQUIRED
-dnl            Generates error if libares not found.
-dnl    ATHENA_ZEPHYR
-dnl            Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
-dnl            used.
-dnl    ATHENA_ZEPHYR_REQUIRED
-dnl            Generates error if zephyr not found.
-dnl
-dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
-dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
-dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
-dnl is a com_err library in the AFS libraries which requires -lutil.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
 
-dnl ----- com_err -----
-
-AC_DEFUN(ATHENA_UTIL_COM_ERR,
-[AC_ARG_WITH(com_err,
-       [  --with-com_err=PREFIX   Specify location of com_err],
-       [com_err="$withval"], [com_err=yes])
-if test "$com_err" != no; then
-       if test "$com_err" != yes; then
-               CPPFLAGS="$CPPFLAGS -I$com_err/include"
-               LDFLAGS="$LDFLAGS -L$com_err/lib"
-       fi
-       AC_CHECK_LIB(com_err, com_err, :,
-                    [AC_MSG_ERROR(com_err library not found)])
-else
-       AC_MSG_ERROR(This package requires com_err.)
-fi])
-
-dnl ----- ss -----
-
-AC_DEFUN(ATHENA_UTIL_SS,
-[AC_ARG_WITH(ss,
-       [  --with-ss=PREFIX        Specify location of ss (requires com_err)],
-       [ss="$withval"], [ss=yes])
-if test "$ss" != no; then
-       if test "$ss" != yes; then
-               CPPFLAGS="$CPPFLAGS -I$ss/include"
-               LDFLAGS="$LDFLAGS -L$ss/lib"
-       fi
-       AC_CHECK_LIB(ss, ss_perror, :,
-                    [AC_MSG_ERROR(ss library not found)], -lcom_err)
-else
-       AC_MSG_ERROR(This package requires ss.)
-fi])
-
-dnl ----- Regular expressions -----
-
-AC_DEFUN(ATHENA_REGEXP,
-[AC_ARG_WITH(regex,
-       [  --with-regex=PREFIX     Use installed regex library],
-       [regex="$withval"], [regex=no])
-if test "$regex" != no; then
-       if test "$regex" != yes; then
-               CPPFLAGS="$CPPFLAGS -I$regex/include"
-               LDFLAGS="$LDFLAGS -L$regex/lib"
-       fi
-       AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
-                    [AC_MSG_ERROR(regex library not found)])
-else
-       AC_CHECK_FUNC(regcomp, :,
-                     [AC_MSG_ERROR(can't find POSIX regexp support)])
-fi
-AC_SUBST(REGEX_LIBS)])
-
-dnl ----- Motif -----
-
-AC_DEFUN(ATHENA_MOTIF_CHECK,
-[if test "$motif" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$motif/include"
-       LDFLAGS="$LDFLAGS -L$motif/lib"
-fi
-AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
-
-AC_DEFUN(ATHENA_MOTIF,
-[AC_ARG_WITH(motif,
-       [  --with-motif=PREFIX     Use Motif],
-       [motif="$withval"], [motif=no])
-if test "$motif" != no; then
-       ATHENA_MOTIF_CHECK
-       MOTIF_LIBS=-lXm
-       AC_DEFINE(HAVE_MOTIF)
-fi
-AC_SUBST(MOTIF_LIBS)])
-
-AC_DEFUN(ATHENA_MOTIF_REQUIRED,
-[AC_ARG_WITH(motif,
-       [  --with-motif=PREFIX     Specify location of Motif],
-       [motif="$withval"], [motif=yes])
-if test "$motif" != no; then
-       ATHENA_MOTIF_CHECK
-else
-       AC_MSG_ERROR(This package requires Motif.)
-fi])
-
-dnl ----- AFS -----
-
-AC_DEFUN(ATHENA_AFS_CHECK,
-[AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
-AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
-AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
-if test "$afs" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$afs/include"
-       LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
-fi
-AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
-            -lrx -llwp -lsys)
-AFS_DIR=$afs
-AC_SUBST(AFS_DIR)])
-
-dnl Specify desired AFS libraries as a parameter.
-AC_DEFUN(ATHENA_AFS,
-[AC_ARG_WITH(afs,
-       [  --with-afs=PREFIX       Use AFS libraries],
-       [afs="$withval"], [afs=no])
-if test "$afs" != no; then
-       ATHENA_AFS_CHECK
-       AFS_LIBS=$1
-       AC_DEFINE(HAVE_AFS)
-fi
-AC_SUBST(AFS_LIBS)])
-
-AC_DEFUN(ATHENA_AFS_REQUIRED,
-[AC_ARG_WITH(afs,
-       [  --with-afs=PREFIX       Specify location of AFS libraries],
-       [afs="$withval"], [afs=/usr/afsws])
-if test "$afs" != no; then
-       ATHENA_AFS_CHECK
-else
-       AC_MSG_ERROR(This package requires AFS libraries.)
-fi])
-
-dnl ----- Kerberos 4 -----
-
-AC_DEFUN(ATHENA_KRB4_CHECK,
-[AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
-AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
-AC_CHECK_LIB(gen, compile)
-if test "$krb4" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$krb4/include"
-       if test -d "$krb4/include/kerberosIV"; then
-               CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
-       fi
-       LDFLAGS="$LDFLAGS -L$krb4/lib"
-fi
-AC_CHECK_LIB(krb4, krb_rd_req,
-            [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
-            [AC_CHECK_LIB(krb, krb_rd_req,
-                          [KRB4_LIBS="-lkrb -ldes"],
-                          [AC_MSG_ERROR(Kerberos 4 libraries not found)],
-                          -ldes)],
-            -ldes425 -lkrb5 -lk5crypto -lcom_err)])
-
-AC_DEFUN(ATHENA_KRB4,
-[AC_ARG_WITH(krb4,
-       [  --with-krb4=PREFIX      Use Kerberos 4],
-       [krb4="$withval"], [krb4=no])
-if test "$krb4" != no; then
-       ATHENA_KRB4_CHECK
-       AC_DEFINE(HAVE_KRB4)
-fi
-AC_SUBST(KRB4_LIBS)])
-
-AC_DEFUN(ATHENA_KRB4_REQUIRED,
-[AC_ARG_WITH(krb4,
-       [  --with-krb4=PREFIX      Specify location of Kerberos 4],
-       [krb4="$withval"], [krb4=yes])
-if test "$krb4" != no; then
-       ATHENA_KRB4_CHECK
-       AC_SUBST(KRB4_LIBS)
-else
-       AC_MSG_ERROR(This package requires Kerberos 4.)
-fi])
-
-dnl ----- Kerberos 5 -----
-
-AC_DEFUN(ATHENA_KRB5_CHECK,
-[AC_SEARCH_LIBS(gethostbyname, nsl)
-AC_SEARCH_LIBS(socket, socket)
-AC_CHECK_LIB(gen, compile)
-if test "$krb5" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$krb5/include"
-       LDFLAGS="$LDFLAGS -L$krb5/lib"
-fi
-AC_CHECK_LIB(krb5, krb5_init_context, :,
-            [AC_MSG_ERROR(Kerberos 5 libraries not found)],
-            -lk5crypto -lcom_err)])
-
-AC_DEFUN(ATHENA_KRB5,
-[AC_ARG_WITH(krb5,
-       [  --with-krb5=PREFIX      Use Kerberos 5],
-       [krb5="$withval"], [krb5=no])
-if test "$krb5" != no; then
-       ATHENA_KRB5_CHECK
-       KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
-       AC_DEFINE(HAVE_KRB5)
-fi
-AC_SUBST(KRB5_LIBS)])
-
-AC_DEFUN(ATHENA_KRB5_REQUIRED,
-[AC_ARG_WITH(krb5,
-       [  --with-krb5=PREFIX      Specify location of Kerberos 5],
-       [krb5="$withval"], [krb5=yes])
-if test "$krb5" != no; then
-       ATHENA_KRB5_CHECK
-else
-       AC_MSG_ERROR(This package requires Kerberos 5.)
-fi])
-
-dnl ----- Hesiod -----
-
-AC_DEFUN(ATHENA_HESIOD_CHECK,
-[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
-if test "$hesiod" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$hesiod/include"
-       LDFLAGS="$LDFLAGS -L$hesiod/lib"
-fi
-AC_CHECK_LIB(hesiod, hes_resolve, :,
-            [AC_MSG_ERROR(Hesiod library not found)])])
-
-AC_DEFUN(ATHENA_HESIOD,
-[AC_ARG_WITH(hesiod,
-       [  --with-hesiod=PREFIX    Use Hesiod],
-       [hesiod="$withval"], [hesiod=no])
-if test "$hesiod" != no; then
-       ATHENA_HESIOD_CHECK
-       HESIOD_LIBS="-lhesiod"
-       AC_DEFINE(HAVE_HESIOD)
-fi
-AC_SUBST(HESIOD_LIBS)])
-
-AC_DEFUN(ATHENA_HESIOD_REQUIRED,
-[AC_ARG_WITH(hesiod,
-       [  --with-hesiod=PREFIX    Specify location of Hesiod],
-       [hesiod="$withval"], [hesiod=yes])
-if test "$hesiod" != no; then
-       ATHENA_HESIOD_CHECK
-else
-       AC_MSG_ERROR(This package requires Hesiod.)
-fi])
-
-dnl ----- libares -----
-
-AC_DEFUN(ATHENA_ARES_CHECK,
-[AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
-if test "$ares" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$ares/include"
-       LDFLAGS="$LDFLAGS -L$ares/lib"
-fi
-AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
-
-AC_DEFUN(ATHENA_ARES,
-[AC_ARG_WITH(ares,
-       [  --with-ares=PREFIX      Use libares],
-       [ares="$withval"], [ares=no])
-if test "$ares" != no; then
-       ATHENA_ARES_CHECK
-       ARES_LIBS="-lares"
-       AC_DEFINE(HAVE_ARES)
-fi
-AC_SUBST(ARES_LIBS)])
-
-AC_DEFUN(ATHENA_ARES_REQUIRED,
-[AC_ARG_WITH(ares,
-       [  --with-ares=PREFIX      Specify location of libares],
-       [ares="$withval"], [ares=yes])
-if test "$ares" != no; then
-       ATHENA_ARES_CHECK
-else
-       AC_MSG_ERROR(This package requires libares.)
-fi])
-dnl ----- zephyr -----
-
-AC_DEFUN(ATHENA_ZEPHYR_CHECK,
-[if test "$zephyr" != yes; then
-       CPPFLAGS="$CPPFLAGS -I$zephyr/include"
-       LDFLAGS="$LDFLAGS -L$zephyr/lib"
-fi
-AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
-
-AC_DEFUN(ATHENA_ZEPHYR,
-[AC_ARG_WITH(zephyr,
-       [  --with-zephyr=PREFIX      Use zephyr],
-       [zephyr="$withval"], [zephyr=no])
-if test "$zephyr" != no; then
-       ATHENA_ZEPHYR_CHECK
-       ZEPHYR_LIBS="-lzephyr"
-       AC_DEFINE(HAVE_ZEPHYR)
-fi
-AC_SUBST(ZEPHYR_LIBS)])
-
-AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
-[AC_ARG_WITH(zephyr,
-       [  --with-zephyr=PREFIX      Specify location of zephyr],
-       [zephyr="$withval"], [zephyr=yes])
-if test "$zephyr" != no; then
-       ATHENA_ZEPHYR_CHECK
-else
-       AC_MSG_ERROR(This package requires zephyr.)
-fi])
+m4_include([acinclude.m4])
index 1bb474bfb490ee83cac3da2abfa0472cf5fc73b3..6d820810744aedda425c871c1138b3241b72b0d5 100644 (file)
@@ -35,35 +35,22 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
 
     CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I../include"
     CFLAGS="$CFLAGS -g" 
-    if test "$GCC" = "yes"; then
-       dnl these work for gcc 2.95
-       CFLAGS="$CFLAGS -W -Wall -Wwrite-strings -pedantic -Wundef -Wpointer-arith -Wnested-externs -Wcast-align -Winline -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -Wshadow -Wsign-compare"
-       dnl 2.96 or higher: -Wfloat-equal -Wunreachable-code
-    fi
-    dnl strip off optimizer flags
-    NEWFLAGS=""
-    for flag in $CFLAGS; do
-      case "$flag" in
-      -O*)
-        dnl echo "cut off $flag"
-        ;;
-      *)
-        NEWFLAGS="$NEWFLAGS $flag"
-        ;;
-      esac
-    done
-    CFLAGS=$NEWFLAGS
+
+    dnl set compiler "debug" options to become more picky, and remove
+    dnl optimize options from CFLAGS
+    CURL_CC_DEBUG_OPTS
+
        ;;
   esac ],
        AC_MSG_RESULT(no)
 )
 
 dnl check for a few basic system headers we need
-AC_CHECK_HEADERS(
-        sys/types.h \
-        sys/time.h \
-        sys/select.h \
-        sys/socket.h \
-        )
+dnl AC_CHECK_HEADERS(
+dnl        sys/types.h \
+dnl        sys/time.h \
+dnl        sys/select.h \
+dnl        sys/socket.h \
+dnl        )
 
 AC_OUTPUT(Makefile)