Deal with the fact that mbchar.h, mbfile.h, mbiter.h, mbuiter.h can
authorBruno Haible <bruno@clisp.org>
Mon, 26 Sep 2005 13:58:51 +0000 (13:58 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 26 Sep 2005 13:58:51 +0000 (13:58 +0000)
only be #included conditionally.

12 files changed:
ChangeLog
m4/ChangeLog
m4/mbchar.m4
m4/mbfile.m4
m4/mbiter.m4
m4/strcase.m4
m4/strcasestr.m4
m4/strstr.m4
modules/mbchar
modules/mbfile
modules/mbiter
modules/mbuiter

index 71b77de3343fef3a959af3ef8d65d355efaf91cb..b1be8e531d0c2fa0051c23527dcbbaed3b3ec98b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-09-26  Bruno Haible  <bruno@clisp.org>
+
+       * modules/mbchar (Include): Mention that HAVE_WCHAR_H && HAVE_WCTYPE_H
+       is necessary.
+       (lib_SOURCES): Remove mbchar.c.
+       * modules/mbfile (Include): Mention that HAVE_MBRTOWC is necessary.
+       (Files): Add m4/mbrtowc.m4.
+       * modules/mbiter: Likewise.
+       * modules/mbuiter: Likewise.
+
 2005-09-25  Jim Meyering  <jim@meyering.net>
 
        * modules/inet_ntop (Depends-on): Add socklen, since inet_ntop.c
index 369fe3024ca32016e65d4c5de2cbf74d15a61404..0ff53684bf91c2d78128ffb8568c6c1caf9240d4 100644 (file)
@@ -1,3 +1,13 @@
+2005-09-26  Bruno Haible  <bruno@clisp.org>
+
+       * mbchar.m4 (gl_MBCHAR): Check for wchar.h and wctype.h. Don't compile
+       mbchar.c if they are not both present.
+       * mbfile.m4 (gl_MBFILE): Require gl_FUNC_MBRTOWC.
+       * mbiter.m4 (gl_MBITER): Likewise.
+       * strstr.m4 (gl_PREREQ_STRSTR): Use AC_REQUIRE.
+       * strcasestr.m4 (gl_PREREQ_STRCASESTR): Likewise.
+       * strcase.m4 (gl_PREREQ_STRCASECMP): Likewise.
+
 2005-09-23  Paul Eggert  <eggert@cs.ucla.edu>
 
        * regex.m4 (gl_REGEX): If replacing, define regcomp to rpl_regcomp,
index dd613cbc6937597fc3197e5e0d0788ab41f04346..df351a6eb24ae2c53fb1d33dc8759188676c4bb6 100644 (file)
@@ -1,4 +1,4 @@
-# mbchar.m4 serial 1
+# mbchar.m4 serial 2
 dnl Copyright (C) 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,5 +10,11 @@ dnl From Bruno Haible.
 AC_DEFUN([gl_MBCHAR],
 [
   AC_REQUIRE([AC_GNU_SOURCE])
-  :
+  dnl The following line is that so the user can test
+  dnl HAVE_WCHAR_H && HAVE_WCTYPE_H before #include "mbchar.h".
+  AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
+  dnl Compile mbchar.c only if HAVE_WCHAR_H && HAVE_WCTYPE_H.
+  if test $ac_cv_header_wchar_h = yes && test $ac_cv_header_wctype_h = yes; then
+    AC_LIBOBJ([mbchar])
+  fi
 ])
index 5ea492dd1b3b6179410d32d343257b6181913beb..032bc996e1407161a6f3730c0ace3399d71d3d8a 100644 (file)
@@ -1,4 +1,4 @@
-# mbfile.m4 serial 1
+# mbfile.m4 serial 2
 dnl Copyright (C) 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,5 +10,8 @@ dnl From Bruno Haible.
 AC_DEFUN([gl_MBFILE],
 [
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  dnl The following line is that so the user can test HAVE_MBRTOWC before
+  dnl #include "mbfile.h".
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
   :
 ])
index 3eb92bcca720b5444074fff2e852e6e0e05fed50..7d51af10dc5d830f7c5662d9c82763f624a90a4d 100644 (file)
@@ -1,4 +1,4 @@
-# mbiter.m4 serial 1
+# mbiter.m4 serial 2
 dnl Copyright (C) 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,5 +10,8 @@ dnl From Bruno Haible.
 AC_DEFUN([gl_MBITER],
 [
   AC_REQUIRE([AC_TYPE_MBSTATE_T])
+  dnl The following line is that so the user can test HAVE_MBRTOWC before
+  dnl #include "mbiter.h" or "mbuiter.h".
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
   :
 ])
index 8a8ff3a451cf8afff9506be1d6691a90097e790e..6db401bb1b93d41f19b35f51ff4416ee8ec4dd97 100644 (file)
@@ -1,4 +1,4 @@
-# strcase.m4 serial 2
+# strcase.m4 serial 3
 dnl Copyright (C) 2002, 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -29,7 +29,8 @@ AC_DEFUN([gl_FUNC_STRNCASECMP],
 
 # Prerequisites of lib/strcasecmp.c.
 AC_DEFUN([gl_PREREQ_STRCASECMP], [
-  gl_FUNC_MBRTOWC
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
+  :
 ])
 
 # Prerequisites of lib/strncasecmp.c.
index 30edffd457bc70b51e09afd7b4aec18d3aab938a..ae83c481d791fcbaeccf8677c9c8d2799a89a0a7 100644 (file)
@@ -1,4 +1,4 @@
-# strcasestr.m4 serial 1
+# strcasestr.m4 serial 2
 dnl Copyright (C) 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,5 +15,6 @@ AC_DEFUN([gl_FUNC_STRCASESTR],
 
 # Prerequisites of lib/strcasestr.c.
 AC_DEFUN([gl_PREREQ_STRCASESTR], [
-  gl_FUNC_MBRTOWC
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
+  :
 ])
index aea809ebd15b1512e792daaf09d04cb2dc66cacb..a785d42866b1960b99e7d95bc7418d8719abb2e2 100644 (file)
@@ -1,4 +1,4 @@
-# strstr.m4 serial 4
+# strstr.m4 serial 5
 dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -14,5 +14,6 @@ AC_DEFUN([gl_FUNC_STRSTR],
 
 # Prerequisites of lib/strstr.c.
 AC_DEFUN([gl_PREREQ_STRSTR], [
-  gl_FUNC_MBRTOWC
+  AC_REQUIRE([gl_FUNC_MBRTOWC])
+  :
 ])
index 150fe47569b9a355f409c88a263bf27aaff67bf2..5f193216998559f157ee70e426a44a2872a5eaea 100644 (file)
@@ -13,10 +13,12 @@ configure.ac:
 gl_MBCHAR
 
 Makefile.am:
-lib_SOURCES += mbchar.h mbchar.c
+lib_SOURCES += mbchar.h
 
 Include:
-"mbchar.h"
+#if HAVE_WCHAR_H && HAVE_WCTYPE_H
+#include "mbchar.h"
+#endif
 
 License:
 LGPL
index 525d1cc9f2e4b9733756cfcf170319e1a1868bdc..585364f446037dfae48abea52c39b4745c7631f5 100644 (file)
@@ -4,6 +4,7 @@ Multibyte character I/O.
 Files:
 lib/mbfile.h
 m4/mbfile.m4
+m4/mbrtowc.m4
 
 Depends-on:
 mbchar
@@ -16,7 +17,9 @@ Makefile.am:
 lib_SOURCES += mbfile.h
 
 Include:
-"mbfile.h"
+#if HAVE_MBRTOWC
+#include "mbfile.h"
+#endif
 
 License:
 LGPL
index 49ce8a2323efc2a0c5068e84177fa1fbbff9cfec..e0daf82c822f60f5a672bb1196b1ad1fc676f219 100644 (file)
@@ -4,6 +4,7 @@ Iterating through multibyte strings.
 Files:
 lib/mbiter.h
 m4/mbiter.m4
+m4/mbrtowc.m4
 
 Depends-on:
 mbchar
@@ -16,7 +17,9 @@ Makefile.am:
 lib_SOURCES += mbiter.h
 
 Include:
-"mbiter.h"
+#if HAVE_MBRTOWC
+#include "mbiter.h"
+#endif
 
 License:
 LGPL
index fe3c4793f8c5a2bee54a541a0d9b9ba3ea123640..9c58466b1394c998b77796f33b42a65545400cd1 100644 (file)
@@ -4,6 +4,7 @@ Iterating through multibyte strings.
 Files:
 lib/mbuiter.h
 m4/mbiter.m4
+m4/mbrtowc.m4
 
 Depends-on:
 mbchar
@@ -17,7 +18,9 @@ Makefile.am:
 lib_SOURCES += mbuiter.h
 
 Include:
-"mbuiter.h"
+#if HAVE_MBRTOWC
+#include "mbuiter.h"
+#endif
 
 License:
 LGPL