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