]>
Commit | Line | Data |
---|---|---|
2f9bcf97 MM |
1 | dnl ** This is a configure script template for BIRD |
2 | dnl ** Process it with autoconf to get ./configure | |
9fac310d | 3 | dnl ** (c) 1999--2000 Martin Mares <mj@ucw.cz> |
2f9bcf97 MM |
4 | |
5 | AC_REVISION($Id$) | |
6 | AC_INIT(conf/confbase.Y) | |
7 | AC_CONFIG_AUX_DIR(tools) | |
8 | ||
c0760ab0 | 9 | AC_ARG_ENABLE(debug,[ --enable-debug enable internal debugging routines (default: disabled)],,enable_debug=no) |
6b5ab875 | 10 | AC_ARG_ENABLE(memcheck,[ --enable-memcheck check memory allocations when debugging (default: enabled)],,enable_memcheck=yes) |
c817b991 | 11 | AC_ARG_ENABLE(warnings,[ --enable-warnings enable extra warnings (default: disabled)],,enable_warnings=no) |
9fac310d | 12 | AC_ARG_ENABLE(client,[ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes) |
c817b991 | 13 | AC_ARG_ENABLE(ipv6,[ --enable-ipv6 enable building of IPv6 version (default: disabled)],,enable_ipv6=no) |
2f9bcf97 | 14 | AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file]) |
c817b991 | 15 | AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: all)],,[with_protocols="all"]) |
a07e9d82 | 16 | AC_ARG_WITH(sysinclude,[ --with-sysinclude=PATH search for system includes on specified place]) |
2f9bcf97 | 17 | |
49e7e5ee MM |
18 | if 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=.. | |
25 | else | |
26 | # Building in separate directory | |
27 | objdir=. | |
28 | srcdir_rel=$srcdir | |
29 | makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in" | |
30 | exedir=. | |
31 | fi | |
32 | case $srcdir_rel in | |
33 | /*) srcdir_rel_mf=$srcdir_rel ;; | |
34 | *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;; | |
35 | esac | |
36 | AC_SUBST(objdir) | |
37 | AC_SUBST(exedir) | |
38 | AC_SUBST(srcdir_rel_mf) | |
39 | ||
c817b991 MM |
40 | if test "$enable_ipv6" = yes ; then |
41 | ip=ipv6 | |
42 | if test "$with_protocols" = all ; then | |
43 | with_protocols=bgp,pipe,rip,static | |
44 | fi | |
45 | else | |
46 | ip=ipv4 | |
47 | if test "$with_protocols" = all ; then | |
48 | with_protocols=bgp,ospf,pipe,rip,static | |
49 | fi | |
50 | fi | |
51 | ||
2f9bcf97 | 52 | AC_CANONICAL_HOST |
416e3ee4 MM |
53 | |
54 | AC_PROG_CC | |
55 | if test -z "$GCC" ; then | |
56 | AC_MSG_ERROR([This program requires the GNU C Compiler.]) | |
57 | fi | |
58 | AC_MSG_CHECKING([what CFLAGS should we use]) | |
59 | if 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 |
66 | fi |
67 | if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then | |
68 | CPPFLAGS="$CPPFLAGS -I$with_sysinclude" | |
69 | fi | |
70 | AC_MSG_RESULT($CFLAGS) | |
71 | ||
72 | AC_PROG_CPP | |
73 | AC_PROG_INSTALL | |
74 | AC_PROG_RANLIB | |
75 | AC_CHECK_PROG(FLEX, flex, flex) | |
76 | AC_CHECK_PROG(BISON, bison, bison) | |
77 | AC_CHECK_PROGS(M4, gm4 m4, m4) | |
78 | if 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 | 82 | if 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 |
91 | elif test -f sysconfig.h ; then | |
49e7e5ee | 92 | sysdesc=sysconfig |
2f9bcf97 | 93 | else |
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 | 119 | fi |
416e3ee4 | 120 | AC_MSG_CHECKING([which OS configuration should we use]) |
49e7e5ee MM |
121 | AC_MSG_RESULT($sysdesc) |
122 | if ! test -f $sysdesc ; then | |
2f9bcf97 MM |
123 | AC_MSG_ERROR([The system configuration file is missing.]) |
124 | fi | |
49e7e5ee MM |
125 | sysname=`echo $sysdesc | sed 's/\.h$//'` |
126 | AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc") | |
127 | ||
128 | AC_MSG_CHECKING([system-dependent directories]) | |
129 | sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib" | |
130 | AC_MSG_RESULT($sysdep_dirs) | |
131 | AC_SUBST(sysdep_dirs) | |
2f9bcf97 MM |
132 | |
133 | AC_MSG_CHECKING([protocols]) | |
134 | protocols=`echo "$with_protocols" | sed 's/,/ /g'` | |
b296730c | 135 | if test "$protocols" = no ; then protocols= ; fi |
2f9bcf97 MM |
136 | for 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 | |
143 | AC_MSG_RESULT(ok) | |
49e7e5ee | 144 | AC_SUBST(protocols) |
2f9bcf97 | 145 | |
a07e9d82 | 146 | case $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 |
153 | esac |
154 | ||
2f9bcf97 | 155 | AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)]) |
7cb37e6f OF |
156 | AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)]) |
157 | AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len) | |
158 | AC_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 | |
165 | BIRD_CHECK_INTEGERS | |
166 | BIRD_CHECK_ENDIAN | |
167 | BIRD_CHECK_STRUCT_ALIGN | |
168 | BIRD_CHECK_TIME_T | |
620c4f90 | 169 | BIRD_CHECK_STRUCT_IP_MREQN |
2f9bcf97 MM |
170 | |
171 | if 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 |
179 | fi |
180 | ||
7211be1c MM |
181 | CLIENT= |
182 | CLIENT_LIBS= | |
9fac310d MM |
183 | if 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 |
193 | fi |
194 | AC_SUBST(CLIENT) | |
7211be1c | 195 | AC_SUBST(CLIENT_LIBS) |
9fac310d | 196 | |
54165b13 | 197 | mkdir -p $objdir/sysdep |
7cb37e6f | 198 | AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in]) |
22122d4d OF |
199 | AC_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"]]) | |
205 | AC_CONFIG_FILES($makefiles) | |
206 | AC_OUTPUT | |
2f9bcf97 MM |
207 | |
208 | cat >&AC_FD_MSG <<EOF | |
209 | ||
210 | BIRD 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 | 217 | EOF |
b296730c | 218 | rm -f $objdir/.*-stamp |