touched: re-added as submodule
[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 # libRTMP
971 if test "$use_librtmp" != "no"; then
972   AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
973    [if test "$use_librtmp" = "yes"; then
974       AC_MSG_ERROR($librtmp_not_found)
975     elif test "$use_librtmp" != "no"; then
976       AC_MSG_NOTICE($librtmp_not_found)
977       use_librtmp="no"
978     fi
979    ])
980   if test "$use_librtmp" != "no"; then
981     XB_FIND_SONAME([RTMP], [rtmp], [use_librtmp])
982   fi
983   if test "$use_librtmp" != "no"; then
984     AC_DEFINE([HAS_LIBRTMP], [1], [Whether to use libRTMP library.])
985   fi
986 else
987   AC_MSG_NOTICE($librtmp_disabled)
988 fi
989
990 # samba
991 if test "x$use_samba" != "xno"; then
992   AC_CHECK_LIB([smbclient], [main],,
993     use_samba=no;AC_MSG_ERROR($missing_library))
994     USE_LIBSMBCLIENT=0
995 else
996   AC_MSG_RESULT($samba_disabled)
997   USE_LIBSMBCLIENT=0
998 fi
999
1000 if test "x$use_samba" != "xno"; then
1001   AC_DEFINE([HAVE_LIBSMBCLIENT], [1], [Define to 1 if you have Samba installed])
1002   USE_LIBSMBCLIENT=1
1003 fi
1004
1005 # libnfs
1006 if test "$use_libnfs" != "no"; then
1007   AC_CHECK_HEADERS([nfsc/libnfs.h],,
1008    [if test "$use_libnfs" = "yes"; then
1009       AC_MSG_ERROR($libnfs_not_found)
1010       USE_LIBNFS=0
1011     elif test "$use_libnfs" != "no"; then
1012       AC_MSG_NOTICE($libnfs_not_found)
1013       use_libnfs="no"
1014       USE_LIBNFS=0
1015     fi
1016    ])
1017   if test "$use_libnfs" != "no"; then
1018     XB_FIND_SONAME([NFS], [nfs], [use_libnfs])
1019   fi
1020   if test "$use_libnfs" != "no"; then
1021     AC_DEFINE([HAVE_LIBNFS], [1], [Whether to use libnfs library.])
1022     USE_LIBNFS=1
1023   fi
1024 else
1025   USE_LIBNFS=0
1026   AC_MSG_NOTICE($libnfs_disabled)
1027 fi
1028
1029 # libafpclient
1030 USE_LIBAFPCLIENT=0
1031 if test "x$use_libafpclient" != "xno"; then
1032   AC_CHECK_HEADERS([afpfs-ng/libafpclient.h],,
1033    [if test "x$use_libafpclient" = "xyes"; then
1034       AC_MSG_ERROR($libafpclient_not_found)
1035     elif test "x$use_libafpclient" != "xno"; then
1036       AC_MSG_NOTICE($libafpclient_not_found)
1037       use_libafpclient="no"
1038     fi
1039    ])
1040   if test "x$use_libafpclient" != "xno"; then
1041     XB_FIND_SONAME([AFPCLIENT], [afpclient], [use_libafpclient])
1042     AC_DEFINE([HAVE_LIBAFPCLIENT], [1], [Whether to use libafpclient library.])
1043     USE_LIBAFPCLIENT=1
1044   fi
1045 else
1046   AC_MSG_NOTICE($libafpclient_disabled)
1047 fi
1048
1049 # libplist for airplay feature
1050 USE_AIRPLAY=0
1051 if test "$use_airplay" != "no"; then
1052   AC_CHECK_LIB([plist],[main],,
1053    [if test "$use_airplay" = "yes"; then
1054       AC_MSG_ERROR($libplist_not_found)
1055     elif test "$use_airplay" != "no"; then
1056       AC_MSG_NOTICE($libplist_not_found)
1057       use_airplay="no"
1058     fi
1059    ])
1060
1061   if test "$use_airplay" != "no"; then
1062     XB_FIND_SONAME([PLIST], [plist], [use_airplay])
1063     USE_AIRPLAY=1
1064   fi
1065 fi
1066
1067 # libshairport for AirTunes
1068 USE_AIRTUNES=0
1069 if test "x$use_airtunes" != "xno"; then
1070   AC_CHECK_LIB([shairport], [shairport_set_ao],,
1071    [if test "x$use_airtunes" = "xyes"; then
1072       AC_MSG_ERROR($libshairport_not_found)
1073     elif test "x$use_airtunes" != "xno"; then
1074       AC_MSG_NOTICE($libshairport_not_found)
1075       use_airtunes="no"
1076     fi
1077    ])
1078
1079   if test "x$use_airtunes" != "xno"; then
1080     XB_FIND_SONAME([SHAIRPORT], [shairport], [use_airtunes])
1081     USE_AIRTUNES=1
1082   fi
1083 fi
1084
1085 # udev
1086 USE_LIBUDEV=0
1087   if test "$host_vendor" = "apple" ; then
1088   use_libudev="no"
1089   AC_MSG_NOTICE($libudev_disabled)
1090 else
1091   if test "$use_libudev" = "auto"; then
1092     PKG_CHECK_MODULES([UDEV], [libudev],
1093       use_libudev="yes"; use_libusb="no"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
1094       AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]),
1095       AC_MSG_RESULT($libudev_not_found))
1096   elif test "$use_libudev" = "yes" ; then
1097     PKG_CHECK_MODULES([UDEV], [libudev],
1098       use_libudev="yes"; use_libusb="no"; USE_LIBUDEV=1; [INCLUDES="$INCLUDES $UDEV_CFLAGS"; LIBS="$LIBS $UDEV_LIBS"]; \
1099       AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]),
1100       AC_MSG_ERROR($libudev_not_found))
1101     use_libudev="no"
1102     AC_MSG_NOTICE($libudev_disabled)
1103   fi
1104 fi
1105
1106 # libusb
1107 USE_LIBUSB=0
1108 if test "$use_libudev" != "yes"; then
1109   if test "$host_vendor" = "apple" ; then
1110     use_libusb="no"
1111     AC_MSG_NOTICE($libusb_disabled)
1112   else
1113     if test "$use_libusb" = "auto"; then
1114       PKG_CHECK_MODULES([USB], [libusb],
1115         use_libusb="yes"; USE_LIBUSB=1; [INCLUDES="$INCLUDES $USB_CFLAGS"; LIBS="$LIBS $USB_LIBS"; USE_LIBUSB=1]; \
1116         AC_DEFINE([HAVE_LIBUSB],[1],["Define to 1 if libusb is installed"]),
1117         use_libusb="no"; AC_MSG_RESULT($libusb_not_found))
1118     elif test "$use_libusb" = "yes"; then
1119       PKG_CHECK_MODULES([USB], [libusb],
1120         use_libusb="yes"; USE_LIBUSB=1; [INCLUDES="$INCLUDES $USB_CFLAGS"; LIBS="$LIBS $USB_LIBS"; USE_LIBUSB=1]; \
1121         AC_DEFINE([HAVE_LIBUSB],[1],["Define to 1 if libusb is installed"]),
1122         use_libusb="no"; AC_MSG_ERROR($libusb_not_found))
1123       use_libusb="no"
1124       AC_MSG_NOTICE($libusb_disabled)
1125     fi
1126   fi
1127 else
1128   use_libusb="no"
1129 fi
1130
1131 # libcec
1132 USE_LIBCEC=0
1133 if test "$use_libcec" = "yes"; then
1134   USE_LIBCEC=1; AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libCEC is installed"])
1135   AC_MSG_NOTICE($libcec_enabled)
1136 else
1137   use_libcec="no"
1138   AC_MSG_NOTICE($libcec_disabled)
1139 fi
1140
1141 ### External libraries checks
1142
1143 # external libcec
1144 USE_EXTERNAL_LIBCEC=0
1145 if test "$use_external_libcec" = "yes"; then
1146   USE_EXTERNAL_LIBCEC=1; PKG_CHECK_MODULES([CEC], [libcec],
1147     [INCLUDES="$INCLUDES $CEC_CFLAGS"; LIBS="$LIBS $CEC_LIBS"],
1148     AC_MSG_ERROR($libcec_external_missing))
1149 elif test "$use_libcec" = "yes"; then
1150   [INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/lib/libcec/include"]
1151   AC_MSG_NOTICE($libcec_internal)
1152 fi
1153
1154 # External FFmpeg
1155 if test "$use_external_ffmpeg" = "yes"; then
1156   FFMPEG_LIBNAMES="libavcodec libavfilter libavformat libavutil libpostproc libswscale"
1157
1158   # libavcore is optional
1159   PKG_CHECK_EXISTS([libavcore], FFMPEG_LIBNAMES="$FFMPEG_LIBNAMES libavcore")
1160
1161   PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
1162                     [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"],
1163                     AC_MSG_ERROR($missing_library))
1164
1165   # Determine whether AVPacket and relevant functions are defined in libavformat
1166   # or libavcodec
1167   AC_CHECK_LIB([avcodec], [av_free_packet],
1168   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavcodec. ==)],
1169   [AC_MSG_NOTICE(== AVPacket and relevant functions defined in libavformat. ==)
1170    AC_DEFINE([AVPACKET_IN_AVFORMAT], [1], [Whether AVPacket is in libavformat.])])
1171
1172   # in case the headers are in a custom directory
1173   SAVE_CPPFLAGS="$CPPFLAGS"
1174   CPPFLAGS="$CPPFLAGS $FFMPEG_CFLAGS"
1175
1176   # Possible places the ffmpeg headers may be
1177   AC_CHECK_HEADERS([libavcodec/avcodec.h libavfilter/avfilter.h libavformat/avformat.h libavutil/avutil.h libpostproc/postprocess.h libswscale/swscale.h],,
1178   [AC_CHECK_HEADERS([ffmpeg/avcodec.h ffmpeg/avfilter.h ffmpeg/avformat.h ffmpeg/avutil.h postproc/postprocess.h ffmpeg/swscale.h],,
1179   [AC_MSG_ERROR($missing_headers)])])
1180
1181   # optional
1182   AC_CHECK_HEADERS([libavcore/avcore.h libavcore/samplefmt.h libavutil/mem.h libavutil/samplefmt.h])
1183
1184   # old FFmpeg have this in libavcodec/opt.h instead:
1185   AC_CHECK_HEADERS([libavutil/opt.h])
1186
1187   # We'll support the use of rgb2rgb.h if it exists.
1188   AC_CHECK_HEADERS([libswscale/rgb2rgb.h],,)
1189   AC_CHECK_HEADERS([ffmpeg/rgb2rgb.h],,)
1190
1191   # Check if AVFilterBufferRefVideoProps AVRational member is named
1192   # 'pixel_aspect' or 'sample_aspect_ratio'.
1193   AC_CHECK_MEMBER([AVFilterBufferRefVideoProps.sample_aspect_ratio],
1194     [AC_DEFINE([HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO],
1195     [1],
1196     [Define to 1 if AVFilterBufferRefVideoProps has member sample_aspect_ratio.])],
1197       [AC_CHECK_MEMBER([AVFilterBufferRefVideoProps.sample_aspect_ratio],
1198       [AC_DEFINE([HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO],
1199       [1],
1200       [Define to 1 if AVFilterBufferRefVideoProps has member sample_aspect_ratio.])],
1201       ,
1202       [[#include <ffmpeg/avfilter.h>]])],
1203     [[#include <libavfilter/avfilter.h>]])
1204
1205   AC_MSG_NOTICE($external_ffmpeg_enabled)
1206   USE_EXTERNAL_FFMPEG=1
1207   AC_DEFINE([USE_EXTERNAL_FFMPEG], [1], [Whether to use external FFmpeg libraries.])
1208
1209   # Disable vdpau support if external libavcodec doesn't have it
1210   AC_CHECK_LIB([avcodec], [ff_vdpau_vc1_decode_picture],,
1211     [if test "x$use_vdpau" = "xyes"; then
1212       AC_MSG_ERROR($ffmpeg_vdpau_not_supported)
1213     else
1214       use_vdpau=no
1215       AC_MSG_RESULT($ffmpeg_vdpau_not_supported)
1216     fi])
1217
1218   # Check for 'PIX_FMT_VDPAU_MPEG4' from libavutil
1219   if test "x$use_vdpau" != "xno"; then
1220     AC_LANG_PUSH([C++])
1221     AC_LINK_IFELSE(
1222       [AC_LANG_SOURCE([ #include <libavutil/pixfmt.h>
1223         int main() { PixelFormat format = PIX_FMT_VDPAU_MPEG4; }])],
1224       [AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1],
1225       [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])],)
1226     AC_LANG_POP([C++])
1227   fi
1228   CPPFLAGS="$SAVE_CPPFLAGS"
1229 else
1230   AC_MSG_NOTICE($external_ffmpeg_disabled)
1231   USE_EXTERNAL_FFMPEG=0
1232   AC_DEFINE([PIX_FMT_VDPAU_MPEG4_IN_AVUTIL], [1], [Whether AVUtil defines PIX_FMT_VDPAU_MPEG4.])
1233 fi
1234
1235 # Python
1236 if test -z "$PYTHON_NOVERSIONCHECK"; then
1237   AX_PYTHON_DEVEL([>= 2.4])
1238   PYTHON_VERSION=$ac_python_version
1239 fi
1240
1241 if test -z "$PYTHON_VERSION"; then
1242   AC_MSG_ERROR([Can't find a Python version.])
1243 else
1244   AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
1245 fi
1246
1247 # VDPAU
1248 if test "x$use_vdpau" != "xno"; then
1249   if test "$host_vendor" = "apple" ; then
1250     if test "x$use_vdpau" = "xyes"; then
1251       AC_MSG_ERROR([VDPAU not supported on this platform])
1252     else
1253       use_vdpau="no"
1254       AC_MSG_NOTICE($vdpau_disabled)
1255     fi
1256     USE_VDPAU=0
1257   else
1258     USE_VDPAU=1
1259     AC_CHECK_HEADER([vdpau/vdpau.h],AC_DEFINE([HAVE_LIBVDPAU], [],
1260       [Define to 1 if you have the 'vdpau' library (-lvdpau).]),
1261     [if test "x$use_vdpau" = "xyes"; then
1262       USE_VDPAU=0
1263       AC_MSG_ERROR([$vdpau_not_found])
1264     else
1265       use_vdpau="no"
1266       USE_VDPAU=0
1267       AC_MSG_RESULT($vdpau_not_found)
1268     fi])
1269   fi
1270 else
1271   USE_VDPAU=0
1272   AC_MSG_NOTICE($vdpau_disabled)
1273 fi
1274
1275 # VAAPI
1276 if test "x$use_vaapi" != "xno"; then
1277   if test "$host_vendor" = "apple" ; then
1278     if test "x$use_vaapi" = "xyes"; then
1279       AC_MSG_ERROR([VAAPI not supported on this platform])
1280     else
1281       use_vaapi="no"
1282       AC_MSG_NOTICE($vaapi_disabled)
1283     fi
1284     USE_VAAPI=0
1285   else
1286     initial_val=$use_vaapi
1287     AC_CHECK_LIB([va], main, :, use_vaapi=no)
1288     if test "x$use_vaapi" != "xno"; then
1289       AC_CHECK_LIB([va-glx], main, LIBS="-lva -lva-glx $LIBS", use_vaapi=no, -lva)
1290     fi
1291
1292     if test "x$use_vaapi" = "xno"; then
1293       if test "x$initial_val" = "xyes"; then
1294         AC_MSG_ERROR($vaapi_not_found)
1295       else
1296         AC_MSG_RESULT($vaapi_not_found)
1297       fi
1298       USE_VAAPI=0
1299     else
1300       AC_DEFINE([HAVE_LIBVA], [1], [Define to 1 if you have the 'vaapi' libraries (-lva AND -lva-glx)])
1301       USE_VAAPI=1
1302     fi
1303   fi
1304 else
1305   AC_MSG_NOTICE($vaapi_disabled)
1306   USE_VAAPI=0
1307 fi
1308
1309 # CrystalHD
1310 if test "x$use_crystalhd" != "xno"; then
1311   SAVE_CFLAGS="$CFLAGS"
1312   CFLAGS="-D__LINUX_USER__"
1313   AC_CHECK_HEADER([libcrystalhd/libcrystalhd_if.h], [],
1314     [ if test "x$use_crystalhd" = "xyes"; then
1315         AC_MSG_ERROR($crystalhd_not_found)
1316       else
1317         use_crystalhd=no
1318         AC_MSG_RESULT($crystalhd_not_found)
1319       fi
1320       USE_CRYSTALHD=0
1321     ])
1322     CFLAGS="$SAVE_CFLAGS"
1323     if test "$host_vendor" != "apple"; then
1324       XB_FIND_SONAME([CRYSTALHD], [crystalhd], [use_crystalhd])
1325     fi
1326     if test "x$use_crystalhd" != "xno"; then
1327       SAVE_CFLAGS="$CFLAGS"
1328       CFLAGS="-D__LINUX_USER__ -llibcrystalhd"
1329       # check for new crystalhd lib
1330       AC_COMPILE_IFELSE(
1331         [AC_LANG_SOURCE([#include <libcrystalhd/bc_dts_types.h>
1332           #include <libcrystalhd/bc_dts_defs.h>
1333           PBC_INFO_CRYSTAL bCrystalInfo;])],
1334         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [2], [Define to 2 if you have the 'New Broadcom Crystal HD' library.]) ], 
1335         [ AC_DEFINE([HAVE_LIBCRYSTALHD], [1], [Define to 1 if you have the 'Old Broadcom Crystal HD' library.]) ])
1336       CFLAGS="$SAVE_CFLAGS"
1337       USE_CRYSTALHD=1
1338     fi
1339 else
1340   AC_MSG_NOTICE($crystalhd_disabled)
1341   USE_CRYSTALHD=0
1342 fi
1343
1344 # VDADecoder
1345 if test "x$use_vdadecoder" != "xno"; then
1346   if test "$host_vendor" = "apple" ; then
1347     HAVE_LIBVDADECODER=1
1348     AC_DEFINE([HAVE_LIBVDADECODER], [1], [Define to 1 if you have the 'VDADecoder' library.])
1349     AC_MSG_NOTICE($vdadecoder_enabled)
1350     USE_VDA=1
1351   else
1352     if test "x$use_vdadecoder" = "xyes"; then
1353       AC_MSG_ERROR([VDA Decoder not supported on this platform])
1354     else
1355       use_vdadecoder="no"
1356       AC_MSG_NOTICE($vdadecoder_disabled)
1357     fi
1358     USE_VDA=0
1359   fi
1360 else
1361   AC_MSG_NOTICE($vdadecoder_disabled)
1362 fi
1363
1364 # VTBDecoder
1365 if test "x$use_vtbdecoder" != "xno"; then
1366   if test "$host_vendor" = "apple" ; then
1367     HAVE_VIDEOTOOLBOXDECODER=1
1368     AC_DEFINE([HAVE_VIDEOTOOLBOXDECODER], [1], [Define to 1 if you have the 'VTBDecoder' library.])
1369     AC_MSG_NOTICE($vtbdecoder_enabled)
1370   else
1371     if test "x$use_vtbdecoder" = "xyes"; then
1372       AC_MSG_ERROR([VTB Decoder not supported on this platform])
1373     else
1374       use_vtbdecoder="no"
1375       AC_MSG_NOTICE($vtbdecoder_disabled)
1376     fi
1377   fi
1378 else
1379   AC_MSG_NOTICE($vtbdecoder_disabled)
1380 fi
1381
1382 # OpenMax
1383 if test "$host_vendor" = "apple" ; then
1384   use_openmax="no"
1385   USE_OPENMAX=0
1386   AC_MSG_NOTICE($openmax_disabled)
1387 else
1388   if test "$use_gles" = "yes" && test "$use_openmax" = "auto"; then
1389     PKG_CHECK_MODULES([OPENMAX], [libomxil-bellagio],
1390                       USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS"],
1391                       use_openmax=no;USE_OPENMAX=0;AC_MSG_RESULT($openmax_not_found))
1392   elif test "$use_gles" = "yes" && test "$use_openmax" = "yes"; then
1393     PKG_CHECK_MODULES([OPENMAX], [libomxil-bellagio],
1394                       USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS"],
1395                       AC_MSG_ERROR($openmax_not_found))
1396   else
1397     AC_MSG_NOTICE($openmax_disabled)
1398     use_openmax=no
1399     USE_OPENMAX=0
1400   fi
1401 fi
1402
1403 # yajl version check (yajl_version.h was added in yajl 2.0)
1404 AC_CHECK_HEADERS([yajl/yajl_version.h], [], [
1405 AC_DEFINE(YAJL_MAJOR, 1, [yajl version 1])
1406 ], [])
1407
1408 # platform specific bin utilities
1409 if test "$host_vendor" != "apple" ; then
1410   AC_CHECK_PROG(HAVE_GAWK,gawk,"yes","no",)
1411   if test "$HAVE_GAWK" = "no" ; then
1412     AC_MSG_ERROR($missing_program)
1413   fi
1414 fi
1415
1416 if test "$use_arch" != "arm" ; then
1417   AC_CHECK_PROG(HAVE_CMAKE,cmake,"yes","no",)
1418   if test "$HAVE_CMAKE" = "no" ; then
1419     AC_MSG_ERROR($missing_program)
1420   fi
1421 fi
1422
1423 AC_CHECK_PROG(HAVE_GPERF,gperf,"yes","no",)
1424 if test "$HAVE_GPERF" = "no" ; then
1425   AC_MSG_ERROR($missing_program)
1426 fi
1427
1428 AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",)
1429 if test "$HAVE_UNZIP" = "no" ; then
1430   AC_MSG_ERROR($missing_program)
1431 fi
1432
1433 AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",)
1434 if test "$HAVE_ZIP" = "no" ; then
1435   AC_MSG_ERROR($missing_program)
1436 fi
1437
1438 if test "$ARCH" = "i486-linux" || test "$ARCH" = "x86-freebsd"; then
1439   AC_CHECK_PROG(HAVE_NASM,nasm,"yes","no",)
1440   if test "$HAVE_NASM" = "no" ; then
1441     AC_MSG_ERROR($missing_program)
1442   fi
1443 fi
1444
1445 AC_CHECK_PROG(HAVE_GIT,git,"yes","no",)
1446
1447 # Checks for header files.
1448 AC_HEADER_DIRENT
1449 AC_HEADER_STDC
1450 AC_HEADER_SYS_WAIT
1451 AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h limits.h locale.h \
1452   malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
1453   strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h \
1454   sys/time.h sys/timeb.h sys/vfs.h termios.h unistd.h utime.h wchar.h wctype.h])
1455 AC_CHECK_HEADERS([cdio/iso9660.h],,AC_MSG_ERROR([$missing_headers]))
1456
1457 # Checks for typedefs, structures, and compiler characteristics.
1458 AC_HEADER_STAT
1459 AC_HEADER_STDBOOL
1460 AC_C_CONST
1461 AC_TYPE_UID_T
1462 AC_C_INLINE
1463 AC_TYPE_INT8_T
1464 AC_TYPE_INT16_T
1465 AC_TYPE_INT32_T
1466 AC_TYPE_INT64_T
1467 AC_TYPE_MODE_T
1468 AC_TYPE_OFF_T
1469 AC_TYPE_PID_T
1470 AC_C_RESTRICT
1471 AC_TYPE_SIZE_T
1472 AC_TYPE_SSIZE_T
1473 AC_CHECK_MEMBERS([struct stat.st_rdev])
1474 AC_HEADER_TIME
1475 AC_STRUCT_TM
1476 AC_TYPE_UINT8_T
1477 AC_TYPE_UINT16_T
1478 AC_TYPE_UINT32_T
1479 AC_TYPE_UINT64_T
1480 AC_C_BIGENDIAN
1481
1482 if test "$cross_compiling" = "yes"; then
1483   final_message="$final_message\n  Crosscomp.:\tYes"
1484 else
1485   final_message="$final_message\n  Crosscomp.:\tNo"
1486 fi
1487
1488 final_message="$final_message\n  target ARCH:\t$use_arch"
1489 final_message="$final_message\n  target CPU:\t$use_cpu"
1490
1491 if test "$use_gles" = "yes"; then
1492   final_message="$final_message\n  OpenGLES:\tYes"
1493   USE_OPENGLES=1
1494   USE_OPENGL=0
1495 else
1496   USE_OPENGLES=0
1497   if test "$use_gl" = "yes"; then
1498     final_message="$final_message\n  OpenGL:\tYes"
1499     USE_OPENGL=1
1500   else
1501     final_message="$final_message\n  OpenGL:\tNo (Very Slow)"
1502     SDL_DEFINES="-DHAS_SDL_2D"
1503     USE_OPENGL=0
1504   fi
1505 fi
1506
1507 if test "$use_alsa" = "yes"; then
1508   USE_ALSA=1
1509   AC_DEFINE([USE_ALSA],[1],["Define to 1 if alsa is installed"])
1510   final_message="$final_message\n  ALSA:\t\tYes"
1511 else
1512   USE_ALSA=0
1513   final_message="$final_message\n  ALSA:\t\tNo"
1514 fi
1515
1516 if test "$use_dbus" = "yes"; then
1517   final_message="$final_message\n  DBUS:\t\tYes"
1518 else
1519   final_message="$final_message\n  DBUS:\t\tNo"
1520 fi
1521
1522 if test "x$use_vdpau" != "xno"; then
1523   final_message="$final_message\n  VDPAU:\tYes"
1524 else
1525   final_message="$final_message\n  VDPAU:\tNo"
1526 fi
1527
1528 if test "x$use_vaapi" != "xno"; then
1529   final_message="$final_message\n  VAAPI:\tYes"
1530 else
1531   final_message="$final_message\n  VAAPI:\tNo"
1532 fi
1533
1534 if test "x$use_crystalhd" != "xno"; then
1535   final_message="$final_message\n  CrystalHD:\tYes"
1536 else
1537   final_message="$final_message\n  CrystalHD:\tNo"
1538 fi
1539
1540 if test "x$use_vdadecoder" != "xno"; then
1541   final_message="$final_message\n  VDADecoder:\tYes"
1542 else
1543   final_message="$final_message\n  VDADecoder:\tNo"
1544 fi
1545
1546 if test "x$use_vtbdecoder" != "xno"; then
1547   final_message="$final_message\n  VTBDecoder:\tYes"
1548 else
1549   final_message="$final_message\n  VTBDecoder:\tNo"
1550 fi
1551
1552 if test "$use_openmax" != "no"; then
1553   final_message="$final_message\n  OpenMax:\tYes"
1554 else
1555   final_message="$final_message\n  OpenMax:\tNo"
1556 fi
1557
1558 if test "$use_joystick" = "yes"; then
1559   final_message="$final_message\n  Joystick:\tYes"
1560   SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_JOYSTICK"
1561 else
1562   final_message="$final_message\n  Joystick:\tNo"
1563 fi
1564
1565 if test "$use_xrandr" = "yes"; then
1566   final_message="$final_message\n  XRandR:\tYes"
1567   USE_XRANDR=1
1568 else
1569   final_message="$final_message\n  XRandR:\tNo"
1570   USE_XRANDR=0
1571 fi
1572
1573 if test "$use_goom" = "yes"; then
1574   final_message="$final_message\n  GOOM:\t\tYes"
1575 else
1576   final_message="$final_message\n  GOOM:\t\tNo"
1577 fi
1578
1579 if test "$use_rsxs" = "yes"; then
1580   final_message="$final_message\n  RSXS:\t\tYes"
1581 else
1582   final_message="$final_message\n  RSXS:\t\tNo"
1583 fi
1584
1585 if test "$use_projectm" = "yes"; then
1586   final_message="$final_message\n  ProjectM:\tYes"
1587 else
1588   final_message="$final_message\n  ProjectM:\tNo"
1589 fi
1590
1591 if test "$use_x11" = "yes"; then
1592   final_message="$final_message\n  X11:\t\tYes"
1593 else
1594   final_message="$final_message\n  X11:\t\tNo"
1595 fi
1596
1597 if test "$use_libbluray" = "yes"; then
1598   final_message="$final_message\n  Bluray:\tYes"
1599 else
1600   final_message="$final_message\n  Bluray:\tNo"
1601 fi
1602
1603 USE_TEXTUREPACKER_NATIVE=0
1604 if test "x$use_texturepacker" != "xno"; then
1605   final_message="$final_message\n  TexturePacker:Yes"
1606   USE_TEXTUREPACKER=1
1607   if test "x$use_texturepacker_native" = "xyes"; then
1608     USE_TEXTUREPACKER_NATIVE=1
1609     if [[ ! -d "$USE_TEXTUREPACKER_NATIVE_ROOT" ]]; then 
1610       USE_TEXTUREPACKER_NATIVE_ROOT= 
1611     fi
1612   fi
1613 else
1614   final_message="$final_message\n  TexturePacker:No"
1615   USE_TEXTUREPACKER=0
1616 fi
1617
1618 if test "$use_mid" = "yes"; then
1619   final_message="$final_message\n  MID Support:\tYes"
1620   SDL_DEFINES="$SDL_DEFINES -DMID"
1621 else
1622   final_message="$final_message\n  MID Support:\tNo"
1623 fi
1624
1625 ORIGCC=$CC
1626 ORIGCXX=$CXX
1627 if test "x$use_ccache" != "xno"; then
1628   AC_PATH_PROG(CCACHE,ccache,none)
1629   if test "$ac_cv_path_CCACHE" = "none"; then
1630     if test "x$use_ccache" = "xyes"; then
1631       AC_MSG_ERROR([ccache not found.]);
1632     else
1633       AC_MSG_NOTICE([ccache not found. Falling back to default CC])
1634       final_message="$final_message\n  ccache:\tNo"
1635     fi
1636   else
1637     CC="$ac_cv_path_CCACHE $CC"
1638     CXX="$ac_cv_path_CCACHE $CXX"
1639     AC_MSG_NOTICE(enabling ccache)
1640     final_message="$final_message\n  ccache:\tYes"
1641   fi
1642 else
1643   final_message="$final_message\n  ccache:\tNo"
1644 fi
1645
1646 if test "x$use_pulse" != "xno"; then
1647   XBMC_STANDALONE_SH_PULSE=tools/Linux/xbmc-standalone.sh.pulse
1648   final_message="$final_message\n  PulseAudio:\tYes"
1649 else
1650   XBMC_STANDALONE_SH_PULSE=/dev/null
1651   final_message="$final_message\n  PulseAudio:\tNo"
1652 fi
1653
1654 if test "$use_hal" = "yes"; then
1655   final_message="$final_message\n  HAL Support:\tYes"
1656 else
1657   final_message="$final_message\n  HAL Support:\tNo"
1658 fi
1659
1660 # DVDCSS
1661 if test "$use_dvdcss" = "yes"; then
1662   AC_MSG_NOTICE($dvdcss_enabled)
1663   final_message="$final_message\n  DVDCSS:\tYes"
1664   BUILD_DVDCSS=1
1665   SKIP_CONFIG_DVDCSS=0
1666   DVDREAD_CFLAGS="-D_XBMC -DHAVE_DVDCSS_DVDCSS_H"
1667 else
1668   AC_MSG_NOTICE($dvdcss_disabled)
1669   final_message="$final_message\n  DVDCSS:\tNo"
1670   BUILD_DVDCSS=0
1671   SKIP_CONFIG_DVDCSS=1
1672   DVDREAD_CFLAGS="-D_XBMC -UHAVE_DVDCSS_DVDCSS_H"
1673 fi
1674 if test "$host_vendor" = "apple"; then
1675  DVDREAD_CFLAGS="$DVDREAD_CFLAGS -D__DARWIN__"
1676 fi
1677
1678 if test "$use_avahi" = "yes"; then
1679   final_message="$final_message\n  Avahi:\tYes"
1680 else
1681   final_message="$final_message\n  Avahi:\tNo"
1682 fi
1683
1684 if test "$HAVE_GIT" = "yes"; then
1685   GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
1686 fi
1687 if test "$GIT_REV" = ""; then
1688   GIT_REV="Unknown"
1689 fi
1690 if test "$host_vendor" = "apple"; then
1691   echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
1692 else
1693   SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'"
1694 fi
1695
1696 if test "$use_nonfree" = "yes"; then
1697   final_message="$final_message\n  Non-free:\tYes"
1698   HAVE_XBMC_NONFREE=1
1699   AC_DEFINE([HAVE_XBMC_NONFREE], [1], [Define to 1 to enable non-free components.])
1700 else
1701   HAVE_XBMC_NONFREE=0
1702   final_message="$final_message\n  Non-free:\tNo"
1703 fi
1704
1705 if test "$use_asap" = "yes"; then
1706   AC_CHECK_PROG(HAVE_GDC,gdc,"yes","no")
1707   if test "$HAVE_GDC" = "no"; then
1708     AC_MSG_ERROR($missing_program);
1709   fi
1710   AC_CHECK_PROG(HAVE_FPC,fpc,"yes","no")
1711   if test "$HAVE_FPC" = "no"; then
1712     AC_MSG_ERROR($missing_program);
1713   fi
1714   USE_ASAP_CODEC=1
1715   AC_DEFINE([USE_ASAP_CODEC], [1], [Define to 1 to enable ASAP codec.])
1716   final_message="$final_message\n  ASAP Codec:\tYes"
1717 else
1718   USE_ASAP_CODEC=0
1719   final_message="$final_message\n  ASAP Codec:\tNo"
1720 fi
1721
1722 if test "$use_webserver" = "yes"; then
1723   final_message="$final_message\n  Webserver:\tYes"
1724 else
1725   final_message="$final_message\n  Webserver:\tNo"
1726 fi
1727
1728 if test "$use_librtmp" != "no"; then
1729   final_message="$final_message\n  libRTMP support:\tYes"
1730 else
1731   final_message="$final_message\n  libRTMP support:\tNo"
1732 fi
1733
1734 if test "x$use_samba" != "xno"; then
1735   final_message="$final_message\n  libsmbclient support:\tYes"
1736 else
1737   final_message="$final_message\n  libsmbclient support:\tNo"
1738 fi
1739
1740 if test "$use_libnfs" != "no"; then
1741   final_message="$final_message\n  libnfs client support:Yes"
1742 else
1743   final_message="$final_message\n  libnfs client support:No"
1744 fi
1745
1746 if test "x$use_libafpclient" != "xno"; then
1747   final_message="$final_message\n  libafpclient support:\tYes"
1748 else  
1749   final_message="$final_message\n  libafpclient support:\tNo"
1750 fi
1751
1752 if test "$use_airplay" != "no"; then
1753   final_message="$final_message\n  AirPlay support:\tYes"
1754 else
1755   final_message="$final_message\n  AirPLay support:\tNo"
1756 fi
1757
1758 if test "x$use_airtunes" != "xno"; then
1759   final_message="$final_message\n  AirTunes support:\tYes"  
1760 else
1761   final_message="$final_message\n  AirTunes support:\tNo"
1762 fi
1763
1764 if test "$use_optical_drive" = "yes"; then
1765   final_message="$final_message\n  Optical drive:\tYes"
1766 else
1767   final_message="$final_message\n  Optical drive:\tNo"
1768 fi
1769
1770 if test "x$use_libudev" != "xno"; then
1771   final_message="$final_message\n  libudev support:\tYes"
1772 else
1773   final_message="$final_message\n  libudev support:\tNo"
1774 fi
1775
1776 if test "x$use_libusb" != "xno"; then
1777   final_message="$final_message\n  libusb support:\tYes"
1778 else
1779   final_message="$final_message\n  libusb support:\tNo"
1780 fi
1781
1782 if test "$use_libcec" = "yes"; then
1783   final_message="$final_message\n  libCEC support:\tYes"
1784 else
1785   final_message="$final_message\n  libCEC support:\tNo"
1786 fi
1787
1788 ### External libraries messages
1789 if test "$use_external_libcec" = "yes"; then
1790   final_message="$final_message\n  External libCEC:\tYes"
1791 else
1792   final_message="$final_message\n  External libCEC:\tNo"
1793 fi
1794
1795 if test "$use_external_ffmpeg" = "yes"; then
1796   final_message="$final_message\n  External FFmpeg:\tYes"
1797 else
1798   final_message="$final_message\n  External FFmpeg:\tNo"
1799 fi
1800
1801 OUTPUT_FILES="Makefile \
1802     Makefile.include \
1803     addons/skin.confluence/media/Makefile \
1804     xbmc/Makefile \
1805     xbmc/cdrip/Makefile \
1806     xbmc/cores/Makefile \
1807     xbmc/cores/VideoRenderers/Makefile \
1808     xbmc/cores/dvdplayer/Makefile \
1809     lib/Makefile \
1810     lib/libdvd/Makefile \
1811     xbmc/cores/DllLoader/Makefile \
1812     xbmc/cores/dvdplayer/DVDCodecs/Makefile \
1813     xbmc/cores/dvdplayer/DVDCodecs/Audio/Makefile \
1814     xbmc/cores/dvdplayer/DVDCodecs/Overlay/Makefile \
1815     xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile \
1816     xbmc/cores/dvdplayer/DVDDemuxers/Makefile \
1817     xbmc/cores/dvdplayer/DVDSubtitles/Makefile \
1818     xbmc/cores/AudioRenderers/Makefile \
1819     xbmc/cores/paplayer/Makefile \
1820     lib/timidity/Makefile \
1821     lib/xbadpcm/Makefile \
1822     lib/asap/Makefile \
1823     lib/nosefart/Makefile \
1824     lib/libsidplay2/Makefile \
1825     lib/vgmstream/Makefile \
1826     lib/snesapu/SNES/SNESAPU/Makefile \
1827     lib/stsound/StSoundLibrary/Makefile \
1828     xbmc/cores/playercorefactory/Makefile \
1829     xbmc/music/karaoke/Makefile \
1830     xbmc/osx/Makefile \
1831     xbmc/guilib/Makefile \
1832     xbmc/interfaces/Makefile \
1833     xbmc/network/Makefile \
1834     lib/libRTV/Makefile \
1835     lib/libexif/Makefile \
1836     lib/libXDAAP/Makefile \
1837     lib/cmyth/Makefile \
1838     lib/libhdhomerun/Makefile \
1839     lib/libsquish/Makefile \
1840     lib/libid3tag/Makefile \
1841     lib/cximage-6.0/Makefile \
1842     lib/addons/script.module.pil/Makefile \
1843     xbmc/interfaces/python/Makefile \
1844     xbmc/interfaces/python/xbmcmodule/Makefile \
1845     lib/libUPnP/Makefile \
1846     xbmc/DllPaths_generated.h \
1847     xbmc/linux/Makefile \
1848     xbmc/filesystem/Makefile \
1849     xbmc/screensavers/rsxs-0.9/xbmc/Makefile \
1850     xbmc/visualizations/XBMCProjectM/Makefile \
1851     xbmc/visualizations/Goom/Makefile \
1852     xbmc/visualizations/OpenGLSpectrum/Makefile \
1853     xbmc/visualizations/WaveForm/Makefile \
1854     xbmc/visualizations/iTunes/Makefile \
1855     tools/Linux/xbmc.sh \
1856     tools/Linux/xbmc-standalone.sh \
1857     tools/TexturePacker/Makefile \
1858     tools/EventClients/Clients/OSXRemote/Makefile \
1859     xbmc/peripherals/bus/Makefile \
1860     xbmc/peripherals/devices/Makefile \
1861     lib/libcec/Makefile"
1862
1863 # Line below is used so we can use AM_INIT_AUTOMAKE. The corresponding
1864 # .dummy.am does nothing.
1865 AC_CONFIG_FILES([.dummy])
1866
1867 AC_CONFIG_FILES([${OUTPUT_FILES}])
1868 OUTPUT_FILES="$OUTPUT_FILES \
1869   .dummy"
1870 AC_SUBST(CFLAGS)
1871 AC_SUBST(CXXFLAGS)
1872 AC_SUBST(INCLUDES)
1873 AC_SUBST(LDFLAGS)
1874 AC_SUBST(SDL_DEFINES)
1875 AC_SUBST(BUILD_DVDCSS)
1876 AC_SUBST(DISABLE_GOOM)
1877 AC_SUBST(DISABLE_RSXS)
1878 AC_SUBST(DISABLE_PROJECTM)
1879 AC_SUBST(USE_EXTERNAL_FFMPEG)
1880 AC_SUBST(PYTHON_VERSION)
1881 AC_SUBST(OUTPUT_FILES)
1882 AC_SUBST(HAVE_XBMC_NONFREE)
1883 AC_SUBST(USE_ASAP_CODEC)
1884 AC_SUBST(LIBCURL_BASENAME)
1885 AC_SUBST(LIBFLAC_BASENAME)
1886 AC_SUBST(LIBVORBISFILE_BASENAME)
1887 AC_SUBST(LIBMODPLUG_BASENAME)
1888 AC_SUBST(LIBMAD_BASENAME)
1889 AC_SUBST(LIBOGG_BASENAME)
1890 AC_SUBST(LIBVORBISENC_BASENAME)
1891 AC_SUBST(LIBVORBIS_BASENAME)
1892 AC_SUBST(LIBASS_BASENAME)
1893 AC_SUBST(LIBMEPG2_BASENAME)
1894 AC_SUBST_FILE(XBMC_STANDALONE_SH_PULSE)
1895 AC_SUBST(USE_OPENGL)
1896 AC_SUBST(USE_OPENGLES)
1897 AC_SUBST(USE_VDPAU)
1898 AC_SUBST(USE_VAAPI)
1899 AC_SUBST(USE_CRYSTALHD)
1900 AC_SUBST(USE_LIBSMBCLIENT)
1901 AC_SUBST(USE_LIBNFS)
1902 AC_SUBST(USE_LIBAFPCLIENT)
1903 AC_SUBST(USE_AIRPLAY)
1904 AC_SUBST(USE_VDA)
1905 AC_SUBST(USE_OPENMAX)
1906 AC_SUBST(USE_PULSE)
1907 AC_SUBST(USE_XRANDR)
1908 AC_SUBST(USE_ALSA)
1909 AC_SUBST(USE_TEXTUREPACKER)
1910 AC_SUBST(USE_TEXTUREPACKER_NATIVE)
1911 AC_SUBST(USE_TEXTUREPACKER_NATIVE_ROOT)
1912 AC_SUBST(USE_AIRTUNES)
1913 AC_SUBST(USE_LIBUDEV)
1914 AC_SUBST(USE_LIBUSB)
1915 AC_SUBST(USE_LIBCEC)
1916 AC_SUBST(USE_EXTERNAL_LIBCEC)
1917
1918 # pushd and popd are not available in other shells besides bash, so implement
1919 # our own pushd/popd functions
1920 XB_DIRSTACK="$PWD"
1921 xb_pushd()
1922 {
1923   local dirname="$1"
1924   if [[ -d "$dirname" ]] && [[ -x "$dirname" ]]; then
1925     cd "$dirname"
1926     XB_DIRSTACK="$dirname ${XB_DIRSTACK:-$PWD}"
1927     return 0
1928   else
1929     AC_MSG_ERROR(xb_pushd: unable to change to $dirname)
1930   fi
1931 }
1932 xb_popd()
1933 {
1934   if [[ -n "$XB_DIRSTACK" ]]; then
1935     XB_DIRSTACK="${XB_DIRSTACK#* }"
1936     cd "${XB_DIRSTACK%% *}"
1937     return 0
1938   else
1939     AC_MSG_ERROR(xb_popd: unable to go back to previous directory)
1940   fi
1941 }
1942
1943 # Function to run the configure scripts in our submodules
1944 # Consists of three paramaters, the path to the submodule, the configure command
1945 # with appropriate arguments, and a third parameter set to 1 if we are to skip
1946 # running the script, anything else if not.
1947 AC_DEFUN([XB_CONFIG_MODULE],[
1948 AC_CONFIG_COMMANDS_POST([
1949 if [[ $3 != "1" ]]; then
1950     if [[ -d $1 ]]; then
1951       xb_pushd $1
1952       $2
1953       if [[ $? -ne 0 ]]; then
1954         xb_popd
1955         AC_MSG_ERROR([[Submodule $1 failed to configure]])
1956       else
1957         xb_popd
1958       fi
1959     else
1960       AC_MSG_ERROR([[Submodule $1 does not exist]])
1961     fi
1962 else
1963     AC_MSG_NOTICE([[Skipping configuration of submodule $1.]])
1964 fi
1965 ])
1966 ])
1967
1968 XB_CONFIG_MODULE([lib/ffmpeg], [
1969   if test "$host_vendor" = "apple" ; then
1970     ./configure \
1971       --extra-cflags="$CFLAGS $FFMPEG_EXTRACFLAGS -w -D_DARWIN_C_SOURCE -Dattribute_deprecated=" \
1972       `if test "$use_arch" != "no"; then echo --enable-cross-compile; fi` \
1973       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
1974       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
1975       --target-os=$(tolower $(uname -s)) \
1976       --disable-amd3dnow \
1977       --disable-armv5te \
1978       --disable-armv6t2 \
1979       `if test "$use_arch" != "yes"; then echo --enable-neon; fi`\
1980       --disable-static \
1981       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
1982       --disable-muxers \
1983       --enable-muxer=spdif \
1984       --enable-muxer=adts \
1985       --disable-encoders \
1986       --enable-encoder=ac3 \
1987       --enable-encoder=aac \
1988       `if test "$use_ffmpeg_libvorbis" = "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
1989       --disable-devices \
1990       --disable-ffprobe \
1991       --disable-ffplay \
1992       --disable-ffserver \
1993       --disable-ffmpeg \
1994       --enable-shared \
1995       --disable-doc \
1996       --disable-decoder=mpeg_xvmc \
1997       --enable-postproc \
1998       --enable-gpl \
1999       --enable-protocol=http \
2000       --enable-pthreads \
2001       --enable-runtime-cpudetect \
2002       --cc="$CC" &&
2003     sed -i "" -e "s#YASM=yasm#YASM=${prefix}/bin/yasm#" config.mak &&
2004     sed -i "" -e "s#YASMDEP=yasm#YASMDEP=${prefix}/bin/yasm#" config.mak &&
2005     sed -i "" -e "s# -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 # #" config.mak
2006     if test "$use_arch" = "ppc"; then
2007       sed -i "" -e "s/HAVE_GNU_AS 1/HAVE_GNU_AS 0/" config.h
2008       sed -i "" -e "s/^HAVE_GNU_AS=yes/!HAVE_GNU_AS=yes/" config.mak
2009     fi
2010   else
2011     CFLAGS="" \
2012     LDFLAGS="$(echo "$LDFLAGS" | sed "s/-Wl,-Bsymbolic-functions//g")" \
2013     ./configure \
2014       --extra-cflags="$PASSED_CFLAGS $FFMPEG_EXTRACFLAGS" \
2015       --disable-static \
2016       `if test "$use_debug" = "no"; then echo --disable-debug; fi` \
2017       `if test "$cross_compiling" = "yes"; then echo --enable-cross-compile; fi` \
2018       `if test "$use_arch" != "no"; then echo --arch=$use_arch; fi`\
2019       `if test "$use_cpu" != "no"; then echo --cpu=$use_cpu; fi`\
2020       --target-os=$(tolower $(uname -s)) \
2021       --disable-muxers \
2022       --enable-muxer=spdif \
2023       --enable-muxer=adts \
2024       --disable-encoders \
2025       --enable-encoder=ac3 \
2026       --enable-encoder=aac \
2027       `if test "$use_ffmpeg_libvorbis" = "yes"; then echo --enable-libvorbis --enable-muxer=ogg --enable-encoder=libvorbis; else echo --disable-libvorbis; fi` \
2028       --disable-decoder=mpeg_xvmc \
2029       --disable-devices \
2030       --disable-ffprobe \
2031       --disable-ffplay \
2032       --disable-ffserver \
2033       --disable-ffmpeg \
2034       --enable-shared \
2035       --disable-doc \
2036       --enable-postproc \
2037       --enable-gpl \
2038       `if test "x$use_vdpau" != "xno"; then echo --enable-vdpau; else echo --disable-vdpau; fi` \
2039       `if test "x$use_vaapi" != "xno"; then echo --enable-vaapi; else echo --disable-vaapi; fi` \
2040       --enable-protocol=http \
2041       --enable-pthreads \
2042       --enable-runtime-cpudetect \
2043       --custom-libname-with-major="\$(FULLNAME)-\$(LIBMAJOR)-${ARCH}\$(SLIBSUF)" \
2044       `case $host_cpu in i?86*) echo --disable-pic ;; *) echo --enable-pic ;; esac` \
2045       --cc="$CC" &&
2046       sed -i -e "s#define HAVE_SYMVER 1#define HAVE_SYMVER 0#" config.h &&
2047       sed -i -e "s#define HAVE_SYMVER_GNU_ASM 1#define HAVE_SYMVER_GNU_ASM 0#" config.h
2048   fi
2049 ], [$USE_EXTERNAL_FFMPEG])
2050
2051 XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [
2052   ./configure \
2053     CC="$CC" \
2054     CXX="$CXX" \
2055     CFLAGS="$CFLAGS" \
2056     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2057     --host=$host_alias \
2058     --build=$build_alias \
2059     --target=$target_alias \      
2060     --disable-doc \
2061     --enable-static \
2062     --with-pic
2063 ], [$SKIP_CONFIG_DVDCSS])
2064
2065 XB_CONFIG_MODULE([lib/libdvd/libdvdread], [
2066   ./configure2 \
2067     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../libdvdcss/src" \
2068     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2069     --host=$host_alias \
2070     --build=$build_alias \
2071     --target=$target_alias \      
2072     --enable-static \
2073     --disable-shared \
2074     --disable-strip \
2075     --disable-opts \
2076     --cc="$CC" &&
2077   $MAKE dvdread-config &&
2078   mkdir -p `pwd`/../includes/dvdread
2079   cp `pwd`/../libdvdread/src/*.h `pwd`/../includes/dvdread
2080 ], [0])
2081
2082 XB_CONFIG_MODULE([lib/libdvd/libdvdnav], [
2083   ./configure2 \
2084     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../includes" \
2085     --extra-ldflags="-L`pwd`/../libdvdread/obj" \
2086     --with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
2087     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2088     --host=$host_alias \
2089     --build=$build_alias \
2090     --target=$target_alias \      
2091     --enable-static \
2092     --disable-shared \
2093     --cc="$CC"
2094 ], [0])
2095
2096 XB_CONFIG_MODULE([lib/libid3tag/libid3tag],[
2097   ./configure \
2098     CC="$CC" \
2099     CXX="$CXX" \
2100     CFLAGS="$CFLAGS" \ 
2101     CXXFLAGS="$CXXFLAGS" \
2102     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2103     --host=$host_alias \
2104     --build=$build_alias \
2105     --target=$target_alias \      
2106     --disable-static \
2107     --with-pic
2108 ], [0])
2109
2110 XB_CONFIG_MODULE([xbmc/visualizations/XBMCProjectM/libprojectM],[
2111   set -x
2112   rm -f CMakeCache.txt && CC="$ORIGCC" CXX="$ORIGCXX" cmake    \
2113     -DCMAKE_BUILD_TYPE=None -DUSE_FTGL:BOOL=OFF        \
2114     -DCMAKE_C_FLAGS:STRING="${CPPFLAGS} ${CFLAGS}"     \
2115     -DCMAKE_CXX_FLAGS:STRING="${CPPFLAGS} ${CXXFLAGS}" \
2116     -DCMAKE_INSTALL_PREFIX="${prefix}"                 \
2117     -DCMAKE_INSTALL_LIBDIR:PATH="${libdir}"            \
2118     -DINCLUDE_INSTALL_DIR:PATH="${includedir}"         \
2119     -DLIB_INSTALL_DIR:PATH="${libdir}"                 \
2120     -DSYSCONF_INSTALL_DIR:PATH="${sysconfdir}"         \
2121     -DSHARE_INSTALL_PREFIX:PATH="${datadir}" . &&
2122   if test "$host_vendor" = "apple" ; then
2123     # cmake has hardcoded paths to macports which bork our darwin depends cross/ppc, remove them
2124     sed -i "" -e "s|-L/opt/local/lib| |" CMakeFiles/projectM.dir/link.txt
2125     sed -i "" -e "s|-L/opt/local/lib| |" CMakeFiles/projectM.dir/flags.make
2126     sed -i "" -e "s|-I/opt/local/include| |" CMakeFiles/projectM.dir/flags.make
2127   fi
2128   set +x
2129 ], [$DISABLE_PROJECTM])
2130
2131 XB_CONFIG_MODULE([xbmc/visualizations/Goom/goom2k4-0],[
2132   ./configure  \
2133     CFLAGS="$CFLAGS" \ 
2134     CXXFLAGS="$CXXFLAGS" \
2135     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2136     --host=$host_alias \
2137     --build=$build_alias \
2138     --target=$target_alias \      
2139     --disable-shared \
2140     --enable-static \
2141     --with-pic
2142 ], [$DISABLE_GOOM])
2143
2144 XB_CONFIG_MODULE([xbmc/screensavers/rsxs-0.9/], [
2145   ./configure \
2146     CC="$CC" \
2147     CXX="$CXX" \
2148     CFLAGS="$CFLAGS" \ 
2149     CXXFLAGS="$CXXFLAGS" \
2150     `if test "$host_vendor" = "apple"; then echo --x-includes=/usr/X11/include --x-libraries=/usr/X11/lib; fi` \
2151     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2152     --host=$host_alias \
2153     --build=$build_alias \
2154     --target=$target_alias \      
2155     --without-xscreensaver \
2156     --disable-sound \
2157     --disable-cyclone \
2158     --disable-fieldlines \
2159     --disable-flocks \
2160     --disable-flux \
2161     --disable-helios \
2162     --disable-hyperspace \
2163     --disable-lattice \
2164     --disable-skyrocket
2165 ], [$DISABLE_RSXS])
2166
2167 XB_CONFIG_MODULE([lib/libapetag], [
2168   ./configure \
2169     `if test "$host_vendor" = "apple"; then echo --disable-shared; fi` \
2170     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2171     --host=$host_alias \
2172     --build=$build_alias \
2173     --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
2174 ], [0])
2175
2176 XB_CONFIG_MODULE([lib/cpluff], [
2177   ./configure --disable-nls \
2178     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2179     --host=$host_alias \
2180     --build=$build_alias \
2181     --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
2182     #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"    
2183 ], [0])
2184
2185 XB_CONFIG_MODULE([lib/libcec], [
2186   if test "$use_libcec" = "yes" ; then
2187     cd libcec ; ./configure \
2188       --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2189       --host=$host_alias \
2190       --build=$build_alias \
2191       --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX"
2192   fi    
2193 ], [0])
2194
2195 AC_OUTPUT
2196
2197 final_message="$final_message\n  prefix:\t$prefix\n$dashes"
2198 echo -e "$final_message\n"