Merge pull request #473 from Montellese/onplaybackspeedchanged
[vuplus_xbmc] / configure.in
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT([xbmc], [11.0], [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_FILENAME=$($CC -nostdlib -o /dev/null $LDFLAGS -l$2 -Wl,-M 2>/dev/null | grep "^LOAD.*$2" | awk '{V=2; print $V}')
24     if [[ ! -z $$1_FILENAME ]]; then
25       $1_SONAME=$(objdump -p $$1_FILENAME | grep "SONAME.*$2" | awk '{V=2; print $V}')
26     fi
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 # Function to push and pop libs and includes for a command
61 AC_DEFUN([XB_PUSH_FLAGS], [
62   SAVE_LIBS="$LIBS"
63   SAVE_INCLUDES="$INCLUDES"
64   LIBS="[$2]"
65   INCLUDES="[$1]"
66   [$3]
67   LIBS="$SAVE_LIBS"
68   INCLUDES="$SAVE_INCLUDES"
69 ])
70
71 # General message strings
72 configure_debug="ERROR: this is a configure debug statement"
73 missing_library="Could not find a required library. Please see the README for your platform."
74 missing_headers="Could not find some required headers. Please see the README for your platform."
75 missing_program="Could not find a required program. Please see the README for your platform."
76 xrandr_not_found="== Could not find libXRandR. SDL will be used for resolution support. =="
77 xrandr_disabled="== XRandR support disabled. SDL will be used for resolution support. =="
78 goom_enabled="== GOOM enabled. =="
79 goom_disabled="== GOOM disabled. =="
80 rsxs_enabled="== RSXS enabled. =="
81 rsxs_disabled="== RSXS disabled. =="
82 projectm_enabled="== ProjectM enabled. =="
83 projectm_disabled="== ProjectM disabled. =="
84 x11_enabled="== X11 enabled. =="
85 x11_disabled="== X11 disabled. =="
86 pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
87 pulse_disabled="== PulseAudio support manually disabled. =="
88 dvdcss_enabled="== DVDCSS support enabled. =="
89 dvdcss_disabled="== DVDCSS support disabled. =="
90 hal_not_found="== Could not find hal. HAL support disabled. =="
91 halstorage_not_found="== Could not find hal-storage. HAL support disabled. =="
92 hal_disabled="== HAL support disabled. =="
93 avahi_not_found="== Could not find libavahi-common or libavahi-client. Avahi support disabled. =="
94 avahi_disabled="== Avahi support disabled. =="
95 vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
96 vdpau_disabled="== VDPAU support manually disabled. =="
97 vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
98 vaapi_disabled="== VAAPI support manually disabled. =="
99 crystalhd_not_found="== Could not find libcrystalhd. CrystalHD support disabled. =="
100 crystalhd_disabled="== CrystalHD support manually disabled. =="
101 vdadecoder_enabled="== VDADecoder support enabled. =="
102 vdadecoder_disabled="== VDADecoder support manually disabled. =="
103 vtbdecoder_enabled="== VTBDecoder support enabled. =="
104 vtbdecoder_disabled="== VTBDecoder support manually disabled. =="
105 openmax_disabled="== OpenMax support manually disabled. =="
106 openmax_not_found="== Could not find libnvomx. OpenMax support disabled. =="
107 ssh_not_found="== Could not find libssh. SSH FTP VFS support disabled. =="
108 librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
109 librtmp_disabled="== RTMP support disabled. =="
110 libnfs_not_found="== Could not find libnfs. NFS client support disabled. =="
111 libnfs_disabled="== NFS support disabled. =="
112 libafpclient_not_found="== Could not find libafpclient. AFP client support disabled. =="
113 libafpclient_disabled="== AFP support disabled. =="
114 libshairport_not_found="== Could not find libshairport. AirTunes support disabled. =="
115 libshairport_disabled="== AirTunes support disabled. =="
116 samba_disabled="== SAMBA support disabled. =="
117 libplist_not_found="== Could not find libplist. AirPlay support disabled. =="
118 libplist_disabled="== AirPlay support disabled. =="
119 alsa_not_found="== Could not find ALSA. ALSA support disabled. =="
120 dbus_not_found="== Could not find DBUS. DBUS support disabled. =="
121
122 libudev_not_found="== Could not find libudev. Will use polling to check for device changes. =="
123 libudev_disabled="== udev support disabled. Will use polling to check for device changes. =="
124 libusb_not_found="== Could not find libusb. Plug and play USB device support will not be available. =="
125 libusb_disabled="== libusb disabled. Plug and play USB device support will not be available. =="
126 libcec_enabled="== libCEC enabled. =="
127 libcec_disabled="== libCEC disabled. CEC adapter support will not be available. =="
128 libcec_internal="== Using internal libCEC. =="
129 libcec_external_missing="== libCEC was not found on your system.  =="
130
131 # External library message strings
132 external_libraries_enabled="== Use of all supported external libraries enabled. =="
133 external_libraries_disabled="== Use of all supported external libraries disabled. =="
134 external_ffmpeg_enabled="== Use of external ffmpeg enabled. =="
135 external_ffmpeg_disabled="== Use of external ffmpeg disabled. =="
136 ffmpeg_vdpau_not_supported="== External ffmpeg doesn't support VDPAU. VDPAU support disabled. =="
137 dashes="------------------------"
138 final_message="\n  XBMC Configuration:"
139 final_message="\n$dashes$final_message\n$dashes"
140
141
142 AC_ARG_ENABLE([debug],
143   [AS_HELP_STRING([--enable-debug],
144   [enable debugging information (default is yes)])],
145   [use_debug=$enableval],
146   [use_debug=yes])
147
148 AC_ARG_WITH([arch],
149   [AS_HELP_STRING([--with-arch],
150   [build with given arch passing to internal ffmpeg (default is no, needed for crosscompiling)])],
151   [use_arch=$withval],
152   [use_arch=no])
153
154 AC_ARG_WITH([cpu],
155   [AS_HELP_STRING([--with-cpu],
156   [build with given cpu passing to ffmpeg (default is no)])],
157   [use_cpu=$withval],
158   [use_cpu=no])
159
160 AC_ARG_ENABLE([optimizations],
161   [AS_HELP_STRING([--enable-optimizations],
162   [enable optimization (default is yes)])],
163   [use_optimizations=$enableval],
164   [use_optimizations=yes])
165
166 AC_ARG_ENABLE([gl],
167   [AS_HELP_STRING([--enable-gl],
168   [enable OpenGL rendering (default is yes)])],
169   [use_gl=$enableval],
170   [use_gl=yes])
171
172 AC_ARG_ENABLE([gles],
173   [AS_HELP_STRING([--enable-gles],
174   [enable OpenGLES rendering (default is no)])],
175   [use_gles=$enableval],
176   [use_gles=no])
177
178 AC_ARG_ENABLE([sdl],
179   [AS_HELP_STRING([--enable-sdl],
180   [enable SDL (default is auto)])],
181   [use_sdl=$enableval],
182   [use_sdl=auto])
183
184 AC_ARG_ENABLE([vdpau],
185   [AS_HELP_STRING([--enable-vdpau],
186   [enable VDPAU decoding (default is auto)])],
187   [use_vdpau=$enableval],
188   [use_vdpau=auto])
189
190 AC_ARG_ENABLE([vaapi],
191   [AS_HELP_STRING([--enable-vaapi],
192   [enable VAAPI decoding (default is auto)])],
193   [use_vaapi=$enableval],
194   [use_vaapi=auto])
195
196 AC_ARG_ENABLE([crystalhd],
197   [AS_HELP_STRING([--enable-crystalhd],
198   [enable CrystalHD decoding (default is auto)])],
199   [use_crystalhd=$enableval],
200   [use_crystalhd=auto])
201
202 AC_ARG_ENABLE([vdadecoder],
203   [AS_HELP_STRING([--enable-vdadecoder],
204   [enable VDADecoder decoding (default is auto)])],
205   [use_vdadecoder=$enableval],
206   [use_vdadecoder=auto])
207
208 AC_ARG_ENABLE([vtbdecoder],
209   [AS_HELP_STRING([--enable-vtbdecoder],
210   [enable VTBDecoder decoding (default is auto)])],
211   [use_vtbdecoder=$enableval],
212   [use_vtbdecoder=auto])
213
214 AC_ARG_ENABLE([openmax],
215   [AS_HELP_STRING([--enable-openmax],
216   [enable OpenMax decoding (default is auto, requires OpenGLES)])],
217   [use_openmax=$enableval],
218   [use_openmax=auto])
219
220 AC_ARG_ENABLE([tegra],
221   [AS_HELP_STRING([--enable-tegra],
222   [enable Tegra2 arm (default is no)])],
223   [use_tegra=$enableval],
224   [use_tegra=no])
225
226 AC_ARG_ENABLE([profiling],
227   [AS_HELP_STRING([--enable-profiling],
228   [enable gprof profiling (default is no)])],
229   [use_profiling=$enableval],
230   [use_profiling=no])
231
232 AC_ARG_ENABLE([joystick],
233   [AS_HELP_STRING([--enable-joystick],
234   [enable SDL joystick support (default is yes)])],
235   [use_joystick=$enableval],
236   [use_joystick=yes])
237
238 AC_ARG_ENABLE([xrandr],
239   [AS_HELP_STRING([--enable-xrandr],
240   [enable XRandR support (default is yes)])],
241   [use_xrandr=$enableval],
242   [use_xrandr=yes])
243
244 AC_ARG_ENABLE([goom],
245   [AS_HELP_STRING([--enable-goom],
246   [enable GOOM visualisation (default is no)])],
247   [use_goom=$enableval],
248   [use_goom=no])
249
250 AC_ARG_ENABLE([rsxs],
251   [AS_HELP_STRING([--enable-rsxs],
252   [enable really slick X screensavers (default is yes)])],
253   [use_rsxs=$enableval],
254   [use_rsxs=yes])
255
256 AC_ARG_ENABLE([projectm],
257   [AS_HELP_STRING([--enable-projectm],
258   [enable ProjectM visualisation (default is yes)])],
259   [use_projectm=$enableval],
260   [use_projectm=yes])
261
262 AC_ARG_ENABLE([x11],
263   [AS_HELP_STRING([--enable-x11],
264   [enable x11 (default is yes) 'Linux Only'])],
265   [use_x11=$enableval],
266   [use_x11=yes])
267
268 AC_ARG_ENABLE([ccache],
269   [AS_HELP_STRING([--enable-ccache],
270   [enable building with ccache feature (default is auto)])],
271   [use_ccache=$enableval],
272   [use_ccache=auto])
273
274 AC_ARG_ENABLE([pulse],
275   [AS_HELP_STRING([--enable-pulse],
276   [enable PulseAudio support (default is auto)])],
277   [use_pulse=$enableval],
278   [use_pulse=auto])
279
280 AC_ARG_ENABLE([rtmp],
281   [AS_HELP_STRING([--enable-rtmp],
282   [enable RTMP support via librtmp (default is auto)])],
283   [use_librtmp=$enableval],
284   [use_librtmp=auto])
285
286 AC_ARG_ENABLE([samba],
287   [AS_HELP_STRING([--disable-samba],
288   [disable SAMBA support (default is enabled)])],
289   [use_samba=$enableval],
290   [use_samba=yes])
291
292 AC_ARG_ENABLE([nfs],
293   [AS_HELP_STRING([--enable-nfs],
294   [enable NFS support via libnfs (default is auto)])],
295   [use_libnfs=$enableval],
296   [use_libnfs=auto])
297
298 AC_ARG_ENABLE([afpclient],
299   [AS_HELP_STRING([--enable-afpclient],
300   [enable AFP support via libafpclient (default is auto)])],
301   [use_libafpclient=$enableval],
302   [use_libafpclient=auto])
303
304 AC_ARG_ENABLE([airplay],
305   [AS_HELP_STRING([--enable-airplay],
306   [enable AirPlay support(default is auto)])],
307   [use_airplay=$enableval],
308   [use_airplay=auto])
309
310 AC_ARG_ENABLE([airtunes],
311   [AS_HELP_STRING([--enable-airtunes],
312   [enable AirTunes support(default is auto)])],
313   [use_airtunes=$enableval],
314   [use_airtunes=auto])
315
316 AC_ARG_ENABLE([ffmpeg_libvorbis],
317   [AS_HELP_STRING([--enable-ffmpeg-libvorbis],
318   [enable FFmpeg vorbis encoding (default is no)])],
319   [use_ffmpeg_libvorbis=$enableval],
320   [use_ffmpeg_libvorbis=no])
321
322 AC_ARG_ENABLE([dvdcss],
323   [AS_HELP_STRING([--enable-dvdcss],
324   [enable DVDCSS support (default is yes)])],
325   [use_dvdcss=$enableval],
326   [use_dvdcss=yes])
327
328 AC_ARG_ENABLE([mid],
329   [AS_HELP_STRING([--enable-mid],
330   [enable MID support (default is no)])],
331   [use_mid=$enableval],
332   [use_mid=no])
333
334 AC_ARG_ENABLE([hal],
335   [AS_HELP_STRING([--disable-hal],
336   [disable HAL support (default is enabled if hal and hal-storage is found)])],
337   [use_hal=$enableval],
338   [use_hal=yes])
339
340 AC_ARG_ENABLE([avahi],
341   [AS_HELP_STRING([--disable-avahi],
342   [disable Avahi support (default is enabled if libavahi-common and libavahi-client is found)])],
343   [use_avahi=$enableval],
344   [use_avahi=yes])
345
346 AC_ARG_ENABLE([non-free],
347   [AS_HELP_STRING([--disable-non-free],
348   [disable componentents with non-compliant licenses])],
349   [use_nonfree=$enableval],
350   [use_nonfree=yes])
351
352 AC_ARG_ENABLE([asap-codec],
353   [AS_HELP_STRING([--enable-asap-codec],
354   [enable ASAP ADPCM support])],
355   [use_asap=$enableval],
356   [use_asap=no])
357
358 AC_ARG_ENABLE([webserver],
359   [AS_HELP_STRING([--disable-webserver],
360   [disable webserver])],
361   [use_webserver=$enableval],
362   [use_webserver=yes])
363
364 AC_ARG_ENABLE([optical-drive],
365   [AS_HELP_STRING([--disable-optical-drive],
366   [disable optical drive])],
367   [use_optical_drive=$enableval],
368   [use_optical_drive=yes])
369
370 AC_ARG_ENABLE([libbluray],
371   [AS_HELP_STRING([--enable-libbluray],
372   [enable libbluray support])],
373   [use_libbluray=$enableval],
374   [use_libbluray=auto])
375
376 AC_ARG_ENABLE([texturepacker],
377   [AS_HELP_STRING([--enable-texturepacker],
378   [enable texturepacker support (default is yes)])],
379   [use_texturepacker=$enableval],
380   [use_texturepacker=auto])
381
382 AC_ARG_WITH([lirc-device],
383   [AS_HELP_STRING([--with-lirc-device=file],
384   [specify the default LIRC device (default is /dev/lircd)])],
385   [lirc_device=$withval],
386   [lirc_device=/dev/lircd])
387 AC_DEFINE_UNQUOTED([LIRC_DEVICE], ["$lirc_device"], [Default LIRC device])
388
389 AC_ARG_ENABLE([udev],
390   [AS_HELP_STRING([--enable-udev],
391   [enable udev support (default is auto)])],
392   [use_libudev=$enableval],
393   [use_libudev=auto])
394
395 AC_ARG_ENABLE([libusb],
396   [AS_HELP_STRING([--enable-libusb],
397   [enable libusb support (default is auto)])],
398   [use_libusb=$enableval],
399   [use_libusb=auto])
400
401 AC_ARG_ENABLE([libcec],
402   [AS_HELP_STRING([--enable-libcec],
403   [enable libcec support (default is no)])],
404   [use_libcec=$enableval],
405   [use_libcec=no])
406
407 ### External libraries options
408 AC_ARG_ENABLE([external-libraries],
409   [AS_HELP_STRING([--enable-external-libraries],
410   [enable use of all supported external libraries (default is no) 'Linux only'])],
411   [use_external_libraries=$enableval],
412   [use_external_libraries=no])
413
414 AC_ARG_ENABLE([external-libcec],
415   [AS_HELP_STRING([--enable-external-libcec],
416   [external libcec support (default is no) 'Linux only'])],
417   [use_external_libcec=$enableval],
418   [use_external_libcec=no])
419
420 AC_ARG_ENABLE([external-ffmpeg],
421   [AS_HELP_STRING([--enable-external-ffmpeg],
422   [enable use of external ffmpeg libraries (default is no) 'Linux only'])],
423   [use_external_ffmpeg=$enableval],
424   [use_external_ffmpeg=$use_external_libraries])
425
426 ### End of external library options
427
428 if test "x$host_vendor" != "xapple"; then
429   DEFAULT_COMPILE_FLAGS="-fPIC -DPIC -D_REENTRANT"
430   DEFAULT_COMPILE_FLAGS="$DEFAULT_COMPILE_FLAGS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
431 fi
432
433 # Checks for programs.
434 PASSED_CXXFLAGS=$CXXFLAGS # Hack to override autoconf default values
435 AC_PROG_CXX
436 CXXFLAGS="$PASSED_CXXFLAGS $DEFAULT_COMPILE_FLAGS"
437 PASSED_CFLAGS=$CFLAGS # Hack to override autoconf default values
438 AC_PROG_CC
439 AC_PROG_LIBTOOL
440 CFLAGS="$PASSED_CFLAGS $DEFAULT_COMPILE_FLAGS"
441 AC_PROG_AWK
442 AC_PROG_LN_S
443 AC_PROG_MAKE_SET
444 MAKE="${MAKE:-make}"
445
446 # host detection and setup
447 case $host in
448   i*86*-linux-gnu*)
449      ARCH="i486-linux"
450      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
451      ;;
452   x86_64-*-linux-gnu*)
453      ARCH="x86_64-linux"
454      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX")
455      ;;
456   arm-apple-darwin*)
457      use_joystick=no
458      use_crystalhd=no
459      use_vdadecoder=no
460      use_vtbdecoder=yes
461      use_optical_drive=no
462      use_dvdcss=no
463      use_gles=yes
464      use_cpu=cortex-a8
465      check_sdl_arch=[`file /opt/local/lib/libSDL_image.dylib | awk '{V=7; print $V}'`]
466      if test "x$check_sdl_arch" = "xi386"; then
467        use_texturepacker_native=yes
468        USE_TEXTUREPACKER_NATIVE_ROOT="/opt/local"
469      else
470        use_texturepacker=no
471      fi
472      ARCH="arm-osx"
473      use_arch="arm"
474      AC_SUBST(ARCH_DEFINES, "-D_ARMEL")
475      PYTHON_VERSION="2.6"
476      PYTHON_LDFLAGS="-L${prefix}/lib -lpython2.6"
477      PYTHON_CPPFLAGS="-I${prefix}/include/python2.6"
478      PYTHON_SITE_PKG="${prefix}/lib/python2.6/site-packages"
479      PYTHON_NOVERSIONCHECK="no-check"
480      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS -D_LINUX")
481      ;;
482   *86-apple-darwin*)
483      use_joystick=no
484      use_vtbdecoder=no
485      use_texturepacker_native=yes
486      USE_TEXTUREPACKER_NATIVE_ROOT="$prefix"
487      ARCH="x86-osx"
488      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX")
489      ;;
490   powerpc-apple-darwin*)
491      use_joystick=no
492      use_vdadecoder=no
493      use_vtbdecoder=no
494      use_crystalhd=no
495      ARCH="powerpc-osx"
496      use_arch="ppc"
497      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX")
498      ;;
499   powerpc-*-linux-gnu*)
500      ARCH="powerpc-linux"
501      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC")
502      ;;
503   powerpc64-*-linux-gnu*)
504      ARCH="powerpc64-linux"
505      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_POWERPC64")
506      ;;
507   arm*-*-linux-gnu*)
508      use_texturepacker=no
509      ARCH="arm"
510      use_arch="arm"
511      AC_SUBST(ARCH_DEFINES, "-DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL")
512      ;;
513   *)
514      AC_MSG_ERROR(unsupported host ($host))
515 esac
516 AC_SUBST([ARCH])
517
518 # platform debug flags
519 if test "$use_debug" = "yes"; then
520   final_message="$final_message\n  Debugging:\tYes"
521   if test "$use_profiling" = "yes"; then
522     final_message="$final_message\n  Profiling:\tYes"
523     DEBUG_FLAGS="-g -pg -D_DEBUG -Wall"
524   else
525     final_message="$final_message\n  Profiling:\tNo"
526     DEBUG_FLAGS="-g -D_DEBUG -Wall"
527   fi
528 else
529   final_message="$final_message\n  Debugging:\tNo"
530   if test "$use_profiling" = "yes"; then
531     final_message="$final_message\n  Profiling:\tYes"
532     DEBUG_FLAGS="-pg -DNDEBUG=1"
533   else
534     final_message="$final_message\n  Profiling:\tNo"
535     DEBUG_FLAGS="-DNDEBUG=1"
536   fi
537 fi
538 CFLAGS="$CFLAGS $DEBUG_FLAGS"
539 CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS"
540
541
542 if test "$use_optimizations" = "yes"; then
543   final_message="$final_message\n  Optimization:\tYes"
544   CXXFLAGS="$CXXFLAGS -O2"
545   CFLAGS="$CFLAGS -O2"
546 else
547   final_message="$final_message\n  Optimization:\tNo"
548 fi
549
550
551 # platform specific flags
552 if test "$host_vendor" = "apple" ; then
553   # standard xbmc paths
554   INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/xbmc/osx"
555   if test "$use_arch" != "arm"; then
556     LIBS="$LIBS -framework IOKit"
557     LIBS="$LIBS -framework Cocoa"
558     LIBS="$LIBS -framework AppKit"
559     LIBS="$LIBS -framework Carbon"
560     LIBS="$LIBS -framework CoreAudio"
561     LIBS="$LIBS -framework QuickTime"
562     LIBS="$LIBS -framework AudioUnit"
563     LIBS="$LIBS -framework Foundation"
564     LIBS="$LIBS -framework CoreServices"
565     LIBS="$LIBS -framework CoreVideo"
566     LIBS="$LIBS -framework CoreAudio"
567     LIBS="$LIBS -framework AudioToolbox"
568     LIBS="$LIBS -framework CoreFoundation"
569     LIBS="$LIBS -framework DiskArbitration"
570     LIBS="$LIBS -framework ApplicationServices"
571   fi
572 elif test "$use_arch" = "arm"; then
573   CFLAGS="$CFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
574   CXXFLAGS="$CXXFLAGS -mfloat-abi=softfp -mno-apcs-stack-check"
575   FFMPEG_EXTRACFLAGS="-mfloat-abi=softfp"
576   if test "$use_tegra" = "yes"; then
577     # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support 
578     SAVE_CFLAGS="$CFLAGS"
579     CFLAGS="-mfpu=vfpv3-d16"
580     AC_COMPILE_IFELSE(
581       [AC_LANG_SOURCE([int foo;])],
582       [ CFLAGS="$SAVE_CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
583         CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
584         FFMPEG_EXTRACFLAGS+=" -mtune=cortex-a9 -mfpu=vfpv3-d16"
585         use_cpu=cortex-a9],
586       [ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
587         CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"    
588         use_cpu=cortex-a8])
589   else
590     # Compile for ARMv7a architecture, CortexA8 cpu and NEON coprocessor
591     CFLAGS+=" -Wa,-march=armv7a -mcpu=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad"
592     CXXFLAGS+=" -Wa,-march=armv7a -mcpu=cortex-a8 -mfpu=neon -mvectorize-with-neon-quad"
593     FFMPEG_EXTRACFLAGS+=" -mfpu=neon"
594   fi
595 fi
596
597 # Checks for library functions.
598 AC_FUNC_ALLOCA
599 AC_FUNC_CHOWN
600 AC_FUNC_CLOSEDIR_VOID
601 AC_FUNC_ERROR_AT_LINE
602 AC_FUNC_FSEEKO
603 AC_PROG_GCC_TRADITIONAL
604 AC_FUNC_LSTAT
605 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
606 AC_FUNC_MEMCMP
607 AC_FUNC_MKTIME
608 AC_FUNC_MMAP
609 # Boxee is apparently having compile problems
610 # if HAVE_REALLOC is defined.  Sort this later.
611 #AC_FUNC_REALLOC
612 AC_FUNC_SELECT_ARGTYPES
613 AC_FUNC_SETVBUF_REVERSED
614 AC_TYPE_SIGNAL
615 AC_FUNC_STAT
616 AC_FUNC_STRCOLL
617 AC_FUNC_STRFTIME
618 AC_FUNC_STRTOD
619 AC_FUNC_UTIME_NULL
620 AC_FUNC_VPRINTF
621 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])
622
623 # Check for various sizes
624 AC_CHECK_SIZEOF([int])
625 AC_CHECK_SIZEOF([size_t])
626
627 # Add top source directory for all builds so we can use config.h
628 INCLUDES="$INCLUDES -I\$(abs_top_srcdir)"
629
630 # Check inotify availability
631 AC_CHECK_HEADER([sys/inotify.h], AC_DEFINE([HAVE_INOTIFY],[1],[Define if we have inotify]),)
632
633 # Checks for boost headers using CXX instead of CC
634 AC_LANG_PUSH([C++])
635 AC_CHECK_HEADER([boost/shared_ptr.hpp],, AC_MSG_ERROR($missing_library))
636 AC_LANG_POP([C++])
637
638 # Checks for platforms libraries.
639 if test "$use_gles" = "yes"; then
640   use_gl="no"
641   # GLES overwrites GL if both set to yes.
642   if test "$host_vendor" = "apple" ; then
643     AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
644     AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
645     AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
646   else
647     AC_CHECK_LIB([EGL],   [main],, AC_MSG_ERROR($missing_library))
648     AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library))
649   fi
650 else
651   if test "$use_gl" = "yes"; then
652     if test "$host_vendor" = "apple" ; then
653       # linking to OpenGL.framework instead of libGL, libGLU so AC_CHECK_LIB will fail
654       LIBS="$LIBS -framework OpenGL"
655       AC_DEFINE([HAVE_LIBGL],[1],["Define to 1 if you have the `GL' library (-lGL)."])
656       AC_MSG_RESULT(== WARNING: OpenGL support is assumed.)
657       AC_DEFINE([HAVE_LIBGLU],[1],["Define to 1 if you have the `GLU' library (-lGLU)."])
658       AC_MSG_RESULT(== WARNING: OpenGLU support is assumed.)
659       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
660     else
661       AC_CHECK_LIB([GL],  [main],, AC_MSG_ERROR($missing_library))
662       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
663       AC_CHECK_LIB([GLU], [main],, AC_MSG_ERROR($missing_library))
664     fi
665   else
666     AC_MSG_RESULT(== WARNING: OpenGL support is disabled. XBMC will run VERY slow. ==)
667     AC_CHECK_LIB([SDL_gfx],[main])
668   fi
669 fi
670
671 # platform common libraries
672 AC_CHECK_PROG(MYSQL_CONFIG, mysql_config, "yes", "no")
673 if test $MYSQL_CONFIG = "yes"; then
674   INCLUDES="$INCLUDES `mysql_config --include`"
675   MYSQL_LIBS=`mysql_config --libs`
676   LIBS="$LIBS $MYSQL_LIBS"
677   AC_SUBST(MYSQL_LIBS)
678 else
679   AC_MSG_ERROR($missing_program)
680 fi
681 AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
682 AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
683 AC_CHECK_HEADER([mpeg2dec/mpeg2convert.h],, AC_MSG_ERROR($missing_library),
684   AC_INCLUDES_DEFAULT()
685   [#include <mpeg2dec/mpeg2.h>])
686 AC_CHECK_HEADER([mad.h],,            AC_MSG_ERROR($missing_library))
687 AC_CHECK_HEADER([jpeglib.h],,        AC_MSG_ERROR($missing_library))
688 AC_CHECK_HEADER([samplerate.h],,     AC_MSG_ERROR($missing_library))
689 AC_CHECK_HEADER([ogg/ogg.h],,        AC_MSG_ERROR($missing_library))
690 AC_CHECK_HEADER([vorbis/vorbisfile.h],, AC_MSG_ERROR($missing_library))
691 AC_CHECK_HEADER([vorbis/vorbisenc.h],, AC_MSG_ERROR($missing_library))
692 AC_CHECK_HEADER([libmodplug/modplug.h],, AC_MSG_ERROR($missing_library))
693 AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR($missing_library))
694 AC_CHECK_HEADER([FLAC/stream_decoder.h],, AC_MSG_ERROR($missing_library))
695 AC_CHECK_LIB([bz2],         [main],, AC_MSG_ERROR($missing_library))
696 AC_CHECK_LIB([jpeg],        [main],, AC_MSG_ERROR($missing_library)) # check for cximage
697 AC_CHECK_LIB([tiff],        [main],, AC_MSG_ERROR($missing_library))
698 AC_CHECK_LIB([pthread],     [main],, AC_MSG_ERROR($missing_library))
699 AC_CHECK_LIB([lzo2],        [main],, AC_MSG_ERROR($missing_library))
700 AC_CHECK_LIB([z],           [main],, AC_MSG_ERROR($missing_library))
701 AC_CHECK_LIB([crypto],      [main],, AC_MSG_ERROR($missing_library))
702 AC_CHECK_LIB([ssl],         [main],, AC_MSG_ERROR($missing_library))
703 AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
704 AC_CHECK_LIB([ssh],         [sftp_tell64],, AC_MSG_RESULT([Could not find suitable version of libssh]))
705 AC_CHECK_LIB([bluetooth],   [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
706 AC_CHECK_LIB([yajl],        [main],, AC_MSG_ERROR($missing_library))
707
708 PKG_CHECK_MODULES([FONTCONFIG], [fontconfig],
709   [INCLUDES="$INCLUDES $FONTCONFIG_CFLAGS"; LIBS="$LIBS $FONTCONFIG_LIBS"],
710   AC_MSG_ERROR($missing_library))
711 PKG_CHECK_MODULES([FRIBIDI],    [fribidi],
712   [INCLUDES="$INCLUDES $FRIBIDI_CFLAGS"; LIBS="$LIBS $FRIBIDI_LIBS"],
713   AC_MSG_ERROR($missing_library))
714 PKG_CHECK_MODULES([SQLITE3],    [sqlite3],
715   [INCLUDES="$INCLUDES $SQLITE3_CFLAGS"; LIBS="$LIBS $SQLITE3_LIBS"],
716   AC_MSG_ERROR($missing_library))
717 PKG_CHECK_MODULES([PNG],        [libpng],
718   [INCLUDES="$INCLUDES $PNG_CFLAGS"; LIBS="$LIBS $PNG_LIBS"],
719   AC_MSG_ERROR($missing_library))
720 PKG_CHECK_MODULES([PCRE],       [libpcre],
721   [INCLUDES="$INCLUDES $PCRE_CFLAGS"; LIBS="$LIBS $PCRE_LIBS"]; \
722   AC_DEFINE([HAVE_LIBPCRE],[1],["Define to 1 if libpcre is installed"]),
723   AC_MSG_ERROR($missing_library))
724 PKG_CHECK_MODULES([PCRECPP],    [libpcrecpp],
725   [INCLUDES="$INCLUDES $PCRECPP_CFLAGS"; LIBS="$LIBS $PCRECPP_LIBS"]; \
726   AC_DEFINE([HAVE_LIBPCRECPP],[1],["Define to 1 if libpcrecpp is installed"]),
727   AC_MSG_ERROR($missing_library))
728 PKG_CHECK_MODULES([CDIO],       [libcdio],
729   [INCLUDES="$INCLUDES $CDIO_CFLAGS"; LIBS="$LIBS $CDIO_LIBS"],
730   AC_MSG_ERROR($missing_library))
731 PKG_CHECK_MODULES([SAMPLERATE], [samplerate],
732   [INCLUDES="$INCLUDES $SAMPLERATE_CFLAGS"; LIBS="$LIBS $SAMPLERATE_LIBS"],
733   AC_MSG_ERROR($missing_library))
734 PKG_CHECK_MODULES([FREETYPE2],  [freetype2],
735   [INCLUDES="$INCLUDES $FREETYPE2_CFLAGS"; LIBS="$LIBS $FREETYPE2_LIBS"],
736   AC_MSG_ERROR($missing_library))
737
738 # check for libbluray
739 AS_CASE([x$use_libbluray],
740   [xyes],[
741     PKG_CHECK_MODULES([LIBBLURAY],[libbluray],[use_libbluray="yes"], AC_MSG_ERROR($missing_library))
742   ],
743   [xauto],[
744     PKG_CHECK_MODULES([LIBBLURAY],[libbluray],[use_libbluray="yes"], [use_libbluray="no"])
745   ])
746
747 AS_CASE([x$use_libbluray],
748   [xyes],[
749     INCLUDES="$INCLUDES $LIBBLURAY_CFLAGS";
750     XB_FIND_SONAME([BLURAY], [bluray], [use_libbluray])
751     AC_DEFINE([HAVE_LIBBLURAY], 1, [System has libbluray library])
752     AC_SUBST([HAVE_LIBBLURAY], 1)
753
754         XB_PUSH_FLAGS(
755         [$LIBBLURAY_CFLAGS]
756       , [$LIBBLURAY_LIBS]
757
758       , AC_MSG_CHECKING([libbluray version])
759         AC_COMPILE_IFELSE(
760             AC_LANG_PROGRAM(
761                 [#include <libbluray/bluray.h>]
762                ,[bd_get_playlist_info(0, 0)])
763           ,[AC_MSG_RESULT(version has old angle api)
764             AC_DEFINE([HAVE_LIBBLURAY_NOANGLE],[],[System has an old api libbluray without angle support])]
765           ,[AC_MSG_RESULT(normal)]
766         )
767
768         AC_MSG_CHECKING([for libbluray log control])
769         AC_LINK_IFELSE(
770             AC_LANG_PROGRAM(
771                [#include <libbluray/bluray.h>
772                 #include <libbluray/log_control.h>]
773               ,[bd_set_debug_mask(0)])
774           , AC_MSG_RESULT(yes)
775           ,[AC_MSG_RESULT(no)
776             AC_DEFINE([HAVE_LIBBLURAY_NOLOGCONTROL],[],[System has an old api libbluray without log support])]
777         )
778     )
779   ],[
780 #    AC_DEFINE([HAVE_LIBBLURAY], 0, [System has libbluray library])
781     AC_SUBST([HAVE_LIBBLURAY], 0)
782   ]
783 )
784
785 # platform dependent libraries
786 if test "$host_vendor" = "apple" ; then
787   AC_CHECK_LIB([iconv],     [main],, AC_MSG_ERROR($missing_library))
788   if test "$use_arch" != "arm"; then
789     AC_CHECK_LIB([SDL_mixer],[main],, AC_MSG_ERROR($missing_library))
790     AC_CHECK_LIB([SDL],      [main],, AC_MSG_ERROR($missing_library))
791     AC_DEFINE([HAVE_SDL],[1],["Define to 1 if using sdl"])
792   fi
793 else
794   AC_CHECK_LIB([dl],         [main],, AC_MSG_ERROR($missing_library))
795   AC_CHECK_LIB([resolv],     [main],, AC_MSG_ERROR($missing_library))
796   AC_CHECK_LIB([jasper],     [main],, AC_MSG_ERROR($missing_library)) # check for cximage
797   AC_CHECK_LIB([rt],         [clock_gettime],, AC_MSG_ERROR($missing_library))
798
799   PKG_CHECK_MODULES([ALSA],  [alsa],
800     [INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"; use_alsa=yes],
801     AC_MSG_NOTICE($alsa_not_found); use_alsa=no)
802   PKG_CHECK_MODULES([DBUS],    [dbus-1],
803     [INCLUDES="$INCLUDES $DBUS_CFLAGS"; LIBS="$LIBS $DBUS_LIBS"; use_dbus=yes]; \
804     AC_DEFINE([HAVE_DBUS],[1],["Define to 1 if dbus is installed"]),
805     AC_MSG_NOTICE($missing_library); use_dbus=no)
806
807   if test "x$use_sdl" != "xno"; then
808     PKG_CHECK_MODULES([SDL],   [sdl],
809       [INCLUDES="$INCLUDES $SDL_CFLAGS"; LIBS="$LIBS $SDL_LIBS"],
810       AC_MSG_ERROR($missing_library))
811     AC_CHECK_LIB([SDL_mixer],  [main],, AC_MSG_ERROR($missing_library))
812     AC_CHECK_LIB([SDL_image],  [main],, AC_MSG_ERROR($missing_library))
813     AC_DEFINE([HAVE_SDL],[1],["Define to 1 if using sdl"])
814   fi
815 fi
816
817 XB_FIND_SONAME([MAD],         [mad])
818 XB_FIND_SONAME([OGG],         [ogg])
819 XB_FIND_SONAME([CURL],        [curl])
820 XB_FIND_SONAME([FLAC],        [FLAC])
821 XB_FIND_SONAME([VORBIS],      [vorbis])
822 XB_FIND_SONAME([VORBISENC],   [vorbisenc])
823 XB_FIND_SONAME([VORBISFILE],  [vorbisfile])
824 XB_FIND_SONAME([MODPLUG],     [modplug])
825 XB_FIND_SONAME([ASS],         [ass])
826 XB_FIND_SONAME([MPEG2],       [mpeg2])
827
828 # WebServer
829 if test "$use_webserver" = "yes"; then
830   AC_CHECK_LIB([microhttpd],  [main],, AC_MSG_ERROR($missing_library))
831 fi
832
833 # Optical
834 if test "$use_optical_drive" = "yes"; then
835   AC_DEFINE([HAS_DVD_DRIVE], [1], [Define to 1 to have optical drive support])
836 fi
837
838 # PulseAudio
839 if test "x$use_pulse" != "xno"; then
840   if test "$host_vendor" = "apple" ; then
841     if test "x$use_pulse" = "xyes"; then
842       AC_MSG_ERROR($pulse_disabled)
843     else
844       use_pulse="no"
845       AC_MSG_RESULT($pulse_disabled)
846     fi
847     USE_PULSE=0
848   else
849     AC_CHECK_LIB([pulse], [main],,
850       [if test "x$use_pulse" = "xyes"; then
851         AC_MSG_ERROR($pulse_not_found)
852       else
853         use_pulse=no
854         USE_PULSE=0
855         AC_MSG_RESULT($pulse_not_found)
856       fi])
857       USE_PULSE=1
858   fi
859 else
860   AC_MSG_RESULT($pulse_disabled)
861   USE_PULSE=0
862 fi
863
864 # HAL
865 if test "$host_vendor" = "apple" ; then
866   use_hal="no"
867   AC_MSG_RESULT($hal_disabled)
868 else
869   if test "$use_hal" = "yes"; then
870     PKG_CHECK_MODULES([HAL], [hal],
871       [INCLUDES="$INCLUDES $HAL_CFLAGS"; LIBS="$LIBS $HAL_LIBS"],
872       use_hal=no;AC_MSG_RESULT($hal_not_found))
873     PKG_CHECK_MODULES([HAL_STORAGE], [hal-storage],
874       [INCLUDES="$INCLUDES $HAL_STORAGE_CFLAGS"; LIBS="$LIBS $HAL_STORAGE_LIBS"],
875       use_hal=no;AC_MSG_RESULT($halstorage_not_found))
876   else
877     AC_MSG_RESULT($hal_disabled)
878   fi
879   if test "$use_hal" = "yes"; then
880     AC_DEFINE([HAS_HAL], [1], [Define to 1 if you have HAL installed])
881   fi
882 fi
883
884 # avahi
885 if test "$host_vendor" = "apple" ; then
886   use_avahi="no"
887   AC_MSG_RESULT($avahi_disabled)
888 else
889   if test "$use_avahi" = "yes"; then
890     AC_CHECK_LIB([avahi-common], [main],,
891       use_avahi=no;AC_MSG_RESULT($avahi_not_found))
892     if test "$use_avahi" = "yes"; then
893       #either both libs or none
894       AC_CHECK_LIB([avahi-client], [main],,
895         use_avahi=no;AC_MSG_RESULT($avahi_not_found))
896     fi
897   else
898     AC_MSG_RESULT($avahi_disabled)
899   fi
900 fi
901
902 # X11
903 if test "$use_x11" = "yes" && test "$host_vendor" != "apple"; then
904   AC_MSG_NOTICE($x11_enabled)
905   PKG_CHECK_MODULES([X11],    [x11],
906     [INCLUDES="$INCLUDES $X11_CFLAGS"; LIBS="$LIBS $X11_LIBS"],
907     AC_MSG_ERROR($missing_library))
908   PKG_CHECK_MODULES([XEXT],  [xext],
909     [INCLUDES="$INCLUDES $XEXT_CFLAGS"; LIBS="$LIBS $XEXT_LIBS"],
910     AC_MSG_ERROR($missing_library))
911   AC_DEFINE([HAVE_X11], [1], [Define to 1 if you have X11 libs installed.])
912 else
913   AC_MSG_RESULT($x11_disabled)
914 fi
915
916 # XRandR
917 if test "$host_vendor" = "apple" || test "$use_x11" = "no"; then
918   use_xrandr="no"
919   AC_MSG_RESULT($xrandr_disabled)
920 else
921   if test "$use_xrandr" = "yes" ; then
922     AC_CHECK_LIB([Xrandr], [main],,
923       use_xrandr="no";AC_MSG_RESULT($xrandr_not_found))
924   else
925     AC_MSG_RESULT($xrandr_disabled)
926   fi
927 fi
928
929 # GOOM
930 if test "$host_vendor" = "apple" ; then
931   AC_MSG_NOTICE($goom_disabled)
932   DISABLE_GOOM=1
933 else
934   if test "$use_goom" = "yes" && test "$use_gl" = "yes"; then
935     AC_MSG_NOTICE($goom_enabled)
936     DISABLE_GOOM=0
937   else
938     AC_MSG_NOTICE($goom_disabled)
939     DISABLE_GOOM=1
940   fi
941 fi
942
943 # RSXS
944 if test "$use_rsxs" = "no" || test "$use_gl" = "no"; then
945   AC_MSG_NOTICE($rsxs_disabled)
946   DISABLE_RSXS=1
947 else
948   AC_MSG_NOTICE($rsxs_enabled)
949   DISABLE_RSXS=0
950   # darwin osx can do rsxs but does not use x11, so do not pkg-config check for them
951   if test "$host_vendor" != "apple" ; then
952     PKG_CHECK_MODULES([XT],    [xt],
953       [INCLUDES="$INCLUDES $XT_CFLAGS"; LIBS="$LIBS $XT_LIBS"],
954       AC_MSG_ERROR($missing_library))
955     PKG_CHECK_MODULES([XMU],   [xmu],
956       [INCLUDES="$INCLUDES $XMU_CFLAGS"; LIBS="$LIBS $XMU_LIBS"],
957       AC_MSG_ERROR($missing_library))
958   fi
959 fi
960
961 # PROJECTM
962 if test "$use_projectm" = "no" || test "$use_gl" = "no"; then
963   AC_MSG_NOTICE($projectm_disabled)
964   DISABLE_PROJECTM=1
965 else
966   AC_MSG_NOTICE($projectm_enabled)
967   DISABLE_PROJECTM=0
968 fi
969
970 # skin touched
971 use_skin_touched=no
972 if [[ -f "addons/skin.touched/addon.xml" ]]; then 
973   use_skin_touched=yes
974   USE_SKIN_TOUCHED=1
975   AC_DEFINE([HAS_SKIN_TOUCHED], [1], [Whether to build skin touched.])
976 else
977   USE_SKIN_TOUCHED=0
978 fi
979
980
981 # libRTMP
982 if test "$use_librtmp" != "no"; then
983   AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
984    [if test "$use_librtmp" = "yes"; then
985       AC_MSG_ERROR($librtmp_not_found)
986     elif test "$use_librtmp" != "no"; then
987       AC_MSG_NOTICE($librtmp_not_found)
988       use_librtmp="no"
989     fi
990    ])
991   if test "$use_librtmp" != "no"; then
992     XB_FIND_SONAME([RTMP], [rtmp], [use_librtmp])
993   fi
994   if test "$use_librtmp" != "no"; then
995     AC_DEFINE([HAS_LIBRTMP], [1], [Whether to use libRTMP library.])
996   fi
997 else
998   AC_MSG_NOTICE($librtmp_disabled)
999 fi
1000
1001 # samba
1002 if test "x$use_samba" != "xno"; then
1003   AC_CHECK_LIB([smbclient], [main],,
1004     use_samba=no;AC_MSG_ERROR($missing_library))
1005     USE_LIBSMBCLIENT=0
1006 else
1007   AC_MSG_RESULT($samba_disabled)
1008   USE_LIBSMBCLIENT=0
1009 fi
1010
1011 if test "x$use_samba" != "xno"; then
1012   AC_DEFINE([HAVE_LIBSMBCLIENT], [1], [Define to 1 if you have Samba installed])
1013   USE_LIBSMBCLIENT=1
1014 fi
1015
1016 # libnfs
1017 if test "$use_libnfs" != "no"; then
1018   AC_CHECK_HEADERS([nfsc/libnfs.h],,
1019    [if test "$use_libnfs" = "yes"; then
1020       AC_MSG_ERROR($libnfs_not_found)
1021       USE_LIBNFS=0
1022     elif test "$use_libnfs" != "no"; then
1023       AC_MSG_NOTICE($libnfs_not_found)
1024       use_libnfs="no"
1025       USE_LIBNFS=0
1026     fi
1027    ])
1028   if test "$use_libnfs" != "no"; then
1029     XB_FIND_SONAME([NFS], [nfs], [use_libnfs])
1030   fi
1031   if test "$use_libnfs" != "no"; then
1032     AC_DEFINE([HAVE_LIBNFS], [1], [Whether to use libnfs library.])
1033     USE_LIBNFS=1
1034   fi
1035 else
1036   USE_LIBNFS=0
1037   AC_MSG_NOTICE($libnfs_disabled)
1038 fi
1039
1040 # libafpclient
1041 USE_LIBAFPCLIENT=0
1042 if test "x$use_libafpclient" != "xno"; then
1043   AC_CHECK_HEADERS([afpfs-ng/libafpclient.h],,
1044    [if test "x$use_libafpclient" = "xyes"; then
1045       AC_MSG_ERROR($libafpclient_not_found)
1046     elif test "x$use_libafpclient" != "xno"; then
1047       AC_MSG_NOTICE($libafpclient_not_found)
1048       use_libafpclient="no"
1049     fi
1050    ])
1051   if test "x$use_libafpclient" != "xno"; then
1052     XB_FIND_SONAME([AFPCLIENT], [afpclient], [use_libafpclient])
1053     AC_DEFINE([HAVE_LIBAFPCLIENT], [1], [Whether to use libafpclient library.])
1054     USE_LIBAFPCLIENT=1
1055   fi
1056 else
1057   AC_MSG_NOTICE($libafpclient_disabled)
1058 fi
1059
1060 # libplist for airplay feature
1061 USE_AIRPLAY=0
1062 if test "$use_airplay" != "no"; then
1063   AC_CHECK_LIB([plist],[main],,
1064    [if test "$use_airplay" = "yes"; then
1065       AC_MSG_ERROR($libplist_not_found)
1066     elif test "$use_airplay" != "no"; then
1067       AC_MSG_NOTICE($libplist_not_found)
1068       use_airplay="no"
1069     fi
1070    ])
1071
1072   if test "$use_airplay" != "no"; then
1073     XB_FIND_SONAME([PLIST], [plist], [use_airplay])
1074     USE_AIRPLAY=1
1075   fi
1076 fi
1077
1078 # libshairport for AirTunes
1079 USE_AIRTUNES=0
1080 if test "x$use_airtunes" != "xno"; then
1081   AC_CHECK_LIB([shairport], [shairport_set_ao],,
1082    [if test "x$use_airtunes" = "xyes"; then
1083       AC_MSG_ERROR($libshairport_not_found)
1084     elif test "x$use_airtunes" != "xno"; then
1085       AC_MSG_NOTICE($libshairport_not_found)
1086       use_airtunes="no"
1087     fi
1088    ])
1089
1090   if test "x$use_airtunes" != "xno"; then
1091     XB_FIND_SONAME([SHAIRPORT], [shairport], [use_airtunes])
1092     USE_AIRTUNES=1
1093   fi
1094 fi
1095
1096 # udev
1097 USE_LIBUDEV=0
1098   if test "$host_vendor" = "apple" ; then
1099   use_libudev="no"
1100   AC_MSG_NOTICE($libudev_disabled)
1101 else
1102   if test "$use_libudev" = "auto"; then
1103     PKG_CHECK_MODULES([UDEV], [libudev],
1104       use_libudev="yes"; use_libusb="no"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
1105       AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]),
1106       AC_MSG_RESULT($libudev_not_found))
1107   elif test "$use_libudev" = "yes" ; then
1108     PKG_CHECK_MODULES([UDEV], [libudev],
1109       use_libudev="yes"; use_libusb="no"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
1110       AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]),
1111       AC_MSG_ERROR($libudev_not_found))
1112     use_libudev="no"
1113     AC_MSG_NOTICE($libudev_disabled)
1114   fi
1115 fi
1116
1117 # libusb
1118 USE_LIBUSB=0
1119 if test "$use_libudev" != "yes"; then
1120   if test "$host_vendor" = "apple" ; then
1121     use_libusb="no"
1122     AC_MSG_NOTICE($libusb_disabled)
1123   else
1124     if test "$use_libusb" = "auto"; then
1125       PKG_CHECK_MODULES([USB], [libusb],
1126         use_libusb="yes"; USE_LIBUSB=1; [INCLUDES="$INCLUDES $USB_CFLAGS"; LIBS="$LIBS $USB_LIBS"; USE_LIBUSB=1]; \
1127         AC_DEFINE([HAVE_LIBUSB],[1],["Define to 1 if libusb is installed"]),
1128         use_libusb="no"; AC_MSG_RESULT($libusb_not_found))
1129     elif test "$use_libusb" = "yes"; then
1130       PKG_CHECK_MODULES([USB], [libusb],
1131         use_libusb="yes"; USE_LIBUSB=1; [INCLUDES="$INCLUDES $USB_CFLAGS"; LIBS="$LIBS $USB_LIBS"; USE_LIBUSB=1]; \
1132         AC_DEFINE([HAVE_LIBUSB],[1],["Define to 1 if libusb is installed"]),
1133         use_libusb="no"; AC_MSG_ERROR($libusb_not_found))
1134       use_libusb="no"
1135       AC_MSG_NOTICE($libusb_disabled)
1136     fi
1137   fi
1138 else
1139   use_libusb="no"
1140 fi
1141
1142 # libcec
1143 USE_LIBCEC=0
1144 if test "$use_libcec" = "yes"; then
1145   USE_LIBCEC=1; AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libCEC is installed"])
1146   AC_MSG_NOTICE($libcec_enabled)
1147 else
1148   use_libcec="no"
1149   AC_MSG_NOTICE($libcec_disabled)
1150 fi
1151
1152 ### External libraries checks
1153
1154 # external libcec
1155 USE_EXTERNAL_LIBCEC=0
1156 if test "$use_libcec" = "yes"; then
1157   if test "$use_external_libcec" = "yes"; then
1158     USE_EXTERNAL_LIBCEC=1; PKG_CHECK_MODULES([CEC], [libcec],
1159       [INCLUDES="$INCLUDES $CEC_CFLAGS"; LIBS="$LIBS $CEC_LIBS"],
1160       AC_MSG_ERROR($libcec_external_missing))
1161   else
1162     [INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/lib/libcec/include"]
1163     AC_MSG_NOTICE($libcec_internal)
1164   fi
1165 fi
1166
1167 # External FFmpeg
1168 if test "$use_external_ffmpeg" = "yes"; then
1169   FFMPEG_LIBNAMES="libavcodec libavfilter libavformat libavutil libpostproc libswscale"
1170
1171   # libavcore is optional
1172   PKG_CHECK_EXISTS([libavcore], FFMPEG_LIBNAMES="$FFMPEG_LIBNAMES libavcore")
1173
1174   PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
1175                     [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"],
1176                     AC_MSG_ERROR($missing_library))
1177
1178   # Determine whether AVPacket and relevant functions are defined in libavformat
1179   # or libavcodec
1180   AC_CHECK_LIB([avcodec], [av_free_packet],
1181   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavcodec. ==)],
1182   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavformat. ==)
1183    AC_DEFINE([AVPACKET_IN_AVFORMAT], [1], [Whether AVPacket is in libavformat.])])
1184
1185   # in case the headers are in a custom directory
1186   SAVE_CPPFLAGS="$CPPFLAGS"
1187   CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
1188
1189   # Possible places the ffmpeg headers may be
1190   AC_CHECK_HEADERS([libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h libavutil/avutil.h libpostproc/postprocess.h libswscale/swscale.h],,
1191   [AC_CHECK_HEADERS([ffmpeg/avcodec.h ffmpeg/avfilter.h ffmpeg/avformat.h ffmpeg/avutil.h postproc/postprocess.h ffmpeg/swscale.h],,
1192   [AC_MSG_ERROR($missing_headers)])])
1193
1194   # optional
1195   AC_CHECK_HEADERS([libavcore/avcore.h libavcore/samplefmt.h libavutil/mem.h libavutil/samplefmt.h])
1196
1197   # old FFmpeg have this in libavcodec/opt.h instead:
1198   AC_CHECK_HEADERS([libavutil/opt.h])
1199
1200   # We'll support the use of rgb2rgb.h if it exists.
1201   AC_CHECK_HEADERS([libswscale/rgb2rgb.h],,)
1202   AC_CHECK_HEADERS([ffmpeg/rgb2rgb.h],,)
1203
1204   # Check if AVFilterBufferRefVideoProps AVRational member is named
1205   # 'pixel_aspect' or 'sample_aspect_ratio'.
1206   AC_CHECK_MEMBER([AVFilterBufferRefVideoProps.sample_aspect_ratio],
1207     [AC_DEFINE([HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO],
1208     [1],
1209     [Define to 1 if AVFilterBufferRefVideoProps has member sample_aspect_ratio.])],
1210       [AC_CHECK_MEMBER([AVFilterBufferRefVideoProps.sample_aspect_ratio],
1211       [AC_DEFINE([HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO],
1212       [1],
1213       [Define to 1 if AVFilterBufferRefVideoProps has member sample_aspect_ratio.])],
1214       ,
1215       [[#include <ffmpeg/avfilter.h>]])],
1216     [[#include <libavfilter/avfilter.h>]])
1217
1218   AC_MSG_NOTICE($external_ffmpeg_enabled)
1219   USE_EXTERNAL_FFMPEG=1
1220   AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.])
1221
1222   # Disable vdpau support if external libavcodec doesn't have it
1223   AC_CHECK_LIB([avcodec], [ff_vdpau_vc1_decode_picture],,
1224     [if test "x$use_vdpau" = "xyes"; then
1225       AC_MSG_ERROR($ffmpeg_vdpau_not_supported)
1226     else
1227       use_vdpau=no
1228       AC_MSG_RESULT($ffmpeg_vdpau_not_supported)
1229     fi])
1230
1231   # Check for 'PIX_FMT_VDPAU_MPEG4' from libavutil
1232   if test "x$use_vdpau" != "xno"; then
1233     AC_LANG_PUSH([C++])
1234     AC_LINK_IFELSE(
1235       [AC_LANG_SOURCE([ #include <libavutil/pixfmt.h>
1236         int main() { PixelFormat format = PIX_FMT_VDPAU_MPEG4; }])],
1237       [AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1],
1238       [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])],)
1239     AC_LANG_POP([C++])
1240   fi
1241   CPPFLAGS="$SAVE_CPPFLAGS"
1242 else
1243   AC_MSG_NOTICE($external_ffmpeg_disabled)
1244   USE_EXTERNAL_FFMPEG=0
1245   AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1], [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])
1246 fi
1247
1248 # Python
1249 if test -z "$PYTHON_NOVERSIONCHECK"; then
1250   AX_PYTHON_DEVEL([>= 2.4])
1251   PYTHON_VERSION=$ac_python_version
1252 fi
1253
1254 if test -z "$PYTHON_VERSION"; then
1255   AC_MSG_ERROR([Can't find a Python version.])
1256 else
1257   AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
1258 fi
1259
1260 # VDPAU
1261 if test "x$use_vdpau" != "xno"; then
1262   if test "$host_vendor" = "apple" ; then
1263     if test "x$use_vdpau" = "xyes"; then
1264       AC_MSG_ERROR([VDPAU not supported on this platform])
1265     else
1266       use_vdpau="no"
1267       AC_MSG_NOTICE($vdpau_disabled)
1268     fi
1269     USE_VDPAU=0
1270   else
1271     USE_VDPAU=1
1272     AC_CHECK_HEADER([vdpau/vdpau.h],AC_DEFINE([HAVE_LIBVDPAU], [],
1273       [Define to 1 if you have the 'vdpau' library (-lvdpau).]),
1274     [if test "x$use_vdpau" = "xyes"; then
1275       USE_VDPAU=0
1276       AC_MSG_ERROR([$vdpau_not_found])
1277     else
1278       use_vdpau="no"
1279       USE_VDPAU=0
1280       AC_MSG_RESULT($vdpau_not_found)
1281     fi])
1282   fi
1283 else
1284   USE_VDPAU=0
1285   AC_MSG_NOTICE($vdpau_disabled)
1286 fi
1287
1288 # VAAPI
1289 if test "x$use_vaapi" != "xno"; then
1290   if test "$host_vendor" = "apple" ; then
1291     if test "x$use_vaapi" = "xyes"; then
1292       AC_MSG_ERROR([VAAPI not supported on this platform])
1293     else
1294       use_vaapi="no"
1295       AC_MSG_NOTICE($vaapi_disabled)
1296     fi
1297     USE_VAAPI=0
1298   else
1299     initial_val=$use_vaapi
1300     AC_CHECK_LIB([va], main, :, use_vaapi=no)
1301     if test "x$use_vaapi" != "xno"; then
1302       AC_CHECK_LIB([va-glx], main, LIBS="-lva -lva-glx $LIBS", use_vaapi=no, -lva)
1303     fi
1304
1305     if test "x$use_vaapi" = "xno"; then
1306       if test "x$initial_val" = "xyes"; then
1307         AC_MSG_ERROR($vaapi_not_found)
1308       else
1309         AC_MSG_RESULT($vaapi_not_found)
1310       fi
1311       USE_VAAPI=0
1312     else
1313       AC_DEFINE([HAVE_LIBVA], [1], [Define to 1 if you have the 'vaapi' libraries (-lva AND -lva-glx)])
1314       USE_VAAPI=1
1315     fi
1316   fi
1317 else
1318   AC_MSG_NOTICE($vaapi_disabled)
1319   USE_VAAPI=0
1320 fi
1321
1322 # CrystalHD
1323 if test "x$use_crystalhd" != "xno"; then
1324   SAVE_CFLAGS="$CFLAGS"
1325   CFLAGS="-D__LINUX_USER__"
1326   AC_CHECK_HEADER([libcrystalhd/libcrystalhd_if.h], [],
1327     [ if test "x$use_crystalhd" = "xyes"; then
1328         AC_MSG_ERROR($crystalhd_not_found)
1329       else
1330         use_crystalhd=no
1331         AC_MSG_RESULT($crystalhd_not_found)
1332       fi
1333       USE_CRYSTALHD=0
1334     ])
1335     CFLAGS="$SAVE_CFLAGS"
1336     if test "$host_vendor" != "apple"; then
1337       XB_FIND_SONAME([CRYSTALHD], [crystalhd], [use_crystalhd])
1338     fi
1339     if test "x$use_crystalhd" != "xno"; then
1340       SAVE_CFLAGS="$CFLAGS"
1341       CFLAGS="-D__LINUX_USER__ -llibcrystalhd"
1342       # check for new crystalhd lib
1343       AC_COMPILE_IFELSE(
1344         [AC_LANG_SOURCE([#include <libcrystalhd/bc_dts_types.h>
1345           #include <libcrystalhd/bc_dts_defs.h>
1346           PBC_INFO_CRYSTAL bCrystalInfo;])],
1347         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [2], [Define to 2 if you have the 'New Broadcom Crystal HD' library.]) ], 
1348         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [1], [Define to 1 if you have the 'Old Broadcom Crystal HD' library.]) ])
1349       CFLAGS="$SAVE_CFLAGS"
1350       USE_CRYSTALHD=1
1351     fi
1352 else
1353   AC_MSG_NOTICE($crystalhd_disabled)
1354   USE_CRYSTALHD=0
1355 fi
1356
1357 # VDADecoder
1358 if test "x$use_vdadecoder" != "xno"; then
1359   if test "$host_vendor" = "apple" ; then
1360     HAVE_LIBVDADECODER=1
1361     AC_DEFINE([HAVE_LIBVDADECODER], [1], [Define to 1 if you have the 'VDADecoder' library.])
1362     AC_MSG_NOTICE($vdadecoder_enabled)
1363     USE_VDA=1
1364   else
1365     if test "x$use_vdadecoder" = "xyes"; then
1366       AC_MSG_ERROR([VDA Decoder not supported on this platform])
1367     else
1368       use_vdadecoder="no"
1369       AC_MSG_NOTICE($vdadecoder_disabled)
1370     fi
1371     USE_VDA=0
1372   fi
1373 else
1374   AC_MSG_NOTICE($vdadecoder_disabled)
1375 fi
1376
1377 # VTBDecoder
1378 if test "x$use_vtbdecoder" != "xno"; then
1379   if test "$host_vendor" = "apple" ; then
1380     HAVE_VIDEOTOOLBOXDECODER=1
1381     AC_DEFINE([HAVE_VIDEOTOOLBOXDECODER], [1], [Define to 1 if you have the 'VTBDecoder' library.])
1382     AC_MSG_NOTICE($vtbdecoder_enabled)
1383   else
1384     if test "x$use_vtbdecoder" = "xyes"; then
1385       AC_MSG_ERROR([VTB Decoder not supported on this platform])
1386     else
1387       use_vtbdecoder="no"
1388       AC_MSG_NOTICE($vtbdecoder_disabled)
1389     fi
1390   fi
1391 else
1392   AC_MSG_NOTICE($vtbdecoder_disabled)
1393 fi
1394
1395 # OpenMax
1396 if test "$host_vendor" = "apple" ; then
1397   use_openmax="no"
1398   USE_OPENMAX=0
1399   AC_MSG_NOTICE($openmax_disabled)
1400 else
1401   if test "$use_gles" = "yes" && test "$use_openmax" = "auto"; then
1402     PKG_CHECK_MODULES([OPENMAX], [libomxil-bellagio],
1403                       USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS"],
1404                       use_openmax=no;USE_OPENMAX=0;AC_MSG_RESULT($openmax_not_found))
1405   elif test "$use_gles" = "yes" && test "$use_openmax" = "yes"; then
1406     PKG_CHECK_MODULES([OPENMAX], [libomxil-bellagio],
1407                       USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS"],
1408                       AC_MSG_ERROR($openmax_not_found))
1409   else
1410     AC_MSG_NOTICE($openmax_disabled)
1411     use_openmax=no
1412     USE_OPENMAX=0
1413   fi
1414 fi
1415
1416 # yajl version check (yajl_version.h was added in yajl 2.0)
1417 AC_CHECK_HEADERS([yajl/yajl_version.h], [], [
1418 AC_DEFINE(YAJL_MAJOR, 1, [yajl version 1])
1419 ], [])
1420
1421 # platform specific bin utilities
1422 if test "$host_vendor" != "apple" ; then
1423   AC_CHECK_PROG(HAVE_GAWK,gawk,"yes","no",)
1424   if test "$HAVE_GAWK" = "no" ; then
1425     AC_MSG_ERROR($missing_program)
1426   fi
1427 fi
1428
1429 if test "$use_arch" != "arm" ; then
1430   AC_CHECK_PROG(HAVE_CMAKE,cmake,"yes","no",)
1431   if test "$HAVE_CMAKE" = "no" ; then
1432     AC_MSG_ERROR($missing_program)
1433   fi
1434 fi
1435
1436 AC_CHECK_PROG(HAVE_GPERF,gperf,"yes","no",)
1437 if test "$HAVE_GPERF" = "no" ; then
1438   AC_MSG_ERROR($missing_program)
1439 fi
1440
1441 AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",)
1442 if test "$HAVE_UNZIP" = "no" ; then
1443   AC_MSG_ERROR($missing_program)
1444 fi
1445
1446 AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",)
1447 if test "$HAVE_ZIP" = "no" ; then
1448   AC_MSG_ERROR($missing_program)
1449 fi
1450
1451 if test "$ARCH" = "i486-linux" || test "$ARCH" = "x86-freebsd"; then
1452   AC_CHECK_PROG(HAVE_NASM,nasm,"yes","no",)
1453   if test "$HAVE_NASM" = "no" ; then
1454     AC_MSG_ERROR($missing_program)
1455   fi
1456 fi
1457
1458 AC_CHECK_PROG(HAVE_GIT,git,"yes","no",)
1459
1460 # Checks for header files.
1461 AC_HEADER_DIRENT
1462 AC_HEADER_STDC
1463 AC_HEADER_SYS_WAIT
1464 AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h limits.h locale.h \
1465   malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
1466   strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h \
1467   sys/time.h sys/timeb.h sys/vfs.h termios.h unistd.h utime.h wchar.h wctype.h])
1468 AC_CHECK_HEADERS([cdio/iso9660.h],,AC_MSG_ERROR([$missing_headers]))
1469
1470 # Checks for typedefs, structures, and compiler characteristics.
1471 AC_HEADER_STAT
1472 AC_HEADER_STDBOOL
1473 AC_C_CONST
1474 AC_TYPE_UID_T
1475 AC_C_INLINE
1476 AC_TYPE_INT8_T
1477 AC_TYPE_INT16_T
1478 AC_TYPE_INT32_T
1479 AC_TYPE_INT64_T
1480 AC_TYPE_MODE_T
1481 AC_TYPE_OFF_T
1482 AC_TYPE_PID_T
1483 AC_C_RESTRICT
1484 AC_TYPE_SIZE_T
1485 AC_TYPE_SSIZE_T
1486 AC_CHECK_MEMBERS([struct stat.st_rdev])
1487 AC_HEADER_TIME
1488 AC_STRUCT_TM
1489 AC_TYPE_UINT8_T
1490 AC_TYPE_UINT16_T
1491 AC_TYPE_UINT32_T
1492 AC_TYPE_UINT64_T
1493 AC_C_BIGENDIAN
1494
1495 if test "$cross_compiling" = "yes"; then
1496   final_message="$final_message\n  Crosscomp.:\tYes"
1497 else
1498   final_message="$final_message\n  Crosscomp.:\tNo"
1499 fi
1500
1501 final_message="$final_message\n  target ARCH:\t$use_arch"
1502 final_message="$final_message\n  target CPU:\t$use_cpu"
1503
1504 if test "$use_gles" = "yes"; then
1505   final_message="$final_message\n  OpenGLES:\tYes"
1506   USE_OPENGLES=1
1507   USE_OPENGL=0
1508 else
1509   USE_OPENGLES=0
1510   if test "$use_gl" = "yes"; then
1511     final_message="$final_message\n  OpenGL:\tYes"
1512     USE_OPENGL=1
1513   else
1514     final_message="$final_message\n  OpenGL:\tNo (Very Slow)"
1515     SDL_DEFINES="-DHAS_SDL_2D"
1516     USE_OPENGL=0
1517   fi
1518 fi
1519
1520 if test "$use_alsa" = "yes"; then
1521   USE_ALSA=1
1522   AC_DEFINE([USE_ALSA],[1],["Define to 1 if alsa is installed"])
1523   final_message="$final_message\n  ALSA:\t\tYes"
1524 else
1525   USE_ALSA=0
1526   final_message="$final_message\n  ALSA:\t\tNo"
1527 fi
1528
1529 if test "$use_dbus" = "yes"; then
1530   final_message="$final_message\n  DBUS:\t\tYes"
1531 else
1532   final_message="$final_message\n  DBUS:\t\tNo"
1533 fi
1534
1535 if test "x$use_vdpau" != "xno"; then
1536   final_message="$final_message\n  VDPAU:\tYes"
1537 else
1538   final_message="$final_message\n  VDPAU:\tNo"
1539 fi
1540
1541 if test "x$use_vaapi" != "xno"; then
1542   final_message="$final_message\n  VAAPI:\tYes"
1543 else
1544   final_message="$final_message\n  VAAPI:\tNo"
1545 fi
1546
1547 if test "x$use_crystalhd" != "xno"; then
1548   final_message="$final_message\n  CrystalHD:\tYes"
1549 else
1550   final_message="$final_message\n  CrystalHD:\tNo"
1551 fi
1552
1553 if test "x$use_vdadecoder" != "xno"; then
1554   final_message="$final_message\n  VDADecoder:\tYes"
1555 else
1556   final_message="$final_message\n  VDADecoder:\tNo"
1557 fi
1558
1559 if test "x$use_vtbdecoder" != "xno"; then
1560   final_message="$final_message\n  VTBDecoder:\tYes"
1561 else
1562   final_message="$final_message\n  VTBDecoder:\tNo"
1563 fi
1564
1565 if test "$use_openmax" != "no"; then
1566   final_message="$final_message\n  OpenMax:\tYes"
1567 else
1568   final_message="$final_message\n  OpenMax:\tNo"
1569 fi
1570
1571 if test "$use_joystick" = "yes"; then
1572   final_message="$final_message\n  Joystick:\tYes"
1573   SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_JOYSTICK"
1574 else
1575   final_message="$final_message\n  Joystick:\tNo"
1576 fi
1577
1578 if test "$use_xrandr" = "yes"; then
1579   final_message="$final_message\n  XRandR:\tYes"
1580   USE_XRANDR=1
1581 else
1582   final_message="$final_message\n  XRandR:\tNo"
1583   USE_XRANDR=0
1584 fi
1585
1586 if test "$use_goom" = "yes"; then
1587   final_message="$final_message\n  GOOM:\t\tYes"
1588 else
1589   final_message="$final_message\n  GOOM:\t\tNo"
1590 fi
1591
1592 if test "$use_rsxs" = "yes"; then
1593   final_message="$final_message\n  RSXS:\t\tYes"
1594 else
1595   final_message="$final_message\n  RSXS:\t\tNo"
1596 fi
1597
1598 if test "$use_projectm" = "yes"; then
1599   final_message="$final_message\n  ProjectM:\tYes"
1600 else
1601   final_message="$final_message\n  ProjectM:\tNo"
1602 fi
1603
1604 if test "$use_skin_touched" = "yes"; then
1605   final_message="$final_message\n  Skin Touched:\tYes"
1606 else
1607   final_message="$final_message\n  Skin Touched:\tNo"
1608 fi
1609
1610 if test "$use_x11" = "yes"; then
1611   final_message="$final_message\n  X11:\t\tYes"
1612 else
1613   final_message="$final_message\n  X11:\t\tNo"
1614 fi
1615
1616 if test "$use_libbluray" = "yes"; then
1617   final_message="$final_message\n  Bluray:\tYes"
1618 else
1619   final_message="$final_message\n  Bluray:\tNo"
1620 fi
1621
1622 USE_TEXTUREPACKER_NATIVE=0
1623 if test "x$use_texturepacker" != "xno"; then
1624   final_message="$final_message\n  TexturePacker:Yes"
1625   USE_TEXTUREPACKER=1
1626   if test "x$use_texturepacker_native" = "xyes"; then
1627     USE_TEXTUREPACKER_NATIVE=1
1628     if [[ ! -d "$USE_TEXTUREPACKER_NATIVE_ROOT" ]]; then 
1629       USE_TEXTUREPACKER_NATIVE_ROOT= 
1630     fi
1631   fi
1632 else
1633   final_message="$final_message\n  TexturePacker:No"
1634   USE_TEXTUREPACKER=0
1635 fi
1636
1637 if test "$use_mid" = "yes"; then
1638   final_message="$final_message\n  MID Support:\tYes"
1639   SDL_DEFINES="$SDL_DEFINES -DMID"
1640 else
1641   final_message="$final_message\n  MID Support:\tNo"
1642 fi
1643
1644 ORIGCC=$CC
1645 ORIGCXX=$CXX
1646 if test "x$use_ccache" != "xno"; then
1647   AC_PATH_PROG(CCACHE,ccache,none)
1648   if test "$ac_cv_path_CCACHE" = "none"; then
1649     if test "x$use_ccache" = "xyes"; then
1650       AC_MSG_ERROR([ccache not found.]);
1651     else
1652       AC_MSG_NOTICE([ccache not found. Falling back to default CC])
1653       final_message="$final_message\n  ccache:\tNo"
1654     fi
1655   else
1656     CC="$ac_cv_path_CCACHE $CC"
1657     CXX="$ac_cv_path_CCACHE $CXX"
1658     AC_MSG_NOTICE(enabling ccache)
1659     final_message="$final_message\n  ccache:\tYes"
1660   fi
1661 else
1662   final_message="$final_message\n  ccache:\tNo"
1663 fi
1664
1665 if test "x$use_pulse" != "xno"; then
1666   XBMC_STANDALONE_SH_PULSE=tools/Linux/xbmc-standalone.sh.pulse
1667   final_message="$final_message\n  PulseAudio:\tYes"
1668 else
1669   XBMC_STANDALONE_SH_PULSE=/dev/null
1670   final_message="$final_message\n  PulseAudio:\tNo"
1671 fi
1672
1673 if test "$use_hal" = "yes"; then
1674   final_message="$final_message\n  HAL Support:\tYes"
1675 else
1676   final_message="$final_message\n  HAL Support:\tNo"
1677 fi
1678
1679 # DVDCSS
1680 if test "$use_dvdcss" = "yes"; then
1681   AC_MSG_NOTICE($dvdcss_enabled)
1682   final_message="$final_message\n  DVDCSS:\tYes"
1683   BUILD_DVDCSS=1
1684   SKIP_CONFIG_DVDCSS=0
1685   DVDREAD_CFLAGS="-D_XBMC -DHAVE_DVDCSS_DVDCSS_H"
1686 else
1687   AC_MSG_NOTICE($dvdcss_disabled)
1688   final_message="$final_message\n  DVDCSS:\tNo"
1689   BUILD_DVDCSS=0
1690   SKIP_CONFIG_DVDCSS=1
1691   DVDREAD_CFLAGS="-D_XBMC -UHAVE_DVDCSS_DVDCSS_H"
1692 fi
1693 if test "$host_vendor" = "apple"; then
1694  DVDREAD_CFLAGS="$DVDREAD_CFLAGS -D__DARWIN__"
1695 fi
1696
1697 if test "$use_avahi" = "yes"; then
1698   final_message="$final_message\n  Avahi:\tYes"
1699 else
1700   final_message="$final_message\n  Avahi:\tNo"
1701 fi
1702
1703 if test "$HAVE_GIT" = "yes"; then
1704   GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
1705 fi
1706 if test "$GIT_REV" = ""; then
1707   GIT_REV="Unknown"
1708 fi
1709 if test "$host_vendor" = "apple"; then
1710   echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
1711 else
1712   SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'"
1713 fi
1714
1715 if test "$use_nonfree" = "yes"; then
1716   final_message="$final_message\n  Non-free:\tYes"
1717   HAVE_XBMC_NONFREE=1
1718   AC_DEFINE([HAVE_XBMC_NONFREE], [1], [Define to 1 to enable non-free components.])
1719 else
1720   HAVE_XBMC_NONFREE=0
1721   final_message="$final_message\n  Non-free:\tNo"
1722 fi
1723
1724 if test "$use_asap" = "yes"; then
1725   AC_CHECK_PROG(HAVE_GDC,gdc,"yes","no")
1726   if test "$HAVE_GDC" = "no"; then
1727     AC_MSG_ERROR($missing_program);
1728   fi
1729   AC_CHECK_PROG(HAVE_FPC,fpc,"yes","no")
1730   if test "$HAVE_FPC" = "no"; then
1731     AC_MSG_ERROR($missing_program);
1732   fi
1733   USE_ASAP_CODEC=1
1734   AC_DEFINE([USE_ASAP_CODEC], [1], [Define to 1 to enable ASAP codec.])
1735   final_message="$final_message\n  ASAP Codec:\tYes"
1736 else
1737   USE_ASAP_CODEC=0
1738   final_message="$final_message\n  ASAP Codec:\tNo"
1739 fi
1740
1741 if test "$use_webserver" = "yes"; then
1742   final_message="$final_message\n  Webserver:\tYes"
1743 else
1744   final_message="$final_message\n  Webserver:\tNo"
1745 fi
1746
1747 if test "$use_librtmp" != "no"; then
1748   final_message="$final_message\n  libRTMP support:\tYes"
1749 else
1750   final_message="$final_message\n  libRTMP support:\tNo"
1751 fi
1752
1753 if test "x$use_samba" != "xno"; then
1754   final_message="$final_message\n  libsmbclient support:\tYes"
1755 else
1756   final_message="$final_message\n  libsmbclient support:\tNo"
1757 fi
1758
1759 if test "$use_libnfs" != "no"; then
1760   final_message="$final_message\n  libnfs client support:Yes"
1761 else
1762   final_message="$final_message\n  libnfs client support:No"
1763 fi
1764
1765 if test "x$use_libafpclient" != "xno"; then
1766   final_message="$final_message\n  libafpclient support:\tYes"
1767 else  
1768   final_message="$final_message\n  libafpclient support:\tNo"
1769 fi
1770
1771 if test "$use_airplay" != "no"; then
1772   final_message="$final_message\n  AirPlay support:\tYes"
1773 else
1774   final_message="$final_message\n  AirPLay support:\tNo"
1775 fi
1776
1777 if test "x$use_airtunes" != "xno"; then
1778   final_message="$final_message\n  AirTunes support:\tYes"  
1779 else
1780   final_message="$final_message\n  AirTunes support:\tNo"
1781 fi
1782
1783 if test "$use_optical_drive" = "yes"; then
1784   final_message="$final_message\n  Optical drive:\tYes"
1785 else
1786   final_message="$final_message\n  Optical drive:\tNo"
1787 fi
1788
1789 if test "x$use_libudev" != "xno"; then
1790   final_message="$final_message\n  libudev support:\tYes"
1791 else
1792   final_message="$final_message\n  libudev support:\tNo"
1793 fi
1794
1795 if test "x$use_libusb" != "xno"; then
1796   final_message="$final_message\n  libusb support:\tYes"
1797 else
1798   final_message="$final_message\n  libusb support:\tNo"
1799 fi
1800
1801 if test "$use_libcec" = "yes"; then
1802   final_message="$final_message\n  libCEC support:\tYes"
1803 else
1804   final_message="$final_message\n  libCEC support:\tNo"
1805 fi
1806
1807 ### External libraries messages
1808 if test "$use_external_libcec" = "yes"; then
1809   final_message="$final_message\n  External libCEC:\tYes"
1810 else
1811   final_message="$final_message\n  External libCEC:\tNo"
1812 fi
1813
1814 if test "$use_external_ffmpeg" = "yes"; then
1815   final_message="$final_message\n  External FFmpeg:\tYes"
1816 else
1817   final_message="$final_message\n  External FFmpeg:\tNo"
1818 fi
1819
1820 OUTPUT_FILES="Makefile \
1821     Makefile.include \
1822     addons/skin.confluence/media/Makefile \
1823     xbmc/Makefile \
1824     xbmc/cdrip/Makefile \
1825     xbmc/cores/Makefile \
1826     xbmc/cores/VideoRenderers/Makefile \
1827     xbmc/cores/dvdplayer/Makefile \
1828     lib/Makefile \
1829     lib/libdvd/Makefile \
1830     xbmc/cores/DllLoader/Makefile \
1831     xbmc/cores/dvdplayer/DVDCodecs/Makefile \
1832     xbmc/cores/dvdplayer/DVDCodecs/Audio/Makefile \
1833     xbmc/cores/dvdplayer/DVDCodecs/Overlay/Makefile \
1834     xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile \
1835     xbmc/cores/dvdplayer/DVDDemuxers/Makefile \
1836     xbmc/cores/dvdplayer/DVDSubtitles/Makefile \
1837     xbmc/cores/AudioRenderers/Makefile \
1838     xbmc/cores/paplayer/Makefile \
1839     lib/timidity/Makefile \
1840     lib/xbadpcm/Makefile \
1841     lib/asap/Makefile \
1842     lib/nosefart/Makefile \
1843     lib/libsidplay2/Makefile \
1844     lib/vgmstream/Makefile \
1845     lib/snesapu/SNES/SNESAPU/Makefile \
1846     lib/stsound/StSoundLibrary/Makefile \
1847     xbmc/cores/playercorefactory/Makefile \
1848     xbmc/music/karaoke/Makefile \
1849     xbmc/osx/Makefile \
1850     xbmc/guilib/Makefile \
1851     xbmc/interfaces/Makefile \
1852     xbmc/network/Makefile \
1853     lib/libRTV/Makefile \
1854     lib/libexif/Makefile \
1855     lib/libXDAAP/Makefile \
1856     lib/cmyth/Makefile \
1857     lib/libhdhomerun/Makefile \
1858     lib/libsquish/Makefile \
1859     lib/libid3tag/Makefile \
1860     lib/cximage-6.0/Makefile \
1861     lib/addons/script.module.pil/Makefile \
1862     xbmc/interfaces/python/Makefile \
1863     xbmc/interfaces/python/xbmcmodule/Makefile \
1864     lib/libUPnP/Makefile \
1865     xbmc/DllPaths_generated.h \
1866     xbmc/linux/Makefile \
1867     xbmc/filesystem/Makefile \
1868     xbmc/screensavers/rsxs-0.9/xbmc/Makefile \
1869     xbmc/visualizations/XBMCProjectM/Makefile \
1870     xbmc/visualizations/Goom/Makefile \
1871     xbmc/visualizations/OpenGLSpectrum/Makefile \
1872     xbmc/visualizations/WaveForm/Makefile \
1873     xbmc/visualizations/iTunes/Makefile \
1874     tools/Linux/xbmc.sh \
1875     tools/Linux/xbmc-standalone.sh \
1876     tools/TexturePacker/Makefile \
1877     tools/EventClients/Clients/OSXRemote/Makefile \
1878     xbmc/peripherals/bus/Makefile \
1879     xbmc/peripherals/devices/Makefile \
1880     lib/libcec/Makefile"
1881
1882 if test "$use_skin_touched" = "yes"; then
1883 OUTPUT_FILES+=" addons/skin.touched/media/Makefile"
1884 fi
1885
1886 # Line below is used so we can use AM_INIT_AUTOMAKE. The corresponding
1887 # .dummy.am does nothing.
1888 AC_CONFIG_FILES([.dummy])
1889
1890 AC_CONFIG_FILES([${OUTPUT_FILES}])
1891 OUTPUT_FILES="$OUTPUT_FILES \
1892   .dummy"
1893 AC_SUBST(CFLAGS)
1894 AC_SUBST(CXXFLAGS)
1895 AC_SUBST(INCLUDES)
1896 AC_SUBST(LDFLAGS)
1897 AC_SUBST(SDL_DEFINES)
1898 AC_SUBST(BUILD_DVDCSS)
1899 AC_SUBST(DISABLE_GOOM)
1900 AC_SUBST(DISABLE_RSXS)
1901 AC_SUBST(DISABLE_PROJECTM)
1902 AC_SUBST(USE_SKIN_TOUCHED)
1903 AC_SUBST(USE_EXTERNAL_FFMPEG)
1904 AC_SUBST(PYTHON_VERSION)
1905 AC_SUBST(OUTPUT_FILES)
1906 AC_SUBST(HAVE_XBMC_NONFREE)
1907 AC_SUBST(USE_ASAP_CODEC)
1908 AC_SUBST(LIBCURL_BASENAME)
1909 AC_SUBST(LIBFLAC_BASENAME)
1910 AC_SUBST(LIBVORBISFILE_BASENAME)
1911 AC_SUBST(LIBMODPLUG_BASENAME)
1912 AC_SUBST(LIBMAD_BASENAME)
1913 AC_SUBST(LIBOGG_BASENAME)
1914 AC_SUBST(LIBVORBISENC_BASENAME)
1915 AC_SUBST(LIBVORBIS_BASENAME)
1916 AC_SUBST(LIBASS_BASENAME)
1917 AC_SUBST(LIBMEPG2_BASENAME)
1918 AC_SUBST_FILE(XBMC_STANDALONE_SH_PULSE)
1919 AC_SUBST(USE_OPENGL)
1920 AC_SUBST(USE_OPENGLES)
1921 AC_SUBST(USE_VDPAU)
1922 AC_SUBST(USE_VAAPI)
1923 AC_SUBST(USE_CRYSTALHD)
1924 AC_SUBST(USE_LIBSMBCLIENT)
1925 AC_SUBST(USE_LIBNFS)
1926 AC_SUBST(USE_LIBAFPCLIENT)
1927 AC_SUBST(USE_AIRPLAY)
1928 AC_SUBST(USE_VDA)
1929 AC_SUBST(USE_OPENMAX)
1930 AC_SUBST(USE_PULSE)
1931 AC_SUBST(USE_XRANDR)
1932 AC_SUBST(USE_ALSA)
1933 AC_SUBST(USE_TEXTUREPACKER)
1934 AC_SUBST(USE_TEXTUREPACKER_NATIVE)
1935 AC_SUBST(USE_TEXTUREPACKER_NATIVE_ROOT)
1936 AC_SUBST(USE_AIRTUNES)
1937 AC_SUBST(USE_LIBUDEV)
1938 AC_SUBST(USE_LIBUSB)
1939 AC_SUBST(USE_LIBCEC)
1940 AC_SUBST(USE_EXTERNAL_LIBCEC)
1941
1942
1943 # pushd and popd are not available in other shells besides bash, so implement
1944 # our own pushd/popd functions
1945 XB_DIRSTACK="$PWD"
1946 xb_pushd()
1947 {
1948   local dirname="$1"
1949   if [[ -d "$dirname" ]] && [[ -x "$dirname" ]]; then
1950     cd "$dirname"
1951     XB_DIRSTACK="$dirname ${XB_DIRSTACK:-$PWD}"
1952     return 0
1953   else
1954     AC_MSG_ERROR(xb_pushd: unable to change to $dirname)
1955   fi
1956 }
1957 xb_popd()
1958 {
1959   if [[ -n "$XB_DIRSTACK" ]]; then
1960     XB_DIRSTACK="${XB_DIRSTACK#* }"
1961     cd "${XB_DIRSTACK%% *}"
1962     return 0
1963   else
1964     AC_MSG_ERROR(xb_popd: unable to go back to previous directory)
1965   fi
1966 }
1967
1968 # Function to run the configure scripts in our submodules
1969 # Consists of three paramaters, the path to the submodule, the configure command
1970 # with appropriate arguments, and a third parameter set to 1 if we are to skip
1971 # running the script, anything else if not.
1972 AC_DEFUN([XB_CONFIG_MODULE],[
1973 AC_CONFIG_COMMANDS_POST([
1974 if [[ $3 != "1" ]]; then
1975     if [[ -d $1 ]]; then
1976       xb_pushd $1
1977       $2
1978       if [[ $? -ne 0 ]]; then
1979         xb_popd
1980         AC_MSG_ERROR([[Submodule $1 failed to configure]])
1981       else
1982         xb_popd
1983       fi
1984     else
1985       AC_MSG_ERROR([[Submodule $1 does not exist]])
1986     fi
1987 else
1988     AC_MSG_NOTICE([[Skipping configuration of submodule $1.]])
1989 fi
1990 ])
1991 ])
1992
1993 XB_CONFIG_MODULE([lib/ffmpeg], [
1994   if test "$host_vendor" = "apple" ; then
1995     ./configure \
1996       --extra-cflags="$CFLAGS $FFMPEG_EXTRACFLAGS -w -D_DARWIN_C_SOURCE -Dattribute_deprecated=" \
1997       `if test "$use_arch" != "no"; then echo --enable-cross-compile; fi` \
1998       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
1999       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
2000       --target-os=$(tolower $(uname -s)) \
2001       --disable-amd3dnow \
2002       --disable-armv5te \
2003       --disable-armv6t2 \
2004       `if test "$use_arch" != "yes"; then echo --enable-neon; fi`\
2005       --disable-static \
2006       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
2007       --disable-muxers \
2008       --enable-muxer=spdif \
2009       --enable-muxer=adts \
2010       --disable-encoders \
2011       --enable-encoder=ac3 \
2012       --enable-encoder=aac \
2013       `if test "$use_ffmpeg_libvorbis" = "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
2014       --disable-devices \
2015       --disable-ffprobe \
2016       --disable-ffplay \
2017       --disable-ffserver \
2018       --disable-ffmpeg \
2019       --enable-shared \
2020       --disable-doc \
2021       --disable-decoder=mpeg_xvmc \
2022       --enable-postproc \
2023       --enable-gpl \
2024       --enable-protocol=http \
2025       --enable-pthreads \
2026       --enable-runtime-cpudetect \
2027       --cc="$CC" &&
2028     sed -i "" -e "s#YASM=yasm#YASM=${prefix}/bin/yasm#" config.mak &&
2029     sed -i "" -e "s#YASMDEP=yasm#YASMDEP=${prefix}/bin/yasm#" config.mak &&
2030     sed -i "" -e "s# -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 # #" config.mak
2031     if test "$use_arch" = "ppc"; then
2032       sed -i "" -e "s/HAVE_GNU_AS 1/HAVE_GNU_AS 0/" config.h
2033       sed -i "" -e "s/^HAVE_GNU_AS=yes/!HAVE_GNU_AS=yes/" config.mak
2034     fi
2035   else
2036     CFLAGS="" \
2037     LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")" \
2038     ./configure \
2039       --extra-cflags="$PASSED_CFLAGS $FFMPEG_EXTRACFLAGS" \
2040       --disable-static \
2041       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
2042       `if test "$cross_compiling" = "yes"; then echo --enable-cross-compile; fi` \
2043       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
2044       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
2045       --target-os=$(tolower $(uname -s)) \
2046       --disable-muxers \
2047       --enable-muxer=spdif \
2048       --enable-muxer=adts \
2049       --disable-encoders \
2050       --enable-encoder=ac3 \
2051       --enable-encoder=aac \
2052       `if test "$use_ffmpeg_libvorbis" = "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
2053       --disable-decoder=mpeg_xvmc \
2054       --disable-devices \
2055       --disable-ffprobe \
2056       --disable-ffplay \
2057       --disable-ffserver \
2058       --disable-ffmpeg \
2059       --enable-shared \
2060       --disable-doc \
2061       --enable-postproc \
2062       --enable-gpl \
2063       `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \
2064       `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \
2065       --enable-protocol=http \
2066       --enable-pthreads \
2067       --enable-runtime-cpudetect \
2068       --custom-libname-with-major="\$(FULLNAME)-\$(LIBMAJOR)-${ARCH}\$(SLIBSUF)" \
2069       `case $host_cpu in i?86*) echo --disable-pic ;; *) echo --enable-pic ;; esac` \
2070       --cc="$CC" &&
2071       sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h &&
2072       sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h
2073   fi
2074 ], [$USE_EXTERNAL_FFMPEG])
2075
2076 XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [
2077   ./configure \
2078     CC="$CC" \
2079     CXX="$CXX" \
2080     CFLAGS="$CFLAGS" \
2081     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2082     --host=$host_alias \
2083     --build=$build_alias \
2084     --target=$target_alias \      
2085     --disable-doc \
2086     --enable-static \
2087     --with-pic
2088 ], [$SKIP_CONFIG_DVDCSS])
2089
2090 XB_CONFIG_MODULE([lib/libdvd/libdvdread], [
2091   ./configure2 \
2092     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../libdvdcss/src" \
2093     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2094     --host=$host_alias \
2095     --build=$build_alias \
2096     --target=$target_alias \      
2097     --enable-static \
2098     --disable-shared \
2099     --disable-strip \
2100     --disable-opts \
2101     --cc="$CC" &&
2102   $MAKE dvdread-config &&
2103   mkdir -p `pwd`/../includes/dvdread
2104   cp `pwd`/../libdvdread/src/*.h `pwd`/../includes/dvdread
2105 ], [0])
2106
2107 XB_CONFIG_MODULE([lib/libdvd/libdvdnav], [
2108   ./configure2 \
2109     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../includes" \
2110     --extra-ldflags="-L`pwd`/../libdvdread/obj" \
2111     --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
2112     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2113     --host=$host_alias \
2114     --build=$build_alias \
2115     --target=$target_alias \      
2116     --enable-static \
2117     --disable-shared \
2118     --cc="$CC"
2119 ], [0])
2120
2121 XB_CONFIG_MODULE([lib/libid3tag/libid3tag],[
2122   ./configure \
2123     CC="$CC" \
2124     CXX="$CXX" \
2125     CFLAGS="$CFLAGS" \ 
2126     CXXFLAGS="$CXXFLAGS" \
2127     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2128     --host=$host_alias \
2129     --build=$build_alias \
2130     --target=$target_alias \      
2131     --disable-static \
2132     --with-pic
2133 ], [0])
2134
2135 XB_CONFIG_MODULE([xbmc/visualizations/XBMCProjectM/libprojectM],[
2136   set -x
2137   rm -f CMakeCache.txt && CC="$ORIGCC" CXX="$ORIGCXX" cmake    \
2138     -DCMAKE_BUILD_TYPE=None -DUSE_FTGL:BOOL=OFF        \
2139     -DCMAKE_C_FLAGS:STRING="${CPPFLAGS} ${CFLAGS}"     \
2140     -DCMAKE_CXX_FLAGS:STRING="${CPPFLAGS} ${CXXFLAGS}" \
2141     -DCMAKE_INSTALL_PREFIX="${prefix}"                 \
2142     -DCMAKE_INSTALL_LIBDIR:PATH="${libdir}"            \
2143     -DINCLUDE_INSTALL_DIR:PATH="${includedir}"         \
2144     -DLIB_INSTALL_DIR:PATH="${libdir}"                 \
2145     -DSYSCONF_INSTALL_DIR:PATH="${sysconfdir}"         \
2146     -DSHARE_INSTALL_PREFIX:PATH="${datadir}" . &&
2147   if test "$host_vendor" = "apple" ; then
2148     # cmake has hardcoded paths to macports which bork our darwin depends cross/ppc, remove them
2149     sed -i "" -e "s|-L/opt/local/lib| |" CMakeFiles/projectM.dir/link.txt
2150     sed -i "" -e "s|-L/opt/local/lib| |" CMakeFiles/projectM.dir/flags.make
2151     sed -i "" -e "s|-I/opt/local/include| |" CMakeFiles/projectM.dir/flags.make
2152   fi
2153   set +x
2154 ], [$DISABLE_PROJECTM])
2155
2156 XB_CONFIG_MODULE([xbmc/visualizations/Goom/goom2k4-0],[
2157   ./configure  \
2158     CFLAGS="$CFLAGS" \ 
2159     CXXFLAGS="$CXXFLAGS" \
2160     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2161     --host=$host_alias \
2162     --build=$build_alias \
2163     --target=$target_alias \      
2164     --disable-shared \
2165     --enable-static \
2166     --with-pic
2167 ], [$DISABLE_GOOM])
2168
2169 XB_CONFIG_MODULE([xbmc/screensavers/rsxs-0.9/], [
2170   ./configure \
2171     CC="$CC" \
2172     CXX="$CXX" \
2173     CFLAGS="$CFLAGS" \ 
2174     CXXFLAGS="$CXXFLAGS" \
2175     `if test "$host_vendor" = "apple"; then echo --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib; fi` \
2176     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2177     --host=$host_alias \
2178     --build=$build_alias \
2179     --target=$target_alias \      
2180     --without-xscreensaver \
2181     --disable-sound \
2182     --disable-cyclone \
2183     --disable-fieldlines \
2184     --disable-flocks \
2185     --disable-flux \
2186     --disable-helios \
2187     --disable-hyperspace \
2188     --disable-lattice \
2189     --disable-skyrocket
2190 ], [$DISABLE_RSXS])
2191
2192 XB_CONFIG_MODULE([lib/libapetag], [
2193   ./configure \
2194     `if test "$host_vendor" = "apple"; then echo --disable-shared; fi` \
2195     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2196     --host=$host_alias \
2197     --build=$build_alias \
2198     --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
2199 ], [0])
2200
2201 XB_CONFIG_MODULE([lib/cpluff], [
2202   ./configure --disable-nls \
2203     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2204     --host=$host_alias \
2205     --build=$build_alias \
2206     --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
2207     #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"    
2208 ], [0])
2209
2210 XB_CONFIG_MODULE([lib/libcec], [
2211   if test "$use_libcec" = "yes" && test "$use_external_libcec" = "no" ; then
2212     cd libcec ; ./configure \
2213       --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2214       --host=$host_alias \
2215       --build=$build_alias \
2216       --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
2217   fi    
2218 ], [0])
2219
2220 AC_OUTPUT
2221
2222 final_message="$final_message\n  prefix:\t$prefix\n$dashes"
2223 echo -e "$final_message\n"