]> git.ipfire.org Git - thirdparty/bird.git/blame - configure.in
Moan loudly if libreadline is an old version which doesn't support
[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
9AC_ARG_ENABLE(debug,[ --enable-debug enable internal debugging routines (default: enabled)],,enable_debug=yes)
9fac310d 10AC_ARG_ENABLE(client,[ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes)
2f9bcf97 11AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file])
9c11ec9e 12AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: rip,static,pipe)],,[with_protocols="rip,static,pipe"])
a07e9d82 13AC_ARG_WITH(sysinclude,[ --with-sysinclude=PATH search for system includes on specified place])
2f9bcf97 14
49e7e5ee
MM
15if 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=..
22else
23 # Building in separate directory
24 objdir=.
25 srcdir_rel=$srcdir
26 makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
27 exedir=.
28fi
29case $srcdir_rel in
30 /*) srcdir_rel_mf=$srcdir_rel ;;
31 *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
32esac
33AC_SUBST(objdir)
34AC_SUBST(exedir)
35AC_SUBST(srcdir_rel_mf)
36
2f9bcf97
MM
37AC_CANONICAL_HOST
38AC_MSG_CHECKING([which OS configuration should we use])
39if 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
48elif test -f sysconfig.h ; then
49e7e5ee 49 sysdesc=sysconfig
2f9bcf97
MM
50else
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 62fi
49e7e5ee
MM
63AC_MSG_RESULT($sysdesc)
64if ! test -f $sysdesc ; then
2f9bcf97
MM
65 AC_MSG_ERROR([The system configuration file is missing.])
66fi
49e7e5ee
MM
67sysname=`echo $sysdesc | sed 's/\.h$//'`
68AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
69
70AC_MSG_CHECKING([system-dependent directories])
71sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
72AC_MSG_RESULT($sysdep_dirs)
73AC_SUBST(sysdep_dirs)
2f9bcf97
MM
74
75AC_MSG_CHECKING([protocols])
76protocols=`echo "$with_protocols" | sed 's/,/ /g'`
b296730c 77if test "$protocols" = no ; then protocols= ; fi
2f9bcf97
MM
78for 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
85AC_MSG_RESULT(ok)
49e7e5ee 86AC_SUBST(protocols)
2f9bcf97
MM
87
88AC_PROG_CC
89if test -z "$GCC" ; then
90 AC_MSG_ERROR([This program requires the GNU C Compiler.])
91 fi
92AC_MSG_CHECKING([what CFLAGS should we use])
93if test "$ac_test_CFLAGS" != set ; then
94 CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses"
95fi
a07e9d82
MM
96if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
97 CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
98fi
2f9bcf97
MM
99AC_MSG_RESULT($CFLAGS)
100
101AC_PROG_CPP
102AC_PROG_INSTALL
103AC_PROG_RANLIB
104AC_CHECK_PROG(FLEX, flex, flex)
105AC_CHECK_PROG(BISON, bison, bison)
e4912e35 106AC_CHECK_PROGS(M4, gm4 m4, m4)
2f9bcf97
MM
107if 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
111case $sysdesc in
112 */linux-22*) AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])])
113 ;;
114esac
115
2f9bcf97
MM
116AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
117
118BIRD_CHECK_INTEGERS
119BIRD_CHECK_ENDIAN
120BIRD_CHECK_STRUCT_ALIGN
121BIRD_CHECK_TIME_T
620c4f90 122BIRD_CHECK_STRUCT_IP_MREQN
2f9bcf97
MM
123
124if 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
132else
133 AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir")
54165b13 134 AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
2f9bcf97
MM
135fi
136
7211be1c
MM
137CLIENT=
138CLIENT_LIBS=
9fac310d
MM
139if 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
147fi
148AC_SUBST(CLIENT)
7211be1c 149AC_SUBST(CLIENT_LIBS)
9fac310d 150
54165b13
MM
151mkdir -p $objdir/sysdep
152AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
2c2f67bd 153AC_OUTPUT_COMMANDS(,[CPP="$CPP" $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs])
49e7e5ee 154AC_OUTPUT($makefiles)
2f9bcf97
MM
155
156cat >&AC_FD_MSG <<EOF
157
158BIRD 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 165EOF
b296730c 166rm -f $objdir/.*-stamp