version 1.1, 2013/10/14 10:32:47
|
version 1.1.1.3, 2016/11/02 10:35:00
|
Line 5 import string
|
Line 5 import string
|
from stat import * |
from stat import * |
|
|
package = 'lighttpd' |
package = 'lighttpd' |
version = '1.4.33' | version = '1.4.41' |
|
|
def checkCHeaders(autoconf, hdrs): |
def checkCHeaders(autoconf, hdrs): |
p = re.compile('[^A-Z0-9]') |
p = re.compile('[^A-Z0-9]') |
Line 13 def checkCHeaders(autoconf, hdrs):
|
Line 13 def checkCHeaders(autoconf, hdrs):
|
if not hdr: |
if not hdr: |
continue |
continue |
_hdr = Split(hdr) |
_hdr = Split(hdr) |
if autoconf.CheckCHeader(_hdr): | if autoconf.CheckCHeader(_hdr): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', _hdr[-1].upper()) ]) | autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', _hdr[-1].upper()) ]) |
|
|
def checkFuncs(autoconf, funcs): |
def checkFuncs(autoconf, funcs): |
p = re.compile('[^A-Z0-9]') |
p = re.compile('[^A-Z0-9]') |
Line 28 def checkTypes(autoconf, types):
|
Line 28 def checkTypes(autoconf, types):
|
if autoconf.CheckType(type, '#include <sys/types.h>'): |
if autoconf.CheckType(type, '#include <sys/types.h>'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', type.upper()) ]) |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', type.upper()) ]) |
|
|
|
def checkGmtOffInStructTm(context): |
|
source = """ |
|
#include <time.h> |
|
int main() { |
|
struct tm a; |
|
a.tm_gmtoff = 0; |
|
return 0; |
|
} |
|
""" |
|
context.Message('Checking for tm_gmtoff in struct tm...') |
|
result = context.TryLink(source, '.c') |
|
context.Result(result) |
|
|
|
return result |
|
|
|
def checkIPv6(context): |
|
source = """ |
|
#include <sys/types.h> |
|
#include <sys/socket.h> |
|
#include <netinet/in.h> |
|
|
|
int main() { |
|
struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; |
|
return 0; |
|
} |
|
""" |
|
context.Message('Checking for IPv6 support...') |
|
result = context.TryLink(source, '.c') |
|
context.Result(result) |
|
|
|
return result |
|
|
|
def checkWeakSymbols(context): |
|
source = """ |
|
__attribute__((weak)) void __dummy(void *x) { } |
|
int main() { |
|
void *x; |
|
__dummy(x); |
|
} |
|
""" |
|
context.Message('Checking for weak symbol support...') |
|
result = context.TryLink(source, '.c') |
|
context.Result(result) |
|
|
|
return result |
|
|
def checkProgram(env, withname, progname): |
def checkProgram(env, withname, progname): |
withname = 'with_' + withname |
withname = 'with_' + withname |
binpath = None |
binpath = None |
Line 54 def checkProgram(env, withname, progname):
|
Line 100 def checkProgram(env, withname, progname):
|
|
|
return binpath |
return binpath |
|
|
def checkStructMember(context): | VariantDir('sconsbuild/build', 'src', duplicate = 0) |
struct_member = """ | VariantDir('sconsbuild/tests', 'tests', duplicate = 0) |
#include <time.h> | |
int main() { | |
struct tm a; | |
a.tm_gmtoff = 0; | |
return 0; | |
} | |
""" | |
context.Message('Checking for tm_gmtoff in struct tm...') | |
result = context.TryLink(struct_member, '.c') | |
context.Result(result) | |
|
|
return result | vars = Variables() #('config.py') |
| vars.AddVariables( |
| |
BuildDir('build', 'src', duplicate = 0) | |
| |
opts = Options('config.py') | |
opts.AddOptions( | |
('prefix', 'prefix', '/usr/local'), |
('prefix', 'prefix', '/usr/local'), |
('bindir', 'binary directory', '${prefix}/bin'), |
('bindir', 'binary directory', '${prefix}/bin'), |
('sbindir', 'binary directory', '${prefix}/sbin'), |
('sbindir', 'binary directory', '${prefix}/sbin'), |
('libdir', 'library directory', '${prefix}/lib'), |
('libdir', 'library directory', '${prefix}/lib'), |
PackageOption('with_mysql', 'enable mysql support', 'no'), | PackageVariable('with_mysql', 'enable mysql support', 'no'), |
PackageOption('with_xml', 'enable xml support', 'no'), | PackageVariable('with_xml', 'enable xml support', 'no'), |
PackageOption('with_pcre', 'enable pcre support', 'yes'), | PackageVariable('with_pcre', 'enable pcre support', 'yes'), |
PathOption('CC', 'path to the c-compiler', None), | PathVariable('CC', 'path to the c-compiler', None), |
BoolOption('build_dynamic', 'enable dynamic build', 'yes'), | BoolVariable('build_dynamic', 'enable dynamic build', 'yes'), |
BoolOption('build_static', 'enable static build', 'no'), | BoolVariable('build_static', 'enable static build', 'no'), |
BoolOption('build_fullstatic', 'enable fullstatic build', 'no'), | BoolVariable('build_fullstatic', 'enable fullstatic build', 'no'), |
BoolOption('with_sqlite3', 'enable sqlite3 support', 'no'), | BoolVariable('with_sqlite3', 'enable sqlite3 support', 'no'), |
BoolOption('with_memcache', 'enable memcache support', 'no'), | BoolVariable('with_memcached', 'enable memcached support', 'no'), |
BoolOption('with_fam', 'enable FAM/gamin support', 'no'), | BoolVariable('with_fam', 'enable FAM/gamin support', 'no'), |
BoolOption('with_openssl', 'enable memcache support', 'no'), | BoolVariable('with_openssl', 'enable openssl support', 'no'), |
BoolOption('with_gzip', 'enable gzip compression', 'no'), | BoolVariable('with_gzip', 'enable gzip compression', 'no'), |
BoolOption('with_bzip2', 'enable bzip2 compression', 'no'), | BoolVariable('with_bzip2', 'enable bzip2 compression', 'no'), |
BoolOption('with_lua', 'enable lua support for mod_cml', 'no'), | BoolVariable('with_lua', 'enable lua support for mod_cml', 'no'), |
BoolOption('with_ldap', 'enable ldap auth support', 'no')) | BoolVariable('with_ldap', 'enable ldap auth support', 'no')) |
|
|
env = Environment( |
env = Environment( |
env = os.environ, | ENV = os.environ, |
options = opts, | variables = vars, |
CPPPATH = Split('#build') | CPPPATH = Split('#sconsbuild/build') |
) |
) |
|
|
env.Help(opts.GenerateHelpText(env)) | env.Help(vars.GenerateHelpText(env)) |
|
|
if env.subst('${CC}') is not '': |
if env.subst('${CC}') is not '': |
env['CC'] = env.subst('${CC}') |
env['CC'] = env.subst('${CC}') |
Line 113 if env['CC'] == 'gcc':
|
Line 144 if env['CC'] == 'gcc':
|
|
|
# cache configure checks |
# cache configure checks |
if 1: |
if 1: |
autoconf = Configure(env, custom_tests = {'CheckStructMember': checkStructMember }) | autoconf = Configure(env, custom_tests = { |
| 'CheckGmtOffInStructTm': checkGmtOffInStructTm, |
| 'CheckIPv6': checkIPv6, |
| 'CheckWeakSymbols': checkWeakSymbols, |
| }) |
| |
| if 'CFLAGS' in os.environ: |
| autoconf.env.Append(CCFLAGS = os.environ['CFLAGS']) |
| print(">> Appending custom build flags : " + os.environ['CFLAGS']) |
| |
| if 'LDFLAGS' in os.environ: |
| autoconf.env.Append(LINKFLAGS = os.environ['LDFLAGS']) |
| print(">> Appending custom link flags : " + os.environ['LDFLAGS']) |
| |
| if 'LIBS' in os.environ: |
| autoconf.env.Append(APPEND_LIBS = os.environ['LIBS']) |
| print(">> Appending custom libraries : " + os.environ['LIBS']) |
| else: |
| autoconf.env.Append(APPEND_LIBS = '') |
| |
autoconf.headerfile = "foo.h" |
autoconf.headerfile = "foo.h" |
checkCHeaders(autoconf, string.split(""" |
checkCHeaders(autoconf, string.split(""" |
arpa/inet.h |
arpa/inet.h |
|
crypt.h |
fcntl.h |
fcntl.h |
|
getopt.h |
|
inttypes.h |
netinet/in.h |
netinet/in.h |
sys/types.h netinet/in.h | poll.h |
| pwd.h |
| stdint.h |
stdlib.h |
stdlib.h |
string.h |
string.h |
sys/socket.h |
|
sys/types.h sys/socket.h |
|
sys/time.h |
|
unistd.h |
|
sys/sendfile.h |
|
sys/uio.h |
|
sys/types.h sys/uio.h |
|
getopt.h |
|
sys/epoll.h |
|
sys/select.h |
|
sys/types.h sys/select.h |
|
poll.h |
|
sys/poll.h |
|
sys/devpoll.h |
sys/devpoll.h |
|
sys/epoll.h |
|
sys/event.h |
sys/filio.h |
sys/filio.h |
sys/mman.h |
sys/mman.h |
sys/types.h sys/mman.h | sys/poll.h |
sys/event.h | |
sys/types.h sys/event.h | |
sys/port.h |
sys/port.h |
winsock2.h | sys/prctl.h |
pwd.h | |
sys/syslimits.h | |
sys/resource.h |
sys/resource.h |
|
sys/select.h |
|
sys/sendfile.h |
|
sys/socket.h |
|
sys/time.h |
sys/time.h sys/types.h sys/resource.h |
sys/time.h sys/types.h sys/resource.h |
sys/un.h | sys/types.h netinet/in.h |
| sys/types.h sys/event.h |
| sys/types.h sys/mman.h |
| sys/types.h sys/select.h |
| sys/types.h sys/socket.h |
| sys/types.h sys/uio.h |
sys/types.h sys/un.h |
sys/types.h sys/un.h |
|
sys/uio.h |
|
sys/un.h |
|
sys/wait.h |
syslog.h |
syslog.h |
stdint.h | unistd.h |
inttypes.h | winsock2.h""", "\n")) |
sys/prctl.h | |
sys/wait.h""", "\n")) | |
|
|
checkFuncs(autoconf, Split('fork stat lstat strftime dup2 getcwd inet_ntoa inet_ntop memset mmap munmap strchr \ |
checkFuncs(autoconf, Split('fork stat lstat strftime dup2 getcwd inet_ntoa inet_ntop memset mmap munmap strchr \ |
strdup strerror strstr strtol sendfile getopt socket \ | strdup strerror strstr strtol sendfile getopt socket \ |
gethostbyname poll epoll_ctl getrlimit chroot \ |
gethostbyname poll epoll_ctl getrlimit chroot \ |
getuid select signal pathconf madvise prctl\ |
getuid select signal pathconf madvise prctl\ |
writev sigaction sendfile64 send_file kqueue port_create localtime_r posix_fadvise issetugid inet_pton')) | writev sigaction sendfile64 send_file kqueue port_create localtime_r posix_fadvise issetugid inet_pton \ |
| memset_s explicit_bzero clock_gettime')) |
|
|
checkTypes(autoconf, Split('pid_t size_t off_t')) |
checkTypes(autoconf, Split('pid_t size_t off_t')) |
|
|
autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '', LIBZ = '', |
autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '', LIBZ = '', |
LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '', LIBPCRE = '', | LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHED = '', LIBFCGI = '', LIBPCRE = '', |
LIBLDAP = '', LIBLBER = '', LIBLUA = '', LIBLUALIB = '', LIBDL = '') | LIBLDAP = '', LIBLBER = '', LIBLUA = '', LIBDL = '', LIBUUID = '') |
|
|
if env['with_fam']: |
if env['with_fam']: |
if autoconf.CheckLibWithHeader('fam', 'fam.h', 'C'): |
if autoconf.CheckLibWithHeader('fam', 'fam.h', 'C'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_FAM_H', '-DHAVE_LIBFAM' ], LIBS = 'fam') |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_FAM_H', '-DHAVE_LIBFAM' ], LIBS = 'fam') |
checkFuncs(autoconf, ['FAMNoExists']); |
checkFuncs(autoconf, ['FAMNoExists']); |
|
|
|
if autoconf.CheckLib('crypt'): |
|
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LIBCRYPT' ], LIBCRYPT = 'crypt') |
|
oldlib = env['LIBS'] |
|
env['LIBS'] += ['crypt'] |
|
checkFuncs(autoconf, ['crypt', 'crypt_r']); |
|
env['LIBS'] = oldlib |
|
else: |
|
checkFuncs(autoconf, ['crypt', 'crypt_r']); |
|
|
if autoconf.CheckLibWithHeader('crypt', 'crypt.h', 'C'): | if autoconf.CheckLibWithHeader('rt', 'time.h', 'c', 'clock_gettime(CLOCK_MONOTONIC, (struct timespec*)0);'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_CRYPT_H', '-DHAVE_LIBCRYPT' ], LIBCRYPT = 'crypt') | autoconf.env.Append(CPPFLAGS = [ '-DHAVE_CLOCK_GETTIME' ], LIBS = [ 'rt' ]) |
|
|
if autoconf.CheckLibWithHeader('uuid', 'uuid/uuid.h', 'C'): |
if autoconf.CheckLibWithHeader('uuid', 'uuid/uuid.h', 'C'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_UUID_UUID_H', '-DHAVE_LIBUUID' ], LIBUUID = 'uuid') |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_UUID_UUID_H', '-DHAVE_LIBUUID' ], LIBUUID = 'uuid') |
Line 197 if 1:
|
Line 256 if 1:
|
if autoconf.CheckLibWithHeader('bz2', 'bzlib.h', 'C'): |
if autoconf.CheckLibWithHeader('bz2', 'bzlib.h', 'C'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_BZLIB_H', '-DHAVE_LIBBZ2' ], LIBBZ2 = 'bz2') |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_BZLIB_H', '-DHAVE_LIBBZ2' ], LIBBZ2 = 'bz2') |
|
|
if env['with_memcache']: | if env['with_memcached']: |
if autoconf.CheckLibWithHeader('memcache', 'memcache.h', 'C'): | if autoconf.CheckLibWithHeader('memcached', 'libmemcached/memcached.h', 'C'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_MEMCACHE_H', '-DHAVE_LIBMEMCACHE' ], LIBMEMCACHE = 'memcache') | autoconf.env.Append(CPPFLAGS = [ '-DUSE_MEMCACHED' ], LIBMEMCACHED = 'memcached') |
|
|
if env['with_sqlite3']: |
if env['with_sqlite3']: |
if autoconf.CheckLibWithHeader('sqlite3', 'sqlite3.h', 'C'): |
if autoconf.CheckLibWithHeader('sqlite3', 'sqlite3.h', 'C'): |
Line 221 if 1:
|
Line 280 if 1:
|
if autoconf.CheckType('struct sockaddr_storage', '#include <sys/socket.h>\n'): |
if autoconf.CheckType('struct sockaddr_storage', '#include <sys/socket.h>\n'): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_SOCKADDR_STORAGE' ]) |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_SOCKADDR_STORAGE' ]) |
|
|
if autoconf.CheckStructMember(): | if autoconf.CheckGmtOffInStructTm(): |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_TM_GMTOFF' ]) |
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_STRUCT_TM_GMTOFF' ]) |
|
|
|
if autoconf.CheckIPv6(): |
|
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_IPV6' ]) |
|
|
|
if autoconf.CheckWeakSymbols(): |
|
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_WEAK_SYMBOLS' ]) |
|
|
env = autoconf.Finish() |
env = autoconf.Finish() |
|
|
if env['with_lua']: | def TryLua(env, name): |
oldlibs = env['LIBS'] | result = False |
env.ParseConfig("pkg-config 'lua >= 5.0' --cflags --libs") | oldlibs = env['LIBS'] |
lualibs = env['LIBS'][len(oldlibs):] | try: |
env.Append(LIBLUA = lualibs) | print("Searching for lua: " + name + " >= 5.0") |
| env.ParseConfig("pkg-config '" + name + " >= 5.0' --cflags --libs") |
| env.Append(LIBLUA = env['LIBS'][len(oldlibs):]) |
env.Append(CPPFLAGS = [ '-DHAVE_LUA_H' ]) |
env.Append(CPPFLAGS = [ '-DHAVE_LUA_H' ]) |
env['LIBS'] = oldlibs | result = True |
| except: |
| pass |
| env['LIBS'] = oldlibs |
| return result |
|
|
|
if env['with_lua']: |
|
found_lua = False |
|
for lua_name in ['lua5.3', 'lua-5.3', 'lua5.2', 'lua-5.2', 'lua5.1', 'lua-5.1', 'lua']: |
|
if TryLua(env, lua_name): |
|
found_lua = True |
|
break |
|
if not found_lua: |
|
raise RuntimeError("Couldn't find any lua implementation") |
|
|
if env['with_pcre']: |
if env['with_pcre']: |
pcre_config = checkProgram(env, 'pcre', 'pcre-config') |
pcre_config = checkProgram(env, 'pcre', 'pcre-config') |
Line 266 else:
|
Line 345 else:
|
versions = string.split(version, '.') |
versions = string.split(version, '.') |
version_id = int(versions[0]) << 16 | int(versions[1]) << 8 | int(versions[2]) |
version_id = int(versions[0]) << 16 | int(versions[1]) << 8 | int(versions[2]) |
env.Append(CPPFLAGS = [ |
env.Append(CPPFLAGS = [ |
'-DLIGHTTPD_VERSION_ID=' + str(version_id), | '-DLIGHTTPD_VERSION_ID=' + hex(version_id), |
'-DPACKAGE_NAME=\\"' + package + '\\"', |
'-DPACKAGE_NAME=\\"' + package + '\\"', |
'-DPACKAGE_VERSION=\\"' + version + '\\"', |
'-DPACKAGE_VERSION=\\"' + version + '\\"', |
'-DLIBRARY_DIR="\\"${libdir}\\""', |
'-DLIBRARY_DIR="\\"${libdir}\\""', |
'-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-D_LARGE_FILES' |
'-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE_SOURCE', '-D_LARGE_FILES' |
] ) |
] ) |
|
|
SConscript( 'src/SConscript', 'env', build_dir = 'build', duplicate = 0) | SConscript('src/SConscript', exports = 'env', variant_dir = 'sconsbuild/build', duplicate = 0) |
SConscript( 'tests/SConscript', 'env' ) | SConscript('tests/SConscript', exports = 'env', variant_dir = 'sconsbuild/tests') |