3 # Copyright (C) 1995-1998, 2000-2005 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # This file is meant for authors or maintainers which want to
21 # internationalize their package with the help of GNU gettext. For
22 # further information how to use it consult the GNU gettext manual.
29 # - gettext_dir directory where the sources are stored.
31 gettext_dir
="@datadir@/gettext"
34 # creates a temporary directory.
36 # - tmp pathname of freshly created temporary directory
39 # Use the environment variable TMPDIR, falling back to /tmp. This allows
40 # users to specify a different temporary directory, for example, if their
41 # /tmp is filled up or too small.
44 # Use the mktemp program if available. If not available, hide the error
46 tmp
=`(umask 077 && mktemp -d -q "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
47 test -n "$tmp" && test -d "$tmp"
50 # Use a simple mkdir command. It is guaranteed to fail if the directory
51 # already exists. $RANDOM is bash specific and expands to empty in shells
52 # other than bash, ksh and zsh. Its use does not increase security;
53 # rather, it minimizes the probability of failure in a very cluttered /tmp
55 tmp
=$TMPDIR/gt$$
-$RANDOM
56 (umask 077 && mkdir
"$tmp")
59 echo "$0: cannot create a temporary directory in $TMPDIR" >&2
64 # Support for relocatability.
65 func_find_curr_installdir
()
67 # Determine curr_installdir, even taking into account symlinks.
69 case "$curr_executable" in
71 *) # Need to look in the PATH.
72 if test "${PATH_SEPARATOR+set}" != set; then
74 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
75 chmod +x
"$tmp"/conf.sh
76 if (PATH
="/nonexistent;$tmp"; conf.sh
) >/dev
/null
2>&1; then
83 save_IFS
="$IFS"; IFS
="$PATH_SEPARATOR"
86 test -z "$dir" && dir
=.
87 for exec_ext
in ''; do
88 if test -f "$dir/$curr_executable$exec_ext"; then
89 curr_executable
="$dir/$curr_executable$exec_ext"
98 case "$curr_executable" in
100 *) curr_executable
=`pwd`/"$curr_executable" ;;
104 lsline
=`LC_ALL=C ls -l "$curr_executable"`
107 curr_executable
=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`/`echo "$lsline" | sed -n -e 's,^.* -> \(.*\),\1,p'` ;;
111 curr_installdir
=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
113 curr_installdir
=`cd "$curr_installdir" && pwd`
115 func_find_prefixes
()
117 # Compute the original/current installation prefixes by stripping the
118 # trailing directories off the original/current installation directories.
119 orig_installprefix
="$orig_installdir"
120 curr_installprefix
="$curr_installdir"
122 orig_last
=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
123 curr_last
=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
124 if test -z "$orig_last" ||
test -z "$curr_last"; then
127 if test "$orig_last" != "$curr_last"; then
130 orig_installprefix
=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
131 curr_installprefix
=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
134 if test "@RELOCATABLE@" = yes; then
135 exec_prefix
="@exec_prefix@"
137 orig_installdir
="$bindir" # see Makefile.am's *_SCRIPTS variables
138 func_find_curr_installdir
# determine curr_installdir
140 # Relocate the directory variables that we use.
141 gettext_dir
=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
145 # outputs to stdout the --help usage message.
149 Usage: gettextize [OPTION]... [package-dir]
151 Prepares a source package to use gettext.
154 --help print this help and exit
155 --version print version information and exit
156 -c, --copy copy files instead of making symlinks
157 -f, --force force writing of new files even if old exist
158 --intl install libintl in a subdirectory
159 --no-changelog don't update or create ChangeLog files
160 -n, --dry-run print modifications but don't perform them
162 Report bugs to <bug-gnu-gettext@gnu.org>."
166 # outputs to stdout the --version message.
169 echo "$progname (GNU $package) $version"
170 echo "Copyright (C) 1995-1998, 2000-2005 Free Software Foundation, Inc.
171 This is free software; see the source for copying conditions. There is NO
172 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
173 echo "Written by" "Ulrich Drepper"
176 # func_fatal_error message
177 # outputs to stderr a fatal error message, and terminates the program.
180 echo "gettextize: *** $1" 1>&2
181 echo "gettextize: *** Stop." 1>&2
186 (unset CDPATH
) >/dev
/null
2>&1 && unset CDPATH
188 # Command-line option processing.
189 # Removes the OPTIONS from the arguments. Sets the variables:
190 # - force 1 if --force was given, 0 otherwise
191 # - intldir yes if --intl was given, empty otherwise
192 # - try_ln_s false if --copy was given, : otherwise
193 # - do_changelog false if --no-changelog was given, : otherwise
194 # - doit false if --dry-run was given, : otherwise
202 while test $# -gt 0; do
204 -c |
--copy |
--cop |
--co |
--c )
207 -n |
--dry-run |
--dry-ru |
--dry-r |
--dry- |
--dry |
--dr |
--d )
210 -f |
--force |
--forc |
--for |
--fo |
--f )
213 --help |
--hel |
--he |
--h )
214 func_usage
; exit 0 ;;
215 --intl |
--int |
--in |
--i )
218 --no-changelog |
--no-changelo |
--no-changel |
--no-change |
--no-chang |
--no-chan |
--no-cha |
--no-ch |
--no-c )
220 do_changelog
=false
;;
221 --version |
--versio |
--versi |
--vers |
--ver |
--ve |
--v )
224 -- ) # Stop option prcessing
227 echo "gettextize: unknown option $1" 1>&2
228 echo "Try 'gettextize --help' for more information." 1>&2
236 # Command-line argument processing.
237 # Analyzes the remaining arguments.
239 # - origdir to the original directory,
240 # - srcdir to the package directory, and cd-s into it.
242 if test $# -gt 1; then
247 if test $# -eq 1; then
249 if cd "$srcdir"; then
252 func_fatal_error
"Cannot change directory to '$srcdir'."
259 # The current directory is now $srcdir.
261 # Check integrity of package: A configure.in/ac must be present. Sets variable
262 # - configure_in name of configure.in/ac file.
263 test -f configure.
in ||
test -f configure.ac ||
264 func_fatal_error
"Missing configure.in or configure.ac, please cd to your package first."
266 if test -f configure.
in; then
267 configure_in
=configure.
in
269 if test -f configure.ac
; then
270 configure_in
=configure.ac
274 # Check whether the --force option is needed but has not been specified.
275 if test $force -eq 0; then
276 if test -d intl
; then
277 func_fatal_error
"intl/ subdirectory exists: use option -f if you really want to delete it."
279 if test -f po
/Makefile.
in.
in; then
280 func_fatal_error
"po/Makefile.in.in exists: use option -f if you really want to delete it."
282 if test -f ABOUT-NLS
; then
283 func_fatal_error
"ABOUT-NLS exists: use option -f if you really want to delete it."
287 # Check in which directory config.rpath, mkinstalldirs etc. belong.
288 auxdir
=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
289 if test -n "$auxdir"; then
293 # For simplicity we change to the gettext source directory.
295 func_fatal_error
"gettext source directory '${gettext_dir}' doesn't exist"
297 # Variables which keep track what has been modified.
302 removed_acoutput
=" intl/intlh.inst"
305 # - please accumulates instructions for the user.
309 # - date current date, for use in ChangeLog entries.
310 date=`date +%Y-%m-%d`
314 # 'from' is a relative pathname, relative to the current directory.
315 # 'to' is a relative pathname, relative to $srcdir.
320 echo "Copying file $2"
327 # func_linkorcopy from absfrom to
328 # links or copies a file.
329 # 'from' is a relative pathname, relative to the current directory.
330 # 'absfrom' is the corresponding absolute pathname.
331 # 'to' is a relative pathname, relative to $srcdir.
336 ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev
/null ||
337 { echo "Copying file $3"; cp "$1" "$srcdir/$3"; }
340 echo "Symlink file $3"
348 # makes a backup of a file that is about to be overwritten or replaced.
349 # 'to' is a relative pathname, relative to $srcdir.
353 if test -f "$srcdir/$1"; then
355 cp -p "$srcdir/$1" "$srcdir/$1~"
362 # 'to' is a relative pathname, relative to $srcdir.
373 # func_ChangeLog_init
374 # func_ChangeLog_add_entry line
375 # func_ChangeLog_finish
376 # manage the ChangeLog file, relative to $srcdir.
377 func_ChangeLog_init
()
381 func_ChangeLog_add_entry
()
384 if test -z "$modified_ChangeLog"; then
385 echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/ChangeLog.tmp"
386 echo >> "$srcdir/ChangeLog.tmp"
387 modified_ChangeLog
=yes
389 echo "$1" >> "$srcdir/ChangeLog.tmp"
391 modified_ChangeLog
=yes
394 func_ChangeLog_finish
()
396 if test -n "$modified_ChangeLog"; then
398 echo >> "$srcdir/ChangeLog.tmp"
399 if test -f "$srcdir/ChangeLog"; then
400 echo "Adding an entry to ChangeLog (backup is in ChangeLog~)"
401 cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp"
402 rm -f "$srcdir/ChangeLog~"
403 cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~"
405 echo "Creating ChangeLog"
407 cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog"
408 rm -f "$srcdir/ChangeLog.tmp"
410 if test -f "$srcdir/ChangeLog"; then
411 echo "Add an entry to ChangeLog"
413 echo "Create ChangeLog"
419 # func_poChangeLog_init
420 # func_poChangeLog_add_entry line
421 # func_poChangeLog_finish
422 # manage the po/ChangeLog file, relative to $srcdir.
423 func_poChangeLog_init
()
425 modified_poChangeLog
=
427 func_poChangeLog_add_entry
()
430 if test -z "$modified_poChangeLog"; then
431 echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/po/ChangeLog.tmp"
432 echo >> "$srcdir/po/ChangeLog.tmp"
433 modified_poChangeLog
=yes
435 echo "$1" >> "$srcdir/po/ChangeLog.tmp"
437 modified_poChangeLog
=yes
440 func_poChangeLog_finish
()
442 if test -n "$modified_poChangeLog"; then
444 echo >> "$srcdir/po/ChangeLog.tmp"
445 if test -f "$srcdir/po/ChangeLog"; then
446 echo "Adding an entry to po/ChangeLog (backup is in po/ChangeLog~)"
447 cat "$srcdir/po/ChangeLog" >> "$srcdir/po/ChangeLog.tmp"
448 rm -f "$srcdir/po/ChangeLog~"
449 cp -p "$srcdir/po/ChangeLog" "$srcdir/po/ChangeLog~"
451 echo "Creating po/ChangeLog"
453 cp "$srcdir/po/ChangeLog.tmp" "$srcdir/po/ChangeLog"
454 rm -f "$srcdir/po/ChangeLog.tmp"
456 if test -f "$srcdir/po/ChangeLog"; then
457 echo "Add an entry to po/ChangeLog"
459 echo "Create po/ChangeLog"
465 # func_m4ChangeLog_init
466 # func_m4ChangeLog_add_entry line
467 # func_m4ChangeLog_finish
468 # manage the $m4dir/ChangeLog file, relative to $srcdir.
469 func_m4ChangeLog_init
()
471 if test -n "$using_m4ChangeLog"; then
472 modified_m4ChangeLog
=
476 func_m4ChangeLog_add_entry
()
478 if test -n "$using_m4ChangeLog"; then
480 if test -z "$modified_m4ChangeLog"; then
481 echo "$date gettextize <bug-gnu-gettext@gnu.org>" > "$srcdir/$m4dir/ChangeLog.tmp"
482 echo >> "$srcdir/$m4dir/ChangeLog.tmp"
483 modified_m4ChangeLog
=yes
485 echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp"
487 modified_m4ChangeLog
=yes
491 line
=`echo "$line" | sed -e "s%^ \\* % * $m4dir/%"`
492 func_ChangeLog_add_entry
"$line"
495 func_m4ChangeLog_finish
()
497 if test -n "$using_m4ChangeLog"; then
498 if test -n "$modified_m4ChangeLog"; then
500 echo >> "$srcdir/$m4dir/ChangeLog.tmp"
501 if test -f "$srcdir/$m4dir/ChangeLog"; then
502 echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)"
503 cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp"
504 rm -f "$srcdir/$m4dir/ChangeLog~"
505 cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~"
507 echo "Creating $m4dir/ChangeLog"
508 created_m4ChangeLog
=yes
510 cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog"
511 rm -f "$srcdir/$m4dir/ChangeLog.tmp"
513 if test -f "$srcdir/$m4dir/ChangeLog"; then
514 echo "Add an entry to $m4dir/ChangeLog"
516 echo "Create $m4dir/ChangeLog"
517 created_m4ChangeLog
=yes
523 using_m4ChangeLog
=yes
525 if test ! -f "$srcdir/intl/Makefile.in" && test -n "$intldir"; then
526 added_acoutput
="$added_acoutput intl/Makefile"
528 if test -f "$srcdir/intl/Makefile.in" && test -z "$intldir"; then
529 removed_acoutput
="$removed_acoutput intl/Makefile"
531 if test -d "$srcdir/intl"; then
532 # Remove everything inside intl except for RCS and CVS subdirs and invisible
535 echo "Wiping out intl/ subdirectory"
536 (cd "$srcdir/intl" &&
538 if test CVS
!= "$f" && test RCS
!= "$f"; then
543 echo "Wipe out intl/ subdirectory"
545 if test -z "$intldir"; then
546 removed_directory
=intl
549 if test -n "$intldir"; then
551 echo "Creating intl/ subdirectory"
552 mkdir
"$srcdir/intl" || func_fatal_error
"failed to create intl/ subdirectory"
554 echo "Create intl/ subdirectory"
556 added_directories
="$added_directories intl"
560 $do_changelog && func_ChangeLog_init
562 test -d "$srcdir/po" ||
{
564 echo "Creating po/ subdirectory"
565 mkdir
"$srcdir/po" || func_fatal_error
"failed to create po/ subdirectory"
567 echo "Create po/ subdirectory"
569 added_directories
="$added_directories po"
572 # Create the directory for config.rpath, mkinstalldirs, if needed.
573 # This is for consistency with autoreconf and automake.
574 # Note that $auxdir is either empty or ends in a slash.
575 test -d "$srcdir/$auxdir" ||
{
577 echo "Creating $auxdir subdirectory"
578 mkdir
"$srcdir/$auxdir" || func_fatal_error
"failed to create $auxdir subdirectory"
580 echo "Create $auxdir subdirectory"
584 # Now copy all files. Take care for the destination directories.
588 func_linkorcopy
$file "$gettext_dir/$file" $file
590 config.rpath | mkinstalldirs
)
591 if test -f "$srcdir/$auxdir$file"; then
594 added_extradist
="$added_extradist $auxdir$file"
596 func_linkorcopy
$file "$gettext_dir/$file" "$auxdir$file"
601 # Copy files to intl/ subdirectory.
602 if test -n "$intldir"; then
605 if test $file != COPYING.LIB-2.0
&& test $file != COPYING.LIB-2.1
; then
606 if test $file != plural.c
; then
607 func_linkorcopy
$file "$gettext_dir/intl/$file" intl
/$file
609 # plural.c is a generated file; it must be copied and touched.
610 func_copy
$file intl
/$file
612 (sleep 2; touch "$srcdir/intl/$file") &
619 echo "Not copying intl/ directory."
620 # Tell the user what to put into configure.ac, if it is not already there.
621 if grep '^AM_GNU_GETTEXT([[]\?external[]]\?[ ]*[,)]' "$srcdir/$configure_in" > /dev
/null
; then
625 Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration
626 to look for an external libintl.
631 # Copy files to po/ subdirectory.
632 $do_changelog && func_poChangeLog_init
634 for file in Makefile.
in.
in; do
636 if test -f "$srcdir/po/$file"; then
637 if cmp -s $file "$srcdir/po/$file"; then
641 added_acoutput
="$added_acoutput po/Makefile.in"
643 if $do_changelog && test $same = no
; then
644 if test -f "$srcdir/po/$file"; then
645 func_poChangeLog_add_entry
" * $file: Upgrade to gettext-${version}."
647 func_poChangeLog_add_entry
" * $file: New file, from gettext-${version}."
651 func_linkorcopy
$file "$gettext_dir/po/$file" po
/$file
656 # Already handled above.
659 func_linkorcopy Makevars.template
"$gettext_dir/po/Makevars.template" po
/Makevars.template
660 if test -f "$srcdir/po/Makevars"; then
661 LC_ALL
=C
sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/po/Makevars" | LC_ALL
=C
sort > "$srcdir/po/Makevars.tmp1"
662 LC_ALL
=C
sed -n -e 's/[ ]*\([A-Za-z0-9_]*\)[ ]*=.*/\1/p' < "$srcdir/po/Makevars.template" | LC_ALL
=C
sort > "$srcdir/po/Makevars.tmp2"
663 missingvars
=`LC_ALL=C comm -13 "$srcdir/po/Makevars.tmp1" "$srcdir/po/Makevars.tmp2"`
664 rm -f "$srcdir/po/Makevars.tmp1" "$srcdir/po/Makevars.tmp2"
665 if test -n "$missingvars"; then
667 Please update po/Makevars so that it defines all the variables mentioned
668 in po/Makevars.template.
669 You can then remove po/Makevars.template.
674 Please create po/Makevars from the template in po/Makevars.template.
675 You can then remove po/Makevars.template.
681 if test -f "$srcdir/po/$file"; then
682 if cmp -s $file "$srcdir/po/$file"; then
686 if $do_changelog && test $same = no
; then
687 if test -f "$srcdir/po/$file"; then
688 func_poChangeLog_add_entry
" * $file: Upgrade to gettext-${version}."
690 func_poChangeLog_add_entry
" * $file: New file, from gettext-${version}."
694 func_linkorcopy
$file $gettext_dir/po
/$file po
/$file
698 if test -f "$srcdir/po/cat-id-tbl.c"; then
699 func_remove po
/cat-id-tbl.c
700 $do_changelog && func_poChangeLog_add_entry
" * cat-id-tbl.c: Remove file."
702 if test -f "$srcdir/po/stamp-cat-id"; then
703 func_remove po
/stamp-cat-id
704 $do_changelog && func_poChangeLog_add_entry
" * stamp-cat-id: Remove file."
706 if test ! -f "$srcdir/po/POTFILES.in"; then
708 echo "Creating initial po/POTFILES.in"
709 echo '# List of source files which contain translatable strings.' > "$srcdir/po/POTFILES.in"
711 echo "Create initial po/POTFILES.in"
713 $do_changelog && func_poChangeLog_add_entry
" * POTFILES.in: New file."
715 Please fill po/POTFILES.in as described in the documentation.
718 $do_changelog && func_poChangeLog_finish
720 m4filelist
=' codeset.m4 gettext.m4 glibc2.m4 glibc21.m4 iconv.m4 intdiv0.m4
721 intmax.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4
722 lib-ld.m4 lib-link.m4 lib-prefix.m4 longdouble.m4 longlong.m4 nls.m4 po.m4
723 printf-posix.m4 progtest.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4
724 ulonglong.m4 wchar_t.m4 wint_t.m4 xsize.m4'
725 # We cannot omit codeset.m4, glibc2.m4, glibc21.m4, intdiv0.m4, intmax.m4,
726 # inttypes.m4, inttypes_h.m4, inttypes-pri.m4, isc-posix.m4, lcmessage.m4,
727 # longdouble.m4, longlong.m4, nls.m4, po.m4, printf-posix.m4, signed.m4,
728 # size_max.m4, stdint_h.m4, uintmax_t.m4, ulonglong.m4, wchar_t.m4, wint_t.m4,
730 # if test -z "$intldir", otherwise "aclocal -I m4" might give an error.
731 # (aclocal doesn't know which macros are really needed, it looks which macros
732 # are potentially needed.)
734 # All sorts of bugs could occur if the configure file was remade with the wrong
735 # version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in
736 # don't fit together). It is therefore important that the package carries the
737 # right versions of gettext.m4 et al. with it.
738 if test -f "$srcdir/Makefile.am"; then
739 # A package using automake.
741 # Determine whether it's using automake 1.8 or newer.
743 if (aclocal
--version) >/dev
/null
2>/dev
/null
; then
744 aclocal_version
=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
745 case $aclocal_version in
746 1.
[8-9]* |
1.
[1-9][0-9]* |
[2-9]*) have_automake18
=yes ;;
750 # Extract the macro directory name from Makefile.am.
751 aclocal_amflags
=`grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
754 for arg
in $aclocal_amflags; do
755 if test -n "$m4dir_is_next"; then
756 # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
765 if test "X$arg" = "X-I"; then
773 # Decide whether to use $m4dir/ChangeLog, or to use ChangeLog instead.
774 if test -d "$srcdir/$m4dir" && test -f "$srcdir/ChangeLog" && test ! -f "$srcdir/$m4dir/ChangeLog"; then
775 # The programmer has no $m4dir/ChangeLog so far. Don't introduce one.
779 # Update the *.m4 files and the corresponding Makefile.am.
780 $do_changelog && func_m4ChangeLog_init
783 if test -d "$srcdir/$m4dir"; then
787 echo "Creating directory $m4dir"
788 mkdir
"$srcdir/$m4dir"
790 echo "Create directory $m4dir"
794 for file in $m4filelist; do
796 if test -f "$srcdir/$m4dir/$file"; then
797 if cmp -s "@datadir@/aclocal/$file" "$srcdir/$m4dir/$file"; then
801 added_m4files
="$added_m4files $file"
803 if $do_changelog && test $same = no
; then
804 if test -f "$srcdir/$m4dir/$file"; then
805 func_m4ChangeLog_add_entry
" * $file: Upgrade to gettext-${version}."
807 func_m4ChangeLog_add_entry
" * $file: New file, from gettext-${version}."
810 func_backup
"$m4dir/$file"
811 func_linkorcopy
"@datadir@/aclocal/$file" "@datadir@/aclocal/$file" "$m4dir/$file"
813 missing_m4Makefileam
=
814 if test -n "$added_m4files"; then
815 if test -f "$srcdir/$m4dir/Makefile.am"; then
817 echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)"
818 func_backup
"$m4dir/Makefile.am"
819 rm -f "$srcdir/$m4dir/Makefile.am"
820 if grep '^EXTRA_DIST[ ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev
/null
; then
821 sed -e "s%^\(EXTRA_DIST[ ]*=\) \\?%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am"
822 $do_changelog && func_m4ChangeLog_add_entry
" * Makefile.am (EXTRA_DIST): Add the new files."
824 (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am"
825 $do_changelog && func_m4ChangeLog_add_entry
" * Makefile.am (EXTRA_DIST): New variable."
828 echo "Update EXTRA_DIST in $m4dir/Makefile.am"
829 $do_changelog && func_m4ChangeLog_add_entry
" * Makefile.am (EXTRA_DIST)."
832 # $m4dir/Makefile.am is not needed any more when aclocal 1.8 or newer
834 if test -z "$have_automake18"; then
836 echo "Creating $m4dir/Makefile.am"
837 echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am"
839 echo "Create $m4dir/Makefile.am"
841 $do_changelog && func_m4ChangeLog_add_entry
" * Makefile.am: New file."
842 added_acoutput
="$added_acoutput $m4dir/Makefile"
844 missing_m4Makefileam
=yes
848 if test -n "$added_m4dir" && test -z "$missing_m4Makefileam"; then
849 added_directories
="$added_directories $m4dir"
851 $do_changelog && func_m4ChangeLog_finish
852 # automake will arrange for $m4dir/ChangeLog to be distributed if a
853 # $m4dir/Makefile.am exists. If not, we need to add it to Makefile.am's
854 # EXTRA_DIST explicitly.
855 if test -n "$created_m4ChangeLog" && test -n "$missing_m4Makefileam"; then
856 added_extradist
="$added_extradist $m4dir/ChangeLog"
859 # Update the top-level Makefile.am.
860 modified_Makefile_am
=
861 # func_modify_Makefile_am changelog_comment
862 # assumes a modified copy of $srcdir/Makefile.am in $srcdir/Makefile.am.tmp
863 # and replaces the original Makefile.am file with the modified one if
864 # the two files differ. Then it removes the modified copy.
865 func_modify_Makefile_am
()
867 if cmp -s "$srcdir/Makefile.am" "$srcdir/Makefile.am.tmp"; then
870 if test -z "$modified_Makefile_am"; then
872 echo "Updating Makefile.am (backup is in Makefile.am~)"
873 func_backup Makefile.am
875 echo "Update Makefile.am"
879 rm -f "$srcdir/Makefile.am"
880 cp "$srcdir/Makefile.am.tmp" "$srcdir/Makefile.am"
882 if $do_changelog; then
883 if test -z "$modified_Makefile_am"; then
884 func_ChangeLog_add_entry
" * Makefile.am $1"
886 func_ChangeLog_add_entry
" $1"
889 modified_Makefile_am
=yes
891 rm -f "$srcdir/Makefile.am.tmp"
894 if test -n "$added_directories"; then
895 if grep '^SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev
/null
; then
896 sed -e "s%^\(SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
897 added_directories_pretty
=`echo $added_directories | sed -e 's/ /, /g'`
898 func_modify_Makefile_am
"(SUBDIRS): Add $added_directories_pretty."
900 (cat "$srcdir/Makefile.am"; echo; echo "SUBDIRS =$added_directories") > "$srcdir/Makefile.am.tmp"
901 func_modify_Makefile_am
"(SUBDIRS): New variable."
904 if test -n "$removed_directory"; then
905 sed -e '/^SUBDIRS[ ]*=/ {
907 s%\([ ]\)'"$removed_directory"'[ ]%\1%
908 s%[ ]'"$removed_directory"'$%%
918 }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
919 func_modify_Makefile_am
"(SUBDIRS): Remove $removed_directory."
921 if test -n "$added_directories"; then
922 if grep '^DIST_SUBDIRS[ ]*=' "$srcdir/Makefile.am" > /dev
/null
; then
923 sed -e "s%^\(DIST_SUBDIRS[ ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
924 added_directories_pretty
=`echo $added_directories | sed -e 's/ /, /g'`
925 func_modify_Makefile_am
"(DIST_SUBDIRS): Add $added_directories_pretty."
928 if test -n "$removed_directory"; then
929 sed -e '/^DIST_SUBDIRS[ ]*=/ {
931 s%\([ ]\)'"$removed_directory"'[ ]%\1%
932 s%[ ]'"$removed_directory"'$%%
942 }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
943 func_modify_Makefile_am
"(DIST_SUBDIRS): Remove $removed_directory."
945 if test -z "$m4dir_is_next"; then
946 if grep '^ACLOCAL_AMFLAGS[ ]*=' "$srcdir/Makefile.am" > /dev
/null
; then
947 sed -e "s%^\(ACLOCAL_AMFLAGS[ ]*=\) \\?%\\1 -I $m4dir %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
948 func_modify_Makefile_am
"(ACLOCAL_AMFLAGS): Add -I $m4dir."
950 (cat "$srcdir/Makefile.am"; echo; echo "ACLOCAL_AMFLAGS = -I $m4dir") > "$srcdir/Makefile.am.tmp"
951 func_modify_Makefile_am
"(ACLOCAL_AMFLAGS): New variable."
953 # Also update Makefile.in and, if existent, Makefile. Otherwise they
954 # would take into account the new flags only after a few rounds of
955 # "./configure", "make", "touch configure.in", "make distclean".
957 for file in Makefile.
in Makefile
; do
958 if test -f "$srcdir/$file"; then
960 rm -f "$srcdir/$file"
961 sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file"
966 if test -n "$added_extradist"; then
967 if grep '^EXTRA_DIST[ ]*=' "$srcdir/Makefile.am" > /dev
/null
; then
968 sed -e "s%^\(EXTRA_DIST[ ]*=\)%\\1$added_extradist %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
969 added_extradist_pretty
=`echo $added_extradist | sed -e 's/ /, /g'`
970 func_modify_Makefile_am
"(EXTRA_DIST): Add $added_extradist_pretty."
972 (cat "$srcdir/Makefile.am"; echo; echo "EXTRA_DIST =$added_extradist") > "$srcdir/Makefile.am.tmp"
973 func_modify_Makefile_am
"(EXTRA_DIST): New variable."
977 Please run 'aclocal -I $m4dir' to regenerate the aclocal.m4 file.
978 You need aclocal from GNU automake 1.5 (or newer) to do this.
979 Then run 'autoconf' to regenerate the configure file.
982 # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake
983 # doesn't do it by itself.
985 case "$added_acoutput" in
987 (cd "$srcdir" && automake
"$m4dir/Makefile") 2>/dev
/null ||
989 Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in
998 from the @datadir@/aclocal directory to your aclocal.m4 file.
1002 modified_configure_in
=
1003 # func_modify_configure_in changelog_comment
1004 # assumes a modified copy of $srcdir/$configure_in in $srcdir/$configure_in.tmp
1005 # and replaces the original configure.in/ac file with the modified one if
1006 # the two files differ. Then it removes the modified copy.
1007 func_modify_configure_in
()
1009 if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
1012 if test -z "$modified_configure_in"; then
1014 echo "Updating $configure_in (backup is in $configure_in~)"
1015 func_backup
$configure_in
1017 echo "Update $configure_in"
1021 rm -f "$srcdir/$configure_in"
1022 cp "$srcdir/$configure_in.tmp" "$srcdir/$configure_in"
1024 if $do_changelog; then
1025 if test -z "$modified_configure_in"; then
1026 func_ChangeLog_add_entry
" * $configure_in $1"
1028 func_ChangeLog_add_entry
" $1"
1031 modified_configure_in
=yes
1033 rm -f "$srcdir/$configure_in.tmp"
1036 if test -n "$added_acoutput"; then
1037 if grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev
/null
; then
1044 sed -e "s%^\\(AC_CONFIG_FILES([^])\\,]*\\)%\\1$added_acoutput%$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1045 added_acoutput_pretty
=`echo $added_acoutput | sed -e 's/ /, /g'`
1046 func_modify_configure_in
"(AC_CONFIG_FILES): Add $added_acoutput_pretty."
1048 if grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev
/null
; then
1049 sed -e "s%^\\(AC_OUTPUT([^])\\,]*\\)%\\1$added_acoutput%" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1050 added_acoutput_pretty
=`echo $added_acoutput | sed -e 's/ /, /g'`
1051 func_modify_configure_in
"(AC_OUTPUT): Add $added_acoutput_pretty."
1054 Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file.
1059 if test -n "$removed_acoutput"; then
1060 for file in $removed_acoutput; do
1063 s%\([[ ]\)'"$file"'[ ]%\1%
1064 s%\([[ ]\)'"$file"'\([]),]\)%\1\2%
1074 s%\([ ]\)'"$file"'[ ]%\1%
1075 s%\([ ]\)'"$file"'\([]),]\)%\1\2%
1080 sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1081 if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
1082 sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1083 if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
1091 if test -n "$tag"; then
1092 func_modify_configure_in
"($tag): Remove $file."
1094 rm -f "$srcdir/$configure_in.tmp"
1095 if test "$file" != intl
/intlh.inst
; then
1097 Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation
1098 in the $configure_in file.
1104 sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1105 func_modify_configure_in
"(AC_OUTPUT): Remove command that created po/Makefile."
1106 sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1107 func_modify_configure_in
"(AC_LINK_FILES): Remove invocation."
1108 sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1109 func_modify_configure_in
"(AM_GNU_GETTEXT_VERSION): Bump to $version."
1110 $do_changelog && func_ChangeLog_finish
1112 # Recommend replacement for deprecated Makefile variables.
1113 use_libtool
=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'`
1114 for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do
1115 if test -f "$srcdir/$file"; then
1116 if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.
in && grep automake
"$srcdir/$file" >/dev
/null
2>&1; then
1119 # INTLLIBS is deprecated because it doesn't distinguish the two
1120 # cases: with libtool, without libtool.
1121 if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev
/null
2>&1; then
1122 if test -n "$use_libtool"; then
1124 Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of
1125 @""INTLLIBS""@. Which one, depends whether it is used with libtool or not.
1126 @""INTLLIBS""@ will go away.
1130 Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@.
1131 @""INTLLIBS""@ will go away.
1135 # DATADIRNAME is deprecated because we install only .gmo files nowadays,
1136 # which can be stored in the platform independent $prefix/share hierarchy.
1137 if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev
/null
2>&1; then
1139 Please change $file to use the constant string \"share\" instead of
1140 @""DATADIRNAME""@. @""DATADIRNAME""@ will go away.
1143 # INSTOBJEXT is deprecated because we install only .gmo files nowadays,
1144 # no catgets .cat catalogs.
1145 if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev
/null
2>&1; then
1147 Please change $file to use the constant string \".mo\" instead of
1148 @""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away.
1151 # GENCAT is deprecated because we install no catgets catalogs anymore.
1152 if grep '@''GENCAT''@' "$srcdir/$file" >/dev
/null
2>&1; then
1154 Please change $file to use the constant string \"gencat\" instead of
1155 @""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more?
1158 # POSUB is deprecated because it causes "./configure --disable-nls", "make",
1159 # "make dist" to create a buggy tarfile.
1160 if grep '@''POSUB''@' "$srcdir/$file" >/dev
/null
2>&1; then
1162 Please change $file to use the constant string \"po\" instead of
1163 @""POSUB""@. @""POSUB""@ will go away.
1169 # Recommend replacement for deprecated configure variables.
1170 if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev
/null
2>&1; then
1172 Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the
1173 $configure_in file. Both will go away. Use <libintl.h> or \"gettext.h\" instead.
1177 # Recommend fetching config.guess and config.sub.
1178 if test -f "$srcdir/$auxdir"config.guess
&& test -f "$srcdir/$auxdir"config.sub
; then
1182 You will also need config.guess and config.sub, which you can get from the CVS
1183 of the 'config' project at http://savannah.gnu.org/. The commands to fetch them
1185 \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
1186 \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
1192 echo "You might also want to copy the convenience header file gettext.h"
1193 echo "from the $gettext_dir directory into your package."
1194 echo "It is a wrapper around <libintl.h> that implements the configure --disable-nls"
1197 count
=`echo "$please" | grep '^$' | wc -l`
1198 count
=`echo "$count" | sed -e 's/[ ]//g'`
1200 1) count
="paragraph";;
1201 2) count
="two paragraphs";;
1202 3) count
="three paragraphs";;
1203 4) count
="four paragraphs";;
1204 5) count
="five paragraphs";;
1205 *) count
="$count paragraphs";;
1207 echo "Press Return to acknowledge the previous $count."
1208 # Read from /dev/tty, not stdin, so that gettextize cannot be abused by
1209 # non-interactive tools.
1210 read dummy
< /dev
/tty