3 # Copyright (C) 2001, 2003, 2005, 2006, 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.
8 dnl From Volker Borchert.
9 dnl Determine whether rename works for source file names with a trailing slash.
10 dnl The rename from SunOS 4.1.1_U1 doesn't.
12 dnl If it doesn't, then define RENAME_TRAILING_SLASH_BUG and arrange
13 dnl to compile the wrapper function.
16 AC_DEFUN([gl_FUNC_RENAME],
18 AC_REQUIRE([AC_CANONICAL_HOST])
19 AC_CACHE_CHECK([whether rename is broken with a trailing slash],
20 gl_cv_func_rename_trailing_slash_bug,
22 rm -rf conftest.d1 conftest.d2
24 AC_MSG_ERROR([cannot create temporary directory])
31 exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
34 gl_cv_func_rename_trailing_slash_bug=no,
35 gl_cv_func_rename_trailing_slash_bug=yes,
36 dnl When crosscompiling, assume rename is broken.
37 gl_cv_func_rename_trailing_slash_bug=yes)
39 rm -rf conftest.d1 conftest.d2
41 AC_CACHE_CHECK([whether rename is broken when the destination exists],
42 gl_cv_func_rename_dest_exists_bug,
45 mingw*) gl_cv_func_rename_dest_exists_bug=yes ;;
46 *) gl_cv_func_rename_dest_exists_bug=no ;;
49 if test $gl_cv_func_rename_trailing_slash_bug = yes ||
50 test $gl_cv_func_rename_dest_exists_bug = yes; then
52 AC_DEFINE([rename], [rpl_rename],
53 [Define to rpl_rename if the replacement function should be used.])
54 if test $gl_cv_func_rename_trailing_slash_bug = yes; then
55 AC_DEFINE([RENAME_TRAILING_SLASH_BUG], [1],
56 [Define if rename does not work for source file names with a trailing
57 slash, like the one from SunOS 4.1.1_U1.])
59 if test $gl_cv_func_rename_dest_exists_bug = yes; then
60 AC_DEFINE([RENAME_DEST_EXISTS_BUG], [1],
61 [Define if rename does not work when the destination file exists,
68 # Prerequisites of lib/rename.c.
69 AC_DEFUN([gl_PREREQ_RENAME], [:])