(gl_GETADDRINFO): Look for getservbyname in these
[gnulib.git] / m4 / mkdir-slash.m4
1 #serial 4
2
3 # Copyright (C) 2001, 2003, 2004 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_CACHE_CHECK([whether mkdir fails due to a trailing slash],
14     gl_cv_func_mkdir_trailing_slash_bug,
15     [
16       # Arrange for deletion of the temporary directory this test might create.
17       ac_clean_files="$ac_clean_files confdir-slash"
18       AC_TRY_RUN([
19 #       include <sys/types.h>
20 #       include <sys/stat.h>
21 #       include <stdlib.h>
22         int main ()
23         {
24           rmdir ("confdir-slash");
25           exit (mkdir ("confdir-slash/", 0700));
26         }
27         ],
28       gl_cv_func_mkdir_trailing_slash_bug=no,
29       gl_cv_func_mkdir_trailing_slash_bug=yes,
30       gl_cv_func_mkdir_trailing_slash_bug=yes
31       )
32     ]
33   )
34
35   if test $gl_cv_func_mkdir_trailing_slash_bug = yes; then
36     AC_LIBOBJ(mkdir)
37     AC_DEFINE(mkdir, rpl_mkdir,
38       [Define to rpl_mkdir if the replacement function should be used.])
39     gl_PREREQ_MKDIR
40   fi
41 ])
42
43 # Prerequisites of lib/mkdir.c.
44 AC_DEFUN([gl_PREREQ_MKDIR], [:])