]> git.meshlink.io Git - catta/blobdiff - configure.ac
Fix compilation error caused by ACX_THREAD
[catta] / configure.ac
index 59255603f0872c7344aa66bf0fe38d284f0e602e..d5de5e1f77edd1427295dffa19a2962c1f8f33c8 100644 (file)
@@ -23,7 +23,7 @@ AC_INIT([catta],[0.1],[])
 AC_CONFIG_SRCDIR([src/server.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects])
 
 AC_SUBST(PACKAGE_URL, [http://github.com/everbase/catta/])
 
@@ -50,11 +50,30 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_PROG_GCC_TRADITIONAL
+AX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
 
 if test x"$ac_cv_prog_cc_c99" = x"no"; then
     AC_MSG_ERROR([C99 support is required])
 fi
 
+# Windows stuff
+AC_CHECK_DECL(_WIN32)
+AM_CONDITIONAL([WINDOWS], [ test "x$ac_cv_have_decl__WIN32" = "xyes" ])
+if test "x$ac_cv_have_decl__WIN32" = "xyes" ; then
+    CPPFLAGS="$CPPFLAGS -I`pwd`/src/compat/windows/include"
+fi
+AC_CHECK_MEMBER([struct in_pktinfo.ipi_spec_dst],
+    AC_DEFINE([HAVE_IPI_SPEC_DST], [], [struct in_pktinfo has ipi_spec_dst member]),
+    [],
+    [[#include <netinet/in.h>]])
+
+# iOS stuff
+AC_CHECK_DECL(__APPLE__)
+AM_CONDITIONAL([APPLE], [ test "x$ac_cv_have_decl___APPLE__" = "xyes" ])
+if test "x$ac_cv_have_decl___APPLE__" = "xyes" ; then
+    CPPFLAGS="$CPPFLAGS -I`pwd`/src/compat/ios/include"
+fi
+
 # -fstack-protector
 AC_ARG_ENABLE([stack-protector],
     [AS_HELP_STRING([--disable-stack-protector],
@@ -121,17 +140,10 @@ fi
 if test x"$enable_ssp" = x"yes"; then
     # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
     GCC_STACK_PROTECT_CC
-
-    AC_LANG_PUSH([C++])
-    GCC_STACK_PROTECT_CXX
-    AC_LANG_POP([C++])
-    # XXX: Update the enable_ssp value now for output later?
 fi
 
 # libtool stuff
-AC_PROG_LIBTOOL
-
-ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
+LT_INIT([win32-dll])
 
 #
 # Check for netlink.h
@@ -248,7 +260,13 @@ test_gcc_flag() {
 # If using GCC specify some additional parameters
 if test "x$GCC" = "xyes" ; then
 
-    DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -fdiagnostics-show-option -Wno-cast-qual -fno-strict-aliasing"
+    DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wold-style-definition -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wshadow -Wbad-function-cast -Wwrite-strings -fdiagnostics-show-option -fno-strict-aliasing"
+
+    # when compiling for MingW, -Wmissing-noreturn is triggered a bunch of
+    # times from autogenerated libtool wrappers, so leave it out on Windows.
+    if test "x$ac_cv_have_decl__WIN32" != "xyes" ; then
+        DESIRED_FLAGS="$DESIRED_FLAGS -Wmissing-noreturn"
+    fi
 
     for flag in $DESIRED_FLAGS ; do
         AC_MSG_CHECKING([whether $CC accepts $flag])
@@ -271,7 +289,7 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h sys/ioctl.h sys/socket.h sys/
 
 # Checks for library functions.
 AC_FUNC_SELECT_ARGTYPES
-AC_CHECK_FUNCS([gethostname select socket uname strcasecmp gettimeofday strncasecmp strlcpy])
+AC_CHECK_FUNCS([gethostname select socket uname strcasecmp gettimeofday strncasecmp strlcpy fcntl])
 
 AC_FUNC_CHOWN
 AC_FUNC_STAT
@@ -327,7 +345,6 @@ src/Makefile
 include/Makefile
 tests/Makefile
 examples/Makefile
-m4/Makefile
 ])
 AC_OUTPUT
 
@@ -335,14 +352,11 @@ AC_OUTPUT
 echo "
  ---{ $PACKAGE_NAME $VERSION }---
 
-    prefix:                                    ${prefix}
-    sysconfdir:                                ${sysconfdir}
-    localstatedir:                             ${localstatedir}
-    C Compiler:                                ${CC}
-    CFLAGS:                                    ${CFLAGS}
-    Enable stack-smashing protection:          ${enable_ssp}
-"
-
-echo "\
+    prefix:                             ${prefix}
+    sysconfdir:                         ${sysconfdir}
+    localstatedir:                      ${localstatedir}
+    C Compiler:                         ${CC}
+    CFLAGS:                             ${CFLAGS}
+    Enable stack-smashing protection:   ${enable_ssp}
     Building tests:                     ${ENABLE_TESTS}
 "