cvs: php-src(PHP_4_3) / configure.in

From: Date: Fri, 12 Mar 2004 00:16:39 +0000
Subject: cvs: php-src(PHP_4_3) / configure.in
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-26595@lists.php.net to get a copy of this message
pollita Thu Mar 11 19:16:39 2004 EDT Modified files: (Branch: PHP_4_3) /php-src configure.in Log: Test getaddrinfo() for brokenness. Pretend it doesn't exist if it misbehaves. http://cvs.php.net/diff.php/php-src/configure.in?r1=1.396.2.97&r2=1.396.2.98&ty=u Index: php-src/configure.in diff -u php-src/configure.in:1.396.2.97 php-src/configure.in:1.396.2.98 --- php-src/configure.in:1.396.2.97 Mon Feb 16 11:03:34 2004 +++ php-src/configure.in Thu Mar 11 19:16:38 2004 @@ -1,4 +1,4 @@ -dnl ## $Id: configure.in,v 1.396.2.97 2004/02/16 16:03:34 iliaa Exp $ -*- sh -*- +dnl ## $Id: configure.in,v 1.396.2.98 2004/03/12 00:16:38 pollita Exp $ -*- sh -*- dnl ## Process this file with autoconf to produce a configure script. divert(1) @@ -521,10 +521,45 @@ ) dnl Check for getaddrinfo, should be a better way, but... +dnl Also check for working getaddrinfo AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo, [AC_TRY_LINK([#include <netdb.h>], - [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);], - ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)]) + [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);], + AC_TRY_RUN([ +#include <netdb.h> +#include <sys/types.h> +int main(void) { + struct addrinfo *ai, *pai, hints; + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_NUMERICHOST; + + if (getaddrinfo("127.0.0.1", NULL, &hints, &ai) < 0) { + exit(1); + } + + if (ai == NULL) { + exit(1); + } + + pai = ai; + + while (pai) { + if (pai->ai_family != AF_INET) { + /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ + exit(1); + } + if (pai->ai_addr->sa_family != AF_INET) { + /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ + exit(1); + } + pai = pai->ai_next; + } + freeaddrinfo(ai); + exit(0); +} + ],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no), +ac_cv_func_getaddrinfo=no)]) if test "$ac_cv_func_getaddrinfo" = yes; then AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function]) fi

« previous php.cvs (#26595) next »