Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / lib / gettext / project-id
blob496f466c92602cf39cb556d8729ee6df141743a2
1 #!/bin/sh
2 # Prints a package's identification PACKAGE VERSION or PACKAGE.
4 # Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 want_version="$1"
21 # NLS nuisances: Letter ranges are different in the Estonian locale.
22 LC_ALL=C
24 while true; do
25 if test -f configure; then
26 package=`(grep '^PACKAGE_NAME=' configure; grep '^ *PACKAGE=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
27 case "$package" in
28 *[\"\$\`\{\}]*)
29 # Some packages (gcal) retrieve the package name dynamically.
30 package=
32 esac
33 if test -n "$package"; then
34 is_gnu=`LC_ALL=C grep "GNU $package" * 2>/dev/null | grep -v '^libtool:'`
35 if test -n "$is_gnu"; then
36 package="GNU $package"
38 if test -n "$want_version"; then
39 version=`(grep '^PACKAGE_VERSION=' configure; grep '^ *VERSION=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
40 case "$version" in
41 *[\"\$\`\{\}]*)
42 # Some packages (gcal, gcc, clisp) retrieve the version dynamically.
43 version=
45 esac
46 if test -n "$version"; then
47 echo "$package $version"
48 else
49 echo "$package"
51 else
52 echo "$package"
54 exit 0
57 dir=`basename \`pwd\``
58 case "$dir" in
59 i18n)
60 # This directory name, used in GNU make, is not the top level directory.
62 *[A-Za-z]*[0-9]*)
63 package=`echo "$dir" | sed -e 's/^\([^0-9]*\)[0-9].*$/\1/' -e 's/[-_]$//'`
64 if test -n "$want_version"; then
65 version=`echo "$dir" | sed -e 's/^[^0-9]*\([0-9].*\)$/\1/'`
66 echo "$package $version"
67 else
68 echo "$package"
70 exit 0
72 esac
73 # Go to parent directory
74 last=`/bin/pwd`
75 cd ..
76 curr=`/bin/pwd`
77 if test "$last" = "$curr"; then
78 # Oops, didn't find the package name.
79 if test -n "$want_version"; then
80 echo "PACKAGE VERSION"
81 else
82 echo "PACKAGE"
84 exit 0
86 done