summaryrefslogtreecommitdiff
path: root/m4/getcwd-path-max.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-09-11 21:44:32 +0200
committerBruno Haible <bruno@clisp.org>2011-09-11 21:44:32 +0200
commit912da04e8be8f7b78ea66c0fba08b2ceb292b8b0 (patch)
treed419d259a7fac387556d297dd6e00047b0a8f7cf /m4/getcwd-path-max.m4
parentcd06f44c35f1e2a49c806686c8f9f6fcf1902a45 (diff)
downloadgnulib-912da04e8be8f7b78ea66c0fba08b2ceb292b8b0.tar.gz
unistd et al.: Don't assume <unistd.h> exists.
* m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): Don't include <unistd.h> if it does not exist. * m4/environ.m4 (gl_ENVIRON): Don't include <unistd.h> if it does not exist. But include <stdlib.h>. * m4/fcntl-o.m4 (gl_FCNTL_O_FLAGS): If <unistd.h> does not exist, include <io.h> and <stdlib.h> instead. Don't test symbolink links if symlink() does not exist. * m4/fflush.m4 (gl_FUNC_FFLUSH_STDIN): If <unistd.h> does not exist, include <io.h> instead. * m4/free.m4 (gl_FUNC_FREE): Assume free(NULL) works on native Windows. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): If <unistd.h> does not exist, include <direct.h> instead. * m4/getcwd-abort-bug.m4 (gl_FUNC_GETCWD_ABORT_BUG): Likewise. * m4/getcwd-path-max.m4 (gl_FUNC_GETCWD_PATH_MAX): Likewise. * m4/lseek.m4 (gl_FUNC_LSEEK): If <unistd.h> does not exist, include <io.h> instead. * m4/rename.m4 (gl_FUNC_RENAME): Assume rename() manages hard links correctly if the system does not have hard links. * m4/rmdir.m4 (gl_FUNC_RMDIR): If <unistd.h> does not exist, include <direct.h> instead. * m4/unistd_h.m4 (gl_UNISTD_H): If <unistd.h> does not exist, bypass it when looking for function declarations. * m4/unlink.m4 (gl_FUNC_UNLINK): If <unistd.h> does not exist, include <direct.h> and <io.h> instead. * doc/posix-headers/unistd.texi: More details about MSVC problem.
Diffstat (limited to 'm4/getcwd-path-max.m4')
-rw-r--r--m4/getcwd-path-max.m49
1 files changed, 7 insertions, 2 deletions
diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4
index 475ae96d16..65ee491037 100644
--- a/m4/getcwd-path-max.m4
+++ b/m4/getcwd-path-max.m4
@@ -1,4 +1,4 @@
-# serial 16
+# serial 17
# Check for several getcwd bugs with long file names.
# If so, arrange to compile the wrapper function.
@@ -17,6 +17,7 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
[
AC_CHECK_DECLS_ONCE([getcwd])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ AC_CHECK_HEADERS_ONCE([unistd.h])
AC_CACHE_CHECK([whether getcwd handles long file names properly],
gl_cv_func_getcwd_path_max,
[# Arrange for deletion of the temporary directory this test creates.
@@ -27,7 +28,11 @@ AC_DEFUN([gl_FUNC_GETCWD_PATH_MAX],
[[
#include <errno.h>
#include <stdlib.h>
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#else
+# include <direct.h>
+#endif
#include <string.h>
#include <limits.h>
#include <sys/stat.h>