Sha256: 38f5b4de2f7c8d7b358fd497542831f15d7f379251d8ca25f1d7969488a82d64

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'mkmf'

begin
  require "curses"
rescue LoadError
  abort "could not require 'curses', make sure your ruby was built with curses"
end

def have_feature name, header, library, fatal = true
  feature = have_func(name) or have_macro(name, headers)

  return unless fatal

  abort "unable to find #{name}() in #{header} and #{library}" unless feature
end

dir_config 'curses'
dir_config 'ncurses'

libs = [
  ["ncurses.h",            ["ncursesw", "ncurses"]],
  ["ncurses/curses.h",     ["ncurses"]],
  ["curses_colr/curses.h", ["cur_colr"]],
  ["curses.h",             ["curses"]],
]

header  = nil
library = nil

libs.each do |hdr, libraries|
  next unless have_header hdr

  header = hdr

  library = libraries.find do |lib|
    have_library lib, "initscr", hdr
  end

  break if library
end

abort "unable to find curses header and library" unless library

puts
puts "using header:  #{header}"
puts "using library: #{library}"
puts

headers = [header]
headers.unshift "varargs.h" if header == "curses_colr/curses.h"

have_feature "newpad",   headers, library
have_feature "doupdate", headers, library, false

puts
create_header
create_makefile "pad"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curses-pad-1.0 ext/curses/pad/extconf.rb