forked from lldpd/lldpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
243 lines (205 loc) · 6.41 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#######################
### Base configuration
# Configure autoconf
AC_PREREQ([2.64])
AC_INIT([lldpd],
[m4_esyscmd_s([./get-version])],
[bernat@luffy.cx])
AC_CONFIG_SRCDIR([src/log.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
src/lib/Makefile src/lib/lldpctl.pc src/client/Makefile
tests/Makefile])
AC_CONFIG_FILES([osx/Makefile osx/distribution.xml osx/im.bernat.lldpd.plist])
AC_CONFIG_FILES([osx/scripts/preinstall], [chmod +x osx/scripts/preinstall])
AC_CONFIG_FILES([osx/scripts/postinstall], [chmod +x osx/scripts/postinstall])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
# Configure automake
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
# Automake 1.12...
m4_pattern_allow([AM_PROG_AR])
AM_PROG_AR
# Configure libtool
LT_INIT
#######################
### Checks
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_LN_S
AC_PROG_EGREP
# Doxygen
DX_HTML_FEATURE(ON)
DX_DOT_FEATURE(OFF)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(ON)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN([lldpd], [doxygen.cfg], [doxygen])
# Check some compiler flags
AX_CFLAGS_GCC_OPTION([-fdiagnostics-show-option])
AX_CFLAGS_GCC_OPTION([-pipe])
AX_CFLAGS_GCC_OPTION([-Wall])
AX_CFLAGS_GCC_OPTION([-W])
AX_CFLAGS_GCC_OPTION([-Wextra])
AX_CFLAGS_GCC_OPTION([-Wformat])
AX_CFLAGS_GCC_OPTION([-Wformat-security])
AX_CFLAGS_GCC_OPTION([-Wfatal-errors])
AX_CFLAGS_GCC_OPTION([-Wcast-align])
AX_CFLAGS_GCC_OPTION([-Winline])
AX_CFLAGS_GCC_OPTION([-fstack-protector])
AX_CFLAGS_GCC_OPTION([-D_FORTIFY_SOURCE=2])
AX_CFLAGS_GCC_OPTION([-Wno-unused-parameter])
AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers])
AX_CFLAGS_GCC_OPTION([-Wno-sign-compare]) dnl Should be fixed later
AX_LDFLAGS_OPTION([-Wl,-z,relro])
AX_LDFLAGS_OPTION([-Wl,-z,now])
# OS
lldp_CHECK_OS
AC_CACHE_SAVE
# Checks for header files.
AC_HEADER_RESOLV
AC_CHECK_HEADERS([valgrind/valgrind.h])
lldp_CHECK_STDINT
AC_CACHE_SAVE
# Checks for typedefs, structures, and compiler characteristics.
lldp_CHECK___PROGNAME
# Checks for library functions.
AC_CONFIG_LIBOBJ_DIR([src/compat])
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_SEARCH_LIBS([setproctitle], [util bsd])
AC_REPLACE_FUNCS([setproctitle])
AC_CHECK_FUNCS([setproctitle_init])
AC_REPLACE_FUNCS([strlcpy strnlen strndup fgetln])
AC_CHECK_FUNCS([setresuid setresgid])
case " $LIBS " in
*\ -lbsd\ *)
AC_DEFINE(HAVE_LIBBSD, 1, [Define if libbsd is used])
;;
esac
# Check for res_init. On OSX, res_init is a symbol in libsystem_info
# and a macro in resolv.h. We need to ensure we test with resolv.h.
m4_pushdef([AC_LANG_CALL(C)], [
AC_LANG_PROGRAM([$1
@%:@include <resolv.h>], [return $2 ();])])
AC_SEARCH_LIBS([res_init], resolv bind,
AC_DEFINE([HAVE_RES_INIT], 1,
[Define to indicate that res_init() exists]))
m4_popdef([AC_LANG_CALL(C)])
AC_CACHE_SAVE
## Unit tests wich check
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
# Libevent
lldp_CHECK_LIBEVENT
#######################
### Options
# Readline
AC_ARG_WITH([readline],
AS_HELP_STRING(
[--with-readline],
[Enable the use of readline-like library @<:@default=check@:>@]),
[],
[with_readline=check])
if test x"$with_readline" != x"no"; then
AX_LIB_READLINE
if test x"$with_readline" != x"check"; then
if test x"$ax_cv_lib_readline" = x"no"; then
AC_MSG_FAILURE([*** no readline support found])
fi
fi
else
ax_cv_lib_readline="no"
fi
# SNMP
AC_ARG_WITH([snmp],
AS_HELP_STRING(
[--with-snmp],
[Enable the use of SNMP @<:@default=no@:>@]
))
if test x"$with_snmp" = x"yes"; then
lldp_CHECK_SNMP
fi
# XML
AC_ARG_WITH([xml],
AC_HELP_STRING(
[--with-xml],
[Enable XML output via libxml2 @<:@default=no@:>@]
))
if test x"$with_xml" = x"yes"; then
lldp_CHECK_XML2
fi
# JSON
AC_ARG_WITH([json],
AC_HELP_STRING(
[--with-json],
[Enable JSON output via Jansson @<:@default=no@:>@]
))
if test x"$with_json" = x"yes"; then
lldp_CHECK_JANSSON
fi
# OS X launchd support
lldp_ARG_WITH([launchd-daemons-path], [Path to system-wide daemons configuration files (OSX)], [/Library/LaunchDaemons])
# Privsep settings
lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
# CDP/FDP/EDP/SONMP
lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
# LLDPMED/Dot1/Dot3
lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
# Oldies
lldp_ARG_ENABLE([oldies], [compatibility with Linux kernel older than 2.6.18], [no])
#######################
# Output results
AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
AM_CONDITIONAL([USE_XML], [test x"$with_xml" = x"yes"])
AM_CONDITIONAL([USE_JSON], [test x"$with_json" = x"yes"])
AC_OUTPUT
if test x"$LIBEVENT_EMBEDDED" = x; then
libevent=system
else
libevent=embedded
fi
cat <<EOF
------------------ Summary ------------------
$PACKAGE_NAME version $PACKAGE_VERSION
OS.............: $os
Prefix.........: $prefix
C Compiler.....: $CC $CFLAGS $CPPFLAGS
Linker.........: $LD $LDFLAGS $LIBS
Libevent.......: $libevent
Readline.......: ${ax_cv_lib_readline}
Optional features:
SNMP support...: ${with_snmp-no}
CDP............: $enable_cdp
FDP............: $enable_fdp
EDP............: $enable_edp
SONMP..........: $enable_sonmp
LLDPMED........: $enable_lldpmed
DOT1...........: $enable_dot1
DOT3...........: $enable_dot3
XML output.....: ${with_xml-no}
JSON output....: ${with_json-no}
Oldies support.: $enable_oldies
---------------------------------------------
Check the above options and compile with:
${MAKE-make}
EOF