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 m4_ifdef([AM_SILENT_RULES], [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
53 AX_LDFLAGS_OPTION([-Wl,--as-needed])
57 # Checks for header files.
76 ],,AC_MSG_ERROR([Required header missing.]))
82 ],,AC_MSG_ERROR([Required header missing.]),[
83 @%:@include <arpa/inet.h>
84 @%:@include <linux/if.h>
88 ],,AC_MSG_ERROR([Required header missing.]),[
89 @%:@include <linux/types.h>
93 ],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[
94 @%:@include <arpa/inet.h>
95 @%:@include <linux/if.h>
100 # Check for sys/queue.h completeness, missing bits will be in compat.h
113 SLIST_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
115 # On some systems, some ioctl are not declared
119 SIOCBONDSLAVEINFOQUERY],[],[],[[@%:@include <linux/sockios.h>]])
120 AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [],
121 [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])],
123 @%:@include <arpa/inet.h>
124 @%:@include <linux/if.h>
125 @%:@include <linux/if_bonding.h>
128 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
129 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
131 # Check for ethtool stuff
132 lldp_CHECK_HEADER_ETHTOOL
134 ADVERTISED_2500baseX_Full,
136 ADVERTISED_Asym_Pause,
137 ADVERTISED_10000baseT_Full,
138 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
140 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
141 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
143 # Check some stuff in linux/if_vlan.h
144 AC_CHECK_DECLS([GET_VLAN_REALDEV_NAME_CMD,GET_VLAN_VID_CMD],[],[],
145 [[@%:@include <linux/if_vlan.h>]])
149 # Checks for typedefs, structures, and compiler characteristics.
160 lldp_CHECK___PROGNAME
161 lldp_CHECK_FD_SETSIZE
163 # Checks for library functions.
182 ],,[AC_MSG_ERROR(Required function not found.)])
184 AC_REPLACE_FUNCS([strlcpy])
185 AC_REPLACE_FUNCS([getifaddrs])
189 ## Unit tests wich check
190 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
192 #######################
199 [Enable the use of SNMP @<:@default=no@:>@]
201 if test x"$with_snmp" = x"yes"; then
208 [Enable XML output via libxml2 @<:@default=no:>@]
210 if test x"$with_xml" = x"yes"; then
215 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
216 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
217 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
220 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
221 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
222 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
223 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
226 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
227 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
228 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
231 lldp_ARG_ENABLE([listenvlan], [listen on any VLAN], [no])
233 #######################
235 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
236 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
237 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
242 ------------------ Summary ------------------
243 $PACKAGE_NAME version $PACKAGE_VERSION
244 Prefix.........: $prefix
245 C Compiler.....: $CC $CFLAGS $CPPFLAGS
246 Linker.........: $LD $LDFLAGS $LIBS
248 SNMP support...: ${with_snmp-no}
249 CDP............: $enable_cdp
250 FDP............: $enable_fdp
251 EDP............: $enable_edp
252 SONMP..........: $enable_sonmp
253 LLDPMED........: $enable_lldpmed
254 DOT1...........: $enable_dot1
255 DOT3...........: $enable_dot3
256 Listen on VLAN.: $enable_listenvlan
257 XML output.....: ${with_xml-no}
258 ---------------------------------------------
260 Check the above options and compile with: