]> git.notmuchmail.org Git - notmuch/blob - bindings/ruby/extconf.rb
ruby: use in-tree notmuch library
[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 # make sure there are no undefined symbols
14 $LDFLAGS += ' -Wl,--no-undefined'
15
16 def have_local_library(lib, path, func, headers = nil)
17   checking_for checking_message(func, lib) do
18     lib = File.join(path, lib)
19     if try_func(func, lib, headers)
20       $LOCAL_LIBS += lib
21     end
22   end
23 end
24
25 if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
26   exit 1
27 end
28
29 # Create Makefile
30 dir_config('notmuch')
31 create_makefile('notmuch')