From 1f79a056146f0b172111b8379ccc344002848e66 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 27 Feb 2008 09:40:21 +0000 Subject: [PATCH] Generally bring up-to-date. * Remove lots of macros from aclocal.glob, since there are better versions of most of them in the Autoconf archive. * Introduce mdw_AUTO_VERSION for extracting version numbers from various places, such as Git tags or Debian revision logs. * Bring things up-to-date for modern autotools. Also strip off redundant and annoying `$Id$' tags. --- .gitignore | 2 +- Makefile.am | 15 +- aclocal.glob | 634 +++---------------------------------------- build-setup | 4 + common.texi | 98 +------ configure.in => configure.ac | 18 +- debian/changelog | 8 + findlinks.in | 3 +- gpl.tex | 2 - lgpl.tex | 2 - lib-config.in | 98 ------- mdw-setup | 11 +- mdwopt.c | 2 - mdwopt.h | 2 - mkaclocal.in | 194 ------------- mklinks.in | 3 +- texinice.tex | 2 - txtlib.in | 125 --------- 18 files changed, 81 insertions(+), 1142 deletions(-) create mode 100755 build-setup rename configure.in => configure.ac (80%) delete mode 100755 lib-config.in delete mode 100755 mkaclocal.in delete mode 100755 txtlib.in diff --git a/.gitignore b/.gitignore index d317553..336a211 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ mkinstalldirs autom4te.cache missing install-sh - +acinclude.m4 diff --git a/Makefile.am b/Makefile.am index 3e021de..7dcce91 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,8 +1,6 @@ ## Process this file with Automake to generate `Makefile.in' ## -*-Makefile-*- ## -## $Id$ -## ## Building the distribution ## ## (c) 1997 Mark Wooding @@ -26,30 +24,29 @@ ## along with `common'; if not, write to the Free Software Foundation, ## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## --- Options --- - -AUTOMAKE_OPTIONS = foreign - ## --- What needs building --- -bin_SCRIPTS = mklinks findlinks txtlib mkaclocal mdw-setup +bin_SCRIPTS = mklinks findlinks mdw-setup ## --- Files to install in the repository --- pkgdata_DATA = \ COPYING COPYING.LIB INSTALL \ gpl.tex lgpl.tex gpl.texi lgpl.texi texinice.tex \ - lib-config.in \ mdwopt.c mdwopt.h \ getdate.y getdate.h EXTRA_DIST = \ - $(pkgdata_DATA) $(pkgdata_SCRIPTS) \ + aclocal.glob \ + $(pkgdata_DATA) $(pkgdata_SCRIPTS) mdw-setup \ debian/control debian/copyright debian/rules debian/changelog pkgdata_SCRIPTS = \ install-ac maninst +dist-hook: + echo $(VERSION) >$(distdir)/RELEASE + install-data-hook: $(mkinstalldirs) $(DESTDIR)$(aclocaldir) $(srcdir)/install-ac install \ diff --git a/aclocal.glob b/aclocal.glob index bce4c97..283f695 100644 --- a/aclocal.glob +++ b/aclocal.glob @@ -1,6 +1,4 @@ -dnl -*-fundamental-*- *@--GLOB-HEADER--@* -dnl -dnl $Id$ +dnl -*-autoconf-*- *@--GLOB-HEADER--@* dnl dnl Common library of autoconf macros dnl @@ -10,83 +8,69 @@ dnl dnl----- Licensing notice --------------------------------------------------- dnl dnl This file is part of the Common Files Distribution (`common') -dnl +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 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 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 --- *@-mdw_AUTO_VERSION-@* --- dnl dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_CURSES +dnl Synopsis: mdw_AUTO_VERSION 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], [1], - [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 Use: Defines an m4 macro AUTO_VERSION which contains the current +dnl version number, worked out in some clever way. + +dnl AC_DEFUN([mdw_AUTO_VERSION], [nobody cares...]) +m4_define([mdw_AUTO_VERSION], [m4_define([AUTO_VERSION], m4_esyscmd([ + if test -d .git && version=$(git describe --abbrev=4 2>/dev/null); then + case "$(git diff-index --name-only HEAD)" in + "") ;; *) version="$version+" ;; + esac + elif cat RELEASE 2>/dev/null; then + version=$(cat RELEASE) + elif test -f debian/changelog; then + version=$(sed -n '/^.*(\(.*\)).*$/ { s::\1:p; q; }' debian/changelog) + else + echo UNKNOWN + fi + echo -n $version +]))]) -dnl --- *@-mdw_TYPE_SSIZE_T-@* --- +dnl --- *@-mdw_LIBTOOL_VERSION_INFO-@* --- dnl dnl Author: Mark Wooding dnl -dnl Synopsis: mdw_TYPE_SSIZE_T +dnl Synopsis: mdw_LIBTOOL_VERSION dnl dnl Arguments: --- dnl -dnl Use: Checks whether the Posix type `ssize_t' is defined. If not, -dnl it defaults to `int'. +dnl Use: Decodes the PACKAGE_VERSION variable as a libtool +dnl version-info string. Strictly speaking, this is very +dnl naughty. -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]) +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_DECL_ENVIRON-@* --- dnl @@ -102,7 +86,7 @@ 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([\], +[AC_EGREP_CPP([\], [#include #if HAVE_UNISTD_H #include @@ -116,519 +100,6 @@ if test $mdw_cv_environ = yes; then [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], -[changequote(<:, :>)dnl -test -x $1 && dnl -"$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)' $2dnl -changequote([, ])]) - -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(<:mdw__PERL_VERSION_hack:>, -<:test -x $1 && $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 @@ -668,41 +139,12 @@ case "$t" in dnl *) break;; dnl esac; done; dnl echo "$t"`]) -AC_DEFUN([mdw_DEFINE_PROG], +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 diff --git a/build-setup b/build-setup new file mode 100755 index 0000000..b923188 --- /dev/null +++ b/build-setup @@ -0,0 +1,4 @@ +#! /bin/sh + +set -e +ln -sf aclocal.glob acinclude.m4 diff --git a/common.texi b/common.texi index 377058e..8336428 100644 --- a/common.texi +++ b/common.texi @@ -1,7 +1,5 @@ \input texinfo.tex @c -*-texinfo-*- @c -@c $Id: common.texi,v 1.2 2003/11/09 16:12:11 mdw Exp $ -@c @c Documentation for `common' @c @c (c) 1997 Mark Wooding @@ -128,8 +126,8 @@ Distribution. * Copying:: * Introduction:: * The file repository:: -* Text libraries:: +@detailmenu --- The Detailed Node Listing --- The file repository @@ -137,10 +135,7 @@ The file repository * The mklinks command:: * The findlinks command:: -Text libraries - -* Anatomy:: Structure of a text library. -* The txtlib program:: +@end detailmenu @end menu @c -------------------------------------------------------------------------- @@ -172,7 +167,7 @@ used as the basis of other similar scripts. @c -------------------------------------------------------------------------- -@node The file repository, Text libraries, Introduction, Top +@node The file repository, , Introduction, Top @chapter The file repository @@ -234,93 +229,6 @@ by default: findlinks >.links @end example - -@c -------------------------------------------------------------------------- -@node Text libraries, , The file repository, Top -@chapter Text libraries - - -Just being able to share files isn't always good enough: it's sometimes -useful to able to share small parts of files. The Common Files Distribution -comes with a simple system for extracting requested parts from a @dfn{text -library}. - - -@menu -* Anatomy:: Structure of a text library. -* The txtlib program:: -@end menu - - - -@node Anatomy, The txtlib program, Text libraries, Text libraries -@section Anatomy of a library file - -Text libraries contain a @dfn{header} followed by a number of @dfn{chunks}. -The start of a chunk is marked by a line containing a string of the form -@samp{*@@-@var{name}-@@*}; the chunk continues until the start of the next -chunk, or the end of the file. The header is simply the text preceding the -first chunk. - -Here's a simple example of a text library. - -@example -% -*-tex-*- -% -% Collection of useful macros -% - -% *@@-todo-@@* - -\newcommand\todo[1]@{% - \par% - \dimen@@\linewidth% - \advance\dimen@@-\tw@@\fboxsep% - \advance\dimen@@-\tw@@\fboxrule% - \fbox@{\expandafter\parbox\expandafter@{\the\dimen@@@}@{% - \begin@{note@}[To do:]% - #1% - \end@{note@}% - @}@}% - \par% -@} - -% *@@-indexing-@@* - -\newindex@{default@}@{idx@}@{ind@}@{Index@} -\atdef^@{\index@} -\atdef_@{\index*@} -@end example - -The file contains a short header containing a line to tell Emacs what mode -to use when editing it and a brief description of the file. It contains two -chunks, named @code{todo} and @code{indexing} - - -@node The txtlib program, , Anatomy, Text libraries -@section The @code{txtlib} program - -The @code{txtlib} program can be used to perform some simple operations on -text libraries: - -@example -txtlib [-x] [-o @var{file}] @var{library}... -txtlib -l @var{library}... -@end example - -By default, or if the @code{-x} option is given, @code{txtlib} extracts -chunks from libraries. It reads a list of chunk names from standard input, -one per line. It then examines each @var{library} named on the command line, -and extracts the requested chunks, writing them to standard output, or to a -named file. Note that the chunks are extracted in the order they appear in -the libraries, not the order in which their chunk names were listed. - -If the @code{-l} option is given, @code{txtlib} scans each @var{library} in -turn, writing the names of all the chunks it finds to standard output. - - - - @c -------------------------------------------------------------------------- @contents diff --git a/configure.in b/configure.ac similarity index 80% rename from configure.in rename to configure.ac index e30c30a..4f3c066 100644 --- a/configure.in +++ b/configure.ac @@ -1,6 +1,4 @@ -dnl -*-m4-*- -dnl -dnl $Id$ +dnl -*-autoconf-*- dnl dnl Configuring the Common Files Distribution dnl @@ -25,11 +23,17 @@ 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. -AC_INIT(mklinks.in) -AM_INIT_AUTOMAKE(common, 1.2.10) +mdw_AUTO_VERSION +AC_INIT([Common Files Distribution], AUTO_VERSION, + [mdw@distorted.org.uk], [cfd]) +AM_INIT_AUTOMAKE([foreign]) +AC_CONFIG_SRCDIR([mdw-setup]) + AC_CACHE_CHECK([where to stash Autoconf macros], [aclocaldir], [ aclocaldir=`aclocal --print-ac-dir` if test $? -ne 0; then AC_MSG_ERROR([aclocal not installed]); fi ]) -AC_SUBST(aclocaldir) -AC_OUTPUT(Makefile mklinks findlinks txtlib mkaclocal) +AC_SUBST([aclocaldir]) + +AC_CONFIG_FILES([Makefile mklinks findlinks]) +AC_OUTPUT diff --git a/debian/changelog b/debian/changelog index d9bd330..e0bd83f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +cfd (1.3.0) experimental; urgency=low + + * Brought up-to-date with modern Autotools. + * Tool for setting up projects straight from Git repositories. + * Various bug fixes. + + -- Mark Wooding Sat, 09 Feb 2008 23:08:39 +0000 + cfd (1.2.10) experimental; urgency=low * Fix for newer Autoconf and Automake: don't duplicate files shipped diff --git a/findlinks.in b/findlinks.in index dc5790f..13380be 100755 --- a/findlinks.in +++ b/findlinks.in @@ -1,8 +1,6 @@ #! /bin/sh # -*-sh-*- # -# $Id: findlinks.in,v 1.3 2004/04/08 01:36:24 mdw Exp $ -# # Find files which could be links to the repository # # (c) 1997 Mark Wooding @@ -29,6 +27,7 @@ # --- Configuration variables --- prefix=@prefix@ +datarootdir=@datarootdir@ datadir=@datadir@/@PACKAGE@ # --- Parse command line arguments --- diff --git a/gpl.tex b/gpl.tex index de5bd11..191ced9 100644 --- a/gpl.tex +++ b/gpl.tex @@ -1,7 +1,5 @@ % \iffalse % -% $Id: gpl.tex,v 1.2 2004/04/08 01:36:24 mdw Exp $ -% % The GNU General Public License as a LaTeX section % % (c) 1989, 1991 Free Software Foundation, Inc. diff --git a/lgpl.tex b/lgpl.tex index 554079b..2f850fc 100644 --- a/lgpl.tex +++ b/lgpl.tex @@ -1,7 +1,5 @@ % \iffalse % -% $Id: lgpl.tex,v 1.2 2004/04/08 01:36:24 mdw Exp $ -% % The GNU Library General Public License as a LaTeX section % % (c) 1989, 1991 Free Software Foundation, Inc. diff --git a/lib-config.in b/lib-config.in deleted file mode 100755 index b0358d6..0000000 --- a/lib-config.in +++ /dev/null @@ -1,98 +0,0 @@ -#! /bin/sh -# -# $Id: lib-config.in,v 1.3 2004/04/08 01:36:24 mdw Exp $ -# -# Provide configuration information for library clients -# -# (c) 1999 Straylight/Edgeware -# - -#----- Licensing notice ----------------------------------------------------- -# -# This file is part of the Common Files Distribution (`common'). -# -# `Common' is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# `Common' is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with `common'; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#----- Configuration -------------------------------------------------------- - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -archincludedir=${libdir}/@LIBRARY@/include - -VERSION=@VERSION@ - -#----- Command-line parsing and output -------------------------------------- - -ego=`echo "$0" | sed 's:.*/::'` - -if [ -z "${1+x}" ]; then - echo >&2 "Usage: $ego OPTION" - echo >&2 "Run \`$ego --help' for more information." - exit 1 -fi - -case "$1" in - --help) - cat <&2 "$ego: unrecognized option \`$1'" - exit 1 -esac - -#----- That's all, folks ---------------------------------------------------- diff --git a/mdw-setup b/mdw-setup index 276b6da..f3ffe95 100755 --- a/mdw-setup +++ b/mdw-setup @@ -36,6 +36,9 @@ fi ### Link any strange common files we need [ -f .links ] && mklinks +### Do any local stuff +[ -x build-setup ] && ./build-setup start + ### Grind through the Autoconf machinery configure= for i in configure.ac configure.in; do @@ -49,11 +52,13 @@ if [ "$configure" ]; then m4 Makefile.m4 >Makefile.am.new && mv Makefile.am.new Makefile.am) done - mkaclocal + aclocalargs= + for i in config m4; do [ -d $i ] && aclocalargs="$aclocalargs -I $i"; done + aclocal $aclocalargs autoconf grep >/dev/null AM_CONFIG_HEADER $configure && autoheader [ -f Makefile.am ] && automake -a fi -### Maybe make a build directory -[ $debian = no ] && [ ! -e build ] && mkdir build +### Do any local stuff +[ -x build-setup ] && ./build-setup end diff --git a/mdwopt.c b/mdwopt.c index 631dae6..fc76635 100644 --- a/mdwopt.c +++ b/mdwopt.c @@ -1,7 +1,5 @@ /* -*-c-*- * - * $Id: mdwopt.c,v 1.10 2004/04/08 01:36:24 mdw Exp $ - * * Options parsing, similar to GNU @getopt_long@ * * (c) 1996 Straylight/Edgeware diff --git a/mdwopt.h b/mdwopt.h index 1cfff62..ba3a024 100644 --- a/mdwopt.h +++ b/mdwopt.h @@ -1,7 +1,5 @@ /* -*-c-*- * - * $Id: mdwopt.h,v 1.10 2004/04/08 01:36:24 mdw Exp $ - * * Options parsing, similar to GNU @getopt_long@ * * (c) 1996 Straylight/Edgeware diff --git a/mkaclocal.in b/mkaclocal.in deleted file mode 100755 index a511923..0000000 --- a/mkaclocal.in +++ /dev/null @@ -1,194 +0,0 @@ -#! /bin/sh -# -*-sh-*- -# -# $Id: mkaclocal.in,v 1.2 1997/09/11 09:06:33 mdw Exp $ -# -# Create an `aclocal.m4' file containing the right macros. -# -# (c) 1997 Mark Wooding -# - -#----- Licensing notice ----------------------------------------------------- -# -# This file is part of the Common Files Distribution (`common'). -# -# `Common' is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# `Common' is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with `common'; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -set -e - -# --- Configuration variables --- - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -datadir=@datadir@/@PACKAGE@ - -# --- Parse command line --- - -mode=x -out="aclocal.m4" -in="configure.in" -stdlib=true - -while [ $# -gt 0 ]; do - case $1 in - -h | --h | --he | --hel | --help) - cat <&2 - exit 1 - ;; - *) - break - ;; - esac - shift -done - -if $stdlib; then - set -- \ - `test -r $datadir/aclocal.site && echo "$datadir/aclocal.site"` \ - `test -r ./aclocal.lib && echo "./aclocal.lib"` \ - "$@" -else - set -- \ - `test -r ./aclocal.lib && echo "./aclocal.lib"` \ - "$@" -fi - -# --- Now do the job --- - -case $mode in - - l) - $bindir/txtlib -l "$@" | sort | uniq - ;; - - x) - t=${TMPDIR-/tmp}/mkaclocal.$$ - doaclocal=false - if $stdlib && [ $out = aclocal.m4 ]; then - doaclocal=true - out=acinclude.m4 - fi - if mkdir -m700 $t; then : - else - echo >&2 "mkaclocal: cculd not create temporary directory" - exit 1 - fi - echo -NOTICE- >$t/a - created=no - - $bindir/txtlib -l "$@" | sort | uniq | while read LINE; do - echo "/$LINE/ i\\ -$LINE" - done >$t/sed - - until { echo -NOTICE-; sed -n -f $t/sed $in; } | sort | uniq >$t/b - cmp -s $t/a $t/b - do - $bindir/txtlib "$@" <$t/b >$out.tmp - in=$out.tmp - mv $t/b $t/a - created=yes - done - - if [ "$created" = "yes" ]; then - { test -r ./aclocal.lib && - grep "\*@--TOP--@\*" ./aclocal.lib >/dev/null && - sed -e "/\*@--TOP--@\*/, $ d" ./aclocal.lib - cat $out.tmp - } >$out.new - mv $out.new $out - else - rm -f $out - fi - - rm -fr $t $out.tmp - if $doaclocal; then aclocal; fi - ;; -esac diff --git a/mklinks.in b/mklinks.in index d41ac83..af3ac2c 100755 --- a/mklinks.in +++ b/mklinks.in @@ -2,8 +2,6 @@ # -*-sh-*- # -# $Id: mklinks.in,v 1.4 1997/09/11 09:06:34 mdw Exp $ -# # Create links to the repository # # (c) 1997 Mark Wooding @@ -30,6 +28,7 @@ # --- Configuration variables --- prefix=@prefix@ +datarootdir=@datarootdir@ datadir=@datadir@/@PACKAGE@ # --- Parse command line arguments --- diff --git a/texinice.tex b/texinice.tex index b31dce9..bb2b678 100644 --- a/texinice.tex +++ b/texinice.tex @@ -1,7 +1,5 @@ @tex % -*-tex-*- % -% $Id: texinice.tex,v 1.2 2004/04/08 01:36:24 mdw Exp $ -% % Make Texinfo printed output look nice % % (c) 1998 Mark Wooding diff --git a/txtlib.in b/txtlib.in deleted file mode 100755 index da2abcd..0000000 --- a/txtlib.in +++ /dev/null @@ -1,125 +0,0 @@ -#! /bin/sh - -# -*-sh-*- -# -# $Id: txtlib.in,v 1.5 2004/04/08 01:36:24 mdw Exp $ -# -# Manipulate simple libraries of text chunks -# -# (c) 1997 Mark Wooding -# - -#----- Licensing notice ----------------------------------------------------- -# -# This file is part of the Common Files Distribution (`common'). -# -# `Common' is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# `Common' is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with `common'; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -set -e - -# --- Handle command line arguments --- - -files="" -mode=x -out="" - -# --- Parse command line arguments --- - -while [ $# -gt 0 ]; do - case $1 in - -h | --h | --he | --hel | --help) - cat <&2 - exit 1 - ;; - *) - break - ;; - esac - shift -done - -test "$out" = "-" && out="" - -# --- Build a `sed' script --- - -case $mode in - l) - sed -n -e "/^.*\*@-\([-a-zA-Z0-9_]*\)-@\*.*$/ s//\1/p" /dev/null "$@" - ;; - x) - t=${TMPDIR-/tmp}/txtlib.$$ - if mkdir -m 700 $t; then : - else - echo >&2 "txtlib: could not create temporary directory" - exit 1 - fi - sedfile=/$t/sed - while read LINE; do - echo "/\*@-$LINE-@\*/,/\*@-#-@\*/ p" - done >$sedfile - test -z "$out" || exec >"$out" - sed -e '/\*@-[-a-zA-Z0-9_]*-@\*/ i\ - *@-#-@*' /dev/null "$@" | sed -n -f $sedfile | sed -e '/\*@-#-@\*/ d' - rm -rf $t - ;; -esac -- 2.11.0