]>
Commit | Line | Data |
---|---|---|
2f9bcf97 MM |
1 | dnl ** This is a configure script template for BIRD |
2 | dnl ** Process it with autoconf to get ./configure | |
3 | dnl ** (c) 1999 Martin Mares <mj@ucw.cz> | |
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) | |
10 | AC_ARG_WITH(sysconfig,[ --with-sysconfig=FILE use specified BIRD system configuration file]) | |
11 | AC_ARG_WITH(protocols,[ --with-protocols=LIST include specified routing protocols (default: rip,static)],,[with_protocols="rip,static"]) | |
12 | ||
49e7e5ee MM |
13 | if 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=.. | |
20 | else | |
21 | # Building in separate directory | |
22 | objdir=. | |
23 | srcdir_rel=$srcdir | |
24 | makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in" | |
25 | exedir=. | |
26 | fi | |
27 | case $srcdir_rel in | |
28 | /*) srcdir_rel_mf=$srcdir_rel ;; | |
29 | *) srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;; | |
30 | esac | |
31 | AC_SUBST(objdir) | |
32 | AC_SUBST(exedir) | |
33 | AC_SUBST(srcdir_rel_mf) | |
34 | ||
2f9bcf97 MM |
35 | AC_CANONICAL_HOST |
36 | AC_MSG_CHECKING([which OS configuration should we use]) | |
37 | if 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 |
46 | elif test -f sysconfig.h ; then | |
49e7e5ee | 47 | sysdesc=sysconfig |
2f9bcf97 MM |
48 | else |
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 | 56 | fi |
49e7e5ee MM |
57 | AC_MSG_RESULT($sysdesc) |
58 | if ! test -f $sysdesc ; then | |
2f9bcf97 MM |
59 | AC_MSG_ERROR([The system configuration file is missing.]) |
60 | fi | |
49e7e5ee MM |
61 | sysname=`echo $sysdesc | sed 's/\.h$//'` |
62 | AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc") | |
63 | ||
64 | AC_MSG_CHECKING([system-dependent directories]) | |
65 | sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib" | |
66 | AC_MSG_RESULT($sysdep_dirs) | |
67 | AC_SUBST(sysdep_dirs) | |
2f9bcf97 MM |
68 | |
69 | AC_MSG_CHECKING([protocols]) | |
70 | protocols=`echo "$with_protocols" | sed 's/,/ /g'` | |
71 | for 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 | |
78 | AC_MSG_RESULT(ok) | |
49e7e5ee | 79 | AC_SUBST(protocols) |
2f9bcf97 MM |
80 | |
81 | AC_PROG_CC | |
82 | if test -z "$GCC" ; then | |
83 | AC_MSG_ERROR([This program requires the GNU C Compiler.]) | |
84 | fi | |
85 | AC_MSG_CHECKING([what CFLAGS should we use]) | |
86 | if test "$ac_test_CFLAGS" != set ; then | |
87 | CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses" | |
88 | fi | |
89 | AC_MSG_RESULT($CFLAGS) | |
90 | ||
91 | AC_PROG_CPP | |
92 | AC_PROG_INSTALL | |
93 | AC_PROG_RANLIB | |
94 | AC_CHECK_PROG(FLEX, flex, flex) | |
95 | AC_CHECK_PROG(BISON, bison, bison) | |
96 | AC_CHECK_PROG(M4, m4, m4) | |
97 | if 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 | ||
101 | AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)]) | |
102 | ||
103 | BIRD_CHECK_INTEGERS | |
104 | BIRD_CHECK_ENDIAN | |
105 | BIRD_CHECK_STRUCT_ALIGN | |
106 | BIRD_CHECK_TIME_T | |
107 | ||
108 | if test "$enable_debug" = yes ; then | |
109 | AC_DEFINE(PATH_CONFIG_DIR, ".") | |
110 | AC_DEFINE(DEBUGGING) | |
111 | else | |
112 | AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir") | |
113 | fi | |
114 | ||
115 | AC_CONFIG_HEADER(sysdep/autoconf.h) | |
49e7e5ee MM |
116 | AC_OUTPUT_COMMANDS(,[$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]) |
117 | AC_OUTPUT($makefiles) | |
2f9bcf97 MM |
118 | |
119 | cat >&AC_FD_MSG <<EOF | |
120 | ||
121 | BIRD was configured with the following options: | |
49e7e5ee | 122 | System configuration: $sysdesc |
2f9bcf97 MM |
123 | Debugging: $enable_debug |
124 | Routing protocols: $protocols | |
125 | EOF |