]> git.notmuchmail.org Git - notmuch/blob - bindings/ruby/extconf.rb
6d5607e168228bf7c12949fe9bb10d0800629d4d
[notmuch] / bindings / ruby / extconf.rb
1 #!/usr/bin/env ruby
2 # coding: utf-8
3 # Copyright 2010, 2011, 2012 Ali Polatel <alip@exherbo.org>
4 # Distributed under the terms of the GNU General Public License v3
5
6 require 'mkmf'
7
8 dir = File.join('..', '..', 'lib')
9
10 # includes
11 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
12
13 if ENV['EXTRA_LDFLAGS']
14   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
15 end
16
17 def have_local_library(lib, path, func, headers = nil)
18   checking_for checking_message(func, lib) do
19     lib = File.join(path, lib)
20     if try_func(func, lib, headers)
21       $LOCAL_LIBS += lib
22     end
23   end
24 end
25
26 if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
27   exit 1
28 end
29
30 # Create Makefile
31 dir_config('notmuch')
32 create_makefile('notmuch')