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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
dnl Process this file with autoconf to produce a configure script.
dnl This file is just some unique file that configure will check
dnl for to make sure it's in the right directory.
AC_INIT(cheops.c)
AC_CONFIG_HEADER(config.h)
AC_SITE_LOAD()
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
dnl Checks for libraries.
dnl Replace `main' with a function in -libs:
dnl AC_CHECK_LIB(ibs, main)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl SNMP support
AC_ARG_WITH(net-snmp, [ --with-net-snmp[=LOCATION] Location of net-snmp header files],
netsnmpdir=$withval, netsnmpdir="no")
if test "$netsnmpdir" = "no" ; then
netsnmpdir=/usr/include/net-snmp
fi
AC_ARG_WITH(snmpir, [ --with-ucd-snmp[=LOCATION] Location of ucd-snmp header files],
ucdsnmpdir=$withval, ucdsnmpdir="no")
if test "$ucdsnmpdir" = "no" ; then
ucdsnmpdir=/usr/include/ucd-snmp
fi
dnl check for snmp
AC_ARG_ENABLE(snmp, [ --enable-snmp Use Simple Network Management Protocol],
[if test $enableval != "no"; then
cheops_snmp=yes
else
cheops_snmp=no
fi],
[cheops_snmp=undefined])
SNMPCFLAGS=" # -I${ucdsnmpdir} -DSNMP"
SNMPLFLAGS=" # -lsnmp"
snmpobjs="# snmp.o browser.o"
if test "$cheops_snmp" = "undefined" -o "$cheops_snmp" = "yes"; then
AC_MSG_CHECKING([for Snmp libraries support])
dnl Try fist net-snmp
dnl get the net-snmp-config binary
if test "x$netsnmpconfig" = "xyes" -o "x$netsnmpconfig" = "x" ; then
dnl search for it
AC_PATH_PROG(NETSNMPCONFIG,net-snmp-config)
else
ac_cv_path_NETSNMPCONFIG=$netsnmpconfig
if test ! -x $ac_cv_path_NETSNMPCONFIG ; then
AC_MSG_ERROR(Invalid net-snmp-config: ac_cv_prog_NETSNMPCONFIG)
fi
fi
if test "x$ac_cv_path_NETSNMPCONFIG" != "xno" -a "x$ac_cv_path_NETSNMPCONFIG" != "x" -a -x "$ac_cv_path_NETSNMPCONFIG" ; then
dnl other choices for flags to use here: could also use
dnl --prefix or --exec-prefix if you don't want the full list.
SNMPCFLAGS="`net-snmp-config --cflags` -DSNMP"
CPPFLAGS="$CPPLAGS `net-snmp-config --cflags`"
SNMPLFLAGS=`net-snmp-config --libs`
snmpobjs="browser.o snmp.o"
# XXX: make sure we can find net-snmp/net-snmp-config.h
# XXX: make sure we can find net-snmp/net-snmp-includes.h
AC_DEFINE(HAVE_NET_SNMP)
AC_MSG_RESULT(yes (net-snmp))
else
if test -f ${ucdsnmpdir}/snmp_api.h ; then
SNMPCFLAGS="-I${ucdsnmpdir} -DSNMP"
SNMPLFLAGS="-lsnmp"
snmpobjs="browser.o snmp.o"
AC_DEFINE(HAVE_UCD_SNMP)
AC_MSG_RESULT(yes (ucd-snmp))
else
AC_MSG_ERROR("SNMP specified but could not find ${ucdsnmpdir}/snmp_api.h")
fi
fi
fi
AC_SUBST(snmpobjs)
AC_SUBST(SNMPCFLAGS)
AC_SUBST(SNMPLFLAGS)
AC_SUBST(CPPFLFLAGS)
dnl May want to get the gnome directory here...
AC_ARG_ENABLE(gnome, [ --enable-gnome Use the Gnome Desktop (security hole)],
[if test $enableval != "no"; then
cheops_gnome=yes
AC_DEFINE(CHEOPS_GNOME,1)
else
cheops_gnome=no
fi],
[cheops_gnome=no])
if test $cheops_gnome = "yes"; then
AC_MSG_CHECKING([for gnome])
if ( gnome-config --cflags gnome gnomeui gtk >/dev/null ); then
XTRACFLAGS="`gnome-config --cflags gnome gnomeui gtk` -DUSE_GNOME"
XTRALIBS="`gnome-config --libs gnome gnomeui gtk`"
AC_MSG_RESULT("yes")
else
AC_MSG_ERROR("Check that gnome-config is in path")
fi
else
AC_MSG_CHECKING([for gtk])
if ( gtk-config --cflags >/dev/null ); then
XTRACFLAGS=`gtk-config --cflags`
XTRALIBS=`gtk-config --libs`
GTKLINK="gtklink.o"
AC_MSG_RESULT("yes")
else
AC_MSG_ERROR("Check that gtk-config is in path")
fi
fi
AC_SUBST(XTRACFLAGS)
AC_SUBST(XTRALIBS)
AC_SUBST(GTKLINK)
dnl Allow for debug config here...
AC_ARG_ENABLE(debug, [ --enable-debug Print debugging data to terminal],
[if test $enableval != "no"; then
cheops_debug=yes
AC_DEFINE(CHEOPS_DEBUG,1)
else
cheops_debug=no
fi],
[cheops_debug=no])
if test $cheops_debug = "yes"; then
DEBUGCFLAG="-DDEBUG"
fi
AC_SUBST(DEBUGCFLAG)
AC_CHECK_LIB(c, dn_expand, [cheops_needs_lresolv=" "], [cheops_needs_lresolv=-lresolv])
AC_SUBST(cheops_needs_lresolv)
snmp_add_var="no"
AC_CHECK_LIB(dl, dlopen, [cheops_lib="dl"], [])
AC_CHECK_LIB(snmp, snmp_add_var, [snmp_add_var="yes"], [])
AC_CHECK_LIB(gmodule, g_module_open, [cheops_lib="gmodule"], [], -lglib -ldl)
if test $cheops_lib = "gmodule"; then
PLUGINCFLAG="-DHAS_GMODULE"
PLUGINLIB="-lgmodule"
else
if test $cheops_lib = "dl"; then
PLUGINCFLAG="-DHAS_DLOPEN"
PLUGINLIB="-ldl"
else
echo "Must have gmodule or dlopen"
exit 1;
fi
fi
AC_SUBST(PLUGINCFLAG)
AC_SUBST(PLUGINLIB)
dnl See if we need to #define ip_sum ip_csum
AC_CACHE_CHECK(if struct ip has member ip_csum,
cheops_cv_ip_csum,
[AC_TRY_COMPILE([#include<netinet/ip.h>
struct ip ip;],[ip.ip_csum=0;],
cheops_cv_ip_csum=yes,
cheops_cv_ip_csum=no)])
if test $cheops_cv_ip_csum != "yes"; then
AC_CACHE_CHECK(if struct ip has member ip_sum,
cheops_cv_ip_sum,
[AC_TRY_COMPILE([#include<netinet/ip.h>
struct ip ip;],[ip.ip_sum=0;],
cheops_cv_ip_sum=yes,
cheops_cv_ip_sum=no)])
if test $cheops_cv_ip_sum != "yes"; then
echo Doh: netinet/ip.h does not have ip_sum or ip_csum in struct ip.
fi
else
cheops_cv_ip_sum=no
fi
AC_SUBST(cheops_cv_ip_csum)
AC_SUBST(cheops_cv_ip_sum)
if ! test $snmp_add_var = "yes"; then
AC_DEFINE(NEED_SNMP_ADD_VAR,1)
fi
if test $cheops_cv_ip_csum = "yes"; then
AC_DEFINE(CHEOPS_IP_CSUM,1)
else
AC_DEFINE(CHEOPS_IP_CSUM,0)
fi
if test $cheops_cv_ip_sum = "yes"; then
AC_DEFINE(CHEOPS_IP_SUM,1)
fi
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_CHECK_FUNCS(gethostname select socket strcspn strdup strstr strtol strtoul)
AC_OUTPUT(Makefile plugins/Makefile)
|