Merge branch 'v0.10'
[platform/upstream/nodejs.git] / configure
index a37f7dd..b950bdc 100755 (executable)
--- a/configure
+++ b/configure
@@ -54,11 +54,6 @@ parser.add_option('--no-ifaddrs',
     dest='no_ifaddrs',
     help='use on deprecated SunOS systems that do not support ifaddrs.h')
 
-parser.add_option('--no-ssl2',
-    action='store_true',
-    dest='no_ssl2',
-    help='disable OpenSSL v2')
-
 # deprecated
 parser.add_option('--openssl-includes',
     action='store',
@@ -225,11 +220,21 @@ parser.add_option('--with-etw',
     dest='with_etw',
     help='build with ETW (default is true on Windows)')
 
+parser.add_option('--with-icu-path',
+    action='store',
+    dest='with_icu_path',
+    help='Path to icu.gyp (ICU i18n, Chromium version only.)')
+
 parser.add_option('--with-perfctr',
     action='store_true',
     dest='with_perfctr',
     help='build with performance counters (default is true on Windows)')
 
+parser.add_option('--with-sslv2',
+    action='store_true',
+    dest='with_sslv2',
+    help='enable SSL v2')
+
 parser.add_option('--without-dtrace',
     action='store_true',
     dest='without_dtrace',
@@ -406,13 +411,15 @@ def host_arch_win():
 
 def compiler_version():
   try:
-    proc = subprocess.Popen(shlex.split(CC) + ['--version'], stdout=subprocess.PIPE)
+    proc = subprocess.Popen(shlex.split(CC) + ['--version'],
+                            stdout=subprocess.PIPE)
   except WindowsError:
     return (0, False)
 
   is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
 
-  proc = subprocess.Popen(shlex.split(CC) + ['-dumpversion'], stdout=subprocess.PIPE)
+  proc = subprocess.Popen(shlex.split(CC) + ['-dumpversion'],
+                          stdout=subprocess.PIPE)
   version = tuple(map(int, proc.communicate()[0].split('.')))
 
   return (version, is_clang)
@@ -421,8 +428,10 @@ def compiler_version():
 def configure_arm(o):
   if options.arm_float_abi:
     arm_float_abi = options.arm_float_abi
+  elif is_arm_hard_float_abi():
+    arm_float_abi = 'hard'
   else:
-    arm_float_abi = 'hard' if is_arm_hard_float_abi() else 'default'
+    'default'
   o['variables']['armv7'] = int(is_arch_armv7())
   o['variables']['arm_fpu'] = 'vfpv3'  # V8 3.18 no longer supports VFP2.
   o['variables']['arm_neon'] = int(is_arm_neon())
@@ -432,9 +441,7 @@ def configure_arm(o):
 
 def configure_node(o):
   if options.dest_os == 'android':
-    o['variables']['OS'] = "android"
-  o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
-  o['variables']['v8_no_strict_aliasing'] = 1 # work around compiler bugs
+    o['variables']['OS'] = 'android'
   o['variables']['node_prefix'] = os.path.expanduser(options.prefix or '')
   o['variables']['node_install_npm'] = b(not options.without_npm)
   o['default_configuration'] = 'Debug' if options.debug else 'Release'
@@ -457,24 +464,21 @@ def configure_node(o):
   if not is_clang and cc_version < (4,0,0):
     o['variables']['visibility'] = ''
 
-  # By default, enable DTrace on SunOS systems. Don't allow it on other
-  # systems, since it won't work.  (The MacOS build process is different than
-  # SunOS, and we haven't implemented it.)
-  if flavor in ('solaris', 'mac'):
-    o['variables']['node_use_dtrace'] = b(not options.without_dtrace)
-    o['variables']['uv_use_dtrace'] = o['variables']['node_use_dtrace']
+  if flavor in ('solaris', 'mac', 'linux'):
+    use_dtrace = not options.without_dtrace
+    # Don't enable by default on linux, it needs the sdt-devel package.
+    if flavor == 'linux':
+      if options.systemtap_includes:
+        o['include_dirs'] += [options.systemtap_includes]
+      use_dtrace = options.with_dtrace
+    o['variables']['node_use_dtrace'] = b(use_dtrace)
+    o['variables']['uv_use_dtrace'] = b(use_dtrace)
     o['variables']['uv_parent_path'] = '/deps/uv/'
-  elif flavor == 'linux':
-    o['variables']['node_use_dtrace'] = 'false'
-    o['variables']['node_use_systemtap'] = b(options.with_dtrace)
-    if options.systemtap_includes:
-      o['include_dirs'] += [options.systemtap_includes]
   elif options.with_dtrace:
     raise Exception(
        'DTrace is currently only supported on SunOS, MacOS or Linux systems.')
   else:
     o['variables']['node_use_dtrace'] = 'false'
-    o['variables']['node_use_systemtap'] = 'false'
 
   # if we're on illumos based systems wrap the helper library into the
   # executable
@@ -488,7 +492,7 @@ def configure_node(o):
 
   # By default, enable ETW on Windows.
   if flavor == 'win':
-    o['variables']['node_use_etw'] = b(not options.without_etw);
+    o['variables']['node_use_etw'] = b(not options.without_etw)
   elif options.with_etw:
     raise Exception('ETW is only supported on Windows.')
   else:
@@ -496,7 +500,7 @@ def configure_node(o):
 
   # By default, enable Performance counters on Windows.
   if flavor == 'win':
-    o['variables']['node_use_perfctr'] = b(not options.without_perfctr);
+    o['variables']['node_use_perfctr'] = b(not options.without_perfctr)
   elif options.with_perfctr:
     raise Exception('Performance counter is only supported on Windows.')
   else:
@@ -565,8 +569,12 @@ def configure_libuv(o):
 
 
 def configure_v8(o):
-  o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
   o['variables']['node_shared_v8'] = b(options.shared_v8)
+  o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
+  o['variables']['v8_no_strict_aliasing'] = 1  # Work around compiler bugs.
+  o['variables']['v8_optimized_debug'] = 0  # Compile with -O0 in debug builds.
+  o['variables']['v8_random_seed'] = 0  # Use a random seed for hash tables.
+  o['variables']['v8_use_snapshot'] = b(not options.without_snapshot)
 
   # assume shared_v8 if one of these is set?
   if options.shared_v8_libpath:
@@ -586,7 +594,9 @@ def configure_openssl(o):
   if options.without_ssl:
     return
 
-  if options.no_ssl2:
+  # OpenSSL uses `#ifndef OPENSSL_NO_SSL2` checks so only define the
+  # macro when we want to _disable_ SSL2.
+  if not options.with_sslv2:
     o['defines'] += ['OPENSSL_NO_SSL2=1']
 
   if options.shared_openssl:
@@ -611,22 +621,31 @@ def configure_winsdk(o):
   if flavor != 'win':
     return
 
-  winsdk_dir = os.environ.get("WindowsSdkDir")
+  winsdk_dir = os.environ.get('WindowsSdkDir')
 
   if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\ctrpp.exe'):
-    print "Found ctrpp in WinSDK--will build generated files into tools/msvs/genfiles."
+    print('Found ctrpp in WinSDK--will build generated files '
+          'into tools/msvs/genfiles.')
     o['variables']['node_has_winsdk'] = 'true'
     return
 
-  print "ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles."
+  print('ctrpp not found in WinSDK path--using pre-gen files '
+        'from tools/msvs/genfiles.')
+
+
+def configure_icu(o):
+  have_icu_path = bool(options.with_icu_path)
+  o['variables']['v8_enable_i18n_support'] = int(have_icu_path)
+  if have_icu_path:
+    o['variables']['icu_gyp_path'] = options.with_icu_path
 
 
 # determine the "flavor" (operating system) we're building for,
 # leveraging gyp's GetFlavor function
-flavor_params = {};
+flavor_params = {}
 if (options.dest_os):
-  flavor_params['flavor'] = options.dest_os;
-flavor = GetFlavor(flavor_params);
+  flavor_params['flavor'] = options.dest_os
+flavor = GetFlavor(flavor_params)
 
 output = {
   'variables': { 'python': sys.executable },
@@ -644,7 +663,7 @@ configure_libuv(output)
 configure_v8(output)
 configure_openssl(output)
 configure_winsdk(output)
-
+configure_icu(output)
 
 # variables should be a root level element,
 # move everything else to target_defaults
@@ -658,12 +677,12 @@ pprint.pprint(output, indent=2)
 
 def write(filename, data):
   filename = os.path.join(root_dir, filename)
-  print "creating ", filename
+  print 'creating ', filename
   f = open(filename, 'w+')
   f.write(data)
 
-write('config.gypi', "# Do not edit. Generated by the configure script.\n" +
-  pprint.pformat(output, indent=2) + "\n")
+write('config.gypi', '# Do not edit. Generated by the configure script.\n' +
+      pprint.pformat(output, indent=2) + '\n')
 
 config = {
   'BUILDTYPE': 'Debug' if options.debug else 'Release',
@@ -680,13 +699,17 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n'
 write('config.mk',
       '# Do not edit. Generated by the configure script.\n' + config)
 
+gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel']
+
 if options.use_ninja:
-  gyp_args = ['-f', 'ninja-' + flavor]
+  gyp_args += ['-f', 'ninja-' + flavor]
 elif options.use_xcode:
-  gyp_args = ['-f', 'xcode']
+  gyp_args += ['-f', 'xcode']
 elif flavor == 'win':
-  gyp_args = ['-f', 'msvs', '-G', 'msvs_version=auto']
+  gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto']
 else:
-  gyp_args = ['-f', 'make-' + flavor]
+  gyp_args += ['-f', 'make-' + flavor]
+
+gyp_args += args
 
-subprocess.call([sys.executable, 'tools/gyp_node'] + gyp_args)
+subprocess.call(gyp_args)