• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2#
3# Copyright (C) 1995-1998, 2000, 2001 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, see <http://www.gnu.org/licenses/>.
17#
18
19# - Modified in October 2001 by jacob berkman <jacob@ximian.com> to
20# work with glib's Makefile.in.in and po2tbl.sed.in, to not copy in
21# intl/, and to not add ChangeLog entries to po/ChangeLog
22
23# This file is meant for authors or maintainers which want to
24# internationalize their package with the help of GNU gettext.  For
25# further information how to use it consult the GNU gettext manual.
26
27echo=echo
28progname=$0
29force=0
30configstatus=0
31origdir=`pwd`
32usage="\
33Usage: glib-gettextize [OPTION]... [package-dir]
34      --help           print this help and exit
35      --version        print version information and exit
36  -c, --copy           copy files instead of making symlinks
37  -f, --force          force writing of new files even if old exist
38Report bugs to https://gitlab.gnome.org/GNOME/glib/issues/new."
39package=@PACKAGE@
40version=@VERSION@
41try_ln_s=:
42
43# Directory where the sources are stored.
44prefix=@prefix@
45case `uname` in
46MINGW32*)
47    prefix="`dirname $0`/.."
48    ;;
49esac
50
51datarootdir=@datarootdir@
52datadir=@datadir@
53
54gettext_dir=$datadir/glib-2.0/gettext
55
56while test $# -gt 0; do
57  case "$1" in
58    -c | --copy | --c* )
59      shift
60      try_ln_s=false ;;
61    -f | --force | --f* )
62      shift
63      force=1 ;;
64    -r | --run | --r* )
65      shift
66      configstatus=1 ;;
67    --help | --h* )
68      $echo "$usage"; exit 0 ;;
69    --version | --v* )
70      echo "$progname (GNU $package) $version"
71      $echo "Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
72This is free software; see the source for copying conditions.  There is NO
73warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
74      $echo "Written by" "Ulrich Drepper"
75      exit 0 ;;
76    -- )	# Stop option processing
77      shift; break ;;
78    -* )
79      $echo "glib-gettextize: unknown option $1"
80      $echo "Try \`glib-gettextize --help' for more information."; exit 1 ;;
81    * )
82      break ;;
83  esac
84done
85
86if test $# -gt 1; then
87  $echo "$usage"
88  exit 1
89fi
90
91# Fill in the command line options value.
92if test $# -eq 1; then
93  srcdir=$1
94  if cd "$srcdir"; then
95    srcdir=`pwd`
96  else
97    $echo "Cannot change directory to \`$srcdir'"
98    exit 1
99  fi
100else
101  srcdir=$origdir
102fi
103
104test -f configure.in || test -f configure.ac || {
105  $echo "Missing configure.in or configure.ac, please cd to your package first."
106  exit 1
107}
108
109configure_in=NONE
110if test -f configure.in; then
111  configure_in=configure.in
112else
113  if test -f configure.ac; then
114    configure_in=configure.ac
115  fi
116fi
117# Check in which directory config.rpath, mkinstalldirs etc. belong.
118auxdir=`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`
119if test -n "$auxdir"; then
120  auxdir="$auxdir/"
121fi
122
123if test -f po/Makefile.in.in && test $force -eq 0; then
124  $echo "\
125po/Makefile.in.in exists: use option -f if you really want to delete it."
126  exit 1
127fi
128
129test -d po || {
130  $echo "Creating po/ subdirectory"
131  mkdir po || {
132    $echo "failed to create po/ subdirectory"
133    exit 1
134  }
135}
136
137# For simplicity we changed to the gettext source directory.
138cd $gettext_dir || {
139   $echo "gettext source directory '${gettext_dir}' doesn't exist"
140   exit 1
141}
142
143# Now copy all files.  Take care for the destination directories.
144for file in *; do
145  case $file in
146    intl | po)
147      ;;
148    mkinstalldirs)
149      rm -f "$srcdir/$auxdir$file"
150      ($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$auxdir$file" && $echo "Symlinking file $file") 2>/dev/null ||
151      { $echo "Copying file $file"; cp $file "$srcdir/$auxdir$file"; }
152      ;;
153    *)
154      rm -f "$srcdir/$file"
155      ($try_ln_s && ln -s $gettext_dir/$file "$srcdir/$file" && $echo "Symlinking file $file") 2>/dev/null ||
156      { $echo "Copying file $file"; cp $file "$srcdir/$file"; }
157      ;;
158  esac
159done
160
161# Copy files to po/ subdirectory.
162cd po
163for file in *; do
164  rm -f "$srcdir/po/$file"
165  ($try_ln_s && ln -s $gettext_dir/po/$file "$srcdir/po/$file" && $echo "Symlinking file po/$file") 2>/dev/null ||
166  { $echo "Copying file po/$file"; cp $file "$srcdir/po/$file"; }
167done
168if test -f "$srcdir/po/cat-id-tbl.c"; then
169  $echo "Removing po/cat-id-tbl.c"
170  rm -f "$srcdir/po/cat-id-tbl.c"
171fi
172if test -f "$srcdir/po/stamp-cat-id"; then
173  $echo "Removing po/stamp-cat-id"
174  rm -f "$srcdir/po/stamp-cat-id"
175fi
176
177echo
178echo "Please add the files"
179echo "  codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4"
180echo "  progtest.m4"
181echo "from the $datadir/aclocal directory to your autoconf macro directory"
182echo "or directly to your aclocal.m4 file."
183echo "You will also need config.guess and config.sub, which you can get from"
184echo "ftp://ftp.gnu.org/pub/gnu/config/."
185echo
186
187exit 0
188