]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
lldpctl: new JSON output
[thirdparty/lldpd.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 #######################
5 ### Base configuration
6
7 # Configure autoconf
8 AC_PREREQ([2.64])
9
10 dnl Use something like this if you need to patch autoconf files and
11 dnl regenerate configure outside upstream git tree:
12 dnl AC_INIT([lldpd], [0.5.7], [bernat@luffy.cx])
13 AC_INIT([lldpd],
14 [m4_esyscmd_s([git describe --tags --always 2> /dev/null || date +%F])],
15 [bernat@luffy.cx])
16
17 AC_CONFIG_SRCDIR([src/log.c])
18 AC_CONFIG_HEADER([config.h])
19 AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
20 src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
21 tests/Makefile])
22 AC_CONFIG_MACRO_DIR([m4])
23
24 # Configure automake
25 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
26 AM_MAINTAINER_MODE
27 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
28
29 # Configure libtool
30 #LT_PREREQ([2.2])
31 LT_INIT
32
33 #######################
34 ### Checks
35
36 # Checks for programs.
37 AC_PROG_CC
38 AC_PROG_CC_C99
39 AC_PROG_CXX
40 AM_PROG_CC_C_O
41 AC_PROG_LIBTOOL
42
43 # Doxygen
44 DX_HTML_FEATURE(ON)
45 DX_DOT_FEATURE(OFF)
46 DX_CHM_FEATURE(OFF)
47 DX_CHI_FEATURE(OFF)
48 DX_MAN_FEATURE(OFF)
49 DX_RTF_FEATURE(OFF)
50 DX_XML_FEATURE(OFF)
51 DX_PDF_FEATURE(ON)
52 DX_PS_FEATURE(OFF)
53 DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
54
55 # Check some compiler flags
56 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
57 AX_CFLAGS_GCC_OPTION([-pipe])
58 AX_CFLAGS_GCC_OPTION([-Wall])
59 AX_CFLAGS_GCC_OPTION([-W])
60 AX_CFLAGS_GCC_OPTION([-Wextra])
61 AX_CFLAGS_GCC_OPTION([-Wformat])
62 AX_CFLAGS_GCC_OPTION([-Wformat-security])
63 AX_CFLAGS_GCC_OPTION([-Wcast-align])
64 AX_CFLAGS_GCC_OPTION([-Winline])
65 AX_CFLAGS_GCC_OPTION([-fstack-protector])
66 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
67 AX_CFLAGS_GCC_OPTION([-Wdeclaration-after-statement])
68 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
69 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
70 AX_LDFLAGS_OPTION([-Wl,-z,relro])
71 AX_LDFLAGS_OPTION([-Wl,-z,now])
72
73 AC_CACHE_SAVE
74
75 # Checks for header files.
76 AC_HEADER_RESOLV
77 AC_CHECK_HEADERS([valgrind/valgrind.h])
78
79 # Check for sys/queue.h completeness, missing bits will be in compat.h
80 AC_CHECK_DECLS([
81 TAILQ_FIRST,
82 TAILQ_NEXT,
83 TAILQ_FOREACH,
84 TAILQ_EMPTY],[],[],[[@%:@include <sys/queue.h>]])
85
86 # On some systems, some ioctl are not declared
87 AC_CHECK_DECLS([
88 SIOCGIFVLAN,
89 SIOCBONDINFOQUERY,
90 SIOCBONDSLAVEINFOQUERY],[],[],[[@%:@include <linux/sockios.h>]])
91 AC_CHECK_MEMBERS([ifslave.slave_name, ifbond.num_slaves], [],
92 [AC_MSG_ERROR([linux/if_bonding.h is incomplete. See README file.])],
93 [
94 @%:@include <arpa/inet.h>
95 @%:@include <linux/if.h>
96 @%:@include <linux/if_bonding.h>
97 ])
98
99 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
100 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
101
102 # Check for ethtool stuff
103 lldp_CHECK_HEADER_ETHTOOL
104 AC_CHECK_DECLS([
105 ADVERTISED_2500baseX_Full,
106 ADVERTISED_Pause,
107 ADVERTISED_Asym_Pause,
108 ADVERTISED_10000baseT_Full,
109 SPEED_10000],[],[],[[@%:@include <linux/ethtool.h>]])
110
111 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
112 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
113
114 # Check some stuff in linux/if_vlan.h
115 AC_CHECK_HEADERS([ \
116 linux/if_vlan.h \
117 ],,AC_MSG_ERROR([You should get linux/if_vlan.h from some other place. See README file.]),[
118 @%:@include <arpa/inet.h>
119 @%:@include <linux/if.h>
120 ])
121 AC_CHECK_DECLS([GET_VLAN_REALDEV_NAME_CMD,GET_VLAN_VID_CMD],[],[],
122 [[@%:@include <linux/if_vlan.h>]])
123
124 AC_CACHE_SAVE
125
126 # Checks for typedefs, structures, and compiler characteristics.
127 lldp_CHECK___PROGNAME
128
129 # Checks for library functions.
130 AC_CONFIG_LIBOBJ_DIR([src/compat])
131 AC_FUNC_MALLOC
132 AC_FUNC_REALLOC
133 AC_REPLACE_FUNCS([strlcpy])
134 AC_REPLACE_FUNCS([getifaddrs])
135 AC_CACHE_SAVE
136
137 ## Unit tests wich check
138 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
139
140 # Libevent
141 lldp_CHECK_LIBEVENT
142
143 #######################
144 ### Options
145
146 # SNMP
147 AC_ARG_WITH([snmp],
148 AS_HELP_STRING(
149 [--with-snmp],
150 [Enable the use of SNMP @<:@default=no@:>@]
151 ))
152 if test x"$with_snmp" = x"yes"; then
153 lldp_CHECK_SNMP
154 fi
155
156 # XML
157 AC_ARG_WITH([xml],
158 AC_HELP_STRING(
159 [--with-xml],
160 [Enable XML output via libxml2 @<:@default=no@:>@]
161 ))
162 if test x"$with_xml" = x"yes"; then
163 lldp_CHECK_XML2
164 fi
165
166 # JSON
167 AC_ARG_WITH([json],
168 AC_HELP_STRING(
169 [--with-json],
170 [Enable JSON output via Jansson @<:@default=no@:>@]
171 ))
172 if test x"$with_json" = x"yes"; then
173 lldp_CHECK_JANSSON
174 fi
175
176 # Privsep settings
177 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
178 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
179 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
180
181 # CDP/FDP/EDP/SONMP
182 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
183 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
184 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
185 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
186
187 # LLDPMED/Dot1/Dot3
188 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
189 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
190 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
191
192 #######################
193 # Output results
194 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
195 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
196 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
197 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
198 AC_OUTPUT
199
200 if test x"$LIBEVENT_LDFLAGS" = x; then
201 libevent=system
202 else
203 libevent=embedded
204 fi
205
206 cat <<EOF
207
208 ------------------ Summary ------------------
209 $PACKAGE_NAME version $PACKAGE_VERSION
210 Prefix.........: $prefix
211 C Compiler.....: $CC $CFLAGS $CPPFLAGS
212 Linker.........: $LD $LDFLAGS $LIBS
213 Libevent.......: $libevent
214 Optional features:
215 SNMP support...: ${with_snmp-no}
216 CDP............: $enable_cdp
217 FDP............: $enable_fdp
218 EDP............: $enable_edp
219 SONMP..........: $enable_sonmp
220 LLDPMED........: $enable_lldpmed
221 DOT1...........: $enable_dot1
222 DOT3...........: $enable_dot3
223 XML output.....: ${with_xml-no}
224 JSON output....: ${with_json-no}
225 ---------------------------------------------
226
227 Check the above options and compile with:
228 ${MAKE-make}
229
230 EOF