summaryrefslogtreecommitdiff
path: root/src/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'src/meson.build')
-rw-r--r--src/meson.build448
1 files changed, 237 insertions, 211 deletions
diff --git a/src/meson.build b/src/meson.build
index e3c91d2f..e63c5198 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,5 +1,7 @@
sbinddir = join_paths(get_option('prefix'), get_option('sbindir'))
moduledir = join_paths(get_option('prefix'), get_option('moduledir'))
+# doesn't do much so far :(
+link_static = get_option('link_static')
include_base_paths = [
'/usr/include',
@@ -26,71 +28,75 @@ endif
compiler = meson.get_compiler('c')
conf_data = configuration_data()
-conf_data.set('HAVE_SYS_DEVPOLL_H', compiler.has_header('sys/devpoll.h'))
-conf_data.set('HAVE_SYS_EPOLL_H', compiler.has_header('sys/epoll.h'))
-conf_data.set('HAVE_SYS_EVENT_H', compiler.has_header('sys/event.h'))
-conf_data.set('HAVE_SYS_MMAN_H', compiler.has_header('sys/mman.h'))
-conf_data.set('HAVE_SYS_POLL_H', compiler.has_header('sys/poll.h'))
-conf_data.set('HAVE_SYS_PORT_H', compiler.has_header('sys/port.h'))
-conf_data.set('HAVE_SYS_PRCTL_H', compiler.has_header('sys/prctl.h'))
-conf_data.set('HAVE_SYS_RESOURCE_H', compiler.has_header('sys/resource.h'))
-conf_data.set('HAVE_SYS_SENDFILE_H', compiler.has_header('sys/sendfile.h'))
-conf_data.set('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h'))
-conf_data.set('HAVE_SYS_TYPES_H', compiler.has_header('sys/types.h'))
-conf_data.set('HAVE_SYS_UIO_H', compiler.has_header('sys/uio.h'))
-conf_data.set('HAVE_SYS_UN_H', compiler.has_header('sys/un.h'))
-conf_data.set('HAVE_SYS_WAIT_H', compiler.has_header('sys/wait.h'))
-conf_data.set('HAVE_SYS_TIME_H', compiler.has_header('sys/time.h'))
-conf_data.set('HAVE_UNISTD_H', compiler.has_header('unistd.h'))
-conf_data.set('HAVE_PTHREAD_H', compiler.has_header('pthread.h'))
-conf_data.set('HAVE_GETOPT_H', compiler.has_header('getopt.h'))
-conf_data.set('HAVE_INTTYPES_H', compiler.has_header('inttypes.h'))
-conf_data.set('HAVE_POLL_H', compiler.has_header('poll.h'))
-conf_data.set('HAVE_PWD_H', compiler.has_header('pwd.h'))
-conf_data.set('HAVE_STDDEF_H', compiler.has_header('stddef.h'))
-conf_data.set('HAVE_STDINT_H', compiler.has_header('stdint.h'))
-conf_data.set('HAVE_STRINGS_H', compiler.has_header('strings.h'))
-conf_data.set('HAVE_SYSLOG_H', compiler.has_header('syslog.h'))
-
-# check for fastcgi lib, for the tests only
-conf_data.set('HAVE_FASTCGI_H', compiler.has_header('fastcgi.h'))
-if not(conf_data.get('HAVE_FASTCGI_H'))
- conf_data.set('HAVE_FASTCGI_FASTCGI_H', compiler.has_header('fastcgi/fastcgi.h'))
-endif
+check_headers = [
+ 'getopt.h',
+ 'poll.h',
+ 'port.h',
+ 'pwd.h',
+ 'stdlib.h',
+ 'string.h',
+ 'strings.h',
+ 'sys/devpoll.h',
+ 'sys/epoll.h',
+ 'sys/event.h',
+ 'sys/filio.h',
+ 'sys/mman.h',
+ 'sys/poll.h',
+ 'sys/prctl.h',
+ 'sys/resource.h',
+ 'sys/select.h',
+ 'sys/sendfile.h',
+ 'sys/time.h',
+ 'sys/uio.h',
+ 'sys/un.h',
+ 'syslog.h',
+]
+
+# headers checked in special autoconf macros
+check_headers += [
+ 'inttypes.h',
+ 'stdint.h',
+ 'sys/wait.h',
+]
+
+foreach h: check_headers
+ conf_data.set('HAVE_' + h.to_upper().underscorify(), compiler.has_header(h))
+endforeach
# will be needed for auth
conf_data.set('HAVE_CRYPT_H', compiler.has_header('crypt.h'))
if conf_data.get('HAVE_CRYPT_H')
# check if we need libcrypt for crypt_r / crypt
+ libcrypt = compiler.find_library('crypt', required: false)
# crypt_r in default libs?
if compiler.has_function('crypt_r', args: defs, prefix: '#include <crypt.h>')
libcrypt = []
conf_data.set('HAVE_CRYPT_R', 1)
# crypt_r in -lcrypt ?
- elif compiler.has_function('crypt_r', args: defs + ['-lcrypt'], prefix: '#include <crypt.h>')
- libcrypt = [ compiler.find_library('crypt') ]
+ elif libcrypt.found() and compiler.has_function('crypt_r', args: defs, dependencies: libcrypt, prefix: '#include <crypt.h>')
+ libcrypt = [ libcrypt ]
conf_data.set('HAVE_CRYPT_R', 1)
# crypt in default libs?
elif compiler.has_function('crypt', args: defs, prefix: '#include <crypt.h>')
libcrypt = []
conf_data.set('HAVE_CRYPT', 1)
# crypt in -lcrypt ?
- elif compiler.has_function('crypt', args: defs + ['-lcrypt'], prefix: '#include <crypt.h>')
- libcrypt = [ compiler.find_library('crypt') ]
+ elif libcrypt.found() and compiler.has_function('crypt', args: defs, dependencies: libcrypt, prefix: '#include <crypt.h>')
+ libcrypt = [ libcrypt ]
conf_data.set('HAVE_CRYPT', 1)
endif
endif
-conf_data.set('HAVE_SYS_INOTIFY_H', compiler.has_header('sys/inotify.h'))
-if conf_data.get('HAVE_SYS_INOTIFY_H')
- conf_data.set('HAVE_INOTIFY_INIT', compiler.has_function('inotify_init', args: defs))
-endif
-
-conf_data.set('HAVE_SOCKLEN_T', compiler.has_type('socklen_t', args: defs, prefix: '#include <sys/socket.h>'))
+conf_data.set('HAVE_SOCKLEN_T', compiler.has_type('socklen_t',
+ args: defs,
+ prefix: '''
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ '''
+))
-conf_data.set('HAVE_SYS_RANDOM_H', compiler.has_header('sys/random.h'))
-if conf_data.get('HAVE_SYS_RANDOM_H')
+if compiler.has_header('sys/random.h')
conf_data.set('HAVE_GETENTROPY', compiler.has_function(
'getentropy',
args: defs,
@@ -107,52 +113,45 @@ if conf_data.get('HAVE_LINUX_RANDOM_H')
))
endif
-conf_data.set('SIZEOF_LONG', compiler.sizeof('long', args: defs))
-conf_data.set('SIZEOF_OFF_T', compiler.sizeof('off_t', args: defs))
-
-conf_data.set('HAVE_ARC4RANDOM_BUF', compiler.has_function('arc4random_buf', args: defs))
-conf_data.set('HAVE_CHROOT', compiler.has_function('chroot', args: defs))
-conf_data.set('HAVE_EPOLL_CTL', compiler.has_function('epoll_ctl', args: defs))
-conf_data.set('HAVE_FORK', compiler.has_function('fork', args: defs))
-conf_data.set('HAVE_GETLOADAVG', compiler.has_function('getloadavg', args: defs))
-conf_data.set('HAVE_GETRLIMIT', compiler.has_function('getrlimit', args: defs))
-conf_data.set('HAVE_GETUID', compiler.has_function('getuid', args: defs))
-conf_data.set('HAVE_GMTIME_R', compiler.has_function('gmtime_r', args: defs))
-conf_data.set('HAVE_INET_NTOP', compiler.has_function('inet_ntop', args: defs))
-conf_data.set('HAVE_JRAND48', compiler.has_function('jrand48', args: defs))
-conf_data.set('HAVE_KQUEUE', compiler.has_function('kqueue', args: defs))
-conf_data.set('HAVE_LOCALTIME_R', compiler.has_function('localtime_r', args: defs))
-conf_data.set('HAVE_LSTAT', compiler.has_function('lstat', args: defs))
-conf_data.set('HAVE_MADVISE', compiler.has_function('madvise', args: defs))
-conf_data.set('HAVE_MEMCPY', compiler.has_function('memcpy', args: defs))
-conf_data.set('HAVE_MEMSET', compiler.has_function('memset', args: defs))
-conf_data.set('HAVE_MMAP', compiler.has_function('mmap', args: defs))
-conf_data.set('HAVE_PATHCONF', compiler.has_function('pathconf', args: defs))
-conf_data.set('HAVE_PIPE2', compiler.has_function('pipe2', args: defs))
-conf_data.set('HAVE_POLL', compiler.has_function('poll', args: defs))
-conf_data.set('HAVE_PORT_CREATE', compiler.has_function('port_create', args: defs))
-conf_data.set('HAVE_PRCTL', compiler.has_function('prctl', args: defs))
-conf_data.set('HAVE_PREAD', compiler.has_function('pread', args: defs))
-conf_data.set('HAVE_POSIX_FADVISE', compiler.has_function('posix_fadvise', args: defs))
-conf_data.set('HAVE_SELECT', compiler.has_function('select', args: defs))
-conf_data.set('HAVE_SENDFILE', compiler.has_function('sendfile', args: defs))
-conf_data.set('HAVE_SEND_FILE', compiler.has_function('send_file', args: defs))
-conf_data.set('HAVE_SENDFILE64', compiler.has_function('sendfile64', args: defs))
-conf_data.set('HAVE_SENDFILEV', compiler.has_function('sendfilev', args: defs))
-conf_data.set('HAVE_SIGACTION', compiler.has_function('sigaction', args: defs))
-conf_data.set('HAVE_SIGNAL', compiler.has_function('signal', args: defs))
-conf_data.set('HAVE_SIGTIMEDWAIT', compiler.has_function('sigtimedwait', args: defs))
-conf_data.set('HAVE_SRANDOM', compiler.has_function('srandom', args: defs))
-conf_data.set('HAVE_STRPTIME', compiler.has_function('strptime', args: defs))
-conf_data.set('HAVE_SYSLOG', compiler.has_function('syslog', args: defs))
-conf_data.set('HAVE_WRITEV', compiler.has_function('writev', args: defs))
-conf_data.set('HAVE_INET_ATON', compiler.has_function('inet_aton', args: defs))
-conf_data.set('HAVE_ISSETUGID', compiler.has_function('issetugid', args: defs))
-conf_data.set('HAVE_INET_PTON', compiler.has_function('inet_pton', args: defs))
-conf_data.set('HAVE_MEMSET_S', compiler.has_function('memset_s', args: defs))
-conf_data.set('HAVE_EXPLICIT_BZERO', compiler.has_function('explicit_bzero', args: defs))
-
-conf_data.set('HAVE_CLOCK_GETTIME', compiler.has_header_symbol('time.h', 'clock_gettime'))
+check_funcs = [
+ 'arc4random_buf',
+ 'chroot',
+ 'clock_gettime',
+ 'epoll_ctl',
+ 'explicit_bzero',
+ 'fork',
+ 'getloadavg',
+ 'getrlimit',
+ 'getuid',
+ 'gmtime_r',
+ 'inet_pton',
+ 'issetugid',
+ 'jrand48',
+ 'kqueue',
+ 'localtime_r',
+ 'lstat',
+ 'madvise',
+ 'memset_s',
+ 'mmap',
+ 'pathconf',
+ 'pipe2',
+ 'poll',
+ 'port_create',
+ 'select',
+ 'send_file',
+ 'sendfile',
+ 'sendfile64',
+ 'sigaction',
+ 'signal',
+ 'srandom',
+ 'writev',
+]
+
+foreach f: check_funcs
+ conf_data.set('HAVE_' + f.to_upper(), compiler.has_function(f, args: defs))
+endforeach
+
+# check whether clock_gettime needs -lrt
clock_lib = []
if not(conf_data.get('HAVE_CLOCK_GETTIME'))
if compiler.has_function('clock_gettime', args: defs + ['-lrt'], prefix: '#include <time.h>')
@@ -186,7 +185,7 @@ conf_data.set('HAVE_WEAK_SYMBOLS', compiler.compiles('''
args: defs
))
-conf_data.set('HAVE_STRUCT_TM_GMTOFF', compiler.compiles('''
+conf_data.set('HAVE_STRUCT_TM_TM_GMTOFF', compiler.compiles('''
#include <time.h>
int main(void) {
struct tm t;
@@ -218,15 +217,14 @@ libbz2 = []
if get_option('with_bzip')
libbz2 = [ compiler.find_library('bz2') ]
if compiler.has_function('BZ2_bzCompress', args: defs, dependencies: libbz2, prefix: '#include <bzlib.h>')
- conf_data.set('HAVE_BZLIB_H', true)
- conf_data.set('HAVE_LIBBZ2', true)
+ conf_data.set('WITH_BZIP', true)
else
error('Couldn\'t find bz2 header / library')
endif
endif
if get_option('with_dbi')
- libdbi = dependency('dbi', required: false)
+ libdbi = dependency('dbi', required: false, static: link_static)
if libdbi.found()
libdbi = [ libdbi ]
else
@@ -235,7 +233,7 @@ if get_option('with_dbi')
error('Couldn\'t find dbi/dbi.h or dbi_conn_connect in lib dbi')
endif
endif
- conf_data.set('HAVE_DBI', true)
+ conf_data.set('WITH_DBI', true)
endif
libfam = []
@@ -244,12 +242,13 @@ if get_option('with_fam')
if not(compiler.has_function('FAMOpen2', args: defs, dependencies: libfam, prefix: '#include <fam.h>'))
error('Couldn\'t find fam.h or FAMOpen2 in lib fam')
endif
- conf_data.set('HAVE_FAM_H', true)
+ conf_data.set('HAVE_FAMNOEXISTS', compiler.has_function('FAMNoExists', args: defs, dependencies: libfam, prefix: '#include <fam.h>'))
+ conf_data.set('WITH_FAM', true)
endif
libgeoip = []
if get_option('with_geoip')
- libgeoip = dependency('geoip', required: false)
+ libgeoip = dependency('geoip', required: false, static: link_static)
if libgeoip.found()
libgeoip = [ libgeoip ]
else
@@ -258,6 +257,7 @@ if get_option('with_geoip')
error('Couldn\'t find GeoIP_country_name_by_addr in lib GeoIP')
endif
endif
+ conf_data.set('WITH_GEOIP', true)
endif
libgdbm = []
@@ -266,14 +266,13 @@ if get_option('with_gdbm')
if not(compiler.has_function('gdbm_open', args: defs, dependencies: libgdbm, prefix: '#include <gdbm.h>'))
error('Couldn\'t find gdbm.h or gdbm_open in lib gdbm')
endif
- conf_data.set('HAVE_GDBM_H', true)
- conf_data.set('HAVE_GDBM', true)
+ conf_data.set('WITH_GDBM', true)
endif
libkrb5 = []
libgssapi_krb5 = []
if get_option('with_krb5')
- libkrb5 = dependency('krb5', required: false)
+ libkrb5 = dependency('krb5', required: false, static: link_static)
if libkrb5.found()
libkrb5 = [ libkrb5 ]
else
@@ -283,14 +282,14 @@ if get_option('with_krb5')
endif
endif
- libgssapi_krb5 = dependency('krb5-gssapi', required: false)
+ libgssapi_krb5 = dependency('krb5-gssapi', required: false, static: link_static)
if libgssapi_krb5.found()
libgssapi_krb5 = [ libgssapi_krb5 ]
else
libgssapi_krb5 = [ compiler.find_library('gssapi_krb5') ]
endif
- conf_data.set('HAVE_KRB5', true)
+ conf_data.set('WITH_KRB5', true)
endif
libldap = []
@@ -301,26 +300,23 @@ if get_option('with_ldap')
args: defs,
dependencies: libldap,
prefix: '''
+ /* ldap_bind is part of the deprecated api */
#define LDAP_DEPRECATED 1
#include <ldap.h>
'''
))
error('Couldn\'t find ldap.h or ldap_bind in lib libldap')
endif
- conf_data.set('HAVE_LDAP_H', true)
- conf_data.set('HAVE_LIBLDAP', true)
liblber = [ compiler.find_library('lber') ]
if not(compiler.has_function('ber_printf', args: defs, dependencies: liblber, prefix: '#include <lber.h>'))
error('Couldn\'t find lber.h or ber_printf in lib liblber')
endif
- conf_data.set('HAVE_LBER_H', true)
- conf_data.set('HAVE_LIBLBER', true)
- conf_data.set('LDAP_DEPRECATED', 1, comment: 'Using deprecated ldap api')
+ conf_data.set('WITH_LDAP', true)
endif
libev = []
if get_option('with_libev')
- libev = dependency('ev', required: false)
+ libev = dependency('ev', required: false, static: link_static)
if libev.found()
libev = [ libev ]
elif compiler.has_header('ev.h') and compiler.has_function('ev_time', args: defs + ['-lev'])
@@ -328,12 +324,13 @@ if get_option('with_libev')
else
error('Couldn\'t find libev header / library')
endif
- conf_data.set('HAVE_LIBEV', true)
+ conf_data.set('WITH_LIBEV', true)
endif
libunwind = []
if get_option('with_libunwind')
- libunwind = [ dependency('libunwind') ]
+ libunwind = [ dependency('libunwind', static: link_static) ]
+ conf_data.set('WITH_LIBUNWIND', true)
endif
liblua = []
@@ -341,7 +338,7 @@ if get_option('with_lua')
found_lua = false
foreach l: ['lua5.3', 'lua-5.3', 'lua5.2', 'lua-5.2', 'lua5.1', 'lua-5.1', 'lua']
if not(found_lua)
- liblua = dependency(l, required: false)
+ liblua = dependency(l, required: false, static: link_static)
found_lua = liblua.found()
endif
endforeach
@@ -349,7 +346,7 @@ if get_option('with_lua')
error('Couldn\'t find any lua library')
endif
liblua = [ liblua ]
- conf_data.set('HAVE_LUA_H', true)
+ conf_data.set('WITH_LUA', true)
endif
libmemcached = []
@@ -357,8 +354,8 @@ if get_option('with_memcached')
# manual search:
# header: libmemcached/memcached.h
# function: memcached (-lmemcached)
- libmemcached = [ dependency('libmemcached') ]
- conf_data.set('USE_MEMCACHED', true)
+ libmemcached = [ dependency('libmemcached', static: link_static) ]
+ conf_data.set('WITH_MEMCACHED', true)
endif
libmysqlclient = []
@@ -366,8 +363,8 @@ if get_option('with_mysql')
# manual search: extend include path with 'mysql/'
# header: mysql.h
# function: mysql_real_connect (-lmysqlclient)
- libmysqlclient = [ dependency('mysqlclient') ]
- conf_data.set('HAVE_MYSQL', true)
+ libmysqlclient = [ dependency('mysqlclient', static: link_static) ]
+ conf_data.set('WITH_MYSQL', true)
endif
libssl = []
@@ -377,10 +374,9 @@ if get_option('with_openssl')
# header: openssl/ssl.h
# function: SSL_new (-lssl)
# function: BIO_f_base64 (-lcrypto)
- libssl = [ dependency('libssl') ]
- libcrypto = [ dependency('libcrypto') ]
- conf_data.set('HAVE_OPENSSL_SSL_H', true)
- conf_data.set('HAVE_LIBSSL', true)
+ libssl = [ dependency('libssl', static: link_static) ]
+ libcrypto = [ dependency('libcrypto', static: link_static) ]
+ conf_data.set('WITH_OPENSSL', true)
endif
libpcre = []
@@ -388,9 +384,8 @@ if get_option('with_pcre')
# manual search:
# header: pcre.h
# function: pcre_exec (-lpcre)
- libpcre = [ dependency('libpcre') ]
- conf_data.set('HAVE_PCRE_H', true)
- conf_data.set('HAVE_LIBPCRE', true)
+ libpcre = [ dependency('libpcre', static: link_static) ]
+ conf_data.set('WITH_PCRE', true)
endif
libpq = []
@@ -398,8 +393,8 @@ if get_option('with_pgsql')
# manual search:
# header: libpq-fe.h
# function: PQsetdbLogin (-lpq)
- libpq = [ dependency('libpq') ]
- conf_data.set('HAVE_PGSQL', true)
+ libpq = [ dependency('libpq', static: link_static) ]
+ conf_data.set('WITH_PGSQL', true)
endif
#if get_option('with_valgrind')
@@ -407,7 +402,11 @@ endif
libuuid = []
if get_option('with_webdav_locks')
- libuuid = dependency('uuid', required: false)
+ if not(get_option('with_webdav_props'))
+ error('webdav locks requires webdav props')
+ endif
+
+ libuuid = dependency('uuid', required: false, static: link_static)
if libuuid.found()
libuuid = [ libuuid ]
elif compiler.has_function('uuid_generate', args: defs, prefix: '#include <uuid/uuid.h>')
@@ -423,14 +422,13 @@ if get_option('with_webdav_locks')
error('Couldn\'t find uuid/uuid.h or uuid_generate in lib c and uuid')
endif
endif
- conf_data.set('HAVE_UUID', true)
- conf_data.set('HAVE_UUID_UUID_H', true)
+ conf_data.set('WITH_UUID', true)
endif
libxml2 = []
libsqlite3 = []
if get_option('with_webdav_props')
- libxml2 = dependency('libxml-2.0', required: false)
+ libxml2 = dependency('libxml-2.0', required: false, static: link_static)
if libxml2.found()
libxml2 = [ libxml2 ]
else
@@ -465,9 +463,9 @@ if get_option('with_webdav_props')
# has_function doesn't like "internal dependencies"
libxml2 += libxml2_includes_dep
endif
- conf_data.set('HAVE_LIBXML_H', true)
+ conf_data.set('WITH_XML', true)
- libsqlite3 = dependency('sqlite31', required: false)
+ libsqlite3 = dependency('sqlite31', required: false, static: link_static)
if libsqlite3.found()
libsqlite3 = [ libsqlite3 ]
else
@@ -482,29 +480,36 @@ if get_option('with_webdav_props')
error('Couldn\'t find sqlite3.h or sqlite3_reset in lib sqlite3')
endif
endif
- conf_data.set('HAVE_SQLITE3_H', true)
+ conf_data.set('WITH_SQLITE3', true)
endif
libattr = []
if get_option('with_xattr')
- libattr = [ compiler.find_library('attr') ]
- if not(compiler.has_function('attr_get',
- args: defs,
- dependencies: libattr,
- prefix: '''
- #include <sys/types.h>
- #include <attr/attributes.h>
- '''
- ))
- error('Couldn\'t find attr/attributes.h or attr_get in lib attr')
+ libattr = compiler.find_library('attr')
+ if libattr.found()
+ libattr = [ libattr ]
+ if not(compiler.has_function('attr_get',
+ args: defs,
+ dependencies: libattr,
+ prefix: '''
+ #include <sys/types.h>
+ #include <attr/attributes.h>
+ '''
+ ))
+ error('Couldn\'t find attr/attributes.h or attr_get in lib attr')
+ endif
+ conf_data.set('HAVE_LIBATTR', true)
+ elif compiler.has_function('extattr_get_file', args: defs, prefix: '#include <sys/extattr.h>')
+ # BSD extended attributes, no lib needed
+ libattr = []
+ conf_data.set('HAVE_EXTATTR', true)
endif
- conf_data.set('HAVE_ATTR_ATTRIBUTES_H', true)
- conf_data.set('HAVE_XATTR', true)
+ conf_data.set('WITH_XATTR', true)
endif
libz = []
if get_option('with_zlib')
- libz = dependency('zlib', required: false)
+ libz = dependency('zlib', required: false, static: link_static)
if libz.found()
libz = [ libz ]
else
@@ -514,8 +519,7 @@ if get_option('with_zlib')
error('Couldn\'t find z header / library')
endif
endif
- conf_data.set('HAVE_ZLIB_H', true)
- conf_data.set('HAVE_LIBZ', true)
+ conf_data.set('WITH_ZLIB', true)
endif
configure_file(
@@ -624,62 +628,8 @@ common_flags = [ declare_dependency(
# tests also use common_flags, and need this
include_directories: include_directories('.'),
) ]
-
lighttpd_flags = []
lighttpd_angel_flags = []
-if target_machine.system() == 'windows'
- lighttpd_flags += [ declare_dependency(
- compile_args: [
- '-DLI_DECLARE_EXPORTS',
- ],
- ) ]
- if compiler.get_id() == 'gcc'
- libmsvcr70 = [ compiler.find_library('msvcr70') ]
- lighttpd_flags += libmsvcr70 + [ declare_dependency(
- link_args: [
- '-Wl,-subsystem,console',
- ],
- ) ]
- lighttpd_angel_flags += libmsvcr70 + [ declare_dependency(
- link_args: [
- '-Wl,-subsystem,console',
- ],
- ) ]
- endif
-endif
-
-if compiler.get_id() == 'gcc' or target_machine.system() != 'darwin'
- lighttpd_flags += [ declare_dependency(
- link_args: [
- '-Wl,-export-dynamic',
- ],
- ) ]
-endif
-
-executable('lighttpd-angel',
- sources: 'lighttpd-angel.c',
- dependencies: common_flags + lighttpd_angel_flags,
- c_args: ['-DSBIN_DIR="' + sbinddir + '"'],
- install: true,
- install_dir: sbinddir,
-)
-
-executable('lighttpd', configparser,
- sources: common_src + main_src,
- # libssl needed?
- dependencies: common_flags + lighttpd_flags
- + libattr
- + libcrypto
- + libdl
- + libev
- + libfam
- + libpcre
- + libunwind
- + libws2_32
- ,
- install: true,
- install_dir: sbinddir,
-)
test('test_buffer', executable('test_buffer',
sources: ['test_buffer.c', 'buffer.c'],
@@ -806,15 +756,91 @@ if get_option('with_openssl')
]
endif
-foreach mod: modules
- mod_name = mod.get(0)
- mod_sources = mod.get(1)
- mod_deps = mod.length() > 2 ? mod.get(2) : []
- shared_module(mod_name,
- sources: mod_sources,
- dependencies: common_flags + mod_deps,
- name_prefix: '',
- install: true,
- install_dir: moduledir,
+if get_option('build_static')
+ sh = find_program('sh')
+ plugin_names = []
+ foreach mod: modules
+ mod_name = mod.get(0)
+ mod_sources = mod.get(1)
+ mod_deps = mod.length() > 2 ? mod.get(2) : []
+ plugin_names += [ mod_name ]
+ lighttpd_flags += mod_deps + [ declare_dependency(
+ sources: mod_sources,
+ ) ]
+ endforeach
+ # printf repeats the format string until all arguments are handled;
+ # the plugin names should be "sane" ([a-zA-Z0-9_]+)
+ plugin_static_h = custom_target('plugin-static.h',
+ command: [ sh, '-c', 'printf \'PLUGIN_INIT(%s)\n\' ' + ' '.join(plugin_names) ],
+ capture: true,
+ output: [ 'plugin-static.h' ],
)
-endforeach
+ main_src += [ plugin_static_h ]
+else
+ foreach mod: modules
+ mod_name = mod.get(0)
+ mod_sources = mod.get(1)
+ mod_deps = mod.length() > 2 ? mod.get(2) : []
+ shared_module(mod_name,
+ sources: mod_sources,
+ dependencies: common_flags + mod_deps,
+ name_prefix: '',
+ install: true,
+ install_dir: moduledir,
+ )
+ endforeach
+endif
+
+if target_machine.system() == 'windows'
+ lighttpd_flags += [ declare_dependency(
+ compile_args: [
+ '-DLI_DECLARE_EXPORTS',
+ ],
+ ) ]
+ if compiler.get_id() == 'gcc'
+ libmsvcr70 = [ compiler.find_library('msvcr70') ]
+ lighttpd_flags += libmsvcr70 + [ declare_dependency(
+ link_args: [
+ '-Wl,-subsystem,console',
+ ],
+ ) ]
+ lighttpd_angel_flags += libmsvcr70 + [ declare_dependency(
+ link_args: [
+ '-Wl,-subsystem,console',
+ ],
+ ) ]
+ endif
+endif
+
+if compiler.get_id() == 'gcc' or target_machine.system() != 'darwin'
+ lighttpd_flags += [ declare_dependency(
+ link_args: [
+ '-Wl,-export-dynamic',
+ ],
+ ) ]
+endif
+
+executable('lighttpd-angel',
+ sources: 'lighttpd-angel.c',
+ dependencies: common_flags + lighttpd_angel_flags,
+ c_args: ['-DSBIN_DIR="' + sbinddir + '"'],
+ install: true,
+ install_dir: sbinddir,
+)
+
+executable('lighttpd',
+ sources: common_src + main_src + [ configparser ],
+ # libssl needed?
+ dependencies: common_flags + lighttpd_flags
+ + libattr
+ + libcrypto
+ + libdl
+ + libev
+ + libfam
+ + libpcre
+ + libunwind
+ + libws2_32
+ ,
+ install: true,
+ install_dir: sbinddir,
+)