]> git.meshlink.io Git - catta/blobdiff - configure.ac
Fix compilation error caused by ACX_THREAD
[catta] / configure.ac
index 1cb4e9f590d5f767555f37925a0df546aebcb823..d5de5e1f77edd1427295dffa19a2962c1f8f33c8 100644 (file)
@@ -1,34 +1,33 @@
 # -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-# This file is part of avahi.
+# This file is part of catta.
 #
-# avahi is free software; you can redistribute it and/or modify it
+# catta is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License as
 # published by the Free Software Foundation; either version 2 of the
 # License, or (at your option) any later version.
 #
-# avahi is distributed in the hope that it will be useful, but WITHOUT
+# catta is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
 # License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
+# License along with catta; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA.
 
 AC_PREREQ(2.63)
-AC_INIT([avahi],[0.6.31],[avahi (at) lists (dot) freedesktop (dot) org])
-AC_CONFIG_SRCDIR([avahi-core/server.c])
-AC_CONFIG_MACRO_DIR([common])
+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://avahi.org/])
+AC_SUBST(PACKAGE_URL, [http://github.com/everbase/catta/])
 
-AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [8:3:5])
-AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [7:2:0])
+AC_SUBST(LIBCATTA_VERSION_INFO, [0:0:0])
 
 AC_CANONICAL_HOST
 
@@ -46,12 +45,34 @@ AC_PROG_CC
 AC_PROG_CC_C99
 AM_PROG_CC_C_O
 AC_USE_SYSTEM_EXTENSIONS
-AC_PROG_CPP
 AC_PROG_MKDIR_P
 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],
@@ -119,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
@@ -144,6 +158,15 @@ AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
 
 AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
 
+if test "x$HAVE_NETLINK" = "xyes" ; then
+    # Test whether rtnetlink.h can be included when compiled with -std=c99
+    # some distributions (e.g. archlinux) have broken headers that dont
+    # define __u64 with -std=c99
+    AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
+    AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
+        [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no])])
+fi
+
 #
 # Check for net/route.h
 #
@@ -187,14 +210,14 @@ AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
 # Check for lifconf struct; only present on Solaris
 #
 AC_MSG_CHECKING(for struct lifconf)
-AC_CACHE_VAL(avahi_cv_has_struct_lifconf,
+AC_CACHE_VAL(catta_cv_has_struct_lifconf,
 [AC_TRY_COMPILE(
 [#include <sys/socket.h>
 #include <net/if.h>
 ],[sizeof (struct lifconf);],
-avahi_cv_has_struct_lifconf=yes,avahi_cv_has_struct_lifconf=no)])
-AC_MSG_RESULT($avahi_cv_has_struct_lifconf)
-if test $avahi_cv_has_struct_lifconf = yes; then
+catta_cv_has_struct_lifconf=yes,catta_cv_has_struct_lifconf=no)])
+AC_MSG_RESULT($catta_cv_has_struct_lifconf)
+if test $catta_cv_has_struct_lifconf = yes; then
     AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
 fi
 
@@ -227,7 +250,7 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [
 ])
 
 test_gcc_flag() {
-    AC_LANG_CONFTEST([int main() {}])
+    AC_LANG_CONFTEST([AC_LANG_SOURCE([[int main() {}]])])
     $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
     ret=$?
     rm -f conftest.o
@@ -237,28 +260,12 @@ 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"
-
-    if test "x$HAVE_NETLINK" = "xyes" ; then
-        # Test whether rtnetlink.h can be included when compiled with -std=c99
-        # some distributions (e.g. archlinux) have broken headers that dont
-        # define __u64 with -std=c99
-        AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
-        OLDCFLAGS="$CFLAGS"
-        CFLAGS="-std=c99"
-        AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
-            use_stdc99=yes, use_stdc99=no)
+    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"
 
-        if test x"$use_stdc99" = xyes; then
-            DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
-            AC_MSG_RESULT([yes])
-        else
-            AC_MSG_RESULT([no])
-        fi
-
-        CFLAGS="$OLDCFLAGS"
-    else
-        DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
+    # 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
@@ -273,15 +280,7 @@ if test "x$GCC" = "xyes" ; then
 fi
 
 # Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h netdb.h syslog.h])
-AC_HEADER_STDBOOL
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
 
  # Solaris stuff
  AC_SEARCH_LIBS([inet_ntop],[nsl])
@@ -289,13 +288,8 @@ AC_HEADER_SYS_WAIT
  AC_CHECK_DECL([CMSG_SPACE],,CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__", [[#include <sys/socket.h>]])
 
 # Checks for library functions.
-AC_FUNC_MEMCMP
 AC_FUNC_SELECT_ARGTYPES
-# avahi_malloc actually returns NULL for avahi_malloc(0), so it does not matter
-# whether libc's malloc does too. (Same for realloc.)
-#AC_FUNC_MALLOC
-#AC_FUNC_REALLOC
-AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid setresgid setregid strcasecmp gettimeofday putenv strncasecmp strlcpy gethostbyname seteuid setegid setproctitle getprogname])
+AC_CHECK_FUNCS([gethostname select socket uname strcasecmp gettimeofday strncasecmp strlcpy fcntl])
 
 AC_FUNC_CHOWN
 AC_FUNC_STAT
@@ -328,7 +322,7 @@ DX_RTF_FEATURE(OFF)
 DX_XML_FEATURE(ON)
 DX_PDF_FEATURE(OFF)
 DX_PS_FEATURE(OFF)
-DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
+DX_INIT_DOXYGEN(catta, doxygen.cfg, doxygen)
 
 #
 # Conditionally compile test and example programs
@@ -347,10 +341,10 @@ AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
 # ==========================================================================
 AC_CONFIG_FILES([
 Makefile
-avahi-common/Makefile
-avahi-core/Makefile
+src/Makefile
+include/Makefile
+tests/Makefile
 examples/Makefile
-common/Makefile
 ])
 AC_OUTPUT
 
@@ -358,15 +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 "\
-    Building libavahi-core              yes
+    prefix:                             ${prefix}
+    sysconfdir:                         ${sysconfdir}
+    localstatedir:                      ${localstatedir}
+    C Compiler:                         ${CC}
+    CFLAGS:                             ${CFLAGS}
+    Enable stack-smashing protection:   ${enable_ssp}
     Building tests:                     ${ENABLE_TESTS}
 "