Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ acc93efd

History | View | Annotate | Download (8 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(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(iproutedir,[  --with-iproutedir=PATH  path to iproute2 config files (default: /etc/iproute2)],[given_iproutedir="yes"])
17
AC_ARG_VAR([FLEX], [location of the Flex program]) 
18
AC_ARG_VAR([BISON], [location of the Bison program]) 
19
AC_ARG_VAR([M4], [location of the M4 program]) 
20

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

    
43
if test "$enable_ipv6" = yes ; then
44
	ip=ipv6
45
	SUFFIX6=6
46
	all_protocols=bgp,ospf,pipe,radv,rip,static
47
else
48
	ip=ipv4
49
	SUFFIX6=""
50
	all_protocols=bgp,ospf,pipe,rip,static
51
fi
52

    
53
if test "$with_protocols" = all ; then
54
	with_protocols="$all_protocols"
55
fi
56

    
57
AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
58

    
59
AC_CANONICAL_HOST
60

    
61
# Store this value because ac_test_CFLAGS is overwritten by AC_PROG_CC
62
if test "$ac_test_CFLAGS" != set ; then
63
	bird_cflags_default=yes
64
fi
65

    
66
AC_PROG_CC
67
if test -z "$GCC" ; then
68
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
69
fi
70

    
71
AC_MSG_CHECKING([what CFLAGS should we use])
72
if test "$bird_cflags_default" = yes ; then
73
	BIRD_CHECK_GCC_OPTIONS
74

    
75
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-parentheses"
76
	if test "$bird_cv_c_option_no_pointer_sign" = yes ; then
77
		CFLAGS="$CFLAGS -Wno-pointer-sign"
78
	fi
79
fi
80
AC_MSG_RESULT($CFLAGS)
81

    
82

    
83
AC_PROG_CPP
84
AC_PROG_INSTALL
85
AC_PROG_RANLIB
86
AC_CHECK_PROG(FLEX, flex, flex)
87
AC_CHECK_PROG(BISON, bison, bison)
88
AC_CHECK_PROGS(M4, gm4 m4)
89

    
90
test -z "$FLEX"	 && AC_MSG_ERROR([Flex is missing.])
91
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
92
test -z "$M4"	 && AC_MSG_ERROR([M4 is missing.])
93
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
94

    
95
if test -n "$with_sysconfig" -a "$with_sysconfig" != no ; then
96
	if test -f $with_sysconfig ; then
97
		sysdesc=$with_sysconfig
98
	else
99
		sysdesc=$srcdir/sysdep/cf/$with_sysconfig
100
		if ! test -f $sysdesc ; then
101
			sysdesc=$sysdesc.h
102
		fi
103
	fi
104
elif test -f sysconfig.h ; then
105
	sysdesc=sysconfig
106
else
107
	case "$ip:$host_os" in
108
		ipv4:linux*)	BIRD_CHECK_LINUX_VERSION
109
				default_iproutedir="/etc/iproute2"
110
				case $bird_cv_sys_linux_version in
111
					1.*|2.0.*)	sysdesc=linux-20 ;;
112
					*)		sysdesc=linux-22 ;;
113
					esac
114
				;;
115
		ipv6:linux*)	BIRD_CHECK_LINUX_VERSION
116
				default_iproutedir="/etc/iproute2"
117
				case $bird_cv_sys_linux_version in
118
					1.*|2.0.*)	AC_MSG_ERROR([This version of Linux doesn't support IPv6.]) ;;
119
					*)		sysdesc=linux-v6 ;;
120
					esac
121
				;;
122
		ipv6:netbsd*)	sysdesc=bsd-v6
123
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
124
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
125
				;;
126
		ipv4:netbsd*)	sysdesc=bsd
127
				CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"
128
				LDFLAGS="$LDFLAGS -L/usr/pkg/lib -R/usr/pkg/lib"
129
				;;
130
		ipv6:freebsd*)	sysdesc=bsd-v6
131
				;;
132
		ipv4:freebsd*)	sysdesc=bsd
133
				;;
134
		ipv6:kfreebsd*) sysdesc=bsd-v6
135
				;;
136
		ipv4:kfreebsd*) sysdesc=bsd
137
				;;
138
		ipv6:openbsd*)	sysdesc=bsd-v6
139
				;;
140
		ipv4:openbsd*)	sysdesc=bsd
141
				;;
142
		*)		AC_MSG_ERROR([Cannot determine correct system configuration. Please use --with-sysconfig to set it manually.])
143
				;;
144
		esac
145
	sysdesc=$srcdir/sysdep/cf/$sysdesc.h
146
fi
147
AC_MSG_CHECKING([which OS configuration should we use])
148
AC_MSG_RESULT($sysdesc)
149
if ! test -f $sysdesc ; then
150
	AC_MSG_ERROR([The system configuration file is missing.])
151
fi
152
sysname=`echo $sysdesc | sed 's/\.h$//'`
153
AC_DEFINE_UNQUOTED(SYSCONF_INCLUDE, "$sysdesc")
154

    
155
AC_MSG_CHECKING([system-dependent directories])
156
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
157
AC_MSG_RESULT($sysdep_dirs)
158
AC_SUBST(sysdep_dirs)
159

    
160
if test "$with_iproutedir" = no ; then with_iproutedir= ; fi
161

    
162
if test -n "$given_iproutedir"
163
then iproutedir=$with_iproutedir
164
else iproutedir=$default_iproutedir
165
fi
166

    
167
AC_SUBST(iproutedir)
168

    
169
AC_MSG_CHECKING([protocols])
170
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
171
if test "$protocols" = no ; then protocols= ; fi
172
for a in $protocols ; do
173
	if ! test -f $srcdir/proto/$a/Makefile ; then
174
		AC_MSG_RESULT(failed)
175
		AC_MSG_ERROR([Requested protocol $a not found.])
176
		fi
177
	AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
178
	done
179
AC_MSG_RESULT(ok)
180
AC_SUBST(protocols)
181

    
182
case $sysdesc in
183
	*/linux-22*|*/linux-v6*)
184
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
185
#include <asm/types.h>
186
#include <sys/socket.h>
187
])
188
		;;
189
esac
190

    
191
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
192
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
193
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
194
AC_TRY_COMPILE([#include <sys/types.h>
195
  #include <sys/socket.h>
196
  ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
197
  [AC_MSG_RESULT(yes)
198
  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
199
  AC_MSG_RESULT(no))
200

    
201
AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
202
		 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
203

    
204
BIRD_CHECK_INTEGERS
205
BIRD_CHECK_STRUCT_ALIGN
206
BIRD_CHECK_TIME_T
207
BIRD_CHECK_STRUCT_IP_MREQN
208

    
209
if test "$enable_debug" = yes ; then
210
	AC_DEFINE(DEBUGGING)
211
	if test "$enable_memcheck" = yes ; then
212
		AC_CHECK_LIB(dmalloc, dmalloc_debug)
213
		if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
214
			AC_CHECK_LIB(efence, malloc)
215
		fi
216
	fi
217
fi
218

    
219
CLIENT=
220
CLIENT_LIBS=
221
if test "$enable_client" = yes ; then
222
	CLIENT=client
223
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
224
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
225
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
226
			AC_CHECK_LIB(tinfow, tgetent, USE_TERMCAP_LIB=-ltinfow,
227
				AC_CHECK_LIB(tinfo, tgetent, USE_TERMCAP_LIB=-ltinfo
228
					AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))))
229
	AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
230
		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)
231
	AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
232
	AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
233
fi
234
AC_SUBST(CLIENT)
235
AC_SUBST(CLIENT_LIBS)
236
AC_SUBST(SUFFIX6)
237

    
238
mkdir -p $objdir/sysdep
239
AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
240
AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
241
$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
242
	[[srcdir=$srcdir]
243
	[srcdir_rel=$srcdir_rel]
244
	[objdir=$objdir]
245
	[sysdep_dirs="$sysdep_dirs"]])
246
AC_CONFIG_FILES($makefiles)
247
AC_OUTPUT
248

    
249
rm -f $objdir/sysdep/paths.h
250

    
251
cat >&AC_FD_MSG <<EOF
252

    
253
BIRD was configured with the following options:
254
	Source directory:	$srcdir
255
	Object directory:	$objdir
256
	Iproute2 directory:	$iproutedir
257
	System configuration:	$sysdesc
258
	Debugging:		$enable_debug
259
	Routing protocols:	$protocols
260
	Client:			$enable_client
261
EOF
262
rm -f $objdir/.*-stamp