]> arthur.barton.de Git - ngircd.git/blobdiff - configure.ng
Check for working getaddrinfo() function
[ngircd.git] / configure.ng
index 16f970f8dc982d21d96e9f1bdf2de8deba1736f8..11482399cf46260f1d52c69a4ed1dd09ea17793f 100644 (file)
@@ -92,6 +92,35 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[
   fi
 ])
 
+AC_DEFUN([WORKING_GETADDRINFO],[
+       AC_CHECK_FUNCS([getaddrinfo],[
+               AC_MSG_CHECKING([whether getaddrinfo() works])
+               AC_TRY_RUN([
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+int
+main(int argc, char **argv)
+{
+       struct addrinfo hints, *ai;
+       memset(&hints, 0, sizeof(hints));
+       hints.ai_flags = AI_PASSIVE;
+       hints.ai_socktype = SOCK_STREAM;
+       hints.ai_family = PF_UNSPEC;
+       if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
+               return 1;
+       return 0;
+}
+               ],[
+               AC_DEFINE([HAVE_WORKING_GETADDRINFO], 1, [getaddrinfo(0)])
+               AC_MSG_RESULT(yes)
+               ],[
+               AC_MSG_RESULT(no)
+               ])
+       ])
+])
+
 if test "$GCC" = "yes"; then
        # We are using the GNU C compiler. Good!
        CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
@@ -186,10 +215,12 @@ AC_CHECK_FUNCS([ \
        AC_MSG_ERROR([required function missing!]))
 
 # Optional functions
-AC_CHECK_FUNCS_ONCE([ \
-       arc4random gai_strerror getaddrinfo getnameinfo inet_aton sigaction \
-       sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat strtok_r \
-       waitpid])
+AC_CHECK_FUNCS_ONCE([
+       arc4random arc4random_stir gai_strerror getnameinfo inet_aton \
+       sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \
+       strtok_r unsetenv waitpid])
+
+WORKING_GETADDRINFO
 
 # -- Configuration options --