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/log.c])
18 AC_CONFIG_HEADER([config.h])
19 AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
20 src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
22 AC_CONFIG_MACRO_DIR([m4])
25 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
27 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
33 #######################
36 # Checks for programs.
52 DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
54 # Check some compiler flags
55 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
56 AX_CFLAGS_GCC_OPTION([-std=gnu99])
57 AX_CFLAGS_GCC_OPTION([-pipe])
58 AX_CFLAGS_GCC_OPTION([-Wall])
59 AX_CFLAGS_GCC_OPTION([-W])
60 AX_CFLAGS_GCC_OPTION([-Wextra])
61 AX_CFLAGS_GCC_OPTION([-Wformat])
62 AX_CFLAGS_GCC_OPTION([-Wformat-security])
63 AX_CFLAGS_GCC_OPTION([-Wcast-align])
64 AX_CFLAGS_GCC_OPTION([-Winline])
65 AX_CFLAGS_GCC_OPTION([-fstack-protector])
66 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
67 AX_CFLAGS_GCC_OPTION([-Wdeclaration-after-statement])
68 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
69 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
70 AX_LDFLAGS_OPTION([-Wl,-z,relro])
71 AX_LDFLAGS_OPTION([-Wl,-z,now])
75 # Checks for header files.
77 AC_CHECK_HEADERS([valgrind/valgrind.h])
79 # Check for sys/queue.h completeness, missing bits will be in compat.h
84 TAILQ_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
86 # On some systems, some ioctl are not declared
90 SIOCBONDSLAVEINFOQUERY],[],[],[[@%:@include <linux/sockios.h>]])
91 AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [],
92 [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])],
94 @%:@include <arpa/inet.h>
95 @%:@include <linux/if.h>
96 @%:@include <linux/if_bonding.h>
99 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
100 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
102 # Check for ethtool stuff
103 lldp_CHECK_HEADER_ETHTOOL
105 ADVERTISED_2500baseX_Full,
107 ADVERTISED_Asym_Pause,
108 ADVERTISED_10000baseT_Full,
109 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
111 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
112 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
114 # Check some stuff in linux/if_vlan.h
117 ],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[
118 @%:@include <arpa/inet.h>
119 @%:@include <linux/if.h>
121 AC_CHECK_DECLS([GET_VLAN_REALDEV_NAME_CMD,GET_VLAN_VID_CMD],[],[],
122 [[@%:@include <linux/if_vlan.h>]])
126 # Checks for typedefs, structures, and compiler characteristics.
127 lldp_CHECK___PROGNAME
129 # Checks for library functions.
130 AC_CONFIG_LIBOBJ_DIR([src/compat])
133 AC_REPLACE_FUNCS([strlcpy])
134 AC_REPLACE_FUNCS([getifaddrs])
137 ## Unit tests wich check
138 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
143 #######################
150 [Enable the use of SNMP @<:@default=no@:>@]
152 if test x"$with_snmp" = x"yes"; then
160 [Enable XML output via libxml2 @<:@default=no@:>@]
162 if test x"$with_xml" = x"yes"; then
167 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
168 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
169 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
172 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
173 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
174 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
175 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
178 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
179 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
180 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
182 #######################
184 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
185 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
186 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
189 if test x"$LIBEVENT_LDFLAGS" = x; then
197 ------------------ Summary ------------------
198 $PACKAGE_NAME version $PACKAGE_VERSION
199 Prefix.........: $prefix
200 C Compiler.....: $CC $CFLAGS $CPPFLAGS
201 Linker.........: $LD $LDFLAGS $LIBS
202 Libevent.......: $libevent
204 SNMP support...: ${with_snmp-no}
205 CDP............: $enable_cdp
206 FDP............: $enable_fdp
207 EDP............: $enable_edp
208 SONMP..........: $enable_sonmp
209 LLDPMED........: $enable_lldpmed
210 DOT1...........: $enable_dot1
211 DOT3...........: $enable_dot3
212 XML output.....: ${with_xml-no}
213 ---------------------------------------------
215 Check the above options and compile with: