Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (4.61 KB)

1
dnl ** This is a configure script template for BIRD
2
dnl ** Process it with autoconf to get ./configure
3
dnl ** (c) 1999--2000 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_ENABLE(client,[  --enable-client         enable building of BIRD client (default: enabled)],,enable_client=yes)
11
AC_ARG_WITH(sysconfig,[  --with-sysconfig=FILE   use specified BIRD system configuration file])
12
AC_ARG_WITH(protocols,[  --with-protocols=LIST   include specified routing protocols (default: rip,static,pipe)],,[with_protocols="rip,static,pipe"])
13
AC_ARG_WITH(sysinclude,[  --with-sysinclude=PATH  search for system includes on specified place])
14

    
15
if 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=..
22
else
23
	# Building in separate directory
24
	objdir=.
25
	srcdir_rel=$srcdir
26
	makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
27
	exedir=.
28
fi
29
case $srcdir_rel in
30
	/*)	srcdir_rel_mf=$srcdir_rel ;;
31
	*)	srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
32
esac
33
AC_SUBST(objdir)
34
AC_SUBST(exedir)
35
AC_SUBST(srcdir_rel_mf)
36

    
37
AC_CANONICAL_HOST
38
AC_MSG_CHECKING([which OS configuration should we use])
39
if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
40
	if test -f $with_sysconfig ; then
41
		sysdesc=$with_sysconfig
42
	else
43
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
44
		if ! test -f $sysdesc ; then
45
			sysdesc=$sysdesc.h
46
		fi
47
	fi
48
elif test -f sysconfig.h ; then
49
	sysdesc=sysconfig
50
else
51
	case "$host_os" in
52
		linux*)		case `uname -r` in
53
					1.*|2.0.*)	sysdesc=linux-20 ;;
54
					*)		sysdesc=linux-22 ;;
55
					esac
56
				;;
57
		*)		AC_MSG_RESULT(unknown)
58
				AC_MSG_ERROR([Cannot determine correct system configuration.])
59
				;;
60
		esac
61
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
62
fi
63
AC_MSG_RESULT($sysdesc)
64
if ! test -f $sysdesc ; then
65
	AC_MSG_ERROR([The system configuration file is missing.])
66
fi
67
sysname=`echo $sysdesc | sed 's/\.h$//'`
68
AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
69

    
70
AC_MSG_CHECKING([system-dependent directories])
71
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
72
AC_MSG_RESULT($sysdep_dirs)
73
AC_SUBST(sysdep_dirs)
74

    
75
AC_MSG_CHECKING([protocols])
76
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
77
if test "$protocols" = no ; then protocols= ; fi
78
for 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
85
AC_MSG_RESULT(ok)
86
AC_SUBST(protocols)
87

    
88
AC_PROG_CC
89
if test -z "$GCC" ; then
90
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
91
	fi
92
AC_MSG_CHECKING([what CFLAGS should we use])
93
if test "$ac_test_CFLAGS" != set ; then
94
	CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses"
95
fi
96
if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
97
	CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
98
fi
99
AC_MSG_RESULT($CFLAGS)
100

    
101
AC_PROG_CPP
102
AC_PROG_INSTALL
103
AC_PROG_RANLIB
104
AC_CHECK_PROG(FLEX, flex, flex)
105
AC_CHECK_PROG(BISON, bison, bison)
106
AC_CHECK_PROGS(M4, gm4 m4, m4)
107
if 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

    
111
case $sysdesc in
112
	*/linux-22*)	AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])])
113
			;;
114
esac
115

    
116
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
117

    
118
BIRD_CHECK_INTEGERS
119
BIRD_CHECK_ENDIAN
120
BIRD_CHECK_STRUCT_ALIGN
121
BIRD_CHECK_TIME_T
122
BIRD_CHECK_STRUCT_IP_MREQN
123

    
124
if test "$enable_debug" = yes ; then
125
	AC_DEFINE(PATH_CONFIG_DIR, ".")
126
	AC_DEFINE(PATH_CONTROL_SOCKET_DIR, ".")
127
	AC_DEFINE(DEBUGGING)
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
132
else
133
	AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir")
134
	AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
135
fi
136

    
137
if test "$enable_client" = yes ; then
138
	CLIENT=client
139
else
140
	CLIENT=
141
fi
142
AC_SUBST(CLIENT)
143

    
144
mkdir -p $objdir/sysdep
145
AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
146
AC_OUTPUT_COMMANDS(,[CPP="$CPP" $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs])
147
AC_OUTPUT($makefiles)
148

    
149
cat >&AC_FD_MSG <<EOF
150

    
151
BIRD was configured with the following options:
152
	Source directory:	$srcdir
153
	Object directory:	$objdir
154
	System configuration:	$sysdesc
155
	Debugging:		$enable_debug
156
	Routing protocols:	$protocols
157
	Client:			$enable_client
158
EOF
159
rm -f $objdir/.*-stamp