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)])
30 m4_pattern_allow([AM_PROG_AR])
36 #######################
39 # Checks for programs.
57 DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
59 # Check some compiler flags
60 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
61 AX_CFLAGS_GCC_OPTION([-pipe])
62 AX_CFLAGS_GCC_OPTION([-Wall])
63 AX_CFLAGS_GCC_OPTION([-W])
64 AX_CFLAGS_GCC_OPTION([-Wextra])
65 AX_CFLAGS_GCC_OPTION([-Wformat])
66 AX_CFLAGS_GCC_OPTION([-Wformat-security])
67 AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
68 AX_CFLAGS_GCC_OPTION([-Wcast-align])
69 AX_CFLAGS_GCC_OPTION([-Winline])
70 AX_CFLAGS_GCC_OPTION([-fstack-protector])
71 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
72 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
73 AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
74 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
75 AX_LDFLAGS_OPTION([-Wl,-z,relro])
76 AX_LDFLAGS_OPTION([-Wl,-z,now])
83 # Checks for header files.
85 AC_CHECK_HEADERS([valgrind/valgrind.h])
89 # Checks for typedefs, structures, and compiler characteristics.
92 # Checks for library functions.
93 AC_CONFIG_LIBOBJ_DIR([src/compat])
96 AC_REPLACE_FUNCS([strlcpy strnlen])
97 AC_CHECK_FUNCS([setresuid setresgid])
99 AC_SEARCH_LIBS([__res_init], resolv bind, AC_DEFINE([HAVE_RES_INIT], 1, [Define to indicate that res_init() exists]),
100 AC_SEARCH_LIBS([res_9_init], resolv bind, AC_DEFINE([HAVE_RES_INIT], 1, [Define to indicate that res_init() exists]),
101 AC_SEARCH_LIBS([res_init], resolv bind, AC_DEFINE([HAVE_RES_INIT], 1, [Define to indicate that res_init() exists]))))
105 ## Unit tests wich check
106 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
111 #######################
115 AC_ARG_WITH([readline],
118 [Enable the use of readline-like library @<:@default=check@:>@]),
120 [with_readline=check])
121 if test x"$with_readline" != x"no"; then
123 if test x"$with_readline" != x"check"; then
124 if test x"$ax_cv_lib_readline" = x"no"; then
125 AC_MSG_FAILURE([*** no readline support found])
129 ax_cv_lib_readline="no"
136 [Enable the use of SNMP @<:@default=no@:>@]
138 if test x"$with_snmp" = x"yes"; then
146 [Enable XML output via libxml2 @<:@default=no@:>@]
148 if test x"$with_xml" = x"yes"; then
156 [Enable JSON output via Jansson @<:@default=no@:>@]
158 if test x"$with_json" = x"yes"; then
163 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
164 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
165 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
168 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
169 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
170 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
171 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
174 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
175 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
176 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
179 lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
181 #######################
183 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
184 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
185 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
186 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = 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
203 Readline.......: ${ax_cv_lib_readline}
205 SNMP support...: ${with_snmp-no}
206 CDP............: $enable_cdp
207 FDP............: $enable_fdp
208 EDP............: $enable_edp
209 SONMP..........: $enable_sonmp
210 LLDPMED........: $enable_lldpmed
211 DOT1...........: $enable_dot1
212 DOT3...........: $enable_dot3
213 XML output.....: ${with_xml-no}
214 JSON output....: ${with_json-no}
215 Oldies support.: $enable_oldies
216 ---------------------------------------------
218 Check the above options and compile with: