[tests] skip mod-secdownload HMAC-SHA1,HMAC-SHA256
[lighttpd.git] / SConstruct
blobc286aed7d178025b994e95f797e7dfb0753cffdc
1 from __future__ import print_function
2 import os
3 import re
4 import string
5 import sys
6 from copy import copy
7 from stat import *
9 try:
10 string_types = basestring
11 except NameError:
12 string_types = str
14 package = 'lighttpd'
15 version = '1.4.54'
17 underscorify_reg = re.compile('[^A-Z0-9]')
18 def underscorify(id):
19 return underscorify_reg.sub('_', id.upper())
21 def fail(*args, **kwargs):
22 print(*args, file=sys.stderr, **kwargs)
23 sys.exit(-1)
25 class Autoconf:
26 class RestoreEnvLibs:
27 def __init__(self, env):
28 self.env = env
29 self.active = False
31 def __enter__(self):
32 if self.active:
33 raise Exception('entered twice')
34 self.active = True
35 if 'LIBS' in self.env:
36 #print("Backup LIBS: " + repr(self.env['LIBS']))
37 self.empty = False
38 self.backup_libs = copy(self.env['LIBS'])
39 else:
40 #print("No LIBS to backup")
41 self.empty = True
43 def __exit__(self, type, value, traceback):
44 if not self.active:
45 raise Exception('exited twice')
46 self.active = False
47 if self.empty:
48 if 'LIBS' in self.env:
49 del self.env['LIBS']
50 else:
51 #print("Restoring LIBS, now: " + repr(self.env['LIBS']))
52 self.env['LIBS'] = self.backup_libs
53 #print("Restoring LIBS, to: " + repr(self.env['LIBS']))
55 def __init__(self, env):
56 self.conf = Configure(env, custom_tests = {
57 'CheckGmtOffInStructTm': Autoconf.__checkGmtOffInStructTm,
58 'CheckIPv6': Autoconf.__checkIPv6,
59 'CheckWeakSymbols': Autoconf.__checkWeakSymbols,
62 def append(self, *args, **kw):
63 return self.conf.env.Append(*args, **kw)
65 def Finish(self):
66 return self.conf.Finish()
68 @property
69 def env(self):
70 return self.conf.env
72 def restoreEnvLibs(self):
73 return Autoconf.RestoreEnvLibs(self.conf.env)
75 def CheckType(self, *args, **kw):
76 return self.conf.CheckType(*args, **kw)
78 def CheckLib(self, *args, **kw):
79 return self.conf.CheckLib(*args, autoadd = 0, **kw)
81 def CheckLibWithHeader(self, *args, **kw):
82 return self.conf.CheckLibWithHeader(*args, autoadd = 0, **kw)
84 def CheckGmtOffInStructTm(self):
85 return self.conf.CheckGmtOffInStructTm()
87 def CheckIPv6(self):
88 return self.conf.CheckIPv6()
90 def CheckWeakSymbols(self):
91 return self.conf.CheckWeakSymbols()
93 def CheckCHeader(self, hdr):
94 return self.conf.CheckCHeader(hdr)
96 def haveCHeader(self, hdr):
97 if self.CheckCHeader(hdr):
98 # if we have a list of headers define HAVE_ only for last one
99 target = hdr
100 if not isinstance(target, string_types):
101 target = target[-1]
102 self.conf.env.Append(CPPFLAGS = [ '-DHAVE_' + underscorify(target) ])
103 return True
104 return False
106 def haveCHeaders(self, hdrs):
107 for hdr in hdrs:
108 self.haveCHeader(hdr)
110 def CheckFunc(self, func, header = None, libs = []):
111 with self.restoreEnvLibs():
112 self.env.Append(LIBS = libs)
113 return self.conf.CheckFunc(func, header = header)
115 def CheckFuncInLib(self, func, lib):
116 return self.CheckFunc(func, libs = [lib])
118 def haveFuncInLib(self, func, lib):
119 if self.CheckFuncInLib(func, lib):
120 self.conf.env.Append(CPPFLAGS = [ '-DHAVE_' + underscorify(func) ])
121 return True
122 return False
124 def haveFunc(self, func, header = None, libs = []):
125 if self.CheckFunc(func, header = header, libs = libs):
126 self.conf.env.Append(CPPFLAGS = [ '-DHAVE_' + underscorify(func) ])
127 return True
128 return False
130 def haveFuncs(self, funcs):
131 for func in funcs:
132 self.haveFunc(func)
134 def haveTypes(self, types):
135 for type in types:
136 if self.conf.CheckType(type, '#include <sys/types.h>'):
137 self.conf.env.Append(CPPFLAGS = [ '-DHAVE_' + underscorify(type) ])
139 def CheckParseConfig(self, *args, **kw):
140 try:
141 self.conf.env.ParseConfig(*args, **kw)
142 return True
143 except Exception as e:
144 print(e.message, file=sys.stderr)
145 return False
147 def CheckParseConfigForLib(self, lib, *args, **kw):
148 with self.restoreEnvLibs():
149 self.env['LIBS'] = []
150 if not self.CheckParseConfig(*args, **kw):
151 return False
152 self.env.Append(**{lib: self.env['LIBS']})
153 return True
155 @staticmethod
156 def __checkGmtOffInStructTm(context):
157 source = """
158 #include <time.h>
159 int main() {
160 struct tm a;
161 a.tm_gmtoff = 0;
162 return 0;
165 context.Message('Checking for tm_gmtoff in struct tm...')
166 result = context.TryLink(source, '.c')
167 context.Result(result)
169 return result
171 @staticmethod
172 def __checkIPv6(context):
173 source = """
174 #include <sys/types.h>
175 #include <sys/socket.h>
176 #include <netinet/in.h>
178 int main() {
179 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;
180 return 0;
183 context.Message('Checking for IPv6 support...')
184 result = context.TryLink(source, '.c')
185 context.Result(result)
187 return result
189 @staticmethod
190 def __checkWeakSymbols(context):
191 source = """
192 __attribute__((weak)) void __dummy(void *x) { }
193 int main() {
194 void *x;
195 __dummy(x);
198 context.Message('Checking for weak symbol support...')
199 result = context.TryLink(source, '.c')
200 context.Result(result)
202 return result
204 def checkProgram(self, withname, progname):
205 withname = 'with_' + withname
206 binpath = None
208 if self.env[withname] != 1:
209 binpath = self.env[withname]
210 else:
211 prog = self.env.Detect(progname)
212 if prog:
213 binpath = self.env.WhereIs(prog)
215 if binpath:
216 mode = os.stat(binpath)[ST_MODE]
217 if S_ISDIR(mode):
218 fail("* error: path `%s' is a directory" % (binpath))
219 if not S_ISREG(mode):
220 fail("* error: path `%s' is not a file or not exists" % (binpath))
222 if not binpath:
223 fail("* error: can't find program `%s'" % (progname))
225 return binpath
227 VariantDir('sconsbuild/build', 'src', duplicate = 0)
228 VariantDir('sconsbuild/tests', 'tests', duplicate = 0)
230 vars = Variables()
231 vars.AddVariables(
232 ('prefix', 'prefix', '/usr/local'),
233 ('bindir', 'binary directory', '${prefix}/bin'),
234 ('sbindir', 'binary directory', '${prefix}/sbin'),
235 ('libdir', 'library directory', '${prefix}/lib'),
236 PathVariable('CC', 'path to the c-compiler', None),
237 BoolVariable('build_dynamic', 'enable dynamic build', 'yes'),
238 BoolVariable('build_static', 'enable static build', 'no'),
239 BoolVariable('build_fullstatic', 'enable fullstatic build', 'no'),
241 BoolVariable('with_bzip2', 'enable bzip2 compression', 'no'),
242 PackageVariable('with_dbi', 'enable dbi support', 'no'),
243 BoolVariable('with_fam', 'enable FAM/gamin support', 'no'),
244 BoolVariable('with_gdbm', 'enable gdbm support', 'no'),
245 BoolVariable('with_geoip', 'enable GeoIP support', 'no'),
246 BoolVariable('with_krb5', 'enable krb5 auth support', 'no'),
247 BoolVariable('with_ldap', 'enable ldap auth support', 'no'),
248 # with_libev not supported
249 # with_libunwind not supported
250 BoolVariable('with_lua', 'enable lua support for mod_cml', 'no'),
251 BoolVariable('with_memcached', 'enable memcached support', 'no'),
252 PackageVariable('with_mysql', 'enable mysql support', 'no'),
253 BoolVariable('with_openssl', 'enable openssl support', 'no'),
254 PackageVariable('with_wolfssl', 'enable wolfSSL support', 'no'),
255 BoolVariable('with_pam', 'enable PAM auth support', 'no'),
256 PackageVariable('with_pcre', 'enable pcre support', 'yes'),
257 PackageVariable('with_pgsql', 'enable pgsql support', 'no'),
258 PackageVariable('with_sasl', 'enable SASL support', 'no'),
259 BoolVariable('with_sqlite3', 'enable sqlite3 support (required for webdav props)', 'no'),
260 BoolVariable('with_uuid', 'enable uuid support (required for webdav locks)', 'no'),
261 # with_valgrind not supported
262 # with_xattr not supported
263 PackageVariable('with_xml', 'enable xml support (required for webdav props)', 'no'),
264 BoolVariable('with_zlib', 'enable deflate/gzip compression', 'no'),
266 BoolVariable('with_all', 'enable all with_* features', 'no'),
269 env = Environment(
270 ENV = os.environ,
271 variables = vars,
272 CPPPATH = Split('#sconsbuild/build')
275 env.Help(vars.GenerateHelpText(env))
277 if env.subst('${CC}') is not '':
278 env['CC'] = env.subst('${CC}')
280 env['package'] = package
281 env['version'] = version
282 if env['CC'] == 'gcc':
283 ## we need x-open 6 and bsd 4.3 features
284 env.Append(CCFLAGS = Split('-Wall -O2 -g -W -pedantic -Wunused -Wshadow -std=gnu99'))
286 env.Append(CPPFLAGS = [
287 '-D_FILE_OFFSET_BITS=64',
288 '-D_LARGEFILE_SOURCE',
289 '-D_LARGE_FILES',
290 '-D_GNU_SOURCE',
293 if env['with_all']:
294 for feature in vars.keys():
295 # only enable 'with_*' flags
296 if not feature.startswith('with_'): continue
297 # don't overwrite manual arguments
298 if feature in vars.args: continue
299 # now activate
300 env[feature] = True
302 # cache configure checks
303 if 1:
304 autoconf = Autoconf(env)
306 if 'CFLAGS' in os.environ:
307 autoconf.env.Append(CCFLAGS = os.environ['CFLAGS'])
308 print(">> Appending custom build flags : " + os.environ['CFLAGS'])
310 if 'LDFLAGS' in os.environ:
311 autoconf.env.Append(LINKFLAGS = os.environ['LDFLAGS'])
312 print(">> Appending custom link flags : " + os.environ['LDFLAGS'])
314 if 'LIBS' in os.environ:
315 autoconf.env.Append(APPEND_LIBS = os.environ['LIBS'])
316 print(">> Appending custom libraries : " + os.environ['LIBS'])
317 else:
318 autoconf.env.Append(APPEND_LIBS = '')
320 autoconf.env.Append(
321 LIBBZ2 = '',
322 LIBCRYPT = '',
323 LIBCRYPTO = '',
324 LIBDBI = '',
325 LIBDL = '',
326 LIBFCGI = '',
327 LIBGDBM = '',
328 LIBGSSAPI_KRB5 = '',
329 LIBKRB5 = '',
330 LIBLBER = '',
331 LIBLDAP = '',
332 LIBLUA = '',
333 LIBMEMCACHED = '',
334 LIBMYSQL = '',
335 LIBPAM = '',
336 LIBPCRE = '',
337 LIBPGSQL = '',
338 LIBSASL = '',
339 LIBSQLITE3 = '',
340 LIBSSL = '',
341 LIBUUID = '',
342 LIBXML2 = '',
343 LIBZ = '',
346 autoconf.haveCHeaders([
347 'arpa/inet.h',
348 'crypt.h',
349 'fcntl.h',
350 'getopt.h',
351 'inttypes.h',
352 'linux/random.h',
353 'poll.h',
354 'pwd.h',
355 'stdint.h',
356 'stdlib.h',
357 'string.h',
358 'strings.h',
359 'sys/devpoll.h',
360 'sys/epoll.h',
361 'sys/filio.h',
362 'sys/poll.h',
363 'sys/port.h',
364 'sys/prctl.h',
365 'sys/sendfile.h',
366 'sys/time.h',
367 'sys/wait.h',
368 'syslog.h',
369 'unistd.h',
370 'winsock2.h',
372 # "have" the last header if we include others before?
373 ['sys/types.h', 'sys/time.h', 'sys/resource.h'],
374 ['sys/types.h', 'netinet/in.h'],
375 ['sys/types.h', 'sys/event.h'],
376 ['sys/types.h', 'sys/mman.h'],
377 ['sys/types.h', 'sys/select.h'],
378 ['sys/types.h', 'sys/socket.h'],
379 ['sys/types.h', 'sys/uio.h'],
380 ['sys/types.h', 'sys/un.h'],
383 autoconf.haveFuncs([
384 'arc4random_buf',
385 'chroot',
386 'clock_gettime',
387 'dup2',
388 'epoll_ctl',
389 'explicit_bzero',
390 'fork',
391 'getcwd',
392 'gethostbyname',
393 'getloadavg',
394 'getopt',
395 'getrlimit',
396 'getuid',
397 'inet_ntoa',
398 'inet_ntop',
399 'inet_pton',
400 'issetugid',
401 'jrand48',
402 'kqueue',
403 'localtime_r',
404 'lstat',
405 'madvise',
406 'memset_s',
407 'memset',
408 'mmap',
409 'munmap',
410 'pathconf',
411 'pipe2',
412 'poll',
413 'port_create',
414 'posix_fadvise',
415 'prctl',
416 'select',
417 'send_file',
418 'sendfile',
419 'sendfile64',
420 'sigaction',
421 'signal',
422 'socket',
423 'srandom',
424 'stat',
425 'strchr',
426 'strdup',
427 'strerror',
428 'strftime',
429 'strstr',
430 'strtol',
431 'writev',
433 autoconf.haveFunc('getentropy', 'sys/random.h')
434 autoconf.haveFunc('getrandom', 'linux/random.h')
436 autoconf.haveTypes(Split('pid_t size_t off_t'))
438 # have crypt_r/crypt, and is -lcrypt needed?
439 if autoconf.CheckLib('crypt'):
440 autoconf.env.Append(
441 CPPFLAGS = [ '-DHAVE_LIBCRYPT' ],
442 LIBCRYPT = 'crypt',
444 with autoconf.restoreEnvLibs():
445 autoconf.env['LIBS'] = ['crypt']
446 autoconf.haveFuncs(['crypt', 'crypt_r'])
447 else:
448 autoconf.haveFuncs(['crypt', 'crypt_r'])
450 if autoconf.CheckType('socklen_t', '#include <unistd.h>\n#include <sys/socket.h>\n#include <sys/types.h>'):
451 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_SOCKLEN_T' ])
453 if autoconf.CheckType('struct sockaddr_storage', '#include <sys/socket.h>\n'):
454 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_SOCKADDR_STORAGE' ])
456 if autoconf.CheckLibWithHeader('elftc', 'libelftc.h', 'c', 'elftc_copyfile(0, 1);'):
457 autoconf.env.Append(
458 CPPFLAGS = [ '-DHAVE_ELFTC_COPYFILE' ],
459 LIBS = [ 'elftc' ],
462 if autoconf.CheckLibWithHeader('rt', 'time.h', 'c', 'clock_gettime(CLOCK_MONOTONIC, (struct timespec*)0);'):
463 autoconf.env.Append(
464 CPPFLAGS = [ '-DHAVE_CLOCK_GETTIME' ],
465 LIBS = [ 'rt' ],
468 if autoconf.CheckIPv6():
469 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_IPV6' ])
471 if autoconf.CheckWeakSymbols():
472 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_WEAK_SYMBOLS' ])
474 if autoconf.CheckGmtOffInStructTm():
475 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_TM_GMTOFF' ])
477 if autoconf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'):
478 autoconf.env.Append(LIBDL = 'dl')
480 # used in tests if present
481 if autoconf.CheckLibWithHeader('fcgi', 'fastcgi.h', 'C'):
482 autoconf.env.Append(LIBFCGI = 'fcgi')
484 if env['with_bzip2']:
485 if not autoconf.CheckLibWithHeader('bz2', 'bzlib.h', 'C'):
486 fail("Couldn't find bz2")
487 autoconf.env.Append(
488 CPPFLAGS = [ '-DHAVE_BZLIB_H', '-DHAVE_LIBBZ2' ],
489 LIBBZ2 = 'bz2',
492 if env['with_dbi']:
493 if not autoconf.CheckLibWithHeader('dbi', 'dbi/dbi.h', 'C'):
494 fail("Couldn't find dbi")
495 autoconf.env.Append(
496 CPPFLAGS = [ '-DHAVE_DBI_H', '-DHAVE_LIBDBI' ],
497 LIBDBI = 'dbi',
500 if env['with_fam']:
501 if not autoconf.CheckLibWithHeader('fam', 'fam.h', 'C'):
502 fail("Couldn't find fam")
503 autoconf.env.Append(
504 CPPFLAGS = [ '-DHAVE_FAM_H', '-DHAVE_LIBFAM' ],
505 LIBS = [ 'fam' ],
507 autoconf.haveFunc('FAMNoExists')
509 if env['with_gdbm']:
510 if not autoconf.CheckLibWithHeader('gdbm', 'gdbm.h', 'C'):
511 fail("Couldn't find gdbm")
512 autoconf.env.Append(
513 CPPFLAGS = [ '-DHAVE_GDBM_H', '-DHAVE_GDBM' ],
514 LIBGDBM = 'gdbm',
517 if env['with_geoip']:
518 if not autoconf.CheckLibWithHeader('GeoIP', 'GeoIP.h', 'C'):
519 fail("Couldn't find geoip")
520 autoconf.env.Append(
521 CPPFLAGS = [ '-DHAVE_GEOIP' ],
522 LIBGEOIP = 'GeoIP',
525 if env['with_krb5']:
526 if not autoconf.CheckLibWithHeader('krb5', 'krb5.h', 'C'):
527 fail("Couldn't find krb5")
528 if not autoconf.CheckLibWithHeader('gssapi_krb5', 'gssapi/gssapi_krb5.h', 'C'):
529 fail("Couldn't find gssapi_krb5")
530 autoconf.env.Append(
531 CPPFLAGS = [ '-DHAVE_KRB5' ],
532 LIBKRB5 = 'krb5',
533 LIBGSSAPI_KRB5 = 'gssapi_krb5',
536 if env['with_ldap']:
537 if not autoconf.CheckLibWithHeader('ldap', 'ldap.h', 'C'):
538 fail("Couldn't find ldap")
539 if not autoconf.CheckLibWithHeader('lber', 'lber.h', 'C'):
540 fail("Couldn't find lber")
541 autoconf.env.Append(
542 CPPFLAGS = [
543 '-DHAVE_LDAP_H', '-DHAVE_LIBLDAP',
544 '-DHAVE_LBER_H', '-DHAVE_LIBLBER',
546 LIBLDAP = 'ldap',
547 LIBLBER = 'lber',
550 if env['with_lua']:
551 found_lua = False
552 for lua_name in ['lua5.3', 'lua-5.3', 'lua5.2', 'lua-5.2', 'lua5.1', 'lua-5.1', 'lua']:
553 print("Searching for lua: " + lua_name + " >= 5.0")
554 if autoconf.CheckParseConfigForLib('LIBLUA', "pkg-config '" + lua_name + " >= 5.0' --cflags --libs"):
555 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LUA_H' ])
556 found_lua = True
557 break
558 if not found_lua:
559 fail("Couldn't find any lua implementation")
561 if env['with_memcached']:
562 if not autoconf.CheckLibWithHeader('memcached', 'libmemcached/memcached.h', 'C'):
563 fail("Couldn't find memcached")
564 autoconf.env.Append(
565 CPPFLAGS = [ '-DUSE_MEMCACHED' ],
566 LIBMEMCACHED = 'memcached',
569 if env['with_mysql']:
570 mysql_config = autoconf.checkProgram('mysql', 'mysql_config')
571 if not autoconf.CheckParseConfigForLib('LIBMYSQL', mysql_config + ' --cflags --libs'):
572 fail("Couldn't find mysql")
573 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_MYSQL_H', '-DHAVE_LIBMYSQL' ])
575 if env['with_openssl']:
576 if not autoconf.CheckLibWithHeader('ssl', 'openssl/ssl.h', 'C'):
577 fail("Couldn't find openssl")
578 autoconf.env.Append(
579 CPPFLAGS = [ '-DHAVE_OPENSSL_SSL_H', '-DHAVE_LIBSSL'],
580 LIBSSL = 'ssl',
581 LIBCRYPTO = 'crypto',
584 if env['with_wolfssl']:
585 if type(env['with_wolfssl']) is str:
586 autoconf.env.AppendUnique(
587 CPPPATH = [ env['with_wolfssl'] + '/include',
588 env['with_wolfssl'] + '/include/wolfssl' ],
589 LIBPATH = [ env['with_wolfssl'] + '/lib' ],
591 if not autoconf.CheckLibWithHeader('wolfssl', 'wolfssl/ssl.h', 'C'):
592 fail("Couldn't find wolfssl")
593 autoconf.env.Append(
594 CPPFLAGS = [ '-DHAVE_WOLFSSL_SSL_H' ],
595 LIBSSL = '',
596 LIBCRYPTO = 'wolfssl',
599 if env['with_pam']:
600 if not autoconf.CheckLibWithHeader('pam', 'security/pam_appl.h', 'C'):
601 fail("Couldn't find pam")
602 autoconf.env.Append(
603 CPPFLAGS = [ '-DHAVE_PAM' ],
604 LIBPAM = 'pam',
607 if env['with_pcre']:
608 pcre_config = autoconf.checkProgram('pcre', 'pcre-config')
609 if not autoconf.CheckParseConfigForLib('LIBPCRE', pcre_config + ' --cflags --libs'):
610 fail("Couldn't find pcre")
611 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_PCRE_H', '-DHAVE_LIBPCRE' ])
613 if env['with_pgsql']:
614 if not autoconf.CheckParseConfigForLib('LIBPGSQL', 'pkg-config libpq --cflags --libs'):
615 fail("Couldn't find libpq")
616 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_PGSQL_H', '-DHAVE_LIBPGSQL' ])
618 if env['with_sasl']:
619 if not autoconf.CheckLibWithHeader('sasl2', 'sasl/sasl.h', 'C'):
620 fail("Couldn't find libsasl2")
621 autoconf.env.Append(
622 CPPFLAGS = [ '-DHAVE_SASL' ],
623 LIBSASL = 'sasl2',
626 if env['with_sqlite3']:
627 if not autoconf.CheckLibWithHeader('sqlite3', 'sqlite3.h', 'C'):
628 fail("Couldn't find sqlite3")
629 autoconf.env.Append(
630 CPPFLAGS = [ '-DHAVE_SQLITE3_H', '-DHAVE_LIBSQLITE3' ],
631 LIBSQLITE3 = 'sqlite3',
634 if env['with_uuid']:
635 if not autoconf.CheckLibWithHeader('uuid', 'uuid/uuid.h', 'C'):
636 fail("Couldn't find uuid")
637 autoconf.env.Append(
638 CPPFLAGS = [ '-DHAVE_UUID_UUID_H', '-DHAVE_LIBUUID' ],
639 LIBUUID = 'uuid',
642 if env['with_xml']:
643 xml2_config = autoconf.checkProgram('xml', 'xml2-config')
644 if not autoconf.CheckParseConfigForLib('LIBXML2', xml2_config + ' --cflags --libs'):
645 fail("Couldn't find xml2")
646 autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LIBXML_H', '-DHAVE_LIBXML2' ])
648 if env['with_zlib']:
649 if not autoconf.CheckLibWithHeader('z', 'zlib.h', 'C'):
650 fail("Couldn't find zlib")
651 autoconf.env.Append(
652 CPPFLAGS = [ '-DHAVE_ZLIB_H', '-DHAVE_LIBZ' ],
653 LIBZ = 'z',
656 env = autoconf.Finish()
658 if re.compile("cygwin|mingw|midipix").search(env['PLATFORM']):
659 env.Append(COMMON_LIB = 'bin')
660 elif re.compile("darwin|aix").search(env['PLATFORM']):
661 env.Append(COMMON_LIB = 'lib')
662 else:
663 env.Append(COMMON_LIB = False)
665 versions = version.split('.')
666 version_id = int(versions[0]) << 16 | int(versions[1]) << 8 | int(versions[2])
667 env.Append(CPPFLAGS = [
668 '-DLIGHTTPD_VERSION_ID=' + hex(version_id),
669 '-DPACKAGE_NAME=\\"' + package + '\\"',
670 '-DPACKAGE_VERSION=\\"' + version + '\\"',
671 '-DLIBRARY_DIR="\\"${libdir}\\""',
674 SConscript('src/SConscript', exports = 'env', variant_dir = 'sconsbuild/build', duplicate = 0)
675 SConscript('tests/SConscript', exports = 'env', variant_dir = 'sconsbuild/tests')