summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-07-07 20:59:43 +0000
committerBruno Haible <bruno@clisp.org>2007-07-07 20:59:43 +0000
commit9e8ce574adfade2243a6141a1655addb92512aeb (patch)
treeae69237c8ec13f45fafca1d87b77c978d7f61ffc /m4
parent5407ddca850d0472f06fa0ef4ec8042e9353d25e (diff)
downloadgnulib-9e8ce574adfade2243a6141a1655addb92512aeb.tar.gz
Remove the wcwidth.h file. Move wcwidth's declaration to wchar_.h.
Diffstat (limited to 'm4')
-rw-r--r--m4/wchar.m446
-rw-r--r--m4/wcwidth.m414
2 files changed, 45 insertions, 15 deletions
diff --git a/m4/wchar.m4 b/m4/wchar.m4
index bf32d2831e..70b1248f8f 100644
--- a/m4/wchar.m4
+++ b/m4/wchar.m4
@@ -7,30 +7,48 @@ dnl with or without modifications, as long as this notice is preserved.
dnl Written by Eric Blake.
-# wchar.m4 serial 3
+# wchar.m4 serial 4
AC_DEFUN([gl_WCHAR_H],
[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
AC_CACHE_CHECK([whether <wchar.h> is standalone],
[gl_cv_header_wchar_h_standalone],
[AC_COMPILE_IFELSE([[#include <wchar.h>
wchar_t w;]],
[gl_cv_header_wchar_h_standalone=yes],
[gl_cv_header_wchar_h_standalone=no])])
- if test $gl_cv_header_wchar_h_standalone = yes; then
- WCHAR_H=
- else
- dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
- dnl character support).
- AC_CHECK_HEADERS_ONCE([wchar.h])
- if test $ac_cv_header_wchar_h = yes; then
- HAVE_WCHAR_H=1
- else
- HAVE_WCHAR_H=0
- fi
- AC_SUBST([HAVE_WCHAR_H])
- gl_CHECK_NEXT_HEADERS([wchar.h])
+ if test $gl_cv_header_wchar_h_standalone != yes; then
WCHAR_H=wchar.h
fi
+
+ dnl Prepare for creating substitute <wchar.h>.
+ dnl Do it always: WCHAR_H may be empty here but can be set later.
+ dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
+ dnl character support).
+ AC_CHECK_HEADERS_ONCE([wchar.h])
+ if test $ac_cv_header_wchar_h = yes; then
+ HAVE_WCHAR_H=1
+ else
+ HAVE_WCHAR_H=0
+ fi
+ AC_SUBST([HAVE_WCHAR_H])
+ gl_CHECK_NEXT_HEADERS([wchar.h])
+])
+
+AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
+[
+ dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+ GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+])
+
+AC_DEFUN([gl_WCHAR_H_DEFAULTS],
+[
+ GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
+ dnl Assume proper GNU behavior unless another module says otherwise.
+ HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
+ REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
+ WCHAR_H=
AC_SUBST([WCHAR_H])
])
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
index fce3281577..b6cedc2430 100644
--- a/m4/wcwidth.m4
+++ b/m4/wcwidth.m4
@@ -1,4 +1,4 @@
-# wcwidth.m4 serial 9
+# wcwidth.m4 serial 10
dnl Copyright (C) 2006, 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,6 +6,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_WCWIDTH],
[
+ AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
+
dnl Persuade glibc <wchar.h> to declare wcwidth().
AC_REQUIRE([AC_GNU_SOURCE])
@@ -27,8 +29,18 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
#include <time.h>
#include <wchar.h>
])
+ if test $ac_cv_have_decl_wcwidth != yes; then
+ HAVE_DECL_WCWIDTH=0
+ fi
if test $ac_cv_func_wcwidth = no; then
+ REPLACE_WCWIDTH=1
+ fi
+ if test $REPLACE_WCWIDTH = 1; then
AC_LIBOBJ([wcwidth])
fi
+
+ if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then
+ WCHAR_H=wchar.h
+ fi
])