Merge pull request #1587 from dersphere/fix_proxy
[vuplus_xbmc] / configure.in
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT([xbmc], [11.9.7], [http://trac.xbmc.org])
6 AC_CONFIG_HEADERS([xbmc/config.h])
7 AH_TOP([#pragma once])
8 m4_include([m4/ax_python_devel.m4])
9
10 AC_CONFIG_AUX_DIR([build-aux])
11 AM_INIT_AUTOMAKE([foreign])
12 AC_CANONICAL_HOST
13
14 tolower(){
15   echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
16 }
17
18 # check for enabling additional players
19 AC_DEFUN([XB_ADD_PLAYER],
20 [
21   AC_MSG_CHECKING([for $2])
22   case $add_players in
23     *$2*)
24       AC_SUBST([USE_$1], 1)
25       AC_DEFINE([HAS_$1], 1, [using $2])
26       AC_MSG_RESULT([enabling $2])
27       ;;
28     *)
29       AC_MSG_RESULT([$2 is not enabled])
30   esac
31 ])
32
33 # check for library basenames
34 AC_DEFUN([XB_FIND_SONAME],
35 [
36   if echo "$host" | grep -q freebsd ; then
37     AC_MSG_CHECKING([for lib$2 soname])
38     $1_SONAME=[`ldconfig -r | sed -n "s;.* \(/.*lib$2\.so.*\)$;\1;p" | head -n 1`]
39     if test x$$1_SONAME != x ; then
40       $1_SONAME=[`basename $$1_SONAME`]
41     fi
42   elif [[ "$host_vendor" != "apple" ]]; then
43     AC_MSG_CHECKING([for lib$2 soname])
44     $1_FILENAME=$($CC -nostdlib -o /dev/null $LDFLAGS -l$2 -Wl,-M 2>/dev/null | grep "^LOAD.*$2" | awk '{V=2; print $V}')
45     if [[ -z $$1_FILENAME ]]; then
46       #try gold linker syntax
47       $1_FILENAME=$($CC -nostdlib -o /dev/null $LDFLAGS -l$2 -Wl,-t 3>&1 1>&2 2>&3 | grep "$2")
48     fi
49     if [[ ! -z $$1_FILENAME ]]; then
50       $1_SONAME=$($OBJDUMP -p $$1_FILENAME | grep "SONAME.*$2" | awk '{V=2; print $V}')
51     fi
52   else
53     AC_MSG_CHECKING([for lib$2 dylib])
54     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
55     env_lib_path=[`echo $LDFLAGS | sed 's/-L[ ]*//g'`]
56     if test "$cross_compiling" = yes; then
57       host_lib_path=""
58     else
59       host_lib_path="/usr/lib /usr/local/lib"
60     fi
61     for path in $gcc_lib_path $env_lib_path $host_lib_path; do
62       lib=[`ls -- $path/lib$2.dylib 2>/dev/null`]
63       if test x$lib != x; then
64         # we want the path/name that is embedded in the dylib 
65         $1_SONAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
66         $1_SONAME=[`basename $$1_SONAME`]
67       fi
68     done
69   fi
70   if [[ -z "$$1_SONAME" ]]; then
71     AC_MSG_RESULT([no])
72     if test -z "$3" || test "x${$3}" = "xyes"; then
73       AC_MSG_ERROR([Unable to determine soname of lib$2 library])
74     else
75       AC_MSG_WARN([Unable to determine soname of lib$2 library])
76       $3=no
77       AC_MSG_WARN([lib$2 support disabled])
78     fi
79   else
80     AC_MSG_RESULT([$$1_SONAME])
81     AC_SUBST($1_SONAME)
82   fi
83 ])
84
85 # Function to push and pop libs and includes for a command
86 AC_DEFUN([XB_PUSH_FLAGS], [
87   SAVE_LIBS="$LIBS"
88   SAVE_INCLUDES="$INCLUDES"
89   LIBS="[$2]"
90   INCLUDES="[$1]"
91   [$3]
92   LIBS="$SAVE_LIBS"
93   INCLUDES="$SAVE_INCLUDES"
94 ])
95
96 # General message strings
97 configure_debug="ERROR: this is a configure debug statement"
98 missing_library="Could not find a required library. Please see the README for your platform."
99 missing_headers="Could not find some required headers. Please see the README for your platform."
100 missing_program="Could not find a required program. Please see the README for your platform."
101 xrandr_not_found="== Could not find libXRandR. SDL will be used for resolution support. =="
102 xrandr_disabled="== XRandR support disabled. SDL will be used for resolution support. =="
103 goom_enabled="== GOOM enabled. =="
104 goom_disabled="== GOOM disabled. =="
105 alsa_disabled="== ALSA support disabled. =="
106 rsxs_enabled="== RSXS enabled. =="
107 rsxs_disabled="== RSXS disabled. =="
108 projectm_enabled="== ProjectM enabled. =="
109 projectm_disabled="== ProjectM disabled. =="
110 x11_enabled="== X11 enabled. =="
111 x11_disabled="== X11 disabled. =="
112 pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
113 pulse_disabled="== PulseAudio support manually disabled. =="
114 dvdcss_enabled="== DVDCSS support enabled. =="
115 dvdcss_disabled="== DVDCSS support disabled. =="
116 hal_not_found="== Could not find hal. HAL support disabled. =="
117 halstorage_not_found="== Could not find hal-storage. HAL support disabled. =="
118 hal_disabled="== HAL support disabled. =="
119 avahi_not_found="== Could not find libavahi-common or libavahi-client. Avahi support disabled. =="
120 avahi_disabled="== Avahi support disabled. =="
121 vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
122 vdpau_disabled="== VDPAU support manually disabled. =="
123 vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
124 vaapi_disabled="== VAAPI support manually disabled. =="
125 crystalhd_not_found="== Could not find libcrystalhd. CrystalHD support disabled. =="
126 crystalhd_disabled="== CrystalHD support manually disabled. =="
127 vdadecoder_enabled="== VDADecoder support enabled. =="
128 vdadecoder_disabled="== VDADecoder support manually disabled. =="
129 vtbdecoder_enabled="== VTBDecoder support enabled. =="
130 vtbdecoder_disabled="== VTBDecoder support manually disabled. =="
131 openmax_disabled="== OpenMax support manually disabled. =="
132 openmax_not_found="== Could not find libnvomx. OpenMax support disabled. =="
133 ssh_not_found="== Could not find libssh. =="
134 ssh_disabled="== SSH SFTP disabled. =="
135 librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
136 librtmp_disabled="== RTMP support disabled. =="
137 libnfs_not_found="== Could not find libnfs. NFS client support disabled. =="
138 libnfs_disabled="== NFS support disabled. =="
139 libafpclient_not_found="== Could not find libafpclient. AFP client support disabled. =="
140 libafpclient_disabled="== AFP support disabled. =="
141 libshairport_not_found="== Could not find libshairport. AirTunes support disabled. =="
142 libshairport_disabled="== AirTunes support disabled. =="
143 samba_disabled="== SAMBA support disabled. =="
144 libplist_not_found="== Could not find libplist. AirPlay support disabled. =="
145 libplist_disabled="== AirPlay support disabled. =="
146 alsa_not_found="== Could not find ALSA. ALSA support disabled. =="
147 dbus_not_found="== Could not find DBUS. DBUS support disabled. =="
148 libcap_disabled="== Capabilities detection support disabled. =="
149 libcap_not_found="== Could not find libcap. Capabilities detection support disabled. =="
150 gtest_enabled="== Google Test Framework will be configured. =="
151 gtest_disabled="== Google Test Framework will not be configured. =="
152
153 libudev_not_found="== Could not find libudev. Will use polling to check for device changes. =="
154 libudev_disabled="== udev support disabled. Will use polling to check for device changes. =="
155 libusb_not_found="== Could not find libusb. Plug and play USB device support will not be available. =="
156 libusb_disabled="== libusb disabled. Plug and play USB device support will not be available. =="
157 libusb_disabled_udev_found="== libusb disabled. =="
158 libcec_enabled="== libcec enabled. =="
159 libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
160 libcec_disabled_missing_libs="== libcec disabled because it either needs libudev, or libusb a compatible version of the RPi API. CEC adapter support will not be available. =="
161 cec_rpi_api_missing="== no compatible RPi API found =="
162
163 # External library message strings
164 external_libraries_enabled="== Use of all supported external libraries enabled. =="
165 external_libraries_disabled="== Use of all supported external libraries disabled. =="
166 external_ffmpeg_enabled="== Use of external ffmpeg enabled. =="
167 external_ffmpeg_disabled="== Use of external ffmpeg disabled. =="
168 ffmpeg_vdpau_not_supported="== External ffmpeg doesn't support VDPAU. VDPAU support disabled. =="
169 dashes="------------------------"
170 final_message="\n  XBMC Configuration:"
171 final_message="\n$dashes$final_message\n$dashes"
172
173 AC_ARG_ENABLE([shared-lib],
174   [AS_HELP_STRING([--enable-shared-lib],
175   [build libxbmc. helpful for tests (default is no)])],
176   [build_shared_lib=$enableval],
177   [build_shared_lib=no])
178
179 AC_ARG_ENABLE([debug],
180   [AS_HELP_STRING([--enable-debug],
181   [enable debugging information (default is yes)])],
182   [use_debug=$enableval],
183   [use_debug=yes])
184
185 AC_ARG_WITH([arch],
186   [AS_HELP_STRING([--with-arch],
187   [build with given arch passing to internal ffmpeg (default is no, needed for crosscompiling)])],
188   [use_arch=$withval],
189   [use_arch=no])
190
191 AC_ARG_WITH([platform],
192   [AS_HELP_STRING([--with-platform],
193   [use a pre-configured config for common arm boards])],
194   [use_platform=$withval],
195   [use_platform=none])
196
197 AC_ARG_WITH([cpu],
198   [AS_HELP_STRING([--with-cpu],
199   [build with given cpu passing to ffmpeg (default is no)])],
200   [use_cpu=$withval],
201   [use_cpu=no])
202
203 AC_ARG_ENABLE([neon],
204   [AS_HELP_STRING([--enable-neon],
205   [enable neon passing to ffmpeg (default is no)])],
206   [use_neon=$enableval],
207   [use_neon=no])
208
209 AC_ARG_ENABLE([optimizations],
210   [AS_HELP_STRING([--enable-optimizations],
211   [enable optimization (default is yes)])],
212   [use_optimizations=$enableval],
213   [use_optimizations=yes])
214
215 AC_ARG_ENABLE([gl],
216   [AS_HELP_STRING([--enable-gl],
217   [enable OpenGL rendering (default is yes)])],
218   [use_gl=$enableval],
219   [use_gl=yes])
220
221 AC_ARG_ENABLE([gles],
222   [AS_HELP_STRING([--enable-gles],
223   [enable OpenGLES rendering (default is no)])],
224   [use_gles=$enableval],
225   [use_gles=no])
226
227 AC_ARG_ENABLE([sdl],
228   [AS_HELP_STRING([--enable-sdl],
229   [enable SDL (default is auto)])],
230   [use_sdl=$enableval],
231   [use_sdl=auto])
232
233 AC_ARG_ENABLE([vdpau],
234   [AS_HELP_STRING([--enable-vdpau],
235   [enable VDPAU decoding (default is auto)])],
236   [use_vdpau=$enableval],
237   [use_vdpau=auto])
238
239 AC_ARG_ENABLE([vaapi],
240   [AS_HELP_STRING([--enable-vaapi],
241   [enable VAAPI decoding (default is auto)])],
242   [use_vaapi=$enableval],
243   [use_vaapi=auto])
244
245 AC_ARG_ENABLE([crystalhd],
246   [AS_HELP_STRING([--enable-crystalhd],
247   [enable CrystalHD decoding (default is auto)])],
248   [use_crystalhd=$enableval],
249   [use_crystalhd=auto])
250
251 AC_ARG_ENABLE([vdadecoder],
252   [AS_HELP_STRING([--enable-vdadecoder],
253   [enable VDADecoder decoding (default is auto)])],
254   [use_vdadecoder=$enableval],
255   [use_vdadecoder=auto])
256
257 AC_ARG_ENABLE([vtbdecoder],
258   [AS_HELP_STRING([--enable-vtbdecoder],
259   [enable VTBDecoder decoding (default is auto)])],
260   [use_vtbdecoder=$enableval],
261   [use_vtbdecoder=auto])
262
263 AC_ARG_ENABLE([openmax],
264   [AS_HELP_STRING([--enable-openmax],
265   [enable OpenMax decoding (default is auto, requires OpenGLES)])],
266   [use_openmax=$enableval],
267   [use_openmax=auto])
268
269 AC_ARG_ENABLE([tegra],
270   [AS_HELP_STRING([--enable-tegra],
271   [enable Tegra2 arm (default is no)])],
272   [use_tegra=$enableval],
273   [use_tegra=no])
274
275 AC_ARG_ENABLE([profiling],
276   [AS_HELP_STRING([--enable-profiling],
277   [enable gprof profiling (default is no)])],
278   [use_profiling=$enableval],
279   [use_profiling=no])
280
281 AC_ARG_ENABLE([joystick],
282   [AS_HELP_STRING([--enable-joystick],
283   [enable SDL joystick support (default is yes)])],
284   [use_joystick=$enableval],
285   [use_joystick=yes])
286
287 AC_ARG_ENABLE([xrandr],
288   [AS_HELP_STRING([--enable-xrandr],
289   [enable XRandR support (default is yes)])],
290   [use_xrandr=$enableval],
291   [use_xrandr=yes])
292
293 AC_ARG_ENABLE([goom],
294   [AS_HELP_STRING([--enable-goom],
295   [enable GOOM visualisation (default is no)])],
296   [use_goom=$enableval],
297   [use_goom=no])
298
299 AC_ARG_ENABLE([rsxs],
300   [AS_HELP_STRING([--enable-rsxs],
301   [enable really slick X screensavers (default is yes)])],
302   [use_rsxs=$enableval],
303   [use_rsxs=yes])
304
305 AC_ARG_ENABLE([projectm],
306   [AS_HELP_STRING([--enable-projectm],
307   [enable ProjectM visualisation (default is yes)])],
308   [use_projectm=$enableval],
309   [use_projectm=yes])
310
311 AC_ARG_ENABLE([x11],
312   [AS_HELP_STRING([--enable-x11],
313   [enable x11 (default is yes) 'Linux Only'])],
314   [use_x11=$enableval],
315   [use_x11=yes])
316
317 AC_ARG_ENABLE([ccache],
318   [AS_HELP_STRING([--enable-ccache],
319   [enable building with ccache feature (default is auto)])],
320   [use_ccache=$enableval],
321   [use_ccache=auto])
322
323 AC_ARG_ENABLE([alsa],
324   [AS_HELP_STRING([--disable-alsa],
325   [disable ALSA support (only for linux/freebsd)])],
326   [use_alsa=$enableval],
327   [use_alsa=yes])
328
329 AC_ARG_ENABLE([pulse],
330   [AS_HELP_STRING([--enable-pulse],
331   [enable PulseAudio support (default is no)])],
332   [use_pulse=$enableval],
333   [use_pulse=no])
334
335 AC_ARG_ENABLE([ssh],
336   [AS_HELP_STRING([--disable-ssh],
337   [disable SSH SFTP support (default is enabled)])],
338   [use_ssh=$enableval],
339   [use_ssh=yes])
340
341 AC_ARG_ENABLE([rtmp],
342   [AS_HELP_STRING([--enable-rtmp],
343   [enable RTMP support via librtmp (default is auto)])],
344   [use_librtmp=$enableval],
345   [use_librtmp=auto])
346
347 AC_ARG_ENABLE([samba],
348   [AS_HELP_STRING([--disable-samba],
349   [disable SAMBA support (default is enabled)])],
350   [use_samba=$enableval],
351   [use_samba=yes])
352
353 AC_ARG_ENABLE([nfs],
354   [AS_HELP_STRING([--enable-nfs],
355   [enable NFS support via libnfs (default is auto)])],
356   [use_libnfs=$enableval],
357   [use_libnfs=auto])
358
359 AC_ARG_ENABLE([afpclient],
360   [AS_HELP_STRING([--enable-afpclient],
361   [enable AFP support via libafpclient (default is auto)])],
362   [use_libafpclient=$enableval],
363   [use_libafpclient=auto])
364
365 AC_ARG_ENABLE([airplay],
366   [AS_HELP_STRING([--enable-airplay],
367   [enable AirPlay support(default is auto)])],
368   [use_airplay=$enableval],
369   [use_airplay=auto])
370
371 AC_ARG_ENABLE([airtunes],
372   [AS_HELP_STRING([--enable-airtunes],
373   [enable AirTunes support(default is auto)])],
374   [use_airtunes=$enableval],
375   [use_airtunes=auto])
376
377 AC_ARG_ENABLE([upnp],
378   [AS_HELP_STRING([--disable-upnp],
379   [disable UPnP support (default is enabled)])],
380   [use_upnp=$enableval],
381   [use_upnp=yes])
382
383 AC_ARG_ENABLE([ffmpeg_libvorbis],
384   [AS_HELP_STRING([--enable-ffmpeg-libvorbis],
385   [enable FFmpeg vorbis encoding (default is no)])],
386   [use_ffmpeg_libvorbis=$enableval],
387   [use_ffmpeg_libvorbis=no])
388
389 AC_ARG_ENABLE([dvdcss],
390   [AS_HELP_STRING([--enable-dvdcss],
391   [enable DVDCSS support (default is yes)])],
392   [use_dvdcss=$enableval],
393   [use_dvdcss=yes])
394
395 AC_ARG_ENABLE([mid],
396   [AS_HELP_STRING([--enable-mid],
397   [enable MID support (default is no)])],
398   [use_mid=$enableval],
399   [use_mid=no])
400
401 AC_ARG_ENABLE([hal],
402   [AS_HELP_STRING([--disable-hal],
403   [disable HAL support (default is enabled if hal and hal-storage is found)])],
404   [use_hal=$enableval],
405   [use_hal=yes])
406
407 AC_ARG_ENABLE([avahi],
408   [AS_HELP_STRING([--disable-avahi],
409   [disable Avahi support (default is enabled if libavahi-common and libavahi-client is found)])],
410   [use_avahi=$enableval],
411   [use_avahi=yes])
412
413 AC_ARG_ENABLE([non-free],
414   [AS_HELP_STRING([--disable-non-free],
415   [disable componentents with non-compliant licenses])],
416   [use_nonfree=$enableval],
417   [use_nonfree=yes])
418
419 AC_ARG_ENABLE([asap-codec],
420   [AS_HELP_STRING([--enable-asap-codec],
421   [enable ASAP ADPCM support])],
422   [use_asap=$enableval],
423   [use_asap=no])
424
425 AC_ARG_ENABLE([mysql],
426   [AS_HELP_STRING([--disable-mysql],
427   [disable mysql])],
428   [use_mysql=$enableval],
429   [use_mysql=yes])
430
431 AC_ARG_ENABLE([webserver],
432   [AS_HELP_STRING([--disable-webserver],
433   [disable webserver])],
434   [use_webserver=$enableval],
435   [use_webserver=yes])
436
437 AC_ARG_ENABLE([optical-drive],
438   [AS_HELP_STRING([--disable-optical-drive],
439   [disable optical drive])],
440   [use_optical_drive=$enableval],
441   [use_optical_drive=yes])
442
443 AC_ARG_ENABLE([libbluray],
444   [AS_HELP_STRING([--enable-libbluray],
445   [enable libbluray support])],
446   [use_libbluray=$enableval],
447   [use_libbluray=auto])
448
449 AC_ARG_ENABLE([texturepacker],
450   [AS_HELP_STRING([--enable-texturepacker],
451   [enable texturepacker support (default is yes)])],
452   [use_texturepacker=$enableval],
453   [use_texturepacker=auto])
454
455 AC_ARG_WITH([lirc-device],
456   [AS_HELP_STRING([--with-lirc-device=file],
457   [specify the default LIRC device (default is /dev/lircd)])],
458   [lirc_device=$withval],
459   [lirc_device=/dev/lircd])
460 AC_DEFINE_UNQUOTED([LIRC_DEVICE], ["$lirc_device"], [Default LIRC device])
461
462 AC_ARG_ENABLE([udev],
463   [AS_HELP_STRING([--enable-udev],
464   [enable udev support (default is auto)])],
465   [use_libudev=$enableval],
466   [use_libudev=auto])
467
468 AC_ARG_ENABLE([libusb],
469   [AS_HELP_STRING([--enable-libusb],
470   [enable libusb support (default is auto)])],
471   [use_libusb=$enableval],
472   [use_libusb=auto])
473
474 AC_ARG_ENABLE([libcec],
475   [AS_HELP_STRING([--enable-libcec],
476   [enable libcec support (default is auto)])],
477   [use_libcec=$enableval],
478   [use_libcec=auto])
479
480 AC_ARG_ENABLE([libmp3lame],
481   [AS_HELP_STRING([--enable-libmp3lame],
482   [enable lame mp3 encoder support (default is auto)])],
483   [use_libmp3lame=$enableval],
484   [use_libmp3lame=auto])
485
486 AC_ARG_ENABLE([vorbisenc],
487   [AS_HELP_STRING([--enable-libvorbisenc],
488   [enable vorbis encoder support (default is auto)])],
489   [use_libvorbisenc=$enableval],
490   [use_libvorbisenc=auto])
491
492 AC_ARG_ENABLE([libcap],
493   [AS_HELP_STRING([--enable-libcap],
494   [enable libcap support (default is auto)])],
495   [use_libcap=$enableval],
496   [use_libcap=auto])
497
498 AC_ARG_ENABLE([player],
499   [AS_HELP_STRING([--enable-player],
500   [enable additional players from a list of comma separated names, (default is none, choices are amlplayer, omxplayer)])],
501   [add_players=$enableval],
502   [add_players=no])
503
504 AC_ARG_ENABLE([gtest],
505   [AS_HELP_STRING([--enable-gtest],
506   [configure Google Test Framework (default is no)])],
507   [configure_gtest=$enableval],
508   [configure_gtest=no])
509
510 ### External libraries options
511 AC_ARG_ENABLE([external-libraries],
512   [AS_HELP_STRING([--enable-external-libraries],
513   [enable use of all supported external libraries (default is no) 'Linux only'])],
514   [use_external_libraries=$enableval],
515   [use_external_libraries=no])
516
517 AC_ARG_ENABLE([external-ffmpeg],
518   [AS_HELP_STRING([--enable-external-ffmpeg],
519   [enable use of external ffmpeg libraries (default is no) 'Linux only'])],
520   [use_external_ffmpeg=$enableval],
521   [use_external_ffmpeg=$use_external_libraries])
522
523 ### End of external library options
524
525 if test "x$host_vendor" != "xapple"; then
526   DEFAULT_COMPILE_FLAGS="-fPIC -DPIC -D_REENTRANT"
527   DEFAULT_COMPILE_FLAGS="$DEFAULT_COMPILE_FLAGS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
528 fi
529
530 # Checks for programs.
531 PASSED_CXXFLAGS=$CXXFLAGS # Hack to override autoconf default values
532 AC_PROG_CXX
533 CXXFLAGS="$PASSED_CXXFLAGS $DEFAULT_COMPILE_FLAGS"
534 PASSED_CFLAGS=$CFLAGS # Hack to override autoconf default values
535 AC_PROG_CC
536 AC_PROG_LIBTOOL
537 CFLAGS="$PASSED_CFLAGS $DEFAULT_COMPILE_FLAGS"
538 AC_PROG_AWK
539 AC_PROG_LN_S
540 AC_PROG_MAKE_SET
541 MAKE="${MAKE:-make}"
542 OBJDUMP="${OBJDUMP:-objdump}"
543
544 # ffmpeg needs the output of uname -s (e.x. linux, darwin) for the target_os
545 # there is no autoconf variable which will give
546 # the correct output format when doing cross compilation
547 # so we have to use our own var here
548 # defaults to the build side target_os
549 # and should be overridden for cross below (see android)
550 ffmpeg_target_os=$(tolower $(uname -s))
551
552 # host detection and setup
553 case $host in
554   i*86*-android-linux-gnu*)
555      target_platform=target_android
556      ARCH="i486-linux"
557      use_arch="x86"
558      use_cpu="i686"
559      ffmpeg_target_os=linux
560      ;;
561   i*86*-linux-gnu*)
562      ARCH="i486-linux"
563      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
564      ;;
565   x86_64-*-linux-gnu*)
566      ARCH="x86_64-linux"
567      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
568      ;;
569   i386-*-freebsd*)
570      ARCH="x86-freebsd"
571      MAKE="gmake"
572      use_external_ffmpeg="yes"
573      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_FREEBSD -D_LINUX")
574      ;;
575   amd64-*-freebsd*)
576      ARCH="x86_64-freebsd"
577      MAKE="gmake"
578      use_external_ffmpeg="yes"
579      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_FREEBSD -D_LINUX")
580      ;;
581   arm-apple-darwin*)
582      use_joystick=no
583      use_neon=yes
584      use_libcec=no
585      use_crystalhd=no
586      use_vdadecoder=no
587      use_vtbdecoder=yes
588      use_optical_drive=no
589      use_dvdcss=no
590      use_gles=yes
591      use_cpu=cortex-a8
592      use_texturepacker_native=yes
593      ARCH="arm-osx"
594      use_arch="arm"
595      PYTHON_VERSION="2.6"
596      PYTHON_LDFLAGS="-L${prefix}/lib -lpython2.6"
597      PYTHON_CPPFLAGS="-I${prefix}/include/python2.6"
598      PYTHON_SITE_PKG="${prefix}/lib/python2.6/site-packages"
599      PYTHON_NOVERSIONCHECK="no-check"
600      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS -D_LINUX")
601      ;;
602   *86*-apple-darwin*)
603      use_joystick=no
604      use_vtbdecoder=no
605      use_texturepacker_native=yes
606      ARCH="x86-osx"
607      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX")
608      ;;
609   powerpc-apple-darwin*)
610      use_joystick=no
611      use_vdadecoder=no
612      use_vtbdecoder=no
613      use_crystalhd=no
614      ARCH="powerpc-osx"
615      use_arch="ppc"
616      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX")
617      ;;
618   powerpc-*-linux-gnu*)
619      ARCH="powerpc-linux"
620      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC")
621      ;;
622   powerpc64-*-linux-gnu*)
623      ARCH="powerpc64-linux"
624      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64")
625      ;;
626   arm*-*-linux-gnu*)
627      use_texturepacker=no
628      ARCH="arm"
629      use_arch="arm"
630      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
631      ;;
632   arm*-*linux-android*)
633      target_platform=target_android
634      use_arch="arm"
635      use_cpu=cortex-a9
636      ARCH="arm"
637      ffmpeg_target_os=linux
638      ;;
639   *)
640      AC_MSG_ERROR(unsupported host ($host))
641 esac
642 AC_SUBST([ARCH])
643
644
645 check_sdl_arch=[`file $USE_TEXTUREPACKER_NATIVE_ROOT/lib/libSDL_image.dylib | awk '{print $NF}'`]
646 if test "x$check_sdl_arch" = "xi386" ; then
647   DARWIN_NATIVE_ARCH=-m32
648 elif test "x$check_sdl_arch" = "xx86_64" ; then
649   DARWIN_NATIVE_ARCH=-m64
650 fi
651 AC_SUBST([DARWIN_NATIVE_ARCH])
652
653 if test "$target_platform" = "target_android" ; then
654   USE_ANDROID=1
655   use_texturepacker_native=yes
656   webserver_checkdepends=yes
657   AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID")
658   CFLAGS="$CFLAGS -Wno-psabi"
659   CXXFLAGS="$CXXFLAGS -Wno-psabi"
660   AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
661 fi
662
663 case $use_platform in
664   raspberry-pi)
665      target_platform=target_raspberry_pi
666      use_neon=no
667      use_texturepacker=yes
668      use_texturepacker_native=yes
669      use_arch="arm"
670      use_cpu=arm1176jzf-s
671      use_hardcoded_tables="yes"
672      use_alsa="no"
673      USE_TEXTUREPACKER_NATIVE_ROOT="$TEXTUREPACKER_NATIVE_ROOT"
674      ARCH="arm"
675      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI")
676      AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
677      USE_OMXLIB=1; AC_DEFINE([HAVE_OMXLIB],[1],["Define to 1 if OMX libs is enabled"])
678      CFLAGS="$CFLAGS"
679      CXXFLAGS="$CXXFLAGS"
680      ffmpeg_target_os=linux
681      ;;
682 esac
683
684 if test "$build_shared_lib" = "yes"; then
685   final_message="$final_message\n Shared lib\tYes"
686   AC_SUBST(USE_LIBXBMC,1)
687 fi
688
689
690 # platform debug flags
691 if test "$use_debug" = "yes"; then
692   final_message="$final_message\n  Debugging:\tYes"
693   if test "$use_profiling" = "yes"; then
694     final_message="$final_message\n  Profiling:\tYes"
695     DEBUG_FLAGS="-g -pg -D_DEBUG -Wall"
696   else
697     final_message="$final_message\n  Profiling:\tNo"
698     DEBUG_FLAGS="-g -D_DEBUG -Wall"
699   fi
700 else
701   final_message="$final_message\n  Debugging:\tNo"
702   if test "$use_profiling" = "yes"; then
703     final_message="$final_message\n  Profiling:\tYes"
704     DEBUG_FLAGS="-pg -DNDEBUG=1"
705   else
706     final_message="$final_message\n  Profiling:\tNo"
707     DEBUG_FLAGS="-DNDEBUG=1"
708   fi
709 fi
710 CFLAGS="$CFLAGS $DEBUG_FLAGS"
711 CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
712
713
714 if test "$use_optimizations" = "yes"; then
715   final_message="$final_message\n  Optimization:\tYes"
716   if test "$target_platform" = "target_raspberry_pi"; then
717     CXXFLAGS="$CXXFLAGS"
718     CFLAGS="$CFLAGS"
719   else
720     CXXFLAGS="$CXXFLAGS -O2"
721     CFLAGS="$CFLAGS -O2"
722   fi
723 else
724   final_message="$final_message\n  Optimization:\tNo"
725 fi
726
727
728 # platform specific flags
729 if echo "$ARCH" | grep -q "freebsd" ; then
730   LOCALBASE="${LOCALBASE:-/usr/local}"
731   CFLAGS="$CFLAGS -I$LOCALBASE/include"
732   CXXFLAGS="$CXXFLAGS -I$LOCALBASE/include"
733   CPPFLAGS="$CPPFLAGS -I$LOCALBASE/include"
734   LDFLAGS="$LDFLAGS -L$LOCALBASE/lib"
735 fi
736 if test "$host_vendor" = "apple" ; then
737   # standard xbmc paths
738   INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/xbmc/osx"
739   if test "$use_arch" != "arm"; then
740     LIBS="$LIBS -framework ApplicationServices"
741     LIBS="$LIBS -framework AudioUnit"
742     LIBS="$LIBS -framework AudioToolbox"
743     LIBS="$LIBS -framework Cocoa"
744     LIBS="$LIBS -framework CoreAudio"
745     LIBS="$LIBS -framework CoreVideo"
746     LIBS="$LIBS -framework CoreServices"
747     LIBS="$LIBS -framework CoreFoundation"
748     LIBS="$LIBS -framework DiskArbitration"
749     LIBS="$LIBS -framework IOKit"
750     LIBS="$LIBS -framework IOSurface"
751     LIBS="$LIBS -framework QuartzCore"
752     LIBS="$LIBS -framework SystemConfiguration"
753   fi
754   USE_EXTERNAL_FFMPEG=1
755 elif test "$target_platform" = "target_raspberry_pi"; then
756   ARCH="arm"
757   use_arch="arm"
758 elif test "$use_arch" = "arm"; then
759   CFLAGS="$CFLAGS -mno-apcs-stack-check"
760   CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
761   FFMPEG_EXTRACFLAGS=""
762   if test "$use_tegra" = "yes"; then
763     # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support 
764     SAVE_CFLAGS="$CFLAGS"
765     CFLAGS="-mfpu=vfpv3-d16"
766     AC_COMPILE_IFELSE(
767       [AC_LANG_SOURCE([int foo;])],
768       [ CFLAGS="$SAVE_CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
769         CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
770         FFMPEG_EXTRACFLAGS="$FFMPEG_EXTRACFLAGS -mtune=cortex-a9 -mfpu=vfpv3-d16"
771         use_cpu=cortex-a9],
772       [ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
773         CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"    
774         use_cpu=cortex-a8])
775   else
776     if test "$use_neon" = "yes"; then 
777       CFLAGS="$CFLAGS -mfpu=neon -mvectorize-with-neon-quad"
778       CXXFLAGS="$CXXFLAGS -mfpu=neon -mvectorize-with-neon-quad"
779       FFMPEG_EXTRACFLAGS="$FFMPEG_EXTRACFLAGS -mfpu=neon"
780     fi
781   fi
782 fi
783
784 # Checks for library functions.
785 AC_FUNC_ALLOCA
786 AC_FUNC_CHOWN
787 AC_FUNC_CLOSEDIR_VOID
788 AC_FUNC_ERROR_AT_LINE
789 AC_FUNC_FSEEKO
790 AC_PROG_GCC_TRADITIONAL
791 AC_FUNC_LSTAT
792 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
793 AC_FUNC_MEMCMP
794 AC_FUNC_MKTIME
795 AC_FUNC_MMAP
796 # Boxee is apparently having compile problems
797 # if HAVE_REALLOC is defined.  Sort this later.
798 #AC_FUNC_REALLOC
799 AC_FUNC_SELECT_ARGTYPES
800 AC_FUNC_SETVBUF_REVERSED
801 AC_TYPE_SIGNAL
802 AC_FUNC_STAT
803 AC_FUNC_STRCOLL
804 AC_FUNC_STRFTIME
805 AC_FUNC_STRTOD
806 AC_FUNC_UTIME_NULL
807 AC_FUNC_VPRINTF
808 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])
809
810 # Check for various sizes
811 AC_CHECK_SIZEOF([int])
812 AC_CHECK_SIZEOF([size_t])
813
814 # Add top source directory for all builds so we can use config.h
815 INCLUDES="$INCLUDES -I\$(abs_top_srcdir)"
816
817 # Check inotify availability
818 AC_CHECK_HEADER([sys/inotify.h], AC_DEFINE([HAVE_INOTIFY],[1],[Define if we have inotify]),)
819
820 # Checks for boost headers using CXX instead of CC
821 AC_LANG_PUSH([C++])
822 AC_CHECK_HEADER([boost/shared_ptr.hpp],, AC_MSG_ERROR($missing_library))
823 AC_LANG_POP([C++])
824
825 # Python
826 if test -z "$PYTHON_NOVERSIONCHECK"; then
827   AX_PYTHON_DEVEL([>= 2.4])
828   PYTHON_VERSION=$ac_python_version
829 fi
830
831 if test -z "$PYTHON_VERSION"; then
832   AC_MSG_ERROR([Can't find a Python version.])
833 else
834   LIBS="$LIBS $PYTHON_LDFLAGS"
835   AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
836 fi
837
838 # Checks for platforms libraries.
839 if test "$use_gles" = "yes"; then
840   use_gl="no"
841   # GLES overwrites GL if both set to yes.
842   if test "$host_vendor" = "apple" ; then
843     AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
844     AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
845     AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
846   else
847     if test "$target_platform" = "target_raspberry_pi"; then
848       AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
849       AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
850       AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
851       LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm"
852     else
853       AC_CHECK_LIB([EGL],   [main],, AC_MSG_ERROR($missing_library))
854       AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library))
855     fi
856   fi
857 else
858   if test "$use_gl" = "yes"; then
859     if test "$host_vendor" = "apple" ; then
860       # linking to OpenGL.framework instead of libGL, libGLU so AC_CHECK_LIB will fail
861       LIBS="$LIBS -framework OpenGL"
862       AC_DEFINE([HAVE_LIBGL],[1],["Define to 1 if you have the `GL' library (-lGL)."])
863       AC_MSG_RESULT(== WARNING: OpenGL support is assumed.)
864       AC_DEFINE([HAVE_LIBGLU],[1],["Define to 1 if you have the `GLU' library (-lGLU)."])
865       AC_MSG_RESULT(== WARNING: OpenGLU support is assumed.)
866       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
867     else
868       AC_CHECK_LIB([GL],  [main],, AC_MSG_ERROR($missing_library))
869       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
870       AC_CHECK_LIB([GLU], [main],, AC_MSG_ERROR($missing_library))
871     fi
872   else
873     AC_MSG_RESULT(== WARNING: OpenGL support is disabled. XBMC will run VERY slow. ==)
874     AC_CHECK_LIB([SDL_gfx],[main])
875   fi
876 fi
877
878 # platform common libraries
879 if test "$use_mysql" = "yes"; then
880   AC_PATH_PROG(MYSQL_CONFIG, mysql_config,"no")
881   if test "x$MYSQL_CONFIG" != "xno"; then
882     AC_DEFINE([HAVE_MYSQL],[1],["Define to 1 if you have the `mysql' library (-lmysqlclient)."])
883     INCLUDES="$INCLUDES `$MYSQL_CONFIG --include`"
884     MYSQL_LIBS=`$MYSQL_CONFIG --libs`
885     LIBS="$LIBS $MYSQL_LIBS"
886     AC_SUBST(MYSQL_LIBS)
887   else
888     AC_MSG_ERROR($missing_program)
889   fi
890 fi
891 AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
892 AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
893 AC_CHECK_HEADER([mpeg2dec/mpeg2convert.h],, AC_MSG_ERROR($missing_library),
894   AC_INCLUDES_DEFAULT()
895   [#include <mpeg2dec/mpeg2.h>])
896 AC_CHECK_HEADER([mad.h],,            AC_MSG_ERROR($missing_library))
897 AC_CHECK_HEADER([jpeglib.h],,        AC_MSG_ERROR($missing_library))
898 AC_CHECK_HEADER([samplerate.h],,     AC_MSG_ERROR($missing_library))
899 AC_CHECK_HEADER([ogg/ogg.h],,        AC_MSG_ERROR($missing_library))
900 AC_CHECK_HEADER([vorbis/vorbisfile.h],, AC_MSG_ERROR($missing_library))
901 AC_CHECK_HEADER([libmodplug/modplug.h],, AC_MSG_ERROR($missing_library))
902 AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR($missing_library))
903 AC_CHECK_HEADER([FLAC/stream_decoder.h],, AC_MSG_ERROR($missing_library))
904
905 # we need to check for the header because if it exists we set the openssl
906 # and gcrypt MT callback hooks. This is mostly so that libcurl operates 
907 # in MT manner correctly.
908 AC_CHECK_HEADER([openssl/crypto.h], AC_DEFINE([HAVE_OPENSSL],[1],[Define if we have openssl]),)
909 AC_CHECK_HEADER([gcrypt.h], gcrypt_headers_available=yes,gcrypt_headers_available=no)
910 if test "$gcrypt_headers_available" = "yes"; then
911    # if we have the headers then we must have the lib
912    AC_CHECK_LIB([gpg-error],[main],, AC_MSG_ERROR($missing_library))
913    AC_CHECK_LIB([gcrypt],[gcry_control],, AC_MSG_ERROR($missing_library))
914    AC_DEFINE([HAVE_GCRYPT],[1],[Define if we have gcrypt])
915 fi
916
917 AC_CHECK_LIB([bz2],         [main],, AC_MSG_ERROR($missing_library))
918 AC_CHECK_LIB([jpeg],        [main],, AC_MSG_ERROR($missing_library)) # check for cximage
919 AC_CHECK_LIB([tiff],        [main],, AC_MSG_ERROR($missing_library))
920 if echo "$ARCH" | grep -q freebsd; then
921 AC_CHECK_LIB([pthread],     [main],LIBS="-pthread $LIBS", AC_MSG_ERROR($missing_library))
922 else
923 if test "$target_platform" != "target_android" ; then
924   AC_CHECK_LIB([pthread],     [main],, AC_MSG_ERROR($missing_library))
925 fi
926 fi
927 AC_CHECK_LIB([lzo2],        [main],, AC_MSG_ERROR($missing_library))
928 AC_CHECK_LIB([z],           [main],, AC_MSG_ERROR($missing_library))
929 AC_CHECK_LIB([crypto],      [main],, AC_MSG_ERROR($missing_library))
930 AC_CHECK_LIB([ssl],         [main],, AC_MSG_ERROR($missing_library))
931 if test "$use_mysql" = "yes"; then
932   AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
933 fi
934 AC_CHECK_LIB([bluetooth],   [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
935 AC_CHECK_LIB([yajl],        [main],, AC_MSG_ERROR($missing_library))
936 AC_CHECK_LIB([tinyxml],     [main],, AC_MSG_ERROR($missing_library))
937 if test "$target_platform" = "target_android" ; then
938   #android hack for static python. Required to maintain correct linking order.
939   AC_CHECK_LIB([python$PYTHON_VERSION],      [main],, AC_MSG_ERROR($missing_library))
940   AC_CHECK_LIB([android],     [main],, AC_MSG_ERROR($missing_library))
941 fi
942 PKG_CHECK_MODULES([FRIBIDI],    [fribidi],
943   [INCLUDES="$INCLUDES $FRIBIDI_CFLAGS"; LIBS="$LIBS $FRIBIDI_LIBS"],
944   AC_MSG_ERROR($missing_library))
945 PKG_CHECK_MODULES([SQLITE3],    [sqlite3],
946   [INCLUDES="$INCLUDES $SQLITE3_CFLAGS"; LIBS="$LIBS $SQLITE3_LIBS"],
947   AC_MSG_ERROR($missing_library))
948 PKG_CHECK_MODULES([PNG],        [libpng],
949   [INCLUDES="$INCLUDES $PNG_CFLAGS"; LIBS="$LIBS $PNG_LIBS"],
950   AC_MSG_ERROR($missing_library))
951 PKG_CHECK_MODULES([PCRECPP],    [libpcrecpp],
952   [INCLUDES="$INCLUDES $PCRECPP_CFLAGS"; LIBS="$LIBS $PCRECPP_LIBS"]; \
953   AC_DEFINE([HAVE_LIBPCRECPP],[1],["Define to 1 if libpcrecpp is installed"]),
954   AC_MSG_ERROR($missing_library))
955 PKG_CHECK_MODULES([PCRE],       [libpcre],
956   [INCLUDES="$INCLUDES $PCRE_CFLAGS"; LIBS="$LIBS $PCRE_LIBS"]; \
957   AC_DEFINE([HAVE_LIBPCRE],[1],["Define to 1 if libpcre is installed"]),
958   AC_MSG_ERROR($missing_library))
959 PKG_CHECK_MODULES([CDIO],       [libcdio],
960   [INCLUDES="$INCLUDES $CDIO_CFLAGS"; LIBS="$LIBS $CDIO_LIBS"],
961   AC_MSG_ERROR($missing_library))
962 PKG_CHECK_MODULES([SAMPLERATE], [samplerate],
963   [INCLUDES="$INCLUDES $SAMPLERATE_CFLAGS"; LIBS="$LIBS $SAMPLERATE_LIBS"],
964   AC_MSG_ERROR($missing_library))
965 PKG_CHECK_MODULES([FREETYPE2],  [freetype2],
966   [INCLUDES="$INCLUDES $FREETYPE2_CFLAGS"; LIBS="$LIBS $FREETYPE2_LIBS"],
967   AC_MSG_ERROR($missing_library))
968 PKG_CHECK_MODULES([TAGLIB],  [taglib >= 1.8],
969   [INCLUDES="$INCLUDES $TAGLIB_CFLAGS"; LIBS="$LIBS $TAGLIB_LIBS"],
970   AC_MSG_ERROR($missing_library))
971
972 if test "$target_platform" = "target_android" ; then
973 PKG_CHECK_MODULES([ZIP],       [libzip],
974   [INCLUDES="$INCLUDES $ZIP_CFLAGS"; LIBS="$LIBS $ZIP_LIBS"],
975   AC_MSG_ERROR($missing_library))
976 fi
977
978 # check for libbluray
979 AS_CASE([x$use_libbluray],
980   [xyes],[
981     PKG_CHECK_MODULES([LIBBLURAY],[libbluray >= 0.2.1],[use_libbluray="yes"], AC_MSG_ERROR($missing_library))
982   ],
983   [xauto],[
984     PKG_CHECK_MODULES([LIBBLURAY],[libbluray >= 0.2.1],[use_libbluray="yes"], [use_libbluray="no"])
985   ])
986
987 AS_CASE([x$use_libbluray],
988   [xyes],[
989     INCLUDES="$INCLUDES $LIBBLURAY_CFLAGS";
990     XB_FIND_SONAME([BLURAY], [bluray], [use_libbluray])
991     AC_DEFINE([HAVE_LIBBLURAY], 1, [System has libbluray library])
992     AC_SUBST([HAVE_LIBBLURAY], 1)
993   ],[
994     AC_SUBST([HAVE_LIBBLURAY], 0)
995   ]
996 )
997
998 # platform dependent libraries
999 if test "$host_vendor" = "apple" ; then
1000   AC_CHECK_LIB([iconv],     [main],, AC_MSG_ERROR($missing_library))
1001   if test "$use_arch" != "arm"; then
1002     AC_CHECK_LIB([SDL],      [main],, AC_MSG_ERROR($missing_library))
1003     AC_DEFINE([HAVE_SDL],[1],["Define to 1 if using sdl"])
1004   fi
1005 else
1006   case $host_os in
1007     linux*) AC_CHECK_LIB([dl], [main],, AC_MSG_ERROR($missing_library)) ;;
1008     freebsd*) AC_CHECK_LIB([iconv], [main],, AC_MSG_ERROR($missing_library)) ;;
1009   esac
1010   case $host_os in
1011     freebsd*) ;;
1012     *)
1013      if test "$target_platform" != "target_android" ; then
1014         AC_CHECK_LIB([resolv],     [main],, AC_MSG_ERROR($missing_library))
1015      fi
1016   ;;
1017   esac
1018 if test "$target_platform" != "target_android" ; then
1019   AC_CHECK_LIB([jasper],     [main],, AC_MSG_ERROR($missing_library)) # check for cximage
1020   AC_CHECK_LIB([rt],         [clock_gettime],, AC_MSG_ERROR($missing_library))
1021 fi
1022 if test "x$use_alsa" != "xno"; then
1023   PKG_CHECK_MODULES([ALSA],  [alsa],
1024     [INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"; use_alsa=yes],
1025     AC_MSG_NOTICE($alsa_not_found); use_alsa=no)
1026 fi
1027   PKG_CHECK_MODULES([DBUS],    [dbus-1],
1028     [INCLUDES="$INCLUDES $DBUS_CFLAGS"; LIBS="$LIBS $DBUS_LIBS"; use_dbus=yes]; \
1029     AC_DEFINE([HAVE_DBUS],[1],["Define to 1 if dbus is installed"]),
1030     AC_MSG_NOTICE($missing_library); use_dbus=no)
1031   if test "x$use_sdl" != "xno"; then
1032     PKG_CHECK_MODULES([SDL],   [sdl],
1033       [INCLUDES="$INCLUDES $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS"],
1034       AC_MSG_ERROR($missing_library))
1035     AC_CHECK_LIB([SDL_image],  [main],, AC_MSG_ERROR($missing_library))
1036     AC_DEFINE([HAVE_SDL],[1],["Define to 1 if using sdl"])
1037   fi
1038 fi
1039
1040 XB_FIND_SONAME([MAD],         [mad])
1041 XB_FIND_SONAME([OGG],         [ogg])
1042 XB_FIND_SONAME([CURL],        [curl])
1043 XB_FIND_SONAME([FLAC],        [FLAC])
1044 XB_FIND_SONAME([VORBIS],      [vorbis])
1045 XB_FIND_SONAME([VORBISFILE],  [vorbisfile])
1046 XB_FIND_SONAME([MODPLUG],     [modplug])
1047 XB_FIND_SONAME([ASS],         [ass])
1048 XB_FIND_SONAME([MPEG2],       [mpeg2])
1049
1050 # Audio encoders
1051 if test "x$use_libmp3lame" != "xno"; then
1052   XB_FIND_SONAME([LAMEENC], [mp3lame], [use_libmp3lame])
1053   if test "x$use_libmp3lame" != "xno"; then
1054     AC_CHECK_HEADER([lame/lame.h],, AC_MSG_ERROR($missing_headers))
1055   fi
1056 fi
1057 AS_CASE([x$use_libmp3lame],
1058   [xno],[
1059     AC_SUBST([HAVE_LIBMP3LAME], 0)
1060   ],
1061   [
1062     AC_DEFINE([HAVE_LIBMP3LAME], 1, [System has libmp3lame library])
1063     AC_SUBST([HAVE_LIBMP3LAME], 1)
1064   ]
1065 )
1066 if test "x$use_libvorbisenc" != "xno"; then
1067   XB_FIND_SONAME([VORBISENC], [vorbisenc], [use_libvorbisenc])
1068   if test "x$use_libvorbisenc" != "xno"; then
1069     AC_CHECK_HEADER([vorbis/vorbisenc.h],, AC_MSG_ERROR($missing_headers))
1070   fi
1071 fi
1072 AS_CASE([x$use_libvorbisenc],
1073   [xno],[
1074     AC_SUBST([HAVE_LIBVORBISENC], 0)
1075   ],[
1076     AC_DEFINE([HAVE_LIBVORBISENC], 1, [System has libvorbisenc library])
1077     AC_SUBST([HAVE_LIBVORBISENC], 1)
1078   ]
1079 )
1080
1081 # WebServer
1082 if test "$use_webserver" = "yes"; then
1083   AC_CHECK_LIB([microhttpd],  [main],, AC_MSG_ERROR($missing_library))
1084 fi
1085
1086 # Optical
1087 if test "$use_optical_drive" = "yes"; then
1088   AC_DEFINE([HAS_DVD_DRIVE], [1], [Define to 1 to have optical drive support])
1089 fi
1090
1091 # Alsa
1092 if test "$use_alsa" = "yes" && test "$host_vendor" != "apple"; then
1093   PKG_CHECK_MODULES([ALSA],  [alsa],
1094     [INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"],
1095     AC_MSG_ERROR($missing_library))
1096   AC_DEFINE([HAS_ALSA], [1], [Define to 0 to disable ALSA support])
1097 else
1098   use_alsa="no"
1099   AC_MSG_RESULT($alsa_disabled)
1100 fi
1101
1102 # PulseAudio
1103 if test "x$use_pulse" != "xno"; then
1104   if test "$host_vendor" = "apple" ; then
1105     if test "x$use_pulse" = "xyes"; then
1106       AC_MSG_ERROR($pulse_disabled)
1107     else
1108       use_pulse="no"
1109       AC_MSG_RESULT($pulse_disabled)
1110     fi
1111     USE_PULSE=0
1112   else
1113     AC_CHECK_LIB([pulse], [main],,
1114       [if test "x$use_pulse" = "xyes"; then
1115         AC_MSG_ERROR($pulse_not_found)
1116       else
1117         use_pulse=no
1118         USE_PULSE=0
1119         AC_MSG_RESULT($pulse_not_found)
1120       fi])
1121       USE_PULSE=1
1122   fi
1123 else
1124   AC_MSG_RESULT($pulse_disabled)
1125   USE_PULSE=0
1126 fi
1127
1128 # HAL
1129 if test "$host_vendor" = "apple" ; then
1130   use_hal="no"
1131   AC_MSG_RESULT($hal_disabled)
1132 else
1133   if test "$use_hal" = "yes"; then
1134     PKG_CHECK_MODULES([HAL], [hal],
1135       [INCLUDES="$INCLUDES $HAL_CFLAGS"; LIBS="$LIBS $HAL_LIBS"],
1136       use_hal=no;AC_MSG_RESULT($hal_not_found))
1137     PKG_CHECK_MODULES([HAL_STORAGE], [hal-storage],
1138       [INCLUDES="$INCLUDES $HAL_STORAGE_CFLAGS"; LIBS="$LIBS $HAL_STORAGE_LIBS"],
1139       use_hal=no;AC_MSG_RESULT($halstorage_not_found))
1140   else
1141     AC_MSG_RESULT($hal_disabled)
1142   fi
1143   if test "$use_hal" = "yes"; then
1144     AC_DEFINE([HAS_HAL], [1], [Define to 1 if you have HAL installed])
1145   fi
1146 fi
1147
1148 # avahi
1149 if test "$host_vendor" = "apple" ; then
1150   use_avahi="no"
1151   AC_MSG_RESULT($avahi_disabled)
1152 else
1153   if test "$use_avahi" = "yes"; then
1154     AC_CHECK_LIB([avahi-common], [main],,
1155       use_avahi=no;AC_MSG_RESULT($avahi_not_found))
1156     if test "$use_avahi" = "yes"; then
1157       #either both libs or none
1158       AC_CHECK_LIB([avahi-client], [main],,
1159         use_avahi=no;AC_MSG_RESULT($avahi_not_found))
1160     fi
1161   else
1162     AC_MSG_RESULT($avahi_disabled)
1163   fi
1164 fi
1165
1166 # X11
1167 if test "$use_x11" = "yes" && test "$host_vendor" != "apple"; then
1168   AC_MSG_NOTICE($x11_enabled)
1169   PKG_CHECK_MODULES([X11],    [x11],
1170     [INCLUDES="$INCLUDES $X11_CFLAGS"; LIBS="$LIBS $X11_LIBS"],
1171     AC_MSG_ERROR($missing_library))
1172   PKG_CHECK_MODULES([XEXT],  [xext],
1173     [INCLUDES="$INCLUDES $XEXT_CFLAGS"; LIBS="$LIBS $XEXT_LIBS"],
1174     AC_MSG_ERROR($missing_library))
1175   AC_DEFINE([HAVE_X11], [1], [Define to 1 if you have X11 libs installed.])
1176 else
1177   AC_MSG_RESULT($x11_disabled)
1178 fi
1179
1180 # XRandR
1181 if test "$host_vendor" = "apple" || test "$use_x11" = "no"; then
1182   use_xrandr="no"
1183   AC_MSG_RESULT($xrandr_disabled)
1184 else
1185   if test "$use_xrandr" = "yes" ; then
1186     AC_CHECK_LIB([Xrandr], [main],,
1187       use_xrandr="no";AC_MSG_RESULT($xrandr_not_found))
1188   else
1189     AC_MSG_RESULT($xrandr_disabled)
1190   fi
1191 fi
1192
1193 # GOOM
1194 if test "$host_vendor" = "apple" ; then
1195   AC_MSG_NOTICE($goom_disabled)
1196   DISABLE_GOOM=1
1197 else
1198   if test "$use_goom" = "yes" && test "$use_gl" = "yes"; then
1199     AC_MSG_NOTICE($goom_enabled)
1200     DISABLE_GOOM=0
1201   else
1202     AC_MSG_NOTICE($goom_disabled)
1203     DISABLE_GOOM=1
1204   fi
1205 fi
1206
1207 # RSXS
1208 if test "$use_rsxs" = "no" || test "$use_gl" = "no"; then
1209   AC_MSG_NOTICE($rsxs_disabled)
1210   DISABLE_RSXS=1
1211 else
1212   AC_MSG_NOTICE($rsxs_enabled)
1213   DISABLE_RSXS=0
1214   # darwin osx can do rsxs but does not use x11, so do not pkg-config check for them
1215   if test "$host_vendor" != "apple" ; then
1216     PKG_CHECK_MODULES([XT],    [xt],
1217       [INCLUDES="$INCLUDES $XT_CFLAGS"; LIBS="$LIBS $XT_LIBS"],
1218       AC_MSG_ERROR($missing_library))
1219     PKG_CHECK_MODULES([XMU],   [xmu],
1220       [INCLUDES="$INCLUDES $XMU_CFLAGS"; LIBS="$LIBS $XMU_LIBS"],
1221       AC_MSG_ERROR($missing_library))
1222   fi
1223 fi
1224
1225 # PROJECTM
1226 if test "$use_projectm" = "no" || test "$use_gl" = "no"; then
1227   AC_MSG_NOTICE($projectm_disabled)
1228   DISABLE_PROJECTM=1
1229 else
1230   AC_MSG_NOTICE($projectm_enabled)
1231   DISABLE_PROJECTM=0
1232 fi
1233
1234 # skin touched
1235 use_skin_touched=no
1236 if [[ -f "addons/skin.touched/addon.xml" ]]; then 
1237   use_skin_touched=yes
1238   USE_SKIN_TOUCHED=1
1239   AC_DEFINE([HAS_SKIN_TOUCHED], [1], [Whether to build skin touched.])
1240 else
1241   USE_SKIN_TOUCHED=0
1242 fi
1243
1244 # libssh
1245 if test "x$use_ssh" = "xno"; then
1246   AC_MSG_NOTICE($ssh_disabled)
1247   use_libssh="no"
1248 else
1249   AC_CHECK_LIB([ssh], [sftp_tell64],, AC_MSG_ERROR($ssh_not_found))
1250   AC_DEFINE([HAVE_LIBSSH], [1], [Whether to use libSSH library.])
1251 fi
1252
1253 # libRTMP
1254 if test "$use_librtmp" != "no"; then
1255   AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
1256    [if test "$use_librtmp" = "yes"; then
1257       AC_MSG_ERROR($librtmp_not_found)
1258     elif test "$use_librtmp" != "no"; then
1259       AC_MSG_NOTICE($librtmp_not_found)
1260       use_librtmp="no"
1261     fi
1262    ])
1263   if test "$use_librtmp" != "no"; then
1264     XB_FIND_SONAME([RTMP], [rtmp], [use_librtmp])
1265   fi
1266   if test "$use_librtmp" != "no"; then
1267     AC_DEFINE([HAS_LIBRTMP], [1], [Whether to use libRTMP library.])
1268   fi
1269 else
1270   AC_MSG_NOTICE($librtmp_disabled)
1271 fi
1272
1273 # samba
1274 if test "x$use_samba" != "xno"; then
1275   AC_CHECK_LIB([smbclient], [main],,
1276     use_samba=no;AC_MSG_ERROR($missing_library))
1277     USE_LIBSMBCLIENT=0
1278 else
1279   AC_MSG_RESULT($samba_disabled)
1280   USE_LIBSMBCLIENT=0
1281 fi
1282
1283 if test "x$use_samba" != "xno"; then
1284   AC_DEFINE([HAVE_LIBSMBCLIENT], [1], [Define to 1 if you have Samba installed])
1285   USE_LIBSMBCLIENT=1
1286 fi
1287
1288 # libnfs
1289 if test "$use_libnfs" != "no"; then
1290   AC_CHECK_HEADERS([nfsc/libnfs.h],,
1291    [if test "$use_libnfs" = "yes"; then
1292       AC_MSG_ERROR($libnfs_not_found)
1293       USE_LIBNFS=0
1294     elif test "$use_libnfs" != "no"; then
1295       AC_MSG_NOTICE($libnfs_not_found)
1296       use_libnfs="no"
1297       USE_LIBNFS=0
1298     fi
1299    ])
1300   if test "$use_libnfs" != "no"; then
1301     XB_FIND_SONAME([NFS], [nfs], [use_libnfs])
1302   fi
1303   if test "$use_libnfs" != "no"; then
1304     AC_DEFINE([HAVE_LIBNFS], [1], [Whether to use libnfs library.])
1305     USE_LIBNFS=1
1306   fi
1307 else
1308   USE_LIBNFS=0
1309   AC_MSG_NOTICE($libnfs_disabled)
1310 fi
1311
1312 # libafpclient
1313 USE_LIBAFPCLIENT=0
1314 if test "x$use_libafpclient" != "xno"; then
1315   AC_CHECK_HEADERS([afpfs-ng/libafpclient.h],,
1316    [if test "x$use_libafpclient" = "xyes"; then
1317       AC_MSG_ERROR($libafpclient_not_found)
1318     elif test "x$use_libafpclient" != "xno"; then
1319       AC_MSG_NOTICE($libafpclient_not_found)
1320       use_libafpclient="no"
1321     fi
1322    ])
1323   if test "x$use_libafpclient" != "xno"; then
1324     XB_FIND_SONAME([AFPCLIENT], [afpclient], [use_libafpclient])
1325     AC_DEFINE([HAVE_LIBAFPCLIENT], [1], [Whether to use libafpclient library.])
1326     USE_LIBAFPCLIENT=1
1327   fi
1328 else
1329   AC_MSG_NOTICE($libafpclient_disabled)
1330 fi
1331
1332 # libplist for airplay feature
1333 USE_AIRPLAY=0
1334 if test "$use_airplay" != "no"; then
1335   AC_CHECK_HEADER([plist/plist.h],,
1336    [if test "$use_airplay" = "yes"; then
1337       AC_MSG_ERROR($libplist_not_found)
1338     elif test "$use_airplay" != "no"; then
1339       AC_MSG_NOTICE($libplist_not_found)
1340       use_airplay="no"
1341     fi
1342    ])
1343
1344   if test "$use_airplay" != "no"; then
1345     XB_FIND_SONAME([PLIST], [plist], [use_airplay])
1346     USE_AIRPLAY=1
1347     AC_DEFINE([HAVE_LIBPLIST],[1],["Define to 1 if you have libplist."])
1348   fi
1349 fi
1350
1351 # libshairport for AirTunes
1352 USE_AIRTUNES=0
1353 if test "x$use_airtunes" != "xno"; then
1354   AC_CHECK_HEADERS([shairport/shairport.h shairport/ao.h],,
1355    [if test "x$use_airtunes" = "xyes"; then
1356       AC_MSG_ERROR($libshairport_not_found)
1357     elif test "x$use_airtunes" != "xno"; then
1358       AC_MSG_NOTICE($libshairport_not_found)
1359       use_airtunes="no"
1360     fi
1361    ])
1362
1363   if test "x$use_airtunes" != "xno"; then
1364     XB_FIND_SONAME([SHAIRPORT], [shairport], [use_airtunes])
1365     USE_AIRTUNES=1
1366     AC_CHECK_MEMBERS([struct AudioOutput.ao_set_metadata],,,
1367                      [[#include <shairport/shairport.h>]])
1368     AC_DEFINE([HAVE_LIBSHAIRPORT],[1],["Define to 1 if you have libshairport."])
1369   fi
1370 fi
1371
1372 # libudev
1373 USE_LIBUDEV=0
1374 if test "$host_vendor" = "apple" ; then
1375   use_libudev="no"
1376   AC_MSG_NOTICE($libudev_disabled)
1377 else
1378   if test "$use_libudev" = "auto"; then
1379     PKG_CHECK_MODULES([UDEV],[libudev],,[use_libudev="no";AC_MSG_RESULT($libudev_not_found)])
1380   elif test "$use_libudev" = "yes" ; then
1381     PKG_CHECK_MODULES([UDEV],[libudev],,[use_libudev="no";AC_MSG_ERROR($libudev_not_found)])
1382   else
1383     AC_MSG_NOTICE($libudev_disabled)
1384   fi
1385
1386   if test "x$use_libudev" != "xno"; then
1387     USE_LIBUDEV=1;INCLUDES="$INCLUDES $UDEV_CFLAGS";LIBS="$LIBS $UDEV_LIBS"
1388     AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"])
1389   fi
1390 fi
1391
1392 # libusb
1393 USE_LIBUSB=0
1394
1395 # if libudev is available, we don't need libusb
1396 if test "x$use_libudev" != "xno"; then
1397   use_libusb="no"
1398   AC_MSG_NOTICE($libusb_disabled_udev_found)
1399 else
1400   if test "$host_vendor" = "apple" ; then
1401     use_libusb="no"
1402     AC_MSG_NOTICE($libusb_disabled)
1403   else
1404     if echo "$ARCH" | grep -q freebsd ; then
1405       AC_CHECK_LIB([usb],[main],
1406                 [use_libusb="yes";USB_LIBS="-lusb"],
1407                 [use_libusb="no";AC_MSG_RESULT($libusb_not_found)])
1408     elif test "$use_libusb" = "auto"; then
1409       PKG_CHECK_MODULES([USB],[libusb],,[use_libusb="no";AC_MSG_RESULT($libusb_not_found)])
1410     elif test "$use_libusb" = "yes"; then
1411       PKG_CHECK_MODULES([USB],[libusb],,[use_libusb="no";AC_MSG_ERROR($libusb_not_found)])
1412     else
1413       AC_MSG_NOTICE($libusb_disabled)
1414     fi
1415   
1416     if test "x$use_libusb" != "xno"; then
1417       USE_LIBUSB=1;INCLUDES="$INCLUDES $USB_CFLAGS";LIBS="$LIBS $USB_LIBS"
1418       AC_DEFINE([HAVE_LIBUSB],[1],["Define to 1 if libusb is installed"])
1419     fi
1420   fi
1421 fi
1422
1423 # libcec
1424 USE_LIBCEC=0
1425 USE_CEC_RPI_API=0
1426 use_rpi_cec_api="auto"
1427 if test "x$use_libcec" != "xno"; then
1428   case "${host_cpu}" in
1429     arm*)
1430       echo "will check for RPi support"
1431       AC_CHECK_HEADER(interface/vmcs_host/vc_cec.h,,use_rpi_cec_api="no")
1432       ;;
1433     *)
1434       echo "will not check for RPi support (unsupported cpu: ${host_cpu})"
1435       use_rpi_cec_api="no"
1436       ;;
1437   esac
1438
1439   # libcec needs libudev, libusb or the RPi API under linux, or the device will never be detected.
1440   if test "$host_vendor" != "apple" && test "$use_libusb" = "no" && test "$use_libudev" = "no" && test "$use_rpi_cec_api" = "no"; then
1441     if test "x$use_libcec" != "xauto"; then
1442       AC_MSG_ERROR($libcec_disabled_missing_libs)
1443     else
1444       use_libcec="no"
1445       AC_MSG_NOTICE($libcec_disabled_missing_libs)
1446     fi
1447   fi
1448
1449   # libcec is dyloaded, so we need to check for its headers and link any depends.
1450   if test "x$use_libcec" != "xno"; then
1451     if test "x$use_libcec" != "xauto"; then
1452       PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
1453     else
1454       PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
1455     fi
1456
1457     if test "x$use_libcec" != "xno"; then
1458       INCLUDES="$INCLUDES $CEC_CFLAGS"
1459       USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"])
1460       if test "x$use_rpi_cec_api" != "xno"; then
1461         LIBS+=" -lvcos -lvchiq_arm"
1462         AC_DEFINE([HAVE_CEC_RPI_API],[1],["Define to 1 if the CEC RPi API is installed"])
1463         USE_CEC_RPI_API=1
1464       fi
1465       XB_FIND_SONAME([LIBCEC],[cec],[use_libcec])
1466       AC_MSG_NOTICE($libcec_enabled)
1467     else
1468       use_libcec="no"
1469       AC_MSG_NOTICE($libcec_disabled)
1470     fi
1471   fi
1472 else
1473   use_libcec="no"
1474   AC_MSG_NOTICE($libcec_disabled)
1475 fi
1476
1477 # libcap
1478 if test "$use_libcap" != "no"; then
1479   AC_CHECK_HEADERS([sys/capability.h],,
1480    [if test "$use_libcap" = "yes"; then
1481       AC_MSG_ERROR($libcap_not_found)
1482     elif test "$use_libcap" != "no"; then
1483       AC_MSG_NOTICE($libcap_not_found)
1484       use_libcap="no"
1485     fi
1486    ])
1487   if test "$use_libcap" != "no"; then
1488     AC_CHECK_LIB([cap], main, LIBS="$LIBS -lcap", use_libcap=no)
1489   fi
1490   if test "$use_libcap" != "no"; then
1491     AC_DEFINE([HAVE_LIBCAP], [1], [Whether to use libcap library.])
1492   fi
1493 else
1494   AC_MSG_NOTICE($libcap_disabled)
1495 fi
1496
1497 ### External libraries checks
1498
1499 # External FFmpeg
1500 if test "$use_external_ffmpeg" = "yes"; then
1501   FFMPEG_LIBNAMES="libavcodec libavfilter libavformat libavutil libpostproc libswscale"
1502
1503   # libavcore is optional
1504   PKG_CHECK_EXISTS([libavcore], FFMPEG_LIBNAMES="$FFMPEG_LIBNAMES libavcore")
1505
1506   # one of libswresample or libavresample is needed
1507   PKG_CHECK_EXISTS([libswresample], FFMPEG_LIBNAMES="$FFMPEG_LIBNAMES libswresample",
1508                    [PKG_CHECK_EXISTS([libavresample],
1509                                      FFMPEG_LIBNAMES="$FFMPEG_LIBNAMES libavresample",
1510                                      AC_MSG_ERROR([You need either libswresample
1511                                                    or libavresample.]))])
1512
1513   PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
1514                     [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"],
1515                     AC_MSG_ERROR($missing_library))
1516
1517   # Determine whether AVPacket and relevant functions are defined in libavformat
1518   # or libavcodec
1519   AC_CHECK_LIB([avcodec], [av_free_packet],
1520   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavcodec. ==)],
1521   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavformat. ==)
1522    AC_DEFINE([AVPACKET_IN_AVFORMAT], [1], [Whether AVPacket is in libavformat.])])
1523
1524   # in case the headers are in a custom directory
1525   SAVE_CPPFLAGS="$CPPFLAGS"
1526   CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
1527
1528   # Possible places the ffmpeg headers may be
1529   AC_CHECK_HEADERS([libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h libavutil/avutil.h libpostproc/postprocess.h libswscale/swscale.h],,
1530   [AC_CHECK_HEADERS([ffmpeg/avcodec.h ffmpeg/avfilter.h ffmpeg/avformat.h ffmpeg/avutil.h postproc/postprocess.h ffmpeg/swscale.h],,
1531   [AC_MSG_ERROR($missing_headers)])])
1532
1533   # optional
1534   AC_CHECK_HEADERS([libavcore/avcore.h libavcore/samplefmt.h libavutil/mem.h libavutil/samplefmt.h])
1535
1536   # old FFmpeg have this in libavcodec/opt.h instead:
1537   AC_CHECK_HEADERS([libavutil/opt.h])
1538
1539   # new FFmpeg have math headers
1540   AC_CHECK_HEADERS([libavutil/mathematics.h],,)
1541
1542   # We'll support the use of rgb2rgb.h if it exists.
1543   AC_CHECK_HEADERS([libswscale/rgb2rgb.h],,)
1544   AC_CHECK_HEADERS([ffmpeg/rgb2rgb.h],,)
1545
1546   # Check for libswresample or libavresample headers.
1547   AC_CHECK_HEADERS([libswresample/swresample.h libavresample/avresample.h])
1548
1549   # Check if AVFilterBufferRefVideoProps AVRational member is named
1550   # 'pixel_aspect' or 'sample_aspect_ratio'.
1551   AC_CHECK_MEMBER([AVFilterBufferRefVideoProps.sample_aspect_ratio],
1552     [AC_DEFINE([HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO],
1553     [1],
1554     [Define to 1 if AVFilterBufferRefVideoProps has member sample_aspect_ratio.])],
1555       [AC_CHECK_MEMBER([AVFilterBufferRefVideoProps.sample_aspect_ratio],
1556       [AC_DEFINE([HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO],
1557       [1],
1558       [Define to 1 if AVFilterBufferRefVideoProps has member sample_aspect_ratio.])],
1559       ,
1560       [[#include <ffmpeg/avfilter.h>]])],
1561     [[#include <libavfilter/avfilter.h>]])
1562
1563   AC_MSG_NOTICE($external_ffmpeg_enabled)
1564   USE_EXTERNAL_FFMPEG=1
1565   AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.])
1566
1567   # Disable vdpau support if external libavcodec doesn't have it
1568   AC_CHECK_LIB([avcodec], [ff_vdpau_vc1_decode_picture],,
1569     [if test "x$use_vdpau" = "xyes"; then
1570       AC_MSG_ERROR($ffmpeg_vdpau_not_supported)
1571     else
1572       use_vdpau=no
1573       AC_MSG_RESULT($ffmpeg_vdpau_not_supported)
1574     fi])
1575
1576   # Check for 'PIX_FMT_VDPAU_MPEG4' from libavutil
1577   if test "x$use_vdpau" != "xno"; then
1578     AC_LANG_PUSH([C++])
1579     AC_LINK_IFELSE(
1580       [AC_LANG_SOURCE([ #include <libavutil/pixfmt.h>
1581         int main() { PixelFormat format = PIX_FMT_VDPAU_MPEG4; }])],
1582       [AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1],
1583       [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])],)
1584     AC_LANG_POP([C++])
1585   fi
1586   CPPFLAGS="$SAVE_CPPFLAGS"
1587 else
1588   AC_MSG_NOTICE($external_ffmpeg_disabled)
1589   USE_EXTERNAL_FFMPEG=0
1590   AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1], [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])
1591 fi
1592
1593 echo "Checking for SWIG installation"
1594 AC_PATH_PROG(SWIG_EXE, swig, "none")
1595 if test "$SWIG_EXE" = "none"; then
1596   AC_PATH_PROG(SWIG20_EXE, swig2.0, "none")
1597   if test "$SWIG20_EXE" != "none" ; then
1598     SWIG_EXE=$SWIG20_EXE
1599   fi
1600 fi
1601 if test "$SWIG_EXE" = "none"; then
1602   AC_MSG_ERROR($missing_program)
1603 fi
1604 final_message="$final_message\n  SWIG Available:\tYes"
1605
1606 echo "Checking for a jre installation"
1607 AC_PATH_PROG(JAVA_EXE, java, "none")
1608 if test "$JAVA_EXE" = "none"; then
1609   AC_MSG_ERROR($missing_program)
1610 fi
1611 final_message="$final_message\n  JRE Available:\tYes"
1612
1613 echo "Checking for doxygen installation"
1614 AC_PATH_PROG(DOXYGEN_EXE, doxygen, "none")
1615 if test "$DOXYGEN_EXE" = "none"; then
1616   AC_MSG_WARN([Unable to find doxygen installation. Will not be able to make docstrings for the python api])
1617   final_message="$final_message\n  Doxygen Available:\tNo"
1618   USE_DOXYGEN=0
1619 else
1620   final_message="$final_message\n  Doxygen Available:\tYes"
1621   USE_DOXYGEN=1
1622 fi
1623
1624 # VDPAU
1625 if test "x$use_vdpau" != "xno"; then
1626   if test "$host_vendor" = "apple" ; then
1627     if test "x$use_vdpau" = "xyes"; then
1628       AC_MSG_ERROR([VDPAU not supported on this platform])
1629     else
1630       use_vdpau="no"
1631       AC_MSG_NOTICE($vdpau_disabled)
1632     fi
1633     USE_VDPAU=0
1634   else
1635     USE_VDPAU=1
1636     AC_CHECK_HEADER([vdpau/vdpau.h],AC_DEFINE([HAVE_LIBVDPAU], [],
1637       [Define to 1 if you have the 'vdpau' library (-lvdpau).]),
1638     [if test "x$use_vdpau" = "xyes"; then
1639       USE_VDPAU=0
1640       AC_MSG_ERROR([$vdpau_not_found])
1641     else
1642       use_vdpau="no"
1643       USE_VDPAU=0
1644       AC_MSG_RESULT($vdpau_not_found)
1645     fi])
1646   fi
1647 else
1648   USE_VDPAU=0
1649   AC_MSG_NOTICE($vdpau_disabled)
1650 fi
1651
1652 # VAAPI
1653 if test "x$use_vaapi" != "xno"; then
1654   if test "$host_vendor" = "apple" ; then
1655     if test "x$use_vaapi" = "xyes"; then
1656       AC_MSG_ERROR([VAAPI not supported on this platform])
1657     else
1658       use_vaapi="no"
1659       AC_MSG_NOTICE($vaapi_disabled)
1660     fi
1661     USE_VAAPI=0
1662   else
1663     initial_val=$use_vaapi
1664     AC_CHECK_LIB([va], main, :, use_vaapi=no)
1665     if test "x$use_vaapi" != "xno"; then
1666       AC_CHECK_LIB([va-glx], main, LIBS="-lva -lva-glx $LIBS", use_vaapi=no, -lva)
1667     fi
1668
1669     if test "x$use_vaapi" = "xno"; then
1670       if test "x$initial_val" = "xyes"; then
1671         AC_MSG_ERROR($vaapi_not_found)
1672       else
1673         AC_MSG_RESULT($vaapi_not_found)
1674       fi
1675       USE_VAAPI=0
1676     else
1677       AC_DEFINE([HAVE_LIBVA], [1], [Define to 1 if you have the 'vaapi' libraries (-lva AND -lva-glx)])
1678       USE_VAAPI=1
1679     fi
1680   fi
1681 else
1682   AC_MSG_NOTICE($vaapi_disabled)
1683   USE_VAAPI=0
1684 fi
1685
1686 # CrystalHD
1687 if test "x$use_crystalhd" != "xno"; then
1688   SAVE_CFLAGS="$CFLAGS"
1689   CFLAGS="-D__LINUX_USER__"
1690   AC_CHECK_HEADER([libcrystalhd/libcrystalhd_if.h], [],
1691     [ if test "x$use_crystalhd" = "xyes"; then
1692         AC_MSG_ERROR($crystalhd_not_found)
1693       else
1694         use_crystalhd=no
1695         AC_MSG_RESULT($crystalhd_not_found)
1696       fi
1697       USE_CRYSTALHD=0
1698     ])
1699     CFLAGS="$SAVE_CFLAGS"
1700     if test "$host_vendor" != "apple"; then
1701       XB_FIND_SONAME([CRYSTALHD], [crystalhd], [use_crystalhd])
1702     fi
1703     if test "x$use_crystalhd" != "xno"; then
1704       SAVE_CFLAGS="$CFLAGS"
1705       CFLAGS="-D__LINUX_USER__ -lcrystalhd"
1706       # check for new crystalhd lib
1707       AC_COMPILE_IFELSE(
1708         [AC_LANG_SOURCE([#include <libcrystalhd/bc_dts_types.h>
1709           #include <libcrystalhd/bc_dts_defs.h>
1710           PBC_INFO_CRYSTAL bCrystalInfo;])],
1711         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [2], [Define to 2 if you have the 'New Broadcom Crystal HD' library.]) ], 
1712         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [1], [Define to 1 if you have the 'Old Broadcom Crystal HD' library.]) ])
1713       CFLAGS="$SAVE_CFLAGS"
1714       USE_CRYSTALHD=1
1715     fi
1716 else
1717   AC_MSG_NOTICE($crystalhd_disabled)
1718   USE_CRYSTALHD=0
1719 fi
1720
1721 # VDADecoder
1722 if test "x$use_vdadecoder" != "xno"; then
1723   if test "$host_vendor" = "apple" ; then
1724     HAVE_LIBVDADECODER=1
1725     AC_DEFINE([HAVE_LIBVDADECODER], [1], [Define to 1 if you have the 'VDADecoder' library.])
1726     AC_MSG_NOTICE($vdadecoder_enabled)
1727     USE_VDA=1
1728   else
1729     if test "x$use_vdadecoder" = "xyes"; then
1730       AC_MSG_ERROR([VDA Decoder not supported on this platform])
1731     else
1732       use_vdadecoder="no"
1733       AC_MSG_NOTICE($vdadecoder_disabled)
1734     fi
1735     USE_VDA=0
1736   fi
1737 else
1738   AC_MSG_NOTICE($vdadecoder_disabled)
1739 fi
1740
1741 # VTBDecoder
1742 if test "x$use_vtbdecoder" != "xno"; then
1743   if test "$host_vendor" = "apple" ; then
1744     HAVE_VIDEOTOOLBOXDECODER=1
1745     AC_DEFINE([HAVE_VIDEOTOOLBOXDECODER], [1], [Define to 1 if you have the 'VTBDecoder' library.])
1746     AC_MSG_NOTICE($vtbdecoder_enabled)
1747   else
1748     if test "x$use_vtbdecoder" = "xyes"; then
1749       AC_MSG_ERROR([VTB Decoder not supported on this platform])
1750     else
1751       use_vtbdecoder="no"
1752       AC_MSG_NOTICE($vtbdecoder_disabled)
1753     fi
1754   fi
1755 else
1756   AC_MSG_NOTICE($vtbdecoder_disabled)
1757 fi
1758
1759 # OpenMax
1760 if test "$host_vendor" = "apple" ; then
1761   use_openmax="no"
1762   USE_OPENMAX=0
1763   AC_MSG_NOTICE($openmax_disabled)
1764 elif test "$target_platform" = "target_raspberry_pi"; then
1765   use_openmax="no"
1766   USE_OPENMAX=0
1767   AC_MSG_NOTICE($openmax_disabled)
1768 else
1769   if test "$use_gles" = "yes" && test "$use_openmax" = "auto"; then
1770     PKG_CHECK_MODULES([OPENMAX], [libomxil-bellagio],
1771                       USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS"],
1772                       use_openmax=no;USE_OPENMAX=0;AC_MSG_RESULT($openmax_not_found))
1773   elif test "$use_gles" = "yes" && test "$use_openmax" = "yes"; then
1774     PKG_CHECK_MODULES([OPENMAX], [libomxil-bellagio],
1775                       USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS"],
1776                       AC_MSG_ERROR($openmax_not_found))
1777   else
1778     AC_MSG_NOTICE($openmax_disabled)
1779     use_openmax=no
1780     USE_OPENMAX=0
1781   fi
1782 fi
1783
1784 # yajl version check (yajl_version.h was added in yajl 2.0)
1785 AC_CHECK_HEADERS([yajl/yajl_version.h], [], [
1786 AC_DEFINE(YAJL_MAJOR, 1, [yajl version 1])
1787 ], [])
1788
1789 # additional internal players
1790 case $add_players in
1791   *amlplayer*)
1792       AC_CHECK_HEADER([amlplayer/amports/amstream.h],, AC_MSG_ERROR($missing_headers))
1793       XB_ADD_PLAYER([AMLPLAYER], [amlplayer])
1794       ;;
1795   *omxplayer*)
1796       XB_ADD_PLAYER([OMXPLAYER], [omxplayer])
1797       ;;
1798 esac
1799
1800 # platform specific bin utilities
1801 if test "$host_vendor" != "apple" ; then
1802   AC_CHECK_PROG(HAVE_GAWK,gawk,"yes","no",)
1803   if test "$HAVE_GAWK" = "no" ; then
1804     AC_MSG_ERROR($missing_program)
1805   fi
1806 fi
1807
1808 if test "$use_arch" != "arm" ; then
1809   AC_CHECK_PROG(HAVE_CMAKE,cmake,"yes","no",)
1810   if test "$HAVE_CMAKE" = "no" ; then
1811     AC_MSG_ERROR($missing_program)
1812   fi
1813 fi
1814
1815 AC_CHECK_PROG(HAVE_GPERF,gperf,"yes","no",)
1816 if test "$HAVE_GPERF" = "no" ; then
1817   AC_MSG_ERROR($missing_program)
1818 fi
1819
1820 AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",)
1821 if test "$HAVE_UNZIP" = "no" ; then
1822   AC_MSG_ERROR($missing_program)
1823 fi
1824
1825 AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",)
1826 if test "$HAVE_ZIP" = "no" ; then
1827   AC_MSG_ERROR($missing_program)
1828 fi
1829
1830 if test "$ARCH" = "i486-linux" || test "$ARCH" = "x86-freebsd"; then
1831   AC_CHECK_PROG(HAVE_NASM,nasm,"yes","no",)
1832   if test "$HAVE_NASM" = "no" ; then
1833     AC_MSG_ERROR($missing_program)
1834   fi
1835 fi
1836
1837 AC_CHECK_PROG(HAVE_GIT,git,"yes","no",)
1838
1839 # Checks for header files.
1840 AC_HEADER_DIRENT
1841 AC_HEADER_STDC
1842 AC_HEADER_SYS_WAIT
1843 AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h limits.h locale.h \
1844   malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
1845   strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h \
1846   sys/time.h sys/timeb.h sys/vfs.h termios.h unistd.h utime.h wchar.h wctype.h])
1847 AC_CHECK_HEADERS([cdio/iso9660.h],,AC_MSG_ERROR([$missing_headers]))
1848
1849 # Checks for typedefs, structures, and compiler characteristics.
1850 AC_HEADER_STAT
1851 AC_HEADER_STDBOOL
1852 AC_C_CONST
1853 AC_TYPE_UID_T
1854 AC_C_INLINE
1855 AC_TYPE_INT8_T
1856 AC_TYPE_INT16_T
1857 AC_TYPE_INT32_T
1858 AC_TYPE_INT64_T
1859 AC_TYPE_MODE_T
1860 AC_TYPE_OFF_T
1861 AC_TYPE_PID_T
1862 AC_C_RESTRICT
1863 AC_TYPE_SIZE_T
1864 AC_TYPE_SSIZE_T
1865 AC_CHECK_MEMBERS([struct stat.st_rdev])
1866 AC_HEADER_TIME
1867 AC_STRUCT_TM
1868 AC_TYPE_UINT8_T
1869 AC_TYPE_UINT16_T
1870 AC_TYPE_UINT32_T
1871 AC_TYPE_UINT64_T
1872 AC_C_BIGENDIAN
1873
1874 if test "$cross_compiling" = "yes"; then
1875   final_message="$final_message\n  Crosscomp.:\tYes"
1876 else
1877   final_message="$final_message\n  Crosscomp.:\tNo"
1878 fi
1879
1880 final_message="$final_message\n  target ARCH:\t$use_arch"
1881 final_message="$final_message\n  target CPU:\t$use_cpu"
1882
1883 if test "$use_gles" = "yes"; then
1884   final_message="$final_message\n  OpenGLES:\tYes"
1885   USE_OPENGLES=1
1886   USE_OPENGL=0
1887 else
1888   USE_OPENGLES=0
1889   if test "$use_gl" = "yes"; then
1890     final_message="$final_message\n  OpenGL:\tYes"
1891     USE_OPENGL=1
1892   else
1893     final_message="$final_message\n  OpenGL:\tNo (Very Slow)"
1894     SDL_DEFINES="-DHAS_SDL_2D"
1895     USE_OPENGL=0
1896   fi
1897 fi
1898
1899 if test "$use_alsa" = "yes"; then
1900   USE_ALSA=1
1901   AC_DEFINE([USE_ALSA],[1],["Define to 1 if alsa is installed"])
1902   final_message="$final_message\n  ALSA:\t\tYes"
1903 else
1904   USE_ALSA=0
1905   final_message="$final_message\n  ALSA:\t\tNo"
1906 fi
1907
1908 if test "$use_dbus" = "yes"; then
1909   final_message="$final_message\n  DBUS:\t\tYes"
1910 else
1911   final_message="$final_message\n  DBUS:\t\tNo"
1912 fi
1913
1914 if test "x$use_vdpau" != "xno"; then
1915   final_message="$final_message\n  VDPAU:\tYes"
1916 else
1917   final_message="$final_message\n  VDPAU:\tNo"
1918 fi
1919
1920 if test "x$use_vaapi" != "xno"; then
1921   final_message="$final_message\n  VAAPI:\tYes"
1922 else
1923   final_message="$final_message\n  VAAPI:\tNo"
1924 fi
1925
1926 if test "x$use_crystalhd" != "xno"; then
1927   final_message="$final_message\n  CrystalHD:\tYes"
1928 else
1929   final_message="$final_message\n  CrystalHD:\tNo"
1930 fi
1931
1932 if test "x$use_vdadecoder" != "xno"; then
1933   final_message="$final_message\n  VDADecoder:\tYes"
1934 else
1935   final_message="$final_message\n  VDADecoder:\tNo"
1936 fi
1937
1938 if test "x$use_vtbdecoder" != "xno"; then
1939   final_message="$final_message\n  VTBDecoder:\tYes"
1940 else
1941   final_message="$final_message\n  VTBDecoder:\tNo"
1942 fi
1943
1944 if test "$use_openmax" != "no"; then
1945   final_message="$final_message\n  OpenMax:\tYes"
1946 else
1947   final_message="$final_message\n  OpenMax:\tNo"
1948 fi
1949
1950 if test "$use_joystick" = "yes"; then
1951   final_message="$final_message\n  Joystick:\tYes"
1952   SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_JOYSTICK"
1953 else
1954   final_message="$final_message\n  Joystick:\tNo"
1955 fi
1956
1957 if test "$use_xrandr" = "yes"; then
1958   final_message="$final_message\n  XRandR:\tYes"
1959   USE_XRANDR=1
1960 else
1961   final_message="$final_message\n  XRandR:\tNo"
1962   USE_XRANDR=0
1963 fi
1964
1965 if test "$use_goom" = "yes"; then
1966   final_message="$final_message\n  GOOM:\t\tYes"
1967 else
1968   final_message="$final_message\n  GOOM:\t\tNo"
1969 fi
1970
1971 if test "$use_rsxs" = "yes"; then
1972   final_message="$final_message\n  RSXS:\t\tYes"
1973 else
1974   final_message="$final_message\n  RSXS:\t\tNo"
1975 fi
1976
1977 if test "$use_projectm" = "yes"; then
1978   final_message="$final_message\n  ProjectM:\tYes"
1979 else
1980   final_message="$final_message\n  ProjectM:\tNo"
1981 fi
1982
1983 if test "$use_skin_touched" = "yes"; then
1984   final_message="$final_message\n  Skin Touched:\tYes"
1985 else
1986   final_message="$final_message\n  Skin Touched:\tNo"
1987 fi
1988
1989 if test "$use_x11" = "yes"; then
1990   final_message="$final_message\n  X11:\t\tYes"
1991 else
1992   final_message="$final_message\n  X11:\t\tNo"
1993 fi
1994
1995 if test "$use_libbluray" = "yes"; then
1996   final_message="$final_message\n  Bluray:\tYes"
1997 else
1998   final_message="$final_message\n  Bluray:\tNo"
1999 fi
2000
2001 USE_TEXTUREPACKER_NATIVE=0
2002 if test "x$use_texturepacker" != "xno"; then
2003   final_message="$final_message\n  TexturePacker:Yes"
2004   USE_TEXTUREPACKER=1
2005   if test "x$use_texturepacker_native" = "xyes"; then
2006     USE_TEXTUREPACKER_NATIVE=1
2007     if [[ ! -d "$USE_TEXTUREPACKER_NATIVE_ROOT" ]]; then 
2008       USE_TEXTUREPACKER_NATIVE_ROOT= 
2009     fi
2010   fi
2011 else
2012   final_message="$final_message\n  TexturePacker:No"
2013   USE_TEXTUREPACKER=0
2014 fi
2015
2016 if test "$use_mid" = "yes"; then
2017   final_message="$final_message\n  MID Support:\tYes"
2018   SDL_DEFINES="$SDL_DEFINES -DMID"
2019 else
2020   final_message="$final_message\n  MID Support:\tNo"
2021 fi
2022
2023 ORIGCC=$CC
2024 ORIGCXX=$CXX
2025 if test "x$use_ccache" != "xno"; then
2026   AC_PATH_PROG(CCACHE,ccache,none)
2027   if test "$ac_cv_path_CCACHE" = "none"; then
2028     if test "x$use_ccache" = "xyes"; then
2029       AC_MSG_ERROR([ccache not found.]);
2030     else
2031       AC_MSG_NOTICE([ccache not found. Falling back to default CC])
2032       final_message="$final_message\n  ccache:\tNo"
2033     fi
2034   else
2035     CC="$ac_cv_path_CCACHE $CC"
2036     CXX="$ac_cv_path_CCACHE $CXX"
2037     AC_MSG_NOTICE(enabling ccache)
2038     final_message="$final_message\n  ccache:\tYes"
2039   fi
2040 else
2041   final_message="$final_message\n  ccache:\tNo"
2042 fi
2043
2044 if test "$use_alsa" = "yes"; then
2045   final_message="$final_message\n  ALSA Support:\tYes"
2046 else
2047   final_message="$final_message\n  ALSA Support:\tNo"
2048 fi
2049
2050 if test "x$use_pulse" != "xno"; then
2051   XBMC_STANDALONE_SH_PULSE=tools/Linux/xbmc-standalone.sh.pulse
2052   final_message="$final_message\n  PulseAudio:\tYes"
2053 else
2054   XBMC_STANDALONE_SH_PULSE=/dev/null
2055   final_message="$final_message\n  PulseAudio:\tNo"
2056 fi
2057
2058 if test "$use_hal" = "yes"; then
2059   final_message="$final_message\n  HAL Support:\tYes"
2060 else
2061   final_message="$final_message\n  HAL Support:\tNo"
2062 fi
2063
2064 # DVDCSS
2065 if test "$use_dvdcss" = "yes"; then
2066   AC_MSG_NOTICE($dvdcss_enabled)
2067   final_message="$final_message\n  DVDCSS:\tYes"
2068   BUILD_DVDCSS=1
2069   SKIP_CONFIG_DVDCSS=0
2070   DVDREAD_CFLAGS="-D_XBMC -DHAVE_DVDCSS_DVDCSS_H"
2071 else
2072   AC_MSG_NOTICE($dvdcss_disabled)
2073   final_message="$final_message\n  DVDCSS:\tNo"
2074   BUILD_DVDCSS=0
2075   SKIP_CONFIG_DVDCSS=1
2076   DVDREAD_CFLAGS="-D_XBMC -UHAVE_DVDCSS_DVDCSS_H"
2077 fi
2078 if test "$host_vendor" = "apple"; then
2079  DVDREAD_CFLAGS="$DVDREAD_CFLAGS -D__DARWIN__"
2080 fi
2081
2082 # Google Test Framework
2083 if test "$configure_gtest" = "yes"; then
2084   AC_MSG_NOTICE($gtest_enabled)
2085   final_message="$final_message\n  Google Test Framework Configured:\tYes"
2086   GTEST_CONFIGURED=1
2087   SKIP_CONFIG_GTEST=0
2088 else
2089   AC_MSG_NOTICE($gtest_disabled)
2090   final_message="$final_message\n  Google Test Framework Configured:\tNo"
2091   GTEST_CONFIGURED=0
2092   SKIP_CONFIG_GTEST=1
2093 fi
2094
2095 if test "$use_avahi" = "yes"; then
2096   final_message="$final_message\n  Avahi:\tYes"
2097 else
2098   final_message="$final_message\n  Avahi:\tNo"
2099 fi
2100
2101 if test "$HAVE_GIT" = "yes"; then
2102   GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
2103 fi
2104 if test "$GIT_REV" = ""; then
2105   GIT_REV="Unknown"
2106 fi
2107 if test "$host_vendor" = "apple"; then
2108   echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
2109 else
2110   SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'"
2111 fi
2112
2113 if test "$use_nonfree" = "yes"; then
2114   final_message="$final_message\n  Non-free:\tYes"
2115   HAVE_XBMC_NONFREE=1
2116   AC_DEFINE([HAVE_XBMC_NONFREE], [1], [Define to 1 to enable non-free components.])
2117 else
2118   HAVE_XBMC_NONFREE=0
2119   final_message="$final_message\n  Non-free:\tNo"
2120 fi
2121
2122 if test "$use_asap" = "yes"; then
2123   AC_CHECK_PROG(HAVE_GDC,gdc,"yes","no")
2124   if test "$HAVE_GDC" = "no"; then
2125     AC_MSG_ERROR($missing_program);
2126   fi
2127   AC_CHECK_PROG(HAVE_FPC,fpc,"yes","no")
2128   if test "$HAVE_FPC" = "no"; then
2129     AC_MSG_ERROR($missing_program);
2130   fi
2131   USE_ASAP_CODEC=1
2132   AC_DEFINE([USE_ASAP_CODEC], [1], [Define to 1 to enable ASAP codec.])
2133   final_message="$final_message\n  ASAP Codec:\tYes"
2134 else
2135   USE_ASAP_CODEC=0
2136   final_message="$final_message\n  ASAP Codec:\tNo"
2137 fi
2138
2139 if test "$use_mysql" = "yes"; then
2140   final_message="$final_message\n  MySQL:\tYes"
2141   USE_MYSQL=1
2142 else
2143   final_message="$final_message\n  MySQL:\tNo"
2144   USE_MYSQL=0
2145 fi
2146 if test "$use_webserver" = "yes"; then
2147   final_message="$final_message\n  Webserver:\tYes"
2148   USE_WEB_SERVER=1
2149 else
2150   final_message="$final_message\n  Webserver:\tNo"
2151   USE_WEB_SERVER=0
2152 fi
2153
2154 if test "$use_libssh" != "no"; then
2155   final_message="$final_message\n  libssh support:\tYes"
2156 else
2157   final_message="$final_message\n  libssh support:\tNo"
2158 fi
2159
2160 if test "$use_librtmp" != "no"; then
2161   final_message="$final_message\n  libRTMP support:\tYes"
2162 else
2163   final_message="$final_message\n  libRTMP support:\tNo"
2164 fi
2165
2166 if test "x$use_samba" != "xno"; then
2167   final_message="$final_message\n  libsmbclient support:\tYes"
2168 else
2169   final_message="$final_message\n  libsmbclient support:\tNo"
2170 fi
2171
2172 if test "$use_libnfs" != "no"; then
2173   final_message="$final_message\n  libnfs client support:Yes"
2174 else
2175   final_message="$final_message\n  libnfs client support:No"
2176 fi
2177
2178 if test "x$use_libafpclient" != "xno"; then
2179   final_message="$final_message\n  libafpclient support:\tYes"
2180 else  
2181   final_message="$final_message\n  libafpclient support:\tNo"
2182 fi
2183
2184 if test "$use_airplay" != "no"; then
2185   final_message="$final_message\n  AirPlay support:\tYes"
2186 else
2187   final_message="$final_message\n  AirPLay support:\tNo"
2188 fi
2189
2190 if test "x$use_airtunes" != "xno"; then
2191   final_message="$final_message\n  AirTunes support:\tYes"  
2192 else
2193   final_message="$final_message\n  AirTunes support:\tNo"
2194 fi
2195
2196 if test "x$use_upnp" != "xno"; then
2197   final_message="$final_message\n  UPnP support:\t\tYes"
2198   USE_UPNP=1
2199   AC_DEFINE([USE_UPNP], [1], [Define to 1 to enable UPnP support.])
2200 else
2201   USE_UPNP=0
2202   final_message="$final_message\n  UPnP support:\t\tNo"
2203 fi
2204
2205 if test "$use_optical_drive" = "yes"; then
2206   final_message="$final_message\n  Optical drive:\tYes"
2207 else
2208   final_message="$final_message\n  Optical drive:\tNo"
2209 fi
2210
2211 if test "x$use_libudev" != "xno"; then
2212   final_message="$final_message\n  libudev support:\tYes"
2213 else
2214   final_message="$final_message\n  libudev support:\tNo"
2215 fi
2216
2217 if test "x$use_libusb" != "xno"; then
2218   final_message="$final_message\n  libusb support:\tYes"
2219 else
2220   final_message="$final_message\n  libusb support:\tNo"
2221 fi
2222
2223 if test "x$use_libcec" != "xno"; then
2224   final_message="$final_message\n  libcec support:\tYes"
2225   if test "x$use_rpi_cec_api" != "xno"; then
2226     final_message="$final_message\n  libcec RPi support:\tYes"
2227   else
2228     final_message="$final_message\n  libcec RPi support:\tNo"
2229   fi
2230 else
2231   final_message="$final_message\n  libcec support:\tNo"
2232 fi
2233
2234 if test "x$use_libmp3lame" != "xno"; then
2235   final_message="$final_message\n  libmp3lame support:\tYes"
2236 else
2237   final_message="$final_message\n  libmp3lame support:\tNo"
2238 fi
2239
2240 if test "x$use_libvorbisenc" != "xno"; then
2241   final_message="$final_message\n  libvorbisenc support:\tYes"
2242 else
2243   final_message="$final_message\n  libvorbisenc support:\tNo"
2244 fi
2245
2246 if test "x$use_libcap" != "xno"; then
2247   final_message="$final_message\n  libcap support:\tYes"
2248 else
2249   final_message="$final_message\n  libcap support:\tNo"
2250 fi
2251
2252 if test "x$add_players" != "xno"; then
2253   final_message="$final_message\n  additional players:\tYes"
2254 else
2255   final_message="$final_message\n  additional players:\tNo"
2256 fi
2257
2258 ### External libraries messages
2259
2260 if test "$use_external_ffmpeg" = "yes"; then
2261   final_message="$final_message\n  External FFmpeg:\tYes"
2262 else
2263   final_message="$final_message\n  External FFmpeg:\tNo"
2264 fi
2265
2266 if test "$host_vendor" = "apple" ; then
2267   # built internal but referenced as external, we link directly to them.
2268   # this MUST be the last thing before OUTPUT_FILES as they do not
2269   # exist until after we build FFMpeg.
2270   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavcodec -lavcodec"
2271   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavfilter -lavfilter"
2272   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libswresample -lswresample"
2273   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavformat -lavformat"
2274   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavutil -lavutil"
2275   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libpostproc -lpostproc"
2276   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libswscale -lswscale"
2277 fi
2278
2279 USE_PVR_ADDONS=0
2280 DISABLE_PVR_ADDON_CONFIG=1
2281 if [[ -f "pvr-addons/Makefile.am" ]]; then
2282   final_message="$final_message\n  PVR add-ons:\t\tYes"
2283   USE_PVR_ADDONS=1
2284   DISABLE_PVR_ADDON_CONFIG=0
2285 else
2286   final_message="$final_message\n  PVR add-ons:\t\tNo"
2287 fi
2288
2289 OUTPUT_FILES="Makefile \
2290     Makefile.include \
2291     addons/skin.confluence/media/Makefile \
2292     xbmc/Makefile \
2293     xbmc/cdrip/Makefile \
2294     xbmc/cores/Makefile \
2295     xbmc/cores/VideoRenderers/Makefile \
2296     xbmc/cores/dvdplayer/Makefile \
2297     lib/Makefile \
2298     lib/libdvd/Makefile \
2299     xbmc/cores/DllLoader/Makefile \
2300     xbmc/cores/DllLoader/exports/Makefile \
2301     xbmc/cores/dvdplayer/DVDCodecs/Makefile \
2302     xbmc/cores/dvdplayer/DVDCodecs/Audio/Makefile \
2303     xbmc/cores/dvdplayer/DVDCodecs/Overlay/Makefile \
2304     xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile \
2305     xbmc/cores/dvdplayer/DVDDemuxers/Makefile \
2306     xbmc/cores/dvdplayer/DVDSubtitles/Makefile \
2307     xbmc/cores/AudioEngine/Makefile \
2308     xbmc/cores/paplayer/Makefile \
2309     xbmc/cores/amlplayer/Makefile \
2310     xbmc/cores/omxplayer/Makefile \
2311     lib/timidity/Makefile \
2312     lib/xbadpcm/Makefile \
2313     lib/asap/Makefile \
2314     lib/nosefart/Makefile \
2315     lib/libsidplay2/Makefile \
2316     lib/vgmstream/Makefile \
2317     lib/snesapu/SNES/SNESAPU/Makefile \
2318     lib/stsound/StSoundLibrary/Makefile \
2319     xbmc/cores/playercorefactory/Makefile \
2320     xbmc/music/karaoke/Makefile \
2321     xbmc/osx/Makefile \
2322     xbmc/guilib/Makefile \
2323     xbmc/interfaces/Makefile \
2324     xbmc/network/Makefile \
2325     xbmc/network/upnp/Makefile \
2326     lib/libRTV/Makefile \
2327     lib/libexif/Makefile \
2328     lib/libXDAAP/Makefile \
2329     lib/cmyth/Makefile \
2330     lib/libhdhomerun/Makefile \
2331     lib/libsquish/Makefile \
2332     lib/cximage-6.0/Makefile \
2333     lib/addons/script.module.pil/Makefile \
2334     lib/libUPnP/Makefile \
2335     xbmc/DllPaths_generated.h \
2336     xbmc/DllPaths_generated_android.h \
2337     xbmc/freebsd/Makefile \
2338     xbmc/linux/Makefile \
2339     xbmc/filesystem/Makefile \
2340     xbmc/screensavers/rsxs-0.9/xbmc/Makefile \
2341     xbmc/visualizations/XBMCProjectM/Makefile \
2342     xbmc/visualizations/Goom/Makefile \
2343     xbmc/visualizations/OpenGLSpectrum/Makefile \
2344     xbmc/visualizations/WaveForm/Makefile \
2345     xbmc/visualizations/iTunes/Makefile \
2346     lib/addons/library.xbmc.addon/Makefile \
2347     lib/addons/library.xbmc.gui/Makefile \
2348     lib/addons/library.xbmc.pvr/Makefile \
2349     xbmc/visualizations/EGLHelpers/Makefile \
2350     tools/Linux/xbmc.sh \
2351     tools/Linux/xbmc-standalone.sh \
2352     tools/TexturePacker/Makefile \
2353     tools/EventClients/Clients/OSXRemote/Makefile \
2354     xbmc/peripherals/bus/Makefile \
2355     xbmc/peripherals/devices/Makefile \
2356     xbmc/android/activity/Makefile \
2357     xbmc/android/loader/Makefile \
2358     xbmc/main/Makefile"
2359
2360 if test "$use_skin_touched" = "yes"; then
2361 OUTPUT_FILES="$OUTPUT_FILES addons/skin.touched/media/Makefile"
2362 fi
2363
2364 OUTPUT_FILES="$OUTPUT_FILES \
2365   xbmc/interfaces/python/Makefile \
2366   xbmc/interfaces/python/test/Makefile"
2367
2368 # Line below is used so we can use AM_INIT_AUTOMAKE. The corresponding
2369 # .dummy.am does nothing.
2370 AC_CONFIG_FILES([.dummy])
2371
2372 AC_CONFIG_FILES([${OUTPUT_FILES}])
2373 OUTPUT_FILES="$OUTPUT_FILES \
2374   .dummy"
2375 AC_SUBST(CFLAGS)
2376 AC_SUBST(CXXFLAGS)
2377 AC_SUBST(INCLUDES)
2378 AC_SUBST(LDFLAGS)
2379 AC_SUBST(SDL_DEFINES)
2380 AC_SUBST(BUILD_DVDCSS)
2381 AC_SUBST(DISABLE_GOOM)
2382 AC_SUBST(DISABLE_RSXS)
2383 AC_SUBST(DISABLE_PROJECTM)
2384 AC_SUBST(USE_SKIN_TOUCHED)
2385 AC_SUBST(USE_EXTERNAL_FFMPEG)
2386 AC_SUBST(PYTHON_VERSION)
2387 AC_SUBST(OUTPUT_FILES)
2388 AC_SUBST(HAVE_XBMC_NONFREE)
2389 AC_SUBST(USE_ASAP_CODEC)
2390 AC_SUBST(LIBCURL_BASENAME)
2391 AC_SUBST(LIBFLAC_BASENAME)
2392 AC_SUBST(LIBVORBISFILE_BASENAME)
2393 AC_SUBST(LIBMODPLUG_BASENAME)
2394 AC_SUBST(LIBMAD_BASENAME)
2395 AC_SUBST(LIBOGG_BASENAME)
2396 AC_SUBST(LIBVORBISENC_BASENAME)
2397 AC_SUBST(LIBVORBIS_BASENAME)
2398 AC_SUBST(LIBASS_BASENAME)
2399 AC_SUBST(LIBMEPG2_BASENAME)
2400 AC_SUBST_FILE(XBMC_STANDALONE_SH_PULSE)
2401 AC_SUBST(USE_OPENGL)
2402 AC_SUBST(USE_OPENGLES)
2403 AC_SUBST(USE_VDPAU)
2404 AC_SUBST(USE_VAAPI)
2405 AC_SUBST(USE_CRYSTALHD)
2406 AC_SUBST(USE_LIBSMBCLIENT)
2407 AC_SUBST(USE_LIBNFS)
2408 AC_SUBST(USE_LIBAFPCLIENT)
2409 AC_SUBST(USE_AIRPLAY)
2410 AC_SUBST(USE_VDA)
2411 AC_SUBST(USE_OPENMAX)
2412 AC_SUBST(USE_PULSE)
2413 AC_SUBST(USE_XRANDR)
2414 AC_SUBST(USE_ALSA)
2415 AC_SUBST(USE_TEXTUREPACKER)
2416 AC_SUBST(USE_TEXTUREPACKER_NATIVE)
2417 AC_SUBST(USE_TEXTUREPACKER_NATIVE_ROOT)
2418 AC_SUBST(USE_AIRTUNES)
2419 AC_SUBST(USE_LIBUDEV)
2420 AC_SUBST(USE_LIBUSB)
2421 AC_SUBST(USE_LIBCEC)
2422 AC_SUBST(USE_CEC_RPI_API)
2423 AC_SUBST(USE_MYSQL)
2424 AC_SUBST(USE_WEB_SERVER)
2425 AC_SUBST(USE_UPNP)
2426 AC_SUBST(USE_OMXLIB)
2427 AC_SUBST(USE_ANDROID)
2428 AC_SUBST(GTEST_CONFIGURED)
2429 AC_SUBST(USE_DOXYGEN)
2430 AC_SUBST(USE_PVR_ADDONS)
2431
2432 # pushd and popd are not available in other shells besides bash, so implement
2433 # our own pushd/popd functions
2434 XB_DIRSTACK="$PWD"
2435 xb_pushd()
2436 {
2437   local dirname="$1"
2438   if [[ -d "$dirname" ]] && [[ -x "$dirname" ]]; then
2439     cd "$dirname"
2440     XB_DIRSTACK="$dirname ${XB_DIRSTACK:-$PWD}"
2441     return 0
2442   else
2443     AC_MSG_ERROR(xb_pushd: unable to change to $dirname)
2444   fi
2445 }
2446 xb_popd()
2447 {
2448   if [[ -n "$XB_DIRSTACK" ]]; then
2449     XB_DIRSTACK="${XB_DIRSTACK#* }"
2450     cd "${XB_DIRSTACK%% *}"
2451     return 0
2452   else
2453     AC_MSG_ERROR(xb_popd: unable to go back to previous directory)
2454   fi
2455 }
2456
2457 # Function to run the configure scripts in our submodules
2458 # Consists of three paramaters, the path to the submodule, the configure command
2459 # with appropriate arguments, and a third parameter set to 1 if we are to skip
2460 # running the script, anything else if not.
2461 AC_DEFUN([XB_CONFIG_MODULE],[
2462 AC_CONFIG_COMMANDS_POST([
2463 if [[ $3 != "1" ]]; then
2464     if [[ -d $1 ]]; then
2465       xb_pushd $1
2466       $2
2467       if [[ $? -ne 0 ]]; then
2468         xb_popd
2469         AC_MSG_ERROR([[Submodule $1 failed to configure]])
2470       else
2471         xb_popd
2472       fi
2473     else
2474       AC_MSG_ERROR([[Submodule $1 does not exist]])
2475     fi
2476 else
2477     AC_MSG_NOTICE([[Skipping configuration of submodule $1.]])
2478 fi
2479 ])
2480 ])
2481
2482 XB_CONFIG_MODULE([lib/ffmpeg], [
2483   if test "$host_vendor" = "apple" ; then
2484     ffmpg_config="--target-os=$ffmpeg_target_os"
2485     # handle disables first, we do individual enables later
2486     ffmpg_config="$ffmpg_config --disable-muxers   --disable-encoders"
2487     ffmpg_config="$ffmpg_config --disable-devices  --disable-doc"
2488     ffmpg_config="$ffmpg_config --disable-ffplay   --disable-ffmpeg"
2489     ffmpg_config="$ffmpg_config --disable-ffprobe  --disable-ffserver"
2490     ffmpg_config="$ffmpg_config --disable-vda      --disable-crystalhd"
2491     ffmpg_config="$ffmpg_config --disable-decoder=mpeg_xvmc"
2492
2493     # handle conditional enables/disables
2494     if test "$use_debug" = "no"; then
2495       ffmpg_config="$ffmpg_config --disable-debug"
2496     fi
2497     if test "$use_cpu"  != "no";  then
2498       ffmpg_config="$ffmpg_config --cpu=$use_cpu"
2499     fi
2500     if test "$use_arch" != "no"; then
2501       ffmpg_config="$ffmpg_config --arch=$use_arch --enable-cross-compile"
2502     fi
2503     if test "$use_arch"  = "arm"; then
2504       ffmpg_config="$ffmpg_config --enable-pic"
2505       ffmpg_config="$ffmpg_config --disable-armv5te --disable-armv6t2"
2506       if test "$use_neon"  = "yes"; then
2507         ffmpg_config="$ffmpg_config --enable-neon"
2508       else
2509         ffmpg_config="$ffmpg_config --disable-neon"
2510       fi
2511     else
2512       ffmpg_config="$ffmpg_config --disable-amd3dnow"
2513     fi
2514     if test "$use_ffmpeg_libvorbis" = "yes"; then
2515       ffmpg_config="$ffmpg_config --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis"
2516     else
2517       ffmpg_config="$ffmpg_config --disable-libvorbis"
2518     fi
2519
2520     # handle individual enables
2521     ffmpg_config="$ffmpg_config --enable-gpl"
2522     ffmpg_config="$ffmpg_config --enable-postproc"
2523     ffmpg_config="$ffmpg_config --enable-static      --enable-pthreads"
2524     ffmpg_config="$ffmpg_config --enable-muxer=spdif --enable-muxer=adts"
2525     ffmpg_config="$ffmpg_config --enable-encoder=ac3 --enable-encoder=aac"
2526     ffmpg_config="$ffmpg_config --enable-protocol=http"
2527     ffmpg_config="$ffmpg_config --enable-runtime-cpudetect"
2528
2529     # ffmpeg will not compile with llvm-gcc-4.2, use clang instead
2530     case $CC in
2531       *llvm-gcc-4.2*)
2532         ffmpg_config="$ffmpg_config --cc=clang" ;;
2533       *)
2534         ffmpg_config="$ffmpg_config --cc=$CC" ;;
2535     esac
2536     
2537     # extra-cflags must be passed alone or it gets expanded wrong by the ffmpeg configure
2538     FFMPEG_EXTRACFLAGS="$CFLAGS $FFMPEG_EXTRACFLAGS -w -D_DARWIN_C_SOURCE -Dattribute_deprecated="
2539
2540     ./configure --extra-cflags="$FFMPEG_EXTRACFLAGS" $ffmpg_config --as="$AS"
2541
2542     # if using llvm-gcc-4.2 as assembler, -MMD is not enough to generate
2543     # dependency files in the right place, replace it with something that works
2544     case $AS in
2545       *llvm-gcc-4.2*)
2546         sed -ie "s#AS_DEPFLAGS=-MMD#AS_DEPFLAGS=-MMD -MF \$(\@:.o=.d) -MT \$\@#" config.mak ;;
2547     esac
2548
2549     # ffmpeg will use yasm found at ${prefix}/bin during configure
2550     # but then hardcodes 'yasm' in config.mak, fix it.
2551     sed -ie "s#YASM=yasm#YASM=${prefix}/bin/yasm#" config.mak
2552     sed -ie "s#YASMDEP=yasm#YASMDEP=${prefix}/bin/yasm#" config.mak
2553     sed -ie "s# -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 # #" config.mak
2554   else
2555     CFLAGS="" \
2556     CPPFLAGS="" \
2557     CXXFLAGS="" \
2558     LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")" \
2559     ./configure \
2560       --extra-cflags="$PASSED_CFLAGS $FFMPEG_EXTRACFLAGS" \
2561       --disable-static \
2562       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
2563       `if test "$cross_compiling" = "yes"; then echo --enable-cross-compile; fi` \
2564       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
2565       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
2566       `if test "$use_neon" = "yes"; then echo --enable-neon; else echo --disable-neon; fi`\
2567       --target-os=$ffmpeg_target_os \
2568       --disable-muxers \
2569       --enable-muxer=spdif \
2570       --enable-muxer=adts \
2571       --disable-encoders \
2572       --enable-encoder=ac3 \
2573       --enable-encoder=aac \
2574       `if test "$use_ffmpeg_libvorbis" = "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
2575       --disable-decoder=mpeg_xvmc \
2576       --disable-devices \
2577       --disable-ffprobe \
2578       --disable-ffplay \
2579       --disable-ffserver \
2580       --disable-ffmpeg \
2581       --disable-crystalhd \
2582       --enable-shared \
2583       --disable-doc \
2584       --enable-postproc \
2585       --enable-gpl \
2586       `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \
2587       `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \
2588       `if test "$use_optimizations" != "no"; then echo --enable-optimizations; else echo --disable-optimizations; fi` \
2589       --enable-protocol=http \
2590       --enable-pthreads \
2591       --enable-runtime-cpudetect \
2592       `if test "$use_hardcoded_tables" = "yes"; then echo --enable-hardcoded-tables; else echo --disable-hardcoded-tables; fi`\
2593       `if test "$target_platform" = "target_android" && test "$host_cpu" = "i686"; then echo --disable-mmx; fi #workaround for gcc 4.6 bug` \
2594       `if test "$target_platform" = "target_android"; then echo "--custom-libname-with-major=\\$(SLIBPREF)\\$(FULLNAME)-\\$(LIBMAJOR)-${ARCH}\\$(SLIBSUF)"; \
2595        else echo "--custom-libname-with-major=\\$(FULLNAME)-\\$(LIBMAJOR)-${ARCH}\\$(SLIBSUF)"; fi` \
2596       `case $host_cpu in i?86*) echo --disable-pic ;; *) echo --enable-pic ;; esac` \
2597       --cc="$CC" &&
2598       sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h &&
2599       sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h
2600   fi
2601 ], [$USE_EXTERNAL_FFMPEG])
2602
2603 XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [
2604   ./configure \
2605     CC="$CC" \
2606     CXX="$CXX" \
2607     CFLAGS="$CFLAGS" \
2608     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2609     --host=$host_alias \
2610     --build=$build_alias \
2611     --target=$target_alias \      
2612     --disable-doc \
2613     --enable-static \
2614     --with-pic
2615 ], [$SKIP_CONFIG_DVDCSS])
2616
2617 XB_CONFIG_MODULE([lib/libdvd/libdvdread], [
2618   ./configure2 \
2619     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../libdvdcss/src" \
2620     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2621     --host=$host_alias \
2622     --build=$build_alias \
2623     --target=$target_alias \      
2624     --enable-static \
2625     --disable-shared \
2626     --disable-strip \
2627     --disable-opts \
2628     --cc="$CC" &&
2629   $MAKE dvdread-config &&
2630   mkdir -p `pwd`/../includes/dvdread
2631   cp `pwd`/../libdvdread/src/*.h `pwd`/../includes/dvdread
2632 ], [0])
2633
2634 XB_CONFIG_MODULE([lib/libdvd/libdvdnav], [
2635   ./configure2 \
2636     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../includes" \
2637     --extra-ldflags="-L`pwd`/../libdvdread/obj" \
2638     --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
2639     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2640     --host=$host_alias \
2641     --build=$build_alias \
2642     --target=$target_alias \      
2643     --enable-static \
2644     --disable-shared \
2645     --cc="$CC"
2646 ], [0])
2647
2648 XB_CONFIG_MODULE([xbmc/visualizations/XBMCProjectM/libprojectM],[
2649   set -x
2650   rm -f CMakeCache.txt &&                              \
2651   CC="$ORIGCC" CXX="$ORIGCXX" LDFLAGS="$LDFLAGS" cmake \
2652     -DCMAKE_BUILD_TYPE=None -DUSE_FTGL:BOOL=OFF        \
2653     -DCMAKE_C_FLAGS:STRING="${CPPFLAGS} ${CFLAGS}"     \
2654     -DCMAKE_CXX_FLAGS:STRING="${CPPFLAGS} ${CXXFLAGS}" \
2655     -DCMAKE_INSTALL_PREFIX="${prefix}"                 \
2656     -DCMAKE_INSTALL_LIBDIR:PATH="${libdir}"            \
2657     -DINCLUDE_INSTALL_DIR:PATH="${includedir}"         \
2658     -DLIB_INSTALL_DIR:PATH="${libdir}"                 \
2659     -DSYSCONF_INSTALL_DIR:PATH="${sysconfdir}"         \
2660     -DSHARE_INSTALL_PREFIX:PATH="${datadir}" . &&
2661   if test "$host_vendor" = "apple" ; then
2662     # cmake has hardcoded paths to macports which bork our darwin depends cross/ppc, remove them
2663     sed -ie "s|-L/opt/local/lib| |" CMakeFiles/projectM.dir/link.txt
2664     sed -ie "s|-L/opt/local/lib| |" CMakeFiles/projectM.dir/flags.make
2665     sed -ie "s|-I/opt/local/include| |" CMakeFiles/projectM.dir/flags.make
2666   fi
2667   set +x
2668 ], [$DISABLE_PROJECTM])
2669
2670 XB_CONFIG_MODULE([xbmc/visualizations/Goom/goom2k4-0],[
2671   ./configure  \
2672     CFLAGS="$CFLAGS" \ 
2673     CXXFLAGS="$CXXFLAGS" \
2674     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2675     --host=$host_alias \
2676     --build=$build_alias \
2677     --target=$target_alias \      
2678     --disable-shared \
2679     --enable-static \
2680     --with-pic
2681 ], [$DISABLE_GOOM])
2682
2683 XB_CONFIG_MODULE([xbmc/screensavers/rsxs-0.9/], [
2684   ./configure \
2685     CC="$CC" \
2686     CXX="$CXX" \
2687     CFLAGS="$CFLAGS" \ 
2688     CXXFLAGS="$CXXFLAGS" \
2689     `if test "$host_vendor" = "apple"; then echo --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib; fi` \
2690     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2691     --host=$host_alias \
2692     --build=$build_alias \
2693     --target=$target_alias \      
2694     --without-xscreensaver \
2695     --disable-sound \
2696     --disable-cyclone \
2697     --disable-fieldlines \
2698     --disable-flocks \
2699     --disable-flux \
2700     --disable-helios \
2701     --disable-hyperspace \
2702     --disable-lattice \
2703     --disable-skyrocket
2704   if echo "$ARCH" | grep -q freebsd ; then
2705     sed -i.back "s;\(STDBOOL_H = \)stdbool.h;\1;" lib/Makefile
2706   fi
2707 ], [$DISABLE_RSXS])
2708
2709 XB_CONFIG_MODULE([lib/cpluff], [
2710   ./configure --disable-nls \
2711     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2712     --host=$host_alias \
2713     --build=$build_alias \
2714     --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX" LDFLAGS="$LDFLAGS" LIBS=""
2715     #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"    
2716 ], [0])
2717
2718 XB_CONFIG_MODULE([lib/gtest], [
2719   ./configure \
2720     CC="$CC" \
2721     CXX="$CXX" \
2722     CFLAGS="$CFLAGS" \
2723     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2724     --host=$host_alias \
2725     --build=$build_alias \
2726     --target=$target_alias \
2727     --disable-shared \
2728     --enable-static \
2729     --with-pthreads
2730 ], [$SKIP_CONFIG_GTEST])
2731
2732 XB_CONFIG_MODULE([pvr-addons], [
2733   ./configure \
2734     --prefix="${prefix}" \
2735     --host=$host_alias \
2736     --build=$build_alias \
2737     --target=$target_alias \
2738     CC="$CC" \
2739     CXX="$CXX" \
2740     CFLAGS="$CFLAGS" \
2741     CXXFLAGS="$CXXFLAGS"
2742 ], [$DISABLE_PVR_ADDON_CONFIG])
2743
2744 AC_OUTPUT
2745
2746 final_message="$final_message\n  prefix:\t$prefix\n$dashes"
2747 echo -e "$final_message\n"