Permalink
Browse files

* ext/curses/extconf.rb: restore $libs and $defs for each

  header/library choice.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent faf4c9d commit 9f6f0788d29e5883bd45f5f4e326e5a9ea9f12bf @akr akr committed Feb 20, 2012
Showing with 27 additions and 4 deletions.
  1. +5 −0 ChangeLog
  2. +22 −4 ext/curses/extconf.rb
View
@@ -1,3 +1,8 @@
+Mon Feb 20 21:08:00 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: restore $libs and $defs for each
+ header/library choice.
+
Mon Feb 20 19:57:26 2012 Tanaka Akira <akr@fsij.org>
* ext/dbm/extconf.rb: weaken header/library consistency check if db is
View
@@ -1,5 +1,16 @@
require 'mkmf'
+def transact
+ old_libs = $libs.dup
+ old_defs = $defs.dup
+ result = yield
+ if !result
+ $libs = old_libs
+ $defs = old_defs
+ end
+ result
+end
+
dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
@@ -9,14 +20,21 @@
have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
have_library("tinfo", "tgetent") or have_library("termcap", "tgetent")
-if have_header(*curses=%w"ncurses.h") and (have_library("ncursesw", "initscr") or have_library("ncurses", "initscr"))
+
+curses = nil
+if transact { have_header(*curses=%w"ncurses.h") and
+ (have_library("ncursesw", "initscr") or
+ have_library("ncurses", "initscr")) }
make=true
-elsif have_header(*curses=%w"ncurses/curses.h") and have_library("ncurses", "initscr")
+elsif transact { have_header(*curses=%w"ncurses/curses.h") and
+ have_library("ncurses", "initscr") }
make=true
-elsif have_header(*curses=%w"curses_colr/curses.h") and have_library("cur_colr", "initscr")
+elsif transact { have_header(*curses=%w"curses_colr/curses.h") and
+ have_library("cur_colr", "initscr") }
curses.unshift("varargs.h")
make=true
-elsif have_header(*curses=%w"curses.h") and have_library("curses", "initscr")
+elsif transact { have_header(*curses=%w"curses.h") and
+ have_library("curses", "initscr") }
make=true
end

0 comments on commit 9f6f078

Please sign in to comment.