-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
configure.ac
4951 lines (4444 loc) · 149 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl Autoconf settings for vlc
AC_COPYRIGHT([Copyright 1999-2024 VLC authors and VideoLAN])
AC_INIT([vlc], [4.0.0-dev])
VERSION_MAJOR=4
VERSION_MINOR=0
VERSION_REVISION=0
VERSION_EXTRA=0
VERSION_DEV=dev
# libvlc .so version values
LIBVLC_ABI_MAJOR=12
LIBVLC_ABI_MINOR=0
LIBVLC_ABI_MICRO=0
PKGDIR="vlc"
AC_SUBST([PKGDIR])
CONFIGURE_LINE="`echo "$0 $ac_configure_args" | sed -e 's/\\\/\\\\\\\/g'`"
CODENAME="Otto Chriek"
COPYRIGHT_YEARS="1996-2024"
AC_CONFIG_SRCDIR([src/libvlc.c])
AC_CONFIG_AUX_DIR([autotools])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_LIBOBJ_DIR([compat])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_PRESERVE_HELP_ORDER
AM_INIT_AUTOMAKE([tar-ustar color-tests foreign])
AC_CONFIG_HEADERS([config.h])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE([enable])
dnl
dnl Check for tools
dnl
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
VLC_PROG_CC_C17
AH_VERBATIM([FORTIFY_SOURCE],
[/* Enable compile-time and run-time bounds-checking, and some warnings,
without upsetting glibc 2.15+ or toolchains predefining _FORTIFY_SOURCE */
#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
# define _FORTIFY_SOURCE 2
#endif])
AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.])
AC_DEFINE([LIBVLC_INTERNAL_],, [Define within the LibVLC source code tree.])
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_OBJC
AC_PROG_EGREP
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AM_PROG_AS
AC_PROG_LEX([noyywrap])
AC_PROG_YACC
AC_ARG_VAR([DESKTOP_FILE_VALIDATE], [Validator for desktop entry files])
AC_CHECK_PROGS([DESKTOP_FILE_VALIDATE], [${DESKTOP_FILE_VALIDATE} desktop-file-validate], :)
AC_ARG_VAR([BUILDCC], [Build system C11 or C99 compiler command])
AC_CHECK_PROGS([BUILDCC], [c17-gcc c17 c11-gcc c11 c99-gcc c99], [false])
AS_IF([test "$BUILDCC" = "false"], [
AC_MSG_ERROR([Cannot find native C99 compiler: please define BUILDCC.])
])
dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_LANG_PUSH([C++])
AX_CXX_COMPILE_STDCXX_17([noext], [mandatory])
AX_CXX_TYPEOF
AC_LANG_POP([C++])
dnl Extend the --help string at the current spot.
AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
dnl Allow binary package maintainer to pass a custom string to avoid
dnl cache problem
AC_ARG_WITH([binary-version],
AS_HELP_STRING([--with-binary-version=STRING],
[To avoid plugins cache problem between binary version]),[],[])
AS_IF([test -n "${with_binary_version}"],[
AC_DEFINE_UNQUOTED([DISTRO_VERSION],["${with_binary_version}"],
[Binary specific version])
])
dnl Prevent clang from accepting unknown flags with a mere warning
AX_CHECK_COMPILE_FLAG([-Werror=invalid-command-line-argument], [
AX_APPEND_FLAG([-Werror=invalid-command-line-argument], [CFLAGS])
AX_APPEND_FLAG([-Werror=invalid-command-line-argument], [CXXFLAGS])
AX_APPEND_FLAG([-Werror=invalid-command-line-argument], [OBJCFLAGS])
])
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option], [
AX_APPEND_FLAG([-Werror=unknown-warning-option], [CFLAGS])
AX_APPEND_FLAG([-Werror=unknown-warning-option], [CXXFLAGS])
AX_APPEND_FLAG([-Werror=unknown-warning-option], [OBJCFLAGS])
])
dnl
dnl Check the operating system
dnl
HAVE_WIN64="0"
HAVE_IOS="0"
HAVE_OSX="0"
HAVE_TVOS="0"
HAVE_IOS_OR_TVOS="0"
HAVE_XROS="0"
HAVE_WATCHOS="0"
dnl Set x86 asm flags and defines
X86ASMFLAGS=""
case "${host_cpu}" in
i?86)
X86ASMFLAGS="-f elf32"
X86ASMDEFS="-DARCH_X86_64=0"
;;
x86_64)
X86ASMFLAGS="-f elf64"
X86ASMDEFS="-DARCH_X86_64=1"
;;
esac
case "${host_os}" in
"")
SYS=unknown
;;
linux*)
SYS=linux
CFLAGS="${CFLAGS} -pthread"
CXXFLAGS="${CXXFLAGS} -pthread"
;;
bsdi*)
SYS=bsdi
CFLAGS="${CFLAGS} -pthread"
CXXFLAGS="${CXXFLAGS} -pthread"
;;
freebsd*)
SYS=freebsd
CFLAGS="${CFLAGS} -pthread"
CXXFLAGS="${CXXFLAGS} -pthread"
CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
ac_cv_ld_z_defs=no
;;
openbsd*)
SYS=openbsd
CPPFLAGS="${CPPFLAGS} -I/usr/local/include -I/usr/X11R6/include"
LDFLAGS="${LDFLAGS} -L/usr/local/lib -L/usr/X11R6/lib/"
;;
netbsd*)
SYS=netbsd
;;
dragonfly*)
SYS=dragonfly
;;
darwin*)
SYS=darwin
ac_cv_func_aligned_alloc=no
dnl Work around an Xcode 11 bug, fixed in Xcode 11.3.1
AX_APPEND_FLAG([-fno-stack-check], [CFLAGS])
AX_APPEND_FLAG([-fno-stack-check], [CXXFLAGS])
AX_APPEND_FLAG([-fno-stack-check], [OBJCFLAGS])
case "${host_cpu}" in
i?86)
X86ASMFLAGS="-f macho32"
AX_APPEND_FLAG([-DPREFIX], [X86ASMDEFS])
;;
x86_64)
X86ASMFLAGS="-f macho64"
AX_APPEND_FLAG([-DPREFIX], [X86ASMDEFS])
;;
arm*)
ac_cv_c_bigendian="no"
ac_cv_c_attribute_packed="no"
;;
esac
AX_APPEND_FLAG([-D_INTL_REDIRECT_MACROS], [CPPFLAGS])
AX_APPEND_FLAG([-stdlib=libc++], [CXXFLAGS])
AX_APPEND_FLAG([-Werror=partial-availability], [OBJCFLAGS])
AX_APPEND_FLAG([-Wl,-headerpad_max_install_names], [LDFLAGS])
VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation])
dnl This is not supported when bitcode is enabled. In that case, we need
dnl to disable the static bank loader.
AC_MSG_CHECKING([if -Wl,-U is allowed])
VLC_SAVE_FLAGS
AX_APPEND_FLAG([-Wl,-U,_my_array],[LDFLAGS])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
__attribute__((visibility("default"))) extern int my_array[];
int foo() { return my_array[0]; }
]],[[return foo();]])],
[
VLC_ADD_LDFLAGS([libvlccore],[-Wl,-U,_vlc_static_modules])
VLC_ADD_LDFLAGS([libvlc vlc],[-Wl,-undefined,dynamic_lookup])
VLC_ADD_CPPFLAGS([libvlccore],[-DHAVE_DYLIB_DYNAMIC_LOOKUP=1])
AC_MSG_RESULT([yes])
],[AC_MSG_RESULT([no])])
VLC_RESTORE_FLAGS
AC_EGREP_CPP(yes,
[#import <TargetConditionals.h>
#if TARGET_OS_IPHONE
yes
#endif],
[HAVE_IOS="1"
HAVE_IOS_OR_TVOS="1"
ac_cv_func_wordexp=no],
[HAVE_OSX="1"])
AC_EGREP_CPP(yes,
[#import <TargetConditionals.h>
#if TARGET_OS_TV
yes
#endif],
[HAVE_TVOS="1"
HAVE_IOS_OR_TVOS="1"
HAVE_IOS="0"
HAVE_OSX="0"
HAVE_XROS="0"
ac_cv_func_fork=no
],)
AC_EGREP_CPP(yes,
[#import <TargetConditionals.h>
#if TARGET_OS_VISION
yes
#endif],
[HAVE_XROS="1"
HAVE_IOS="0"
HAVE_OSX="0"
HAVE_TVOS="0"
HAVE_IOS_OR_TVOS="0"
ac_cv_func_fork=no
],)
AC_EGREP_CPP(yes,
[#import <TargetConditionals.h>
#if TARGET_OS_WATCH
yes
#endif],
[HAVE_WATCHOS="1"
HAVE_IOS="0"
HAVE_OSX="0"
HAVE_TVOS="0"
HAVE_IOS_OR_TVOS="0"
ac_cv_func_fork=no
],)
AS_IF([test "${HAVE_OSX}" = "1"],[VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreServices])])
dnl
dnl Handle Mac OS X SDK flags
dnl
AC_ARG_WITH(macosx-sdk,
AS_HELP_STRING([--with-macosx-sdk=DIR],
[compile using the SDK in DIR]))
if test "${with_macosx_sdk}" != "" ; then
test ! -d "${with_macosx_sdk}" && AC_MSG_ERROR([SDK "${with_macosx_sdk}" not found])
CPP="${CPP} -isysroot ${with_macosx_sdk}"
CC="${CC} -isysroot ${with_macosx_sdk}"
CXX="${CXX} -isysroot ${with_macosx_sdk}"
OBJC="${OBJC} -isysroot ${with_macosx_sdk}"
LD="${LD} -syslibroot ${with_macosx_sdk}"
fi
AC_ARG_WITH(macosx-version-min,
AS_HELP_STRING([--with-macosx-version-min=VERSION],
[compile for Mac OS X VERSION and above]))
if test "${with_macosx_version_min}" != "" ; then
CPP="${CPP} -mmacosx-version-min=${with_macosx_version_min}"
CC="${CC} -mmacosx-version-min=${with_macosx_version_min}"
CXX="${CXX} -mmacosx-version-min=${with_macosx_version_min}"
OBJC="${OBJC} -mmacosx-version-min=${with_macosx_version_min}"
LD="${LD} -mmacosx_version_min=${with_macosx_version_min}"
fi
;;
*mingw32* | *cygwin* | *wince* | *mingwce*)
dnl Force libtool to not link to (shared) libgcc_s when detecting C++ dependencies
dnl When doing this test with -static-libgcc it will link on (static) libgcc_eh
AC_LANG_PUSH(C++)
AX_APPEND_COMPILE_FLAGS([-static-libgcc], [CXXFLAGS], [-Werror])
AC_LANG_POP(C++)
AC_CHECK_TOOL(WINDRES, windres, :)
AC_CHECK_TOOL(OBJCOPY, objcopy, :)
AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#ifdef _WIN32_WINNT
# error _WIN32_WINNT already defined
#else
# include <sdkddkver.h>
# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0601
# error _WIN32_WINNT toolchain default high enough
# endif
#endif
]],[[;]])
],[
AC_DEFINE([_WIN32_WINNT], [0x0601], [Define to '0x0601' for Windows 7 APIs.])
])
AC_MSG_CHECKING([if libsynchronization is needed])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#if _WIN32_WINNT >= 0x0602
# error building for Win8+ and above
#endif
]],[[;]])
],[
AC_MSG_RESULT([no])
],[
AC_MSG_RESULT([yes])
VLC_ADD_LIBS([libvlccore], [-lsynchronization])
])
AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])
AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
AC_ARG_WITH(packagedir,
AS_HELP_STRING([--with-packagedir=DIR],
[output the packaged VLC files in DIR (default vlc-$PACKAGE_VERSION)]))
AS_IF([test "${with_packagedir}" != ""], [
AS_IF([test -d "${with_packagedir}"], [
PACKAGE_DIR=`cd "${with_packagedir}" && pwd -P`
],[
dnl this should be an absolute path
PACKAGE_DIR="${with_packagedir}"
])
], [
PACKAGE_DIR=`pwd -P`"/vlc-${PACKAGE_VERSION}"
])
AC_SUBST([PACKAGE_DIR])
case "${host_os}" in
*mingw32*)
SYS=mingw32
;;
*cygwin*)
dnl Check if we are using the mno-cygwin mode in which case we are
dnl actually dealing with a mingw32 compiler.
AC_EGREP_CPP(yes,
[#ifdef _WIN32
yes
#endif],
SYS=mingw32, AC_MSG_ERROR([VLC requires -mno-cygwin]))
;;
esac
if test "${SYS}" = "mingw32"; then
# DEP, ASLR, NO SEH
LDFLAGS="${LDFLAGS} -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase"
AC_CHECK_PROGS(U2D, [unix2dos todos], unix2dos)
ac_default_prefix="`pwd`/_win32"
DESTDIR="`pwd`/_win32/"
dnl
dnl NSIS/MSI Installer prefix and WIN64
dnl
case "${host_cpu}" in
aarch64)
HAVE_WIN64="1"
WINDOWS_ARCH="arm64"
PROGRAMFILES="PROGRAMFILES64"
LDFLAGS="${LDFLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x140000000"
;;
amd64|x86_64)
HAVE_WIN64="1"
WINDOWS_ARCH="x64"
PROGRAMFILES="PROGRAMFILES64"
LDFLAGS="${LDFLAGS} -Wl,--high-entropy-va -Wl,--image-base,0x140000000"
X86ASMFLAGS="-f win64"
;;
armv7)
WINDOWS_ARCH="arm"
PROGRAMFILES="PROGRAMFILES"
;;
i?86)
WINDOWS_ARCH="x86"
PROGRAMFILES="PROGRAMFILES"
X86ASMFLAGS="-f win32"
X86ASMDEFS="${X86ASMDEFS} -DPREFIX"
AX_APPEND_FLAG([-Wl,--large-address-aware], [LDFLAGS])
;;
*)
AC_MSG_ERROR([Unsupported Windows architecture ${host_cpu}])
;;
esac
AC_SUBST([WINDOWS_ARCH])
AC_SUBST([PROGRAMFILES])
fi
;;
*nto*)
SYS=nto
;;
solaris*)
SYS=solaris
;;
hpux*)
SYS=hpux
;;
*os2*)
SYS=os2
LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild -Zhigh-mem"
AC_LIBOBJ([freeaddrinfo])
AC_LIBOBJ([gai_strerror])
AC_CHECK_FUNCS([if_nametoindex])
X86ASMFLAGS="-f aout"
X86ASMDEFS="-DARCH_X86_64=0 -DPREFIX"
;;
*emscripten*)
SYS=emscripten
# tdestroy() is a GNU extension
CFLAGS="${CFLAGS} -pthread -D_GNU_SOURCE"
CXXFLAGS="${CXXFLAGS} -pthread"
ac_cv_func_if_nameindex=yes
ac_cv_header_sys_shm_h=no
;;
*)
SYS="${host_os}"
;;
esac
ANDROID_API=17
dnl Vendor-specific configuration
case "${host_os}" in
linux-android*)
VENDOR=android
AC_MSG_CHECKING([Check Android API version])
ANDROID_API="`echo ${host_os} | tr -c -d '[[:digit:]]'`"
AC_MSG_RESULT([${ANDROID_API}])
dnl GLESv2 and EGL are provided by android NDK without .pc files
GLES2_LIBS="-lGLESv2"
GLES2_CFLAGS=" "
EGL_LIBS="-lEGL"
EGL_CFLAGS=" "
AS_IF([test -n "$ANDROID_API" -a "$ANDROID_API" -lt "26"],[
ac_cv_header_sys_shm_h=no
])
dnl Those functions and headers are not functional on android, use vlc_fixups instead
ac_cv_header_search_h=no
ac_cv_func_tdestroy=no
ac_cv_func_tfind=no
;;
esac
dnl WinRT
AC_ARG_ENABLE([winstore_app],
AS_HELP_STRING([--enable-winstore-app],
[Build targetted for Windows Store apps (default disabled)]))
vlc_winstore_app=0
AS_IF([test "${SYS}" = "mingw32"],[
LIBCOM="-lole32 -loleaut32"
AC_LANG_PUSH(C++)
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [
LIBCOMCXXFLAGS="-fno-strict-aliasing"
],[
# fno-strict-aliasing is necessary for WRL and IID_PPV_ARGS to work safely
# MSVC doesn't have this option but doesn't do pointer aliasing, so it
# should work too
AC_MSG_ERROR([-fno-strict-aliasing is necessary for Windows C++ modules])
])
AC_LANG_POP(C++)
AS_IF([test "${enable_winstore_app}" = "yes"], [
vlc_winstore_app=1
LIBCOM="-loleaut32"
LDFLAGS="${LDFLAGS} -lwindowsappcompat"
VLC_ADD_LIBS([libvlccore], [-lruntimeobject])
AC_LIBOBJ([gai_strerror])
],[])
AC_SUBST([LIBCOM])
AC_SUBST([LIBCOMCXXFLAGS])
])
vlc_build_pdb=0
AC_ARG_ENABLE([pdb],
AS_HELP_STRING([--enable-pdb],
[Build PDB files for windows targets (default off)]))
AS_IF([test "${SYS}" = "mingw32"],[
AS_IF([test "${enable_pdb}" = "yes"], [
vlc_build_pdb=1
AX_APPEND_FLAG([-g -gcodeview],[CPPFLAGS])
LDFLAGS="${LDFLAGS} -Wl,-pdb="
],[])
])
AM_CONDITIONAL([HAVE_FREEBSD], [test "${SYS}" = "freebsd"])
AM_CONDITIONAL([HAVE_LINUX], [test "${SYS}" = "linux"])
AM_CONDITIONAL([HAVE_ANDROID], [test "${VENDOR}" = "android"])
AM_CONDITIONAL([HAVE_OS2], [test "${SYS}" = "os2"])
AM_CONDITIONAL([HAVE_DARWIN], [test "${SYS}" = "darwin"])
AM_CONDITIONAL([HAVE_IOS], [test "${HAVE_IOS}" = "1"])
AM_CONDITIONAL([HAVE_OSX], [test "${HAVE_OSX}" = "1"])
AM_CONDITIONAL([HAVE_TVOS], [test "${HAVE_TVOS}" = "1"])
AM_CONDITIONAL([HAVE_IOS_OR_TVOS], [test "${HAVE_IOS_OR_TVOS}" = "1"])
AM_CONDITIONAL([HAVE_XROS], [test "${HAVE_XROS}" = "1"])
AM_CONDITIONAL([HAVE_WATCHOS], [test "${HAVE_WATCHOS}" = "1"])
AM_CONDITIONAL([HAVE_LIBANL], [test "${HAVE_LIBANL}" = "1"])
AM_CONDITIONAL([HAVE_WIN32], [test "${SYS}" = "mingw32"])
AM_CONDITIONAL([HAVE_WIN64], [test "${HAVE_WIN64}" = "1"]) dnl Only used for the packaging
AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])
AM_CONDITIONAL([HAVE_WIN32_DESKTOP], [test "${SYS}" = "mingw32" -a "$vlc_winstore_app" = "0"])
AM_CONDITIONAL([ENABLE_PDB], [test "$vlc_build_pdb" = "1"])
dnl Use nasm/yasm only on x86
AC_CHECK_PROGS(X86ASM, [nasm yasm])
AM_CONDITIONAL([HAVE_X86ASM], [test -n "${X86ASM}" && test -n "${X86ASMFLAGS}"])
AM_COND_IF([HAVE_X86ASM], [
AC_DEFINE([HAVE_X86ASM], [1], [Use external asm on x86.])
])
dnl Because DOLT is not able to handle --with-pic
dnl correctly, manually add -DPIC to the options for
dnl nasm / yasm here.
AS_IF([test "$with_pic" = "yes"], [X86ASMDEFS="${X86ASMDEFS} -DPIC"])
AC_SUBST([X86ASMFLAGS])
AC_SUBST([X86ASMDEFS])
AM_CONDITIONAL([HAVE_EMSCRIPTEN], [test "${SYS}" = "emscripten"])
dnl
dnl Sadly autoconf does not think about testing foo.exe when ask to test
dnl for program foo on win32
case "${build_os}" in
cygwin|msys|mingw32)
ac_executable_extensions=".exe"
BUILDEXEEXT=".exe"
;;
os2*)
BUILDEXEEXT=".exe"
;;
*)
;;
esac
AC_SUBST([BUILDEXEEXT])
dnl
dnl Check for the contrib directory
dnl
AC_ARG_WITH(contrib,
AS_HELP_STRING([--with-contrib[=DIR]],
[search for 3rd party libraries in DIR/include and DIR/lib])
)
AC_MSG_CHECKING([for 3rd party libraries path])
AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"], [
CONTRIB_DIR="${srcdir}/contrib/${host}"
AS_IF([test ! -d "${CONTRIB_DIR}"], [
echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
AS_IF([test ! -d "${CONTRIB_DIR}"], [
echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR=""
AC_MSG_RESULT([not found])
])
])
], [
AS_IF([test "${with_contrib}" != "no"], [
CONTRIB_DIR="${with_contrib}"
AC_MSG_RESULT([${CONTRIB_DIR}])
], [
CONTRIB_DIR=""
AC_MSG_RESULT([disabled])
])
])
AS_IF([test -n "${CONTRIB_DIR}"], [
AS_IF([test -d "${CONTRIB_DIR}/lib"],[
SRC_CONTRIB_DIR="${CONTRIB_DIR}"
CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd -P`
AC_MSG_RESULT([${CONTRIB_DIR} from ${SRC_CONTRIB_DIR}])
], [
echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR=""
AC_MSG_RESULT([not usable])
])
])
AS_IF([test -n "${CONTRIB_DIR}"], [
CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include -F${CONTRIB_DIR} -F${CONTRIB_DIR}/Frameworks"
PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:${CONTRIB_DIR}/share/pkgconfig:${PKG_CONFIG_PATH}"
case "${build_os}" in
mingw32)
export PKG_CONFIG_PATH="$(cygpath -mp "${PKG_CONFIG_PATH}")"
;;
*)
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}"
;;
esac
LDFLAGS="${LDFLAGS} -L${CONTRIB_DIR}/lib"
AS_IF([test -z "$LUAC"], [
AC_MSG_CHECKING([if contribs provide luac])
AS_IF([test -x "${CONTRIB_DIR}/../bin/${host_alias}-luac${BUILDEXEEXT}"], [
LUAC="${CONTRIB_DIR}/../bin/${host_alias}-luac${BUILDEXEEXT}"
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
])
])
AS_IF([test "${SYS}" = "darwin"], [
export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"
])
], [
AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"], [
AC_MSG_ERROR([Third party libraries not found!])
])
])
AC_SUBST([CONTRIB_DIR])
dnl Add extras/tools to the PATH
TOOLS_DIR="${srcdir}/extras/tools/build/bin"
AS_IF([test -d "${TOOLS_DIR}"], [
TOOLS_DIR="$(cd "${TOOLS_DIR}" && pwd)"
export PATH="${TOOLS_DIR}:$PATH"
])
dnl
dnl Libtool
dnl It's very bad, but our former custom system was worst
dnl -- Courmisch
dnl
dnl override platform specific check for dependent libraries
dnl otherwise libtool linking of shared libraries will
dnl fail on anything other than pass_all.
AC_CACHE_VAL(lt_cv_deplibs_check_method,
[lt_cv_deplibs_check_method=pass_all])
LT_INIT([dlopen win32-dll shared disable-static])
LT_LANG([C++])
LT_LANG([Windows Resource])
DOLT
lt_cv_deplibs_check_method=pass_all
AS_IF([test "${enable_shared}" = "no" -a "${enable_vlc}" != "no"], [
AC_MSG_ERROR([VLC is based on plugins. Shared libraries cannot be disabled.])
])
dnl
dnl Gettext stuff
dnl
AM_GNU_GETTEXT_VERSION([0.21])
AM_GNU_GETTEXT([external], [need-formatstring-macros])
dnl
dnl Iconv stuff
dnl
AM_ICONV
dnl
dnl checks for mingw
AS_IF([test "${SYS}" = "mingw32"], [
dnl Check if this is a UCRT build
AC_MSG_CHECKING([whether compiling with Universal C Runtime])
win_ucrt_build=no
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#include <crtdefs.h>
#if !(defined(_UCRT) || (__MSVCRT_VERSION__ >= 0x1400) || (__MSVCRT_VERSION__ >= 0xE00 && __MSVCRT_VERSION__ < 0x1000))
# error This is NOT a UCRT build
#endif
])], [
AC_MSG_RESULT([yes])
win_ucrt_build=yes
], [
AC_MSG_RESULT([no])
])
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#if !defined(__MINGW32__)
# error Not compiling with mingw
#endif
])], [
dnl Check for broken versions of mingw-runtime compatability library
AC_MSG_CHECKING(for broken mingw-runtime)
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#include <_mingw.h>
#if defined(__MINGW64_VERSION_MAJOR)
# if __MINGW64_VERSION_MAJOR < 6
# error Update your mingw-w64! This one is too old.
# endif
#else
# error You cannot compile with Mingw. Use Mingw-w64!
#endif
])], [
AC_MSG_RESULT([ok])
], [
AC_MSG_RESULT([present])
AC_MSG_ERROR([LibVLC requires Mingw-w64 version 6.0 or higher!])
])
AS_IF([test "${win_ucrt_build}" = "no"], [
dnl force use of mingw provided c99 *printf over msvcrt
CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
],[
dnl for UCRT build we use the standard compatibility define of UCRT
CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0"
])
], [
AC_MSG_RESULT([Not compiling with mingw])
])
dnl Check for fnative-struct or mms-bitfields support for mingw32
AX_CHECK_COMPILE_FLAG([-mms-bitfields], [
AX_APPEND_FLAG([-mms-bitfields], [CFLAGS])
AX_APPEND_FLAG([-mms-bitfields], [CXXFLAGS])
# Check for the warning flag without "-Wno-", GCC accepts
# -Wno-<anything> for unsupported warnings, which can trigger
# other warnings instead.
AX_CHECK_COMPILE_FLAG([-Wincompatible-ms-struct], [
AX_APPEND_FLAG([-Wno-incompatible-ms-struct], [CFLAGS])
AX_APPEND_FLAG([-Wno-incompatible-ms-struct], [CXXFLAGS])
])
], [
AX_CHECK_COMPILE_FLAG([-fnative-struct], [
AX_APPEND_FLAG([-fnative-struct], [CFLAGS])
AX_APPEND_FLAG([-fnative-struct], [CXXFLAGS])
])
])
])
dnl
dnl Buggy glibc prevention. Purposedly not cached.
dnl See sourceware.org bugs 5058 and 5443.
dnl Ubuntu alone has 20 bug numbers for this...
dnl
AC_MSG_CHECKING(for buggy GNU/libc versions)
AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#include <limits.h>
#if defined (__GLIBC__) && (__GLIBC__ == 2) \
&& (__GLIBC_MINOR__ >= 5) && (__GLIBC_MINOR__ <= 7)
# error GNU/libc with dcgettext killer bug!
#endif
])], [
AC_MSG_RESULT([not present])
], [
AC_MSG_RESULT([found])
AS_IF([test "${enable_nls}" != "no"], [
AC_MSG_ERROR([Buggy GNU/libc (version 2.5 - 2.7) present. VLC would crash; there is no viable
work-around for this. Check with your distribution vendor on how to update the
glibc run-time. Alternatively, build with --disable-nls.])
])
])
dnl Plugin compilation stuff
VLC_LIBRARY_SUFFIX
dnl Check for system libs needed
need_libc=false
dnl Check for usual libc functions
AC_CHECK_FUNCS([accept4 dup3 fcntl flock fstatat fstatvfs fork getmntent_r getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale pipe2 posix_fadvise setlocale uselocale wordexp])
AC_REPLACE_FUNCS([aligned_alloc asprintf atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lfind lldiv localtime_r memrchr nrand48 poll posix_memalign readv recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp vasprintf writev])
AC_REPLACE_FUNCS([gettimeofday])
AC_CHECK_FUNC(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
])
VLC_REPLACE_DECL([realpath], [#include <stdlib.h>])
# Windows CE does not have strcoll()
AC_FUNC_STRCOLL
dnl Check for non-standard system calls
case "$SYS" in
"linux")
AC_CHECK_FUNCS([eventfd vmsplice sched_getaffinity recvmmsg memfd_create])
AC_REPLACE_FUNCS([getauxval])
;;
"mingw32")
AC_CHECK_FUNCS([_lock_file])
;;
esac
AH_BOTTOM([#include <vlc_fixups.h>])
dnl Check for struct timespec
AC_CHECK_TYPES([struct timespec],,,
[#include <time.h>])
dnl Check for max_align_t
AC_CHECK_TYPES([max_align_t],,,
[#include <stddef.h>])
dnl Checks for socket stuff
VLC_SAVE_FLAGS
SOCKET_LIBS=""
AS_IF([test "${SYS}" = "mingw32"], [
SOCKET_LIBS="-lws2_32 -liphlpapi"
],[
AC_SEARCH_LIBS(connect, [socket], [
AS_IF([test "$ac_cv_search_connect" != "none required"], [
SOCKET_LIBS="$ac_cv_search_connect"
])
])
])
AC_SEARCH_LIBS([inet_pton], [nsl], [
AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [
SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS"
])
],, [${SOCKET_LIBS}])
LIBS="${LIBS} ${SOCKET_LIBS}"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([#ifdef _WIN32
#include <ws2tcpip.h>
#include <windows.h>
#else
#include <sys/socket.h>
#include <arpa/inet.h>
#endif], [
char dst[[sizeof(struct in_addr)]];
inet_pton(AF_INET, "127.0.0.1", dst);
])],[AC_DEFINE([HAVE_INET_PTON],[1],[Define to 1 if you have inet_pton function])],[AC_LIBOBJ([inet_pton])])
AC_CHECK_TYPES([struct if_nameindex],,,[#include <net/if.h>])
AC_CHECK_FUNCS([if_nameindex])
VLC_RESTORE_FLAGS
AC_SUBST([SOCKET_LIBS])
dnl Check for socklen_t
AH_TEMPLATE(socklen_t, [Define to `int' if <sys/socket.h> does not define.])
AC_CACHE_CHECK([for socklen_t in sys/socket.h],
ac_cv_type_socklen_t,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
[#include <sys/types.h>
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
#else
# include <sys/socket.h>
#endif]], [[socklen_t len; len = 0;]])],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)])
AS_IF([test "$ac_cv_type_socklen_t" = no], [
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef _WIN32
# include <winsock2.h>
# include <ws2tcpip.h>
#else
# include <sys/socket.h>
#endif
]], [[
_Generic(getpeername, int (*)(int, struct sockaddr *, int *): 0);
]])
], AC_DEFINE(socklen_t, int), AC_DEFINE(socklen_t, unsigned int))
])
dnl Check for struct sockaddr_storage
AH_TEMPLATE(sockaddr_storage, [Define to `sockaddr' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
AH_TEMPLATE(ss_family, [Define to `sa_family' if <sys/socket.h> does not define.]) dnl ` (fix VIM syntax highlight
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_struct_sockaddr_storage,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#if defined( _WIN32 )
# include <winsock2.h>
#else
# include <sys/socket.h>
#endif]], [[struct sockaddr_storage addr;]])],
[ac_cv_struct_sockaddr_storage=yes],
[ac_cv_struct_sockaddr_storage=no])])
AS_IF([test "${ac_cv_struct_sockaddr_storage}" = no], [
AC_DEFINE(sockaddr_storage, sockaddr)
AC_DEFINE(ss_family, sa_family)
])
dnl FreeBSD has a gnugetopt library for this:
GNUGETOPT_LIBS=""
AC_CHECK_FUNC(getopt_long,, [
AC_CHECK_LIB([gnugetopt],[getopt_long], [
GNUGETOPT_LIBS="-lgnugetopt"
])
])
AC_SUBST([GNUGETOPT_LIBS])
AC_CHECK_LIB([m], [cos], [
LIBM="-lm"
], [
LIBM=""
])
AC_SUBST([LIBM])
AC_CHECK_LIB([m], [lrintf], [
AC_DEFINE(HAVE_LRINTF, 1, [Define to 1 if you have the lrintf function])
VLC_ADD_LIBS([skins2],[-lm])
])
AC_CHECK_LIB([m], [nanf],
AC_DEFINE(HAVE_NANF, 1, [Define to 1 if you have the NANF function])
)
AC_CHECK_LIB([m], [sincos], [
AC_DEFINE(HAVE_SINCOS, 1, [Define to 1 if you have the sincos function.])
], [
AC_LIBOBJ([sincos])
])
AC_MSG_CHECKING([broken qsort_r prototype])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <stdlib.h>
_Static_assert(_Generic((qsort_r),
void (*)(void *, size_t, size_t, void *,
int (*)(void *, const void *, const void *)) : 1, default: 0),
"Bad prototype not matched");
])], [
AC_MSG_RESULT([broken])
AC_DEFINE([HAVE_BROKEN_QSORT_R], 1, [Defined to 1 if the qsort_r() prototype contradicts the upcoming POSIX standard.])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([_Thread_local support])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_Thread_local int foo = 0;
int main() {}])], [
AC_MSG_RESULT([ok])
AC_DEFINE(HAVE_THREAD_LOCAL, 1, [Defined to 1 if C11 _Thread_local storage qualifier is supported])
],[ AC_MSG_RESULT([no])])
dnl __STDC_NO_THREADS__ can't be trusted on some platforms.
dnl check for its availability explicitely
AC_CHECK_HEADERS([threads.h])
AC_CHECK_LIB([anl],[getaddrinfo_a],[])
dnl Check for dynamic plugins
LIBDL=""
have_dynamic_objects="no"
VLC_SAVE_FLAGS
AC_SEARCH_LIBS(dlsym, [dl svld], [
AS_IF([test "$ac_cv_search_dlsym" != "none required"], [
LIBDL="$ac_cv_search_dlsym"
])
have_dynamic_objects="yes"
])
VLC_RESTORE_FLAGS
# Windows
AS_IF([test "${SYS}" = "mingw32"], [
LIBDL=""
have_dynamic_objects="yes" #assume we can use shared objects
])
AC_ARG_WITH([libfuzzer],
AS_HELP_STRING([--with-libfuzzer=DIR],
[use libFuzzer library from DIR and triggers sanitize coverage (default disabled)]),
[],
[with_libfuzzer=no])
AS_VAR_IF(with_libfuzzer, no, [], [
enable_shared=no
enable_static=yes
enable_vlc=no
])
AM_CONDITIONAL([HAVE_LIBFUZZER], [test "${with_libfuzzer}" != "no"])
AS_IF([test "${enable_shared}" = "no"], [
have_dynamic_objects=no
])
AM_CONDITIONAL([HAVE_DYNAMIC_PLUGINS], [test "${have_dynamic_objects}" != "no"])
AC_SUBST([LIBDL])
AS_IF([test "${SYS}" != "mingw32"], [
AC_SEARCH_LIBS([clock_nanosleep], [rt pthread], [
AS_IF([test "$ac_cv_search_clock_nanosleep" != "none required"], [
LIBRT="$ac_cv_search_clock_nanosleep"
])
], [
AC_SEARCH_LIBS([nanosleep], [rt pthread posix4], [
AS_IF([test "$ac_cv_search_nanosleep" != "none required"], [
LIBRT="$ac_cv_search_nanosleep"
])
])
])
])
AC_SUBST([LIBRT])
dnl Check for clock_* functions, needs to be done here,
dnl after the -lrt check