To all,

I have been facing a problem on Windows/MinGW with autoconf. The configure generated script crashes when called via "config.status --recheck":
../src/configure: config.log: Permission denied

The reason is that config.log cannot be truncated by configure because config.status already opened it (and Windows forbids truncating an open file). Here is the fix (tested on Windows/MinGW).

Best regards,
Eric

--- lib/autoconf/general.m4~    2006-04-14 12:37:15.913263000 +0200
+++ lib/autoconf/general.m4     2006-04-14 12:57:01.063010000 +0200
@@ -1103,6 +1103,11 @@
 m4_define([_AC_INIT_CONFIG_LOG],
 [m4_divert_text([INIT_PREPARE],
 [m4_define([AS_MESSAGE_LOG_FD], 5)dnl
+exec AS_MESSAGE_LOG_FD>/dev/null
+# Redirect first AS_MESSAGE_LOG_FD to /dev/null in order to be able to
+# truncate config.log in the case configure is run by "config.status --recheck"
+# with AS_MESSAGE_LOG_FD already opened on config.log (on Windows, truncating
+an open file is forbidden).
 exec AS_MESSAGE_LOG_FD>config.log
 cat >&AS_MESSAGE_LOG_FD <<_ACEOF
 This file contains any messages produced by compilers while
--- ChangeLog~  2006-04-14 12:44:01.000000000 +0200
+++ ChangeLog   2006-04-14 12:59:14.811001000 +0200
@@ -1,3 +1,9 @@
+2006-04-14  Eric PAIRE  <[EMAIL PROTECTED]>
+
+       * lib/autoconf/general.m4 (_AC_INIT_CONFIG_LOG): Redirect first
+       AS_MESSAGE_LOG_FD to /dev/null in order to be able to truncate
+       config.log if already opened by "config.status --recheck" (on Windows).
+
 2006-04-14  Stepan Kasal  <[EMAIL PROTECTED]>
 
        * lib/Autom4te/FileUtils.pm (find_file): Fix a typo in the

Reply via email to