commit f1df0ebc62537953b1d93d45594de7c81f583583
parent 907c48f5c97ba0e6af582ea1fb3d7f6f4927feeb
Author: Florian Dold <florian@dold.me>
Date: Wed, 21 Dec 2022 15:38:03 +0100
build system
Diffstat:
1 file changed, 54 insertions(+), 50 deletions(-)
diff --git a/subprojects/curl/meson.build b/subprojects/curl/meson.build
@@ -2,59 +2,62 @@ project('curl', 'c')
c_compiler = meson.get_compiler('c')
+add_project_arguments('-DHTTP_ONLY', language : 'c')
add_project_arguments('-DCURL_DISABLE_LDAP', language : 'c')
add_project_arguments('-DCURL_DISABLE_IMAP', language : 'c')
add_project_arguments('-DCURL_DISABLE_SMTP', language : 'c')
add_project_arguments('-DCURL_DISABLE_POP3', language : 'c')
add_project_arguments('-D_GNU_SOURCE', language : 'c')
-if c_compiler.check_header('unistd.h')
- add_project_arguments('-DHAVE_UNISTD_H', language : 'c')
-endif
-
-if c_compiler.check_header('signal.h')
- add_project_arguments('-DHAVE_SIGNAL_H', language : 'c')
-endif
-
-if c_compiler.check_header('time.h')
- add_project_arguments('-DHAVE_TIME_H', language : 'c')
-endif
-
-if c_compiler.check_header('netinet/in.h')
- add_project_arguments('-DHAVE_NETINET_IN_H', language : 'c')
-endif
-
-if c_compiler.check_header('netdb.h')
- add_project_arguments('-DHAVE_NETDB_H', language : 'c')
-endif
-
-if c_compiler.check_header('fcntl.h')
- add_project_arguments('-DHAVE_FCNTL_H', language : 'c')
-endif
-
-if c_compiler.check_header('arpa/inet.h')
- add_project_arguments('-DHAVE_ARPA_INET_H', language : 'c')
-endif
-
-if c_compiler.check_header('sys/socket.h')
- add_project_arguments('-DHAVE_SYS_SOCKET_H', language : 'c')
-endif
-
-if c_compiler.check_header('sys/types.h')
- add_project_arguments('-DHAVE_SYS_TYPES_H', language : 'c')
-endif
-
-if c_compiler.check_header('sys/select.h')
- add_project_arguments('-DHAVE_SYS_SELECT_H', language : 'c')
-endif
-
-if c_compiler.check_header('sys/stat.h')
- add_project_arguments('-DHAVE_SYS_STAT_H', language : 'c')
-endif
+basic_headers = [
+ 'sys/types.h',
+ 'sys/time.h',
+ 'sys/select.h',
+ 'sys/socket.h',
+ 'sys/ioctl.h',
+ 'sys/uio.h',
+ 'assert.h',
+ 'unistd.h',
+ 'stdlib.h',
+ 'arpa/inet.h',
+ 'net/if.h',
+ 'netinet/in.h',
+ 'netinet/in6.h',
+ 'sys/un.h',
+ 'linux/tcp.h',
+ 'netinet/tcp.h',
+ 'netinet/udp.h',
+ 'netdb.h',
+ 'sys/sockio.h',
+ 'sys/stat.h',
+ 'sys/param.h',
+ 'termios.h',
+ 'termio.h',
+ 'fcntl.h',
+ 'io.h',
+ 'pwd.h',
+ 'utime.h',
+ 'sys/utime.h',
+ 'sys/poll.h',
+ 'poll.h',
+ 'socket.h',
+ 'sys/resource.h',
+ 'libgen.h',
+ 'locale.h',
+ 'errno.h',
+ 'stdbool.h',
+ 'arpa/tftp.h',
+ 'sys/filio.h',
+ 'sys/wait.h',
+ 'setjmp.h',
+]
-if c_compiler.check_header('sys/poll.h')
- add_project_arguments('-DHAVE_SYS_POLL_H', language : 'c')
-endif
+foreach bh : basic_headers
+ if c_compiler.check_header(bh)
+ n = bh.to_upper().underscorify()
+ add_project_arguments(f'-DHAVE_@n@', language : 'c')
+ endif
+endforeach
sizeof_curl_off_t = c_compiler.sizeof('curl_off_t', prefix : '#include <curl/system.h>')
add_project_arguments(f'-DSIZEOF_CURL_OFF_T=@sizeof_curl_off_t@', language : 'c')
@@ -67,21 +70,22 @@ add_project_arguments(f'-DSIZEOF_TIME_T=@sizeof_time_t@', language : 'c')
sizeof_off_t = c_compiler.sizeof('off_t')
add_project_arguments(f'-DSIZEOF_OFF_T=@sizeof_off_t@', language : 'c')
-add_project_arguments('-DHAVE_ERRNO_H', language : 'c')
-add_project_arguments('-DHAVE_STDBOOL_H', language : 'c')
add_project_arguments('-DHAVE_BOOL_T', language : 'c')
add_project_arguments('-DHAVE_STRUCT_TIMEVAL', language : 'c')
add_project_arguments('-DHAVE_RECV', language : 'c')
add_project_arguments('-DHAVE_SEND', language : 'c')
add_project_arguments('-DHAVE_LONGLONG', language : 'c')
-add_project_arguments('-DHAVE_LONGLONG', language : 'c')
+
+if c_compiler.has_function('gethostbyname', prefix : '#include <netdb.h>')
+ add_project_arguments('-DHAVE_GETHOSTBYNAME', language : 'c')
+endif
# FIXME: test for this!
add_project_arguments('-DHAVE_FCNTL_O_NONBLOCK', language : 'c')
add_project_arguments('-DHAVE_SELECT', language : 'c')
add_project_arguments('-DHAVE_SOCKET', language : 'c')
os = host_machine.system()
-add_project_arguments('-DOS="@os@"', language : 'c')
+add_project_arguments(f'-DOS="@os@"', language : 'c')
# SSL config
add_project_arguments('-DUSE_MBEDTLS', language : 'c')