On 09/20/2014 06:19 PM, David A. Wheeler wrote: > I *think* that AC_USE_SYSTEM_EXTENSIONS has a bug; it seems to ignore conditionals. Not a bug, but a feature. > > E.G., given this configure.ac: > ==== > AC_PREREQ([2.63]) > AC_INIT([bug], [0.01]) > AC_CONFIG_HEADERS([config.h]) > AS_IF([test 0 = 1 ], The whole POINT of AS_IF is to allow macros to hoist pre-req code that must be run unconditionally to occur before the if statement. > [AC_USE_SYSTEM_EXTENSIONS]) and AC_USE_SYSTEM_EXTENSIONS intentionally defines its body to be a prerequisite that is hoisted outside the body of AS_IF or any other macro that uses AC_REQUIRE. It is a feature that unconditional code is hoisted like this. > AC_OUTPUT > ==== > > The file "config.h" still enables extensions, even though the test is false. That's because of the way the macros are designed to be expanded. You are NOT writing: if test 0 = 1; then shell code to turn on conditionals fi rather, you are writing: prereqs of any code embedded in the AS_IF, including the AC_USE_SYSTEM_EXTENSIONS body that unconditionally turns on extensions if test 0 = 1; then any conditional remains (of which AC_USE_SYSTEM_EXTENSIONS has none) fi > > I'm trying to conditionally use extensions like this: > AS_IF([test "$enable_all_system_extensions" = "yes"], > [AC_USE_SYSTEM_EXTENSIONS]) > > Am I going about this the wrong way? I don't think what you are asking for is possible. Either you want to use extensions (and just use the macro) or you don't. I don't really see a use case for wanting extensions on only some of the builds. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf