changeset 14984:2a2292579cf1

getaddrinfo: Move AC_LIBOBJ invocations to module description. * m4/getaddrinfo.m4 (gl_GETADDRINFO): Set HAVE_GETADDRINFO, Move AC_LIBOBJ invocations from here... * modules/getaddrinfo (configure.ac): ... to here. (Depends-on): Add conditions.
author Bruno Haible <bruno@clisp.org>
date Mon, 09 May 2011 00:20:21 +0200
parents 9ee1592da97c
children 48ead8d2c5c1
files ChangeLog m4/getaddrinfo.m4 modules/getaddrinfo
diffstat 3 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-08  Bruno Haible  <bruno@clisp.org>
+
+	getaddrinfo: Move AC_LIBOBJ invocations to module description.
+	* m4/getaddrinfo.m4 (gl_GETADDRINFO): Set HAVE_GETADDRINFO, Move
+	AC_LIBOBJ invocations from here...
+	* modules/getaddrinfo (configure.ac): ... to here.
+	(Depends-on): Add conditions.
+
 2011-05-08  Bruno Haible  <bruno@clisp.org>
 
 	inet_pton. getaddrinfo: Respect rules for use of AC_LIBOBJ.
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 25
+# getaddrinfo.m4 serial 26
 dnl Copyright (C) 2004-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,6 +24,7 @@
      fi])
   LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
 
+  HAVE_GETADDRINFO=1
   AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
@@ -55,7 +56,7 @@
       GETADDRINFO_LIB="-lws2_32"
       LIBS="$gai_saved_LIBS $GETADDRINFO_LIB"
     else
-      AC_LIBOBJ([getaddrinfo])
+      HAVE_GETADDRINFO=0
     fi
   fi
 
@@ -75,9 +76,7 @@
 #endif
 #include <stddef.h>
 ]])
-  if test $ac_cv_have_decl_gai_strerror = no; then
-    AC_LIBOBJ([gai_strerror])
-  else
+  if test $ac_cv_have_decl_gai_strerror = yes; then
     dnl check for correct signature
     AC_CACHE_CHECK([for gai_strerror with POSIX signature],
      [gl_cv_func_gai_strerror_posix_signature], [
@@ -98,7 +97,6 @@
         [gl_cv_func_gai_strerror_posix_signature=no])])
     if test $gl_cv_func_gai_strerror_posix_signature = no; then
       REPLACE_GAI_STRERROR=1
-      AC_LIBOBJ([gai_strerror])
     fi
   fi
 
--- a/modules/getaddrinfo
+++ b/modules/getaddrinfo
@@ -7,20 +7,26 @@
 m4/getaddrinfo.m4
 
 Depends-on:
-extensions
-gettext-h
-inet_ntop
-snprintf
-stdbool
+netdb
 sys_socket
-netdb
-strdup
-servent
-hostent
-sockets
+extensions
+gettext-h       [test $HAVE_GETADDRINFO = 0 || test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1]
+inet_ntop       [test $HAVE_GETADDRINFO = 0]
+snprintf        [test $HAVE_GETADDRINFO = 0]
+stdbool         [test $HAVE_GETADDRINFO = 0]
+strdup          [test $HAVE_GETADDRINFO = 0]
+servent         [test $HAVE_GETADDRINFO = 0]
+hostent         [test $HAVE_GETADDRINFO = 0]
+sockets         [test $HAVE_GETADDRINFO = 0]
 
 configure.ac:
 gl_GETADDRINFO
+if test $HAVE_GETADDRINFO = 0; then
+  AC_LIBOBJ([getaddrinfo])
+fi
+if test $HAVE_DECL_GAI_STRERROR = 0 || test $REPLACE_GAI_STRERROR = 1; then
+  AC_LIBOBJ([gai_strerror])
+fi
 gl_NETDB_MODULE_INDICATOR([getaddrinfo])
 
 Makefile.am: