]> git.ipfire.org Git - thirdparty/lldpd.git/blame - configure.ac
dtrace: add systemtap/DTrace support
[thirdparty/lldpd.git] / configure.ac
CommitLineData
43c02e7b
VB
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
d38eae28
VB
4#######################
5### Base configuration
6
7# Configure autoconf
8AC_PREREQ([2.64])
4593c0dc 9
4593c0dc 10AC_INIT([lldpd],
a888bea6 11 [m4_esyscmd_s([./get-version])],
4593c0dc
VB
12 [bernat@luffy.cx])
13
4b292b55 14AC_CONFIG_SRCDIR([src/log.c])
43c02e7b 15AC_CONFIG_HEADER([config.h])
4b292b55
VB
16AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
17 src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
e9f4d63c
VB
18 tests/Makefile])
19AC_CONFIG_FILES([osx/Makefile osx/distribution.xml osx/im.bernat.lldpd.plist])
20AC_CONFIG_FILES([osx/scripts/preinstall], [chmod +x osx/scripts/preinstall])
21AC_CONFIG_FILES([osx/scripts/postinstall], [chmod +x osx/scripts/postinstall])
9d1524b7 22AC_CONFIG_FILES([src/daemon/lldpd.service])
2acc1418 23AC_CONFIG_MACRO_DIR([m4])
fa71a00c 24AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
43c02e7b 25
d38eae28
VB
26# Configure automake
27AM_INIT_AUTOMAKE([foreign -Wall -Werror])
33aa26d0 28AM_MAINTAINER_MODE
44cd2bed 29m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
d38eae28 30
0339b9a2
VB
31# Automake 1.12...
32m4_pattern_allow([AM_PROG_AR])
33AM_PROG_AR
34
d38eae28 35# Configure libtool
d38eae28
VB
36LT_INIT
37
38#######################
39### Checks
40
43c02e7b
VB
41# Checks for programs.
42AC_PROG_CC
6c586123 43AC_PROG_CC_C99
223227c8 44AC_PROG_CXX
d38eae28 45AM_PROG_CC_C_O
f5bc67ee 46AC_PROG_LIBTOOL
fe80711e 47AC_PROG_LN_S
7ba4a183 48AC_PROG_EGREP
2acc1418 49
4b292b55
VB
50# Doxygen
51DX_HTML_FEATURE(ON)
52DX_DOT_FEATURE(OFF)
53DX_CHM_FEATURE(OFF)
54DX_CHI_FEATURE(OFF)
55DX_MAN_FEATURE(OFF)
56DX_RTF_FEATURE(OFF)
57DX_XML_FEATURE(OFF)
58DX_PDF_FEATURE(ON)
59DX_PS_FEATURE(OFF)
60DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
61
45e89c8c
VB
62# Check some compiler flags
63AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
45e89c8c
VB
64AX_CFLAGS_GCC_OPTION([-pipe])
65AX_CFLAGS_GCC_OPTION([-Wall])
66AX_CFLAGS_GCC_OPTION([-W])
67AX_CFLAGS_GCC_OPTION([-Wextra])
68AX_CFLAGS_GCC_OPTION([-Wformat])
69AX_CFLAGS_GCC_OPTION([-Wformat-security])
d56bb3bd 70AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
45e89c8c
VB
71AX_CFLAGS_GCC_OPTION([-Wcast-align])
72AX_CFLAGS_GCC_OPTION([-Winline])
73AX_CFLAGS_GCC_OPTION([-fstack-protector])
74AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
75AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
d56bb3bd 76AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
45e89c8c 77AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
a37f8fd6
VB
78AX_LDFLAGS_OPTION([-Wl,-z,relro])
79AX_LDFLAGS_OPTION([-Wl,-z,now])
45e89c8c 80
e12c2365
VB
81# OS
82lldp_CHECK_OS
83
8e4b9031
VB
84AC_CACHE_SAVE
85
d38eae28
VB
86# Checks for header files.
87AC_HEADER_RESOLV
396cfdfe 88AC_CHECK_HEADERS([valgrind/valgrind.h])
c3e340b6 89lldp_CHECK_STDINT
43c02e7b 90
8e4b9031
VB
91AC_CACHE_SAVE
92
43c02e7b 93# Checks for typedefs, structures, and compiler characteristics.
6bb9c4e0 94lldp_CHECK___PROGNAME
43c02e7b
VB
95
96# Checks for library functions.
4b292b55 97AC_CONFIG_LIBOBJ_DIR([src/compat])
d38eae28
VB
98AC_FUNC_MALLOC
99AC_FUNC_REALLOC
66879d46 100AC_SEARCH_LIBS([setproctitle], [util bsd])
1e0d651f
VB
101AC_REPLACE_FUNCS([setproctitle])
102AC_CHECK_FUNCS([setproctitle_init])
103AC_REPLACE_FUNCS([strlcpy strnlen strndup fgetln])
8dab5698 104AC_CHECK_FUNCS([setresuid setresgid])
e66b7f34 105
66879d46
VB
106case " $LIBS " in
107 *\ -lbsd\ *)
108 AC_DEFINE(HAVE_LIBBSD, 1, [Define if libbsd is used])
109 ;;
110esac
111
d0a03372
VB
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.
114m4_pushdef([AC_LANG_CALL(C)], [
115 AC_LANG_PROGRAM([$1
116@%:@include <resolv.h>], [return $2 ();])])
117AC_SEARCH_LIBS([res_init], resolv bind,
118 AC_DEFINE([HAVE_RES_INIT], 1,
119 [Define to indicate that res_init() exists]))
120m4_popdef([AC_LANG_CALL(C)])
e66b7f34 121
8e4b9031
VB
122AC_CACHE_SAVE
123
d38eae28
VB
124## Unit tests wich check
125PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
43c02e7b 126
e5c94652 127# Libevent
c461e5da 128lldp_CHECK_LIBEVENT
e5c94652 129
d38eae28
VB
130#######################
131### Options
43c02e7b 132
35f6f4fb
VB
133# Readline
134AC_ARG_WITH([readline],
135 AS_HELP_STRING(
136 [--with-readline],
137 [Enable the use of readline-like library @<:@default=check@:>@]),
138 [],
139 [with_readline=check])
140if test x"$with_readline" != x"no"; then
141 AX_LIB_READLINE
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])
145 fi
146 fi
147else
148 ax_cv_lib_readline="no"
149fi
150
d38eae28
VB
151# SNMP
152AC_ARG_WITH([snmp],
153 AS_HELP_STRING(
154 [--with-snmp],
155 [Enable the use of SNMP @<:@default=no@:>@]
156 ))
157if test x"$with_snmp" = x"yes"; then
158 lldp_CHECK_SNMP
315587ef
VB
159fi
160
8beb9a73 161# XML
1480ce74
AH
162AC_ARG_WITH([xml],
163 AC_HELP_STRING(
164 [--with-xml],
5a9cb3db 165 [Enable XML output via libxml2 @<:@default=no@:>@]
1480ce74
AH
166 ))
167if test x"$with_xml" = x"yes"; then
168 lldp_CHECK_XML2
169fi
170
8b7150e4
VB
171# JSON
172AC_ARG_WITH([json],
173 AC_HELP_STRING(
174 [--with-json],
175 [Enable JSON output via Jansson @<:@default=no@:>@]
176 ))
177if test x"$with_json" = x"yes"; then
178 lldp_CHECK_JANSSON
179fi
180
c3f85560 181# OS X launchd support
4dfe31fd
VB
182lldp_ARG_WITH([launchddaemonsdir], [Directory for launchd configuration file (OSX)],
183 [/Library/LaunchDaemons])
184AC_SUBST([launchddaemonsdir], [$with_launchddaemonsdir])
185AM_CONDITIONAL(HAVE_LAUNCHDDAEMONSDIR,
186 [test -n "$with_launchddaemonsdir" -a "x$with_launchddaemonsdir" != xno ])
9d1524b7
VB
187
188# Systemd
189lldp_ARG_WITH([systemdsystemunitdir], [Directory for systemd service files],
4dfe31fd
VB
190 [$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
191AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
192AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR,
193 [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
c3f85560 194
bdfe4193
VB
195# Systemtap/DTrace
196lldp_SYSTEMTAP
197
d38eae28
VB
198# Privsep settings
199lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
200lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
201lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
89840df0 202
d38eae28
VB
203# CDP/FDP/EDP/SONMP
204lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
205lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
206lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
207lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
a1347cd8 208
d38eae28
VB
209# LLDPMED/Dot1/Dot3
210lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
211lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
212lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
a1347cd8 213
184bd199 214# Oldies
fda729fd 215lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
184bd199 216
d38eae28
VB
217#######################
218# Output results
219AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
220AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
1480ce74 221AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
8b7150e4 222AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
43c02e7b 223AC_OUTPUT
d38eae28 224
4c1a8c61 225if test x"$LIBEVENT_EMBEDDED" = x; then
e5c94652
VB
226 libevent=system
227else
228 libevent=embedded
229fi
230
d38eae28
VB
231cat <<EOF
232
233------------------ Summary ------------------
234 $PACKAGE_NAME version $PACKAGE_VERSION
91e0280a 235 OS.............: $os
d38eae28
VB
236 Prefix.........: $prefix
237 C Compiler.....: $CC $CFLAGS $CPPFLAGS
238 Linker.........: $LD $LDFLAGS $LIBS
e5c94652 239 Libevent.......: $libevent
35f6f4fb 240 Readline.......: ${ax_cv_lib_readline}
d38eae28
VB
241 Optional features:
242 SNMP support...: ${with_snmp-no}
243 CDP............: $enable_cdp
244 FDP............: $enable_fdp
245 EDP............: $enable_edp
246 SONMP..........: $enable_sonmp
247 LLDPMED........: $enable_lldpmed
248 DOT1...........: $enable_dot1
249 DOT3...........: $enable_dot3
1480ce74 250 XML output.....: ${with_xml-no}
8b7150e4 251 JSON output....: ${with_json-no}
184bd199 252 Oldies support.: $enable_oldies
d38eae28
VB
253---------------------------------------------
254
255Check the above options and compile with:
256 ${MAKE-make}
257
258EOF