# HG changeset patch # User Paul Eggert # Date 1360357801 28800 # Node ID 6c93ff5bc2bd11a7f24ba3298162b99dd295bab2 # Parent 9d7698fd5b5f87d0ef989934d3fd542fdc468db7 extensions: port better to HP-UX This is merged from git Autoconf. * m4/extensions.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. diff -r 9d7698fd5b5f -r 6c93ff5bc2bd ChangeLog --- a/ChangeLog Fri Feb 08 08:03:23 2013 -0800 +++ b/ChangeLog Fri Feb 08 13:10:01 2013 -0800 @@ -1,5 +1,11 @@ 2013-02-08 Paul Eggert + extensions: port better to HP-UX + This is merged from git Autoconf. + * m4/extensions.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. + openpty: fix bug where HAVE_OPENPTY is mistakenly 1 Problem reported by Mats Erik Andersson in . diff -r 9d7698fd5b5f -r 6c93ff5bc2bd m4/extensions.m4 --- a/m4/extensions.m4 Fri Feb 08 08:03:23 2013 -0800 +++ b/m4/extensions.m4 Fri Feb 08 13:10:01 2013 -0800 @@ -8,7 +8,7 @@ # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly +# 2.70 or later everywhere, but since Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -68,11 +68,6 @@ #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 @@ -81,6 +76,12 @@ #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__ @@ -101,6 +102,22 @@ 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 + mbstate_t x;]])], + [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 500 + #include + 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 # gl_USE_SYSTEM_EXTENSIONS