autoconf
[Top][All Lists]
Advanced

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

Re: AS_CASE vs case/esac


From: NightStrike
Subject: Re: AS_CASE vs case/esac
Date: Thu, 13 Mar 2008 17:07:31 -0400

On 3/13/08, Ralf Wildenhues <address@hidden> wrote:
> * NightStrike wrote on Thu, Mar 13, 2008 at 09:20:06PM CET:
> > Should AS_CASE 
> > (http://www.gnu.org/software/autoconf/manual/autoconf.html#index-AS_005fCASE-1116)
> > always be used instead of case/esac inside configure.ac, some local
> > package m4 script, or AC_DEFUN macros?
>
> Most of the time that is purely an aesthetic question.
>
> It however matters if, inside AS_CASE arguments, you put
> AC_DEFUN'ed macros which themselves AC_REQUIRE other macros.
> They will then be expanded outside of the AS_CASE construct.
>
> Example:
>
> AC_INIT
> AC_DEFUN([FOO], [echo foo])
> AC_DEFUN([BAR], [AC_REQUIRE([FOO])
>                 echo bar])
> x=zork
> AS_CASE([$x], [y*], [BAR])
>
>
> will print 'foo' because FOO will be expanded outside of the AS_CASE.
>
> Note that with AS_IF of Autoconf's 2.61 and newer, the same holds
> (before 2.61, AS_IF was not m4_defun'ed, only m4_define'd, so the
> expansion of required macros was not pushed outside of it).

I'm trying to follow this logic, but I'm not putting it together in my
head.  Why isn't the result nothing?  I would think (probably
incorrectly) that the AS_CASE becomes this:

case $x in
  y*)
    echo foo;
    echo bar;
    ;;
esac




reply via email to

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