comparison setup-gettext @ 6749:c92584ee753d

[gaim-migrate @ 7281] setup-gettext works with gettext 0.12.x. And yes, it was a gettext bug, and a rather stupid one. I'm surprised they didn't realize that $(top_builddir)/$(top_builddir)/mkinstalldirs doesn't work so well, since $(top_builddir) is a relative path. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 05 Sep 2003 06:01:39 +0000
parents d6491dc2b7b2
children afd6b3185274
comparison
equal deleted inserted replaced
6748:4f6c8a696f2e 6749:c92584ee753d
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # setup-gettext - Provides compatibility with versions of gettext 3 # setup-gettext - Provides compatibility with versions of gettext
4 # from the 0.10.x series and 0.11.x. 4 # from the 0.10.x, 0.11.x, and 0.12.x series.
5 # 5 #
6 # Copyright (C) 2002 Christian Hammond. 6 # Copyright (C) 2002 Christian Hammond.
7 # 7 #
8 # This program is free software; you can redistribute it and/or 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 9 # modify it under the terms of the GNU General Public License as
19 # License along with this program; if not, write to the Free 19 # License along with this program; if not, write to the Free
20 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 # MA 02111-1307 USA 21 # MA 02111-1307 USA
22 # 22 #
23 23
24 VERSION=0.1.4 24 VERSION=0.1.5
25 25
26 VERBOSE=0 26 VERBOSE=0
27 27
28 parse_gettext_version() { 28 parse_gettext_version() {
29 GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'` 29 GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'`
32 GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'` 32 GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'`
33 } 33 }
34 34
35 find_gettext() { 35 find_gettext() {
36 GETTEXT_TOOL=autopoint 36 GETTEXT_TOOL=autopoint
37 37
38 (autopoint --version) < /dev/null > /dev/null 2>&1 || { 38 (autopoint --version) < /dev/null > /dev/null 2>&1 || {
39 GETTEXT_TOOL=gettextize 39 GETTEXT_TOOL=gettextize
40 40
41 (gettextize --version) < /dev/null > /dev/null 2>&1 || { 41 (gettextize --version) < /dev/null > /dev/null 2>&1 || {
42 GETTEXT_TOOL= 42 GETTEXT_TOOL=
97 # Main code 97 # Main code
98 98
99 find_gettext 99 find_gettext
100 100
101 # See if a version of gettext and its tools are installed. 101 # See if a version of gettext and its tools are installed.
102 if [ x$GETTEXT_TOOL = x ]; then 102 if test x$GETTEXT_TOOL = x; then
103 echo 103 echo
104 echo "You do not have a version of gettext installed." 104 echo "You do not have a version of gettext installed."
105 echo "Please download one from your local package repository or" 105 echo "Please download one from your local package repository or"
106 echo "from ftp://ftp.gnu.org/pub/gnu/gettext/" 106 echo "from ftp://ftp.gnu.org/pub/gnu/gettext/"
107 echo 107 echo
110 110
111 parse_gettext_version 111 parse_gettext_version
112 112
113 NUMVAR=$# 113 NUMVAR=$#
114 114
115 if [ $NUMVAR -gt 0 ]; then 115 if test $NUMVAR -gt 0; then
116 if [ $NUMVAR -gt 1 ]; then 116 if test $NUMVAR -gt 1; then
117 echo "Only one option at a time!" 117 echo "Only one option at a time!"
118 exit 1 118 exit 1
119 119
120 elif [ $1 = "--gettext-tool" ]; then 120 elif test $1 = "--gettext-tool"; then
121 echo $GETTEXT_TOOL 121 echo $GETTEXT_TOOL
122 exit 0 122 exit 0
123 123
124 elif [ $1 = "--help" ]; then 124 elif test $1 = "--help"; then
125 echo "setup-gettext v$VERSION" 125 echo "setup-gettext v$VERSION"
126 echo "Usage:" 126 echo "Usage:"
127 echo " --gettext-tool Returns gettextize or autopoint, depending" 127 echo " --gettext-tool Returns gettextize or autopoint, depending"
128 echo " on the version of gettext installed." 128 echo " on the version of gettext installed."
129 echo " --gettext-version Returns the version of gettext installed." 129 echo " --gettext-version Returns the version of gettext installed."
132 echo " --gettext-micro-version Returns the micro version of gettext installed." 132 echo " --gettext-micro-version Returns the micro version of gettext installed."
133 echo " --help Displays this help screen." 133 echo " --help Displays this help screen."
134 echo 134 echo
135 exit 0 135 exit 0
136 136
137 elif [ $1 = "--version" ]; then 137 elif test $1 = "--version"; then
138 echo $VERSION 138 echo $VERSION
139 exit 0 139 exit 0
140 140
141 elif [ $1 = "--gettext-version" ]; then 141 elif test $1 = "--gettext-version"; then
142 echo $GETTEXT_VERSION 142 echo $GETTEXT_VERSION
143 exit 0 143 exit 0
144 144
145 elif [ $1 = "--gettext-major-version" ]; then 145 elif test $1 = "--gettext-major-version"; then
146 echo $GETTEXT_MAJOR_VERSION 146 echo $GETTEXT_MAJOR_VERSION
147 exit 0 147 exit 0
148 148
149 elif [ $1 = "--gettext-minor-version" ]; then 149 elif test $1 = "--gettext-minor-version"; then
150 echo $GETTEXT_MINOR_VERSION 150 echo $GETTEXT_MINOR_VERSION
151 exit 0 151 exit 0
152 152
153 elif [ $1 = "--gettext-micro-version" ]; then 153 elif test $1 = "--gettext-micro-version"; then
154 echo $GETTEXT_MICRO_VERSION 154 echo $GETTEXT_MICRO_VERSION
155 exit 0 155 exit 0
156 156
157 elif [ $1 = "--install" ]; then 157 elif test $1 = "--install"; then
158 install 158 install
159 echo "setup-gettext installed." 159 echo "setup-gettext installed."
160 exit 0 160 exit 0
161 161
162 elif [ $1 = "--happy-url" ]; then 162 elif test $1 = "--happy-url"; then
163 echo http://gaim.sf.net/forkgettext.jpg 163 echo http://gaim.sf.net/forkgettext.jpg
164 exit 0 164 exit 0
165 165
166 elif [ $1 = "--verbose" ]; then 166 elif test $1 = "--verbose"; then
167 VERBOSE=1 167 VERBOSE=1
168 168
169 else 169 else
170 echo "Invalid option '$1'" 170 echo "Invalid option '$1'"
171 exit 1 171 exit 1
172 fi 172 fi
173 fi 173 fi
174 174
175 # Okay, run the main stuff 175 # Okay, run the main stuff
176 if [ "$GETTEXT_TOOL" = "autopoint" ]; then 176 if test "$GETTEXT_TOOL" = "autopoint"; then
177 backup_m4 177 backup_m4
178 [ $VERBOSE -eq 1 ] && echo " autopoint --force" 178 [ $VERBOSE -eq 1 ] && echo " autopoint --force"
179 echo n | autopoint --force || abort 179 echo n | autopoint --force || abort
180 restore_m4 180 restore_m4
181
182 if test $GETTEXT_MINOR_VERSION -eq 12; then
183 cp po/Makefile.in.in po/.tmp-Makefile.in.in
184 sed -e 's#echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; esac#echo "\$(MKINSTALLDIRS)" ;; esac#1' < po/.tmp-Makefile.in.in > po/Makefile.in.in
185 rm po/.tmp-Makefile.in.in
186 fi
181 else 187 else
182 if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then 188 if test $GETTEXT_MINOR_VERSION -eq 11; then
183 backup_m4 189 backup_m4
184 190
185 # Gettext is pure evil. It DEMANDS that we press Return no matter 191 # Gettext is pure evil. It DEMANDS that we press Return no matter
186 # what. This gets rid of their happy "feature" of doom. 192 # what. This gets rid of their happy "feature" of doom.
187 [ $VERBOSE -eq 1 ] && \ 193 [ $VERBOSE -eq 1 ] && \