File: extconf.rb

package info (click to toggle)
openbabel 2.3.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 75,356 kB
  • ctags: 41,971
  • sloc: cpp: 321,256; ansic: 89,228; python: 7,262; perl: 6,418; pascal: 793; sh: 194; xml: 97; ruby: 55; makefile: 48; java: 23
file content (44 lines) | stat: -rw-r--r-- 1,277 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Creates a makefile to build the Open Babel-Ruby extension.

# Compensate for the fact that Ruby will try to build universal
# binaries on OS X by default
require 'rbconfig'
if Config::CONFIG["arch"] =~ /universal-darwin/
  ENV['ARCHFLAGS'] = case `uname -smr`.chomp
    when "i386" then '-arch i386'
    when "ppc"  then '-arch ppc'
  end
end

require 'mkmf'

dir_config('openbabel')

# Find a trivial header in order to add the proper include path
# to the build flags.
here = File.dirname(__FILE__)
find_header('inchi_api.h', '/usr/include/inchi', '/usr/include', here + '/../../include')

# Prevent Ruby 1.8.x from trying to compile and link the extension
# using gcc.
if RUBY_VERSION < "1.9"
  cxx = ''
  begin
    File.open('../Makefile', 'r').each_line do |line|
      if line =~ /CXX = /
        cxx = Regexp.last_match.post_match.chomp
      end
    end
  rescue Errno::ENOENT
    puts 'Please configure Open Babel before compiling the Ruby extension'
  end
  cpp_command(cxx)
end

if have_library('openbabel')
  with_ldflags("#$LDFLAGS -dynamic -flat_namespace") do #Enables cc to handle linking better.
  create_makefile('openbabel')
end
else
  puts "Install Open Babel first. If you've already compiled and installed Open Babel, you may need to run ldconfig."
end