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