No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / src / project-id
blob95e5f9ffa323a555cd3d2a485e67683a8548ecf1
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 2, or (at your option)
9 # 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, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 want_version="$1"
22 # NLS nuisances: Letter ranges are different in the Estonian locale.
23 LC_ALL=C
25 while true; do
26 if test -f configure; then
27 package=`(grep '^PACKAGE_NAME=' configure; grep '^ *PACKAGE=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
28 case "$package" in
29 *[\"\$\`\{\}]*)
30 # Some packages (gcal) retrieve the package name dynamically.
31 package=
33 esac
34 if test -n "$package"; then
35 is_gnu=`LC_ALL=C grep "GNU $package" * 2>/dev/null | grep -v '^libtool:'`
36 if test -n "$is_gnu"; then
37 package="GNU $package"
39 if test -n "$want_version"; then
40 version=`(grep '^PACKAGE_VERSION=' configure; grep '^ *VERSION=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
41 case "$version" in
42 *[\"\$\`\{\}]*)
43 # Some packages (gcal, gcc, clisp) retrieve the version dynamically.
44 version=
46 esac
47 if test -n "$version"; then
48 echo "$package $version"
49 else
50 echo "$package"
52 else
53 echo "$package"
55 exit 0
58 dir=`basename \`pwd\``
59 case "$dir" in
60 i18n)
61 # This directory name, used in GNU make, is not the top level directory.
63 *[A-Za-z]*[0-9]*)
64 package=`echo "$dir" | sed -e 's/^\([^0-9]*\)[0-9].*$/\1/' -e 's/[-_]$//'`
65 if test -n "$want_version"; then
66 version=`echo "$dir" | sed -e 's/^[^0-9]*\([0-9].*\)$/\1/'`
67 echo "$package $version"
68 else
69 echo "$package"
71 exit 0
73 esac
74 # Go to parent directory
75 last=`/bin/pwd`
76 cd ..
77 curr=`/bin/pwd`
78 if test "$last" = "$curr"; then
79 # Oops, didn't find the package name.
80 if test -n "$want_version"; then
81 echo "PACKAGE VERSION"
82 else
83 echo "PACKAGE"
85 exit 0
87 done