2 # Process this file with autoconf to produce a configure script.
4 #######################
11 [m4_esyscmd_s([./get-version])],
12 [https://github.com/vincentbernat/lldpd/issues],
14 [http://vincentbernat.github.io/lldpd/])
16 AC_CONFIG_SRCDIR([src/log.c])
17 AC_CONFIG_HEADER([config.h])
18 AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
19 src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
21 AC_CONFIG_FILES([osx/Makefile osx/distribution.xml osx/im.bernat.lldpd.plist])
22 AC_CONFIG_FILES([osx/scripts/preinstall], [chmod +x osx/scripts/preinstall])
23 AC_CONFIG_FILES([osx/scripts/postinstall], [chmod +x osx/scripts/postinstall])
24 AC_CONFIG_FILES([src/daemon/lldpd.service])
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
29 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
34 m4_pattern_allow([AM_PROG_AR])
40 #######################
43 # Checks for programs.
63 DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
65 # Check some compiler flags
66 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
67 AX_CFLAGS_GCC_OPTION([-fdiagnostics-color=auto])
68 AX_CFLAGS_GCC_OPTION([-pipe])
69 AX_CFLAGS_GCC_OPTION([-Wall])
70 AX_CFLAGS_GCC_OPTION([-W])
71 AX_CFLAGS_GCC_OPTION([-Wextra])
72 AX_CFLAGS_GCC_OPTION([-Wformat])
73 AX_CFLAGS_GCC_OPTION([-Wformat-security])
74 AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
75 AX_CFLAGS_GCC_OPTION([-Wcast-align])
76 AX_CFLAGS_GCC_OPTION([-Winline])
77 AX_CFLAGS_GCC_OPTION([-fstack-protector])
78 AX_CFLAGS_GCC_OPTION([-fstack-protector-strong])
79 AX_CFLAGS_GCC_OPTION([-fno-omit-frame-pointer])
80 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
81 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
82 AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
83 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
84 AX_LDFLAGS_OPTION([-Wl,-z,relro])
85 AX_LDFLAGS_OPTION([-Wl,-z,now])
93 # Checks for header files.
95 AC_CHECK_HEADERS([valgrind/valgrind.h])
100 # Checks for typedefs, structures, and compiler characteristics.
101 lldp_CHECK___PROGNAME
104 # Checks for library functions.
105 AC_CONFIG_LIBOBJ_DIR([src/compat])
109 # setproctitle (maybe through libbsd)
110 AC_SEARCH_LIBS([setproctitle], [util bsd])
111 AC_REPLACE_FUNCS([setproctitle])
112 AC_CHECK_FUNCS([setproctitle_init])
114 AC_REPLACE_FUNCS([strlcpy
122 AC_CHECK_FUNCS([setresuid setresgid])
126 AC_DEFINE(HAVE_LIBBSD, 1, [Define if libbsd is used])
130 # Check for res_init. On OSX, res_init is a symbol in libsystem_info
131 # and a macro in resolv.h. We need to ensure we test with resolv.h.
132 m4_pushdef([AC_LANG_CALL(C)], [
134 @%:@include <resolv.h>], [return $2 ();])])
135 AC_SEARCH_LIBS([res_init], resolv bind,
136 AC_DEFINE([HAVE_RES_INIT], 1,
137 [Define to indicate that res_init() exists]))
138 m4_popdef([AC_LANG_CALL(C)])
142 ## Unit tests wich check
143 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
148 #######################
152 AC_ARG_WITH([readline],
155 [Enable the use of readline-like library @<:@default=check@:>@]),
157 [with_readline=check])
158 if test x"$with_readline" != x"no"; then
160 if test x"$with_readline" != x"check"; then
161 if test x"$ax_cv_lib_readline" = x"no"; then
162 AC_MSG_FAILURE([*** no readline support found])
166 ax_cv_lib_readline="no"
173 [Enable the use of SNMP @<:@default=no@:>@]
175 if test x"$with_snmp" = x"yes"; then
183 [Enable XML output via libxml2 @<:@default=no@:>@]
185 if test x"$with_xml" = x"yes"; then
193 [Enable JSON output via Jansson @<:@default=no@:>@]
195 if test x"$with_json" = x"yes"; then
200 AC_ARG_WITH([seccomp],
203 [Enable seccomp support (with libseccomp) @<:@default=no@:>@]),
208 # OS X launchd support
209 lldp_ARG_WITH([launchddaemonsdir], [Directory for launchd configuration file (OSX)],
210 [/Library/LaunchDaemons])
211 AC_SUBST([launchddaemonsdir], [$with_launchddaemonsdir])
212 AM_CONDITIONAL(HAVE_LAUNCHDDAEMONSDIR,
213 [test -n "$with_launchddaemonsdir" -a "x$with_launchddaemonsdir" != xno ])
216 lldp_ARG_WITH([systemdsystemunitdir], [Directory for systemd service files],
217 [$($PKG_CONFIG --variable=systemdsystemunitdir systemd 2> /dev/null)])
218 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
219 AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR,
220 [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
226 lldp_ARG_ENABLE([privsep], [Privilege separation], [yes])
227 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
228 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
231 dnl On autoconf 2.69 and before, runstatedir is not configurable, let be able to use it anyway
232 if test "x$runstatedir" = x; then
233 AC_SUBST([runstatedir], ['${localstatedir}/run'])
235 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [${runstatedir}/lldpd])
236 lldp_ARG_WITH([lldpd-ctl-socket], [Path to socket for communication with lldpd], [${runstatedir}/lldpd.socket])
239 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
240 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
241 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
242 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
245 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
246 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
247 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
250 lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
252 #######################
254 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
255 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
256 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
257 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
258 AM_CONDITIONAL([USE_SECCOMP], [test x"$with_seccomp" = x"yes"])
261 if test x"$LIBEVENT_EMBEDDED" = x; then
269 ------------------ Summary ------------------
270 $PACKAGE_NAME version $PACKAGE_VERSION
272 Prefix.........: $prefix
273 C Compiler.....: $CC $CFLAGS $CPPFLAGS
274 Linker.........: $LD $LDFLAGS $LIBS
275 Libevent.......: $libevent
276 Readline.......: ${ax_cv_lib_readline}
278 SNMP support...: ${with_snmp-no}
279 CDP............: $enable_cdp
280 FDP............: $enable_fdp
281 EDP............: $enable_edp
282 SONMP..........: $enable_sonmp
283 LLDPMED........: $enable_lldpmed
284 DOT1...........: $enable_dot1
285 DOT3...........: $enable_dot3
286 XML output.....: ${with_xml-no}
287 JSON output....: ${with_json-no}
288 Oldies support.: $enable_oldies
289 seccomp........: ${with_seccomp-no}
290 Privilege separation:
291 Enabled........: $enable_privsep
292 User/group.....: ${with_privsep_user}/${with_privsep_group}
293 Chroot.........: ${with_privsep_chroot}
294 ---------------------------------------------
296 Check the above options and compile with: