summaryrefslogtreecommitdiff
path: root/Build/source/reautoconf
blob: 85c80c0cf0e037cc359b4b72fcba765a46fb3e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#! /bin/sh

# $Id$
# This "reautoconf" script found at the root of the TeX Live source tree 
# runs aclocal and autoconf (from PATH) in all relevant directories.
#
# Copyright 2008 Karl Berry.
# Copyright 2005 Olaf Weber.
# Copyright 2004 - 2008 Peter Breitenlohner.
#
# This program 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.
#
# This program 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 this library; if not, see <http://www.gnu.org/licenses/>.

unset CDPATH

usage="Usage: $0 [OPTION]...
  Run \`aclocal' (if applicable) and \`autoconf' for a
  selection of packages in the TeX Live source tree.

Options:
  -h, --help      display this help and exit successfully
  -f, --force     include some optional packages
  -n, --dry-run   don't run any commands; just print them
  -q, --quiet     don't echo commands
  -v, --verbose   verbosely report processing (default)

Selection:
  packages using KPSE macros are included
  packages using automake are excluded
  packages using GNU autoconf 2.60 or later:
    with \`--force' included, otherwise excluded
  packages using old autoconf versions are excluded

Environment variables:
  TL_AUTOCONF: program to use instead of autoconf from PATH
  TL_ACLOCAL:  program to use instead of aclocal from PATH"

force=no
do_cmd=
do_say=echo

for option
do
  case $option in
    -h | --help) echo "$usage"; exit 0
      ;;
    -f | --force) force=yes
      ;;
    -n | --dry-run) do_cmd=:
      ;;
    -q | --quiet) do_say=:
      ;;
    -v | --verbose) do_say=echo
      ;;
    *) echo "$0: *** unrecognized option \`$option'"
      echo "$usage"; exit 1
      ;;
  esac
done

[ "$do_cmd" = : ] && do_say=echo	# -n implies -v

[ -f ./texk/make/common.mk ] || {
	echo "$0: *** can't find ./texk/make/common.mk (from `pwd`)" >&2
	exit 1
}

: ${TL_AUTOCONF=autoconf}
echo "$0: using \"$TL_AUTOCONF\" = `$TL_AUTOCONF --version | sed 1q`"
echo "$0: if you want to use a different autoconf, set TL_AUTOCONF."
: ${TL_ACLOCAL=aclocal}
echo "$0: using \"$TL_ACLOCAL\" = `$TL_ACLOCAL --version | sed 1q`"
echo "$0: if you want to use a different aclocal, set TL_ACLOCAL."

sleep 5		# Give users a chance to cancel and set TL_AUTOCONF and/or TL_ACLOCAL

do_it () {
  $do_say "$0: running \"$@\""
  $do_cmd "$@"
}

# process one directory
do_one () {	# $base=configure.{in,ac}, $dir=current, $dir/$rdir->./texk/m4 with the KPSE macros
  if grep 'AM_INIT_AUTOMAKE' $base >/dev/null 2>&1; then
    $do_say "$0: $dir/$base ... uses automake, skipped."
  elif grep 'm4_include(\['$rdir'/kpse_.*\.m4])' aclocal.m4 >/dev/null 2>&1; then
    $do_say "$0: $dir/$base ... uses KPSE macros"
    do_it $TL_ACLOCAL -I $rdir
    do_it $TL_AUTOCONF
  elif grep '# Generated by GNU Autoconf 2.6' configure >/dev/null 2>&1; then
    if test "$force" = yes; then
      $do_say "$0: $dir/$base ... uses modern autoconf, forced"
      do_it $TL_AUTOCONF
    else
      $do_say "$0: $dir/$base ... uses modern autoconf, skipped"
    fi
  else
    $do_say "$0: $dir/$base ... uses older autoconf, skipped."
  fi
}

# Autoconf in . (the top level).
base=configure.in dir=. rdir=texk/m4
do_one

# Autoconf in all other directories
for base in configure.{in,ac}; do
  for dir in `find utils libs texk -name $base | sed "s,/$base\$,,"`; do
    case $dir in
      texk)
        rdir=m4
      ;;
      texk/*)
        rdir=`echo $dir | sed -e 's,^texk/,,' -e 's,[^/]*,..,g'`/m4
      ;;
      *)
        rdir=`echo $dir | sed 's,[^/]*,..,g'`/texk/m4
      ;;
    esac
    (cd $dir; do_one)
  done
done

echo "$0: done."