1compiler = meson.get_compiler('c') 2sbindir = join_paths(get_option('prefix'), get_option('sbindir')) 3moduledir = join_paths(get_option('prefix'), get_option('moduledir')) 4 5include_base_paths = [ 6 '/usr/include', 7 '/usr/local/include', 8# '/opt/local/include', 9] 10 11defs = [ 12 '-D_TIME_BITS=64', 13 '-D_FILE_OFFSET_BITS=64', 14 '-D_LARGEFILE_SOURCE', 15 '-D_LARGE_FILES', 16 '-D_DEFAULT_SOURCE', 17 '-D_GNU_SOURCE', 18] 19 20socket_libs = [] 21if target_machine.system() == 'windows' 22 socket_libs = [ compiler.find_library('ws2_32') ] 23 defs += [ 24 '-DNVALGRIND', 25 ] 26endif 27if target_machine.system() == 'sunos' 28 socket_libs = [ compiler.find_library('socket') 29 , compiler.find_library('nsl') 30 ] 31elif target_machine.system() == 'haiku' 32 socket_libs = [ compiler.find_library('network') ] 33endif 34 35 36conf_data = configuration_data() 37 38headers = [ 39 'sys/inotify.h', 40 'sys/loadavg.h', 41 'sys/poll.h', 42 'sys/prctl.h', 43 'sys/procctl.h', 44 'sys/sendfile.h', 45 'sys/un.h', 46 'sys/wait.h', 47 'sys/time.h', 48 'unistd.h', 49 'dlfcn.h', 50 'getopt.h', 51 'inttypes.h', 52 'poll.h', 53 'pwd.h', 54 'stdint.h', 55 'stdlib.h', 56 'strings.h', 57 'syslog.h', 58 'crypt.h', 59 'malloc.h', 60 'signal.h', 61 'sys/epoll.h', 62 'sys/event.h', 63 'sys/mman.h', 64 'sys/random.h', 65 'linux/random.h', 66 'sys/resource.h', 67 'sys/uio.h', 68] 69 70foreach h : headers 71 conf_data.set('HAVE_@0@'.format(h.underscorify().to_upper()), compiler.has_header(h)) 72endforeach 73 74# will be needed for auth 75if conf_data.get('HAVE_CRYPT_H') 76 # check if we need libcrypt for crypt_r / crypt 77 78 # crypt_r in default libs? 79 if compiler.has_function('crypt_r', args: defs, prefix: '#include <crypt.h>') 80 libcrypt = [] 81 conf_data.set('HAVE_CRYPT_R', 1) 82 # crypt_r in -lcrypt ? 83 elif compiler.has_function('crypt_r', args: defs + ['-lcrypt'], prefix: '#include <crypt.h>') 84 libcrypt = [ compiler.find_library('crypt') ] 85 conf_data.set('HAVE_CRYPT_R', 1) 86 # crypt in default libs? 87 elif compiler.has_function('crypt', args: defs, prefix: '#include <crypt.h>') 88 libcrypt = [] 89 conf_data.set('HAVE_CRYPT', 1) 90 # crypt in -lcrypt ? 91 elif compiler.has_function('crypt', args: defs + ['-lcrypt'], prefix: '#include <crypt.h>') 92 libcrypt = [ compiler.find_library('crypt') ] 93 conf_data.set('HAVE_CRYPT', 1) 94 endif 95elif conf_data.get('HAVE_UNISTD_H') 96 # crypt in default libs? 97 if compiler.has_function('crypt', args: defs, prefix: '#include <unistd.h>') 98 libcrypt = [] 99 conf_data.set('HAVE_CRYPT', 1) 100 # crypt in -lcrypt ? 101 elif compiler.has_function('crypt', args: defs + ['-lcrypt'], prefix: '#include <unistd.h>') 102 libcrypt = [ compiler.find_library('crypt') ] 103 conf_data.set('HAVE_CRYPT', 1) 104 endif 105endif 106 107conf_data.set('HAVE_SOCKLEN_T', compiler.has_type('socklen_t', args: defs, prefix: '#include <sys/socket.h>')) 108 109functions = { 110 'arc4random_buf': 'stdlib.h', 111 'chroot': 'unistd.h', 112 'copy_file_range': 'unistd.h', 113 'epoll_ctl': 'sys/epoll.h', 114 'explicit_bzero': 'strings.h', 115 'explicit_memset': 'string.h', 116 'fork': 'unistd.h', 117 'getentropy': 'sys/random.h', 118 'getloadavg': 'stdlib.h', 119 'getrandom': 'linux/random.h', 120 'getrlimit': 'sys/resource.h', 121 'getuid': 'unistd.h', 122 'gmtime_r': 'time.h', 123 'inet_aton': 'arpa/inet.h', 124 'inet_pton': 'arpa/inet.h', 125 'issetugid': 'unistd.h', 126 'jrand48': 'stdlib.h', 127 'kqueue': 'sys/event.h', 128 'localtime_r': 'time.h', 129 'lstat': 'sys/stat.h', 130 'madvise': 'sys/mman.h', 131 'malloc_trim': 'malloc.h', 132 'mallopt': 'malloc.h', 133 'mempcpy': 'string.h', 134 'memset_s': 'string.h', 135 'mkostemp': 'stdlib.h', 136 'mmap': 'sys/mman.h', 137 'pipe2': 'unistd.h', 138 'poll': 'poll.h', 139 'pread': 'unistd.h', 140 'preadv': 'sys/uio.h', 141 'pwrite': 'unistd.h', 142 'pwritev': 'sys/uio.h', 143 'sendfile64': 'sys/socket.h', 144 'sendfile': 'sys/sendfile.h', 145 'sigaction': 'signal.h', 146 'signal': 'signal.h', 147 'splice': 'fcntl.h', 148 'srandom': 'stdlib.h', 149 'strerror_r': 'string.h', 150 'timegm': 'time.h', 151 'writev': 'sys/uio.h', 152} 153 154foreach f, h : functions 155 conf_data.set('HAVE_@0@'.format(f.underscorify().to_upper()), compiler.has_header_symbol(h, f, args: defs)) 156endforeach 157 158if not(conf_data.get('HAVE_POLL')) 159conf_data.set('HAVE_SYS_SELECT_H', compiler.has_header('sys/select.h')) 160conf_data.set('HAVE_SELECT', compiler.has_function('select', args: defs)) 161endif 162 163if target_machine.system() == 'sunos' 164conf_data.set('HAVE_PORT_H', compiler.has_header('port.h')) 165conf_data.set('HAVE_PRIV_H', compiler.has_header('priv.h')) 166conf_data.set('HAVE_SYS_DEVPOLL_H', compiler.has_header('sys/devpoll.h')) 167conf_data.set('HAVE_SYS_FILIO_H', compiler.has_header('sys/filio.h')) 168conf_data.set('HAVE_PORT_CREATE', compiler.has_function('port_create', args: defs)) 169conf_data.set('HAVE_SENDFILEV', compiler.has_function('sendfilev', args: defs)) 170conf_data.set('HAVE_SETPFLAGS', compiler.has_function('setpflags', args: defs)) 171endif 172 173conf_data.set('SIZEOF_LONG', compiler.sizeof('long', args: defs)) 174conf_data.set('SIZEOF_OFF_T', compiler.sizeof('off_t', args: defs)) 175 176conf_data.set('HAVE_CLOCK_GETTIME', compiler.has_function('clock_gettime', args: defs, prefix: '#include <time.h>')) 177clock_lib = [] 178if not conf_data.get('HAVE_CLOCK_GETTIME') 179 rt = compiler.find_library('rt') 180 conf_data.set('HAVE_CLOCK_GETTIME', compiler.has_function('clock_gettime', args: defs, dependencies: rt, prefix: '#include <time.h>')) 181 if conf_data.get('HAVE_CLOCK_GETTIME') 182 clock_lib = rt 183 else 184 threads = dependency('threads') 185 conf_data.set('HAVE_CLOCK_GETTIME', compiler.has_function('clock_gettime', args: defs, dependencies: threads, prefix: '#include <time.h>')) 186 if conf_data.get('HAVE_CLOCK_GETTIME') 187 clock_lib = threads 188 endif 189 endif 190endif 191 192libelftc = [] 193if compiler.has_function('elftc_copyfile', args: defs + ['-lelftc'], prefix: '#include <libelftc.h>') 194 conf_data.set('HAVE_ELFTC_COPYFILE', true) 195 libelftc = [ compiler.find_library('elftc') ] 196endif 197 198conf_data.set('HAVE_IPV6', compiler.compiles(''' 199 #include <sys/types.h> 200 #include <sys/socket.h> 201 #include <netinet/in.h> 202 203 int main() { 204 struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0; 205 return 0; 206 } 207''', 208 name: 'IPv6 support', 209 args: defs 210)) 211 212conf_data.set('HAVE_WEAK_SYMBOLS', compiler.compiles(''' 213 __attribute__((weak)) void __dummy(void *x) { } 214 int main() { 215 void *x; 216 __dummy(x); 217 } 218''', 219 name: 'weak symbols', 220 args: defs 221)) 222 223conf_data.set('HAVE_STRUCT_TM_GMTOFF', compiler.compiles(''' 224 #include <time.h> 225 int main(void) { 226 struct tm t; 227 t.tm_gmtoff = 0; 228 return 0; 229 } 230''', 231 name: 'struct tm gmt offset', 232 args: defs 233)) 234 235conf_data.set('LIGHTTPD_VERSION_ID', ''.join(['0x104', meson.project_version().split('.')[2]])) 236conf_data.set_quoted('PACKAGE_NAME', meson.project_name()) 237conf_data.set_quoted('PACKAGE_VERSION', meson.project_version()) 238conf_data.set_quoted('LIBRARY_DIR', moduledir) 239 240conf_data.set('LIGHTTPD_STATIC', get_option('build_static')) 241libdl = [] 242if not(get_option('build_static')) 243 if target_machine.system() != 'windows' 244 libdl = [ compiler.find_library('dl', required: false) ] 245 if not(compiler.has_function('dlopen', args: defs, dependencies: libdl, prefix: '#include <dlfcn.h>')) 246 error('Couldn\'t find dlfcn.h or dlopen in lib dl') 247 endif 248 endif 249endif 250 251libbrotli = dependency('libbrotlienc', required: get_option('with_brotli')) 252conf_data.set('HAVE_BROTLI_ENCODE_H', libbrotli.found()) 253conf_data.set('HAVE_BROTLI', libbrotli.found()) 254 255libbz2 = compiler.find_library('bz2', required: get_option('with_bzip')) 256conf_data.set('HAVE_BZLIB_H', libbz2.found()) 257conf_data.set('HAVE_LIBBZ2', libbz2.found()) 258 259libdbi = dependency('dbi', required: get_option('with_dbi')) 260conf_data.set('HAVE_DBI', libdbi.found()) 261 262libfam = [] 263if not conf_data.get('HAVE_SYS_INOTIFY_H') 264 libfam = compiler.find_library('fam', required: get_option('with_fam')) 265 conf_data.set('HAVE_FAM_H', libfam.found()) 266endif 267 268libdeflate = dependency('libdeflate', required: get_option('with_libdeflate')) 269conf_data.set('HAVE_LIBDEFLATE', libdeflate.found()) 270 271libmaxminddb = dependency('libmaxminddb', required: get_option('with_maxminddb')) 272 273libkrb5 = dependency('krb5', required: get_option('with_krb5')) 274libgssapi_krb5 = dependency('krb5-gssapi', required: get_option('with_krb5')) 275conf_data.set('HAVE_KRB5', libkrb5.found() and libgssapi_krb5.found()) 276 277libldap = compiler.find_library('ldap', required: get_option('with_ldap')) 278liblber = compiler.find_library('lber', required: get_option('with_ldap')) 279conf_data.set('HAVE_LDAP_H', libldap.found()) 280conf_data.set('HAVE_LIBLDAP', libldap.found()) 281conf_data.set('HAVE_LBER_H', liblber.found()) 282conf_data.set('HAVE_LIBLBER', liblber.found()) 283 284libpam = compiler.find_library('pam', required: get_option('with_pam')) 285conf_data.set('HAVE_PAM', libpam.found()) 286 287libunwind = dependency('libunwind', required: get_option('with_libunwind')) 288 289liblua = [] 290if get_option('with_lua') 291 lua_version = get_option('lua_version') 292 if (lua_version != '') 293 liblua = dependency(lua_version, required: true) 294 else 295 found_lua = false 296 foreach l: ['lua5.4', 'lua-5.4', 'lua5.3', 'lua-5.3', 'lua5.2', 'lua-5.2', 'lua5.1', 'lua-5.1', 'lua'] 297 liblua = dependency(l, required: false) 298 if not(liblua.found()) 299 liblua = compiler.find_library(l, required: false) 300 if not(liblua.found()) 301 continue 302 endif 303 foreach ib: include_base_paths 304 i = join_paths(ib, l) 305 if compiler.has_header(join_paths(i, 'lua.h')) 306 liblua += [ declare_dependency(include_directories: include_directories(i)) ] 307 break 308 endif 309 endforeach 310 endif 311 found_lua = true 312 break 313 endforeach 314 if not(found_lua) 315 error('Couldn\'t find any lua library') 316 endif 317 endif 318 liblua = [ liblua ] 319 conf_data.set('HAVE_LUA_H', true) 320endif 321 322libmysqlclient = dependency('libmariadb', required: get_option('with_mysql')) 323conf_data.set('HAVE_MYSQL', libmysqlclient.found()) 324 325libssl = [] 326libcrypto = [] 327libsslcrypto = [] 328libgnutls = [] 329libmbedtls = [] 330libmbedcrypto = [] 331libmbedx509 = [] 332libwolfssl = [] 333if get_option('with_openssl') 334 # manual search: 335 # header: openssl/ssl.h 336 # function: SSL_new (-lssl) 337 # function: RAND_bytes (-lcrypto) 338 libssl = [ dependency('libssl') ] 339 libsslcrypto = [ dependency('libcrypto') ] 340 libcrypto = [ dependency('libcrypto') ] 341 conf_data.set('HAVE_OPENSSL_SSL_H', true) 342 conf_data.set('HAVE_LIBSSL', true) 343endif 344if get_option('with_wolfssl') 345 # manual search: 346 # header: wolfssl/ssl.h 347 # function: wolfSSL_Init (-lwolfssl) 348 libwolfssl = [ dependency('wolfssl') ] 349 libcrypto = [ dependency('wolfssl') ] 350 conf_data.set('HAVE_WOLFSSL_SSL_H', true) 351endif 352if get_option('with_mbedtls') 353 # manual search: 354 # header: mbedtls/ssl.h 355 # function: mbedtls_ssl_init (-lmbedtls) 356 # function: mbedtls_x509_get_name (-lmbedx509) 357 # function: mbedtls_base64_encode (-lmbedcrypto) 358 libmbedtls = [ compiler.find_library('mbedtls') ] 359 libmbedx509 = [ compiler.find_library('mbedx509') ] 360 libmbedcrypto = [ compiler.find_library('mbedcrypto') ] 361 libcrypto = [ compiler.find_library('mbedcrypto') ] 362 conf_data.set('HAVE_LIBMBEDCRYPTO', true) 363endif 364if get_option('with_nettle') 365 # manual search: 366 # header: nettle/nettle-types.h 367 # function: nettle_md5_init (-lnettle) 368 libcrypto = [ dependency('nettle') ] 369 conf_data.set('HAVE_NETTLE_NETTLE_TYPES_H', true) 370endif 371if get_option('with_gnutls') 372 # manual search: 373 # header: gnutls/gnutls.h 374 # function: gnutls_check_version (-lgnutls) 375 libgnutls = [ dependency('gnutls') ] 376 conf_data.set('HAVE_GNUTLS_CRYPTO_H', true) 377 if not(get_option('with_openssl')) and not(get_option('with_wolfssl')) and not(get_option('with_mbedtls')) and not(getoption('with_nettle')) 378 libcrypto = [ dependency('gnutls') ] 379 endif 380endif 381libssl3 = [] 382libsmime3 = [] 383libnss3 = [] 384libnssutil3 = [] 385if get_option('with_nss') 386 # manual search: 387 # header: nss3/nss.h 388 # function: NSSSSL_GetVersion (-lssl3) 389 # function: NSSSMIME_GetVersion (-lsmime3) 390 # function: NSS_GetVersion (-lnss3) 391 # function: NSSUTIL_GetVersion (-lnssutil3) 392 libnss3 = [ dependency('nss') ] 393 #libssl3 = [ compiler.find_library('ssl3') ] 394 #libsmime3 = [ compiler.find_library('smime3') ] 395 #libnss3 = [ compiler.find_library('nss3') ] 396 #libnssutil3 = [ compiler.find_library('nssutil3') ] 397 conf_data.set('HAVE_NSS3_NSS_H', true) 398 if not(get_option('with_openssl')) and not(get_option('with_wolfssl')) and not(get_option('with_mbedtls')) and not(getoption('with_nettle')) and not(getoption('with_gnutls')) 399 libcrypto = [ dependency('nss') ] 400 endif 401endif 402if get_option('with_nss') 403 # manual search: 404 # header: nss/nss.h 405 conf_data.set('HAVE_NSS_NSS_H', true) 406endif 407 408libpcre = [] 409pcre = get_option('with_pcre') 410if pcre == 'auto' or get_option('with_pcre2') 411 pcre = 'pcre2' 412endif 413 414if pcre == 'pcre2' 415 libpcre = dependency('libpcre2-8', required: get_option('with_pcre') == 'pcre2' or get_option('with_pcre2')) 416 conf_data.set('HAVE_PCRE2_H', libpcre.found()) 417 conf_data.set('HAVE_PCRE', libpcre.found()) 418 if not libpcre.found() 419 pcre = 'pcre' 420 endif 421endif 422 423if pcre == 'pcre' 424 libpcre = dependency('libpcre', required: pcre == 'pcre') 425 conf_data.set('HAVE_PCRE_H', libpcre.found()) 426 conf_data.set('HAVE_PCRE', libpcre.found()) 427 if not libpcre.found() 428 error('Neither pcre2 nor pcre was found when with_pcre was not disabled') 429 endif 430endif 431 432libpq = dependency('libpq', required: get_option('with_pgsql')) 433conf_data.set('HAVE_PGSQL', libpq.found()) 434 435libsasl = dependency('libsasl2', required: get_option('with_sasl')) 436conf_data.set('HAVE_SASL', libsasl.found()) 437 438#if get_option('with_valgrind') 439#endif 440 441uuid = compiler.has_function('uuid_generate', args: defs, prefix: '#include <uuid/uuid.h>') 442if uuid 443 libuuid = dependency('', required: false) 444else 445 libuuid = dependency('uuid', required: get_option('with_webdav_locks')) 446endif 447 448conf_data.set('HAVE_LIBUUID', uuid) 449conf_data.set('HAVE_UUID_UUID_H', uuid) 450 451libxml2 = dependency('libxml-2.0', required: get_option('with_webdav_props')) 452libsqlite3 = dependency('sqlite3', required: get_option('with_webdav_props')) 453conf_data.set('HAVE_LIBXML2', libxml2.found()) 454conf_data.set('HAVE_LIBXML_H', libxml2.found()) 455conf_data.set('HAVE_SQLITE3_H', libsqlite3.found()) 456 457libattr = [] 458if get_option('with_xattr') 459 if compiler.has_function('getxattr', 460 args: defs, 461 prefix: ''' 462 #include <sys/types.h> 463 #include <sys/xattr.h> 464 ''' 465 ) 466 conf_data.set('HAVE_SYS_XATTR_H', true) 467 conf_data.set('HAVE_XATTR', true) 468 elif compiler.has_function('extattr_get_file', 469 args: defs, 470 prefix: ''' 471 #include <sys/types.h> 472 #include <sys/extattr.h> 473 ''' 474 ) 475 conf_data.set('HAVE_SYS_EXTATTR_H', true) 476 conf_data.set('HAVE_EXTATTR', true) 477 else 478 libattr = [ compiler.find_library('attr') ] 479 if not(compiler.has_function('attr_get', 480 args: defs, 481 dependencies: libattr, 482 prefix: ''' 483 #include <sys/types.h> 484 #include <attr/attributes.h> 485 ''' 486 )) 487 error('Couldn\'t find attr/attributes.h or attr_get in lib attr') 488 endif 489 conf_data.set('HAVE_ATTR_ATTRIBUTES_H', true) 490 conf_data.set('HAVE_XATTR', true) 491 endif 492endif 493 494libxxhash = dependency('libxxhash', required: get_option('with_xxhash')) 495conf_data.set('HAVE_XXHASH_H', libxxhash.found()) 496 497libz = dependency('zlib', required: get_option('with_zlib')) 498conf_data.set('HAVE_ZLIB_H', libz.found()) 499conf_data.set('HAVE_LIBZ', libz.found()) 500 501libzstd = dependency('libzstd', required: get_option('with_zstd')) 502conf_data.set('HAVE_ZSTD_H', libzstd.found()) 503conf_data.set('HAVE_ZSTD', libzstd.found()) 504 505configure_file( 506 output : 'config.h', 507 configuration : conf_data, 508) 509 510common_src = files( 511 'algo_md5.c', 512 'algo_sha1.c', 513 'algo_splaytree.c', 514 'array.c', 515 'base64.c', 516 'buffer.c', 517 'burl.c', 518 'chunk.c', 519 'configfile-glue.c', 520 'http_etag.c', 521 'fdevent.c', 522 'fdevent_fdnode.c', 523 'fdlog_maint.c', 524 'fdlog.c', 525 'gw_backend.c', 526 'http_cgi.c', 527 'http_chunk.c', 528 'http_date.c', 529 'http_header.c', 530 'http_kv.c', 531 'http-header-glue.c', 532 'keyvalue.c', 533 'log.c', 534 'rand.c', 535 'request.c', 536 'ck.c', 537 'sock_addr.c', 538 'stat_cache.c', 539 'sys-setjmp.c', 540) 541 542main_src = files( 543 'configfile.c', 544 'connections.c', 545 'data_config.c', 546 'h2.c', 547 'plugin.c', 548 'sock_addr_cache.c', 549 'ls-hpack/lshpack.c', 550 'algo_xxhash.c', 551 'fdevent_impl.c', 552 'http_range.c', 553 'network_write.c', 554 'network.c', 555 'reqpool.c', 556 'response.c', 557 'server.c', 558) 559 560builtin_mods = files( 561 'mod_rewrite.c', 562 'mod_redirect.c', 563 'mod_access.c', 564 'mod_alias.c', 565 'mod_indexfile.c', 566 'mod_staticfile.c', 567 'mod_setenv.c', 568 'mod_expire.c', 569 'mod_simple_vhost.c', 570 'mod_evhost.c', 571 'mod_fastcgi.c', 572 'mod_scgi.c', 573) 574 575if get_option('build_static') 576 main_src += builtin_mods 577endif 578 579lemon = executable('lemon', 580 sources: 'lemon.c', 581 native: true, 582) 583# generator doesn't handle additional "input dependencies" like lempar.c 584# => use custom_target 585configparser = custom_target('configparser', 586 input: ['configparser.y', 'lempar.c'], 587 output: ['configparser.c', 'configparser.h'], 588 command: [lemon, '-q', '-d@OUTDIR@', '-T@INPUT1@', '@INPUT0@'], 589) 590 591common_cflags = defs + [ 592 '-DHAVE_CONFIG_H', 593] 594 595if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang' 596 common_cflags += [ 597 '-pipe', 598 '-Wall', 599 '-g', 600 '-Wshadow', 601 '-W', 602 '-pedantic', 603 ] 604 if get_option('build_extra_warnings') 605 common_cflags += get_option('warn_cflags').split() 606 endif 607endif 608 609common_flags = [ declare_dependency( 610 compile_args: common_cflags, 611 # tests also use common_flags, and need this 612 include_directories: include_directories('.'), 613) ] 614 615lighttpd_flags = [] 616lighttpd_angel_flags = [] 617if target_machine.system() == 'windows' 618 lighttpd_flags += [ declare_dependency( 619 compile_args: [ 620 '-DLI_DECLARE_EXPORTS', 621 ], 622 ) ] 623 if compiler.get_id() == 'gcc' 624 libmsvcr70 = [ compiler.find_library('msvcr70') ] 625 lighttpd_flags += libmsvcr70 + [ declare_dependency( 626 link_args: [ 627 '-Wl,-subsystem,console', 628 ], 629 ) ] 630 lighttpd_angel_flags += libmsvcr70 + [ declare_dependency( 631 link_args: [ 632 '-Wl,-subsystem,console', 633 ], 634 ) ] 635 endif 636endif 637 638if (compiler.get_id() == 'gcc' or compiler.get_id() == 'clang') and target_machine.system() != 'darwin' and target_machine.system() != 'sunos' 639 lighttpd_flags += [ declare_dependency( 640 link_args: [ 641 '-Wl,-export-dynamic', 642 ], 643 ) ] 644endif 645 646executable('lighttpd-angel', 647 sources: 'lighttpd-angel.c', 648 dependencies: common_flags + lighttpd_angel_flags, 649 c_args: ['-DSBIN_DIR="' + sbindir + '"'], 650 install: true, 651 install_dir: sbindir, 652) 653 654executable('lighttpd', configparser, 655 sources: common_src + main_src, 656 dependencies: [ common_flags, lighttpd_flags 657 , libattr 658 , libcrypto 659 , libdl 660 , libfam 661 , libpcre 662 , libunwind 663 , libxxhash 664 , socket_libs 665 , clock_lib 666 ], 667 install: true, 668 install_dir: sbindir, 669) 670 671test('test_common', executable('test_common', 672 sources: [ 673 't/test_common.c', 674 't/test_array.c', 675 't/test_base64.c', 676 't/test_buffer.c', 677 't/test_burl.c', 678 't/test_http_header.c', 679 't/test_http_kv.c', 680 't/test_keyvalue.c', 681 't/test_request.c', 682 'log.c', 683 'fdlog.c', 684 'sock_addr.c', 685 'ck.c', 686 ], 687 dependencies: [ common_flags 688 , libpcre 689 , libunwind 690 , socket_libs 691 , clock_lib 692 ], 693 build_by_default: false, 694)) 695 696test('test_configfile', executable('test_configfile', 697 sources: [ 698 't/test_configfile.c', 699 'buffer.c', 700 'array.c', 701 'data_config.c', 702 'http_header.c', 703 'http_kv.c', 704 'log.c', 705 'fdlog.c', 706 'sock_addr.c', 707 'ck.c', 708 ], 709 dependencies: [ common_flags 710 , libpcre 711 , libunwind 712 , socket_libs 713 , clock_lib 714 ], 715 build_by_default: false, 716)) 717 718test('test_mod', executable('test_mod', 719 sources: [ 720 common_src, 721 't/test_mod.c', 722 't/test_mod_access.c', 723 't/test_mod_alias.c', 724 't/test_mod_evhost.c', 725 't/test_mod_indexfile.c', 726 't/test_mod_simple_vhost.c', 727 't/test_mod_ssi.c', 728 't/test_mod_staticfile.c', 729 't/test_mod_userdir.c', 730 ], 731 dependencies: [ common_flags, lighttpd_flags 732 , libattr 733 , libcrypto 734 , libdl 735 , libfam 736 , libpcre 737 , libunwind 738 , libxxhash 739 , socket_libs 740 , clock_lib 741 ], 742 build_by_default: false, 743)) 744 745modules = [ 746 [ 'mod_accesslog', [ 'mod_accesslog.c' ] ], 747 [ 'mod_ajp13', [ 'mod_ajp13.c' ] ], 748 [ 'mod_auth', [ 'mod_auth.c', 'mod_auth_api.c' ], [ libcrypto ] ], 749 [ 'mod_authn_file', [ 'mod_authn_file.c' ], [ libcrypt, libcrypto ] ], 750 [ 'mod_deflate', [ 'mod_deflate.c' ], [ libbz2, libz, libzstd, libbrotli, libdeflate ] ], 751 [ 'mod_dirlisting', [ 'mod_dirlisting.c' ] ], 752 [ 'mod_extforward', [ 'mod_extforward.c' ] ], 753 [ 'mod_proxy', [ 'mod_proxy.c' ], socket_libs ], 754 [ 'mod_rrdtool', [ 'mod_rrdtool.c' ] ], 755 [ 'mod_sockproxy', [ 'mod_sockproxy.c' ] ], 756 [ 'mod_ssi', [ 'mod_ssi.c' ], socket_libs ], 757 [ 'mod_status', [ 'mod_status.c' ] ], 758 [ 'mod_userdir', [ 'mod_userdir.c' ] ], 759 [ 'mod_vhostdb', [ 'mod_vhostdb.c', 'mod_vhostdb_api.c' ] ], 760 [ 'mod_webdav', [ 'mod_webdav.c' ], [ libsqlite3, libuuid, libxml2, libelftc ] ], 761 [ 'mod_wstunnel', [ 'mod_wstunnel.c' ], libcrypto ], 762] 763 764if target_machine.system() != 'windows' 765 modules += [ 766 [ 'mod_cgi', [ 'mod_cgi.c' ] ], 767 ] 768endif 769 770if get_option('with_lua') 771 modules += [ 772 [ 'mod_magnet', [ 'mod_magnet.c', 'mod_magnet_cache.c', 'algo_hmac.c' ], liblua + libcrypto ], 773 ] 774endif 775 776if libmaxminddb.found() 777 modules += [ 778 [ 'mod_maxminddb', [ 'mod_maxminddb.c' ], libmaxminddb ], 779 ] 780endif 781 782if libmysqlclient.found() 783 modules += [ 784 [ 'mod_vhostdb_mysql', [ 'mod_vhostdb_mysql.c' ], libmysqlclient ], 785 ] 786endif 787 788if libpq.found() 789 modules += [ 790 [ 'mod_vhostdb_pgsql', [ 'mod_vhostdb_pgsql.c' ], libpq ], 791 ] 792endif 793 794if libdbi.found() 795 modules += [ 796 [ 'mod_authn_dbi', [ 'mod_authn_dbi.c' ], [ libcrypt, libdbi, libcrypto ] ], 797 [ 'mod_vhostdb_dbi', [ 'mod_vhostdb_dbi.c' ], libdbi ], 798 ] 799endif 800 801if libkrb5.found() and libgssapi_krb5.found() 802 modules += [ 803 [ 'mod_authn_gssapi', [ 'mod_authn_gssapi.c' ], [ libkrb5, libgssapi_krb5 ] ], 804 ] 805endif 806 807if libldap.found() and liblber.found() 808 modules += [ 809 [ 'mod_authn_ldap', [ 'mod_authn_ldap.c' ], [ libldap, liblber ] ], 810 [ 'mod_vhostdb_ldap', [ 'mod_vhostdb_ldap.c' ], [ libldap, liblber ] ], 811 ] 812endif 813 814if get_option('with_openssl') 815 modules += [ 816 [ 'mod_openssl', [ 'mod_openssl.c' ], libssl + libsslcrypto ], 817 ] 818endif 819 820if get_option('with_wolfssl') 821 modules += [ 822 [ 'mod_wolfssl', [ 'mod_wolfssl.c' ], libwolfssl ], 823 ] 824endif 825 826if get_option('with_mbedtls') 827 modules += [ 828 [ 'mod_mbedtls', [ 'mod_mbedtls.c' ], libmbedtls + libmbedx509 + libmbedcrypto ], 829 ] 830endif 831 832if get_option('with_nss') 833 modules += [ 834 [ 'mod_nss', [ 'mod_nss.c' ], libssl3 + libsmime3 + libnss3 + libnssutil3 ], 835 ] 836endif 837 838if get_option('with_gnutls') 839 modules += [ 840 [ 'mod_gnutls', [ 'mod_gnutls.c' ], libgnutls ], 841 ] 842endif 843 844if libpam.found() 845 modules += [ 846 [ 'mod_authn_pam', [ 'mod_authn_pam.c' ], libpam ], 847 ] 848endif 849 850if libsasl.found() 851 modules += [ 852 [ 'mod_authn_sasl', [ 'mod_authn_sasl.c' ], libsasl ], 853 ] 854endif 855 856foreach mod: modules 857 mod_name = mod.get(0) 858 mod_sources = mod.get(1) 859 mod_deps = mod.length() > 2 ? mod.get(2) : [] 860 shared_module(mod_name, 861 sources: mod_sources, 862 dependencies: [ common_flags, mod_deps ], 863 name_prefix: '', 864 install: true, 865 install_dir: moduledir, 866 ) 867endforeach 868