]> git.ipfire.org Git - thirdparty/bird.git/blame_incremental - configure.in
Merge commit 'origin/master' into new
[thirdparty/bird.git] / configure.in
... / ...
CommitLineData
1dnl ** This is a configure script template for BIRD
2dnl ** Process it with autoconf to get ./configure
3dnl ** (c) 1999--2000 Martin Mares <mj@ucw.cz>
4
5AC_REVISION($Id$)
6AC_INIT(conf/confbase.Y)
7AC_CONFIG_AUX_DIR(tools)
8
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(warnings,[ --enable-warnings enable extra warnings (default: disabled)],,enable_warnings=no)
12AC_ARG_ENABLE(client,[ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes)
13AC_ARG_ENABLE(ipv6,[ --enable-ipv6 enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
14AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file])
15AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: all)],,[with_protocols="all"])
16AC_ARG_WITH(sysinclude,[ --with-sysinclude=PATH search for system includes on specified place])
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])
20
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
43if test "$enable_ipv6" = yes ; then
44 ip=ipv6
45 SUFFIX6=6
46else
47 ip=ipv4
48 SUFFIX6=""
49fi
50
51if test "$with_protocols" = all ; then
52 with_protocols=bgp,ospf,pipe,rip,static
53fi
54
55AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
56
57AC_CANONICAL_HOST
58
59AC_PROG_CC
60if test -z "$GCC" ; then
61 AC_MSG_ERROR([This program requires the GNU C Compiler.])
62 fi
63AC_MSG_CHECKING([what CFLAGS should we use])
64if test "$ac_test_CFLAGS" != set ; then
65 if test "$enable_warnings" = yes ; then
66 WARNS=" -Wmissing-prototypes -Wundef"
67 else
68 WARNS=" -Wno-unused"
69 fi
70 CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-pointer-sign -Wno-parentheses$WARNS"
71fi
72if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
73 CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
74fi
75AC_MSG_RESULT($CFLAGS)
76
77AC_PROG_CPP
78AC_PROG_INSTALL
79AC_PROG_RANLIB
80AC_CHECK_PROG(FLEX, flex, flex)
81AC_CHECK_PROG(BISON, bison, bison)
82AC_CHECK_PROGS(M4, gm4 m4)
83
84test -z "$FLEX" && AC_MSG_ERROR([Flex is missing.])
85test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
86test -z "$M4" && AC_MSG_ERROR([M4 is missing.])
87BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
88
89if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
90 if test -f $with_sysconfig ; then
91 sysdesc=$with_sysconfig
92 else
93 sysdesc=$srcdir/sysdep/cf/$with_sysconfig
94 if ! test -f $sysdesc ; then
95 sysdesc=$sysdesc.h
96 fi
97 fi
98elif test -f sysconfig.h ; then
99 sysdesc=sysconfig
100else
101 case "$ip:$host_os" in
102 ipv4:linux*) BIRD_CHECK_LINUX_VERSION
103 case $bird_cv_sys_linux_version in
104 1.*|2.0.*) sysdesc=linux-20 ;;
105 *) sysdesc=linux-22 ;;
106 esac
107 ;;
108 ipv6:linux*) BIRD_CHECK_LINUX_VERSION
109 case $bird_cv_sys_linux_version in
110 1.*|2.0.*) AC_MSG_ERROR([This version of Linux doesn't support IPv6.]) ;;
111 *) sysdesc=linux-v6 ;;
112 esac
113 ;;
114 ipv6:netbsd*) sysdesc=bsd-v6
115 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
116 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
117 ;;
118 ipv4:netbsd*) sysdesc=bsd
119 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
120 LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
121 ;;
122 ipv6:freebsd*) sysdesc=bsd-v6
123 ;;
124 ipv4:freebsd*) sysdesc=bsd
125 ;;
126 ipv6:kfreebsd*) sysdesc=bsd-v6
127 ;;
128 ipv4:kfreebsd*) sysdesc=bsd
129 ;;
130 ipv6:openbsd*) sysdesc=bsd-v6
131 ;;
132 ipv4:openbsd*) sysdesc=bsd
133 ;;
134 *) AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
135 ;;
136 esac
137 sysdesc=$srcdir/sysdep/cf/$sysdesc.h
138fi
139AC_MSG_CHECKING([which OS configuration should we use])
140AC_MSG_RESULT($sysdesc)
141if ! test -f $sysdesc ; then
142 AC_MSG_ERROR([The system configuration file is missing.])
143fi
144sysname=`echo $sysdesc | sed 's/\.h$//'`
145AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
146
147AC_MSG_CHECKING([system-dependent directories])
148sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
149AC_MSG_RESULT($sysdep_dirs)
150AC_SUBST(sysdep_dirs)
151
152AC_MSG_CHECKING([protocols])
153protocols=`echo "$with_protocols" | sed 's/,/ /g'`
154if test "$protocols" = no ; then protocols= ; fi
155for a in $protocols ; do
156 if ! test -f $srcdir/proto/$a/Makefile ; then
157 AC_MSG_RESULT(failed)
158 AC_MSG_ERROR([Requested protocol $a not found.])
159 fi
160 AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
161 done
162AC_MSG_RESULT(ok)
163AC_SUBST(protocols)
164
165case $sysdesc in
166 */linux-22*|*/linux-v6*)
167 AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
168#include <asm/types.h>
169#include <sys/socket.h>
170])
171 ;;
172esac
173
174AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
175AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
176AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
177AC_TRY_COMPILE([#include <sys/types.h>
178 #include <sys/socket.h>
179 ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
180 [AC_MSG_RESULT(yes)
181 AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
182 AC_MSG_RESULT(no))
183
184AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
185 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
186
187BIRD_CHECK_INTEGERS
188BIRD_CHECK_STRUCT_ALIGN
189BIRD_CHECK_TIME_T
190BIRD_CHECK_STRUCT_IP_MREQN
191
192if test "$enable_debug" = yes ; then
193 AC_DEFINE(DEBUGGING)
194 if test "$enable_memcheck" = yes ; then
195 AC_CHECK_LIB(dmalloc, dmalloc_debug)
196 if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
197 AC_CHECK_LIB(efence, malloc)
198 fi
199 fi
200fi
201
202CLIENT=
203CLIENT_LIBS=
204if test "$enable_client" = yes ; then
205 CLIENT=client
206 AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
207 AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
208 AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
209 AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))
210 AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
211 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)
212 AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
213 AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
214fi
215AC_SUBST(CLIENT)
216AC_SUBST(CLIENT_LIBS)
217AC_SUBST(SUFFIX6)
218
219mkdir -p $objdir/sysdep
220AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
221AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
222$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
223 [[srcdir=$srcdir]
224 [srcdir_rel=$srcdir_rel]
225 [objdir=$objdir]
226 [sysdep_dirs="$sysdep_dirs"]])
227AC_CONFIG_FILES($makefiles)
228AC_OUTPUT
229
230cat >&AC_FD_MSG <<EOF
231
232BIRD was configured with the following options:
233 Source directory: $srcdir
234 Object directory: $objdir
235 System configuration: $sysdesc
236 Debugging: $enable_debug
237 Routing protocols: $protocols
238 Client: $enable_client
239EOF
240rm -f $objdir/.*-stamp