Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ dc16584a

History | View | Annotate | Download (7.32 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(warnings,[  --enable-warnings       enable extra warnings (default: disabled)],,enable_warnings=no)
12
AC_ARG_ENABLE(client,[  --enable-client         enable building of BIRD client (default: enabled)],,enable_client=yes)
13
AC_ARG_ENABLE(ipv6,[  --enable-ipv6           enable building of IPv6 version (default: disabled)],,enable_ipv6=no)
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_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
	if test "$with_protocols" = all ; then
47
		with_protocols=bgp,pipe,rip,static
48
	fi
49
else
50
	ip=ipv4
51
	SUFFIX6=""
52
	if test "$with_protocols" = all ; then
53
		with_protocols=bgp,ospf,pipe,rip,static
54
	fi
55
fi
56

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

    
59
AC_CANONICAL_HOST
60

    
61
AC_PROG_CC
62
if test -z "$GCC" ; then
63
	AC_MSG_ERROR([This program requires the GNU C Compiler.])
64
	fi
65
AC_MSG_CHECKING([what CFLAGS should we use])
66
if test "$ac_test_CFLAGS" != set ; then
67
	if test "$enable_warnings" = yes ; then
68
		WARNS=" -Wmissing-prototypes -Wundef"
69
	else
70
		WARNS=" -Wno-unused"
71
	fi
72
	CFLAGS="$CFLAGS -Wall -W -Wstrict-prototypes -Wno-pointer-sign -Wno-parentheses$WARNS"
73
fi
74
if test "$with_sysinclude" != no -a -n "$with_sysinclude"; then
75
	CPPFLAGS="$CPPFLAGS -I$with_sysinclude"
76
fi
77
AC_MSG_RESULT($CFLAGS)
78

    
79
AC_PROG_CPP
80
AC_PROG_INSTALL
81
AC_PROG_RANLIB
82
AC_CHECK_PROG(FLEX, flex, flex)
83
AC_CHECK_PROG(BISON, bison, bison)
84
AC_CHECK_PROGS(M4, gm4 m4)
85

    
86
test -z "$FLEX"	 && AC_MSG_ERROR([Flex is missing.])
87
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
88
test -z "$M4"	 && AC_MSG_ERROR([M4 is missing.])
89
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
90

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

    
145
AC_MSG_CHECKING([system-dependent directories])
146
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
147
AC_MSG_RESULT($sysdep_dirs)
148
AC_SUBST(sysdep_dirs)
149

    
150
AC_MSG_CHECKING([protocols])
151
protocols=`echo "$with_protocols" | sed 's/,/ /g'`
152
if test "$protocols" = no ; then protocols= ; fi
153
for a in $protocols ; do
154
	if ! test -f $srcdir/proto/$a/Makefile ; then
155
		AC_MSG_RESULT(failed)
156
		AC_MSG_ERROR([Requested protocol $a not found.])
157
		fi
158
	AC_DEFINE_UNQUOTED(CONFIG_`echo $a | tr 'a-z' 'A-Z'`)
159
	done
160
AC_MSG_RESULT(ok)
161
AC_SUBST(protocols)
162

    
163
case $sysdesc in
164
	*/linux-22*|*/linux-v6*)
165
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
166
#include <asm/types.h>
167
#include <sys/socket.h>
168
])
169
		;;
170
esac
171

    
172
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
173
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
174
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
175
AC_TRY_COMPILE([#include <sys/types.h>
176
  #include <sys/socket.h>
177
  ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
178
  [AC_MSG_RESULT(yes)
179
  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
180
  AC_MSG_RESULT(no))
181

    
182
BIRD_CHECK_INTEGERS
183
BIRD_CHECK_ENDIAN
184
BIRD_CHECK_STRUCT_ALIGN
185
BIRD_CHECK_TIME_T
186
BIRD_CHECK_STRUCT_IP_MREQN
187

    
188
if test "$enable_debug" = yes ; then
189
	AC_DEFINE(DEBUGGING)
190
	if test "$enable_memcheck" = yes ; then
191
		AC_CHECK_LIB(dmalloc, dmalloc_debug)
192
		if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
193
			AC_CHECK_LIB(efence, malloc)
194
		fi
195
	fi
196
fi
197

    
198
CLIENT=
199
CLIENT_LIBS=
200
if test "$enable_client" = yes ; then
201
	CLIENT=client
202
	AC_CHECK_LIB(history, add_history, CLIENT_LIBS="-lhistory")
203
	AC_CHECK_LIB(ncurses, tgetent, USE_TERMCAP_LIB=-lncurses,
204
		AC_CHECK_LIB(curses, tgetent, USE_TERMCAP_LIB=-lcurses,
205
			AC_CHECK_LIB(termcap, tgetent, USE_TERMCAP_LIB=-ltermcap)))
206
	AC_CHECK_LIB(readline, rl_callback_read_char, CLIENT_LIBS="-lreadline $CLIENT_LIBS $USE_TERMCAP_LIB",
207
		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)
208
	AC_CHECK_LIB(readline, rl_crlf, AC_DEFINE(HAVE_RL_CRLF),,$USE_TERMCAP_LIB)
209
	AC_CHECK_LIB(readline, rl_ding, AC_DEFINE(HAVE_RL_DING),,$USE_TERMCAP_LIB)
210
fi
211
AC_SUBST(CLIENT)
212
AC_SUBST(CLIENT_LIBS)
213
AC_SUBST(SUFFIX6)
214

    
215
mkdir -p $objdir/sysdep
216
AC_CONFIG_HEADERS([$objdir/sysdep/autoconf.h:sysdep/autoconf.h.in])
217
AC_CONFIG_COMMANDS([merge],[[export CPP="$CPP"
218
$srcdir/tools/mergedirs $srcdir $srcdir_rel $objdir $sysdep_dirs]],
219
	[[srcdir=$srcdir]
220
	[srcdir_rel=$srcdir_rel]
221
	[objdir=$objdir]
222
	[sysdep_dirs="$sysdep_dirs"]])
223
AC_CONFIG_FILES($makefiles)
224
AC_OUTPUT
225

    
226
cat >&AC_FD_MSG <<EOF
227

    
228
BIRD was configured with the following options:
229
	Source directory:	$srcdir
230
	Object directory:	$objdir
231
	System configuration:	$sysdesc
232
	Debugging:		$enable_debug
233
	Routing protocols:	$protocols
234
	Client:			$enable_client
235
EOF
236
rm -f $objdir/.*-stamp