summaryrefslogtreecommitdiffstats
path: root/debian/gettext-kde/gettext-kde-0.10.35/misc/gettextize.in
blob: 0803ef31bf2900503b8d2ba3d3915a1dc0fb5829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#! /bin/sh
#
# Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

# This file is meant for authors or maintainers which want to
# internationalize their package with the help of GNU gettext.  For
# further information how to use it consult the GNU gettext manual.

echo=echo
progname=$0
force=0
configstatus=0
origdir=`pwd`
usage="\
Usage: gettextize [OPTION]... [package-dir]
      --help           print this help and exit
      --version        print version information and exit
  -c, --copy           copy files instead of making symlinks
  -f, --force          force writing of new files even if old exist
Report bugs to <bug-gnu-utils@prep.ai.mit.edu>."
package=@PACKAGE@
version=@VERSION@
aclocal_version=@ACLOCAL_VERSION@
try_ln_s=:

while test $# -gt 0; do
  case "$1" in
    -c | --copy | --c* )
      shift
      try_ln_s=false ;;
    -f | --force | --f* )
      shift
      force=1 ;;
    -r | --run | --r* )
      shift
      configstatus=1 ;;
    --help | --h* )
      $echo "$usage"; exit 0 ;;
    --version | --v* )
      echo "$progname (GNU $package) $version"
      $echo "Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
      $echo "Written by" "Ulrich Drepper"
      exit 0 ;;
    -- )	# Stop option prcessing
      shift; break ;;
    -* )
      $echo "gettextize: unknown option $1"
      $echo "Try \`gettextize --help' for more information."; exit 1 ;;
    * )
      break ;;
  esac
done

if test $# -gt 1; then
  $echo "$usage"
  exit 1
fi

# Fill in the command line options value.
if test $# -eq 1; then
  srcdir=$1
  if cd $srcdir; then
    srcdir=`pwd`
  else
    $echo "Cannot change directory to \`$srcdir'"
    exit 1
  fi
else
  srcdir=$origdir
fi

# Directory where the sources are stored.
prefix=@prefix@
gettext_dir=@datadir@/gettext
aclocal_dir=@aclocaldir@

test -f configure.in || {
  $echo "Missing configure.in, please cd to your package first."
  exit 1
}

if test -d intl && test $force -eq 0; then
  $echo "\
intl/ subdirectory exists: use option -f if you really want to delete it."
  exit 1
fi

if test -f po/Makefile.in.in && test $force -eq 0; then
  $echo "\
po/Makefile.in.in exists: use option -f if you really want to delete it."
  exit 1
fi

if test -f NLS && test $force -eq 0; then
  $echo "NLS exists: use option -f if you really want to delete it."
  exit 1
fi

rm -fr intl
mkdir intl || {
  $echo "failed to create intl/ subdirectory"
  exit 1;
}

test -d po || mkdir po || {
   $echo "failed to create po/ subdirectory"
   exit 1
}

# For simplicity we changed to the gettext source directory.
cd $gettext_dir

# Now copy all files.  Take care for the destination directories.
for file in *; do
  case $file in
    intl | po | demo)
      ;;
    *)
      rm -f $srcdir/$file
      ($try_ln_s && ln -s $gettext_dir/$file $srcdir/$file) 2>/dev/null ||
      cp $file $srcdir/$file
      ;;
  esac
done

# Copy files to intl/ subdirectory.
cd intl
for file in *; do
  rm -f $srcdir/intl/$file
  ($try_ln_s && ln -s $gettext_dir/intl/$file $srcdir/intl/$file) 2>/dev/null ||
  cp $file $srcdir/intl/$file
done

# Copy files to po/ subdirectory.
cd ../po
for file in *; do
  rm -f $srcdir/po/$file
  ($try_ln_s && ln -s $gettext_dir/po/$file $srcdir/po/$file) 2>/dev/null ||
  cp $file $srcdir/po/$file
done


# Check whether we can run config.status to produce intl/Makefile.in.
cd $origdir
if test -f ./config.status; then
  if test $configstatus -eq 0; then
    echo "Shall I run config.status? (y/N)"
    read ans
    case "$ans" in
      y* | Y* | 1* )
	configstatus=1 ;;
      * )
	;;
    esac
  fi

  test $configstatus -ne 0 &&
    (CONFIG_FILES=intl/Makefile CONFIG_HEADERS= ./config.status)
fi

merge=no
OLD_IFS="$IFS"
IFS="."
cntr=0
major=0; minor=0; subminor=0
for num in $aclocal_version; do
  case $cntr in
    0) major=$num;;
    1) minor=$num;;
    2) subminor=$num;;
  esac
  cntr=`expr $cntr + 1`
done
IFS="$OLD_IFS"

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


if test $# -lt 2 || test $# -gt 3; then
  merge=yes
else
  here_major=$1; here_minor=$2
  if test $# -eq 2; then
    here_subminor=0
  else
    here_subminor=$3
  fi

  if test $major -eq $here_major; then
    if test $minor -eq $here_minor; then
      if test $subminor -lt $here_subminor; then
	merge=gettext
      elif test $subminor -gt $here_subminor; then
	merge=yes
      fi
    else
      if test $minor -lt $here_minor; then
	merge=gettext
      else
	merge=yes
      fi
    fi
  else
    if test $major -lt $here_major; then
      merge=gettext
    else
      merge=yes
    fi
  fi
fi

if test "$merge" = "yes"; then
  $echo "You should update your own \`aclocal.m4' by adding the necessary"
  $echo "macro packages gettext.m4, lcmessage.m4 and progtest.m4 from"
  $echo "the directory \`$aclocal_dir'"
elif test "$merge" = "gettext"; then
  $echo "Your \`aclocal.m4' file is newer than the installed gettext"
  $echo "program.  Consider upgrading to a recent GNU gettext version."
fi

exit 0