Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ 7152e5ef

History | View | Annotate | Download (8.43 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 1ec52253 Ondrej Zajicek
AC_ARG_ENABLE(pthreads,	[  --enable-pthreads       enable POSIX threads support (default: detect)],,enable_pthreads=try)
13 ab188fb7 Ondrej Zajicek
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
AC_ARG_WITH(runtimedir,	[  --with-runtimedir=PATH  path for runtime files (default: $(localstatedir)/run)],[runtimedir="$with_runtimedir"],[runtimedir="\$(localstatedir)/run"])
17
AC_ARG_WITH(iproutedir,	[  --with-iproutedir=PATH  path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
18
AC_ARG_VAR([FLEX], [location of the Flex program])
19
AC_ARG_VAR([BISON], [location of the Bison program])
20
AC_ARG_VAR([M4], [location of the M4 program])
21
22 2f9bcf97 Martin Mares
23 49e7e5ee Martin Mares
if test "$srcdir" = . ; then
24
	# Building in current directory => create obj directory holding all objects
25
	objdir=obj
26
else
27
	# Building in separate directory
28
	objdir=.
29
fi
30 7152e5ef Jan Moskyto Matejka
31
exedir=.
32
33 49e7e5ee Martin Mares
AC_SUBST(objdir)
34
AC_SUBST(exedir)
35 7152e5ef Jan Moskyto Matejka
AC_SUBST(srcdir)
36 ab188fb7 Ondrej Zajicek
AC_SUBST(runtimedir)
37 49e7e5ee Martin Mares
38 ab188fb7 Ondrej Zajicek
39
if test "$enable_debug" = yes ; then
40 d549b83f Ondrej Zajicek (work)
	CONFIG_FILE="bird.conf"
41
	CONTROL_SOCKET="bird.ctl"
42 ab188fb7 Ondrej Zajicek
else
43 d549b83f Ondrej Zajicek (work)
	CONFIG_FILE="\$(sysconfdir)/bird.conf"
44
	CONTROL_SOCKET="$runtimedir/bird.ctl"
45 ab188fb7 Ondrej Zajicek
fi
46
AC_SUBST(CONFIG_FILE)
47
AC_SUBST(CONTROL_SOCKET)
48
49 d7765408 Ondrej Zajicek
AC_SEARCH_LIBS(clock_gettime, [c rt posix4], ,
50
	AC_MSG_ERROR([[Function clock_gettime not available.]]))
51 fd91ae33 Ondrej Zajicek
52 2f9bcf97 Martin Mares
AC_CANONICAL_HOST
53 416e3ee4 Martin Mares
54 b1c030b0 Ondrej Zajicek
# Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
55 416e3ee4 Martin Mares
if test "$ac_test_CFLAGS" != set ; then
56 b1c030b0 Ondrej Zajicek
	bird_cflags_default=yes
57 416e3ee4 Martin Mares
fi
58
59 e81b440f Ondrej Zajicek
AC_PROG_CC
60
if test -z "$GCC" ; then
61
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
62
fi
63
64 547d3bf4 Ondrej Zajicek
# Enable threads by default just in Linux and FreeBSD
65 0e965f69 Jan Moskyto Matejka
#if test "$enable_pthreads" = try ; then
66
#	case "$host_os" in
67
#		(linux* | freebsd* | openbsd* | netbsd* )	enable_pthreads=try ;;
68
#		(*)				enable_pthreads=no ;;
69
#	esac
70
#fi
71 547d3bf4 Ondrej Zajicek
72 1ec52253 Ondrej Zajicek
if test "$enable_pthreads" != no ; then
73
	BIRD_CHECK_PTHREADS
74
75
	if test "$bird_cv_lib_pthreads" = yes ; then
76
		AC_DEFINE(USE_PTHREADS)
77
		CFLAGS="$CFLAGS -pthread"
78
		LDFLAGS="$LDFLAGS -pthread"
79
		proto_bfd=bfd
80
	elif test "$enable_pthreads" = yes ; then
81
		AC_MSG_ERROR([POSIX threads not available.])
82
	fi
83
84
	if test "$enable_pthreads" = try ; then
85
		enable_pthreads="$bird_cv_lib_pthreads"
86
	fi
87
fi
88
89 bed41728 Ondrej Zajicek
if test "$bird_cflags_default" = yes ; then
90 efd6d12b Ondrej Zajicek
	BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign, -Wall)
91
	BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
92
	BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
93 b1c030b0 Ondrej Zajicek
94 1ec52253 Ondrej Zajicek
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
95 efd6d12b Ondrej Zajicek
	BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign)
96
	BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
97
	BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
98 b1c030b0 Ondrej Zajicek
fi
99 efd6d12b Ondrej Zajicek
AC_MSG_CHECKING([CFLAGS])
100 b1c030b0 Ondrej Zajicek
AC_MSG_RESULT($CFLAGS)
101
102
103 416e3ee4 Martin Mares
AC_PROG_CPP
104
AC_PROG_INSTALL
105
AC_PROG_RANLIB
106
AC_CHECK_PROG(FLEX, flex, flex)
107
AC_CHECK_PROG(BISON, bison, bison)
108 8de11deb Ondrej Zajicek
AC_CHECK_PROGS(M4, gm4 m4)
109
110
test -z "$FLEX"	 && AC_MSG_ERROR([Flex is missing.])
111
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
112
test -z "$M4"	 && AC_MSG_ERROR([M4 is missing.])
113
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
114 416e3ee4 Martin Mares
115 2f9bcf97 Martin Mares
if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
116
	if test -f $with_sysconfig ; then
117 49e7e5ee Martin Mares
		sysdesc=$with_sysconfig
118 2f9bcf97 Martin Mares
	else
119 49e7e5ee Martin Mares
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
120
		if ! test -f $sysdesc ; then
121
			sysdesc=$sysdesc.h
122
		fi
123 2f9bcf97 Martin Mares
	fi
124
elif test -f sysconfig.h ; then
125 49e7e5ee Martin Mares
	sysdesc=sysconfig
126 2f9bcf97 Martin Mares
else
127 d549b83f Ondrej Zajicek (work)
	case "$host_os" in
128
		linux*)		sysdesc=linux
129 acc93efd Ondrej Zajicek
				default_iproutedir="/etc/iproute2"
130 1127ac6e Martin Mares
				;;
131 d549b83f Ondrej Zajicek (work)
		freebsd*)	sysdesc=bsd
132 c817b991 Martin Mares
				;;
133 d549b83f Ondrej Zajicek (work)
		kfreebsd*)	sysdesc=bsd
134 7cb37e6f Ondrej Filip
				;;
135 d549b83f Ondrej Zajicek (work)
		netbsd*)	sysdesc=bsd
136 d0c64519 Ondrej Zajicek
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
137 646b24d9 Ondrej Zajicek
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
138 7cb37e6f Ondrej Filip
				;;
139 d549b83f Ondrej Zajicek (work)
		openbsd*)	sysdesc=bsd
140 7cb37e6f Ondrej Filip
				;;
141 d549b83f Ondrej Zajicek (work)
		dragonfly*)	sysdesc=bsd
142 ef9c9ab9 Ondrej Filip
				;;
143 416e3ee4 Martin Mares
		*)		AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
144 2f9bcf97 Martin Mares
				;;
145
		esac
146 49e7e5ee Martin Mares
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
147 2f9bcf97 Martin Mares
fi
148 416e3ee4 Martin Mares
AC_MSG_CHECKING([which OS configuration should we use])
149 49e7e5ee Martin Mares
AC_MSG_RESULT($sysdesc)
150
if ! test -f $sysdesc ; then
151 2f9bcf97 Martin Mares
	AC_MSG_ERROR([The system configuration file is missing.])
152
fi
153 49e7e5ee Martin Mares
sysname=`echo $sysdesc | sed 's/\.h$//'`
154
AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
155
156
AC_MSG_CHECKING([system-dependent directories])
157 7152e5ef Jan Moskyto Matejka
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '`"
158 49e7e5ee Martin Mares
AC_MSG_RESULT($sysdep_dirs)
159
AC_SUBST(sysdep_dirs)
160 2f9bcf97 Martin Mares
161 acc93efd Ondrej Zajicek
if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
162
163
if test -n "$given_iproutedir"
164
then iproutedir=$with_iproutedir
165
else iproutedir=$default_iproutedir
166
fi
167
168
AC_SUBST(iproutedir)
169
170 d549b83f Ondrej Zajicek (work)
# all_protocols="$proto_bfd bgp ospf pipe radv rip static"
171
all_protocols="$proto_bfd ospf pipe radv rip static"
172
173 1ec52253 Ondrej Zajicek
all_protocols=`echo $all_protocols | sed 's/ /,/g'`
174
175
if test "$with_protocols" = all ; then
176
	with_protocols="$all_protocols"
177
fi
178
179 2f9bcf97 Martin Mares
AC_MSG_CHECKING([protocols])
180
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
181 b296730c Martin Mares
if test "$protocols" = no ; then protocols= ; fi
182 2f9bcf97 Martin Mares
for a in $protocols ; do
183
	if ! test -f $srcdir/proto/$a/Makefile ; then
184
		AC_MSG_RESULT(failed)
185
		AC_MSG_ERROR([Requested protocol $a not found.])
186
		fi
187
	AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
188
	done
189
AC_MSG_RESULT(ok)
190 49e7e5ee Martin Mares
AC_SUBST(protocols)
191 2f9bcf97 Martin Mares
192 a07e9d82 Martin Mares
case $sysdesc in
193 d549b83f Ondrej Zajicek (work)
	*/linux*)
194 9f387e11 Martin Mares
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
195
#include <asm/types.h>
196
#include <sys/socket.h>
197
])
198 c817b991 Martin Mares
		;;
199 a07e9d82 Martin Mares
esac
200
201 2f9bcf97 Martin Mares
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
202 7cb37e6f Ondrej Filip
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
203
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
204
AC_TRY_COMPILE([#include <sys/types.h>
205
  #include <sys/socket.h>
206
  ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
207
  [AC_MSG_RESULT(yes)
208
  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
209
  AC_MSG_RESULT(no))
210 2f9bcf97 Martin Mares
211 e6ff7a08 Ondrej Zajicek
AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
212
		 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
213
214 2f9bcf97 Martin Mares
BIRD_CHECK_INTEGERS
215
BIRD_CHECK_STRUCT_ALIGN
216
BIRD_CHECK_TIME_T
217 620c4f90 Martin Mares
BIRD_CHECK_STRUCT_IP_MREQN
218 2f9bcf97 Martin Mares
219
if test "$enable_debug" = yes ; then
220
	AC_DEFINE(DEBUGGING)
221 6b5ab875 Martin Mares
	if test "$enable_memcheck" = yes ; then
222
		AC_CHECK_LIB(dmalloc, dmalloc_debug)
223
		if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
224
			AC_CHECK_LIB(efence, malloc)
225
		fi
226 7a2105be Martin Mares
	fi
227 2f9bcf97 Martin Mares
fi
228
229 7152e5ef Jan Moskyto Matejka
CLIENT=birdcl
230 7211be1c Martin Mares
CLIENT_LIBS=
231 9fac310d Martin Mares
if test "$enable_client" = yes ; then
232 7152e5ef Jan Moskyto Matejka
	CLIENT="$CLIENT birdc"
233 7211be1c Martin Mares
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
234
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
235
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
236 489c308a Ondrej Zajicek
			AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
237 9ae0f4b7 Ondrej Zajicek
				AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo,
238
					AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap,
239
						AC_MSG_ERROR([[The client requires ncurses library. Either install the library or use --disable-client to compile without the client.]]))))))
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 7152e5ef Jan Moskyto Matejka
AC_CONFIG_FILES(Makefile:Makefile.in)
251 22122d4d Ondrej Filip
AC_OUTPUT
252 2f9bcf97 Martin Mares
253
cat >&AC_FD_MSG <<EOF
254
255
BIRD was configured with the following options:
256 b296730c Martin Mares
	Source directory:	$srcdir
257
	Object directory:	$objdir
258 acc93efd Ondrej Zajicek
	Iproute2 directory:	$iproutedir
259 49e7e5ee Martin Mares
	System configuration:	$sysdesc
260 2f9bcf97 Martin Mares
	Debugging:		$enable_debug
261 1ec52253 Ondrej Zajicek
	POSIX threads:		$enable_pthreads
262 2f9bcf97 Martin Mares
	Routing protocols:	$protocols
263 9fac310d Martin Mares
	Client:			$enable_client
264 2f9bcf97 Martin Mares
EOF
265 b296730c Martin Mares
rm -f $objdir/.*-stamp