From 8fbb5856df9a3e6414b0e3789a78219eb82d6638 Mon Sep 17 00:00:00 2001
From: Lars Kanis <lars@greiz-reinsdorf.de>
Date: Sun, 2 Aug 2015 21:23:28 +0200
Subject: [PATCH] Use release mode, unless extconf.rb is called with
 --enable-debug, so that all FXTRACE() and FXASSERT() calls are skiped, per
 default.

This should improve performance.
---
 History.txt            | 2 ++
 ext/fox16_c/extconf.rb | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/History.txt b/History.txt
index 3e78ed7..5af71f7 100755
--- a/History.txt
+++ b/History.txt
@@ -1,6 +1,8 @@
 === 1.6.32 / unreleased
 
 * Avoid call to rb_class2name() during GC. Fixes #21
+* Use release mode, unless extconf.rb is called with --enable-debug,
+  so that all FXTRACE() and FXASSERT() calls are skiped, per default.
 
 === 1.6.31 / 2015-07-21
 
diff --git a/ext/fox16_c/extconf.rb b/ext/fox16_c/extconf.rb
index c7ef79d..5d6913c 100755
--- a/ext/fox16_c/extconf.rb
+++ b/ext/fox16_c/extconf.rb
@@ -230,6 +230,7 @@ def do_rake_compiler_setup
         "--without-x",
         "--enable-shared",
         "--disable-static",
+        enable_config("debug") ? "--enable-debug" : "--enable-release",
         ]
       class << recipe
         def compile
@@ -390,6 +391,10 @@ unless enable_config("win32-cross")
   end
 end
 
+unless enable_config("debug")
+  $CPPFLAGS += " -DNDEBUG"
+end
+
 # Platform-specific modifications
 do_rake_compiler_setup
 
-- 
GitLab