Add -lm dependency for gettextlib to fix LTO build
[platform/upstream/gettext.git] / gettext-tools / misc / gettextize.in
1 #! /bin/sh
2 #
3 # Copyright (C) 1995-1998, 2000-2015 Free Software Foundation, Inc.
4 #
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 3 of the License, or
8 # (at your option) any later version.
9 #
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.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18
19 # This file is meant for authors or maintainers which want to
20 # internationalize their package with the help of GNU gettext.  For
21 # further information how to use it consult the GNU gettext manual.
22
23 progname=$0
24 package=@PACKAGE@
25 version=@VERSION@
26 archive_version=@ARCHIVE_VERSION@
27
28 # Set variables
29 # - gettext_datadir     directory where the data files are stored.
30 prefix="@prefix@"
31 datarootdir="@datarootdir@"
32 : ${gettext_datadir="@datadir@/gettext"}
33 : ${AUTOM4TE=autom4te}
34
35 # func_tmpdir
36 # creates a temporary directory.
37 # Sets variable
38 # - tmp             pathname of freshly created temporary directory
39 func_tmpdir ()
40 {
41   # Use the environment variable TMPDIR, falling back to /tmp. This allows
42   # users to specify a different temporary directory, for example, if their
43   # /tmp is filled up or too small.
44   : ${TMPDIR=/tmp}
45   {
46     # Use the mktemp program if available. If not available, hide the error
47     # message.
48     tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
49     test -n "$tmp" && test -d "$tmp"
50   } ||
51   {
52     # Use a simple mkdir command. It is guaranteed to fail if the directory
53     # already exists.  $RANDOM is bash specific and expands to empty in shells
54     # other than bash, ksh and zsh.  Its use does not increase security;
55     # rather, it minimizes the probability of failure in a very cluttered /tmp
56     # directory.
57     tmp=$TMPDIR/gt$$-$RANDOM
58     (umask 077 && mkdir "$tmp")
59   } ||
60   {
61     echo "$0: cannot create a temporary directory in $TMPDIR" >&2
62     { (exit 1); exit 1; }
63   }
64 }
65
66 # Support for relocatability.
67 func_find_curr_installdir ()
68 {
69   # Determine curr_installdir, even taking into account symlinks.
70   curr_executable="$0"
71   case "$curr_executable" in
72     */* | *\\*) ;;
73     *) # Need to look in the PATH.
74       save_IFS="$IFS"; IFS="${PATH_SEPARATOR='@PATH_SEPARATOR@'}"
75       for dir in $PATH; do
76         IFS="$save_IFS"
77         test -z "$dir" && dir=.
78         for exec_ext in ''; do
79           if test -f "$dir/$curr_executable$exec_ext"; then
80             curr_executable="$dir/$curr_executable$exec_ext"
81             break 2
82           fi
83         done
84       done
85       IFS="$save_IFS"
86       ;;
87   esac
88   # Make absolute.
89   case "$curr_executable" in
90     /* | ?:/* | ?:\\*) ;;
91     *) curr_executable=`pwd`/"$curr_executable" ;;
92   esac
93   # Resolve symlinks.
94   sed_dirname='s,/[^/]*$,,'
95   sed_linkdest='s,^.* -> \(.*\),\1,p'
96   while : ; do
97     lsline=`LC_ALL=C ls -l "$curr_executable"`
98     case "$lsline" in
99       *" -> "*)
100         linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
101         case "$linkdest" in
102           /* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
103           *) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
104         esac ;;
105       *) break ;;
106     esac
107   done
108   curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
109   # Canonicalize.
110   curr_installdir=`cd "$curr_installdir" && pwd`
111 }
112 func_find_prefixes ()
113 {
114   # Compute the original/current installation prefixes by stripping the
115   # trailing directories off the original/current installation directories.
116   orig_installprefix="$orig_installdir"
117   curr_installprefix="$curr_installdir"
118   while true; do
119     orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
120     curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
121     if test -z "$orig_last" || test -z "$curr_last"; then
122       break
123     fi
124     if test "$orig_last" != "$curr_last"; then
125       break
126     fi
127     orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
128     curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
129   done
130 }
131 if test "@RELOCATABLE@" = yes; then
132   exec_prefix="@exec_prefix@"
133   bindir="@bindir@"
134   orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
135   func_find_curr_installdir # determine curr_installdir
136   func_find_prefixes
137   # Relocate the directory variables that we use.
138   gettext_datadir=`echo "$gettext_datadir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
139 fi
140
141 # func_trace_autoconf macro configure.ac
142 # traces an Autoconf macro call and outputs the arguments to stdout,
143 # using autom4te.
144 func_trace_autoconf ()
145 {
146   echo '\
147 dnl replace macros which may abort autom4te with a no-op variant
148 m4_pushdef([m4_assert])
149 m4_pushdef([m4_fatal])
150 m4_pushdef([m4_warn])
151 m4_pushdef([m4_errprintn])
152 m4_pushdef([m4_exit])
153 m4_pushdef([m4_include])
154 m4_pushdef([m4_esyscmd])
155 ' \
156   | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 \
157     --trace="$1":\$% - "$2" 2>/dev/null
158 }
159
160 # func_trace_sed macro configure.ac
161 # traces an Autoconf macro call and outputs the arguments to stdout,
162 # using sed.
163 func_trace_sed ()
164 {
165   sed_extract_arguments='
166 s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
167 /'"$1"'(/ {
168   ta
169   :a
170     s/)/)/
171     tb
172     s/\\$//
173     N
174     ba
175   :b
176   s,^.*'"$1"'([[ ]*\([^]"$`\\)]*\).*$,\1,p
177 }
178 d'
179   sed -e "$sed_extract_arguments" "$2"
180 }
181
182 # func_usage
183 # outputs to stdout the --help usage message.
184 func_usage ()
185 {
186   echo "\
187 Usage: gettextize [OPTION]... [package-dir]
188
189 Prepares a source package to use gettext.
190
191 Options:
192       --help           print this help and exit
193       --version        print version information and exit
194   -f, --force          force writing of new files even if old exist
195       --intl           install libintl in a subdirectory (deprecated)
196       --po-dir=DIR     specify directory with PO files
197       --no-changelog   don't update or create ChangeLog files
198       --symlink        make symbolic links instead of copying files
199   -n, --dry-run        print modifications but don't perform them
200
201 Report bugs to <bug-gnu-gettext@gnu.org>."
202 }
203
204 # func_version
205 # outputs to stdout the --version message.
206 func_version ()
207 {
208   echo "$progname (GNU $package) $version"
209   echo "Copyright (C) 1995-1998, 2000-2013 Free Software Foundation, Inc.
210 License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
211 This is free software: you are free to change and redistribute it.
212 There is NO WARRANTY, to the extent permitted by law."
213   echo "Written by" "Ulrich Drepper"
214 }
215
216 # func_fatal_error message
217 # outputs to stderr a fatal error message, and terminates the program.
218 func_fatal_error ()
219 {
220   echo "gettextize: *** $1" 1>&2
221   echo "gettextize: *** Stop." 1>&2
222   exit 1
223 }
224
225 # Nuisances.
226 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
227
228 # Unset more variables known to interfere with behavior of common tools.
229 CLICOLOR_FORCE= GREP_OPTIONS=
230 unset CLICOLOR_FORCE GREP_OPTIONS
231
232 # Command-line option processing.
233 # Removes the OPTIONS from the arguments. Sets the variables:
234 # - force           1 if --force was given, 0 otherwise
235 # - intldir         yes if --intl was given, empty otherwise
236 # - podirs          list of directories specified with --po-dir
237 # - try_ln_s        : if --symlink was given, false otherwise
238 # - do_changelog    false if --no-changelog was given, : otherwise
239 # - doit            false if --dry-run was given, : otherwise
240 {
241   force=0
242   intldir=
243   podirs=
244   try_ln_s=false
245   do_changelog=:
246   doit=:
247
248   while test $# -gt 0; do
249     case "$1" in
250       -c | --copy | --cop | --co | --c ) # accepted for backward compatibility
251         shift ;;
252       -n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
253         shift
254         doit=false ;;
255       -f | --force | --forc | --for | --fo | --f )
256         shift
257         force=1 ;;
258       --help | --hel | --he | --h )
259         func_usage; exit 0 ;;
260       --intl | --int | --in | --i )
261         shift
262         intldir=yes ;;
263       --po-dir | --po-di | --po-d | --po- | --po | --p )
264         shift 
265         if test $# = 0; then
266           func_fatal_error "missing argument for --po-dir"
267         fi
268         case "$1" in
269           -*) func_fatal_error "missing argument for --po-dir" ;;
270         esac
271         podirs="$podirs $1"
272         shift ;;
273       --po-dir=* )
274         arg=`echo "X$1" | sed -e 's/^X--po-dir=//'`
275         podirs="$podirs $arg"
276         shift ;;
277       --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
278         shift
279         do_changelog=false ;;
280       --symlink | --symlin | --symli | --syml | --sym | --sy | --s )
281         shift
282         try_ln_s=: ;;
283       --version | --versio | --versi | --vers | --ver | --ve | --v )
284         func_version
285         exit 0 ;;
286       -- ) # Stop option prcessing
287         shift; break ;;
288       -* )
289         echo "gettextize: unknown option $1" 1>&2
290         echo "Try 'gettextize --help' for more information." 1>&2
291         exit 1 ;;
292       * )
293         break ;;
294     esac
295   done
296   # podirs defaults to "po".
297   test -n "$podirs" || podirs="po"
298 }
299
300 # Warn about deprecated options.
301 if test -n "$intldir"; then
302   echo "gettextize: warning: the option '--intl' is deprecated and will be removed" 1>&2
303 fi
304
305 # Command-line argument processing.
306 # Analyzes the remaining arguments.
307 # Sets the variables
308 # - origdir         to the original directory,
309 # - srcdir          to the package directory, and cd-s into it.
310 {
311   if test $# -gt 1; then
312     func_usage 1>&2
313     exit 1
314   fi
315   origdir=`pwd`
316   if test $# -eq 1; then
317     srcdir=$1
318     if cd "$srcdir"; then
319       srcdir=`pwd`
320     else
321       func_fatal_error "Cannot change directory to '$srcdir'."
322     fi
323   else
324     srcdir=$origdir
325   fi
326 }
327
328 # The current directory is now $srcdir.
329
330 # Check integrity of package: A configure.in/ac must be present. Sets variable
331 # - configure_in    name of configure.in/ac file.
332 test -f configure.in || test -f configure.ac ||
333   func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
334 configure_in=NONE
335 if test -f configure.in; then
336   configure_in=configure.in
337 else
338   if test -f configure.ac; then
339     configure_in=configure.ac
340   fi
341 fi
342
343 # Check whether the --force option is needed but has not been specified.
344 if test $force -eq 0; then
345   if test -d intl; then
346     func_fatal_error "intl/ subdirectory exists: use option -f if you really want to delete it."
347   fi
348   for podir in $podirs; do
349     if test -f "$podir/Makefile.in.in"; then
350       func_fatal_error "$podir/Makefile.in.in exists: use option -f if you really want to delete it."
351     fi
352   done
353   if test -f ABOUT-NLS; then
354     func_fatal_error "ABOUT-NLS exists: use option -f if you really want to delete it."
355   fi
356 fi
357
358 # Select the method for Autoconf macro tracing.  func_trace_autoconf
359 # is more accurate than func_trace_sed, but it only works with
360 # autoconf >= 2.69.
361 if echo "AC_PREREQ([2.69])" \
362   | "$AUTOM4TE" --no-cache --language=Autoconf-without-aclocal-m4 - 2>&1; then
363   func_trace=func_trace_autoconf
364 else
365   func_trace=func_trace_sed
366 fi
367
368 # Check in which directory config.rpath etc. belong.
369 auxdir=`"$func_trace" AC_CONFIG_AUX_DIR "$configure_in"`
370 if test -n "$auxdir"; then
371   auxdir="$auxdir/"
372 fi
373
374 # Check in which directory gettext.m4 etc. belong.
375 macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR_TRACE "$configure_in"`
376 if test -z "$macrodirs"; then
377   macrodirs=`"$func_trace" AC_CONFIG_MACRO_DIR "$configure_in"`
378 fi
379 for arg in $macrodirs; do
380   m4dir="$arg"
381   break
382 done
383
384 # For simplicity we change to the gettext source directory.
385 cd "$gettext_datadir" ||
386   func_fatal_error "gettext source directory '${gettext_datadir}' doesn't exist"
387
388 # Variables which keep track what has been modified.
389 added_directories=
390 removed_directory=
391 added_extradist=
392 added_acoutput=
393 removed_acoutput=" intl/intlh.inst"
394
395 # Variable:
396 # - please          accumulates instructions for the user.
397 please=
398
399 # Variable:
400 # - date            current date, for use in ChangeLog entries.
401 date=`date +%Y-%m-%d`
402
403 # func_copy from to
404 # copies a file.
405 # 'from' is a relative pathname, relative to the current directory.
406 # 'to' is a relative pathname, relative to $srcdir.
407 func_copy ()
408 {
409   if $doit; then
410     rm -f "$srcdir/$2"
411     echo "Copying file $2"
412     cp "$1" "$srcdir/$2"
413   else
414     echo "Copy file $2"
415   fi
416 }
417
418 # func_linkorcopy from absfrom to
419 # links or copies a file.
420 # 'from' is a relative pathname, relative to the current directory.
421 # 'absfrom' is the corresponding absolute pathname.
422 # 'to' is a relative pathname, relative to $srcdir.
423 func_linkorcopy ()
424 {
425   if $doit; then
426     rm -f "$srcdir/$3"
427     ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev/null ||
428     { echo "Copying file $3"; cp "$1" "$srcdir/$3"; }
429   else
430     if $try_ln_s; then
431       echo "Symlink file $3"
432     else
433       echo "Copy file $3"
434     fi
435   fi
436 }
437
438 # func_backup to
439 # makes a backup of a file that is about to be overwritten or replaced.
440 # 'to' is a relative pathname, relative to $srcdir.
441 func_backup ()
442 {
443   if $doit; then
444     if test -f "$srcdir/$1"; then
445       rm -f "$srcdir/$1~"
446       cp -p "$srcdir/$1" "$srcdir/$1~"
447     fi
448   fi
449 }
450
451 # func_remove to
452 # removes a file.
453 # 'to' is a relative pathname, relative to $srcdir.
454 func_remove ()
455 {
456   if $doit; then
457     echo "Removing $1"
458     rm -f "$srcdir/$1"
459   else
460     echo "Remove $1"
461   fi
462 }
463
464 # func_ChangeLog_init
465 # func_ChangeLog_add_entry line
466 # func_ChangeLog_finish
467 # manage the ChangeLog file, relative to $srcdir.
468 func_ChangeLog_init ()
469 {
470   modified_ChangeLog=
471 }
472 func_ChangeLog_add_entry ()
473 {
474   if $doit; then
475     if test -z "$modified_ChangeLog"; then
476       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/ChangeLog.tmp"
477       echo >> "$srcdir/ChangeLog.tmp"
478       modified_ChangeLog=yes
479     fi
480     echo "$1" >> "$srcdir/ChangeLog.tmp"
481   else
482     modified_ChangeLog=yes
483   fi
484 }
485 func_ChangeLog_finish ()
486 {
487   if test -n "$modified_ChangeLog"; then
488     if $doit; then
489       echo >> "$srcdir/ChangeLog.tmp"
490       if test -f "$srcdir/ChangeLog"; then
491         echo "Adding an entry to ChangeLog (backup is in ChangeLog~)"
492         cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp"
493         rm -f "$srcdir/ChangeLog~"
494         cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~"
495       else
496         echo "Creating ChangeLog"
497       fi
498       cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog"
499       rm -f "$srcdir/ChangeLog.tmp"
500     else
501       if test -f "$srcdir/ChangeLog"; then
502         echo "Add an entry to ChangeLog"
503       else
504         echo "Create ChangeLog"
505       fi
506     fi
507   fi
508 }
509
510 # func_poChangeLog_init
511 # func_poChangeLog_add_entry line
512 # func_poChangeLog_finish
513 # manage the $podir/ChangeLog file, relative to $srcdir.
514 func_poChangeLog_init ()
515 {
516   modified_poChangeLog=
517 }
518 func_poChangeLog_add_entry ()
519 {
520   if $doit; then
521     if test -z "$modified_poChangeLog"; then
522       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/$podir/ChangeLog.tmp"
523       echo >> "$srcdir/$podir/ChangeLog.tmp"
524       modified_poChangeLog=yes
525     fi
526     echo "$1" >> "$srcdir/$podir/ChangeLog.tmp"
527   else
528     modified_poChangeLog=yes
529   fi
530 }
531 func_poChangeLog_finish ()
532 {
533   if test -n "$modified_poChangeLog"; then
534     if $doit; then
535       echo >> "$srcdir/$podir/ChangeLog.tmp"
536       if test -f "$srcdir/$podir/ChangeLog"; then
537         echo "Adding an entry to $podir/ChangeLog (backup is in $podir/ChangeLog~)"
538         cat "$srcdir/$podir/ChangeLog" >> "$srcdir/$podir/ChangeLog.tmp"
539         rm -f "$srcdir/$podir/ChangeLog~"
540         cp -p "$srcdir/$podir/ChangeLog" "$srcdir/$podir/ChangeLog~"
541       else
542         echo "Creating $podir/ChangeLog"
543       fi
544       cp "$srcdir/$podir/ChangeLog.tmp" "$srcdir/$podir/ChangeLog"
545       rm -f "$srcdir/$podir/ChangeLog.tmp"
546     else
547       if test -f "$srcdir/$podir/ChangeLog"; then
548         echo "Add an entry to $podir/ChangeLog"
549       else
550         echo "Create $podir/ChangeLog"
551       fi
552     fi
553   fi
554 }
555
556 # func_m4ChangeLog_init
557 # func_m4ChangeLog_add_entry line
558 # func_m4ChangeLog_finish
559 # manage the $m4dir/ChangeLog file, relative to $srcdir.
560 func_m4ChangeLog_init ()
561 {
562   if test -n "$using_m4ChangeLog"; then
563     modified_m4ChangeLog=
564     created_m4ChangeLog=
565   fi
566 }
567 func_m4ChangeLog_add_entry ()
568 {
569   if test -n "$using_m4ChangeLog"; then
570     if $doit; then
571       if test -z "$modified_m4ChangeLog"; then
572         echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/$m4dir/ChangeLog.tmp"
573         echo >> "$srcdir/$m4dir/ChangeLog.tmp"
574         modified_m4ChangeLog=yes
575       fi
576       echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp"
577     else
578       modified_m4ChangeLog=yes
579     fi
580   else
581     line="$1"
582     line=`echo "$line" | sed -e "s%^    \\* %   * $m4dir/%"`
583     func_ChangeLog_add_entry "$line"
584   fi
585 }
586 func_m4ChangeLog_finish ()
587 {
588   if test -n "$using_m4ChangeLog"; then
589     if test -n "$modified_m4ChangeLog"; then
590       if $doit; then
591         echo >> "$srcdir/$m4dir/ChangeLog.tmp"
592         if test -f "$srcdir/$m4dir/ChangeLog"; then
593           echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)"
594           cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp"
595           rm -f "$srcdir/$m4dir/ChangeLog~"
596           cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~"
597         else
598           echo "Creating $m4dir/ChangeLog"
599           created_m4ChangeLog=yes
600         fi
601         cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog"
602         rm -f "$srcdir/$m4dir/ChangeLog.tmp"
603       else
604         if test -f "$srcdir/$m4dir/ChangeLog"; then
605           echo "Add an entry to $m4dir/ChangeLog"
606         else
607           echo "Create $m4dir/ChangeLog"
608           created_m4ChangeLog=yes
609         fi
610       fi
611     fi
612   fi
613 }
614 using_m4ChangeLog=yes
615
616 if test ! -f "$srcdir/intl/Makefile.in" && test -n "$intldir"; then
617   added_acoutput="$added_acoutput intl/Makefile"
618 fi
619 if test -f "$srcdir/intl/Makefile.in" && test -z "$intldir"; then
620   removed_acoutput="$removed_acoutput intl/Makefile"
621 fi
622 if test -d "$srcdir/intl"; then
623   # Remove everything inside intl except for RCS and CVS subdirs and invisible
624   # files.
625   if $doit; then
626     echo "Wiping out intl/ subdirectory"
627     (cd "$srcdir/intl" &&
628      for f in *; do
629        if test CVS != "$f" && test RCS != "$f"; then
630          rm -rf "$f"
631        fi
632      done)
633   else
634     echo "Wipe out intl/ subdirectory"
635   fi
636   if test -z "$intldir"; then
637     removed_directory=intl
638   fi
639 else
640   if test -n "$intldir"; then
641     if $doit; then
642       echo "Creating intl/ subdirectory"
643       mkdir "$srcdir/intl" || func_fatal_error "failed to create intl/ subdirectory"
644     else
645       echo "Create intl/ subdirectory"
646     fi
647     added_directories="$added_directories intl"
648   fi
649 fi
650
651 $do_changelog && func_ChangeLog_init
652
653 for podir in $podirs; do
654   test -d "$srcdir/$podir" || {
655     if $doit; then
656       echo "Creating $podir/ subdirectory"
657       mkdir "$srcdir/$podir" || func_fatal_error "failed to create $podir/ subdirectory"
658     else
659       echo "Create $podir/ subdirectory"
660     fi
661     added_directories="$added_directories $podir"
662   }
663 done
664
665 # Create the directory for config.rpath, if needed.
666 # This is for consistency with autoreconf and automake.
667 # Note that $auxdir is either empty or ends in a slash.
668 test -d "$srcdir/$auxdir" || {
669   if $doit; then
670     echo "Creating $auxdir subdirectory"
671     mkdir "$srcdir/$auxdir" || func_fatal_error "failed to create $auxdir subdirectory"
672   else
673     echo "Create $auxdir subdirectory"
674   fi
675 }
676
677 # Now copy all files.  Take care for the destination directories.
678 for file in *; do
679   case $file in
680     ABOUT-NLS)
681       func_linkorcopy $file "$gettext_datadir/$file" $file
682       ;;
683     config.rpath)
684       if test -f "$srcdir/$auxdir$file"; then
685         :
686       else
687         added_extradist="$added_extradist $auxdir$file"
688       fi
689       func_linkorcopy $file "$gettext_datadir/$file" "$auxdir$file"
690       ;;
691   esac
692 done
693
694 # Copy files to intl/ subdirectory.
695 if test -n "$intldir"; then
696   cd intl
697   for file in *; do
698     if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
699       if test $file != plural.c; then
700         func_linkorcopy $file "$gettext_datadir/intl/$file" intl/$file
701       else
702         # plural.c is a generated file; it must be copied and touched.
703         func_copy $file intl/$file
704         if $doit; then
705           (sleep 2; touch "$srcdir/intl/$file") &
706         fi
707       fi
708     fi
709   done
710   cd ..
711 else
712   echo "Not copying intl/ directory."
713   # Tell the user what to put into configure.ac, if it is not already there.
714   external=
715   # Need to use func_trace_sed instead of $func_trace, since
716   # AM_GNU_GETTEXT is not a standard Autoconf trace.
717   xargs=`func_trace_sed AM_GNU_GETTEXT "$srcdir/$configure_in"`
718   save_IFS="$IFS"; IFS=:
719   for arg in $xargs; do
720     if test 'external' = "$arg"; then
721       external=yes
722       break
723     fi
724   done
725   IFS="$save_IFS"
726   if test -z "$external"; then
727     please="$please
728 Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration
729 to look for an external libintl.
730 "
731   fi
732 fi
733
734 # Copy files to po/ subdirectory.
735 cd po
736 for podir in $podirs; do
737   $do_changelog && func_poChangeLog_init
738   for file in Makefile.in.in; do
739     same=no
740     if test -f "$srcdir/$podir/$file"; then
741       if cmp -s $file "$srcdir/$podir/$file"; then
742         same=yes
743       fi
744     else
745       added_acoutput="$added_acoutput $podir/Makefile.in"
746     fi
747     if $do_changelog && test $same = no; then
748       if test -f "$srcdir/$podir/$file"; then
749         func_poChangeLog_add_entry "    * $file: Upgrade to gettext-${version}."
750       else
751         func_poChangeLog_add_entry "    * $file: New file, from gettext-${version}."
752       fi
753     fi
754     func_backup "$podir/$file"
755     func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
756   done
757   for file in *; do
758     case $file in
759       Makefile.in.in)
760         # Already handled above.
761         ;;
762       Makevars.template)
763         func_linkorcopy Makevars.template "$gettext_datadir/po/Makevars.template" "$podir/Makevars.template"
764         if test -f "$srcdir/po/Makevars"; then
765           LC_ALL=C sed -n -e 's/[       ]*\([A-Za-z0-9_]*\)[    ]*=.*/\1/p' < "$srcdir/$podir/Makevars" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp1"
766           LC_ALL=C sed -n -e 's/[       ]*\([A-Za-z0-9_]*\)[    ]*=.*/\1/p' < "$srcdir/$podir/Makevars.template" | LC_ALL=C sort > "$srcdir/$podir/Makevars.tmp2"
767           missingvars=`LC_ALL=C comm -13 "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"`
768           rm -f "$srcdir/$podir/Makevars.tmp1" "$srcdir/$podir/Makevars.tmp2"
769           if test -n "$missingvars"; then
770             please="$please
771 Please update $podir/Makevars so that it defines all the variables mentioned
772 in $podir/Makevars.template.
773 You can then remove $podir/Makevars.template.
774 "
775           fi
776         else
777           please="$please
778 Please create $podir/Makevars from the template in $podir/Makevars.template.
779 You can then remove $podir/Makevars.template.
780 "
781         fi
782         ;;
783       *)
784         same=no
785         if test -f "$srcdir/$podir/$file"; then
786           if cmp -s $file "$srcdir/$podir/$file"; then
787             same=yes
788           fi
789         fi
790         if $do_changelog && test $same = no; then
791           if test -f "$srcdir/$podir/$file"; then
792             func_poChangeLog_add_entry "        * $file: Upgrade to gettext-${version}."
793           else
794             func_poChangeLog_add_entry "        * $file: New file, from gettext-${version}."
795           fi
796         fi
797         func_backup "$podir/$file"
798         func_linkorcopy $file "$gettext_datadir/po/$file" "$podir/$file"
799         ;;
800     esac
801   done
802   if test -f "$srcdir/$podir/cat-id-tbl.c"; then
803     func_remove "$podir/cat-id-tbl.c"
804     $do_changelog && func_poChangeLog_add_entry "       * cat-id-tbl.c: Remove file."
805   fi
806   if test -f "$srcdir/$podir/stamp-cat-id"; then
807     func_remove "$podir/stamp-cat-id"
808     $do_changelog && func_poChangeLog_add_entry "       * stamp-cat-id: Remove file."
809   fi
810   if test ! -f "$srcdir/$podir/POTFILES.in"; then
811     if $doit; then
812       echo "Creating initial $podir/POTFILES.in"
813       echo '# List of source files which contain translatable strings.' > "$srcdir/$podir/POTFILES.in"
814     else
815       echo "Create initial $podir/POTFILES.in"
816     fi
817     $do_changelog && func_poChangeLog_add_entry "       * POTFILES.in: New file."
818     please="$please
819 Please fill $podir/POTFILES.in as described in the documentation.
820 "
821   fi
822   $do_changelog && func_poChangeLog_finish
823 done
824
825 # Determine whether we can assume automake 1.9 or newer.
826 have_automake19=
827 if (aclocal --version) >/dev/null 2>/dev/null; then
828   aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
829   case $aclocal_version in
830     1.9* | 1.[1-9][0-9]* | [2-9]*) have_automake19=yes ;;
831   esac
832 fi
833
834 m4filelist='gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4
835  po.m4 progtest.m4'
836 # With aclocal versions < 1.9 we need all m4 files, otherwise "aclocal -I m4"
837 # might give an error. (aclocal < 1.9 didn't know which macros are really
838 # needed, it looked which macros are potentially needed.)
839 min_automake_version=1.9
840 if test -n "$intldir" || test -z "$have_automake19"; then
841   # Add intldir.m4, intl.m4 and its dependencies.
842   m4filelist=$m4filelist' codeset.m4 fcntl-o.m4 glibc2.m4 glibc21.m4 intdiv0.m4
843    intl.m4 intldir.m4 intlmacosx.m4 intmax.m4 inttypes_h.m4 inttypes-pri.m4
844    lcmessage.m4 lock.m4 longlong.m4 printf-posix.m4 size_max.m4 stdint_h.m4
845    threadlib.m4 uintmax_t.m4 visibility.m4 wchar_t.m4 wint_t.m4 xsize.m4'
846   min_automake_version=1.8
847 fi
848
849 # All sorts of bugs could occur if the configure file was remade with the wrong
850 # version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in
851 # don't fit together). It is therefore important that the package carries the
852 # right versions of gettext.m4 et al. with it.
853 if test -f "$srcdir/Makefile.am"; then
854   # A package using automake.
855
856   # Determine whether it's using automake 1.8 or newer.
857   have_automake18=
858   if (aclocal --version) >/dev/null 2>/dev/null; then
859     aclocal_version=`aclocal --version | sed -n -e 1p | sed -e 's/^[^0-9]*//'`
860     case $aclocal_version in
861       1.[8-9]* | 1.[1-9][0-9]* | [2-9]*) have_automake18=yes ;;
862     esac
863   fi
864
865   if test -z "$m4dir"; then
866     # Extract the macro directory name from Makefile.am.
867     aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[    ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[        ]*=\(.*\)$/\1/'`
868     m4dir_is_next=
869     for arg in $aclocal_amflags; do
870       if test -n "$m4dir_is_next"; then
871         # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
872         case "$arg" in
873           /*) ;;
874           *)
875             test -z "$m4dir" || m4dir="$arg"
876             macrodirs="$macrodirs $arg"
877             ;;
878         esac
879         m4dir_is_next=
880       else
881         if test "X$arg" = "X-I"; then
882           m4dir_is_next=yes
883         else
884           m4dir_is_next=
885         fi
886       fi
887     done
888     for arg in $macrodirs; do
889       m4dir="$arg"
890       break
891     done
892   fi
893
894   if test -z "$m4dir"; then
895     m4dir=m4
896     m4dir_defaulted=yes
897   fi
898
899   # Decide whether to use $m4dir/ChangeLog, or to use ChangeLog instead.
900   if test -d "$srcdir/$m4dir" && test -f "$srcdir/ChangeLog" && test ! -f "$srcdir/$m4dir/ChangeLog"; then
901     # The programmer has no $m4dir/ChangeLog so far. Don't introduce one.
902     using_m4ChangeLog=
903   fi
904
905   # Update the *.m4 files and the corresponding Makefile.am.
906   $do_changelog && func_m4ChangeLog_init
907   added_m4dir=
908   added_m4files=
909   if test -d "$srcdir/$m4dir"; then
910     :
911   else
912     if $doit; then
913       echo "Creating directory $m4dir"
914       mkdir "$srcdir/$m4dir"
915     else
916       echo "Create directory $m4dir"
917     fi
918     added_m4dir=yes
919   fi
920   for file in $m4filelist; do
921     same=no
922     if test -f "$srcdir/$m4dir/$file"; then
923       if cmp -s "@datadir@/aclocal/$file" "$srcdir/$m4dir/$file"; then
924         same=yes
925       fi
926     else
927       added_m4files="$added_m4files $file"
928     fi
929     if $do_changelog && test $same = no; then
930       if test -f "$srcdir/$m4dir/$file"; then
931         func_m4ChangeLog_add_entry "    * $file: Upgrade to gettext-${version}."
932       else
933         func_m4ChangeLog_add_entry "    * $file: New file, from gettext-${version}."
934       fi
935     fi
936     func_backup "$m4dir/$file"
937     func_linkorcopy "@datadir@/aclocal/$file" "@datadir@/aclocal/$file" "$m4dir/$file"
938   done
939   missing_m4Makefileam=
940   if test -n "$added_m4files"; then
941     if test -f "$srcdir/$m4dir/Makefile.am"; then
942       if $doit; then
943         echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)"
944         func_backup "$m4dir/Makefile.am"
945         rm -f "$srcdir/$m4dir/Makefile.am"
946         if grep '^EXTRA_DIST[   ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev/null; then
947           sed -e "s%^\(EXTRA_DIST[      ]*=\) \\?%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am"
948           $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): Add the new files."
949         else
950           (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am"
951           $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): New variable."
952         fi
953       else
954         echo "Update EXTRA_DIST in $m4dir/Makefile.am"
955         $do_changelog && func_m4ChangeLog_add_entry "   * Makefile.am (EXTRA_DIST)."
956       fi
957     else
958       # $m4dir/Makefile.am is not needed any more when aclocal 1.8 or newer
959       # is used.
960       if test -z "$have_automake18"; then
961         if $doit; then
962           echo "Creating $m4dir/Makefile.am"
963           echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am"
964         else
965           echo "Create $m4dir/Makefile.am"
966         fi
967         $do_changelog && func_m4ChangeLog_add_entry "   * Makefile.am: New file."
968         added_acoutput="$added_acoutput $m4dir/Makefile"
969       else
970         missing_m4Makefileam=yes
971       fi
972     fi
973   fi
974   if test -n "$added_m4dir" && test -z "$missing_m4Makefileam"; then
975     added_directories="$added_directories $m4dir"
976   fi
977   $do_changelog && func_m4ChangeLog_finish
978   # automake will arrange for $m4dir/ChangeLog to be distributed if a
979   # $m4dir/Makefile.am exists. If not, we need to add it to Makefile.am's
980   # EXTRA_DIST explicitly.
981   if test -n "$created_m4ChangeLog" && test -n "$missing_m4Makefileam"; then
982     added_extradist="$added_extradist $m4dir/ChangeLog"
983   fi
984
985   # Update the top-level Makefile.am.
986   modified_Makefile_am=
987   # func_modify_Makefile_am changelog_comment
988   # assumes a modified copy of $srcdir/Makefile.am in $srcdir/Makefile.am.tmp
989   # and replaces the original Makefile.am file with the modified one if
990   # the two files differ. Then it removes the modified copy.
991   func_modify_Makefile_am ()
992   {
993     if cmp -s "$srcdir/Makefile.am" "$srcdir/Makefile.am.tmp"; then
994       :
995     else
996       if test -z "$modified_Makefile_am"; then
997         if $doit; then
998           echo "Updating Makefile.am (backup is in Makefile.am~)"
999           func_backup Makefile.am
1000         else
1001           echo "Update Makefile.am"
1002         fi
1003       fi
1004       if $doit; then
1005         rm -f "$srcdir/Makefile.am"
1006         cp "$srcdir/Makefile.am.tmp" "$srcdir/Makefile.am"
1007       fi
1008       if $do_changelog; then
1009         if test -z "$modified_Makefile_am"; then
1010           func_ChangeLog_add_entry "    * Makefile.am $1"
1011         else
1012           func_ChangeLog_add_entry "    $1"
1013         fi
1014       fi
1015       modified_Makefile_am=yes
1016     fi
1017     rm -f "$srcdir/Makefile.am.tmp"
1018   }
1019
1020   if test -n "$added_directories"; then
1021     if grep '^SUBDIRS[  ]*=' "$srcdir/Makefile.am" > /dev/null; then
1022       sed -e "s%^\(SUBDIRS[     ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
1023       added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
1024       func_modify_Makefile_am "(SUBDIRS): Add $added_directories_pretty."
1025     else
1026       (cat "$srcdir/Makefile.am"; echo; echo "SUBDIRS =$added_directories") > "$srcdir/Makefile.am.tmp"
1027       func_modify_Makefile_am "(SUBDIRS): New variable."
1028     fi
1029   fi
1030   if test -n "$removed_directory"; then
1031     sed -e '/^SUBDIRS[  ]*=/ {
1032         :a
1033         s%\([   ]\)'"$removed_directory"'[      ]%\1%
1034         s%[     ]'"$removed_directory"'$%%
1035         tb
1036         :b
1037         s%\\$%\\%
1038         tc
1039         bd
1040         :c
1041         n
1042         ba
1043       :d
1044     }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
1045     func_modify_Makefile_am "(SUBDIRS): Remove $removed_directory."
1046   fi
1047   if test -n "$added_directories"; then
1048     if grep '^DIST_SUBDIRS[     ]*=' "$srcdir/Makefile.am" > /dev/null; then
1049       sed -e "s%^\(DIST_SUBDIRS[        ]*=\) \\?%\\1$added_directories %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
1050       added_directories_pretty=`echo $added_directories | sed -e 's/ /, /g'`
1051       func_modify_Makefile_am "(DIST_SUBDIRS): Add $added_directories_pretty."
1052     fi
1053   fi
1054   if test -n "$removed_directory"; then
1055     sed -e '/^DIST_SUBDIRS[     ]*=/ {
1056         :a
1057         s%\([   ]\)'"$removed_directory"'[      ]%\1%
1058         s%[     ]'"$removed_directory"'$%%
1059         tb
1060         :b
1061         s%\\$%\\%
1062         tc
1063         bd
1064         :c
1065         n
1066         ba
1067       :d
1068     }' < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
1069     func_modify_Makefile_am "(DIST_SUBDIRS): Remove $removed_directory."
1070   fi
1071   if test -n "$m4dir_defaulted"; then
1072     if grep '^ACLOCAL_AMFLAGS[  ]*=' "$srcdir/Makefile.am" > /dev/null; then
1073       sed -e "s%^\(ACLOCAL_AMFLAGS[     ]*=\) \\?%\\1 -I $m4dir %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
1074       func_modify_Makefile_am "(ACLOCAL_AMFLAGS): Add -I $m4dir."
1075     else
1076       (cat "$srcdir/Makefile.am"; echo; echo "ACLOCAL_AMFLAGS = -I $m4dir") > "$srcdir/Makefile.am.tmp"
1077       func_modify_Makefile_am "(ACLOCAL_AMFLAGS): New variable."
1078     fi
1079     # Also update Makefile.in and, if existent, Makefile. Otherwise they
1080     # would take into account the new flags only after a few rounds of
1081     # "./configure", "make", "touch configure.in", "make distclean".
1082     if $doit; then
1083       for file in Makefile.in Makefile; do
1084         if test -f "$srcdir/$file"; then
1085           func_backup $file
1086           rm -f "$srcdir/$file"
1087           sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file"
1088         fi
1089       done
1090     fi
1091   fi
1092   if test -n "$added_extradist"; then
1093     if grep '^EXTRA_DIST[       ]*=' "$srcdir/Makefile.am" > /dev/null; then
1094       sed -e "s%^\(EXTRA_DIST[  ]*=\)%\\1$added_extradist %" < "$srcdir/Makefile.am" > "$srcdir/Makefile.am.tmp"
1095       added_extradist_pretty=`echo $added_extradist | sed -e 's/ /, /g'`
1096       func_modify_Makefile_am "(EXTRA_DIST): Add $added_extradist_pretty."
1097     else
1098       (cat "$srcdir/Makefile.am"; echo; echo "EXTRA_DIST =$added_extradist") > "$srcdir/Makefile.am.tmp"
1099       func_modify_Makefile_am "(EXTRA_DIST): New variable."
1100     fi
1101   fi
1102   # Extract the aclocal options name from Makefile.am.
1103   aclocal_options=
1104   for arg in $macrodirs; do
1105     aclocal_options="$aclocal_options -I $arg"
1106   done
1107   please="$please
1108 Please run 'aclocal$aclocal_options' to regenerate the aclocal.m4 file.
1109 You need aclocal from GNU automake $min_automake_version (or newer) to do this.
1110 Then run 'autoconf' to regenerate the configure file.
1111 "
1112
1113   # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake
1114   # doesn't do it by itself.
1115   if $doit; then
1116     case "$added_acoutput" in
1117       *" $m4dir/Makefile")
1118         (cd "$srcdir" && automake "$m4dir/Makefile") 2>/dev/null ||
1119         please="$please
1120 Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in
1121 "
1122         ;;
1123     esac
1124   fi
1125 else
1126   please="$please
1127 Please add the files
1128 $m4filelist
1129 from the @datadir@/aclocal directory to your aclocal.m4 file.
1130 "
1131 fi
1132
1133 modified_configure_in=
1134 # func_modify_configure_in changelog_comment
1135 # assumes a modified copy of $srcdir/$configure_in in $srcdir/$configure_in.tmp
1136 # and replaces the original configure.in/ac file with the modified one if
1137 # the two files differ. Then it removes the modified copy.
1138 func_modify_configure_in ()
1139 {
1140   if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
1141     :
1142   else
1143     if test -z "$modified_configure_in"; then
1144       if $doit; then
1145         echo "Updating $configure_in (backup is in $configure_in~)"
1146         func_backup $configure_in
1147       else
1148         echo "Update $configure_in"
1149       fi
1150     fi
1151     if $doit; then
1152       rm -f "$srcdir/$configure_in"
1153       cp "$srcdir/$configure_in.tmp" "$srcdir/$configure_in"
1154     fi
1155     if $do_changelog; then
1156       if test -z "$modified_configure_in"; then
1157         func_ChangeLog_add_entry "      * $configure_in $1"
1158       else
1159         func_ChangeLog_add_entry "      $1"
1160       fi
1161     fi
1162     modified_configure_in=yes
1163   fi
1164   rm -f "$srcdir/$configure_in.tmp"
1165 }
1166
1167 if test -n "$added_acoutput"; then
1168   if grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev/null; then
1169     sedprog='
1170 ta
1171 b
1172 :a
1173 n
1174 ba'
1175     sed -e "s%^\\(AC_CONFIG_FILES([^])\\,]*\\)%\\1$added_acoutput%$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1176     added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
1177     func_modify_configure_in "(AC_CONFIG_FILES): Add $added_acoutput_pretty."
1178   else
1179     if grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev/null; then
1180       sed -e "s%^\\(AC_OUTPUT([^])\\,]*\\)%\\1$added_acoutput%" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1181       added_acoutput_pretty=`echo $added_acoutput | sed -e 's/ /, /g'`
1182       func_modify_configure_in "(AC_OUTPUT): Add $added_acoutput_pretty."
1183     else
1184       please="$please
1185 Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file.
1186 "
1187     fi
1188   fi
1189 fi
1190 if test -n "$removed_acoutput"; then
1191   for file in $removed_acoutput; do
1192     tag=
1193     sedprog='{
1194       s%\([[    ]\)'"$file"'[   ]%\1%
1195       s%\([[    ]\)'"$file"'\([]),]\)%\1\2%
1196       s%[[      ]'"$file"'$%%
1197         :a
1198         tb
1199         :b
1200         s%\\$%\\%
1201         tc
1202         bd
1203         :c
1204         n
1205         s%\([   ]\)'"$file"'[   ]%\1%
1206         s%\([   ]\)'"$file"'\([]),]\)%\1\2%
1207         s%[     ]'"$file"'$%%
1208         ba
1209       :d
1210     }'
1211     sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1212     if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
1213       sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1214       if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
1215         :
1216       else
1217         tag=AC_OUTPUT
1218       fi
1219     else
1220       tag=AC_CONFIG_FILES
1221     fi
1222     if test -n "$tag"; then
1223       func_modify_configure_in "($tag): Remove $file."
1224     else
1225       rm -f "$srcdir/$configure_in.tmp"
1226       if test "$file" != intl/intlh.inst; then
1227         please="$please
1228 Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation
1229 in the $configure_in file.
1230 "
1231       fi
1232     fi
1233   done
1234 fi
1235 sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1236 func_modify_configure_in "(AC_OUTPUT): Remove command that created po/Makefile."
1237 sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1238 func_modify_configure_in "(AC_LINK_FILES): Remove invocation."
1239 # AM_GNU_GETTEXT_VERSION may not be present, when AM_GNU_GETTEXT_REQUIRE_VERSION is used.
1240 if grep '^AM_GNU_GETTEXT_VERSION(' "$srcdir/$configure_in" 2>&1 >/dev/null; then
1241   sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION(['"$archive_version"'])/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
1242   func_modify_configure_in "(AM_GNU_GETTEXT_VERSION): Bump to $archive_version."
1243 fi
1244 $do_changelog && func_ChangeLog_finish
1245
1246 # Recommend replacement for deprecated Makefile variables.
1247 use_libtool=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'`
1248 for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do
1249   if test -f "$srcdir/$file"; then
1250     if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.in && grep automake "$srcdir/$file" >/dev/null 2>&1; then
1251       continue;
1252     fi
1253     # INTLLIBS is deprecated because it doesn't distinguish the two
1254     # cases: with libtool, without libtool.
1255     if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev/null 2>&1; then
1256       if test -n "$use_libtool"; then
1257         please="$please
1258 Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of
1259 @""INTLLIBS""@. Which one, depends whether it is used with libtool or not.
1260 @""INTLLIBS""@ will go away.
1261 "
1262       else
1263         please="$please
1264 Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@.
1265 @""INTLLIBS""@ will go away.
1266 "
1267       fi
1268     fi
1269     # DATADIRNAME is deprecated because we install only .gmo files nowadays,
1270     # which can be stored in the platform independent $prefix/share hierarchy.
1271     if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev/null 2>&1; then
1272       please="$please
1273 Please change $file to use the constant string \"share\" instead of
1274 @""DATADIRNAME""@. @""DATADIRNAME""@ will go away.
1275 "
1276     fi
1277     # INSTOBJEXT is deprecated because we install only .gmo files nowadays,
1278     # no catgets .cat catalogs.
1279     if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev/null 2>&1; then
1280       please="$please
1281 Please change $file to use the constant string \".mo\" instead of
1282 @""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away.
1283 "
1284     fi
1285     # GENCAT is deprecated because we install no catgets catalogs anymore.
1286     if grep '@''GENCAT''@' "$srcdir/$file" >/dev/null 2>&1; then
1287       please="$please
1288 Please change $file to use the constant string \"gencat\" instead of
1289 @""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more?
1290 "
1291     fi
1292     # POSUB is deprecated because it causes "./configure --disable-nls", "make",
1293     # "make dist" to create a buggy tarfile.
1294     if grep '@''POSUB''@' "$srcdir/$file" >/dev/null 2>&1; then
1295       please="$please
1296 Please change $file to use the constant string \"po\" instead of
1297 @""POSUB""@. @""POSUB""@ will go away.
1298 "
1299     fi
1300   fi
1301 done
1302
1303 # Recommend replacement for deprecated configure variables.
1304 if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev/null 2>&1; then
1305   please="$please
1306 Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the
1307 $configure_in file. Both will go away. Use <libintl.h> or \"gettext.h\" instead.
1308 "
1309 fi
1310
1311 # Recommend fetching config.guess and config.sub.
1312 if test -f "$srcdir/$auxdir"config.guess && test -f "$srcdir/$auxdir"config.sub; then
1313   :
1314 else
1315   please="$please
1316 You will also need config.guess and config.sub, which you can get from the CVS
1317 of the 'config' project at http://savannah.gnu.org/. The commands to fetch them
1318 are
1319 \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess'
1320 \$ wget 'http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub'
1321 "
1322 fi
1323
1324 if $doit; then
1325   echo "$please"
1326   echo "You might also want to copy the convenience header file gettext.h"
1327   echo "from the $gettext_datadir directory into your package."
1328   echo "It is a wrapper around <libintl.h> that implements the configure --disable-nls"
1329   echo "option."
1330   echo
1331   count=`echo "$please" | grep '^$' | wc -l`
1332   count=`echo "$count" | sed -e 's/[    ]//g'`
1333   case "$count" in
1334     1) count="paragraph";;
1335     2) count="two paragraphs";;
1336     3) count="three paragraphs";;
1337     4) count="four paragraphs";;
1338     5) count="five paragraphs";;
1339     *) count="$count paragraphs";;
1340   esac
1341   echo "Press Return to acknowledge the previous $count."
1342   # Read from /dev/tty, not stdin, so that gettextize cannot be abused by
1343   # non-interactive tools.
1344   read dummy < /dev/tty
1345 fi
1346
1347 exit 0