Commit 8aec7adc by Dane Springmeyer

add ability to configure against boost threads if requested

parent a5fe5d0a
...@@ -21,7 +21,7 @@ BUNDLED_SQLITE3_TAR = 'sqlite-autoconf-%s.tar.gz' % BUNDLED_SQLITE3_VERSION ...@@ -21,7 +21,7 @@ BUNDLED_SQLITE3_TAR = 'sqlite-autoconf-%s.tar.gz' % BUNDLED_SQLITE3_VERSION
SQLITE3_TARGET = 'deps/%s' % BUNDLED_SQLITE3 SQLITE3_TARGET = 'deps/%s' % BUNDLED_SQLITE3
sqlite3_test_program = ''' sqlite3_test_program = '''
#include "stdio.h" #include <stdio>"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -36,6 +36,16 @@ main() { ...@@ -36,6 +36,16 @@ main() {
} }
''' '''
boost_thread_test_program = '''
#include <boost/thread/mutex.hpp>
int
main() {
boost::mutex mutex_;
return 0;
}
'''
def set_options(opt): def set_options(opt):
opt.tool_options("compiler_cxx") opt.tool_options("compiler_cxx")
...@@ -46,6 +56,13 @@ def set_options(opt): ...@@ -46,6 +56,13 @@ def set_options(opt):
, dest='sqlite3_dir' , dest='sqlite3_dir'
) )
opt.add_option( '--with-boost'
, action='store'
, default=None
, help='Directory prefix containing boost "lib" and "include" files (default is to use pthreads not boost for threading support)'
, dest='boost_dir'
)
def _conf_exit(conf,msg): def _conf_exit(conf,msg):
conf.fatal('\n\n' + msg + '\n...check the build/config.log for details') conf.fatal('\n\n' + msg + '\n...check the build/config.log for details')
...@@ -75,10 +92,28 @@ def configure(conf): ...@@ -75,10 +92,28 @@ def configure(conf):
msg='Checking for libsqlite3 at %s' % lib, msg='Checking for libsqlite3 at %s' % lib,
includes=include): includes=include):
Utils.pprint('GREEN', 'Sweet, found viable sqlite3 dependency at: %s ' % o.sqlite3_dir) Utils.pprint('GREEN', 'Sweet, found viable sqlite3 dependency at: %s ' % o.sqlite3_dir)
else: else:
_conf_exit(conf,'sqlite3 libs/headers not found at %s' % o.sqlite3_dir) _conf_exit(conf,'sqlite3 libs/headers not found at %s' % o.sqlite3_dir)
linkflags = [] linkflags = []
if o.boost_dir:
lib, include = _build_paths(conf,o.boost_dir)
if conf.check_cxx(lib='boost_thread',
fragment=boost_thread_test_program,
uselib_store='SQLITE3',
libpath=lib,
msg='Checking for libboost_thread at %s' % lib,
includes=include):
Utils.pprint('GREEN', 'Sweet, found viable boost dependency at: %s ' % o.boost_dir)
conf.env.append_value("CXXFLAGS_SQLITE3", ['-DNODE_SQLITE3_BOOST_THREADING'])
else:
_conf_exit(conf,'boost libs/headers not found at %s' % o.boost_dir)
else:
conf.env.append_value("CXXFLAGS_SQLITE3", ["-pthread"])
if os.environ.has_key('LINKFLAGS'): if os.environ.has_key('LINKFLAGS'):
linkflags.extend(os.environ['LINKFLAGS'].split(' ')) linkflags.extend(os.environ['LINKFLAGS'].split(' '))
...@@ -128,7 +163,7 @@ def build(bld): ...@@ -128,7 +163,7 @@ def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon") obj = bld.new_task_gen("cxx", "shlib", "node_addon")
build_internal_sqlite3(bld) build_internal_sqlite3(bld)
obj.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", obj.cxxflags = ["-g", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE",
"-DSQLITE_ENABLE_RTREE=1", "-pthread", "-Wall"] "-DSQLITE_ENABLE_RTREE=1", "-Wall"]
# uncomment the next line to remove '-undefined dynamic_lookup' # uncomment the next line to remove '-undefined dynamic_lookup'
# in order to review linker errors (v8, libev/eio references can be ignored) # in order to review linker errors (v8, libev/eio references can be ignored)
#obj.env['LINKFLAGS_MACBUNDLE'] = ['-bundle'] #obj.env['LINKFLAGS_MACBUNDLE'] = ['-bundle']
......
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