]>
Commit | Line | Data |
---|---|---|
43c02e7b VB |
1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
4 | AC_PREREQ(2.61) | |
ff1910c8 | 5 | AC_INIT(lldpd, 0.2.1, bernat@luffy.cx) |
43c02e7b VB |
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 | ||
4bad1937 VB |
14 | # Options |
15 | AC_ARG_ENABLE(cdp, AC_HELP_STRING([--enable-cdp], | |
16 | [Enable Cisco Discovery Protocol]), | |
17 | [enable_cdp=$enableval],[enable_cdp=yes]) | |
18 | AC_MSG_CHECKING(whether to enable CDP) | |
19 | if test x$enable_cdp = xyes; then | |
20 | AC_MSG_RESULT(yes) | |
21 | AC_DEFINE([ENABLE_CDP],, [Enable Cisco Discovery Protocol]) | |
22 | else | |
23 | AC_MSG_RESULT(no) | |
24 | fi | |
25 | ||
26 | AC_ARG_ENABLE(fdp, AC_HELP_STRING([--enable-fdp], | |
27 | [Enable Foundry Discovery Protocol]), | |
28 | [enable_fdp=$enableval],[enable_fdp=yes]) | |
29 | AC_MSG_CHECKING(whether to enable FDP) | |
30 | if test x$enable_fdp = xyes; then | |
31 | AC_MSG_RESULT(yes) | |
32 | AC_DEFINE([ENABLE_FDP],, [Enable Foundry Discovery Protocol]) | |
33 | else | |
34 | AC_MSG_RESULT(no) | |
35 | fi | |
36 | ||
37 | AC_ARG_ENABLE(edp, AC_HELP_STRING([--enable-edp], | |
38 | [Enable Extreme Discovery Protocol]), | |
39 | [enable_edp=$enableval],[enable_edp=yes]) | |
40 | AC_MSG_CHECKING(whether to enable EDP) | |
41 | if test x$enable_edp = xyes; then | |
42 | AC_MSG_RESULT(yes) | |
43 | AC_DEFINE([ENABLE_EDP],, [Enable Extreme Discovery Protocol]) | |
44 | else | |
45 | AC_MSG_RESULT(no) | |
46 | fi | |
47 | ||
48 | AC_ARG_ENABLE(sonmp, AC_HELP_STRING([--enable-sonmp], | |
49 | [Enable SynOptics Network Management Protocol]), | |
50 | [enable_sonmp=$enableval],[enable_sonmp=yes]) | |
51 | AC_MSG_CHECKING(whether to enable SONMP) | |
52 | if test x$enable_sonmp = xyes; then | |
53 | AC_MSG_RESULT(yes) | |
54 | AC_DEFINE([ENABLE_SONMP],, [Enable SynOptics Network Management Protocol]) | |
55 | else | |
56 | AC_MSG_RESULT(no) | |
57 | fi | |
58 | ||
43c02e7b VB |
59 | # Checks for libraries. |
60 | AC_ARG_WITH(snmp, | |
61 | AC_HELP_STRING( | |
62 | [--with-snmp], | |
63 | [Enable the use of SNMP] | |
64 | ), | |
65 | [], | |
66 | [with_snmp=no] | |
67 | ) | |
68 | AM_CONDITIONAL([USE_SNMP], [test "${with_snmp}" != "no"]) | |
69 | ||
b5562b23 VB |
70 | AC_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 |
75 | AC_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 |
80 | AC_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. |
87 | AC_CHECK_DECLS([TAILQ_FIRST, TAILQ_NEXT, TAILQ_FOREACH, TAILQ_EMPTY],[],[],[[#include <sys/queue.h>]]) | |
4de7bd54 | 88 | AC_CHECK_DECLS([PACKET_ORIGDEV],[],[],[[#include <linux/if_packet.h>]]) |
9aee81ae VB |
89 | AC_CHECK_DECLS([ADVERTISED_2500baseX_Full, ADVERTISED_Pause, ADVERTISED_Asym_Pause], |
90 | [],[],[[#include <linux/ethtool.h>]]) | |
4de7bd54 | 91 | AC_CHECK_DECLS([ETHERTYPE_VLAN],[],[],[[#include <net/ethernet.h>]]) |
43c02e7b VB |
92 | |
93 | # Checks for typedefs, structures, and compiler characteristics. | |
94 | AC_C_CONST | |
95 | 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])]) | |
9dfa196f VB |
96 | AC_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. | |
104 | AC_REPLACE_FUNCS([strlcpy]) | |
105 | ||
106 | AC_PROG_GCC_TRADITIONAL | |
107 | ||
108 | ## NetSNMP | |
109 | NETSNMP_CONFIG=No | |
110 | if test "${with_snmp}" != "no"; then | |
111 | AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No) | |
112 | fi | |
113 | if 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 | |
124 | fi | |
125 | if 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 | |
133 | fi | |
134 | ||
135 | AC_OUTPUT |