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