Add debian package patches.
[deb_libcec.git] / configure.ac
index e0252c9bc118cce5c51c2681fc8cd7483403660c..68b98563533f8f087bdf02ae2b617a9367db9890 100644 (file)
@@ -1,10 +1,10 @@
 AC_PREREQ(2.59)
-AC_INIT([libcec], [1:9:0], [http://libcec.pulse-eight.com/])
+AC_INIT([libcec], [2:1:0], [http://libcec.pulse-eight.com/])
 AC_CONFIG_HEADERS([config.h])
 AH_TOP([#pragma once])
 
 AM_INIT_AUTOMAKE([foreign])
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 
@@ -23,7 +23,7 @@ msg_pthread_missing="required library 'pthread' is missing"
 msg_dl_missing="required library 'dl' is missing"
 msg_udev_missing="library 'udev' is missing - adapter detection will not be available"
 msg_dirent_missing="dirent.h header is missing - adapter detection will not be available"
-msg_lockdev_missing="required library 'liblockdev' is missing"
+msg_lockdev_missing="library 'liblockdev' is missing"
 msg_rpi_api_missing="Raspberry Pi API not found or incompatible with libCEC"
 msg_rpi_will_check="will check for RPi support"
 msg_rpi_unsupported_target="will not check for RPi support (unsupported cpu: ${host_cpu})"
@@ -43,19 +43,26 @@ AC_ARG_ENABLE([optimisation],
   [use_optimisation=$enableval],
   [use_optimisation=yes])
 
-## CuBox support
+## TDA995x support
 AC_ARG_ENABLE([cubox],
-  [AS_HELP_STRING([--enable-cubox],
-  [enable support for the CuBox (default is no)])],
-  [use_nxp=$enableval],
-  [use_nxp=no])
-
-## Optional path to the NXP dev toolkit
-AC_ARG_WITH([nxp-toolkit-path],
-  [AS_HELP_STRING([--with-nxp-toolkit-path],
-    [location of the NXP HDMI toolkit (default is ./nxp_hdmi)])],
-  [NXP_CFLAGS="-I$withval/inc"],
-  [NXP_CFLAGS="-I\$(abs_top_srcdir)/nxp_hdmi/inc"])
+  [AS_HELP_STRING([--enable-tda995x],
+  [enable support for the TDA995x (default is no)])],
+  [use_tda995x=$enableval],
+  [use_tda995x=no])
+
+## Optional path to the tda995x dev toolkit
+AC_ARG_WITH([tda995x-toolkit-path],
+  [AS_HELP_STRING([--with-tda995x-toolkit-path],
+    [location of the TDA995x driver toolkit (default is ./nxp_hdmi)])],
+  [TDA995X_CFLAGS="-I$withval/inc"],
+  [TDA995X_CFLAGS="-I\$(abs_top_srcdir)/nxp_hdmi/inc"])
+
+## Exynos support
+AC_ARG_ENABLE([exynos],
+  [AS_HELP_STRING([--enable-exynos],
+  [enable support for the Exynos (default is yes)])],
+  [use_exynos=$enableval],
+  [use_exynos=yes])
 
 ## Raspberry Pi support
 AC_ARG_ENABLE([rpi],
@@ -68,7 +75,7 @@ AC_ARG_ENABLE([rpi],
 AC_ARG_WITH([rpi-include-path],
   [AS_HELP_STRING([--with-rpi-include-path],
     [location of the Raspberry Pi headers (location of /opt/vc/include, default is auto)])],
-  [RPI_CFLAGS="-I$withval -I$withval/interface/vcos/pthreads"])
+  [RPI_CFLAGS="-I$withval -I$withval/interface/vcos/pthreads -I$withval/interface/vmcs_host/linux"])
 
 ## Optional path to libbcm_host.so
 AC_ARG_WITH([rpi-lib-path],
@@ -110,13 +117,13 @@ AC_CHECK_FUNCS([pthread_mutexattr_init pthread_cond_init pthread_cond_destroy pt
 AC_SEARCH_LIBS([dlopen], [dl],
   [test "$ac_cv_search_dlopen" = "none required" || LIBS_DL=$ac_cv_search_dlopen],
   AC_MSG_ERROR($msg_dl_missing))
-AC_CHECK_FUNCS([dlopen dlcose dlsym])
+AC_CHECK_FUNCS([dlopen dlclose dlsym])
 
 ## platform specific libs, required by all targets
 case "${host}" in
   *-*-linux*)
     # for timeutils
-    LIBS="$LIBS -lrt"
+    AC_SEARCH_LIBS([clock_gettime], [rt])
     ;;
   *-apple-darwin*)
     LIBS="$LIBS -framework CoreVideo -framework IOKit"
@@ -129,6 +136,8 @@ libs_client="$LIBS"
 ## search for udev, lockdev and the RPi API, only required by libCEC
 use_udev="no"
 use_adapter_detection="yes"
+use_lockdev="no"
+SUPPRESS_MANGLING_WARNINGS=" -Wno-psabi"
 case "${host}" in
   *-*-linux*)
     ## search for udev if pkg-config was found
@@ -146,8 +155,9 @@ case "${host}" in
     fi
 
     ## search for lockdev
-    AC_CHECK_HEADER(lockdev.h,,AC_MSG_ERROR($msg_lockdev_missing))
-    AC_CHECK_LIB(lockdev,dev_unlock,,AC_MSG_ERROR($msg_lockdev_missing))
+    use_lockdev="yes"
+    AC_CHECK_HEADER(lockdev.h,,[use_lockdev="no";AC_MSG_WARN($msg_lockdev_missing)])
+    AC_CHECK_LIB(lockdev,dev_unlock,,[use_lockdev="no";AC_MSG_WARN($msg_lockdev_missing)])
 
     AC_CHECK_HEADER(time.h,,AC_MSG_ERROR($msg_required_header_missing))
     AC_CHECK_HEADER(sys/prctl.h,,AC_MSG_ERROR($msg_required_header_missing))
@@ -203,10 +213,28 @@ case "${host}" in
         LIBS="$libs_pre_rpi"
       fi
     fi
+    ## search for X11/xrandr
+    libs_tmp="$LIBS"
+    use_x11_xrandr="yes"
+    AC_CHECK_HEADER(X11/Xlib.h,,[use_x11_xrandr="no"])
+    AC_CHECK_HEADER(X11/Xatom.h,,[use_x11_xrandr="no"])
+    AC_CHECK_HEADER(X11/extensions/Xrandr.h,,[use_x11_xrandr="no"])
+    AC_CHECK_LIB(X11,XOpenDisplay,,[use_x11_xrandr="no"])
+    AC_CHECK_LIB(Xrandr,XRRGetScreenResources,,[use_x11_xrandr="no"])
+    if test "x$use_x11_xrandr" = "xyes"; then
+      AC_DEFINE([HAVE_RANDR],[1],[Define to 1 to include support for the X11 randr extension])
+      AM_CONDITIONAL(USE_X11_RANDR, true)
+    else
+      AM_CONDITIONAL(USE_X11_RANDR, false)
+      LIBS="$libs_tmp"
+    fi
     ;;
   *-apple-darwin*)
     AC_CHECK_HEADER(mach/mach_time.h,,AC_MSG_ERROR($msg_required_header_missing))
     AC_CHECK_HEADER(CoreVideo/CVHostTime.h,,AC_MSG_ERROR($msg_required_header_missing))
+    AC_DEFINE([TARGET_DARWIN], [1], [Darwin target])
+    AM_CONDITIONAL(USE_X11_RANDR, false)
+    SUPPRESS_MANGLING_WARNINGS=""
     ;;
 esac
 
@@ -218,6 +246,10 @@ LIB_INFO="$LIB_INFO 'P8 USB'"
 AC_DEFINE([HAVE_P8_USB],[1],[Define to 1 to include support for the Pulse-Eight USB-CEC Adapter])
 AM_CONDITIONAL(USE_P8_USB, true)
 
+if test "x$use_lockdev" = "xyes"; then
+  AC_DEFINE([HAVE_LOCKDEV],[1],[Define to 1 if liblockdev is installed])
+fi
+
 ## mark adapter detection as available if the required deps were found
 if test "x$use_adapter_detection" = "xyes"; then
   ## mark udev as available if it was found
@@ -249,18 +281,31 @@ else
   features="$features\n  Raspberry Pi support :\t\tno"
 fi
 
-## mark CuBox support as available
-if test "x$use_nxp" != "xno"; then
-  AC_DEFINE([HAVE_NXP_API],[1],[Define to 1 to include CuBox support])
-  AM_CONDITIONAL(USE_NXP_API, true)
-  features="$features\n  CuBox support :\t\t\tyes"
-  LIB_INFO="$LIB_INFO 'CuBox'"
-  CPPFLAGS="$CPPFLAGS $NXP_CFLAGS"
+## mark TDA995x support as available
+if test "x$use_tda995x" != "xno"; then
+  AC_DEFINE([HAVE_TDA995X_API],[1],[Define to 1 to include CuBox support])
+  AM_CONDITIONAL(USE_TDA995X_API, true)
+  features="$features\n  TDA995x support :\t\t\tyes"
+  LIB_INFO="$LIB_INFO 'TDA995x'"
+  CPPFLAGS="$CPPFLAGS $TDA995X_CFLAGS"
 else
-  AM_CONDITIONAL(USE_NXP_API, false)
-  features="$features\n  CuBox support :\t\t\tno"
+  AM_CONDITIONAL(USE_TDA995X_API, false)
+  features="$features\n  TDA995x support :\t\t\tno"
 fi
 
+## mark Exynos support as available
+if test "x$use_exynos" != "xno"; then
+  AC_DEFINE([HAVE_EXYNOS_API],[1],[Define to 1 to include Exynos support])
+  AM_CONDITIONAL(USE_EXYNOS_API, true)
+  features="$features\n  Exynos support :\t\t\tyes"
+  LIB_INFO="$LIB_INFO 'EXYNOS'"
+  CPPFLAGS="$CPPFLAGS $EXYNOS_CFLAGS"
+else
+  AM_CONDITIONAL(USE_EXYNOS_API, false)
+  features="$features\n  EXYNOS support :\t\t\tno"
+fi
+
+
 ## check if our build system is complete
 AC_CHECK_HEADER(algorithm,,AC_MSG_ERROR($msg_required_header_missing))
 AC_CHECK_HEADER(ctype.h,,AC_MSG_ERROR($msg_required_header_missing))
@@ -331,14 +376,15 @@ if test "x$HAVE_UNAME" = "xyes"; then
   LIB_INFO="$LIB_INFO on `uname -s` `uname -r` (`uname -m`)"
 fi
 
-## redefine the LIBS, so cec-client and cec-config aren't linked against things they don't need
+## redefine the LIBS, so cec-client isn't linked against things they don't need
 LIBS_LIBCEC="$LIBS"
 LIBS="$libs_client"
 
-CXXFLAGS="$CXXFLAGS -fPIC -Wall -Wextra -Wno-missing-field-initializers"
+CXXFLAGS="$CXXFLAGS -fPIC -Wall -Wextra -Wno-missing-field-initializers $SUPPRESS_MANGLING_WARNINGS"
 
 if test "x$use_debug" = "xyes"; then
   CXXFLAGS="$CXXFLAGS -g"
+  AC_DEFINE(CEC_DEBUGGING,"1", "generate libCEC debug output")
 fi
 
 if test "x$optimisation" = "xyes"; then
@@ -355,7 +401,7 @@ AC_SUBST([USE_P8_USB])
 AC_SUBST([USE_P8_USB_DETECT])
 AC_SUBST([USE_RPI_API])
 AC_CONFIG_FILES([src/lib/libcec.pc])
-AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile src/cec-config/Makefile])
+AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile])
 
 cat <<EOB