]> git.ipfire.org Git - thirdparty/lldpd.git/blame - configure.ac
Move at the bottom of configure.ac the instructions to conditionaly
[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
14# Checks for libraries.
15AC_ARG_WITH(snmp,
16 AC_HELP_STRING(
17 [--with-snmp],
18 [Enable the use of SNMP]
19 ),
20 [],
21 [with_snmp=no]
22)
23AM_CONDITIONAL([USE_SNMP], [test "${with_snmp}" != "no"])
24
b5562b23
VB
25AC_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]),
6629befa 29 AC_DEFINE_UNQUOTED([PRIVSEP_USER], "_lldpd", [User for privilege separation]))
b5562b23
VB
30AC_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]),
6629befa 34 AC_DEFINE_UNQUOTED([PRIVSEP_GROUP], "_lldpd", [Group for privilege separation]))
b5562b23
VB
35AC_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
43c02e7b
VB
41# Checks for header files.
42AC_CHECK_DECLS([TAILQ_FIRST, TAILQ_NEXT, TAILQ_FOREACH, TAILQ_EMPTY],[],[],[[#include <sys/queue.h>]])
4de7bd54 43AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[#include <linux/if_packet.h>]])
9aee81ae
VB
44AC_CHECK_DECLS([ADVERTISED_2500baseX_Full, ADVERTISED_Pause, ADVERTISED_Asym_Pause],
45 [],[],[[#include <linux/ethtool.h>]])
4de7bd54 46AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[#include <net/ethernet.h>]])
43c02e7b
VB
47
48# Checks for typedefs, structures, and compiler characteristics.
49AC_C_CONST
50AC_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
51AC_CHECK_MEMBERS([netsnmp_tdomain.f_create_from_tstring_new],,,
52 [
53#include <net-snmp/net-snmp-config.h>
54#include <net-snmp/net-snmp-includes.h>
55#include <net-snmp/library/snmp_transport.h>
56])
43c02e7b
VB
57
58# Checks for library functions.
59AC_REPLACE_FUNCS([strlcpy])
60
61AC_PROG_GCC_TRADITIONAL
62
63## NetSNMP
64NETSNMP_CONFIG=No
65if test "${with_snmp}" != "no"; then
66 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
67fi
68if test x"${NETSNMP_CONFIG}" != xNo; then
69 NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
70
71 AC_CHECK_LIB([netsnmp], [snmp_register_callback],
72 AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1, [Define to indicate the Net-SNMP library])
73 AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support]),
74 [], ${NETSNMP_libs})
75
76 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
77 AC_SUBST([NETSNMP_LIB],"${NETSNMP_libs}")
78 fi
79fi
80if test "${with_snmp}" != "no"; then
81 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" != "yes"; then
82 AC_MSG_NOTICE([***])
83 AC_MSG_NOTICE([*** net-snmp libraries not found])
84 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
85 AC_MSG_NOTICE([*** including --without-snmp])
86 exit 1
87 fi
88fi
89
315587ef
VB
90# Options
91AC_ARG_ENABLE(cdp, AC_HELP_STRING([--enable-cdp],
92 [Enable Cisco Discovery Protocol]),
93 [enable_cdp=$enableval],[enable_cdp=yes])
94AC_MSG_CHECKING(whether to enable CDP)
95if test x$enable_cdp = xyes; then
96 AC_MSG_RESULT(yes)
97 AC_DEFINE([ENABLE_CDP],, [Enable Cisco Discovery Protocol])
98else
99 AC_MSG_RESULT(no)
100fi
101
102AC_ARG_ENABLE(fdp, AC_HELP_STRING([--enable-fdp],
103 [Enable Foundry Discovery Protocol]),
104 [enable_fdp=$enableval],[enable_fdp=yes])
105AC_MSG_CHECKING(whether to enable FDP)
106if test x$enable_fdp = xyes; then
107 AC_MSG_RESULT(yes)
108 AC_DEFINE([ENABLE_FDP],, [Enable Foundry Discovery Protocol])
109else
110 AC_MSG_RESULT(no)
111fi
112
113AC_ARG_ENABLE(edp, AC_HELP_STRING([--enable-edp],
114 [Enable Extreme Discovery Protocol]),
115 [enable_edp=$enableval],[enable_edp=yes])
116AC_MSG_CHECKING(whether to enable EDP)
117if test x$enable_edp = xyes; then
118 AC_MSG_RESULT(yes)
119 AC_DEFINE([ENABLE_EDP],, [Enable Extreme Discovery Protocol])
120else
121 AC_MSG_RESULT(no)
122fi
123
124AC_ARG_ENABLE(sonmp, AC_HELP_STRING([--enable-sonmp],
125 [Enable SynOptics Network Management Protocol]),
126 [enable_sonmp=$enableval],[enable_sonmp=yes])
127AC_MSG_CHECKING(whether to enable SONMP)
128if test x$enable_sonmp = xyes; then
129 AC_MSG_RESULT(yes)
130 AC_DEFINE([ENABLE_SONMP],, [Enable SynOptics Network Management Protocol])
131else
132 AC_MSG_RESULT(no)
133fi
134
43c02e7b 135AC_OUTPUT