]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
Fix AC_CHECK_DECLS macro in configure.ac
[thirdparty/lldpd.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 #######################
5 ### Base configuration
6
7 # Configure autoconf
8 AC_PREREQ([2.64])
9 AC_INIT([lldpd], [0.5.1], [bernat@luffy.cx])
10 AC_CONFIG_SRCDIR([src/lldpd.c])
11 AC_CONFIG_HEADER([config.h])
12 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile])
13 AC_CONFIG_MACRO_DIR([m4])
14
15 # Configure automake
16 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
17 AM_SILENT_RULES([yes])
18
19 # Configure libtool
20 #LT_PREREQ([2.2])
21 LT_INIT
22
23 #######################
24 ### Checks
25
26 # Checks for programs.
27 AC_PROG_AWK
28 AC_PROG_CC
29 AC_PROG_CPP
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32 AC_PROG_MAKE_SET
33 AC_PROG_CXX
34 AM_PROG_CC_C_O
35 AC_PROG_LIBTOOL
36
37 # Check some compiler flags
38 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
39 AX_CFLAGS_GCC_OPTION([-std=gnu99])
40 AX_CFLAGS_GCC_OPTION([-pipe])
41 AX_CFLAGS_GCC_OPTION([-Wall])
42 AX_CFLAGS_GCC_OPTION([-W])
43 AX_CFLAGS_GCC_OPTION([-Wextra])
44 AX_CFLAGS_GCC_OPTION([-Wformat])
45 AX_CFLAGS_GCC_OPTION([-Wformat-security])
46 AX_CFLAGS_GCC_OPTION([-Wcast-align])
47 AX_CFLAGS_GCC_OPTION([-Winline])
48 AX_CFLAGS_GCC_OPTION([-fstack-protector])
49 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
50 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
51 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
52
53 AC_CACHE_SAVE
54
55 # Checks for header files.
56 AC_HEADER_RESOLV
57 AC_CHECK_HEADERS([ \
58 arpa/inet.h \
59 fcntl.h \
60 malloc.h \
61 netdb.h \
62 netinet/in.h \
63 stdlib.h \
64 string.h \
65 sys/ioctl.h \
66 sys/param.h \
67 sys/socket.h \
68 sys/time.h \
69 sys/queue.h \
70 syslog.h \
71 unistd.h \
72 net/if.h \
73 linux/sockios.h \
74 ],,AC_MSG_ERROR([Required header missing.]))
75 AC_CHECK_HEADERS([ \
76 linux/wireless.h \
77 linux/if_bonding.h \
78 linux/if_bridge.h \
79 linux/if_packet.h \
80 ],,AC_MSG_ERROR([Required header missing.]),[
81 @%:@include <arpa/inet.h>
82 @%:@include <linux/if.h>
83 ])
84 AC_CHECK_HEADERS([ \
85 linux/filter.h \
86 ],,AC_MSG_ERROR([Required header missing.]),[
87 @%:@include <linux/types.h>
88 ])
89 AC_CHECK_HEADERS([ \
90 linux/if_vlan.h \
91 ],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[
92 @%:@include <arpa/inet.h>
93 @%:@include <linux/if.h>
94 ])
95
96 AC_CACHE_SAVE
97
98 # Check for sys/queue.h completeness, missing bits will be in compat.h
99 AC_CHECK_DECLS([
100 TAILQ_FIRST,
101 TAILQ_NEXT,
102 TAILQ_FOREACH,
103 TAILQ_EMPTY,
104 SLIST_HEAD,
105 SLIST_ENTRY,
106 SLIST_INIT,
107 SLIST_INSERT_HEAD,
108 SLIST_FIRST,
109 SLIST_NEXT,
110 SLIST_REMOVE_HEAD,
111 SLIST_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
112
113 # On some systems, some ioctl are not declared
114 AC_CHECK_DECLS([
115 SIOCGIFVLAN,
116 SIOCBONDINFOQUERY,
117 SIOCBONDSLAVEINFOQUERY],[],[],[[@%:@include <linux/sockios.h>]])
118 AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [],
119 [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])],
120 [
121 @%:@include <arpa/inet.h>
122 @%:@include <linux/if.h>
123 @%:@include <linux/if_bonding.h>
124 ])
125
126 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
127 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
128
129 # Check for ethtool stuff
130 lldp_CHECK_HEADER_ETHTOOL
131 AC_CHECK_DECLS([
132 ADVERTISED_2500baseX_Full,
133 ADVERTISED_Pause,
134 ADVERTISED_Asym_Pause,
135 ADVERTISED_10000baseT_Full,
136 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
137
138 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
139 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
140
141 # Check some stuff in linux/if_vlan.h
142 AC_CHECK_DECLS([GET_VLAN_REALDEV_NAME_CMD,GET_VLAN_VID_CMD],[],[],
143 [[@%:@include <linux/if_vlan.h>]])
144
145 AC_CACHE_SAVE
146
147 # Checks for typedefs, structures, and compiler characteristics.
148 AC_TYPE_UID_T
149 AC_C_INLINE
150 AC_TYPE_INT16_T
151 AC_TYPE_INT32_T
152 AC_TYPE_PID_T
153 AC_TYPE_SIZE_T
154 AC_TYPE_SSIZE_T
155 AC_TYPE_UINT16_T
156 AC_TYPE_UINT32_T
157 AC_TYPE_UINT8_T
158 lldp_CHECK___PROGNAME
159 lldp_CHECK_FD_SETSIZE
160
161 # Checks for library functions.
162 AC_FUNC_CHOWN
163 AC_FUNC_FORK
164 AC_FUNC_MALLOC
165 AC_FUNC_REALLOC
166 AC_CHECK_FUNCS([ \
167 atexit \
168 gethostbyname \
169 inet_ntoa memset \
170 regcomp \
171 select \
172 setenv \
173 socket \
174 strchr \
175 strdup \
176 strerror \
177 strndup \
178 tzset \
179 uname \
180 ],,[AC_MSG_ERROR(Required function not found.)])
181
182 AC_REPLACE_FUNCS([strlcpy])
183 AC_REPLACE_FUNCS([getifaddrs])
184
185 AC_CACHE_SAVE
186
187 ## Unit tests wich check
188 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
189
190 #######################
191 ### Options
192
193 # SNMP
194 AC_ARG_WITH([snmp],
195 AS_HELP_STRING(
196 [--with-snmp],
197 [Enable the use of SNMP @<:@default=no@:>@]
198 ))
199 if test x"$with_snmp" = x"yes"; then
200 lldp_CHECK_SNMP
201 fi
202
203 AC_ARG_WITH([xml],
204 AC_HELP_STRING(
205 [--with-xml],
206 [Enable XML output via libxml2 @<:@default=no:>@]
207 ))
208 if test x"$with_xml" = x"yes"; then
209 lldp_CHECK_XML2
210 fi
211
212 # Privsep settings
213 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
214 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
215 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
216
217 # CDP/FDP/EDP/SONMP
218 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
219 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
220 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
221 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
222
223 # LLDPMED/Dot1/Dot3
224 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
225 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
226 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
227
228 #Listen on vlan
229 lldp_ARG_ENABLE([listenvlan], [listen on any VLAN], [no])
230
231 #######################
232 # Output results
233 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
234 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
235 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
236 AC_OUTPUT
237
238 cat <<EOF
239
240 ------------------ Summary ------------------
241 $PACKAGE_NAME version $PACKAGE_VERSION
242 Prefix.........: $prefix
243 C Compiler.....: $CC $CFLAGS $CPPFLAGS
244 Linker.........: $LD $LDFLAGS $LIBS
245 Optional features:
246 SNMP support...: ${with_snmp-no}
247 CDP............: $enable_cdp
248 FDP............: $enable_fdp
249 EDP............: $enable_edp
250 SONMP..........: $enable_sonmp
251 LLDPMED........: $enable_lldpmed
252 DOT1...........: $enable_dot1
253 DOT3...........: $enable_dot3
254 Listen on VLAN.: $enable_listenvlan
255 XML output.....: ${with_xml-no}
256 ---------------------------------------------
257
258 Check the above options and compile with:
259 ${MAKE-make}
260
261 EOF