Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ 54165b13

History | View | Annotate | Download (4.37 KB)

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,pipe)],,[with_protocols="rip,static,pipe"])
12
AC_ARG_WITH(sysinclude,[  --with-sysinclude=PATH  search for system includes on specified place])
13

    
14
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
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
		sysdesc=$with_sysconfig
41
	else
42
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
43
		if ! test -f $sysdesc ; then
44
			sysdesc=$sysdesc.h
45
		fi
46
	fi
47
elif test -f sysconfig.h ; then
48
	sysdesc=sysconfig
49
else
50
	case "$host_os" in
51
		linux*)		case `uname -r` in
52
					1.*|2.0.*)	sysdesc=linux-20 ;;
53
					*)		sysdesc=linux-21 ;;
54
					esac
55
				;;
56
		*)		AC_MSG_RESULT(unknown)
57
				AC_MSG_ERROR([Cannot determine correct system configuration.])
58
				;;
59
		esac
60
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
61
fi
62
AC_MSG_RESULT($sysdesc)
63
if ! test -f $sysdesc ; then
64
	AC_MSG_ERROR([The system configuration file is missing.])
65
fi
66
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

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

    
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
if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
96
	CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
97
fi
98
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
AC_CHECK_PROGS(M4, gm4 m4, m4)
106
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
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
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
BIRD_CHECK_STRUCT_IP_MREQN
122

    
123
if test "$enable_debug" = yes ; then
124
	AC_DEFINE(PATH_CONFIG_DIR, ".")
125
	AC_DEFINE(PATH_CONTROL_SOCKET_DIR, ".")
126
	AC_DEFINE(DEBUGGING)
127
	AC_CHECK_LIB(dmalloc, dmalloc_debug)
128
	if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
129
		AC_CHECK_LIB(efence, malloc)
130
	fi
131
else
132
	AC_DEFINE_UNQUOTED(PATH_CONFIG_DIR, "$sysconfdir")
133
	AC_DEFINE_UNQUOTED(PATH_CONTROL_SOCKET_DIR, "$localstatedir")
134
fi
135

    
136
mkdir -p $objdir/sysdep
137
AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
138
AC_OUTPUT_COMMANDS(,[CPP="$CPP" $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs])
139
AC_OUTPUT($makefiles)
140

    
141
cat >&AC_FD_MSG <<EOF
142

    
143
BIRD was configured with the following options:
144
	Source directory:	$srcdir
145
	Object directory:	$objdir
146
	System configuration:	$sysdesc
147
	Debugging:		$enable_debug
148
	Routing protocols:	$protocols
149
EOF
150
rm -f $objdir/.*-stamp