]> git.ipfire.org Git - thirdparty/bird.git/blame - configure.in
Added --enable-ipv6 which tells configure to select the right configuration
[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)
c817b991 10AC_ARG_ENABLE(warnings,[ --enable-warnings enable extra warnings (default: disabled)],,enable_warnings=no)
9fac310d 11AC_ARG_ENABLE(client,[ --enable-client enable building of BIRD client (default: enabled)],,enable_client=yes)
c817b991 12AC_ARG_ENABLE(ipv6,[ --enable-ipv6 enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
2f9bcf97 13AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file])
c817b991 14AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: all)],,[with_protocols="all"])
a07e9d82 15AC_ARG_WITH(sysinclude,[ --with-sysinclude=PATH search for system includes on specified place])
2f9bcf97 16
49e7e5ee
MM
17if 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=..
24else
25 # Building in separate directory
26 objdir=.
27 srcdir_rel=$srcdir
28 makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
29 exedir=.
30fi
31case $srcdir_rel in
32 /*) srcdir_rel_mf=$srcdir_rel ;;
33 *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
34esac
35AC_SUBST(objdir)
36AC_SUBST(exedir)
37AC_SUBST(srcdir_rel_mf)
38
c817b991
MM
39if test "$enable_ipv6" = yes ; then
40 ip=ipv6
41 if test "$with_protocols" = all ; then
42 with_protocols=bgp,pipe,rip,static
43 fi
44else
45 ip=ipv4
46 if test "$with_protocols" = all ; then
47 with_protocols=bgp,ospf,pipe,rip,static
48 fi
49fi
50
2f9bcf97
MM
51AC_CANONICAL_HOST
52AC_MSG_CHECKING([which OS configuration should we use])
53if 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
62elif test -f sysconfig.h ; then
49e7e5ee 63 sysdesc=sysconfig
2f9bcf97 64else
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 78fi
49e7e5ee
MM
79AC_MSG_RESULT($sysdesc)
80if ! test -f $sysdesc ; then
2f9bcf97
MM
81 AC_MSG_ERROR([The system configuration file is missing.])
82fi
49e7e5ee
MM
83sysname=`echo $sysdesc | sed 's/\.h$//'`
84AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
85
86AC_MSG_CHECKING([system-dependent directories])
87sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
88AC_MSG_RESULT($sysdep_dirs)
89AC_SUBST(sysdep_dirs)
2f9bcf97
MM
90
91AC_MSG_CHECKING([protocols])
92protocols=`echo "$with_protocols" | sed 's/,/ /g'`
b296730c 93if test "$protocols" = no ; then protocols= ; fi
2f9bcf97
MM
94for 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
101AC_MSG_RESULT(ok)
49e7e5ee 102AC_SUBST(protocols)
2f9bcf97
MM
103
104AC_PROG_CC
105if test -z "$GCC" ; then
106 AC_MSG_ERROR([This program requires the GNU C Compiler.])
107 fi
108AC_MSG_CHECKING([what CFLAGS should we use])
109if 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 116fi
a07e9d82
MM
117if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
118 CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
119fi
2f9bcf97
MM
120AC_MSG_RESULT($CFLAGS)
121
122AC_PROG_CPP
123AC_PROG_INSTALL
124AC_PROG_RANLIB
125AC_CHECK_PROG(FLEX, flex, flex)
126AC_CHECK_PROG(BISON, bison, bison)
e4912e35 127AC_CHECK_PROGS(M4, gm4 m4, m4)
2f9bcf97
MM
128if 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 132case $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
136esac
137
2f9bcf97
MM
138AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
139
140BIRD_CHECK_INTEGERS
141BIRD_CHECK_ENDIAN
142BIRD_CHECK_STRUCT_ALIGN
143BIRD_CHECK_TIME_T
620c4f90 144BIRD_CHECK_STRUCT_IP_MREQN
2f9bcf97
MM
145
146if 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
154else
155 AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir")
54165b13 156 AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
2f9bcf97
MM
157fi
158
7211be1c
MM
159CLIENT=
160CLIENT_LIBS=
9fac310d
MM
161if 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
169fi
170AC_SUBST(CLIENT)
7211be1c 171AC_SUBST(CLIENT_LIBS)
9fac310d 172
54165b13
MM
173mkdir -p $objdir/sysdep
174AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
2c2f67bd 175AC_OUTPUT_COMMANDS(,[CPP="$CPP" $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs])
49e7e5ee 176AC_OUTPUT($makefiles)
2f9bcf97
MM
177
178cat >&AC_FD_MSG <<EOF
179
180BIRD 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 187EOF
b296730c 188rm -f $objdir/.*-stamp