X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fruby%2Fextconf.rb;h=6d5607e168228bf7c12949fe9bb10d0800629d4d;hp=933f34a98db3e57d940bd39f68302843b6aa3d77;hb=53035dafe060f6832909ad54e48277c8d3bd2d1b;hpb=82b73ffd7380b85d259eeb91100dd6ac2d14223a diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb index 933f34a9..6d5607e1 100644 --- a/bindings/ruby/extconf.rb +++ b/bindings/ruby/extconf.rb @@ -5,27 +5,27 @@ require 'mkmf' -NOTDIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib')) -NOTHDR = File.join(NOTDIR, 'notmuch.h') -NOTLIB = File.join(NOTDIR, 'libnotmuch.a') +dir = File.join('..', '..', 'lib') -unless File.exists? NOTHDR - $stderr.puts "notmuch.h is missing under #{NOTDIR}" - exit 1 -end +# includes +$INCFLAGS = "-I#{dir} #{$INCFLAGS}" -unless File.exists? NOTLIB - $stderr.puts "libnotmuch.a is missing under #{NOTDIR}" - exit 1 +if ENV['EXTRA_LDFLAGS'] + $LDFLAGS += " " + ENV['EXTRA_LDFLAGS'] end -# Small hack to build with in-tree version not the installed one. -# find_header() and friends use standard include/library paths first. -$stderr.puts "Added -I#{NOTDIR} to $INCFLAGS" -$INCFLAGS = "-I#{NOTDIR}".quote + " " + $INCFLAGS -find_header('notmuch.h', NOTDIR) +def have_local_library(lib, path, func, headers = nil) + checking_for checking_message(func, lib) do + lib = File.join(path, lib) + if try_func(func, lib, headers) + $LOCAL_LIBS += lib + end + end +end -$LOCAL_LIBS += NOTLIB +if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h') + exit 1 +end # Create Makefile dir_config('notmuch')