Sha256: 7b8c8b5534b30d1bfeadbcfcef34df3c2d060439d22a7e88e61e8c3f1716f029

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'mkmf'
require 'rbconfig'

EXTENSION_NAME = 'rs_232_native'.freeze
dir_config(EXTENSION_NAME)

if ENV['DEBUG']
  $CFLAGS << ' -DDEBUG'
  $CFLAGS << ' -g'
  $stdout.puts "compiling in debug mode... flags: #{$CFLAGS}"
end

$CFLAGS << ' -Wall -g'

$warnflags = '-Wall'

OS = case RbConfig::CONFIG['host_os'].downcase
       when /linux/
         'linux'
       when /darwin/
         'darwin'
       when /freebsd/
         'freebsd'
       when /openbsd/
         'openbsd'
       when /sunos|solaris/
         'solaris'
       when /mswin|mingw/
         'windows'
       else
         RbConfig::CONFIG['host_os'].downcase
     end

have_header('ruby.h')
have_header('stdio.h')

if OS == 'windows'
  $VPATH << '$(srcdir)/windows'
  $INCFLAGS += ' -I$(srcdir)/windows'
  have_header('windows.h')
  have_header('fcntl.h')
  have_header('io.h')
  have_header('ruby/io.h')
  have_header('rubyio.h')
elsif %w(linux darwin).include? OS
  $VPATH << ' $(srcdir)/posix'
  $INCFLAGS += ' -I$(srcdir)/posix'
  have_header('termios.h')
  have_header('unistd.h')
  have_header('string.h')
  have_header('fcntl.h')
  have_header('errno.h')
  have_header('sys/ioctl.h')
else
  fail "RS-233 implementation wasn't been tested for #{OS} platform."
end

$objs = %w(Constants.o Port.o Rs232.o).freeze

$CFLAGS += " -DOS_#{OS.upcase}"

$stdout.puts <<-MSG

Extending with: #{$CFLAGS}

MSG

create_makefile(EXTENSION_NAME)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rs_232-3.0.0.pre5 ext/rs_232/extconf.rb