forked from troglobit/pim6sd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
184 lines (159 loc) · 5.01 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_INIT([pim6sd], [2.1.0-beta1], [https://github.com/troglobit/pim6sd/issues],, [https://github.com/troglobit/pim6sd])
AM_INIT_AUTOMAKE([1.11 foreign])
AM_SILENT_RULES([yes])
AM_CONFIG_HEADER(include/config.h)
AC_CONFIG_FILES([Makefile
man/Makefile
include/Makefile
src/Makefile])
# Checks for programs.
AC_PROG_CC
AC_PROG_YACC
AC_PROG_INSTALL
AM_PROG_LEX
CFLAGS_ADD="$CFLAGS_ADD -W -Wall -Wextra -Wno-unused"
# Checks for libraries.
# We don't need libfl at the moment, see '%option noyywrap'
#AC_CHECK_LIB([fl], [main])
# FIXME: Replace `main' with a function in `-ll':
AC_CHECK_LIB([l], [main])
AC_CHECK_LIB([y], [main])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h paths.h stddef.h stdlib.h string.h strings.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h])
AC_CHECK_HEADERS([sys/types.h sys/queue.h netinet/in.h net/if.h net/if_var.h netinet6/in6_var.h],,,
[[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_QUEUE_H
#include <sys/queue.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_NET_IF_VAR_H
#include <net/if_var.h>
#endif
]])
AC_CHECK_HEADERS([sys/types.h netinet6/pim6.h],,,
[[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
]])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_HEADER_STDC
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h paths.h stdarg.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h)
AC_MSG_CHECKING(if you have struct mld_hdr in your system)
AC_CACHE_VAL(ts_cv_have_mld_hdr, [dnl
AC_TRY_COMPILE([
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/icmp6.h>
], [
int i;
struct mld_hdr a;
i = sizeof(a);
], [ts_cv_have_mld_hdr="yes"], [ts_cv_have_mld_hdr="no"])])
AC_MSG_RESULT($ts_cv_have_mld_hdr);
if test "$ts_cv_have_mld_hdr" = yes; then
AC_DEFINE([HAVE_MLD_HDR], 1, [Define to 1 if you have struct mld_hdr in your system])
fi
# Checks for library functions.
AC_CHECK_FUNCS([bzero dup2 gettimeofday isascii memset select socket strchr strdup strerror strrchr strncpy])
# Check for usually missing API's, which we can replace
AC_REPLACE_FUNCS([strlcpy strlcat])
AC_CONFIG_LIBOBJ_DIR([lib])
dnl Checks for other features
AC_MSG_CHECKING(if you have a length field in struct sockaddr*)
AC_CACHE_VAL(ts_cv_sa_len, [dnl
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
], [
struct sockaddr a;
a.sa_len = 1;
], [ts_cv_sa_len="yes"], [ts_cv_sa_len="no"])])
AC_MSG_RESULT($ts_cv_sa_len);
if test "$ts_cv_sa_len" = yes; then
AC_DEFINE([HAVE_SA_LEN], 1, [Define to 1 if you have a length field in struct sockaddr])
fi
AC_MSG_CHECKING(if you enabled router-side mldv2)
AC_ARG_ENABLE(mldv2router,
[ --disable-mldv2router disables router-side MLDv2 functionality],
[],
[enable_mldv2router=yes])
if test "$enable_mldv2router" = "yes"; then
AC_DEFINE(HAVE_MLDV2, 1, [Define to 1 if you enables router-side MLDv2 functionality])
fi
AC_MSG_RESULT($enable_mldv2router)
AC_MSG_CHECKING(if you enabled host-side mldv2)
AC_ARG_ENABLE(mldv2host,
[ --enable-mldv2host enables host-side MLDv2 functionality],
[],
[enable_mldv2host=no])
if test "$enable_mldv2host" = "yes"; then
AC_DEFINE(HAVE_MLDV2HOST, 1, [Define to 1 if you have the host-side MLDv2 functionality])
fi
AC_MSG_RESULT($enable_mldv2host)
dnl Determine routing get and set method
AC_MSG_CHECKING(userland-kernel interface for routing information)
AC_TRY_RUN([#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
main ()
{
#ifdef AF_NETLINK
exit(1);
#else
int ac_sock;
ac_sock = socket (AF_ROUTE, SOCK_RAW, 0);
if (ac_sock < 0 && errno == EINVAL)
exit (1);
exit (0);
#endif
}],
[AC_DEFINE([HAVE_ROUTING_SOCKETS], [1], [Define to 1 if you support the 'routing socket' function.])
UK_METHOD=routesock
AC_MSG_RESULT(routing socket)],
[AC_DEFINE([HAVE_NETLINK], [1], [Define to 1 if you support the 'netlink' function.])
UK_METHOD=netlink
AC_MSG_RESULT(netlink)])
AC_SUBST(UK_METHOD)
dnl Checks for RFC3542
AC_CHECK_LIB([c], [inet6_opt_init], [AC_DEFINE([HAVE_RFC3542], [1], [Define to 1 if you support RFC3542])], )
# Generate all files
AC_OUTPUT
cat <<EOF
------------------ Summary ------------------
$PACKAGE_NAME version $PACKAGE_VERSION
Prefix................: $prefix
Sysconfdir............: `eval echo $sysconfdir`
Localstatedir.........: `eval echo $localstatedir`
C Compiler............: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS
Optional features:
Router-side MLDv2.....: $enable_mldv2router
Host-side MLDv2.......: $enable_mldv2host
------------- Compiler version --------------
$($CC --version || true)
---------------------------------------------
Check the above options and compile with:
${MAKE-make}
EOF