summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bigdecimal/bigdecimal.h14
-rw-r--r--ext/bigdecimal/extconf.rb2
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index 28f3363b3c..c89f212ad3 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -14,6 +14,20 @@
#include "ruby/ruby.h"
#include <float.h>
+#if defined(__bool_true_false_are_defined)
+# /* Take that. */
+
+#elif defined(HAVE_STDBOOL_H)
+# include <stdbool.h>
+
+#else
+typedef unsigned char _Bool;
+# define bool _Bool
+# define true ((_Bool)+1)
+# define false ((_Bool)-1)
+# define __bool_true_false_are_defined
+#endif
+
#ifndef RB_UNUSED_VAR
# ifdef __GNUC__
# define RB_UNUSED_VAR(x) x __attribute__ ((unused))
diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb
index 63123e2892..41b8df8d5b 100644
--- a/ext/bigdecimal/extconf.rb
+++ b/ext/bigdecimal/extconf.rb
@@ -28,6 +28,8 @@ end
check_bigdecimal_version(gemspec_path)
+have_header("stdbool.h")
+
have_func("labs", "stdlib.h")
have_func("llabs", "stdlib.h")
have_func("finite", "math.h")