]>
Commit | Line | Data |
---|---|---|
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 | |
8 | AC_PREREQ([2.64]) | |
9 | AC_INIT([lldpd], [0.5.0], [bernat@luffy.cx]) | |
43c02e7b VB |
10 | AC_CONFIG_SRCDIR([src/lldpd.c]) |
11 | AC_CONFIG_HEADER([config.h]) | |
2acc1418 VB |
12 | AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile]) |
13 | AC_CONFIG_MACRO_DIR([m4]) | |
43c02e7b | 14 | |
d38eae28 VB |
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 | ||
43c02e7b | 26 | # Checks for programs. |
d38eae28 | 27 | AC_PROG_AWK |
43c02e7b | 28 | AC_PROG_CC |
d38eae28 VB |
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 | |
2acc1418 | 36 | |
d38eae28 VB |
37 | # Checks for header files. |
38 | AC_HEADER_RESOLV | |
39 | AC_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.])) |
57 | AC_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 |
67 | AC_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 |
75 | AC_CHECK_DECLS([ \ | |
76 | TAILQ_FIRST, \ | |
77 | TAILQ_NEXT, \ | |
78 | TAILQ_FOREACH, \ | |
79 | TAILQ_EMPTY, \ | |
80 | SLIST_HEAD, \ | |
81 | SLIST_ENTRY, \ | |
82 | SLIST_INIT, \ | |
83 | SLIST_INSERT_HEAD, \ | |
84 | SLIST_FIRST, \ | |
85 | SLIST_NEXT, \ | |
86 | SLIST_REMOVE_HEAD, \ | |
87 | SLIST_EMPTY \ | |
88 | ],[],[],[[@%:@include <sys/queue.h>]]) | |
89 | ||
90 | # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h) | |
91 | AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]]) | |
92 | ||
93 | # Check for ethtool stuff | |
94 | lldp_CHECK_HEADER_ETHTOOL | |
95 | AC_CHECK_DECLS([ \ | |
96 | ADVERTISED_2500baseX_Full, \ | |
97 | ADVERTISED_Pause, \ | |
98 | ADVERTISED_Asym_Pause, \ | |
99 | ADVERTISED_10000baseT_Full, \ | |
100 | SPEED_10000 \ | |
101 | ],[],[],[[@%:@include <linux/ethtool.h>]]) | |
102 | ||
103 | # Check for ETHERTYPE_VLAN, put it in compat.h if not defined | |
104 | AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]]) | |
105 | ||
106 | # Check some stuff in linux/if_vlan.h | |
107 | AC_CHECK_DECLS([ \ | |
108 | GET_VLAN_REALDEV_NAME_CMD, \ | |
109 | GET_VLAN_VID_CMD \ | |
110 | ],[],[],[[@%:@include <linux/if_vlan.h>]]) | |
43c02e7b VB |
111 | |
112 | # Checks for typedefs, structures, and compiler characteristics. | |
d38eae28 VB |
113 | AC_TYPE_UID_T |
114 | AC_C_INLINE | |
115 | AC_TYPE_INT16_T | |
116 | AC_TYPE_INT32_T | |
117 | AC_TYPE_PID_T | |
118 | AC_TYPE_SIZE_T | |
119 | AC_TYPE_SSIZE_T | |
120 | AC_TYPE_UINT16_T | |
121 | AC_TYPE_UINT32_T | |
122 | AC_TYPE_UINT8_T | |
6bb9c4e0 | 123 | lldp_CHECK___PROGNAME |
43c02e7b VB |
124 | |
125 | # Checks for library functions. | |
d38eae28 VB |
126 | AC_FUNC_CHOWN |
127 | AC_FUNC_FORK | |
128 | AC_FUNC_MALLOC | |
129 | AC_FUNC_REALLOC | |
130 | AC_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 | 146 | AC_REPLACE_FUNCS([strlcpy]) |
b7997528 | 147 | AC_REPLACE_FUNCS([getifaddrs]) |
43c02e7b | 148 | |
d38eae28 VB |
149 | ## Unit tests wich check |
150 | PKG_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 |
156 | AC_ARG_WITH([snmp], | |
157 | AS_HELP_STRING( | |
158 | [--with-snmp], | |
159 | [Enable the use of SNMP @<:@default=no@:>@] | |
160 | )) | |
161 | if test x"$with_snmp" = x"yes"; then | |
162 | lldp_CHECK_SNMP | |
315587ef VB |
163 | fi |
164 | ||
d38eae28 VB |
165 | # Privsep settings |
166 | lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd]) | |
167 | lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd]) | |
168 | lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd]) | |
89840df0 | 169 | |
d38eae28 VB |
170 | # CDP/FDP/EDP/SONMP |
171 | lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes]) | |
172 | lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes]) | |
173 | lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes]) | |
174 | lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes]) | |
a1347cd8 | 175 | |
d38eae28 VB |
176 | # LLDPMED/Dot1/Dot3 |
177 | lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes]) | |
178 | lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes]) | |
179 | lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes]) | |
a1347cd8 | 180 | |
993a6e50 | 181 | #Listen on vlan |
d38eae28 | 182 | lldp_ARG_ENABLE([listenvlan], [listen on any VLAN], [no]) |
993a6e50 | 183 | |
d38eae28 VB |
184 | ####################### |
185 | # Output results | |
186 | AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"]) | |
187 | AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"]) | |
43c02e7b | 188 | AC_OUTPUT |
d38eae28 VB |
189 | |
190 | cat <<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 | ||
209 | Check the above options and compile with: | |
210 | ${MAKE-make} | |
211 | ||
212 | EOF |