Add comments.
[pspp] / m4 / wctype.m4
1 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
2
3 dnl Copyright (C) 2006 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 Paul Eggert.
9
10 AC_DEFUN([gl_WCTYPE_H],
11 [
12   AC_CHECK_FUNCS_ONCE([iswcntrl])
13   AC_CHECK_HEADERS_ONCE([wctype.h])
14   AC_REQUIRE([AC_C_INLINE])
15
16   if test $ac_cv_header_wctype_h = yes; then
17     gl_ABSOLUTE_HEADER([wctype.h])
18     ABSOLUTE_WCTYPE_H=\"$gl_cv_absolute_wctype_h\"
19     HAVE_WCTYPE_H=1
20   else
21     ABSOLUTE_WCTYPE_H=\"no/such/file/wctype.h\"
22     HAVE_WCTYPE_H=0
23   fi
24   AC_SUBST([ABSOLUTE_WCTYPE_H])
25   AC_SUBST([HAVE_WCTYPE_H])
26
27   WCTYPE_H=wctype.h
28   HAVE_WCTYPE_CTMP_BUG=0
29   if test $ac_cv_header_wctype_h = yes; then
30     dnl IRIX 5.3 has a bug: its isw* macros reference an undefined variable
31     dnl _ctmp_. Test against this bug.
32     AC_CACHE_CHECK([whether wctype macros need _ctmp_ declared],
33       [gl_cv_wctype_ctmp_bug],
34       [gl_cv_wctype_ctmp_bug=no
35        AC_COMPILE_IFELSE(
36          [AC_LANG_PROGRAM(
37             [[#include <wctype.h>
38             ]],
39             [[return iswprint (0);]])],
40          [gl_cv_wctype_ctmp_bug='no, but bare wctype.h does not work'],
41          [AC_COMPILE_IFELSE(
42             [AC_LANG_PROGRAM(
43                [[#include <wctype.h>
44                  static wint_t _ctmp_;]],
45                [[return iswprint (0);]])],
46             [gl_cv_wctype_ctmp_bug=yes])])])
47     case $gl_cv_wctype_ctmp_bug,$ac_cv_func_iswcntrl in #(
48       yes,*)
49         HAVE_WCTYPE_CTMP_BUG=1;; #(
50       no,yes)
51         WCTYPE_H=;;
52     esac
53   fi
54   AC_SUBST([WCTYPE_H])
55   AC_SUBST([HAVE_WCTYPE_CTMP_BUG])
56 ])