Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ ab188fb7

History | View | Annotate | Download (8.36 KB)

1 2f9bcf97 Martin Mares
dnl ** This is a configure script template for BIRD
2
dnl ** Process it with autoconf to get ./configure
3 9fac310d Martin Mares
dnl ** (c) 1999--2000 Martin Mares <mj@ucw.cz>
4 2f9bcf97 Martin Mares
5
AC_REVISION($Id$)
6
AC_INIT(conf/confbase.Y)
7
AC_CONFIG_AUX_DIR(tools)
8
9 ab188fb7 Ondrej Zajicek
AC_ARG_ENABLE(debug,	[  --enable-debug          enable internal debugging routines (default: disabled)],,enable_debug=no)
10
AC_ARG_ENABLE(memcheck,	[  --enable-memcheck       check memory allocations when debugging (default: enabled)],,enable_memcheck=yes)
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(suffix,	[  --with-suffix=STRING    use specified suffix for BIRD files (default: 6 for IPv6 version)],[given_suffix="yes"])
14
AC_ARG_WITH(sysconfig,	[  --with-sysconfig=FILE   use specified BIRD system configuration file])
15
AC_ARG_WITH(protocols,	[  --with-protocols=LIST   include specified routing protocols (default: all)],,[with_protocols="all"])
16
AC_ARG_WITH(sysinclude,	[  --with-sysinclude=PATH  search for system includes on specified place])
17
AC_ARG_WITH(runtimedir,	[  --with-runtimedir=PATH  path for runtime files (default: $(localstatedir)/run)],[runtimedir="$with_runtimedir"],[runtimedir="\$(localstatedir)/run"])
18
AC_ARG_WITH(iproutedir,	[  --with-iproutedir=PATH  path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
19
AC_ARG_VAR([FLEX], [location of the Flex program])
20
AC_ARG_VAR([BISON], [location of the Bison program])
21
AC_ARG_VAR([M4], [location of the M4 program])
22
23 2f9bcf97 Martin Mares
24 49e7e5ee Martin Mares
if test "$srcdir" = . ; then
25
	# Building in current directory => create obj directory holding all objects
26
	objdir=obj
27
	mkdir -p obj
28
	srcdir_rel=..
29
	makefiles="Makefile:tools/Makefile-top.in obj/Makefile:tools/Makefile.in obj/Rules:tools/Rules.in"
30
	exedir=..
31
else
32
	# Building in separate directory
33
	objdir=.
34
	srcdir_rel=$srcdir
35
	makefiles="Makefile:tools/Makefile.in Rules:tools/Rules.in"
36
	exedir=.
37
fi
38
case $srcdir_rel in
39
	/*)	srcdir_rel_mf=$srcdir_rel ;;
40
	*)	srcdir_rel_mf="\$(root-rel)$srcdir_rel" ;;
41
esac
42
AC_SUBST(objdir)
43
AC_SUBST(exedir)
44
AC_SUBST(srcdir_rel_mf)
45 ab188fb7 Ondrej Zajicek
AC_SUBST(runtimedir)
46 49e7e5ee Martin Mares
47 c817b991 Martin Mares
if test "$enable_ipv6" = yes ; then
48
	ip=ipv6
49 ab188fb7 Ondrej Zajicek
	SUFFIX=6
50 93e868c7 Ondrej Zajicek
	all_protocols=bgp,ospf,pipe,radv,rip,static
51 c817b991 Martin Mares
else
52
	ip=ipv4
53 ab188fb7 Ondrej Zajicek
	SUFFIX=""
54 93e868c7 Ondrej Zajicek
	all_protocols=bgp,ospf,pipe,rip,static
55 c3226991 Ondrej Zajicek
fi
56
57 ab188fb7 Ondrej Zajicek
if test "$given_suffix" = yes ; then
58
   	SUFFIX="$with_suffix"
59
fi
60
AC_SUBST(SUFFIX)
61
62 c3226991 Ondrej Zajicek
if test "$with_protocols" = all ; then
63 93e868c7 Ondrej Zajicek
	with_protocols="$all_protocols"
64 c817b991 Martin Mares
fi
65
66 ab188fb7 Ondrej Zajicek
if test "$enable_debug" = yes ; then
67
	CONFIG_FILE="bird$SUFFIX.conf"
68
	CONTROL_SOCKET="bird$SUFFIX.ctl"
69
else
70
	CONFIG_FILE="\$(sysconfdir)/bird$SUFFIX.conf"
71
	CONTROL_SOCKET="$runtimedir/bird$SUFFIX.ctl"
72
fi
73
AC_SUBST(CONFIG_FILE)
74
AC_SUBST(CONTROL_SOCKET)
75
76 08cca48a Ondrej Zajicek
AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
77 fd91ae33 Ondrej Zajicek
78 2f9bcf97 Martin Mares
AC_CANONICAL_HOST
79 416e3ee4 Martin Mares
80 b1c030b0 Ondrej Zajicek
# Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
81 416e3ee4 Martin Mares
if test "$ac_test_CFLAGS" != set ; then
82 b1c030b0 Ondrej Zajicek
	bird_cflags_default=yes
83 416e3ee4 Martin Mares
fi
84
85 e81b440f Ondrej Zajicek
AC_PROG_CC
86
if test -z "$GCC" ; then
87
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
88
fi
89
90 b1c030b0 Ondrej Zajicek
AC_MSG_CHECKING([what CFLAGS should we use])
91 bed41728 Ondrej Zajicek
if test "$bird_cflags_default" = yes ; then
92 b1c030b0 Ondrej Zajicek
	BIRD_CHECK_GCC_OPTIONS
93
94
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
95 bed41728 Ondrej Zajicek
	if test "$bird_cv_c_option_no_pointer_sign" = yes ; then
96 b1c030b0 Ondrej Zajicek
		CFLAGS="$CFLAGS -Wno-pointer-sign"
97
	fi
98
fi
99
AC_MSG_RESULT($CFLAGS)
100
101
102 416e3ee4 Martin Mares
AC_PROG_CPP
103
AC_PROG_INSTALL
104
AC_PROG_RANLIB
105
AC_CHECK_PROG(FLEX, flex, flex)
106
AC_CHECK_PROG(BISON, bison, bison)
107 8de11deb Ondrej Zajicek
AC_CHECK_PROGS(M4, gm4 m4)
108
109
test -z "$FLEX"	 && AC_MSG_ERROR([Flex is missing.])
110
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
111
test -z "$M4"	 && AC_MSG_ERROR([M4 is missing.])
112
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
113 416e3ee4 Martin Mares
114 2f9bcf97 Martin Mares
if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
115
	if test -f $with_sysconfig ; then
116 49e7e5ee Martin Mares
		sysdesc=$with_sysconfig
117 2f9bcf97 Martin Mares
	else
118 49e7e5ee Martin Mares
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
119
		if ! test -f $sysdesc ; then
120
			sysdesc=$sysdesc.h
121
		fi
122 2f9bcf97 Martin Mares
	fi
123
elif test -f sysconfig.h ; then
124 49e7e5ee Martin Mares
	sysdesc=sysconfig
125 2f9bcf97 Martin Mares
else
126 c817b991 Martin Mares
	case "$ip:$host_os" in
127 f1aceff5 Ondrej Zajicek
		ipv6:linux*)	sysdesc=linux-v6
128 acc93efd Ondrej Zajicek
				default_iproutedir="/etc/iproute2"
129 1127ac6e Martin Mares
				;;
130 f1aceff5 Ondrej Zajicek
		ipv4:linux*)	sysdesc=linux
131 acc93efd Ondrej Zajicek
				default_iproutedir="/etc/iproute2"
132 c817b991 Martin Mares
				;;
133 7cb37e6f Ondrej Filip
		ipv6:netbsd*)	sysdesc=bsd-v6
134 d0c64519 Ondrej Zajicek
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
135 646b24d9 Ondrej Zajicek
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
136 7cb37e6f Ondrej Filip
				;;
137
		ipv4:netbsd*)	sysdesc=bsd
138 d0c64519 Ondrej Zajicek
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
139 646b24d9 Ondrej Zajicek
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
140 7cb37e6f Ondrej Filip
				;;
141
		ipv6:freebsd*)	sysdesc=bsd-v6
142
				;;
143
		ipv4:freebsd*)	sysdesc=bsd
144
				;;
145 7965e17d Ondrej Zajicek
		ipv6:kfreebsd*) sysdesc=bsd-v6
146
				;;
147
		ipv4:kfreebsd*) sysdesc=bsd
148
				;;
149 ef9c9ab9 Ondrej Filip
		ipv6:openbsd*)	sysdesc=bsd-v6
150
				;;
151
		ipv4:openbsd*)	sysdesc=bsd
152
				;;
153 416e3ee4 Martin Mares
		*)		AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
154 2f9bcf97 Martin Mares
				;;
155
		esac
156 49e7e5ee Martin Mares
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
157 2f9bcf97 Martin Mares
fi
158 416e3ee4 Martin Mares
AC_MSG_CHECKING([which OS configuration should we use])
159 49e7e5ee Martin Mares
AC_MSG_RESULT($sysdesc)
160
if ! test -f $sysdesc ; then
161 2f9bcf97 Martin Mares
	AC_MSG_ERROR([The system configuration file is missing.])
162
fi
163 49e7e5ee Martin Mares
sysname=`echo $sysdesc | sed 's/\.h$//'`
164
AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
165
166
AC_MSG_CHECKING([system-dependent directories])
167
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
168
AC_MSG_RESULT($sysdep_dirs)
169
AC_SUBST(sysdep_dirs)
170 2f9bcf97 Martin Mares
171 acc93efd Ondrej Zajicek
if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
172
173
if test -n "$given_iproutedir"
174
then iproutedir=$with_iproutedir
175
else iproutedir=$default_iproutedir
176
fi
177
178
AC_SUBST(iproutedir)
179
180 2f9bcf97 Martin Mares
AC_MSG_CHECKING([protocols])
181
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
182 b296730c Martin Mares
if test "$protocols" = no ; then protocols= ; fi
183 2f9bcf97 Martin Mares
for a in $protocols ; do
184
	if ! test -f $srcdir/proto/$a/Makefile ; then
185
		AC_MSG_RESULT(failed)
186
		AC_MSG_ERROR([Requested protocol $a not found.])
187
		fi
188
	AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
189
	done
190
AC_MSG_RESULT(ok)
191 49e7e5ee Martin Mares
AC_SUBST(protocols)
192 2f9bcf97 Martin Mares
193 a07e9d82 Martin Mares
case $sysdesc in
194 f1aceff5 Ondrej Zajicek
	*/linux*|*/linux-v6*)
195 9f387e11 Martin Mares
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
196
#include <asm/types.h>
197
#include <sys/socket.h>
198
])
199 c817b991 Martin Mares
		;;
200 a07e9d82 Martin Mares
esac
201
202 2f9bcf97 Martin Mares
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
203 7cb37e6f Ondrej Filip
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
204
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
205
AC_TRY_COMPILE([#include <sys/types.h>
206
  #include <sys/socket.h>
207
  ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
208
  [AC_MSG_RESULT(yes)
209
  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
210
  AC_MSG_RESULT(no))
211 2f9bcf97 Martin Mares
212 e6ff7a08 Ondrej Zajicek
AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
213
		 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
214
215 2f9bcf97 Martin Mares
BIRD_CHECK_INTEGERS
216
BIRD_CHECK_STRUCT_ALIGN
217
BIRD_CHECK_TIME_T
218 620c4f90 Martin Mares
BIRD_CHECK_STRUCT_IP_MREQN
219 2f9bcf97 Martin Mares
220
if test "$enable_debug" = yes ; then
221
	AC_DEFINE(DEBUGGING)
222 6b5ab875 Martin Mares
	if test "$enable_memcheck" = yes ; then
223
		AC_CHECK_LIB(dmalloc, dmalloc_debug)
224
		if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
225
			AC_CHECK_LIB(efence, malloc)
226
		fi
227 7a2105be Martin Mares
	fi
228 2f9bcf97 Martin Mares
fi
229
230 7211be1c Martin Mares
CLIENT=
231
CLIENT_LIBS=
232 9fac310d Martin Mares
if test "$enable_client" = yes ; then
233
	CLIENT=client
234 7211be1c Martin Mares
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
235
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
236
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
237 489c308a Ondrej Zajicek
			AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
238
				AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo
239
					AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))))
240 1d4ba658 Martin Mares
	AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
241 df0cf75d Martin Mares
		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)
242 6de62923 Ondrej Filip
	AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
243
	AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
244 9fac310d Martin Mares
fi
245
AC_SUBST(CLIENT)
246 7211be1c Martin Mares
AC_SUBST(CLIENT_LIBS)
247 9fac310d Martin Mares
248 54165b13 Martin Mares
mkdir -p $objdir/sysdep
249 7cb37e6f Ondrej Filip
AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
250 22122d4d Ondrej Filip
AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
251
$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
252
	[[srcdir=$srcdir]
253
	[srcdir_rel=$srcdir_rel]
254
	[objdir=$objdir]
255
	[sysdep_dirs="$sysdep_dirs"]])
256
AC_CONFIG_FILES($makefiles)
257
AC_OUTPUT
258 2f9bcf97 Martin Mares
259 acc93efd Ondrej Zajicek
rm -f $objdir/sysdep/paths.h
260
261 2f9bcf97 Martin Mares
cat >&AC_FD_MSG <<EOF
262
263
BIRD was configured with the following options:
264 b296730c Martin Mares
	Source directory:	$srcdir
265
	Object directory:	$objdir
266 acc93efd Ondrej Zajicek
	Iproute2 directory:	$iproutedir
267 49e7e5ee Martin Mares
	System configuration:	$sysdesc
268 2f9bcf97 Martin Mares
	Debugging:		$enable_debug
269
	Routing protocols:	$protocols
270 9fac310d Martin Mares
	Client:			$enable_client
271 2f9bcf97 Martin Mares
EOF
272 b296730c Martin Mares
rm -f $objdir/.*-stamp