bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

replacement getaddrinfo not working properly


From: Andrew J. Schorr
Subject: replacement getaddrinfo not working properly
Date: Thu, 5 Apr 2007 09:09:43 -0400
User-agent: Mutt/1.4.2.2i

Hi,

It seems that adding AC_USE_SYSTEM_EXTENSIONS to configure.ac
will always cause _POSIX_PTHREAD_SEMANTICS and _TANDEM_SOURCE to
be defined (at least that is the case for autoconf version 2.61 on my
linux FC6 host).  From /usr/share/autoconf/autoconf/specific.m4:

   # AC_USE_SYSTEM_EXTENSIONS
   # ------------------------
   # Enable extensions on systems that normally disable them,
   # typically due to standards-conformance issues.
   AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
   [
     AC_BEFORE([$0], [AC_COMPILE_IFELSE])
     AC_BEFORE([$0], [AC_RUN_IFELSE])

     AC_REQUIRE([AC_GNU_SOURCE])
     AC_REQUIRE([AC_AIX])
     AC_REQUIRE([AC_MINIX])

     AH_VERBATIM([__EXTENSIONS__],
   [/* Enable extensions on Solaris.  */
   #ifndef __EXTENSIONS__
   # undef __EXTENSIONS__
   #endif
   #ifndef _POSIX_PTHREAD_SEMANTICS
   # undef _POSIX_PTHREAD_SEMANTICS
   #endif
   #ifndef _TANDEM_SOURCE
   # undef _TANDEM_SOURCE
   #endif])
     AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
       [ac_cv_safe_to_define___extensions__],
       [AC_COMPILE_IFELSE(
          [AC_LANG_PROGRAM([
   #      define __EXTENSIONS__ 1
             AC_INCLUDES_DEFAULT])],
          [ac_cv_safe_to_define___extensions__=yes],
          [ac_cv_safe_to_define___extensions__=no])])
     test $ac_cv_safe_to_define___extensions__ = yes &&
       AC_DEFINE([__EXTENSIONS__])
     AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
     AC_DEFINE([_TANDEM_SOURCE])
   ])

As you can see, this defines _POSIX_PTHREAD_SEMANTICS and _TANDEM_SOURCE
unconditionally.

As a result, this logic in io.c to decide whether to include
missing_d/getaddrinfo.h is not working as intended:

   #ifdef _TANDEM_SOURCE
   #include <arpa/inet.h>
   #include <netdb.h>
   #else
   #ifdef HAVE_GETADDRINFO
   #include <netdb.h>
   #else
   #include "missing_d/getaddrinfo.h"
   #endif
   #endif

Because _TANDEM_SOURCE is defined, there is never any chance
of including missing_d/getaddrinfo.h.

This causes compilation errors on systems that do not supply getaddrinfo.

I'm not certain of the best fix.  Why is it necessary to test
for _TANDEM_SOURCE at all in this spot?  It seems that the only
difference is whether to include <arpa/inet.h>.  Couldn't configure.ac
just test whether this header file exists (and similarly for netdb.h),
and just include them unconditionally if they exist (without caring
about _TANDEM_SOURCE)?

Regards,
Andy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]