a896bec7ad46fd14dba81798c92da30884e37e24
[pspp-builds.git] / gettextize
1 #! /bin/sh
2 #
3 # Copyright (C) 1995-1998, 2000-2002 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 2, or (at your option)
8 # 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, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 #
19
20 # This file was copied from gettextize version 0.11.5 and modified to allow
21 # sensible use --- what the gettext maintainers call `misuse' and refuse to
22 # support.  John Darrington 3 Feb 2004
23
24 progname=$0
25 package=gettext
26 version=0.11.5-jmd-hacked
27
28 # func_usage
29 # outputs to stdout the --help usage message.
30 func_usage ()
31 {
32   echo "\
33 Usage: gettextize [OPTION]... [package-dir]
34
35 Prepares a source package to use gettext.
36
37 Options:
38       --help           print this help and exit
39       --version        print version information and exit
40   -c, --copy           copy files instead of making symlinks
41   -f, --force          force writing of new files even if old exist
42       --intl           install libintl in a subdirectory
43       --no-changelog   don't update or create ChangeLog files
44   -n, --dry-run        print modifications but don't perform them
45
46 Report bugs to <bug-gnu-gettext@gnu.org>."
47 }
48
49 # func_version
50 # outputs to stdout the --version message.
51 func_version ()
52 {
53   echo "$progname (GNU $package) $version"
54   echo "Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
55 This is free software; see the source for copying conditions.  There is NO
56 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
57   echo "Written by" "Ulrich Drepper"
58 }
59
60 # func_fatal_error message
61 # outputs to stderr a fatal error message, and terminates the program.
62 func_fatal_error ()
63 {
64   echo "gettextize: *** $1" 1>&2
65   echo "gettextize: *** Stop." 1>&2
66   exit 1
67 }
68
69 # Command-line option processing.
70 # Removes the OPTIONS from the arguments. Sets the variables:
71 # - force           1 if --force was given, 0 otherwise
72 # - intldir         yes if --intl was given, empty otherwise
73 # - try_ln_s        false if --copy was given, : otherwise
74 # - do_changelog    false if --no-changelog was given, : otherwise
75 # - doit            false if --dry-run was given, : otherwise
76 {
77   force=0
78   intldir=
79   try_ln_s=:
80   do_changelog=:
81   doit=:
82
83   while test $# -gt 0; do
84     case "$1" in
85       -c | --copy | --cop | --co | --c )
86         shift
87         try_ln_s=false ;;
88       -n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
89         shift
90         doit=false ;;
91       -f | --force | --forc | --for | --fo | --f )
92         shift
93         force=1 ;;
94       --help | --hel | --he | --h )
95         func_usage; exit 0 ;;
96       --intl | --int | --in | --i )
97         shift
98         intldir=yes ;;
99       --no-changelog | --no-changelo | --no-changel | --no-change | --no-chang | --no-chan | --no-cha | --no-ch | --no-c )
100         shift
101         do_changelog=false ;;
102       --version | --versio | --versi | --vers | --ver | --ve | --v )
103         func_version
104         exit 0 ;;
105       -- )      # Stop option prcessing
106         shift; break ;;
107       -* )
108         echo "gettextize: unknown option $1" 1>&2
109         echo "Try 'gettextize --help' for more information." 1>&2
110         exit 1 ;;
111       * )
112         break ;;
113     esac
114   done
115 }
116
117 # Command-line argument processing.
118 # Analyzes the remaining arguments.
119 # Sets the variables
120 # - origdir         to the original directory,
121 # - srcdir          to the package directory, and cd-s into it.
122 {
123   if test $# -gt 1; then
124     func_usage 1>&2
125     exit 1
126   fi
127   origdir=`pwd`
128   if test $# -eq 1; then
129     srcdir=$1
130     if cd "$srcdir"; then
131       srcdir=`pwd`
132     else
133       func_fatal_error "Cannot change directory to '$srcdir'."
134     fi
135   else
136     srcdir=$origdir
137   fi
138 }
139
140 # The current directory is now $srcdir.
141
142 # Set variable
143 # - gettext_dir     directory where the sources are stored.
144 prefix="/usr"
145 gettext_dir="${prefix}/share/gettext"
146
147 # Check integrity of package: A configure.in/ac must be present. Sets variable
148 # - configure_in    name of configure.in/ac file.
149 test -f configure.in || test -f configure.ac ||
150   func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
151 configure_in=NONE
152 if test -f configure.in; then
153   configure_in=configure.in
154 else
155   if test -f configure.ac; then
156     configure_in=configure.ac
157   fi
158 fi
159
160 # Check whether the --force option is needed but has not been specified.
161 if test $force -eq 0; then
162   if test -d intl; then
163     func_fatal_error "intl/ subdirectory exists: use option -f if you really want to delete it."
164   fi
165   if test -f po/Makefile.in.in; then
166     func_fatal_error "po/Makefile.in.in exists: use option -f if you really want to delete it."
167   fi
168   if test -f ABOUT-NLS; then
169     func_fatal_error "ABOUT-NLS exists: use option -f if you really want to delete it."
170   fi
171 fi
172
173 # Check in which directory config.rpath, mkinstalldirs etc. belong.
174 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`
175 if test -n "$auxdir"; then
176   auxdir="$auxdir/"
177 fi
178
179 # For simplicity we change to the gettext source directory.
180 cd $gettext_dir ||
181   func_fatal_error "gettext source directory '${gettext_dir}' doesn't exist"
182
183 # Variables which keep track what has been modified.
184 added_directories=
185 removed_directory=
186 added_extradist=
187 added_acoutput=
188 removed_acoutput=" intl/intlh.inst"
189
190 # Variable:
191 # - please          accumulates instructions for the user.
192 please=
193
194 # Variable:
195 # - date            current date, for use in ChangeLog entries.
196 date=`date +%Y-%m-%d`
197
198 # func_copy from to
199 # copies a file.
200 # 'from' is a relative pathname, relative to the current directory.
201 # 'to' is a relative pathname, relative to $srcdir.
202 func_copy ()
203 {
204   if $doit; then
205     rm -f "$srcdir/$2"
206     echo "Copying file $2"
207     cp "$1" "$srcdir/$2"
208   else
209     echo "Copy file $2"
210   fi
211 }
212
213 # func_linkorcopy from absfrom to
214 # links or copies a file.
215 # 'from' is a relative pathname, relative to the current directory.
216 # 'absfrom' is the corresponding absolute pathname.
217 # 'to' is a relative pathname, relative to $srcdir.
218 func_linkorcopy ()
219 {
220   if $doit; then
221     rm -f "$srcdir/$3"
222     ($try_ln_s && ln -s "$2" "$srcdir/$3" && echo "Symlinking file $3") 2>/dev/null ||
223     { echo "Copying file $3"; cp "$1" "$srcdir/$3"; }
224   else
225     if $try_ln_s; then
226       echo "Symlink file $3"
227     else
228       echo "Copy file $3"
229     fi
230   fi
231 }
232
233 # func_backup to
234 # makes a backup of a file that is about to be overwritten or replaced.
235 # 'to' is a relative pathname, relative to $srcdir.
236 func_backup ()
237 {
238   if $doit; then
239     if test -f "$srcdir/$1"; then
240       rm -f "$srcdir/$1~"
241       cp -p "$srcdir/$1" "$srcdir/$1~"
242     fi
243   fi
244 }
245
246 # func_remove to
247 # removes a file.
248 # 'to' is a relative pathname, relative to $srcdir.
249 func_remove ()
250 {
251   if $doit; then
252     echo "Removing $1"
253     rm -f "$srcdir/$1"
254   else
255     echo "Remove $1"
256   fi
257 }
258
259 # func_ChangeLog_init
260 # func_ChangeLog_add_entry line
261 # func_ChangeLog_finish
262 # manage the ChangeLog file, relative to $srcdir.
263 func_ChangeLog_init ()
264 {
265   modified_ChangeLog=
266 }
267 func_ChangeLog_add_entry ()
268 {
269   if $doit; then
270     if test -z "$modified_ChangeLog"; then
271       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/ChangeLog.tmp"
272       echo >> "$srcdir/ChangeLog.tmp"
273       modified_ChangeLog=yes
274     fi
275     echo "$1" >> "$srcdir/ChangeLog.tmp"
276   else
277     modified_ChangeLog=yes
278   fi
279 }
280 func_ChangeLog_finish ()
281 {
282   if test -n "$modified_ChangeLog"; then
283     if $doit; then
284       echo >> "$srcdir/ChangeLog.tmp"
285       if test -f "$srcdir/ChangeLog"; then
286         echo "Adding an entry to ChangeLog (backup is in ChangeLog~)"
287         cat "$srcdir/ChangeLog" >> "$srcdir/ChangeLog.tmp"
288         rm -f "$srcdir/ChangeLog~"
289         cp -p "$srcdir/ChangeLog" "$srcdir/ChangeLog~"
290       else
291         echo "Creating ChangeLog"
292       fi
293       cp "$srcdir/ChangeLog.tmp" "$srcdir/ChangeLog"
294       rm -f "$srcdir/ChangeLog.tmp"
295     else
296       if test -f "$srcdir/ChangeLog"; then
297         echo "Add an entry to ChangeLog"
298       else
299         echo "Create ChangeLog"
300       fi
301     fi
302   fi
303 }
304
305 # func_poChangeLog_init
306 # func_poChangeLog_add_entry line
307 # func_poChangeLog_finish
308 # manage the po/ChangeLog file, relative to $srcdir.
309 func_poChangeLog_init ()
310 {
311   modified_poChangeLog=
312 }
313 func_poChangeLog_add_entry ()
314 {
315   if $doit; then
316     if test -z "$modified_poChangeLog"; then
317       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/po/ChangeLog.tmp"
318       echo >> "$srcdir/po/ChangeLog.tmp"
319       modified_poChangeLog=yes
320     fi
321     echo "$1" >> "$srcdir/po/ChangeLog.tmp"
322   else
323     modified_poChangeLog=yes
324   fi
325 }
326 func_poChangeLog_finish ()
327 {
328   if test -n "$modified_poChangeLog"; then
329     if $doit; then
330       echo >> "$srcdir/po/ChangeLog.tmp"
331       if test -f "$srcdir/po/ChangeLog"; then
332         echo "Adding an entry to po/ChangeLog (backup is in po/ChangeLog~)"
333         cat "$srcdir/po/ChangeLog" >> "$srcdir/po/ChangeLog.tmp"
334         rm -f "$srcdir/po/ChangeLog~"
335         cp -p "$srcdir/po/ChangeLog" "$srcdir/po/ChangeLog~"
336       else
337         echo "Creating po/ChangeLog"
338       fi
339       cp "$srcdir/po/ChangeLog.tmp" "$srcdir/po/ChangeLog"
340       rm -f "$srcdir/po/ChangeLog.tmp"
341     else
342       if test -f "$srcdir/po/ChangeLog"; then
343         echo "Add an entry to po/ChangeLog"
344       else
345         echo "Create po/ChangeLog"
346       fi
347     fi
348   fi
349 }
350
351 # func_m4ChangeLog_init
352 # func_m4ChangeLog_add_entry line
353 # func_m4ChangeLog_finish
354 # manage the $m4dir/ChangeLog file, relative to $srcdir.
355 func_m4ChangeLog_init ()
356 {
357   modified_m4ChangeLog=
358 }
359 func_m4ChangeLog_add_entry ()
360 {
361   if $doit; then
362     if test -z "$modified_m4ChangeLog"; then
363       echo "$date  gettextize  <bug-gnu-gettext@gnu.org>" > "$srcdir/$m4dir/ChangeLog.tmp"
364       echo >> "$srcdir/$m4dir/ChangeLog.tmp"
365       modified_m4ChangeLog=yes
366     fi
367     echo "$1" >> "$srcdir/$m4dir/ChangeLog.tmp"
368   else
369     modified_m4ChangeLog=yes
370   fi
371 }
372 func_m4ChangeLog_finish ()
373 {
374   if test -n "$modified_m4ChangeLog"; then
375     if $doit; then
376       echo >> "$srcdir/$m4dir/ChangeLog.tmp"
377       if test -f "$srcdir/$m4dir/ChangeLog"; then
378         echo "Adding an entry to $m4dir/ChangeLog (backup is in $m4dir/ChangeLog~)"
379         cat "$srcdir/$m4dir/ChangeLog" >> "$srcdir/$m4dir/ChangeLog.tmp"
380         rm -f "$srcdir/$m4dir/ChangeLog~"
381         cp -p "$srcdir/$m4dir/ChangeLog" "$srcdir/$m4dir/ChangeLog~"
382       else
383         echo "Creating $m4dir/ChangeLog"
384       fi
385       cp "$srcdir/$m4dir/ChangeLog.tmp" "$srcdir/$m4dir/ChangeLog"
386       rm -f "$srcdir/$m4dir/ChangeLog.tmp"
387     else
388       if test -f "$srcdir/$m4dir/ChangeLog"; then
389         echo "Add an entry to $m4dir/ChangeLog"
390       else
391         echo "Create $m4dir/ChangeLog"
392       fi
393     fi
394   fi
395 }
396
397 if test ! -f "$srcdir/intl/Makefile.in" && test -n "$intldir"; then
398   added_acoutput="$added_acoutput intl/Makefile"
399 fi
400 if test -f "$srcdir/intl/Makefile.in" && test -z "$intldir"; then
401   removed_acoutput="$removed_acoutput intl/Makefile"
402 fi
403 if test -d "$srcdir/intl"; then
404   # Remove everything inside intl except for RCS and CVS subdirs and invisible
405   # files.
406   if $doit; then
407     echo "Wiping out intl/ subdirectory"
408     (cd "$srcdir/intl" &&
409      for f in *; do
410        if test CVS != "$f" && test RCS != "$f"; then
411          rm -rf "$f"
412        fi
413      done)
414   else
415     echo "Wipe out intl/ subdirectory"
416   fi
417   if test -z "$intldir"; then
418     removed_directory=intl
419   fi
420 else
421   if test -n "$intldir"; then
422     if $doit; then
423       echo "Creating intl/ subdirectory"
424       mkdir "$srcdir/intl" || func_fatal_error "failed to create intl/ subdirectory"
425     else
426       echo "Create intl/ subdirectory"
427     fi
428     added_directories="$added_directories intl"
429   fi
430 fi
431
432 $do_changelog && func_ChangeLog_init
433
434 test -d "$srcdir/po" || {
435   if $doit; then
436     echo "Creating po/ subdirectory"
437     mkdir "$srcdir/po" || func_fatal_error "failed to create po/ subdirectory"
438   else
439     echo "Create po/ subdirectory"
440   fi
441 }
442
443 # Now copy all files.  Take care for the destination directories.
444 for file in *; do
445   case $file in
446     ABOUT-NLS)
447       func_linkorcopy $file "$gettext_dir/$file" $file
448       ;;
449     config.rpath | mkinstalldirs)
450       if test -f "$srcdir/$auxdir$file"; then
451         :
452       else
453         added_extradist="$added_extradist $auxdir$file"
454       fi
455       func_linkorcopy $file "$gettext_dir/$file" "$auxdir$file"
456       ;;
457   esac
458 done
459
460 # Copy files to intl/ subdirectory.
461 if test -n "$intldir"; then
462   cd intl
463   for file in *; do
464     if test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
465       if test $file != plural.c; then
466         func_linkorcopy $file "$gettext_dir/intl/$file" intl/$file
467       else
468         # plural.c is a generated file; it must be copied and touched.
469         func_copy $file intl/$file
470         if $doit; then
471           (sleep 2; touch "$srcdir/intl/$file") &
472         fi
473       fi
474     fi
475   done
476   cd ..
477 else
478   echo "Not copying intl/ directory."
479   please="$please
480 Please use AM_GNU_GETTEXT([external]) in order to cause autoconfiguration
481 to look for an external libintl.
482 "
483 fi
484
485 # Copy files to po/ subdirectory.
486 $do_changelog && func_poChangeLog_init
487 cd po
488 for file in Makefile.in.in; do
489   same=no
490   if test -f "$srcdir/po/$file"; then
491     if cmp -s $file "$srcdir/po/$file"; then
492       same=yes
493     fi
494   else
495     added_acoutput="$added_acoutput po/Makefile.in"
496   fi
497   if $do_changelog && test $same = no; then
498     if test -f "$srcdir/po/$file"; then
499       func_poChangeLog_add_entry "      * $file: Upgrade to gettext-${version}."
500     else
501       func_poChangeLog_add_entry "      * $file: New file, from gettext-${version}."
502     fi
503   fi
504   func_backup po/$file
505   func_linkorcopy $file "$gettext_dir/po/$file" po/$file
506 done
507 for file in *; do
508   case $file in
509     Makefile.in.in)
510       # Already handled above.
511       ;;
512     Makevars)
513       func_linkorcopy $file "$gettext_dir/po/$file" po/$file.template
514       if test -f "$srcdir/po/$file"; then
515         sed -n -e 's/[  ]*\([A-Za-z0-9_]*\)[    ]*=.*/\1/p' < "$srcdir/po/$file" | LC_ALL=C sort > "$srcdir/po/$file.tmp1"
516         sed -n -e 's/[  ]*\([A-Za-z0-9_]*\)[    ]*=.*/\1/p' < "$srcdir/po/$file.template" | LC_ALL=C sort > "$srcdir/po/$file.tmp2"
517         missingvars=`LC_ALL=C comm -13 "$srcdir/po/$file.tmp1" "$srcdir/po/$file.tmp2"`
518         rm -f "$srcdir/po/$file.tmp1" "$srcdir/po/$file.tmp2"
519         if test -n "$missingvars"; then
520           please="$please
521 Please update po/$file so that it defines all the variables mentioned
522 in po/$file.template.
523 You can then remove po/$file.template.
524 "
525         fi
526       else
527         please="$please
528 Please create po/$file from the template in po/$file.template.
529 You can then remove po/$file.template.
530 "
531       fi
532       ;;
533     *)
534       same=no
535       if test -f "$srcdir/po/$file"; then
536         if cmp -s $file "$srcdir/po/$file"; then
537           same=yes
538         fi
539       fi
540       if $do_changelog && test $same = no; then
541         if test -f "$srcdir/po/$file"; then
542           func_poChangeLog_add_entry "  * $file: Upgrade to gettext-${version}."
543         else
544           func_poChangeLog_add_entry "  * $file: New file, from gettext-${version}."
545         fi
546       fi
547       func_backup po/$file
548       func_linkorcopy $file $gettext_dir/po/$file po/$file
549       ;;
550   esac
551 done
552 if test -f "$srcdir/po/cat-id-tbl.c"; then
553   func_remove po/cat-id-tbl.c
554   $do_changelog && func_poChangeLog_add_entry " * cat-id-tbl.c: Remove file."
555 fi
556 if test -f "$srcdir/po/stamp-cat-id"; then
557   func_remove po/stamp-cat-id
558   $do_changelog && func_poChangeLog_add_entry " * stamp-cat-id: Remove file."
559 fi
560 $do_changelog && func_poChangeLog_finish
561
562 m4filelist='  codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4
563   inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4
564   lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4'
565 # We cannot omit codeset.m4, glibc21.m4, intdiv0.m4, inttypes.m4,
566 # inttypes_h.m4, isc-posix.m4, lcmessage.m4, stdint_h.m4, uintmax_t.m4
567 # if test -z "$intldir", otherwise "aclocal -I m4" might give an error.
568 # (aclocal doesn't know which macros are really needed, it looks which macros
569 # are potentially needed.)
570
571 # All sorts of bugs could occur if the configure file was remade with the wrong
572 # version of gettext.m4 et al. (because then the configure and the po/Makefile.in.in
573 # don't fit together). It is therefore important that the package carries the
574 # right versions of gettext.m4 et al. with it.
575 if test -f "$srcdir/Makefile.am"; then
576   # A package using automake.
577
578   # Extract the macro directory name from Makefile.am.
579   aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[      ]*=' "$srcdir/Makefile.am" | sed -e 's/^ACLOCAL_AMFLAGS[        ]*=\(.*\)$/\1/'`
580   m4dir=m4
581   m4dir_is_next=
582   for arg in $aclocal_amflags; do
583     if test -n "$m4dir_is_next"; then
584       m4dir="$arg"
585       break
586     else
587       if test "X$arg" = "X-I"; then
588         m4dir_is_next=yes
589       else
590         m4dir_is_next=
591       fi
592     fi
593   done
594
595   # Update the *.m4 files and the corresponding Makefile.am.
596   $do_changelog && func_m4ChangeLog_init
597   added_m4files=
598   if test -d "$srcdir/$m4dir"; then
599     :
600   else
601     if $doit; then
602       echo "Creating directory $m4dir"
603       mkdir "$srcdir/$m4dir"
604     else
605       echo "Create directory $m4dir"
606     fi
607     added_directories="$added_directories $m4dir"
608   fi
609   for file in $m4filelist; do
610     same=no
611     if test -f "$srcdir/$m4dir/$file"; then
612       if cmp -s "${prefix}/share/aclocal/$file" "$srcdir/$m4dir/$file"; then
613         same=yes
614       fi
615     else
616       added_m4files="$added_m4files $file"
617     fi
618     if $do_changelog && test $same = no; then
619       if test -f "$srcdir/$m4dir/$file"; then
620         func_m4ChangeLog_add_entry "    * $file: Upgrade to gettext-${version}."
621       else
622         func_m4ChangeLog_add_entry "    * $file: New file, from gettext-${version}."
623       fi
624     fi
625     func_backup "$m4dir/$file"
626     func_linkorcopy "${prefix}/share/aclocal/$file" "${prefix}/share/aclocal/$file" "$m4dir/$file"
627   done
628   if test -n "$added_m4files"; then
629     if test -f "$srcdir/$m4dir/Makefile.am"; then
630       if $doit; then
631         echo "Updating EXTRA_DIST in $m4dir/Makefile.am (backup is in $m4dir/Makefile.am~)"
632         func_backup "$m4dir/Makefile.am"
633         rm -f "$srcdir/$m4dir/Makefile.am"
634         if grep '^EXTRA_DIST[   ]*=' "$srcdir/$m4dir/Makefile.am~" > /dev/null; then
635           sed -e "s%^\(EXTRA_DIST[      ]*=\)%\\1$added_m4files %" < "$srcdir/$m4dir/Makefile.am~" > "$srcdir/$m4dir/Makefile.am"
636           $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): Add the new files."
637         else
638           (cat "$srcdir/$m4dir/Makefile.am~"; echo; echo "EXTRA_DIST =$added_m4files") > "$srcdir/$m4dir/Makefile.am"
639           $do_changelog && func_m4ChangeLog_add_entry " * Makefile.am (EXTRA_DIST): New variable."
640         fi
641       else
642         echo "Update EXTRA_DIST in $m4dir/Makefile.am"
643         $do_changelog && func_m4ChangeLog_add_entry "   * Makefile.am (EXTRA_DIST)."
644       fi
645     else
646       if $doit; then
647         echo "Creating $m4dir/Makefile.am"
648         echo "EXTRA_DIST =$added_m4files" > "$srcdir/$m4dir/Makefile.am"
649       else
650         echo "Create $m4dir/Makefile.am"
651       fi
652       $do_changelog && func_m4ChangeLog_add_entry "     * Makefile.am: New file."
653       added_acoutput="$added_acoutput $m4dir/Makefile"
654     fi
655   fi
656   $do_changelog && func_m4ChangeLog_finish
657   # Also create $m4dir/Makefile.in from $m4dir/Makefile.am, because automake
658   # doesn't do it by itself.
659   if $doit; then
660     case "$added_acoutput" in
661       *" $m4dir/Makefile")
662         (cd "$srcdir" && automake "$m4dir/Makefile") 2>/dev/null ||
663         please="$please
664 Please run 'automake $m4dir/Makefile' to create $m4dir/Makefile.in
665 "
666         ;;
667     esac
668   fi
669
670   # Update the top-level Makefile.am.
671   modified_Makefile_am=
672
673   # [snip]
674
675
676   if test -z "$m4dir_is_next"; then
677     # Also update Makefile.in and, if existent, Makefile. Otherwise they
678     # would take into account the new flags only after a few rounds of
679     # "./configure", "make", "touch configure.in", "make distclean".
680     if $doit; then
681       for file in Makefile.in Makefile; do
682         if test -f "$srcdir/$file"; then
683           func_backup $file
684           rm -f "$srcdir/$file"
685           sed -e "s%(ACLOCAL)%(ACLOCAL) -I $m4dir%" < "$srcdir/$file~" > "$srcdir/$file"
686         fi
687       done
688     fi
689   fi
690   please="$please
691 Please run 'aclocal -I $m4dir' to regenerate the aclocal.m4 file.
692 You need aclocal from GNU automake 1.5 (or newer) to do this.
693 Then run 'autoconf' to regenerate the configure file.
694 "
695 else
696   please="$please
697 Please add the files
698 $m4filelist
699 from the ${prefix}/share/aclocal directory to your aclocal.m4 file.
700 "
701 fi
702
703 modified_configure_in=
704
705 # [snip]
706
707 if test -n "$added_acoutput"; then
708   if ! grep '^AC_CONFIG_FILES(' "$srcdir/$configure_in" > /dev/null; then
709     if ! grep '^AC_OUTPUT(' "$srcdir/$configure_in" > /dev/null; then
710       please="$please
711 Please add$added_acoutput to the AC_OUTPUT or AC_CONFIG_FILES invocation in the $configure_in file.
712 "
713     fi
714   fi
715 fi
716 if test -n "$removed_acoutput"; then
717   for file in $removed_acoutput; do
718     tag=
719     sedprog='{
720       s%\([[    ]\)'"$file"'[   ]%\1%
721       s%\([[    ]\)'"$file"'\([]),]\)%\1\2%
722       s%[[      ]'"$file"'$%%
723         :a
724         tb
725         :b
726         s%\\$%\\%
727         tc
728         bd
729         :c
730         n
731         s%\([   ]\)'"$file"'[   ]%\1%
732         s%\([   ]\)'"$file"'\([]),]\)%\1\2%
733         s%[     ]'"$file"'$%%
734         ba
735       :d
736     }'
737     sed -e '/^AC_CONFIG_FILES(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
738     if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
739       sed -e '/^AC_OUTPUT(/'"$sedprog" < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
740       if cmp -s "$srcdir/$configure_in" "$srcdir/$configure_in.tmp"; then
741         :
742       else
743         tag=AC_OUTPUT
744       fi
745     else
746       tag=AC_CONFIG_FILES
747     fi
748     if ! test -n "$tag"; then
749       rm -f "$srcdir/$configure_in.tmp"
750       if test "$file" != intl/intlh.inst; then
751         please="$please
752 Please remove $file from the AC_OUTPUT or AC_CONFIG_FILES invocation
753 in the $configure_in file.
754 "
755       fi
756     fi
757   done
758 fi
759 sed -e 's%sed -e "/POTFILES =/r po/POTFILES" po/Makefile\.in > po/Makefile *;* *%%' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
760 sed -e '/^\(dnl \|\)AC_LINK_FILES(\$nls_cv_header_libgt, \$nls_cv_header_intl)$/d' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
761 sed -e 's/^AM_GNU_GETTEXT_VERSION([^()]*)/AM_GNU_GETTEXT_VERSION('"$version"')/' < "$srcdir/$configure_in" > "$srcdir/$configure_in.tmp"
762 $do_changelog && func_ChangeLog_finish
763
764 # Recommend replacement for deprecated Makefile variables.
765 use_libtool=`cat "$srcdir/$configure_in" | grep '^A[CM]_PROG_LIBTOOL'`
766 for file in `(cd "$srcdir"; find . -name Makefile.am -print; find . -name Makefile.in -print) | sed -e 's,^\./,,'`; do
767   if test -f "$srcdir/$file"; then
768     if test `echo "$file" | sed -e 's,^.*/,,'` = Makefile.in && grep automake "$srcdir/$file" >/dev/null 2>&1; then
769       continue;
770     fi
771     # INTLLIBS is deprecated because it doesn't distinguish the two
772     # cases: with libtool, without libtool.
773     if grep '@''INTLLIBS''@' "$srcdir/$file" >/dev/null 2>&1; then
774       if test -n "$use_libtool"; then
775         please="$please
776 Please change $file to use @""LTLIBINTL""@ or @""LIBINTL""@ instead of
777 @""INTLLIBS""@. Which one, depends whether it is used with libtool or not.
778 @""INTLLIBS""@ will go away.
779 "
780       else
781         please="$please
782 Please change $file to use @""LIBINTL""@ instead of @""INTLLIBS""@.
783 @""INTLLIBS""@ will go away.
784 "
785       fi
786     fi
787     # DATADIRNAME is deprecated because we install only .gmo files nowadays,
788     # which can be stored in the platform independent $prefix/share hierarchy.
789     if grep '@''DATADIRNAME''@' "$srcdir/$file" >/dev/null 2>&1; then
790       please="$please
791 Please change $file to use the constant string \"share\" instead of
792 @""DATADIRNAME""@. @""DATADIRNAME""@ will go away.
793 "
794     fi
795     # INSTOBJEXT is deprecated because we install only .gmo files nowadays,
796     # no catgets .cat catalogs.
797     if grep '@''INSTOBJEXT''@' "$srcdir/$file" >/dev/null 2>&1; then
798       please="$please
799 Please change $file to use the constant string \".mo\" instead of
800 @""INSTOBJEXT""@. @""INSTOBJEXT""@ will go away.
801 "
802     fi
803     # GENCAT is deprecated because we install no catgets catalogs anymore.
804     if grep '@''GENCAT''@' "$srcdir/$file" >/dev/null 2>&1; then
805       please="$please
806 Please change $file to use the constant string \"gencat\" instead of
807 @""GENCAT""@. @""GENCAT""@ will go away. Maybe you don't even need it any more?
808 "
809     fi
810     # POSUB is deprecated because it causes "./configure --disable-nls", "make",
811     # "make dist" to create a buggy tarfile.
812     if grep '@''POSUB''@' "$srcdir/$file" >/dev/null 2>&1; then
813       please="$please
814 Please change $file to use the constant string \"po\" instead of
815 @""POSUB""@. @""POSUB""@ will go away.
816 "
817     fi
818   fi
819 done
820
821 # Recommend replacement for deprecated configure variables.
822 if grep '\$nls_cv_header_' "$srcdir/$configure_in" >/dev/null 2>&1; then
823   please="$please
824 Please stop using \$nls_cv_header_intl or \$nls_cv_header_libgt in the
825 $configure_in file. Both will go away. Use <libintl.h> or \"gettext.h\" instead.
826 "
827 fi