bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Calling AC_USE_SYSTEM_EXTENSIONS through several of its aliases


From: Stepan Kasal
Subject: [PATCH] Calling AC_USE_SYSTEM_EXTENSIONS through several of its aliases should not issue a cryptic warning
Date: Wed, 8 Oct 2008 19:11:45 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello,
  it used to be usual to call

AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS

or

AC_AIX
AC_MINIX

to handle various platform-specific needs.

Both of the above generate a warning with Autoconf 2.62+.

The "obsolete" warnings are off by default, so te only visible
warning says that AC_COMPILE_IFELSE has been called before
AC_USE_SYSTEM_EXTENSIONS.  This is confusing and does not help much;
I think we should get rid of them.

What do you think about the following patch?
I see it slightly changes the semantics of AC_USE_SYSTEM_EXTENSIONS
(the code is moved outside the outermost ac_defuned macro), do you
think this is OK?

Or is it OK to commit?

Have a nice day,
   Stepan


* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Move
the body to ...
(_AC_USE_SYSTEM_EXTENSIONS): ... this new macro and require it
from the original and ...
(AC_GNU_SOURCE, AC_AIX, AC_MINIX): ... from all of these.
---
 ChangeLog                |   10 ++++++++++
 lib/autoconf/specific.m4 |   16 ++++++++++------
 tests/c.at               |   21 +++++++++++++++++++++
 3 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2ca7c76..17c77b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-10-08  Stepan Kasal  <address@hidden>
+
+       Calling AC_USE_SYSTEM_EXTENSIONS through several of its
+       aliases should not issue a cryptic warning.
+       * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Move
+       the body to ...
+       (_AC_USE_SYSTEM_EXTENSIONS): ... this new macro and require it
+       from the original and ...
+       (AC_GNU_SOURCE, AC_AIX, AC_MINIX): ... from all of these.
+
 2008-09-18  Paolo Bonzini  <address@hidden>
 
        * lib/m4sugar/m4sh.m4 (_AS_SHELL_FN_SPY): Remove.
diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 5fcfe37..6315af5 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -329,7 +329,7 @@ AC_DEFUN([AC_SYS_POSIX_TERMIOS],
 
 # AC_GNU_SOURCE
 # --------------
-AU_DEFUN([AC_GNU_SOURCE], [AC_USE_SYSTEM_EXTENSIONS])
+AU_DEFUN([AC_GNU_SOURCE], [AC_REQUIRE([_AC_USE_SYSTEM_EXTENSIONS])])
 
 
 # AC_CYGWIN
@@ -383,7 +383,12 @@ matches *mingw32*])# AC_MINGW32
 # AC_DEFINE.  The goal here is to define all known feature-enabling
 # macros, then, if reports of conflicts are made, disable macros that
 # cause problems on some platforms (such as __EXTENSIONS__).
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
+#
+# To prevent conflicts with all the obsolete variables, a wrapper is needed.
+#
+AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_REQUIRE([_$0])])
+
+AC_DEFUN([_AC_USE_SYSTEM_EXTENSIONS],
 [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
 AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 
@@ -437,8 +442,7 @@ dnl configure.ac when using autoheader 2.62.
   AC_DEFINE([_GNU_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
   AC_DEFINE([_TANDEM_SOURCE])
-])# AC_USE_SYSTEM_EXTENSIONS
-
+])# _AC_USE_SYSTEM_EXTENSIONS
 
 
 ## -------------------------- ##
@@ -451,12 +455,12 @@ dnl configure.ac when using autoheader 2.62.
 
 # AC_AIX
 # ------
-AU_DEFUN([AC_AIX], [AC_USE_SYSTEM_EXTENSIONS])
+AU_DEFUN([AC_AIX], [AC_REQUIRE([_AC_USE_SYSTEM_EXTENSIONS])])
 
 
 # AC_MINIX
 # --------
-AU_DEFUN([AC_MINIX], [AC_USE_SYSTEM_EXTENSIONS])
+AU_DEFUN([AC_MINIX], [AC_REQUIRE([_AC_USE_SYSTEM_EXTENSIONS])])
 
 
 # AC_ISC_POSIX
diff --git a/tests/c.at b/tests/c.at
index bc07c6e..efa8c74 100644
--- a/tests/c.at
+++ b/tests/c.at
@@ -255,3 +255,24 @@ AC_DEFINE([__EXTENSIONS__], [1], [Manually defined for 
Solaris])
 ]])
 
 AT_CLEANUP
+
+
+## ------------------------------------ ##
+## AC_USE_SYSTEM_EXTENSIONS (aliases).  ##
+## ------------------------------------ ##
+
+AT_SETUP([AC_USE_SYSTEM_EXTENSIONS (aliases)])
+
+# Now, when AC_AIX and such are aliases of AC_USE_SYSTEM_EXTENSIONS,
+# calling more of these macros might result in repeated calls to
+# the macro, which is not allowed.
+
+AT_CONFIGURE_AC(
+[[AC_GNU_SOURCE
+AC_AIX
+AC_MINIX
+AC_USE_SYSTEM_EXTENSIONS
+]])
+AT_CHECK_AUTOCONF
+
+AT_CLEANUP
-- 
1.5.5.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]