dnl -*-fundamental-*- *@--GLOB-HEADER--@* dnl dnl $Id$ dnl dnl Common library of autoconf macros dnl dnl (c) 1997 Mark Wooding, except for macros and documentation where noted. dnl dnl----- Licensing notice --------------------------------------------------- dnl dnl This file is part of the Common Files Distribution (`common') dnl dnl `Common' is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl `Common' is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with `common'; if not, write to the Free Software Foundation, dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl *@--NOTICE--@* Common File Distribution dnl $Id$ 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], [Define if you have a curses library.])]) 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], [1], [Define if you have a `curses.h' header.]) 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], [Define to `int' if your system doesn't have ssize_t.]) 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], [1], [Define if you have the `environ' vector of environment variables.]) fi]) dnl --- *@-mdw_CHECK_MANYLIBS-@* --- dnl dnl Author: Mark Wooding dnl 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 dnl in LIBS in turn. If it finds a match, it adds the dnl appropriate library to `LIBS'. dnl 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_CACHE_CHECK([for library containing $1], [mdw_cv_lib_$1], [mdw_save_LIBS="$LIBS" mdw_cv_lib_$1="no" 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([$5], [$1($6)], [mdw_cv_lib_$1="-l$i" break]) done LIBS="$mdw_save_LIBS"]) if test "$mdw_cv_lib_$1" != "no"; then test "$mdw_cv_lib_$1" = "none required" || LIBS="$mdw_cv_lib_$1 $LIBS" $3 else : $4 fi]) dnl --- *@-mdw__PYTHON_VERSION-@* --- dnl dnl Will fail hopelessly on Python < 1.5.2. Nobody uses that any more, dnl right? AC_DEFUN([mdw__PYTHON_VERSION], [$1 -c 'from sys import *; v = argv[1]; vv = v.split("."); x = 0 for i in range(len(vv)): x = x | (int(vv[i]) << (24 - i * 8)) exit(x > hexversion)' $2]) dnl --- *@-mdw_PROG_PYTHON-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_PROG_PYTHON(VERSION, [IF-FOUND], [IF-NOT-FOUND]) dnl dnl Arguments: VERSION = version number of Python required dnl IF-FOUND = what to do if it's found dnl IF-NOT-FOUND = what to do if it isn't dnl dnl Use: Attempts to find a working version of Python with a late dnl enough version number. It supplies an option `--with-python' dnl to allow the user to provide a Python interpreter. If one dnl isn't provided explicitly, it searches for `python' and dnl `pythonVERSION' in the current PATH, asking them whether they dnl have a late enough version number. The path of the working dnl Python is put into the `PYTHON' environment variable; dnl `AC_SUBST' is used to substitute its value into Python dnl scripts. If there is no Python to be found, the value of dnl `PYTHON' is set to be `none'. AC_DEFUN([mdw_PROG_PYTHON], [AC_ARG_WITH([python], [ --with-python=PYTHON specify path to Python version $1 or newer], [PYTHON="$withval"], if test -z "$PYTHON"; then [AC_CACHE_CHECK([for Python version $1 or later], mdw_cv_prog_python, [mdw_cv_prog_python="none" for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do case $p in /*) ;; *) p=`pwd`/$p ;; esac if mdw__PYTHON_VERSION(["$p/python"], $1); then mdw_cv_prog_python="$p/python" break fi if mdw__PYTHON_VERSION(["$p/python$1"], $1); then mdw_cv_prog_python="$p/python$1" break fi done]) PYTHON="$mdw_cv_prog_python"]) fi AC_SUBST(PYTHON)dnl if test "$PYTHON" = "none"; then : $3 else : $2 fi]) dnl --- *@-mdw_CHECK_PYTHON-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_CHECK_PYTHON(VERSION) dnl dnl Arguments: VERSION = version number of Python required dnl dnl Use: Verifies that the Python interpreter in the `PYTHON' 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_PYTHON], [AC_REQUIRE([mdw_PROG_PYTHON], [mdw_PROG_PYTHON([$1])]) AC_MSG_CHECKING([whether Python ($PYTHON) works]) if test "$PYTHON" != "none" && mdw__PYTHON_VERSION("$PYTHON", $1); then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([Python version $1 or newer not found. If you have a recent enough Python, and I just failed to find it, try using the --with-python=PYTHON option to give me an explicit pathname.]) fi]) dnl --- *@-mdw__PERL_VERSION-@* --- dnl dnl AC_DEFUN relies on `[', `]' being quotes, so I have to drop down a level. AC_DEFUN([mdw__PERL_VERSION], [mdw__PERL_VERSION_hack([$1], [$2])]) changequote(<<, >>) define(<>, <<$1 -e 'exit ($] < $2);' >&5 2>&5>>) changequote([, ]) dnl --- *@-mdw_PROG_PERL-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_PROG_PERL(VERSION, [IF-FOUND], [IF-NOT-FOUND]) dnl dnl Arguments: VERSION = version number of Perl required dnl IF-FOUND = what to do if it's found dnl IF-NOT-FOUND = what to do if it isn't dnl dnl Use: Attempts to find a working version of Perl with a late dnl enough version number. It supplies an option `--with-perl' dnl to allow the user to provide a Perl interpreter. If one dnl isn't provided explicitly, it searches for `perl' and `perl5' dnl in the current PATH, asking them whether they have a late dnl enough version number. The path of the working Perl is 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_ARG_WITH([perl], [ --with-perl=PERL specify path to Perl version $1 or newer], [PERL="$withval"], if test -z "$PERL"; then [AC_CACHE_CHECK([for Perl version $1 or later], mdw_cv_prog_perl, [mdw_cv_prog_perl="none" for p in `echo "$PATH:/usr/local/bin" | tr ":" " "`; do case $p in /*) ;; *) p=`pwd`/$p ;; esac if mdw__PERL_VERSION(["$p/perl"], $1); then mdw_cv_prog_perl="$p/perl" break fi if mdw__PERL_VERSION(["$p/perl5"], $1); then mdw_cv_prog_perl="$p/perl5" break fi done]) PERL="$mdw_cv_prog_perl"]) fi AC_SUBST(PERL)dnl if test "$PERL" = "none"; then : $3 else : $2 fi]) dnl --- *@-mdw_CHECK_PERL-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_CHECK_PERL(VERSION) dnl dnl Arguments: VERSION = version number of Perl required dnl 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_REQUIRE([mdw_PROG_PERL], [mdw_PROG_PERL([$1])]) AC_MSG_CHECKING([whether Perl ($PERL) works]) if test "$PERL" != "none" && mdw__PERL_VERSION("$PERL", $1); then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) AC_MSG_ERROR([Perl version $1 or newer not found. If you have a recent enough Perl, and I just failed to find it, try using the --with-perl=PERL option to give me an explicit pathname.]) fi]) dnl --- *@-mdw_PERLLIB_CHECK-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_PERLLIB_CHECK(LIBRARY) dnl dnl Arguments: LIBRARY = name of a Perl library to check for dnl dnl Use: Ensures that a Perl script can `use LIBRARY;'. If it can, dnl all's well and good; if it can't, `LIBRARY.pm' is added to dnl the variable `NEEDED_PERLLIBS' and a line which adds dnl `pkgdatadir' to Perl's `@INC' array is placed in the dnl variable `INC_PERLLIBS'; `AC_SUBST' is called for both of dnl these variables. It's expected that `NEEDED_PERLLIBS' will dnl be used in the `Makefile.in' to decide which versions from dnl the distribution need installing. 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_SUBST(INC_PERLLIBS)dnl AC_SUBST(NEEDED_PERLLIBS)dnl ]) AC_DEFUN([mdw_PERLLIB_CHECK], [AC_REQUIRE([mdw__PERLLIB_INIT]) AC_REQUIRE([mdw_CHECK_PERL], [mdw_PROG_PERL([5])]) AC_CACHE_CHECK([for Perl library $1], mdw_cv_perllib_$1, [if $PERL -e 'use $1;' >&5 2>&5; then mdw_cv_perllib_$1="yes" else mdw_cv_perllib_$1="no" fi]) if test "$mdw_cv_perllib_$1" = "no"; then NEEDED_PERLLIBS="$NEEDED_PERLLIBS $1.pm" # --- Deal with autoconf lossage --- # # It doesn't want to define `prefix' until rather later on, so I have # to bodge it here. if test -z "$INC_PERLLIBS"; then mdw_old_prefix="$prefix" test "$prefix" = "NONE" && prefix="$ac_default_prefix"; INC_PERLLIBS="BEGIN { push @INC, \"`eval echo $datadir/$PACKAGE`\"; }" prefix="$mdw_old_prefix"; fi fi]) dnl --- *@-mdw_GCC_FLAGS-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS]) dnl dnl Arguments: FLAGS = GCC compiler flags to add (default is dnl `-pedantic -Wall') dnl CFLAGS = GCC C compiler flags to add (default is empty) dnl C++FLAGS = GCC C++ compiler flags to add (default is dnl `-fhandle-exceptions'). dnl dnl Use: If the C compiler is GCC, add the compiler flags. AC_DEFUN([mdw_GCC_FLAGS], [if test "$GCC" = "yes"; then CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])" fi if test "$GXX" = "yes"; then CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" 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], [AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])]) 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], [AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])]) 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], [AC_REQUIRE([mdw_MLIB], [mdw_MLIB([2.0.3])]) mdw_LIB_CONFIG(pk, PK, $@)]) dnl --- *@-mdw_OPT_NDEBUG-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_OPT_NDEBUG dnl dnl Arguments: --- dnl dnl Use: Turns on the `NDEBUG' flag, to disable useful things like dnl assertions. AC_DEFUN([mdw_OPT_NDEBUG], [AC_ARG_ENABLE(debugging, [ --disable-debugging spews vast swathes of useless information], [if test "$enableval" = "no"; then AC_DEFINE([NDEBUG], [1], [Define to turn off assertions and other debugging. Not recommended.]) fi])]) dnl --- *@-mdw_OPT_EFENCE-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_OPT_EFENCE dnl dnl Arguments: --- dnl dnl Use: Links with the Electric Fence library. 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_TRACE-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_OPT_TRACE dnl dnl Arguments: --- dnl 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], [Define to turn off tracing.]) 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-track turns on malloc tracking dnl --enable-blame-PROGRAM tracks malloc contexts in PROGRAM dnl 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], [Define to turn on memory tracking. Doesn't work properly.])]) AC_ARG_ENABLE(blame-$1, [ --enable-blame-$1 track malloc contexts while in $1], [AC_DEFINE([TRACK_BLAME], [1], [Define to track mallocs in this code.])])]) 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], [AC_REQUIRE([mdw_OPT_NDEBUG]) AC_REQUIRE([mdw_OPT_mLib_TRACK], [mdw_OPT_mLib_TRACK([$1])])]) dnl --- *@-mdw_DEFINE_PATHS-@* dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_DEFINE_PATHS(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])"], [Program name for $2.])]) AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"], [Pathname for $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=$withval], [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 --- *@-mdw_MANEXT-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_MANEXT dnl dnl Arguments: --- dnl dnl Use: Sets the substitution `manext' for man page extensions. AC_DEFUN([mdw_MANEXT], [ AC_ARG_WITH([man-ext], [ --with-man-ext=EXT give manpages the EXT extension (e.g., foo.3EXT)], [manext=$withval], [manext=mLib]) AC_SUBST(manext)]) dnl----- That's all, folks --------------------------------- *@--GLOB-END--@*