summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-14 14:03:31 +0200
committerH.Merijn Brand <h.m.brand@xs4all.nl>2011-09-16 13:32:37 +0200
commitbd31be4baa3ee68abdb92c0db3200efe0fad903b (patch)
tree064b376e87748cf3ceee2c1a5fae468146e0b9de
parent28051109dbd5d27f591646b8e36a5f6be33854d6 (diff)
downloadperl-bd31be4baa3ee68abdb92c0db3200efe0fad903b.tar.gz
Probe for <stdbool.h>, and if found use it in handy.h
This means that the core uses the compiler's bool type if one exists. This avoids potential problems of clashes between perl's own implementation of bool and the compiler's bool type, which otherwise occur when one attempts to include headers which in turn include <stdbool.h>. Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
-rwxr-xr-xConfigure6
-rw-r--r--Cross/config.sh-arm-linux1
-rw-r--r--Porting/Glossary5
-rw-r--r--Porting/config.sh1
-rw-r--r--Porting/config_H6
-rwxr-xr-xconfig_h.SH6
-rw-r--r--epoc/config.sh1
-rw-r--r--handy.h11
-rw-r--r--plan9/config_sh.sample1
-rw-r--r--symbian/config.sh1
-rw-r--r--uconfig.h10
-rw-r--r--uconfig.sh1
-rw-r--r--uconfig64.sh1
-rw-r--r--win32/config.ce1
-rw-r--r--win32/config.gc1
-rw-r--r--win32/config.gc641
-rw-r--r--win32/config.gc64nox1
-rw-r--r--win32/config.vc1
-rw-r--r--win32/config.vc641
19 files changed, 51 insertions, 6 deletions
diff --git a/Configure b/Configure
index 74450a95e6..d9cdd032df 100755
--- a/Configure
+++ b/Configure
@@ -926,6 +926,7 @@ i_pwd=''
i_sfio=''
i_shadow=''
i_socks=''
+i_stdbool=''
i_stddef=''
i_stdlib=''
i_string=''
@@ -21764,6 +21765,10 @@ set i_termio; eval $setvar
val=$val2; set i_sgtty; eval $setvar
val=$val3; set i_termios; eval $setvar
+: see if stdbool is available
+set stdbool.h i_stdbool
+eval $inhdr
+
: see if stddef is available
set stddef.h i_stddef
eval $inhdr
@@ -23051,6 +23056,7 @@ i_sgtty='$i_sgtty'
i_shadow='$i_shadow'
i_socks='$i_socks'
i_stdarg='$i_stdarg'
+i_stdbool='$i_stdbool'
i_stddef='$i_stddef'
i_stdlib='$i_stdlib'
i_string='$i_string'
diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux
index acbc403ee4..fe81fd99f1 100644
--- a/Cross/config.sh-arm-linux
+++ b/Cross/config.sh-arm-linux
@@ -676,6 +676,7 @@ i_sgtty='undef'
i_shadow='define'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/Porting/Glossary b/Porting/Glossary
index 9134dfa1b6..ceed6a5e58 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -3164,6 +3164,11 @@ i_stdarg (i_varhdr.U):
indicates to the C program that <stdarg.h> exists and should
be included.
+i_stdbool (i_stdbool.U):
+ This variable conditionally defines the I_STDBOOL symbol, which
+ indicates to the C program that <stdbool.h> exists and should
+ be included.
+
i_stddef (i_stddef.U):
This variable conditionally defines the I_STDDEF symbol, which
indicates to the C program that <stddef.h> exists and should
diff --git a/Porting/config.sh b/Porting/config.sh
index eb9db2a6a0..d66b9f45a6 100644
--- a/Porting/config.sh
+++ b/Porting/config.sh
@@ -693,6 +693,7 @@ i_sgtty='undef'
i_shadow='define'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/Porting/config_H b/Porting/config_H
index 190ea8e5cf..6ad9bc9fd9 100644
--- a/Porting/config_H
+++ b/Porting/config_H
@@ -713,6 +713,12 @@
*/
/*#define I_SFIO / **/
+/* I_STDBOOL:
+ * This symbol, if defined, indicates that <stdbool.h> exists and should
+ * be included.
+ */
+/*#define I_STDBOOL / **/
+
/* I_STDDEF:
* This symbol, if defined, indicates that <stddef.h> exists and should
* be included.
diff --git a/config_h.SH b/config_h.SH
index 96748fa5b8..f11612b3e8 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -742,6 +742,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#$i_sfio I_SFIO /**/
+/* I_STDBOOL:
+ * This symbol, if defined, indicates that <stdbool.h> exists and should
+ * be included.
+ */
+#$i_stdbool I_STDBOOL /**/
+
/* I_STDDEF:
* This symbol, if defined, indicates that <stddef.h> exists and should
* be included.
diff --git a/epoc/config.sh b/epoc/config.sh
index faabef502e..a971d1375e 100644
--- a/epoc/config.sh
+++ b/epoc/config.sh
@@ -620,6 +620,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/handy.h b/handy.h
index b75eafb53f..5e30512104 100644
--- a/handy.h
+++ b/handy.h
@@ -70,10 +70,13 @@ Null SV pointer. (No longer available when C<PERL_CORE> is defined.)
#define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p))
#define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
-/* XXX Configure ought to have a test for a boolean type, if I can
- just figure out all the headers such a test needs.
- Andy Dougherty August 1996
-*/
+#ifdef I_STDBOOL
+# include <stdbool.h>
+# ifndef HAS_BOOL
+# define HAS_BOOL 1
+# endif
+#endif
+
/* bool is built-in for g++-2.6.3 and later, which might be used
for extensions. <_G_config.h> defines _G_HAVE_BOOL, but we can't
be sure _G_config.h will be included before this file. _G_config.h
diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample
index 98daaa6989..a5e793fe18 100644
--- a/plan9/config_sh.sample
+++ b/plan9/config_sh.sample
@@ -670,6 +670,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/symbian/config.sh b/symbian/config.sh
index 2e531ae34d..0641b637eb 100644
--- a/symbian/config.sh
+++ b/symbian/config.sh
@@ -597,6 +597,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='undef'
i_stdlib='define'
i_string='define'
diff --git a/uconfig.h b/uconfig.h
index a74501732e..4d0b3f29e4 100644
--- a/uconfig.h
+++ b/uconfig.h
@@ -709,6 +709,12 @@
*/
/*#define I_SFIO / **/
+/* I_STDBOOL:
+ * This symbol, if defined, indicates that <stdbool.h> exists and should
+ * be included.
+ */
+/*#define I_STDBOOL / **/
+
/* I_STDDEF:
* This symbol, if defined, indicates that <stddef.h> exists and should
* be included.
@@ -4696,6 +4702,6 @@
#endif
/* Generated from:
- * 31a462b40046313b877734092b49f853190d949d609c56fc0f03085f3aedc382 config_h.SH
- * 9ea5c7e8b0b32c76caab5a89a371b8cdce6efcf690a5a74962b9b856fab49fed uconfig.sh
+ * e73735b63cc1e7874e6402c8348f594458a1f16be24703d0e14ba9516f2b20df config_h.SH
+ * 572c1e5ebb7563dcf5fa02c1ff0b1ca588d8aab1d52e0ffed24245c95dc7a137 uconfig.sh
* ex: set ro: */
diff --git a/uconfig.sh b/uconfig.sh
index 1798d0d6d4..0f047ae6cf 100644
--- a/uconfig.sh
+++ b/uconfig.sh
@@ -584,6 +584,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/uconfig64.sh b/uconfig64.sh
index 38784313b0..7d94741598 100644
--- a/uconfig64.sh
+++ b/uconfig64.sh
@@ -585,6 +585,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/win32/config.ce b/win32/config.ce
index 47eeb71968..4f76437c6e 100644
--- a/win32/config.ce
+++ b/win32/config.ce
@@ -657,6 +657,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/win32/config.gc b/win32/config.gc
index c49a27bfca..8c00871b01 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -665,6 +665,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/win32/config.gc64 b/win32/config.gc64
index 52185f00d9..d225638aad 100644
--- a/win32/config.gc64
+++ b/win32/config.gc64
@@ -666,6 +666,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/win32/config.gc64nox b/win32/config.gc64nox
index 9a797a1662..4ad66faf32 100644
--- a/win32/config.gc64nox
+++ b/win32/config.gc64nox
@@ -666,6 +666,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/win32/config.vc b/win32/config.vc
index 3495a2369c..74ae27552b 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -665,6 +665,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'
diff --git a/win32/config.vc64 b/win32/config.vc64
index c9b1cb77cb..ac5e61e17e 100644
--- a/win32/config.vc64
+++ b/win32/config.vc64
@@ -665,6 +665,7 @@ i_sgtty='undef'
i_shadow='undef'
i_socks='undef'
i_stdarg='define'
+i_stdbool='undef'
i_stddef='define'
i_stdlib='define'
i_string='define'