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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
# Process this file with autoconf to produce a configure script.
AC_INIT
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR([bandwidthd.c])
AC_CONFIG_HEADER([config.h])
MAJOR_VERSION=2
MINOR_VERSION=0
RELEASE_VERSION=1
EXTRA_VERSION="+cvs20050208"
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
# Checks for programs.
AC_PROG_YACC
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LEX
# May be required for libgd on bsd
AC_PATH_X
if test -n "$x_libraries" && test "x$x_libraries" != xNONE ; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
# May be equired for BSD
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
#Check for Darwin sw directory
AC_CHECK_FILE(/sw/lib, LDFLAGS="$LDFLAGS -L/sw/lib")
AC_CHECK_FILE(/sw/include, CPPFLAGS="$CPPFLAGS -I/sw/include")
#Check for NetBSD usr/pkg directory
AC_CHECK_FILE(/usr/pkg/lib, LDFLAGS="$LDFLAGS -L/usr/pkg/lib")
AC_CHECK_FILE(/usr/pkg/include, CPPFLAGS="$CPPFLAGS -I/usr/pkg/include")
# Required for solaris
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(resolv, inet_aton)
# Required for openbsd png library
AC_CHECK_LIB(m, pow)
# Required for gd under netbsd
AC_CHECK_LIB(iconv, libiconv_open)
# Required Libraries
AC_CHECK_LIB(png, png_read_info, ,[AC_MSG_ERROR([Bandwidthd requires but cannot libpng])])
AC_CHECK_LIB(gd, gdImageCreate, ,[AC_MSG_ERROR([Bandwidthd requires but cannot find libgd])])
AC_CHECK_LIB(pcap, pcap_open_live, ,
[AC_CHECK_LIB(wpcap, pcap_open_live, ,[AC_MSG_ERROR([Bandwidthd requires but cannot find libpcap])])])
# Optional Library
AC_PATH_PROG(PG_CONFIG, pg_config)
use_pgsql=no
if test x$enable_pgsql = xyes ; then
if test "x$PG_CONFIG" = "x" ; then
echo "*** Couldn't find pg_config. Disabling PostgreSQL support."
else
LDFLAGS="$LDFLAGS -L`$PG_CONFIG --libdir` -lpq"
pgsql_cflags=`$PG_CONFIG --includedir`
if test "x$pgsql_cflags" != "x/usr/include" ; then
CPPFLAGS="$CPPFLAGS -I$pgsql_cflags"
fi
use_pgsql=yes
AC_DEFINE(USE_PGSQL, 1, "Enable PostgreSQL compiletime option")
fi
fi
#AM_CONDITIONAL(HAVE_PGSQL, test x$use_pgsql != xno)
#AC_SUBST(PG_LIBS)
#AC_SUBST(PG_CFLAGS)
#AC_CHECK_FILE(/usr/local/pgsql/lib, LDFLAGS="$LDFLAGS -L/usr/local/pgsql/lib")
#AC_CHECK_FILE(/usr/local/pgsql/include, CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include")
#AC_CHECK_LIB(pq, PQconnectdb,
# [AC_CHECK_LIB(pq,PQexecParams, ,AC_MSG_WARN([libpq exists but is too old... bandwidthd requires support for PQexecParams]))])
# Checks for header files.
AC_HEADER_DIRENT
AC_CHECK_HEADERS([gd.h],,
[AC_CHECK_HEADERS([gd/gd.h],,
AC_MSG_ERROR([Bandwidthd cannot find gd.h]))])
AC_CHECK_HEADERS(gdfonts.h,,
[AC_CHECK_HEADERS(gd/gdfonts.h,,
AC_MSG_ERROR([Bandwidthd cannot find gdfonts.h]))])
AC_CHECK_HEADERS([pcap.h],,
[AC_MSG_ERROR([Bandwidthd cannot find pcap.h])])
AC_CHECK_HEADERS([arpa/inet.h errno.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/socket.h sys/time.h sys/wait.h syslog.h unistd.h],,
[AC_MSG_ERROR([Bandwidthd cannot find some header files])])
#Headers missing on cygwin
AC_CHECK_HEADERS([arpa/nameser.h])
AC_CHECK_HEADERS([resolv.h],,,
[#include <netinet/in.h>
#include <arpa/nameser.h>])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
TCPHDR_SPORT="undefined"
AC_CHECK_MEMBER(struct tcphdr.source,TCPHDR_SPORT="source",,[#include "bandwidthd.h"])
AC_CHECK_MEMBER(struct tcphdr.th_sport,TCPHDR_SPORT="th_sport",,[#include "bandwidthd.h"])
if test "$TCPHDR_SPORT" = "undefined" ; then
AC_MSG_ERROR([Could not determine souce port field name for tcphdr structure])
fi
AC_DEFINE_UNQUOTED(TCPHDR_SPORT,$TCPHDR_SPORT,[source port field name in tcphdr])
TCPHDR_DPORT="undefined"
AC_CHECK_MEMBER(struct tcphdr.dest,TCPHDR_DPORT="dest",,[#include "bandwidthd.h"])
AC_CHECK_MEMBER(struct tcphdr.th_dport,TCPHDR_DPORT="th_dport",,[#include "bandwidthd.h"])
if test "$TCPHDR_DPORT" = "undefined" ; then
AC_MSG_ERROR([Could not determine dest port field name for tcphdr structure])
fi
AC_DEFINE_UNQUOTED(TCPHDR_DPORT,$TCPHDR_DPORT,[dest port field name in tcphdr])
# Checks for library functions.
AC_FUNC_MALLOC
AC_HEADER_STDC
AC_FUNC_MKTIME
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([alarm gethostbyaddr inet_ntoa memset strdup strftime pcap_findalldevs])
# Set directory names
AC_ARG_WITH([htdocs-dir], AC_HELP_STRING([--with-htdocs-dir=DIR], [Sets default htdocs directory. Default is LOCALSTATEDIR/bandwidthd/htdocs]),
htdocs_dir=${with_htdocs_dir},
htdocs_dir="${localstatedir}/bandwidthd/htdocs")
AC_ARG_WITH([log-dir], AC_HELP_STRING([--with-log-dir=DIR], [Sets default cdf log directory. Default is LOCALSTATEDIR/bandwidthd]),
log_dir=${with_log_dir},
log_dir="${localstatedir}/bandwidthd")
config_file="${sysconfdir}/bandwidthd.conf"
AC_DEFINE_DIR(CONFIG_FILE, config_file, [Name of bandwidthd.conf])
AC_DEFINE_DIR(LOG_DIR, log_dir, [Name of log directory])
AC_DEFINE_DIR(HTDOCS_DIR, htdocs_dir, [Name of htdocs directory])
AC_ARG_ENABLE([pgsql], AC_HELP_STRING([--enable-pgsql],
[Enable PostgreSQL support. Default is yes, if available.]),
enable_pgsql="$enableval", enable_pgsql=yes)
AC_OUTPUT(Makefile)
|