RFR: JDK-8146995 Introduce named arguments in configure

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Jan 13 14:43:52 UTC 2016


Similar to how we use named argument in makefiles, we should support 
named arguments in the configure scripts. This is possible using some m4 
black magic.

My long-term goal with this is to provide readable functions for 
handling common patterns, like parsing --with arguments and doing proper 
action depending on the value of the flag.

Since the m4 logic is hairy, to say the least, I chose to pick a more 
simple function to use as test bench for getting the actual m4 
underpinning to work.

The essence of this change can be seen here:

- FLAGS_COMPILER_CHECK_ARGUMENTS([$STACK_PROTECTOR_CFLAG], [], 
[STACK_PROTECTOR_CFLAG=""])
+ FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG], 
IF_FALSE: [STACK_PROTECTOR_CFLAG=""])


Just like in our Setup* macros in make, now it is possible to use named 
arguments in autoconf macros. Named arguments can come in any order. The 
framework will verify that only known arguments is allowed in. It is 
also possible to mark an argument as compulsory (by prefixing it with 
*). The framework will verify that all required arguments are present.

Don't ask me to explain the finer points of BASIC_DEFUN_NAMED. :) 
m4/autoconf is non-trivial to get correct, with few debugging 
possibilities and sparse documentation. There's a lot of trial and error 
behind this final version. :-&

Bug: https://bugs.openjdk.java.net/browse/JDK-8146995
WebRev: 
http://cr.openjdk.java.net/~ihse/JDK-8146995-named-arguments-in-configure/webrev.01

/Magnus




More information about the build-dev mailing list