Remove K&R cruft.
[gnulib.git] / m4 / rename.m4
1 #serial 6
2
3 dnl From Volker Borchert.
4 dnl Determine whether rename works for source paths with a trailing slash.
5 dnl The rename from SunOS 4.1.1_U1 doesn't.
6 dnl
7 dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
8 dnl to compile the wrapper function.
9 dnl
10
11 AC_DEFUN([vb_FUNC_RENAME],
12 [
13  AC_CACHE_CHECK([whether rename is broken],
14   vb_cv_func_rename_trailing_slash_bug,
15   [
16     rm -rf conftest.d1 conftest.d2
17     mkdir conftest.d1 ||
18       AC_MSG_ERROR([cannot create temporary directory])
19     AC_TRY_RUN([
20 #       include <stdio.h>
21         int
22         main ()
23         {
24           exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
25         }
26       ],
27       vb_cv_func_rename_trailing_slash_bug=no,
28       vb_cv_func_rename_trailing_slash_bug=yes,
29       dnl When crosscompiling, assume rename is broken.
30       vb_cv_func_rename_trailing_slash_bug=yes)
31
32       rm -rf conftest.d1 conftest.d2
33   ])
34   if test $vb_cv_func_rename_trailing_slash_bug = yes; then
35     AC_LIBOBJ(rename)
36     AC_DEFINE(rename, rpl_rename,
37       [Define to rpl_rename if the replacement function should be used.])
38     AC_DEFINE(RENAME_TRAILING_SLASH_BUG, 1,
39       [Define if rename does not work for source paths with a trailing slash,
40        like the one from SunOS 4.1.1_U1.])
41     gl_PREREQ_RENAME
42   fi
43 ])
44
45 # Prerequisites of lib/rename.c.
46 AC_DEFUN([gl_PREREQ_RENAME], [:])