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([-pipe])
68 AX_CFLAGS_GCC_OPTION([-Wall])
69 AX_CFLAGS_GCC_OPTION([-W])
70 AX_CFLAGS_GCC_OPTION([-Wextra])
71 AX_CFLAGS_GCC_OPTION([-Wformat])
72 AX_CFLAGS_GCC_OPTION([-Wformat-security])
73 AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
74 AX_CFLAGS_GCC_OPTION([-Wcast-align])
75 AX_CFLAGS_GCC_OPTION([-Winline])
76 AX_CFLAGS_GCC_OPTION([-fstack-protector])
77 AX_CFLAGS_GCC_OPTION([-fno-omit-frame-pointer])
78 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
79 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
80 AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
81 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
82 AX_LDFLAGS_OPTION([-Wl,-z,relro])
83 AX_LDFLAGS_OPTION([-Wl,-z,now])
91 # Checks for header files.
93 AC_CHECK_HEADERS([valgrind/valgrind.h])
98 # Checks for typedefs, structures, and compiler characteristics.
102 # Checks for library functions.
103 AC_CONFIG_LIBOBJ_DIR([src/compat])
107 # setproctitle (maybe through libbsd)
108 AC_SEARCH_LIBS([setproctitle], [util bsd])
109 AC_REPLACE_FUNCS([setproctitle])
110 AC_CHECK_FUNCS([setproctitle_init])
112 AC_REPLACE_FUNCS([strlcpy
120 AC_CHECK_FUNCS([setresuid setresgid])
124 AC_DEFINE(HAVE_LIBBSD, 1, [Define if libbsd is used])
128 # Check for res_init. On OSX, res_init is a symbol in libsystem_info
129 # and a macro in resolv.h. We need to ensure we test with resolv.h.
130 m4_pushdef([AC_LANG_CALL(C)], [
132 @%:@include <resolv.h>], [return $2 ();])])
133 AC_SEARCH_LIBS([res_init], resolv bind,
134 AC_DEFINE([HAVE_RES_INIT], 1,
135 [Define to indicate that res_init() exists]))
136 m4_popdef([AC_LANG_CALL(C)])
140 ## Unit tests wich check
141 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
146 #######################
150 AC_ARG_WITH([readline],
153 [Enable the use of readline-like library @<:@default=check@:>@]),
155 [with_readline=check])
156 if test x"$with_readline" != x"no"; then
158 if test x"$with_readline" != x"check"; then
159 if test x"$ax_cv_lib_readline" = x"no"; then
160 AC_MSG_FAILURE([*** no readline support found])
164 ax_cv_lib_readline="no"
171 [Enable the use of SNMP @<:@default=no@:>@]
173 if test x"$with_snmp" = x"yes"; then
181 [Enable XML output via libxml2 @<:@default=no@:>@]
183 if test x"$with_xml" = x"yes"; then
191 [Enable JSON output via Jansson @<:@default=no@:>@]
193 if test x"$with_json" = x"yes"; then
198 AC_ARG_WITH([seccomp],
201 [Enable seccomp support (with libseccomp) @<:@default=no@:>@]),
206 # OS X launchd support
207 lldp_ARG_WITH([launchddaemonsdir], [Directory for launchd configuration file (OSX)],
208 [/Library/LaunchDaemons])
209 AC_SUBST([launchddaemonsdir], [$with_launchddaemonsdir])
210 AM_CONDITIONAL(HAVE_LAUNCHDDAEMONSDIR,
211 [test -n "$with_launchddaemonsdir" -a "x$with_launchddaemonsdir" != xno ])
214 lldp_ARG_WITH([systemdsystemunitdir], [Directory for systemd service files],
215 [$($PKG_CONFIG --variable=systemdsystemunitdir systemd 2> /dev/null)])
216 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
217 AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR,
218 [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
224 lldp_ARG_ENABLE([privsep], [Privilege separation], [yes])
225 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
226 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
227 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
230 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
231 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
232 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
233 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
236 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
237 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
238 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
241 lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
243 #######################
245 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
246 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
247 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
248 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
249 AM_CONDITIONAL([USE_SECCOMP], [test x"$with_seccomp" = x"yes"])
252 if test x"$LIBEVENT_EMBEDDED" = x; then
260 ------------------ Summary ------------------
261 $PACKAGE_NAME version $PACKAGE_VERSION
263 Prefix.........: $prefix
264 C Compiler.....: $CC $CFLAGS $CPPFLAGS
265 Linker.........: $LD $LDFLAGS $LIBS
266 Libevent.......: $libevent
267 Readline.......: ${ax_cv_lib_readline}
269 SNMP support...: ${with_snmp-no}
270 CDP............: $enable_cdp
271 FDP............: $enable_fdp
272 EDP............: $enable_edp
273 SONMP..........: $enable_sonmp
274 LLDPMED........: $enable_lldpmed
275 DOT1...........: $enable_dot1
276 DOT3...........: $enable_dot3
277 XML output.....: ${with_xml-no}
278 JSON output....: ${with_json-no}
279 Oldies support.: $enable_oldies
280 seccomp........: ${with_seccomp-no}
281 Privilege separation:
282 Enabled........: $enable_privsep
283 User/group.....: ${with_privsep_user-_lldpd}/${with_privsep_group-_lldpd}
284 Chroot.........: ${with_privsep_chroot-/var/run/lldpd}
285 ---------------------------------------------
287 Check the above options and compile with: