build: don't rely on implicit GNU extensions
Currently libwayland assumes GNU extensions will be available, but doesn't define the C standard to use. Instead, let's unconditionally enable POSIX extensions, and enable GNU extensions on a case-by-case basis as needed. Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
65616e946b
commit
0d314c4a04
|
@ -23,6 +23,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include "xcursor.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
10
meson.build
10
meson.build
|
@ -14,6 +14,12 @@ config_h = configuration_data()
|
|||
config_h.set_quoted('PACKAGE', meson.project_name())
|
||||
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||
|
||||
cc_args = []
|
||||
if host_machine.system() != 'freebsd'
|
||||
cc_args += ['-D_POSIX_C_SOURCE=200809L']
|
||||
endif
|
||||
add_project_arguments(cc_args, language: 'c')
|
||||
|
||||
compiler_flags = [
|
||||
'-Wno-unused-parameter',
|
||||
'-Wstrict-prototypes',
|
||||
|
@ -79,7 +85,7 @@ if get_option('libraries')
|
|||
]
|
||||
|
||||
foreach d: decls
|
||||
if not cc.has_header_symbol(d['header'], d['symbol'], dependencies: epoll_dep)
|
||||
if not cc.has_header_symbol(d['header'], d['symbol'], dependencies: epoll_dep, args: cc_args)
|
||||
error('@0@ is needed to compile Wayland libraries'.format(d['symbol']))
|
||||
endif
|
||||
endforeach
|
||||
|
@ -87,7 +93,7 @@ if get_option('libraries')
|
|||
rt_dep = []
|
||||
if not cc.has_function('clock_gettime', prefix: '#include <time.h>')
|
||||
rt_dep = cc.find_library('rt')
|
||||
if not cc.has_function('clock_gettime', prefix: '#include <time.h>', dependencies: rt_dep)
|
||||
if not cc.has_function('clock_gettime', prefix: '#include <time.h>', dependencies: rt_dep, args: cc_args)
|
||||
error('clock_gettime not found')
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
|
Loading…
Reference in New Issue
Block a user