]> git.ipfire.org Git - thirdparty/bird.git/blame - configure.in
Babel: Rework handling of retractions
[thirdparty/bird.git] / configure.in
CommitLineData
2f9bcf97
MM
1dnl ** This is a configure script template for BIRD
2dnl ** Process it with autoconf to get ./configure
9fac310d 3dnl ** (c) 1999--2000 Martin Mares <mj@ucw.cz>
2f9bcf97
MM
4
5AC_REVISION($Id$)
6AC_INIT(conf/confbase.Y)
7AC_CONFIG_AUX_DIR(tools)
8
ab188fb7
OZ
9AC_ARG_ENABLE(debug, [ --enable-debug enable internal debugging routines (default: disabled)],,enable_debug=no)
10AC_ARG_ENABLE(memcheck, [ --enable-memcheck check memory allocations when debugging (default: enabled)],,enable_memcheck=yes)
11AC_ARG_ENABLE(client, [ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes)
12AC_ARG_ENABLE(ipv6, [ --enable-ipv6 enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
1ec52253 13AC_ARG_ENABLE(pthreads, [ --enable-pthreads enable POSIX threads support (default: detect)],,enable_pthreads=try)
ab188fb7
OZ
14AC_ARG_WITH(suffix, [ --with-suffix=STRING use specified suffix for BIRD files (default: 6 for IPv6 version)],[given_suffix="yes"])
15AC_ARG_WITH(sysconfig, [ --with-sysconfig=FILE use specified BIRD system configuration file])
16AC_ARG_WITH(protocols, [ --with-protocols=LIST include specified routing protocols (default: all)],,[with_protocols="all"])
17AC_ARG_WITH(sysinclude, [ --with-sysinclude=PATH search for system includes on specified place])
18AC_ARG_WITH(runtimedir, [ --with-runtimedir=PATH path for runtime files (default: $(localstatedir)/run)],[runtimedir="$with_runtimedir"],[runtimedir="\$(localstatedir)/run"])
19AC_ARG_WITH(iproutedir, [ --with-iproutedir=PATH path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
20AC_ARG_VAR([FLEX], [location of the Flex program])
21AC_ARG_VAR([BISON], [location of the Bison program])
22AC_ARG_VAR([M4], [location of the M4 program])
23
2f9bcf97 24
49e7e5ee
MM
25if test "$srcdir" = . ; then
26 # Building in current directory => create obj directory holding all objects
27 objdir=obj
28 mkdir -p obj
29 srcdir_rel=..
30 makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
31 exedir=..
32else
33 # Building in separate directory
34 objdir=.
35 srcdir_rel=$srcdir
36 makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
37 exedir=.
38fi
39case $srcdir_rel in
40 /*) srcdir_rel_mf=$srcdir_rel ;;
41 *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
42esac
43AC_SUBST(objdir)
44AC_SUBST(exedir)
45AC_SUBST(srcdir_rel_mf)
ab188fb7 46AC_SUBST(runtimedir)
49e7e5ee 47
c817b991
MM
48if test "$enable_ipv6" = yes ; then
49 ip=ipv6
ab188fb7 50 SUFFIX=6
1ec52253 51 proto_radv=radv
c817b991
MM
52else
53 ip=ipv4
ab188fb7 54 SUFFIX=""
c3226991
OZ
55fi
56
ab188fb7
OZ
57if test "$given_suffix" = yes ; then
58 SUFFIX="$with_suffix"
59fi
60AC_SUBST(SUFFIX)
61
ab188fb7
OZ
62if test "$enable_debug" = yes ; then
63 CONFIG_FILE="bird$SUFFIX.conf"
64 CONTROL_SOCKET="bird$SUFFIX.ctl"
65else
66 CONFIG_FILE="\$(sysconfdir)/bird$SUFFIX.conf"
67 CONTROL_SOCKET="$runtimedir/bird$SUFFIX.ctl"
68fi
69AC_SUBST(CONFIG_FILE)
70AC_SUBST(CONTROL_SOCKET)
71
d7765408
OZ
72AC_SEARCH_LIBS(clock_gettime, [c rt posix4], ,
73 AC_MSG_ERROR([[Function clock_gettime not available.]]))
fd91ae33 74
2f9bcf97 75AC_CANONICAL_HOST
416e3ee4 76
b1c030b0 77# Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
416e3ee4 78if test "$ac_test_CFLAGS" != set ; then
b1c030b0 79 bird_cflags_default=yes
416e3ee4 80fi
416e3ee4 81
e81b440f
OZ
82AC_PROG_CC
83if test -z "$GCC" ; then
84 AC_MSG_ERROR([This program requires the GNU C Compiler.])
85fi
86
547d3bf4 87# Enable threads by default just in Linux and FreeBSD
b25509e5
JMM
88#if test "$enable_pthreads" = try ; then
89# case "$host_os" in
90# (linux* | freebsd* | openbsd* | netbsd* ) enable_pthreads=try ;;
91# (*) enable_pthreads=no ;;
92# esac
93#fi
547d3bf4 94
1ec52253
OZ
95if test "$enable_pthreads" != no ; then
96 BIRD_CHECK_PTHREADS
97
98 if test "$bird_cv_lib_pthreads" = yes ; then
99 AC_DEFINE(USE_PTHREADS)
100 CFLAGS="$CFLAGS -pthread"
101 LDFLAGS="$LDFLAGS -pthread"
102 proto_bfd=bfd
103 elif test "$enable_pthreads" = yes ; then
104 AC_MSG_ERROR([POSIX threads not available.])
105 fi
106
107 if test "$enable_pthreads" = try ; then
108 enable_pthreads="$bird_cv_lib_pthreads"
109 fi
110fi
111
bed41728 112if test "$bird_cflags_default" = yes ; then
efd6d12b
OZ
113 BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign, -Wall)
114 BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
115 BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
b1c030b0 116
1ec52253 117 CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
efd6d12b
OZ
118 BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign)
119 BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
120 BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
b1c030b0 121fi
efd6d12b 122AC_MSG_CHECKING([CFLAGS])
b1c030b0
OZ
123AC_MSG_RESULT($CFLAGS)
124
125
416e3ee4
MM
126AC_PROG_CPP
127AC_PROG_INSTALL
128AC_PROG_RANLIB
129AC_CHECK_PROG(FLEX, flex, flex)
130AC_CHECK_PROG(BISON, bison, bison)
8de11deb
OZ
131AC_CHECK_PROGS(M4, gm4 m4)
132
133test -z "$FLEX" && AC_MSG_ERROR([Flex is missing.])
134test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
135test -z "$M4" && AC_MSG_ERROR([M4 is missing.])
136BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
416e3ee4 137
2f9bcf97 138if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
2f9bcf97 139 if test -f $with_sysconfig ; then
49e7e5ee 140 sysdesc=$with_sysconfig
2f9bcf97 141 else
49e7e5ee
MM
142 sysdesc=$srcdir/sysdep/cf/$with_sysconfig
143 if ! test -f $sysdesc ; then
144 sysdesc=$sysdesc.h
145 fi
2f9bcf97
MM
146 fi
147elif test -f sysconfig.h ; then
49e7e5ee 148 sysdesc=sysconfig
2f9bcf97 149else
c817b991 150 case "$ip:$host_os" in
f1aceff5 151 ipv6:linux*) sysdesc=linux-v6
acc93efd 152 default_iproutedir="/etc/iproute2"
1127ac6e 153 ;;
f1aceff5 154 ipv4:linux*) sysdesc=linux
acc93efd 155 default_iproutedir="/etc/iproute2"
c817b991 156 ;;
7cb37e6f 157 ipv6:netbsd*) sysdesc=bsd-v6
d0c64519 158 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
646b24d9 159 LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
7cb37e6f
OF
160 ;;
161 ipv4:netbsd*) sysdesc=bsd
d0c64519 162 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
646b24d9 163 LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
7cb37e6f
OF
164 ;;
165 ipv6:freebsd*) sysdesc=bsd-v6
166 ;;
167 ipv4:freebsd*) sysdesc=bsd
168 ;;
d760229a
OF
169 ipv6:dragonfly*) sysdesc=bsd-v6
170 ;;
171 ipv4:dragonfly*) sysdesc=bsd
172 ;;
7965e17d
OZ
173 ipv6:kfreebsd*) sysdesc=bsd-v6
174 ;;
175 ipv4:kfreebsd*) sysdesc=bsd
176 ;;
ef9c9ab9
OF
177 ipv6:openbsd*) sysdesc=bsd-v6
178 ;;
179 ipv4:openbsd*) sysdesc=bsd
180 ;;
416e3ee4 181 *) AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
2f9bcf97
MM
182 ;;
183 esac
49e7e5ee 184 sysdesc=$srcdir/sysdep/cf/$sysdesc.h
2f9bcf97 185fi
416e3ee4 186AC_MSG_CHECKING([which OS configuration should we use])
49e7e5ee
MM
187AC_MSG_RESULT($sysdesc)
188if ! test -f $sysdesc ; then
2f9bcf97
MM
189 AC_MSG_ERROR([The system configuration file is missing.])
190fi
49e7e5ee
MM
191sysname=`echo $sysdesc | sed 's/\.h$//'`
192AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
193
194AC_MSG_CHECKING([system-dependent directories])
195sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
196AC_MSG_RESULT($sysdep_dirs)
197AC_SUBST(sysdep_dirs)
2f9bcf97 198
acc93efd
OZ
199if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
200
201if test -n "$given_iproutedir"
202then iproutedir=$with_iproutedir
203else iproutedir=$default_iproutedir
204fi
205
206AC_SUBST(iproutedir)
207
1ec52253 208all_protocols="$proto_bfd bgp ospf pipe $proto_radv rip static"
937e75d8
OZ
209if test "$ip" = ipv6 ; then
210 all_protocols="$all_protocols babel"
211fi
1ec52253
OZ
212all_protocols=`echo $all_protocols | sed 's/ /,/g'`
213
214if test "$with_protocols" = all ; then
215 with_protocols="$all_protocols"
216fi
217
2f9bcf97
MM
218AC_MSG_CHECKING([protocols])
219protocols=`echo "$with_protocols" | sed 's/,/ /g'`
b296730c 220if test "$protocols" = no ; then protocols= ; fi
2f9bcf97
MM
221for a in $protocols ; do
222 if ! test -f $srcdir/proto/$a/Makefile ; then
223 AC_MSG_RESULT(failed)
224 AC_MSG_ERROR([Requested protocol $a not found.])
225 fi
226 AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
227 done
228AC_MSG_RESULT(ok)
49e7e5ee 229AC_SUBST(protocols)
2f9bcf97 230
a07e9d82 231case $sysdesc in
f1aceff5 232 */linux*|*/linux-v6*)
9f387e11
MM
233 AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
234#include <asm/types.h>
235#include <sys/socket.h>
236])
c817b991 237 ;;
a07e9d82
MM
238esac
239
2f9bcf97 240AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
7cb37e6f
OF
241AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
242AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
243AC_TRY_COMPILE([#include <sys/types.h>
244 #include <sys/socket.h>
245 ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
246 [AC_MSG_RESULT(yes)
247 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
248 AC_MSG_RESULT(no))
2f9bcf97 249
e6ff7a08
OZ
250AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
251 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
252
2f9bcf97 253BIRD_CHECK_INTEGERS
2f9bcf97
MM
254BIRD_CHECK_STRUCT_ALIGN
255BIRD_CHECK_TIME_T
620c4f90 256BIRD_CHECK_STRUCT_IP_MREQN
2f9bcf97
MM
257
258if test "$enable_debug" = yes ; then
2f9bcf97 259 AC_DEFINE(DEBUGGING)
6b5ab875
MM
260 if test "$enable_memcheck" = yes ; then
261 AC_CHECK_LIB(dmalloc, dmalloc_debug)
262 if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
263 AC_CHECK_LIB(efence, malloc)
264 fi
7a2105be 265 fi
2f9bcf97
MM
266fi
267
7211be1c
MM
268CLIENT=
269CLIENT_LIBS=
9fac310d 270if test "$enable_client" = yes ; then
8322ecde 271 CLIENT=birdc
7211be1c
MM
272 AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
273 AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
274 AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
489c308a 275 AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
9ae0f4b7
OZ
276 AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo,
277 AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap,
278 AC_MSG_ERROR([[The client requires ncurses library. Either install the library or use --disable-client to compile without the client.]]))))))
1d4ba658 279 AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
df0cf75d 280 AC_MSG_ERROR([[The client requires GNU readline library 2.1 or newer. Either install the library or use --disable-client to compile without the client.]]), $USE_TERMCAP_LIB)
6de62923
OF
281 AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
282 AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
9fac310d
MM
283fi
284AC_SUBST(CLIENT)
7211be1c 285AC_SUBST(CLIENT_LIBS)
9fac310d 286
54165b13 287mkdir -p $objdir/sysdep
7cb37e6f 288AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
22122d4d
OF
289AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
290$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
291 [[srcdir=$srcdir]
292 [srcdir_rel=$srcdir_rel]
293 [objdir=$objdir]
294 [sysdep_dirs="$sysdep_dirs"]])
295AC_CONFIG_FILES($makefiles)
296AC_OUTPUT
2f9bcf97 297
acc93efd
OZ
298rm -f $objdir/sysdep/paths.h
299
2f9bcf97
MM
300cat >&AC_FD_MSG <<EOF
301
302BIRD was configured with the following options:
b296730c
MM
303 Source directory: $srcdir
304 Object directory: $objdir
acc93efd 305 Iproute2 directory: $iproutedir
49e7e5ee 306 System configuration: $sysdesc
2f9bcf97 307 Debugging: $enable_debug
1ec52253 308 POSIX threads: $enable_pthreads
2f9bcf97 309 Routing protocols: $protocols
9fac310d 310 Client: $enable_client
2f9bcf97 311EOF
b296730c 312rm -f $objdir/.*-stamp