fix OS-X build
[deb_libcec.git] / configure.ac
CommitLineData
6ea2515b
LOK
1AC_PREREQ(2.59)
2AC_INIT([libcec], [1:7:0], [http://libcec.pulse-eight.com/])
abbca718
LOK
3AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
4
5AC_PROG_CXX
6AC_PROG_LIBTOOL
7
6ea2515b
LOK
8# search for pthread, required by all targets
9AC_SEARCH_LIBS([pthread_create],[pthread],,
10 AC_MSG_ERROR("required library 'pthread' is missing"))
11
12# search for dlopen, required by all targets
13AC_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
19case "${host}" in
20 *-*-linux*)
21 LIBS+=" -lrt"
22 ;;
23 *-apple-darwin*)
ebefc26c 24 LIBS+="-framework CoreVideo -framework IOKit"
6ea2515b
LOK
25 ;;
26 *-freebsd*)
27 ;;
28esac
29
30libs_client=$LIBS
31
32# search for udev and lockdev, only required by libCEC
42c02563 33has_libudev="yes"
3e703e8e 34case "${host}" in
35 *-*-linux*)
6ea2515b
LOK
36 PKG_CHECK_MODULES([UDEV],[libudev],,
37 [has_libudev="no"]; AC_MSG_WARN("library 'udev' is missing - adapter detection will not be available"))
38
39 AC_CHECK_HEADER(lockdev.h,,
40 AC_MSG_ERROR("required library 'liblockdev' is missing"))
41
42 LIBS+=" -llockdev"
3e703e8e 43 ;;
44 *-apple-darwin*)
42c02563 45 has_libudev="no";
3e703e8e 46 ;;
5458fd77
F
47 *-freebsd*)
48 has_libudev="no"
49 ;;
3e703e8e 50esac
51
6ea2515b 52# mark udev as available if it was found, so we can include adapter autodetection code
42c02563
LOK
53if 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"
57fi
58
6ea2515b
LOK
59LIBS_LIBCEC=$LIBS
60LIBS=$libs_client
abbca718 61
0bb46307 62CXXFLAGS="-fPIC -Wall -Wextra -Wno-missing-field-initializers $CXXFLAGS"
7eb13cca 63
6ea2515b
LOK
64AC_SUBST([REQUIRES])
65AC_SUBST([LIBS])
66AC_SUBST([LIBS_LIBCEC])
abbca718 67AC_CONFIG_FILES([src/lib/libcec.pc])
39b1216c 68AC_OUTPUT([Makefile src/lib/Makefile src/testclient/Makefile src/cec-config/Makefile])