Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ 9c11ec9e

History | View | Annotate | Download (4.22 KB)

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