| 1 | AC_PREREQ(2.59) |
| 2 | AC_INIT([libcec], [1:7:0], [http://libcec.pulse-eight.com/]) |
| 3 | AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) |
| 4 | |
| 5 | AC_PROG_CXX |
| 6 | AC_PROG_LIBTOOL |
| 7 | |
| 8 | # search for pthread, required by all targets |
| 9 | AC_SEARCH_LIBS([pthread_create],[pthread],, |
| 10 | AC_MSG_ERROR("required library 'pthread' is missing")) |
| 11 | |
| 12 | # search for dlopen, required by all targets |
| 13 | AC_SEARCH_LIBS([dlopen], [dl], |
| 14 | [test "$ac_cv_search_dlopen" = "none required" || LIBS_DL=$ac_cv_search_dlopen], |
| 15 | AC_MSG_ERROR("required library 'dl' is missing")) |
| 16 | |
| 17 | |
| 18 | # platform specific libs, required by all targets |
| 19 | case "${host}" in |
| 20 | *-*-linux*) |
| 21 | LIBS+=" -lrt" |
| 22 | ;; |
| 23 | *-apple-darwin*) |
| 24 | ;; |
| 25 | *-freebsd*) |
| 26 | ;; |
| 27 | esac |
| 28 | |
| 29 | libs_client=$LIBS |
| 30 | |
| 31 | # search for udev and lockdev, only required by libCEC |
| 32 | has_libudev="yes" |
| 33 | case "${host}" in |
| 34 | *-*-linux*) |
| 35 | PKG_CHECK_MODULES([UDEV],[libudev],, |
| 36 | [has_libudev="no"]; AC_MSG_WARN("library 'udev' is missing - adapter detection will not be available")) |
| 37 | |
| 38 | AC_CHECK_HEADER(lockdev.h,, |
| 39 | AC_MSG_ERROR("required library 'liblockdev' is missing")) |
| 40 | |
| 41 | LIBS+=" -llockdev" |
| 42 | ;; |
| 43 | *-apple-darwin*) |
| 44 | has_libudev="no"; |
| 45 | LIBS+="-framework CoreVideo -framework IOKit" |
| 46 | ;; |
| 47 | *-freebsd*) |
| 48 | has_libudev="no" |
| 49 | ;; |
| 50 | esac |
| 51 | |
| 52 | # mark udev as available if it was found, so we can include adapter autodetection code |
| 53 | if test "x$has_libudev" != "xno"; then |
| 54 | INCLUDES="$INCLUDES $UDEV_CFLAGS";LIBS="$LIBS $UDEV_LIBS" |
| 55 | AC_DEFINE([HAVE_LIBUDEV],[1],["Define to 1 if libudev is installed"]) |
| 56 | REQUIRES="udev" |
| 57 | fi |
| 58 | |
| 59 | LIBS_LIBCEC=$LIBS |
| 60 | LIBS=$libs_client |
| 61 | |
| 62 | CXXFLAGS="-fPIC -Wall -Wextra -Wno-missing-field-initializers $CXXFLAGS" |
| 63 | |
| 64 | AC_SUBST([REQUIRES]) |
| 65 | AC_SUBST([LIBS]) |
| 66 | AC_SUBST([LIBS_LIBCEC]) |
| 67 | AC_CONFIG_FILES([src/lib/libcec.pc]) |
| 68 | AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile src/cec-config/Makefile]) |