[configure] properly detect if curl was compiled statically with openssl
[vuplus_xbmc] / configure.in
index 20caba5..2b7b10d 100644 (file)
@@ -84,8 +84,8 @@ AC_DEFUN([XB_FIND_SONAME],
       lib=[`ls -- $path/lib$2.dylib 2>/dev/null`]
       if test x$lib != x; then
         # we want the path/name that is embedded in the dylib 
-        $1_SONAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
-        $1_SONAME=[`basename $$1_SONAME`]
+        $1_FILENAME=[`otool -L $lib | grep -v lib$2.dylib | grep lib$2 | awk '{V=1; print $V}'`]
+        $1_SONAME=[`basename $$1_FILENAME`]
       fi
     done
   fi
@@ -168,7 +168,6 @@ libnfs_not_found="== Could not find libnfs. NFS client support disabled. =="
 libnfs_disabled="== NFS support disabled. =="
 libafpclient_not_found="== Could not find libafpclient. AFP client support disabled. =="
 libafpclient_disabled="== AFP support disabled. =="
-libshairport_not_found="== Could not find libshairport. =="
 libshairplay_not_found="== Could not find libshairplay. =="
 samba_disabled="== SAMBA support disabled. =="
 libplist_not_found="== Could not find libplist. AirPlay support disabled. =="
@@ -505,18 +504,6 @@ AC_ARG_ENABLE([libcec],
   [use_libcec=$enableval],
   [use_libcec=auto])
 
-AC_ARG_ENABLE([libmp3lame],
-  [AS_HELP_STRING([--enable-libmp3lame],
-  [enable lame mp3 encoder support (default is auto)])],
-  [use_libmp3lame=$enableval],
-  [use_libmp3lame=auto])
-
-AC_ARG_ENABLE([libvorbisenc],
-  [AS_HELP_STRING([--enable-libvorbisenc],
-  [enable vorbis encoder support (default is auto)])],
-  [use_libvorbisenc=$enableval],
-  [use_libvorbisenc=auto])
-
 AC_ARG_ENABLE([libcap],
   [AS_HELP_STRING([--enable-libcap],
   [enable libcap support (default is auto)])],
@@ -571,6 +558,8 @@ AC_PROG_MAKE_SET
 PKG_PROG_PKG_CONFIG
 MAKE="${MAKE:-make}"
 OBJDUMP="${OBJDUMP:-objdump}"
+READELF="${READELF:-readelf}"
+NM="${NM:-nm}"
 
 # host detection and setup
 case $host in
@@ -627,11 +616,15 @@ case $host in
      PYTHON_CPPFLAGS="-I${prefix}/include/python2.6"
      PYTHON_SITE_PKG="${prefix}/lib/python2.6/site-packages"
      PYTHON_NOVERSIONCHECK="no-check"
+     DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
+     AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
      ;;
   *86*-apple-darwin*)
      use_joystick=no
      use_vtbdecoder=no
      ARCH="x86-osx"
+     DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
+     AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
      ;;
   powerpc-apple-darwin*)
      use_joystick=no
@@ -639,6 +632,8 @@ case $host in
      use_crystalhd=no
      ARCH="powerpc-osx"
      use_arch="ppc"
+     DEPENDS_ROOT_FOR_XCODE=$(echo ${prefix%/*})
+     AC_SUBST([DEPENDS_ROOT_FOR_XCODE])
      ;;
   powerpc-*-linux-gnu*|powerpc-*-linux-uclibc*)
      ARCH="powerpc-linux"
@@ -724,6 +719,27 @@ if test "$GIT_REV" = ""; then
 fi
 final_message="$final_message\n  git Rev.:\t${GIT_REV}"
 
+# detect Xbmc soname version
+# version can be overridden by setting the following as ENV vars when running configure
+APP_VERSION_MAJOR=${APP_VERSION_MAJOR-$(${AWK} '/VERSION_MAJOR/ {print $2}' version.txt)}
+APP_VERSION_MINOR=${APP_VERSION_MINOR-$(${AWK} '/VERSION_MINOR/ {print $2}' version.txt)}
+APP_VERSION_TAG=${APP_VERSION_TAG-$(${AWK} '/VERSION_TAG/ {print $2}' version.txt)}
+APP_VERSION_TAG_LC=$(echo $APP_VERSION_TAG | ${AWK} '{print tolower($0)}')
+APP_VERSION_CODE=${APP_VERSION_CODE-$(${AWK} '/VERSION_CODE/ {print $2}' version.txt)}
+APP_ADDON_API=${APP_ADDON_API-$(${AWK} '/ADDON_API/ {print $2}' version.txt)}
+if test "$APP_VERSION_MAJOR" != "" && test "$APP_VERSION_MINOR" != "" && test "$APP_VERSION_TAG" != "" \
+&& test "$APP_VERSION_CODE" != "" && test "$APP_ADDON_API" != ""; then
+  final_message="$final_message\n  Xbmc Version:\t${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}-${APP_VERSION_TAG}"
+  AC_SUBST(APP_VERSION_MAJOR)
+  AC_SUBST(APP_VERSION_MINOR)
+  AC_SUBST(APP_VERSION_TAG)
+  AC_SUBST(APP_VERSION_TAG_LC)
+  AC_SUBST(APP_VERSION_CODE)
+  AC_SUBST(APP_ADDON_API)
+else
+  AC_MSG_ERROR(could not detect XBMC Version, make sure version.txt is complete)
+fi
+
 if test "$host_vendor" = "apple"; then
   echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
 else
@@ -1037,21 +1053,28 @@ AC_CHECK_HEADER([mpeg2dec/mpeg2convert.h],, AC_MSG_ERROR($missing_library),
   AC_INCLUDES_DEFAULT()
   [#include <mpeg2dec/mpeg2.h>])
 AC_CHECK_HEADER([jpeglib.h],,        AC_MSG_ERROR($missing_library))
-AC_CHECK_HEADER([samplerate.h],,     AC_MSG_ERROR($missing_library))
 AC_CHECK_HEADER([ogg/ogg.h],,        AC_MSG_ERROR($missing_library))
 AC_CHECK_HEADER([vorbis/vorbisfile.h],, AC_MSG_ERROR($missing_library))
 AC_CHECK_HEADER([libmodplug/modplug.h],, AC_MSG_ERROR($missing_library))
-AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR($missing_library))
 AC_CHECK_HEADER([FLAC/stream_decoder.h],, AC_MSG_ERROR($missing_library))
 
-# we need to check for the header because if it exists we set the openssl
-# and gcrypt MT callback hooks. This is mostly so that libcurl operates 
-# in MT manner correctly.
-AC_MSG_CHECKING([for CRYPTO_set_locking_callback(0)])
-AC_TRY_LINK([],[CRYPTO_set_locking_callback(0);],
-                [have_curl_static=yes],
-                [have_curl_static=no])
-AC_MSG_RESULT($have_curl_static)
+AC_CHECK_HEADER([curl/curl.h],, AC_MSG_ERROR($missing_library))
+XB_FIND_SONAME([CURL], [curl])
+AC_MSG_CHECKING([for CRYPTO_set_locking_callback(0) in $CURL_SONAME])
+if test "$host_vendor" = "apple" ; then
+  libchecker="$NM"
+  searchpattern="T [_]?CRYPTO_set_locking_call"
+else
+  libchecker="$READELF -s"
+  searchpattern="CRYPTO_set_locking_call"
+fi
+if test $($libchecker $CURL_FILENAME  | grep -Eq "${searchpattern}" ; echo $?) -eq 0 ; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE([HAS_CURL_STATIC], [1], [Whether OpenSSL inside libcurl is static.])
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_CHECK_HEADER([openssl/crypto.h], AC_DEFINE([HAVE_OPENSSL],[1],[Define if we have openssl]),)
 AC_CHECK_HEADER([gcrypt.h], gcrypt_headers_available=yes,gcrypt_headers_available=no)
 if test "$gcrypt_headers_available" = "yes"; then
@@ -1116,9 +1139,6 @@ PKG_CHECK_MODULES([PCRE],       [libpcre],
   [INCLUDES="$INCLUDES $PCRE_CFLAGS"; LIBS="$LIBS $PCRE_LIBS"]; \
   AC_DEFINE([HAVE_LIBPCRE],[1],["Define to 1 if libpcre is installed"]),
   AC_MSG_ERROR($missing_library))
-PKG_CHECK_MODULES([SAMPLERATE], [samplerate],
-  [INCLUDES="$INCLUDES $SAMPLERATE_CFLAGS"; LIBS="$LIBS $SAMPLERATE_LIBS"],
-  AC_MSG_ERROR($missing_library))
 PKG_CHECK_MODULES([FREETYPE2],  [freetype2],
   [INCLUDES="$INCLUDES $FREETYPE2_CFLAGS"; LIBS="$LIBS $FREETYPE2_LIBS"],
   AC_MSG_ERROR($missing_library))
@@ -1199,7 +1219,6 @@ fi
 fi
 
 XB_FIND_SONAME([OGG],         [ogg])
-XB_FIND_SONAME([CURL],        [curl])
 XB_FIND_SONAME([FLAC],        [FLAC])
 XB_FIND_SONAME([VORBIS],      [vorbis])
 XB_FIND_SONAME([VORBISFILE],  [vorbisfile])
@@ -1207,37 +1226,6 @@ XB_FIND_SONAME([MODPLUG],     [modplug])
 XB_FIND_SONAME([ASS],         [ass])
 XB_FIND_SONAME([MPEG2],       [mpeg2])
 
-# Audio encoders
-if test "x$use_libmp3lame" != "xno"; then
-  XB_FIND_SONAME([LAMEENC], [mp3lame], [use_libmp3lame])
-  if test "x$use_libmp3lame" != "xno"; then
-    AC_CHECK_HEADER([lame/lame.h],, AC_MSG_ERROR($missing_headers))
-  fi
-fi
-AS_CASE([x$use_libmp3lame],
-  [xno],[
-    AC_SUBST([HAVE_LIBMP3LAME], 0)
-  ],
-  [
-    AC_DEFINE([HAVE_LIBMP3LAME], 1, [System has libmp3lame library])
-    AC_SUBST([HAVE_LIBMP3LAME], 1)
-  ]
-)
-if test "x$use_libvorbisenc" != "xno"; then
-  XB_FIND_SONAME([VORBISENC], [vorbisenc], [use_libvorbisenc])
-  if test "x$use_libvorbisenc" != "xno"; then
-    AC_CHECK_HEADER([vorbis/vorbisenc.h],, AC_MSG_ERROR($missing_headers))
-  fi
-fi
-AS_CASE([x$use_libvorbisenc],
-  [xno],[
-    AC_SUBST([HAVE_LIBVORBISENC], 0)
-  ],[
-    AC_DEFINE([HAVE_LIBVORBISENC], 1, [System has libvorbisenc library])
-    AC_SUBST([HAVE_LIBVORBISENC], 1)
-  ]
-)
-
 # WebServer
 if test "$use_webserver" = "yes"; then
   AC_CHECK_LIB([microhttpd],  [main],, AC_MSG_ERROR($missing_library))
@@ -1463,11 +1451,6 @@ else
   AC_DEFINE([HAVE_LIBSSH], [1], [Whether to use libSSH library.])
 fi
 
-# libcurl
-if test "x$have_curl_static" = "xyes"; then
-  AC_DEFINE([HAS_CURL_STATIC], [1], [Whether OpenSSL inside libcurl is static.])
-fi
-
 # libRTMP
 if test "$use_librtmp" != "no"; then
   AC_CHECK_HEADERS([librtmp/log.h librtmp/amf.h librtmp/rtmp.h],,
@@ -1569,7 +1552,7 @@ if test "$use_airplay" != "no"; then
   fi
 fi
 
-# libshairplay for AirTunes (prefered lib)
+# libshairplay for AirTunes
 USE_AIRTUNES=0
 if test "x$use_airtunes" != "xno"; then
   AC_CHECK_HEADERS([shairplay/raop.h],USE_AIRTUNES=1,
@@ -1578,29 +1561,14 @@ if test "x$use_airtunes" != "xno"; then
 
   if test "x$USE_AIRTUNES" != "x0"; then
     XB_FIND_SONAME([SHAIRPLAY], [shairplay], [USE_AIRTUNES])
-    USE_LIBSHAIRPLAY=1
     AC_CHECK_MEMBERS([struct raop_callbacks_s.cls],,,
                      [[#include <shairplay/raop.h>]])
     AC_DEFINE([HAVE_LIBSHAIRPLAY],[1],["Define to 1 if you have libshairplay."])
   fi
 
-  #libshairport - as a fallback for AirTunes
-  if test "x$USE_AIRTUNES" == "x0"; then
-    AC_CHECK_HEADERS([shairport/shairport.h],USE_AIRTUNES=1,
-     [AC_MSG_NOTICE($libshairport_not_found)
-     ])
-
-    if test "x$USE_AIRTUNES" != "x0"; then
-      XB_FIND_SONAME([SHAIRPORT], [shairport], [USE_AIRTUNES])
-      AC_CHECK_MEMBERS([struct AudioOutput.ao_set_metadata],,,
-                       [[#include <shairport/shairport.h>]])
-      AC_DEFINE([HAVE_LIBSHAIRPORT],[1],["Define to 1 if you have libshairport."])
-    fi
-  fi
-
   if test "x$USE_AIRTUNES" == "x0"; then
     if test "x$use_airtunes" == "xyes"; then
-      AC_MSG_ERROR("No airtunes library could be found. (libshairport/libshairplay)")
+      AC_MSG_ERROR("No airtunes library could be found. (libshairplay)")
     fi
     use_airtunes="no"
   fi
@@ -2413,11 +2381,7 @@ else
 fi
 
 if test "x$use_airtunes" != "xno"; then
-  if test "x$USE_LIBSHAIRPLAY" == "x1"; then
-    final_message="$final_message\n  AirTunes support (libshairplay):\tYes"  
-  else
-    final_message="$final_message\n  AirTunes support (libshairport):\tYes"
-  fi
+  final_message="$final_message\n  AirTunes support (libshairplay):\tYes"  
 else
   final_message="$final_message\n  AirTunes support:\tNo"
 fi
@@ -2425,6 +2389,7 @@ fi
 if test "x$use_upnp" != "xno"; then
   final_message="$final_message\n  UPnP support:\t\tYes"
   USE_UPNP=1
+  UPNP_DEFINES="-DNPT_CONFIG_ENABLE_LOGGING -DPLT_HTTP_DEFAULT_USER_AGENT="\"UPnP/1.0 DLNADOC/1.50 XBMC\"" -DPLT_HTTP_DEFAULT_SERVER="\"UPnP/1.0 DLNADOC/1.50 XBMC\"""
   AC_DEFINE([USE_UPNP], [1], [Define to 1 to enable UPnP support.])
 else
   USE_UPNP=0
@@ -2455,18 +2420,6 @@ else
   final_message="$final_message\n  libcec support:\tNo"
 fi
 
-if test "x$use_libmp3lame" != "xno"; then
-  final_message="$final_message\n  libmp3lame support:\tYes"
-else
-  final_message="$final_message\n  libmp3lame support:\tNo"
-fi
-
-if test "x$use_libvorbisenc" != "xno"; then
-  final_message="$final_message\n  libvorbisenc support:\tYes"
-else
-  final_message="$final_message\n  libvorbisenc support:\tNo"
-fi
-
 if test "x$use_libcap" != "xno"; then
   final_message="$final_message\n  libcap support:\tYes"
 else
@@ -2582,7 +2535,15 @@ OUTPUT_FILES="Makefile \
     xbmc/android/jni/Makefile \
     xbmc/utils/Makefile \
     xbmc/main/Makefile \
-    project/cmake/xbmc-config.cmake"
+    tools/darwin/Configurations/App.xcconfig \
+    tools/darwin/Configurations/Common.xcconfig \
+    tools/darwin/packaging/xbmc-ios/mkdeb-xbmc-ios.sh \
+    tools/darwin/packaging/xbmc-atv2/mkdeb-xbmc-atv2.sh \
+    tools/darwin/packaging/xbmc-osx/mkdmg-xbmc-osx.sh \
+    xbmc/osx/Info.plist \
+    project/cmake/xbmc-config.cmake \
+    tools/android/packaging/xbmc/AndroidManifest.xml \
+    addons/xbmc.addon/addon.xml"
 
 if test "$use_wayland" = "yes"; then
 OUTPUT_FILES="$OUTPUT_FILES xbmc/windowing/tests/wayland/Makefile"
@@ -2639,7 +2600,6 @@ AC_SUBST(LIBFLAC_BASENAME)
 AC_SUBST(LIBVORBISFILE_BASENAME)
 AC_SUBST(LIBMODPLUG_BASENAME)
 AC_SUBST(LIBOGG_BASENAME)
-AC_SUBST(LIBVORBISENC_BASENAME)
 AC_SUBST(LIBVORBIS_BASENAME)
 AC_SUBST(LIBASS_BASENAME)
 AC_SUBST(LIBMEPG2_BASENAME)
@@ -2673,6 +2633,7 @@ AC_SUBST(USE_ANDROID)
 AC_SUBST(GTEST_CONFIGURED)
 AC_SUBST(USE_DOXYGEN)
 AC_SUBST(USE_PVR_ADDONS)
+AC_SUBST(UPNP_DEFINES)
 
 # pushd and popd are not available in other shells besides bash, so implement
 # our own pushd/popd functions