X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=m4%2Ffcntl-o.m4;h=87cc4bd2ddbd4c37aad828c31b38b95149c8fe11;hb=daa269958ad8d50ef8154ccb65e58acaf7a6dd99;hp=88db07ec73e1b2f702e292b003fbdc9b618a65ae;hpb=1a44d77d50f4fb37c0410eed04b82303624ea2ec;p=debian%2Ftar diff --git a/m4/fcntl-o.m4 b/m4/fcntl-o.m4 index 88db07ec..87cc4bd2 100644 --- a/m4/fcntl-o.m4 +++ b/m4/fcntl-o.m4 @@ -1,5 +1,5 @@ -# fcntl-o.m4 serial 3 -dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. +# fcntl-o.m4 serial 4 +dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,12 +17,21 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], [AC_REQUIRE([AC_GNU_SOURCE])]) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_FUNCS_ONCE([symlink]) AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include #include - #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + # include + # defined sleep(n) _sleep ((n) * 1000) + #endif #include #ifndef O_NOATIME #define O_NOATIME 0 @@ -38,9 +47,21 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], ]], [[ int result = !constants; + #if HAVE_SYMLINK { static char const sym[] = "conftest.sym"; - if (symlink (".", sym) != 0) + if (symlink ("/dev/null", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + if (unlink (sym) != 0 || symlink (".", sym) != 0) result |= 2; else { @@ -53,6 +74,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], } unlink (sym); } + #endif { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME);