forked from dreibh/sctplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
300 lines (261 loc) · 9.05 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# ###########################################################################
# sctplib package configuration
# $Id$
# ###########################################################################
AC_INIT([sctplib], [1.0.14~rc2])
AC_CONFIG_SRCDIR([sctplib/programs/discard_server.c])
AC_CONFIG_AUX_DIR(admin)
AC_CONFIG_MACRO_DIR([admin])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
AC_PREFIX_DEFAULT(/usr/local)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
ac_configure_args="$ac_configure_args --prefix $prefix"
fi
AM_CONFIG_HEADER(config.h)
# ###### Checks for programs ################################################
AC_PROG_CC
AC_ENABLE_STATIC
AC_PROG_LIBTOOL
# ###### Compiler checks ####################################################
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
# ###### Check for Headers ##################################################
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h)
AC_HEADER_TIME
# ###### Checks for library functions #######################################
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([gettimeofday inet_ntoa memset select socket strerror strtol strtoul])
# ###### colorgcc ###########################################################
AC_CHECK_PROG([COLORGCC], [colorgcc], [yes], [no])
if test "$COLORGCC" == "yes"
then
AC_MSG_NOTICE([Compiling using colorgcc])
CC=colorgcc
CXX=colorgcc
fi
# ###### Options ############################################################
AC_ARG_ENABLE([sctp-over-udp],
[ --enable-sctp-over-udp enable SCTP over UDP mode ],
AC_DEFINE(SCTP_OVER_UDP, 1, "Define to 1 if you want SCTP over UDP"), )
if test "$enable_sctp_over_udp" = "yes" ; then
AC_MSG_CHECKING([port number for SCTP over UDP])
AC_ARG_WITH(sctp_over_udp_port,AC_HELP_STRING(
[--with-sctp-over-udp-port=FLAGS],
[SCTP over UDO port (default: 9899).]),
sctp_over_udp_port="$withval", sctp_over_udp_port="9899")
if test "$sctp_over_udp_port" -lt 1 ; then
AC_ERROR([SCTP over UDP port too small!])
elif test "$sctp_over_udp_port" -gt 65535 ; then
AC_ERROR([SCTP over UDP port too large!])
fi
AC_MSG_RESULT($sctp_over_udp_port)
AC_DEFINE_UNQUOTED(SCTP_OVER_UDP_UDPPORT, $sctp_over_udp_port, [UDP port for SCTP over UDP tunneling])
fi
AC_ARG_ENABLE([maintainer-mode],
[ --enable-maintainer-mode enable maintainer mode ]
[default=yes]],enable_maintainer_mode=$enableval,enable_maintainer_mode=yes)
AC_ARG_ENABLE(ipv6,
[ --disable-ipv6 turn off IPv6 support ])
# ###### IPv6 checks ########################################################
AC_MSG_CHECKING(whether this OS does have IPv6 stack)
if test "${enable_ipv6}" = "no"; then
AC_MSG_RESULT(disabled)
else
# ----------
# INRIA IPv6
# ----------
if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
cv_ipv6=yes
AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
AC_DEFINE(INRIA_IPV6, 1, "Define to 1 if it is a INRIA IPv6 stack.")
LIB_IPV6=""
AC_MSG_RESULT(INRIA IPv6)
fi
# ---------
# KAME IPv6
# ---------
if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
cv_ipv6=yes
AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
AC_DEFINE(KAME, 1, "Define to 1 if the KAME implementation is used.")
if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
LIB_IPV6="-L/usr/local/v6/lib -linet6"
fi
AC_MSG_RESULT(KAME)
fi
# ---------
# NRL check
# ---------
if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
cv_ipv6=yes
AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
AC_DEFINE(NRL, 1, "Define to 1 if NRL is used.")
if test x"$opsys" = x"bsdi";then
AC_DEFINE(BSDI_NRL, 1, "Define to 1 if BSDI NRL is used.")
AC_MSG_RESULT(BSDI_NRL)
else
AC_MSG_RESULT(NRL)
fi
fi
# ----------
# Linux IPv6
# ----------
AC_EGREP_CPP(yes, [#
#include <linux/version.h>
/* 2.1.128 or later */
#if LINUX_VERSION_CODE >= 0x020180
yes
#endif],
[cv_ipv6=yes; cv_linux_ipv6=yes; AC_MSG_RESULT(Linux IPv6)])
if test "$cv_linux_ipv6" = "yes"; then
AC_DEFINE(HAVE_IPV6, 1, "Define to 1 if IPv6 is supported.")
AC_MSG_CHECKING(for GNU libc 2.1)
AC_EGREP_CPP(yes, [
#include <features.h>
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
yes
#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
AC_DEFINE(LINUX_IPV6, 1, "Define to 1 if the Linux IPv6 implementation is used.")
if test "$glibc" != "yes"; then
INCLUDES="-I/usr/inet6/include"
if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
LIB_IPV6="-L/usr/inet6/lib -linet6"
fi
fi
fi
fi
LIBS="$LIB_IPV6 $LIBS"
AC_SUBST(LIB_IPV6)
# ###### Check for sin6_scope_id of sockaddr_in6 ############################
if test "$cv_ipv6" = yes; then
AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/in.h>
],[static struct sockaddr_in6 ac_i;int ac_j = sizeof(ac_i.sin6_scope_id);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SIN6_SCOPE_ID, 1, "Define to 1 if sin6_scope_id is supported.")],
AC_MSG_RESULT(no))
fi
# ###### Check for IPV6_PKTINFO #############################################
AC_MSG_CHECKING(for IPV6_PKTINFO)
AC_TRY_COMPILE([#include <arpa/inet.h>
#include <netinet/in.h>], [
int level = IPV6_PKTINFO;
], [
# Yes, we have it...
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_IPV6_PKTINFO], [], [IPV6_PKTINFO has been found!])
], [
AC_MSG_RESULT(no)
])
# ###### Check for IPV6_RECVPKTINFO #########################################
AC_MSG_CHECKING(for IPV6_RECVPKTINFO)
AC_TRY_COMPILE([#include <arpa/inet.h>
#include <netinet/in.h>], [
int level = IPV6_RECVPKTINFO;
], [
# Yes, we have it...
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_IPV6_RECVPKTINFO], [], [IPV6_RECVPKTINFO has been found!])
], [
AC_MSG_RESULT(no)
])
# ###### Check for glib #####################################################
AM_PATH_GLIB_2_0(2.0.0, [ glib_is_okay=yes ], [ glib_is_okay=no ])
if test "x$glib_is_okay" = "xno"; then
AC_MSG_ERROR(GLib distribution not found.)
fi
CFLAGS="$CFLAGS $GLIB_CFLAGS"
CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
glib_LIBS="$GLIB_LIBS"
AC_SUBST(glib_LIBS)
# ###### Operating system checks ############################################
case $host_os in
bsdi*)
CFLAGS="$CFLAGS -DBSDI"
thread_LIBS="-lpthread"
CFLAGS="$CFLAGS `glib-config --cflags`"
LDFLAGS="$LDFLAGS `glib-config --libs`"
;;
freebsd*)
CFLAGS="$CFLAGS -DFreeBSD -D_PTHREADS -pthread -I/usr/local/include"
CXXFLAGS="$CXXFLAGS -DFreeBSD -D_PTHREADS -pthread -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/v6/lib"
thread_LIBS=""
;;
hpux*)
CFLAGS="$CFLAGS -DSNAKE"
test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -Wp,-H600000"
thread_LIBS="-lpthread"
;;
linux*)
CFLAGS="$CFLAGS -DLINUX"
CXXFLAGS="$CXXFLAGS -DLINUX"
LDFLAGS="$LDFLAGS"
thread_LIBS="-lpthread"
;;
openbsd*)
LIBS="$LIBS -lcompat"
thread_LIBS="-lpthread"
;;
solaris*)
CFLAGS="$CFLAGS -D_XPG4_2 -D__EXTENSIONS__ -DSOLARIS -D__sun -DSUN -DSUNOS_5"
CXXFLAGS="$CXXFLAGS -D_XPG4_2 -D__EXTENSIONS__ -DSOLARIS -D__sun -DSUN -DSUNOS_5"
thread_LIBS="-lpthread"
LDFLAGS="$LDFLAGS -lsocket -lnsl -lrt -lresolv"
;;
sunos4*)
CFLAGS="$CFLAGS -DSUN -DSUN4"
thread_LIBS="-lpthread"
;;
darwin7*)
CFLAGS="$CFLAGS -DDARWIN"
CXXFLAGS="$CXXFLAGS -DDARWIN"
thread_LIBS="-lpthread"
;;
darwin8*)
CFLAGS="$CFLAGS -DDARWIN -DUSE_SELECT"
CXXFLAGS="$CXXFLAGS -DDARWIN"
thread_LIBS="-lpthread"
;;
esac
AC_SUBST(thread_LIBS)
# ###### Maintainer mode ####################################################
if test "$enable_maintainer_mode" = "yes"; then
CFLAGS="$CFLAGS -Wall -g3 -O0 -D_REENTRANT -D_THREAD_SAFE"
CXXFLAGS="$CXXFLAGS -Wall -g3 -O0 -D_REENTRANT -D_THREAD_SAFE"
else
CFLAGS="$CFLAGS -Wall -O3 -g0 -D_REENTRANT -D_THREAD_SAFE"
CXXFLAGS="$CXXFLAGS -Wall -O3 -g0 -D_REENTRANT -D_THREAD_SAFE"
fi
# ###### Version information ################################################
SCTPLIB_CURRENT=1
SCTPLIB_REVISION=8
SCTPLIB_AGE=0
AC_SUBST(SCTPLIB_CURRENT)
AC_SUBST(SCTPLIB_REVISION)
AC_SUBST(SCTPLIB_AGE)
# ###### Makefiles ##########################################################
AC_OUTPUT(Makefile sctplib/Makefile sctplib/docs/Makefile sctplib/docs/en/Makefile sctplib/docs/sctplib/Makefile sctplib/manual/Makefile sctplib/programs/Makefile sctplib/sctp/Makefile )
# ###### Configuration results ##############################################
echo ""
echo "The sctplib package has been configured with the following options:"
echo ""
echo " Build with Maintainer Mode : $enable_maintainer_mode"
echo " Build with SCTP over UDP : $enable_sctp_over_udp"
echo ""
echo " glib_LIBS : $glib_LIBS"
echo ""
echo " CFLAGS : $CFLAGS"
echo " CXXFLAGS : $CXXFLAGS"
echo " LDFLAGS : $LDFLAGS"