bug-autoconf
[Top][All Lists]
Advanced

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

Re: m4 conditionals and AC_ARG_WITH


From: Akim Demaille
Subject: Re: m4 conditionals and AC_ARG_WITH
Date: 08 Dec 2000 15:20:33 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

| Hi,
| I'd really, really, *love* to be able to do define a macro like this:
| 
| AC_DEFUN([mymacro], [
| 
| ifdef([enable_foo], 
| AC_ARG_WITH(foobar, [ --with-foobar  etc ], foobar=$withval)
| ,
| foobar=off
| )
| 
| ])
| 
| So, if 'enable_foo' is define()d before calling 'mymacro', the
| --with-foobar argument gets added to configure, and the user gets to
| choose whether foobar is used or not.  If enable_foo *isn't* defined
| before calling 'mymacro', they don't get to use foobar, end of story.
| 
| This *very nearly* works, 

No, that's impossible: it doesn't work at all: since you don't quote
your call to AC_ARG_WITH, when mymacro is expanded, independently of
enable_foo, it will be expanded.

When you run

my_whatever_macro(some text)

then `some text' is *always* expanded, and in particular the code with
puts the --help message is triggered.  *If* you quote properly

my_whatever_macro([some text])

then indeed my_whatever_macro is free to expand [some text] or not.
In your case, ifdef is just any my_whatever_macro.

| but the line to add the --with-foobar stuff to
| ac_help only appears in the middle of configure, and hence, doesn't get
| displayed in configure --help!
| 
| Is there any way I can work round this?

IMO fixing your code should be enough :)

AC_DEFUN([mymacro], 
[ifdef([enable_foo], 
       [AC_ARG_WITH(foobar, [ --with-foobar  etc ], foobar=$withval)],
       [foobar=off])])



reply via email to

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