Work around select() bug on Interix 3.5.
[gnulib.git] / m4 / mkdir-slash.m4
index 84c9415..4e56bda 100644 (file)
@@ -1,12 +1,19 @@
-#serial 2
+# serial 7
+
+# Copyright (C) 2001, 2003-2004, 2006, 2008-2009 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
 
 # On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
 # On such systems, arrange to use a wrapper function that removes any
 # trailing slashes.
-AC_DEFUN([UTILS_FUNC_MKDIR_TRAILING_SLASH],
+AC_DEFUN([gl_FUNC_MKDIR_TRAILING_SLASH],
 [dnl
+  AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([unistd.h])
   AC_CACHE_CHECK([whether mkdir fails due to a trailing slash],
-    utils_cv_func_mkdir_trailing_slash_bug,
+    gl_cv_func_mkdir_trailing_slash_bug,
     [
       # Arrange for deletion of the temporary directory this test might create.
       ac_clean_files="$ac_clean_files confdir-slash"
@@ -14,23 +21,25 @@ AC_DEFUN([UTILS_FUNC_MKDIR_TRAILING_SLASH],
 #       include <sys/types.h>
 #       include <sys/stat.h>
 #       include <stdlib.h>
+#       ifdef HAVE_UNISTD_H
+#         include <unistd.h>
+#       endif
        int main ()
        {
          rmdir ("confdir-slash");
          exit (mkdir ("confdir-slash/", 0700));
        }
        ],
-      utils_cv_func_mkdir_trailing_slash_bug=no,
-      utils_cv_func_mkdir_trailing_slash_bug=yes,
-      utils_cv_func_mkdir_trailing_slash_bug=yes
+      gl_cv_func_mkdir_trailing_slash_bug=no,
+      gl_cv_func_mkdir_trailing_slash_bug=yes,
+      gl_cv_func_mkdir_trailing_slash_bug=yes
       )
     ]
   )
 
-  if test $utils_cv_func_mkdir_trailing_slash_bug = yes; then
-    AC_LIBOBJ(mkdir)
-    AC_DEFINE(mkdir, rpl_mkdir,
-      [Define to rpl_mkdir if the replacement function should be used.])
+  if test $gl_cv_func_mkdir_trailing_slash_bug = yes; then
+    REPLACE_MKDIR=1
+    AC_LIBOBJ([mkdir])
     gl_PREREQ_MKDIR
   fi
 ])