- if mkdir conftestdir; then
- vb_cv_func_rename_trailing_slash_bug=no
- else
- AC_TRY_RUN([
-# include <stdio.h>
- int
- main ()
- {
- exit (rename ("conftestdir/", "conftestdir2") ? 1 : 0);
- }
- ],
- vb_cv_func_rename_trailing_slash_bug=no,
- vb_cv_func_rename_trailing_slash_bug=yes,
- dnl When crosscompiling, assume rename is broken.
- vb_cv_func_rename_trailing_slash_bug=yes)
- rm -rf conftestdir conftestdir2
- fi
+ rm -rf conftest.d1 conftest.d2
+ mkdir conftest.d1 ||
+ AC_MSG_ERROR([cannot create temporary directory])
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+# include <stdio.h>
+# include <stdlib.h>
+ int
+ main ()
+ {
+ exit (rename ("conftest.d1/", "conftest.d2") ? 1 : 0);
+ }
+ ]])],
+ [gl_cv_func_rename_trailing_slash_bug=no],
+ [gl_cv_func_rename_trailing_slash_bug=yes],
+ dnl When crosscompiling, assume rename is broken.
+ [gl_cv_func_rename_trailing_slash_bug=yes])
+
+ rm -rf conftest.d1 conftest.d2
+ ])
+ AC_CACHE_CHECK([whether rename is broken when the destination exists],
+ gl_cv_func_rename_dest_exists_bug,
+ [
+ case "$host_os" in
+ mingw*) gl_cv_func_rename_dest_exists_bug=yes ;;
+ *) gl_cv_func_rename_dest_exists_bug=no ;;
+ esac