1dnl 2dnl Copyright (C) 2011-2012 Michael Tuexen 3dnl 4dnl All rights reserved. 5dnl 6dnl Redistribution and use in source and binary forms, with or without 7dnl modification, are permitted provided that the following conditions 8dnl are met: 9dnl 1. Redistributions of source code must retain the above copyright 10dnl notice, this list of conditions and the following disclaimer. 11dnl 2. Redistributions in binary form must reproduce the above copyright 12dnl notice, this list of conditions and the following disclaimer in the 13dnl documentation and/or other materials provided with the distribution. 14dnl 3. Neither the name of the project nor the names of its contributors 15dnl may be used to endorse or promote products derived from this software 16dnl without specific prior written permission. 17dnl 18dnl THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 19dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21dnl ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 22dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28dnl SUCH DAMAGE. 29dnl 30 31AC_INIT([libusrsctp], [0.9.5.0]) 32AM_INIT_AUTOMAKE([foreign]) 33 34AC_PROG_CC 35AC_PROG_LIBTOOL 36AC_CANONICAL_HOST 37AC_CONFIG_MACRO_DIR([m4]) 38 39dnl Disable pkg_config support for now 40dnl PKG_PROG_PKG_CONFIG 41dnl PKG_INSTALLDIR 42 43LIBCFLAGS="-DSCTP_PROCESS_LEVEL_LOCKS -DSCTP_SIMPLE_ALLOCATOR -D__Userspace__" 44APPCFLAGS="" 45 46case $host_os in 47darwin*) 48 CFLAGS="$CFLAGS -std=c99 -Wno-deprecated-declarations -D__APPLE_USE_RFC_2292" 49 ;; 50dragonfly*) 51 CFLAGS="$CFLAGS -std=c99 -pthread" 52 ;; 53freebsd*) 54 CFLAGS="$CFLAGS -std=c99 -pthread" 55 if $CC --version | grep -q clang; then 56 CFLAGS="$CFLAGS -Wno-unknown-warning-option" 57 LDFLAGS="$LDFLAGS -Qunused-arguments" 58 fi 59 ;; 60linux*) 61 CFLAGS="$CFLAGS -std=c99 -pthread -D_GNU_SOURCE -Wno-address-of-packed-member" 62 ;; 63netbsd*) 64 CFLAGS="$CFLAGS -std=c99 -pthread" 65 ;; 66openbsd*) 67 CFLAGS="$CFLAGS -std=c99 -pthread" 68 ;; 69solaris*) 70 CFLAGS="$CFLAGS -D_XPG4_2" 71 ;; 72esac 73 74if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then 75 ac_supports_gcc_flags=yes 76fi 77 78if test "x$ac_supports_gcc_flags" = "xyes" ; then 79 CFLAGS="$CFLAGS -pedantic -Wall" 80fi 81 82AC_MSG_CHECKING(whether we should treat compiler warnings as errors) 83AC_ARG_ENABLE(warnings-as-errors, 84 AC_HELP_STRING( [--enable-warnings-as-errors], 85 [treat warnings as errors (only for GCC or clang) @<:@default=yes@:>@]), 86 enable_warnings_as_errors=$enableval,enable_warnings_as_errors=yes) 87if test "x$ac_supports_gcc_flags" = "xyes" -a x$enable_warnings_as_errors = xyes; then 88 AC_MSG_RESULT(yes) 89 CFLAGS="$CFLAGS -Werror" 90else 91 AC_MSG_RESULT(no) 92fi 93 94AC_ARG_ENABLE(invariants, 95 AC_HELP_STRING( [--enable-invariants], 96 [add additional runtime checks @<:@default=no@:>@]), 97 enable_invariants=$enableval,enable_invariants=no) 98if test x$enable_invariants = xyes; then 99 AC_DEFINE(INVARIANTS, 1, [Add additional runtime checks]) 100fi 101 102AC_ARG_ENABLE(debug, 103 AC_HELP_STRING( [--enable-debug], 104 [provide debug information @<:@default=yes@:>@]), 105 enable_debug=$enableval,enable_debug=yes) 106if test x$enable_debug = xyes; then 107 AC_DEFINE(SCTP_DEBUG, 1, [Provide debug information]) 108 CFLAGS="$CFLAGS -g -O0" 109fi 110 111AC_ARG_ENABLE(inet, 112 AC_HELP_STRING( [--enable-inet], 113 [Support IPv4 @<:@default=yes@:>@]), 114 enable_inet=$enableval,enable_inet=yes) 115if test x$enable_inet = xyes; then 116 APPCFLAGS="$APPCFLAGS -DINET" 117 AC_DEFINE(INET, 1, [Support IPv4]) 118fi 119 120AC_ARG_ENABLE(inet6, 121 AC_HELP_STRING( [--enable-inet6], 122 [Support IPv6 @<:@default=yes@:>@]), 123 enable_inet6=$enableval,enable_inet6=yes) 124if test x$enable_inet6 = xyes; then 125 APPCFLAGS="$APPCFLAGS -DINET6" 126 AC_DEFINE(INET6, 1, [Support IPv6]) 127fi 128 129AC_ARG_ENABLE(programs, 130 AC_HELP_STRING( [--enable-programs], 131 [build example programs @<:@default=yes@:>@]), 132 enable_programs=$enableval,enable_programs=yes) 133AM_CONDITIONAL([COND_PROGRAMS], [test "$enable_programs" = yes]) 134 135AC_CHECK_TYPE(size_t) 136AC_CHECK_TYPE(ssize_t) 137 138AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket)) 139AC_CHECK_FUNCS(inet_addr, , AC_CHECK_LIB(nsl, inet_addr)) 140 141AC_CHECK_HEADERS(stdatomic.h) 142AC_CHECK_HEADERS(sys/queue.h) 143AC_CHECK_HEADERS(linux/if_addr.h, [], [], [#include <sys/socket.h>]) 144AC_CHECK_HEADERS(linux/rtnetlink.h, [], [], [#include <sys/socket.h>]) 145AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [], [#include <netinet/ip.h>]) 146 147AC_CHECK_MEMBER(struct sockaddr.sa_len, 148 AC_DEFINE(HAVE_SA_LEN, 1, [Define this if your stack has sa_len in sockaddr struct.]),, 149 [#ifdef HAVE_SYS_TYPES_H 150 #include <sys/types.h> 151 #endif 152 #include <sys/socket.h>]) 153 154AC_CHECK_MEMBER(struct sockaddr_in.sin_len, 155 AC_DEFINE(HAVE_SIN_LEN, 1, [Define this if your IPv4 has sin_len in sockaddr_in struct.]),, 156 [#ifdef HAVE_SYS_TYPES_H 157 #include <sys/types.h> 158 #endif 159 #include <netinet/in.h>]) 160 161AC_CHECK_MEMBER(struct sockaddr_in6.sin6_len, 162 AC_DEFINE(HAVE_SIN6_LEN, 1, [Define this if your IPv6 has sin6_len in sockaddr_in6 struct.]),, 163 [#ifdef HAVE_SYS_TYPES_H 164 #include <sys/types.h> 165 #endif 166 #include <netinet/in.h>]) 167 168AC_CHECK_MEMBER(struct sockaddr_conn.sconn_len, 169 AC_DEFINE(HAVE_SCONN_LEN, 1, [Define this if your userland stack has sconn_len in sockaddr_conn struct.]),, 170 [#include "usrsctplib/usrsctp.h"]) 171 172AC_MSG_CHECKING(for socklen_t) 173AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H 174 #include <sys/types.h> 175 #endif 176 #include <sys/socket.h>], 177 [socklen_t x; x = 1; return ((int)x);], 178 [AC_MSG_RESULT(yes)], 179 [AC_MSG_RESULT(int) 180 AC_DEFINE(socklen_t, int, [Define a type for socklen_t.])]) 181 182AC_C_BIGENDIAN 183 184AC_SUBST([LIBCFLAGS]) 185AC_SUBST([APPCFLAGS]) 186dnl AC_CONFIG_FILES([usrsctp.pc]) 187AC_CONFIG_FILES(usrsctplib/Makefile programs/Makefile Makefile) 188AC_OUTPUT 189