]> git.ipfire.org Git - thirdparty/bird.git/blame - configure.in
New release 1.1.3
[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
c0760ab0 9AC_ARG_ENABLE(debug,[ --enable-debug enable internal debugging routines (default: disabled)],,enable_debug=no)
6b5ab875 10AC_ARG_ENABLE(memcheck,[ --enable-memcheck check memory allocations when debugging (default: enabled)],,enable_memcheck=yes)
c817b991 11AC_ARG_ENABLE(warnings,[ --enable-warnings enable extra warnings (default: disabled)],,enable_warnings=no)
9fac310d 12AC_ARG_ENABLE(client,[ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes)
c817b991 13AC_ARG_ENABLE(ipv6,[ --enable-ipv6 enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
2f9bcf97 14AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file])
c817b991 15AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: all)],,[with_protocols="all"])
a07e9d82 16AC_ARG_WITH(sysinclude,[ --with-sysinclude=PATH search for system includes on specified place])
8de11deb
OZ
17AC_ARG_VAR([FLEX], [location of the Flex program])
18AC_ARG_VAR([BISON], [location of the Bison program])
19AC_ARG_VAR([M4], [location of the M4 program])
2f9bcf97 20
49e7e5ee
MM
21if test "$srcdir" = . ; then
22 # Building in current directory => create obj directory holding all objects
23 objdir=obj
24 mkdir -p obj
25 srcdir_rel=..
26 makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
27 exedir=..
28else
29 # Building in separate directory
30 objdir=.
31 srcdir_rel=$srcdir
32 makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
33 exedir=.
34fi
35case $srcdir_rel in
36 /*) srcdir_rel_mf=$srcdir_rel ;;
37 *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
38esac
39AC_SUBST(objdir)
40AC_SUBST(exedir)
41AC_SUBST(srcdir_rel_mf)
42
c817b991
MM
43if test "$enable_ipv6" = yes ; then
44 ip=ipv6
dc16584a 45 SUFFIX6=6
c817b991
MM
46 if test "$with_protocols" = all ; then
47 with_protocols=bgp,pipe,rip,static
48 fi
49else
50 ip=ipv4
dc16584a 51 SUFFIX6=""
c817b991
MM
52 if test "$with_protocols" = all ; then
53 with_protocols=bgp,ospf,pipe,rip,static
54 fi
55fi
56
08cca48a 57AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
fd91ae33 58
2f9bcf97 59AC_CANONICAL_HOST
416e3ee4
MM
60
61AC_PROG_CC
62if test -z "$GCC" ; then
63 AC_MSG_ERROR([This program requires the GNU C Compiler.])
64 fi
65AC_MSG_CHECKING([what CFLAGS should we use])
66if test "$ac_test_CFLAGS" != set ; then
67 if test "$enable_warnings" = yes ; then
54c411f6 68 WARNS=" -Wmissing-prototypes -Wundef"
416e3ee4
MM
69 else
70 WARNS=" -Wno-unused"
71 fi
baa9ef18 72 CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-pointer-sign -Wno-parentheses$WARNS"
416e3ee4
MM
73fi
74if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
75 CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
76fi
77AC_MSG_RESULT($CFLAGS)
78
79AC_PROG_CPP
80AC_PROG_INSTALL
81AC_PROG_RANLIB
82AC_CHECK_PROG(FLEX, flex, flex)
83AC_CHECK_PROG(BISON, bison, bison)
8de11deb
OZ
84AC_CHECK_PROGS(M4, gm4 m4)
85
86test -z "$FLEX" && AC_MSG_ERROR([Flex is missing.])
87test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
88test -z "$M4" && AC_MSG_ERROR([M4 is missing.])
89BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
416e3ee4 90
2f9bcf97 91if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
2f9bcf97 92 if test -f $with_sysconfig ; then
49e7e5ee 93 sysdesc=$with_sysconfig
2f9bcf97 94 else
49e7e5ee
MM
95 sysdesc=$srcdir/sysdep/cf/$with_sysconfig
96 if ! test -f $sysdesc ; then
97 sysdesc=$sysdesc.h
98 fi
2f9bcf97
MM
99 fi
100elif test -f sysconfig.h ; then
49e7e5ee 101 sysdesc=sysconfig
2f9bcf97 102else
c817b991 103 case "$ip:$host_os" in
416e3ee4
MM
104 ipv4:linux*) BIRD_CHECK_LINUX_VERSION
105 case $bird_cv_sys_linux_version in
1127ac6e 106 1.*|2.0.*) sysdesc=linux-20 ;;
f2ed663a 107 *) sysdesc=linux-22 ;;
1127ac6e
MM
108 esac
109 ;;
416e3ee4
MM
110 ipv6:linux*) BIRD_CHECK_LINUX_VERSION
111 case $bird_cv_sys_linux_version in
112 1.*|2.0.*) AC_MSG_ERROR([This version of Linux doesn't support IPv6.]) ;;
113 *) sysdesc=linux-v6 ;;
114 esac
c817b991 115 ;;
7cb37e6f 116 ipv6:netbsd*) sysdesc=bsd-v6
d0c64519
OZ
117 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
118 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
7cb37e6f
OF
119 ;;
120 ipv4:netbsd*) sysdesc=bsd
d0c64519
OZ
121 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
122 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
7cb37e6f
OF
123 ;;
124 ipv6:freebsd*) sysdesc=bsd-v6
125 ;;
126 ipv4:freebsd*) sysdesc=bsd
127 ;;
ef9c9ab9
OF
128 ipv6:openbsd*) sysdesc=bsd-v6
129 ;;
130 ipv4:openbsd*) sysdesc=bsd
131 ;;
416e3ee4 132 *) AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
2f9bcf97
MM
133 ;;
134 esac
49e7e5ee 135 sysdesc=$srcdir/sysdep/cf/$sysdesc.h
2f9bcf97 136fi
416e3ee4 137AC_MSG_CHECKING([which OS configuration should we use])
49e7e5ee
MM
138AC_MSG_RESULT($sysdesc)
139if ! test -f $sysdesc ; then
2f9bcf97
MM
140 AC_MSG_ERROR([The system configuration file is missing.])
141fi
49e7e5ee
MM
142sysname=`echo $sysdesc | sed 's/\.h$//'`
143AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
144
145AC_MSG_CHECKING([system-dependent directories])
146sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
147AC_MSG_RESULT($sysdep_dirs)
148AC_SUBST(sysdep_dirs)
2f9bcf97
MM
149
150AC_MSG_CHECKING([protocols])
151protocols=`echo "$with_protocols" | sed 's/,/ /g'`
b296730c 152if test "$protocols" = no ; then protocols= ; fi
2f9bcf97
MM
153for a in $protocols ; do
154 if ! test -f $srcdir/proto/$a/Makefile ; then
155 AC_MSG_RESULT(failed)
156 AC_MSG_ERROR([Requested protocol $a not found.])
157 fi
158 AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
159 done
160AC_MSG_RESULT(ok)
49e7e5ee 161AC_SUBST(protocols)
2f9bcf97 162
a07e9d82 163case $sysdesc in
c817b991 164 */linux-22*|*/linux-v6*)
9f387e11
MM
165 AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
166#include <asm/types.h>
167#include <sys/socket.h>
168])
c817b991 169 ;;
a07e9d82
MM
170esac
171
2f9bcf97 172AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
7cb37e6f
OF
173AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
174AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
175AC_TRY_COMPILE([#include <sys/types.h>
176 #include <sys/socket.h>
177 ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
178 [AC_MSG_RESULT(yes)
179 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
180 AC_MSG_RESULT(no))
2f9bcf97
MM
181
182BIRD_CHECK_INTEGERS
183BIRD_CHECK_ENDIAN
184BIRD_CHECK_STRUCT_ALIGN
185BIRD_CHECK_TIME_T
620c4f90 186BIRD_CHECK_STRUCT_IP_MREQN
2f9bcf97
MM
187
188if test "$enable_debug" = yes ; then
2f9bcf97 189 AC_DEFINE(DEBUGGING)
6b5ab875
MM
190 if test "$enable_memcheck" = yes ; then
191 AC_CHECK_LIB(dmalloc, dmalloc_debug)
192 if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
193 AC_CHECK_LIB(efence, malloc)
194 fi
7a2105be 195 fi
2f9bcf97
MM
196fi
197
7211be1c
MM
198CLIENT=
199CLIENT_LIBS=
9fac310d
MM
200if test "$enable_client" = yes ; then
201 CLIENT=client
7211be1c
MM
202 AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
203 AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
204 AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
205 AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))
1d4ba658 206 AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
df0cf75d 207 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
208 AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
209 AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
9fac310d
MM
210fi
211AC_SUBST(CLIENT)
7211be1c 212AC_SUBST(CLIENT_LIBS)
dc16584a 213AC_SUBST(SUFFIX6)
9fac310d 214
54165b13 215mkdir -p $objdir/sysdep
7cb37e6f 216AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
22122d4d
OF
217AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
218$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
219 [[srcdir=$srcdir]
220 [srcdir_rel=$srcdir_rel]
221 [objdir=$objdir]
222 [sysdep_dirs="$sysdep_dirs"]])
223AC_CONFIG_FILES($makefiles)
224AC_OUTPUT
2f9bcf97
MM
225
226cat >&AC_FD_MSG <<EOF
227
228BIRD was configured with the following options:
b296730c
MM
229 Source directory: $srcdir
230 Object directory: $objdir
49e7e5ee 231 System configuration: $sysdesc
2f9bcf97
MM
232 Debugging: $enable_debug
233 Routing protocols: $protocols
9fac310d 234 Client: $enable_client
2f9bcf97 235EOF
b296730c 236rm -f $objdir/.*-stamp