This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use a real compile to test for stdbool.h
authorH.Merijn Brand <h.m.brand@xs4all.nl>
Thu, 22 Sep 2011 15:26:34 +0000 (17:26 +0200)
committerH.Merijn Brand <h.m.brand@xs4all.nl>
Thu, 22 Sep 2011 15:26:34 +0000 (17:26 +0200)
On some Solaris systems, <stdbool.h> is present, but will give an
error if used by a compiler that is not sufficiently c99-compliant.
Check for this by including <stdbool.h> and trying to compile a
short program that uses bool.

Signed-off-by: H.Merijn Brand <h.m.brand@xs4all.nl>
Configure

index e22860d..42a0a19 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -28,7 +28,7 @@
 # See Porting/pumpkin.pod for more information on metaconfig.
 #
 
 # See Porting/pumpkin.pod for more information on metaconfig.
 #
 
-# Generated on Fri Sep 16 13:09:14 CEST 2011 [metaconfig 3.5 PL0]
+# Generated on Thu Sep 22 17:10:35 CEST 2011 [metaconfig 3.5 PL0]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -21766,8 +21766,33 @@ val=$val2; set i_sgtty; eval $setvar
 val=$val3; set i_termios; eval $setvar
 
 : see if stdbool is available
 val=$val3; set i_termios; eval $setvar
 
 : see if stdbool is available
-set stdbool.h i_stdbool
-eval $inhdr
+: we want a real compile instead of Inhdr because some Solaris systems
+: have stdbool.h, but it can only be used if the compiler indicates it
+: is sufficiently c99-compliant.
+echo " "
+$cat >try.c <<EOCP
+#include <stdio.h>
+#include <stdbool.h>
+int func(bool x)
+{
+    return x ? 1 : 0;
+}
+int main(int argc, char **argv)
+{
+    return func(0);
+}
+EOCP
+set try
+if eval $compile; then
+       echo "<stdbool.h> found." >&4
+       val="$define"
+else
+       echo "<stdbool.h> NOT found." >&4
+       val="$undef"
+fi
+$rm_try
+set i_stdbool
+eval $setvar
 
 : see if stddef is available
 set stddef.h i_stddef
 
 : see if stddef is available
 set stddef.h i_stddef