[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to specify arbitrary macro variable for config.h
From: |
Ralf Wildenhues |
Subject: |
Re: how to specify arbitrary macro variable for config.h |
Date: |
Mon, 19 Jul 2010 07:46:15 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
Hello John,
* John Lumby wrote on Sat, Jul 17, 2010 at 08:09:32PM CEST:
>
> This is a beginner question. I am modifying a package and would
> like to introduce a new configure option to set a value which had been
> previously hardcoded.
>
> So - for example - I want to provide an optional configure option
>
> --foo-barian-characteristic=VALUE
>
> and place a default definition in config.h.in
>
> #undef FOO_BARIAN_CHARACTERISTIC
>
> and then write something in configure.ac which would respond to the
> user specifying the option by replacing #undef by
>
> #define FOO_BARIAN_CHARACTERISTIC=VALUE
you mean a space not = here.
> in config.h
>
> How can I do this? I can see how by using AC_ARG_ENABLE and
> AC_DEFINE_UNQUOTED, but that would require that my option appear to be
> an --enable-xxx kind - the user would have to specify
> configure ... --enable-foo-barian-characteristic=VALUE
> which is slightly misleading since this is a setting for a default feature.
But your description in the second argument of AC_ARG_ENABLE can help
clarify that, right?
There is a reason configure does not accept arbitrary arguments: API
consistency. For example, it should be possible to configure a number
of (even unrelated) packages with the same command line, and developers
should be able to stack packages using AC_CONFIG_SUBDIRS.
The extension mechanisms are provided by --enable-* and --with-*
arguments, and you shouldn't try to change that.
Hope that helps.
Cheers,
Ralf