home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / gettext-0.10.24-bin.lha / bin / gettextize < prev    next >
Text File  |  1996-10-12  |  5KB  |  230 lines

  1. #! /bin/sh
  2. #
  3. # Copyright (C) 1995, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. #
  19.  
  20. # This file is meant for authors or maintainers which want to
  21. # internationalize their package with the help of GNU gettext.  For
  22. # further information how to use it consult the GNU gettext manual.
  23.  
  24. echo=echo
  25. progname=$0
  26. force=0
  27. configstatus=0
  28. origdir=`pwd`
  29. usage="\
  30. Usage: gettextize [OPTION]... [package-dir]
  31.   -h, --help           print this help and exit
  32.   -v, --version        print version information and exit
  33.   -c, --copy           copy files instead of making symlinks
  34.   -f, --force          force writing of new files even if old exist"
  35. package=gettext
  36. version=0.10.24
  37. aclocal_version=0.10.24
  38. try_ln_s=:
  39.  
  40. while test $# -gt 0; do
  41.   case "$1" in
  42.     -c | --copy | --c* )
  43.       shift
  44.       try_ln_s=false ;;
  45.     -f | --force | --f* )
  46.       shift
  47.       force=1 ;;
  48.     -r | --run | --r* )
  49.       shift
  50.       configstatus=1 ;;
  51.     -h | --help | --h* )
  52.       $echo "$usage"; exit 0 ;;
  53.     --version | --v* )
  54.       echo "$progname - GNU $package $version"; exit 0 ;;
  55.     -- )    # Stop option prcessing
  56.       shift; break ;;
  57.     -* )
  58.       $echo "$usage"; exit 1 ;;
  59.     * )
  60.       break ;;
  61.   esac
  62. done
  63.  
  64. if test $# -gt 1; then
  65.   $echo "$usage"
  66.   exit 1
  67. fi
  68.  
  69. # Fill in the command line options value.
  70. if test $# -eq 1; then
  71.   srcdir=$1
  72.   if cd $srcdir; then
  73.     srcdir=`pwd`
  74.   else
  75.     $echo "Cannot change directory to \`$srcdir'"
  76.     exit 1
  77.   fi
  78. else
  79.   srcdir=$origdir
  80. fi
  81.  
  82. # Directory where the sources are stored.
  83. prefix=/ade
  84. gettext_dir=${prefix}/share/gettext
  85.  
  86. test -f configure.in || {
  87.   $echo "Missing configure.in, please cd to your package first."
  88.   exit 1
  89. }
  90.  
  91. if test -d intl && test $force -eq 0; then
  92.   $echo "\
  93. intl/ subdirectory exists: use option -f if you really want to delete it."
  94.   exit 1
  95. fi
  96.  
  97. if test -f po/Makefile.in.in && test $force -eq 0; then
  98.   $echo "\
  99. po/Makefile.in.in exists: use option -f if you really want to delete it."
  100.   exit 1
  101. fi
  102.  
  103. if test -f NLS && test $force -eq 0; then
  104.   $echo "NLS exists: use option -f if you really want to delete it."
  105.   exit 1
  106. fi
  107.  
  108. rm -fr intl
  109. mkdir intl || {
  110.   $echo "failed to create intl/ subdirectory"
  111.   exit 1;
  112. }
  113.  
  114. test -d po || mkdir po || {
  115.    $echo "failed to create po/ subdirectory"
  116.    exit 1
  117. }
  118.  
  119. # For simplicity we changed to the gettext source directory.
  120. cd $gettext_dir
  121.  
  122. # Now copy all files.  Take care for the destination directories.
  123. for file in *; do
  124.   case $file in
  125.     intl | po | demo)
  126.       ;;
  127.     *)
  128.       rm -f $srcdir/$file
  129.       ($try_ln_s && ln -s $gettext_dir/$file $srcdir/$file) 2>/dev/null ||
  130.       cp $file $srcdir/$file
  131.       ;;
  132.   esac
  133. done
  134.  
  135. # Copy files to intl/ subdirectory.
  136. cd intl
  137. for file in *; do
  138.   rm -f $srcdir/intl/$file
  139.   ($try_ln_s && ln -s $gettext_dir/intl/$file $srcdir/intl/$file) 2>/dev/null ||
  140.   cp $file $srcdir/intl/$file
  141. done
  142.  
  143. # Copy files to po/ subdirectory.
  144. cd ../po
  145. for file in *; do
  146.   rm -f $srcdir/po/$file
  147.   ($try_ln_s && ln -s $gettext_dir/po/$file $srcdir/po/$file) 2>/dev/null ||
  148.   cp $file $srcdir/po/$file
  149. done
  150.  
  151.  
  152. # Check whether we can run config.status to produce intl/Makefile.in.
  153. cd $origdir
  154. if test -f ./config.status; then
  155.   if test $configstatus -eq 0; then
  156.     echo "Shall I run config.status? (y/N)"
  157.     read ans
  158.     case "$ans" in
  159.       y* | Y* | 1* )
  160.     configstatus=1 ;;
  161.       * )
  162.     ;;
  163.     esac
  164.   fi
  165.  
  166.   test $configstatus -ne 0 &&
  167.     (CONFIG_FILES=intl/Makefile CONFIG_HEADERS= ./config.status)
  168. fi
  169.  
  170. merge=no
  171. OLD_IFS="$IFS"
  172. IFS="."
  173. cntr=0
  174. major=0; minor=0; subminor=0
  175. for num in $aclocal_version; do
  176.   case $cntr in
  177.     0) major=$num;;
  178.     1) minor=$num;;
  179.     2) subminor=$num;;
  180.   esac
  181.   cntr=`expr $cntr + 1`
  182. done
  183. IFS="$OLD_IFS"
  184.  
  185. set `sed -e 's/.*Last updated for gettext-\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]\)*.*/\1 \2 \3/p' -e d aclocal.m4` >/dev/null
  186.  
  187.  
  188. if test $# -lt 2 || test $# -gt 3; then
  189.   merge=yes
  190. else
  191.   here_major=$1; here_minor=$2
  192.   if test $# -eq 2; then
  193.     here_subminor=0
  194.   else
  195.     here_subminor=$3
  196.   fi
  197.  
  198.   if test $major -eq $here_major; then
  199.     if test $minor -eq $here_minor; then
  200.       if test $subminor -lt $here_subminor; then
  201.     merge=gettext
  202.       elif test $subminor -gt $here_subminor; then
  203.     merge=yes
  204.       fi
  205.     else
  206.       if test $minor -lt $here_minor; then
  207.     merge=gettext
  208.       else
  209.     merge=yes
  210.       fi
  211.     fi
  212.   else
  213.     if test $major -lt $here_major; then
  214.       merge=gettext
  215.     else
  216.       merge=yes
  217.     fi
  218.   fi
  219. fi
  220.  
  221. if test "$merge" = "yes"; then
  222.   $echo "You should update your own \`aclocal.m4' by merging into it"
  223.   $echo "the contents of \`$gettext_dir/demo/aclocal.m4'"
  224. elif test "$merge" = "gettext"; then
  225.   $echo "Your \`aclocal.m4' file is newer than the installed gettext"
  226.   $echo "program.  Consider upgrading to a recent GNU gettext version."
  227. fi
  228.  
  229. exit 0
  230.