Commit 052fe512 authored by take_cheeze's avatar take_cheeze

Use header searcher to find readline and linenoise.

parent b4a702f2
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment