[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Extract rm out of shell functions for AC_*_IFELSE
From: |
Paolo Bonzini |
Subject: |
[PATCH] Extract rm out of shell functions for AC_*_IFELSE |
Date: |
Thu, 23 Oct 2008 15:42:27 +0200 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Here it is, I reran compile.at so far, which includes the new testcase.
I'll push after getting approval and running the full testsuite.
Paolo
2008-10-22 Paolo Bonzini <address@hidden>
* lib/autoconf/general.m4 (_AC_PREPROC_IFELSE_BODY,
_AC_COMPILE_IFELSE_BODY, _AC_LINK_IFELSE_BODY, _AC_RUN_IFELSE_BODY):
Move rm commands, except IPA files and Apple debug symbols...
(_AC_PREPROC_IFELSE, __AC_COMPILE_IFELSE, _AC_LINK_IFELSE,
_AC_RUN_IFELSE): ...in here.
* tests/compile.at: Add regression test.
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 21959df..72a54c5 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -2390,7 +2390,6 @@ m4_define([_AC_PREPROC_IFELSE_BODY],
[ac_retval=0],
[_AC_MSG_LOG_CONFTEST
ac_retval=1])
- rm -f conftest.err
AS_LINENO_POP
return $ac_retval
])# _AC_PREPROC_IFELSE_BODY
@@ -2409,7 +2408,7 @@ AC_DEFUN([_AC_PREPROC_IFELSE],
[$0_BODY])]dnl
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_cpp "$LINENO"], [$2], [$3])
-m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
+rm -f conftest.err[]m4_ifvaln([$1], [ conftest.$ac_ext])dnl
])# _AC_PREPROC_IFELSE
# AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
@@ -2480,7 +2479,6 @@ m4_define([_AC_COMPILE_IFELSE_BODY],
[ac_retval=0],
[_AC_MSG_LOG_CONFTEST
ac_retval=1])
- rm -f core conftest.err conftest.$ac_objext
AS_LINENO_POP
return $ac_retval
])# _AC_COMPILE_IFELSE_BODY
@@ -2497,7 +2495,7 @@ AC_DEFUN([_AC_COMPILE_IFELSE],
[$0_BODY])]dnl
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_compile "$LINENO"], [$2], [$3])
-m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
+rm -f core conftest.err conftest.$ac_objext[]m4_ifvaln([$1], [
conftest.$ac_ext])dnl
])# _AC_COMPILE_IFELSE
@@ -2540,12 +2538,11 @@ m4_define([_AC_LINK_IFELSE_BODY],
[ac_retval=0],
[_AC_MSG_LOG_CONFTEST
ac_retval=1])
- # Delete also the IPA/IPO (Inter Procedural Analysis/Optimization)
- # information created by the PGI compiler (conftest_ipa8_conftest.oo),
- # as it would interfere with the next link command.
- rm -rf conftest.dSYM
- rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
AS_LINENO_POP
return $ac_retval
])# _AC_LINK_IFELSE_BODY
@@ -2569,7 +2566,8 @@ AC_DEFUN([_AC_LINK_IFELSE],
[$0_BODY])]dnl
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_link "$LINENO"], [$2], [$3])
-m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext[]m4_ifvaln([$1], [ conftest.$ac_ext])dnl
])# _AC_LINK_IFELSE
@@ -2616,8 +2614,7 @@ m4_define([_AC_RUN_IFELSE_BODY],
[AS_ECHO(["$as_me: program exited with status $ac_status"])
>&AS_MESSAGE_LOG_FD
_AC_MSG_LOG_CONFTEST
ac_retval=$ac_status])
- rm -rf conftest.dSYM
- rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext
conftest.$ac_objext conftest$ac_exeext
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
AS_LINENO_POP
return $ac_retval
])# _AC_RUN_IFELSE_BODY
@@ -2638,7 +2635,8 @@ AC_DEFUN([_AC_RUN_IFELSE],
[$0_BODY])]dnl
[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
[AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_run "$LINENO"], [$2], [$3])
-m4_ifvaln([$1], [rm -f conftest.$ac_ext])dnl
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest$ac_exeext[]m4_ifvaln([$1], [
conftest.$ac_ext])dnl
])# _AC_RUN_IFELSE
# AC_RUN_IFELSE(PROGRAM,
diff --git a/tests/compile.at b/tests/compile.at
index 6ee22ae..c4c9e1f 100644
--- a/tests/compile.at
+++ b/tests/compile.at
@@ -141,6 +141,52 @@ AT_CHECK_CONFIGURE([-q])
AT_CLEANUP
+## -------------------------- ##
+## Order of `rm' and actions. ##
+## -------------------------- ##
+
+AT_SETUP([Order of user actions and cleanup])
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_PROG_CC
+
+AC_PREPROC_IFELSE([AC_LANG_PROGRAM([int ok;], [])],
+ [test -f conftest.err || AS_EXIT([1])],
+ [AS_EXIT([1])])
+AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#define 12 34], [])],
+ [AS_EXIT([1])],
+ [test -f conftest.err || AS_EXIT([1])])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int ok;], [])],
+ [test -f conftest.$ac_objext || AS_EXIT([1])],
+ [AS_EXIT([1])])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int bad bad;], [])],
+ [AS_EXIT([1])],
+ [test -f conftest.err || AS_EXIT([1])])
+
+AC_LINK_IFELSE([AC_LANG_PROGRAM([int ok;], [])],
+ [test -f conftest$ac_exeext || AS_EXIT([1])],
+ [AS_EXIT([1])])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([int bad bad;], [])],
+ [AS_EXIT([1])],
+ [test -f conftest.err || AS_EXIT([1])])
+
+AC_RUN_IFELSE([AC_LANG_PROGRAM([int ok;], [])],
+ [./conftest$ac_exeext || AS_EXIT([1])],
+ [AS_EXIT([1])])
+
+d@&address@hidden conftest.err not generated by AC_RUN_IFELSE?
+AC_RUN_IFELSE([AC_LANG_PROGRAM([int bad bad;], [])],
+ [AS_EXIT([1])],
+ [ls; test -f conftest.err || AS_EXIT([1])])
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([-q])
+
+AT_CLEANUP
+
+
## ------------------ ##
## AC_TRY_LINK_FUNC. ##
## ------------------ ##
- [PATCH] Extract rm out of shell functions for AC_*_IFELSE,
Paolo Bonzini <=