Skip to content

Commit

Permalink
fixup! Correctly compute size of timeval.tv_sec on Windows.
Browse files Browse the repository at this point in the history
Simply compute size of `long` on Windows.
  • Loading branch information
mgautierfr authored and neheb committed Aug 30, 2024
1 parent fe22833 commit e3b4249
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions subprojects/packagefiles/libmicrohttpd/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,13 @@ foreach s : ['size_t', 'unsigned int', 'unsigned long long']
cdata.set('SIZEOF_@0@'.format(s.underscorify().to_upper()), cc.sizeof(s))
endforeach

cdata.set(
'SIZEOF_STRUCT_TIMEVAL_TV_SEC',
cc.sizeof(
'test_var.tv_sec',
prefix: '''#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#ifdef HAVE_TIME_H
#include <time.h>
#endif /* HAVE_TIME_H */
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef _WIN32
#include <winsock.h>
#endif /* _WIN32 */
struct timeval test_var;'''
)
)
if host_machine.system() == 'windows'
# `timevale.tv_sec` is `long` on Windows
# See https://learn.microsoft.com/en-us/windows/win32/api/winsock/ns-winsock-timeval
cdata.set('SIZEOF_STRUCT_TIMEVAL_TV_SEC', cc.sizeof('long'))
else
cdata.set('SIZEOF_STRUCT_TIMEVAL_TV_SEC', cc.sizeof('time_t', prefix: '#include <time.h>'))
endif
cdata.set('SIZEOF_UINT64_T', cc.sizeof('uint64_t', prefix: '#include <stdint.h>'))

cdata.set('HAVE_PIPE2_FUNC', cc.has_function('pipe2'))
Expand Down

0 comments on commit e3b4249

Please sign in to comment.