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