source: trunk/third/xml-i18n-tools/xml-i18n-toolize.in @ 15545

Revision 15545, 6.6 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15544, which included commits to RCS files with non-trunk default branches.
Line 
1#! /bin/sh
2# xml-i18n-toolize - Prepare a package to use xml-i18-tools.
3# @configure_input@
4# Copyright (C) 1996-1999 Free Software Foundation, Inc.
5# Copyright (C) 2001 Eazel, Inc.
6#
7# Originally based on libtoolize by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8#
9# Modified for xml-i18n-tools by Maciej Stachowiak <mjs@eazel.com>
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful, but
17# WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19# General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24#
25# As a special exception to the GNU General Public License, if you
26# distribute this file as part of a program that contains a
27# configuration script generated by Autoconf, you may include it under
28# the same distribution terms that you use for the rest of that program.
29
30# The name of this program.
31progname=`echo "$0" | sed 's%^.*/%%'`
32
33# Constants.
34PROGRAM=xml-i18n-toolize
35PACKAGE=@PACKAGE@
36VERSION=@VERSION@
37
38# Directory names.
39prefix=@prefix@
40datadir=@datadir@
41pkgdatadir=@pkgdatadir@
42
43dry_run=no
44help="Try \`$progname --help' for more information."
45rm="rm -f"
46ln_s="ln -s"
47cp="cp -f"
48mkdir="mkdir"
49
50# Global variables.
51automake=
52copy=
53force=
54status=0
55
56for arg
57do
58  case "$arg" in
59  --help)
60    cat <<EOF
61Usage: $progname [OPTION]...
62
63Prepare a package to use xml-i18n-tools.
64
65    --automake        work silently, and assume that Automake is in use
66-c, --copy            copy files rather than symlinking them
67    --debug           enable verbose shell tracing
68-n, --dry-run         print commands rather than running them
69-f, --force           replace existing files
70    --help            display this message and exit
71    --version         print version information and exit
72
73You must \`cd' to the top directory of your package before you run
74\`$progname'.
75EOF
76    exit 0
77    ;;
78
79  --version)
80    echo "$PROGRAM (GNU $PACKAGE) $VERSION"
81    exit 0
82    ;;
83
84  --automake)
85    automake=yes
86    ;;
87
88  -c | --copy)
89    ln_s=
90    ;;
91
92  --debug)
93    echo "$progname: enabling shell trace mode"
94    set -x
95    ;;
96
97  -n | --dry-run)
98    if test "$dry_run" != yes; then
99      dry_run=yes
100      rm="echo $rm"
101      test -n "$ln_s" && ln_s="echo $ln_s"
102      cp="echo $cp"
103      mkdir="echo mkdir"
104    fi
105    ;;
106
107  -f | --force)
108    force=yes
109    ;;
110
111  -*)
112    echo "$progname: unrecognized option \`$arg'" 1>&2
113    echo "$help" 1>&2
114    exit 1
115    ;;
116
117  *)
118    echo "$progname: too many arguments" 1>&2
119    echo "$help" 1>&2
120    exit 1
121    ;;
122  esac
123done
124
125if test ! -f configure.in; then
126  echo "$progname: \`configure.in' does not exist" 1>&2
127  echo "$help" 1>&2
128  exit 1
129fi
130
131
132files=`cd $pkgdatadir && ls`
133if test -z "$files"; then
134  echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2
135  exit 1
136fi
137files='xml-i18n-extract xml-i18n-merge xml-i18n-update'
138
139auxdir=.
140auxdirline=`egrep '^AC_CONFIG_AUX_DIR' configure.in 2>/dev/null`
141if test -n "$auxdirline"; then
142  # Handle explicit AC_CONFIG_AUX_DIR settings.
143  auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'`
144
145  if test "$auxdir" = "$auxdirline"; then
146    echo "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2
147    exit 1
148  else
149    # Strip any quote brackets.
150    auxdir=`echo "$auxdir" | sed 's/^\[\(.*\)\]$/\1/g'`
151    case "$auxdir" in
152    *\$*)
153      echo "$progname: cannot handle variables in AC_CONFIG_AUX_DIR" 1>&2
154      exit 1
155      ;;
156    *)
157    ;;
158    esac
159  fi
160else
161  # Try to discover auxdir the same way it is discovered by configure.
162  # Note that we default to the current directory.
163  for dir in . .. ../..; do
164    if test -f $dir/install-sh; then
165      auxdir=$dir
166      break
167    elif test -f $dir/install.sh; then
168      auxdir=$dir
169      break
170    fi
171  done
172fi
173
174if test -z "$automake"; then
175  if egrep '^A[MC]_PROG_XML_I18N_TOOLS' configure.in >/dev/null 2>&1; then :
176  else
177    echo "Remember to add \`AM_PROG_XML_I18N_TOOLS' to \`configure.in'."
178  fi
179
180  if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
181    updatemsg="update your \`aclocal.m4' by running aclocal"
182  else
183    updatemsg="add the contents of \`$xml_i18n_tools_m4' to \`aclocal.m4'"
184  fi
185
186  if egrep '^AC_DEFUN\(A[MC]_PROG_XML_I18NTOOLS' aclocal.m4 >/dev/null 2>&1; then
187    # Check the version number on xml-i18n-tools.m4 and the one used in aclocal.m4.
188    instserial=`grep '^# serial ' $xml_i18n_tools_m4 | grep 'A[MC]_PROG_XML_I18N_TOOLS' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
189
190    if test -z "$instserial"; then
191      echo "$progname: warning: no serial number on \`$xml_i18n_tools_m4'" 1>&2
192    else
193      # If the local macro has no serial number, we assume it's ancient.
194      localserial=`grep '^# serial ' aclocal.m4 | grep 'A[MC]_PROG_XML_I18N_TOOLS' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
195
196      test -z "$localserial" && localserial=0
197
198      if test "$localserial" -lt "$instserial"; then
199        echo "You should $updatemsg."
200      elif test "$localserial" -gt "$instserial"; then
201        echo "$progname: \`$xml_i18n_tools_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
202        if test -z "$force"; then
203          echo "Use \`--force' to replace newer xml-i18n-tools files with this version." 1>&2
204          exit 1
205        fi
206        echo "To remain compatible, you should $updatemsg."
207      fi
208    fi
209  else
210    echo "You should $updatemsg."
211  fi
212fi
213
214
215
216# Change to the auxiliary directory.
217if test "$auxdir" != .; then
218  test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
219  cd $auxdir || exit 1
220fi
221
222for file in $files; do
223  if test -f "$file" && test -z "$force"; then
224    test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
225    continue
226  fi
227
228  $rm $file
229  if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
230  elif $cp $pkgdatadir/$file $file; then :
231  else
232    echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
233    status=1
234  fi
235done
236
237#FIXME: probably does not work w/ builddir != srcdir
238if grep GENPOT po/Makefile.in.in >/dev/null;
239  then
240echo "no need for patching file \`Makefile.in.in'";
241  else patch po/Makefile.in.in < $pkgdatadir/xml-i18n-tools.Makefile.patch;
242fi
243
244exit $status
245
246# Local Variables:
247# mode:shell-script
248# sh-indentation:2
249# End:
Note: See TracBrowser for help on using the repository browser.