(gl_MBCHAR): Check for wchar.h and wctype.h, and
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 24 Sep 2005 23:13:19 +0000 (23:13 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 24 Sep 2005 23:13:19 +0000 (23:13 +0000)
don't compile mbchar.c unless both headers exist.  See
<http://lists.gnu.org/archive/html/bug-gnulib/2005-09/msg00242.html>.

m4/mbchar.m4

index dd613cb..7657b69 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,
@@ -9,6 +9,13 @@ dnl From Bruno Haible.
 
 AC_DEFUN([gl_MBCHAR],
 [
+  AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
+
+  case $ac_cv_header_wchar_h,$ac_cv_header_wctype_h in
+  yes,yes)
+    AC_LIBOBJ([mbchar]);;
+  esac
+
   AC_REQUIRE([AC_GNU_SOURCE])
   :
 ])