bug-autoconf
[Top][All Lists]
Advanced

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

Re: autoconf enhancement for Interix


From: Eric Blake
Subject: Re: autoconf enhancement for Interix
Date: Sat, 08 Sep 2007 22:13:03 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[replies can drop bug-autoconf]

According to Martin Koeppe on 9/4/2007 10:01 AM:
> 
> On Mon, 3 Sep 2007, Eric Blake wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> [Adding gnulib: this thread started at
>> http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/5717]
> 
>>
>> Anyway, on further investigation, gnulib's m4/extensions.m4 does not
>> currently mention _ALL_SOURCE, so it looks like we should fix this
>> issue in both autoconf and gnulib.
>>
>>>
>>> Personally, I'd rather have one macro that enables as many platforms
>>> as possible, rather than having to add a macro for every new
>>> platform.  As in AC_USE_SYSTEM_EXTENSIONS.
> 
> I have no problems if it's not named AC_INTERIX. I only thought it would
> be the way to go, i.e. AC_USE_SYSTEM_EXTENSIONS was only a collection of
> individual macro calls. Please add the test whereever you like. I'm not
> that familiar with writing m4 scripts and not with autoconf's internals
> either. I just copied AC_AIX.

How about the following patch for autoconf?  If others agree with this
approach, then gnulib's m4/extensions.m4 would need the subset of this
patch that touches AC_USE_SYSTEM_EXTENSIONS to copy the new autoconf
expansion.

2007-09-08  Eric Blake  <address@hidden>

        Centralize all system extensions checks.
        * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Inline code
        from AC_AIX, AC_GNU_SOURCE, AC_MINIX.  Add Interix support.
        (AC_AIX, AC_GNU_SOURCE, AC_MINIX): Obsolete, and point to
        AC_USE_SYSTEM_EXTENSIONS.
        (AC_ISC_POSIX): Obsolete, and point to AC_SEARCH_LIBS.
        * doc/autoconf.texi (Posix Variants): Reword this section,
        emphasizing that AC_USE_SYSTEM_EXTENSIONS is the preferred method,
        rather than a series of system-specific checks.
        (Obsolete Macros): Add AC_AIX, AC_GNU_SOURCE, AC_ISC_POSIX,
        AC_MINIX.
        * NEWS: Document this change.
        * THANKS: Update.
        Reported by Martin Koeppe.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG43LM84KuGfSFAYARAreRAJkBRI2NzlgBKCBUFZhuv/9oudSQIgCeKyEi
I4HsF1iYCf3/4s2N3z3AT8U=
=lE3U
-----END PGP SIGNATURE-----
Index: NEWS
===================================================================
RCS file: /sources/autoconf/autoconf/NEWS,v
retrieving revision 1.436
diff -u -p -r1.436 NEWS
--- NEWS        8 Sep 2007 21:47:38 -0000       1.436
+++ NEWS        9 Sep 2007 04:00:18 -0000
@@ -36,6 +36,8 @@ GNU Autoconf NEWS - User visible changes
 
 ** AC_INIT no longer alters $@; regression introduced in 2.60.
 
+** AC_USE_SYSTEM_EXTENSIONS now defines _ALL_SOURCE for Interix platforms.
+
 ** The command 'autoconf -' now correctly processes a file from stdin.
 
 ** Autotest now determines $srcdir correctly.
@@ -53,7 +55,7 @@ GNU Autoconf NEWS - User visible changes
 ** For portability with the eventual M4 2.0, macros should no longer use
    anything larger than $9 to refer to arguments.
 
-** Obsolete macros
+** Existing obsolete macros
    The documentation for the following macros is adjusted to make it
    more clear that they have previously been marked obsolete, as their
    functionality can be accomplished by other macros.  We have no
@@ -61,6 +63,13 @@ GNU Autoconf NEWS - User visible changes
 
      AC_ENABLE  AC_STRUCT_ST_BLKSIZE  AC_STRUCT_ST_RDEV  AC_WITH
 
+** Newly obsolete macros
+   The following macros have been marked obsolete, as they only
+   perform a subset of AC_USE_SYSTEM_EXTENSIONS.  We have no current
+   plans to remove them.
+
+     AC_AIX  AC_GNU_SOURCE  AC_ISC_POSIX  AC_MINIX
+
 ** AC_C_LONG_DOUBLE is obsolescent.
    The documentation now says that AC_C_LONG_DOUBLE is obsolescent: it
    tests for problems that are so old that it is no longer of
Index: doc/autoconf.texi
===================================================================
RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1171
diff -u -p -r1.1171 autoconf.texi
--- doc/autoconf.texi   8 Sep 2007 21:47:38 -0000       1.1171
+++ doc/autoconf.texi   9 Sep 2007 04:00:21 -0000
@@ -4108,7 +4108,7 @@ days it is normally better to use @code{
 [nsl])} instead of @code{AC_CHECK_LIB([nsl], [gethostbyname])}.
 @end defmac
 
-
address@hidden
 @defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs}, @
   @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{other-libraries})
 @acindex{SEARCH_LIBS}
@@ -7488,51 +7488,10 @@ system.  If so, set the shell variable @
 @node Posix Variants
 @section Posix Variants
 
-The following macros check for certain operating systems that need
-special treatment for some programs, due to exceptional oddities in
-their header files or libraries.  These macros are warts; they will be
-replaced by a more systematic approach, based on the functions they make
-available or the environments they provide.
-
address@hidden AC_AIX
address@hidden
address@hidden _ALL_SOURCE
-If on @acronym{AIX}, define @code{_ALL_SOURCE}.
-Allows the use of some @acronym{BSD}
-functions.  Should be called before any macros that run the C compiler.
address@hidden defmac
-
address@hidden AC_GNU_SOURCE
address@hidden
address@hidden _GNU_SOURCE
-If using the @acronym{GNU} C library, define @code{_GNU_SOURCE}.
-Allows the use of some @acronym{GNU} functions.  Should be called
-before any macros that run the C compiler.
address@hidden defmac
-
address@hidden AC_ISC_POSIX
address@hidden
address@hidden LIBS
-For @sc{interactive} Systems Corporation Unix, add @option{-lcposix} to output
-variable @code{LIBS} if necessary for Posix facilities.  Call this
-after @code{AC_PROG_CC} and before any other macros that use Posix
-interfaces.
-
-This macro is obsolescent, as @sc{interactive} Unix is obsolete, and Sun
-dropped support for it on 2006-07-23.  New programs need not use this
-macro.
address@hidden defmac
-
address@hidden AC_MINIX
address@hidden
address@hidden _MINIX
address@hidden _POSIX_SOURCE
address@hidden _POSIX_1_SOURCE
-If on Minix, define @code{_MINIX} and @code{_POSIX_SOURCE} and define
address@hidden to be 2.  This allows the use of Posix
-facilities.  Should be called before any macros that run the C compiler.
address@hidden defmac
+The following macro makes it possible to use features of Posix that are
+extensions to C, as well as platform extensions not defined by Posix.
 
address@hidden
 @defmac AC_USE_SYSTEM_EXTENSIONS
 @acindex{USE_SYSTEM_EXTENSIONS}
 @cvindex _ALL_SOURCE
@@ -7545,11 +7504,27 @@ facilities.  Should be called before any
 @cvindex __EXTENSIONS__
 If possible, enable extensions to Posix on hosts that normally disable
 the extensions, typically due to standards-conformance namespace issues.
-This may involve defining @code{__EXTENSIONS__} and
address@hidden, which are macros used by Solaris.
-It also defines @code{_TANDEM_SOURCE} for the @acronym{HP} NonStop platform.
-This macro also has the combined effects of @code{AC_GNU_SOURCE},
address@hidden, and @code{AC_MINIX}.
+This should be called before any macros that run the C compiler.  The
+following preprocessor macros are defined where appropriate:
+
address@hidden @code
address@hidden _GNU_SOURCE
+Enable extensions on @acronym{GNU}/Linux.
address@hidden __EXTENSIONS__
+Enable general extensions on Solaris.
address@hidden _POSIX_PTHREAD_SEMANTICS
+Enable threading extensions on Solaris.
address@hidden _TANDEM_SOURCE
+Enable extensions for the @acronym{HP} NonStop platform.
address@hidden _ALL_SOURCE
+Enable extensions for @acronym{AIX} 3, and for Interix.
address@hidden _POSIX_SOURCE
+Enable Posix functions for Minix.
address@hidden _POSIX_1_SOURCE
+Enable additional Posix functions for Minix.
address@hidden _MINIX
+Identify Minix platform.
address@hidden table
 @end defmac
 
 
@@ -17031,6 +17006,13 @@ from old names to new names for these ma
 refer to the definition of the new macro for the signature and the
 description.
 
address@hidden AC_AIX
address@hidden
address@hidden _ALL_SOURCE
+This macro is a platform-specific subset of
address@hidden (@pxref{AC_USE_SYSTEM_EXTENSIONS}).
address@hidden defmac
+
 @defmac AC_ALLOCA
 @acindex{ALLOCA}
 Replaced by @code{AC_FUNC_ALLOCA} (@pxref{AC_FUNC_ALLOCA}).
@@ -17334,6 +17316,13 @@ Replaced by @code{AC_TYPE_GETGROUPS} (@p
 Replaced by @code{AC_FUNC_GETLOADAVG} (@pxref{AC_FUNC_GETLOADAVG}).
 @end defmac
 
address@hidden AC_GNU_SOURCE
address@hidden
address@hidden _GNU_SOURCE
+This macro is a platform-specific subset of
address@hidden (@pxref{AC_USE_SYSTEM_EXTENSIONS}).
address@hidden defmac
+
 @defmac AC_HAVE_FUNCS
 @acindex{HAVE_FUNCS}
 Replaced by @code{AC_CHECK_FUNCS} (@pxref{AC_CHECK_FUNCS}).
@@ -17423,6 +17412,16 @@ AC_CHECK_LIB([sun], [getpwnam])
 See @ref{AC_FUNC_GETMNTENT} and @ref{AC_CHECK_LIB}.
 @end defmac
 
address@hidden AC_ISC_POSIX
address@hidden
address@hidden LIBS
+This macro adds @option{-lcposix} to output variable @code{LIBS} if
+necessary for Posix facilities.  Sun dropped support for the obsolete
address@hidden Systems Corporation Unix on 2006-07-23.  New programs
+need not use this macro.  It is implemented as
address@hidden([strerror], [cposix])} (@pxref{AC_SEARCH_LIBS}).
address@hidden defmac
+
 @defmac AC_LANG_C
 @acindex{LANG_C}
 Same as @samp{AC_LANG([C])} (@pxref{AC_LANG}).
@@ -17529,6 +17528,15 @@ dignified means to check the nature of t
 @code{AC_CANONICAL_HOST} (@pxref{Canonicalizing}).
 @end defmac
 
address@hidden AC_MINIX
address@hidden
address@hidden _MINIX
address@hidden _POSIX_SOURCE
address@hidden _POSIX_1_SOURCE
+This macro is a platform-specific subset of
address@hidden (@pxref{AC_USE_SYSTEM_EXTENSIONS}).
address@hidden defmac
+
 @defmac AC_MINUS_C_MINUS_O
 @acindex{MINUS_C_MINUS_O}
 Replaced by @code{AC_PROG_CC_C_O} (@pxref{AC_PROG_CC_C_O}).
Index: lib/autoconf/specific.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autoconf/specific.m4,v
retrieving revision 1.375
diff -u -p -r1.375 specific.m4
--- lib/autoconf/specific.m4    20 Jul 2007 23:11:53 -0000      1.375
+++ lib/autoconf/specific.m4    9 Sep 2007 04:00:21 -0000
@@ -2,7 +2,7 @@
 # Macros that test for specific, unclassified, features.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -326,16 +326,7 @@ AC_DEFUN([AC_SYS_POSIX_TERMIOS],
 
 # AC_GNU_SOURCE
 # --------------
-AC_DEFUN([AC_GNU_SOURCE],
-[AH_VERBATIM([_GNU_SOURCE],
-[/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_DEFINE([_GNU_SOURCE])
-])
+AU_DEFUN([AC_GNU_SOURCE], [AC_USE_SYSTEM_EXTENSIONS])
 
 
 # AC_CYGWIN
@@ -384,26 +375,49 @@ matches *mingw32*])# AC_MINGW32
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
+#
+# Remember that #undef in AH_VERBATIM gets replaced with #define by
+# 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],
-[
-  AC_BEFORE([$0], [AC_COMPILE_IFELSE])
-  AC_BEFORE([$0], [AC_RUN_IFELSE])
-
-  AC_REQUIRE([AC_GNU_SOURCE])
-  AC_REQUIRE([AC_AIX])
-  AC_REQUIRE([AC_MINIX])
+[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+
+  AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
+  if test "$MINIX" = yes; then
+    AC_DEFINE([_POSIX_SOURCE], [1],
+             [Define to 1 if you need to in order for `stat' and other
+               things to work.])
+    AC_DEFINE([_POSIX_1_SOURCE], [2],
+             [Define to 2 if the system does not provide POSIX.1 features
+              except with this defined.])
+    AC_DEFINE([_MINIX], [1],
+             [Define to 1 if on MINIX.])
+  fi
 
   AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris.  */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
+[/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
 #endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif
+/* Enable extensions on HP NonStop.  */
 #ifndef _TANDEM_SOURCE
 # undef _TANDEM_SOURCE
-#endif])
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+])
   AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
     [ac_cv_safe_to_define___extensions__],
     [AC_COMPILE_IFELSE(
@@ -414,10 +428,11 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
        [ac_cv_safe_to_define___extensions__=no])])
   test $ac_cv_safe_to_define___extensions__ = yes &&
     AC_DEFINE([__EXTENSIONS__])
+  AC_DEFINE([_ALL_SOURCE])
+  AC_DEFINE([_GNU_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
   AC_DEFINE([_TANDEM_SOURCE])
-])
-
+])# AC_USE_SYSTEM_EXTENSIONS
 
 
 
@@ -431,50 +446,17 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
 
 # AC_AIX
 # ------
-AC_DEFUN([AC_AIX],
-[AH_VERBATIM([_ALL_SOURCE],
-[/* Define to 1 if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
address@hidden:@ifndef _ALL_SOURCE
address@hidden:@ undef _ALL_SOURCE
address@hidden:@endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_MSG_CHECKING([for AIX])
-AC_EGREP_CPP(yes,
-[#ifdef _AIX
-  yes
-#endif
-],
-[AC_MSG_RESULT([yes])
-AC_DEFINE(_ALL_SOURCE)],
-[AC_MSG_RESULT([no])])
-])# AC_AIX
+AU_DEFUN([AC_AIX], [AC_USE_SYSTEM_EXTENSIONS])
 
 
 # AC_MINIX
 # --------
-AC_DEFUN([AC_MINIX],
-[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=)
-if test "$MINIX" = yes; then
-  AC_DEFINE(_POSIX_SOURCE, 1,
-           [Define to 1 if you need to in order for `stat' and other things to
-            work.])
-  AC_DEFINE(_POSIX_1_SOURCE, 2,
-           [Define to 2 if the system does not provide POSIX.1 features except
-            with this defined.])
-  AC_DEFINE(_MINIX, 1,
-           [Define to 1 if on MINIX.])
-fi
-])# AC_MINIX
+AU_DEFUN([AC_MINIX], [AC_USE_SYSTEM_EXTENSIONS])
 
 
 # AC_ISC_POSIX
 # ------------
-AC_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
+AU_DEFUN([AC_ISC_POSIX], [AC_SEARCH_LIBS(strerror, cposix)])
 
 
 # AC_XENIX_DIR

reply via email to

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