strtod: avoid C99 decl-after-statement
[gnulib.git] / m4 / mkdir-slash.m4
1 # serial 7
2
3 # Copyright (C) 2001, 2003-2004, 2006, 2008-2009 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # On some systems, mkdir ("foo/", 0700) fails because of the trailing slash.
9 # On such systems, arrange to use a wrapper function that removes any
10 # trailing slashes.
11 AC_DEFUN([gl_FUNC_MKDIR_TRAILING_SLASH],
12 [dnl
13   AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14   AC_CHECK_HEADERS_ONCE([unistd.h])
15   AC_CACHE_CHECK([whether mkdir fails due to a trailing slash],
16     gl_cv_func_mkdir_trailing_slash_bug,
17     [
18       # Arrange for deletion of the temporary directory this test might create.
19       ac_clean_files="$ac_clean_files confdir-slash"
20       AC_TRY_RUN([
21 #       include <sys/types.h>
22 #       include <sys/stat.h>
23 #       include <stdlib.h>
24 #       ifdef HAVE_UNISTD_H
25 #         include <unistd.h>
26 #       endif
27         int main ()
28         {
29           rmdir ("confdir-slash");
30           exit (mkdir ("confdir-slash/", 0700));
31         }
32         ],
33       gl_cv_func_mkdir_trailing_slash_bug=no,
34       gl_cv_func_mkdir_trailing_slash_bug=yes,
35       gl_cv_func_mkdir_trailing_slash_bug=yes
36       )
37     ]
38   )
39
40   if test $gl_cv_func_mkdir_trailing_slash_bug = yes; then
41     REPLACE_MKDIR=1
42     AC_LIBOBJ([mkdir])
43     gl_PREREQ_MKDIR
44   fi
45 ])
46
47 # Prerequisites of lib/mkdir.c.
48 AC_DEFUN([gl_PREREQ_MKDIR], [:])