X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/blobdiff_plain/5b59e2273110cd2173669a3fcf519de3c956ac36..861b771926602bf05394386923fa4c2e282fecf7:/aclocal.glob diff --git a/aclocal.glob b/aclocal.glob index 5ae7364..1c19f01 100644 --- a/aclocal.glob +++ b/aclocal.glob @@ -1,6 +1,6 @@ dnl -*-fundamental-*- *@--GLOB-HEADER--@* dnl -dnl $Id: aclocal.glob,v 1.2 1999/05/13 22:57:23 mdw Exp $ +dnl $Id: aclocal.glob,v 1.15 2002/02/19 22:50:24 mdw Exp $ dnl dnl Common library of autoconf macros dnl @@ -28,6 +28,48 @@ dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl----- Revision history --------------------------------------------------- dnl dnl $Log: aclocal.glob,v $ +dnl Revision 1.15 2002/02/19 22:50:24 mdw +dnl Fix spelling. Add new macro which works out where to put TeX files. +dnl +dnl Revision 1.14 2002/02/03 19:15:15 mdw +dnl Add SDL-finding equipment. Quote some macro names which need it. Add +dnl long-overdue macros for expanding configured paths (and do it +dnl properly). +dnl +dnl Revision 1.13 2001/02/23 09:07:24 mdw +dnl Restore temporary variable on exit. +dnl +dnl Revision 1.12 2001/02/04 01:18:52 mdw +dnl Overhaul the mLib debugging options. +dnl +dnl Revision 1.11 2001/01/20 12:03:08 mdw +dnl Remove redundant stuff. +dnl +dnl Revision 1.10 2000/10/14 16:32:15 mdw +dnl Fixes from upstream. +dnl +dnl Revision 1.9 2000/08/15 21:37:49 mdw +dnl New initialization macro for libraries, and a new base client macro for +dnl finding libraries with an appropriate version. +dnl +dnl Revision 1.8 1999/11/26 01:23:17 mdw +dnl And support for MXD (not yet released). +dnl +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 dnl Revision 1.2 1999/05/13 22:57:23 mdw dnl Change `-ise' to `-ize' throughout. dnl @@ -37,13 +79,13 @@ dnl dnl----- Common files distribution --------------------------- *@--NOTICE--@* dnl -dnl $Id: aclocal.glob,v 1.2 1999/05/13 22:57:23 mdw Exp $ +dnl $Id: aclocal.glob,v 1.15 2002/02/19 22:50:24 mdw Exp $ -dnl --- *@-AC_PROG_CC_STDC-@* --- +dnl --- *@-AM_PROG_CC_STDC-@* --- dnl dnl Author: Franc,ois Pinard dnl -dnl Synopsis: AC_PROG_CC_STDC +dnl Synopsis: AM_PROG_CC_STDC dnl dnl Arguments: --- dnl @@ -288,7 +330,7 @@ dnl certain things. But this isn't really a big deal. # serial 1 AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AM_PROG_INSTALL]) +[AC_REQUIRE([AC_PROG_INSTALL]) PACKAGE=[$1] AC_SUBST(PACKAGE) VERSION=[$2] @@ -300,8 +342,8 @@ fi ifelse([$3],, AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) -AM_SANITY_CHECK -AC_ARG_PROGRAM +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) dnl FIXME This is truly gross. missing_dir=`cd $ac_aux_dir && pwd` AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) @@ -309,26 +351,7 @@ AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_PROG_MAKE_SET]) - -dnl --- *@-AM_PROG_INSTALL-@* --- -dnl -dnl Author: Franc,ois Pinard -dnl -dnl Synopsis: AM_PROG_INSTALL -dnl -dnl Arguments: --- -dnl -dnl Use: Calls `AC_PROG_INSTALL' to find an installer. Then it sets -dnl `INSTALL_SCRIPT' to a suitable value if necessary. - -# serial 1 - -AC_DEFUN(AM_PROG_INSTALL, -[AC_PROG_INSTALL -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755' -AC_SUBST(INSTALL_SCRIPT)dnl -]) +AC_REQUIRE([AC_PROG_MAKE_SET])]) dnl --- *@-AM_PROG_LEX-@* --- dnl @@ -613,7 +636,7 @@ dnl set `U' to be `_' and `ANSI2KNR' to be `./ansi2knr'. # serial 1 AC_DEFUN(fp_C_PROTOTYPES, -[AC_REQUIRE([fp_PROG_CC_STDC]) +[AC_REQUIRE([AM_PROG_CC_STDC]) AC_MSG_CHECKING([for function prototypes]) if test "$ac_cv_prog_cc_stdc" != no; then AC_MSG_RESULT(yes) @@ -813,6 +836,187 @@ main () rm -f conf.gtktest ]) +dnl --- *@-AM_PATH_SDL-@* --- +dnl +dnl Author: Sam Langinga +dnl +dnl Synopsis: AM_PATH_SDL([VERSION, [IF-FOUND, [IF-NOT-FOUND]]]) +dnl +dnl Arguments: VERSION = minimum required version +dnl IF-FOUND = what to do if found +dnl IF-NOT-FOUND = what to do if not found +dnl +dnl Use: Test for SDL, and define SDL_CFLAGS and SDL_LIBS + +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN(AM_PATH_SDL, +[dnl +dnl Get the cflags and libraries from the sdl-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + AC_PATH_PROG(SDL_CONFIG, sdl-config, no) + min_sdl_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) + dnl --- *@-AC_TYPE_PTRDIFF_T-@* --- dnl dnl Author: Ulrich Drepper @@ -972,35 +1176,6 @@ main() { /* Under Solaris 2.4, strtod returns the wrong value for the terminating character under some conditions. */ - -## @defmac AC_FUNC_STRTOD -## @maindex FUNC_STRTOD -## @ovindex LIBOBJS -## If the @code{strtod} function is not available, or does not work -## correctly (like the one on SunOS 5.4), add @samp{strtod.o} to output -## variable @code{LIBOBJS}. -## @end defmac - -AC_DEFUN(AM_FUNC_STRTOD, -[AC_CACHE_CHECK(for working strtod, am_cv_func_strtod, -[AC_TRY_RUN([ -double strtod (); -int -main() -{ - { - /* Some versions of Linux strtod mis-parse strings with leading '+'. */ - char *string = " +69"; - char *term; - double value; - value = strtod (string, &term); - if (value != 69 || term != (string + 4)) - exit (1); - } - - { - /* Under Solaris 2.4, strtod returns the wrong value for the - terminating character under some conditions. */ char *string = "NaN"; char *term; strtod (string, &term); @@ -1056,23 +1231,111 @@ dnl ARGS = arguments to pass dnl dnl Use: Like `AC_REQUIRE', only it handles arguments. -AC_DEFUN(mdw_REQUIRE, -[ifdef([AC_PROVIDED_$1], , +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 +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_CURSES +dnl +dnl Arguments: --- +dnl +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 , +dnl or ) 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)) +if test $mdw_cv_lib_newwin != no; then +AC_CHECK_HEADERS([ncurses.h ncurses/ncurses.h curses.h], [break]) +if test "$ac_cv_header_ncurses_h" = "no" && + test "$ac_cv_header_ncurses_ncurses_h" = "no" && + test "$ac_cv_header_curses_h" = "no"; then + AC_MSG_WARN([couldn't find a \`curses' header. Assuming \`curses.h'.]) + AC_DEFINE(HAVE_CURSES_H) +fi +AC_CHECK_FUNCS(wresize) +fi]) + +dnl --- *@-mdw_TYPE_SSIZE_T-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_TYPE_SSIZE_T +dnl +dnl Arguments: --- +dnl +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_REQUIRE([AC_HEADER_STDC]) +AC_CACHE_CHECK(for ssize_t, mdw_cv_ssize_t, +[AC_EGREP_CPP(ssize_t, +[#include +#if HAVE_UNISTD_H +#include +#endif +#if STDC_HEADERS +#include +#include +#endif], +[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_DECL_ENVIRON-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_DECL_ENVIRON +dnl +dnl Arguments: --- +dnl +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_DECL_ENVIRON], +[AC_CACHE_CHECK([for declaration of \`environ'], mdw_cv_environ, +[AC_EGREP_CPP(environ, +[#include +#if HAVE_UNISTD_H +#include +#endif +#if STDC_HEADERS +#include +#include +#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 dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND]) +dnl Synopsis: mdw_CHECK_MANYLIBS(FUNC, LIBS, [IF-FOUND], [IF-NOT-FOUND], +dnl [INCLUDES], [ARGS]) dnl dnl Arguments: FUNC = a function to try to find dnl LIBS = a whitespace-separated list of libraries to search dnl IF-FOUND = what to do when the function is found dnl IF-NOT-FOUND = what to do when the function isn't found +dnl INCLUDES = other include files to add +dnl ARGS = arguments to pass the function dnl dnl Use: Searches for a library which defines FUNC. It first tries dnl without any libraries; then it tries each library specified @@ -1083,14 +1346,14 @@ dnl This is particularly handy under DIREIX: if you link with dnl `-lnsl' then you get non-NIS-aware versions of getpwnam and dnl so on, which is clearly a Bad Thing. -AC_DEFUN(mdw_CHECK_MANYLIBS, +AC_DEFUN([mdw_CHECK_MANYLIBS], [AC_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1], [mdw_save_LIBS="$LIBS" mdw_cv_lib_$1="no" -AC_TRY_LINK(,[$1()], [mdw_cv_lib_$1="none required"]) +AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="none required"]) test "$mdw_cv_lib_$1" = "no" && for i in $2; do LIBS="-l$i $mdw_save_LIBS" -AC_TRY_LINK(,[$1()], +AC_TRY_LINK([$5], [$1($6)], [mdw_cv_lib_$1="-l$i" break]) done @@ -1107,7 +1370,7 @@ dnl dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level. changequote(<<, >>) -define(mdw__PERL_VERSION, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>) +define([mdw__PERL_VERSION], <<$1 -e 'exit ($] < $2);' >&5 2>&5>>) changequote([, ]) dnl --- *@-mdw_PROG_PERL-@* --- @@ -1130,7 +1393,7 @@ dnl put into the `PERL' environment variable; `AC_SUBST' is used dnl to substitute its value into Perl scripts. If there is no dnl Perl to be found, the value of `PERL' is set to be `none'. -AC_DEFUN(mdw_PROG_PERL, +AC_DEFUN([mdw_PROG_PERL], [AC_ARG_WITH([perl], [ --with-perl=PERL specify path to Perl version $1 or newer], [PERL="$withval"], @@ -1170,7 +1433,7 @@ dnl Use: Verifies that the Perl interpreter in the `PERL' shell dnl variable actually works and is of the right version. If it's dnl not, an error is raised and configuration is aborted. -AC_DEFUN(mdw_CHECK_PERL, +AC_DEFUN([mdw_CHECK_PERL], [mdw_REQUIRE([mdw_PROG_PERL], [$1]) AC_MSG_CHECKING([whether Perl ($PERL) works]) if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then @@ -1202,12 +1465,12 @@ dnl dnl This macro isn't terribly useful in the general case. It dnl Also implicitly assumes that `$PERL' is Perl 5 or later. -AC_DEFUN(mdw__PERLLIB_INIT, +AC_DEFUN([mdw__PERLLIB_INIT], [AC_SUBST(INC_PERLLIBS)dnl AC_SUBST(NEEDED_PERLLIBS)dnl ]) -AC_DEFUN(mdw_PERLLIB_CHECK, +AC_DEFUN([mdw_PERLLIB_CHECK], [AC_REQUIRE([mdw__PERLLIB_INIT]) mdw_REQUIRE([mdw_CHECK_PERL], 5) AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1, @@ -1247,7 +1510,7 @@ dnl `-fhandle-exceptions'). dnl dnl Use: If the C compiler is GCC, add the compiler flags. -AC_DEFUN(mdw_GCC_FLAGS, +AC_DEFUN([mdw_GCC_FLAGS], [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])" @@ -1257,6 +1520,134 @@ if test "$GXX" = "yes"; then CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])" fi]) +dnl *@-mdw_INIT_LIB-@* +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_INIT_LIB(LIB, NAME, VERSION, [PACKAGE]) +dnl +dnl Arguments: LIB = the name of the library (and the package) +dnl NAME = a presentable version of the library's name +dnl VERSION = version of the library +dnl PACKAGE = package name to pass on to AM_INIT_AUTOMAKE +dnl +dnl Use: Sets up various useful variables. This macro calls +dnl AM_INIT_AUTOMAKE, which might be considered useful. It also +dnl provides variables for the use of `lib-config.in'. + +AC_DEFUN([mdw_INIT_LIB], +[AM_INIT_AUTOMAKE(ifelse([$4], [], [$1], [$4]), [$3]) +LIBRARY="$1" AC_SUBST(LIBRARY) +LIBNAME="$2" AC_SUBST(LIBNAME)]) + +dnl *@-mdw_LIB_CONFIG-@* +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_LIB_CONFIG(LIB, NAME, VERSION, IF-FOUND, IF-NOT-FOUND) +dnl +dnl Arguments: LIB = the name of the library (and its configuration program) +dnl NAME = a presentable version of the library's name +dnl 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 a library client program, using a configuration +dnl script provided by the library maintainer. +dnl +dnl The default version is 1.0.0pre0; the default action is to +dnl add everything to the CFLAGS and LIBS variables, and complain +dnl if the library couldn't be found. +dnl +dnl The variable LIB_VERSION contains the version number of +dnl the library; LIB_CFLAGS is the C compiler flags required +dnl and LIB_LIBS is the linker flags. + +AC_DEFUN([mdw_LIB_CONFIG], +[pushdef([upname], translit([$1], [a-z], [A-Z]))dnl +AC_MSG_CHECKING([for $2 library]) +if $1-config --check $3 >/dev/null 2>&1; then + upname[]_VERSION=`$1-config --version` + upname[]_CFLAGS=`$1-config --cflags` + upname[]_LIBS=`$1-config --libs` + AC_SUBST(upname[]_VERSION) + AC_SUBST(upname[]_CFLAGS) + AC_SUBST(upname[]_LIBS) + ifelse([$4], [], + [CFLAGS="$CFLAGS $upname[]_CFLAGS" + LIBS="$upname[]_LIBS $LIBS"], + $4) + AC_MSG_RESULT([$upname[]_VERSION]) +else + ifelse([$5], [], + AC_MSG_ERROR([$2 library not found or too old.]), + $5) + AC_MSG_RESULT([not found]) +fi +popdef([upname])]) + +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. + +AC_DEFUN([mdw_MLIB], [mdw_LIB_CONFIG(mLib, mLib, $@)]) + +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. + +AC_DEFUN([mdw_MGLIB], +[mdw_REQUIRE([mdw_MLIB], [1.6.0]) +mdw_LIB_CONFIG(mgLib, mgLib, $@)]) + +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. + +AC_DEFUN([mdw_CATACOMB], +[mdw_REQUIRE([mdw_MLIB], [1.6.0]) +mdw_LIB_CONFIG(catacomb, Catacomb, $@)]) + +dnl *@-mdw_PK-@* +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_PK([VERSION], [IF-FOUND], [IF-NOT-FOUND]) +dnl +dnl Arguments: VERSION = version of PK 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 PK client. + +AC_DEFUN([mdw_PK], +[mdw_REQUIRE([mdw_MLIB], [1.6.0]) +mdw_LIB_CONFIG(pk, PK, $@)]) + dnl --- *@-mdw_OPT_NDEBUG-@* --- dnl dnl Author: Mark Wooding @@ -1265,16 +1656,15 @@ dnl Synopsis: mdw_OPT_NDEBUG dnl dnl Arguments: --- dnl -dnl Use: Turns off the `NDEBUG' flag if the user wants to do -dnl debugging. +dnl Use: Turns on the `NDEBUG' flag, to disable useful things like +dnl assertions. -AC_DEFUN(mdw_OPT_NDEBUG, +AC_DEFUN([mdw_OPT_NDEBUG], [AC_ARG_ENABLE(debugging, -[ --enable-debugging spews vast swathes of useless information], +[ --disable-debugging spews vast swathes of useless information], [if test "$enableval" = "no"; then AC_DEFINE(NDEBUG, 1) -fi], -[AC_DEFINE(NDEBUG, 1)])]) +fi])]) dnl --- *@-mdw_OPT_EFENCE-@* --- dnl @@ -1286,49 +1676,144 @@ dnl Arguments: --- dnl dnl Use: Links with the Electric Fence library. -AC_DEFUN(mdw_OPT_EFENCE, +AC_DEFUN([mdw_OPT_EFENCE], [AC_ARG_WITH(electric-fence, [ --with-electric-fence link programs with Electric Fence], [if test "$withval" = "yes"; then AC_CHECK_LIB(efence, malloc) fi])]) -dnl --- *@-mdw_OPT_mLib_DEBUG-@* --- +dnl --- *@-mdw_OPT_TRACE-@* --- dnl dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM) +dnl Synopsis: mdw_OPT_TRACE dnl dnl Arguments: --- dnl -dnl Use: Provides options for mLib debugging. In particular, the +dnl Use: Turns on the `NTRACE' flag, to disable useful things like +dnl trace outputs. + +AC_DEFUN([mdw_OPT_TRACE], +[AC_ARG_ENABLE(tracing, +[ --disable-tracing disable output of trace information], +[if test "$enableval" = "no"; then + AC_DEFINE(NTRACE, 1) +fi])]) + +dnl --- *@-mdw_OPT_mLib_TRACK-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_OPT_mLib_TRACK(PROGRAM) +dnl +dnl Arguments: PROGRAM = name of this program or package. +dnl +dnl Use: Controls the unsupported mLib memory tracker. The dnl following are defined: dnl -dnl --enable-tracing turns off the NTRACE variable dnl --enable-track turns on malloc tracking dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM dnl -dnl There must be a separate `blame' option, so that the various -dnl blame options work properly. - -AC_DEFUN(mdw_OPT_mLib_DEBUG, -[mdw_OPT_NDEBUG -mdw_OPT_EFENCE - -AC_ARG_ENABLE(tracing, -[ --enable-tracing enable output of tracing information], -[if test "$enableval" = "no"; then - AC_DEFINE(NTRACE, 1) -fi], -[AC_DEFINE(NTRACE, 1)]) +dnl There must be a separate `blame' option for each program, +dnl so that the various blame options in a hierarchy get +dnl propagated properly. This is an obsolete feature from the +dnl days when mLib was provided as a subdirectory of other +dnl packages. +AC_DEFUN([mdw_OPT_mLib_TRACK], +[AC_REQUIRE([mdw_OPT_TRACE]) AC_ARG_ENABLE(track, [ --enable-track enable tracking of malloc and free], [AC_DEFINE(TRACK_ENABLE, 1)]) - AC_ARG_ENABLE(blame-$1, [ --enable-blame-$1 track malloc contexts while in $1], [AC_DEFINE(TRACK_BLAME, 1)])]) +dnl --- *@-mdw_OPT_mLib_DEBUG-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_OPT_mLib_DEBUG(PROGRAM) +dnl +dnl Arguments: PROGRAM = name of this program or package. +dnl +dnl Use: Provides all of the above debugging options. + +AC_DEFUN([mdw_OPT_mLib_DEBUG], +[mdw_REQUIRE([mdw_OPT_NDEBUG]) +mdw_REQUIRE([mdw_OPT_mLib_TRACK], [$1])]) + +dnl --- *@-mdw_DEFINE_PATHS-@* +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_DEFINE_FILES(CODE) +dnl +dnl Arguments: CODE = shell script code to execute +dnl +dnl Use: Fixes up various variables so that pathname defines can be +dnl defined. Within CODE, you may use the following macros: +dnl +dnl mdw_PROG(NAME) Transformed program name +dnl +dnl mdw_PATH(PATH) Expanded path (may contain variables) +dnl +dnl mdw_DEFINE_PROG(SYMBOL, PROG) +dnl Define a symbol as a transformed +dnl program name. +dnl +dnl mdw_DEFINE_PATH(SYMBOL, NAME) +dnl Define a symbol as an expanded path + +AC_DEFUN([mdw_DEFINE_PATHS], +[mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix +mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'` +test "$prefix" = "NONE" && prefix=$ac_default_prefix +test "$exec_prefix" = "NONE" && exec_prefix=$prefix +$1 +prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix]) + +AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`]) +AC_DEFUN([mdw_PATH], [dnl +`t="$1"; dnl +while :; do dnl +case "$t" in dnl +*\\$[]*) t=\`eval echo "$t"\`;; dnl +*) break;; dnl +esac; done; dnl +echo "$t"`]) +AC_DEFUN([mdw_DEFINE_PROG], [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"])]) +AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"])]) + +dnl --- *@-mdw_DIR_TEXMF-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_DIR_TEXMF +dnl +dnl Arguments: --- +dnl +dnl Use: Sets the substitution `texmfdir' as a sensible TeX install +dnl tree. + +AC_DEFUN([mdw_DIR_TEXMF], [ +AC_ARG_WITH([texmfdir], +[ --with-texmfdir=DIR set the TeX install directory to DIR], +[texmfdir=$witharg], +[AC_MSG_CHECKING([where to put installed TeX files]) +mdw_DEFINE_PATHS([ +texmfdir='${datadir}/texmf' +for d in \ + '${datadir}/texmf' '${prefix}/lib/texmf' \ + '${prefix}/texmf' '${libdir}/lib/texmf'; do + if test -d "mdw_PATH([$d])"; then + texmfdir=$d + break + fi +done +AC_MSG_RESULT([$texmfdir])])]) +AC_SUBST(texmfdir)]) + dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*