* m4/configmake.m4: New file. * modules/configmake (Files): Ship it. (configure.ac): Use it to guarantee fallbacks.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- > Okay, then, I'm back to trying to modify the configmake module's > configure.ac section, in a way that is friendly to the autotools already > providing a definition, and which allows use of these variables > throughout makefiles in addition to C files. How does this look? ChangeLog | 7 +++++++ m4/configmake.m4 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ modules/configmake | 5 ++++- 3 files changed, 61 insertions(+), 1 deletions(-) create mode 100644 m4/configmake.m4 diff --git a/ChangeLog b/ChangeLog index 62b9dca..a7f2b3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-12-14 Eric Blake <ebl...@redhat.com> + + configmake: provide fallbacks for oldest supported autotools + * m4/configmake.m4: New file. + * modules/configmake (Files): Ship it. + (configure.ac): Use it to guarantee fallbacks. + 2010-12-13 Eric Blake <ebl...@redhat.com> cloexec, fcntl: relax license diff --git a/m4/configmake.m4 b/m4/configmake.m4 new file mode 100644 index 0000000..2a364d7 --- /dev/null +++ b/m4/configmake.m4 @@ -0,0 +1,50 @@ +# configmake.m4 serial 1 +dnl Copyright (C) 2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_CONFIGMAKE_PREP +# ------------------ +# Guarantee all of the standard directory variables, even when used with +# autoconf 2.59 (datarootdir wasn't supported until 2.59c) or automake +# 1.9.6 (pkglibexecdir wasn't supported until 1.10b.). +AC_DEFUN([gl_CONFIGMAKE_PREP], +[ + dnl Technically, datadir should default to datarootdir. But if autoconf + dnl is too old to provide datarootdir, then reversing the definition is + dnl a reasonable compromise. Only AC_SUBST a variable if it was not + dnl already defined; autoconf AC_SUBSTs these values rather early. + if test "x$datarootdir" = x; then + AC_SUBST([datarootdir], ['${datadir}']) + fi + dnl Copy the alternate definition approach used in autoconf 2.60. + if test "x$docdir" = x; then + AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) + fi + dnl The remaining variables missing from autoconf 2.59 are easier. + if test "x$htmldir" = x; then + AC_SUBST([htmldir], ['${docdir}']) + fi + if test "x$dvidir" = x; then + AC_SUBST([dvidir], ['${docdir}']) + fi + if test "x$pdfdir" = x; then + AC_SUBST([pdfdir], ['${docdir}']) + fi + if test "x$psdir" = x; then + AC_SUBST([psdir], ['${docdir}']) + fi + if test "x$lispdir" = x; then + AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) + fi + if test "x$localedir" = x; then + AC_SUBST([localedir], ['${datarootdir}/locale']) + fi + + dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely + dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. + AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) +]) diff --git a/modules/configmake b/modules/configmake index d826c13..d4e9bfe 100644 --- a/modules/configmake +++ b/modules/configmake @@ -2,10 +2,12 @@ Description: Variables set by "configure" or "make". Files: +m4/configmake.m4 Depends-on: configure.ac: +gl_CONFIGMAKE_PREP Makefile.am: # Retrieve values of the variables through 'configure' followed by @@ -22,7 +24,8 @@ Makefile.am: # # Another advantage is that 'make' output is shorter. # -# Listed in the same order as the GNU makefile conventions. +# Listed in the same order as the GNU makefile conventions, and +# as provided by autoconf 2.60+. # The Automake-defined pkg* macros are appended, in the order # listed in the Automake 1.10a+ documentation. configmake.h: Makefile -- 1.7.3.3