maint: fts.c: remove __opendir2's now-unused parameter, oflag
[gnulib.git] / m4 / unlink.m4
index e485c6f..49cd3bb 100644 (file)
@@ -1,12 +1,11 @@
-# unlink.m4 serial 5
-dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# unlink.m4 serial 8
+dnl Copyright (C) 2009-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,
 dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_UNLINK],
 [
-  AC_REQUIRE([gl_AC_DOS])
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
   dnl Detect FreeBSD 7.2, AIX 7.1, Solaris 9 bug.
@@ -21,11 +20,20 @@ AC_DEFUN([gl_FUNC_UNLINK],
        [AC_LANG_PROGRAM(
          [[#include <unistd.h>
            #include <errno.h>
-]], [[if (!unlink ("conftest.file/") || errno != ENOTDIR) return 1;
+         ]],
+         [[int result = 0;
+           if (!unlink ("conftest.file/"))
+             result |= 1;
+           else if (errno != ENOTDIR)
+             result |= 2;
 #if HAVE_LSTAT
-      if (!unlink ("conftest.lnk/") || errno != ENOTDIR) return 2;
+           if (!unlink ("conftest.lnk/"))
+             result |= 4;
+           else if (errno != ENOTDIR)
+             result |= 8;
 #endif
-      ]])],
+           return result;
+         ]])],
       [gl_cv_func_unlink_honors_slashes=yes],
       [gl_cv_func_unlink_honors_slashes=no],
       [gl_cv_func_unlink_honors_slashes="guessing no"])
@@ -65,9 +73,12 @@ AC_DEFUN([gl_FUNC_UNLINK],
                 #include <unistd.h>
                 int main ()
                 {
+                  int result = 0;
                   if (chdir (getenv ("GL_SUBDIR_FOR_UNLINK")) != 0)
-                    return 1;
-                  return unlink ("..") == 0;
+                    result |= 1;
+                  else if (unlink ("..") == 0)
+                    result |= 2;
+                  return result;
                 }
               ]])],
              [gl_cv_func_unlink_parent_fails=yes],
@@ -97,6 +108,5 @@ AC_DEFUN([gl_FUNC_UNLINK],
           esac
         }; then
     REPLACE_UNLINK=1
-    AC_LIBOBJ([unlink])
   fi
 ])