Add support for mgLib too.
[cfd] / aclocal.glob
index 760229c..0f4b4d8 100644 (file)
@@ -1,6 +1,6 @@
 dnl -*-fundamental-*-                                    *@--GLOB-HEADER--@*
 dnl
-dnl $Id: aclocal.glob,v 1.3 1999/07/17 10:27:44 mdw Exp $
+dnl $Id: aclocal.glob,v 1.7 1999/11/11 20:03:58 mdw Exp $
 dnl
 dnl Common library of autoconf macros
 dnl
@@ -28,6 +28,18 @@ dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 dnl----- Revision history ---------------------------------------------------
 dnl
 dnl $Log: aclocal.glob,v $
+dnl Revision 1.7  1999/11/11 20:03:58  mdw
+dnl Add support for mgLib too.
+dnl
+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 Revision 1.4  1999/07/26 23:44:32  mdw
+dnl Reorder and tidy documentation.
+dnl
 dnl Revision 1.3  1999/07/17 10:27:44  mdw
 dnl More useful macros added.
 dnl
@@ -40,7 +52,7 @@ dnl
 
 dnl----- Common files distribution --------------------------- *@--NOTICE--@*
 dnl
-dnl $Id: aclocal.glob,v 1.3 1999/07/17 10:27:44 mdw Exp $
+dnl $Id: aclocal.glob,v 1.7 1999/11/11 20:03:58 mdw Exp $
 
 dnl --- *@-AC_PROG_CC_STDC-@* ---
 dnl
@@ -1048,32 +1060,23 @@ AC_DEFUN(AM_SYS_POSIX_TERMIOS,
 
 dnl----- Macros by Mark Wooding ------------------------------ *@--IGNORE--@*
 
-dnl --- *@-mdw_DECL_ENVIRON-@* ---
+dnl --- *@-mdw_REQUIRE-@* ---
 dnl
 dnl Author:    Mark Wooding
 dnl
-dnl Synopsis:  mdw_DECL_ENVIRON
+dnl Synopsis:  mdw_REQUIRE(MACRO, ARGS...)
 dnl
-dnl Arguments: ---
+dnl Arguments: MACRO = name of a macro which should have been called
+dnl            ARGS = arguments to pass
 dnl
-dnl Use:       If the global variable `environ' is declared anywhere
-dnl            `obvious', then define the preprocessor symbol DECL_ENVIRON.
+dnl Use:       Like `AC_REQUIRE', only it handles arguments.
 
-AC_DEFUN(mdw_DECL_ENVIRON,
-[AC_CHECK_HEADERS([unistd.h])
-AC_CACHE_CHECK([for declaration of \`environ'], sw_cv_environ,
-[AC_EGREP_CPP(environ, 
-[#include <sys/types.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif], [sw_cv_environ=yes], [sw_cv_environ=no])])
-if test $sw_cv_environ = yes; then
-  AC_DEFINE(DECL_ENVIRON)
-fi])
+AC_DEFUN(mdw_REQUIRE,
+[ifdef([AC_PROVIDE_$1], ,
+[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
+indir($@)
+AC_DIVERT_POP()dnl
+])])
 
 dnl --- *@-mdw_CURSES-@* ---
 dnl
@@ -1083,12 +1086,14 @@ dnl Synopsis:   mdw_CURSES
 dnl
 dnl Arguments: ---
 dnl
-dnl Use:       Attempts to find an implementation of `curses'.  A `curses'
-dnl            library (`ncurses' by preference) will be added to `LIBS'.
-dnl            If a library could be found, the preprocessor symbol
-dnl            HAVE_CURSES is defined, along with one of HAVE_NCURSES_H,
-dnl            HAVE_NCURSES_NCURSES_H or HAVE_CURSES_H, suggesting which
-dnl            header to include (in the obvious way).
+dnl Use:       Searches for a `curses' library (one of `ncurses' or
+dnl            `curses') using mdw_CHECK_MANYLIBS.  If one is found, the
+dnl            preprocessor macro HAVE_CURSES is defined, and a search is
+dnl            made for a `curses' header file (one of <ncurses.h>,
+dnl            <ncurses/ncurses.h> or <curses.h>) using AC_CHECK_HEADERS
+dnl            and the appropriate preprocessor symbol is defined.
+dnl            Finally, a check is made for the function `wresize' using
+dnl            AC_CHECK_FUNCS.
 
 AC_DEFUN(mdw_CURSES,
 [mdw_CHECK_MANYLIBS(newwin, ncurses curses, AC_DEFINE(HAVE_CURSES))
@@ -1111,11 +1116,12 @@ dnl Synopsis:   mdw_TYPE_SSIZE_T
 dnl
 dnl Arguments: ---
 dnl
-dnl Use:       Finds an appropriate type for `ssize_t' if there isn't a
-dnl            sensible one to use already.
+dnl Use:       Checks whether the Posix type `ssize_t' is defined.  If not,
+dnl            it defaults to `int'.
 
 AC_DEFUN(mdw_TYPE_SSIZE_T,
-[AC_CACHE_CHECK(for ssize_t, sw_cv_ssize_t,
+[AC_REQUIRE([AC_HEADER_STDC])
+AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t,
 [AC_EGREP_CPP(ssize_t,
 [#include <sys/types.h>
 #if HAVE_UNISTD_H
@@ -1125,28 +1131,37 @@ AC_DEFUN(mdw_TYPE_SSIZE_T,
 #include <stdlib.h>
 #include <stddef.h>
 #endif],
-[sw_cv_ssize_t=yes], [sw_cv_ssize_t=no])])
-if test $sw_cv_ssize_t = no; then
+[mdw_cv_ssize_t=yes], [mdw_cv_ssize_t=no])])
+if test $mdw_cv_ssize_t = no; then
   AC_DEFINE(ssize_t, int)
 fi])
 
-dnl --- *@-mdw_REQUIRE-@* ---
+dnl --- *@-mdw_DECL_ENVIRON-@* ---
 dnl
 dnl Author:    Mark Wooding
 dnl
-dnl Synopsis:  mdw_REQUIRE(MACRO, ARGS...)
+dnl Synopsis:  mdw_DECL_ENVIRON
 dnl
-dnl Arguments: MACRO = name of a macro which should have been called
-dnl            ARGS = arguments to pass
+dnl Arguments: ---
 dnl
-dnl Use:       Like `AC_REQUIRE', only it handles arguments.
+dnl Use:       Searches for a declaration of the global `environ' variable.
+dnl            If one is found in one of the `usual' places, DECL_ENVIRON
+dnl            is defined as a preprocessor symbol.
 
-AC_DEFUN(mdw_REQUIRE,
-[ifdef([AC_PROVIDED_$1], ,
-[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl
-indir($@)
-AC_DIVERT_POP()dnl
-])])
+AC_DEFUN(mdw_DECL_ENVIRON,
+[AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ,
+[AC_EGREP_CPP(environ, 
+[#include <sys/types.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])])
+if test $mdw_cv_environ = yes; then
+  AC_DEFINE(DECL_ENVIRON)
+fi])
 
 dnl --- *@-mdw_CHECK_MANYLIBS-@* ---
 dnl
@@ -1342,6 +1357,123 @@ if test "$GXX" = "yes"; then
   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_MGLIB-@*
+dnl
+dnl Author:    Mark Wooding
+dnl
+dnl Synopsis:  mdw_MGLIB(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 mgLib 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 MGLIB_VERSION contains the version number of
+dnl            the library; MGLIB_CFLAGS is the C compiler flags required
+dnl            and MGLIB_LIBS is the linker flags.
+
+AC_DEFUN([mdw_MGLIB],
+[mdw_REQUIRE([mdw_MGLIB], [1.6.0])
+AC_MSG_CHECKING([for mgLib library])
+if mgLib-config --check $1 >/dev/null 2>&1; then
+  MGLIB_VERSION=`mgLib-config --version`
+  MGLIB_CFLAGS=`mgLib-config --cflags`
+  MGLIB_LIBS=`mgLib-config --libs`
+  AC_SUBST(MGLIB_VERSION) AC_SUBST(MGLIB_CFLAGS) AC_SUBST(MGLIB_LIBS)
+  ifelse([$2], [],
+  [CFLAGS="$CFLAGS $MGLIB_CFLAGS"
+  LIBS="$MGLIB_LIBS $LIBS"],
+  $2)
+  AC_MSG_RESULT([$MGLIB_VERSION])
+else
+  ifelse([$3], [],
+  AC_MSG_ERROR([mgLib 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.6.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