* lib/Makefile.am, lib/alloca.c, lib/alloca.in.h, lib/argp-ba.c, lib/argp-eexst.c, lib/argp-fmtstream.c, lib/argp-fmtstream.h, lib/argp-fs-xinl.c, lib/argp-help.c, lib/argp-namefrob.h, lib/argp-parse.c, lib/argp-pin.c, lib/argp-pv.c, lib/argp-pvh.c, lib/argp-xinl.c, lib/argp.h, lib/asnprintf.c, lib/basename-lgpl.c, lib/dirname-lgpl.c, lib/dirname.h, lib/dosname.h, lib/errno.in.h, lib/float+.h, lib/float.c, lib/float.in.h, lib/getopt.c, lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h, lib/gettext.h, lib/intprops.h, lib/itold.c, lib/malloc.c, lib/memchr.c, lib/memchr.valgrind, lib/mempcpy.c, lib/printf-args.c, lib/printf-args.h, lib/printf-parse.c, lib/printf-parse.h, lib/rawmemchr.c, lib/rawmemchr.valgrind, lib/size_max.h, lib/sleep.c, lib/stdalign.in.h, lib/stdbool.in.h, lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h, lib/strcasecmp.c, lib/strchrnul.c, lib/strchrnul.valgrind, lib/strerror-override.c, lib/strerror-override.h, lib/strerror.c, lib/string.in.h, lib/strings.in.h, lib/stripslash.c, lib/strncasecmp.c, lib/strndup.c, lib/strnlen.c, lib/sys_types.in.h, lib/sysexits.in.h, lib/unistd.in.h, lib/vasnprintf.c, lib/vasnprintf.h, lib/verify.h, lib/vsnprintf.c, lib/wchar.in.h, lib/xsize.h, m4/00gnulib.m4, m4/alloca.m4, m4/argp.m4, m4/dirname.m4, m4/double-slash-root.m4, m4/errno_h.m4, m4/exponentd.m4, m4/extensions.m4, m4/float_h.m4, m4/getopt.m4, m4/gnulib-cache.m4, m4/gnulib-common.m4, m4/gnulib-comp.m4, m4/gnulib-tool.m4, m4/include_next.m4, m4/intmax_t.m4, m4/inttypes_h.m4, m4/longlong.m4, m4/malloc.m4, m4/math_h.m4, m4/memchr.m4, m4/mempcpy.m4, m4/mmap-anon.m4, m4/multiarch.m4, m4/nocrash.m4, m4/off_t.m4, m4/printf.m4, m4/rawmemchr.m4, m4/size_max.m4, m4/sleep.m4, m4/ssize_t.m4, m4/stdalign.m4, m4/stdbool.m4, m4/stddef_h.m4, m4/stdint.m4, m4/stdint_h.m4, m4/stdio_h.m4, m4/stdlib_h.m4, m4/strcase.m4, m4/strchrnul.m4, m4/strerror.m4, m4/string_h.m4, m4/strings_h.m4, m4/strndup.m4, m4/strnlen.m4, m4/sys_socket_h.m4, m4/sys_types_h.m4, m4/sysexits.m4, m4/unistd_h.m4, m4/vasnprintf.m4, m4/vsnprintf.m4, m4/warn-on-use.m4, m4/wchar_h.m4, m4/wchar_t.m4, m4/wint_t.m4, m4/xsize.m4, tools/snippet/_Noreturn.h, tools/snippet/arg-nonnull.h, tools/snippet/c++defs.h, tools/snippet/warn-on-use.h: New files from gnulib 1af55d85d9762a679b4302d5995f05ccd883e956. * configure.ac, Makefile.am: Adjust to compile gnulib. * src/bin/Makefile.am: Adjust to use gnulib. * README: Mention lib/.
100 lines
3.2 KiB
Text
100 lines
3.2 KiB
Text
# Check for stdbool.h that conforms to C99.
|
|
|
|
dnl Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
|
|
dnl This file is free software; the Free Software Foundation
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
|
|
#serial 5
|
|
|
|
# Prepare for substituting <stdbool.h> if it is not supported.
|
|
|
|
AC_DEFUN([AM_STDBOOL_H],
|
|
[
|
|
AC_REQUIRE([AC_CHECK_HEADER_STDBOOL])
|
|
|
|
# Define two additional variables used in the Makefile substitution.
|
|
|
|
if test "$ac_cv_header_stdbool_h" = yes; then
|
|
STDBOOL_H=''
|
|
else
|
|
STDBOOL_H='stdbool.h'
|
|
fi
|
|
AC_SUBST([STDBOOL_H])
|
|
AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"])
|
|
|
|
if test "$ac_cv_type__Bool" = yes; then
|
|
HAVE__BOOL=1
|
|
else
|
|
HAVE__BOOL=0
|
|
fi
|
|
AC_SUBST([HAVE__BOOL])
|
|
])
|
|
|
|
# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
|
|
AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
|
|
|
|
# This version of the macro is needed in autoconf <= 2.68.
|
|
|
|
AC_DEFUN([AC_CHECK_HEADER_STDBOOL],
|
|
[AC_CACHE_CHECK([for stdbool.h that conforms to C99],
|
|
[ac_cv_header_stdbool_h],
|
|
[AC_COMPILE_IFELSE(
|
|
[AC_LANG_PROGRAM(
|
|
[[
|
|
#include <stdbool.h>
|
|
#ifndef bool
|
|
"error: bool is not defined"
|
|
#endif
|
|
#ifndef false
|
|
"error: false is not defined"
|
|
#endif
|
|
#if false
|
|
"error: false is not 0"
|
|
#endif
|
|
#ifndef true
|
|
"error: true is not defined"
|
|
#endif
|
|
#if true != 1
|
|
"error: true is not 1"
|
|
#endif
|
|
#ifndef __bool_true_false_are_defined
|
|
"error: __bool_true_false_are_defined is not defined"
|
|
#endif
|
|
|
|
struct s { _Bool s: 1; _Bool t; } s;
|
|
|
|
char a[true == 1 ? 1 : -1];
|
|
char b[false == 0 ? 1 : -1];
|
|
char c[__bool_true_false_are_defined == 1 ? 1 : -1];
|
|
char d[(bool) 0.5 == true ? 1 : -1];
|
|
/* See body of main program for 'e'. */
|
|
char f[(_Bool) 0.0 == false ? 1 : -1];
|
|
char g[true];
|
|
char h[sizeof (_Bool)];
|
|
char i[sizeof s.t];
|
|
enum { j = false, k = true, l = false * true, m = true * 256 };
|
|
/* The following fails for
|
|
HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
|
|
_Bool n[m];
|
|
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
|
|
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
|
|
/* Catch a bug in an HP-UX C compiler. See
|
|
http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
|
|
http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
|
|
*/
|
|
_Bool q = true;
|
|
_Bool *pq = &q;
|
|
]],
|
|
[[
|
|
bool e = &s;
|
|
*pq |= q;
|
|
*pq |= ! q;
|
|
/* Refer to every declared value, to avoid compiler optimizations. */
|
|
return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
|
|
+ !m + !n + !o + !p + !q + !pq);
|
|
]])],
|
|
[ac_cv_header_stdbool_h=yes],
|
|
[ac_cv_header_stdbool_h=no])])
|
|
AC_CHECK_TYPES([_Bool])
|
|
])
|