head	1.12;
access;
symbols
	v2_0_0beta2:1.11
	v2_0_0beta1:1.11
	v1_5_0:1.8.2.1
	v1_4_0:1.8.2.1
	gaim-doodle:1.9.0.2
	v1_3_1:1.8.2.1
	v1_3_0:1.8.2.1
	v1_2_1:1.8.2.1
	v1_2_0:1.8.2.1
	v1_1_4:1.8.2.1
	v1_1_3:1.8.2.1
	v1_1_2:1.8.2.1
	v1_1_1:1.8
	v1_1_0:1.8
	v1_0_3:1.8
	v1_0_2:1.8
	v1_0_1:1.8
	v1_0_0:1.8
	oldstatus:1.8.0.2
	v0_82:1.8
	v0_81:1.8
	v0_80:1.8
	v0_79:1.8
	v0_78:1.8
	v0_77:1.8
	v0_76:1.8
	v0_75:1.7
	v0_74:1.7
	v0_74-branch:1.7.0.2
	v0_73:1.7
	v0_72:1.7
	v0_71:1.7
	v0_70:1.7
	v0_69:1.7
	v0_68:1.6
	v0_67:1.6
	v0_65:1.6
	v0_64:1.6
	v0_63:1.6
	v0_62:1.6
	gaim_0_60:1.6
	v0_60:1.6
	ZERO_DOT_FUCKING_SIXTY:1.6
	v0_59_9:1.5.2.1
	v0_59_8:1.5.2.1
	gaim_0_59_7:1.5.2.1
	v0_60alpha3:1.5
	v0_59_6:1.5.2.1
	v0_59_5:1.5.2.1
	v0_59_4:1.5.2.1
	v0_59_3:1.5.2.1
	v0_59_2:1.5.2.1
	gtk1-stable:1.5.0.2;
locks; strict;
comment	@# @;


1.12
date	2006.02.08.21.01.56;	author rlaager;	state dead;
branches;
next	1.11;

1.11
date	2005.12.16.18.39.21;	author nosnilmot;	state Exp;
branches;
next	1.10;

1.10
date	2005.08.18.18.11.12;	author lschiere;	state Exp;
branches;
next	1.9;

1.9
date	2004.12.29.20.01.48;	author eblanton;	state Exp;
branches;
next	1.8;

1.8
date	2004.01.10.20.03.59;	author chipx86;	state Exp;
branches
	1.8.2.1;
next	1.7;

1.7
date	2003.09.05.06.01.39;	author chipx86;	state Exp;
branches;
next	1.6;

1.6
date	2003.02.09.19.08.07;	author chipx86;	state Exp;
branches;
next	1.5;

1.5
date	2002.08.24.22.34.52;	author chipx86;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2002.08.24.22.32.16;	author chipx86;	state Exp;
branches;
next	1.3;

1.3
date	2002.08.24.02.15.37;	author chipx86;	state Exp;
branches;
next	1.2;

1.2
date	2002.08.20.17.00.56;	author chipx86;	state Exp;
branches;
next	1.1;

1.1
date	2002.08.20.08.54.56;	author chipx86;	state Exp;
branches;
next	;

1.5.2.1
date	2002.08.25.23.57.08;	author chipx86;	state Exp;
branches;
next	;

1.8.2.1
date	2004.12.29.20.01.27;	author eblanton;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Finish the switch to glib-gettext.
@
text
@#!/bin/sh
#
# setup-gettext - Provides compatibility with versions of gettext
#                 from the 0.10.x, 0.11.x, and 0.12.x series.
#
# Copyright (C) 2002 Christian Hammond.
#
# 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 of
# the License, 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
#

VERSION=0.1.6

VERBOSE=0

parse_gettext_version() {
	GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1.\2.\3/p'`
	test -z "$GETTEXT_VERSION" && GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2/p'`
	GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | cut -d. -f1`
	GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | cut -d. -f2`
	GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | cut -d. -f3`
}

find_gettext() {
	GETTEXT_TOOL=autopoint

	(autopoint --version) < /dev/null > /dev/null 2>&1 || {
		GETTEXT_TOOL=gettextize

		(gettextize --version) < /dev/null > /dev/null 2>&1 || {
			GETTEXT_TOOL=
		}
	}
}

install() {
	[ -f configure.in ] && {
		cp configure.in .tmp-configure.in
		sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.in > configure.in
		rm .tmp-configure.in
	}

	[ -f configure.ac ] && {
		cp configure.ac .tmp-configure.ac
		sed -e 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
AM_GNU_GETTEXT_VERSION(0.10.40)/' < .tmp-configure.ac > configure.ac
		rm .tmp-configure.ac
	}

	[ -f autogen.sh ] && {
		cp autogen.sh .tmp-autogen.sh
		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
		rm .tmp-autogen.sh
	}

	echo 'dnl Added by setup-gettext. Do not remove this' >> acinclude.m4
	echo 'dnl unless you know what you are doing.' >> acinclude.m4
	echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' >> acinclude.m4
}

backup_m4() {
	[ -d m4 ] && mv m4 m4~
}

restore_m4() {
	[ -d m4~ ] && {
		rm -rf m4
		mv m4~ m4
	}
}

restore_files() {
	[ -f configure.in~ ] && mv -f configure.in~ configure.in
	[ -f configure.ac~ ] && mv -f configure.ac~ configure.ac
	[ -f Makefile.am~ ]  && mv -f Makefile.am~  Makefile.am
}

abort() {
	restore_files
	restore_m4

	exit 1
}

# Main code

find_gettext

# See if a version of gettext and its tools are installed.
if test x$GETTEXT_TOOL = x; then
	echo
	echo "You do not have a version of gettext installed."
	echo "Please download one from your local package repository or"
	echo "from ftp://ftp.gnu.org/pub/gnu/gettext/"
	echo
	exit 1
fi

parse_gettext_version

NUMVAR=$#

if test $NUMVAR -gt 0; then
	if test $NUMVAR -gt 1; then
		echo "Only one option at a time!"
		exit 1

	elif test $1 = "--gettext-tool"; then
		echo $GETTEXT_TOOL
		exit 0

	elif test $1 = "--help"; then
		echo "setup-gettext v$VERSION"
		echo "Usage:"
		echo "   --gettext-tool           Returns gettextize or autopoint, depending"
		echo "                            on the version of gettext installed."
		echo "   --gettext-version        Returns the version of gettext installed."
		echo "   --gettext-major-version  Returns the major version of gettext installed."
		echo "   --gettext-minor-version  Returns the minor version of gettext installed."
		echo "   --gettext-micro-version  Returns the micro version of gettext installed."
		echo "   --help                   Displays this help screen."
		echo
		exit 0

	elif test $1 = "--version"; then
		echo $VERSION
		exit 0

	elif test $1 = "--gettext-version"; then
		echo $GETTEXT_VERSION
		exit 0

	elif test $1 = "--gettext-major-version"; then
		echo $GETTEXT_MAJOR_VERSION
		exit 0

	elif test $1 = "--gettext-minor-version"; then
		echo $GETTEXT_MINOR_VERSION
		exit 0

	elif test $1 = "--gettext-micro-version"; then
		echo $GETTEXT_MICRO_VERSION
		exit 0

	elif test $1 = "--install"; then
		install
		echo "setup-gettext installed."
		exit 0

	elif test $1 = "--happy-url"; then
		echo http://gaim.sf.net/forkgettext.jpg
		exit 0

	elif test $1 = "--verbose"; then
		VERBOSE=1

	else
		echo "Invalid option '$1'"
		exit 1
	fi
fi

# Okay, run the main stuff
if test "$GETTEXT_TOOL" = "autopoint"; then
	backup_m4
	[ $VERBOSE -eq 1 ] && echo "  autopoint --force"
	echo n | autopoint --force || abort
	restore_m4

	if test $GETTEXT_MINOR_VERSION -ge 12; then
		cp po/Makefile.in.in po/.tmp-Makefile.in.in
		sed -e 's#\*) echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; esac#\.\/\*) echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; \*) echo "\$(MKINSTALLDIRS)" ;; esac#1' < po/.tmp-Makefile.in.in > po/Makefile.in.in
		rm po/.tmp-Makefile.in.in
	fi
else
	if test $GETTEXT_MINOR_VERSION -eq 11; then
		backup_m4

		# Gettext is pure evil. It DEMANDS that we press Return no matter
		# what. This gets rid of their happy "feature" of doom.
		[ $VERBOSE -eq 1 ] && \
			echo "  gettextize --copy --force --intl --no-changelog"

		sed 's:read .*< /dev/tty::' `which gettextize` > .temp-gettextize
		chmod +x .temp-gettextize
		echo n | ./.temp-gettextize --copy --force --intl --no-changelog || abort
		rm .temp-gettextize

		restore_files
		restore_m4

		[ -f po/Makevars.template ] && mv po/Makevars.template po/Makevars
	else
		[ $VERBOSE -eq 1 ] && echo "  gettextize --copy --force"
		echo n | gettextize --copy --force || exit;
	fi
fi

@


1.11
log
@Something happened to the gettext config or autotools or something that
prevented mkinstalldirs being found when doing the "make install" in the
po/ directory.

I think this fixes it. I hope it does anyway.

I'm guessing that most people who encountered this problem just copied
mkinstalldirs into po/ and forgot about it.
@
text
@@


1.10
log
@This apparently fixes setup-gettext for gettext versions in x.y format
rather than x.y.z format. see sf patch 1218157
@
text
@d185 1
a185 1
		sed -e 's#echo "\$(top_builddir)/\$(MKINSTALLDIRS)" ;; esac#echo "\$(MKINSTALLDIRS)" ;; esac#1' < po/.tmp-Makefile.in.in > po/Makefile.in.in
@


1.9
log
@Don't be quite so generous in assumptions about what sed can do
@
text
@d30 1
@


1.8
log
@setup-gettext 0.1.6. gettext 0.13.x should work now. I wish they'd fix
their bugs.
@
text
@d29 4
a32 4
	GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\).*$/\1.\2.\3/p'`
	GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^\([0-9]\+\).*/\1/p'`
	GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.\([0-9]\+\).*/\1/p'`
	GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | sed -n 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\).*/\1/p'`
@


1.8.2.1
log
@This fixes a "bug" in setup-gettext, where it makes a somewhat bold
assumption about the capabilities of sed.  Some systems have particularly
primitives seds which cannot handle + or \+ or any variation thereof;
I have changed [0-9]\+ to [0-9][0-9]* for the benefit of these somewhat
anemic systems.  Like OSX.  I also changed some long and painful regular
expressions into simple cut commands, but that really wasn't as much a
bug fix as a canonicalization.

Christian, you may or may not want to fold some of this into setup-gettext
wherever it lives.
@
text
@d29 4
a32 4
	GETTEXT_VERSION=`$GETTEXT_TOOL --version | sed -n 's/^.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1.\2.\3/p'`
	GETTEXT_MAJOR_VERSION=`echo $GETTEXT_VERSION | cut -d. -f1`
	GETTEXT_MINOR_VERSION=`echo $GETTEXT_VERSION | cut -d. -f2`
	GETTEXT_MICRO_VERSION=`echo $GETTEXT_VERSION | cut -d. -f3`
@


1.7
log
@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.
@
text
@d24 1
a24 1
VERSION=0.1.5
d182 1
a182 1
	if test $GETTEXT_MINOR_VERSION -eq 12; then
@


1.6
log
@Add a comment for the thing we add to acinclude.m4. This way, Paco-Paco
will stop randomly deleting it.
@
text
@d4 1
a4 1
#                 from the 0.10.x series and 0.11.x.
d24 1
a24 1
VERSION=0.1.4
d37 1
a37 1
	
d102 1
a102 1
if [ x$GETTEXT_TOOL = x ]; then
d115 2
a116 2
if [ $NUMVAR -gt 0 ]; then
	if [ $NUMVAR -gt 1 ]; then
d120 1
a120 1
	elif [ $1 = "--gettext-tool" ]; then
d124 1
a124 1
	elif [ $1 = "--help" ]; then
d137 1
a137 1
	elif [ $1 = "--version" ]; then
d141 1
a141 1
	elif [ $1 = "--gettext-version" ]; then
d145 1
a145 1
	elif [ $1 = "--gettext-major-version" ]; then
d149 1
a149 1
	elif [ $1 = "--gettext-minor-version" ]; then
d153 1
a153 1
	elif [ $1 = "--gettext-micro-version" ]; then
d156 2
a157 2
	
	elif [ $1 = "--install" ]; then
d162 1
a162 1
	elif [ $1 = "--happy-url" ]; then
d165 2
a166 2
	
	elif [ $1 = "--verbose" ]; then
d176 1
a176 1
if [ "$GETTEXT_TOOL" = "autopoint" ]; then
d181 6
d188 1
a188 1
	if [ $GETTEXT_MINOR_VERSION -eq 11 ]; then
@


1.5
log
@Missed one.
@
text
@d24 1
a24 1
VERSION=0.1.3
d68 2
@


1.5.2.1
log
@Added support for gettext 0.11.x.
@
text
@@


1.4
log
@Oops. Blindly regexping is bad.
@
text
@d64 1
a64 1
		sed -e 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -f 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh > autogen.sh
@


1.3
log
@Latest version of setup-gettext. Fixes some of the bashisms, but not the
sed issue.
@
text
@d50 1
a50 1
		sed -f 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
d57 1
a57 1
		sed -f 's/^AM_GNU_GETTEXT\(.*\)$/AM_GNU_GETTEXT\1\
d64 1
a64 1
		sed -f 's/\(gettextize\|autopoint\) --version/.\/setup-gettext --gettext-tool/1' -f 's/^\(echo.*|[\t ]*\)\?\(gettextize\|autopoint\) -.*$/.\/setup-gettext/1' < .tmp-autogen.sh > autogen.sh
@


1.2
log
@Typo, and added the script to EXTRA_DIST.
@
text
@d2 21
d24 3
a26 1
VERSION=0.1.0
d47 24
d83 3
a85 3
	[ -e configure.in~ ] && mv -f configure.in~ configure.in
	[ -e configure.ac~ ] && mv -f configure.ac~ configure.ac
	[ -e Makefile.am~ ]  && mv -f Makefile.am~  Makefile.am
d100 1
a100 1
if [ x$GETTEXT_TOOL == x ]; then
d118 1
a118 1
	elif [ $1 == "--gettext-tool" ]; then
d122 1
a122 1
	elif [ $1 == "--help" ]; then
d135 1
a135 1
	elif [ $1 == "--version" ]; then
d139 1
a139 1
	elif [ $1 == "--gettext-version" ]; then
d143 1
a143 1
	elif [ $1 == "--gettext-major-version" ]; then
d147 1
a147 1
	elif [ $1 == "--gettext-minor-version" ]; then
d151 1
a151 1
	elif [ $1 == "--gettext-micro-version" ]; then
d154 5
d160 1
a160 1
	elif [ $1 == "--happy-url" ]; then
d163 3
d174 1
a174 1
if [ "$GETTEXT_TOOL" == "autopoint" ]; then
d176 1
d185 3
d196 1
a196 1
		[ -e po/Makevars.template ] && mv po/Makevars.template po/Makevars
d198 1
@


1.1
log
@This is easier to maintain, cleaner, and you can take the script with you.
@
text
@d56 1
a56 1
	echo "Please download one from your locak package repository or"
@

