summaryrefslogtreecommitdiff
path: root/m4/dup.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-09-24 17:42:03 +0200
committerBruno Haible <bruno@clisp.org>2011-09-24 17:42:03 +0200
commit026b2bdecbd540899299f499f062354dcb0556b0 (patch)
tree9f089ab3de696f903674d55fea0a586b6dc3aabe /m4/dup.m4
parenteea38e67b2eb57529b01092d86178935d7ead222 (diff)
downloadgnulib-026b2bdecbd540899299f499f062354dcb0556b0.tar.gz
dup: Simplify autoconf test.
* m4/dup.m4 (gl_FUNC_DUP): Don't run a test program. Instead, just rely on gl_MSVC_INVAL's result.
Diffstat (limited to 'm4/dup.m4')
-rw-r--r--m4/dup.m435
1 files changed, 5 insertions, 30 deletions
diff --git a/m4/dup.m4 b/m4/dup.m4
index 8f2ec8f7b0..83d4ecb8f4 100644
--- a/m4/dup.m4
+++ b/m4/dup.m4
@@ -1,4 +1,4 @@
-# dup.m4 serial 1
+# dup.m4 serial 2
dnl Copyright (C) 2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -7,35 +7,10 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_DUP],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CACHE_CHECK([whether dup supports bad arguments], [gl_cv_func_dup_works],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM([[
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#else
-# include <io.h>
-#endif
-#include <errno.h>
-]],
- [[if (dup (-1) != -1)
- return 1;
- if (errno != EBADF)
- return 2;
- return 0;
- ]])],
- [gl_cv_func_dup_works=yes],
- [gl_cv_func_dup_works=no],
- [case "$host_os" in
- mingw*) gl_cv_func_dup_works="guessing no" ;;
- *) gl_cv_func_dup_works="guessing yes" ;;
- esac
- ])
- ])
- case "$gl_cv_func_dup_works" in
- *no) REPLACE_DUP=1 ;;
- esac
+ AC_REQUIRE([gl_MSVC_INVAL])
+ if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then
+ REPLACE_DUP=1
+ fi
dnl Replace dup() for supporting the gnulib-defined fchdir() function,
dnl to keep fchdir's bookkeeping up-to-date.
m4_ifdef([gl_FUNC_FCHDIR], [