]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
Add support for libc not defining __progname symbol.
[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 # 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 \
54 linux/sockios.h \
55 linux/filter.h \
56 net/if.h \
57 ],,AC_MSG_ERROR([Required header missing.]))
58 AC_CHECK_HEADERS([ \
59 linux/wireless.h \
60 linux/if_bonding.h \
61 linux/if_vlan.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
69
70 # Check for sys/queue.h completeness, missing bits will be in compat.h
71 AC_CHECK_DECLS([ \
72 TAILQ_FIRST, \
73 TAILQ_NEXT, \
74 TAILQ_FOREACH, \
75 TAILQ_EMPTY, \
76 SLIST_HEAD, \
77 SLIST_ENTRY, \
78 SLIST_INIT, \
79 SLIST_INSERT_HEAD, \
80 SLIST_FIRST, \
81 SLIST_NEXT, \
82 SLIST_REMOVE_HEAD, \
83 SLIST_EMPTY \
84 ],[],[],[[@%:@include <sys/queue.h>]])
85
86 # Do we have PACKET_ORIGDEV (it can be present at runtime, put it in compat.h)
87 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[@%:@include <linux/if_packet.h>]])
88
89 # Check for ethtool stuff
90 lldp_CHECK_HEADER_ETHTOOL
91 AC_CHECK_DECLS([ \
92 ADVERTISED_2500baseX_Full, \
93 ADVERTISED_Pause, \
94 ADVERTISED_Asym_Pause, \
95 ADVERTISED_10000baseT_Full, \
96 SPEED_10000 \
97 ],[],[],[[@%:@include <linux/ethtool.h>]])
98
99 # Check for ETHERTYPE_VLAN, put it in compat.h if not defined
100 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[@%:@include <net/ethernet.h>]])
101
102 # Check some stuff in linux/if_vlan.h
103 AC_CHECK_DECLS([ \
104 GET_VLAN_REALDEV_NAME_CMD, \
105 GET_VLAN_VID_CMD \
106 ],[],[],[[@%:@include <linux/if_vlan.h>]])
107
108 # Checks for typedefs, structures, and compiler characteristics.
109 AC_TYPE_UID_T
110 AC_C_INLINE
111 AC_TYPE_INT16_T
112 AC_TYPE_INT32_T
113 AC_TYPE_PID_T
114 AC_TYPE_SIZE_T
115 AC_TYPE_SSIZE_T
116 AC_TYPE_UINT16_T
117 AC_TYPE_UINT32_T
118 AC_TYPE_UINT8_T
119 lldp_CHECK___PROGNAME
120
121 # Checks for library functions.
122 AC_FUNC_CHOWN
123 AC_FUNC_FORK
124 AC_FUNC_MALLOC
125 AC_FUNC_REALLOC
126 AC_CHECK_FUNCS([ \
127 atexit \
128 gethostbyname \
129 inet_ntoa memset \
130 regcomp \
131 select \
132 setenv \
133 socket \
134 strchr \
135 strdup \
136 strerror \
137 strndup \
138 tzset \
139 uname \
140 ],,[AC_MSG_ERROR(Required function not found.)])
141
142 AC_REPLACE_FUNCS([strlcpy])
143 AC_REPLACE_FUNCS([getifaddrs])
144
145 ## Unit tests wich check
146 PKG_CHECK_MODULES([CHECK], [check >= 0.9.4], [have_check=yes], [have_check=no])
147
148 #######################
149 ### Options
150
151 # SNMP
152 AC_ARG_WITH([snmp],
153 AS_HELP_STRING(
154 [--with-snmp],
155 [Enable the use of SNMP @<:@default=no@:>@]
156 ))
157 if test x"$with_snmp" = x"yes"; then
158 lldp_CHECK_SNMP
159 fi
160
161 # Privsep settings
162 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
163 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
164 lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
165
166 # CDP/FDP/EDP/SONMP
167 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
168 lldp_ARG_ENABLE([fdp], [Foundry Discovery Protocol], [yes])
169 lldp_ARG_ENABLE([edp], [Extreme Discovery Protocol], [yes])
170 lldp_ARG_ENABLE([sonmp], [SynOptics Network Management Protocol], [yes])
171
172 # LLDPMED/Dot1/Dot3
173 lldp_ARG_ENABLE([lldpmed], [LLDP-MED extension], [yes])
174 lldp_ARG_ENABLE([dot1], [Dot1 extension (VLAN stuff)], [yes])
175 lldp_ARG_ENABLE([dot3], [Dot3 extension (PHY stuff)], [yes])
176
177 #Listen on vlan
178 lldp_ARG_ENABLE([listenvlan], [listen on any VLAN], [no])
179
180 #######################
181 # Output results
182 AM_CONDITIONAL([HAVE_CHECK], [test x"$have_check" = x"yes"])
183 AM_CONDITIONAL([USE_SNMP], [test x"$with_snmp" = x"yes"])
184 AC_OUTPUT
185
186 cat <<EOF
187
188 ------------------ Summary ------------------
189 $PACKAGE_NAME version $PACKAGE_VERSION
190 Prefix.........: $prefix
191 C Compiler.....: $CC $CFLAGS $CPPFLAGS
192 Linker.........: $LD $LDFLAGS $LIBS
193 Optional features:
194 SNMP support...: ${with_snmp-no}
195 CDP............: $enable_cdp
196 FDP............: $enable_fdp
197 EDP............: $enable_edp
198 SONMP..........: $enable_sonmp
199 LLDPMED........: $enable_lldpmed
200 DOT1...........: $enable_dot1
201 DOT3...........: $enable_dot3
202 Listen on VLAN.: $enable_listenvlan
203 ---------------------------------------------
204
205 Check the above options and compile with:
206 ${MAKE-make}
207
208 EOF