changeset 10918:1a3d44359528

Ensure mbstate_t is defined on HP-UX 11.11.
author Bruno Haible <bruno@clisp.org>
date Sat, 20 Dec 2008 13:43:27 +0100
parents e5c15988572b
children 45375d4f306e
files ChangeLog m4/extensions.m4 m4/mbstate_t.m4 modules/fnmatch modules/mbrlen modules/mbrtowc modules/mbsinit modules/mbsrtowcs modules/mbswidth modules/quotearg modules/strftime
diffstat 11 files changed, 45 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-12-20  Bruno Haible  <bruno@clisp.org>
+
+	Ensure mbstate_t is defined on HP-UX 11.11.
+	* m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Require
+	AC_CANONICAL_HOST. On HP-UX, define _XOPEN_SOURCE to 500.
+	* m4/mbstate_t.m4 (AC_TYPE_MBSTATE_T): Require
+	AC_USE_SYSTEM_EXTENSIONS.
+	* modules/fnmatch (Depends-on): Add extensions.
+	* modules/mbrlen (Depends-on): Likewise.
+	* modules/mbrtowc (Depends-on): Likewise.
+	* modules/mbsinit (Depends-on): Likewise.
+	* modules/mbsrtowcs (Depends-on): Likewise.
+	* modules/mbswidth (Depends-on): Likewise.
+	* modules/quotearg (Depends-on): Likewise.
+	* modules/strftime (Depends-on): Likewise.
+
 2008-12-20  Bruno Haible  <bruno@clisp.org>
 
 	Ensure wctob is declared on IRIX 6.5.
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 5  -*- Autoconf -*-
+# serial 6  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
@@ -24,6 +24,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],
@@ -36,6 +38,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
+
   AH_VERBATIM([__EXTENSIONS__],
 [/* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
--- a/m4/mbstate_t.m4
+++ b/m4/mbstate_t.m4
@@ -1,4 +1,4 @@
-# mbstate_t.m4 serial 10
+# mbstate_t.m4 serial 11
 dnl Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,10 @@
 # AC_TYPE_MBSTATE_T
 # -----------------
 AC_DEFUN([AC_TYPE_MBSTATE_T],
-  [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
+[
+   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl for HP-UX 11.11
+
+   AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
      [AC_COMPILE_IFELSE(
 	[AC_LANG_PROGRAM(
 	   [AC_INCLUDES_DEFAULT[
@@ -27,4 +30,5 @@
    else
      AC_DEFINE([mbstate_t], int,
 	       [Define to a type if <wchar.h> does not define.])
-   fi])
+   fi
+])
--- a/modules/fnmatch
+++ b/modules/fnmatch
@@ -16,6 +16,7 @@
 wctype
 memchr
 memcmp
+extensions
 
 configure.ac:
 # No macro. You should also use one of fnmatch-posix or fnmatch-gnu.
--- a/modules/mbrlen
+++ b/modules/mbrlen
@@ -9,6 +9,7 @@
 Depends-on:
 wchar
 mbrtowc
+extensions
 
 configure.ac:
 gl_FUNC_MBRLEN
--- a/modules/mbrtowc
+++ b/modules/mbrtowc
@@ -11,6 +11,7 @@
 localcharset
 streq
 verify
+extensions
 
 configure.ac:
 gl_FUNC_MBRTOWC
--- a/modules/mbsinit
+++ b/modules/mbsinit
@@ -9,6 +9,7 @@
 Depends-on:
 wchar
 verify
+extensions
 
 configure.ac:
 gl_FUNC_MBSINIT
--- a/modules/mbsrtowcs
+++ b/modules/mbsrtowcs
@@ -3,6 +3,7 @@
 
 Files:
 lib/mbsrtowcs.c
+lib/mbsrtowcs-state.c
 m4/mbsrtowcs.m4
 m4/mbstate_t.m4
 
@@ -10,6 +11,7 @@
 wchar
 mbrtowc
 strnlen1
+extensions
 
 configure.ac:
 gl_FUNC_MBSRTOWCS
--- a/modules/mbswidth
+++ b/modules/mbswidth
@@ -12,6 +12,7 @@
 wchar
 wctype
 wcwidth
+extensions
 
 configure.ac:
 gl_MBSWIDTH
--- a/modules/quotearg
+++ b/modules/quotearg
@@ -9,6 +9,7 @@
 m4/quotearg.m4
 
 Depends-on:
+extensions
 gettext-h
 memcmp
 stdbool
--- a/modules/strftime
+++ b/modules/strftime
@@ -9,6 +9,7 @@
 m4/strftime.m4
 
 Depends-on:
+extensions
 stdbool
 time_r
 wchar