3 # setup-gettext - Provides compatibility with versions of gettext
4 # from the 0.10.x series and 0.11.x.
6 # Copyright (C) 2002 Christian Hammond.
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public
19 # License along with this program; if not, write to the Free
20 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28 parse_gettext_version
() {
29 GETTEXT_VERSION
=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'`
30 GETTEXT_MAJOR_VERSION
=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'`
31 GETTEXT_MINOR_VERSION
=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'`
32 GETTEXT_MICRO_VERSION
=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'`
36 GETTEXT_TOOL
=autopoint
38 (autopoint
--version) < /dev
/null
> /dev
/null
2>&1 ||
{
39 GETTEXT_TOOL
=gettextize
41 (gettextize
--version) < /dev
/null
> /dev
/null
2>&1 ||
{
48 [ -f configure.
in ] && {
49 cp configure.
in .tmp-configure.
in
50 sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
51 AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.
in > configure.
in
55 [ -f configure.ac
] && {
56 cp configure.ac .tmp-configure.ac
57 sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
58 AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac
> configure.ac
62 [ -f autogen.sh
] && {
63 cp autogen.sh .tmp-autogen.sh
64 sed -e 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -e 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh
> autogen.sh
68 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.
m4
72 [ -d m4 ] && mv m4 m4~
83 [ -f configure.
in~
] && mv -f configure.
in~ configure.
in
84 [ -f configure.ac~
] && mv -f configure.ac~ configure.ac
85 [ -f Makefile.am~
] && mv -f Makefile.am~ Makefile.am
99 # See if a version of gettext and its tools are installed.
100 if [ x
$GETTEXT_TOOL = x
]; then
102 echo "You do not have a version of gettext installed."
103 echo "Please download one from your local package repository or"
104 echo "from ftp://ftp.gnu.org/pub/gnu/gettext/"
109 parse_gettext_version
113 if [ $NUMVAR -gt 0 ]; then
114 if [ $NUMVAR -gt 1 ]; then
115 echo "Only one option at a time!"
118 elif [ $1 = "--gettext-tool" ]; then
122 elif [ $1 = "--help" ]; then
123 echo "setup-gettext v$VERSION"
125 echo " --gettext-tool Returns gettextize or autopoint, depending"
126 echo " on the version of gettext installed."
127 echo " --gettext-version Returns the version of gettext installed."
128 echo " --gettext-major-version Returns the major version of gettext installed."
129 echo " --gettext-minor-version Returns the minor version of gettext installed."
130 echo " --gettext-micro-version Returns the micro version of gettext installed."
131 echo " --help Displays this help screen."
135 elif [ $1 = "--version" ]; then
139 elif [ $1 = "--gettext-version" ]; then
140 echo $GETTEXT_VERSION
143 elif [ $1 = "--gettext-major-version" ]; then
144 echo $GETTEXT_MAJOR_VERSION
147 elif [ $1 = "--gettext-minor-version" ]; then
148 echo $GETTEXT_MINOR_VERSION
151 elif [ $1 = "--gettext-micro-version" ]; then
152 echo $GETTEXT_MICRO_VERSION
155 elif [ $1 = "--install" ]; then
157 echo "setup-gettext installed."
160 elif [ $1 = "--happy-url" ]; then
161 echo http
://gaim.sf.net
/forkgettext.jpg
164 elif [ $1 = "--verbose" ]; then
168 echo "Invalid option '$1'"
173 # Okay, run the main stuff
174 if [ "$GETTEXT_TOOL" = "autopoint" ]; then
176 [ $VERBOSE -eq 1 ] && echo " autopoint --force"
177 echo n | autopoint
--force || abort
180 if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then
183 # Gettext is pure evil. It DEMANDS that we press Return no matter
184 # what. This gets rid of their happy "feature" of doom.
185 [ $VERBOSE -eq 1 ] && \
186 echo " gettextize --copy --force --intl --no-changelog"
188 sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize
189 chmod +x .temp-gettextize
190 echo n | .
/.temp-gettextize
--copy --force --intl --no-changelog || abort
196 [ -f po
/Makevars.template
] && mv po
/Makevars.template po
/Makevars
198 [ $VERBOSE -eq 1 ] && echo " gettextize --copy --force --intl"
199 echo n | gettextize
--copy --force --intl ||
exit;