> > Indeed. The mbstate_t type and mbsinit etc. functions were not part of > > C89 + appendices, they were introduced in C99. Therefore, the > > -D_XOPEN_SOURCE=500 option should better be added to the detection of flags > > for C99, not C89.
Ben Pfaff corrected me: mbstate_t, mbsinit etc. are part of C89 with normative attendum 1 included. Eric Blake wrote: > We need to guarantee that AC_USE_SYSTEM_EXTENSIONS > (which works regardless of C flavor) and AC_PROG_CC_C99 both guarantee the > define Find attached the patch for AC_USE_SYSTEM_EXTENSIONS. For the C mode, do you want it in AC_PROG_CC_C89 or AC_PROG_CC_C99 ? Bruno 2008-12-20 Bruno Haible <br...@clisp.org> Ensure mbstate_t is defined on HP-UX 11.11 when AC_USE_SYSTEM_EXTENSIONS is used. * lib/autoconf/specific.m4 (AC_USE_SYSTEM_EXTENSIONS): Require AC_CANONICAL_HOST. On HP-UX, define _XOPEN_SOURCE to 500. --- lib/autoconf/specific.m4.orig 2008-12-20 20:10:05.000000000 +0100 +++ lib/autoconf/specific.m4 2008-12-20 20:01:18.000000000 +0100 @@ -387,6 +387,8 @@ [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], @@ -399,6 +401,16 @@ [Define to 1 if on MINIX.]) fi + dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, + dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already + dnl provided. + case "$host_os" in + hpux*) + AC_DEFINE([_XOPEN_SOURCE], [500], + [Define to 500 only on HP-UX.]) + ;; + esac + dnl Use a different key than __EXTENSIONS__, as that name broke existing dnl configure.ac when using autoheader 2.62. AH_VERBATIM([USE_SYSTEM_EXTENSIONS],