Skip to content

Commit

Permalink
build: allow linking against system c-ares
Browse files Browse the repository at this point in the history
  • Loading branch information
sgallagher authored and bnoordhuis committed Nov 5, 2012
1 parent bfd78b6 commit 73ff653
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
35 changes: 35 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,26 @@ parser.add_option("--shared-http-parser-libname",
dest="shared_http_parser_libname",
help="Alternative lib name to link to (default: 'http_parser')")

parser.add_option("--shared-cares",
action="store_true",
dest="shared_cares",
help="Link to a shared cares DLL instead of static linking")

parser.add_option("--shared-cares-includes",
action="store",
dest="shared_cares_includes",
help="Directory containing cares header files")

parser.add_option("--shared-cares-libpath",
action="store",
dest="shared_cares_libpath",
help="A directory to search for the shared cares DLL")

parser.add_option("--shared-cares-libname",
action="store",
dest="shared_cares_libname",
help="Alternative lib name to link to (default: 'cares')")

parser.add_option("--with-dtrace",
action="store_true",
dest="with_dtrace",
Expand Down Expand Up @@ -456,6 +476,20 @@ def configure_http_parser(o):
o['include_dirs'] += [options.shared_http_parser_includes]


def configure_cares(o):
o['variables']['node_shared_cares'] = b(options.shared_cares)

# assume shared cares if one of these is set?
if options.shared_cares_libpath:
o['libraries'] += ['-L%s' % options.shared_cares_libpath]
if options.shared_cares_libname:
o['libraries'] += ['-l%s' % options.shared_cares_libname]
elif options.shared_cares:
o['libraries'] += ['-lcares']
if options.shared_cares_includes:
o['include_dirs'] += [options.shared_cares_includes]


def configure_v8(o):
o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
o['variables']['node_shared_v8'] = b(options.shared_v8)
Expand Down Expand Up @@ -510,6 +544,7 @@ output = {
configure_node(output)
configure_libz(output)
configure_http_parser(output)
configure_cares(output)
configure_v8(output)
configure_openssl(output)

Expand Down
1 change: 1 addition & 0 deletions doc/api/process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ An example of the possible output looks like:
{ host_arch: 'x64',
node_install_npm: 'true',
node_prefix: '',
node_shared_cares: 'false',
node_shared_http_parser: 'false',
node_shared_v8: 'false',
node_shared_zlib: 'false',
Expand Down
6 changes: 5 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'node_shared_v8%': 'false',
'node_shared_zlib%': 'false',
'node_shared_http_parser%': 'false',
'node_shared_cares%': 'false',
'node_use_openssl%': 'true',
'node_use_systemtap%': 'false',
'node_shared_openssl%': 'false',
Expand Down Expand Up @@ -59,7 +60,6 @@
'type': 'executable',

'dependencies': [
'deps/cares/cares.gyp:cares',
'deps/uv/uv.gyp:libuv',
'node_js2c#host',
],
Expand Down Expand Up @@ -205,6 +205,10 @@
'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
}],

[ 'node_shared_cares=="false"', {
'dependencies': [ 'deps/cares/cares.gyp:cares' ],
}],

[ 'OS=="win"', {
'sources': [
'src/res/node.rc',
Expand Down

0 comments on commit 73ff653

Please sign in to comment.