2 # Process this file with autoconf to produce a configure script.
4 #######################
10 dnl Use something like this if you need to patch autoconf files and
11 dnl regenerate configure outside upstream git tree:
12 dnl AC_INIT([lldpd], [0.5.7], [bernat@luffy.cx])
14 [m4_esyscmd_s([git describe --tags --always 2> /dev/null || date +%F])],
17 AC_CONFIG_SRCDIR([src/lldpd.c])
18 AC_CONFIG_HEADER([config.h])
19 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile])
20 AC_CONFIG_MACRO_DIR([m4])
23 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
25 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
31 #######################
34 # Checks for programs.
45 # Check some compiler flags
46 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
47 AX_CFLAGS_GCC_OPTION([-std=gnu99])
48 AX_CFLAGS_GCC_OPTION([-pipe])
49 AX_CFLAGS_GCC_OPTION([-Wall])
50 AX_CFLAGS_GCC_OPTION([-W])
51 AX_CFLAGS_GCC_OPTION([-Wextra])
52 AX_CFLAGS_GCC_OPTION([-Wformat])
53 AX_CFLAGS_GCC_OPTION([-Wformat-security])
54 AX_CFLAGS_GCC_OPTION([-Wcast-align])
55 AX_CFLAGS_GCC_OPTION([-Winline])
56 AX_CFLAGS_GCC_OPTION([-fstack-protector])
57 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
58 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
59 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
60 AX_LDFLAGS_OPTION([-Wl,-z,relro])
61 AX_LDFLAGS_OPTION([-Wl,-z,now])
65 # Checks for header files.
84 ],,AC_MSG_ERROR([Required header missing.]))
90 ],,AC_MSG_ERROR([Required header missing.]),[
91 @%:@include <arpa/inet.h>
92 @%:@include <linux/if.h>
96 ],,AC_MSG_ERROR([Required header missing.]),[
97 @%:@include <linux/types.h>
101 ],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[
102 @%:@include <arpa/inet.h>
103 @%:@include <linux/if.h>
105 AC_CHECK_HEADERS([valgrind/valgrind.h])
109 # Check for sys/queue.h completeness, missing bits will be in compat.h
122 SLIST_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
124 # On some systems, some ioctl are not declared
128 SIOCBONDSLAVEINFOQUERY],[],[],[[@%:@include <linux/sockios.h>]])
129 AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [],
130 [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])],
132 @%:@include <arpa/inet.h>
133 @%:@include <linux/if.h>
134 @%:@include <linux/if_bonding.h>
137 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
138 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
140 # Check for ethtool stuff
141 lldp_CHECK_HEADER_ETHTOOL
143 ADVERTISED_2500baseX_Full,
145 ADVERTISED_Asym_Pause,
146 ADVERTISED_10000baseT_Full,
147 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
149 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
150 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
152 # Check some stuff in linux/if_vlan.h
153 AC_CHECK_DECLS([GET_VLAN_REALDEV_NAME_CMD,GET_VLAN_VID_CMD],[],[],
154 [[@%:@include <linux/if_vlan.h>]])
158 # Checks for typedefs, structures, and compiler characteristics.
169 lldp_CHECK___PROGNAME
170 lldp_CHECK_FD_SETSIZE
172 # Checks for library functions.
191 ],,[AC_MSG_ERROR(Required function not found.)])
193 AC_REPLACE_FUNCS([strlcpy])
194 AC_REPLACE_FUNCS([getifaddrs])
198 ## Unit tests wich check
199 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
201 #######################
208 [Enable the use of SNMP @<:@default=no@:>@]
210 if test x"$with_snmp" = x"yes"; then
218 [Enable XML output via libxml2 @<:@default=no@:>@]
220 if test x"$with_xml" = x"yes"; then
225 lldp_ARG_WITH([libevent], [Location of libevent directory, la or archive], [])
226 lldp_CHECK_LIBEVENT([$with_libevent])
229 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
230 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
231 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
234 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
235 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
236 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
237 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
240 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
241 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
242 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
244 #######################
246 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
247 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
248 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
253 ------------------ Summary ------------------
254 $PACKAGE_NAME version $PACKAGE_VERSION
255 Prefix.........: $prefix
256 C Compiler.....: $CC $CFLAGS $CPPFLAGS
257 Linker.........: $LD $LDFLAGS $LIBS
259 SNMP support...: ${with_snmp-no}
260 CDP............: $enable_cdp
261 FDP............: $enable_fdp
262 EDP............: $enable_edp
263 SONMP..........: $enable_sonmp
264 LLDPMED........: $enable_lldpmed
265 DOT1...........: $enable_dot1
266 DOT3...........: $enable_dot3
267 XML output.....: ${with_xml-no}
268 ---------------------------------------------
270 Check the above options and compile with: