[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AC_USE_SYSTEM_EXTENSIONS should be AC_DEFUN_ONCEd
From: |
Bruno Haible |
Subject: |
AC_USE_SYSTEM_EXTENSIONS should be AC_DEFUN_ONCEd |
Date: |
Sun, 25 Jan 2009 12:42:53 +0100 |
User-agent: |
KMail/1.9.9 |
Hi,
Assuming the new semantics of AC_DEFUN_ONCE proposed by Paolo Bonzini and
Eric Blake, I think the macro AC_USE_SYSTEM_EXTENSIONS should be defined
through AC_DEFUN_ONCE.
Here are four scenarios I observe with autoconf 2.63:
------------------------------------- 1 -------------------------------------
$ cat > configure.ac
AC_INIT
AC_CONFIG_SRCDIR([configure.ac])
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS
AC_OUTPUT
$ autoconf
configure.ac:7: warning: AC_COMPILE_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
../../lib/autoconf/specific.m4:386: AC_USE_SYSTEM_EXTENSIONS is expanded from...
configure.ac:7: the top level
configure.ac:7: warning: AC_RUN_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
-----------------------------------------------------------------------------
This shows that AC_USE_SYSTEM_EXTENSIONS may not be invoked twice. Therefore
the 2.63 doc should recommend to AC_REQUIRE it.
------------------------------------- 2 -------------------------------------
$ cat > configure.ac
AC_INIT
AC_CONFIG_SRCDIR([configure.ac])
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_GNU_SOURCE
AC_OUTPUT
$ autoconf
configure.ac:7: warning: AC_COMPILE_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
../../lib/autoconf/specific.m4:386: AC_USE_SYSTEM_EXTENSIONS is expanded from...
../../lib/autoconf/specific.m4:332: AC_GNU_SOURCE is expanded from...
configure.ac:7: the top level
configure.ac:7: warning: AC_RUN_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
------------------------------------- 3 -------------------------------------
$ cat > configure.ac
AC_INIT
AC_CONFIG_SRCDIR([configure.ac])
AC_PROG_CC
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
AC_OUTPUT
$ autoconf
configure.ac:7: warning: AC_COMPILE_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
../../lib/autoconf/specific.m4:386: AC_USE_SYSTEM_EXTENSIONS is expanded from...
configure.ac:7: the top level
configure.ac:7: warning: AC_RUN_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
-----------------------------------------------------------------------------
This shows that AC_USE_SYSTEM_EXTENSIONS and AC_GNU_SOURCE cannot be both
invoked, in either order. The bug in 2.63 is IMO that AC_GNU_SOURCE is
defined to *invoke* AC_USE_SYSTEM_EXTENSIONS, rather than to *require* it.
------------------------------------- 4 -------------------------------------
$ cat > configure.ac
AC_INIT
AC_CONFIG_SRCDIR([configure.ac])
AC_PROG_CC
dnl Make sure we see all GNU and Solaris extensions.
AC_DEFUN([xy_EARLY],
[
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_GNU_SOURCE])
])
xy_EARLY
AC_OUTPUT
$ autoconf
configure.ac:12: warning: AC_COMPILE_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
../../lib/autoconf/specific.m4:386: AC_USE_SYSTEM_EXTENSIONS is expanded from...
../../lib/autoconf/specific.m4:332: AC_GNU_SOURCE is expanded from...
configure.ac:7: xy_EARLY is expanded from...
configure.ac:12: the top level
configure.ac:12: warning: AC_RUN_IFELSE was called before
AC_USE_SYSTEM_EXTENSIONS
-----------------------------------------------------------------------------
This shows that even *requiring* both AC_USE_SYSTEM_EXTENSIONS and
AC_GNU_SOURCE does not work if the AC_REQUIREs are in the wrong order.
For 2.64, defining AC_USE_SYSTEM_EXTENSIONS through AC_DEFUN_ONCE should fix
all these problems, IMO. But feel free to add these 4 test cases to the test
suite nevertheless :-)
Bruno
- AC_USE_SYSTEM_EXTENSIONS should be AC_DEFUN_ONCEd,
Bruno Haible <=