Merge pull request #9325 from AlwinEsch/fix-adsp-frezze
[vuplus_xbmc] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT([kodi], [16.0.992], [http://trac.kodi.tv])
6 AC_CONFIG_HEADERS([xbmc/config.h])
7 AH_TOP([#pragma once])
8 m4_include([m4/ax_prog_cc_for_build.m4])
9 m4_include([m4/ax_prog_cxx_for_build.m4])
10 m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
11 m4_include([m4/ax_python_devel.m4])
12 m4_include([m4/xbmc_arch.m4])
13
14 AC_CONFIG_AUX_DIR([build-aux])
15 AM_INIT_AUTOMAKE([foreign])
16 AC_CANONICAL_HOST
17
18 tolower(){
19   echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
20 }
21
22 # workaround for autotools that don't set this
23 abs_top_srcdir=${abs_top_srcdir=$(cd $srcdir; pwd)}
24
25 # check for enabling additional players
26 AC_DEFUN([XB_ADD_PLAYER],
27 [
28   AC_MSG_CHECKING([for $2])
29   case $add_players in
30     *$2*)
31       AC_SUBST([USE_$1], 1)
32       AC_DEFINE([HAS_$1], 1, [using $2])
33       AC_MSG_RESULT([enabling $2])
34       ;;
35     *)
36       AC_MSG_RESULT([$2 is not enabled])
37   esac
38 ])
39
40 # check for enabling additional codecs
41 AC_DEFUN([XB_ADD_CODEC],
42 [
43   AC_MSG_CHECKING([for $2])
44   case $3 in
45     *$2*)
46       use_codec_$2="yes"
47       AC_SUBST([USE_$1], 1)
48       AC_DEFINE([HAS_$1], 1, [using $2])
49       AC_MSG_RESULT([enabling $2])
50       ;;
51     *)
52       AC_MSG_RESULT([$2 is not enabled])
53   esac
54 ])
55
56 # check for library basenames
57 AC_DEFUN([XB_FIND_SONAME],
58 [
59   if echo "$host" | grep -q freebsd ; then
60     AC_MSG_CHECKING([for lib$2 soname])
61     $1_SONAME=[`ldconfig -r | sed -n "s;.* \(/.*lib$2\.so.*\)$;\1;p" | head -n 1`]
62     if test x$$1_SONAME != x ; then
63       $1_SONAME=[`basename $$1_SONAME`]
64     fi
65   elif [[ "$host_vendor" != "apple" ]]; then
66     AC_MSG_CHECKING([for lib$2 soname])
67     $1_FILENAME=$($CC -nostdlib -o /dev/null $CFLAGS $LDFLAGS $4 -l$2 -Wl,-M 2>/dev/null | grep "^LOAD.*$2" | awk '{V=2; print $V}')
68     if [[ -z $$1_FILENAME ]]; then
69       #try gold linker syntax
70       $1_FILENAME=$($CC -nostdlib -o /dev/null $CFLAGS $LDFLAGS $4 -l$2 -Wl,-t 3>&1 1>&2 2>&3 | grep "lib$2")
71     fi
72     if [[ ! -z $$1_FILENAME ]]; then
73       $1_SONAME=$($OBJDUMP -p $$1_FILENAME | grep "SONAME.*$2" | awk '{V=2; print $V}')
74     fi
75   else
76     AC_MSG_CHECKING([for lib$2 dylib])
77     gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
78     env_lib_path=[`echo $LDFLAGS | sed 's/-L[ ]*//g'`]
79     if test "$cross_compiling" = yes; then
80       host_lib_path=""
81     else
82       host_lib_path="/usr/lib /usr/local/lib"
83     fi
84     for path in $gcc_lib_path $env_lib_path $host_lib_path; do
85       lib=[`ls -- $path/lib$2.dylib 2>/dev/null`]
86       if test x$lib != x; then
87         # we want the path/name that is embedded in the dylib 
88         $1_FILENAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
89         $1_SONAME=[`basename $$1_FILENAME`]
90       fi
91     done
92   fi
93   if [[ -z "$$1_SONAME" ]]; then
94     AC_MSG_RESULT([no])
95     if test -z "$3" || test "x${$3}" = "xyes"; then
96       AC_MSG_ERROR([Unable to determine soname of lib$2 library])
97     else
98       AC_MSG_WARN([Unable to determine soname of lib$2 library])
99       $3=no
100       AC_MSG_WARN([lib$2 support disabled])
101     fi
102   else
103     AC_MSG_RESULT([$$1_SONAME])
104     AC_SUBST($1_SONAME)
105   fi
106 ])
107
108 # Function to push and pop libs and includes for a command
109 AC_DEFUN([XB_PUSH_FLAGS], [
110   SAVE_LIBS="$LIBS"
111   SAVE_INCLUDES="$INCLUDES"
112   LIBS="[$2]"
113   INCLUDES="[$1]"
114   [$3]
115   LIBS="$SAVE_LIBS"
116   INCLUDES="$SAVE_INCLUDES"
117 ])
118
119 # version can be overridden by setting the following as ENV vars when running configure
120 APP_NAME=${APP_NAME-$(${AWK} '/APP_NAME/ {print $2}' version.txt)}
121 APP_NAME_LC=$(echo $APP_NAME | ${AWK} '{print tolower($0)}')
122 APP_NAME_UC=$(echo $APP_NAME | ${AWK} '{print toupper($0)}')
123 APP_VERSION_MAJOR=${APP_VERSION_MAJOR-$(${AWK} '/VERSION_MAJOR/ {print $2}' version.txt)}
124 APP_VERSION_MINOR=${APP_VERSION_MINOR-$(${AWK} '/VERSION_MINOR/ {print $2}' version.txt)}
125 APP_VERSION_TAG=${APP_VERSION_TAG-$(${AWK} '/VERSION_TAG/ {print $2}' version.txt)}
126 APP_VERSION_TAG_LC=$(echo $APP_VERSION_TAG | ${AWK} '{print tolower($0)}')
127 APP_VERSION_CODE=${APP_VERSION_CODE-$(${AWK} '/VERSION_CODE/ {print $2}' version.txt)}
128 APP_ADDON_API=${APP_ADDON_API-$(${AWK} '/ADDON_API/ {print $2}' version.txt)}
129 if test "$APP_NAME" != "" && test "$APP_VERSION_MAJOR" != "" && test "$APP_VERSION_MINOR" != "" \
130 && test "$APP_VERSION_CODE" != "" && test "$APP_ADDON_API" != ""; then
131   APP_VERSION=${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}
132   if test "$APP_VERSION_TAG" != ""; then
133     APP_VERSION=${APP_VERSION}-${APP_VERSION_TAG}
134   fi
135
136   AC_SUBST(APP_NAME)
137   AC_SUBST(APP_NAME_LC)
138   AC_SUBST(APP_NAME_UC)
139   AC_SUBST(APP_VERSION)
140   AC_SUBST(APP_VERSION_MAJOR)
141   AC_SUBST(APP_VERSION_MINOR)
142   AC_SUBST(APP_VERSION_TAG)
143   AC_SUBST(APP_VERSION_TAG_LC)
144   AC_SUBST(APP_VERSION_CODE)
145   AC_SUBST(APP_ADDON_API)
146
147   dashes="------------------------"
148   final_message="\n  ${APP_NAME} Configuration:"
149   final_message="\n$dashes$final_message\n$dashes"
150   final_message="$final_message\n  ${APP_NAME} Version:\t${APP_VERSION}"
151 else
152   AC_MSG_ERROR(could not detect application Version, make sure version.txt is complete)
153 fi
154
155 # check for GIT_REV
156 AC_CHECK_PROG(HAVE_GIT,git,"yes","no",)
157 if test "$GIT_REV" = ""; then
158   if test -f VERSION ; then
159     GIT_REV=$(awk 'END{print substr($1,1,16)}' VERSION)
160   elif test "$HAVE_GIT" = "yes" -a -d ${abs_top_srcdir}/.git; then
161     GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
162   else
163     GIT_REV="Unknown"
164   fi
165 fi
166 final_message="$final_message\n  git Rev.:\t${GIT_REV}"
167
168 # General message strings
169 configure_debug="ERROR: this is a configure debug statement"
170 missing_library="Could not find a required library. Please see the README for your platform."
171 missing_headers="Could not find some required headers. Please see the README for your platform."
172 missing_program="Could not find a required program. Please see the README for your platform."
173 alsa_disabled="== ALSA support disabled. =="
174 dbus_disabled="== DBUS support disabled. =="
175 wayland_enabled="== Wayland enabled. =="
176 wayland_disabled="== Wayland disabled. =="
177 x11_enabled="== X11 enabled. =="
178 x11_disabled="== X11 disabled. =="
179 pulse_not_found="== Could not find libpulse. PulseAudio support disabled. =="
180 pulse_disabled="== PulseAudio support disabled. =="
181 dvdcss_enabled="== DVDCSS support enabled. =="
182 dvdcss_disabled="== DVDCSS support disabled. =="
183 avahi_not_found="== Could not find libavahi-common or libavahi-client. Avahi support disabled. =="
184 avahi_disabled="== Avahi support disabled. =="
185 mdnsembedded_not_found="== Could not find mDNSEmbedded. Might prevent zeroconf support. =="
186 mdnsembedded_disabled="== mDNSEmbedded support disabled. =="
187 vdpau_not_found="== Could not find libvdpau. VDPAU support disabled. =="
188 vdpau_disabled="== VDPAU support manually disabled. =="
189 vaapi_not_found="== Could not find libva. VAAPI support disabled. =="
190 vaapi_disabled="== VAAPI support manually disabled. =="
191 vtbdecoder_enabled="== VTBDecoder support enabled. =="
192 vtbdecoder_disabled="== VTBDecoder support manually disabled. =="
193 openmax_disabled="== OpenMax support manually disabled. =="
194 openmax_not_found="== Could not find OpenMax headers. OpenMax support disabled. =="
195 ssh_not_found="== Could not find libssh. =="
196 ssh_disabled="== SSH SFTP disabled. =="
197 librtmp_not_found="== Could not find libRTMP. RTMP support disabled. =="
198 librtmp_disabled="== RTMP support disabled. =="
199 libnfs_not_found="== Could not find libnfs. NFS client support disabled. =="
200 libnfs_disabled="== NFS support disabled. =="
201 libgif_not_found="== Could not find libgif. libgif support disabled. =="
202 libgif_disabled="== libgif support disabled. =="
203 libshairplay_not_found="== Could not find libshairplay. =="
204 samba_disabled="== SAMBA support disabled. =="
205 libplist_not_found="== Could not find libplist. AirPlay support disabled. =="
206 libplist_disabled="== AirPlay support disabled. =="
207 alsa_not_found="== Could not find ALSA. ALSA support disabled. =="
208 dbus_not_found="== Could not find DBUS. DBUS support disabled. =="
209 sdl_joystick_not_found="== Could not find SDL2. Joystick support disabled. =="
210 libcap_disabled="== Capabilities detection support disabled. =="
211 libcap_not_found="== Could not find libcap. Capabilities detection support disabled. =="
212 gtest_enabled="== Google Test Framework will be configured. =="
213 gtest_disabled="== Google Test Framework will not be configured. =="
214 breakpad_enabled="== Google Breakpad will be configured. =="
215 breakpad_disabled="== Google Breakpad Framework will not be configured. =="
216
217 libudev_not_found="== Could not find libudev. Will use polling to check for device changes. =="
218 libudev_disabled="== udev support disabled. Will use polling to check for device changes. =="
219 libusb_not_found="== Could not find libusb. Plug and play USB device support will not be available. =="
220 libusb_disabled="== libusb disabled. Plug and play USB device support will not be available. =="
221 libusb_disabled_udev_found="== libusb disabled. =="
222 libcec_enabled="== libcec enabled. =="
223 libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
224
225 AC_ARG_WITH([ffmpeg],
226   [AS_HELP_STRING([--with-ffmpeg],
227   [ffmpeg options: auto (search pkg-config or auto build), force (always build ffmpeg), shared (link dynamically), path_to_ffmpeg [default=force]])],
228   [ffmpeg_dir=$with_ffmpeg],
229   [with_ffmpeg=force])
230
231 AC_ARG_ENABLE([shared-lib],
232   [AS_HELP_STRING([--enable-shared-lib],
233   [build lib${APP_NAME_LC}. helpful for tests (default is no)])],
234   [build_shared_lib=$enableval],
235   [build_shared_lib=no])
236
237 AC_ARG_ENABLE([debug],
238   [AS_HELP_STRING([--enable-debug],
239   [enable debugging information (default is yes)])],
240   [use_debug=$enableval],
241   [use_debug=yes])
242
243 AC_ARG_WITH([platform],
244   [AS_HELP_STRING([--with-platform],
245   [use a pre-configured config for common arm boards])],
246   [use_platform=$withval],
247   [use_platform=none])
248
249 AC_ARG_ENABLE([optimizations],
250   [AS_HELP_STRING([--enable-optimizations],
251   [enable optimization (default is yes)])],
252   [use_optimizations=$enableval],
253   [use_optimizations=yes])
254
255 AC_ARG_ENABLE([gl],
256   [AS_HELP_STRING([--enable-gl],
257   [enable OpenGL rendering (default is yes)])],
258   [use_gl=$enableval],
259   [use_gl=yes])
260
261 AC_ARG_ENABLE([gles],
262   [AS_HELP_STRING([--enable-gles],
263   [enable OpenGLES rendering (default is no)])],
264   [use_gles=$enableval],
265   [use_gles=no])
266
267 AC_ARG_ENABLE([vdpau],
268   [AS_HELP_STRING([--enable-vdpau],
269   [enable VDPAU decoding (default is auto)])],
270   [use_vdpau=$enableval],
271   [use_vdpau=auto])
272
273 AC_ARG_ENABLE([vaapi],
274   [AS_HELP_STRING([--enable-vaapi],
275   [enable VAAPI decoding (default is auto)])],
276   [use_vaapi=$enableval],
277   [use_vaapi=auto])
278
279 AC_ARG_ENABLE([vtbdecoder],
280   [AS_HELP_STRING([--enable-vtbdecoder],
281   [enable VTBDecoder decoding (default is auto)])],
282   [use_vtbdecoder=$enableval],
283   [use_vtbdecoder=auto])
284
285 AC_ARG_ENABLE([openmax],
286   [AS_HELP_STRING([--enable-openmax],
287   [enable OpenMax decoding (default is auto, requires OpenGLES)])],
288   [use_openmax=$enableval],
289   [use_openmax=auto])
290
291 AC_ARG_ENABLE([tegra],
292   [AS_HELP_STRING([--enable-tegra],
293   [enable Tegra2 arm (default is no)])],
294   [use_tegra=$enableval],
295   [use_tegra=no])
296
297 AC_ARG_ENABLE([profiling],
298   [AS_HELP_STRING([--enable-profiling],
299   [enable gprof profiling (default is no)])],
300   [use_profiling=$enableval],
301   [use_profiling=no])
302
303 AC_ARG_ENABLE([joystick],
304   [AS_HELP_STRING([--enable-joystick],
305   [enable SDL joystick support (default is auto)])],
306   [use_joystick=$enableval],
307   [use_joystick=auto])
308
309 AC_ARG_ENABLE([wayland],
310   [AS_HELP_STRING([--enable-wayland],
311   [enable wayland (default is no) 'Linux Only'])],
312   [use_wayland=$enableval],
313   [use_wayland=no])
314
315 AC_ARG_ENABLE([x11],
316   [AS_HELP_STRING([--enable-x11],
317   [enable x11 (default is yes) 'Linux Only'])],
318   [use_x11=$enableval],
319   [use_x11=yes])
320
321 AC_ARG_ENABLE([ccache],
322   [AS_HELP_STRING([--enable-ccache],
323   [enable building with ccache feature (default is auto)])],
324   [use_ccache=$enableval],
325   [use_ccache=auto])
326
327 AC_ARG_ENABLE([alsa],
328   [AS_HELP_STRING([--disable-alsa],
329   [disable ALSA support (only for linux/freebsd)])],
330   [use_alsa=$enableval],
331   [use_alsa=yes])
332
333 AC_ARG_ENABLE([dbus],
334   [AS_HELP_STRING([--disable-dbus],
335   [disable DBUS support])],
336   [use_dbus=$enableval],
337   [use_dbus=yes])
338
339 AC_ARG_ENABLE([pulse],
340   [AS_HELP_STRING([--enable-pulse],
341   [enable PulseAudio support (default is auto)])],
342   [use_pulse=$enableval],
343   [use_pulse=auto])
344
345 AC_ARG_ENABLE([ssh],
346   [AS_HELP_STRING([--disable-ssh],
347   [disable SSH SFTP support (default is enabled)])],
348   [use_ssh=$enableval],
349   [use_ssh=yes])
350
351 AC_ARG_ENABLE([rtmp],
352   [AS_HELP_STRING([--enable-rtmp],
353   [enable RTMP support via librtmp (default is auto)])],
354   [use_librtmp=$enableval],
355   [use_librtmp=auto])
356
357 AC_ARG_ENABLE([samba],
358   [AS_HELP_STRING([--disable-samba],
359   [disable SAMBA support (default is enabled)])],
360   [use_samba=$enableval],
361   [use_samba=yes])
362
363 AC_ARG_ENABLE([nfs],
364   [AS_HELP_STRING([--enable-nfs],
365   [enable NFS support via libnfs (default is auto)])],
366   [use_libnfs=$enableval],
367   [use_libnfs=auto])
368
369 AC_ARG_ENABLE([gif],
370   [AS_HELP_STRING([--enable-gif],
371   [enable gif support via libgif (default is auto)])],
372   [use_libgif=$enableval],
373   [use_libgif=auto])
374
375 AC_ARG_ENABLE([airplay],
376   [AS_HELP_STRING([--enable-airplay],
377   [enable AirPlay support(default is auto)])],
378   [use_airplay=$enableval],
379   [use_airplay=auto])
380
381 AC_ARG_ENABLE([airtunes],
382   [AS_HELP_STRING([--enable-airtunes],
383   [enable AirTunes support(default is auto)])],
384   [use_airtunes=$enableval],
385   [use_airtunes=auto])
386
387 AC_ARG_ENABLE([upnp],
388   [AS_HELP_STRING([--disable-upnp],
389   [disable UPnP support (default is enabled)])],
390   [use_upnp=$enableval],
391   [use_upnp=yes])
392
393 AC_ARG_ENABLE([dvdcss],
394   [AS_HELP_STRING([--enable-dvdcss],
395   [enable DVDCSS support (default is yes)])],
396   [use_dvdcss=$enableval],
397   [use_dvdcss=yes])
398
399 AC_ARG_ENABLE([mid],
400   [AS_HELP_STRING([--enable-mid],
401   [enable MID support (default is no)])],
402   [use_mid=$enableval],
403   [use_mid=no])
404
405 AC_ARG_ENABLE([avahi],
406   [AS_HELP_STRING([--disable-avahi],
407   [disable Avahi support (default is enabled if libavahi-common and libavahi-client is found)])],
408   [use_avahi=$enableval],
409   [use_avahi=yes])
410   
411   AC_ARG_ENABLE([mdnsembedded],
412   [AS_HELP_STRING([--disable-mdnsembedded],
413   [disable mDNSEmbedded support (default is auto)])],
414   [use_mdnsembedded=$enableval],
415   [use_mdnsembedded=auto])
416
417 AC_ARG_ENABLE([non-free],
418   [AS_HELP_STRING([--disable-non-free],
419   [disable componentents with non-compliant licenses])],
420   [use_nonfree=$enableval],
421   [use_nonfree=yes])
422
423 AC_ARG_ENABLE([asap-codec],
424   [AS_HELP_STRING([--enable-asap-codec],
425   [enable ASAP ADPCM support])],
426   [use_asap=$enableval],
427   [use_asap=no])
428
429 AC_ARG_ENABLE([mysql],
430   [AS_HELP_STRING([--disable-mysql],
431   [disable mysql])],
432   [use_mysql=$enableval],
433   [use_mysql=yes])
434
435 AC_ARG_ENABLE([webserver],
436   [AS_HELP_STRING([--disable-webserver],
437   [disable webserver])],
438   [use_webserver=$enableval],
439   [use_webserver=yes])
440
441 AC_ARG_ENABLE([optical-drive],
442   [AS_HELP_STRING([--disable-optical-drive],
443   [disable optical drive])],
444   [use_optical_drive=$enableval],
445   [use_optical_drive=yes])
446
447 AC_ARG_ENABLE([libbluray],
448   [AS_HELP_STRING([--enable-libbluray],
449   [enable libbluray support])],
450   [use_libbluray=$enableval],
451   [use_libbluray=auto])
452
453 AC_ARG_ENABLE([texturepacker],
454   [AS_HELP_STRING([--enable-texturepacker],
455   [enable texturepacker support (default is auto)])],
456   [use_texturepacker=$enableval],
457   [use_texturepacker=auto])
458
459 AC_ARG_ENABLE([lirc],
460   [AS_HELP_STRING([--disable-lirc],
461   [disable lirc support (default is enabled)])],
462   [AC_MSG_RESULT("Lirc disabled")],
463   [AC_DEFINE([HAVE_LIRC], [1], ["Lirc enabled"])])
464
465 AC_ARG_WITH([lirc-device],
466   [AS_HELP_STRING([--with-lirc-device=file],
467   [specify the default LIRC device (default is /dev/lircd)])],
468   [lirc_device=$withval],
469   [lirc_device=/dev/lircd])
470 AC_DEFINE_UNQUOTED([LIRC_DEVICE], ["$lirc_device"], [Default LIRC device])
471
472 AC_ARG_ENABLE([udev],
473   [AS_HELP_STRING([--enable-udev],
474   [enable udev support (default is auto)])],
475   [use_libudev=$enableval],
476   [use_libudev=auto])
477
478 AC_ARG_ENABLE([libusb],
479   [AS_HELP_STRING([--enable-libusb],
480   [enable libusb support (default is auto)])],
481   [use_libusb=$enableval],
482   [use_libusb=auto])
483
484 AC_ARG_ENABLE([libcec],
485   [AS_HELP_STRING([--enable-libcec],
486   [enable libcec support (default is auto)])],
487   [use_libcec=$enableval],
488   [use_libcec=auto])
489
490 AC_ARG_ENABLE([libcap],
491   [AS_HELP_STRING([--enable-libcap],
492   [enable libcap support (default is auto)])],
493   [use_libcap=$enableval],
494   [use_libcap=auto])
495
496 AC_ARG_ENABLE([player],
497   [AS_HELP_STRING([--enable-player],
498   [enable additional players from a list of comma separated names, (default is none, choices are omxplayer)])],
499   [add_players=$enableval],
500   [add_players=no])
501
502 AC_ARG_ENABLE([gtest],
503   [AS_HELP_STRING([--enable-gtest],
504   [configure Google Test Framework (default is yes)])],
505   [configure_gtest=$enableval],
506   [configure_gtest=yes])
507
508 AC_ARG_ENABLE([breakpad],
509   [AS_HELP_STRING([--enable-breakpad],
510   [configure Google Breakpad (default is no)])],
511   [use_breakpad=$enableval],
512   [use_breakpad=no])
513
514 AC_ARG_ENABLE([codec],
515   [AS_HELP_STRING([--enable-codec],
516   [enable additional codecs from a list of comma separated names, (default is none, choices are amcodec, libstagefright and imxvpu)])],
517   [add_codecs=$enableval],
518   [add_codecs=no])
519
520 AC_ARG_ENABLE([libav-compat],
521   [AS_HELP_STRING([--enable-libav-compat],
522   [build a wrapper around libav to provide the functions needed by ${APP_NAME}. This is
523    *not* supported by ${APP_NAME} developers and is provided only for convenience. (default is no) 'Linux only'])],
524   [use_libav_hacks=$enableval],
525   [use_libav_hacks=no])
526
527 ### End of external library options
528
529 if test "x$host_vendor" != "xapple"; then
530   DEFAULT_COMPILE_FLAGS="-fPIC -DPIC -D_REENTRANT"
531   DEFAULT_COMPILE_FLAGS="$DEFAULT_COMPILE_FLAGS -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
532 fi
533
534 # Checks for programs.
535 PASSED_CFLAGS=$CFLAGS # Hack to override autoconf default values
536 AC_PROG_CC
537 AX_PROG_CC_FOR_BUILD
538 CFLAGS="$PASSED_CFLAGS $DEFAULT_COMPILE_FLAGS"
539 PASSED_CXXFLAGS=$CXXFLAGS # Hack to override autoconf default values
540 AC_PROG_CXX
541 AX_PROG_CXX_FOR_BUILD
542 CXXFLAGS="$PASSED_CXXFLAGS $DEFAULT_COMPILE_FLAGS"
543 AX_CXX_COMPILE_STDCXX_11(,[optional])
544 AC_PROG_LIBTOOL
545 AC_PROG_AWK
546 AC_PROG_LN_S
547 AC_PROG_MAKE_SET
548 PKG_PROG_PKG_CONFIG
549 MAKE="${MAKE:-make}"
550 OBJDUMP="${OBJDUMP:-objdump}"
551 READELF="${READELF:-readelf}"
552 NM="${NM:-nm}"
553
554 # host detection and setup
555 case $host in
556   i*86*-linux-android*)
557      target_platform=target_android
558      ARCH="i486-linux"
559      use_arch="x86"
560      use_cpu="i686"
561      use_joystick=no
562      use_gles=yes
563      use_optical_drive=no
564      use_x11=no
565      build_shared_lib=yes    
566      ;;
567   i*86*-linux-gnu*|i*86*-*-linux-uclibc*)
568      target_platform=target_linux
569      ARCH="i486-linux"
570      if test "$use_cpu" = "no" -a "$cross_compiling" = "yes";  then
571         use_arch="x86"
572         use_cpu="i686"
573      fi
574      USE_STATIC_FFMPEG=1
575      # Workaround a build issue on i386 with gcc 4.9:
576      # including <algorithm> pulls in SSE intrinsics.
577      # possible GCC bug? ideas welcome
578      if test "$GCC_CXX" = "yes"; then
579        GCC_VERSION=$($CXX -dumpversion)
580        GCC_MAJOR_VER=$(echo $GCC_VERSION | awk -F"." '{print $1}')
581        GCC_MINOR_VER=$(echo $GCC_VERSION | awk -F"." '{print $2}')
582
583        if (test "$GCC_MAJOR_VER" -eq "4" && test "$GCC_MINOR_VER" -ge "9") || (test "$GCC_MAJOR_VER" -gt "4"); then
584          CXXFLAGS="$CXXFLAGS -msse"
585          AC_MSG_NOTICE("detected gcc version $GCC_VERSION - enabling SSE")
586        fi
587      fi
588      ;;
589   x86_64-*-linux-gnu*|x86_64-*-linux-uclibc*)
590      target_platform=target_linux
591      ARCH="x86_64-linux"
592      if test "$use_cpu" = "no" -a "$cross_compiling" = "yes";  then
593         use_arch="x86_64"
594         use_cpu="x86_64"
595      fi
596      USE_STATIC_FFMPEG=1
597      ;;
598   i386-*-freebsd*)
599      target_platform=target_linux
600      ARCH="x86-freebsd"
601      MAKE="gmake"
602      ;;
603   amd64-*-freebsd*)
604      target_platform=target_linux
605      ARCH="x86_64-freebsd"
606      MAKE="gmake"
607      ;;
608   arm-apple-darwin*)
609      use_joystick=no
610      use_neon=yes
611      use_libcec=no
612      use_vtbdecoder=yes
613      use_optical_drive=no
614      use_dvdcss=no
615      use_gles=yes
616      use_cpu=cortex-a8
617      ARCH="arm-osx"
618      use_arch="arm"
619      PYTHON_VERSION="2.6"
620      PYTHON_LDFLAGS="-L${prefix}/lib -lpython2.6"
621      PYTHON_CPPFLAGS="-I${prefix}/include/python2.6"
622      PYTHON_SITE_PKG="${prefix}/lib/python2.6/site-packages"
623      PYTHON_NOVERSIONCHECK="no-check"
624      DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
625      AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
626      ;;
627   *86*-apple-darwin*)
628      use_joystick=no
629      use_vtbdecoder=no
630      ARCH="x86-osx"
631      DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
632      AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
633      ;;
634   powerpc-apple-darwin*)
635      use_joystick=no
636      use_vtbdecoder=no
637      ARCH="powerpc-osx"
638      use_arch="ppc"
639      DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
640      AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
641      ;;
642   powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*)
643      ARCH="powerpc-linux"
644      ;;
645   powerpc64-*-linux-gnu*|powerpc64-*-linux-uclibc*)
646      ARCH="powerpc64-linux"
647      ;;
648   arm*-*-linux-gnu*|arm*-*-linux-uclibc*)
649      target_platform=target_linux
650      ARCH="arm"
651      use_arch="arm"
652      use_joystick=no
653      use_neon=yes
654      use_gles=yes
655      use_gl=no
656      use_wayland=no
657      USE_STATIC_FFMPEG=1
658      ;;
659   arm*-*linux-android*)
660      target_platform=target_android
661      use_arch="arm"
662      use_cpu=cortex-a9
663      ARCH="arm"
664      use_joystick=no
665      use_neon=yes
666      use_gles=yes
667      use_optical_drive=no
668      use_x11=no
669      use_wayland=no
670      build_shared_lib=yes
671      ;;
672   mips*-*-linux-gnu*)
673      target_platform=target_linux
674      ARCH="mips"
675      use_arch="mips"
676      use_joystick=no
677      use_gles=no
678      use_gl=yes
679      use_sdl=yes
680      use_wayland=no
681      USE_STATIC_FFMPEG=1
682      ;;
683   *)
684      AC_MSG_ERROR(unsupported host ($host))
685 esac
686 AC_SUBST([ARCH])
687
688 if test "$target_platform" = "target_android" ; then
689   USE_ANDROID=1
690   webserver_checkdepends=yes
691   CFLAGS="$CFLAGS -Wno-psabi"
692   DROID_DVDLIB_SEEK64="-D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED_ -Doff_t=off64_t -Dlseek=lseek64"
693   CXXFLAGS="$CXXFLAGS -Wno-psabi"
694   AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
695 fi
696
697 case $use_platform in
698   raspberry-pi)
699      target_platform=target_raspberry_pi
700      use_neon=no
701      use_arch="arm"
702      use_cpu=arm1176jzf-s
703      use_hardcoded_tables="yes"
704      use_openmax=no
705      ARCH="arm"
706      AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer])
707      USE_OMXLIB=1; AC_DEFINE([HAVE_OMXLIB],[1],["Define to 1 if OMX libs is enabled"])
708      USE_MMAL=1; AC_DEFINE([HAS_MMAL],[1],["Define to 1 if MMAL libs is enabled"])
709      CFLAGS="$CFLAGS"
710      CXXFLAGS="$CXXFLAGS"
711      ;;
712 esac
713
714 if test "$host_vendor" = "apple"; then
715   use_avahi=no
716   use_alsa=no
717   use_openmax=no
718   use_libudev=no
719   use_libusb=no
720   use_x11=no
721   use_wayland=no
722 fi
723
724 XBMC_SETUP_ARCH_DEFINES()
725
726 # detect soname version
727
728 if test "$host_vendor" = "apple"; then
729   echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
730 else
731   SDL_DEFINES="$SDL_DEFINES -D'GIT_REV=\"$GIT_REV\"'"
732 fi
733
734 if test "$build_shared_lib" = "yes"; then
735   final_message="$final_message\n Shared lib\tYes"
736   AC_SUBST(USE_LIBXBMC,1)
737 fi
738
739
740 # platform debug flags
741 if test "$use_debug" = "yes"; then
742   final_message="$final_message\n  Debugging:\tYes"
743   if test "$use_profiling" = "yes"; then
744     final_message="$final_message\n  Profiling:\tYes"
745     DEBUG_FLAGS="-g -pg -D_DEBUG -Wall"
746   else
747     final_message="$final_message\n  Profiling:\tNo"
748     DEBUG_FLAGS="-g -D_DEBUG -Wall"
749   fi
750 else
751   final_message="$final_message\n  Debugging:\tNo"
752   if test "$use_profiling" = "yes"; then
753     final_message="$final_message\n  Profiling:\tYes"
754     DEBUG_FLAGS="-pg -DNDEBUG=1"
755   else
756     final_message="$final_message\n  Profiling:\tNo"
757     if test "$use_breakpad" = "yes"; then
758        DEBUG_FLAGS="-g -DNDEBUG=1"
759     else
760        DEBUG_FLAGS="-DNDEBUG=1"
761     fi
762   fi
763 fi
764 CFLAGS="$DEBUG_FLAGS $CFLAGS"
765 CXXFLAGS="$DEBUG_FLAGS $CXXFLAGS"
766
767
768 if test "$use_optimizations" = "yes"; then
769   final_message="$final_message\n  Optimization:\tYes"
770   CXXFLAGS="-O2 $CXXFLAGS"
771   CFLAGS="-O2 $CFLAGS"
772 else
773   final_message="$final_message\n  Optimization:\tNo"
774 fi
775
776
777 # platform specific flags
778 if echo "$ARCH" | grep -q "freebsd" ; then
779   LOCALBASE="${LOCALBASE:-/usr/local}"
780   CFLAGS="$CFLAGS -I$LOCALBASE/include"
781   CXXFLAGS="$CXXFLAGS -I$LOCALBASE/include"
782   CPPFLAGS="$CPPFLAGS -I$LOCALBASE/include"
783   LDFLAGS="$LDFLAGS -L$LOCALBASE/lib"
784 fi
785 if test "$host_vendor" = "apple" ; then
786   # standard application paths
787   INCLUDES="$INCLUDES -I\$(abs_top_srcdir)/xbmc/osx"
788   if test "$use_arch" != "arm"; then
789     LIBS="$LIBS -framework ApplicationServices"
790     LIBS="$LIBS -framework AudioUnit"
791     LIBS="$LIBS -framework AudioToolbox"
792     LIBS="$LIBS -framework Cocoa"
793     LIBS="$LIBS -framework CoreAudio"
794     LIBS="$LIBS -framework CoreVideo"
795     LIBS="$LIBS -framework CoreServices"
796     LIBS="$LIBS -framework CoreFoundation"
797     LIBS="$LIBS -framework DiskArbitration"
798     LIBS="$LIBS -framework IOKit"
799     LIBS="$LIBS -framework IOSurface"
800     LIBS="$LIBS -framework QuartzCore"
801     LIBS="$LIBS -framework SystemConfiguration"
802     LIBS="$LIBS -framework VideoDecodeAcceleration"
803   else
804     #arm/ios
805     LIBS="$LIBS -framework CoreFoundation"
806   fi
807 elif test "$target_platform" = "target_raspberry_pi"; then
808   ARCH="arm"
809   use_arch="arm"
810 elif test "$use_arch" = "arm"; then
811   CFLAGS="$CFLAGS -mno-apcs-stack-check"
812   CXXFLAGS="$CXXFLAGS -mno-apcs-stack-check"
813   if test "$use_tegra" = "yes"; then
814     # Compile for ARMv7a architecture, need to test gcc for vfpv3-d16 support 
815     SAVE_CFLAGS="$CFLAGS"
816     CFLAGS="-mfpu=vfpv3-d16"
817     AC_COMPILE_IFELSE(
818       [AC_LANG_SOURCE([int foo;])],
819       [ CFLAGS="$SAVE_CFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
820         CXXFLAGS="$CXXFLAGS -Wno-psabi -Wa,-march=armv7a -mtune=cortex-a9 -mfpu=vfpv3-d16 -mthumb-interwork"
821         use_cpu=cortex-a9],
822       [ CFLAGS="$SAVE_CFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"
823         CXXFLAGS="$CXXFLAGS -Wa,-march=armv6 -mtune=cortex-a8 -mthumb-interwork"    
824         use_cpu=cortex-a8])
825   else
826     if test "$use_neon" = "yes"; then 
827       CFLAGS="$CFLAGS -mfpu=neon -mvectorize-with-neon-quad"
828       CXXFLAGS="$CXXFLAGS -mfpu=neon -mvectorize-with-neon-quad"
829     fi
830   fi
831 fi
832
833 use_sse4=no
834 if test "$ARCH" = "x86_64-linux" || test "$ARCH" = "i486-linux"; then
835   SAVE_CFLAGS="$CFLAGS"
836   CFLAGS="-msse4.1"
837   AC_COMPILE_IFELSE(
838     [AC_LANG_SOURCE([int foo;])],
839     [ use_sse4=yes
840       USE_SSE4=1],
841     [ use_sse4=no
842       USE_SSE4=0])
843   CFLAGS="$SAVE_CFLAGS"
844 fi
845
846 # Checks for library functions.
847 AC_FUNC_ALLOCA
848 AC_FUNC_CHOWN
849 AC_FUNC_CLOSEDIR_VOID
850 AC_FUNC_ERROR_AT_LINE
851 AC_FUNC_FSEEKO
852 AC_PROG_GCC_TRADITIONAL
853 AC_FUNC_LSTAT
854 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
855 AC_FUNC_MEMCMP
856 AC_FUNC_MKTIME
857 AC_FUNC_MMAP
858 # Boxee is apparently having compile problems
859 # if HAVE_REALLOC is defined.  Sort this later.
860 #AC_FUNC_REALLOC
861 AC_FUNC_SELECT_ARGTYPES
862 AC_FUNC_SETVBUF_REVERSED
863 AC_TYPE_SIGNAL
864 AC_FUNC_STAT
865 AC_FUNC_STRCOLL
866 AC_FUNC_STRFTIME
867 AC_FUNC_STRTOD
868 AC_FUNC_UTIME_NULL
869 AC_FUNC_VPRINTF
870 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 posix_fadvise localtime_r])
871
872 # Check for various sizes
873 AC_CHECK_SIZEOF([int])
874 AC_CHECK_SIZEOF([size_t])
875
876 # Check for intrinsics
877 AC_MSG_CHECKING([for __sync_add_and_fetch(temp, 1)])
878 AC_TRY_LINK([],[long* temp=0; long ret=__sync_add_and_fetch(temp, 1);],
879                 [have_builtin_sync_add_and_fetch=yes],
880                 [have_builtin_sync_add_and_fetch=no])
881 AC_MSG_RESULT($have_builtin_sync_add_and_fetch)
882 if test "x$have_builtin_sync_add_and_fetch" = "xyes"; then
883     AC_DEFINE(HAS_BUILTIN_SYNC_ADD_AND_FETCH, 1,
884         [Define to 1 if your compiler supports the __sync_add_and_fetch() intrinsic.])
885 fi
886
887 AC_MSG_CHECKING([for __sync_sub_and_fetch(temp, 1)])
888 AC_TRY_LINK([],[long* temp=0; long ret=__sync_sub_and_fetch(temp, 1);],
889                 [have_builtin_sync_sub_and_fetch=yes],
890                 [have_builtin_sync_sub_and_fetch=no])
891 AC_MSG_RESULT($have_builtin_sync_sub_and_fetch)
892 if test "x$have_builtin_sync_sub_and_fetch" = "xyes"; then
893     AC_DEFINE(HAS_BUILTIN_SYNC_SUB_AND_FETCH, 1,
894         [Define to 1 if your compiler supports the __sync_sub_and_fetch() intrinsic.])
895 fi
896
897 AC_MSG_CHECKING([for __sync_val_compare_and_swap(temp, 1, 1)])
898 AC_TRY_LINK([],[long *temp = 0; long ret=__sync_val_compare_and_swap(temp, 1, 1);],
899                 [have_builtin_sync_val_compare_and_swap=yes],
900                 [have_builtin_sync_val_compare_and_swap=no])
901 AC_MSG_RESULT($have_builtin_sync_val_compare_and_swap)
902 if test "x$have_builtin_sync_val_compare_and_swap" = "xyes"; then
903     AC_DEFINE(HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP, 1,
904         [Define to 1 if your compiler supports the __sync_val_compare_and_swap() intrinsic.])
905 fi
906
907 # Check for u16string/u32string declarations
908 AC_LANG_PUSH([C++])
909 AC_CHECK_TYPES([std::u16string, std::u32string], [], [], [[#include <string>]])
910 AC_CHECK_TYPES([char16_t, char32_t])
911 AC_CHECK_SIZEOF([wchar_t])
912 AC_LANG_POP([C++])
913
914 # Check inotify availability
915 AC_CHECK_HEADER([sys/inotify.h], AC_DEFINE([HAVE_INOTIFY],[1],[Define if we have inotify]),)
916
917 # Checks for boost headers using CXX instead of CC
918 AC_LANG_PUSH([C++])
919 AC_CHECK_HEADER([boost/circular_buffer.hpp],, AC_MSG_ERROR($missing_library))
920 AC_LANG_POP([C++])
921
922 # Python
923 if test -z "$PYTHON_NOVERSIONCHECK"; then
924   AX_PYTHON_DEVEL([>= '2.6'])
925   AX_PYTHON_DEVEL([< '3.0'])
926   PYTHON_VERSION=$ac_python_version
927 fi
928
929 if test -z "$PYTHON_VERSION"; then
930   AC_MSG_ERROR([Can't find a Python version.])
931 else
932   LIBS="$LIBS $PYTHON_LDFLAGS"
933   AC_MSG_NOTICE([Using Python $PYTHON_VERSION])
934 fi
935
936 # Wayland
937 if test "$use_wayland" = "yes"; then
938   AC_MSG_NOTICE($wayland_enabled)
939   PKG_CHECK_MODULES([WAYLAND_CLIENT],    [wayland-client],
940     [INCLUDES="$INCLUDES $WAYLAND_CLIENT_CFLAGS";
941      WAYLAND_CLIENT_LIBRARY_LINE=`LIBRARY=\`${PKG_CONFIG} --libs-only-l wayland-client\`; echo ${LIBRARY:2}`;
942      XB_FIND_SONAME([WAYLAND_CLIENT_LIBRARY], ${WAYLAND_CLIENT_LIBRARY_LINE})],
943      AC_MSG_ERROR($missing_library))
944   PKG_CHECK_MODULES([WAYLAND_EGL],    [wayland-egl],
945     [INCLUDES="$INCLUDES $WAYLAND_EGL_CFLAGS";
946      WAYLAND_EGL_LIBRARY_LINE=`LIBRARY=\`${PKG_CONFIG} --libs-only-l wayland-egl\`; echo ${LIBRARY:2:11}`
947      XB_FIND_SONAME([WAYLAND_EGL_LIBRARY], ${WAYLAND_EGL_LIBRARY_LINE})],
948     AC_MSG_ERROR($missing_library))
949   PKG_CHECK_MODULES([XKBCOMMON],    [xkbcommon],
950     [INCLUDES="$INCLUDES $XKBCOMMON_CFLAGS";
951      XKBCOMMON_LIBRARY_LINE=`LIBRARY=\`${PKG_CONFIG} --libs-only-l xkbcommon\`; echo ${LIBRARY:2}`;
952      XB_FIND_SONAME([XKBCOMMON_LIBRARY], $XKBCOMMON_LIBRARY_LINE)],
953     AC_MSG_ERROR($missing_library))
954   AC_DEFINE([HAVE_WAYLAND], [1], [Define to 1 if you have Wayland libs installed.])
955   AC_DEFINE([HAVE_XKBCOMMON], [1], [Define to 1 if you have libxkbcommon installed.])
956
957   # If we are also building with tests then we want to build
958   # wayland tests as well
959   if test "$configure_gtest" = "yes"; then
960     have_weston_sdk=no;
961     PKG_CHECK_MODULES([PIXMAN],
962                       [pixman-1],have_pixman=yes,
963                       [AC_MSG_WARN($missing_library); have_pixman=no])
964     PKG_CHECK_MODULES([WESTON],
965                       [weston >= 1.1.90],[have_weston_sdk=yes],
966                       [have_weston_sdk=no; AC_MSG_WARN($missing_library)])
967
968     AC_CHECK_PROG(WAYLAND_SCANNER, wayland-scanner, "wayland-scanner", "no")
969     if test "x$WAYLAND_SCANNER" == "xno"; then
970       AC_MSG_WARN($missing_program)
971     else
972       if test "x$have_weston_sdk" == "xyes" && test "x$have_pixman" = "xyes"; then
973         AC_SUBST(WAYLAND_TEST_INCLUDES,"$WAYLAND_CLIENT_CFLAGS $XKBCOMMON_CFLAGS $PIXMAN_CFLAGS $WESTON_CFLAGS")
974         AC_SUBST(WAYLAND_TEST_LIBS,"$WAYLAND_CLIENT_LIBS $XKBCOMMON_LIBS $PIXMAN_LIBS $WESTON_LIBS")
975         AC_DEFINE([HAVE_WESTON_SDK], [1], [Define to 1 if Weston SDK is installed.])
976         AC_SUBST(USE_WAYLAND_TEST_EXTENSION, 1)
977       fi
978       AC_SUBST(WAYLAND_SCANNER)
979       AC_DEFINE([HAVE_WAYLAND_XBMC_PROTO],[1],["Define to 1 if the wayland test-protocol will be built"])
980     fi
981   fi
982
983   # Disable SDL and X11 builds
984   use_joystick=no
985   use_x11=no
986
987   # Wayland requires the EGL "window system" which in turn only supports
988   # the OpenGL ES API, so enable gles support
989   use_gles=yes
990 else
991   AC_MSG_RESULT($wayland_disabled)
992 fi
993
994 # Checks for platforms libraries.
995 if test "$use_gles" = "yes"; then
996   use_gl="no"
997   # GLES overwrites GL if both set to yes.
998   if test "$host_vendor" = "apple" ; then
999     AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
1000     AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
1001     AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
1002   else
1003     if test "$target_platform" = "target_raspberry_pi"; then
1004       AC_DEFINE([HAVE_LIBEGL],[1],["Define to 1 if you have the `EGL' library (-lEGL)."])
1005       AC_DEFINE([HAVE_LIBGLESV2],[1],["Define to 1 if you have the `GLESv2' library (-lGLESv2)."])
1006       AC_MSG_RESULT(== WARNING: OpenGLES support is assumed.)
1007       LIBS="$LIBS -lEGL -lGLESv2 -lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util"
1008     else
1009       AC_CHECK_LIB([EGL],   [main],, AC_MSG_ERROR($missing_library))
1010       AC_CHECK_LIB([GLESv2],[main],, AC_MSG_ERROR($missing_library))
1011     fi
1012   fi
1013 else
1014   if test "$use_gl" = "yes"; then
1015     if test "$host_vendor" = "apple" ; then
1016       # linking to OpenGL.framework instead of libGL, libGLU so AC_CHECK_LIB will fail
1017       LIBS="$LIBS -framework OpenGL"
1018       AC_DEFINE([HAVE_LIBGL],[1],["Define to 1 if you have the `GL' library (-lGL)."])
1019       AC_MSG_RESULT(== WARNING: OpenGL support is assumed.)
1020       AC_DEFINE([HAVE_LIBGLU],[1],["Define to 1 if you have the `GLU' library (-lGLU)."])
1021       AC_MSG_RESULT(== WARNING: OpenGLU support is assumed.)
1022       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
1023     else
1024       AC_CHECK_LIB([GL],  [main],, AC_MSG_ERROR($missing_library))
1025       AC_CHECK_LIB([GLEW],[main],, AC_MSG_ERROR($missing_library))
1026       AC_CHECK_LIB([GLU], [main],, AC_MSG_ERROR($missing_library))
1027     fi
1028   else
1029     AC_MSG_RESULT(== WARNING: OpenGL support is disabled. ${APP_NAME} will run VERY slow. ==)
1030     AC_CHECK_LIB([SDL2_gfx],[main])
1031   fi
1032 fi
1033
1034 # platform common libraries
1035 if test "$use_mysql" = "yes"; then
1036   AC_PATH_PROG(MYSQL_CONFIG, mysql_config,"no")
1037   if test "x$MYSQL_CONFIG" != "xno"; then
1038     AC_DEFINE([HAVE_MYSQL],[1],["Define to 1 if you have the `mysql' library (-lmysqlclient)."])
1039     INCLUDES="$INCLUDES `$MYSQL_CONFIG --include`"
1040     MYSQL_LIBS=`$MYSQL_CONFIG --libs`
1041     LIBS="$LIBS $MYSQL_LIBS"
1042     AC_SUBST(MYSQL_LIBS)
1043   else
1044     AC_MSG_ERROR($missing_program)
1045   fi
1046 fi
1047 AC_CHECK_HEADER([ass/ass.h],, AC_MSG_ERROR($missing_library))
1048 AC_CHECK_HEADER([mpeg2dec/mpeg2.h],, AC_MSG_ERROR($missing_library))
1049 AC_CHECK_HEADER([mpeg2dec/mpeg2convert.h],, AC_MSG_ERROR($missing_library),
1050   AC_INCLUDES_DEFAULT()
1051   [#include <mpeg2dec/mpeg2.h>])
1052 AC_CHECK_HEADER([jpeglib.h],,        AC_MSG_ERROR($missing_library))
1053 AC_CHECK_HEADER([ogg/ogg.h],,        AC_MSG_ERROR($missing_library))
1054 AC_CHECK_HEADER([vorbis/vorbisfile.h],, AC_MSG_ERROR($missing_library))
1055 PKG_CHECK_MODULES([LIBDCADEC], [dcadec],, AC_MSG_ERROR([libdcadec not found]))
1056
1057 PKG_CHECK_MODULES([LIBCURL], [libcurl],, AC_MSG_ERROR([libcurl not found]))
1058 XB_FIND_SONAME([CURL], [curl])
1059 AC_MSG_CHECKING([for CRYPTO_set_locking_callback(0) in $CURL_SONAME])
1060 if test "$host_vendor" = "apple" ; then
1061   libchecker="$NM"
1062   searchpattern="T [_]?CRYPTO_set_locking_call"
1063 else
1064   libchecker="$READELF -s"
1065   searchpattern="CRYPTO_set_locking_call"
1066 fi
1067 if test $($libchecker $CURL_FILENAME  | grep -Eq "${searchpattern}" ; echo $?) -eq 0 ; then
1068   AC_MSG_RESULT(yes)
1069   AC_DEFINE([HAS_CURL_STATIC], [1], [Whether OpenSSL inside libcurl is static.])
1070 else
1071   AC_MSG_RESULT(no)
1072 fi
1073
1074 AC_CHECK_HEADER([openssl/crypto.h], AC_DEFINE([HAVE_OPENSSL],[1],[Define if we have openssl]),)
1075 AC_CHECK_HEADER([gcrypt.h], gcrypt_headers_available=yes,gcrypt_headers_available=no)
1076 if test "$gcrypt_headers_available" = "yes"; then
1077    # if we have the headers then we must have the lib
1078    AC_CHECK_LIB([gpg-error],[main],, AC_MSG_ERROR($missing_library))
1079    AC_CHECK_LIB([gcrypt],[gcry_control],, AC_MSG_ERROR($missing_library))
1080    AC_DEFINE([HAVE_GCRYPT],[1],[Define if we have gcrypt])
1081 fi
1082 PKG_CHECK_MODULES([GNUTLS], [gnutls], [have_gnutls=yes];AC_DEFINE([HAVE_GNUTLS], [1], [Define if we have gnutls]), AC_MSG_WARN("gnutls not found"))
1083
1084 AC_CHECK_LIB([bz2],         [main],, AC_MSG_ERROR($missing_library))
1085 AC_CHECK_LIB([jpeg],        [main],, AC_MSG_ERROR($missing_library)) # check for cximage
1086 AC_CHECK_LIB([tiff],        [main],, AC_MSG_ERROR($missing_library))
1087 if echo "$ARCH" | grep -q freebsd; then
1088 AC_CHECK_LIB([pthread],     [main],LIBS="-pthread $LIBS", AC_MSG_ERROR($missing_library))
1089 AC_CHECK_LIB([pthread],     [pthread_set_name_np],
1090   AC_DEFINE([HAVE_PTHREAD_SET_NAME_NP],[1],["Define to 1 if pthread has pthread_set_name_np"]),
1091   AC_MSG_RESULT([Could not find pthread_set_name_np in pthread]))
1092 else
1093 if test "$target_platform" != "target_android" ; then
1094   AC_CHECK_LIB([pthread],     [main],, AC_MSG_ERROR($missing_library))
1095   AC_CHECK_LIB([pthread],     [pthread_setname_np],
1096     AC_DEFINE([HAVE_PTHREAD_SETNAME_NP],[1],["Define to 1 if pthread has pthread_setname_np"]),
1097     AC_MSG_RESULT([Could not find pthread_setname_np in pthread]))
1098 fi
1099 fi
1100 AC_CHECK_LIB([lzo2],        [main],, AC_MSG_ERROR($missing_library))
1101 AC_CHECK_LIB([z],           [main],, AC_MSG_ERROR($missing_library))
1102 AC_CHECK_LIB([crypto],      [main],, AC_MSG_ERROR($missing_library))
1103 AC_CHECK_LIB([ssl],         [main],, AC_MSG_ERROR($missing_library))
1104 if test "$use_mysql" = "yes"; then
1105   AC_CHECK_LIB([mysqlclient], [main],, AC_MSG_ERROR($missing_library))
1106 fi
1107 AC_CHECK_LIB([bluetooth],   [hci_devid],, AC_MSG_RESULT([Could not find suitable version of libbluetooth]))
1108
1109 AC_LANG_PUSH([C++])
1110 PKG_CHECK_MODULES([TINYXML], [tinyxml >= 2.6.2],
1111   [INCLUDES="$INCLUDES $TINYXML_CFLAGS"; LIBS="$LIBS $TINYXML_LIBS"],
1112   [AC_RUN_IFELSE(
1113    [AC_LANG_SOURCE([[
1114 #include <stdlib.h>
1115 #include <tinyxml.h>
1116
1117 int main() {
1118   if (TIXML_MAJOR_VERSION < 2) exit(1);
1119   if (TIXML_MAJOR_VERSION == 2 && ( TIXML_MINOR_VERSION < 6 || ( TIXML_MINOR_VERSION == 6 && TIXML_PATCH_VERSION < 2 ))) exit(1);
1120 }
1121     ]])],[AC_CHECK_LIB([tinyxml], [main],, AC_MSG_ERROR("tinyxml >= 2.6.2 not found"))], [AC_MSG_ERROR([tinyxml >= 2.6.2 not found])]
1122   )])
1123 AC_LANG_POP([C++])
1124
1125 if test "${target_platform}" = "target_linux" || test "${target_platform}" = "target_raspberry_pi" || test "${target_platform}" = "target_android"; then
1126   PKG_CHECK_MODULES([UUID], [uuid],, AC_MSG_ERROR(libuuid not found))
1127 fi
1128
1129 AC_MSG_CHECKING("for libcrossguid")
1130 AC_LANG_PUSH([C++])
1131 SAVED_LIBS="$LIBS"
1132 LIBS="$LIBS -lcrossguid $UUID_LIBS"
1133 AC_LINK_IFELSE(
1134   [AC_LANG_PROGRAM(
1135     [#include <guid.h>],
1136     [Guid dummy])],
1137   [AC_MSG_RESULT(yes); SAVED_LIBS="$SAVED_LIBS $LDFLAGS -lcrossguid $UUID_LIBS"],
1138   [AC_MSG_ERROR(crossguid not found)])
1139 LIBS="$SAVED_LIBS"
1140 AC_LANG_POP([C++])
1141
1142 PKG_CHECK_MODULES([YAJL], [yajl >= 2],
1143   [INCLUDES="$INCLUDES $YAJL_CFLAGS"; LIBS="$LIBS $YAJL_LIBS"; YAJL_FOUND="true"],
1144   [AC_COMPILE_IFELSE(
1145     [AC_LANG_SOURCE([[
1146 #include <yajl/yajl_version.h>
1147 #if !defined YAJL_MAJOR || YAJL_MAJOR < 2
1148 #error yajl version < 2;
1149 #endif
1150     ]])],, [AC_MSG_ERROR([libyajl >= 2.0.0 not found])]
1151   )])
1152
1153 if test "$YAJL_FOUND" != "true"; then
1154   AC_CHECK_LIB([yajl], [main],, [AC_MSG_ERROR("libyajl >= 2.0.0 not found")])
1155   AC_CHECK_HEADERS([yajl/yajl_common.h], [AC_MSG_NOTICE(libyajl2 found)], [AC_MSG_ERROR("yajl/yajl_common.h not found")])
1156 fi
1157
1158 if test "$target_platform" = "target_android" ; then
1159   AC_CHECK_LIB([android],     [main],, AC_MSG_ERROR($missing_library))
1160   AC_CHECK_LIB([log],         [__android_log_vprint],, AC_MSG_ERROR($missing_library))
1161   AC_CHECK_LIB([jnigraphics],     [main],, AC_MSG_ERROR($missing_library))
1162 fi
1163 PKG_CHECK_MODULES([LIBXML], [libxml-2.0],
1164   [INCLUDES="$INCLUDES $LIBXML_CFLAGS"; LIBS="$LIBS $LIBXML_LIBS"],
1165   AC_MSG_ERROR($missing_library))
1166 PKG_CHECK_MODULES([LIBXSLT], [libxslt],
1167   [INCLUDES="$INCLUDES $LIBXSLT_CFLAGS"; LIBS="$LIBS $LIBXSLT_LIBS"],
1168   AC_MSG_ERROR($missing_library))
1169 PKG_CHECK_MODULES([FRIBIDI],    [fribidi],
1170   [INCLUDES="$INCLUDES $FRIBIDI_CFLAGS"; LIBS="$LIBS $FRIBIDI_LIBS"],
1171   AC_MSG_ERROR($missing_library))
1172 PKG_CHECK_MODULES([SQLITE3],    [sqlite3],
1173   [INCLUDES="$INCLUDES $SQLITE3_CFLAGS"; LIBS="$LIBS $SQLITE3_LIBS"],
1174   AC_MSG_ERROR($missing_library))
1175 PKG_CHECK_MODULES([PNG],        [libpng],
1176   [INCLUDES="$INCLUDES $PNG_CFLAGS"; LIBS="$LIBS $PNG_LIBS"],
1177   AC_MSG_ERROR($missing_library))
1178 PKG_CHECK_MODULES([PCRECPP],    [libpcrecpp],
1179   [INCLUDES="$INCLUDES $PCRECPP_CFLAGS"; LIBS="$LIBS $PCRECPP_LIBS"]; \
1180   AC_DEFINE([HAVE_LIBPCRECPP],[1],["Define to 1 if libpcrecpp is installed"]),
1181   AC_MSG_ERROR($missing_library))
1182 PKG_CHECK_MODULES([PCRE],       [libpcre],
1183   [INCLUDES="$INCLUDES $PCRE_CFLAGS"; LIBS="$LIBS $PCRE_LIBS"]; \
1184   AC_DEFINE([HAVE_LIBPCRE],[1],["Define to 1 if libpcre is installed"]),
1185   AC_MSG_ERROR($missing_library))
1186 PKG_CHECK_MODULES([FREETYPE2],  [freetype2],
1187   [INCLUDES="$INCLUDES $FREETYPE2_CFLAGS"; LIBS="$LIBS $FREETYPE2_LIBS"],
1188   AC_MSG_ERROR($missing_library))
1189 PKG_CHECK_MODULES([TAGLIB],  [taglib >= 1.8],
1190   [INCLUDES="$INCLUDES $TAGLIB_CFLAGS"; LIBS="$LIBS $TAGLIB_LIBS"],
1191   AC_MSG_ERROR($missing_library))
1192
1193 if test "$use_optical_drive" = "yes"; then
1194   PKG_CHECK_MODULES([CDIO],       [libcdio],
1195     [INCLUDES="$INCLUDES $CDIO_CFLAGS"; LIBS="$LIBS $CDIO_LIBS"],
1196     AC_MSG_ERROR($missing_library))
1197 fi
1198
1199 if test "$target_platform" = "target_android" ; then
1200 PKG_CHECK_MODULES([ZIP],       [libzip],
1201   [INCLUDES="$INCLUDES $ZIP_CFLAGS"; LIBS="$LIBS $ZIP_LIBS"],
1202   AC_MSG_ERROR($missing_library))
1203 fi
1204
1205 # check for libbluray
1206 AS_CASE([x$use_libbluray],
1207   [xyes],[
1208     PKG_CHECK_MODULES([LIBBLURAY],[libbluray >= 0.7.0],[use_libbluray="yes"], AC_MSG_ERROR($missing_library))
1209   ],
1210   [xauto],[
1211     PKG_CHECK_MODULES([LIBBLURAY],[libbluray >= 0.7.0],[use_libbluray="yes"], [use_libbluray="no"])
1212   ])
1213
1214 AS_CASE([x$use_libbluray],
1215   [xyes],[
1216     INCLUDES="$INCLUDES $LIBBLURAY_CFLAGS";
1217     LIBBLURAY_LIB_BASENAME=`$PKG_CONFIG --libs-only-L "libbluray >= 0.7.0"`;
1218     XB_FIND_SONAME([BLURAY], [bluray], [use_libbluray], [$LIBBLURAY_LIB_BASENAME])
1219     AC_DEFINE([HAVE_LIBBLURAY], 1, [System has libbluray library])
1220     AC_SUBST([HAVE_LIBBLURAY], 1)
1221     AC_CHECK_LIB([bluray], [bd_register_argb_overlay_proc],
1222       AC_CHECK_DECL([BD_EVENT_IDLE],
1223         AC_DEFINE([HAVE_LIBBLURAY_BDJ], 1, [System has libbluray library with bdj support]),,
1224         [[#include <libbluray/bluray.h>]]))
1225   ],[
1226     AC_SUBST([HAVE_LIBBLURAY], 0)
1227   ]
1228 )
1229
1230 #Check to see if libs are needed for functions that are often built-in to libc
1231 AC_SEARCH_LIBS([iconv_open],iconv,,AC_SEARCH_LIBS([libiconv_open],iconv,,AC_MSG_ERROR($missing_library)))
1232 AC_SEARCH_LIBS([dlopen],dl)
1233 AC_SEARCH_LIBS([clock_gettime],rt)
1234 AC_SEARCH_LIBS([dn_expand],  resolv)
1235 AC_SEARCH_LIBS([_dn_expand], resolv)
1236 AC_SEARCH_LIBS([__dn_expand],resolv)
1237
1238 # platform dependent libraries
1239 if test "$host_vendor" = "apple" ; then
1240   if test "$use_arch" != "arm"; then
1241     AC_CHECK_LIB([SDL],      [main],, AC_MSG_ERROR($missing_library))
1242     AC_DEFINE([HAVE_SDL],[1],["Define to 1 if using sdl"])
1243     AC_DEFINE([HAVE_SDL_VERSION],[1],["SDL major version"])
1244   fi
1245 else
1246 if test "$target_platform" != "target_android" ; then
1247   AC_CHECK_LIB([jasper],     [main],, AC_MSG_ERROR($missing_library)) # check for cximage
1248 fi
1249 if test "x$use_alsa" != "xno"; then
1250   PKG_CHECK_MODULES([ALSA],  [alsa],
1251     [INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"; use_alsa=yes],
1252     AC_MSG_NOTICE($alsa_not_found); use_alsa=no)
1253 fi
1254 if test "x$use_dbus" != "xno"; then
1255   PKG_CHECK_MODULES([DBUS],    [dbus-1],
1256     [INCLUDES="$INCLUDES $DBUS_CFLAGS"; LIBS="$LIBS $DBUS_LIBS"; use_dbus=yes]; \
1257     AC_DEFINE([HAVE_DBUS],[1],["Define to 1 if dbus is installed"]),
1258     AC_MSG_NOTICE($missing_library); use_dbus=no)
1259 else
1260   AC_MSG_NOTICE($dbus_disabled)
1261 fi
1262   #case "$host_vendor" != "apple"; determine availability of SDL or SDL2
1263   # joystick
1264   if test "$use_joystick" != "no"; then
1265     PKG_CHECK_MODULES([SDL2], [sdl2],
1266       [AC_DEFINE([HAVE_SDL_VERSION],[2],["SDL major version"])
1267        AC_DEFINE([HAVE_SDL],[1],["Define to 1 if using sdl"])
1268        INCLUDES="$INCLUDES $SDL2_CFLAGS"; LIBS="$LIBS $SDL2_LIBS"; use_joystick="yes"],
1269       [if test "$use_joystick" = "yes"; then
1270         AC_MSG_ERROR($sdl_joystick_not_found)
1271       elif test "$use_joystick" != "no"; then
1272         AC_MSG_NOTICE($sdl_joystick_not_found)
1273         use_joystick="no"
1274       fi
1275      ])
1276   else
1277     AC_MSG_RESULT($sdl_joystick_not_found)
1278   fi
1279 fi
1280
1281 XB_FIND_SONAME([ASS],         [ass])
1282 XB_FIND_SONAME([MPEG2],       [mpeg2])
1283
1284 # WebServer
1285 if test "$use_webserver" = "yes"; then
1286   AC_CHECK_LIB([microhttpd],  [main],, AC_MSG_ERROR($missing_library))
1287 fi
1288
1289 # Optical
1290 if test "$use_optical_drive" = "yes"; then
1291   AC_DEFINE([HAS_DVD_DRIVE], [1], [Define to 1 to have optical drive support])
1292 fi
1293
1294 # Alsa
1295 if test "$use_alsa" = "yes"; then
1296   PKG_CHECK_MODULES([ALSA],  [alsa],
1297     [INCLUDES="$INCLUDES $ALSA_CFLAGS"; LIBS="$LIBS $ALSA_LIBS"],
1298     AC_MSG_ERROR($missing_library))
1299   AC_DEFINE([HAS_ALSA], [1], [Define to 0 to disable ALSA support])
1300 else
1301   use_alsa="no"
1302   AC_MSG_RESULT($alsa_disabled)
1303 fi
1304
1305 # PulseAudio
1306 if test "x$use_pulse" != "xno"; then
1307   if test "$host_vendor" = "apple" ; then
1308     if test "x$use_pulse" = "xyes"; then
1309       AC_MSG_ERROR($pulse_disabled)
1310     else
1311       use_pulse="no"
1312       AC_MSG_RESULT($pulse_disabled)
1313     fi
1314     USE_PULSE=0
1315   else
1316     PKG_CHECK_MODULES([PULSE], [libpulse >= 1.0],
1317       [INCLUDES="$INCLUDES $PULSE_CFLAGS"; LIBS="$LIBS $PULSE_LIBS"; USE_PULSE=1;
1318         HAVE_LIBPULSE=1; AC_DEFINE([HAVE_LIBPULSE],[1],[Pulse audio enabled])],
1319       [pulse_found="no"; USE_PULSE=0; HAVE_LIBPULSE=0])
1320
1321     if test "$pulse_found" = "no"; then
1322       if test "x$use_pulse" = "xyes"; then
1323         AC_MSG_ERROR($pulse_not_found)
1324       else
1325         use_pulse="no"
1326         AC_MSG_RESULT($pulse_disabled)
1327       fi
1328     fi
1329   fi
1330 else
1331   AC_MSG_RESULT($pulse_disabled)
1332   USE_PULSE=0
1333 fi
1334
1335 # avahi
1336 if test "$use_avahi" = "yes"; then
1337   AC_CHECK_LIB([avahi-common], [main],,
1338     use_avahi=no;AC_MSG_RESULT($avahi_not_found))
1339   if test "$use_avahi" = "yes"; then
1340     #either both libs or none
1341     AC_CHECK_LIB([avahi-client], [main],,
1342       use_avahi=no;AC_MSG_RESULT($avahi_not_found))
1343   fi
1344 else
1345   AC_MSG_RESULT($avahi_disabled)
1346 fi
1347
1348 # mdnsembedded
1349 if test "$use_mdnsembedded" != "no"; then
1350   AC_CHECK_LIB([mDNSEmbedded], [embedded_mDNSInit],,
1351     [if test "$use_mdnsembedded" = "yes"; then
1352       AC_MSG_ERROR($mdnsembedded_not_found)
1353       USE_MDNSEMBEDDED=0
1354     elif test "$use_mdnsembedded" != "no"; then
1355       AC_MSG_NOTICE($mdnsembedded_not_found)
1356       use_mdnsembedded="no"
1357       USE_MDNSEMBEDDED=0
1358     fi
1359    ])
1360   if test $use_mdnsembedded != "no"; then
1361     USE_MDNSEMBEDDED=1
1362   fi
1363 else
1364   AC_MSG_RESULT($mdnsembedded_disabled)
1365   USE_MDNSEMBEDDED=0
1366 fi
1367 AC_SUBST(USE_MDNSEMBEDDED)
1368
1369 # X11
1370 if test "$use_x11" = "yes"; then
1371   AC_MSG_NOTICE($x11_enabled)
1372   PKG_CHECK_MODULES([X11],    [x11],
1373     [INCLUDES="$INCLUDES $X11_CFLAGS"; LIBS="$LIBS $X11_LIBS"],
1374     AC_MSG_ERROR($missing_library))
1375   PKG_CHECK_MODULES([XEXT],  [xext],
1376     [INCLUDES="$INCLUDES $XEXT_CFLAGS"; LIBS="$LIBS $XEXT_LIBS"],
1377     AC_MSG_ERROR($missing_library))
1378   PKG_CHECK_MODULES([XRANDR], [xrandr],
1379     [INCLUDES="$INCLUDES $XRANDR_CFLAGS"; LIBS="$LIBS $XRANDR_LIBS"],
1380     AC_MSG_ERROR($missing_library))
1381   PKG_CHECK_MODULES([DRM],  [libdrm],
1382     [INCLUDES="$INCLUDES $DRM_CFLAGS"; LIBS="$LIBS $DRM_LIBS"],
1383     AC_MSG_ERROR($missing_library))
1384   AC_DEFINE([HAVE_X11], [1], [Define to 1 if you have X11 libs installed.])
1385 else
1386   AC_MSG_RESULT($x11_disabled)
1387 fi
1388
1389 # touch skin
1390 use_touch_skin=no
1391 if [[ -f "addons/skin.re-touched/addon.xml" ]]; then 
1392   use_touch_skin=yes
1393   USE_TOUCH_SKIN=1
1394   AC_DEFINE([HAS_TOUCH_SKIN], [1], [Whether to build the touch skin.])
1395 else
1396   USE_TOUCH_SKIN=0
1397 fi
1398
1399 # libssh
1400 if test "x$use_ssh" = "xno"; then
1401   AC_MSG_NOTICE($ssh_disabled)
1402   use_libssh="no"
1403 else
1404   AC_CHECK_LIB([ssh], [sftp_tell64],, AC_MSG_ERROR($ssh_not_found))
1405   AC_DEFINE([HAVE_LIBSSH], [1], [Whether to use libSSH library.])
1406 fi
1407
1408 # libRTMP
1409 if test "$use_librtmp" != "no"; then
1410   AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
1411    [if test "$use_librtmp" = "yes"; then
1412       AC_MSG_ERROR($librtmp_not_found)
1413     elif test "$use_librtmp" != "no"; then
1414       AC_MSG_NOTICE($librtmp_not_found)
1415       use_librtmp="no"
1416     fi
1417    ])
1418   if test "$use_librtmp" != "no"; then
1419     XB_FIND_SONAME([RTMP], [rtmp], [use_librtmp])
1420   fi
1421   if test "$use_librtmp" != "no"; then
1422     AC_DEFINE([HAS_LIBRTMP], [1], [Whether to use libRTMP library.])
1423   fi
1424 else
1425   AC_MSG_NOTICE($librtmp_disabled)
1426 fi
1427
1428 # samba
1429 if test "x$use_samba" != "xno"; then
1430   PKG_CHECK_MODULES([SAMBA], [smbclient],
1431     [INCLUDES="$INCLUDES $SAMBA_CFLAGS"; LIBS="$LIBS $SAMBA_LIBS"],
1432     [AC_CHECK_LIB([smbclient], [main],,
1433       use_samba=no;AC_MSG_ERROR($missing_library))
1434       USE_LIBSMBCLIENT=0
1435     ])
1436 else
1437   AC_MSG_RESULT($samba_disabled)
1438   USE_LIBSMBCLIENT=0
1439 fi
1440
1441 if test "x$use_samba" != "xno"; then
1442   AC_DEFINE([HAVE_LIBSMBCLIENT], [1], [Define to 1 if you have Samba installed])
1443   USE_LIBSMBCLIENT=1
1444 fi
1445
1446 # libnfs
1447 if test "$use_libnfs" != "no"; then
1448   AC_CHECK_HEADERS([nfsc/libnfs.h],,
1449    [if test "$use_libnfs" = "yes"; then
1450       AC_MSG_ERROR($libnfs_not_found)
1451       USE_LIBNFS=0
1452     elif test "$use_libnfs" != "no"; then
1453       AC_MSG_NOTICE($libnfs_not_found)
1454       use_libnfs="no"
1455       USE_LIBNFS=0
1456     fi
1457    ])
1458   if test "$use_libnfs" != "no"; then
1459     XB_FIND_SONAME([NFS], [nfs], [use_libnfs])
1460   fi
1461   if test "$use_libnfs" != "no"; then
1462     AC_DEFINE([HAVE_LIBNFS], [1], [Whether to use libnfs library.])
1463     USE_LIBNFS=1
1464   fi
1465 else
1466   USE_LIBNFS=0
1467   AC_MSG_NOTICE($libnfs_disabled)
1468 fi
1469
1470 # libgif
1471 if test "$use_libgif" != "no"; then
1472   AC_CHECK_HEADERS([gif_lib.h],,
1473    [if test "$use_libgif" = "yes"; then
1474       AC_MSG_ERROR($libgif_not_found)
1475       USE_LIBGIF=0
1476     elif test "$use_libgif" != "no"; then
1477       AC_MSG_NOTICE($libgif_not_found)
1478       use_libgif="no"
1479       USE_LIBGIF=0
1480     fi
1481    ])
1482   if test "$use_libgif" != "no"; then
1483     XB_FIND_SONAME([GIF], [gif], [use_libgif])
1484   fi
1485   if test "$use_libgif" != "no"; then
1486     AC_DEFINE([HAVE_LIBGIF], [1], [Whether to use libgif library.])
1487     USE_LIBGIF=1
1488   fi
1489 else
1490   USE_LIBGIF=0
1491   AC_MSG_NOTICE($libgif_disabled)
1492 fi
1493
1494 # libplist for airplay feature
1495 USE_AIRPLAY=0
1496 if test "$use_airplay" != "no"; then
1497   AC_CHECK_HEADER([plist/plist.h],,
1498    [if test "$use_airplay" = "yes"; then
1499       AC_MSG_ERROR($libplist_not_found)
1500     elif test "$use_airplay" != "no"; then
1501       AC_MSG_NOTICE($libplist_not_found)
1502       use_airplay="no"
1503     fi
1504    ])
1505
1506   if test "$use_airplay" != "no"; then
1507     XB_FIND_SONAME([PLIST], [plist], [use_airplay])
1508     USE_AIRPLAY=1
1509     AC_DEFINE([HAVE_LIBPLIST],[1],["Define to 1 if you have libplist."])
1510   fi
1511 fi
1512
1513 # libshairplay for AirTunes
1514 USE_AIRTUNES=0
1515 if test "x$use_airtunes" != "xno"; then
1516   AC_CHECK_HEADERS([shairplay/raop.h],USE_AIRTUNES=1,
1517    [AC_MSG_NOTICE($libshairplay_not_found)
1518    ])
1519
1520   if test "x$USE_AIRTUNES" != "x0"; then
1521     XB_FIND_SONAME([SHAIRPLAY], [shairplay], [USE_AIRTUNES])
1522     AC_CHECK_MEMBERS([struct raop_callbacks_s.audio_remote_control_id],
1523                      AC_DEFINE([HAVE_LIBSHAIRPLAY],[1],["Define to 1 if you have libshairplay."]),
1524                      USE_AIRTUNES=0,
1525                      [[#include <shairplay/raop.h>]])
1526   fi
1527
1528   if test "x$USE_AIRTUNES" == "x0"; then
1529     if test "x$use_airtunes" == "xyes"; then
1530       AC_MSG_ERROR("No airtunes library could be found. (libshairplay)")
1531     fi
1532     use_airtunes="no"
1533   fi
1534 fi
1535
1536 # libudev
1537 USE_LIBUDEV=0
1538 if test "$use_libudev" = "auto"; then
1539   PKG_CHECK_MODULES([UDEV],[libudev],,[use_libudev="no";AC_MSG_RESULT($libudev_not_found)])
1540 elif test "$use_libudev" = "yes" ; then
1541   PKG_CHECK_MODULES([UDEV],[libudev],,[use_libudev="no";AC_MSG_ERROR($libudev_not_found)])
1542 else
1543   AC_MSG_NOTICE($libudev_disabled)
1544 fi
1545
1546 if test "x$use_libudev" != "xno"; then
1547   USE_LIBUDEV=1;INCLUDES="$INCLUDES $UDEV_CFLAGS";LIBS="$LIBS $UDEV_LIBS"
1548   AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"])
1549 fi
1550
1551 # libusb
1552 USE_LIBUSB=0
1553
1554 # if libudev is available, we don't need libusb
1555 if test "x$use_libudev" != "xno"; then
1556   use_libusb="no"
1557   AC_MSG_NOTICE($libusb_disabled_udev_found)
1558 else
1559   if echo "$ARCH" | grep -q freebsd ; then
1560     AC_CHECK_LIB([usb],[main],
1561                 [use_libusb="yes";USB_LIBS="-lusb"],
1562                 [use_libusb="no";AC_MSG_RESULT($libusb_not_found)])
1563   elif test "$use_libusb" = "auto"; then
1564     PKG_CHECK_MODULES([USB],[libusb],,[use_libusb="no";AC_MSG_RESULT($libusb_not_found)])
1565   elif test "$use_libusb" = "yes"; then
1566     PKG_CHECK_MODULES([USB],[libusb],,[use_libusb="no";AC_MSG_ERROR($libusb_not_found)])
1567   else
1568     AC_MSG_NOTICE($libusb_disabled)
1569   fi
1570
1571   if test "x$use_libusb" != "xno"; then
1572     USE_LIBUSB=1;INCLUDES="$INCLUDES $USB_CFLAGS";LIBS="$LIBS $USB_LIBS"
1573     AC_DEFINE([HAVE_LIBUSB],[1],["Define to 1 if libusb is installed"])
1574   fi
1575 fi
1576
1577 # libcec
1578 USE_LIBCEC=0
1579 if test "x$use_libcec" != "xno"; then
1580   # libcec is dyloaded, so we need to check for its headers and link any depends.
1581   if test "x$use_libcec" != "xno"; then
1582     if test "x$use_libcec" != "xauto"; then
1583       PKG_CHECK_MODULES([CEC],[libcec >= 3.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
1584     else
1585       PKG_CHECK_MODULES([CEC],[libcec >= 3.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
1586     fi
1587
1588     if test "x$use_libcec" != "xno"; then
1589       INCLUDES="$INCLUDES $CEC_CFLAGS"
1590       USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"])
1591       XB_FIND_SONAME([LIBCEC],[cec],[use_libcec])
1592       AC_MSG_NOTICE($libcec_enabled)
1593     else
1594       use_libcec="no"
1595       AC_MSG_NOTICE($libcec_disabled)
1596     fi
1597   fi
1598 else
1599   use_libcec="no"
1600   AC_MSG_NOTICE($libcec_disabled)
1601 fi
1602
1603 # libcap
1604 if test "$use_libcap" != "no"; then
1605   AC_CHECK_HEADERS([sys/capability.h],,
1606    [if test "$use_libcap" = "yes"; then
1607       AC_MSG_ERROR($libcap_not_found)
1608     elif test "$use_libcap" != "no"; then
1609       AC_MSG_NOTICE($libcap_not_found)
1610       use_libcap="no"
1611     fi
1612    ])
1613   if test "$use_libcap" != "no"; then
1614     AC_CHECK_LIB([cap], main, LIBS="$LIBS -lcap", use_libcap=no)
1615   fi
1616   if test "$use_libcap" != "no"; then
1617     AC_DEFINE([HAVE_LIBCAP], [1], [Whether to use libcap library.])
1618   fi
1619 else
1620   AC_MSG_NOTICE($libcap_disabled)
1621 fi
1622
1623 # FFmpeg
1624 FFMPEG_LIBNAMES="libavcodec >= 56.26.100
1625                  libavfilter >= 5.11.102
1626                  libavformat >= 56.25.101
1627                  libavutil >= 54.20.100
1628                  libpostproc >= 53.3.100
1629                  libswscale >= 3.1.101
1630                  libswresample >= 1.1.100"
1631
1632 ffmpeg_build="${abs_top_srcdir}/tools/depends/target/ffmpeg"
1633 FFMPEG_VER_SHA=$(grep "VERSION=" ${ffmpeg_build}/FFMPEG-VERSION | sed 's/VERSION=//g')
1634 AC_DEFINE_UNQUOTED([FFMPEG_VER_SHA], ["$FFMPEG_VER_SHA"], [FFmpeg version hash])
1635
1636 if test "$with_ffmpeg" = "shared"; then
1637   # allow linking against shared ffmpeg libs
1638   # a proper version must be installed, we won't build ffmpeg
1639   USE_STATIC_FFMPEG=0
1640   AC_DEFINE([USE_STATIC_FFMPEG], [0], [FFmpeg linked dynamically])
1641 fi
1642 if test "${USE_STATIC_FFMPEG}" = "1"; then
1643   AC_DEFINE([USE_STATIC_FFMPEG], [1], [FFmpeg linked statically])
1644   ff_libs=$(${ECHO} ${FFMPEG_LIBNAMES} | ${AWK} '/lib/{print $1}' ORS=' ')
1645   if test -n "${PKG_CONFIG_SYSROOT_DIR}"; then
1646     # workaround for cross compiling with buildroot on different buildsystem
1647     # Rpi buildroots pkg-config returns static libs with
1648     # PKG_CONFIG_SYSROOT_DIR prefixed, OEs does not
1649     # so lets make sure we always prefix in case PKG_CONFIG_SYSROOT_DIR is defined
1650     pkg_cfg_prefix="${PKG_CONFIG_SYSROOT_DIR}"
1651   elif test "${target_platform}" = "target_raspberry_pi" && test "${USE_BUILDROOT}" = "1"; then
1652       pkg_cfg_prefix=${SYSROOT}
1653   fi
1654
1655   if test "$cross_compiling" != "yes"; then
1656     if test "$use_debug" != "yes"; then
1657       FFMPEG_OPTS="-r"
1658     fi
1659     if test "$use_optimizations" != "yes"; then
1660       FFMPEG_OPTS="${FFMPEG_OPTS} --disable-optimizations"
1661     fi
1662
1663     if test "$with_ffmpeg" = "auto" || test "$with_ffmpeg" = "yes"; then
1664       SAVE_INCLUDES="$INCLUDES"
1665       SAVE_LIBS="$LIBS"
1666       # check for system installed ffmpeg. We require minimum versions.
1667       PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
1668         [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"],
1669         [FFMPEG_FOUND="false"])
1670
1671       if test "${USE_STATIC_FFMPEG}" = "1" && test "$FFMPEG_FOUND" = "true"; then
1672         # we need to check if static libs are available
1673         FFMPEG_LIBDIR=$(${PKG_CONFIG} --static --variable=libdir libavcodec)
1674         for ff_lib in ${ff_libs}; do
1675           if test -f ${FFMPEG_LIBDIR}/${ff_lib}.a; then :; else
1676             AC_MSG_NOTICE("${FFMPEG_LIBDIR}/${ff_lib}.a not found")
1677             FFMPEG_FOUND="false"
1678             # restore includes and libs, the ones we found are invalid
1679             INCLUDES="$SAVE_INCLUDES"
1680             LIBS="$SAVE_LIBS"
1681             unset FFMPEG_LIBS FFMPEG_CFLAGS FFMPEG_LIBDIR
1682           fi
1683         done
1684       fi
1685       if test "$with_ffmpeg" = "yes" || test "$FFMPEG_FOUND" = "false"; then
1686         # ffmpeg not found with pkg-config, lets install it
1687         AC_MSG_NOTICE("Installing FFmpeg")
1688         CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS}
1689         export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH"
1690       fi
1691
1692     elif test "$with_ffmpeg" = "force"; then
1693       # always build our ffmpeg
1694       AC_MSG_NOTICE("FFmpeg installation forced by user - installing our version")
1695       CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ${ffmpeg_build}/autobuild.sh ${FFMPEG_OPTS}
1696       export PKG_CONFIG_PATH="${ffmpeg_build}/ffmpeg-install/lib/pkgconfig:$PKG_CONFIG_PATH"
1697
1698     elif test "$with_ffmpeg" != "no"; then
1699       # user passed --with-ffmpeg=/some/path, lets use it
1700       AC_MSG_NOTICE("using ffmpeg: ${with_ffmpeg}")
1701       export PKG_CONFIG_PATH="${with_ffmpeg}/lib/pkgconfig:$PKG_CONFIG_PATH"
1702     fi
1703   fi
1704 fi
1705
1706 if test "$FFMPEG_FOUND" != "true"; then
1707   PKG_CHECK_MODULES([FFMPEG], [$FFMPEG_LIBNAMES],
1708     [INCLUDES="$INCLUDES $FFMPEG_CFLAGS"; LIBS="$LIBS $FFMPEG_LIBS"; FFMPEG_FOUND="true"], 
1709     [AC_MSG_ERROR("ffmpeg not found")])
1710 fi
1711
1712 if test "${USE_STATIC_FFMPEG}" = "1"; then
1713   # get the libdir for static linking
1714   FFMPEG_LIBDIR=${pkg_cfg_prefix}$(PKG_CONFIG_SYSROOT_DIR="" ${PKG_CONFIG} --static --variable=libdir libavcodec)
1715   GNUTLS_ALL_LIBS=$(${PKG_CONFIG} --static --libs-only-l --silence-errors gnutls)
1716   VORBISENC_ALL_LIBS=$(${PKG_CONFIG} --static --libs-only-l --silence-errors vorbisenc)
1717   DCADEC_ALL_LIBS=$(${PKG_CONFIG} --static --libs-only-l --silence-errors dcadec)
1718
1719   # check if static libs are available
1720   for ff_lib in ${ff_libs}; do
1721     if test -f ${FFMPEG_LIBDIR}/${ff_lib}.a; then :; else
1722       AC_MSG_ERROR("${FFMPEG_LIBDIR}/${ff_lib}.a not found")
1723     fi
1724     # filter out libs we link statically
1725     filter=$(${ECHO} ${ff_lib} | ${SED} 's/lib/-l/g')
1726     LIBS=$(${ECHO} ${LIBS} | ${SED} "s/${filter}//g")
1727   done
1728   LIBS=$(${ECHO} ${LIBS} | ${SED} ':a;N;$!ba;s/\n/ /g')
1729 fi
1730
1731 echo "Checking for SWIG installation"
1732 AC_PATH_PROG(SWIG_EXE, swig, "none")
1733 if test "$SWIG_EXE" = "none"; then
1734   AC_PATH_PROG(SWIG20_EXE, swig2.0, "none")
1735   if test "$SWIG20_EXE" != "none" ; then
1736     SWIG_EXE=$SWIG20_EXE
1737   fi
1738 fi
1739 if test "$SWIG_EXE" = "none"; then
1740   AC_MSG_ERROR($missing_program)
1741 fi
1742 final_message="$final_message\n  SWIG Available:\tYes"
1743
1744 echo "Checking for a jre installation"
1745 AC_PATH_PROG(JAVA_EXE, java, "none")
1746 if test "$JAVA_EXE" = "none"; then
1747   AC_MSG_ERROR($missing_program)
1748 fi
1749 final_message="$final_message\n  JRE Available:\tYes"
1750
1751 echo "Checking for doxygen installation"
1752 AC_PATH_PROG(DOXYGEN_EXE, doxygen, "none")
1753 if test "$DOXYGEN_EXE" = "none"; then
1754   AC_MSG_WARN([Unable to find doxygen installation. Will not be able to make docstrings for the python api])
1755   final_message="$final_message\n  Doxygen Available:\tNo"
1756   USE_DOXYGEN=0
1757 else
1758   final_message="$final_message\n  Doxygen Available:\tYes"
1759   USE_DOXYGEN=1
1760 fi
1761
1762 # VDPAU
1763 if test "x$use_vdpau" != "xno"; then
1764   if test "$host_vendor" = "apple" ; then
1765     if test "x$use_vdpau" = "xyes"; then
1766       AC_MSG_ERROR([VDPAU not supported on this platform])
1767     else
1768       use_vdpau="no"
1769       AC_MSG_NOTICE($vdpau_disabled)
1770     fi
1771     USE_VDPAU=0
1772   else
1773     USE_VDPAU=1
1774     AC_CHECK_HEADER([vdpau/vdpau.h],AC_DEFINE([HAVE_LIBVDPAU], [],
1775       [Define to 1 if you have the 'vdpau' library (-lvdpau).]),
1776     [if test "x$use_vdpau" = "xyes"; then
1777       USE_VDPAU=0
1778       AC_MSG_ERROR([$vdpau_not_found])
1779     else
1780       use_vdpau="no"
1781       USE_VDPAU=0
1782       AC_MSG_RESULT($vdpau_not_found)
1783     fi])
1784   fi
1785 else
1786   USE_VDPAU=0
1787   AC_MSG_NOTICE($vdpau_disabled)
1788 fi
1789
1790 # VAAPI
1791 if test "x$use_vaapi" != "xno"; then
1792   if test "$host_vendor" = "apple" ; then
1793     if test "x$use_vaapi" = "xyes"; then
1794       AC_MSG_ERROR([VAAPI not supported on this platform])
1795     else
1796       use_vaapi="no"
1797       AC_MSG_NOTICE($vaapi_disabled)
1798     fi
1799     USE_VAAPI=0
1800   else
1801     initial_val=$use_vaapi
1802     if test "x$use_vaapi" != "xno"; then
1803       PKG_CHECK_MODULES([LIBVA], [libva libva-x11],
1804         [INCLUDES="$INCLUDES $LIBVA_CFLAGS"; LIBS="$LIBS $LIBVA_LIBS"; USE_VAAPI=1;
1805          AC_DEFINE([HAVE_LIBVA], [1], [Define to 1 if you have the 'vaapi' libraries])],
1806         [use_vaapi="no"; USE_VAAPI=0; AC_MSG_RESULT($vaapi_not_found)])
1807     else
1808       if test "x$initial_val" = "xyes"; then
1809         AC_MSG_ERROR($vaapi_not_found)
1810       fi
1811     fi
1812   fi
1813 else
1814   AC_MSG_NOTICE($vaapi_disabled)
1815   USE_VAAPI=0
1816 fi
1817
1818 # VTBDecoder
1819 if test "x$use_vtbdecoder" != "xno"; then
1820   if test "$host_vendor" = "apple" ; then
1821     HAVE_VIDEOTOOLBOXDECODER=1
1822     AC_DEFINE([HAVE_VIDEOTOOLBOXDECODER], [1], [Define to 1 if you have the 'VTBDecoder' library.])
1823     AC_MSG_NOTICE($vtbdecoder_enabled)
1824   else
1825     if test "x$use_vtbdecoder" = "xyes"; then
1826       AC_MSG_ERROR([VTB Decoder not supported on this platform])
1827     else
1828       use_vtbdecoder="no"
1829       AC_MSG_NOTICE($vtbdecoder_disabled)
1830     fi
1831   fi
1832 else
1833   AC_MSG_NOTICE($vtbdecoder_disabled)
1834 fi
1835
1836 # OpenMax
1837 if test "$use_gles" = "yes" && test "$use_openmax" = "auto"; then
1838
1839   AC_CHECK_HEADERS([OMX_Core.h],
1840                     USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS";AC_DEFINE([HAVE_LIBOPENMAX], [1], [Define to 1 if you have the OpenMax library.])],
1841                     use_openmax=no;USE_OPENMAX=0;AC_MSG_RESULT($openmax_not_found))
1842 elif test "$use_gles" = "yes" && test "$use_openmax" = "yes"; then
1843   AC_CHECK_HEADERS([OMX_Core.h],
1844                     USE_OPENMAX=1;[INCLUDES="$INCLUDES $OPENMAX_CFLAGS"; LIBS="$LIBS $OPENMAX_LIBS";AC_DEFINE([HAVE_LIBOPENMAX], [1], [Define to 1 if you have the OpenMax library.])],
1845                     AC_MSG_ERROR($openmax_not_found))
1846 else
1847   AC_MSG_NOTICE($openmax_disabled)
1848   use_openmax=no
1849   USE_OPENMAX=0
1850 fi
1851
1852 # additional internal players
1853 case $add_players in
1854   *omxplayer*)
1855       XB_ADD_PLAYER([OMXPLAYER], [omxplayer])
1856       ;;
1857 esac
1858
1859 # additional internal codecs
1860 # remember to convert commas to spaces
1861 for codecs in `echo $add_codecs | sed 's/,/ /g'`; do
1862   case $codecs in
1863     *amcodec*)
1864         AC_CHECK_HEADER([amcodec/codec_error.h],, AC_MSG_ERROR($missing_headers))
1865         XB_ADD_CODEC([LIBAMCODEC], [amcodec], [$codecs])
1866         ;;
1867     *libstagefright*)
1868         XB_ADD_CODEC([LIBSTAGEFRIGHT], [libstagefright], [$codecs])
1869         ;;
1870     *imxvpu*)
1871       AC_CHECK_HEADER([imx-mm/vpu/vpu_wrapper.h],, AC_MSG_ERROR($missing_headers))
1872       AC_CHECK_LIB([vpu], main, LIBS="$LIBS -lfslvpuwrap -lvpu -lg2d", AC_MSG_ERROR($missing_library))
1873       XB_ADD_CODEC([IMXVPU], [imxvpu], [$codecs])
1874       CXXFLAGS="$CXXFLAGS -Wno-psabi -DLINUX "
1875       CFLAGS="$CFLAGS -DLINUX"
1876       if test "$use_x11" = "no"; then
1877         CXXFLAGS="$CXXFLAGS -DEGL_API_FB"
1878         CFLAGS="$CFLAGS -DEGL_API_FB"
1879       fi
1880       ;;
1881     *)
1882   esac
1883 done
1884
1885 # platform specific bin utilities
1886 if test "$build_vendor" != "apple" ; then
1887   AC_CHECK_PROG(HAVE_GAWK,gawk,"yes","no",)
1888   if test "$HAVE_GAWK" = "no" ; then
1889     AC_MSG_ERROR($missing_program)
1890   fi
1891 fi
1892
1893 if test "$use_arch" != "arm" ; then
1894   AC_CHECK_PROG(HAVE_CMAKE,cmake,"yes","no",)
1895   if test "$HAVE_CMAKE" = "no" ; then
1896     AC_MSG_ERROR($missing_program)
1897   fi
1898 fi
1899
1900 AC_CHECK_PROG(HAVE_GPERF,gperf,"yes","no",)
1901 if test "$HAVE_GPERF" = "no" ; then
1902   AC_MSG_ERROR($missing_program)
1903 fi
1904
1905 AC_CHECK_PROG(HAVE_UNZIP,unzip,"yes","no",)
1906 if test "$HAVE_UNZIP" = "no" ; then
1907   AC_MSG_ERROR($missing_program)
1908 fi
1909
1910 AC_CHECK_PROG(HAVE_ZIP,zip,"yes","no",)
1911 if test "$HAVE_ZIP" = "no" ; then
1912   AC_MSG_ERROR($missing_program)
1913 fi
1914
1915 if test "$ARCH" = "i486-linux" || test "$ARCH" = "x86-freebsd"; then
1916   AC_CHECK_PROG(HAVE_NASM,nasm,"yes","no",)
1917   if test "$HAVE_NASM" = "no" ; then
1918     AC_MSG_ERROR($missing_program)
1919   fi
1920 fi
1921
1922 # Checks for header files.
1923 AC_HEADER_DIRENT
1924 AC_HEADER_STDC
1925 AC_HEADER_SYS_WAIT
1926 AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h inttypes.h limits.h locale.h \
1927   malloc.h memory.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \
1928   strings.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/socket.h \
1929   sys/time.h sys/timeb.h sys/vfs.h termios.h unistd.h utime.h wchar.h wctype.h])
1930 AC_CHECK_HEADERS([cdio/iso9660.h],,AC_MSG_ERROR([$missing_headers]))
1931
1932 # Checks for typedefs, structures, and compiler characteristics.
1933 AC_HEADER_STAT
1934 AC_HEADER_STDBOOL
1935 AC_C_CONST
1936 AC_TYPE_UID_T
1937 AC_C_INLINE
1938 AC_TYPE_INT8_T
1939 AC_TYPE_INT16_T
1940 AC_TYPE_INT32_T
1941 AC_TYPE_INT64_T
1942 AC_TYPE_MODE_T
1943 AC_TYPE_OFF_T
1944 AC_TYPE_PID_T
1945 AC_C_RESTRICT
1946 AC_TYPE_SIZE_T
1947 AC_TYPE_SSIZE_T
1948 AC_CHECK_MEMBERS([struct stat.st_rdev])
1949 AC_HEADER_TIME
1950 AC_STRUCT_TM
1951 AC_TYPE_UINT8_T
1952 AC_TYPE_UINT16_T
1953 AC_TYPE_UINT32_T
1954 AC_TYPE_UINT64_T
1955 AC_C_BIGENDIAN
1956
1957 if test "$cross_compiling" = "yes"; then
1958   final_message="$final_message\n  Crosscomp.:\tYes"
1959   if [[ -d "$NATIVE_ROOT" ]]; then
1960     CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -I$NATIVE_ROOT/include"
1961     CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -I$NATIVE_ROOT/include"
1962     LDFLAGS_FOR_BUILD="$LDFLAGS_FOR_BUILD -L$NATIVE_ROOT/lib"
1963     if test "$host_vendor" != "apple" ; then
1964       LDFLAGS_FOR_BUILD="$LDFLAGS_FOR_BUILD -Wl,-rpath=$NATIVE_ROOT/lib"
1965     fi
1966     final_message="$final_message\n  Native Root:\t$NATIVE_ROOT"
1967   fi
1968 else
1969   final_message="$final_message\n  Crosscomp.:\tNo"
1970 fi
1971
1972 final_message="$final_message\n  target ARCH:\t$use_arch"
1973 final_message="$final_message\n  target CPU:\t$use_cpu"
1974
1975 if test "$use_gles" = "yes"; then
1976   final_message="$final_message\n  OpenGLES:\tYes"
1977   USE_OPENGLES=1
1978   USE_OPENGL=0
1979 else
1980   USE_OPENGLES=0
1981   if test "$use_gl" = "yes"; then
1982     final_message="$final_message\n  OpenGL:\tYes"
1983     USE_OPENGL=1
1984   else
1985     final_message="$final_message\n  OpenGL:\tNo (Very Slow)"
1986     SDL_DEFINES="$SDL_DEFINES -DHAS_SDL_2D"
1987     USE_OPENGL=0
1988   fi
1989 fi
1990
1991 if test "$use_alsa" = "yes"; then
1992   USE_ALSA=1
1993   AC_DEFINE([USE_ALSA],[1],["Define to 1 if alsa is installed"])
1994   final_message="$final_message\n  ALSA:\t\tYes"
1995 else
1996   USE_ALSA=0
1997   final_message="$final_message\n  ALSA:\t\tNo"
1998 fi
1999
2000 if test "$use_dbus" = "yes"; then
2001   final_message="$final_message\n  DBUS:\t\tYes"
2002 else
2003   final_message="$final_message\n  DBUS:\t\tNo"
2004 fi
2005
2006 if test "x$use_vdpau" != "xno"; then
2007   final_message="$final_message\n  VDPAU:\tYes"
2008 else
2009   final_message="$final_message\n  VDPAU:\tNo"
2010 fi
2011
2012 if test "x$use_vaapi" != "xno"; then
2013   final_message="$final_message\n  VAAPI:\tYes"
2014 else
2015   final_message="$final_message\n  VAAPI:\tNo"
2016 fi
2017
2018 if test "x$use_vtbdecoder" != "xno"; then
2019   final_message="$final_message\n  VTBDecoder:\tYes"
2020 else
2021   final_message="$final_message\n  VTBDecoder:\tNo"
2022 fi
2023
2024 if test "$use_openmax" != "no"; then
2025   final_message="$final_message\n  OpenMax:\tYes"
2026 else
2027   final_message="$final_message\n  OpenMax:\tNo"
2028 fi
2029
2030 if test "$use_joystick" = "yes"; then
2031   final_message="$final_message\n  Joystick:\tYes"
2032   AC_DEFINE([HAS_SDL_JOYSTICK],[1],["Define to 1 if using SDL joystick"])
2033 else
2034   final_message="$final_message\n  Joystick:\tNo"
2035 fi
2036
2037 if test "$use_touch_skin" = "yes"; then
2038   final_message="$final_message\n  Touch skin:\tYes"
2039 else
2040   final_message="$final_message\n  Touch skin:\tNo"
2041 fi
2042
2043 if test "$use_x11" = "yes"; then
2044   USE_X11=1
2045   final_message="$final_message\n  X11:\t\tYes"
2046 else
2047   USE_X11=0
2048   final_message="$final_message\n  X11:\t\tNo"
2049 fi
2050
2051 if test "$use_wayland" = "yes"; then
2052   final_message="$final_message\n  Wayland:\tYes"
2053   USE_WAYLAND=1
2054   USE_XKBCOMMON=1
2055 else
2056   final_message="$final_message\n  Wayland:\tNo"
2057 fi
2058
2059 if test "$use_libbluray" = "yes"; then
2060   final_message="$final_message\n  Bluray:\tYes"
2061 else
2062   final_message="$final_message\n  Bluray:\tNo"
2063 fi
2064
2065 # we don't compile with default upstream squish, so we use our own one
2066 # even on non unified deps platforms
2067 if test "$cross_compiling" != "yes"; then
2068   make -C ${abs_top_srcdir}/tools/depends/native/libsquish-native CXX=${CXX}
2069   export PKG_CONFIG_PATH="${abs_top_srcdir}/tools/depends/native/libsquish-native/squish-install/lib/pkgconfig:$PKG_CONFIG_PATH"
2070 fi
2071 PKG_CHECK_MODULES([SQUISH], [squish],
2072  [INCLUDES="$INCLUDES $SQUISH_CFLAGS" LIBS="$LIBS $SQUISH_LIBS"],
2073  AC_MSG_ERROR("squish not found"))
2074
2075 if test "x$use_texturepacker" != "xno"; then
2076   AC_PATH_PROG([TEXTUREPACKER], [TexturePacker], ["none"],
2077     [$PATH$PATH_SEPARATOR${abs_top_srcdir}/tools/depends/native/TexturePacker/bin])
2078   if test "$TEXTUREPACKER" = "none"; then
2079     make -C ${abs_top_srcdir}/tools/depends/native/TexturePacker
2080     TEXTUREPACKER="${abs_top_srcdir}/tools/depends/native/TexturePacker/bin/TexturePacker"
2081   fi
2082   if test -x "$TEXTUREPACKER"; then
2083     final_message="$final_message\n  TexturePacker:Yes"
2084     USE_TEXTUREPACKER=1
2085   else
2086     if test "x$use_texturepacker" = "xyes"; then
2087       AC_MSG_ERROR("Texturepacker not found")
2088     else
2089       AC_MSG_NOTICE("Texturepacker not found")
2090       USE_TEXTUREPACKER=0
2091       final_message="$final_message\n  TexturePacker:No"
2092     fi
2093   fi
2094 else
2095   final_message="$final_message\n  TexturePacker:No"
2096   USE_TEXTUREPACKER=0
2097 fi
2098
2099 if test "$use_mid" = "yes"; then
2100   final_message="$final_message\n  MID Support:\tYes"
2101   SDL_DEFINES="$SDL_DEFINES -DMID"
2102 else
2103   final_message="$final_message\n  MID Support:\tNo"
2104 fi
2105
2106 ORIGCC=$CC
2107 ORIGCXX=$CXX
2108 if test "x$use_ccache" != "xno"; then
2109   AC_PATH_PROG(CCACHE,ccache,none)
2110   if test "$ac_cv_path_CCACHE" = "none"; then
2111     if test "x$use_ccache" = "xyes"; then
2112       AC_MSG_ERROR([ccache not found.]);
2113     else
2114       AC_MSG_NOTICE([ccache not found. Falling back to default CC])
2115       final_message="$final_message\n  ccache:\tNo"
2116     fi
2117   else
2118     CC="$ac_cv_path_CCACHE $CC"
2119     CXX="$ac_cv_path_CCACHE $CXX"
2120     AC_MSG_NOTICE(enabling ccache)
2121     final_message="$final_message\n  ccache:\tYes"
2122   fi
2123 else
2124   final_message="$final_message\n  ccache:\tNo"
2125 fi
2126
2127 if test "$use_alsa" = "yes"; then
2128   final_message="$final_message\n  ALSA Support:\tYes"
2129 else
2130   final_message="$final_message\n  ALSA Support:\tNo"
2131 fi
2132
2133 if test "x$use_pulse" != "xno"; then
2134   XBMC_STANDALONE_SH_PULSE=tools/Linux/${APP_NAME_LC}-standalone.sh.pulse
2135   final_message="$final_message\n  PulseAudio:\tYes"
2136 else
2137   XBMC_STANDALONE_SH_PULSE=/dev/null
2138   final_message="$final_message\n  PulseAudio:\tNo"
2139 fi
2140
2141 # DVDCSS
2142 if test "$use_dvdcss" = "yes"; then
2143   AC_MSG_NOTICE($dvdcss_enabled)
2144   final_message="$final_message\n  DVDCSS:\tYes"
2145   BUILD_DVDCSS=1
2146   SKIP_CONFIG_DVDCSS=0
2147   DVDREAD_CFLAGS="-D_XBMC -DHAVE_DVDCSS_DVDCSS_H"
2148 else
2149   AC_MSG_NOTICE($dvdcss_disabled)
2150   final_message="$final_message\n  DVDCSS:\tNo"
2151   BUILD_DVDCSS=0
2152   SKIP_CONFIG_DVDCSS=1
2153   DVDREAD_CFLAGS="-D_XBMC -UHAVE_DVDCSS_DVDCSS_H"
2154 fi
2155 if test "$host_vendor" = "apple"; then
2156  DVDREAD_CFLAGS="$DVDREAD_CFLAGS -D__DARWIN__"
2157 fi
2158
2159 # Google Test Framework
2160 if test "$configure_gtest" = "yes"; then
2161   AC_MSG_NOTICE($gtest_enabled)
2162   final_message="$final_message\n  Google Test Framework Configured:\tYes"
2163   GTEST_CONFIGURED=1
2164   SKIP_CONFIG_GTEST=0
2165 else
2166   AC_MSG_NOTICE($gtest_disabled)
2167   final_message="$final_message\n  Google Test Framework Configured:\tNo"
2168   GTEST_CONFIGURED=0
2169   SKIP_CONFIG_GTEST=1
2170 fi
2171
2172 # Google Breakpad
2173 if test "$use_breakpad" = "yes"; then
2174   USE_BREAKPAD=1
2175   PKG_CHECK_MODULES([BREAKPAD],    [breakpad-client],
2176     [INCLUDES="$INCLUDES $BREAKPAD_CFLAGS"; LIBS="$LIBS $BREAKPAD_LIBS"],
2177     AC_MSG_ERROR("breakpad-client not found"))
2178   AC_DEFINE([HAVE_BREAKPAD],[1],["Define to 1 if Google Breakpad is installed"])
2179   AC_MSG_NOTICE($breakpad_enabled)
2180   final_message="$final_message\n  Google Breakpad Configured:\tYes"
2181 else
2182   AC_MSG_NOTICE($breakpad_disabled)
2183   final_message="$final_message\n  Google Breakpad Configured:\tNo"
2184   USE_BREAKPAD=0
2185 fi
2186
2187 if test "$use_avahi" = "yes"; then
2188   final_message="$final_message\n  Avahi:\tYes"
2189 else
2190   final_message="$final_message\n  Avahi:\tNo"
2191 fi
2192
2193 if test "$use_mdnsembedded" != "no"; then
2194   final_message="$final_message\n  mDNSEmbedded:\tYes"
2195 else
2196   final_message="$final_message\n  mDNSEmbedded:\tNo"
2197 fi
2198
2199 if test "$use_nonfree" = "yes"; then
2200   final_message="$final_message\n  Non-free:\tYes"
2201   HAVE_XBMC_NONFREE=1
2202   AC_DEFINE([HAVE_XBMC_NONFREE], [1], [Define to 1 to enable non-free components.])
2203 else
2204   HAVE_XBMC_NONFREE=0
2205   final_message="$final_message\n  Non-free:\tNo"
2206 fi
2207
2208 if test "$use_asap" = "yes"; then
2209   AC_CHECK_PROGS(HAVE_GDC,gdc-4.4 gdc-4.3 gdc,"no")
2210   if test "$HAVE_GDC" = "no"; then
2211     AC_MSG_ERROR($missing_program);
2212   fi
2213   AC_CHECK_PROG(HAVE_FPC,fpc,"yes","no")
2214   if test "$HAVE_FPC" = "no"; then
2215     AC_MSG_ERROR($missing_program);
2216   fi
2217   USE_ASAP_CODEC=1
2218   AC_DEFINE([USE_ASAP_CODEC], [1], [Define to 1 to enable ASAP codec.])
2219   final_message="$final_message\n  ASAP Codec:\tYes"
2220 else
2221   USE_ASAP_CODEC=0
2222   final_message="$final_message\n  ASAP Codec:\tNo"
2223 fi
2224
2225 if test "$use_mysql" = "yes"; then
2226   final_message="$final_message\n  MySQL:\tYes"
2227   USE_MYSQL=1
2228 else
2229   final_message="$final_message\n  MySQL:\tNo"
2230   USE_MYSQL=0
2231 fi
2232 if test "$use_webserver" = "yes"; then
2233   final_message="$final_message\n  Webserver:\tYes"
2234   USE_WEB_SERVER=1
2235 else
2236   final_message="$final_message\n  Webserver:\tNo"
2237   USE_WEB_SERVER=0
2238 fi
2239
2240 if test "$use_libssh" != "no"; then
2241   final_message="$final_message\n  libssh support:\tYes"
2242 else
2243   final_message="$final_message\n  libssh support:\tNo"
2244 fi
2245
2246 if test "$use_librtmp" != "no"; then
2247   final_message="$final_message\n  libRTMP support:\tYes"
2248 else
2249   final_message="$final_message\n  libRTMP support:\tNo"
2250 fi
2251
2252 if test "x$use_samba" != "xno"; then
2253   final_message="$final_message\n  libsmbclient support:\tYes"
2254 else
2255   final_message="$final_message\n  libsmbclient support:\tNo"
2256 fi
2257
2258 if test "$use_libnfs" != "no"; then
2259   final_message="$final_message\n  libnfs client support:Yes"
2260 else
2261   final_message="$final_message\n  libnfs client support:No"
2262 fi
2263
2264 if test "$use_libgif" != "no"; then
2265   final_message="$final_message\n  libgif support:\tYes"
2266 else
2267   final_message="$final_message\n  libgif support:\tNo"
2268 fi
2269
2270 if test "$use_airplay" != "no"; then
2271   final_message="$final_message\n  AirPlay support:\tYes"
2272 else
2273   final_message="$final_message\n  AirPLay support:\tNo"
2274 fi
2275
2276 if test "x$use_airtunes" != "xno"; then
2277   final_message="$final_message\n  AirTunes support (libshairplay):\tYes"  
2278 else
2279   final_message="$final_message\n  AirTunes support:\tNo"
2280 fi
2281
2282 if test "x$use_upnp" != "xno"; then
2283   final_message="$final_message\n  UPnP support:\t\tYes"
2284   USE_UPNP=1
2285   UPNP_DEFINES='-DNPT_CONFIG_ENABLE_LOGGING -DPLT_HTTP_DEFAULT_USER_AGENT="\"UPnP/1.0 DLNADOC/1.50 Kodi\"" -DPLT_HTTP_DEFAULT_SERVER="\"UPnP/1.0 DLNADOC/1.50 Kodi\""'
2286   AC_DEFINE([USE_UPNP], [1], [Define to 1 to enable UPnP support.])
2287 else
2288   USE_UPNP=0
2289   final_message="$final_message\n  UPnP support:\t\tNo"
2290 fi
2291
2292 if test "$use_optical_drive" = "yes"; then
2293   final_message="$final_message\n  Optical drive:\tYes"
2294 else
2295   final_message="$final_message\n  Optical drive:\tNo"
2296 fi
2297
2298 if test "x$use_libudev" != "xno"; then
2299   final_message="$final_message\n  libudev support:\tYes"
2300 else
2301   final_message="$final_message\n  libudev support:\tNo"
2302 fi
2303
2304 if test "x$use_libusb" != "xno"; then
2305   final_message="$final_message\n  libusb support:\tYes"
2306 else
2307   final_message="$final_message\n  libusb support:\tNo"
2308 fi
2309
2310 if test "x$use_libcec" != "xno"; then
2311   final_message="$final_message\n  libcec support:\tYes"
2312 else
2313   final_message="$final_message\n  libcec support:\tNo"
2314 fi
2315
2316 if test "x$use_libcap" != "xno"; then
2317   final_message="$final_message\n  libcap support:\tYes"
2318 else
2319   final_message="$final_message\n  libcap support:\tNo"
2320 fi
2321
2322 if test "x$add_players" != "xno"; then
2323   final_message="$final_message\n  additional players:\tYes, $add_players"
2324 else
2325   final_message="$final_message\n  additional players:\tNo"
2326 fi
2327
2328 if test "x$add_codecs" != "xno"; then
2329   final_message="$final_message\n  additional codecs:\tYes, $add_codecs"
2330 else
2331   final_message="$final_message\n  additional codecs:\tNo"
2332 fi
2333
2334 ### External libraries messages
2335
2336 if test "$host_vendor" = "apple" ; then
2337   # built internal but referenced as external, we link directly to them.
2338   # this MUST be the last thing before OUTPUT_FILES as they do not
2339   # exist until after we build FFMpeg.
2340   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavcodec -lavcodec"
2341   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavfilter -lavfilter"
2342   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libswresample -lswresample"
2343   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavformat -lavformat"
2344   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libavutil -lavutil"
2345   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libpostproc -lpostproc"
2346   LIBS="$LIBS -L\$(abs_top_srcdir)/lib/ffmpeg/libswscale -lswscale"
2347 fi
2348
2349 OUTPUT_FILES="Makefile \
2350     Makefile.include \
2351     addons/skin.confluence/media/Makefile \
2352     xbmc/Makefile \
2353     xbmc/cdrip/Makefile \
2354     xbmc/cores/Makefile \
2355     xbmc/cores/VideoRenderers/Makefile \
2356     xbmc/cores/dvdplayer/Makefile \
2357     lib/libdvd/Makefile \
2358     xbmc/cores/DllLoader/Makefile \
2359     xbmc/cores/DllLoader/exports/Makefile \
2360     xbmc/cores/dvdplayer/DVDCodecs/Makefile \
2361     xbmc/cores/dvdplayer/DVDCodecs/Audio/Makefile \
2362     xbmc/cores/dvdplayer/DVDCodecs/Overlay/Makefile \
2363     xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile \
2364     xbmc/cores/dvdplayer/DVDDemuxers/Makefile \
2365     xbmc/cores/dvdplayer/DVDSubtitles/Makefile \
2366     xbmc/cores/AudioEngine/Makefile \
2367     xbmc/cores/paplayer/Makefile \
2368     xbmc/cores/omxplayer/Makefile \
2369     xbmc/cores/playercorefactory/Makefile \
2370     xbmc/messaging/Makefile \
2371     xbmc/messaging/helpers/Makefile \
2372     xbmc/osx/Makefile \
2373     xbmc/guilib/Makefile \
2374     xbmc/input/linux/Makefile \
2375     xbmc/interfaces/Makefile \
2376     xbmc/interfaces/builtins/Makefile \
2377     xbmc/network/Makefile \
2378     xbmc/network/upnp/Makefile \
2379     lib/libexif/Makefile \
2380     lib/cximage-6.0/Makefile \
2381     lib/libUPnP/Makefile \
2382     xbmc/DllPaths_generated.h \
2383     xbmc/DllPaths_generated_android.h \
2384     xbmc/freebsd/Makefile \
2385     xbmc/linux/Makefile \
2386     xbmc/filesystem/Makefile \
2387     xbmc/windowing/Makefile \
2388     xbmc/windowing/egl/Makefile \
2389     lib/addons/library.xbmc.addon/Makefile \
2390     lib/addons/library.kodi.adsp/Makefile \
2391     lib/addons/library.kodi.audioengine/Makefile \
2392     lib/addons/library.xbmc.codec/Makefile \
2393     lib/addons/library.kodi.guilib/Makefile \
2394     lib/addons/library.xbmc.pvr/Makefile \
2395     tools/Linux/${APP_NAME_LC}.sh \
2396     tools/Linux/${APP_NAME_LC}-standalone.sh \
2397     tools/Linux/${APP_NAME_LC}-xsession.desktop \
2398     tools/EventClients/Makefile \
2399     tools/EventClients/Clients/OSXRemote/Makefile \
2400     xbmc/peripherals/bus/Makefile \
2401     xbmc/peripherals/devices/Makefile \
2402     xbmc/android/activity/Makefile \
2403     xbmc/android/loader/Makefile \
2404     xbmc/android/jni/Makefile \
2405     xbmc/utils/Makefile \
2406     xbmc/main/Makefile \
2407     xbmc/main/posix/Makefile \
2408     tools/darwin/Configurations/App.xcconfig \
2409     tools/darwin/Configurations/Common.xcconfig \
2410     tools/darwin/packaging/ios/mkdeb-ios.sh \
2411     tools/darwin/packaging/osx/mkdmg-osx.sh \
2412     tools/darwin/packaging/migrate_to_kodi_ios.sh \
2413     xbmc/osx/Info.plist \
2414     xbmc/osx/ios/XBMCIOS-Info.plist \
2415     project/cmake/kodi-config.cmake \
2416     project/cmake/xbmc-config.cmake \
2417     tools/android/packaging/xbmc/AndroidManifest.xml \
2418     tools/android/packaging/Makefile \
2419     tools/android/packaging/xbmc/src/org/xbmc/kodi/Splash.java \
2420     tools/android/packaging/xbmc/src/org/xbmc/kodi/Main.java \
2421     tools/android/packaging/xbmc/src/org/xbmc/kodi/XBMCBroadcastReceiver.java \
2422     tools/android/packaging/xbmc/src/org/xbmc/kodi/XBMCOnFrameAvailableListener.java \
2423     tools/android/packaging/xbmc/src/org/xbmc/kodi/XBMCSettingsContentObserver.java \
2424     tools/android/packaging/xbmc/src/org/xbmc/kodi/XBMCOnAudioFocusChangeListener.java \
2425     tools/android/packaging/xbmc/src/org/xbmc/kodi/XBMCVideoView.java \
2426     tools/android/packaging/xbmc/activity_main.xml \
2427     tools/android/packaging/xbmc/strings.xml \
2428     addons/xbmc.addon/addon.xml"
2429
2430 if test "$use_webserver" = "yes"; then
2431 OUTPUT_FILES="$OUTPUT_FILES xbmc/network/httprequesthandler/python/Makefile"
2432 fi
2433
2434 if test "$use_wayland" = "yes"; then
2435 OUTPUT_FILES="$OUTPUT_FILES xbmc/windowing/tests/wayland/Makefile"
2436 fi
2437
2438 if test "$use_touch_skin" = "yes"; then
2439 OUTPUT_FILES="$OUTPUT_FILES addons/skin.re-touched/media/Makefile"
2440 fi
2441
2442 if test "$use_codec_libstagefright" = "yes"; then
2443 OUTPUT_FILES="$OUTPUT_FILES xbmc/cores/dvdplayer/DVDCodecs/Video/libstagefrightICS/Makefile"
2444 fi
2445
2446 if test "$use_sse4" = "yes"; then
2447 OUTPUT_FILES="$OUTPUT_FILES xbmc/linux/sse4/Makefile"
2448 fi
2449
2450 OUTPUT_FILES="$OUTPUT_FILES \
2451   xbmc/interfaces/python/Makefile \
2452   xbmc/interfaces/python/test/Makefile"
2453
2454 # needed for kodi-config.cmake
2455 if echo "$libdir" | grep -q '${exec_prefix}'; then
2456   if test "${prefix}" = "NONE" || test "${prefix}" = ""; then
2457     prefix="/usr/local"
2458   fi
2459   if test "${exec_prefix}" = "NONE" || test "${exec_prefix}" = ""; then
2460     exec_prefix=${prefix}
2461   fi
2462 fi
2463 eval "APP_PREFIX=${prefix}"
2464 eval "APP_LIB_DIR=${libdir}/${APP_NAME_LC}"
2465 eval "APP_INCLUDE_DIR=${includedir}/${APP_NAME_LC}"
2466 AC_SUBST(APP_PREFIX)
2467 AC_SUBST(APP_LIB_DIR)
2468 AC_SUBST(APP_INCLUDE_DIR)
2469
2470 # Line below is used so we can use AM_INIT_AUTOMAKE. The corresponding
2471 # .dummy.am does nothing.
2472 AC_CONFIG_FILES([.dummy])
2473
2474 AC_CONFIG_FILES([${OUTPUT_FILES}])
2475 OUTPUT_FILES="$OUTPUT_FILES \
2476   .dummy"
2477 AC_SUBST(CFLAGS)
2478 AC_SUBST(CXXFLAGS)
2479 AC_SUBST(INCLUDES)
2480 AC_SUBST(LDFLAGS)
2481 AC_SUBST(CXX_FOR_BUILD)
2482 AC_SUBST(CC_FOR_BUILD)
2483 AC_SUBST(CFLAGS_FOR_BUILD)
2484 AC_SUBST(CXXFLAGS_FOR_BUILD)
2485 AC_SUBST(LDFLAGS_FOR_BUILD)
2486 AC_SUBST(SDL_DEFINES)
2487 AC_SUBST(BUILD_DVDCSS)
2488 AC_SUBST(FFMPEG_LIBDIR)
2489 AC_SUBST(USE_STATIC_FFMPEG)
2490 AC_SUBST(GNUTLS_ALL_LIBS)
2491 AC_SUBST(VORBISENC_ALL_LIBS)
2492 AC_SUBST(DCADEC_ALL_LIBS)
2493 AC_SUBST(USE_TOUCH_SKIN)
2494 AC_SUBST(USE_LIBAV_HACKS)
2495 AC_SUBST(PYTHON_VERSION)
2496 AC_SUBST(OUTPUT_FILES)
2497 AC_SUBST(HAVE_XBMC_NONFREE)
2498 AC_SUBST(USE_ASAP_CODEC)
2499 AC_SUBST(LIBCURL_BASENAME)
2500 AC_SUBST(LIBVORBISFILE_BASENAME)
2501 AC_SUBST(LIBOGG_BASENAME)
2502 AC_SUBST(LIBVORBIS_BASENAME)
2503 AC_SUBST(LIBASS_BASENAME)
2504 AC_SUBST(LIBMEPG2_BASENAME)
2505 AC_SUBST_FILE(XBMC_STANDALONE_SH_PULSE)
2506 AC_SUBST(USE_OPENGL)
2507 AC_SUBST(USE_OPENGLES)
2508 AC_SUBST(USE_VDPAU)
2509 AC_SUBST(USE_VAAPI)
2510 AC_SUBST(USE_LIBSMBCLIENT)
2511 AC_SUBST(USE_LIBNFS)
2512 AC_SUBST(USE_LIBGIF)
2513 AC_SUBST(USE_AIRPLAY)
2514 AC_SUBST(USE_OPENMAX)
2515 AC_SUBST(USE_PULSE)
2516 AC_SUBST(HAVE_LIBPULSE)
2517 AC_SUBST(USE_ALSA)
2518 AC_SUBST(USE_TEXTUREPACKER)
2519 AC_SUBST(TEXTUREPACKER)
2520 AC_SUBST(USE_AIRTUNES)
2521 AC_SUBST(USE_LIBUDEV)
2522 AC_SUBST(USE_LIBUSB)
2523 AC_SUBST(USE_LIBCEC)
2524 AC_SUBST(USE_MYSQL)
2525 AC_SUBST(USE_WAYLAND)
2526 AC_SUBST(USE_WEB_SERVER)
2527 AC_SUBST(USE_UPNP)
2528 AC_SUBST(USE_XKBCOMMON)
2529 AC_SUBST(USE_OMXLIB)
2530 AC_SUBST(USE_ANDROID)
2531 AC_SUBST(GTEST_CONFIGURED)
2532 AC_SUBST(USE_DOXYGEN)
2533 AC_SUBST(UPNP_DEFINES)
2534 AC_SUBST(USE_SSE4)
2535 AC_SUBST(USE_MMAL)
2536 AC_SUBST(USE_X11)
2537 AC_SUBST(USE_BREAKPAD)
2538
2539 # pushd and popd are not available in other shells besides bash, so implement
2540 # our own pushd/popd functions
2541 XB_DIRSTACK="$PWD"
2542 xb_pushd()
2543 {
2544   local dirname="$1"
2545   if [[ -d "$dirname" ]] && [[ -x "$dirname" ]]; then
2546     cd "$dirname"
2547     XB_DIRSTACK="$dirname ${XB_DIRSTACK:-$PWD}"
2548     return 0
2549   else
2550     AC_MSG_ERROR(xb_pushd: unable to change to $dirname)
2551   fi
2552 }
2553 xb_popd()
2554 {
2555   if [[ -n "$XB_DIRSTACK" ]]; then
2556     XB_DIRSTACK="${XB_DIRSTACK#* }"
2557     cd "${XB_DIRSTACK%% *}"
2558     return 0
2559   else
2560     AC_MSG_ERROR(xb_popd: unable to go back to previous directory)
2561   fi
2562 }
2563
2564 # Function to run the configure scripts in our submodules
2565 # Consists of three paramaters, the path to the submodule, the configure command
2566 # with appropriate arguments, and a third parameter set to 1 if we are to skip
2567 # running the script, anything else if not.
2568 AC_DEFUN([XB_CONFIG_MODULE],[
2569 AC_CONFIG_COMMANDS_POST([
2570 if [[ $3 != "1" ]]; then
2571     if [[ -d $1 ]]; then
2572       xb_pushd $1
2573       $2
2574       if [[ $? -ne 0 ]]; then
2575         xb_popd
2576         AC_MSG_ERROR([[Submodule $1 failed to configure]])
2577       else
2578         xb_popd
2579       fi
2580     else
2581       AC_MSG_ERROR([[Submodule $1 does not exist]])
2582     fi
2583 else
2584     AC_MSG_NOTICE([[Skipping configuration of submodule $1.]])
2585 fi
2586 ])
2587 ])
2588
2589 XB_CONFIG_MODULE([lib/libdvd/libdvdcss], [
2590   ./configure \
2591     CC="$CC" \
2592     CXX="$CXX" \
2593     CFLAGS="$CFLAGS $DROID_DVDLIB_SEEK64" \
2594     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2595     --host=$host_alias \
2596     --build=$build_alias \
2597     --target=$target_alias \      
2598     --disable-doc \
2599     --enable-static \
2600     --with-pic
2601 ], [$SKIP_CONFIG_DVDCSS])
2602
2603 XB_CONFIG_MODULE([lib/libdvd/libdvdread], [
2604   ./configure2 \
2605     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../libdvdcss/src $DROID_DVDLIB_SEEK64" \
2606     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2607     --host=$host_alias \
2608     --build=$build_alias \
2609     --target=$target_alias \      
2610     --enable-static \
2611     --disable-shared \
2612     --disable-strip \
2613     --disable-opts \
2614     --cc="$CC" &&
2615   mkdir -p `pwd`/../includes/dvdread
2616   cp `pwd`/../libdvdread/src/*.h `pwd`/../includes/dvdread
2617   cp `pwd`/../libdvdread/src/dvdread/*.h `pwd`/../includes/dvdread
2618 ], [0])
2619
2620 XB_CONFIG_MODULE([lib/libdvd/libdvdnav], [
2621   ./configure2 \
2622     --extra-cflags="$CFLAGS $DVDREAD_CFLAGS -I`pwd`/../includes $DROID_DVDLIB_SEEK64" \
2623     --extra-ldflags="-L`pwd`/../libdvdread/obj" \
2624     --with-dvdread-config="`pwd`/../dvdread-config" \
2625     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2626     --host=$host_alias \
2627     --build=$build_alias \
2628     --target=$target_alias \      
2629     --enable-static \
2630     --disable-shared \
2631     --cc="$CC"
2632 ], [0])
2633
2634 XB_CONFIG_MODULE([lib/cpluff], [
2635   ./configure --disable-nls \
2636     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2637     --host=$host_alias \
2638     --build=$build_alias \
2639     --target=$target_alias CFLAGS="$CFLAGS" CC="$CC" CXX="$CXX" LDFLAGS="$LDFLAGS" LIBS=""
2640     #LDFLAGS="$LDFLAGS -Wl,-read_only_relocs,suppress"    
2641 ], [0])
2642
2643 XB_CONFIG_MODULE([lib/gtest], [
2644   ./configure \
2645     CC="$CC" \
2646     CXX="$CXX" \
2647     CFLAGS="$CFLAGS" \
2648     CXXFLAGS="$CXXFLAGS" \
2649     --prefix="${prefix}" --includedir="${includedir}" --libdir="${libdir}" --datadir="${datadir}" \
2650     --host=$host_alias \
2651     --build=$build_alias \
2652     --target=$target_alias \
2653     --disable-shared \
2654     --enable-static \
2655     --with-pthreads
2656 ], [$SKIP_CONFIG_GTEST])
2657
2658 AC_OUTPUT
2659
2660 final_message="$final_message\n  prefix:\t$prefix\n$dashes"
2661 echo -e "$final_message\n"