#
# SellaNMS
# $Id: aclocal.m4,v 2.67 2005/04/17 00:02:17 sella Exp $
# Copyright (c) 2001-2004 Digital Genesis Software. All Rights Reserved.
# Released under the GPL Version 2 License.
# http://www.digitalgenesis.com
#

# AC Archive: http://www.gnu.org/software/ac-archive/

AC_DEFUN(AC_ADD_SEARCH_PATH,[
  if test "x$1" != x -a -d $1; then
     if test -d $1/lib; then
       LDFLAGS="-L$1/lib $LDFLAGS"
     fi
     if test -d $1/include; then
       CPPFLAGS="-I$1/include $CPPFLAGS"
     fi
  fi
])

AC_DEFUN(AC_CHECK_STATIC, [
  AC_MSG_CHECKING(if static build is desired)

  USE_STATIC="no"

  AC_ARG_ENABLE(
    static,
    [  --enable-static         enable static build rather than shared],
    USE_STATIC="yes")

  AC_MSG_RESULT($USE_STATIC)
  if test "$USE_STATIC" = "yes"; then
    STATIC=1
    LIB_EXT="a"
    AC_DEFINE(USE_STATIC, 1, [Define if 'use_static' is enabled.])
    AC_MSG_ERROR([Static support won't compile. Needs development. Sorry.])
  else
    LIB_EXT="so"
  fi

  AC_SUBST(STATIC)
  AC_SUBST(LIB_EXT)
])

AC_DEFUN(AC_CHECK_DEBUG, [
  AC_MSG_CHECKING(whether to enable debugging)

  WITH_DEBUG="no"

  AC_ARG_ENABLE(
    debug,
    [  --enable-debug          enable debug (enables -O0 -g)],
    WITH_DEBUG="yes")

  if test "$WITH_DEBUG" = "no"; then
    AC_MSG_RESULT(no)
    CFLAGS="$CFLAGS -w"
    CXXFLAGS="$CXXFLAGS -w"
  else
    AC_MSG_RESULT(yes)

    if test "$WITH_DEBUG" = "yes"; then
      AC_DEFINE(USE_DEBUG, 1, [Define if 'use_debug' is enabled.])
      CFLAGS="$CFLAGS -g -O0 -fno-inline -DDEBUG"
      CXXFLAGS="$CXXFLAGS -g -O0 -fno-inline -DDEBUG"
    fi
  fi
])

AC_DEFUN(AC_CHECK_SETPROCTITLE, [
  AC_MSG_CHECKING(whether to enable setproctitle)

  case "$host" in
    *-*-linux*)
      WITH_SETPROCTITLE="yes"
      ;;
    *)
      WITH_SETPROCTITLE="no"
      ;;
  esac

  AC_ARG_ENABLE(
    setproctitle,
    [  --disable-setproctitle  disables setproctitle (linux only)],
    WITH_SETPROCTITLE="no")

  if test "$WITH_SETPROCTITLE" = "yes"; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_SETPROCTITLE, 1, [Define if 'have_setproctitle' is enabled.])
  else
    AC_MSG_RESULT(no)
  fi
])

AC_DEFUN(AC_CHECK_INITSCRIPT, [
  AC_MSG_CHECKING(whether to enable init script)

  WITH_INITSCRIPT="no"

  AC_ARG_ENABLE(
    init-script,
    [  --enable-init-script    enable init script (RedHat only)],
    WITH_INITSCRIPT="yes")

  if test "$WITH_INITSCRIPT" = "yes"; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_INITSCRIPT, 1, [Define if 'have_init-script' is enabled.])
    ENABLE_INITSCRIPT=1
  else
    AC_MSG_RESULT(no)
    ENABLE_INITSCRIPT=0
  fi

  AC_SUBST(ENABLE_INITSCRIPT)
])

AC_DEFUN(AC_CHECK_ARENA, [
  AC_MSG_CHECKING(whether to disable STL arena memory system)

  WITH_ARENA="yes"

  AC_ARG_ENABLE(
    arena-memory,
    [  --disable-arena-memory  disable STL arena memory system (gcc < v3.2.2 only)],
    WITH_ARENA="no")

  if test "$WITH_ARENA" = "yes"; then
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)
    CFLAGS="$CFLAGS -D__USE_MALLOC -D_STLP_USE_MALLOC"
    CXXFLAGS="$CXXFLAGS -D__USE_MALLOC -D_STLP_USE_MALLOC"
  fi
])

AC_DEFUN(AC_CHECK_PROFILE, [
  AC_MSG_CHECKING(whether to enable profiling)

  WITH_PROFILE="no"

  AC_ARG_ENABLE(
    profile,
    [  --enable-profile        enable profiling (enables -pg)],
    WITH_PROFILE="yes")

  if test "$WITH_PROFILE" = "no"; then
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)
    CFLAGS="$CFLAGS -pg"
    CXXFLAGS="$CXXFLAGS -pg"
  fi
])

AC_DEFUN(AC_CHECK_DISCOVERY, [
  AC_MSG_CHECKING(whether to enable discovery)

  WITH_DISCOVERY="yes"

  AC_ARG_ENABLE(
    discovery,
    [  --disable-discovery     discovery support],
    WITH_DISCOVERY="no")

  if test "$WITH_DISCOVERY" = "no"; then
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)

    DISCOVERY="discovery"
  fi

  dnl Subst must happen to remove variables.
  AC_SUBST(DISCOVERY)
])

AC_DEFUN(AC_CHECK_MONITOR, [
  AC_MSG_CHECKING(whether to enable monitor)

  WITH_MONITOR="yes"

  AC_ARG_ENABLE(
    monitor,
    [  --disable-monitor       monitoring support],
    WITH_MONITOR="no")

  if test "$WITH_MONITOR" = "no"; then
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)

    MONITOR="monitor"
  fi

  dnl Subst must happen to remove variables.
  AC_SUBST(MONITOR)
])

AC_DEFUN(AC_CHECK_OUTPUT, [
  AC_MSG_CHECKING(whether to enable output)

  WITH_OUTPUT="yes"

  AC_ARG_ENABLE(
    output,
    [  --disable-output        output support],
    WITH_OUTPUT="no")

  if test "$WITH_OUTPUT" = "no"; then
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)

    OUTPUT="output"
  fi

  dnl Subst must happen to remove variables.
  AC_SUBST(OUTPUT)
])

AC_DEFUN(AC_WITH_MARCH, [
  AC_MSG_CHECKING(which cpu-type for march)

  AC_ARG_WITH(march,
  [  --with-march=CPU        use cpu-type (ie: i686, pentium4, athlon, athlon-mp) [[no]]],
      if test "$withval" = "yes"; then
        WITH_MARCH="i386"
      elif test "$withval" = "no"; then
        WITH_MARCH="no"
      else
        WITH_MARCH="$withval"
      fi,
      WITH_MARCH="no"
  )
  if test "$WITH_MARCH" = "no"; then
    AC_MSG_RESULT(no)
  else
    old_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$INCLUDES $CPPFLAGS -march=$WITH_MARCH"
    AC_LANG_CPLUSPLUS
    AC_TRY_COMPILE([
        #include <stdio.h>
      ],[
        int x = 0;
      ],[
        dnl Success
        CPPFLAGS="$old_CPPFLAGS -march=$WITH_MARCH"
      ],[
        dnl Failure
        WITH_MARCH="no"
        CPPFLAGS="$old_CPPFLAGS"
      ])
    if test "$WITH_MARCH" = "no"; then
      AC_MSG_RESULT([not compatible with compiler])
    else
      AC_MSG_RESULT($WITH_MARCH)
    fi
  fi
])

AC_DEFUN(AC_CHECK_DUMMY, [
  AC_MSG_CHECKING(whether to enable dummy)

  WITH_DUMMY="yes"

  AC_ARG_ENABLE(
    dummy,
    [  --disable-dummy         dummy support (test module)],
    WITH_DUMMY="no")

  if test "$WITH_DUMMY" = "no"; then
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)

    DUMMY="dummy"
  fi

  dnl Subst must happen to remove variables.
  AC_SUBST(DUMMY)
])

AC_DEFUN(AC_CHECK_STLP_SAFE_STL, [
  AC_MSG_CHECKING(whether to enable STLport's 'Safe STL' Mode)

  USE_STLP_SAFE_STL="no"

  AC_ARG_ENABLE(
    safe-stl,
    [  --enable-safe-stl       enable stlp-debug (enables STLport's 'Safe STL' Mode)],
    USE_STLP_SAFE_STL="yes")

  if test "$USE_STLP_SAFE_STL" = "no"; then
    AC_MSG_RESULT(no)

    CFLAGS="$CFLAGS"
    CXXFLAGS="$CXXFLAGS"
  else
    AC_MSG_RESULT(yes)

    AC_DEFINE(USE_STLP_SAFE_STL, 1, [Define if 'use_stlp_safe_stl' is enabled.])
    CFLAGS="$CFLAGS -g -O0"
    CXXFLAGS="$CXXFLAGS -g -O0"
  fi
])

dnl See BUGS: autoconf on a RH6.2 box, breaks this check. Run autoconf on another box.
AC_DEFUN(AC_WITH_STLPORT, [
  AC_MSG_CHECKING(which STLport should be used)

  AC_ARG_WITH(stlport,
  [  --with-stlport=PATH     use specific copy of STLport (www.stlport.org)],
		WITH_STLPORT="no"
      if test "x$withval" = "xyes"; then
        WITH_STLPORT="yes"
        STLPORT="third-party/STLport"
      elif test -d "$withval/stlport"; then
        WITH_STLPORT="yes"
        STLPORT="$withval"
      fi,
      WITH_STLPORT="no"; STLPORT=""
  )
  if test "$WITH_STLPORT" = "no"; then
    AC_MSG_RESULT(no)
  else
    old_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$INCLUDES $CPPFLAGS -I$STLPORT/stlport"
    AC_LANG_CPLUSPLUS
    AC_TRY_COMPILE([
        #include "string"
      ],[
			stlport::string s;
			s = "this is a sanity check";
			s.compare(0, 4, "this");
      ],[
        dnl Success
        WITH_STLPORT=yes
      ],[
        dnl Failure
        WITH_STLPORT=no; STLPORT=""
      ])
    CPPFLAGS="$old_CPPFLAGS"
    if test "$WITH_STLPORT" != "no"; then
		STLPORT="-I\$(SRCDIR)/${STLPORT}/stlport"
      AC_DEFINE(HAVE_STLPORT, 1, [Define if 'have_stlport' is enabled.])
      AC_SUBST(STLPORT)
      AC_MSG_RESULT($STLPORT)
    else
      AC_MSG_RESULT([failed to compile sanity check with this compiler])
    fi
  fi
])

AC_DEFUN(AC_CHECK_SELLA_NMS_OPTIONS, [
  AC_MSG_CHECKING(for SellaNMS RRD Base)

  AC_ARG_WITH(
    rrddir,
    [  --with-rrddir=PATH      install rrd files in PATH [[PREFIX/rrd]] (experimental)],
    rrddir="$withval", rrddir="\${prefix}/rrd")

  AC_ARG_WITH(
    htmldir,
    [  --with-htmldir=PATH     install webgui files in PATH [[PREFIX/html]]],
    htmldir="$withval", htmldir="\${prefix}/html")

  AC_MSG_RESULT($htmldir)

  AC_MSG_CHECKING(for SellaNMS database server)

  AC_ARG_WITH(
    db-server,
    [  --with-db-server=NAME   name of sella_nms database server [[localhost]]],
    sella_nms_server="$withval", sella_nms_server="localhost")

  AC_MSG_RESULT($sella_nms_server)

  AC_MSG_CHECKING(for SellaNMS database port)

  AC_ARG_WITH(
    db-port,
    [  --with-db-port=NAME     name of sella_nms database port [[3306]]],
    sella_nms_port="$withval", sella_nms_port="3306")

  AC_MSG_RESULT($sella_nms_port)

  AC_MSG_CHECKING(for SellaNMS database name)

  AC_ARG_WITH(
    db-name,
    [  --with-db-name=NAME     name of sella_nms database [[sella_nms]]],
    sella_nms_database="$withval", sella_nms_database="sella_nms")

  AC_MSG_RESULT($sella_nms_database)

  AC_MSG_CHECKING(for SellaNMS database user)

  AC_ARG_WITH(
    db-user,
    [  --with-db-user=NAME     name of sella_nms username [[sella_nms]]],
    sella_nms_username="$withval", sella_nms_username="sella_nms")

  AC_MSG_RESULT($sella_nms_username)

  AC_MSG_CHECKING(for SellaNMS database pass)

  AC_ARG_WITH(
    db-pass,
    [  --with-db-pass=NAME     name of sella_nms password [[my_password]]],
    sella_nms_password="$withval", sella_nms_password="my_password")

  AC_MSG_RESULT($sella_nms_password)

  dnl Subst must happen to remove variables.
  AC_SUBST(htmldir)
  AC_SUBST(rrddir)
  AC_SUBST(sella_nms_server)
  AC_SUBST(sella_nms_port)
  AC_SUBST(sella_nms_database)
  AC_SUBST(sella_nms_username)
  AC_SUBST(sella_nms_password)
])

AC_DEFUN(AC_RESOLVE_CONFIGURE_PATHS, [
  if test "x$prefix" = "xNONE"; then
    eval "prefix=$ac_default_prefix"
    eval "resolved_datadir=$datadir"
    eval "resolved_sysconfdir=$sysconfdir"
    eval "resolved_localstatedir=$localstatedir"
    eval "resolved_htmldir=$htmldir"
    eval "resolved_rrddir=$rrddir"
    eval "prefix=NONE"
  else
    eval "resolved_datadir=\"$datadir\""
    eval "resolved_sysconfdir=$sysconfdir"
    eval "resolved_localstatedir=\"$localstatedir\""
    eval "resolved_htmldir=\"$htmldir\""
    eval "resolved_rrddir=\"$rrddir\""
  fi

  if test "x$exec_prefix" = "xNONE"; then
    if test "x$prefix" = "xNONE"; then
      eval "exec_prefix=$ac_default_prefix"
    else
      eval "exec_prefix=${prefix}"
    fi
    eval "resolved_bindir=$bindir"
    eval "resolved_sbindir=$sbindir"
    eval "resolved_libdir=$libdir"
    eval "resolved_libexecdir=$libexecdir"
    eval "exec_prefix=NONE"
  else
    eval "resolved_bindir=\"$bindir\""
    eval "resolved_sbindir=\"$sbindir\""
    eval "resolved_libdir=\"$libdir\""
    eval "resolved_libexecdir=\"$libexecdir\""
  fi

  AC_SUBST(resolved_datadir)
  AC_SUBST(resolved_sysconfdir)
  AC_SUBST(resolved_localstatedir)
  AC_SUBST(resolved_htmldir)
  AC_SUBST(resolved_rrddir)
  AC_SUBST(resolved_bindir)
  AC_SUBST(resolved_sbindir)
  AC_SUBST(resolved_libdir)
  AC_SUBST(resolved_libexecdir)
]) 

AC_DEFUN(AC_CHECK_CXXVER, [
  AC_MSG_CHECKING(for c++ version)

  AC_TRY_RUN([
int main() {
#ifdef __GNUC__
	exit(0);
#else
	exit(1);
#endif
}
  ], COMPILER="gcc", COMPILER="false", COMPILER="x-false")

  if test "$COMPILER" = "gcc"; then
    CXXVERSION="`${CXX} --version 2> /dev/null | head -n 1`"
    if test "$CXXVERSION" = "2.96"; then
      DEFINES="-pipe ${DEFS} ${DEFINES}"
      CXXVERSION="g++ $CXXVERSION"
      AC_MSG_RESULT([$CXXVERSION (May not compile properly. We suggest gcc 2.95.3 or 3.3.)])
    elif test "$CXXVERSION" = "2.95.3"; then
      DEFINES="-pipe -ftemplate-depth-25 -fpermissive ${DEFS} ${DEFINES}"
      CXXVERSION="g++ $CXXVERSION"
      AC_MSG_RESULT([$CXXVERSION])
    elif test "$CXXVERSION" = ""; then
      DEFINES="-pipe -ftemplate-depth-25 ${DEFS} ${DEFINES}"
      CXXVERSION="g++ (unknown)"
      AC_MSG_RESULT([$CXXVERSION (Untested. We suggest gcc 2.95.3 or 3.3.)])
    else
      DEFINES="-pipe ${DEFS} ${DEFINES}"
      AC_MSG_RESULT([$CXXVERSION])
    fi
  else
    if test "`${CXX} -V 2>&1 | grep -c 'Intel'`" -ge "1"; then
      dnl Diabled warnings.
      CXXVERSION="`${CXX} -V 2>&1 | grep 'Version'`"
      if test "$CXXVERSION" = ""; then
        CXXVERSION="unknown"
        AC_MSG_RESULT([$CXXVERSION])
      else
        AC_MSG_RESULT([$CXXVERSION])
      fi
    else
      DEFINES="${DEFS} ${DEFINES}"
      CXXVERSION="unknown"
      AC_MSG_RESULT([$CXXVERSION])
    fi
  fi

  AC_SUBST(DEFINES)
]) 

dnl AC_DEFUN(AC_CHECK_LIBMYSQLCLIENT, [
dnl   AC_MSG_CHECKING(for ThreadSafe MySQL Client support)
dnl 
dnl   AC_ARG_ENABLE(
dnl     mysql,
dnl     [  --disable-mysql         disable MySQL support],
dnl     WITH_MYSQL="$enableval", WITH_MYSQL="yes")
dnl 
dnl   AC_ARG_WITH(
dnl     mysql-inc,
dnl     [  --with-mysql-inc=PATH   include path for MySQL headers],
dnl     mysql_incdir="$withval", mysql_incdir="no")
dnl 
dnl   AC_ARG_WITH(
dnl     mysql-lib,
dnl     [  --with-mysql-lib=PATH   library path for MySQL libraries],
dnl     mysql_libdir="$withval", mysql_libdir="no")
dnl 
dnl   if test "$WITH_MYSQL" = "no"; then
dnl     AC_MSG_RESULT(no)
dnl     dnl MySQL is required currently, enforce it.
dnl     AC_MSG_ERROR([MySQL support is currently required.])
dnl   else
dnl     AC_MSG_RESULT(yes)
dnl 
dnl     if test -n "$ac_cv_header_mysqlclient_mysql_incdir"; then
dnl       INC_MYSQL="$ac_cv_header_mysqlclient_mysql_incdir"
dnl     fi
dnl 
dnl     if test -n "$ac_cv_lib_mysqlclient_r_mysql_libdir"; then
dnl       LIB_MYSQL="$ac_cv_lib_mysqlclient_r_mysql_libdir"
dnl     fi
dnl 
dnl     dnl MySQL Header Check
dnl     temp="$CPPFLAGS"
dnl     if test "$mysql_incdir" != "no"; then
dnl       INC_MYSQL="-I$mysql_incdir"
dnl       CPPFLAGS="$temp $INC_MYSQL"
dnl       dnl Un-Set any cached results, since user is specifying a specific directory.
dnl       unset ac_cv_header_mysql_mysql_h
dnl     else
dnl       INC_MYSQL="-I/usr/local/include"
dnl       CPPFLAGS="$temp $INC_MYSQL"
dnl       dnl Un-Set any cached results, since user is specifying a specific directory.
dnl       unset ac_cv_header_mysql_mysql_h
dnl     fi
dnl     AC_CHECK_HEADER(mysql/mysql.h, WITH_MYSQL="yes", WITH_MYSQL="no")
dnl     if test "$WITH_MYSQL" = "no"; then
dnl       dnl If our normal search or user suggested attempt failed, then try the known default for MySQL.
dnl       INC_MYSQL="-I/usr/include"
dnl       CPPFLAGS="$temp $INC_MYSQL"
dnl       dnl Un-Set any cached results, to force the second check to go.
dnl       unset ac_cv_header_mysql_mysql_h
dnl 		AC_MSG_RESULT([Here with $INC_MYSQL])
dnl       AC_CHECK_HEADER(mysql/mysql.h, WITH_MYSQL="yes", WITH_MYSQL="no")
dnl     fi
dnl     CPPFLAGS="$temp"
dnl 
dnl     if test "$WITH_MYSQL" = "no"; then
dnl       dnl The headers are required currently, enforce it.
dnl       AC_MSG_ERROR([Unable to locate <mysql/mysql.h>. MySQL support is currently required.])
dnl       dnl The above error will be removed eventually, and we need to clear this var if it fails.
dnl       INC_MYSQL=""
dnl     else
dnl       dnl Cache trick for header.
dnl       ac_cv_header_mysqlclient_mysql_incdir="$INC_MYSQL"
dnl       dnl MySQL Lib Check
dnl       temp="$LIBS"
dnl       if test "$mysql_libdir" != "no"; then
dnl         LIB_MYSQL="-L$mysql_libdir"
dnl         LIBS="$temp $LIB_MYSQL"
dnl         dnl Un-Set any cached results, since user is specifying a specific directory.
dnl         unset ac_cv_lib_mysqlclient_r_mysql_real_connect
dnl       fi
dnl       AC_CHECK_LIB(mysqlclient_r, mysql_real_connect, WITH_MYSQL="yes",
dnl       [
dnl         dnl If our normal search or user suggested attempt failed, then try the known default for MySQL.
dnl         LIB_MYSQL="-L/usr/local/lib/mysql"
dnl         LIBS="$temp $LIB_MYSQL"
dnl         dnl Un-Set any cached results, to force the second check to go.
dnl         unset ac_cv_lib_mysqlclient_r_mysql_real_connect
dnl         echo "Attempting to locate in $LIB_MYSQL..."
dnl         AC_CHECK_LIB(mysqlclient_r, mysql_real_connect, WITH_MYSQL="yes",
dnl         [
dnl           dnl Try a common RPM location for the MySQL libraries.
dnl           LIB_MYSQL="-L/usr/lib/mysql"
dnl           LIBS="$temp $LIB_MYSQL"
dnl           dnl Un-Set any cached results, to force the second check to go.
dnl           unset ac_cv_lib_mysqlclient_r_mysql_real_connect
dnl           echo "Attempting to locate in $LIB_MYSQL..."
dnl           AC_CHECK_LIB(mysqlclient_r, mysql_real_connect, WITH_MYSQL="yes", WITH_MYSQL="no")
dnl         ])
dnl       ])
dnl       if test "$WITH_MYSQL" = "yes"; then
dnl         MYSQLCLIENT="mysqlclient_r"
dnl       else
dnl         dnl Give the normal (not thread-safe) library a try.
dnl         LIBS="$temp"
dnl         AC_CHECK_LIB(mysqlclient, mysql_real_connect, WITH_MYSQL="yes",
dnl         [
dnl           dnl If our normal search or user suggested attempt failed, then try the known default for MySQL.
dnl           LIB_MYSQL="-L/usr/local/lib/mysql"
dnl           LIBS="$temp $LIB_MYSQL"
dnl           dnl Un-Set any cached results, to force the second check to go.
dnl           unset ac_cv_lib_mysqlclient_mysql_real_connect
dnl           echo "Attempting to locate in $LIB_MYSQL..."
dnl           AC_CHECK_LIB(mysqlclient, mysql_real_connect, WITH_MYSQL="yes",
dnl           [
dnl             dnl Try a common RPM location for the MySQL libraries.
dnl             LIB_MYSQL="-L/usr/lib/mysql"
dnl             LIBS="$temp $LIB_MYSQL"
dnl             dnl Un-Set any cached results, to force the second check to go.
dnl             unset ac_cv_lib_mysqlclient_mysql_real_connect
dnl             echo "Attempting to locate in $LIB_MYSQL..."
dnl             AC_CHECK_LIB(mysqlclient, mysql_real_connect, WITH_MYSQL="yes", WITH_MYSQL="no")
dnl           ])
dnl         ])
dnl         if test "$WITH_MYSQL" = "yes"; then
dnl           MYSQLCLIENT="mysqlclient"
dnl         else
dnl           MYSQLCLIENT=""
dnl         fi
dnl       fi
dnl       LIBS="$temp"
dnl 
dnl       if test "$WITH_MYSQL" = "no"; then
dnl         dnl The libs are required currently, enforce it.
dnl         AC_MSG_ERROR([Unable to locate libmysqlclient_r.so or libmysqlclient.so. MySQL support is currently required.])
dnl         dnl The above error will be removed eventually, and we need to clear this var if it fails.
dnl         LIB_MYSQL=""
dnl       else
dnl         if test "$MYSQLCLIENT" = "mysqlclient"; then
dnl           AC_MSG_RESULT([Failed to locate Threadsafe MySQL Client. Settled for libmysqlclient.so.])
dnl           ac_cv_lib_mysqlclient_mysql_libdir="$LIB_MYSQL"
dnl         else
dnl           ac_cv_lib_mysqlclient_r_mysql_libdir="$LIB_MYSQL"
dnl         fi
dnl         AC_DEFINE(HAVE_MYSQL, 1, [Define if 'have_mysql' is enabled.])
dnl         dnl Cache trick for lib.
dnl         LIB_MYSQL="$LIB_MYSQL -l$MYSQLCLIENT"
dnl       fi
dnl     fi
dnl 
dnl     dnl Subst must happen to remove variables.
dnl     AC_SUBST(INC_MYSQL)
dnl     AC_SUBST(LIB_MYSQL)
dnl   fi
dnl ])

AC_DEFUN(AC_CHECK_LIBRRD, [
  AC_MSG_CHECKING(for RRD support)

  AC_ARG_ENABLE(
    rrd,
    [  --disable-rrd           disable RRD support (http://people.ee.ethz.ch/~oetiker/webtools/rrdtool)],
    WITH_RRD="$enableval", WITH_RRD="yes")

  AC_ARG_WITH(
    rrd-inc,
    [  --with-rrd-inc=PATH     include path for RRD headers],
    rrd_incdir="$withval", rrd_incdir="no")

  AC_ARG_WITH(
    rrd-lib,
    [  --with-rrd-lib=PATH     library path for RRD libraries],
    rrd_libdir="$withval", rrd_libdir="no")


  dnl Test for rrd
  if test "$WITH_RRD" = "no"; then 
    RRD_INCDIR=""
    RRD_LIBDIR=""
    AC_MSG_RESULT(no)
  else
    AC_MSG_RESULT(yes)
    unset ac_cv_header_rrd_h

    RRD_FIND=`$FIND /usr/local -maxdepth 1 -name "rrdtool*" | $HEAD -1`

    if test "$rrd_incdir" != "no"; then
        RRD_INCDIR=-I$rrd_incdir
    elif test "$WITH_RRD" != "yes"; then
      RRD_INCDIR=-I$WITH_RRD
      test -d $WITH_RRD/include && RRD_INCDIR="-I$withval/include"
    else
      RRD_INCDIR="-I${RRD_FIND}"
      test -f $RRD_FIND/include/rrd.h && RRD_INCDIR="-I$RRD_FIND/include"
    fi

    if test "$rrd_libdir" != "no"; then
      RRD_LIBDIR=-L$rrd_libdir
    elif test "$WITH_RRD" != "yes"; then
      RRD_LIBDIR=-L$WITH_RRD/lib
    else
      RRD_LIBDIR=""
      test -f ${RRD_FIND}/lib/librrd.a && RRD_LIBDIR=-L${RRD_FIND}/lib
      test -f ${RRD_FIND}/lib/librrd.so && RRD_LIBDIR=-L${RRD_FIND}/lib
      test -f /usr/local/lib/librrd.a && RRD_LIBDIR=-L/usr/local/lib
      test -f /usr/local/lib/librrd.so && RRD_LIBDIR=-L/usr/local/lib
      test -f /usr/lib/librrd.a && RRD_LIBDIR=-L/usr/lib
      test -f /usr/lib/librrd.so && RRD_LIBDIR=-L/usr/lib
    fi

    old_LIBS="$LIBS"
    old_CPPFLAGS="$CPPFLAGS"
    INCLUDES="$RRD_INCDIR $INCLUDES"
    CPPFLAGS="$INCLUDES $CPPFLAGS"
    LIBS="$RRD_LIBDIR $LIBS"
  
    AC_CHECK_HEADER(rrd.h)
    AC_CHECK_LIB(rrd, rrd_create, RRD_LIBDIR="$RRD_LIBDIR -lrrd")
  
    LIBS="$old_LIBS"
    CPPFLAGS="$old_CPPFLAGS"

    if test "$ac_cv_lib_rrd_rrd_create" = "yes" -a "$ac_cv_header_rrd_h" = "yes"; then
      AC_DEFINE(HAVE_LIBRRD, 1, [Define if 'have_librrd' is enabled.])
    else
      RRD_INCDIR=""
      RRD_LIBDIR=""
      dnl AC_MSG_RESULT(no)
    fi
  fi

  AC_SUBST(RRD_LIBDIR)
  AC_SUBST(RRD_INCDIR)
])

AC_DEFUN(AC_CHECK_LIBDBI, [
  AC_MSG_CHECKING(for DBI support)

  AC_ARG_ENABLE(
    dbi,
    [  --disable-dbi           disable DBI support (libdbi.sourceforge.net)],
    WITH_DBI="$enableval", WITH_DBI="yes")

  AC_ARG_WITH(
    dbi-inc,
    [  --with-dbi-inc=PATH     include path for DBI headers],
    dbi_incdir="$withval", dbi_incdir="no")

  AC_ARG_WITH(
    dbi-lib,
    [  --with-dbi-lib=PATH     library path for DBI libraries],
    dbi_libdir="$withval", dbi_libdir="no")


  dnl Test for dbi
  if test "$WITH_DBI" = "no"; then 
    AC_MSG_ERROR([DBI support is required. You attempted to disable it.])
  else
    AC_MSG_RESULT(yes)
    unset ac_cv_header_dbi_dbi_h
    unset ac_cv_lib_dbi_dbi_driver_open

    if test "$dbi_incdir" != "no"; then
        DBI_INCDIR=-I$dbi_incdir
    elif test "$WITH_DBI" != "yes"; then
      DBI_INCDIR=-I$WITH_DBI
      test -d $WITH_DBI/include/dbi && DBI_INCDIR="-I$withval/include"
    else
      DBI_INCDIR=""
      test -f /usr/local/include/dbi/dbi.h && DBI_INCDIR="-I/usr/local/include"
dnl      test -f /usr/local/include/dbi/dbi.h && DBI_INCDIR=""
    fi


    if test "$dbi_libdir" != "no"; then
      DBI_LIBDIR=-L$dbi_libdir
    elif test "$WITH_DBI" != "yes"; then
      DBI_LIBDIR=-L$WITH_DBI/lib
    else
      DBI_LIBDIR=""
      test -f /usr/local/lib/libdbi.a && DBI_LIBDIR=-L/usr/local/lib
      test -f /usr/local/lib/libdbi.so && DBI_LIBDIR=-L/usr/local/lib
      test -f /usr/lib/libdbi.a && DBI_LIBDIR=-L/usr/lib
      test -f /usr/lib/libdbi.so && DBI_LIBDIR=-L/usr/lib
    fi

    old_LIBS="$LIBS"
    old_CPPFLAGS="$CPPFLAGS"
    INCLUDES="$DBI_INCDIR $INCLUDES"
    CPPFLAGS="$INCLUDES $CPPFLAGS"
    LIBS="$DBI_LIBDIR $LIBS"
  
    AC_CHECK_HEADER(dbi/dbi.h)
    AC_CHECK_LIB(dbi, dbi_driver_open, DBI_LIBDIR="$DBI_LIBDIR -ldbi")
  
    LIBS="$old_LIBS"
    CPPFLAGS="$old_CPPFLAGS"

    if test "$ac_cv_lib_dbi_dbi_driver_open" = "yes" -a "$ac_cv_header_dbi_dbi_h" = "yes"; then
      AC_DEFINE(HAVE_LIBDBI, 1, [Define if 'have_libdbi' is enabled.])
    else
      AC_MSG_ERROR([libdbi support is required. Please check your libdbi installation. (libdbi.sourceforge.net)])
    fi
  fi

  AC_SUBST(DBI_LIBDIR)
  AC_SUBST(DBI_INCDIR)
])

AC_DEFUN(AC_CHECK_LIBUCDSNMP, [
  AC_MSG_CHECKING(for SNMP support)

  AC_ARG_ENABLE(
    snmp,
    [  --disable-snmp          disable SNMP support (www.netsnmp.org)],
    WITH_SNMP="$enableval", WITH_SNMP="yes")

  AC_ARG_WITH(
    snmp-inc,
    [  --with-snmp-inc=PATH    include path for SNMP headers],
    snmp_incdir="$withval", snmp_incdir="no")

  AC_ARG_WITH(
    snmp-lib,
    [  --with-snmp-lib=PATH    library path for SNMP libraries],
    snmp_libdir="$withval", snmp_libdir="no")


  dnl Test for net-snmp
  if test "$WITH_SNMP" = "no"; then 
    AC_MSG_ERROR([SNMP support is curently required. You attempted to disable it.])
  elif test "$WITH_SNMP" = "yes"; then
    AC_MSG_RESULT(yes)
    AC_PATH_PROG(SNMP_CONFIG, net-snmp-config, , [/usr/local/bin:$PATH])
  else
    AC_MSG_RESULT(yes)
    SNMP_CONFIG="$WITH_SNMP/bin/net-snmp-config"
  fi

  if test -x "$SNMP_CONFIG"; then
    SNMP_LIBS="`$SNMP_CONFIG --netsnmp-libs`"
    SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`"
    SNMP_PREFIX="`$SNMP_CONFIG --prefix`"

    if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
      if test "${SNMP_PREFIX}" != "/usr"; then
        SNMP_INCDIR="-I${SNMP_PREFIX}/include"
      fi
      SNMP_LIBDIR="${SNMP_LIBS}"

      old_LIBS="$LIBS"
      old_CPPFLAGS="$CPPFLAGS"
      CPPFLAGS="$SNMP_INCDIR $CPPFLAGS"
      LIBS="$SNMP_LIBDIR $LIBS"
    
      AC_CHECK_HEADER(net-snmp/net-snmp-config.h)
      AC_CHECK_LIB(netsnmp, snmp_open)
  
      LIBS="$old_LIBS"
      CPPFLAGS="$old_CPPFLAGS"

      if test "$ac_cv_lib_netsnmp_snmp_open" = "yes" -a "$ac_cv_header_net_snmp_net_snmp_config_h" = "yes"; then
        AC_DEFINE(HAVE_NET_SNMP, 1, [Define if 'have_net_snmp' is enabled.])
      else
        AC_MSG_ERROR([SNMP support is curently required. Please check your NET-SNMP installation. (www.net-snmp.org)])
      fi
    else
      AC_MSG_ERROR([SNMP support is curently required. Please check your NET-SNMP installation. (www.net-snmp.org)])
    fi
  else 
    unset ac_cv_header_ucd_snmp_ucd_snmp_config_h
    unset ac_cv_header_ucd_snmp_parse_h
    unset ac_cv_lib_snmp_snmp_open
    unset ac_cv_lib_crypto_SSLeay

    if test "$snmp_incdir" != "no"; then
        SNMP_INCDIR=-I$snmp_incdir
    elif test "$WITH_SNMP" != "yes"; then
      SNMP_INCDIR=-I$WITH_SNMP/include
      test -d $WITH_SNMP/include/ucd-snmp && SNMP_INCDIR="-I$withval/include"
    else
      SNMP_INCDIR=""
      test -f /usr/local/include/ucd-snmp/ucd-snmp-config.h && SNMP_INCDIR=""
      test -f /usr/include/snmp/include/ucd-snmp/ucd-snmp-config.h && SNMP_INCDIR="-I/usr/include/snmp/include"
      test -f /usr/local/include/snmp/include/ucd-snmp/ucd-snmp-config.h && SNMP_INCDIR="-I/usr/local/include/snmp/include"
    fi
    if test "$snmp_libdir" != "no"; then
      SNMP_LIBDIR=-L$snmp_libdir
    elif test "$WITH_SNMP" != "yes"; then
      SNMP_LIBDIR=-L$WITH_SNMP/lib
    else
      SNMP_LIBDIR=-L/usr/local/lib
      test -f /usr/lib/libsnmp.a && SNMP_LIBDIR=-L/usr/lib
      test -f /usr/lib/libsnmp.so && SNMP_LIBDIR=-L/usr/lib
      test -f /usr/local/lib/libsnmp.a && SNMP_LIBDIR=-L/usr/local/lib
      test -f /usr/local/lib/libsnmp.so && SNMP_LIBDIR=-L/usr/local/lib
      test -f /usr/local/snmp/lib/libsnmp.a && SNMP_LIBDIR=-L/usr/local/snmp/lib
      test -f /usr/local/snmp/lib/libsnmp.so && SNMP_LIBDIR=-L/usr/local/snmp/lib
    fi

    old_LIBS="$LIBS"
    old_CPPFLAGS="$CPPFLAGS"
    INCLUDES="$SNMP_INCDIR $INCLUDES"
    CPPFLAGS="$INCLUDES $CPPFLAGS"
    LIBS="$SNMP_LIBDIR $LIBS"
  
    AC_CHECK_HEADERS(ucd-snmp/ucd-snmp-config.h ucd-snmp/parse.h)
    if test "$ac_cv_header_ucd_snmp_ucd_snmp_config_h" = "yes"; then
      dnl UCD SNMP 4.x
      AC_TRY_RUN([
          #include <ucd-snmp/ucd-snmp-config.h>
          main() { exit(USE_OPENSSL != 1); }
        ],[
          SNMP_SSL=yes
        ],[
          SNMP_SSL=no
        ],[
          SNMP_SSL=no
        ])
      if test "$SNMP_SSL" = "yes"; then
        AC_DEFINE(HAVE_UCD_SNMP_SSL, 1, [Define if 'have_snmp_ssl' is enabled.])
      fi
    fi
  
    if test "$SNMP_SSL" = "yes"; then
      dnl This is required if crypto was used to build libsnmp.
      SSL_LIBDIR=""
      test -f /usr/local/ssl/lib/libcrypto.a && SSL_LIBDIR=-L/usr/local/ssl/lib
      test -f /usr/local/ssl/lib/libcrypto.so && SSL_LIBDIR=-L/usr/local/ssl/lib
      LIBS="$SSL_LIBDIR -lcrypto $LIBS"
    fi
  
    AC_CHECK_LIB(snmp, snmp_open, SNMP_LIBDIR="$SNMP_LIBDIR -lsnmp")
    AC_CHECK_LIB(crypto, SSLeay, SNMP_LIBDIR="$SNMP_LIBDIR $SSL_LIBDIR -lcrypto")
  
    LIBS="$old_LIBS"
    CPPFLAGS="$old_CPPFLAGS"

    if test "$ac_cv_lib_snmp_snmp_open" = "yes" -a "$ac_cv_header_ucd_snmp_parse_h" = "yes" -a "$ac_cv_header_ucd_snmp_ucd_snmp_config_h" = "yes"; then
      AC_DEFINE(HAVE_UCD_SNMP, 1, [Define if 'have_ucd_snmp' is enabled.])
    else
      AC_MSG_ERROR([SNMP support is curently required. Please check your UCD-SNMP installation. (www.net-snmp.org)])
    fi
  fi

  AC_SUBST(SNMP_LIBDIR)
  AC_SUBST(SNMP_INCDIR)
])

AC_DEFUN(AC_WITH_HOARD, [
  AC_MSG_CHECKING(if hoard should be enabled)

  AC_ARG_WITH(hoard,
  [  --with-hoard=PATH       use hoard library (www.hoard.org)],
      WITH_HOARD="no"
      if test "x$withval" = "xyes"; then
        AC_ADD_SEARCH_PATH(/usr/local)
        LIBS="-lhoard $LIBS"
        WITH_HOARD="yes"
        AC_DEFINE(HAVE_HOARD, 1, [Define if 'have_hoard' is enabled.])
      elif test -d "$withval"; then
        AC_ADD_SEARCH_PATH($withval)
        LIBS="-lhoard $LIBS"
        WITH_HOARD="yes"
        AC_DEFINE(HAVE_HOARD)
      fi,
      WITH_HOARD="no"
  )
  AC_SUBST(HAVE_HOARD)
  AC_MSG_RESULT($WITH_HOARD)
])

dnl dmalloc support
dnl Automake macro adapted from ucd-snmp.
dnl
AC_DEFUN(AC_WITH_DMALLOC, [
  AC_MSG_CHECKING(if dmalloc should be enabled)

  AC_ARG_WITH(dmalloc,
  [  --with-dmalloc=PATH     use dmalloc library (www.dmalloc.com)],
      WITH_DMALLOC="no"
      if test "x$withval" = "xyes"; then
        AC_ADD_SEARCH_PATH(/usr/local)
        LIBS="$LIBS -ldmalloc"
        WITH_DMALLOC="yes"
        AC_DEFINE(HAVE_DMALLOC, 1, [Define if 'have_dmalloc' is enabled.])
      elif test -d "$withval"; then
        AC_ADD_SEARCH_PATH($withval)
        LIBS="$LIBS -ldmalloc"
        WITH_DMALLOC="yes"
        AC_DEFINE(HAVE_DMALLOC, 1, [Define if 'have_dmalloc' is enabled.])
      fi,
      WITH_DMALLOC="no"
  )
  AC_SUBST(HAVE_DMALLOC)
  AC_MSG_RESULT($WITH_DMALLOC)
])

dnl ccalloc support

AC_DEFUN(AC_WITH_CCMALLOC, [
  AC_MSG_CHECKING(if ccmalloc should be enabled)

  AC_ARG_WITH(ccmalloc,
  [  --with-ccmalloc=PATH    use ccmalloc library],
      WITH_CCMALLOC="no"
      if test "x$withval" = "xyes"; then
        AC_ADD_SEARCH_PATH(/usr/local)
        LIBS="$LIBS -lccmalloc /usr/local/lib/ccmalloc-g++.o"
        WITH_CCMALLOC="yes"
        AC_DEFINE(HAVE_CCMALLOC, 1, [Define if 'have_ccmalloc' is enabled.])
      elif test -d "$withval"; then
        AC_ADD_SEARCH_PATH($withval)
        LIBS="$LIBS -lccmalloc $withval/lib/ccmalloc-g++.o"
        WITH_CCMALLOC="yes"
        AC_DEFINE(HAVE_CCMALLOC, 1, [Define if 'have_ccmalloc' is enabled.])
      fi,
      WITH_CCMALLOC="no"
  )
  AC_SUBST(HAVE_CCMALLOC)
  AC_MSG_RESULT($WITH_CCMALLOC)
])

dnl mpatrol
dnl A library for controlling and tracing dynamic memory allocations.
dnl Copyright (C) 1997-2001 Graeme S. Roy <graeme.roy@analog.com>
dnl

dnl Automake macro to build with the mpatrol library

# serial 1

# AM_WITH_MPATROL(DEFAULT)
# Check whether to build with the mpatrol library and also attempt to
# determine the support libraries that also need to be linked in when
# libmpatrol is used.  If `DEFAULT' is not specified then it is `no'.
# If `DEFAULT' is `threads' then the threadsafe version of the mpatrol
# library will be used.

AC_DEFUN(AM_WITH_MPATROL, [
  # Firstly, determine if the mpatrol library should be used.

  AC_MSG_CHECKING(if mpatrol should be used)
  AC_ARG_WITH(mpatrol,
   [  --with-mpatrol=PATH     build with the mpatrol library],
   [case "$withval" in
     threads)
      am_with_mpatrol=1
      am_with_mpatrol_threads=1;;
     yes)
      am_with_mpatrol=1
      am_with_mpatrol_threads=1;; dnl We always want threads.
     no)
      am_with_mpatrol=0
      am_with_mpatrol_threads=0;;
     *)
      AC_MSG_RESULT(no)
      AC_MSG_ERROR(invalid value $withval for --with-mpatrol);;
    esac
   ],
   [if test "x[$1]" = x
    then
     am_with_mpatrol=0
     am_with_mpatrol_threads=0
    elif test "[$1]" = no
    then
     am_with_mpatrol=0
     am_with_mpatrol_threads=0
    elif test "[$1]" = yes
    then
     am_with_mpatrol=1
     am_with_mpatrol_threads=0
    elif test "[$1]" = threads
    then
     am_with_mpatrol=1
     am_with_mpatrol_threads=1
    else
     AC_MSG_RESULT(no)
     AC_MSG_ERROR(invalid argument [$1])
    fi
   ]
  )

  if test "$am_with_mpatrol" = 1
  then
   AC_MSG_RESULT(yes)

   # Next, determine which support libraries are available on this
   # system.  If we don't do this here then we can't link later with
   # the mpatrol library to perform any further tests.

   am_with_mpatrol_libs=""
   AC_CHECK_LIB(ld, ldopen,
                am_with_mpatrol_libs="$am_with_mpatrol_libs -lld")
   AC_CHECK_LIB(elf, elf_begin,
                am_with_mpatrol_libs="$am_with_mpatrol_libs -lelf")
   AC_CHECK_LIB(bfd, bfd_init,
                am_with_mpatrol_libs="$am_with_mpatrol_libs -lbfd -liberty", ,
                -liberty)
   AC_CHECK_LIB(imagehlp, SymInitialize,
                am_with_mpatrol_libs="$am_with_mpatrol_libs -limagehlp")
   AC_CHECK_LIB(cl, U_get_previous_frame,
                am_with_mpatrol_libs="$am_with_mpatrol_libs -lcl")
   AC_CHECK_LIB(exc, unwind,
                am_with_mpatrol_libs="$am_with_mpatrol_libs -lexc")

   # Now determine which libraries really need to be linked in with
   # the version of libmpatrol that is on this system.  For example,
   # if the system has libelf and libbfd, we need to determine which
   # of these, if any, libmpatrol was built with support for.

   am_with_mpatrol_libs2=""
   AC_CHECK_LIB(mpatrol, __mp_libld,
                am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lld", ,
                $am_with_mpatrol_libs)
   AC_CHECK_LIB(mpatrol, __mp_libelf,
                am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lelf", ,
                $am_with_mpatrol_libs)
   AC_CHECK_LIB(mpatrol, __mp_libbfd,
                am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lbfd -liberty", ,
                $am_with_mpatrol_libs)
   AC_CHECK_LIB(mpatrol, __mp_libimagehlp,
                am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -limagehlp", ,
                $am_with_mpatrol_libs)
   AC_CHECK_LIB(mpatrol, __mp_libcl,
                am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lcl", ,
                $am_with_mpatrol_libs)
   AC_CHECK_LIB(mpatrol, __mp_libexc,
                am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lexc", ,
                $am_with_mpatrol_libs)

   # If we are using the threadsafe mpatrol library then we may also need
   # to link in the threads library.  We check blindly for pthreads here
   # even if we don't need them (in which case it doesn't matter) since
   # the threads libraries are linked in by default on AmigaOS, Windows
   # and Netware and it is only UNIX systems that we need to worry about.

   if test "$am_with_mpatrol_threads" = 1
   then
    AC_CHECK_LIB(pthread, pthread_mutex_init,
                 am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lpthread", [
      AC_CHECK_LIB(pthreads, pthread_mutex_init,
                   am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lpthreads", [
        AC_CHECK_LIB(thread, pthread_mutex_init,
                     am_with_mpatrol_libs2="$am_with_mpatrol_libs2 -lthread")
       ]
      )
     ]
    )
   fi

   # We now know what libraries to use in order to link with libmpatrol.

   AC_DEFINE(HAVE_MPATROL, 1, [Define if using mpatrol])
   if test "$am_with_mpatrol_threads" = 1
   then
    LIBS="-lmpatrolmt $am_with_mpatrol_libs2 $LIBS"
   else
    LIBS="-lmpatrol $am_with_mpatrol_libs2 $LIBS"
   fi

   # Finally, verify that mpatrol is correctly installed and that we can
   # link a simple program with it.

   AC_CACHE_CHECK(for working mpatrol, am_cv_with_mpatrol, [
     AC_TRY_LINK([#include <mpatrol.h>], [
int main(void)
{
    malloc(4);
    return EXIT_SUCCESS;
}
],
      [am_cv_with_mpatrol=yes],
      [am_cv_with_mpatrol=no]
     )
    ]
   )

   if test "$am_cv_with_mpatrol" = no
   then
    AC_MSG_ERROR(mpatrol not installed correctly)
   fi
  else
   AC_MSG_RESULT(no)
  fi
 ]
)

dnl Automake macro adapted from PHP.
AC_DEFUN(BOLD_MSG,[
  AC_MSG_RESULT()
  AC_MSG_RESULT([${term_bold}$1${term_norm}])
])
