]> git.ipfire.org Git - thirdparty/lldpd.git/blame - configure.ac
linux/filter.h may need linux/types on old systems.
[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])
9AC_INIT([lldpd], [0.5.0], [bernat@luffy.cx])
43c02e7b
VB
10AC_CONFIG_SRCDIR([src/lldpd.c])
11AC_CONFIG_HEADER([config.h])
2acc1418
VB
12AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile])
13AC_CONFIG_MACRO_DIR([m4])
43c02e7b 14
d38eae28
VB
15# Configure automake
16AM_INIT_AUTOMAKE([foreign -Wall -Werror])
17AM_SILENT_RULES([yes])
18
19# Configure libtool
20LT_PREREQ([2.2])
21LT_INIT
22
23#######################
24### Checks
25
43c02e7b 26# Checks for programs.
d38eae28 27AC_PROG_AWK
43c02e7b 28AC_PROG_CC
d38eae28
VB
29AC_PROG_CPP
30AC_PROG_INSTALL
31AC_PROG_LN_S
32AC_PROG_MAKE_SET
33AC_PROG_CXX
34AC_PROG_RANLIB
35AM_PROG_CC_C_O
2acc1418 36
d38eae28
VB
37# Checks for header files.
38AC_HEADER_RESOLV
39AC_CHECK_HEADERS([ \
40 arpa/inet.h \
41 fcntl.h \
42 malloc.h \
43 netdb.h \
44 netinet/in.h \
45 stdlib.h \
46 string.h \
47 sys/ioctl.h \
48 sys/param.h \
49 sys/socket.h \
50 sys/time.h \
51 sys/queue.h \
52 syslog.h \
53 unistd.h \
d38eae28 54 net/if.h \
b56625e6 55 linux/sockios.h \
d38eae28
VB
56],,AC_MSG_ERROR([Required header missing.]))
57AC_CHECK_HEADERS([ \
58 linux/wireless.h \
59 linux/if_bonding.h \
60 linux/if_vlan.h \
61 linux/if_bridge.h \
62 linux/if_packet.h \
63],,AC_MSG_ERROR([Required header missing.]),[
64@%:@include <arpa/inet.h>
65@%:@include <linux/if.h>
66])
b56625e6
VB
67AC_CHECK_HEADERS([ \
68 linux/filter.h \
69],,AC_MSG_ERROR([Required header missing.]),[
70@%:@include <linux/types.h>
71])
43c02e7b 72
b5562b23 73
d38eae28
VB
74# Check for sys/queue.h completeness, missing bits will be in compat.h
75AC_CHECK_DECLS([ \
76TAILQ_FIRST, \
77TAILQ_NEXT, \
78TAILQ_FOREACH, \
79TAILQ_EMPTY, \
80SLIST_HEAD, \
81SLIST_ENTRY, \
82SLIST_INIT, \
83SLIST_INSERT_HEAD, \
84SLIST_FIRST, \
85SLIST_NEXT, \
86SLIST_REMOVE_HEAD, \
87SLIST_EMPTY \
88],[],[],[[@%:@include <sys/queue.h>]])
89
90# Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
91AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
92
93# Check for ethtool stuff
94lldp_CHECK_HEADER_ETHTOOL
95AC_CHECK_DECLS([ \
96ADVERTISED_2500baseX_Full, \
97ADVERTISED_Pause, \
98ADVERTISED_Asym_Pause, \
99ADVERTISED_10000baseT_Full, \
100SPEED_10000 \
101],[],[],[[@%:@include <linux/ethtool.h>]])
102
103# Check for ETHERTYPE_VLAN, put it in compat.h if not defined
104AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
105
106# Check some stuff in linux/if_vlan.h
107AC_CHECK_DECLS([ \
108GET_VLAN_REALDEV_NAME_CMD, \
109GET_VLAN_VID_CMD \
110],[],[],[[@%:@include <linux/if_vlan.h>]])
43c02e7b
VB
111
112# Checks for typedefs, structures, and compiler characteristics.
d38eae28
VB
113AC_TYPE_UID_T
114AC_C_INLINE
115AC_TYPE_INT16_T
116AC_TYPE_INT32_T
117AC_TYPE_PID_T
118AC_TYPE_SIZE_T
119AC_TYPE_SSIZE_T
120AC_TYPE_UINT16_T
121AC_TYPE_UINT32_T
122AC_TYPE_UINT8_T
6bb9c4e0 123lldp_CHECK___PROGNAME
43c02e7b
VB
124
125# Checks for library functions.
d38eae28
VB
126AC_FUNC_CHOWN
127AC_FUNC_FORK
128AC_FUNC_MALLOC
129AC_FUNC_REALLOC
130AC_CHECK_FUNCS([ \
131 atexit \
132 gethostbyname \
133 inet_ntoa memset \
134 regcomp \
135 select \
136 setenv \
137 socket \
138 strchr \
139 strdup \
140 strerror \
141 strndup \
142 tzset \
143 uname \
144],,[AC_MSG_ERROR(Required function not found.)])
145
43c02e7b 146AC_REPLACE_FUNCS([strlcpy])
b7997528 147AC_REPLACE_FUNCS([getifaddrs])
43c02e7b 148
d38eae28
VB
149## Unit tests wich check
150PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
43c02e7b 151
d38eae28
VB
152#######################
153### Options
43c02e7b 154
d38eae28
VB
155# SNMP
156AC_ARG_WITH([snmp],
157 AS_HELP_STRING(
158 [--with-snmp],
159 [Enable the use of SNMP @<:@default=no@:>@]
160 ))
161if test x"$with_snmp" = x"yes"; then
162 lldp_CHECK_SNMP
315587ef
VB
163fi
164
d38eae28
VB
165# Privsep settings
166lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
167lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
168lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
89840df0 169
d38eae28
VB
170# CDP/FDP/EDP/SONMP
171lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
172lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
173lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
174lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
a1347cd8 175
d38eae28
VB
176# LLDPMED/Dot1/Dot3
177lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
178lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
179lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
a1347cd8 180
993a6e50 181#Listen on vlan
d38eae28 182lldp_ARG_ENABLE([listenvlan], [listen on any VLAN], [no])
993a6e50 183
d38eae28
VB
184#######################
185# Output results
186AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
187AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
43c02e7b 188AC_OUTPUT
d38eae28
VB
189
190cat <<EOF
191
192------------------ Summary ------------------
193 $PACKAGE_NAME version $PACKAGE_VERSION
194 Prefix.........: $prefix
195 C Compiler.....: $CC $CFLAGS $CPPFLAGS
196 Linker.........: $LD $LDFLAGS $LIBS
197 Optional features:
198 SNMP support...: ${with_snmp-no}
199 CDP............: $enable_cdp
200 FDP............: $enable_fdp
201 EDP............: $enable_edp
202 SONMP..........: $enable_sonmp
203 LLDPMED........: $enable_lldpmed
204 DOT1...........: $enable_dot1
205 DOT3...........: $enable_dot3
206 Listen on VLAN.: $enable_listenvlan
207---------------------------------------------
208
209Check the above options and compile with:
210 ${MAKE-make}
211
212EOF