blob: cdcd483571182b42fa40c4560317e04c0b530e23 [file] [log] [blame]
tuexenbdbed9a2012-05-23 09:13:55 +00001dnl
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
Vitaly Zaitsev07f871b2021-01-13 15:37:19 +010031AC_INIT([libusrsctp], [0.9.5.0])
Christian Wright899b19a2018-09-12 11:30:58 +120032AM_INIT_AUTOMAKE([foreign])
tuexend37aa5e2011-11-01 20:19:04 +000033
Michael Tuexen09aadc62015-09-04 10:01:54 +020034AC_PROG_CC
tuexenf45025c2011-11-01 23:00:31 +000035AC_PROG_LIBTOOL
tuexend37aa5e2011-11-01 20:19:04 +000036AC_CANONICAL_HOST
tuexen8e332e72011-11-04 06:59:54 +000037AC_CONFIG_MACRO_DIR([m4])
tuexend37aa5e2011-11-01 20:19:04 +000038
Michael Tuexen96f26062017-01-09 12:59:53 +010039dnl Disable pkg_config support for now
40dnl PKG_PROG_PKG_CONFIG
41dnl PKG_INSTALLDIR
Michael Tuexen8679f2b2017-01-06 13:16:03 +010042
t00fcxena336e832013-09-02 23:00:20 +000043LIBCFLAGS="-DSCTP_PROCESS_LEVEL_LOCKS -DSCTP_SIMPLE_ALLOCATOR -D__Userspace__"
Michael Tuexen8679f2b2017-01-06 13:16:03 +010044APPCFLAGS=""
45
tuexend37aa5e2011-11-01 20:19:04 +000046case $host_os in
tuexenf45025c2011-11-01 23:00:31 +000047darwin*)
Michael Tuexena37b2e82017-10-14 12:08:00 +020048 CFLAGS="$CFLAGS -std=c99 -Wno-deprecated-declarations -D__APPLE_USE_RFC_2292"
tuexenf45025c2011-11-01 23:00:31 +000049 ;;
t00fcxen652291c2013-12-27 19:21:25 +000050dragonfly*)
Michael Tuexen078ff322015-09-26 17:26:47 +020051 CFLAGS="$CFLAGS -std=c99 -pthread"
tuexenf45025c2011-11-01 23:00:31 +000052 ;;
53freebsd*)
Michael Tuexen078ff322015-09-26 17:26:47 +020054 CFLAGS="$CFLAGS -std=c99 -pthread"
t00fcxen5628b4c2012-09-16 07:43:07 +000055 if $CC --version | grep -q clang; then
Michael Tuexena37b2e82017-10-14 12:08:00 +020056 CFLAGS="$CFLAGS -Wno-unknown-warning-option"
t00fcxen8795d462012-09-16 07:14:53 +000057 LDFLAGS="$LDFLAGS -Qunused-arguments"
t00fcxenb130f0a2012-09-15 19:10:42 +000058 fi
tuexenf45025c2011-11-01 23:00:31 +000059 ;;
t00fcxen652291c2013-12-27 19:21:25 +000060linux*)
Felix Weinrankdb272162020-01-20 15:34:50 +010061 CFLAGS="$CFLAGS -std=c99 -pthread -D_GNU_SOURCE -Wno-address-of-packed-member"
t00fcxen652291c2013-12-27 19:21:25 +000062 ;;
63netbsd*)
Michael Tuexen078ff322015-09-26 17:26:47 +020064 CFLAGS="$CFLAGS -std=c99 -pthread"
t00fcxen652291c2013-12-27 19:21:25 +000065 ;;
t00fcxen8f236c52013-02-27 12:53:23 +000066openbsd*)
Michael Tuexen078ff322015-09-26 17:26:47 +020067 CFLAGS="$CFLAGS -std=c99 -pthread"
t00fcxen8f236c52013-02-27 12:53:23 +000068 ;;
tuexend37aa5e2011-11-01 20:19:04 +000069solaris*)
70 CFLAGS="$CFLAGS -D_XPG4_2"
71 ;;
72esac
Michael Tuexen078ff322015-09-26 17:26:47 +020073
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
Michael Tuexen700f96c2015-11-03 22:11:18 +010094AC_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
tuexen3a9fb2f2011-11-04 08:27:30 +0000102AC_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])
Michael Tuexen1e3c3902015-11-07 20:40:16 +0100108 CFLAGS="$CFLAGS -g -O0"
tuexen3a9fb2f2011-11-04 08:27:30 +0000109fi
110
tuexen08d7ac62012-06-28 16:54:10 +0000111AC_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
Michael Tuexen8679f2b2017-01-06 13:16:03 +0100116 APPCFLAGS="$APPCFLAGS -DINET"
tuexen08d7ac62012-06-28 16:54:10 +0000117 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
Michael Tuexen8679f2b2017-01-06 13:16:03 +0100125 APPCFLAGS="$APPCFLAGS -DINET6"
tuexen08d7ac62012-06-28 16:54:10 +0000126 AC_DEFINE(INET6, 1, [Support IPv6])
127fi
128
Michael Tuexen281024f2017-07-24 09:01:35 +0200129AC_ARG_ENABLE(programs,
130 AC_HELP_STRING( [--enable-programs],
131 [build example programs @<:@default=yes@:>@]),
132 enable_programs=$enableval,enable_programs=yes)
Christian Wrightb92b2a52018-09-12 11:33:58 +1200133AM_CONDITIONAL([COND_PROGRAMS], [test "$enable_programs" = yes])
Michael Tuexen281024f2017-07-24 09:01:35 +0200134
tuexend37aa5e2011-11-01 20:19:04 +0000135AC_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
Michael Tuexen0f628812016-11-23 17:19:53 +0100141AC_CHECK_HEADERS(stdatomic.h)
t00fcxend22e2982015-03-16 21:26:43 +0000142AC_CHECK_HEADERS(sys/queue.h)
t00fcxenc9859102015-02-16 12:23:06 +0000143AC_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>])
Michael Tuexen87389442021-09-13 12:34:18 +0200146AC_CHECK_HEADERS(net/route.h, [], [],
147 [#ifdef HAVE_SYS_TYPES_H
148 #include <sys/types.h>
149 #endif
150 #include <sys/socket.h>])
Michael Tuexen623f1142021-09-13 12:30:35 +0200151
t00fcxen0cd71862012-09-04 20:21:12 +0000152
t00fcxena8a26f62012-09-12 19:24:54 +0000153AC_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
t00fcxen12b6c0c2012-09-14 18:50:54 +0000158 #include <sys/socket.h>])
t00fcxena8a26f62012-09-12 19:24:54 +0000159
tuexend37aa5e2011-11-01 20:19:04 +0000160AC_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
t00fcxen8fbaee32012-09-04 16:41:39 +0000167AC_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
174AC_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.]),,
t00fcxen12b6c0c2012-09-14 18:50:54 +0000176 [#include "usrsctplib/usrsctp.h"])
t00fcxen8fbaee32012-09-04 16:41:39 +0000177
tuexend37aa5e2011-11-01 20:19:04 +0000178AC_MSG_CHECKING(for socklen_t)
179AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
180 #include <sys/types.h>
181 #endif
182 #include <sys/socket.h>],
t00fcxenb39e8c82012-09-14 18:22:18 +0000183 [socklen_t x; x = 1; return ((int)x);],
tuexend37aa5e2011-11-01 20:19:04 +0000184 [AC_MSG_RESULT(yes)],
185 [AC_MSG_RESULT(int)
tuexen218ed842012-04-19 15:40:50 +0000186 AC_DEFINE(socklen_t, int, [Define a type for socklen_t.])])
tuexend37aa5e2011-11-01 20:19:04 +0000187
t00fcxen8bfe4502012-09-04 20:56:36 +0000188AC_C_BIGENDIAN
189
t00fcxen5cbc6832012-09-04 18:22:18 +0000190AC_SUBST([LIBCFLAGS])
Michael Tuexen8679f2b2017-01-06 13:16:03 +0100191AC_SUBST([APPCFLAGS])
Michael Tuexen96f26062017-01-09 12:59:53 +0100192dnl AC_CONFIG_FILES([usrsctp.pc])
Christian Wrightb92b2a52018-09-12 11:33:58 +1200193AC_CONFIG_FILES(usrsctplib/Makefile programs/Makefile Makefile)
194AC_OUTPUT