dnl -*-fundamental-*- *@--GLOB-HEADER--@*
dnl
-dnl $Id: aclocal.glob,v 1.5 1999/07/27 18:27:37 mdw Exp $
+dnl $Id: aclocal.glob,v 1.6 1999/11/11 17:49:33 mdw Exp $
dnl
dnl Common library of autoconf macros
dnl
dnl----- Revision history ---------------------------------------------------
dnl
dnl $Log: aclocal.glob,v $
+dnl Revision 1.6 1999/11/11 17:49:33 mdw
+dnl New macros for configuring clients of mLib and Catacomb.
+dnl
dnl Revision 1.5 1999/07/27 18:27:37 mdw
dnl Fix typo in header line for mdw_DECL_ENVIRON.
dnl
dnl----- Common files distribution --------------------------- *@--NOTICE--@*
dnl
-dnl $Id: aclocal.glob,v 1.5 1999/07/27 18:27:37 mdw Exp $
+dnl $Id: aclocal.glob,v 1.6 1999/11/11 17:49:33 mdw Exp $
dnl --- *@-AC_PROG_CC_STDC-@* ---
dnl
dnl Use: Like `AC_REQUIRE', only it handles arguments.
AC_DEFUN(mdw_REQUIRE,
-[ifdef([AC_PROVIDED_$1], ,
+[ifdef([AC_PROVIDE_$1], ,
[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
indir($@)
AC_DIVERT_POP()dnl
CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])"
fi])
+dnl *@-mdw_MLIB-@*
+dnl
+dnl Author: Mark Wooding
+dnl
+dnl Synopsis: mdw_MLIB(VERSION, IF-FOUND, IF-NOT-FOUND
+dnl
+dnl Arguments: VERSION = version of library required
+dnl IF-FOUND = what to do if found
+dnl IF-NOT-FOUND = what to do if not found
+dnl
+dnl Use: Configures an mLib client program. The default
+dnl version is 1.0.0pre0; the default action is to add
+dnl everything to the CFLAGS and LIBS variables, and complain
+dnl if the library couldn't be found.
+dnl
+dnl The variable MLIB_VERSION contains the version number of
+dnl the library; MLIB_CFLAGS is the C compiler flags required
+dnl and MLIB_LIBS is the linker flags.
+
+AC_DEFUN([mdw_MLIB],
+[AC_MSG_CHECKING([for mLib library])
+if mLib-config --check $1 >/dev/null 2>&1; then
+ MLIB_VERSION=`mLib-config --version`
+ MLIB_CFLAGS=`mLib-config --cflags`
+ MLIB_LIBS=`mLib-config --libs`
+ AC_SUBST(MLIB_VERSION) AC_SUBST(MLIB_CFLAGS) AC_SUBST(MLIB_LIBS)
+ ifelse([$2], [],
+ [CFLAGS="$CFLAGS $MLIB_CFLAGS"
+ LIBS="$MLIB_LIBS $LIBS"],
+ $2)
+ AC_MSG_RESULT([$MLIB_VERSION])
+else
+ ifelse([$3], [],
+ AC_MSG_ERROR([mLib library not found or too old.]),
+ $3)
+ AC_MSG_RESULT([not found])
+fi])
+
+dnl *@-mdw_CATACOMB-@*
+dnl
+dnl Author: Mark Wooding
+dnl
+dnl Synopsis: mdw_CATACOMB([VERSION], [IF-FOUND], [IF-NOT-FOUND])
+dnl
+dnl Arguments: VERSION = version of Catacomb required
+dnl IF-FOUND = what to do if found
+dnl IF-NOT-FOUND = what to do if not found
+dnl
+dnl Use: Configures the program as a Catacomb client. The default
+dnl version is 1.0.0pre0; the default action is to add
+dnl everything to the CFLAGS and LIBS variables, and complain
+dnl if the library couldn't be found.
+dnl
+dnl The variable CATACOMB_VERSION contains the version number of
+dnl the library; CATACOMB_CFLAGS is the C compiler flags required
+dnl and CATACOMB_LIBS is the linker flags.
+
+AC_DEFUN([mdw_CATACOMB],
+[mdw_REQUIRE([mdw_MLIB], [1.5.0])
+AC_MSG_CHECKING([for Catacomb library])
+if catacomb-config --check $1 >/dev/null 2>&1; then
+ CATACOMB_VERSION=`catacomb-config --version`
+ CATACOMB_CFLAGS=`catacomb-config --cflags`
+ CATACOMB_LIBS=`catacomb-config --libs`
+ AC_SUBST(CATACOMB_VERSION)
+ AC_SUBST(CATACOMB_CFLAGS) AC_SUBST(CATACOMB_LIBS)
+ ifelse([$2], [],
+ [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"
+ LIBS="$CATACOMB_LIBS $LIBS"],
+ $2)
+ AC_MSG_RESULT([$CATACOMB_VERSION])
+else
+ ifelse([$3], [],
+ AC_MSG_ERROR([Catacomb library not found or too old.]),
+ $3)
+ AC_MSG_RESULT([not found])
+fi])
+
dnl --- *@-mdw_OPT_NDEBUG-@* ---
dnl
dnl Author: Mark Wooding