--- projects/libstatgrab/configure.in 2003/08/26 12:14:43 1.25 +++ projects/libstatgrab/configure.in 2004/02/10 16:42:14 1.52 @@ -2,15 +2,15 @@ # Process this file with autoconf to produce a configure script. # # configure.in for libstatgrab -# $Id: configure.in,v 1.25 2003/08/26 12:14:43 tdb Exp $ +# $Id: configure.in,v 1.52 2004/02/10 16:42:14 tdb Exp $ # # Change these to change the package name and version -AC_INIT(libstatgrab, 0.5.1, bugs@i-scream.org) -AM_INIT_AUTOMAKE(libstatgrab, 0.5.1) +AC_INIT(libstatgrab, 0.8.2, bugs@i-scream.org) +AM_INIT_AUTOMAKE(libstatgrab, 0.8.2) # Revision number (automatically updated) -AC_REVISION($Revision: 1.25 $) +AC_REVISION($Revision: 1.52 $) # Might work with older autoconfs... but tested on 2.57 AC_PREREQ(2.57) @@ -34,6 +34,22 @@ AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS(atoll) +# Disk IO read and write statistics are only present on recent NetBSD. +AC_CHECK_MEMBER(struct disk_sysctl.dk_rbytes, + [AC_DEFINE(HAVE_DK_RBYTES, , [New-style NetBSD stats])], + [], + [#include ]) + +# Check for sys/loadavg.h +AC_CHECK_HEADERS([sys/loadavg.h]) + +# Check for libdevinfo.h +AC_CHECK_HEADERS([libdevinfo.h]) + +# Default needing setgid/setuid to false +AM_CONDITIONAL(SETGIDBINS, false) +AM_CONDITIONAL(SETUIDBINS, false) + # Set things up for different OS's # We define the name of the OS so the code can act accordingly # We also need to add the right LDFLAGS @@ -41,27 +57,138 @@ case $host_os in solaris2.[[6-7]]) AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) - AC_DEFINE(SOL7, , [Building on Solaris 2.7]) - LDFLAGS="$LDFLAGS -lkstat" + AC_DEFINE(SOL7, , [Building on Solaris 2.6 or 2.7]) + AM_CONDITIONAL(SETUIDBINS, true) + LINKFLAGS="-lkstat" + AC_CHECK_LIB(devinfo, di_init, [LINKFLAGS="$LINKFLAGS -ldevinfo"]) ;; solaris2.*) AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) - LDFLAGS="$LDFLAGS -lkstat" + AM_CONDITIONAL(SETUIDBINS, true) + LINKFLAGS="-lkstat -ldevinfo" ;; freebsd4.*) - AC_DEFINE(FREEBSD, , [Building on FreeBSD 4.x]) - LDFLAGS="$LDFLAGS -lkvm -ldevstat" + AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) + AC_DEFINE(FREEBSD, , [Building on FreeBSD]) + AM_CONDITIONAL(SETGIDBINS, true) + LINKFLAGS="-lkvm -ldevstat" ;; +freebsd5.*) + AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) + AC_DEFINE(FREEBSD, , [Building on FreeBSD]) + AC_DEFINE(FREEBSD5, , [Building on FreeBSD 5.x]) + AM_CONDITIONAL(SETGIDBINS, true) + LINKFLAGS="-lkvm -ldevstat" + ;; +netbsdelf*) + AC_DEFINE(ALLBSD, , [Building on a BSD-derived system]) + AC_DEFINE(NETBSD, , [Building on NetBSD]) + AM_CONDITIONAL(SETGIDBINS, true) + LINKFLAGS="-lkvm" + ;; linux-gnu) AC_DEFINE(LINUX, , [Building on GNU/Linux]) ;; +cygwin) + AC_DEFINE(CYGWIN, , [Building on Cygwin]) + ;; *) AC_MSG_ERROR([Cannot build on unknown OS: $host_os]) ;; esac +# User specified curses/ncurses prefix +AC_ARG_WITH([curses-prefix], + [ --with-curses-prefix=PATH curses (or ncurses) is in PATH], + [ + if test -d "$withval/lib"; then + SAIDARLIBS="-L${withval}/lib ${SAIDARLIBS}" + fi + if test -d "$withval/include"; then + SAIDARCPPFLAGS="-I${withval}/include -I${withval}/include/ncurses ${SAIRDARCPPFLAGS}" + fi + ] +) + +# Check if user wants to disable statgrab +AM_CONDITIONAL(STATGRAB, true) +AC_ARG_ENABLE(statgrab, + [ --disable-statgrab disable building of statgrab], + [ + if test "x$enableval" = "xno" ; then + AM_CONDITIONAL(STATGRAB, false) + fi + ] +) + +# Check if user wants to disable saidar +AM_CONDITIONAL(SAIDAR, true) +AC_ARG_ENABLE(saidar, + [ --disable-saidar disable building of saidar], + [ + if test "x$enableval" = "xno" ; then + AM_CONDITIONAL(SAIDAR, false) + fi + ], + [ + # saidar needs curses + # (if we don't find curses we disable saidar) + MP_WITH_CURSES + ] +) + +# Check if the user would prefer not to build examples +AM_CONDITIONAL(EXAMPLES, true) +AC_ARG_ENABLE(examples, + [ --disable-examples disable building of examples], + [ + if test "x$enableval" = "xno" ; then + AM_CONDITIONAL(EXAMPLES, false) + fi + ] +) + +# Check if user wants to install manpages +AM_CONDITIONAL(MANPAGES, true) +AC_ARG_ENABLE(manpages, + [ --disable-manpages disable installation of manpages], + [ + if test "x$enableval" = "xno" ; then + AM_CONDITIONAL(MANPAGES, false) + fi + ] +) + +# Check if the user wants to turn off setgid binaries +AC_ARG_ENABLE(setgid-binaries, + [ --disable-setgid-binaries disable binaries being setgid], + [ + if test "x$enableval" = "xno" ; then + AM_CONDITIONAL(SETGIDBINS, false) + fi + ] +) + +# Check if the user wants to turn off setuid binaries +AC_ARG_ENABLE(setuid-binaries, + [ --disable-setuid-binaries disable binaries being setuid], + [ + if test "x$enableval" = "xno" ; then + AM_CONDITIONAL(SETUIDBINS, false) + fi + ] +) + +# The LIBS and CPPFLAGS that saidar needs +AC_SUBST(SAIDARLIBS) +AC_SUBST(SAIDARCPPFLAGS) + +# The flags needed to link to libstatgrab +# (ie. our dependencies) +AC_SUBST(LINKFLAGS) + # And finish by changing these files -AC_CONFIG_FILES([Makefile src/Makefile src/libstatgrab/Makefile src/statgrab/Makefile docs/Makefile examples/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile src/libstatgrab/Makefile src/statgrab/Makefile docs/Makefile examples/Makefile libstatgrab.pc src/statgrab/statgrab-make-mrtg-config src/statgrab/statgrab-make-mrtg-index src/saidar/Makefile]) AC_OUTPUT