]> hydra-www.ietfng.org Git - gtetrinet/commitdiff
Rework configure checks.
authorJordi Mallach <jordi@sindominio.net>
Mon, 2 May 2011 10:17:05 +0000 (12:17 +0200)
committerJordi Mallach <jordi@sindominio.net>
Mon, 2 May 2011 10:17:05 +0000 (12:17 +0200)
Quote arguments and fix summary information when IPv6 or detaching is not enabled.
Change config.h USE_IPV6 variable to ENABLE_IPV6 and update code accordingly.

configure.ac
src/client.c

index baa9d6b3bcf81479fcb17f2d8412f6e7ceff3f47..a63511f3c6ba88cea53595f949cf8622e09aa9c2 100644 (file)
@@ -43,7 +43,7 @@ AM_GCONF_SOURCE_2
 # Check for pkg-config
 PKG_PROG_PKG_CONFIG([0.22])
 
-dnl Add debug flags if building from git.
+# Add debug flags if building from git.
 if test -d $srcdir/.git; then
        CFLAGS="-Wall -W -g3 -ggdb -O0"
        AC_SUBST(CFLAGS)
@@ -63,7 +63,7 @@ PKG_CHECK_MODULES(GTETRINET,[
 AC_SUBST(GTETRINET_CFLAGS)
 AC_SUBST(GTETRINET_LIBS)
 
-dnl Check for libesd
+# Check for libesd
 if pkg-config --exists esound ; then
        have_esound=yes
 else 
@@ -71,10 +71,10 @@ else
 fi
 
 if test "x$have_esound" = "xyes"; then
-AC_DEFINE(HAVE_ESD, 1, [Define this to enable EsounD support.])
-PKG_CHECK_MODULES(ESOUND, esound >= $LIBESD_OPTIONAL)
-AC_SUBST(ESOUND_CFLAGS)
-AC_SUBST(ESOUND_LIBS)
+       AC_DEFINE([HAVE_ESD],[1],[Define this to enable EsounD support.])
+       PKG_CHECK_MODULES([ESOUND],[esound >= $LIBESD_OPTIONAL])
+       AC_SUBST(ESOUND_CFLAGS)
+       AC_SUBST(ESOUND_LIBS)
 fi
 
 AM_CONDITIONAL(HAVE_ESOUND, test "x$have_esound" = "xyes")
@@ -95,18 +95,30 @@ if test $ac_cv_func_setenv = no; then
   AC_DEFINE(HAVE_SETENV, 1, [Define this if setenv() is available.])
  fi
 
-dnl configure options
+# configure options
+# Check for page detaching support
 AC_ARG_ENABLE(detach,
-[  --enable-detach         Enable page detaching (default=no)],
-  [if test "x$enable_detach" = "xyes"; then
-    AC_DEFINE(ENABLE_DETACH, 1, [Define this to enable page detaching.])
-  fi])
+       AS_HELP_STRING([--enable-detach],[Enable page detaching support (default=no)]),
+       enable_detach="yes")
+AC_MSG_CHECKING([if page detaching support should be built])
+if test "x$enable_detach" = "xyes"; then
+       AC_DEFINE([ENABLE_DETACH],[1],[Define this to enable page detaching.])
+else
+       enable_detach="no"
+fi
+AC_MSG_RESULT($enable_detach)
 
+# Check for IPv6
 AC_ARG_ENABLE(ipv6,
-[  --enable-ipv6           Enable IPv6 support (default=no)],
-  [if test "x$enable_ipv6" = "xyes"; then
-   AC_DEFINE(USE_IPV6, 1, [Define this to enable IPv6 support.])
-  fi])
+       AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support (default=no)]),
+        enable_ipv6="yes")
+AC_MSG_CHECKING([if IPv6 support should be built])
+if test "x$enable_ipv6" = "xyes"; then
+       AC_DEFINE([ENABLE_IPV6],[1],[Define this to enable IPv6 support.])
+else
+       enable_ipv6="no"
+fi
+AC_MSG_RESULT($enable_ipv6)
 
 # Generate files
 AC_CONFIG_FILES([
@@ -123,6 +135,7 @@ icons/Makefile
 AC_OUTPUT
 
 # Print configuration information
+echo
 echo "   Configuration result"
 echo "   ------------- ------"
 echo
index 7124bd07605f9342c2dd013023b766978b512ac6..6fe53af20f8864ea7171b9dd9360baacf28d1d22 100644 (file)
@@ -291,7 +291,7 @@ void client_process (void)
 
 gpointer client_resolv_hostname (void)
 {
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
     char hbuf[NI_MAXHOST];
     struct addrinfo hints, *res, *res0;
     struct sockaddr_in6 sa;
@@ -303,7 +303,7 @@ gpointer client_resolv_hostname (void)
 
     /* set up the connection */
 
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
     snprintf(service, 9, "%d", spectating?SPECPORT:PORT);
     memset(&hints, 0, sizeof(hints));
     hints.ai_family = AF_UNSPEC;
@@ -498,7 +498,7 @@ int client_readmsg (gchar **str)
 
 void server_ip (unsigned char buf[4])
 {
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
     struct sockaddr_in6 sin;
     struct sockaddr_in *sin4;
 #else
@@ -507,7 +507,7 @@ void server_ip (unsigned char buf[4])
     int len = sizeof(sin);
 
     getpeername (sock, (struct sockaddr *)&sin, &len);
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
     if (sin.sin6_family == AF_INET6) {
        memcpy (buf, ((char *) &sin.sin6_addr) + 12, 4);
     } else {