]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
Fix lldpctl when LLDP-MED is enabled.
[thirdparty/lldpd.git] / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.61)
5 AC_INIT(lldpd, 0.3.2, bernat@luffy.cx)
6 AM_INIT_AUTOMAKE([foreign])
7 AC_CONFIG_SRCDIR([src/lldpd.c])
8 AC_CONFIG_HEADER([config.h])
9 AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
10
11 # Checks for programs.
12 AC_PROG_CC
13
14 # Checks for libraries.
15 AC_ARG_WITH(snmp,
16 AC_HELP_STRING(
17 [--with-snmp],
18 [Enable the use of SNMP]
19 ),
20 [],
21 [with_snmp=no]
22 )
23 AM_CONDITIONAL([USE_SNMP], [test "${with_snmp}" != "no"])
24
25 AC_ARG_WITH(privsep-user,
26 AC_HELP_STRING([--with-privsep-user],
27 [Which user to use for privilege separation]),
28 AC_DEFINE_UNQUOTED([PRIVSEP_USER], "$withval", [User for privilege separation]),
29 AC_DEFINE_UNQUOTED([PRIVSEP_USER], "_lldpd", [User for privilege separation]))
30 AC_ARG_WITH(privsep-group,
31 AC_HELP_STRING([--with-privsep-group],
32 [Which group to use for privilege separation]),
33 AC_DEFINE_UNQUOTED([PRIVSEP_GROUP], "$withval", [Group for privilege separation]),
34 AC_DEFINE_UNQUOTED([PRIVSEP_GROUP], "_lldpd", [Group for privilege separation]))
35 AC_ARG_WITH(privsep-chroot,
36 AC_HELP_STRING([--with-privsep-chroot],
37 [Which directory to use to chroot lldpd]),
38 AC_DEFINE_UNQUOTED([PRIVSEP_CHROOT], "$withval", [Chroot directory]),
39 AC_DEFINE_UNQUOTED([PRIVSEP_CHROOT], "/var/run/lldpd", [Chroot directory]))
40
41 # Checks for header files.
42 AC_CHECK_DECLS([TAILQ_FIRST, TAILQ_NEXT, TAILQ_FOREACH, TAILQ_EMPTY],[],[],[[#include <sys/queue.h>]])
43 AC_CHECK_DECLS([SLIST_HEAD, SLIST_ENTRY, SLIST_INIT, SLIST_INSERT_HEAD],[],[],[[#include <sys/queue.h>]])
44 AC_CHECK_DECLS([SLIST_FIRST, SLIST_NEXT, SLIST_REMOVE_HEAD, SLIST_EMPTY],[],[],[[#include <sys/queue.h>]])
45 AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[#include <linux/if_packet.h>]])
46 AC_CHECK_DECLS([ADVERTISED_2500baseX_Full, ADVERTISED_Pause, ADVERTISED_Asym_Pause],
47 [],[],[[#include <linux/ethtool.h>]])
48 AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[#include <net/ethernet.h>]])
49
50 # Checks for typedefs, structures, and compiler characteristics.
51 AC_C_CONST
52 AC_CHECK_TYPES([int16_t, u_int16_t, int8_t, u_int8_t, int32_t, u_int32_t],[],[AC_MSG_ERROR([mandatory type not found])])
53 AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,
54 [
55 #include <net-snmp/net-snmp-config.h>
56 #include <net-snmp/net-snmp-includes.h>
57 #include <net-snmp/library/snmp_transport.h>
58 ])
59
60 # Checks for library functions.
61 AC_REPLACE_FUNCS([strlcpy])
62
63 AC_PROG_GCC_TRADITIONAL
64
65 ## NetSNMP
66 NETSNMP_CONFIG=No
67 if test "${with_snmp}" != "no"; then
68 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
69 fi
70 if test x"${NETSNMP_CONFIG}" != xNo; then
71 NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
72
73 AC_CHECK_LIB([netsnmp], [snmp_register_callback],
74 AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1, [Define to indicate the Net-SNMP library])
75 AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support]),
76 [], ${NETSNMP_libs})
77
78 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
79 AC_SUBST([NETSNMP_LIB],"${NETSNMP_libs}")
80 fi
81 fi
82 if test "${with_snmp}" != "no"; then
83 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" != "yes"; then
84 AC_MSG_NOTICE([***])
85 AC_MSG_NOTICE([*** net-snmp libraries not found])
86 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
87 AC_MSG_NOTICE([*** including --without-snmp])
88 exit 1
89 fi
90 fi
91
92 # Options
93 # CDP
94 AC_ARG_ENABLE(cdp, AC_HELP_STRING([--enable-cdp],
95 [Enable Cisco Discovery Protocol]),
96 [enable_cdp=$enableval],[enable_cdp=yes])
97 AC_MSG_CHECKING(whether to enable CDP)
98 if test x$enable_cdp = xyes; then
99 AC_MSG_RESULT(yes)
100 AC_DEFINE([ENABLE_CDP],, [Enable Cisco Discovery Protocol])
101 else
102 AC_MSG_RESULT(no)
103 fi
104
105 # FDP
106 AC_ARG_ENABLE(fdp, AC_HELP_STRING([--enable-fdp],
107 [Enable Foundry Discovery Protocol]),
108 [enable_fdp=$enableval],[enable_fdp=yes])
109 AC_MSG_CHECKING(whether to enable FDP)
110 if test x$enable_fdp = xyes; then
111 AC_MSG_RESULT(yes)
112 AC_DEFINE([ENABLE_FDP],, [Enable Foundry Discovery Protocol])
113 else
114 AC_MSG_RESULT(no)
115 fi
116
117 # EDP
118 AC_ARG_ENABLE(edp, AC_HELP_STRING([--enable-edp],
119 [Enable Extreme Discovery Protocol]),
120 [enable_edp=$enableval],[enable_edp=yes])
121 AC_MSG_CHECKING(whether to enable EDP)
122 if test x$enable_edp = xyes; then
123 AC_MSG_RESULT(yes)
124 AC_DEFINE([ENABLE_EDP],, [Enable Extreme Discovery Protocol])
125 else
126 AC_MSG_RESULT(no)
127 fi
128
129 # SONMP
130 AC_ARG_ENABLE(sonmp, AC_HELP_STRING([--enable-sonmp],
131 [Enable SynOptics Network Management Protocol]),
132 [enable_sonmp=$enableval],[enable_sonmp=yes])
133 AC_MSG_CHECKING(whether to enable SONMP)
134 if test x$enable_sonmp = xyes; then
135 AC_MSG_RESULT(yes)
136 AC_DEFINE([ENABLE_SONMP],, [Enable SynOptics Network Management Protocol])
137 else
138 AC_MSG_RESULT(no)
139 fi
140
141 #LLDPMED
142 AC_ARG_ENABLE(lldpmed, AC_HELP_STRING([--enable-lldpmed],
143 [Enable LLDP-MED extension]),
144 [enable_lldpmed=$enableval],[enable_lldpmed=yes])
145 AC_MSG_CHECKING(whether to enable LLDP-MED)
146 if test x$enable_lldpmed = xyes; then
147 AC_MSG_RESULT(yes)
148 AC_DEFINE([ENABLE_LLDPMED],, [Enable LLDP-MED extension])
149 else
150 AC_MSG_RESULT(no)
151 fi
152
153 #Dot1
154 AC_ARG_ENABLE(dot1, AC_HELP_STRING([--enable-dot1],
155 [Enable LLDP Dot1 extension]),
156 [enable_dot1=$enableval],[enable_dot1=yes])
157 AC_MSG_CHECKING(whether to enable Dot1)
158 if test x$enable_dot1 = xyes; then
159 AC_MSG_RESULT(yes)
160 AC_DEFINE([ENABLE_DOT1],, [Enable LLDP Dot1 extension])
161 else
162 AC_MSG_RESULT(no)
163 fi
164
165 #Dot3
166 AC_ARG_ENABLE(dot3, AC_HELP_STRING([--enable-dot3],
167 [Enable LLDP Dot3 extension]),
168 [enable_dot3=$enableval],[enable_dot3=yes])
169 AC_MSG_CHECKING(whether to enable Dot3)
170 if test x$enable_dot3 = xyes; then
171 AC_MSG_RESULT(yes)
172 AC_DEFINE([ENABLE_DOT3],, [Enable LLDP Dot3 extension])
173 else
174 AC_MSG_RESULT(no)
175 fi
176
177 AC_OUTPUT