$:.unshift File.dirname(__FILE__)
 
-module Thrift
-  # prevent the deprecation layer from being loaded if you require 'thrift'
-  DEPRECATION = false unless const_defined? :DEPRECATION
-end
-
 require 'thrift/core_ext'
 require 'thrift/exceptions'
 require 'thrift/types'
 require 'thrift/struct'
 require 'thrift/protocol'
 require 'thrift/protocol/binaryprotocol'
+require 'thrift/protocol/compact_protocol'
 require 'thrift/transport'
 require 'thrift/transport/socket'
 require 'thrift/server'
+require "thrift/thrift_native"
\ No newline at end of file
 
--- /dev/null
+begin
+  require "thrift_native"
+rescue LoadError
+  puts "Unable to load thrift_native extension. Defaulting to pure Ruby libraries."
+end
\ No newline at end of file
 
 # will get screwed up
 # $" << 'fastthread.bundle'
 
-# turn on deprecation so we can test it
-module Thrift
-  # squelch any warnings if we happen to get required twice
-  remove_const(:DEPRECATION) if const_defined? :DEPRECATION
-  DEPRECATION = true
-end
-
 require File.dirname(__FILE__) + '/../lib/thrift'
 
 class Object
   end
 end
 
-require "thrift/protocol/compact_protocol"
-require "thrift_native"
-
 require File.dirname(__FILE__) + "/../debug_proto_test/gen-rb/Srv"
 
 module Fixtures