summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2016-12-17 10:50:06 (GMT)
committerBruno Haible <bruno@clisp.org>2016-12-18 12:10:55 (GMT)
commit3e8966603703b677b3c29003dd8c1d68dd34457c (patch)
treeb1a6155c9366566d39dd9a593ebd5ea982362846
parent571d60e6f9b53acd386d0cfe73e5c4fbf3a2c9da (diff)
downloadgnulib-3e8966603703b677b3c29003dd8c1d68dd34457c.zip
gnulib-3e8966603703b677b3c29003dd8c1d68dd34457c.tar.gz
gnulib-3e8966603703b677b3c29003dd8c1d68dd34457c.tar.bz2
posix-modules: Add options for specific platforms.
* posix-modules (func_usage): Document options --for-mingw, --for-msvc. (exclude_for_mingw, exclude_for_msvc, exclude): New variables. Invoke func_tmpdir. Filter out the excludes.
-rw-r--r--ChangeLog7
-rwxr-xr-xposix-modules48
2 files changed, 53 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d9834b5..9dd66ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2016-12-18 Bruno Haible <bruno@clisp.org>
+ posix-modules: Add options for specific platforms.
+ * posix-modules (func_usage): Document options --for-mingw, --for-msvc.
+ (exclude_for_mingw, exclude_for_msvc, exclude): New variables.
+ Invoke func_tmpdir. Filter out the excludes.
+
+2016-12-18 Bruno Haible <bruno@clisp.org>
+
getopt: Fix link error for users of getopt() in <unistd.h>.
* lib/getopt.in.h (getopt etc.): Do the macro definitions also when
__need_getopt is defined. Undefine all macros before defining them.
diff --git a/posix-modules b/posix-modules
index 4464e7e..b1a5eba 100755
--- a/posix-modules
+++ b/posix-modules
@@ -24,10 +24,15 @@ package=gnulib
func_usage ()
{
echo "\
-Usage: posix-modules
+Usage: posix-modules [option]
Lists the gnulib modules that implement POSIX interfaces.
+Options:
+
+ --for-mingw list only modules that work on mingw
+ --for-msvc list only modules that work on MSVC
+
Report bugs to <bug-gnulib@gnu.org>."
}
@@ -217,9 +222,27 @@ else
}
fi
+# Excludes for mingw.
+exclude_for_mingw=
+# <grp.h> does not exist.
+exclude_for_mingw="$exclude_for_mingw pt_chown grantpt posix_openpt-tests posix_openpt"
+# The functions getuid, getgid, geteuid, getegid don't exist.
+exclude_for_mingw="$exclude_for_mingw euidaccess faccessat"
+exclude_for_mingw="$exclude_for_mingw fchownat-tests fchownat"
+
+# Excludes for MSVC.
+exclude_for_msvc="$exclude_for_mingw"
+
# Command-line option processing.
+exclude=
while test $# -gt 0; do
case "$1" in
+ --for-mingw | --for-ming | --for-min | --for-mi )
+ exclude="$exclude $exclude_for_mingw"
+ shift ;;
+ --for-msvc | --for-msv | --for-ms )
+ exclude="$exclude $exclude_for_msvc"
+ shift ;;
--help | --hel | --he | --h )
func_usage
exit $? ;;
@@ -238,6 +261,18 @@ while test $# -gt 0; do
done
func_gnulib_dir
+func_tmpdir
+trap 'exit_status=$?
+ if test "$signal" != 0; then
+ echo "caught signal $signal" >&2
+ fi
+ rm -rf "$tmp"
+ exit $exit_status' 0
+for signal in 1 2 3 13 15; do
+ trap '{ signal='$signal'; func_exit 1; }' $signal
+done
+signal=0
+
(
# Get the header modules.
LC_ALL=C grep -h '^Gnulib module: ' "$gnulib_dir"/doc/posix-headers/*.texi 2>/dev/null \
@@ -250,7 +285,16 @@ func_gnulib_dir
| { # Then filter out the words "---", "and", "or" and remove *-gnu modules.
tr ' ' '\012' | sed -e '/^---$/d' -e '/^and$/d' -e '/^or$/d' -e '/-gnu$/d'
} \
- | LC_ALL=C sort | LC_ALL=C uniq
+ | LC_ALL=C sort | LC_ALL=C uniq \
+ | { # Then filter out the excludes.
+ if test -n "$exclude"; then
+ for m in $exclude; do echo $m; done | LC_ALL=C sort -u > "$tmp"/excludes
+ LC_ALL=C join -v 1 - "$tmp"/excludes
+ rm -f "$tmp"/excludes
+ else
+ cat
+ fi
+ }
# Local Variables:
# indent-tabs-mode: nil