summaryrefslogtreecommitdiff
blob: c57eef0815bf014bd01c58921ca10f2d2439bc8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
diff --git configure configure
index 67440a2..2a3b05f 100755
--- configure
+++ configure
@@ -326,12 +326,13 @@ def b(value):
 
 
 def pkg_config(pkg):
-  cmd = os.popen('pkg-config --libs %s' % pkg, 'r')
+  pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
+  cmd = os.popen(pkg_config + ' --libs %s' % pkg, 'r')
   libs = cmd.readline().strip()
   ret = cmd.close()
   if (ret): return None
 
-  cmd = os.popen('pkg-config --cflags %s' % pkg, 'r')
+  cmd = os.popen(pkg_config + ' --cflags %s' % pkg, 'r')
   cflags = cmd.readline().strip()
   ret = cmd.close()
   if (ret): return None
@@ -603,14 +604,21 @@ def configure_node(o):
 
 def configure_libz(o):
   o['variables']['node_shared_zlib'] = b(options.shared_zlib)
+  if b(options.shared_zlib) == 'true':
+    (libs, cflags) = pkg_config('zlib') or ('-lz', '')
 
-  if b(options.shared_zlib) == True:
-    o['libraries'] += ['-l%s' % options.shared_zlib_libname]
-  if options.shared_zlib_libpath:
-    o['libraries'] += ['-L%s' % options.shared_zlib_libpath]
-  if options.shared_zlib_includes:
-    o['include_dirs'] += [options.shared_zlib_includes]
+    if options.shared_zlib_libpath:
+      o['libraries'] += ['-L%s' % options.shared_zlib_libpath]
 
+    if options.shared_zlib_libname:
+      o['libraries'] += ['-l%s' % options.shared_zlib_libname]
+    else:
+      o['libraries'] += libs.split()
+
+    if options.shared_zlib_includes:
+      o['include_dirs'] += [options.shared_zlib_includes]
+    else:
+      o['cflags'] += cflags.split()
 
 def configure_http_parser(o):
     o['variables']['node_shared_http_parser'] = b(options.shared_http_parser)