-
Notifications
You must be signed in to change notification settings - Fork 107
/
configure.ac
273 lines (235 loc) · 7.57 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
dnl
dnl
dnl Authors:
dnl Lars Fenneberg <[email protected]>
dnl
dnl This software is Copyright 1996-2000 by the above mentioned author(s),
dnl All Rights Reserved.
dnl
dnl The license which is distributed with this software in the file COPYRIGHT
dnl applies to this software. If your distribution is missing this file, you
dnl may request it from <[email protected]>.
dnl
dnl
dnl If adding rcX to version, be sure to separate with a '-'
AC_INIT(radvd, [2.20_rc1])
AC_CONFIG_SRCDIR(radvd.c)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
AC_MSG_CHECKING([architecture])
case "$target" in
*linux*)
AC_MSG_RESULT(linux)
AC_DEFINE([_GNU_SOURCE], [], [whether compiling on Linux, glibc>=2.8 does not expose in6_pktinfo otherwise..])
arch=linux
;;
*bsd*)
AC_MSG_RESULT(bsd44)
arch=bsd44
;;
*darwin*)
AC_DEFINE([__APPLE_USE_RFC_2292], [1], [OS X 10.9 wont build radvd without this])
AC_MSG_RESULT([bsd44 (darwin)])
arch=bsd44
;;
*)
AC_MSG_RESULT(unknown: $target)
AC_MSG_ERROR(
[currently only Linux and BSD 4.4 with NRLs IPv6 code are
supported. If you have such a system and it is not guessed correctly
you must specify it with --target on the configure command line])
;;
esac
dnl Determine CC and preset CFLAGS
AC_PROG_CC_C99
AC_PROG_RANLIB
AM_PROG_AR
AC_ARG_WITH([stack-protector], AS_HELP_STRING([--without-stack-protector], [Build without -fstack-protector]),[],[with_stack_protector=yes])
AM_CONDITIONAL(HAVE_STACK_PROTECTOR, test x"$with_stack_protector" = xyes)
AC_ARG_WITH([check], AS_HELP_STRING([--without-check], [Build without check unit testing framework]),[],[with_check=no])
AS_IF([test "x$with_check" = "xyes"], [
AS_IF([test "x$arch" = "xlinux"], [
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])
])
])
AM_CONDITIONAL(HAVE_CHECK, test x"$with_check" = xyes)
dnl Determine of netlink is available
AC_MSG_CHECKING(netlink)
AC_TRY_COMPILE([
#include <asm/types.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
],[
int
main(int argc, char * argv[])
{
int sock;
struct sockaddr_nl snl;
sock = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
snl.nl_family = AF_NETLINK;
snl.nl_groups = RTMGRP_LINK;
return 0;
}
],[
AC_DEFINE(HAVE_NETLINK, 1, [Linux netlink])
CONDITIONAL_SOURCES=netlink.${OBJEXT}
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])
dnl clock_gettime is in librt for glibc <2.17
AC_SEARCH_LIBS(clock_gettime, rt)
dnl strlcpy is in libbsd
AC_SEARCH_LIBS(strlcpy, bsd)
dnl Needed for normal compile
AC_PROG_INSTALL
AC_PATH_PROG(RM, rm, NOTFOUND)
if test "x$RM" = xNOTFOUND; then
AC_MSG_ERROR(can not find rm in your path - check PATH)
fi
AC_PATH_PROG(SED, sed, NOTFOUND)
if test "x$SED" = xNOTFOUND; then
AC_MSG_ERROR(can not find sed in your path - check PATH)
fi
dnl Not needed
AC_PATH_PROG(LN, ln)
AC_PROG_YACC
AM_PROG_LEX
AC_PATH_PROG(TAR, tar)
AC_PATH_PROG(GZIP, gzip)
dnl Check where to put the logfile
AC_MSG_CHECKING(where to put logfile)
AC_ARG_WITH(logfile,
[ --with-logfile Path to the radvd logfile [/var/log/radvd.log]],
PATH_RADVD_LOG=$withval,
PATH_RADVD_LOG=/var/log/radvd.log)
AC_MSG_RESULT($PATH_RADVD_LOG)
dnl Check where to put the pidfile
AC_MSG_CHECKING(where to put pidfile)
AC_ARG_WITH(pidfile,
[ --with-pidfile Path to the radvd pidfile [/var/run/radvd.pid]],
PATH_RADVD_PID=$withval,
PATH_RADVD_PID=/var/run/radvd.pid)
AC_MSG_RESULT($PATH_RADVD_PID)
dnl Check where to put the configfile
AC_MSG_CHECKING(where to find configfile)
AC_ARG_WITH(configfile,
[ --with-configfile Path to the radvd config file [SYSCONF/radvd.conf]],
PATH_RADVD_CONF=$withval,
[eval PATH_RADVD_CONF=${sysconfdir}/radvd.conf])
PATH_RADVD_CONF=$(echo $PATH_RADVD_CONF | sed 's/NONE//1')
AC_MSG_RESULT($PATH_RADVD_CONF)
dnl Checking which syslog facility to use
AC_MSG_CHECKING(which syslog facility to use)
AC_ARG_WITH(facility,
[ --with-facility Syslog facility to use when using syslog logging],
LOG_FACILITY=$withval,
LOG_FACILITY=LOG_DAEMON)
AC_MSG_RESULT($LOG_FACILITY)
dnl Checks for libraries.
AC_CHECK_LIB(c, inet_ntop,,
AC_CHECK_LIB(inet6, inet_ntop,
LIBS="$LIBS -linet6"
,
AC_MSG_ERROR(can not continue without libinet6.a library - check your LDFLAGS)
)
)
# prevent caching
unset ac_cv_lib_inet6_inet_ntop
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS( \
getopt.h \
ifaddrs.h \
linux/if_arp.h \
machine/limits.h \
machine/param.h \
net/if_arp.h \
net/if_dl.h \
net/if_types.h \
sys/param.h \
sys/sockio.h \
sys/time.h \
time.h \
)
AC_HEADER_TIME
dnl Checks for typedefs, structures, and compiler characteristics.
AC_MSG_CHECKING(whether struct sockaddr_in6 has sin6_scope_id)
AC_TRY_COMPILE([#include <stdint.h>
#include <sys/types.h>
#include <netinet/in.h>], [
static struct sockaddr_in6 ac_sin6;
uint32_t ac_size = sizeof (ac_sin6.sin6_scope_id);
], [AC_MSG_RESULT(yes); AC_DEFINE([HAVE_SIN6_SCOPE_ID],
1, [whether struct sockaddr_in6 has sin6_scope_id])],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether struct in6_addr has u6_addrXX and defines s6_addrXX)
AC_TRY_COMPILE([#include <stdint.h>
#include <netinet/in.h>], [static struct in6_addr in6_u;
uint16_t u = in6_u.s6_addr16[0];], [AC_MSG_RESULT(yes); AC_DEFINE([HAVE_IN6_ADDR_S6_ADDR],
1, [whether struct in6_addr has u6_addrXX and defines s6_addrXX])],
AC_MSG_RESULT(no))
dnl Checks for library functions.
AC_CHECK_FUNCS(getopt_long)
AC_CHECK_FUNCS(ppoll)
AC_CHECK_FUNCS(sysctl)
CONDITIONAL_SOURCES="device-${arch}.${OBJEXT} ${CONDITIONAL_SOURCES}"
if test x${arch} = xlinux ; then
CONDITIONAL_SOURCES="privsep-${arch}.${OBJEXT} ${CONDITIONAL_SOURCES}"
AC_DEFINE(USE_PRIVSEP, 1, [Use privsep])
fi
AC_SUBST(CONDITIONAL_SOURCES)
AC_SUBST(VERSION)
AC_SUBST(PATH_RADVD_CONF)
AC_SUBST(PATH_RADVD_PID)
AC_SUBST(PATH_RADVD_LOG)
AC_SUBST(LOG_FACILITY)
# Default value for sbindir
prefix_temp=$prefix
exec_prefix_temp=$exec_prefix
test "${prefix}" = "NONE" && prefix="${ac_default_prefix}"
test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}'
# Initial Value is $exec_prefix/sbin
sbintemp="${sbindir}"
# Expands to $prefix/sbin
eval sbintemp=\"${sbintemp}\"
# Expands to /usr/local/sbin or /usr/sbin if --prefix is passed
eval sbintemp=\"${sbintemp}\"
SBINDIR=${sbintemp}
AC_SUBST(SBINDIR)
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
[with_systemdsystemunitdir=auto])
AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
AS_IF([test "x$def_systemdsystemunitdir" = "x"],
[AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
[AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
with_systemdsystemunitdir=no],
[with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
[AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(
Makefile \
radvd.service \
redhat/systemd/radvd.spec \
redhat/SysV/radvd.spec \
)
cat << EOF
Your build configuration:
CPPFLAGS = $CPPFLAGS
CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
Arch = ${arch}
Extras: ${CONDITIONAL_SOURCES}
prefix: $prefix
PID file: $PATH_RADVD_PID
Log file: $PATH_RADVD_LOG
Config file: $PATH_RADVD_CONF
Radvd version: $VERSION
EOF