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