]> git.ipfire.org Git - thirdparty/lldpd.git/blame - configure.ac
Allow to compile only needed protocols
[thirdparty/lldpd.git] / configure.ac
CommitLineData
43c02e7b
VB
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.61)
ff1910c8 5AC_INIT(lldpd, 0.2.1, bernat@luffy.cx)
43c02e7b
VB
6AM_INIT_AUTOMAKE([foreign])
7AC_CONFIG_SRCDIR([src/lldpd.c])
8AC_CONFIG_HEADER([config.h])
9AC_CONFIG_FILES([Makefile src/Makefile man/Makefile])
10
11# Checks for programs.
12AC_PROG_CC
13
4bad1937
VB
14# Options
15AC_ARG_ENABLE(cdp, AC_HELP_STRING([--enable-cdp],
16 [Enable Cisco Discovery Protocol]),
17 [enable_cdp=$enableval],[enable_cdp=yes])
18AC_MSG_CHECKING(whether to enable CDP)
19if test x$enable_cdp = xyes; then
20 AC_MSG_RESULT(yes)
21 AC_DEFINE([ENABLE_CDP],, [Enable Cisco Discovery Protocol])
22else
23 AC_MSG_RESULT(no)
24fi
25
26AC_ARG_ENABLE(fdp, AC_HELP_STRING([--enable-fdp],
27 [Enable Foundry Discovery Protocol]),
28 [enable_fdp=$enableval],[enable_fdp=yes])
29AC_MSG_CHECKING(whether to enable FDP)
30if test x$enable_fdp = xyes; then
31 AC_MSG_RESULT(yes)
32 AC_DEFINE([ENABLE_FDP],, [Enable Foundry Discovery Protocol])
33else
34 AC_MSG_RESULT(no)
35fi
36
37AC_ARG_ENABLE(edp, AC_HELP_STRING([--enable-edp],
38 [Enable Extreme Discovery Protocol]),
39 [enable_edp=$enableval],[enable_edp=yes])
40AC_MSG_CHECKING(whether to enable EDP)
41if test x$enable_edp = xyes; then
42 AC_MSG_RESULT(yes)
43 AC_DEFINE([ENABLE_EDP],, [Enable Extreme Discovery Protocol])
44else
45 AC_MSG_RESULT(no)
46fi
47
48AC_ARG_ENABLE(sonmp, AC_HELP_STRING([--enable-sonmp],
49 [Enable SynOptics Network Management Protocol]),
50 [enable_sonmp=$enableval],[enable_sonmp=yes])
51AC_MSG_CHECKING(whether to enable SONMP)
52if test x$enable_sonmp = xyes; then
53 AC_MSG_RESULT(yes)
54 AC_DEFINE([ENABLE_SONMP],, [Enable SynOptics Network Management Protocol])
55else
56 AC_MSG_RESULT(no)
57fi
58
43c02e7b
VB
59# Checks for libraries.
60AC_ARG_WITH(snmp,
61 AC_HELP_STRING(
62 [--with-snmp],
63 [Enable the use of SNMP]
64 ),
65 [],
66 [with_snmp=no]
67)
68AM_CONDITIONAL([USE_SNMP], [test "${with_snmp}" != "no"])
69
b5562b23
VB
70AC_ARG_WITH(privsep-user,
71 AC_HELP_STRING([--with-privsep-user],
72 [Which user to use for privilege separation]),
73 AC_DEFINE_UNQUOTED([PRIVSEP_USER], "$withval", [User for privilege separation]),
6629befa 74 AC_DEFINE_UNQUOTED([PRIVSEP_USER], "_lldpd", [User for privilege separation]))
b5562b23
VB
75AC_ARG_WITH(privsep-group,
76 AC_HELP_STRING([--with-privsep-group],
77 [Which group to use for privilege separation]),
78 AC_DEFINE_UNQUOTED([PRIVSEP_GROUP], "$withval", [Group for privilege separation]),
6629befa 79 AC_DEFINE_UNQUOTED([PRIVSEP_GROUP], "_lldpd", [Group for privilege separation]))
b5562b23
VB
80AC_ARG_WITH(privsep-chroot,
81 AC_HELP_STRING([--with-privsep-chroot],
82 [Which directory to use to chroot lldpd]),
83 AC_DEFINE_UNQUOTED([PRIVSEP_CHROOT], "$withval", [Chroot directory]),
84 AC_DEFINE_UNQUOTED([PRIVSEP_CHROOT], "/var/run/lldpd", [Chroot directory]))
85
43c02e7b
VB
86# Checks for header files.
87AC_CHECK_DECLS([TAILQ_FIRST, TAILQ_NEXT, TAILQ_FOREACH, TAILQ_EMPTY],[],[],[[#include <sys/queue.h>]])
4de7bd54 88AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[#include <linux/if_packet.h>]])
9aee81ae
VB
89AC_CHECK_DECLS([ADVERTISED_2500baseX_Full, ADVERTISED_Pause, ADVERTISED_Asym_Pause],
90 [],[],[[#include <linux/ethtool.h>]])
4de7bd54 91AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[#include <net/ethernet.h>]])
43c02e7b
VB
92
93# Checks for typedefs, structures, and compiler characteristics.
94AC_C_CONST
95AC_CHECK_TYPES([int16_t, u_int16_t, int8_t, u_int8_t, int32_t, u_int32_t],[],[AC_MSG_ERROR([mandatory type not found])])
9dfa196f
VB
96AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,
97 [
98#include <net-snmp/net-snmp-config.h>
99#include <net-snmp/net-snmp-includes.h>
100#include <net-snmp/library/snmp_transport.h>
101])
43c02e7b
VB
102
103# Checks for library functions.
104AC_REPLACE_FUNCS([strlcpy])
105
106AC_PROG_GCC_TRADITIONAL
107
108## NetSNMP
109NETSNMP_CONFIG=No
110if test "${with_snmp}" != "no"; then
111 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
112fi
113if test x"${NETSNMP_CONFIG}" != xNo; then
114 NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
115
116 AC_CHECK_LIB([netsnmp], [snmp_register_callback],
117 AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1, [Define to indicate the Net-SNMP library])
118 AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support]),
119 [], ${NETSNMP_libs})
120
121 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
122 AC_SUBST([NETSNMP_LIB],"${NETSNMP_libs}")
123 fi
124fi
125if test "${with_snmp}" != "no"; then
126 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" != "yes"; then
127 AC_MSG_NOTICE([***])
128 AC_MSG_NOTICE([*** net-snmp libraries not found])
129 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
130 AC_MSG_NOTICE([*** including --without-snmp])
131 exit 1
132 fi
133fi
134
135AC_OUTPUT