1*377e76abSEd Tanous# - Try to find DBus 2*377e76abSEd Tanous# Once done, this will define 3*377e76abSEd Tanous# 4*377e76abSEd Tanous# DBUS_FOUND - system has DBus 5*377e76abSEd Tanous# DBUS_INCLUDE_DIRS - the DBus include directories 6*377e76abSEd Tanous# DBUS_LIBRARIES - link these to use DBus 7*377e76abSEd Tanous# 8*377e76abSEd Tanous# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org> 9*377e76abSEd Tanous# 10*377e76abSEd Tanous# Redistribution and use in source and binary forms, with or without 11*377e76abSEd Tanous# modification, are permitted provided that the following conditions 12*377e76abSEd Tanous# are met: 13*377e76abSEd Tanous# 1. Redistributions of source code must retain the above copyright 14*377e76abSEd Tanous# notice, this list of conditions and the following disclaimer. 15*377e76abSEd Tanous# 2. Redistributions in binary form must reproduce the above copyright 16*377e76abSEd Tanous# notice, this list of conditions and the following disclaimer in the 17*377e76abSEd Tanous# documentation and/or other materials provided with the distribution. 18*377e76abSEd Tanous# 19*377e76abSEd Tanous# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS 20*377e76abSEd Tanous# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21*377e76abSEd Tanous# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22*377e76abSEd Tanous# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS 23*377e76abSEd Tanous# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24*377e76abSEd Tanous# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25*377e76abSEd Tanous# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26*377e76abSEd Tanous# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27*377e76abSEd Tanous# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28*377e76abSEd Tanous# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29*377e76abSEd Tanous# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30*377e76abSEd Tanous 31*377e76abSEd TanousFIND_PACKAGE(PkgConfig) 32*377e76abSEd TanousPKG_CHECK_MODULES(PC_DBUS QUIET dbus-1) 33*377e76abSEd Tanous 34*377e76abSEd TanousFIND_LIBRARY(DBUS_LIBRARIES 35*377e76abSEd Tanous NAMES dbus-1 36*377e76abSEd Tanous HINTS ${PC_DBUS_LIBDIR} 37*377e76abSEd Tanous ${PC_DBUS_LIBRARY_DIRS} 38*377e76abSEd Tanous) 39*377e76abSEd Tanous 40*377e76abSEd Tanousmessage("DBUS_LIBRARIES = ${DBUS_LIBRARIES}") 41*377e76abSEd Tanous 42*377e76abSEd TanousFIND_PATH(DBUS_INCLUDE_DIR 43*377e76abSEd Tanous NAMES dbus/dbus.h 44*377e76abSEd Tanous HINTS ${PC_DBUS_INCLUDEDIR} 45*377e76abSEd Tanous ${PC_DBUS_INCLUDE_DIRS} 46*377e76abSEd Tanous) 47*377e76abSEd Tanous 48*377e76abSEd TanousGET_FILENAME_COMPONENT(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH) 49*377e76abSEd TanousFIND_PATH(DBUS_ARCH_INCLUDE_DIR 50*377e76abSEd Tanous NAMES dbus/dbus-arch-deps.h 51*377e76abSEd Tanous HINTS ${PC_DBUS_INCLUDEDIR} 52*377e76abSEd Tanous ${PC_DBUS_INCLUDE_DIRS} 53*377e76abSEd Tanous ${_DBUS_LIBRARY_DIR} 54*377e76abSEd Tanous ${DBUS_INCLUDE_DIR} 55*377e76abSEd Tanous PATH_SUFFIXES include 56*377e76abSEd Tanous) 57*377e76abSEd Tanous 58*377e76abSEd TanousSET(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) 59*377e76abSEd Tanous 60*377e76abSEd TanousINCLUDE(FindPackageHandleStandardArgs) 61*377e76abSEd TanousFIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES) 62