Transferring variables from configure.ac to Makefile.am

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Transferring variables from configure.ac to Makefile.am

Russell Wallace
I think I sort of see how to set variables within configure.ac, and do some
minimal calculations on them. But how do you transfer the value of a
variable set in configure.ac, to Makefile.am where it will be actually used?
_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Transferring variables from configure.ac to Makefile.am

Nick Bowler-2
Hi Russell,

On 3/24/16, Russell Wallace <[hidden email]> wrote:
> I think I sort of see how to set variables within configure.ac, and do some
> minimal calculations on them. But how do you transfer the value of a
> variable set in configure.ac, to Makefile.am where it will be actually
> used?

Any shell variable can be marked as an "output variable" by using AC_SUBST;
the value is then substituted into configure outputs.  See "Setting Output
Variables"[1] in the Autoconf manual for the details.

It sounds like you are using Automake so this process should be pretty much
automatic: by default, automake automatically adds the appropriate magic to
set make variables with the same name, so you can just use the variable in
make as you normally would.

Example:

 configure.ac:
  FOO=bar
  AC_SUBST([FOO])

 Makefile.am:
  my_stuff = $(FOO)

[1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Setting-Output-Variables

Cheers,
  Nick

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Loading...