Author: cazfi
Date: Sat Dec 12 09:03:35 2015
New Revision: 30950

URL: http://svn.gna.org/viewcvs/freeciv?rev=30950&view=rev
Log:
Check availability of getaddrinfo() only once.

See patch #6664

Modified:
    branches/S2_6/configure.ac

Modified: branches/S2_6/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/configure.ac?rev=30950&r1=30949&r2=30950&view=diff
==============================================================================
--- branches/S2_6/configure.ac  (original)
+++ branches/S2_6/configure.ac  Sat Dec 12 09:03:35 2015
@@ -146,6 +146,9 @@
 esac], [server=yes])
 AM_CONDITIONAL(SERVER, test x$server = xyes)
 
+dnl Check getaddrinfo just once here, and remember the result
+AC_CHECK_FUNCS([getaddrinfo], [have_getaddrinfo=yes])
+
 dnl yes     - Support for IPv6 required
 dnl no      - Legacy IPv4 support
 dnl test    - Try to enable IPv6 support
@@ -156,12 +159,12 @@
   *)   AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
 esac], [ipv6=test])
 if test x$ipv6 != xno ; then
-  enable_ipv6=yes
-  dnl We check some functions (getaddrinfo) twice. Once unconditionally
-  dnl to get HAVE_xxx always correctly set. We need separate check here to
-  dnl correcly disable IPv6 when function is not available.
-  AC_CHECK_FUNCS([getaddrinfo inet_pton inet_ntop getnameinfo],
-[], [enable_ipv6=no])
+  if test "x$have_getaddrinfo" = "xyes" ; then
+    AC_CHECK_FUNCS([inet_pton inet_ntop getnameinfo],
+[enable_ipv6=yes], [enable_ipv6=no])
+  else
+     enable_ipv6=no
+  fi
   if test x$enable_ipv6 = xyes ; then
     AC_MSG_CHECKING([for AF_INET6])
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -1163,7 +1166,7 @@
 AC_CHECK_FUNCS([bind connect fileno flock ftime gethostbyname gethostname \
                getpwuid inet_aton select snooze strcasecmp strcasestr \
                strerror strlcat strlcpy strncasecmp strstr uname usleep \
-                getline _strcoll stricoll _stricoll strcasecoll getaddrinfo \
+                getline _strcoll stricoll _stricoll strcasecoll \
                 backtrace])
 
 AC_MSG_CHECKING(for working gettimeofday)


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to