]>
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 | ||
9 | AC_ARG_ENABLE(debug,[ --enable-debug enable internal debugging routines (default: enabled)],,enable_debug=yes) | |
c817b991 | 10 | AC_ARG_ENABLE(warnings,[ --enable-warnings enable extra warnings (default: disabled)],,enable_warnings=no) |
9fac310d | 11 | AC_ARG_ENABLE(client,[ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes) |
c817b991 | 12 | AC_ARG_ENABLE(ipv6,[ --enable-ipv6 enable building of IPv6 version (default: disabled)],,enable_ipv6=no) |
2f9bcf97 | 13 | AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file]) |
c817b991 | 14 | AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: all)],,[with_protocols="all"]) |
a07e9d82 | 15 | AC_ARG_WITH(sysinclude,[ --with-sysinclude=PATH search for system includes on specified place]) |
2f9bcf97 | 16 | |
49e7e5ee MM |
17 | if test "$srcdir" = . ; then |
18 | # Building in current directory => create obj directory holding all objects | |
19 | objdir=obj | |
20 | mkdir -p obj | |
21 | srcdir_rel=.. | |
22 | makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in" | |
23 | exedir=.. | |
24 | else | |
25 | # Building in separate directory | |
26 | objdir=. | |
27 | srcdir_rel=$srcdir | |
28 | makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in" | |
29 | exedir=. | |
30 | fi | |
31 | case $srcdir_rel in | |
32 | /*) srcdir_rel_mf=$srcdir_rel ;; | |
33 | *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;; | |
34 | esac | |
35 | AC_SUBST(objdir) | |
36 | AC_SUBST(exedir) | |
37 | AC_SUBST(srcdir_rel_mf) | |
38 | ||
c817b991 MM |
39 | if test "$enable_ipv6" = yes ; then |
40 | ip=ipv6 | |
41 | if test "$with_protocols" = all ; then | |
42 | with_protocols=bgp,pipe,rip,static | |
43 | fi | |
44 | else | |
45 | ip=ipv4 | |
46 | if test "$with_protocols" = all ; then | |
47 | with_protocols=bgp,ospf,pipe,rip,static | |
48 | fi | |
49 | fi | |
50 | ||
2f9bcf97 MM |
51 | AC_CANONICAL_HOST |
52 | AC_MSG_CHECKING([which OS configuration should we use]) | |
53 | if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then | |
2f9bcf97 | 54 | if test -f $with_sysconfig ; then |
49e7e5ee | 55 | sysdesc=$with_sysconfig |
2f9bcf97 | 56 | else |
49e7e5ee MM |
57 | sysdesc=$srcdir/sysdep/cf/$with_sysconfig |
58 | if ! test -f $sysdesc ; then | |
59 | sysdesc=$sysdesc.h | |
60 | fi | |
2f9bcf97 MM |
61 | fi |
62 | elif test -f sysconfig.h ; then | |
49e7e5ee | 63 | sysdesc=sysconfig |
2f9bcf97 | 64 | else |
c817b991 MM |
65 | case "$ip:$host_os" in |
66 | ipv4:linux*) case `uname -r` in | |
1127ac6e | 67 | 1.*|2.0.*) sysdesc=linux-20 ;; |
f2ed663a | 68 | *) sysdesc=linux-22 ;; |
1127ac6e MM |
69 | esac |
70 | ;; | |
c817b991 MM |
71 | ipv6:linux*) sysdesc=linux-v6 |
72 | ;; | |
2f9bcf97 MM |
73 | *) AC_MSG_RESULT(unknown) |
74 | AC_MSG_ERROR([Cannot determine correct system configuration.]) | |
75 | ;; | |
76 | esac | |
49e7e5ee | 77 | sysdesc=$srcdir/sysdep/cf/$sysdesc.h |
2f9bcf97 | 78 | fi |
49e7e5ee MM |
79 | AC_MSG_RESULT($sysdesc) |
80 | if ! test -f $sysdesc ; then | |
2f9bcf97 MM |
81 | AC_MSG_ERROR([The system configuration file is missing.]) |
82 | fi | |
49e7e5ee MM |
83 | sysname=`echo $sysdesc | sed 's/\.h$//'` |
84 | AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc") | |
85 | ||
86 | AC_MSG_CHECKING([system-dependent directories]) | |
87 | sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib" | |
88 | AC_MSG_RESULT($sysdep_dirs) | |
89 | AC_SUBST(sysdep_dirs) | |
2f9bcf97 MM |
90 | |
91 | AC_MSG_CHECKING([protocols]) | |
92 | protocols=`echo "$with_protocols" | sed 's/,/ /g'` | |
b296730c | 93 | if test "$protocols" = no ; then protocols= ; fi |
2f9bcf97 MM |
94 | for a in $protocols ; do |
95 | if ! test -f $srcdir/proto/$a/Makefile ; then | |
96 | AC_MSG_RESULT(failed) | |
97 | AC_MSG_ERROR([Requested protocol $a not found.]) | |
98 | fi | |
99 | AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`) | |
100 | done | |
101 | AC_MSG_RESULT(ok) | |
49e7e5ee | 102 | AC_SUBST(protocols) |
2f9bcf97 MM |
103 | |
104 | AC_PROG_CC | |
105 | if test -z "$GCC" ; then | |
106 | AC_MSG_ERROR([This program requires the GNU C Compiler.]) | |
107 | fi | |
108 | AC_MSG_CHECKING([what CFLAGS should we use]) | |
109 | if test "$ac_test_CFLAGS" != set ; then | |
c817b991 MM |
110 | if test "$enable_warnings" = yes ; then |
111 | WARNS="" | |
112 | else | |
113 | WARNS=" -Wno-unused" | |
114 | fi | |
115 | CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-parentheses$WARNS" | |
2f9bcf97 | 116 | fi |
a07e9d82 MM |
117 | if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then |
118 | CPPFLAGS="$CPPFLAGS -I$with_sysinclude" | |
119 | fi | |
2f9bcf97 MM |
120 | AC_MSG_RESULT($CFLAGS) |
121 | ||
122 | AC_PROG_CPP | |
123 | AC_PROG_INSTALL | |
124 | AC_PROG_RANLIB | |
125 | AC_CHECK_PROG(FLEX, flex, flex) | |
126 | AC_CHECK_PROG(BISON, bison, bison) | |
e4912e35 | 127 | AC_CHECK_PROGS(M4, gm4 m4, m4) |
2f9bcf97 MM |
128 | if test -z "$FLEX" -o -z "$BISON" -o -z "$M4" ; then |
129 | AC_MSG_ERROR([Some tools required for building BIRD are missing.]) | |
130 | fi | |
131 | ||
a07e9d82 | 132 | case $sysdesc in |
c817b991 MM |
133 | */linux-22*|*/linux-v6*) |
134 | AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])]) | |
135 | ;; | |
a07e9d82 MM |
136 | esac |
137 | ||
2f9bcf97 MM |
138 | AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)]) |
139 | ||
140 | BIRD_CHECK_INTEGERS | |
141 | BIRD_CHECK_ENDIAN | |
142 | BIRD_CHECK_STRUCT_ALIGN | |
143 | BIRD_CHECK_TIME_T | |
620c4f90 | 144 | BIRD_CHECK_STRUCT_IP_MREQN |
2f9bcf97 MM |
145 | |
146 | if test "$enable_debug" = yes ; then | |
147 | AC_DEFINE(PATH_CONFIG_DIR, ".") | |
54165b13 | 148 | AC_DEFINE(PATH_CONTROL_SOCKET_DIR, ".") |
2f9bcf97 | 149 | AC_DEFINE(DEBUGGING) |
7a2105be MM |
150 | AC_CHECK_LIB(dmalloc, dmalloc_debug) |
151 | if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then | |
152 | AC_CHECK_LIB(efence, malloc) | |
153 | fi | |
2f9bcf97 MM |
154 | else |
155 | AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir") | |
54165b13 | 156 | AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir") |
2f9bcf97 MM |
157 | fi |
158 | ||
7211be1c MM |
159 | CLIENT= |
160 | CLIENT_LIBS= | |
9fac310d MM |
161 | if test "$enable_client" = yes ; then |
162 | CLIENT=client | |
7211be1c MM |
163 | AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory") |
164 | AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses, | |
165 | AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses, | |
166 | AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap))) | |
1d4ba658 | 167 | AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB", |
df0cf75d | 168 | 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) |
9fac310d MM |
169 | fi |
170 | AC_SUBST(CLIENT) | |
7211be1c | 171 | AC_SUBST(CLIENT_LIBS) |
9fac310d | 172 | |
54165b13 MM |
173 | mkdir -p $objdir/sysdep |
174 | AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in) | |
2c2f67bd | 175 | AC_OUTPUT_COMMANDS(,[CPP="$CPP" $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]) |
49e7e5ee | 176 | AC_OUTPUT($makefiles) |
2f9bcf97 MM |
177 | |
178 | cat >&AC_FD_MSG <<EOF | |
179 | ||
180 | BIRD was configured with the following options: | |
b296730c MM |
181 | Source directory: $srcdir |
182 | Object directory: $objdir | |
49e7e5ee | 183 | System configuration: $sysdesc |
2f9bcf97 MM |
184 | Debugging: $enable_debug |
185 | Routing protocols: $protocols | |
9fac310d | 186 | Client: $enable_client |
2f9bcf97 | 187 | EOF |
b296730c | 188 | rm -f $objdir/.*-stamp |