useless-if-before-free: correct --help's exit status description
[pspp] / m4 / wctype.m4
1 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
2
3 dnl Copyright (C) 2006-2008 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_REQUIRE([AC_PROG_CC])
13   AC_CHECK_FUNCS_ONCE([iswcntrl])
14   if test $ac_cv_func_iswcntrl = yes; then
15     HAVE_ISWCNTRL=1
16   else
17     HAVE_ISWCNTRL=0
18   fi
19   AC_SUBST([HAVE_ISWCNTRL])
20   AC_CHECK_HEADERS_ONCE([wctype.h])
21   AC_REQUIRE([AC_C_INLINE])
22
23   AC_REQUIRE([gt_TYPE_WINT_T])
24   if test $gt_cv_c_wint_t = yes; then
25     HAVE_WINT_T=1
26   else
27     HAVE_WINT_T=0
28   fi
29   AC_SUBST([HAVE_WINT_T])
30
31   WCTYPE_H=wctype.h
32   if test $ac_cv_header_wctype_h = yes; then
33     if test $ac_cv_func_iswcntrl = yes; then
34       dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
35       dnl The other functions are likely broken in the same way.
36       AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
37         [
38           AC_TRY_RUN([#include <stddef.h>
39                       #include <stdio.h>
40                       #include <time.h>
41                       #include <wchar.h>
42                       #include <wctype.h>
43                       int main () { return iswprint ('x') == 0; }],
44             [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
45         ],
46         [
47           AC_TRY_COMPILE([#include <stdlib.h>
48                           #if __GNU_LIBRARY__ == 1
49                           Linux libc5 i18n is broken.
50                           #endif],
51             [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
52         ])
53       if test $gl_cv_func_iswcntrl_works = yes; then
54         WCTYPE_H=
55       fi
56     fi
57     dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty,
58     dnl for the benefit of builds from non-distclean directories.
59     gl_CHECK_NEXT_HEADERS([wctype.h])
60     HAVE_WCTYPE_H=1
61   else
62     HAVE_WCTYPE_H=0
63   fi
64   AC_SUBST([HAVE_WCTYPE_H])
65   AC_SUBST([WCTYPE_H])
66
67   if test "$gl_cv_func_iswcntrl_works" = no; then
68     REPLACE_ISWCNTRL=1
69   else
70     REPLACE_ISWCNTRL=0
71   fi
72   AC_SUBST([REPLACE_ISWCNTRL])
73 ])