Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ f9254d23

History | View | Annotate | Download (5.52 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: disabled)],,enable_debug=no)
10
AC_ARG_ENABLE(warnings,[  --enable-warnings       enable extra warnings (default: disabled)],,enable_warnings=no)
11
AC_ARG_ENABLE(client,[  --enable-client         enable building of BIRD client (default: enabled)],,enable_client=yes)
12
AC_ARG_ENABLE(ipv6,[  --enable-ipv6           enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
13
AC_ARG_WITH(sysconfig,[  --with-sysconfig=FILE   use specified BIRD system configuration file])
14
AC_ARG_WITH(protocols,[  --with-protocols=LIST   include specified routing protocols (default: all)],,[with_protocols="all"])
15
AC_ARG_WITH(sysinclude,[  --with-sysinclude=PATH  search for system includes on specified place])
16

    
17
if test "$srcdir" = . ; then
18
	# Building in current directory => create obj directory holding all objects
19
	objdir=obj
20
	mkdir -p obj
21
	srcdir_rel=..
22
	makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
23
	exedir=..
24
else
25
	# Building in separate directory
26
	objdir=.
27
	srcdir_rel=$srcdir
28
	makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
29
	exedir=.
30
fi
31
case $srcdir_rel in
32
	/*)	srcdir_rel_mf=$srcdir_rel ;;
33
	*)	srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
34
esac
35
AC_SUBST(objdir)
36
AC_SUBST(exedir)
37
AC_SUBST(srcdir_rel_mf)
38

    
39
if test "$enable_ipv6" = yes ; then
40
	ip=ipv6
41
	if test "$with_protocols" = all ; then
42
		with_protocols=bgp,pipe,rip,static
43
	fi
44
else
45
	ip=ipv4
46
	if test "$with_protocols" = all ; then
47
		with_protocols=bgp,ospf,pipe,rip,static
48
	fi
49
fi
50

    
51
AC_CANONICAL_HOST
52
AC_MSG_CHECKING([which OS configuration should we use])
53
if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
54
	if test -f $with_sysconfig ; then
55
		sysdesc=$with_sysconfig
56
	else
57
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
58
		if ! test -f $sysdesc ; then
59
			sysdesc=$sysdesc.h
60
		fi
61
	fi
62
elif test -f sysconfig.h ; then
63
	sysdesc=sysconfig
64
else
65
	case "$ip:$host_os" in
66
		ipv4:linux*)	case `uname -r` in
67
					1.*|2.0.*)	sysdesc=linux-20 ;;
68
					*)		sysdesc=linux-22 ;;
69
					esac
70
				;;
71
		ipv6:linux*)	sysdesc=linux-v6
72
				;;
73
		*)		AC_MSG_RESULT(unknown)
74
				AC_MSG_ERROR([Cannot determine correct system configuration.])
75
				;;
76
		esac
77
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
78
fi
79
AC_MSG_RESULT($sysdesc)
80
if ! test -f $sysdesc ; then
81
	AC_MSG_ERROR([The system configuration file is missing.])
82
fi
83
sysname=`echo $sysdesc | sed 's/\.h$//'`
84
AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
85

    
86
AC_MSG_CHECKING([system-dependent directories])
87
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
88
AC_MSG_RESULT($sysdep_dirs)
89
AC_SUBST(sysdep_dirs)
90

    
91
AC_MSG_CHECKING([protocols])
92
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
93
if test "$protocols" = no ; then protocols= ; fi
94
for a in $protocols ; do
95
	if ! test -f $srcdir/proto/$a/Makefile ; then
96
		AC_MSG_RESULT(failed)
97
		AC_MSG_ERROR([Requested protocol $a not found.])
98
		fi
99
	AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
100
	done
101
AC_MSG_RESULT(ok)
102
AC_SUBST(protocols)
103

    
104
AC_PROG_CC
105
if test -z "$GCC" ; then
106
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
107
	fi
108
AC_MSG_CHECKING([what CFLAGS should we use])
109
if test "$ac_test_CFLAGS" != set ; then
110
	if test "$enable_warnings" = yes ; then
111
		WARNS=""
112
	else
113
		WARNS=" -Wno-unused"
114
	fi
115
	CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-parentheses$WARNS"
116
fi
117
if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
118
	CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
119
fi
120
AC_MSG_RESULT($CFLAGS)
121

    
122
AC_PROG_CPP
123
AC_PROG_INSTALL
124
AC_PROG_RANLIB
125
AC_CHECK_PROG(FLEX, flex, flex)
126
AC_CHECK_PROG(BISON, bison, bison)
127
AC_CHECK_PROGS(M4, gm4 m4, m4)
128
if test -z "$FLEX" -o -z "$BISON" -o -z "$M4" ; then
129
	AC_MSG_ERROR([Some tools required for building BIRD are missing.])
130
	fi
131

    
132
case $sysdesc in
133
	*/linux-22*|*/linux-v6*)
134
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])])
135
		;;
136
esac
137

    
138
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
139

    
140
BIRD_CHECK_INTEGERS
141
BIRD_CHECK_ENDIAN
142
BIRD_CHECK_STRUCT_ALIGN
143
BIRD_CHECK_TIME_T
144
BIRD_CHECK_STRUCT_IP_MREQN
145

    
146
if test "$enable_debug" = yes ; then
147
	AC_DEFINE(DEBUGGING)
148
	AC_CHECK_LIB(dmalloc, dmalloc_debug)
149
	if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
150
		AC_CHECK_LIB(efence, malloc)
151
	fi
152
fi
153

    
154
CLIENT=
155
CLIENT_LIBS=
156
if test "$enable_client" = yes ; then
157
	CLIENT=client
158
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
159
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
160
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
161
			AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))
162
	AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
163
		AC_MSG_ERROR([[The client requires GNU readline library 2.1 or newer. Either install the library or use --disable-client to compile without the client.]]), $USE_TERMCAP_LIB)
164
fi
165
AC_SUBST(CLIENT)
166
AC_SUBST(CLIENT_LIBS)
167

    
168
mkdir -p $objdir/sysdep
169
AC_CONFIG_HEADER($objdir/sysdep/autoconf.h:sysdep/autoconf.h.in)
170
AC_OUTPUT_COMMANDS(,[CPP="$CPP" $srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs])
171
AC_OUTPUT($makefiles)
172

    
173
cat >&AC_FD_MSG <<EOF
174

    
175
BIRD was configured with the following options:
176
	Source directory:	$srcdir
177
	Object directory:	$objdir
178
	System configuration:	$sysdesc
179
	Debugging:		$enable_debug
180
	Routing protocols:	$protocols
181
	Client:			$enable_client
182
EOF
183
rm -f $objdir/.*-stamp