mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/curses/extconf.rb: refactored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1a6b0bab94
commit
9fc31792ce
2 changed files with 35 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Feb 22 19:08:55 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/curses/extconf.rb: refactored.
|
||||
|
||||
Wed Feb 22 18:44:41 2012 Shota Fukumori <sorah@tubusu.net>
|
||||
|
||||
* lib/test/unit.rb (setup_options): add option "--retry" as opposite
|
||||
|
|
|
@ -11,34 +11,45 @@ def transact
|
|||
result
|
||||
end
|
||||
|
||||
def check_header_library(hdr, libs)
|
||||
if !have_header(hdr)
|
||||
return nil
|
||||
end
|
||||
libs.each {|lib|
|
||||
if have_library(lib, "initscr")
|
||||
return [hdr, lib]
|
||||
end
|
||||
}
|
||||
nil
|
||||
end
|
||||
|
||||
dir_config('curses')
|
||||
dir_config('ncurses')
|
||||
dir_config('termcap')
|
||||
|
||||
make=false
|
||||
headers = []
|
||||
|
||||
have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
|
||||
have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
|
||||
|
||||
curses = nil
|
||||
if transact { have_header(*curses=%w"ncurses.h") and
|
||||
(have_library("ncursesw", "initscr") or
|
||||
have_library("ncurses", "initscr")) }
|
||||
make=true
|
||||
elsif transact { have_header(*curses=%w"ncurses/curses.h") and
|
||||
have_library("ncurses", "initscr") }
|
||||
make=true
|
||||
elsif transact { have_header(*curses=%w"curses_colr/curses.h") and
|
||||
have_library("cur_colr", "initscr") }
|
||||
curses.unshift("varargs.h")
|
||||
make=true
|
||||
elsif transact { have_header(*curses=%w"curses.h") and
|
||||
have_library("curses", "initscr") }
|
||||
make=true
|
||||
end
|
||||
header_library = nil
|
||||
[
|
||||
["ncurses.h", ["ncursesw", "ncurses"]],
|
||||
["ncurses/curses.h", ["ncurses"]],
|
||||
["curses_colr/curses.h", ["cur_colr"]],
|
||||
["curses.h", ["curses"]],
|
||||
].each {|hdr, libs|
|
||||
header_library = transact { check_header_library(hdr, libs) }
|
||||
if header_library
|
||||
break;
|
||||
end
|
||||
}
|
||||
|
||||
if header_library
|
||||
header, _ = header_library
|
||||
curses = [header]
|
||||
if header == 'curses_colr/curses.h'
|
||||
curses.unshift("varargs.h")
|
||||
end
|
||||
|
||||
if make
|
||||
for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash
|
||||
getbkgd getnstr init isendwin keyname keypad resizeterm
|
||||
scrl set setscrreg ungetch
|
||||
|
|
Loading…
Add table
Reference in a new issue