summaryrefslogtreecommitdiff
path: root/configure.in
blob: 4e2de985ae3d98aad163593a939d0b16401c8d33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
dnl Process this file with autoconf to produce a configure script.
AC_INIT(rrdbot, 0.9.7, stef@memberwebs.com)
AM_INIT_AUTOMAKE(rrdbot, 0.9.7)

m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])

LDFLAGS="$LDFLAGS -L/usr/local/lib"
CFLAGS="$CFLAGS -I/usr/local/include"

AC_CONFIG_SRCDIR([daemon/rrdbotd.c])
AM_CONFIG_HEADER([config.h])

CFLAGS="$CFLAGS -Wall"

# Debug mode
AC_ARG_ENABLE(debug, 
        AC_HELP_STRING([--enable-debug],
        [Compile binaries in debug mode]))

if test "$enable_debug" = "yes"; then
    CFLAGS="$CFLAGS -g -O0"
    AC_DEFINE_UNQUOTED(_DEBUG, 1, [In debug mode])
    echo "enabling debug compile mode"
fi

dnl Check for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB

# IPV6 enabled
AC_ARG_ENABLE(ipv6,
		AC_HELP_STRING([--disable-ipv6],
		[Disable IPV6 support]))

if test "$enable_ipv6" != "no"; then
	AC_DEFINE_UNQUOTED(HAVE_INET6, 1, [Have IPV6 Support])
	echo "enabling ipv6 support"
fi

# TODO: Figure out why we need this wierd hack
ACX_PTHREAD( , [echo "ERROR: Pthread support not found."; exit 1] )

LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS -D_POSIX_PTHREAD_SEMANTICS"

dnl Checks for libraries
AC_CHECK_LIB(rrd, rrd_update, ,
    [echo "ERROR: librrd not found."; exit 1])
dnl May need these for getaddrinfo
AC_CHECK_LIB(nsl, nis_lookup)
AC_CHECK_LIB(socket, getaddrinfo)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_CHECK_MEMBERS([struct dirent.d_type],,,[#include <dirent.h>])

dnl Check for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([rrd.h], , [echo "ERROR: rrd headers not found"])
AC_CHECK_HEADERS([unistd.h stdio.h stddef.h stdlib.h assert.h errno.h stdarg.h string.h netdb.h ], ,
    [echo "ERROR: Required C header missing"; exit 1])
AC_CHECK_HEADERS([sys/socket.h sys/cdefs.h])

AC_CHECK_FUNCS([daemon strlcat strlcpy strtob strncasecmp strcasestr])
AC_CHECK_FUNCS([strerror getopt getaddrinfo], , 
           [echo "ERROR: Required function missing"; exit 1])

AC_MSG_RESULT()

AC_CONFIG_FILES([Makefile
    mibs/Makefile
    common/Makefile
    daemon/Makefile
    bsnmp/Makefile
    tools/Makefile
    doc/Makefile])
AC_OUTPUT