Sun, 04 Sep 2005 22:08:03 +0000
[gaim-migrate @ 13683]
Fixing a warning.
| 3414 | 1 | #!/bin/sh |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
2 | # |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
3 | # setup-gettext - Provides compatibility with versions of gettext |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
4 | # from the 0.10.x, 0.11.x, and 0.12.x series. |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
5 | # |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
6 | # Copyright (C) 2002 Christian Hammond. |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
7 | # |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
8 | # This program is free software; you can redistribute it and/or |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
9 | # modify it under the terms of the GNU General Public License as |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
10 | # published by the Free Software Foundation; either version 2 of |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
11 | # the License, or (at your option) any later version. |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
12 | # |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
13 | # This program is distributed in the hope that it will be useful, |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
16 | # GNU General Public License for more details. |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
17 | # |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
18 | # You should have received a copy of the GNU General Public |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
19 | # License along with this program; if not, write to the Free |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
20 | # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
21 | # MA 02111-1307 USA |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
22 | # |
| 3414 | 23 | |
|
8065
1aab8c47cbb3
[gaim-migrate @ 8761]
Christian Hammond <chipx86@chipx86.com>
parents:
6749
diff
changeset
|
24 | VERSION=0.1.6 |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
25 | |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
26 | VERBOSE=0 |
| 3414 | 27 | |
| 28 | parse_gettext_version() { | |
| 10446 | 29 | GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1.\2.\3/p'` |
| 11301 | 30 | test -z "$GETTEXT_VERSION" && GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2/p'` |
| 10446 | 31 | GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | cut -d. -f1` |
| 32 | GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | cut -d. -f2` | |
| 33 | GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | cut -d. -f3` | |
| 3414 | 34 | } |
| 35 | ||
| 36 | find_gettext() { | |
| 37 | GETTEXT_TOOL=autopoint | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
38 | |
| 3414 | 39 | (autopoint --version) < /dev/null > /dev/null 2>&1 || { |
| 40 | GETTEXT_TOOL=gettextize | |
| 41 | ||
| 42 | (gettextize --version) < /dev/null > /dev/null 2>&1 || { | |
| 43 | GETTEXT_TOOL= | |
| 44 | } | |
| 45 | } | |
| 46 | } | |
| 47 | ||
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
48 | install() { |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
49 | [ -f configure.in ] && { |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
50 | cp configure.in .tmp-configure.in |
|
3421
ff874b76a0f0
[gaim-migrate @ 3443]
Christian Hammond <chipx86@chipx86.com>
parents:
3420
diff
changeset
|
51 | sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\ |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
52 | AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.in > configure.in |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
53 | rm .tmp-configure.in |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
54 | } |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
55 | |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
56 | [ -f configure.ac ] && { |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
57 | cp configure.ac .tmp-configure.ac |
|
3421
ff874b76a0f0
[gaim-migrate @ 3443]
Christian Hammond <chipx86@chipx86.com>
parents:
3420
diff
changeset
|
58 | sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\ |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
59 | AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac > configure.ac |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
60 | rm .tmp-configure.ac |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
61 | } |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
62 | |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
63 | [ -f autogen.sh ] && { |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
64 | cp autogen.sh .tmp-autogen.sh |
|
3422
3851ade84950
[gaim-migrate @ 3444]
Christian Hammond <chipx86@chipx86.com>
parents:
3421
diff
changeset
|
65 | 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 |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
66 | rm .tmp-autogen.sh |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
67 | } |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
68 | |
|
4563
c224db84797b
[gaim-migrate @ 4844]
Christian Hammond <chipx86@chipx86.com>
parents:
3422
diff
changeset
|
69 | echo 'dnl Added by setup-gettext. Do not remove this' >> acinclude.m4 |
|
c224db84797b
[gaim-migrate @ 4844]
Christian Hammond <chipx86@chipx86.com>
parents:
3422
diff
changeset
|
70 | echo 'dnl unless you know what you are doing.' >> acinclude.m4 |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
71 | echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.m4 |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
72 | } |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
73 | |
| 3414 | 74 | backup_m4() { |
| 75 | [ -d m4 ] && mv m4 m4~ | |
| 76 | } | |
| 77 | ||
| 78 | restore_m4() { | |
| 79 | [ -d m4~ ] && { | |
| 80 | rm -rf m4 | |
| 81 | mv m4~ m4 | |
| 82 | } | |
| 83 | } | |
| 84 | ||
| 85 | restore_files() { | |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
86 | [ -f configure.in~ ] && mv -f configure.in~ configure.in |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
87 | [ -f configure.ac~ ] && mv -f configure.ac~ configure.ac |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
88 | [ -f Makefile.am~ ] && mv -f Makefile.am~ Makefile.am |
| 3414 | 89 | } |
| 90 | ||
| 91 | abort() { | |
| 92 | restore_files | |
| 93 | restore_m4 | |
| 94 | ||
| 95 | exit 1 | |
| 96 | } | |
| 97 | ||
| 98 | # Main code | |
| 99 | ||
| 100 | find_gettext | |
| 101 | ||
| 102 | # See if a version of gettext and its tools are installed. | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
103 | if test x$GETTEXT_TOOL = x; then |
| 3414 | 104 | echo |
| 105 | echo "You do not have a version of gettext installed." | |
|
3415
86eb830be476
[gaim-migrate @ 3434]
Christian Hammond <chipx86@chipx86.com>
parents:
3414
diff
changeset
|
106 | echo "Please download one from your local package repository or" |
| 3414 | 107 | echo "from ftp://ftp.gnu.org/pub/gnu/gettext/" |
| 108 | echo | |
| 109 | exit 1 | |
| 110 | fi | |
| 111 | ||
| 112 | parse_gettext_version | |
| 113 | ||
| 114 | NUMVAR=$# | |
| 115 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
116 | if test $NUMVAR -gt 0; then |
|
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
117 | if test $NUMVAR -gt 1; then |
| 3414 | 118 | echo "Only one option at a time!" |
| 119 | exit 1 | |
| 120 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
121 | elif test $1 = "--gettext-tool"; then |
| 3414 | 122 | echo $GETTEXT_TOOL |
| 123 | exit 0 | |
| 124 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
125 | elif test $1 = "--help"; then |
| 3414 | 126 | echo "setup-gettext v$VERSION" |
| 127 | echo "Usage:" | |
| 128 | echo " --gettext-tool Returns gettextize or autopoint, depending" | |
| 129 | echo " on the version of gettext installed." | |
| 130 | echo " --gettext-version Returns the version of gettext installed." | |
| 131 | echo " --gettext-major-version Returns the major version of gettext installed." | |
| 132 | echo " --gettext-minor-version Returns the minor version of gettext installed." | |
| 133 | echo " --gettext-micro-version Returns the micro version of gettext installed." | |
| 134 | echo " --help Displays this help screen." | |
| 135 | echo | |
| 136 | exit 0 | |
| 137 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
138 | elif test $1 = "--version"; then |
| 3414 | 139 | echo $VERSION |
| 140 | exit 0 | |
| 141 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
142 | elif test $1 = "--gettext-version"; then |
| 3414 | 143 | echo $GETTEXT_VERSION |
| 144 | exit 0 | |
| 145 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
146 | elif test $1 = "--gettext-major-version"; then |
| 3414 | 147 | echo $GETTEXT_MAJOR_VERSION |
| 148 | exit 0 | |
| 149 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
150 | elif test $1 = "--gettext-minor-version"; then |
| 3414 | 151 | echo $GETTEXT_MINOR_VERSION |
| 152 | exit 0 | |
| 153 | ||
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
154 | elif test $1 = "--gettext-micro-version"; then |
| 3414 | 155 | echo $GETTEXT_MICRO_VERSION |
| 156 | exit 0 | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
157 | |
|
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
158 | elif test $1 = "--install"; then |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
159 | install |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
160 | echo "setup-gettext installed." |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
161 | exit 0 |
| 3414 | 162 | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
163 | elif test $1 = "--happy-url"; then |
| 3414 | 164 | echo http://gaim.sf.net/forkgettext.jpg |
| 165 | exit 0 | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
166 | |
|
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
167 | elif test $1 = "--verbose"; then |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
168 | VERBOSE=1 |
| 3414 | 169 | |
| 170 | else | |
| 171 | echo "Invalid option '$1'" | |
| 172 | exit 1 | |
| 173 | fi | |
| 174 | fi | |
| 175 | ||
| 176 | # Okay, run the main stuff | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
177 | if test "$GETTEXT_TOOL" = "autopoint"; then |
| 3414 | 178 | backup_m4 |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
179 | [ $VERBOSE -eq 1 ] && echo " autopoint --force" |
| 3414 | 180 | echo n | autopoint --force || abort |
| 181 | restore_m4 | |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
182 | |
|
8065
1aab8c47cbb3
[gaim-migrate @ 8761]
Christian Hammond <chipx86@chipx86.com>
parents:
6749
diff
changeset
|
183 | if test $GETTEXT_MINOR_VERSION -ge 12; then |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
184 | cp po/Makefile.in.in po/.tmp-Makefile.in.in |
|
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
185 | sed -e 's#echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; esac#echo "\$(MKINSTALLDIRS)" ;; esac#1' < po/.tmp-Makefile.in.in > po/Makefile.in.in |
|
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
186 | rm po/.tmp-Makefile.in.in |
|
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
187 | fi |
| 3414 | 188 | else |
|
6749
cd56e10fbcdd
[gaim-migrate @ 7281]
Christian Hammond <chipx86@chipx86.com>
parents:
4563
diff
changeset
|
189 | if test $GETTEXT_MINOR_VERSION -eq 11; then |
| 3414 | 190 | backup_m4 |
| 191 | ||
| 192 | # Gettext is pure evil. It DEMANDS that we press Return no matter | |
| 193 | # what. This gets rid of their happy "feature" of doom. | |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
194 | [ $VERBOSE -eq 1 ] && \ |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
195 | echo " gettextize --copy --force --intl --no-changelog" |
|
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
196 | |
| 3414 | 197 | sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize |
| 198 | chmod +x .temp-gettextize | |
| 199 | echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort | |
| 200 | rm .temp-gettextize | |
| 201 | ||
| 202 | restore_files | |
| 203 | restore_m4 | |
| 204 | ||
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
205 | [ -f po/Makevars.template ] && mv po/Makevars.template po/Makevars |
| 3414 | 206 | else |
|
3420
0e7662dfe9cc
[gaim-migrate @ 3442]
Christian Hammond <chipx86@chipx86.com>
parents:
3415
diff
changeset
|
207 | [ $VERBOSE -eq 1 ] && echo " gettextize --copy --force" |
| 3414 | 208 | echo n | gettextize --copy --force || exit; |
| 209 | fi | |
| 210 | fi | |
| 211 |