Commit d6e9cb06 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

build: use local getopt for anything system where it's missing

Do not force include the compat folder as it may contain headers that do exist
for the compiler. Include the compat headers individually when they are needed
and use an explicit path to compat/
parent ce0f141e
Pipeline #611 passed with stage
in 1 minute and 26 seconds
......@@ -50,8 +50,6 @@ extern int optreset;
* specific block, only when *not* __UNISTD_H_SOURCED__, in which
* to declare the extended API.
*/
#endif /* !defined(__GETOPT_H__) */
#if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__)
#define __GETOPT_LONG_H__
......@@ -93,3 +91,5 @@ extern int getopt_long_only(int nargc, char * const *nargv, const char *options,
#endif
#endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */
#endif /* !defined(__GETOPT_H__) */
......@@ -44,7 +44,9 @@ else
thread_dependency = declare_dependency(sources: ['src/win32/thread.c'])
endif
dav1d_inc_dirs = include_directories(['include', 'include/dav1d'])
if cc.has_function('getopt_long', prefix : '#include <getopt.h>')
cdata.set('HAVE_GETOPT_H',1)
endif
#
# Option handling
......@@ -170,6 +172,11 @@ cdata.set10('HAVE_ASM', is_asm_enabled)
#
# Generate config headers
#
if cdata.has('HAVE_GETOPT_H')
dav1d_inc_dirs = include_directories(['include', 'include/dav1d'])
else
dav1d_inc_dirs = include_directories(['include', 'include/dav1d', 'include/compat'])
endif
config_h_target = configure_file(output: 'config.h', configuration: cdata)
......@@ -331,7 +338,7 @@ dav1d_sources = files(
'tools/output/yuv.c'
)
if cc.get_id() == 'msvc'
if not cdata.has('HAVE_GETOPT_H')
dav1d_sources += files('tools/compat/getopt.c')
endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment