[osx/ios] changed libass from static link to xbmc binary to dyloaded/unloaded on...
[xbmc:xbmc.git] / configure.in
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT([xbmc], [9.11], [http://trac.xbmc.org])
6 AC_CONFIG_HEADERS([xbmc/config.h])
7 AH_TOP([#pragma once])
8
9 AC_CONFIG_AUX_DIR([build-aux])
10 AM_INIT_AUTOMAKE([foreign])
11 AC_CANONICAL_HOST
12
13 tolower(){
14   echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
15 }
16
17 # check for library basenames
18 AC_DEFUN([XB_FIND_SONAME],
19 [
20   if [[ "$host_vendor" != "apple" ]]; then
21     AC_MSG_CHECKING([for lib$2 soname])
22     $1_SONAME=$( $CC -print-file-name=lib$2.so | \
23       while read output; do objdump -p $output | \
24         grep "SONAME" | \
25         sed -e 's/  *SONAME  *//'; done 2> /dev/null )
26   else
27     AC_MSG_CHECKING([for lib$2 dylib])
28     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
29     env_lib_path=[`echo $LDFLAGS | sed 's/-L[ ]*//g'`]
30     if test "$cross_compiling" = yes; then
31       host_lib_path=""
32     else
33       host_lib_path="/usr/lib /usr/local/lib"
34     fi
35     for path in $gcc_lib_path $env_lib_path $host_lib_path; do
36       lib=[`ls -- $path/lib$2.dylib 2>/dev/null`]
37       if test x$lib != x; then
38         # we want the path/name that is embedded in the dylib 
39         $1_SONAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
40         $1_SONAME=[`basename $$1_SONAME`]
41       fi
42     done
43   fi
44   if [[ -z "$$1_SONAME" ]]; then
45     AC_MSG_RESULT([no])
46     if test -z "$3" || test "x${$3}" = "xyes"; then
47       AC_MSG_ERROR([Unable to determine soname of lib$2 library])
48     else
49       AC_MSG_WARN([Unable to determine soname of lib$2 library])
50       $3=no
51       AC_MSG_WARN([lib$2 support disabled])
52     fi
53   else
54     AC_MSG_RESULT([$$1_SONAME])
55     AC_SUBST($1_SONAME)
56   fi
57 ])
58
59 # General message strings
60 configure_debug="ERROR: this is a configure debug statement"
61 missing_library="Could not find a required library. Please see the README for your platform."
62 missing_headers="Could not find some required headers. Please see the README for your platform."
63 missing_program="Could not find a required program. Please see the README for your platform."
64 xrandr_not_found="== Could not find libXRandR. SDL will be used for resolution support. =="
65 xrandr_disabled="== XRandR support disabled. SDL will be used for resolution support. =="
66 goom_enabled="== GOOM enabled. =="
67 goom_disabled="== GOOM disabled. =="
68 pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
69 pulse_disabled="== PulseAudio support manually disabled. =="
70 dvdcss_enabled="== DVDCSS support enabled. =="
71 dvdcss_disabled="== DVDCSS support disabled. =="
72 hal_not_found="== Could not find hal. HAL support disabled. =="
73 halstorage_not_found="== Could not find hal-storage. HAL support disabled. =="
74 hal_disabled="== HAL support disabled. =="
75 avahi_not_found="== Could not find libavahi-common or libavahi-client. Avahi support disabled. =="
76 avahi_disabled="== Avahi support disabled. =="
77 vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
78 vdpau_disabled="== VDPAU support manually disabled. =="
79 vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
80 vaapi_disabled="== VAAPI support manually disabled. =="
81 crystalhd_not_found="== Could not find libcrystalhd. CrystalHD support disabled. =="
82 crystalhd_disabled="== CrystalHD support manually disabled. =="
83 vdadecoder_enabled="== VDADecoder support enabled. =="
84 vdadecoder_disabled="== VDADecoder support manually disabled. =="
85 vtbdecoder_enabled="== VTBDecoder support enabled. =="
86 vtbdecoder_disabled="== VTBDecoder support manually disabled. =="
87 openmax_disabled="== OpenMax support manually disabled. =="
88 openmax_not_found="== Could not find libnvomx. OpenMax support disabled. =="
89 ssh_not_found="== Could not find libssh. SSH FTP VFS support disabled. =="
90 librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
91 librtmp_disabled="== RTMP support disabled. =="
92
93 # External library message strings
94 external_libraries_enabled="== Use of all supported external libraries enabled. =="
95 external_libraries_disabled="== Use of all supported external libraries disabled. =="
96 external_ffmpeg_enabled="== Use of external ffmpeg enabled. =="
97 external_ffmpeg_disabled="== Use of external ffmpeg disabled. =="
98 external_python_enabled="== Use of external python enabled. =="
99 external_python_disabled="== Use of external python disabled. =="
100 ffmpeg_vdpau_not_supported="== External ffmpeg doesn't support VDPAU. VDPAU support disabled. =="
101 dashes="------------------------"
102 final_message="\n  XBMC Configuration:"
103 final_message="\n$dashes$final_message\n$dashes"
104
105
106 AC_ARG_ENABLE([debug],
107   [AS_HELP_STRING([--enable-debug],
108   [enable debugging information (default is yes)])],
109   [use_debug=$enableval],
110   [use_debug=yes])
111
112 AC_ARG_WITH([arch],
113   [AS_HELP_STRING([--with-arch],
114   [build with given arch passing to internal ffmpeg (default is no, needed for crosscompiling)])],
115   [use_arch=$withval],
116   [use_arch=no])
117
118 AC_ARG_WITH([cpu],
119   [AS_HELP_STRING([--with-cpu],
120   [build with given cpu passing to ffmpeg (default is no)])],
121   [use_cpu=$withval],
122   [use_cpu=no])
123
124 AC_ARG_ENABLE([optimizations],
125   [AS_HELP_STRING([--enable-optimizations],
126   [enable optimization (default is yes)])],
127   [use_optimizations=$enableval],
128   [use_optimizations=yes])
129
130 AC_ARG_ENABLE([gl],
131   [AS_HELP_STRING([--enable-gl],
132   [enable OpenGL rendering (default is yes)])],
133   [use_gl=$enableval],
134   [use_gl=yes])
135
136 AC_ARG_ENABLE([gles],
137   [AS_HELP_STRING([--enable-gles],
138   [enable OpenGLES rendering (default is no)])],
139   [use_gles=$enableval],
140   [use_gles=no])
141
142 AC_ARG_ENABLE([vdpau],
143   [AS_HELP_STRING([--enable-vdpau],
144   [enable VDPAU decoding (default is auto)])],
145   [use_vdpau=$enableval],
146   [use_vdpau=auto])
147
148 AC_ARG_ENABLE([vaapi],
149   [AS_HELP_STRING([--enable-vaapi],
150   [enable VAAPI decoding (default is auto)])],
151   [use_vaapi=$enableval],
152   [use_vaapi=auto])
153
154 AC_ARG_ENABLE([crystalhd],
155   [AS_HELP_STRING([--enable-crystalhd],
156   [enable CrystalHD decoding (default is auto)])],
157   [use_crystalhd=$enableval],
158   [use_crystalhd=auto])
159
160 AC_ARG_ENABLE([vdadecoder],
161   [AS_HELP_STRING([--enable-vdadecoder],
162   [enable VDADecoder decoding (default is auto)])],
163   [use_vdadecoder=$enableval],
164   [use_vdadecoder=auto])
165
166 AC_ARG_ENABLE([vtbdecoder],
167   [AS_HELP_STRING([--enable-vtbdecoder],
168   [enable VTBDecoder decoding (default is auto)])],
169   [use_vtbdecoder=$enableval],
170   [use_vtbdecoder=auto])
171
172 AC_ARG_ENABLE([openmax],
173   [AS_HELP_STRING([--enable-openmax],
174   [enable OpenMax decoding (default is yes)])],
175   [use_openmax=$enableval],
176   [use_openmax=yes])
177
178 AC_ARG_ENABLE([tegra],
179   [AS_HELP_STRING([--enable-tegra],
180   [enable Tegra2 arm (default is no)])],
181   [use_tegra=$enableval],
182   [use_tegra=no])
183
184 AC_ARG_ENABLE([profiling],
185   [AS_HELP_STRING([--enable-profiling],
186   [enable gprof profiling (default is no)])],
187   [use_profiling=$enableval],
188   [use_profiling=no])
189
190 AC_ARG_ENABLE([joystick],
191   [AS_HELP_STRING([--enable-joystick],
192   [enable SDL joystick support (default is yes)])],
193   [use_joystick=$enableval],
194   [use_joystick=yes])
195
196 AC_ARG_ENABLE([xrandr],
197   [AS_HELP_STRING([--enable-xrandr],
198   [enable XRandR support (default is yes)])],
199   [use_xrandr=$enableval],
200   [use_xrandr=yes])
201
202 AC_ARG_ENABLE([goom],
203   [AS_HELP_STRING([--enable-goom],
204   [enable GOOM visualisation (default is no)])],
205   [use_goom=$enableval],
206   [use_goom=no])
207
208 AC_ARG_ENABLE([ccache],
209   [AS_HELP_STRING([--enable-ccache],
210   [enable building with ccache feature (default is auto)])],
211   [use_ccache=$enableval],
212   [use_ccache=auto])
213
214 AC_ARG_ENABLE([pulse],
215   [AS_HELP_STRING([--enable-pulse],
216   [enable PulseAudio support (default is auto)])],
217   [use_pulse=$enableval],
218   [use_pulse=auto])
219
220 AC_ARG_ENABLE([rtmp],
221   [AS_HELP_STRING([--enable-rtmp],
222   [enable RTMP support via librtmp (default is auto)])],
223   [use_librtmp=$enableval],
224   [use_librtmp=auto])
225
226 AC_ARG_ENABLE([ffmpeg_libvorbis],
227   [AS_HELP_STRING([--enable-ffmpeg-libvorbis],
228   [enable FFmpeg vorbis encoding (default is no)])],
229   [use_ffmpeg_libvorbis=$enableval],
230   [use_ffmpeg_libvorbis=no])
231
232 AC_ARG_ENABLE([dvdcss],
233   [AS_HELP_STRING([--enable-dvdcss],
234   [enable DVDCSS support (default is yes)])],
235   [use_dvdcss=$enableval],
236   [use_dvdcss=yes])
237
238 AC_ARG_ENABLE([mid],
239   [AS_HELP_STRING([--enable-mid],
240   [enable MID support (default is no)])],
241   [use_mid=$enableval],
242   [use_mid=no])
243
244 AC_ARG_ENABLE([hal],
245   [AS_HELP_STRING([--disable-hal],
246   [disable HAL support (default is enabled if hal and hal-storage is found)])],
247   [use_hal=$enableval],
248   [use_hal=yes])
249
250 AC_ARG_ENABLE([avahi],
251   [AS_HELP_STRING([--disable-avahi],
252   [disable Avahi support (default is enabled if libavahi-common and libavahi-client is found)])],
253   [use_avahi=$enableval],
254   [use_avahi=yes])
255
256 AC_ARG_ENABLE([non-free],
257   [AS_HELP_STRING([--disable-non-free],
258   [disable componentents with non-compliant licenses])],
259   [use_nonfree=$enableval],
260   [use_nonfree=yes])
261
262 AC_ARG_ENABLE([asap-codec],
263   [AS_HELP_STRING([--enable-asap-codec],
264   [enable ASAP ADPCM support])],
265   [use_asap=$enableval],
266   [use_asap=no])
267
268 AC_ARG_ENABLE([webserver],
269   [AS_HELP_STRING([--disable-webserver],
270   [disable webserver])],
271   [use_webserver=$enableval],
272   [use_webserver=yes])
273
274 AC_ARG_ENABLE([optical-drive],
275   [AS_HELP_STRING([--disable-optical-drive],
276   [disable optical drive])],
277   [use_optical_drive=$enableval],
278   [use_optical_drive=yes])
279
280 AC_ARG_ENABLE([libbluray],
281   [AS_HELP_STRING([--enable-libbluray],
282   [enable libbluray support])],
283   [use_libbluray=$enableval],
284   [use_libbluray=auto])
285
286 AC_ARG_WITH([lirc-device],
287   [AS_HELP_STRING([--with-lirc-device=file],
288   [specify the default LIRC device (default is /dev/lircd)])],
289   [lirc_device=$withval],
290   [lirc_device=/dev/lircd])
291 AC_DEFINE_UNQUOTED([LIRC_DEVICE], ["$lirc_device"], [Default LIRC device])
292
293 ### External libraries options
294 AC_ARG_ENABLE([external-libraries],
295   [AS_HELP_STRING([--enable-external-libraries],
296   [enable use of all supported external libraries (default is no) 'Linux only'])],
297   [use_external_libraries=$enableval],
298   [use_external_libraries=no])
299
300 AC_ARG_ENABLE([external-ffmpeg],
301   [AS_HELP_STRING([--enable-external-ffmpeg],
302   [enable use of external ffmpeg libraries (default is no) 'Linux only'])],
303   [use_external_ffmpeg=$enableval],
304   [use_external_ffmpeg=$use_external_libraries])
305
306 AC_ARG_ENABLE([external-python],
307   [AS_HELP_STRING([--enable-external-python],
308   [enable use of external python library (default is no) 'Linux only'])],
309   [use_external_python=$enableval],
310   [use_external_python=$use_external_libraries])
311
312 ### End of external library options
313
314 if test "x$host_vendor" != "xapple"; then
315   DEFAULT_COMPILE_FLAGS="-fPIC -DPIC -D_REENTRANT"
316   DEFAULT_COMPILE_FLAGS="$DEFAULT_COMPILE_FLAGS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
317 fi
318
319 # Checks for programs.
320 PASSED_CXXFLAGS=$CXXFLAGS # Hack to override autoconf default values
321 AC_PROG_CXX
322 CXXFLAGS="$PASSED_CXXFLAGS $DEFAULT_COMPILE_FLAGS"
323 PASSED_CFLAGS=$CFLAGS # Hack to override autoconf default values
324 AC_PROG_CC
325 AC_PROG_LIBTOOL
326 CFLAGS="$PASSED_CFLAGS $DEFAULT_COMPILE_FLAGS"
327 AC_PROG_AWK
328 AC_PROG_LN_S
329 AC_PROG_MAKE_SET
330 MAKE="${MAKE:-make}"
331
332 # host detection and setup
333 case $host in
334   i*86*-linux-gnu*)
335      ARCH="i486-linux"
336      ;;
337   x86_64-*-linux-gnu*)
338      ARCH="x86_64-linux"
339      ;;
340   arm-apple-darwin*)
341      use_joystick=no
342      use_vdadecoder=no
343      use_vtbdecoder=yes
344      ARCH="arm-osx"
345      SYSROOT="-miphoneos-version-min=4.1 -isysroot $SDKROOT"
346      ARCHTYPE=$HOSTTYPE
347      AC_SUBST([ARCHTYPE])
348      AC_SUBST(ARCH_DEFINES, "-D_ARMEL")
349      ;;
350   i386-apple-darwin*)
351      use_joystick=no
352      use_vtbdecoder=no
353      ARCH="x86-osx"
354      export MACOSX_DEPLOYMENT_TARGET=10.4
355      SYSROOT="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
356      # define i386 or x86_64, cannot use $HOSTTYPE as it reports x86_64 on 10.6 regardless of kernel flavor
357      ARCHTYPE=`uname -m`
358      AC_SUBST([ARCHTYPE])
359      ;;
360   powerpc-apple-darwin*)
361      ARCH="powerpc-osx"
362      export MACOSX_DEPLOYMENT_TARGET=10.4
363      SYSROOT="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
364      # define ppc
365      ARCHTYPE=`arch`
366      AC_SUBST([ARCHTYPE])
367      ;;
368   powerpc-*-linux-gnu*)
369      ARCH="powerpc-linux"
370      AC_SUBST(ARCH_DEFINES, "-D_POWERPC")
371      ;;
372   powerpc64-*-linux-gnu*)
373      ARCH="powerpc64-linux"
374      AC_SUBST(ARCH_DEFINES, "-D_POWERPC64")
375      ;;
376   arm*-*-linux-gnu*)
377      ARCH="arm"
378      AC_SUBST(ARCH_DEFINES, "-D_ARMEL")
379      ;;
380   *)
381      AC_MSG_ERROR(unsupported host ($host))
382 esac
383 AC_SUBST([ARCH])
384
385 # platform debug flags
386 if test "$use_debug" = "yes"; then
387   final_message="$final_message\n  Debugging:\tYes"
388   if test "$use_profiling" = "yes"; then
389     final_message="$final_message\n  Profiling:\tYes"
390     DEBUG_FLAGS="-g -pg -D_DEBUG -Wall"
391   else
392     final_message="$final_message\n  Profiling:\tNo"
393     DEBUG_FLAGS="-g -D_DEBUG -Wall"
394   fi
395 else
396   final_message="$final_message\n  Debugging:\tNo"
397   if test "$use_profiling" = "yes"; then
398     final_message="$final_message\n  Profiling:\tYes"
399     DEBUG_FLAGS="-pg -DNDEBUG=1"
400   else
401     final_message="$final_message\n  Profiling:\tNo"
402     DEBUG_FLAGS="-DNDEBUG=1"
403   fi
404 fi
405 CFLAGS="$CFLAGS $DEBUG_FLAGS"
406 CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
407
408
409 if test "$use_optimizations" = "yes"; then
410   final_message="$final_message\n  Optimization:\tYes"
411   CXXFLAGS="$CXXFLAGS -O2"
412   CFLAGS="$CFLAGS -O2"
413 else
414   final_message="$final_message\n  Optimization:\tNo"
415 fi
416
417
418 # platform specific flags
419 if test "$host_vendor" = "apple" ; then
420   # standard xbmc paths
421   INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/xbmc/osx"
422   if expr "X$host_cpu" : 'Xarm.*' > /dev/null; then
423     use_arch=arm
424   else
425     LIBS="$LIBS -framework IOKit"
426     LIBS="$LIBS -framework Cocoa"
427     LIBS="$LIBS -framework OpenGL"
428     LIBS="$LIBS -framework AppKit"
429     LIBS="$LIBS -framework Carbon"
430     LIBS="$LIBS -framework CoreAudio"
431     LIBS="$LIBS -framework QuickTime"
432     LIBS="$LIBS -framework AudioUnit"
433     LIBS="$LIBS -framework Foundation"
434     LIBS="$LIBS -framework CoreServices"
435     LIBS="$LIBS -framework CoreVideo"
436     LIBS="$LIBS -framework CoreAudio"
437     LIBS="$LIBS -framework AudioToolbox"
438     LIBS="$LIBS -framework CoreFoundation"
439     LIBS="$LIBS -framework DiskArbitration"
440     LIBS="$LIBS -framework ApplicationServices"
441   fi
442 elif expr "X$host_cpu" : 'Xarm.*' > /dev/null; then
443   use_arch=arm
444   CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
445   CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
446   FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
447   if test "$use_tegra" = "yes"; then
448     # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support 
449     SAVE_CFLAGS="$CFLAGS"
450     CFLAGS="-mfpu=vfpv3-d16"
451     AC_COMPILE_IFELSE(
452       [int foo;],
453       [ CFLAGS="$SAVE_CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
454         CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
455         FFMPEG_EXTRACFLAGS+=" -mtune=cortex-a9 -mfpu=vfpv3-d16"
456         use_cpu=cortex-a9],
457       [ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
458         CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"    
459         use_cpu=cortex-a8])
460   else
461     # Compile for ARMv7a architecture, CortexA8 cpu and NEON coprocessor
462     CFLAGS+=" -Wa,-march=armv7a -mcpu=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad"
463     CXXFLAGS+=" -Wa,-march=armv7a -mcpu=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad"
464     FFMPEG_EXTRACFLAGS+=" -mfpu=neon"
465   fi
466 fi
467
468 # Checks for library functions.
469 AC_FUNC_ALLOCA
470 AC_FUNC_CHOWN
471 AC_FUNC_CLOSEDIR_VOID
472 AC_FUNC_ERROR_AT_LINE
473 AC_FUNC_FSEEKO
474 AC_PROG_GCC_TRADITIONAL
475 AC_FUNC_LSTAT
476 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
477 AC_FUNC_MEMCMP
478 AC_FUNC_MKTIME
479 AC_FUNC_MMAP
480 # Boxee is apparently having compile problems
481 # if HAVE_REALLOC is defined.  Sort this later.
482 #AC_FUNC_REALLOC
483 AC_FUNC_SELECT_ARGTYPES
484 AC_FUNC_SETVBUF_REVERSED
485 AC_TYPE_SIGNAL
486 AC_FUNC_STAT
487 AC_FUNC_STRCOLL
488 AC_FUNC_STRFTIME
489 AC_FUNC_STRTOD
490 AC_FUNC_UTIME_NULL
491 AC_FUNC_VPRINTF
492 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])
493
494 # Check for various sizes
495 AC_CHECK_SIZEOF([int])
496 AC_CHECK_SIZEOF([size_t])
497
498 # Add top source directory for all builds so we can use config.h
499 INCLUDES="$INCLUDES -I\$(abs_top_srcdir)"
500
501 # Checks for boost headers using CXX instead of CC
502 AC_LANG_PUSH([C++])
503 AC_CHECK_HEADER([boost/shared_ptr.hpp],, AC_MSG_ERROR($missing_library))
504 AC_LANG_POP([C++])
505
506 # Checks for platforms libraries.
507 if test "$use_gles" = "yes"; then
508   # GLES overwrites GL if both set to yes.
509   if test "$host_vendor" = "apple" ; then
510     AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
511     AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
512     AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
513   else
514     AC_CHECK_LIB([EGL],   [main],, AC_MSG_ERROR($missing_library))
515     AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library))
516   fi
517 else
518   if test "$use_gl" = "yes"; then
519     if test "$host_vendor" = "apple" ; then
520       # linking to OpenGL.framework instead of libGL, libGLU so AC_CHECK_LIB will fail
521       AC_DEFINE([HAVE_LIBGL],[1],["Define to 1 if you have the `GL' library (-lGL)."])
522       AC_MSG_RESULT(== WARNING: OpenGL support is assumed.)
523       AC_DEFINE([HAVE_LIBGLU],[1],["Define to 1 if you have the `GLU' library (-lGLU)."])
524       AC_MSG_RESULT(== WARNING: OpenGLU support is assumed.)
525       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
526     else
527       AC_CHECK_LIB([GL],  [main],, AC_MSG_ERROR($missing_library))
528       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
529       AC_CHECK_LIB([GLU], [main],, AC_MSG_ERROR($missing_library))
530     fi
531   else
532     AC_MSG_RESULT(== WARNING: OpenGL support is disabled. XBMC will run VERY slow. ==)
533     AC_CHECK_LIB([SDL_gfx],[main])
534   fi
535 fi
536
537 # platform common libraries
538 AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
539 if test $MYSQL_CONFIG = "yes"; then
540   INCLUDES="$INCLUDES `mysql_config --include`"
541   LIBS="$LIBS `mysql_config --libs`"
542 else
543   AC_MSG_ERROR($missing_program)
544 fi
545 AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
546 AC_CHECK_HEADER([mad.h],,            AC_MSG_ERROR($missing_library))
547 AC_CHECK_HEADER([jpeglib.h],,        AC_MSG_ERROR($missing_library))
548 AC_CHECK_HEADER([samplerate.h],,     AC_MSG_ERROR($missing_library))
549 AC_CHECK_HEADER([ogg/ogg.h],,        AC_MSG_ERROR($missing_library))
550 AC_CHECK_HEADER([vorbis/vorbisfile.h],, AC_MSG_ERROR($missing_library))
551 AC_CHECK_HEADER([vorbis/vorbisenc.h],, AC_MSG_ERROR($missing_library))
552 AC_CHECK_HEADER([libmodplug/modplug.h],, AC_MSG_ERROR($missing_library))
553 AC_CHECK_HEADER([wavpack/wavpack.h],, AC_MSG_ERROR($missing_library))
554 AC_CHECK_HEADER([FLAC/stream_decoder.h],, AC_MSG_ERROR($missing_library))
555 AC_CHECK_LIB([bz2],         [main],, AC_MSG_ERROR($missing_library))
556 AC_CHECK_LIB([jpeg],        [main],, AC_MSG_ERROR($missing_library)) # check for cximage
557 AC_CHECK_LIB([tiff],        [main],, AC_MSG_ERROR($missing_library))
558 AC_CHECK_LIB([pthread],     [main],, AC_MSG_ERROR($missing_library))
559 AC_CHECK_LIB([lzo2],        [main],, AC_MSG_ERROR($missing_library))
560 AC_CHECK_LIB([z],           [main],, AC_MSG_ERROR($missing_library))
561 AC_CHECK_LIB([ssl],         [main],, AC_MSG_ERROR($missing_library))
562 AC_CHECK_LIB([crypto],      [main],, AC_MSG_ERROR($missing_library))
563 AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
564 AC_CHECK_LIB([ssh],         [sftp_tell64],, AC_MSG_RESULT([Could not find suitable version of libssh]))
565 AC_CHECK_LIB([smbclient],   [main],, AC_MSG_ERROR($missing_library))
566 PKG_CHECK_MODULES([FONTCONFIG], [fontconfig],
567   [INCLUDES="$INCLUDES $FONTCONFIG_CFLAGS"],
568   AC_MSG_ERROR($missing_library))
569 PKG_CHECK_MODULES([FRIBIDI],    [fribidi],
570   [INCLUDES="$INCLUDES $FRIBIDI_CFLAGS"; LIBS="$LIBS $FRIBIDI_LIBS"],
571   AC_MSG_ERROR($missing_library))
572 PKG_CHECK_MODULES([SQLITE3],    [sqlite3],
573   [INCLUDES="$INCLUDES $SQLITE3_CFLAGS"; LIBS="$LIBS $SQLITE3_LIBS"],
574   AC_MSG_ERROR($missing_library))
575 PKG_CHECK_MODULES([PNG],        [libpng],
576   [INCLUDES="$INCLUDES $PNG_CFLAGS"; LIBS="$LIBS $PNG_LIBS"],
577   AC_MSG_ERROR($missing_library))
578 PKG_CHECK_MODULES([PCRE],       [libpcre],
579   [INCLUDES="$INCLUDES $PCRE_CFLAGS"; LIBS="$LIBS $PCRE_LIBS"]; \
580   AC_DEFINE([HAVE_LIBPCRE],[1],["Define to 1 if libpcre is installed"]),
581   AC_MSG_ERROR($missing_library))
582 PKG_CHECK_MODULES([PCRECPP],    [libpcrecpp],
583   [INCLUDES="$INCLUDES $PCRECPP_CFLAGS"; LIBS="$LIBS $PCRECPP_LIBS"]; \
584   AC_DEFINE([HAVE_LIBPCRECPP],[1],["Define to 1 if libpcrecpp is installed"]),
585   AC_MSG_ERROR($missing_library))
586 PKG_CHECK_MODULES([CDIO],       [libcdio],
587   [INCLUDES="$INCLUDES $CDIO_CFLAGS"; LIBS="$LIBS $CDIO_LIBS"],
588   AC_MSG_ERROR($missing_library))
589 PKG_CHECK_MODULES([SAMPLERATE], [samplerate],
590   [INCLUDES="$INCLUDES $SAMPLERATE_CFLAGS"; LIBS="$LIBS $SAMPLERATE_LIBS"],
591   AC_MSG_ERROR($missing_library))
592 PKG_CHECK_MODULES([FREETYPE2],  [freetype2],
593   [INCLUDES="$INCLUDES $FREETYPE2_CFLAGS"; LIBS="$LIBS $FREETYPE2_LIBS"],
594   AC_MSG_ERROR($missing_library))
595 PKG_CHECK_MODULES([CURL],       [libcurl],
596   [INCLUDES="$INCLUDES $CURL_CFLAGS"],
597   AC_MSG_ERROR($missing_library))
598
599 # check for libbluray
600 AS_CASE([x$use_libbluray],
601   [xyes],[
602     PKG_CHECK_MODULES([LIBBLURAY],[libbluray],[use_libbluray="yes"], AC_MSG_ERROR($missing_library))
603   ],
604   [xauto],[
605     PKG_CHECK_MODULES([LIBBLURAY],[libbluray],[use_libbluray="yes"], [use_libbluray="no"])
606   ])
607
608 AS_CASE([x$use_libbluray],
609   [xyes],[
610     INCLUDES="$INCLUDES $LIBBLURAY_CFLAGS";
611     XB_FIND_SONAME([BLURAY], [bluray], [use_libbluray])
612     AC_DEFINE([HAVE_LIBBLURAY], 1, [System has libbluray library])
613     AC_SUBST([HAVE_LIBBLURAY], 1)
614   ],[
615 #    AC_DEFINE([HAVE_LIBBLURAY], 0, [System has libbluray library])
616     AC_SUBST([HAVE_LIBBLURAY], 0)
617   ]
618 )
619
620 # platform dependent libraries
621 if test "$host_vendor" = "apple" ; then
622   AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
623   AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
624   AC_CHECK_HEADER([mpeg2dec/mpeg2convert.h],, AC_MSG_ERROR($missing_library))
625   AC_CHECK_LIB([iconv],     [main],, AC_MSG_ERROR($missing_library))
626   if test "$use_arch" != "arm"; then
627     AC_CHECK_LIB([SDL_mixer],[main],, AC_MSG_ERROR($missing_library))
628     AC_CHECK_LIB([SDL],      [main],, AC_MSG_ERROR($missing_library))
629   fi
630 else
631   AC_CHECK_LIB([ass],        [main],, AC_MSG_ERROR($missing_library))
632   AC_CHECK_LIB([SDL_mixer],  [main],, AC_MSG_ERROR($missing_library))
633   AC_CHECK_LIB([dl],         [main],, AC_MSG_ERROR($missing_library))
634   AC_CHECK_LIB([resolv],     [main],, AC_MSG_ERROR($missing_library))
635   AC_CHECK_LIB([jasper],     [main],, AC_MSG_ERROR($missing_library)) # check for cximage
636   AC_CHECK_LIB([rt],         [clock_gettime],, AC_MSG_ERROR($missing_library))
637   AC_CHECK_LIB([SDL_image],  [main],, AC_MSG_ERROR($missing_library))
638   AC_CHECK_LIB([modplug],    [main],, AC_MSG_ERROR($missing_library))
639   AC_CHECK_LIB([wavpack],    [main],, AC_MSG_ERROR($missing_library))
640   AC_CHECK_LIB([mpeg2],       [main],, AC_MSG_ERROR($missing_library))
641   AC_CHECK_LIB([mpeg2convert],[main],, AC_MSG_ERROR($missing_library))
642
643   PKG_CHECK_MODULES([ALSA],  [alsa],
644     [INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"],
645     AC_MSG_ERROR($missing_library))
646   PKG_CHECK_MODULES([ENCA],  [enca],
647     [INCLUDES="$INCLUDES $ENCA_CFLAGS"; LIBS="$LIBS $ENCA_LIBS"],
648     AC_MSG_ERROR($missing_library))
649   PKG_CHECK_MODULES([XT],    [xt],
650     [INCLUDES="$INCLUDES $XT_CFLAGS"; LIBS="$LIBS $XT_LIBS"],
651     AC_MSG_ERROR($missing_library))
652   PKG_CHECK_MODULES([XEXT],  [xext],
653     [INCLUDES="$INCLUDES $XEXT_CFLAGS"; LIBS="$LIBS $XEXT_LIBS"],
654     AC_MSG_ERROR($missing_library))
655   PKG_CHECK_MODULES([XMU],   [xmu],
656     [INCLUDES="$INCLUDES $XMU_CFLAGS"; LIBS="$LIBS $XMU_LIBS"],
657     AC_MSG_ERROR($missing_library))
658   PKG_CHECK_MODULES([DBUS],  [dbus-1],
659     [INCLUDES="$INCLUDES $DBUS_CFLAGS"; LIBS="$LIBS $DBUS_LIBS"],
660     AC_MSG_ERROR($missing_library))
661   PKG_CHECK_MODULES([SDL],   [sdl],
662     [INCLUDES="$INCLUDES $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS"],
663     AC_MSG_ERROR($missing_library))
664   PKG_CHECK_MODULES([MAD],   [mad],
665     [INCLUDES="$INCLUDES $MAD_CFLAGS"; LIBS="$LIBS $MAD_LIBS"],
666     AC_MSG_ERROR($missing_library))
667   PKG_CHECK_MODULES([OGG],   [ogg],
668     [INCLUDES="$INCLUDES $OGG_CFLAGS"; LIBS="$LIBS $OGG_LIBS"],
669     AC_MSG_ERROR($missing_library))
670   PKG_CHECK_MODULES([VORBIS],[vorbis],
671     [INCLUDES="$INCLUDES $VORBIS_CFLAGS"; LIBS="$LIBS $VORBIS_LIBS"],
672     AC_MSG_ERROR($missing_library))
673   PKG_CHECK_MODULES([VORBISENC],[vorbisenc],
674     [INCLUDES="$INCLUDES $VORBISENC_CFLAGS"; LIBS="$LIBS $VORBISENC_LIBS"],
675     AC_MSG_ERROR($missing_library))
676 fi
677
678 # This is used to skip some submodule configuration on non-Apple hardware
679 HOST_NOT_APPLE=1
680 if [[ "$host_vendor" = "apple" ]]; then
681   HOST_NOT_APPLE=0
682 fi
683
684 XB_FIND_SONAME([MAD],         [mad])
685 XB_FIND_SONAME([OGG],         [ogg])
686 XB_FIND_SONAME([CURL],        [curl])
687 XB_FIND_SONAME([FLAC],        [FLAC])
688 XB_FIND_SONAME([VORBIS],      [vorbis])
689 XB_FIND_SONAME([VORBISENC],   [vorbisenc])
690 XB_FIND_SONAME([VORBISFILE],  [vorbisfile])
691 XB_FIND_SONAME([MODPLUG],     [modplug])
692 if test "$host_vendor" = "apple"; then
693   XB_FIND_SONAME([ASS],       [ass])
694   XB_FIND_SONAME([MPEG2],     [mpeg2])
695   XB_FIND_SONAME([WAVPACK],   [wavpack])
696 fi
697
698 # WebServer
699 if test "$use_webserver" = "yes"; then
700   AC_CHECK_LIB([microhttpd],  [main],, AC_MSG_ERROR($missing_library))
701 fi
702
703 # Optical
704 if test "$use_optical_drive" = "yes"; then
705   AC_DEFINE([HAS_DVD_DRIVE], [1], [Define to 1 to have optical drive support])
706 fi
707
708 # PulseAudio
709 if test "x$use_pulse" != "xno"; then
710   if test "$host_vendor" = "apple" ; then
711     if test "x$use_pulse" = "xyes"; then
712       AC_MSG_ERROR($pulse_disabled)
713     else
714       use_pulse="no"
715       AC_MSG_RESULT($pulse_disabled)
716     fi
717     USE_PULSE=0
718   else
719     AC_CHECK_LIB([pulse], [main],,
720       [if test "x$use_pulse" = "xyes"; then
721         AC_MSG_ERROR($pulse_not_found)
722       else
723         use_pulse=no
724         USE_PULSE=0
725         AC_MSG_RESULT($pulse_not_found)
726       fi])
727       USE_PULSE=1
728   fi
729 else
730   AC_MSG_RESULT($pulse_disabled)
731   USE_PULSE=0
732 fi
733
734 # HAL
735 if test "$host_vendor" = "apple" ; then
736   use_hal="no"
737   AC_MSG_RESULT($hal_disabled)
738 else
739   if test "$use_hal" = "yes"; then
740     PKG_CHECK_MODULES([HAL], [hal],
741       [INCLUDES="$INCLUDES $HAL_CFLAGS"; LIBS="$LIBS $HAL_LIBS"],
742       use_hal=no;AC_MSG_RESULT($hal_not_found))
743     PKG_CHECK_MODULES([HAL_STORAGE], [hal-storage],
744       [INCLUDES="$INCLUDES $HAL_STORAGE_CFLAGS"; LIBS="$LIBS $HAL_STORAGE_LIBS"],
745       use_hal=no;AC_MSG_RESULT($halstorage_not_found))
746   else
747     AC_MSG_RESULT($hal_disabled)
748   fi
749   if test "$use_hal" = "yes"; then
750     AC_DEFINE([HAS_HAL], [1], [Define to 1 if you have HAL installed])
751   fi
752 fi
753
754 # avahi
755 if test "$host_vendor" = "apple" ; then
756   use_avahi="no"
757   AC_MSG_RESULT($avahi_disabled)
758 else
759   if test "$use_avahi" = "yes"; then
760     AC_CHECK_LIB([avahi-common], [main],,
761       use_avahi=no;AC_MSG_RESULT($avahi_not_found))
762     if test "$use_avahi" = "yes"; then
763       #either both libs or none
764       AC_CHECK_LIB([avahi-client], [main],,
765         use_avahi=no;AC_MSG_RESULT($avahi_not_found))
766     fi
767   else
768     AC_MSG_RESULT($avahi_disabled)
769   fi
770 fi
771
772 # XRandR
773 if test "$host_vendor" = "apple" ; then
774   use_xrandr="no"
775   AC_MSG_RESULT($xrandr_disabled)
776 else
777   if test "$use_xrandr" = "yes" ; then
778     AC_CHECK_LIB([Xrandr], [main],, 
779       use_xrandr="no";AC_MSG_RESULT($xrandr_not_found))
780   else
781     AC_MSG_RESULT($xrandr_disabled)
782   fi
783 fi
784
785 # GOOM
786 if test "$host_vendor" = "apple" ; then
787   AC_MSG_NOTICE($goom_disabled)
788   BUILD_GOOM=1
789 else
790   if test "$use_goom" = "yes" && test "use_gl" == "yes"; then
791     AC_MSG_NOTICE($goom_enabled)
792     BUILD_GOOM=0
793   else
794     AC_MSG_NOTICE($goom_disabled)
795     BUILD_GOOM=1
796   fi
797 fi
798
799 # libRTMP
800 if test "$use_librtmp" != "no"; then
801   AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
802    [if test "$use_librtmp" = "yes"; then
803       AC_MSG_ERROR($librtmp_not_found)
804     elif test "$use_librtmp" != "no"; then
805       AC_MSG_NOTICE($librtmp_not_found)
806       use_librtmp="no"
807     fi
808    ])
809   if test "$use_librtmp" != "no"; then
810     XB_FIND_SONAME([RTMP], [rtmp], [use_librtmp])
811   fi
812   if test "$use_librtmp" != "no"; then
813     AC_DEFINE([HAS_LIBRTMP], [1], [Whether to use libRTMP library.])
814   fi
815 else
816   AC_MSG_NOTICE($librtmp_disabled)
817 fi
818
819 ### External libraries checks
820 # External FFmpeg
821 if test "$use_external_ffmpeg" = "yes"; then
822   FFMPEG_LIBNAMES="libavcodec libavformat libavutil libpostproc libswscale"
823
824   # libavcore is optional
825   PKG_CHECK_EXISTS([libavcore], FFMPEG_LIBNAMES="$FFMPEG_LIBNAMES libavcore")
826
827   PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
828                     [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"],
829                     AC_MSG_ERROR($missing_library))
830
831   # Determine whether AVPacket and relevant functions are defined in libavformat
832   # or libavcodec
833   AC_CHECK_LIB([avcodec], [av_free_packet],
834   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavcodec. ==)],
835   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavformat. ==)
836    AC_DEFINE([AVPACKET_IN_AVFORMAT], [1], [Whether AVPacket is in libavformat.])])
837
838   # in case the headers are in a custom directory
839   SAVE_CPPFLAGS="$CPPFLAGS"
840   CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
841
842   # Possible places the ffmpeg headers may be
843   AC_CHECK_HEADERS([libavcodec/avcodec.h libavformat/avformat.h libavutil/avutil.h libpostproc/postprocess.h libswscale/swscale.h],,
844   [AC_CHECK_HEADERS([ffmpeg/avcodec.h ffmpeg/avformat.h ffmpeg/avutil.h postproc/postprocess.h ffmpeg/swscale.h],,
845   [AC_MSG_ERROR($missing_headers)])])
846
847   # optional
848   AC_CHECK_HEADERS([libavcore/avcore.h libavcore/samplefmt.h libavutil/samplefmt.h])
849
850   # old FFmpeg have this in libavcodec/opt.h instead:
851   AC_CHECK_HEADERS([libavutil/opt.h])
852
853   # We'll support the use of rgb2rgb.h if it exists.
854   AC_CHECK_HEADERS([libswscale/rgb2rgb.h],,)
855   AC_CHECK_HEADERS([ffmpeg/rgb2rgb.h],,)
856
857   AC_MSG_NOTICE($external_ffmpeg_enabled)
858   USE_EXTERNAL_FFMPEG=1
859   AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.])
860
861   # Disable vdpau support if external libavcodec doesn't have it
862   AC_CHECK_LIB([avcodec], [ff_vdpau_vc1_decode_picture],,
863     [if test "x$use_vdpau" = "xyes"; then
864       AC_MSG_ERROR($ffmpeg_vdpau_not_supported)
865     else
866       use_vdpau=no
867       AC_MSG_RESULT($ffmpeg_vdpau_not_supported)
868     fi])
869
870   # Check for 'PIX_FMT_VDPAU_MPEG4' from libavutil
871   if test "x$use_vdpau" != "xno"; then
872     AC_LANG_PUSH([C++])
873     AC_LINK_IFELSE(
874       [ #include <libavutil/pixfmt.h>
875         int main() { PixelFormat format = PIX_FMT_VDPAU_MPEG4; }],
876       [AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1],
877       [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])],)
878     AC_LANG_POP([C++])
879   fi
880   CPPFLAGS="$SAVE_CPPFLAGS"
881 else
882   AC_MSG_NOTICE($external_ffmpeg_disabled)
883   USE_EXTERNAL_FFMPEG=0
884   AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1], [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])
885 fi
886
887 # External Python
888 if test "$use_external_python" = "yes"; then
889   AC_CHECK_LIB([python2.6], [main],
890     [AC_DEFINE([HAVE_LIBPYTHON2_6], [1],
891     [Define to 1 if you have the 'python2.6' library.])
892     USE_PYTHON2_6=1],
893   [AC_CHECK_LIB([python2.5], [main],
894     [AC_DEFINE([HAVE_LIBPYTHON2_5], [1],
895     [Define to 1 if you have the 'python2.5' library.])
896     USE_PYTHON2_5=1],
897   [AC_CHECK_LIB([python2.4], [main],
898     [AC_DEFINE([HAVE_LIBPYTHON2_4], [1],
899     [Define to 1 if you have the 'python2.4' library.])
900     USE_PYTHON2_4=1],
901   [AC_MSG_ERROR($missing_library)] )] )] )
902
903   AC_MSG_NOTICE($external_python_enabled)
904   test "$USE_PYTHON2_6" && AC_MSG_NOTICE([Using Python 2.6])
905   test "$USE_PYTHON2_5" && AC_MSG_NOTICE([Using Python 2.5])
906   test "$USE_PYTHON2_4" && AC_MSG_NOTICE([Using Python 2.4])
907   USE_EXTERNAL_PYTHON=1
908   AC_DEFINE([USE_EXTERNAL_PYTHON], [1], [Whether to use external python library.])
909 else
910   AC_MSG_NOTICE($external_python_disabled)
911   USE_EXTERNAL_PYTHON=0
912 fi
913
914 # VDPAU
915 if test "x$use_vdpau" != "xno"; then
916   if test "$host_vendor" = "apple" ; then
917     if test "x$use_vdpau" = "xyes"; then
918       AC_MSG_ERROR([VDPAU not supported on this platform])
919     else
920       use_vdpau="no"
921       AC_MSG_NOTICE($vdpau_disabled)
922     fi
923     USE_VDPAU=0
924   else
925     USE_VDPAU=1
926     AC_CHECK_HEADER([vdpau/vdpau.h],AC_DEFINE([HAVE_LIBVDPAU], [],
927       [Define to 1 if you have the 'vdpau' library (-lvdpau).]),
928     [if test "x$use_vdpau" = "xyes"; then
929       USE_VDPAU=0
930       AC_MSG_ERROR([$vdpau_not_found])
931     else
932       use_vdpau="no"
933       USE_VDPAU=0
934       AC_MSG_RESULT($vdpau_not_found)
935     fi])
936   fi
937 else
938   USE_VDPAU=0
939   AC_MSG_NOTICE($vdpau_disabled)
940 fi
941
942 # VAAPI
943 if test "x$use_vaapi" != "xno"; then
944   if test "$host_vendor" = "apple" ; then
945     if test "x$use_vaapi" = "xyes"; then
946       AC_MSG_ERROR([VAAPI not supported on this platform])
947     else
948       use_vaapi="no"
949       AC_MSG_NOTICE($vaapi_disabled)
950     fi
951     USE_VAAPI=0
952   else
953     initial_val=$use_vaapi
954     AC_CHECK_LIB([va], main, :, use_vaapi=no)
955     if test "x$use_vaapi" != "xno"; then
956       AC_CHECK_LIB([va-glx], main, LIBS="-lva -lva-glx $LIBS", use_vaapi=no, -lva)
957     fi
958
959     if test "x$use_vaapi" = "xno"; then
960       if test "x$initial_val" = "xyes"; then
961         AC_MSG_ERROR($vaapi_not_found)
962       else
963         AC_MSG_RESULT($vaapi_not_found)
964       fi
965       USE_VAAPI=0
966     else
967       AC_DEFINE([HAVE_LIBVA], [1], [Define to 1 if you have the 'vaapi' libraries (-lva AND -lva-glx)])
968       USE_VAAPI=1
969     fi
970   fi
971 else
972   AC_MSG_NOTICE($vaapi_disabled)
973   USE_VAAPI=0
974 fi
975
976 # CrystalHD
977 if test "x$use_crystalhd" != "xno"; then
978   AC_CHECK_HEADER([libcrystalhd/libcrystalhd_if.h], [], 
979     [ if test "x$use_crystalhd" = "xyes"; then
980         AC_MSG_ERROR($crystalhd_not_found)
981       else
982         use_crystalhd=no
983         AC_MSG_RESULT($crystalhd_not_found)
984       fi
985       USE_CRYSTALHD=0
986     ],
987     [#define __LINUX_USER__])
988     if test "$host_vendor" != "apple"; then
989       XB_FIND_SONAME([CRYSTALHD], [crystalhd], [use_crystalhd])
990     fi
991     if test "x$use_crystalhd" != "xno"; then
992       SAVE_CFLAGS="$CFLAGS"
993       CFLAGS="-llibcrystalhd"
994       # check for new crystalhd lib
995       AC_COMPILE_IFELSE(
996         [ #define __LINUX_USER__
997           #include <libcrystalhd/bc_dts_types.h>
998           #include <libcrystalhd/bc_dts_defs.h>
999           PBC_INFO_CRYSTAL bCrystalInfo;],
1000         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [2], [Define to 2 if you have the 'New Broadcom Crystal HD' library.]) ], 
1001         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [1], [Define to 1 if you have the 'Old Broadcom Crystal HD' library.]) ])
1002       CFLAGS="$SAVE_CFLAGS"
1003       USE_CRYSTALHD=1
1004     fi
1005 else
1006   AC_MSG_NOTICE($crystalhd_disabled)
1007   USE_CRYSTALHD=0
1008 fi
1009
1010 # VDADecoder
1011 if test "x$use_vdadecoder" != "xno"; then
1012   if test "$host_vendor" = "apple" ; then
1013     HAVE_LIBVDADECODER=1
1014     AC_DEFINE([HAVE_LIBVDADECODER], [1], [Define to 1 if you have the 'VDADecoder' library.])
1015     AC_MSG_NOTICE($vdadecoder_enabled)
1016     USE_VDA=1
1017   else
1018     if test "x$use_vdadecoder" = "xyes"; then
1019       AC_MSG_ERROR([VDA Decoder not supported on this platform])
1020     else
1021       use_vdadecoder="no"
1022       AC_MSG_NOTICE($vdadecoder_disabled)
1023     fi
1024     USE_VDA=0
1025   fi
1026 else
1027   AC_MSG_NOTICE($vdadecoder_disabled)
1028 fi
1029
1030 # VTBDecoder
1031 if test "x$use_vtbdecoder" != "xno"; then
1032   if test "$host_vendor" = "apple" ; then
1033     HAVE_VIDEOTOOLBOXDECODER=1
1034     AC_DEFINE([HAVE_VIDEOTOOLBOXDECODER], [1], [Define to 1 if you have the 'VTBDecoder' library.])
1035     AC_MSG_NOTICE($vtbdecoder_enabled)
1036   else
1037     if test "x$use_vtbdecoder" = "xyes"; then
1038       AC_MSG_ERROR([VTB Decoder not supported on this platform])
1039     else
1040       use_vtbdecoder="no"
1041       AC_MSG_NOTICE($vtbdecoder_disabled)
1042     fi
1043   fi
1044 else
1045   AC_MSG_NOTICE($vtbdecoder_disabled)
1046 fi
1047
1048 # OpenMax
1049 if test "$host_vendor" = "apple" ; then
1050   use_openmax="no"
1051   USE_OPENMAX=0
1052   AC_MSG_NOTICE($openmax_disabled)
1053 else
1054   if test "$use_openmax" = "yes"; then
1055     AC_CHECK_HEADER([OpenMAX/IL/OMX_Types.h],
1056       AC_DEFINE([HAVE_LIBOPENMAX], [1], [Define to 1 if you have the 'OpenMax' library.]),
1057       use_openmax=no;USE_OPENMAX=0;AC_MSG_RESULT($openmax_not_found))
1058     if test "$use_openmax" = "yes"; then
1059       INCLUDES="$INCLUDES -I/usr/include/OpenMAX/IL"
1060       USE_OPENMAX=1
1061     fi
1062   else
1063     AC_MSG_NOTICE($openmax_disabled)
1064     USE_OPENMAX=0
1065   fi
1066 fi
1067
1068 # platform specific bin utilities
1069 if test "$host_vendor" != "apple" ; then
1070   AC_CHECK_PROG(HAVE_GAWK,gawk,"yes","no",)
1071   if test "$HAVE_GAWK" = "no" ; then
1072     AC_MSG_ERROR($missing_program)
1073   fi
1074 fi
1075
1076 if test "$use_arch" != "arm" ; then
1077   AC_CHECK_PROG(HAVE_CMAKE,cmake,"yes","no",)
1078   if test "$HAVE_CMAKE" = "no" ; then
1079     AC_MSG_ERROR($missing_program)
1080   fi
1081 fi
1082
1083 AC_CHECK_PROG(HAVE_GPERF,gperf,"yes","no",)
1084 if test "$HAVE_GPERF" = "no" ; then
1085   AC_MSG_ERROR($missing_program)
1086 fi
1087
1088 AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",)
1089 if test "$HAVE_UNZIP" = "no" ; then
1090   AC_MSG_ERROR($missing_program)
1091 fi
1092
1093 AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",)
1094 if test "$HAVE_ZIP" = "no" ; then
1095   AC_MSG_ERROR($missing_program)
1096 fi
1097
1098 if test "$ARCH" = "i486-linux" || test "$ARCH" = "x86-freebsd"; then
1099   AC_CHECK_PROG(HAVE_NASM,nasm,"yes","no",)
1100   if test "$HAVE_NASM" = "no" ; then
1101     AC_MSG_ERROR($missing_program)
1102   fi
1103 fi
1104
1105 AC_CHECK_PROG(HAVE_GIT,git,"yes","no",)
1106
1107 # Checks for header files.
1108 AC_HEADER_DIRENT
1109 AC_HEADER_STDC
1110 AC_HEADER_SYS_WAIT
1111 AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h limits.h locale.h \
1112   malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
1113   strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h \
1114   sys/time.h sys/timeb.h sys/vfs.h termios.h unistd.h utime.h wchar.h wctype.h])
1115 AC_CHECK_HEADERS([cdio/iso9660.h],,AC_MSG_ERROR([$missing_headers]))
1116
1117 # Checks for typedefs, structures, and compiler characteristics.
1118 AC_HEADER_STAT
1119 AC_HEADER_STDBOOL
1120 AC_C_CONST
1121 AC_TYPE_UID_T
1122 AC_C_INLINE
1123 AC_TYPE_INT8_T
1124 AC_TYPE_INT16_T
1125 AC_TYPE_INT32_T
1126 AC_TYPE_INT64_T
1127 AC_TYPE_MODE_T
1128 AC_TYPE_OFF_T
1129 AC_TYPE_PID_T
1130 AC_C_RESTRICT
1131 AC_TYPE_SIZE_T
1132 AC_TYPE_SSIZE_T
1133 AC_CHECK_MEMBERS([struct stat.st_rdev])
1134 AC_HEADER_TIME
1135 AC_STRUCT_TM
1136 AC_TYPE_UINT8_T
1137 AC_TYPE_UINT16_T
1138 AC_TYPE_UINT32_T
1139 AC_TYPE_UINT64_T
1140 AC_C_BIGENDIAN
1141
1142 if test "$cross_compiling" = "yes"; then
1143   final_message="$final_message\n  Crosscomp.:\tYes"
1144 else
1145   final_message="$final_message\n  Crosscomp.:\tNo"
1146 fi
1147
1148 final_message="$final_message\n  target ARCH:\t$use_arch"
1149 final_message="$final_message\n  target CPU:\t$use_cpu"
1150
1151 if test "$use_gles" = "yes"; then
1152   final_message="$final_message\n  OpenGLES:\tYes"
1153   USE_OPENGLES=1
1154   USE_OPENGL=0
1155 else
1156   USE_OPENGLES=0
1157   if test "$use_gl" = "yes"; then
1158     final_message="$final_message\n  OpenGL:\tYes"
1159     USE_OPENGL=1
1160   else
1161     final_message="$final_message\n  OpenGL:\tNo (Very Slow)"
1162     SDL_DEFINES="-DHAS_SDL_2D"
1163     USE_OPENGL=0
1164   fi
1165 fi
1166
1167 if test "x$use_vdpau" != "xno"; then
1168   final_message="$final_message\n  VDPAU:\tYes"
1169 else
1170   final_message="$final_message\n  VDPAU:\tNo"
1171 fi
1172
1173 if test "x$use_vaapi" != "xno"; then
1174   final_message="$final_message\n  VAAPI:\tYes"
1175 else
1176   final_message="$final_message\n  VAAPI:\tNo"
1177 fi
1178
1179 if test "x$use_crystalhd" != "xno"; then
1180   final_message="$final_message\n  CrystalHD:\tYes"
1181 else
1182   final_message="$final_message\n  CrystalHD:\tNo"
1183 fi
1184
1185 if test "x$use_vdadecoder" != "xno"; then
1186   final_message="$final_message\n  VDADecoder:\tYes"
1187 else
1188   final_message="$final_message\n  VDADecoder:\tNo"
1189 fi
1190
1191 if test "x$use_vtbdecoder" != "xno"; then
1192   final_message="$final_message\n  VTBDecoder:\tYes"
1193 else
1194   final_message="$final_message\n  VTBDecoder:\tNo"
1195 fi
1196
1197 if test "$use_openmax" != "no"; then
1198   final_message="$final_message\n  OpenMax:\tYes"
1199 else
1200   final_message="$final_message\n  OpenMax:\tNo"
1201 fi
1202
1203 if test "$use_joystick" = "yes"; then
1204   final_message="$final_message\n  Joystick:\tYes"
1205   SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_JOYSTICK"
1206 else
1207   final_message="$final_message\n  Joystick:\tNo"
1208 fi
1209
1210 if test "$use_xrandr" = "yes"; then
1211   final_message="$final_message\n  XRandR:\tYes"
1212 else
1213   final_message="$final_message\n  XRandR:\tNo"
1214 fi
1215
1216 if test "$use_goom" = "yes"; then
1217   final_message="$final_message\n  GOOM:\t\tYes"
1218 else
1219   final_message="$final_message\n  GOOM:\t\tNo"
1220 fi
1221
1222 if test "$use_libbluray" = "yes"; then
1223   final_message="$final_message\n  Bluray:\tYes"
1224 else
1225   final_message="$final_message\n  Bluray:\tNo"
1226 fi
1227
1228 if test "$use_mid" = "yes"; then
1229   final_message="$final_message\n  MID Support:\tYes"
1230   SDL_DEFINES="$SDL_DEFINES -DMID"
1231 else
1232   final_message="$final_message\n  MID Support:\tNo"
1233 fi
1234
1235 if test "x$use_ccache" != "xno"; then
1236   AC_PATH_PROG(CCACHE,ccache,none)
1237   if test "$ac_cv_path_CCACHE" = "none"; then
1238     if test "x$use_ccache" = "xyes"; then
1239       AC_MSG_ERROR([ccache not found.]);
1240     else
1241       AC_MSG_NOTICE([ccache not found. Falling back to default CC])
1242       final_message="$final_message\n  ccache:\tNo"
1243     fi
1244   else
1245     CC="$ac_cv_path_CCACHE $CC"
1246     CXX="$ac_cv_path_CCACHE $CXX"
1247     AC_MSG_NOTICE(enabling ccache)
1248     final_message="$final_message\n  ccache:\tYes"
1249   fi
1250 else
1251   final_message="$final_message\n  ccache:\tNo"
1252 fi
1253
1254 if test "x$use_pulse" != "xno"; then
1255   XBMC_STANDALONE_SH_PULSE=tools/Linux/xbmc-standalone.sh.pulse
1256   final_message="$final_message\n  PulseAudio:\tYes"
1257 else
1258   XBMC_STANDALONE_SH_PULSE=/dev/null
1259   final_message="$final_message\n  PulseAudio:\tNo"
1260 fi
1261
1262 if test "$use_hal" = "yes"; then
1263   final_message="$final_message\n  HAL Support:\tYes"
1264 else
1265   final_message="$final_message\n  HAL Support:\tNo"
1266 fi
1267
1268 # DVDCSS
1269 if test "$use_dvdcss" = "yes"; then
1270   AC_MSG_NOTICE($dvdcss_enabled)
1271   final_message="$final_message\n  DVDCSS:\tYes"
1272   BUILD_DVDCSS=1
1273   SKIP_CONFIG_DVDCSS=0
1274   DVDREAD_CFLAGS="-D_XBMC -DHAVE_DVDCSS_DVDCSS_H"
1275 else
1276   AC_MSG_NOTICE($dvdcss_disabled)
1277   final_message="$final_message\n  DVDCSS:\tNo"
1278   BUILD_DVDCSS=0
1279   SKIP_CONFIG_DVDCSS=1
1280   DVDREAD_CFLAGS="-D_XBMC -UHAVE_DVDCSS_DVDCSS_H"
1281 fi
1282 if test "$use_avahi" = "yes"; then
1283   final_message="$final_message\n  Avahi:\tYes"
1284 else
1285   final_message="$final_message\n  Avahi:\tNo"
1286 fi
1287
1288 if test "$HAVE_GIT" = "yes"; then
1289   GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
1290 fi
1291 if test "$GIT_REV" = ""; then
1292   GIT_REV="Unknown"
1293 fi
1294 if test "$host_vendor" = "apple"; then
1295   echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
1296 else
1297   SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'"
1298 fi
1299
1300 if test "$use_nonfree" = "yes"; then
1301   final_message="$final_message\n  Non-free:\tYes"
1302   HAVE_XBMC_NONFREE=1
1303   AC_DEFINE([HAVE_XBMC_NONFREE], [1], [Define to 1 to enable non-free components.])
1304 else
1305   HAVE_XBMC_NONFREE=0
1306   final_message="$final_message\n  Non-free:\tNo"
1307 fi
1308
1309 if test "$use_asap" = "yes"; then
1310   AC_CHECK_PROG(HAVE_GDC,gdc,"yes","no")
1311   if test "$HAVE_GDC" = "no"; then
1312     AC_MSG_ERROR($missing_program);
1313   fi
1314   AC_CHECK_PROG(HAVE_FPC,fpc,"yes","no")
1315   if test "$HAVE_FPC" = "no"; then
1316     AC_MSG_ERROR($missing_program);
1317   fi
1318   USE_ASAP_CODEC=1
1319   AC_DEFINE([USE_ASAP_CODEC], [1], [Define to 1 to enable ASAP codec.])
1320   final_message="$final_message\n  ASAP Codec:\tYes"
1321 else
1322   USE_ASAP_CODEC=0
1323   final_message="$final_message\n  ASAP Codec:\tNo"
1324 fi
1325
1326 if test "$use_webserver" = "yes"; then
1327   final_message="$final_message\n  Webserver:\tYes"
1328 else
1329   final_message="$final_message\n  Webserver:\tNo"
1330 fi
1331
1332 if test "$use_librtmp" != "no"; then
1333   final_message="$final_message\n  libRTMP support:\tYes"
1334 else
1335   final_message="$final_message\n  libRTMP support:\tNo"
1336 fi
1337
1338 if test "$use_optical_drive" = "yes"; then
1339   final_message="$final_message\n  Optical drive:\tYes"
1340 else
1341   final_message="$final_message\n  Optical drive:\tNo"
1342 fi
1343
1344 ### External libraries messages
1345 if test "$use_external_ffmpeg" = "yes"; then
1346   final_message="$final_message\n  External FFmpeg:\tYes"
1347 else
1348   final_message="$final_message\n  External FFmpeg:\tNo"
1349 fi
1350 if test "$use_external_python" = "yes"; then
1351   final_message="$final_message\n  External Python:\tYes"
1352 else
1353   final_message="$final_message\n  External Python:\tNo"
1354 fi
1355
1356 OUTPUT_FILES="Makefile \
1357     Makefile.include \
1358     addons/skin.confluence/media/Makefile \
1359     xbmc/Makefile \
1360     xbmc/cdrip/Makefile \
1361     xbmc/cores/Makefile \
1362     xbmc/cores/VideoRenderers/Makefile \
1363     xbmc/cores/dvdplayer/Makefile \
1364     lib/Makefile \
1365     lib/libdvd/Makefile \
1366     xbmc/cores/DllLoader/Makefile \
1367     xbmc/cores/dvdplayer/DVDCodecs/Makefile \
1368     xbmc/cores/dvdplayer/DVDCodecs/Audio/Makefile \
1369     xbmc/cores/dvdplayer/DVDCodecs/Overlay/Makefile \
1370     xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile \
1371     xbmc/cores/dvdplayer/DVDDemuxers/Makefile \
1372     xbmc/cores/dvdplayer/DVDSubtitles/Makefile \
1373     xbmc/cores/AudioRenderers/Makefile \
1374     xbmc/cores/paplayer/Makefile \
1375     lib/timidity/Makefile \
1376     lib/xbadpcm/Makefile \
1377     lib/asap/Makefile \
1378     lib/nosefart/Makefile \
1379     lib/libsidplay2/Makefile \
1380     lib/vgmstream/Makefile \
1381     lib/snesapu/SNES/SNESAPU/Makefile \
1382     lib/stsound/StSoundLibrary/Makefile \
1383     xbmc/cores/playercorefactory/Makefile \
1384     xbmc/music/karaoke/Makefile \
1385     xbmc/osx/Makefile \
1386     xbmc/guilib/Makefile \
1387     xbmc/interfaces/Makefile \
1388     xbmc/network/Makefile \
1389     lib/libXBMS/Makefile \
1390     lib/libRTV/Makefile \
1391     lib/libexif/Makefile \
1392     lib/libXDAAP/Makefile \
1393     lib/cmyth/Makefile \
1394     lib/libhdhomerun/Makefile \
1395     lib/jsoncpp/src/lib_json/Makefile \
1396     lib/libsquish/Makefile \
1397     lib/libid3tag/Makefile \
1398     lib/cximage-6.0/Makefile \
1399     xbmc/interfaces/python/linux/Makefile \
1400     lib/libUPnP/Makefile \
1401     xbmc/DllPaths_generated.h \
1402     xbmc/linux/Makefile \
1403     xbmc/filesystem/Makefile \
1404     xbmc/screensavers/rsxs-0.9/xbmc/Makefile \
1405     xbmc/visualizations/XBMCProjectM/Makefile \
1406     xbmc/visualizations/Goom/Makefile \
1407     xbmc/visualizations/OpenGLSpectrum/Makefile \
1408     xbmc/visualizations/WaveForm/Makefile \
1409     xbmc/visualizations/iTunes/Makefile \
1410     tools/Linux/xbmc.sh \
1411     tools/Linux/xbmc-standalone.sh \
1412     tools/TexturePacker/Makefile \
1413     tools/EventClients/Clients/OSXRemote/Makefile"
1414
1415 # Line below is used so we can use AM_INIT_AUTOMAKE. The corresponding
1416 # .dummy.am does nothing.
1417 AC_CONFIG_FILES([.dummy])
1418
1419 AC_CONFIG_FILES([${OUTPUT_FILES}])
1420 OUTPUT_FILES="$OUTPUT_FILES \
1421   .dummy"
1422 AC_SUBST(CFLAGS)
1423 AC_SUBST(CXXFLAGS)
1424 AC_SUBST(INCLUDES)
1425 AC_SUBST(LDFLAGS)
1426 AC_SUBST(SYSROOT)
1427 AC_SUBST(SDL_DEFINES)
1428 AC_SUBST(BUILD_DVDCSS)
1429 AC_SUBST(BUILD_GOOM)
1430 AC_SUBST(USE_EXTERNAL_FFMPEG)
1431 AC_SUBST(USE_EXTERNAL_PYTHON)
1432 AC_SUBST(USE_PYTHON2_6)
1433 AC_SUBST(USE_PYTHON2_5)
1434 AC_SUBST(USE_PYTHON2_4)
1435 AC_SUBST(OUTPUT_FILES)
1436 AC_SUBST(HAVE_XBMC_NONFREE)
1437 AC_SUBST(USE_ASAP_CODEC)
1438 AC_SUBST(LIBCURL_BASENAME)
1439 AC_SUBST(LIBFLAC_BASENAME)
1440 AC_SUBST(LIBVORBISFILE_BASENAME)
1441 AC_SUBST(LIBMODPLUG_BASENAME)
1442 AC_SUBST(LIBMAD_BASENAME)
1443 AC_SUBST(LIBOGG_BASENAME)
1444 AC_SUBST(LIBVORBISENC_BASENAME)
1445 AC_SUBST(LIBVORBIS_BASENAME)
1446 AC_SUBST(LIBWAVPACK_BASENAME)
1447 AC_SUBST(LIBASS_BASENAME)
1448 AC_SUBST(LIBMEPG2_BASENAME)
1449 AC_SUBST_FILE(XBMC_STANDALONE_SH_PULSE)
1450 AC_SUBST(USE_OPENGL)
1451 AC_SUBST(USE_OPENGLES)
1452 AC_SUBST(USE_VDPAU)
1453 AC_SUBST(USE_VAAPI)
1454 AC_SUBST(USE_CRYSTALHD)
1455 AC_SUBST(USE_VDA)
1456 AC_SUBST(USE_OPENMAX)
1457 AC_SUBST(USE_PULSE)
1458
1459 # pushd and popd are not available in other shells besides bash, so implement
1460 # our own pushd/popd functions
1461 XB_DIRSTACK="$PWD"
1462 xb_pushd()
1463 {
1464   local dirname="$1"
1465   if [[ -d "$dirname" ]] && [[ -x "$dirname" ]]; then
1466     cd "$dirname"
1467     XB_DIRSTACK="$dirname ${XB_DIRSTACK:-$PWD}"
1468     return 0
1469   else
1470     AC_MSG_ERROR(xb_pushd: unable to change to $dirname)
1471   fi
1472 }
1473 xb_popd()
1474 {
1475   if [[ -n "$XB_DIRSTACK" ]]; then
1476     XB_DIRSTACK="${XB_DIRSTACK#* }"
1477     cd "${XB_DIRSTACK%% *}"
1478     return 0
1479   else
1480     AC_MSG_ERROR(xb_popd: unable to go back to previous directory)
1481   fi
1482 }
1483
1484 # Function to run the configure scripts in our submodules
1485 # Consists of three paramaters, the path to the submodule, the configure command
1486 # with appropriate arguments, and a third parameter set to 1 if we are to skip
1487 # running the script, anything else if not.
1488 AC_DEFUN([XB_CONFIG_MODULE],[
1489 AC_CONFIG_COMMANDS_POST([
1490 if [[ $3 != "1" ]]; then
1491     if [[ -d $1 ]]; then
1492       xb_pushd $1
1493       $2
1494       if [[ $? -ne 0 ]]; then
1495         xb_popd
1496         AC_MSG_ERROR([[Submodule $1 failed to configure]])
1497       else
1498         xb_popd
1499       fi
1500     else
1501       AC_MSG_ERROR([[Submodule $1 does not exist]])
1502     fi
1503 else
1504     AC_MSG_NOTICE([[Skipping configuration of submodule $1.]])
1505 fi
1506 ])
1507 ])
1508
1509 XB_CONFIG_MODULE([lib/python], [
1510   if test "$host_vendor" = "apple" ; then
1511     ./configure \
1512       --host=$host_alias \
1513       --build=$build_alias \
1514       --target=$target_alias \
1515       --enable-ipv6 \
1516       --enable-unicode=ucs4 \
1517       --without-cxx \
1518       --enable-shared \
1519       --without-pymalloc \
1520       --with-suffix=.exe \
1521       LDFLAGS="-L/opt/local/lib" \
1522       OPT="-Wno-deprecated-declarations -I/opt/local/include" \
1523       CFLAGS="$CFLAGS" &&
1524     sed -i bak -e "s/define HAVE_GETC_UNLOCKED 1/undef HAVE_GETC_UNLOCKED/" pyconfig.h && 
1525     sed -i bak -e "s/define HAVE_FSEEKO 1/undef HAVE_FSEEKO/" pyconfig.h &&
1526     sed -i bak -e "s/define HAVE_FTELLO 1/undef HAVE_FTELLO/" pyconfig.h &&
1527     sed -i bak -e "s/define HAVE_FTRUNCATE 1/undef HAVE_FTRUNCATE/" pyconfig.h &&
1528     sed -i bak -e "s/define HAVE_FPATHCONF 1/undef HAVE_FPATHCONF/" pyconfig.h &&
1529     sed -i bak -e "s/define HAVE_FSYNC 1/undef HAVE_FSYNC/" pyconfig.h &&
1530     sed -i bak -e "s/define HAVE_FCHDIR 1/undef HAVE_FCHDIR/" pyconfig.h &&
1531     sed -i bak -e "s/define _POSIX_C_SOURCE 200112L/undef _POSIX_C_SOURCE/" pyconfig.h &&
1532     sed -i bak -e "s/define _XOPEN_SOURCE 600/undef _XOPEN_SOURCE/" pyconfig.h &&
1533     sed -i bak -e "s/define _XOPEN_SOURCE_EXTENDED 1/undef _XOPEN_SOURCE_EXTENDED/" pyconfig.h &&
1534     echo "#define   SETPGRP_HAVE_ARG 1" >> pyconfig.h &&
1535     cp pyconfig.h Include       
1536   else
1537     ./configure \
1538       --host=$host_alias \
1539       --build=$build_alias \
1540       --target=$target_alias \
1541       --disable-ipv6 \
1542       --enable-unicode=ucs4 \
1543       --without-cxx \
1544       --enable-shared \
1545       --without-pymalloc \
1546       --prefix=`pwd`/../../xbmc/interfaces/python/linux/python-lib CFLAGS="$CFLAGS" \
1547       CC="$CC" \
1548       CXX="$CXX" &&
1549     sed -i -e "s/define HAVE_GETC_UNLOCKED 1/undef HAVE_GETC_UNLOCKED/" pyconfig.h &&
1550     sed -i -e "s/define _POSIX_C_SOURCE 200112L/undef _POSIX_C_SOURCE/" pyconfig.h &&
1551     sed -i -e "s/define _XOPEN_SOURCE 600/undef _XOPEN_SOURCE/" pyconfig.h &&
1552     cp pyconfig.h Include
1553   fi
1554 ], [$USE_EXTERNAL_PYTHON])
1555
1556 XB_CONFIG_MODULE([lib/ffmpeg], [
1557   if test "$host_vendor" = "apple" ; then
1558     ./configure \
1559       --extra-cflags="$CFLAGS $FFMPEG_EXTRACFLAGS -w -D_DARWIN_C_SOURCE -Dattribute_deprecated=" \
1560       `if test "$cross_compiling" = "yes"; then echo --enable-cross-compile; fi` \
1561       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
1562       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
1563       --target-os=$(tolower $(uname -s)) \
1564       --disable-amd3dnow \
1565       --disable-armv5te \
1566       --disable-armv6t2 \
1567       `if test "$use_arch" != "yes"; then echo --enable-neon; fi`\
1568       --disable-static \
1569       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
1570       --disable-muxers \
1571       --enable-muxer=spdif \
1572       --enable-muxer=adts \
1573       --disable-encoders \
1574       --enable-encoder=ac3 \
1575       --enable-encoder=aac \
1576       `if test "$use_ffmpeg_libvorbis" == "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
1577       --disable-devices \
1578       --disable-ffprobe \
1579       --disable-ffplay \
1580       --disable-ffserver \
1581       --disable-ffmpeg \
1582       --enable-shared \
1583       --disable-doc \
1584       --disable-decoder=mpeg_xvmc \
1585       --enable-postproc \
1586       --enable-gpl \
1587       --enable-protocol=http \
1588       --enable-pthreads \
1589       --enable-runtime-cpudetect \
1590       --cc="$CC" &&
1591     sed -i "" -e "s#YASM=yasm#YASM=${prefix}/bin/yasm#" config.mak &&
1592     sed -i "" -e "s#YASMDEP=yasm#YASMDEP=${prefix}/bin/yasm#" config.mak &&
1593     sed -i "" -e "s# -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 # #" config.mak
1594   else
1595     CFLAGS="" \
1596     LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")" \
1597     ./configure \
1598       --extra-cflags="$PASSED_CFLAGS $FFMPEG_EXTRACFLAGS" \
1599       --disable-static \
1600       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
1601       `if test "$cross_compiling" = "yes"; then echo --enable-cross-compile; fi` \
1602       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
1603       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
1604       --target-os=$(tolower $(uname -s)) \
1605       --disable-muxers \
1606       --enable-muxer=spdif \
1607       --enable-muxer=adts \
1608       --disable-encoders \
1609       --enable-encoder=ac3 \
1610       --enable-encoder=aac \
1611       `if test "$use_ffmpeg_libvorbis" == "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
1612       --disable-decoder=mpeg_xvmc \
1613       --disable-devices \
1614       --disable-ffprobe \
1615       --disable-ffplay \
1616       --disable-ffserver \
1617       --disable-ffmpeg \
1618       --enable-shared \
1619       --disable-doc \
1620       --enable-postproc \
1621       --enable-gpl \
1622       `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \
1623       `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \
1624       --enable-protocol=http \
1625       --enable-pthreads \
1626       --enable-runtime-cpudetect \
1627       --custom-libname-with-major="\$(FULLNAME)-\$(LIBMAJOR)-${ARCH}\$(SLIBSUF)" \
1628       `case $host_cpu in i?86*) echo --disable-pic ;; *) echo --enable-pic ;; esac` \
1629       --cc="$CC" &&
1630       sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h &&
1631       sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h
1632   fi
1633 ], [$USE_EXTERNAL_FFMPEG])
1634
1635 XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [
1636   if test "$host_vendor" = "apple" ; then
1637     ./configure \
1638     CFLAGS="$CFLAGS -fno-common" \
1639       --host=$host_alias \
1640       --build=$build_alias \
1641       --target=$target_alias \
1642       --disable-doc \
1643       --enable-static \
1644       --with-pic
1645   else
1646     ./configure \
1647       CC="$CC" \
1648       CXX="$CXX" \
1649       CFLAGS="$CFLAGS" \
1650       --host=$host_alias \
1651       --build=$build_alias \
1652       --target=$target_alias \      
1653       --disable-doc \
1654       --enable-static \
1655       --with-pic
1656   fi
1657 ], [$SKIP_CONFIG_DVDCSS])
1658
1659 XB_CONFIG_MODULE([lib/libdvd/libdvdread], [
1660   if test "$host_vendor" = "apple" ; then
1661     ./configure2 \
1662       --host=$host_alias \
1663       --build=$build_alias \
1664       --target=$target_alias \
1665       --extra-cflags="$CFLAGS -fno-common $DVDREAD_CFLAGS -D__DARWIN__ -I`pwd`/../libdvdcss/src" \
1666       --enable-static \
1667       --disable-shared \
1668       --cc="$CC" &&
1669     $MAKE dvdread-config &&
1670     mkdir -p `pwd`/../includes/dvdread
1671     cp `pwd`/../libdvdread/src/*.h `pwd`/../includes/dvdread
1672   else
1673     ./configure2 \
1674       --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../libdvdcss/src" \
1675       --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
1676       --host=$host_alias \
1677       --build=$build_alias \
1678       --target=$target_alias \      
1679       --enable-static \
1680       --disable-shared \
1681       --disable-strip \
1682       --disable-opts \
1683       --cc="$CC" &&
1684     $MAKE dvdread-config &&
1685     mkdir -p `pwd`/../includes/dvdread
1686     cp `pwd`/../libdvdread/src/*.h `pwd`/../includes/dvdread
1687   fi
1688
1689 ], [0])
1690
1691 XB_CONFIG_MODULE([lib/libdvd/libdvdnav], [
1692   if test "$host_vendor" = "apple" ; then
1693     ./configure2 \
1694       --host=$host_alias \
1695       --build=$build_alias \
1696       --target=$target_alias \
1697       --extra-cflags="$CFLAGS -fno-common $DVDREAD_CFLAGS -I`pwd`/../includes" \
1698       --extra-ldflags="-L`pwd`/../libdvdread/obj" \
1699       --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
1700       --enable-static \
1701       --disable-shared \
1702       --cc="$CC"
1703   else
1704     ./configure2 \
1705       --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../includes" \
1706       --extra-ldflags="-L`pwd`/../libdvdread/obj" \
1707       --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
1708       --host=$host_alias \
1709       --build=$build_alias \
1710       --target=$target_alias \      
1711       --enable-static \
1712       --disable-shared \
1713       --cc="$CC"
1714   fi
1715 ], [0])
1716
1717 XB_CONFIG_MODULE([lib/libid3tag/libid3tag],[
1718   if test "$host_vendor" = "apple" ; then
1719     CFLAGS="$CFLAGS -fno-common" \
1720     LDFLAGS="-Wl,-read_only_relocs,suppress" \
1721     ./configure \
1722       --host=$host_alias \
1723       --build=$build_alias \
1724       --target=$target_alias \
1725       --disable-static \
1726       --disable-debugging \
1727       --with-pic
1728   else
1729     ./configure \
1730       CC="$CC" \
1731       CXX="$CXX" \
1732       CFLAGS="$CFLAGS" \ 
1733       CXXFLAGS="$CXXFLAGS" \
1734       --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
1735       --host=$host_alias \
1736       --build=$build_alias \
1737       --target=$target_alias \      
1738       --disable-static \
1739       --with-pic
1740   fi
1741 ], [0])
1742
1743 XB_CONFIG_MODULE([xbmc/visualizations/XBMCProjectM/libprojectM],[
1744   if test "$host_vendor" = "apple" ; then
1745   if test "$use_arch" != "arm" ; then
1746     rm -f CMakeCache.txt && CC="$CC" CXX="$CXX" cmake -DCMAKE_BUILD_TYPE=None -DUSE_FTGL:BOOL=OFF \
1747       -DCMAKE_C_FLAGS:STRING="${CPPFLAGS} ${CFLAGS} -fno-common" -DCMAKE_CXX_FLAGS:STRING="${CPPFLAGS} ${CXXFLAGS} -fno-common"
1748   fi
1749   else
1750 set -x
1751     rm -f CMakeCache.txt && CC="$CC" CXX="$CXX" cmake -DCMAKE_BUILD_TYPE=None -DUSE_FTGL:BOOL=OFF \
1752       -DCMAKE_C_FLAGS:STRING="${CFLAGS}" -DCMAKE_CXX_FLAGS:STRING="${CXXFLAGS}" \
1753       -DCMAKE_INSTALL_PREFIX="${prefix}" -DCMAKE_INSTALL_LIBDIR:PATH="${libdir}" \
1754       -DINCLUDE_INSTALL_DIR:PATH="${includedir}" -DLIB_INSTALL_DIR:PATH="${libdir}" \
1755       -DSYSCONF_INSTALL_DIR:PATH="${sysconfdir}" -DSHARE_INSTALL_PREFIX:PATH="${datadir}" .
1756 set +x
1757   fi
1758 ], [0])
1759
1760 XB_CONFIG_MODULE([xbmc/visualizations/Goom/goom2k4-0],[
1761   if test "$host_vendor" != "apple" ; then
1762     ./configure  \
1763         CFLAGS="$CFLAGS" \ 
1764         CXXFLAGS="$CXXFLAGS" \
1765       --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
1766       --host=$host_alias \
1767       --build=$build_alias \
1768       --target=$target_alias \      
1769       --disable-shared \
1770       --enable-static \
1771       --with-pic
1772   fi
1773 ], [$BUILD_GOOM])
1774
1775 XB_CONFIG_MODULE([xbmc/screensavers/rsxs-0.9/], [
1776 if expr "X$host_cpu" : 'Xarm.*' > /dev/null; then :; else
1777   if test "$host_vendor" = "apple" ; then
1778     ./configure \
1779       CFLAGS="$CFLAGS" \
1780       CXXFLAGS="$CXXFLAGS" \
1781       LDFLAGS="$LDFLAGS" \
1782       LIBS="-lz" \
1783       --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib \
1784       --host=$host_alias \
1785       --build=$build_alias \
1786       --target=$target_alias \
1787       --without-xscreensaver \
1788       --disable-sound \
1789       --disable-cyclone \
1790       --disable-fieldlines \
1791       --disable-flocks \
1792       --disable-flux \
1793       --disable-helios \
1794       --disable-hyperspace \
1795       --disable-lattice \
1796       --disable-skyrocket
1797   else
1798     ./configure \
1799       CC="$CC" \
1800       CXX="$CXX" \
1801       CFLAGS="$CFLAGS" \ 
1802       CXXFLAGS="$CXXFLAGS" \
1803       --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
1804       --host=$host_alias \
1805       --build=$build_alias \
1806       --target=$target_alias \      
1807       --without-xscreensaver \
1808       --disable-sound \
1809       --disable-cyclone \
1810       --disable-fieldlines \
1811       --disable-flocks \
1812       --disable-flux \
1813       --disable-helios \
1814       --disable-hyperspace \
1815       --disable-lattice \
1816       --disable-skyrocket
1817   fi
1818 fi
1819 ], [0])
1820
1821 XB_CONFIG_MODULE([lib/libapetag], [
1822   if test "$host_vendor" = "apple" ; then
1823     CFLAGS="$CFLAGS -fno-common" \
1824     ./configure --disable-shared \
1825       --host=$host_alias \
1826       --build=$build_alias \
1827       --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
1828   else
1829     ./configure \
1830       --host=$host_alias \
1831       --build=$build_alias \
1832       --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
1833   fi
1834 ], [0])
1835
1836 XB_CONFIG_MODULE([lib/cpluff], [
1837   if test "$host_vendor" = "apple" ; then
1838     ./configure --disable-nls \
1839       --host=$host_alias \
1840       --build=$build_alias \
1841       --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX" LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"    
1842   else
1843     ./configure --disable-nls \
1844       --host=$host_alias \
1845       --build=$build_alias \
1846       --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
1847   fi
1848 ], [0])
1849
1850 AC_OUTPUT
1851
1852 final_message="$final_message\n  prefix:\t$prefix\n$dashes"
1853 echo -e "$final_message\n"