]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
lldpcli: switch to GNU Readline.
[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 AC_PROG_LN_S
43
44 # Doxygen
45 DX_HTML_FEATURE(ON)
46 DX_DOT_FEATURE(OFF)
47 DX_CHM_FEATURE(OFF)
48 DX_CHI_FEATURE(OFF)
49 DX_MAN_FEATURE(OFF)
50 DX_RTF_FEATURE(OFF)
51 DX_XML_FEATURE(OFF)
52 DX_PDF_FEATURE(ON)
53 DX_PS_FEATURE(OFF)
54 DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
55
56 # Check some compiler flags
57 AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
58 AX_CFLAGS_GCC_OPTION([-pipe])
59 AX_CFLAGS_GCC_OPTION([-Wall])
60 AX_CFLAGS_GCC_OPTION([-W])
61 AX_CFLAGS_GCC_OPTION([-Wextra])
62 AX_CFLAGS_GCC_OPTION([-Wformat])
63 AX_CFLAGS_GCC_OPTION([-Wformat-security])
64 AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
65 AX_CFLAGS_GCC_OPTION([-Wcast-align])
66 AX_CFLAGS_GCC_OPTION([-Winline])
67 AX_CFLAGS_GCC_OPTION([-fstack-protector])
68 AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
69 AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
70 AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
71 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
72 AX_LDFLAGS_OPTION([-Wl,-z,relro])
73 AX_LDFLAGS_OPTION([-Wl,-z,now])
74
75 # OS
76 lldp_CHECK_OS
77
78 AC_CACHE_SAVE
79
80 # Checks for header files.
81 AC_HEADER_RESOLV
82 AC_CHECK_HEADERS([valgrind/valgrind.h])
83
84 AC_CACHE_SAVE
85
86 # Checks for typedefs, structures, and compiler characteristics.
87 lldp_CHECK___PROGNAME
88
89 # Checks for library functions.
90 AC_CONFIG_LIBOBJ_DIR([src/compat])
91 AC_FUNC_MALLOC
92 AC_FUNC_REALLOC
93 AC_REPLACE_FUNCS([strlcpy])
94 AC_CHECK_FUNCS([setresuid setresgid])
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 # readline (or something similar)
104 AX_LIB_READLINE
105
106 #######################
107 ### Options
108
109 # SNMP
110 AC_ARG_WITH([snmp],
111 AS_HELP_STRING(
112 [--with-snmp],
113 [Enable the use of SNMP @<:@default=no@:>@]
114 ))
115 if test x"$with_snmp" = x"yes"; then
116 lldp_CHECK_SNMP
117 fi
118
119 # XML
120 AC_ARG_WITH([xml],
121 AC_HELP_STRING(
122 [--with-xml],
123 [Enable XML output via libxml2 @<:@default=no@:>@]
124 ))
125 if test x"$with_xml" = x"yes"; then
126 lldp_CHECK_XML2
127 fi
128
129 # JSON
130 AC_ARG_WITH([json],
131 AC_HELP_STRING(
132 [--with-json],
133 [Enable JSON output via Jansson @<:@default=no@:>@]
134 ))
135 if test x"$with_json" = x"yes"; then
136 lldp_CHECK_JANSSON
137 fi
138
139 # Privsep settings
140 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
141 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
142 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
143
144 # CDP/FDP/EDP/SONMP
145 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
146 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
147 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
148 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
149
150 # LLDPMED/Dot1/Dot3
151 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
152 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
153 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
154
155 # Oldies
156 lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
157
158 #######################
159 # Output results
160 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
161 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
162 AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
163 AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
164 AC_OUTPUT
165
166 if test x"$LIBEVENT_LDFLAGS" = x; then
167 libevent=system
168 else
169 libevent=embedded
170 fi
171
172 cat <<EOF
173
174 ------------------ Summary ------------------
175 $PACKAGE_NAME version $PACKAGE_VERSION
176 Prefix.........: $prefix
177 C Compiler.....: $CC $CFLAGS $CPPFLAGS
178 Linker.........: $LD $LDFLAGS $LIBS
179 Libevent.......: $libevent
180 Optional features:
181 SNMP support...: ${with_snmp-no}
182 CDP............: $enable_cdp
183 FDP............: $enable_fdp
184 EDP............: $enable_edp
185 SONMP..........: $enable_sonmp
186 LLDPMED........: $enable_lldpmed
187 DOT1...........: $enable_dot1
188 DOT3...........: $enable_dot3
189 XML output.....: ${with_xml-no}
190 JSON output....: ${with_json-no}
191 Oldies support.: $enable_oldies
192 ---------------------------------------------
193
194 Check the above options and compile with:
195 ${MAKE-make}
196
197 EOF