forked from koying/SPMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2430 lines (2211 loc) · 78.1 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([kodi], [17.5.0], [http://trac.kodi.tv])
AC_CONFIG_HEADERS([xbmc/config.h])
AH_TOP([#pragma once])
m4_include([m4/ax_prog_cc_for_build.m4])
m4_include([m4/ax_prog_cxx_for_build.m4])
m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
m4_include([m4/ax_python_devel.m4])
m4_include([m4/xbmc_arch.m4])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST
tolower(){
echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
}
# workaround for autotools that don't set this
abs_top_srcdir=${abs_top_srcdir=$(cd $srcdir; pwd)}
# check for enabling additional players
AC_DEFUN([XB_ADD_PLAYER],
[
AC_MSG_CHECKING([for $2])
case $add_players in
*$2*)
AC_SUBST([USE_$1], 1)
AC_DEFINE([HAS_$1], 1, [using $2])
AC_MSG_RESULT([enabling $2])
;;
*)
AC_MSG_RESULT([$2 is not enabled])
esac
])
# check for enabling additional codecs
AC_DEFUN([XB_ADD_CODEC],
[
AC_MSG_CHECKING([for $2])
case $3 in
*$2*)
use_codec_$2="yes"
AC_SUBST([USE_$1], 1)
AC_DEFINE([HAS_$1], 1, [using $2])
AC_MSG_RESULT([enabling $2])
;;
*)
AC_MSG_RESULT([$2 is not enabled])
esac
])
# check for library basenames
AC_DEFUN([XB_FIND_SONAME],
[
if echo "$host" | grep -q freebsd ; then
AC_MSG_CHECKING([for lib$2 soname])
$1_SONAME=[`ldconfig -r | sed -n "s;.* \(/.*lib$2\.so.*\)$;\1;p" | head -n 1`]
if test x$$1_SONAME != x ; then
$1_SONAME=[`basename $$1_SONAME`]
fi
elif [[ "$host_vendor" != "apple" ]]; then
AC_MSG_CHECKING([for lib$2 soname])
$1_FILENAME=$($CC -nostdlib -o /dev/null $CFLAGS $LDFLAGS $4 -l$2 -Wl,-M 2>/dev/null | grep "^LOAD.*$2" | awk '{V=2; print $V}')
if [[ -z $$1_FILENAME ]]; then
#try gold linker syntax
$1_FILENAME=$($CC -nostdlib -o /dev/null $CFLAGS $LDFLAGS $4 -l$2 -Wl,-t 3>&1 1>&2 2>&3 | grep "lib$2")
fi
if [[ ! -z $$1_FILENAME ]]; then
$1_SONAME=$($OBJDUMP -p $$1_FILENAME | grep "SONAME.*$2" | awk '{V=2; print $V}')
fi
else
AC_MSG_CHECKING([for lib$2 dylib])
gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
env_lib_path=[`echo $LDFLAGS | sed 's/-L[ ]*//g'`]
if test "$cross_compiling" = yes; then
host_lib_path=""
else
host_lib_path="/usr/lib /usr/local/lib"
fi
for path in $gcc_lib_path $env_lib_path $host_lib_path; do
lib=[`ls -- $path/lib$2.dylib 2>/dev/null`]
if test x$lib != x; then
# we want the path/name that is embedded in the dylib
$1_FILENAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
$1_SONAME=[`basename $$1_FILENAME`]
fi
done
fi
if [[ -z "$$1_SONAME" ]]; then
AC_MSG_RESULT([no])
if test -z "$3" || test "x${$3}" = "xyes"; then
AC_MSG_ERROR([Unable to determine soname of lib$2 library])
else
AC_MSG_WARN([Unable to determine soname of lib$2 library])
$3=no
AC_MSG_WARN([lib$2 support disabled])
fi
else
AC_MSG_RESULT([$$1_SONAME])
AC_SUBST($1_SONAME)
fi
])
# Function to push and pop libs and includes for a command
AC_DEFUN([XB_PUSH_FLAGS], [
SAVE_LIBS="$LIBS"
SAVE_INCLUDES="$INCLUDES"
LIBS="[$2]"
INCLUDES="[$1]"
[$3]
LIBS="$SAVE_LIBS"
INCLUDES="$SAVE_INCLUDES"
])
# version can be overridden by setting the following as ENV vars when running configure
APP_NAME=${APP_NAME-$(${AWK} '/APP_NAME/ {print $2}' version.txt)}
APP_NAME_LC=$(echo $APP_NAME | ${AWK} '{print tolower($0)}')
APP_NAME_UC=$(echo $APP_NAME | ${AWK} '{print toupper($0)}')
APP_EMAIL=${APP_NAME-$(${AWK} '/EMAIL/ {print $2}' version.txt)}
APP_VERSION_MAJOR=${APP_VERSION_MAJOR-$(${AWK} '/VERSION_MAJOR/ {print $2}' version.txt)}
APP_VERSION_MINOR=${APP_VERSION_MINOR-$(${AWK} '/VERSION_MINOR/ {print $2}' version.txt)}
APP_VERSION_TAG=${APP_VERSION_TAG-$(${AWK} '/VERSION_TAG/ {print $2}' version.txt)}
APP_VERSION_TAG_LC=$(echo $APP_VERSION_TAG | ${AWK} '{print tolower($0)}')
APP_VERSION_CODE=${APP_VERSION_CODE-$(${AWK} '/VERSION_CODE/ {print $2}' version.txt)}
APP_ADDON_API=${APP_ADDON_API-$(${AWK} '/ADDON_API/ {print $2}' version.txt)}
APP_STICKYURL=${APP_STICKYURL-$(${AWK} '/APP_STICKYURL/ {print $2}' version.txt)}
APP_EMAIL=${APP_EMAIL-$(${AWK} '/APP_EMAIL/ {print $2}' version.txt)}
if test "$APP_NAME" != "" && test "$APP_VERSION_MAJOR" != "" && test "$APP_VERSION_MINOR" != "" \
&& test "$APP_VERSION_CODE" != "" && test "$APP_ADDON_API" != ""; then
APP_VERSION=${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
if test "$APP_VERSION_TAG" != ""; then
APP_VERSION=${APP_VERSION}-${APP_VERSION_TAG}
fi
AC_SUBST(APP_NAME)
AC_SUBST(APP_NAME_LC)
AC_SUBST(APP_NAME_UC)
AC_SUBST(APP_EMAIL)
AC_SUBST(APP_VERSION)
AC_SUBST(APP_VERSION_MAJOR)
AC_SUBST(APP_VERSION_MINOR)
AC_SUBST(APP_VERSION_TAG)
AC_SUBST(APP_VERSION_TAG_LC)
AC_SUBST(APP_VERSION_CODE)
AC_SUBST(APP_ADDON_API)
AC_SUBST(APP_STICKYURL)
AC_SUBST(APP_EMAIL)
dashes="------------------------"
final_message="\n ${APP_NAME} Configuration:"
final_message="\n$dashes$final_message\n$dashes"
final_message="$final_message\n ${APP_NAME} Version:\t${APP_VERSION}"
else
AC_MSG_ERROR(could not detect application Version, make sure version.txt is complete)
fi
# check for GIT_REV
AC_CHECK_PROG(HAVE_GIT,git,"yes","no",)
if test "$GIT_REV" = ""; then
if test -f VERSION ; then
GIT_REV=$(awk 'END{print substr($1,1,16)}' VERSION)
elif test "$HAVE_GIT" = "yes" -a -d ${abs_top_srcdir}/.git; then
GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
else
GIT_REV="Unknown"
fi
fi
final_message="$final_message\n git Rev.:\t${GIT_REV}"
# General message strings
configure_debug="ERROR: this is a configure debug statement"
missing_library="Could not find a required library. Please see the README for your platform."
missing_headers="Could not find some required headers. Please see the README for your platform."
missing_program="Could not find a required program. Please see the README for your platform."
alsa_disabled="== ALSA support disabled. =="
dbus_disabled="== DBUS support disabled. =="
x11_enabled="== X11 enabled. =="
x11_disabled="== X11 disabled. =="
pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
pulse_disabled="== PulseAudio support disabled. =="
avahi_not_found="== Could not find libavahi-common or libavahi-client. Avahi support disabled. =="
avahi_disabled="== Avahi support disabled. =="
mdnsembedded_not_found="== Could not find mDNSEmbedded. Might prevent zeroconf support. =="
mdnsembedded_disabled="== mDNSEmbedded support disabled. =="
vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
vdpau_disabled="== VDPAU support manually disabled. =="
vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
vaapi_disabled="== VAAPI support manually disabled. =="
openmax_disabled="== OpenMax support manually disabled. =="
openmax_not_found="== Could not find OpenMax headers. OpenMax support disabled. =="
libnfs_not_found="== Could not find libnfs. NFS client support disabled. =="
libnfs_disabled="== NFS support disabled. =="
libshairplay_not_found="== Could not find libshairplay. =="
samba_disabled="== SAMBA support disabled. =="
libplist_not_found="== Could not find libplist. AirPlay support disabled. =="
libplist_disabled="== AirPlay support disabled. =="
alsa_not_found="== Could not find ALSA. ALSA support disabled. =="
dbus_not_found="== Could not find DBUS. DBUS support disabled. =="
libcap_disabled="== Capabilities detection support disabled. =="
libcap_not_found="== Could not find libcap. Capabilities detection support disabled. =="
gtest_enabled="== Google Test Framework will be configured. =="
gtest_disabled="== Google Test Framework will not be configured. =="
libudev_not_found="== Could not find libudev. Will use polling to check for device changes. =="
libudev_disabled="== udev support disabled. Will use polling to check for device changes. =="
libusb_not_found="== Could not find libusb. Plug and play USB device support will not be available. =="
libusb_disabled="== libusb disabled. Plug and play USB device support will not be available. =="
libusb_disabled_udev_found="== libusb disabled. =="
libcec_enabled="== libcec enabled. =="
libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
lcms2_enabled="== lcms2 enabled. =="
lcms2_not_found="== Could not find lcms2. ICC profile support will not be available. =="
lcms2_disabled="== lcms2 disabled. ICC profile support will not be available. =="
libbluetooth_not_found="== Could not find libbluetooth. Bluetooth support will not be available =="
libbluetooth_enabled="== libbluetooth enabled. =="
libbluetooth_disabled="== libbluetooth disabled. Bluetooth support will not be available. =="
AC_ARG_WITH([ffmpeg],
[AS_HELP_STRING([--with-ffmpeg],
[ffmpeg options: auto (search pkg-config or auto build), force (always build ffmpeg), shared (link dynamically), path_to_ffmpeg [default=force]])],
[ffmpeg_dir=$with_ffmpeg],
[with_ffmpeg=force])
AC_ARG_ENABLE([shared-lib],
[AS_HELP_STRING([--enable-shared-lib],
[build lib${APP_NAME_LC}. helpful for tests (default is no)])],
[build_shared_lib=$enableval],
[build_shared_lib=no])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debugging information (default is yes)])],
[use_debug=$enableval],
[use_debug=yes])
AC_ARG_WITH([platform],
[AS_HELP_STRING([--with-platform],
[use a pre-configured config for common arm boards])],
[use_platform=$withval],
[use_platform=none])
AC_ARG_ENABLE([optimizations],
[AS_HELP_STRING([--enable-optimizations],
[enable passing -O2 to CFLAGS (default is yes)])],
[use_optimizations=$enableval],
[use_optimizations=yes])
AC_ARG_ENABLE([gl],
[AS_HELP_STRING([--enable-gl],
[enable OpenGL rendering (default is yes)])],
[use_gl=$enableval],
[use_gl=yes])
AC_ARG_ENABLE([gles],
[AS_HELP_STRING([--enable-gles],
[enable OpenGLES rendering (default is no)])],
[use_gles=$enableval],
[use_gles=no])
AC_ARG_ENABLE([vdpau],
[AS_HELP_STRING([--enable-vdpau],
[enable VDPAU decoding (default is auto)])],
[use_vdpau=$enableval],
[use_vdpau=auto])
AC_ARG_ENABLE([vaapi],
[AS_HELP_STRING([--enable-vaapi],
[enable VAAPI decoding (default is auto)])],
[use_vaapi=$enableval],
[use_vaapi=auto])
AC_ARG_ENABLE([openmax],
[AS_HELP_STRING([--enable-openmax],
[enable OpenMax decoding (default is auto, requires OpenGLES)])],
[use_openmax=$enableval],
[use_openmax=auto])
AC_ARG_ENABLE([tegra],
[AS_HELP_STRING([--enable-tegra],
[enable Tegra2 arm (default is no)])],
[use_tegra=$enableval],
[use_tegra=no])
AC_ARG_ENABLE([profiling],
[AS_HELP_STRING([--enable-profiling],
[enable gprof profiling (default is no)])],
[use_profiling=$enableval],
[use_profiling=no])
AC_ARG_ENABLE([x11],
[AS_HELP_STRING([--enable-x11],
[enable x11 (default is yes) 'Linux Only'])],
[use_x11=$enableval],
[use_x11=yes])
AC_ARG_ENABLE([ccache],
[AS_HELP_STRING([--enable-ccache],
[enable building with ccache feature (default is auto)])],
[use_ccache=$enableval],
[use_ccache=auto])
AC_ARG_ENABLE([alsa],
[AS_HELP_STRING([--disable-alsa],
[disable ALSA support (only for linux/freebsd)])],
[use_alsa=$enableval],
[use_alsa=yes])
AC_ARG_ENABLE([dbus],
[AS_HELP_STRING([--disable-dbus],
[disable DBUS support])],
[use_dbus=$enableval],
[use_dbus=yes])
AC_ARG_ENABLE([pulse],
[AS_HELP_STRING([--enable-pulse],
[enable PulseAudio support (default is auto)])],
[use_pulse=$enableval],
[use_pulse=auto])
AC_ARG_ENABLE([ssh],
[AS_HELP_STRING([--disable-ssh],
[disable SSH SFTP support (default is enabled)])],
[use_ssh=$enableval],
[use_ssh=yes])
AC_ARG_ENABLE([samba],
[AS_HELP_STRING([--disable-samba],
[disable SAMBA support (default is enabled)])],
[use_samba=$enableval],
[use_samba=yes])
AC_ARG_ENABLE([nfs],
[AS_HELP_STRING([--enable-nfs],
[enable NFS support via libnfs (default is auto)])],
[use_libnfs=$enableval],
[use_libnfs=auto])
AC_ARG_ENABLE([airplay],
[AS_HELP_STRING([--enable-airplay],
[enable AirPlay support(default is auto)])],
[use_airplay=$enableval],
[use_airplay=auto])
AC_ARG_ENABLE([airtunes],
[AS_HELP_STRING([--enable-airtunes],
[enable AirTunes support(default is auto)])],
[use_airtunes=$enableval],
[use_airtunes=auto])
AC_ARG_ENABLE([upnp],
[AS_HELP_STRING([--disable-upnp],
[disable UPnP support (default is enabled)])],
[use_upnp=$enableval],
[use_upnp=yes])
AC_ARG_ENABLE([mid],
[AS_HELP_STRING([--enable-mid],
[enable MID support (default is no)])],
[use_mid=$enableval],
[use_mid=no])
AC_ARG_ENABLE([avahi],
[AS_HELP_STRING([--disable-avahi],
[disable Avahi support (default is enabled if libavahi-common and libavahi-client is found)])],
[use_avahi=$enableval],
[use_avahi=yes])
AC_ARG_ENABLE([mdnsembedded],
[AS_HELP_STRING([--disable-mdnsembedded],
[disable mDNSEmbedded support (default is auto)])],
[use_mdnsembedded=$enableval],
[use_mdnsembedded=auto])
AC_ARG_ENABLE([non-free],
[AS_HELP_STRING([--disable-non-free],
[disable components with non-compliant licenses])],
[use_nonfree=$enableval],
[use_nonfree=yes])
AC_ARG_ENABLE([mysql],
[AS_HELP_STRING([--disable-mysql],
[disable mysql])],
[use_mysql=$enableval],
[use_mysql=yes])
AC_ARG_ENABLE([webserver],
[AS_HELP_STRING([--disable-webserver],
[disable webserver])],
[use_webserver=$enableval],
[use_webserver=yes])
AC_ARG_ENABLE([optical-drive],
[AS_HELP_STRING([--disable-optical-drive],
[disable optical drive])],
[use_optical_drive=$enableval],
[use_optical_drive=yes])
AC_ARG_ENABLE([libbluray],
[AS_HELP_STRING([--enable-libbluray],
[enable libbluray support])],
[use_libbluray=$enableval],
[use_libbluray=auto])
AC_ARG_ENABLE([libxslt],
[AS_HELP_STRING([--disable-libxslt],
[enable libxslt (XSLT scrapers) support (default is enabled)])],
[use_libxslt=$enableval],
[use_libxslt=yes])
AC_ARG_ENABLE([texturepacker],
[AS_HELP_STRING([--enable-texturepacker],
[enable texturepacker support (default is auto)])],
[use_texturepacker=$enableval],
[use_texturepacker=auto])
AC_ARG_ENABLE([lirc],
[AS_HELP_STRING([--disable-lirc],
[disable lirc support (default is enabled)])],
[AC_MSG_RESULT("Lirc disabled")],
[AC_DEFINE([HAVE_LIRC], [1], ["Lirc enabled"])])
AC_ARG_WITH([lirc-device],
[AS_HELP_STRING([--with-lirc-device=file],
[specify the default LIRC device (default is /dev/lircd)])],
[lirc_device=$withval],
[lirc_device=/dev/lircd])
AC_DEFINE_UNQUOTED([LIRC_DEVICE], ["$lirc_device"], [Default LIRC device])
AC_ARG_ENABLE([udev],
[AS_HELP_STRING([--enable-udev],
[enable udev support (default is auto)])],
[use_libudev=$enableval],
[use_libudev=auto])
AC_ARG_ENABLE([libusb],
[AS_HELP_STRING([--enable-libusb],
[enable libusb support (default is auto)])],
[use_libusb=$enableval],
[use_libusb=auto])
AC_ARG_ENABLE([libcec],
[AS_HELP_STRING([--enable-libcec],
[enable libcec support (default is auto)])],
[use_libcec=$enableval],
[use_libcec=auto])
AC_ARG_ENABLE([lcms2],
[AS_HELP_STRING([--enable-lcms2],
[enable lcms2 support (default is auto)])],
[use_lcms2=$enableval],
[use_lcms2=auto])
AC_ARG_ENABLE([libbluetooth],
[AS_HELP_STRING([--enable-libbluetooth],
[enable libbluetooth support (default is auto)])],
[use_libbluetooth=$enableval],
[use_libbluetooth=auto])
AC_ARG_ENABLE([libcap],
[AS_HELP_STRING([--enable-libcap],
[enable libcap support (default is auto)])],
[use_libcap=$enableval],
[use_libcap=auto])
AC_ARG_ENABLE([player],
[AS_HELP_STRING([--enable-player],
[enable additional players from a list of comma separated names, (default is none, choices are omxplayer)])],
[add_players=$enableval],
[add_players=no])
AC_ARG_ENABLE([gtest],
[AS_HELP_STRING([--enable-gtest],
[configure Google Test Framework (default is yes)])],
[configure_gtest=$enableval],
[configure_gtest=yes])
AC_ARG_ENABLE([codec],
[AS_HELP_STRING([--enable-codec],
[enable additional codecs from a list of comma separated names, (default is none, choices are amcodec and imxvpu)])],
[add_codecs=$enableval],
[add_codecs=no])
AC_ARG_ENABLE([libav-compat],
[AS_HELP_STRING([--enable-libav-compat],
[build a wrapper around libav to provide the functions needed by ${APP_NAME}. This is
*not* supported by ${APP_NAME} developers and is provided only for convenience. (default is no) 'Linux only'])],
[use_libav_hacks=$enableval],
[use_libav_hacks=no])
### End of external library options
if test "x$host_vendor" != "xapple"; then
DEFAULT_COMPILE_FLAGS="-fPIC -DPIC -D_REENTRANT"
DEFAULT_COMPILE_FLAGS="$DEFAULT_COMPILE_FLAGS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
fi
# Checks for programs.
PASSED_CFLAGS=$CFLAGS # Hack to override autoconf default values
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
CFLAGS="$PASSED_CFLAGS $DEFAULT_COMPILE_FLAGS"
PASSED_CXXFLAGS=$CXXFLAGS # Hack to override autoconf default values
AC_PROG_CXX
AX_PROG_CXX_FOR_BUILD
CXXFLAGS="$PASSED_CXXFLAGS $DEFAULT_COMPILE_FLAGS"
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
AC_PROG_LIBTOOL
AC_PROG_AWK
AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
MAKE="${MAKE:-make}"
OBJDUMP="${OBJDUMP:-objdump}"
READELF="${READELF:-readelf}"
NM="${NM:-nm}"
# host detection and setup
case $host in
i*86*-linux-android*)
target_platform=target_android
CORE_SYSTEM_NAME=android
ARCH="i486-linux"
use_arch="x86"
use_cpu="i686"
use_gles=yes
use_optical_drive=no
use_x11=no
build_shared_lib=yes
;;
i*86*-linux-gnu*|i*86*-*-linux-uclibc*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="i486-linux"
if test "$use_cpu" = "no" -a "$cross_compiling" = "yes"; then
use_arch="x86"
use_cpu="i686"
fi
USE_STATIC_FFMPEG=1
# Workaround a build issue on i386 with gcc 4.9:
# including <algorithm> pulls in SSE intrinsics.
# possible GCC bug? ideas welcome
if test "$GCC_CXX" = "yes"; then
GCC_VERSION=$($CXX -dumpversion)
GCC_MAJOR_VER=$(echo $GCC_VERSION | awk -F"." '{print $1}')
GCC_MINOR_VER=$(echo $GCC_VERSION | awk -F"." '{print $2}')
if (test "$GCC_MAJOR_VER" -eq "4" && test "$GCC_MINOR_VER" -ge "9") || (test "$GCC_MAJOR_VER" -gt "4"); then
CXXFLAGS="$CXXFLAGS -msse"
AC_MSG_NOTICE("detected gcc version $GCC_VERSION - enabling SSE")
fi
fi
;;
x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="x86_64-linux"
if test "$use_cpu" = "no" -a "$cross_compiling" = "yes"; then
use_arch="x86_64"
use_cpu="x86_64"
fi
USE_STATIC_FFMPEG=1
;;
i386-*-freebsd*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="x86-freebsd"
MAKE="gmake"
;;
amd64-*-freebsd*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="x86_64-freebsd"
MAKE="gmake"
;;
arm-apple-darwin*)
CORE_SYSTEM_NAME=ios
use_neon=yes
use_libcec=no
use_optical_drive=no
use_gles=yes
use_cpu=cortex-a8
ARCH="arm-osx"
use_arch="arm"
PYTHON_VERSION="2.7"
PYTHON_LDFLAGS="-L${prefix}/lib -lpython2.7"
PYTHON_CPPFLAGS="-I${prefix}/include/python2.7"
PYTHON_SITE_PKG="${prefix}/lib/python2.7/site-packages"
PYTHON_NOVERSIONCHECK="no-check"
DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
;;
*86*-apple-darwin*)
CORE_SYSTEM_NAME=osx
ARCH="x86-osx"
DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
;;
powerpc-apple-darwin*)
CORE_SYSTEM_NAME=osx
ARCH="powerpc-osx"
use_arch="ppc"
DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
;;
powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="powerpc-linux"
;;
powerpc64*-*-linux-gnu*|powerpc64*-*-linux-uclibc*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="powerpc64-linux"
;;
arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="arm"
use_arch="arm"
use_neon=yes
use_gles=yes
use_gl=no
USE_STATIC_FFMPEG=1
;;
aarch64*-*-linux-gnu*|aarch64*-*-linux-uclibc*)
target_platform=target_linux
ARCH="aarch64"
use_arch="aarch64"
use_neon=yes
# Check whether --enable-gl was given.
if test "${enable_gl+set}" = set; then :
enableval=$enable_gl; use_gl=$enableval
else
use_gl=no
use_gles=yes
fi
USE_STATIC_FFMPEG=1
;;
arm*-*linux-android*)
target_platform=target_android
CORE_SYSTEM_NAME=android
use_arch="arm"
use_cpu=cortex-a9
ARCH="arm"
use_neon=yes
use_gles=yes
use_optical_drive=no
use_x11=no
build_shared_lib=yes
;;
mips*-*-linux-gnu*)
target_platform=target_linux
CORE_SYSTEM_NAME=linux
ARCH="mips"
use_arch="mips"
use_gles=no
use_gl=yes
use_sdl=yes
USE_STATIC_FFMPEG=1
;;
*)
AC_MSG_ERROR(unsupported host ($host))
esac
AC_SUBST([ARCH])
if test "$target_platform" = "target_android" ; then
USE_ANDROID=1
webserver_checkdepends=yes
CFLAGS="$CFLAGS -Wno-psabi"
CXXFLAGS="$CXXFLAGS -Wno-psabi"
AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
fi
case $use_platform in
raspberry-pi)
target_platform=target_raspberry_pi
use_neon=no
use_cpu=arm1176jzf-s
;;
raspberry-pi2)
target_platform=target_raspberry_pi
use_neon=yes
use_cpu=cortex-a7
;;
esac
if test "$target_platform" = "target_raspberry_pi" ; then
use_arch="arm"
use_hardcoded_tables="yes"
use_openmax=no
CORE_SYSTEM_NAME=rbpi
ARCH="arm"
AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
USE_OMXLIB=1; AC_DEFINE([HAVE_OMXLIB],[1],["Define to 1 if OMX libs is enabled"])
USE_MMAL=1; AC_DEFINE([HAS_MMAL],[1],["Define to 1 if MMAL libs is enabled"])
CFLAGS="$CFLAGS"
CXXFLAGS="$CXXFLAGS"
fi
if test "$host_vendor" = "apple"; then
use_avahi=no
use_alsa=no
use_openmax=no
use_libudev=no
use_libusb=no
use_x11=no
fi
XBMC_SETUP_ARCH_DEFINES()
# detect soname version
if test "$host_vendor" = "apple"; then
echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
else
SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'"
fi
if test "$build_shared_lib" = "yes"; then
final_message="$final_message\n Shared lib\tYes"
AC_SUBST(USE_LIBXBMC,1)
fi
# platform debug flags
if test "$use_debug" = "yes"; then
CMAKE_BUILD_TYPE="Debug"
final_message="$final_message\n Debugging:\tYes"
if test "$use_profiling" = "yes"; then
final_message="$final_message\n Profiling:\tYes"
DEBUG_FLAGS="-g -pg -D_DEBUG -Wall"
else
final_message="$final_message\n Profiling:\tNo"
DEBUG_FLAGS="-g -D_DEBUG -Wall"
fi
else
CMAKE_BUILD_TYPE="Release"
final_message="$final_message\n Debugging:\tNo"
if test "$use_profiling" = "yes"; then
final_message="$final_message\n Profiling:\tYes"
DEBUG_FLAGS="-pg -DNDEBUG=1"
else
final_message="$final_message\n Profiling:\tNo"
DEBUG_FLAGS="-DNDEBUG=1"
fi
fi
CFLAGS="$DEBUG_FLAGS $CFLAGS"
CXXFLAGS="$DEBUG_FLAGS $CXXFLAGS"
if test "$use_optimizations" = "yes"; then
final_message="$final_message\n Optimization:\tYes"
CXXFLAGS="-O2 $CXXFLAGS"
CFLAGS="-O2 $CFLAGS"
else
final_message="$final_message\n Optimization:\tNo"
fi
# platform specific flags
if echo "$ARCH" | grep -q "freebsd" ; then
LOCALBASE="${LOCALBASE:-/usr/local}"
CFLAGS="$CFLAGS -I$LOCALBASE/include"
CXXFLAGS="$CXXFLAGS -I$LOCALBASE/include"
CPPFLAGS="$CPPFLAGS -I$LOCALBASE/include"
LDFLAGS="$LDFLAGS -L$LOCALBASE/lib"
fi
if test "$host_vendor" = "apple" ; then
# standard application paths
INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/xbmc/osx"
if test "$use_arch" != "arm"; then
SAVE_CFLAGS="$CFLAGS"
CFLAGS="-msse -msse2"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([int foo;])],
[ HAVE_SSE=1
HAVE_SSE2=1
AC_DEFINE([HAVE_SSE],[1],[sse enabled])
AC_DEFINE([HAVE_SSE2],[1],[sse2 enabled])],
[ HAVE_SSE=0
HAVE_SSE2=0
AC_DEFINE([HAVE_SSE],[0],[sse enabled])
AC_DEFINE([HAVE_SSE2],[0],[sse2 enabled])
])
CFLAGS="$SAVE_CFLAGS"
LIBS="$LIBS -framework ApplicationServices"
LIBS="$LIBS -framework AudioUnit"
LIBS="$LIBS -framework AudioToolbox"
LIBS="$LIBS -framework Cocoa"
LIBS="$LIBS -framework CoreAudio"
LIBS="$LIBS -framework CoreVideo"
LIBS="$LIBS -framework CoreServices"
LIBS="$LIBS -framework CoreFoundation"
LIBS="$LIBS -framework DiskArbitration"
LIBS="$LIBS -framework IOKit"
LIBS="$LIBS -framework IOSurface"
LIBS="$LIBS -framework QuartzCore"
LIBS="$LIBS -framework SystemConfiguration"
LIBS="$LIBS -framework VideoDecodeAcceleration"
else
#arm/ios
LIBS="$LIBS -framework CoreFoundation"
fi
elif test "$target_platform" = "target_raspberry_pi"; then
ARCH="arm"
use_arch="arm"
elif test "$use_arch" = "arm"; then
CFLAGS="$CFLAGS -mno-apcs-stack-check"
CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
if test "$use_tegra" = "yes"; then
# Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support
SAVE_CFLAGS="$CFLAGS"
CFLAGS="-mfpu=vfpv3-d16"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([int foo;])],
[ CFLAGS="$SAVE_CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
use_cpu=cortex-a9],
[ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
use_cpu=cortex-a8])
else
if test "$use_neon" = "yes"; then
CFLAGS="$CFLAGS -mfpu=neon -mvectorize-with-neon-quad"
CXXFLAGS="$CXXFLAGS -mfpu=neon -mvectorize-with-neon-quad"
fi
fi
fi
use_sse4=no
if test "$ARCH" = "x86_64-linux" || test "$ARCH" = "i486-linux"; then
SAVE_CFLAGS="$CFLAGS"
CFLAGS="-msse -msse2 -msse4.1"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([int foo;])],
[ use_sse4=yes
HAVE_SSE=1
HAVE_SSE2=1
HAVE_SSE4=1
AC_DEFINE([HAVE_SSE],[1],[sse enabled])
AC_DEFINE([HAVE_SSE2],[1],[sse2 enabled])
AC_DEFINE([HAVE_SSE4],[1],[sse4.1 enabled])],
[ use_sse4=no
HAVE_SSE=0
HAVE_SSE2=0
HAVE_SSE4=0
AC_DEFINE([HAVE_SSE],[0],[sse enabled])
AC_DEFINE([HAVE_SSE2],[0],[sse2 enabled])
AC_DEFINE([HAVE_SSE4],[0],[sse4.1 enabled])
])
CFLAGS="$SAVE_CFLAGS"
fi
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FSEEKO
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_MMAP
# Boxee is apparently having compile problems
# if HAVE_REALLOC is defined. Sort this later.
#AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_SETVBUF_REVERSED
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRCOLL
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit dup2 fdatasync floor fs_stat_dev ftime ftruncate getcwd gethostbyaddr gethostbyname gethostname getpagesize getpass gettimeofday inet_ntoa lchown localeconv memchr memmove memset mkdir modf munmap pow rmdir select setenv setlocale socket sqrt strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul sysinfo tzset utime posix_fadvise localtime_r])
# Check for various sizes
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([size_t])
# Check for intrinsics
AC_MSG_CHECKING([for __sync_add_and_fetch(temp, 1)])
AC_TRY_LINK([],[long* temp=0; long ret=__sync_add_and_fetch(temp, 1);],
[have_builtin_sync_add_and_fetch=yes],
[have_builtin_sync_add_and_fetch=no])
AC_MSG_RESULT($have_builtin_sync_add_and_fetch)
if test "x$have_builtin_sync_add_and_fetch" = "xyes"; then
AC_DEFINE(HAS_BUILTIN_SYNC_ADD_AND_FETCH, 1,
[Define to 1 if your compiler supports the __sync_add_and_fetch() intrinsic.])
fi
AC_MSG_CHECKING([for __sync_sub_and_fetch(temp, 1)])
AC_TRY_LINK([],[long* temp=0; long ret=__sync_sub_and_fetch(temp, 1);],
[have_builtin_sync_sub_and_fetch=yes],
[have_builtin_sync_sub_and_fetch=no])
AC_MSG_RESULT($have_builtin_sync_sub_and_fetch)
if test "x$have_builtin_sync_sub_and_fetch" = "xyes"; then
AC_DEFINE(HAS_BUILTIN_SYNC_SUB_AND_FETCH, 1,
[Define to 1 if your compiler supports the __sync_sub_and_fetch() intrinsic.])
fi
AC_MSG_CHECKING([for __sync_val_compare_and_swap(temp, 1, 1)])
AC_TRY_LINK([],[long *temp = 0; long ret=__sync_val_compare_and_swap(temp, 1, 1);],
[have_builtin_sync_val_compare_and_swap=yes],
[have_builtin_sync_val_compare_and_swap=no])
AC_MSG_RESULT($have_builtin_sync_val_compare_and_swap)
if test "x$have_builtin_sync_val_compare_and_swap" = "xyes"; then
AC_DEFINE(HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP, 1,
[Define to 1 if your compiler supports the __sync_val_compare_and_swap() intrinsic.])
fi
# Check for u16string/u32string declarations
AC_LANG_PUSH([C++])
AC_CHECK_TYPES([std::u16string, std::u32string], [], [], [[#include <string>]])
AC_CHECK_TYPES([char16_t, char32_t])
AC_CHECK_SIZEOF([wchar_t])
AC_LANG_POP([C++])
# Check inotify availability
AC_CHECK_HEADER([sys/inotify.h], AC_DEFINE([HAVE_INOTIFY],[1],[Define if we have inotify]),)
# Python
if test -z "$PYTHON_NOVERSIONCHECK"; then
AX_PYTHON_DEVEL([>= '2.6'])
AX_PYTHON_DEVEL([< '3.0'])
PYTHON_VERSION=$ac_python_version
fi
if test -z "$PYTHON_VERSION"; then
AC_MSG_ERROR([Can't find a Python version.])
else
LIBS="$LIBS $PYTHON_LDFLAGS"
AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
fi
# Checks for platforms libraries.
if test "$use_gles" = "yes"; then
use_gl="no"
# GLES overwrites GL if both set to yes.
if test "$host_vendor" = "apple" ; then
AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
else
if test "$target_platform" = "target_raspberry_pi"; then
AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm"
else
AC_CHECK_LIB([EGL], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library))
fi
fi
else
if test "$use_gl" = "yes"; then
if test "$host_vendor" = "apple" ; then
# linking to OpenGL.framework instead of libGL, libGLU so AC_CHECK_LIB will fail
LIBS="$LIBS -framework OpenGL"
AC_DEFINE([HAVE_LIBGL],[1],["Define to 1 if you have the `GL' library (-lGL)."])
AC_MSG_RESULT(== WARNING: OpenGL support is assumed.)
AC_DEFINE([HAVE_LIBGLU],[1],["Define to 1 if you have the `GLU' library (-lGLU)."])
AC_MSG_RESULT(== WARNING: OpenGLU support is assumed.)
else
AC_CHECK_LIB([GL], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([GLU], [main],, AC_MSG_ERROR($missing_library))
fi
else
AC_MSG_RESULT(== WARNING: OpenGL support is disabled. ${APP_NAME} will run VERY slow. ==)
AC_CHECK_LIB([SDL2_gfx],[main])
fi
fi
# platform common libraries
if test "$use_mysql" = "yes"; then
AC_PATH_PROG(MYSQL_CONFIG, mysql_config,"no")
if test "x$MYSQL_CONFIG" != "xno"; then
AC_DEFINE([HAVE_MYSQL],[1],["Define to 1 if you have the `mysql' library (-lmysqlclient)."])
INCLUDES="$INCLUDES `$MYSQL_CONFIG --include`"
MYSQL_LIBS=`$MYSQL_CONFIG --libs`
LIBS="$LIBS $MYSQL_LIBS"
AC_SUBST(MYSQL_LIBS)
else
AC_MSG_ERROR($missing_program)
fi
fi
AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
PKG_CHECK_MODULES([LIBCURL], [libcurl],, AC_MSG_ERROR([libcurl not found]))
XB_FIND_SONAME([CURL], [curl])
AC_MSG_CHECKING([for CRYPTO_set_locking_callback(0) in $CURL_SONAME])