summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-09-16 12:32:07 +0000
committerJim Meyering <jim@meyering.net>2001-09-16 12:32:07 +0000
commit0b0b0c10b9ced9264268c64670c391329cbafedd (patch)
tree09532b3848361246843d0fa7e1582a8ebed30d5a /m4
parent74ab294e6fdf16d3aa296a6899c5a26f94416137 (diff)
downloadcoreutils-0b0b0c10b9ced9264268c64670c391329cbafedd.tar.xz
(UTILS_FUNC_MKDIR_TRAILING_SLASH): New file/macro.
Diffstat (limited to 'm4')
-rw-r--r--m4/mkdir-slash.m435
1 files changed, 35 insertions, 0 deletions
diff --git a/m4/mkdir-slash.m4 b/m4/mkdir-slash.m4
new file mode 100644
index 000000000..8245d8870
--- /dev/null
+++ b/m4/mkdir-slash.m4
@@ -0,0 +1,35 @@
+#serial 1
+
+# 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],
+[dnl
+ AC_CACHE_CHECK([whether mkdir fails due to a trailing slash],
+ utils_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"
+ AC_TRY_RUN([
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <stdlib.h>
+ 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
+ )
+ ]
+ )
+
+ if test $utils_cv_func_mkdir_trailing_slash_bug = yes; then
+ AC_LIBOBJ(mkdir)
+ AC_DEFINE_UNQUOTED(mkdir, rpl_mkdir,
+ [Define to rpl_mkdir if the replacement function should be used.])
+ fi
+])