autoconf-patches
[Top][All Lists]
Advanced

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

Re: Patch AC_USE_SYSTEM_EXTENSIONS for Minix3


From: Paul Eggert
Subject: Re: Patch AC_USE_SYSTEM_EXTENSIONS for Minix3
Date: Fri, 08 Feb 2013 15:00:35 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

The patch I installed wasn't quite right for HP-UX,
as it caused _XOPEN_SOURCE to be defined differently when
configuring than when compiling.  I installed the following
further patch to try to fix this.  I'm doing all this without
any HP-UX host to test with -- talk about playing without a net!
But it should be harmless on non-HP-UX hosts.

>From 16ce3ed2f7844356fc41f3bc4e5b7b0587fc57f7 Mon Sep 17 00:00:00 2001
From: Paul Eggert <address@hidden>
Date: Fri, 8 Feb 2013 13:01:15 -0800
Subject: [PATCH] AC_USE_SYSTEM_EXTENSIONS: improve port to HP-UX

* lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS):
On hosts that need _XOPEN_SOURCE, define it when configuring, too,
so that it's compatible with the value used when compiling.
---
 lib/autoconf/specific.m4 | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4
index 248a7a3..4fca0a8 100644
--- a/lib/autoconf/specific.m4
+++ b/lib/autoconf/specific.m4
@@ -395,11 +395,6 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _GNU_SOURCE
 # undef _GNU_SOURCE
 #endif
-/* HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
-   regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1.  */
-#ifdef __hpux
-# define _XOPEN_SOURCE 500
-#endif
 /* Enable threading extensions on Solaris.  */
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
@@ -408,6 +403,12 @@ dnl configure.ac when using autoheader 2.62.
 #ifndef _TANDEM_SOURCE
 # undef _TANDEM_SOURCE
 #endif
+/* Enable X/Open extensions if necessary.  HP-UX 11.11 defines
+   mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of
+   whether compiling with -Ae or -D_HPUX_SOURCE=1.  */
+#ifndef _XOPEN_SOURCE
+# undef _XOPEN_SOURCE
+#endif
 /* Enable general extensions on Solaris.  */
 #ifndef __EXTENSIONS__
 # undef __EXTENSIONS__
@@ -428,6 +429,22 @@ dnl configure.ac when using autoheader 2.62.
   AC_DEFINE([_GNU_SOURCE])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
   AC_DEFINE([_TANDEM_SOURCE])
+  AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
+    [ac_cv_should_define__xopen_source],
+    [ac_cv_should_define__xopen_source=no
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+          #include <wchar.h>
+          mbstate_t x;]])],
+       [],
+       [AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[
+             #define _XOPEN_SOURCE 500
+             #include <wchar.h>
+             mbstate_t x;]])],
+          [ac_cv_should_define__xopen_source=yes])])])
+  test $ac_cv_should_define__xopen_source = yes &&
+    AC_DEFINE([_XOPEN_SOURCE], [500])
 ])# AC_USE_SYSTEM_EXTENSIONS
 
 
-- 
1.7.11.7




reply via email to

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