Correct SunOS and Solaris version number notation to match Sun's usage.
[gnulib.git] / m4 / rmdir-errno.m4
1 #serial 3
2
3 # When rmdir fails because the specified directory is not empty, it sets
4 # errno to some value, usually ENOTEMPTY.  However, on some AIX systems,
5 # ENOTEMPTY is mistakenly defined to be EEXIST.  To work around this, and
6 # in general, to avoid depending on the use of any particular symbol, this
7 # test runs a test to determine the actual numeric value.
8 AC_DEFUN([fetish_FUNC_RMDIR_NOTEMPTY],
9 [dnl
10   AC_CACHE_CHECK([for rmdir-not-empty errno value],
11     fetish_cv_func_rmdir_errno_not_empty,
12     [
13       # Arrange for deletion of the temporary directory this test creates.
14       ac_clean_files="$ac_clean_files confdir2"
15       mkdir confdir2; : > confdir2/file
16       AC_TRY_RUN([
17 #include <stdio.h>
18 #include <errno.h>
19 #ifndef errno
20 extern int errno;
21 #endif
22         int main ()
23         {
24           FILE *s;
25           int val;
26           rmdir ("confdir2");
27           val = errno;
28           s = fopen ("confdir2/errno", "w");
29           fprintf (s, "%d\n", val);
30           exit (0);
31         }
32         ],
33       fetish_cv_func_rmdir_errno_not_empty=`cat confdir2/errno`,
34       fetish_cv_func_rmdir_errno_not_empty='configure error in rmdir-errno.m4',
35       fetish_cv_func_rmdir_errno_not_empty=ENOTEMPTY
36       )
37     ]
38   )
39
40   AC_DEFINE_UNQUOTED([RMDIR_ERRNO_NOT_EMPTY],
41     $fetish_cv_func_rmdir_errno_not_empty,
42     [the value to which errno is set when rmdir fails on a nonempty directory])
43 ])