Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ efd6d12b

History | View | Annotate | Download (8.77 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(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

    
24
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
AC_SUBST(runtimedir)
46

    
47
if test "$enable_ipv6" = yes ; then
48
	ip=ipv6
49
	SUFFIX=6
50
	all_protocols=bgp,ospf,pipe,radv,rip,static
51
else
52
	ip=ipv4
53
	SUFFIX=""
54
	all_protocols=bgp,ospf,pipe,rip,static
55
fi
56

    
57
if test "$given_suffix" = yes ; then
58
   	SUFFIX="$with_suffix"
59
fi
60
AC_SUBST(SUFFIX)
61

    
62
if test "$with_protocols" = all ; then
63
	with_protocols="$all_protocols"
64
fi
65

    
66
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
AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
77

    
78
AC_CANONICAL_HOST
79

    
80
# Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
81
if test "$ac_test_CFLAGS" != set ; then
82
	bird_cflags_default=yes
83
fi
84

    
85
AC_PROG_CC
86
if test -z "$GCC" ; then
87
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
88
fi
89

    
90
if test "$bird_cflags_default" = yes ; then
91
	BIRD_CHECK_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign, -Wall)
92
	BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
93
	BIRD_CHECK_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
94

    
95
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
96
	BIRD_ADD_GCC_OPTION(bird_cv_c_option_wno_pointer_sign, -Wno-pointer-sign)
97
	BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_aliasing, -fno-strict-aliasing)
98
	BIRD_ADD_GCC_OPTION(bird_cv_c_option_fno_strict_overflow, -fno-strict-overflow)
99
fi
100
AC_MSG_CHECKING([CFLAGS])
101
AC_MSG_RESULT($CFLAGS)
102

    
103

    
104
AC_PROG_CPP
105
AC_PROG_INSTALL
106
AC_PROG_RANLIB
107
AC_CHECK_PROG(FLEX, flex, flex)
108
AC_CHECK_PROG(BISON, bison, bison)
109
AC_CHECK_PROGS(M4, gm4 m4)
110

    
111
test -z "$FLEX"	 && AC_MSG_ERROR([Flex is missing.])
112
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
113
test -z "$M4"	 && AC_MSG_ERROR([M4 is missing.])
114
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
115

    
116
if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
117
	if test -f $with_sysconfig ; then
118
		sysdesc=$with_sysconfig
119
	else
120
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
121
		if ! test -f $sysdesc ; then
122
			sysdesc=$sysdesc.h
123
		fi
124
	fi
125
elif test -f sysconfig.h ; then
126
	sysdesc=sysconfig
127
else
128
	case "$ip:$host_os" in
129
		ipv6:linux*)	sysdesc=linux-v6
130
				default_iproutedir="/etc/iproute2"
131
				;;
132
		ipv4:linux*)	sysdesc=linux
133
				default_iproutedir="/etc/iproute2"
134
				;;
135
		ipv6:netbsd*)	sysdesc=bsd-v6
136
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
137
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
138
				;;
139
		ipv4:netbsd*)	sysdesc=bsd
140
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
141
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
142
				;;
143
		ipv6:freebsd*)	sysdesc=bsd-v6
144
				;;
145
		ipv4:freebsd*)	sysdesc=bsd
146
				;;
147
		ipv6:dragonfly*)	sysdesc=bsd-v6
148
				;;
149
		ipv4:dragonfly*)	sysdesc=bsd
150
				;;
151
		ipv6:kfreebsd*) sysdesc=bsd-v6
152
				;;
153
		ipv4:kfreebsd*) sysdesc=bsd
154
				;;
155
		ipv6:openbsd*)	sysdesc=bsd-v6
156
				;;
157
		ipv4:openbsd*)	sysdesc=bsd
158
				;;
159
		*)		AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
160
				;;
161
		esac
162
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
163
fi
164
AC_MSG_CHECKING([which OS configuration should we use])
165
AC_MSG_RESULT($sysdesc)
166
if ! test -f $sysdesc ; then
167
	AC_MSG_ERROR([The system configuration file is missing.])
168
fi
169
sysname=`echo $sysdesc | sed 's/\.h$//'`
170
AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
171

    
172
AC_MSG_CHECKING([system-dependent directories])
173
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
174
AC_MSG_RESULT($sysdep_dirs)
175
AC_SUBST(sysdep_dirs)
176

    
177
if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
178

    
179
if test -n "$given_iproutedir"
180
then iproutedir=$with_iproutedir
181
else iproutedir=$default_iproutedir
182
fi
183

    
184
AC_SUBST(iproutedir)
185

    
186
AC_MSG_CHECKING([protocols])
187
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
188
if test "$protocols" = no ; then protocols= ; fi
189
for a in $protocols ; do
190
	if ! test -f $srcdir/proto/$a/Makefile ; then
191
		AC_MSG_RESULT(failed)
192
		AC_MSG_ERROR([Requested protocol $a not found.])
193
		fi
194
	AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
195
	done
196
AC_MSG_RESULT(ok)
197
AC_SUBST(protocols)
198

    
199
case $sysdesc in
200
	*/linux*|*/linux-v6*)
201
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
202
#include <asm/types.h>
203
#include <sys/socket.h>
204
])
205
		;;
206
esac
207

    
208
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
209
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
210
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
211
AC_TRY_COMPILE([#include <sys/types.h>
212
  #include <sys/socket.h>
213
  ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
214
  [AC_MSG_RESULT(yes)
215
  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
216
  AC_MSG_RESULT(no))
217

    
218
AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
219
		 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
220

    
221
BIRD_CHECK_INTEGERS
222
BIRD_CHECK_STRUCT_ALIGN
223
BIRD_CHECK_TIME_T
224
BIRD_CHECK_STRUCT_IP_MREQN
225

    
226
if test "$enable_debug" = yes ; then
227
	AC_DEFINE(DEBUGGING)
228
	if test "$enable_memcheck" = yes ; then
229
		AC_CHECK_LIB(dmalloc, dmalloc_debug)
230
		if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
231
			AC_CHECK_LIB(efence, malloc)
232
		fi
233
	fi
234
fi
235

    
236
CLIENT=
237
CLIENT_LIBS=
238
if test "$enable_client" = yes ; then
239
	CLIENT=client
240
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
241
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
242
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
243
			AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
244
				AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo
245
					AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))))
246
	AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
247
		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)
248
	AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
249
	AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
250
fi
251
AC_SUBST(CLIENT)
252
AC_SUBST(CLIENT_LIBS)
253

    
254
mkdir -p $objdir/sysdep
255
AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
256
AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
257
$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
258
	[[srcdir=$srcdir]
259
	[srcdir_rel=$srcdir_rel]
260
	[objdir=$objdir]
261
	[sysdep_dirs="$sysdep_dirs"]])
262
AC_CONFIG_FILES($makefiles)
263
AC_OUTPUT
264

    
265
rm -f $objdir/sysdep/paths.h
266

    
267
cat >&AC_FD_MSG <<EOF
268

    
269
BIRD was configured with the following options:
270
	Source directory:	$srcdir
271
	Object directory:	$objdir
272
	Iproute2 directory:	$iproutedir
273
	System configuration:	$sysdesc
274
	Debugging:		$enable_debug
275
	Routing protocols:	$protocols
276
	Client:			$enable_client
277
EOF
278
rm -f $objdir/.*-stamp