Statistics
| Branch: | Revision:

iof-bird-daemon / configure.in @ e81b440f

History | View | Annotate | Download (7.08 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_VAR([FLEX], [location of the Flex program]) 
17
AC_ARG_VAR([BISON], [location of the Bison program]) 
18
AC_ARG_VAR([M4], [location of the M4 program]) 
19

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

    
42
if test "$enable_ipv6" = yes ; then
43
	ip=ipv6
44
	SUFFIX6=6
45
else
46
	ip=ipv4
47
	SUFFIX6=""
48
fi
49

    
50
if test "$with_protocols" = all ; then
51
	with_protocols=bgp,ospf,pipe,rip,static
52
fi
53

    
54
AC_SEARCH_LIBS(clock_gettime,[c rt posix4])
55

    
56
AC_CANONICAL_HOST
57

    
58
AC_MSG_CHECKING([what CFLAGS should we use])
59
if test "$ac_test_CFLAGS" != set ; then
60
	CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wno-pointer-sign -Wno-parentheses"
61
fi
62
AC_MSG_RESULT($CFLAGS)
63

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

    
69
AC_PROG_CPP
70
AC_PROG_INSTALL
71
AC_PROG_RANLIB
72
AC_CHECK_PROG(FLEX, flex, flex)
73
AC_CHECK_PROG(BISON, bison, bison)
74
AC_CHECK_PROGS(M4, gm4 m4)
75

    
76
test -z "$FLEX"	 && AC_MSG_ERROR([Flex is missing.])
77
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
78
test -z "$M4"	 && AC_MSG_ERROR([M4 is missing.])
79
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], , [AC_MSG_ERROR([Provided M4 is not GNU M4.])])
80

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

    
139
AC_MSG_CHECKING([system-dependent directories])
140
sysdep_dirs="`sed <$sysdesc '/^Link: /!d;s/^Link: \(.*\)$/\1/' | tr '\012' ' '` lib"
141
AC_MSG_RESULT($sysdep_dirs)
142
AC_SUBST(sysdep_dirs)
143

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

    
157
case $sysdesc in
158
	*/linux-22*|*/linux-v6*)
159
		AC_CHECK_HEADER(linux/rtnetlink.h,,[AC_MSG_ERROR([Appropriate version of Linux kernel headers not found.])],[
160
#include <asm/types.h>
161
#include <sys/socket.h>
162
])
163
		;;
164
esac
165

    
166
AC_CHECK_HEADER(syslog.h, [AC_DEFINE(HAVE_SYSLOG)])
167
AC_CHECK_HEADER(alloca.h, [AC_DEFINE(HAVE_ALLOCA_H)])
168
AC_MSG_CHECKING(whether 'struct sockaddr' has sa_len)
169
AC_TRY_COMPILE([#include <sys/types.h>
170
  #include <sys/socket.h>
171
  ], [static struct sockaddr sa; int i = sizeof(sa.sa_len);],
172
  [AC_MSG_RESULT(yes)
173
  AC_DEFINE(HAVE_SIN_LEN,,sin_len)],
174
  AC_MSG_RESULT(no))
175

    
176
AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
177
		 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
178

    
179
BIRD_CHECK_INTEGERS
180
BIRD_CHECK_STRUCT_ALIGN
181
BIRD_CHECK_TIME_T
182
BIRD_CHECK_STRUCT_IP_MREQN
183

    
184
if test "$enable_debug" = yes ; then
185
	AC_DEFINE(DEBUGGING)
186
	if test "$enable_memcheck" = yes ; then
187
		AC_CHECK_LIB(dmalloc, dmalloc_debug)
188
		if test $ac_cv_lib_dmalloc_dmalloc_debug != yes ; then
189
			AC_CHECK_LIB(efence, malloc)
190
		fi
191
	fi
192
fi
193

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

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

    
222
cat >&AC_FD_MSG <<EOF
223

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