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 3 of the License, or
8 # (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
21 cvsdatestamp='$Date: 2007-09-11 00:40:16 $'
22 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
23 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
26 # outputs to stdout the --help usage message.
32 Report bugs to <bug-gnulib@gnu.org>."
36 # outputs to stdout the --version message.
39 year=`echo "$last_checkin_date" | sed -e 's,/.*$,,'`
41 $progname (GNU $package) $version
42 Copyright (C) $year Free Software Foundation, Inc.
43 This is free software; see the source for copying conditions. There is NO
44 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
45 Written by" "Bruno Haible"
49 /*) self_abspathname="$0" ;;
50 */*) self_abspathname=`pwd`/"$0" ;;
53 # Iterate through the elements of $PATH.
54 # We use IFS=: instead of
55 # for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`
56 # because the latter does not work when some PATH element contains spaces.
57 # We use a canonicalized $pathx instead of $PATH, because empty PATH
58 # elements are by definition equivalent to '.', however field splitting
59 # according to IFS=: loses empty fields in many shells:
60 # - /bin/sh on OSF/1 and Solaris loses all empty fields (at the
61 # beginning, at the end, and in the middle),
62 # - /bin/sh on IRIX and /bin/ksh on IRIX and OSF/1 lose empty fields
63 # at the beginning and at the end,
64 # - GNU bash, /bin/sh on AIX and HP-UX, and /bin/ksh on AIX, HP-UX,
65 # Solaris lose empty fields at the end.
66 # The 'case' statement is an optimization, to avoid evaluating the
67 # explicit canonicalization command when $PATH contains no empty fields.
69 if test "${PATH_SEPARATOR+set}" != set; then
71 { echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
72 chmod +x "$tmp"/conf.sh
73 if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
80 if test "$PATH_SEPARATOR" = ";"; then
81 # On Windows, programs are searched in "." before $PATH.
84 # On Unix, we have to convert empty PATH elements to ".".
88 pathx=`echo ":$PATH:" | sed -e 's/:::*/:.:/g' -e 's/^://' -e 's/:\$//'`
97 if test -x "$d/$0" && test ! -d "$d/$0"; then
98 self_abspathname="$d/$0"
103 if test -z "$self_abspathname"; then
104 func_fatal_error "could not locate the posix-modules program - how did you invoke it?"
108 while test -h "$self_abspathname"; do
109 # Resolve symbolic link.
110 linkval=`func_readlink "$self_abspathname"`
111 test -n "$linkval" || break
113 /* ) self_abspathname="$linkval" ;;
114 * ) self_abspathname=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`/"$linkval" ;;
117 gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`
119 # Command-line option processing.
120 while test $# -gt 0; do
122 --help | --hel | --he | --h )
125 --version | --versio | --versi | --vers | --ver | --ve | --v )
129 echo "posix-modules: unknown option $1" 1>&2
130 echo "Try 'posix-modules --help' for more information." 1>&2
133 echo "posix-modules: too many arguments" 1>&2
134 echo "Try 'posix-modules --help' for more information." 1>&2
140 # Get the header modules.
141 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/headers/* 2>/dev/null \
142 | sed -e 's,^Gnulib module: ,,'
143 # Get the function modules.
144 LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/functions/* 2>/dev/null \
145 | sed -e 's,^Gnulib module: ,,'
146 # Then filter out the words "---", "and", "or" and remove *-gnu modules.
147 ) | LC_ALL=C sort | LC_ALL=C uniq \
148 | { # Then filter out the words "---", "and", "or" and remove *-gnu modules.
149 tr ' ' '\012' | sed -e '/^---$/d' -e '/^and$/d' -e '/^or$/d' -e '/-gnu$/d'
151 | LC_ALL=C sort | LC_ALL=C uniq \
152 | { # Except ftruncate, which aborts the configuration on mingw. FiXME
153 sed -e '/^ftruncate$/d'