Only look for a system getaddrinfo/getnameinfo if AI_PASSIVE is defined
authorDavid Dykstra <dwd@samba.org>
Mon, 20 Jan 2003 15:04:16 +0000 (15:04 +0000)
committerDavid Dykstra <dwd@samba.org>
Mon, 20 Jan 2003 15:04:16 +0000 (15:04 +0000)
by system headers.  This fixes compile errors on Irix 6.5.

configure.in

index 59cb99d..72a4781 100644 (file)
@@ -327,20 +327,35 @@ dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
 AC_CHECK_FUNCS(inet_ntop, , AC_LIBOBJ(lib/inet_ntop)) 
 AC_CHECK_FUNCS(inet_pton, , AC_LIBOBJ(lib/inet_pton))
 
-# Tru64 UNIX has getaddrinfo() but has it renamed in libc as
-# something else so we must include <netdb.h> to get the
-# redefinition.
-AC_CHECK_FUNCS(getaddrinfo, ,
-       [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
-       AC_TRY_LINK([#include <sys/types.h>
-       #include <sys/socket.h>
-       #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
-               [AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_GETADDRINFO, 1,
-                       [Define if you have the `getaddrinfo' function.])],
-               [AC_MSG_RESULT([no])
-               AC_LIBOBJ(lib/getaddrinfo)])])
-AC_CHECK_FUNCS(getnameinfo, , AC_LIBOBJ(lib/getnameinfo))
+# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
+#   builtin getaddrinfo if one of the defines don't exist
+AC_MSG_CHECKING([whether defines needed by getaddrinfo exist])
+AC_EGREP_CPP(yes, [
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#ifdef AI_PASSIVE
+yes
+#endif], [
+       AC_MSG_RESULT(yes)
+       # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
+       # something else so we must include <netdb.h> to get the
+       # redefinition.
+       AC_CHECK_FUNCS(getaddrinfo, ,
+               [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
+               AC_TRY_LINK([#include <sys/types.h>
+               #include <sys/socket.h>
+               #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
+                       [AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_GETADDRINFO, 1,
+                               [Define if you have the `getaddrinfo' function.])],
+                       [AC_MSG_RESULT([no])
+                       AC_LIBOBJ(lib/getaddrinfo)])])
+       AC_CHECK_FUNCS(getnameinfo, , AC_LIBOBJ(lib/getnameinfo))
+       ],
+       AC_MSG_RESULT(no)
+       )
+
 
 AC_CHECK_MEMBER([struct sockaddr.sa_len], 
                [ AC_DEFINE(HAVE_SOCKADDR_LEN) ],