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_REQUIRE([gl_STDIO_H_DEFAULTS])
20 AC_CACHE_CHECK([whether rename is broken with a trailing slash],
21 gl_cv_func_rename_trailing_slash_bug,
23 rm -rf conftest.d1 conftest.d2
25 AC_MSG_ERROR([cannot create temporary directory])
26 AC_RUN_IFELSE([AC_LANG_SOURCE([[
32 exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
35 [gl_cv_func_rename_trailing_slash_bug=no],
36 [gl_cv_func_rename_trailing_slash_bug=yes],
37 dnl When crosscompiling, assume rename is broken.
38 [gl_cv_func_rename_trailing_slash_bug=yes])
40 rm -rf conftest.d1 conftest.d2
42 AC_CACHE_CHECK([whether rename is broken when the destination exists],
43 gl_cv_func_rename_dest_exists_bug,
46 mingw*) gl_cv_func_rename_dest_exists_bug=yes ;;
47 *) gl_cv_func_rename_dest_exists_bug=no ;;
50 if test $gl_cv_func_rename_trailing_slash_bug = yes ||
51 test $gl_cv_func_rename_dest_exists_bug = yes; then
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], [:])