]> git.ipfire.org Git - thirdparty/lldpd.git/blob - configure.ac
Start privilege separation
[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.1, 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_DECL([PACKET_ORIGDEV],[],[],[[#include <linux/if_packet.h>]])
44 AC_CHECK_DECL([ADVERTISED_2500baseX_Full],[],[],[[#include <linux/ethtool.h>]])
45
46 # Checks for typedefs, structures, and compiler characteristics.
47 AC_C_CONST
48 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])])
49
50 # Checks for library functions.
51 AC_REPLACE_FUNCS([strlcpy])
52
53 AC_PROG_GCC_TRADITIONAL
54
55 ## NetSNMP
56 NETSNMP_CONFIG=No
57 if test "${with_snmp}" != "no"; then
58 AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], No)
59 fi
60 if test x"${NETSNMP_CONFIG}" != xNo; then
61 NETSNMP_libs=`${NETSNMP_CONFIG} --agent-libs`
62
63 AC_CHECK_LIB([netsnmp], [snmp_register_callback],
64 AC_DEFINE_UNQUOTED([HAVE_NETSNMP], 1, [Define to indicate the Net-SNMP library])
65 AC_DEFINE_UNQUOTED([USE_SNMP], 1, [Define to indicate to enable SNMP support]),
66 [], ${NETSNMP_libs})
67
68 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" = "yes"; then
69 AC_SUBST([NETSNMP_LIB],"${NETSNMP_libs}")
70 fi
71 fi
72 if test "${with_snmp}" != "no"; then
73 if test "${ac_cv_lib_netsnmp_snmp_register_callback}" != "yes"; then
74 AC_MSG_NOTICE([***])
75 AC_MSG_NOTICE([*** net-snmp libraries not found])
76 AC_MSG_NOTICE([*** Either correct the installation, or run configure])
77 AC_MSG_NOTICE([*** including --without-snmp])
78 exit 1
79 fi
80 fi
81
82 AC_OUTPUT