diff --git a/ext/fox16_c/FXRbApp.cpp b/ext/fox16_c/FXRbApp.cpp
index acd6fe1c08e71d831198a1983239a220e9aaeabe..6a61bc4cc32b7ee57769039def468361a5636ea4 100644
--- a/ext/fox16_c/FXRbApp.cpp
+++ b/ext/fox16_c/FXRbApp.cpp
@@ -26,7 +26,7 @@
 
 #include "FXRbCommon.h"
 
-#if !(defined(RUBY_1_9) || defined(RUBY_2_0))
+#if defined(RUBY_1_8)
 extern "C" {
 #include "rubysig.h" /* For CHECK_INTS */
 }
@@ -97,14 +97,14 @@ long FXRbApp::onChoreThreads(FXObject*,FXSelector,void*){
   wait.tv_usec=100*sleepTime;
 
   // Confirm that this thread can be interrupted, then go to sleep
-#if !(defined(RUBY_1_9) || defined(RUBY_2_0))
+#if defined(RUBY_1_8)
   CHECK_INTS;
   if(!rb_thread_critical)
     rb_thread_wait_for(wait);
 #else
   // if(!rb_thread_critical) rb_thread_wait_for(wait);
   rb_thread_wait_for(wait);
-#endif /* RUBY_1_9 || RUBY_2_0 */
+#endif /* RUBY_1_8 */
 
   // Re-register this chore for next time
   addChore(this,ID_CHORE_THREADS);
diff --git a/ext/fox16_c/FXRuby.cpp b/ext/fox16_c/FXRuby.cpp
index 94eee997bb3306fdf9a92827c9e854e08ac72475..4f2cb144ed48f8f3e9dee390e52eebf72afb1d98 100644
--- a/ext/fox16_c/FXRuby.cpp
+++ b/ext/fox16_c/FXRuby.cpp
@@ -39,19 +39,19 @@
 #include <signal.h>	// for definitions of SIGINT, etc.
 #endif
 
-#if defined(RUBY_1_9) || defined(RUBY_2_0)
-
-#include "ruby/io.h"
-#include "ruby/st.h"
-
-#else
+#if defined(RUBY_1_8)
 
 extern "C" {
 #include "st.h"
 #include "rubyio.h"     // for GetOpenFile(), etc.
 }
 
-#endif /* RUBY_1_9 || RUBY_2_0 */
+#else
+
+#include "ruby/io.h"
+#include "ruby/st.h"
+
+#endif /* RUBY_1_8 */
 
 
 // Opaque type declaration from SWIG runtime
@@ -204,17 +204,17 @@ FXInputHandle FXRbGetWriteFileHandle(VALUE obj) {
   VALUE vwrite = rb_intern("@write");
   if(rb_ivar_defined(obj, vwrite)) obj = rb_ivar_get(obj, vwrite);
   fd = FIX2INT(rb_funcall(obj, rb_intern("fileno"), 0));
-#elif defined(RUBY_1_9) || defined(RUBY_2_0)
+#elif defined(RUBY_1_8)
+  OpenFile *fptr;
+  GetOpenFile(obj, fptr);
+  FILE *fpw=GetWriteFile(fptr);
+  fd = fileno(fpw);
+#else
   rb_io_t *fptr;
   GetOpenFile(obj, fptr);
   VALUE wrio = fptr->tied_io_for_writing;
   if(wrio) obj = wrio;
   fd = FIX2INT(rb_funcall(obj, rb_intern("fileno"), 0));
-#else
-  OpenFile *fptr;
-  GetOpenFile(obj, fptr);
-  FILE *fpw=GetWriteFile(fptr);
-  fd = fileno(fpw);
 #endif
 #ifdef WIN32
 #ifdef __CYGWIN__
diff --git a/ext/fox16_c/extconf.rb b/ext/fox16_c/extconf.rb
index 796c927c927ea558a5056bb05dc341888a10b164..9e9b75ac1a2be03998c5b2f11a4b42d0efe4899b 100755
--- a/ext/fox16_c/extconf.rb
+++ b/ext/fox16_c/extconf.rb
@@ -145,6 +145,7 @@ end
 # Platform-specific modifications
 do_rake_compiler_setup
 
+$CFLAGS += " -DRUBY_1_8" if RUBY_VERSION =~ /1\.8\./
 $CFLAGS += " -DRUBY_1_9" if RUBY_VERSION =~ /1\.9\./
 $CFLAGS += " -DRUBY_2_0" if RUBY_VERSION =~ /2\.0\./