summaryrefslogtreecommitdiff
path: root/Build/source/texk/m4
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2008-02-02 14:23:40 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2008-02-02 14:23:40 +0000
commitb12d337486bb1b532ff35ad73b39e547b0c80474 (patch)
treee7b80f7c37f28f03f2af4db043a351e43420bf5a /Build/source/texk/m4
parent7b6ec243e2c593053c0987fb720fe3fe565ce7fd (diff)
more autoconf updates
git-svn-id: svn://tug.org/texlive/trunk@6488 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/m4')
-rw-r--r--Build/source/texk/m4/ChangeLog6
-rw-r--r--Build/source/texk/m4/kpse_subdirs.m473
2 files changed, 79 insertions, 0 deletions
diff --git a/Build/source/texk/m4/ChangeLog b/Build/source/texk/m4/ChangeLog
index c2f9c8c4c75..d5e2a58e8e6 100644
--- a/Build/source/texk/m4/ChangeLog
+++ b/Build/source/texk/m4/ChangeLog
@@ -1,3 +1,9 @@
+2008-02-02 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * kpse_subdirs.m4 (new): Define KPSE_CONFIG_SUBDIRS, used in
+ ../configure.in and ../../configure.in in order to avoid shell
+ variables as arguments of AC_CONFIG_SUBDIRS.
+
2008-01-29 Peter Breitenlohner <peb@mppmu.mpg.de>
Support for autoconf-2.59+:
diff --git a/Build/source/texk/m4/kpse_subdirs.m4 b/Build/source/texk/m4/kpse_subdirs.m4
new file mode 100644
index 00000000000..70afe18fdac
--- /dev/null
+++ b/Build/source/texk/m4/kpse_subdirs.m4
@@ -0,0 +1,73 @@
+# Private macros for the kpathsea library.
+# by Peter Breitenlohner <peb@mppmu.mpg.de>
+# Copyright (C) 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# KPSE_CONFIG_SUBDIRS(PKGLIST, [DIR])
+# -----------------------------------
+# Specify optional subdirectories to be configured.
+# First the shell variable ESUBDIRS initialize (to empty). Then for
+# each PKG in PKGLIST, test if PKG (or optionally DIR/PKG) exists as
+# subdirectory of $srcdir and the value of the shell variable with_PKG
+# differs from "no"; if so append this subdirectoryi to the list of
+# subdirectories to be configured and to the shell variable ESUBDIRS.
+# Finally ESUBDIRS is AC_SUBSTed.
+#
+# Examples: KPSE_CONFIG_SUBDIRS([dialog lcdf-typetools], [utils]) is
+# roughly equivalent to the shell code
+# ESUBDIRS=
+# test -d utils || mkdir utils
+# for pkg in $PKGS; do
+# if test -d $srcdir/utils/$pkg; then
+# if eval "test \"`echo '$with_'${pkg}|sed 's/-/_/g'`\" != no"; then
+# ESUBDIRS="$ESUBDIRS utils/$pkg"
+# AC_CONFIG_SUBDIRS([utils/$pkg])
+# fi
+# fi
+# done
+# AC_SUBST(ESUBDIRS)
+# whereas KPSE_CONFIG_SUBDIRS([afm2pl bibtex8]) corresponds to
+# ESUBDIRS=
+# for pkg in $PKGS; do
+# if test -d $srcdir/utils/$pkg; then
+# if eval "test \"x`echo '$with_'${pkg}`\" != xno"; then
+# ESUBDIRS="$ESUBDIRS $pkg"
+# AC_CONFIG_SUBDIRS([$pkg])
+# fi
+# fi
+# done
+# AC_SUBST(ESUBDIRS)
+#
+# The main difference is that these macros replace the shell loop by
+# an M4 loop and therefore M4 variables (i.e., shell literals) are
+# passed as arguments to AC_CONFIG_SUBDIRS, as required by modern
+# versions of Autoconf and Automake.
+
+AC_DEFUN([KPSE_CONFIG_SUBDIRS],
+[ESUBDIRS=
+m4_ifval([$2], [test -d $2 || mkdir $2])
+AC_FOREACH([AC_Pkg], [$1],
+ [_KPSE_CONFIG_SUBDIR(m4_ifval([$2], [$2/])AC_Pkg,
+ [with_]m4_bpatsubst(AC_Pkg, [-], [_]))])
+AC_SUBST(ESUBDIRS)dnl
+])
+
+# _KPSE_CONFIG_SUBDIR(DIR, WITH_VAR)
+# ----------------------------------
+# See above; test if $srcdir/DIR exists and $WITH_VAR != no; if so
+# append DIR to the list of subdirectories to be configured.
+m4_define([_KPSE_CONFIG_SUBDIR],
+[if test -d $srcdir/$1; then
+ if test "x$[]$2" != xno; then
+ ESUBDIRS="$ESUBDIRS $1"
+ AC_CONFIG_SUBDIRS([$1])dnl
+ fi
+fi
+])
+