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