Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing environment variables to autoconf's `./configure`

What are the differences between FOO=bar ./configure and ./configure FOO=bar, where ./configure is a script generate by autoconf from a configure.am? I know that the former sets the environment variable FOO to bar before running the script ./configure, and the latter passes the string FOO=bar to ./configure. I think that ./configure interprets this (and remembers it?) as setting the variable FOO equal to bar, but beyond that, I don't know. In particular, are there any advantages to doing it one way or the other?

like image 237
Jason Gross Avatar asked Dec 12 '12 20:12

Jason Gross


1 Answers

Passing the assignment to configure as an argument ensures that the assignment is available in config.status, so it will be set on config.status --recheck. That is the primary advantage of making the assignment as an argument. Note that the current autoconf documentation recommends this over passing the assignment via the environment. Older versions of autoconf did not allow assignments to be made as arguments to configure, so it is necessary to use the older form when running old configure scripts, and habits die hard so many people continue to use the environment. However, it is a good habit to pass assignments via arguments.

like image 161
William Pursell Avatar answered Nov 15 '22 11:11

William Pursell