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