30377ca12d95ac116a166def7c7f65dd63fb99f8
[gnulib.git] / m4 / wchar.m4
1 dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
2
3 dnl Copyright (C) 2007 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl Written by Eric Blake.
9
10 # wchar.m4 serial 2
11
12 AC_DEFUN([gl_WCHAR_H],
13 [
14   AC_CACHE_CHECK([whether <wchar.h> is standalone],
15     [gl_cv_header_wchar_h_standalone],
16     [AC_COMPILE_IFELSE([[#include <wchar.h>
17 wchar_t w;]],
18       [gl_cv_header_wchar_h_standalone=yes],
19       [gl_cv_header_wchar_h_standalone=no])])
20   if test $gl_cv_header_wchar_h_standalone = yes; then
21     WCHAR_H=
22   else
23     dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
24     dnl character support).
25     AC_CHECK_HEADERS_ONCE([wchar.h])
26     if test $ac_cv_header_wchar_h = yes; then
27       HAVE_WCHAR_H=1
28     else
29       HAVE_WCHAR_H=0
30     fi
31     AC_SUBST([HAVE_WCHAR_H])
32     gl_ABSOLUTE_HEADER([wchar.h])
33     ABSOLUTE_WCHAR_H=\"$gl_cv_absolute_wchar_h\"
34     WCHAR_H=wchar.h
35   fi
36   AC_SUBST([ABSOLUTE_WCHAR_H])
37   AC_SUBST([WCHAR_H])
38 ])