diff --git a/SConstruct b/SConstruct index b85911d6..5e068054 100644 --- a/SConstruct +++ b/SConstruct @@ -157,7 +157,7 @@ if 1: checkTypes(autoconf, Split('pid_t size_t off_t')) autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '', LIBZ = '', - LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '', + LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '', LIBPCRE = '', LIBLDAP = '', LIBLBER = '', LIBLUA = '', LIBLUALIB = '', LIBDL = '') if env['with_fam']: @@ -179,7 +179,7 @@ if 1: if env['with_ldap']: if autoconf.CheckLibWithHeader('ldap', 'ldap.h', 'C'): - autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LDAP_H', '-DHAVE_LIBLDAP' ], LIBLDAP = [ 'ldap' ]) + autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LDAP_H', '-DHAVE_LIBLDAP' ], LIBLDAP = 'ldap') if autoconf.CheckLibWithHeader('lber', 'lber.h', 'C'): autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LBER_H', '-DHAVE_LIBLBER' ], LIBLBER = 'lber') @@ -198,12 +198,16 @@ if 1: if env['with_lua']: if autoconf.CheckLibWithHeader('lua', 'lua.h', 'C'): autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LUA_H', '-DHAVE_LIBLUA' ], LIBLUA = 'lua', LIBLUALIB = 'lualib') - + + ol = env['LIBS'] if autoconf.CheckLibWithHeader('fcgi', 'fastcgi.h', 'C'): autoconf.env.Append(LIBFCGI = 'fcgi') + env['LIBS'] = ol + ol = env['LIBS'] if autoconf.CheckLibWithHeader('dl', 'dlfcn.h', 'C'): autoconf.env.Append(LIBDL = 'dl') + env['LIBS'] = ol if autoconf.CheckType('socklen_t', '#include \n#include \n#include '): autoconf.env.Append(CPPFLAGS = [ '-DHAVE_SOCKLEN_T' ]) diff --git a/src/SConscript b/src/SConscript index f280db74..e2bef43b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -1,3 +1,7 @@ +import os +import re +import types + Import('env') common_src = Split("buffer.c log.c \ @@ -96,7 +100,29 @@ staticbin = staticenv.Program('lighttpd-semi-static', ## you might have to adjust the list of libs and the order for your setup ## this is tricky, be warned -fullstaticlib = staticlib + [ 'sasl2', 'gssapi_krb5', 'ssl', 'crypto', 'crypt', 'krb5', 'k5crypto', 'krb5support', 'com_err', 'resolv' ] +fullstaticlib = [] + +## try to calculate the libs for fullstatic with ldd +## 1. find the lib +## 2. check the deps +## 3. add them to the libs +searchlibs = os.pathsep.join([ '/lib/', '/usr/lib/', '/usr/local/lib/' ]) +lddre = re.compile(r'^\s+lib([^=-]+)(?:-[\.0-9]+)?\.so\.[0-9]+ =>', re.MULTILINE) +for libs in staticlib: + if type(libs) is types.StringType: libs = [ libs ] + for lib in libs: + fullstaticlib += [ lib ] + solibpath = env.WhereIs('lib' + lib + '.so', searchlibs) + fullstaticlib += [ lib ] + if solibpath is None: + continue + + f = os.popen('ldd ' + solibpath, 'r') + for aword in lddre.findall(f.read()): + fullstaticlib += [ aword ] + f.close + + fullstaticbin = staticenv.Program('lighttpd-static', staticobj, LIBS = fullstaticlib,