dnl -*-autoconf-*- *@--GLOB-HEADER--@* 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 --- *@-mdw_AUTO_VERSION-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_AUTO_VERSION dnl dnl Arguments: --- dnl dnl Use: Defines an m4 macro AUTO_VERSION which contains the current dnl version number, worked out in some clever way. AC_DEFUN([mdw_AUTO_VERSION], [nobody cares...]) m4_define([mdw_AUTO_VERSION], [m4_define([AUTO_VERSION], m4_esyscmd([ ver=UNKNOWN for pre in ./ config/; do for post in "" .in; do try=${pre}auto-version${post} if test -x $try; then ver=$("$try"); break; fi done done echo -n "$ver" ]))]) dnl --- *@-mdw_LIBTOOL_VERSION_INFO-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_LIBTOOL_VERSION dnl dnl Arguments: --- dnl dnl Use: Decodes the PACKAGE_VERSION variable as a libtool dnl version-info string. Strictly speaking, this is very dnl naughty. AC_DEFUN([mdw_LIBTOOL_VERSION_INFO], [ set -- $(echo $PACKAGE_VERSION | sed 's:[^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$]:\1 \2 \3:' ) LIBTOOL_VERSION_INFO="$(expr $[]1 + $[]2):$[]3:$[]2" AC_SUBST([LIBTOOL_VERSION_INFO]) ]) dnl --- *@-mdw_SILENT_RULES-@* --- dnl dnl Author: Mark Wooding dnl dnl Synopsis: mdw_SILENT_RULES dnl dnl Arguments: --- dnl dnl Use: Enables the Automake `silent-rules' feature, if available. AC_DEFUN([mdw_SILENT_RULES], [ m4_ifdef([AM_SILENT_RULES], [ AM_SILENT_RULES([yes]) ], [ AC_SUBST([AM_DEFAULT_VERBOSITY], [1]) ]) ]) 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([\], [#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_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_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 --- *@-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----- That's all, folks --------------------------------- *@--GLOB-END--@*