Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ ab188fb7

History | View | Annotate | Download (8.36 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
AC_MSG_CHECKING([what CFLAGS should we use])
91
if test "$bird_cflags_default" = yes ; then
92
	BIRD_CHECK_GCC_OPTIONS
93

    
94
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
95
	if test "$bird_cv_c_option_no_pointer_sign" = yes ; then
96
		CFLAGS="$CFLAGS -Wno-pointer-sign"
97
	fi
98
fi
99
AC_MSG_RESULT($CFLAGS)
100

    
101

    
102
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
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

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

    
171
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
AC_MSG_CHECKING([protocols])
181
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
182
if test "$protocols" = no ; then protocols= ; fi
183
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
AC_SUBST(protocols)
192

    
193
case $sysdesc in
194
	*/linux*|*/linux-v6*)
195
		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
		;;
200
esac
201

    
202
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
203
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

    
212
AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
213
		 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
214

    
215
BIRD_CHECK_INTEGERS
216
BIRD_CHECK_STRUCT_ALIGN
217
BIRD_CHECK_TIME_T
218
BIRD_CHECK_STRUCT_IP_MREQN
219

    
220
if test "$enable_debug" = yes ; then
221
	AC_DEFINE(DEBUGGING)
222
	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
	fi
228
fi
229

    
230
CLIENT=
231
CLIENT_LIBS=
232
if test "$enable_client" = yes ; then
233
	CLIENT=client
234
	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
			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
	AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
241
		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
	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
fi
245
AC_SUBST(CLIENT)
246
AC_SUBST(CLIENT_LIBS)
247

    
248
mkdir -p $objdir/sysdep
249
AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
250
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

    
259
rm -f $objdir/sysdep/paths.h
260

    
261
cat >&AC_FD_MSG <<EOF
262

    
263
BIRD was configured with the following options:
264
	Source directory:	$srcdir
265
	Object directory:	$objdir
266
	Iproute2 directory:	$iproutedir
267
	System configuration:	$sysdesc
268
	Debugging:		$enable_debug
269
	Routing protocols:	$protocols
270
	Client:			$enable_client
271
EOF
272
rm -f $objdir/.*-stamp