~ubuntu-branches/ubuntu/oneiric/strigi/oneiric

« back to all changes in this revision

Viewing changes to libstreamanalyzer/cmake/FindXine.cmake

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2011-09-20 08:50:25 UTC
  • mto: (1.1.20 upstream) (5.1.6 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: package-import@ubuntu.com-20110920085025-wszfu6x8rshrjq0e
ImportĀ upstreamĀ versionĀ 0.7.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# - Try to find the XINE  library
 
2
# Once done this will define
 
3
#
 
4
#  XINE_FOUND - system has the XINE library
 
5
#  XINE_VERSION - XINE version
 
6
#  XINE_BUGFIX_VERSION - the XINE bugfix version
 
7
#  XINE_INCLUDE_DIR - the XINE include directory
 
8
#  XINE_LIBRARY - The libraries needed to use XINE
 
9
#  XINE_XCB_FOUND - libxine can use XCB for video output
 
10
 
 
11
# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
 
12
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
 
13
#
 
14
# Redistribution and use is allowed according to the terms of the BSD license.
 
15
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
 
16
 
 
17
if (XINE_INCLUDE_DIR AND XINE_LIBRARY)
 
18
  # Already in cache, be silent
 
19
  set(Xine_FIND_QUIETLY TRUE)
 
20
endif (XINE_INCLUDE_DIR AND XINE_LIBRARY)
 
21
 
 
22
find_package(PkgConfig)
 
23
if (PKG_CONFIG_FOUND)
 
24
   pkg_check_modules(PC_LIBXINE libxine)
 
25
endif (PKG_CONFIG_FOUND)
 
26
 
 
27
find_path(XINE_INCLUDE_DIR NAMES xine.h 
 
28
    HINTS                    # HINTS is new in cmake 2.6. These dirs will be preferred over the default ones
 
29
    ${PC_LIBXINE_INCLUDEDIR} 
 
30
    ${PC_LIBXINE_INCLUDE_DIRS} 
 
31
    )
 
32
 
 
33
find_library(XINE_LIBRARY NAMES xine
 
34
 HINTS
 
35
  ${PC_LIBXINE_LIBDIR}
 
36
  ${PC_LIBXINE_LIBRARY_DIRS}
 
37
 )
 
38
 
 
39
find_program(XINECONFIG_EXECUTABLE NAMES xine-config 
 
40
   HINTS
 
41
   ${PC_LIBXINE_PREFIX}/bin
 
42
)
 
43
 
 
44
if (XINE_INCLUDE_DIR AND XINE_LIBRARY AND XINECONFIG_EXECUTABLE)
 
45
   exec_program(${XINECONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE XINE_VERSION)
 
46
   if("${XINE_VERSION}" VERSION_GREATER "1.1.0")   #if (... VERSION_GREATER) is new since cmake 2.6.2
 
47
      set(XINE_VERSION_OK TRUE)
 
48
      string(REGEX REPLACE "[0-9]\\.[0-9]\\." "" XINE_BUGFIX_VERSION ${XINE_VERSION})
 
49
   endif("${XINE_VERSION}" VERSION_GREATER "1.1.0")
 
50
endif (XINE_INCLUDE_DIR AND XINE_LIBRARY AND XINECONFIG_EXECUTABLE)
 
51
 
 
52
 
 
53
if( XINE_VERSION_OK)
 
54
  include(CheckCSourceCompiles)
 
55
  set(CMAKE_REQUIRED_INCLUDES ${XINE_INCLUDE_DIR})
 
56
  set(CMAKE_REQUIRED_LIBRARIES ${XINE_LIBRARY})
 
57
  check_c_source_compiles("#include <xine.h>\nint main()\n{\n  xine_open_video_driver(xine_new(), \"auto\", XINE_VISUAL_TYPE_XCB, NULL);\n  return 0;\n}\n" XINE_XCB_FOUND)
 
58
  set(XINE_FOUND TRUE)
 
59
endif(XINE_VERSION_OK)
 
60
 
 
61
include(FindPackageHandleStandardArgs)
 
62
find_package_handle_standard_args(Xine  "Could NOT find XINE 1.1.1 or greater"  XINE_INCLUDE_DIR XINE_LIBRARY XINECONFIG_EXECUTABLE  XINE_VERSION_OK)
 
63
 
 
64
mark_as_advanced(XINE_INCLUDE_DIR XINE_LIBRARY XINECONFIG_EXECUTABLE)