blob: 45fff3f2590bf459a531f071489554c5cde72062 [file] [log] [blame]
Tim-Philipp Müllerc2b542b2016-03-19 15:40:22 +00001project('opus', 'c',
2 version: run_command('meson/get-version.py', '--package-version', check: true).stdout().strip(),
3 meson_version: '>=0.54.0',
4 default_options: ['warning_level=2',
5 'c_std=gnu99',
6 'buildtype=debugoptimized'])
7
8libversion = run_command('meson/get-version.py', '--libtool-version', check: true).stdout().strip()
9macosversion = run_command('meson/get-version.py', '--darwin-version', check: true).stdout().strip()
10
11cc = meson.get_compiler('c')
12host_system = host_machine.system()
13host_cpu_family = host_machine.cpu_family()
14
15opus_includes = include_directories('.', 'include', 'celt', 'silk')
16opus_public_includes = include_directories('include')
17
18add_project_arguments('-DOPUS_BUILD', language: 'c')
19add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
20
21if host_system == 'windows'
22 if cc.get_argument_syntax() == 'msvc'
23 add_project_arguments('-D_CRT_SECURE_NO_WARNINGS', language: 'c')
24 endif
25endif
26
27if cc.get_argument_syntax() == 'gnu'
28 add_project_arguments('-D_FORTIFY_SOURCE=2', language: 'c')
29endif
30
31# Check for extra compiler args
32additional_c_args = []
33if cc.get_argument_syntax() != 'msvc'
34 additional_c_args += [
35 '-fvisibility=hidden',
36 '-Wcast-align',
37 '-Wnested-externs',
38 '-Wshadow',
39 '-Wstrict-prototypes',
40 ]
41
42 # On Windows, -fstack-protector-strong adds a libssp-0.dll dependency and
43 # prevents static linking
44 if host_system != 'windows'
45 additional_c_args += ['-fstack-protector-strong']
46 endif
47endif
48
49foreach arg : additional_c_args
50 if cc.has_argument(arg)
51 add_project_arguments(arg, language: 'c')
52 endif
53endforeach
54
55# Windows MSVC warnings
56if cc.get_id() == 'msvc'
57 # Ignore several spurious warnings.
58 # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
59 # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
60 # NOTE: Only add warnings here if you are sure they're spurious
61 add_project_arguments('/wd4035', '/wd4715', '/wd4116', '/wd4046', '/wd4068',
62 '/wd4820', '/wd4244', '/wd4255', '/wd4668',
63 language : 'c')
64endif
65
66opus_version = meson.project_version()
67
68opus_conf = configuration_data()
69opus_conf.set('PACKAGE_BUGREPORT', '"opus@xiph.org"')
70opus_conf.set('PACKAGE_NAME', '"opus"')
71opus_conf.set('PACKAGE_STRING', '"opus @0@"'.format(opus_version))
72opus_conf.set('PACKAGE_TARNAME', '"opus"')
73opus_conf.set('PACKAGE_URL', '""')
74opus_conf.set('PACKAGE_VERSION', '"@0@"'.format(opus_version))
75
76# FIXME: optional Ne10 dependency
77have_arm_ne10 = false
78
79libm = cc.find_library('m', required : false)
80
81opus_conf.set('HAVE_LRINTF', cc.has_function('lrintf', prefix: '#include <math.h>', dependencies: libm))
82opus_conf.set('HAVE_LRINT', cc.has_function('lrint', prefix: '#include <math.h>', dependencies: libm))
83opus_conf.set('HAVE___MALLOC_HOOK', cc.has_function('__malloc_hook', prefix: '#include <malloc.h>'))
84opus_conf.set('HAVE_STDINT_H', cc.check_header('stdint.h'))
85
86# Check for restrict keyword
87restrict_tmpl = '''
88typedef int * int_ptr;
89int foo (int_ptr @0@ ip, int * @0@ baz[]) {
90 return ip[0];
91}
92int main (int argc, char ** argv) {
93 int s[1];
94 int * @0@ t = s;
95 t[0] = 0;
96 return foo(t, (void *)0);
97}'''
98# Define restrict to the equivalent of the C99 restrict keyword, or to
99# nothing if this is not supported. Do not define if restrict is
100# supported directly.
101if not cc.compiles(restrict_tmpl.format('restrict'), name : 'restrict keyword')
102 if cc.compiles(restrict_tmpl.format('__restrict'), name : '__restrict')
103 opus_conf.set('restrict', '__restrict')
104 elif cc.compiles(restrict_tmpl.format('__restrict__'), name : '__restrict__')
105 opus_conf.set('restrict', '__restrict')
106 elif cc.compiles(restrict_tmpl.format('_Restrict'), name : '_Restrict')
107 opus_conf.set('restrict', '_Restrict')
108 else
109 opus_conf.set('restrict', '/**/')
110 endif
111endif
112
113# Check for C99 variable-size arrays, or alloca() as fallback
114msg_use_alloca = false
115if cc.compiles('''static int x;
116 char some_func (void) {
117 char a[++x];
118 a[sizeof a - 1] = 0;
119 int N;
120 return a[0];
121 }''', name : 'C99 variable-size arrays')
122 opus_conf.set('VAR_ARRAYS', 1)
123 msg_use_alloca = 'NO (using C99 variable-size arrays instead)'
124elif cc.compiles('''#include <alloca.h>
125 void some_func (void) {
126 int foo=10;
127 int * array = alloca(foo);
128 }''', name : 'alloca (alloca.h)')
129 opus_conf.set('USE_ALLOCA', true)
130 opus_conf.set('HAVE_ALLOCA_H', true)
131 msg_use_alloca = true
132elif cc.compiles('''#include <malloc.h>
133 #include <stdlib.h>
134 void some_func (void) {
135 int foo=10;
136 int * array = alloca(foo);
137 }''', name : 'alloca (std)')
138 opus_conf.set('USE_ALLOCA', true)
139 msg_use_alloca = true
140endif
141
142opts = [
143 [ 'fixed-point', 'FIXED_POINT' ],
144 [ 'fixed-point-debug', 'FIXED_DEBUG' ],
145 [ 'custom-modes', 'CUSTOM_MODES' ],
146 [ 'float-approx', 'FLOAT_APPROX' ],
147 [ 'assertions', 'ENABLE_ASSERTIONS' ],
148 [ 'hardening', 'ENABLE_HARDENING' ],
149 [ 'fuzzing', 'FUZZING' ],
150 [ 'check-asm', 'OPUS_CHECK_ASM' ],
151]
152
153foreach opt : opts
154 # we assume these are all boolean options
155 opt_foo = get_option(opt[0])
156 if opt_foo
157 opus_conf.set(opt[1], 1)
158 endif
159 set_variable('opt_' + opt[0].underscorify(), opt_foo)
160endforeach
161
162opt_asm = get_option('asm')
163opt_rtcd = get_option('rtcd')
164opt_intrinsics = get_option('intrinsics')
165extra_programs = get_option('extra-programs')
166opt_tests = get_option('tests')
167
168disable_float_api = not get_option('float-api')
169if disable_float_api
170 opus_conf.set('DISABLE_FLOAT_API', 1)
171endif
172
173# This is for the description in the pkg-config .pc file
174if opt_fixed_point
175 pc_build = 'fixed-point'
176else
177 pc_build = 'floating-point'
178endif
179if opt_custom_modes
180 pc_build = pc_build + ', custom modes'
181endif
182
183rtcd_support = []
184# With GCC, Clang, ICC, etc, we differentiate between 'may support this SIMD'
185# and 'presume we have this SIMD' by checking whether the SIMD / intrinsics can
186# be compiled by the compiler as-is (presume) or with SIMD cflags (may have).
187# With MSVC, the compiler will always build SIMD/intrinsics targeting all
188# specific instruction sets supported by that version of the compiler. No
189# special arguments are ever needed. If runtime CPU detection is not disabled,
190# we must always assume that we only 'may have' it.
191opus_can_presume_simd = true
192if cc.get_argument_syntax() == 'msvc'
193 if opt_rtcd.disabled()
194 warning('Building with an MSVC-like compiler and runtime CPU detection is disabled. Outputs may not run on all @0@ CPUs.'.format(host_cpu_family))
195 else
196 opus_can_presume_simd = false
197 endif
198endif
199
200opus_arm_external_asm = false
201
202asm_tmpl = '''
203int main (int argc, char ** argv) {
204 __asm__("@0@");
205 return 0;
206}'''
207
208asm_optimization = []
209inline_optimization = []
210if not opt_asm.disabled()
211 # Currently we only have inline asm for fixed-point
212 if host_cpu_family == 'arm' and opt_fixed_point
213 opus_conf.set('OPUS_ARM_ASM', true)
214
215 # Check if compiler supports gcc-style inline assembly
216 if cc.compiles('''#ifdef __GNUC_MINOR__
217 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 3004
218 #error GCC before 3.4 has critical bugs compiling inline assembly
219 #endif
220 #endif
221 __asm__ (""::)''',
222 name : 'compiler supports gcc-style inline assembly')
223
224 opus_conf.set('OPUS_ARM_INLINE_ASM', 1)
225
226 # AS_ASM_ARM_EDSP
227 if cc.compiles(asm_tmpl.format('qadd r3,r3,r3'),
228 name : 'assembler supports EDSP instructions on ARM')
229 opus_conf.set('OPUS_ARM_INLINE_EDSP', 1)
230 inline_optimization += ['ESDP']
231 endif
232
233 # AS_ASM_ARM_MEDIA
234 if cc.compiles(asm_tmpl.format('shadd8 r3,r3,r3'),
235 name : 'assembler supports ARMv6 media instructions on ARM')
236 opus_conf.set('OPUS_ARM_INLINE_MEDIA', 1)
237 inline_optimization += ['Media']
238 endif
239
240 # AS_ASM_ARM_NEON
241 if cc.compiles(asm_tmpl.format('vorr d0,d0,d0'),
242 name : 'assembler supports NEON instructions on ARM')
243 opus_conf.set('OPUS_ARM_INLINE_NEON', 1)
244 inline_optimization += ['NEON']
245 endif
246 endif
247
248 # We need Perl to translate RVCT-syntax asm to gas syntax
249 perl = find_program('perl', required: get_option('asm'))
250 if perl.found()
251 opus_arm_external_asm = true
252 # opus_arm_presume_* mean we can and will use those instructions
253 # directly without doing runtime CPU detection.
254 # opus_arm_may_have_* mean we can emit those instructions, but we can
255 # only use them after runtime detection.
256 # The same rules apply for x86 assembly and intrinsics.
257
258 opus_arm_may_have_edsp = opus_conf.has('OPUS_ARM_INLINE_EDSP')
259 opus_arm_presume_edsp = opus_arm_may_have_edsp and opus_can_presume_simd
260
261 opus_arm_may_have_media = opus_conf.has('OPUS_ARM_INLINE_MEDIA')
262 opus_arm_presume_media = opus_arm_may_have_media and opus_can_presume_simd
263
264 opus_arm_may_have_neon = opus_conf.has('OPUS_ARM_INLINE_NEON')
265 opus_arm_presume_neon = opus_arm_may_have_neon and opus_can_presume_simd
266
267 if not opt_rtcd.disabled()
268 if not opus_arm_may_have_edsp
269 message('Trying to force-enable armv5e EDSP instructions...')
270 # AS_ASM_ARM_EDSP_FORCE
271 opus_arm_may_have_edsp = cc.compiles(asm_tmpl.format('.arch armv5te\n.object_arch armv4t\nqadd r3,r3,r3'),
272 name : 'Assembler supports EDSP instructions on ARM (forced)')
273 endif
274 if not opus_arm_may_have_media
275 message('Trying to force-enable ARMv6 media instructions...')
276 opus_arm_may_have_media = cc.compiles(asm_tmpl.format('.arch armv6\n.object_arch armv4t\nshadd8 r3,r3,r3'),
277 name : 'Assembler supports ARMv6 media instructions on ARM (forced)')
278 endif
279 if not opus_arm_may_have_neon
280 message('Trying to force-enable NEON instructions...')
281 opus_arm_may_have_neon = cc.compiles(asm_tmpl.format('.arch armv7-a\n.fpu neon\n.object_arch armv4t\nvorr d0,d0,d0'),
282 name : 'Assembler supports NEON instructions on ARM (forced)')
283 endif
284 endif
285
286 if opus_arm_may_have_edsp
287 opus_conf.set('OPUS_ARM_MAY_HAVE_EDSP', 1)
288 if opus_arm_presume_edsp
289 opus_conf.set('OPUS_ARM_PRESUME_EDSP', 1)
290 asm_optimization += ['EDSP']
291 else
292 rtcd_support += ['EDSP']
293 endif
294 endif
295 if opus_arm_may_have_media
296 opus_conf.set('OPUS_ARM_MAY_HAVE_MEDIA', 1)
297 if opus_arm_presume_media
298 opus_conf.set('OPUS_ARM_PRESUME_MEDIA', 1)
299 asm_optimization += ['Media']
300 else
301 rtcd_support += ['Media']
302 endif
303 endif
304 if opus_arm_may_have_neon
305 opus_conf.set('OPUS_ARM_MAY_HAVE_NEON', 1)
306 if opus_arm_presume_neon
307 opus_conf.set('OPUS_ARM_PRESUME_NEON', 1)
308 asm_optimization += ['NEON']
309 else
310 rtcd_support += ['NEON']
311 endif
312 endif
313
314 if cc.get_define('__APPLE__')
315 arm2gnu_args = ['--apple']
316 else
317 arm2gnu_args = []
318 endif
319 endif # found perl
320 else # arm + enable fixed point
321 if opt_asm.enabled()
322 error('asm option is enabled, but no assembly support for ' + host_cpu_family)
323 endif
324 endif
325endif # enable asm
326
327# Check whether we require assembly and we support assembly on this arch,
328# but none were detected. Can happen because of incorrect compiler flags, such
329# as missing -mfloat-abi=softfp on ARM32 softfp architectures.
330if opt_asm.enabled() and (asm_optimization.length() + inline_optimization.length()) == 0
331 error('asm option was enabled, but no assembly support was detected')
332endif
333
334# XXX: NEON has hardfp vs softfp compiler configuration issues
335# When targeting ARM32 softfp, we sometimes need to explicitly pass
336# -mfloat-abi=softfp to enable NEON. F.ex., on Android. It should
337# be set in the cross file.
338arm_neon_intr_link_args = ['-mfpu=neon']
339
340have_sse = false
341have_sse2 = false
342have_sse4_1 = false
343have_avx = false # no avx opus code yet
344have_neon_intr = false
345
346intrinsics_support = []
347if not opt_intrinsics.disabled()
348 if host_cpu_family in ['arm', 'aarch64']
349 # Check for ARMv7/AArch64 neon intrinsics
350 intrin_check = '''
351 #include <arm_neon.h>
352 int main (void) {
353 static float32x4_t A0, A1, SUMM;
354 SUMM = vmlaq_f32(SUMM, A0, A1);
355 return (int)vgetq_lane_f32(SUMM, 0);
356 }'''
357 intrin_name = 'ARMv7/AArch64 NEON'
358 if cc.links(intrin_check,
359 name: 'compiler supports @0@ intrinsics'.format(intrin_name))
360 opus_arm_presume_neon_intr = opus_can_presume_simd
361 opus_arm_may_have_neon_intr = true
362 else
363 opus_arm_presume_neon_intr = false
364 if cc.links(intrin_check,
365 args: arm_neon_intr_link_args,
366 name: 'compiler supports @0@ intrinsics with @1@'.format(intrin_name, ' '.join(arm_neon_intr_link_args)))
367 opus_arm_may_have_neon_intr = true
368 else
369 opus_arm_may_have_neon_intr = false
370 endif
371 endif
372
373 if opus_arm_may_have_neon_intr
374 have_neon_intr = true
375 intrinsics_support += [intrin_name]
376 opus_conf.set('OPUS_ARM_MAY_HAVE_NEON_INTR', 1)
377 if opus_arm_presume_neon_intr
378 opus_conf.set('OPUS_ARM_PRESUME_NEON_INTR', 1)
379 else
380 rtcd_support += [intrin_name]
381 opus_neon_intr_args = arm_neon_intr_link_args
382 endif
383 else
384 message('Compiler does not support @0@ intrinsics'.format(intrin_name))
385 endif
386
387 # Check for aarch64 neon intrinsics
388 intrin_check = '''
389 #include <arm_neon.h>
390 int main (void) {
391 static int32_t IN;
392 static int16_t OUT;
393 OUT = vqmovns_s32(IN);
394 }'''
395 intrin_name = 'AArch64 NEON'
396 if cc.links(intrin_check,
397 name: 'compiler supports @0@ intrinsics'.format(intrin_name))
398 opus_arm_presume_aarch64_neon_intr = opus_can_presume_simd
399 opus_arm_may_have_aarch64_neon_intr = true
400 else
401 opus_arm_presume_aarch64_neon_intr = false
402 if cc.links(intrin_check,
403 args: arm_neon_intr_link_args,
404 name: 'compiler supports @0@ intrinsics with @1@'.format(intrin_name, ' '.join(arm_neon_intr_link_args)))
405 opus_arm_may_have_aarch64_neon_intr = true
406 else
407 opus_arm_may_have_aarch64_neon_intr = false
408 endif
409 endif
410
411 if opus_arm_may_have_aarch64_neon_intr
412 intrinsics_support += [intrin_name]
413 opus_conf.set('OPUS_X86_MAY_HAVE_AARCH64_NEON_INTR', 1)
414 if opus_arm_presume_aarch64_neon_intr
415 opus_conf.set('OPUS_X86_PRESUME_AARCH64_NEON_INTR', 1)
416 endif
417 else
418 message('Compiler does not support @0@ intrinsics'.format(intrin_name))
419 endif
420 elif host_cpu_family in ['x86', 'x86_64']
421 # XXX: allow external override/specification of the flags
422 x86_intrinsics = [
423 [ 'SSE', 'xmmintrin.h', '__m128', '_mm_setzero_ps()', ['-msse'] ],
424 [ 'SSE2', 'emmintrin.h', '__m128i', '_mm_setzero_si128()', ['-msse2'] ],
425 [ 'SSE4.1', 'smmintrin.h', '__m128i', '_mm_setzero_si128(); mtest = _mm_cmpeq_epi64(mtest, mtest)', ['-msse4.1'] ],
426 [ 'AVX', 'immintrin.h', '__m256', '_mm256_setzero_ps()', ['-mavx'] ],
427 ]
428
429 foreach intrin : x86_intrinsics
430 intrin_check = '''#include <@0@>
431 int main (int argc, char ** argv) {
432 static @1@ mtest;
433 mtest = @2@;
434 return *((unsigned char *) &mtest) != 0;
435 }'''.format(intrin[1],intrin[2],intrin[3])
436 intrin_name = intrin[0]
437 # Intrinsics arguments are not available with MSVC-like compilers
438 intrin_args = cc.get_argument_syntax() == 'msvc' ? [] : intrin[4]
439 if cc.links(intrin_check, name : 'compiler supports @0@ intrinsics'.format(intrin_name))
440 may_have_intrin = true
441 presume_intrin = opus_can_presume_simd
442 elif intrin_args.length() > 0
443 presume_intrin = false
444 if cc.links(intrin_check,
445 args : intrin_args,
446 name : 'compiler supports @0@ intrinsics with @1@'.format(intrin_name, ' '.join(intrin_args)))
447 may_have_intrin = true
448 else
449 may_have_intrin = false
450 endif
451 endif
452 if may_have_intrin
453 intrinsics_support += [intrin_name]
454 intrin_lower_name = intrin_name.to_lower().underscorify()
455 set_variable('have_' + intrin_lower_name, true)
456 opus_conf.set('OPUS_X86_MAY_HAVE_' + intrin_name.underscorify(), 1)
457 if presume_intrin
458 opus_conf.set('OPUS_X86_PRESUME_' + intrin_name.underscorify(), 1)
459 else
460 rtcd_support += [intrin_name]
461 set_variable('opus_@0@_args'.format(intrin_lower_name), intrin_args)
462 endif
463 else
464 message('Compiler does not support @0@ intrinsics'.format(intrin_name))
465 endif
466 endforeach
467
468 if not opt_rtcd.disabled()
469 get_cpuid_by_asm = false
470 cpuid_asm_code = '''
471 #include <stdio.h>
472 int main (int argc, char ** argv) {
473 unsigned int CPUInfo0;
474 unsigned int CPUInfo1;
475 unsigned int CPUInfo2;
476 unsigned int CPUInfo3;
477 unsigned int InfoType;
478 #if defined(__i386__) && defined(__PIC__)
479 __asm__ __volatile__ (
480 "xchg %%ebx, %1\n"
481 "cpuid\n"
482 "xchg %%ebx, %1\n":
483 "=a" (CPUInfo0),
484 "=r" (CPUInfo1),
485 "=c" (CPUInfo2),
486 "=d" (CPUInfo3) :
487 "a" (InfoType), "c" (0)
488 );
489 #else
490 __asm__ __volatile__ (
491 "cpuid":
492 "=a" (CPUInfo0),
493 "=b" (CPUInfo1),
494 "=c" (CPUInfo2),
495 "=d" (CPUInfo3) :
496 "a" (InfoType), "c" (0)
497 );
498 #endif
499 return 0;
500 }'''
501 cpuid_c_code = '''
502 #include <cpuid.h>
503 int main (int argc, char ** argv) {
504 unsigned int CPUInfo0;
505 unsigned int CPUInfo1;
506 unsigned int CPUInfo2;
507 unsigned int CPUInfo3;
508 unsigned int InfoType;
509 __get_cpuid(InfoType, &CPUInfo0, &CPUInfo1, &CPUInfo2, &CPUInfo3);
510 return 0;
511 }'''
512 cpuid_msvc_code = '''
513 #include <intrin.h>
514 int main (void) {
515 int CPUInfo, InfoType;
516 __cpuid(&CPUInfo, InfoType);
517 }'''
518 if cc.links(cpuid_asm_code, name : 'Get X86 CPU info via inline assembly')
519 opus_conf.set('CPU_INFO_BY_ASM', 1)
520 elif cc.links(cpuid_c_code, name : 'Get X86 CPU info via C method')
521 opus_conf.set('CPU_INFO_BY_C', 1)
522 elif cc.get_define('_MSC_VER') != '' and cc.links(cpuid_msvc_code)
523 message('Getting X86 CPU info via __cpuid')
524 else
525 if opt_intrinsics.enabled() and opt_rtcd.enabled()
526 error('intrinsics and rtcd options are enabled, but no Get CPU Info method detected')
527 endif
528 warning('Get CPU Info method not detected, no rtcd for intrinsics')
529 endif
530 endif # opt_rtcd
531 else
532 if opt_intrinsics.enabled()
533 error('intrinsics option enabled, but no intrinsics support for ' + host_machine.get_cpu())
534 endif
535 warning('No intrinsics support for ' + host_machine.get_cpu())
536 endif
537endif
538
539# Check whether we require intrinsics and we support intrinsics on this arch,
540# but none were detected. Can happen because of incorrect compiler flags, such
541# as missing -mfloat-abi=softfp on ARM32 softfp architectures.
542if opt_intrinsics.enabled() and intrinsics_support.length() == 0
543 error('intrinsics option was enabled, but none were detected')
544endif
545
546if opt_rtcd.disabled()
547 rtcd_support = 'disabled'
548else
549 if rtcd_support.length() > 0
550 opus_conf.set('OPUS_HAVE_RTCD', 1)
551 else
552 if intrinsics_support.length() == 0
553 rtcd_support = 'none'
554 if opt_rtcd.enabled()
555 error('rtcd option is enabled, but no support for intrinsics or assembly is available')
556 endif
557 else
558 rtcd_support = 'not needed'
559 endif
560 endif
561endif
562
563# extract source file lists from .mk files
564mk_files = ['silk_sources.mk', 'opus_headers.mk', 'opus_sources.mk', 'silk_headers.mk', 'celt_sources.mk', 'celt_headers.mk']
565lines = run_command('meson/read-sources-list.py', mk_files, check: true).stdout().strip().split('\n')
566sources = {}
567foreach l : lines
568 a = l.split(' = ')
569 var_name = a[0]
570 file_list = a[1].split()
571 sources += {var_name: files(file_list)}
572endforeach
573
574subdir('include')
575subdir('silk')
576subdir('celt')
577subdir('src')
578
579configure_file(output: 'config.h', configuration: opus_conf)
580
581if not opt_tests.disabled()
582 subdir('celt/tests')
583 subdir('silk/tests')
584 subdir('tests')
585endif
586
587# pkg-config files (not using pkg module so we can use the existing .pc.in file)
588pkgconf = configuration_data()
589
590pkgconf.set('prefix', join_paths(get_option('prefix')))
591pkgconf.set('exec_prefix', '${prefix}')
592pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
593pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
594pkgconf.set('VERSION', opus_version)
595pkgconf.set('PC_BUILD', pc_build)
596pkgconf.set('LIBM', libm.found() ? '-lm' : '')
597
598pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
599
600configure_file(input : 'opus.pc.in',
601 output : 'opus.pc',
602 configuration : pkgconf,
603 install_dir : pkg_install_dir)
604
605# The uninstalled one has hardcoded libtool + static lib stuff, skip it for now
606#configure_file(input : 'opus-uninstalled.pc.in',
607# output : 'opus-uninstalled.pc',
608# configuration : pkgconf,
609# install : false)
610
611doxygen = find_program('doxygen', required: get_option('docs'))
612if doxygen.found()
613 subdir('doc')
614endif
615
616summary(
617 {
618 'C99 var arrays': opus_conf.has('VAR_ARRAYS'),
619 'C99 lrintf': opus_conf.has('HAVE_LRINTF'),
620 'Use alloca': msg_use_alloca,
621 },
622 section: 'Compiler support',
623 bool_yn: true,
624 list_sep: ', ',
625)
626
627# Parse optimization status
628foreach status : [['inline_optimization', opt_asm],
629 ['asm_optimization', opt_asm],
630 ['intrinsics_support', opt_intrinsics]]
631 res = status[0]
632 opt = status[1]
633 resval = get_variable(res)
634 if opt.disabled()
635 set_variable(res, 'disabled')
636 elif resval.length() == 0
637 if host_cpu_family not in ['arm', 'aarch64', 'x86', 'x86_64']
638 set_variable(res, 'No optimizations for your platform, please send patches')
639 else
640 set_variable(res, 'none')
641 endif
642 endif
643endforeach
644
645summary(
646 {
647 'Floating point support': not opt_fixed_point,
648 'Fast float approximations': opt_float_approx,
649 'Fixed point debugging': opt_fixed_point_debug,
650 'Inline assembly optimizations': inline_optimization,
651 'External assembly optimizations': asm_optimization,
652 'Intrinsics optimizations': intrinsics_support,
653 'Run-time CPU detection': rtcd_support,
654 },
655 section: 'Optimizations',
656 bool_yn: true,
657 list_sep: ', ',
658)
659summary(
660 {
661 'Custom modes': opt_custom_modes,
662 'Assertions': opt_assertions,
663 'Hardening': opt_hardening,
664 'Fuzzing': opt_fuzzing,
665 'Check ASM': opt_check_asm,
666 'API documentation': doxygen.found(),
667 'Extra programs': not extra_programs.disabled(),
668 'Tests': not opt_tests.disabled(),
669 },
670 section: 'General configuration',
671 bool_yn: true,
672 list_sep: ', ',
673)