2 # intltoolize - Prepare a package to use intltool.
4 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
5 # Copyright (C) 2001 Eazel, Inc.
7 # Originally based on libtoolize by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9 # Modified for xml-i18n-tools by Maciej Stachowiak <mjs@noisehavoc.org>
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.
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.
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.
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.
30 # The name of this program.
31 progname=`echo "$0" | sed 's%^.*/%%'`
43 # Assume intltoolize is in $prefix/bin. Strip off the script name and the "bin"
45 prefix=`dirname $prefix`
49 datarootdir=@datarootdir@
51 pkgdatadir=@pkgdatadir@
53 aclocaldir=${datadir}/aclocal
54 intltool_m4="${aclocaldir}/intltool.m4"
57 help="Try '$progname --help' for more information."
63 mkinstalldirs="mkinstalldirs"
76 Usage: $progname [OPTION]...
78 Prepare a package to use intltool.
80 --automake work silently, and assume that Automake is in use
81 -c, --copy copy files rather than symlinking them
82 --debug enable verbose shell tracing
83 -n, --dry-run print commands rather than running them
84 -f, --force replace existing files
85 --help display this message and exit
86 --version print version information and exit
88 You must 'cd' to the top directory of your package before you run
95 echo "$PROGRAM (GNU $PACKAGE) $VERSION"
108 echo "$progname: enabling shell trace mode"
113 if test "$dry_run" != yes; then
116 rm_rec="echo $rm_rec"
117 test -n "$ln_s" && ln_s="echo $ln_s"
120 mkinstalldirs="echo $mkinstalldirs"
129 echo "$progname: unrecognized option '$arg'" 1>&2
135 echo "$progname: too many arguments" 1>&2
142 if test -f configure.ac; then
143 configure="configure.ac"
145 if test -f configure.in; then
146 configure="configure.in"
148 echo "$progname: neither 'configure.ac' nor 'configure.in' exists" 1>&2
155 files='po/Makefile.in.in'
157 if test -z "$automake"; then
158 if egrep '^(AC|IT)_PROG_INTLTOOL' $configure >/dev/null 2>&1; then :
160 echo "ERROR: 'IT_PROG_INTLTOOL' must appear in $configure for intltool to work."
164 if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
165 updatemsg="update your 'aclocal.m4' by running aclocal"
167 updatemsg="add the contents of '$intltool_m4' to 'aclocal.m4'"
170 if egrep '^AC_DEFUN\(\[IT_PROG_INTLTOOL\]' aclocal.m4 >/dev/null 2>&1; then
171 # Check the version number on intltool.m4 and the one used in aclocal.m4.
172 instserial=`grep '^# serial ' $intltool_m4 | grep 'IT_PROG_INTLTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
174 if test -z "$instserial"; then
175 echo "$progname: warning: no serial number on '$intltool_m4'" 1>&2
177 # If the local macro has no serial number, we assume it's ancient.
178 localserial=`grep '^# serial ' aclocal.m4 | grep 'IT_PROG_INTLTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
180 test -z "$localserial" && localserial=0
182 if test "$localserial" -lt "$instserial"; then
183 echo "You should $updatemsg."
184 elif test "$localserial" -gt "$instserial"; then
185 echo "$progname: '$intltool_m4' is serial $instserial, less than $localserial in 'aclocal.m4'" 1>&2
186 if test -z "$force"; then
187 echo "Use '--force' to replace newer intltool files with this version." 1>&2
190 echo "To remain compatible, you should $updatemsg."
194 echo "You should $updatemsg."
199 # Copy or symlink the Makefile.in.in
201 for file in $files; do
202 if test -f "$file" && test -z "$force"; then
203 test -z "$automake" && echo "$progname: '$file' exists: use '--force' to overwrite" 1>&2
208 if test -n "$ln_s" && $ln_s $pkgdatadir/`basename $file` $file; then :
209 elif $cp $pkgdatadir/`basename $file` $file; then :
211 echo "$progname: cannot copy '$pkgdatadir/`basename $file`' to '$file'" 1>&2
214 # Touch script names for backward compatibility
215 for script in intltool-extract.in intltool-merge.in intltool-update.in; do
216 # Always remove the script files now
218 if egrep $script Makefile.am >/dev/null 2>&1; then
225 # make sure this subshell exits with the exit value if it failed
229 # If the AC_CONFIG_MACRO_DIR() macro is used, copy intltool.m4 from our
230 # prefix to that directory. This makes sure that the M4 macro used
231 # matches the intltool scripts we install.
232 # If AC_CONFIG_MACRO_DIR is not used, things will behave as before (aclocal
233 # will be used to pull in the macro.
234 m4dir=`cat "$configure" | grep '^AC_CONFIG_MACRO_DIR' | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
235 if test -n "$m4dir"; then
236 rm -f $m4dir/intltool.m4
237 if test -n "$ln_s" && $ln_s $intltool_m4 $m4dir/intltool.m4; then :
238 elif $cp $intltool_m4 $m4dir/intltool.m4; then :
240 echo "$progname: cannot copy '$intltool_m4' to '$m4dir/intltool.m4'" 1>&2
246 # FIXME: This probably does not work w/ builddir != srcdir because it
247 # gets at source files relative to the current directory.
249 grep INTLTOOL_MAKEFILE po/Makefile.in.in >/dev/null || {
250 echo "$progname: 'po/Makefile.in.in' is out of date: use '--force' to overwrite"