mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Use header searcher to find readline and linenoise.
This commit is contained in:
@@ -3,7 +3,12 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec|
|
||||
spec.author = 'mruby developers'
|
||||
spec.summary = 'mirb command'
|
||||
|
||||
spec.linker.libraries << 'readline' if spec.cc.defines.include? "ENABLE_READLINE"
|
||||
if spec.build.cc.search_header_path 'readline/readline.h'
|
||||
spec.cc.defines << "ENABLE_READLINE"
|
||||
spec.linker.libraries << 'readline'
|
||||
elsif spec.build.cc.search_header_path 'linenoise.h'
|
||||
spec.cc.defines << "ENABLE_LINENOISE"
|
||||
end
|
||||
|
||||
spec.bins = %w(mirb)
|
||||
end
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define MIRB_WRITE_HISTORY(path) write_history(path)
|
||||
#define MIRB_READ_HISTORY(path) read_history(path)
|
||||
#define MIRB_USING_HISTORY() using_history()
|
||||
#elif ENABLE_LINENOISE
|
||||
#elif defined(ENABLE_LINENOISE)
|
||||
#define ENABLE_READLINE
|
||||
#include <linenoise.h>
|
||||
#define MIRB_ADD_HISTORY(line) linenoiseHistoryAdd(line)
|
||||
|
||||
Reference in New Issue
Block a user