2 # Process this file with autoconf to produce a configure script.
4 #######################
11 [m4_esyscmd_s([./get-version])],
14 AC_CONFIG_SRCDIR([src/log.c])
15 AC_CONFIG_HEADER([config.h])
16 AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
17 src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
19 AC_CONFIG_FILES([osx/Makefile osx/distribution.xml osx/im.bernat.lldpd.plist])
20 AC_CONFIG_FILES([osx/scripts/preinstall], [chmod +x osx/scripts/preinstall])
21 AC_CONFIG_FILES([osx/scripts/postinstall], [chmod +x osx/scripts/postinstall])
22 AC_CONFIG_FILES([src/daemon/lldpd.service])
23 AC_CONFIG_MACRO_DIR([m4])
24 AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
27 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
32 m4_pattern_allow([AM_PROG_AR])
38 #######################
41 # Checks for programs.
60 DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
62 # Check some compiler flags
63 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
64 AX_CFLAGS_GCC_OPTION([-pipe])
65 AX_CFLAGS_GCC_OPTION([-Wall])
66 AX_CFLAGS_GCC_OPTION([-W])
67 AX_CFLAGS_GCC_OPTION([-Wextra])
68 AX_CFLAGS_GCC_OPTION([-Wformat])
69 AX_CFLAGS_GCC_OPTION([-Wformat-security])
70 AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
71 AX_CFLAGS_GCC_OPTION([-Wcast-align])
72 AX_CFLAGS_GCC_OPTION([-Winline])
73 AX_CFLAGS_GCC_OPTION([-fstack-protector])
74 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
75 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
76 AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
77 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
78 AX_LDFLAGS_OPTION([-Wl,-z,relro])
79 AX_LDFLAGS_OPTION([-Wl,-z,now])
86 # Checks for header files.
88 AC_CHECK_HEADERS([valgrind/valgrind.h])
93 # Checks for typedefs, structures, and compiler characteristics.
96 # Checks for library functions.
97 AC_CONFIG_LIBOBJ_DIR([src/compat])
100 AC_SEARCH_LIBS([setproctitle], [util bsd])
101 AC_REPLACE_FUNCS([setproctitle])
102 AC_CHECK_FUNCS([setproctitle_init])
103 AC_REPLACE_FUNCS([strlcpy strnlen strndup fgetln])
104 AC_CHECK_FUNCS([setresuid setresgid])
108 AC_DEFINE(HAVE_LIBBSD, 1, [Define if libbsd is used])
112 # Check for res_init. On OSX, res_init is a symbol in libsystem_info
113 # and a macro in resolv.h. We need to ensure we test with resolv.h.
114 m4_pushdef([AC_LANG_CALL(C)], [
116 @%:@include <resolv.h>], [return $2 ();])])
117 AC_SEARCH_LIBS([res_init], resolv bind,
118 AC_DEFINE([HAVE_RES_INIT], 1,
119 [Define to indicate that res_init() exists]))
120 m4_popdef([AC_LANG_CALL(C)])
124 ## Unit tests wich check
125 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
130 #######################
134 AC_ARG_WITH([readline],
137 [Enable the use of readline-like library @<:@default=check@:>@]),
139 [with_readline=check])
140 if test x"$with_readline" != x"no"; then
142 if test x"$with_readline" != x"check"; then
143 if test x"$ax_cv_lib_readline" = x"no"; then
144 AC_MSG_FAILURE([*** no readline support found])
148 ax_cv_lib_readline="no"
155 [Enable the use of SNMP @<:@default=no@:>@]
157 if test x"$with_snmp" = x"yes"; then
165 [Enable XML output via libxml2 @<:@default=no@:>@]
167 if test x"$with_xml" = x"yes"; then
175 [Enable JSON output via Jansson @<:@default=no@:>@]
177 if test x"$with_json" = x"yes"; then
181 # OS X launchd support
182 lldp_ARG_WITH([launchddaemonsdir], [Directory for launchd configuration file (OSX)],
183 [/Library/LaunchDaemons])
184 AC_SUBST([launchddaemonsdir], [$with_launchddaemonsdir])
185 AM_CONDITIONAL(HAVE_LAUNCHDDAEMONSDIR,
186 [test -n "$with_launchddaemonsdir" -a "x$with_launchddaemonsdir" != xno ])
189 lldp_ARG_WITH([systemdsystemunitdir], [Directory for systemd service files],
190 [$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
191 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
192 AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR,
193 [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
196 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
197 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
198 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
201 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
202 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
203 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
204 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
207 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
208 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
209 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
212 lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
214 #######################
216 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
217 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
218 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
219 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
222 if test x"$LIBEVENT_EMBEDDED" = x; then
230 ------------------ Summary ------------------
231 $PACKAGE_NAME version $PACKAGE_VERSION
233 Prefix.........: $prefix
234 C Compiler.....: $CC $CFLAGS $CPPFLAGS
235 Linker.........: $LD $LDFLAGS $LIBS
236 Libevent.......: $libevent
237 Readline.......: ${ax_cv_lib_readline}
239 SNMP support...: ${with_snmp-no}
240 CDP............: $enable_cdp
241 FDP............: $enable_fdp
242 EDP............: $enable_edp
243 SONMP..........: $enable_sonmp
244 LLDPMED........: $enable_lldpmed
245 DOT1...........: $enable_dot1
246 DOT3...........: $enable_dot3
247 XML output.....: ${with_xml-no}
248 JSON output....: ${with_json-no}
249 Oldies support.: $enable_oldies
250 ---------------------------------------------
252 Check the above options and compile with: