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.
40 # Check some compiler flags
41 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
42 AX_CFLAGS_GCC_OPTION([-std=gnu99])
43 AX_CFLAGS_GCC_OPTION([-pipe])
44 AX_CFLAGS_GCC_OPTION([-Wall])
45 AX_CFLAGS_GCC_OPTION([-W])
46 AX_CFLAGS_GCC_OPTION([-Wextra])
47 AX_CFLAGS_GCC_OPTION([-Wformat])
48 AX_CFLAGS_GCC_OPTION([-Wformat-security])
49 AX_CFLAGS_GCC_OPTION([-Wcast-align])
50 AX_CFLAGS_GCC_OPTION([-Winline])
51 AX_CFLAGS_GCC_OPTION([-fstack-protector])
52 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
53 AX_CFLAGS_GCC_OPTION([-Wdeclaration-after-statement])
54 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
55 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
56 AX_LDFLAGS_OPTION([-Wl,-z,relro])
57 AX_LDFLAGS_OPTION([-Wl,-z,now])
61 # Checks for header files.
63 AC_CHECK_HEADERS([valgrind/valgrind.h])
65 # Check for sys/queue.h completeness, missing bits will be in compat.h
70 TAILQ_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
72 # On some systems, some ioctl are not declared
76 SIOCBONDSLAVEINFOQUERY],[],[],[[@%:@include <linux/sockios.h>]])
77 AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [],
78 [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])],
80 @%:@include <arpa/inet.h>
81 @%:@include <linux/if.h>
82 @%:@include <linux/if_bonding.h>
85 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
86 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
88 # Check for ethtool stuff
89 lldp_CHECK_HEADER_ETHTOOL
91 ADVERTISED_2500baseX_Full,
93 ADVERTISED_Asym_Pause,
94 ADVERTISED_10000baseT_Full,
95 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
97 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
98 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
100 # Check some stuff in linux/if_vlan.h
103 ],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[
104 @%:@include <arpa/inet.h>
105 @%:@include <linux/if.h>
107 AC_CHECK_DECLS([GET_VLAN_REALDEV_NAME_CMD,GET_VLAN_VID_CMD],[],[],
108 [[@%:@include <linux/if_vlan.h>]])
112 # Checks for typedefs, structures, and compiler characteristics.
113 lldp_CHECK___PROGNAME
115 # Checks for library functions.
118 AC_REPLACE_FUNCS([strlcpy])
119 AC_REPLACE_FUNCS([getifaddrs])
122 ## Unit tests wich check
123 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
128 #######################
135 [Enable the use of SNMP @<:@default=no@:>@]
137 if test x"$with_snmp" = x"yes"; then
145 [Enable XML output via libxml2 @<:@default=no@:>@]
147 if test x"$with_xml" = x"yes"; then
152 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
153 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
154 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
157 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
158 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
159 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
160 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
163 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
164 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
165 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
167 #######################
169 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
170 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
171 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
174 if test x"$LIBEVENT_LDFLAGS" = x; then
182 ------------------ Summary ------------------
183 $PACKAGE_NAME version $PACKAGE_VERSION
184 Prefix.........: $prefix
185 C Compiler.....: $CC $CFLAGS $CPPFLAGS
186 Linker.........: $LD $LDFLAGS $LIBS
187 Libevent.......: $libevent
189 SNMP support...: ${with_snmp-no}
190 CDP............: $enable_cdp
191 FDP............: $enable_fdp
192 EDP............: $enable_edp
193 SONMP..........: $enable_sonmp
194 LLDPMED........: $enable_lldpmed
195 DOT1...........: $enable_dot1
196 DOT3...........: $enable_dot3
197 XML output.....: ${with_xml-no}
198 ---------------------------------------------
200 Check the above options and compile with: