]> git.ipfire.org Git - thirdparty/bird.git/blame - configure.in
New makefiles. Includes support for out-of-source-tree builds.
[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
3dnl ** (c) 1999 Martin Mares <mj@ucw.cz>
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)
10AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file])
11AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: rip,static)],,[with_protocols="rip,static"])
12
49e7e5ee
MM
13if test "$srcdir" = . ; then
14 # Building in current directory => create obj directory holding all objects
15 objdir=obj
16 mkdir -p obj
17 srcdir_rel=..
18 makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
19 exedir=..
20else
21 # Building in separate directory
22 objdir=.
23 srcdir_rel=$srcdir
24 makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
25 exedir=.
26fi
27case $srcdir_rel in
28 /*) srcdir_rel_mf=$srcdir_rel ;;
29 *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
30esac
31AC_SUBST(objdir)
32AC_SUBST(exedir)
33AC_SUBST(srcdir_rel_mf)
34
2f9bcf97
MM
35AC_CANONICAL_HOST
36AC_MSG_CHECKING([which OS configuration should we use])
37if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
2f9bcf97 38 if test -f $with_sysconfig ; then
49e7e5ee 39 sysdesc=$with_sysconfig
2f9bcf97 40 else
49e7e5ee
MM
41 sysdesc=$srcdir/sysdep/cf/$with_sysconfig
42 if ! test -f $sysdesc ; then
43 sysdesc=$sysdesc.h
44 fi
2f9bcf97
MM
45 fi
46elif test -f sysconfig.h ; then
49e7e5ee 47 sysdesc=sysconfig
2f9bcf97
MM
48else
49 case "$host_os" in
49e7e5ee 50 linux*) sysdesc=linux-20 ;;
2f9bcf97
MM
51 *) AC_MSG_RESULT(unknown)
52 AC_MSG_ERROR([Cannot determine correct system configuration.])
53 ;;
54 esac
49e7e5ee 55 sysdesc=$srcdir/sysdep/cf/$sysdesc.h
2f9bcf97 56fi
49e7e5ee
MM
57AC_MSG_RESULT($sysdesc)
58if ! test -f $sysdesc ; then
2f9bcf97
MM
59 AC_MSG_ERROR([The system configuration file is missing.])
60fi
49e7e5ee
MM
61sysname=`echo $sysdesc | sed 's/\.h$//'`
62AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
63
64AC_MSG_CHECKING([system-dependent directories])
65sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
66AC_MSG_RESULT($sysdep_dirs)
67AC_SUBST(sysdep_dirs)
2f9bcf97
MM
68
69AC_MSG_CHECKING([protocols])
70protocols=`echo "$with_protocols" | sed 's/,/ /g'`
71for a in $protocols ; do
72 if ! test -f $srcdir/proto/$a/Makefile ; then
73 AC_MSG_RESULT(failed)
74 AC_MSG_ERROR([Requested protocol $a not found.])
75 fi
76 AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
77 done
78AC_MSG_RESULT(ok)
49e7e5ee 79AC_SUBST(protocols)
2f9bcf97
MM
80
81AC_PROG_CC
82if test -z "$GCC" ; then
83 AC_MSG_ERROR([This program requires the GNU C Compiler.])
84 fi
85AC_MSG_CHECKING([what CFLAGS should we use])
86if test "$ac_test_CFLAGS" != set ; then
87 CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses"
88fi
89AC_MSG_RESULT($CFLAGS)
90
91AC_PROG_CPP
92AC_PROG_INSTALL
93AC_PROG_RANLIB
94AC_CHECK_PROG(FLEX, flex, flex)
95AC_CHECK_PROG(BISON, bison, bison)
96AC_CHECK_PROG(M4, m4, m4)
97if test -z "$FLEX" -o -z "$BISON" -o -z "$M4" ; then
98 AC_MSG_ERROR([Some tools required for building BIRD are missing.])
99 fi
100
101AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
102
103BIRD_CHECK_INTEGERS
104BIRD_CHECK_ENDIAN
105BIRD_CHECK_STRUCT_ALIGN
106BIRD_CHECK_TIME_T
107
108if test "$enable_debug" = yes ; then
109 AC_DEFINE(PATH_CONFIG_DIR, ".")
110 AC_DEFINE(DEBUGGING)
111else
112 AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir")
113fi
114
115AC_CONFIG_HEADER(sysdep/autoconf.h)
49e7e5ee
MM
116AC_OUTPUT_COMMANDS(,[$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs])
117AC_OUTPUT($makefiles)
2f9bcf97
MM
118
119cat >&AC_FD_MSG <<EOF
120
121BIRD was configured with the following options:
49e7e5ee 122 System configuration: $sysdesc
2f9bcf97
MM
123 Debugging: $enable_debug
124 Routing protocols: $protocols
125EOF