summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-20 12:09:25 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-20 12:09:25 +0000
commit9f6f0788d29e5883bd45f5f4e326e5a9ea9f12bf (patch)
tree48021d353525c35a263c57ae66d74f146612675e /ext
parentfaf4c9db80b12e590c38863604889032ea097711 (diff)
* 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
Diffstat (limited to 'ext')
-rw-r--r--ext/curses/extconf.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 5220b08d58..7c38bd9266 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -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 @@ headers = []
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