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