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