home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / bin / gettextize < prev    next >
Encoding:
Text File  |  2010-09-19  |  41.1 KB  |  1,282 lines

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