Re: AS_CASE vs case/esac

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

 



On 3/13/08, Ralf Wildenhues <Ralf.Wildenhues@xxxxxx> 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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux