# We rely on the glibc variant of basename, et al.
cdata.set10('_GNU_SOURCE', true)
-# TODO: Once meson-only, adjust all #ifdef X to if X and convert .set to .set10
-
################################################################################
# Function and structure checks
################################################################################
'secure_getenv',
]
foreach func : _funcs
- if cc.has_function(func, args : '-D_GNU_SOURCE')
- cdata.set('HAVE_@0@'.format(func.to_upper()), true)
- endif
+ cdata.set10('HAVE_@0@'.format(func.to_upper()), cc.has_function(func, args : '-D_GNU_SOURCE'))
endforeach
# Meson has some amount of support for finding builtins by passing the symbol
cdata.set10('HAVE_DECL_@0@'.format(decl.to_upper()), have)
endforeach
-if cc.compiles('_Static_assert(1, "Test");', name : '_Static_assert')
- cdata.set('HAVE_STATIC_ASSERT', true)
-endif
-
-if cc.compiles('''
- #include <stdlib.h>
- _Noreturn int foo(void) { exit(0); }
- ''',
- name : '_Noreturn')
- cdata.set('HAVE_NORETURN', true)
-endif
+cdata.set10('HAVE_STATIC_ASSERT', cc.compiles('_Static_assert(1, "Test");', name : '_Static_assert'))
+cdata.set10('HAVE_NORETURN', cc.compiles('#include <stdlib.h>; _Noreturn int foo(void) { exit(0); }', name : '_Noreturn'))
################################################################################
# Default CFLAGS and LDFLAGS
#include <stddef.h>
-#if defined(HAVE_STATIC_ASSERT)
+#if HAVE_STATIC_ASSERT
#define assert_cc(expr) _Static_assert((expr), #expr)
#else
#define assert_cc(expr) \
/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
* compiler versions */
#ifndef noreturn
-#if defined(HAVE_NORETURN)
+#if HAVE_NORETURN
#define noreturn _Noreturn
#else
#define noreturn __attribute__((noreturn))
WRAP_OPEN();
-#ifdef HAVE_FOPEN64
+#if HAVE_FOPEN64
WRAP_2ARGS(FILE *, NULL, fopen64, const char *);
#endif
-#ifdef HAVE_STAT64
+#if HAVE_STAT64
WRAP_2ARGS(int, -1, stat64, struct stat64 *);
#endif
-#ifdef HAVE___STAT64_TIME64
+#if HAVE___STAT64_TIME64
extern int __stat64_time64(const char *file, void *buf);
WRAP_2ARGS(int, -1, __stat64_time64, void *);
#endif
-#ifdef HAVE_OPEN64
+#if HAVE_OPEN64
WRAP_OPEN(64);
#endif