autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Extract rm out of shell functions for AC_*_IFELSE


From: Eric Blake
Subject: Re: [PATCH] Extract rm out of shell functions for AC_*_IFELSE
Date: Thu, 23 Oct 2008 15:27:37 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Paolo Bonzini <bonzini <at> gnu.org> writes:

> 
> 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.
> 
> @@ -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

m4_ifvaln is primarily useful in situations where you want to avoid an empty 
newline when $1 is empty.  But here, you want to conditionally add content to a 
line that needs a newline terminator no matter what.  I'm worried that people 
might be using dnl after AC_PREPROC_IFELSE to delete a second newline; which 
means we would be causing a shell syntax error if we don't supply a first 
newline.  So I would write this as:

rm -f conftest.err[]m4_ifval([$1], [ conftest.$ac_ext])
])# _AC_PREPROC_IFELSE

Likewise for the other uses.

> +## --------------------------  ##
> +## Order of `rm' and actions.  ##
> +## --------------------------  ##
> +
> +AT_SETUP([Order of user actions and cleanup])

Nice addition.

> +
> +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])])
> +]])

I take it you have more cleanups in mind for this part of the test?

One thought I had was that in _AC_RUN_IFELSE_BODY (or even once, since the list 
is really constant), we do

ac_run_cleanfiles="core *.core gmon.out bb.out conftest.$ac_exeext...'

then in _AC_RUN_IFELSE, emit

eval rm -f "$ac_run_cleanfiles[]m4_ifval([$1], [ conftest.$ac_ext]"

which would give slightly smaller configure files (fewer looong rm lines).  On 
the other hand, what happens in the case where the user does:

AC_COMPILE_IFELSE([feature a],
  [AC_COMPILE_IFELSE([feature b], [], [])])

Is there ever a chance that files left behind by compiling feature a will 
interfere with correct detection of whether feature b is supported?  It seems 
like we ought to also have a test that shows a nested AC_*_IFELSE run as one of 
the actions to the original run.

-- 
Eric Blake






reply via email to

[Prev in Thread] Current Thread [Next in Thread]