3 # Copyright (C) 2002-2007 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 cvsdatestamp='$Date: 2007-09-08 22:27:19 $'
23 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
24 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
27 # outputs to stdout the --help usage message.
33 Report bugs to <bug-gnulib@gnu.org>."
37 # outputs to stdout the --version message.
40 year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
42 $progname (GNU $package) $version
43 Copyright (C) $year Free Software Foundation, Inc.
44 This is free software; see the source for copying conditions. There is NO
45 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
46 Written by" "Bruno Haible"
50 /*) self_abspathname="$0" ;;
51 */*) self_abspathname=`pwd`/"$0" ;;
54 # Iterate through the elements of $PATH.
55 # We use IFS=: instead of
56 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
57 # because the latter does not work when some PATH element contains spaces.
58 # We use a canonicalized $pathx instead of $PATH, because empty PATH
59 # elements are by definition equivalent to '.', however field splitting
60 # according to IFS=: loses empty fields in many shells:
61 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
62 # beginning, at the end, and in the middle),
63 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
64 # at the beginning and at the end,
65 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
66 # Solaris lose empty fields at the end.
67 # The 'case' statement is an optimization, to avoid evaluating the
68 # explicit canonicalization command when $PATH contains no empty fields.
70 if test "${PATH_SEPARATOR+set}" != set; then
72 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
73 chmod +x "$tmp"/conf.sh
74 if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
81 if test "$PATH_SEPARATOR" = ";"; then
82 # On Windows, programs are searched in "." before $PATH.
85 # On Unix, we have to convert empty PATH elements to ".".
89 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
98 if test -x "$d/$0" && test ! -d "$d/$0"; then
99 self_abspathname="$d/$0"
104 if test -z "$self_abspathname"; then
105 func_fatal_error "could not locate the gnulib-tool program - how did you invoke it?"
109 while test -h "$self_abspathname"; do
110 # Resolve symbolic link.
111 linkval=`func_readlink "$self_abspathname"`
112 test -n "$linkval" || break
114 /* ) self_abspathname="$linkval" ;;
115 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
118 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
121 # Get the header modules.
122 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/headers/* 2>/dev/null \
123 | sed -e 's,^Gnulib module: ,,'
124 # Get the function modules.
125 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/functions/* 2>/dev/null \
126 | sed -e 's,^Gnulib module: ,,'
127 # Then filter out the words "---", "and", "or" and remove *-gnu modules.
128 ) | LC_ALL=C sort | LC_ALL=C uniq \
129 | { # Then filter out the words "---", "and", "or" and remove *-gnu modules.
130 tr ' ' '\012' | sed -e '/^---$/d' -e '/^and$/d' -e '/^or$/d' -e '/-gnu$/d'
132 | LC_ALL=C sort | LC_ALL=C uniq \
133 | { # Except ftruncate, which aborts the configuration on mingw. FiXME
134 sed -e '/^ftruncate$/d'