Subject: Re: bagder: curl/ares CHANGES,1.102,1.103 configure.ac,1.78,1.79 (fwd)

Re: bagder: curl/ares CHANGES,1.102,1.103 configure.ac,1.78,1.79 (fwd)

From: Doug Goldstein <cardoe_at_gentoo.org>
Date: Thu, 08 May 2008 16:46:06 -0400

Daniel Stenberg wrote:
> Hey
>
> It would be cool if you joined the mailing list and provide some
> feedback/thoughts, as it seems your patch broke things...
>
Since I wasn't on the ML at the time of this e-mail being sent.

AC_PROG_CC_STDC
AM_PROG_CC_C_O

I'll address them in order.

Essentially, AC_PROG_CC_STDC will attempt to use a C standard C99
following by C89 (well gnu99 on gcc). AC_PROG_CC simply ensures that a
K&R compiler is available. Not a compiler that is ANSI compliant. Now
days this macro is merely used to enable C99 mode of compiler.
Considering that c-ares code is not in K&R and conforms to C standards,
it's reasonably safe to assume that this macro should be used.

Now the reason why it would give you warnings when building with icc
10.1 is simple. icc 10.1 is the latest Intel C Compiler available at
this current time. However, you're using an old autotools chain
(autoconf, automake, libtool, m4, etc) on your system that is not aware
of options flag changes in the latest version of icc.

AM_PROG_CC_C_O is a flag that's warned about by newer automake's (1.10.1
and higher). Basically, not all compilers allow -c and -o to be used
together, this macro merely tests for this support in your compiler and
will build things differently if this support is not available. The
assumption that -c and -o are allowed is not a safe assumption.

Here's a random sample of c-ares compiling without the patch (basically
a raw 1.5.1 tarball)

/bin/sh ./libtool --tag=CC --mode=compile gcc -std=gnu99
-DHAVE_CONFIG_H -I. -O0 -g -MT ares_expand_string.lo -MD -MP -MF
.deps/ares_expand_string.Tpo -c -o ares_expand_string.lo
ares_expand_string.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -O0 -g -MT
ares_expand_string.lo -MD -MP -MF .deps/ares_expand_string.Tpo -c
ares_expand_string.c -fPIC -DPIC -o ares_expand_string.o

As you can see, the c-ares build uses -c and -o together and as such
automake will be cranky about this.

I tried to be as unobstrusive as possible with my patches while cleaning
up the major warnings I was getting with the latest set of autotools.

autoconf does include a tool called autoupdate which will automatically
replace all the deprecated usage with the updated syntax. For reference
the patch that autoupdate generates is attached.

Index: configure.ac
===================================================================
--- configure.ac (revision 13581)
+++ configure.ac (working copy)
@@ -1,7 +1,7 @@
 AC_INIT([c-ares],[1.5.1],[daniel_at_haxx.se])
-AC_PREREQ(2.57)
+AC_PREREQ(2.62)
 AC_CONFIG_SRCDIR([ares_ipv6.h])
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE
 
@@ -26,8 +26,11 @@
 esac
 
 dnl support building of Windows DLLs
-AC_LIBTOOL_WIN32_DLL
+AC_REQUIRE([AC_CANONICAL_HOST])_LT_SET_OPTION([LT_INIT],[win32-dll])
+AC_DIAGNOSE([obsolete],[AC_LIBTOOL_WIN32_DLL: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
 
+
 dnl ************************************************************
 dnl Option to switch on debug options. This makes an assumption that
 dnl this is built as an 'ares' subdir in the curl source tree. Subject for
@@ -35,8 +38,8 @@
 dnl
 AC_MSG_CHECKING([whether to enable debug options])
 AC_ARG_ENABLE(debug,
-AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
-AC_HELP_STRING([--disable-debug],[Disable debug options]),
+AS_HELP_STRING([--enable-debug],[Enable pedantic debug options])
+AS_HELP_STRING([--disable-debug],[Disable debug options]),
 [ case "$enableval" in
   no)
        AC_MSG_RESULT(no)
@@ -78,10 +81,10 @@
 m4_defun([AC_PROG_F77],[])
 
 dnl skip libtool C++ and Fortran linker checks
-m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
-m4_defun([AC_LIBTOOL_CXX],[])
-m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
-m4_defun([AC_LIBTOOL_F77],[])
+m4_ifdef([LT_LANG([C++])], [m4_undefine([LT_LANG([C++])])])
+m4_defun([LT_LANG([C++])],[])
+m4_ifdef([LT_LANG([Fortran 77])], [m4_undefine([LT_LANG([Fortran 77])])])
+m4_defun([LT_LANG([Fortran 77])],[])
 
 dnl force libtool to build static libraries with PIC on AMD64-linux
 AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
@@ -96,7 +99,7 @@
 esac
 
 dnl libtool setup
-AC_PROG_LIBTOOL
+LT_INIT
 
 AC_MSG_CHECKING([if we need -no-undefined])
 case $host in
@@ -184,16 +187,13 @@
   AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
   my_ac_save_LIBS=$LIBS
   LIBS="-lnsl -lsocket $LIBS"
- AC_TRY_LINK( ,
- [gethostbyname();],
- [ dnl found it!
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[gethostbyname();]])],[ dnl found it!
              HAVE_GETHOSTBYNAME="1"
- AC_MSG_RESULT([yes])],
- [ dnl failed!
+ AC_MSG_RESULT([yes])],[ dnl failed!
              AC_MSG_RESULT([no])
              dnl restore LIBS
- LIBS=$my_ac_save_LIBS]
- )
+ LIBS=$my_ac_save_LIBS
+ ])
 fi
 
 if test "$HAVE_GETHOSTBYNAME" != "1"
@@ -202,31 +202,25 @@
   AC_MSG_CHECKING([for gethostbyname in ws2_32])
   my_ac_save_LIBS=$LIBS
   LIBS="-lws2_32 $LIBS"
- AC_TRY_LINK([#include <winsock2.h>],
- [gethostbyname("www.dummysite.com");],
- [ dnl worked!
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]], [[gethostbyname("www.dummysite.com");]])],[ dnl worked!
                ws2="yes"
                AC_MSG_RESULT([yes])
- HAVE_GETHOSTBYNAME="1"],
- [ dnl failed, restore LIBS
+ HAVE_GETHOSTBYNAME="1"],[ dnl failed, restore LIBS
                LIBS=$my_ac_save_LIBS
- AC_MSG_RESULT(no)]
- )
+ AC_MSG_RESULT(no)
+ ])
 fi
 
 if test "$HAVE_GETHOSTBYNAME" != "1"
 then
   dnl This is for eCos with a stubbed DNS implementation
   AC_MSG_CHECKING([for gethostbyname for eCos])
- AC_TRY_LINK([
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <stdio.h>
-#include <netdb.h>],
- [gethostbyname("www.dummysite.com");],
- [ dnl worked!
+#include <netdb.h>]], [[gethostbyname("www.dummysite.com");]])],[ dnl worked!
                AC_MSG_RESULT([yes])
- HAVE_GETHOSTBYNAME="1"],
- AC_MSG_RESULT(no)
- )
+ HAVE_GETHOSTBYNAME="1"],[AC_MSG_RESULT(no)
+ ])
 fi
 
 if test "$HAVE_GETHOSTBYNAME" != "1"
@@ -263,7 +257,7 @@
 
 AC_MSG_CHECKING([whether to use libgcc])
 AC_ARG_ENABLE(libgcc,
-AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
+AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
 [ case "$enableval" in
   yes)
         LIBS="$LIBS -lgcc"
@@ -295,8 +289,8 @@
 )
 
 AC_ARG_ENABLE(thread,dnl
-AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
-AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
+AS_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
+AS_HELP_STRING([--enable-thread],[look for thread-safe functions]),
 [ case "$enableval" in
   no)
     OPT_THREAD=off
@@ -646,14 +640,11 @@
 dnl if not found, $ac_func is the name we check for
 func="$ac_func"
 AC_MSG_CHECKING([deeper for $func])
-AC_TRY_LINK( [],
- [ $func ();],
- AC_MSG_RESULT(yes!)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ $func ();]])],[AC_MSG_RESULT(yes!)
              eval "ac_cv_func_$func=yes"
              def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
- AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
- AC_MSG_RESULT(but still no)
- )
+ AC_DEFINE_UNQUOTED($def, 1, If you have $func)],[AC_MSG_RESULT(but still no)
+ ])
 )
 
 
@@ -662,8 +653,7 @@
 dnl Some systems have it, but not IPv6
 if test "$ac_cv_func_inet_pton" = "yes" ; then
 AC_MSG_CHECKING(if inet_pton supports IPv6)
-AC_TRY_RUN(
- [
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -681,18 +671,17 @@
     else
       exit(0);
   }
- ], [
+ ]])],[
        AC_MSG_RESULT(yes)
        AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
- ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
+ ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
 fi
 dnl Check for inet_net_pton
 AC_CHECK_FUNCS(inet_net_pton)
 dnl Again, some systems have it, but not IPv6
 if test "$ac_cv_func_inet_net_pton" = "yes" ; then
 AC_MSG_CHECKING(if inet_net_pton supports IPv6)
-AC_TRY_RUN(
- [
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -710,10 +699,10 @@
     else
       exit(0);
   }
- ], [
+ ]])],[
        AC_MSG_RESULT(yes)
        AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
- ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
+ ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
 fi
 
 
@@ -722,8 +711,7 @@
 dnl Again, some systems have it, but not IPv6
 if test "$ac_cv_func_inet_ntop" = "yes" ; then
 AC_MSG_CHECKING(if inet_ntop supports IPv6)
-AC_TRY_RUN(
- [
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -743,11 +731,11 @@
     else
       exit(0);
   }
- ], [
+ ]])],[
        AC_MSG_RESULT(yes)
        AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,
           [Define to 1 if inet_ntop supports IPv6.])
- ], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
+ ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
 fi
 
 AC_CHECK_SIZEOF(struct in6_addr, ,
@@ -827,8 +815,7 @@
 
 dnl Check for user-specified random device
 AC_ARG_WITH(random,
-AC_HELP_STRING([--with-random=FILE],
- [read randomness from FILE (default=/dev/urandom)]),
+AS_HELP_STRING([--with-random=FILE],[read randomness from FILE (default=/dev/urandom)]),
     [ RANDOM_FILE="$withval" ],
     [
         dnl Check for random device
Received on 2008-05-08