]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
Add support for FreeBSD.
[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 # OS
74 lldp_CHECK_OS
75
76 AC_CACHE_SAVE
77
78 # Checks for header files.
79 AC_HEADER_RESOLV
80 AC_CHECK_HEADERS([valgrind/valgrind.h])
81
82 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
83 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
84
85 AC_CACHE_SAVE
86
87 # Checks for typedefs, structures, and compiler characteristics.
88 lldp_CHECK___PROGNAME
89
90 # Checks for library functions.
91 AC_CONFIG_LIBOBJ_DIR([src/compat])
92 AC_FUNC_MALLOC
93 AC_FUNC_REALLOC
94 AC_REPLACE_FUNCS([strlcpy])
95 AC_CACHE_SAVE
96
97 ## Unit tests wich check
98 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
99
100 # Libevent
101 lldp_CHECK_LIBEVENT
102
103 #######################
104 ### Options
105
106 # SNMP
107 AC_ARG_WITH([snmp],
108 AS_HELP_STRING(
109 [--with-snmp],
110 [Enable the use of SNMP @<:@default=no@:>@]
111 ))
112 if test x"$with_snmp" = x"yes"; then
113 lldp_CHECK_SNMP
114 fi
115
116 # XML
117 AC_ARG_WITH([xml],
118 AC_HELP_STRING(
119 [--with-xml],
120 [Enable XML output via libxml2 @<:@default=no@:>@]
121 ))
122 if test x"$with_xml" = x"yes"; then
123 lldp_CHECK_XML2
124 fi
125
126 # JSON
127 AC_ARG_WITH([json],
128 AC_HELP_STRING(
129 [--with-json],
130 [Enable JSON output via Jansson @<:@default=no@:>@]
131 ))
132 if test x"$with_json" = x"yes"; then
133 lldp_CHECK_JANSSON
134 fi
135
136 # Privsep settings
137 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
138 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
139 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
140
141 # CDP/FDP/EDP/SONMP
142 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
143 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
144 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
145 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
146
147 # LLDPMED/Dot1/Dot3
148 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
149 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
150 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
151
152 # Oldies
153 lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
154
155 #######################
156 # Output results
157 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
158 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
159 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
160 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
161 AC_OUTPUT
162
163 if test x"$LIBEVENT_LDFLAGS" = x; then
164 libevent=system
165 else
166 libevent=embedded
167 fi
168
169 cat <<EOF
170
171 ------------------ Summary ------------------
172 $PACKAGE_NAME version $PACKAGE_VERSION
173 Prefix.........: $prefix
174 C Compiler.....: $CC $CFLAGS $CPPFLAGS
175 Linker.........: $LD $LDFLAGS $LIBS
176 Libevent.......: $libevent
177 Optional features:
178 SNMP support...: ${with_snmp-no}
179 CDP............: $enable_cdp
180 FDP............: $enable_fdp
181 EDP............: $enable_edp
182 SONMP..........: $enable_sonmp
183 LLDPMED........: $enable_lldpmed
184 DOT1...........: $enable_dot1
185 DOT3...........: $enable_dot3
186 XML output.....: ${with_xml-no}
187 JSON output....: ${with_json-no}
188 Oldies support.: $enable_oldies
189 ---------------------------------------------
190
191 Check the above options and compile with:
192 ${MAKE-make}
193
194 EOF