ext/extconf.rb in ferocia-rubywmq-1.1.3 vs ext/extconf.rb in ferocia-rubywmq-2.0.2
- old
+ new
@@ -1,52 +1,32 @@
-################################################################################
-# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-################################################################################
+require 'mkmf'
+generate_sources_path = File.join(File.dirname(__FILE__), 'generate')
+$LOAD_PATH.unshift generate_sources_path
+require 'generate_reason'
+require 'generate_const'
+require 'generate_structs'
-if RUBY_PLATFORM =~ /darwin/ || ENV['DISABLE_RUBYWMQ']
- # do nothing on a mac, this is so people developing applications using this
- # gem on a mac (using stubs for development) can still keep the gem in their
- # Gemfile
- # create a blank Makefile to satisfy extension install requirements
- File.open("Makefile", "w") { |f| f << 'install:' }
+include_path = ''
+if RUBY_PLATFORM =~ /win|mingw/i
+ include_path = 'C:\Program Files\IBM\WebSphere MQ\tools\c\include'
+ dir_config('mqm', include_path, '.')
else
- require 'mkmf'
- require_relative 'generate/generate_reason'
- require_relative 'generate/generate_const'
- require_relative 'generate/generate_structs'
+ include_path = '/opt/mqm/inc'
+ lib64_path = '/opt/mqm/lib64'
+ lib_path = File.directory?(lib64_path) ? lib64_path : '/opt/mqm/lib'
+ dir_config('mqm', include_path, lib_path)
+end
- include_path = ''
- if RUBY_PLATFORM =~ /mswin32/
- include_path = 'C:\Program Files\IBM\WebSphere MQ\Tools\c\include'
- dir_config('mqm', include_path, '.')
- else
- include_path = '/opt/mqm/inc'
- #dir_config('mqm', include_path, '/opt/mqm/lib')
- end
+have_header('cmqc.h')
- have_header('cmqc.h')
+# Check for WebSphere MQ Server library
+unless (RUBY_PLATFORM =~ /win/i) || (RUBY_PLATFORM =~ /solaris/i) || (RUBY_PLATFORM =~ /linux/i)
+ have_library('mqm')
+end
- # Check for WebSphere MQ Server library
- unless (RUBY_PLATFORM =~ /win/i) || (RUBY_PLATFORM =~ /solaris/i) || (RUBY_PLATFORM =~ /linux/i)
- have_library('mqm')
- end
+# Generate Source Files
+GenerateReason.generate(include_path+'/')
+GenerateConst.generate(include_path+'/', File.dirname(__FILE__) + '/../lib/wmq')
+GenerateStructs.new(include_path+'/', generate_sources_path).generate
- # Generate Source Files
- GenerateReason.generate(include_path+'/')
- GenerateConst.generate(include_path+'/', 'lib')
- GenerateStructs.new(include_path+'/', 'generate').generate
-
- # Generate Makefile
- create_makefile('wmq/wmq')
-end
+# Generate Makefile
+create_makefile('wmq/wmq')