2 # Process this file with autoconf to produce a configure script.
4 #######################
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])
16 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
17 AM_SILENT_RULES([yes])
23 #######################
26 # Checks for programs.
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
55 # Checks for header files.
74 ],,AC_MSG_ERROR([Required header missing.]))
80 ],,AC_MSG_ERROR([Required header missing.]),[
81 @%:@include <arpa/inet.h>
82 @%:@include <linux/if.h>
86 ],,AC_MSG_ERROR([Required header missing.]),[
87 @%:@include <linux/types.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>
98 # Check for sys/queue.h completeness, missing bits will be in compat.h
111 SLIST_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
113 # On some systems, some ioctl are not declared
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.])],
121 @%:@include <arpa/inet.h>
122 @%:@include <linux/if.h>
123 @%:@include <linux/if_bonding.h>
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>]])
129 # Check for ethtool stuff
130 lldp_CHECK_HEADER_ETHTOOL
132 ADVERTISED_2500baseX_Full,
134 ADVERTISED_Asym_Pause,
135 ADVERTISED_10000baseT_Full,
136 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
138 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
139 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
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>]])
147 # Checks for typedefs, structures, and compiler characteristics.
158 lldp_CHECK___PROGNAME
159 lldp_CHECK_FD_SETSIZE
161 # Checks for library functions.
180 ],,[AC_MSG_ERROR(Required function not found.)])
182 AC_REPLACE_FUNCS([strlcpy])
183 AC_REPLACE_FUNCS([getifaddrs])
187 ## Unit tests wich check
188 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
190 #######################
197 [Enable the use of SNMP @<:@default=no@:>@]
199 if test x"$with_snmp" = x"yes"; then
206 [Enable XML output via libxml2 @<:@default=no:>@]
208 if test x"$with_xml" = x"yes"; then
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])
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])
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])
229 lldp_ARG_ENABLE([listenvlan], [listen on any VLAN], [no])
231 #######################
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"])
240 ------------------ Summary ------------------
241 $PACKAGE_NAME version $PACKAGE_VERSION
242 Prefix.........: $prefix
243 C Compiler.....: $CC $CFLAGS $CPPFLAGS
244 Linker.........: $LD $LDFLAGS $LIBS
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 ---------------------------------------------
258 Check the above options and compile with: