Mercurial > hg > octave-shane > gnulib-hg
annotate m4/stdbool.m4 @ 17536:ea01543bbca7
install-reloc: Support multi-binary installation.
* build-aux/install-reloc: Support installing multiple programs in
one invocation, as done by Automake starting with commit
4295fe33eb23f (Multi-file install for PROGRAMS.). From Bruno
Haible <bruno@clisp.org>, archived at
http://lists.debian.org/debian-bsd/2012/05/msg00032.html.
Reported by Sylvain <beuc@gnu.org>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 21 Oct 2013 22:48:35 -0700 |
parents | e542fd46ad6f |
children | 344018b6e5d7 |
rev | line source |
---|---|
3889
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
1 # Check for stdbool.h that conforms to C99. |
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
2 |
17249
e542fd46ad6f
maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents:
16201
diff
changeset
|
3 dnl Copyright (C) 2002-2006, 2009-2013 Free Software Foundation, Inc. |
5585
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
5075
diff
changeset
|
4 dnl This file is free software; the Free Software Foundation |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
5075
diff
changeset
|
5 dnl gives unlimited permission to copy and/or distribute it, |
adff74659d81
Use an all-permissive copyright notice, recommended by RMS.
Bruno Haible <bruno@clisp.org>
parents:
5075
diff
changeset
|
6 dnl with or without modifications, as long as this notice is preserved. |
3889
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
7 |
14528
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14265
diff
changeset
|
8 #serial 5 |
13567
8ac98041d7e3
stdbool: avoid rejecting clang
Eric Blake <eblake@redhat.com>
parents:
12559
diff
changeset
|
9 |
4151
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
10 # Prepare for substituting <stdbool.h> if it is not supported. |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
11 |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
12 AC_DEFUN([AM_STDBOOL_H], |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
13 [ |
14265
702056cdbca0
stdbool: do not define HAVE_STDBOOL_H
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
14 AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) |
4151
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
15 |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
16 # Define two additional variables used in the Makefile substitution. |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
17 |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
18 if test "$ac_cv_header_stdbool_h" = yes; then |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
19 STDBOOL_H='' |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
20 else |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
21 STDBOOL_H='stdbool.h' |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
22 fi |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
23 AC_SUBST([STDBOOL_H]) |
14528
662ae53d8d37
Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents:
14265
diff
changeset
|
24 AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) |
4151
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
25 |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
26 if test "$ac_cv_type__Bool" = yes; then |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
27 HAVE__BOOL=1 |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
28 else |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
29 HAVE__BOOL=0 |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
30 fi |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
31 AC_SUBST([HAVE__BOOL]) |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
32 ]) |
3a0c83552f0e
Make it possible to #include <stdbool.h> without any #ifdefs.
Bruno Haible <bruno@clisp.org>
parents:
4108
diff
changeset
|
33 |
6374
7398c10d65f5
Prepare for using gl_STDBOOL_H.
Bruno Haible <bruno@clisp.org>
parents:
6345
diff
changeset
|
34 # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. |
7398c10d65f5
Prepare for using gl_STDBOOL_H.
Bruno Haible <bruno@clisp.org>
parents:
6345
diff
changeset
|
35 AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) |
7398c10d65f5
Prepare for using gl_STDBOOL_H.
Bruno Haible <bruno@clisp.org>
parents:
6345
diff
changeset
|
36 |
14265
702056cdbca0
stdbool: do not define HAVE_STDBOOL_H
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
37 # This version of the macro is needed in autoconf <= 2.68. |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3889
diff
changeset
|
38 |
14265
702056cdbca0
stdbool: do not define HAVE_STDBOOL_H
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
39 AC_DEFUN([AC_CHECK_HEADER_STDBOOL], |
3889
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
40 [AC_CACHE_CHECK([for stdbool.h that conforms to C99], |
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
41 [ac_cv_header_stdbool_h], |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
42 [AC_COMPILE_IFELSE( |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
43 [AC_LANG_PROGRAM( |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
44 [[ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
45 #include <stdbool.h> |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
46 #ifndef bool |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
47 "error: bool is not defined" |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
48 #endif |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
49 #ifndef false |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
50 "error: false is not defined" |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
51 #endif |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
52 #if false |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
53 "error: false is not 0" |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
54 #endif |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
55 #ifndef true |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
56 "error: true is not defined" |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
57 #endif |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
58 #if true != 1 |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
59 "error: true is not 1" |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
60 #endif |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
61 #ifndef __bool_true_false_are_defined |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
62 "error: __bool_true_false_are_defined is not defined" |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
63 #endif |
3889
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
64 |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
65 struct s { _Bool s: 1; _Bool t; } s; |
3889
c6cde8cafff6
New file, from diffutils-2.8.2.
Jim Meyering <jim@meyering.net>
parents:
diff
changeset
|
66 |
13577
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
67 char a[true == 1 ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
68 char b[false == 0 ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
69 char c[__bool_true_false_are_defined == 1 ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
70 char d[(bool) 0.5 == true ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
71 /* See body of main program for 'e'. */ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
72 char f[(_Bool) 0.0 == false ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
73 char g[true]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
74 char h[sizeof (_Bool)]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
75 char i[sizeof s.t]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
76 enum { j = false, k = true, l = false * true, m = true * 256 }; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
77 /* The following fails for |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
78 HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
79 _Bool n[m]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
80 char o[sizeof n == m * sizeof n[0] ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
81 char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
82 /* Catch a bug in an HP-UX C compiler. See |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
83 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
84 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
85 */ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
86 _Bool q = true; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
87 _Bool *pq = &q; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
88 ]], |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
89 [[ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
90 bool e = &s; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
91 *pq |= q; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
92 *pq |= ! q; |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
93 /* Refer to every declared value, to avoid compiler optimizations. */ |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
94 return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
95 + !m + !n + !o + !p + !q + !pq); |
d53740f6f336
Modernize AC_TRY_COMPILE invocations.
Bruno Haible <bruno@clisp.org>
parents:
13572
diff
changeset
|
96 ]])], |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
97 [ac_cv_header_stdbool_h=yes], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
98 [ac_cv_header_stdbool_h=no])]) |
4108
c1d472db5c30
An independent .m4 file for each module.
Bruno Haible <bruno@clisp.org>
parents:
3889
diff
changeset
|
99 AC_CHECK_TYPES([_Bool]) |
14265
702056cdbca0
stdbool: do not define HAVE_STDBOOL_H
Paul Eggert <eggert@cs.ucla.edu>
parents:
14079
diff
changeset
|
100 ]) |