--- projects/libstatgrab/configure.in 2003/02/19 23:09:48 1.3 +++ projects/libstatgrab/configure.in 2003/10/07 22:07:37 1.33 @@ -1,35 +1,57 @@ -dnl configure.in for libstatgrab -dnl $Id: configure.in,v 1.3 2003/02/19 23:09:48 tdb Exp $ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. +# +# configure.in for libstatgrab +# $Id: configure.in,v 1.33 2003/10/07 22:07:37 tdb Exp $ +# -dnl Change these to change the package name and version -AC_INIT(libstatgrab, 0.1, dev@i-scream.org.uk) -AM_INIT_AUTOMAKE(libstatgrab, 0.1) +# Change these to change the package name and version +AC_INIT(libstatgrab, 0.6, bugs@i-scream.org) +AM_INIT_AUTOMAKE(libstatgrab, 0.6) -dnl The file we use to pass #define's to the source -AC_CONFIG_HEADER(config.h) +# Revision number (automatically updated) +AC_REVISION($Revision: 1.33 $) -dnl We need a CC, install, and libtool +# Might work with older autoconfs... but tested on 2.57 +AC_PREREQ(2.57) + +# The file we use to pass #define's to the source +AM_CONFIG_HEADER([config.h]) + +# Checks for programs AC_PROG_CC AC_PROG_INSTALL AC_PROG_LIBTOOL -dnl And we probably need the standard C bits +# Checks for header files AC_HEADER_STDC -dnl The program needs to know whether it can use getloadavg -AC_CHECK_FUNCS(getloadavg) +# Checks for typedefs, structures, and compiler characteristics +AC_C_CONST -dnl Set things up for different OS's -dnl We define the name of the OS so the code can act accordingly -dnl We also need to add the right LDFLAGS +# Checks for library functions +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS(atoll) + +# 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 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]) + LINKFLAGS="-lkstat" + ;; solaris2.*) + AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) - LDFLAGS="$LDFLAGS -lkstat" + LINKFLAGS="-lkstat" ;; freebsd4.*) AC_DEFINE(FREEBSD, , [Building on FreeBSD 4.x]) - LDFLAGS="$LDFLAGS -lkvm" + LINKFLAGS="-lkvm -ldevstat" ;; linux-gnu) AC_DEFINE(LINUX, , [Building on GNU/Linux]) @@ -39,5 +61,85 @@ linux-gnu) ;; esac -dnl And finish by changing these files -AC_OUTPUT([Makefile src/Makefile]) +# 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 + ] +) + +# User specified pkgconfig dir +AC_ARG_WITH([pkgconfig-dir], + [ --with-pkgconfig-dir=PATH pkgconfig lib directory (PREFIX/lib/pkgconfig)], + [ PKGCONFIG_DIR=$withval ], + [ PKGCONFIG_DIR="\$(libdir)/pkgconfig" ] +) +AC_SUBST(PKGCONFIG_DIR) + +# 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 libstatgrab.pc src/statgrab/statgrab-make-mrtg-config src/statgrab/statgrab-make-mrtg-index src/saidar/Makefile]) + +AC_OUTPUT