File: meson.build

package info (click to toggle)
spawn-fcgi 1.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 148 kB
  • sloc: ansic: 524; sh: 135; makefile: 2
file content (119 lines) | stat: -rw-r--r-- 2,335 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
project(
  'spawn-fcgi',
  'c',
  default_options: [
    'buildtype=debugoptimized',
    'warning_level=3',
    'c_std=gnu99',
  ],
  version: '1.6.6',
  license: 'BSD-3-Clause',
)

compiler = meson.get_compiler('c')

conf_data = configuration_data()
conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
conf_data.set_quoted('PACKAGE_NAME', meson.project_name())

warn_c_args = [
  '-Wshadow',
  '-W',
  '-pedantic',
]
if get_option('extra-warnings')
  warn_c_args += [
    '-Wmissing-declarations',
    '-Wdeclaration-after-statement',
    '-Wcast-align',
    '-Wsign-compare',
    '-Wnested-externs',
    '-Wpointer-arith',
    '-Wmissing-prototypes',
    '-Wno-pointer-sign',
    '-Wformat',
    '-Wformat-security',
    '-D_FORTIFY_SOURCE=2',
    '-fstack-protector',
    '--param=ssp-buffer-size=4',
  ]
endif

check_libc_functions = [
  'issetugid',
]

# run compiler/env checks
foreach libc_function: check_libc_functions
  if compiler.has_function(libc_function)
    conf_data.set10('HAVE_' + libc_function.underscorify().to_upper(), true)
  endif
endforeach
add_project_arguments(
  compiler.get_supported_arguments(warn_c_args),
  language: 'c'
)

if compiler.has_type(
  'socklen_t',
  prefix: '\n'.join([
    '#include <sys/socket.h>',
  ]),
)
  conf_data.set10('HAVE_SOCKLEN_T', true)
endif

# IPv6 support is mandatory by default
if get_option('ipv6')
  has_sockaddr_in6 = compiler.has_type(
    'struct sockaddr_in6',
    prefix: '\n'.join([
      '#include <sys/types.h>',
      '#include <sys/socket.h>',
      '#include <netinet/in.h>',
    ]),
  )
  has_inet_pton = compiler.has_function('inet_pton')

  if has_sockaddr_in6 and has_inet_pton
    conf_data.set10('USE_IPV6', true)
  else
    error('Missing struct sockaddr_in6 or inet_pton, required for IPv6 support')
  endif
endif

# solaris needs -lsocket -lnsl

test_socket_inet_addr_link = '''
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int main() {
  int s = socket(0, 0, 0);
  in_addr_t a = inet_addr("");
  return 0;
}
'''

if compiler.links(test_socket_inet_addr_link)
  socket_deps = []
else
  socket_deps = [
    compiler.find_library('socket'),
    compiler.find_library('nsl'),
  ]
endif

subdir('src')

install_man(
  'spawn-fcgi.1',
)

summary(
  {
    'ipv6': get_option('ipv6'),
  },
  section: 'Features',
)