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