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