~ubuntu-branches/ubuntu/precise/dwarves-dfsg/precise

« back to all changes in this revision

Viewing changes to cmake/modules/FindDWARF.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Girard
  • Date: 2011-05-02 19:34:31 UTC
  • mfrom: (1.1.1 upstream) (2.1.3 maverick)
  • Revision ID: james.westby@ubuntu.com-20110502193431-xd7eeb4sarnmyd7e
Tags: 1.9-1
* Acknowledge 1.3-1.1 NMU (thanks to Michael Banck) and resynch with
  Ubuntu release (thanks Bhavani Shankar).
* New upstream release:
  - patch from 1.3-1.1ubuntu1 no longer needed.
  - new manpage for pahole.
  - new program scncopy to copy ELF sections.
  - fixes crash when encountering a pointer in a struct. Closes: #513573.
  - recognizes C++ classes. Closes: #621530.
  - no longer FTBFS with gcc 4.6. Closes: #625158.
* Remove libebl detection and use. Closes: #534529.
* debian/control:
  - bump debhelper level to 7.
  - add Vcs-Git: and Vcs-Browser:
  - bump Standards-Version: to 3.9.2.
  - add zlib1g-dev build dependency.
* debian/copyright: add missing copyright holders.
* debian/rules:
  - allow to be compiled twice in a row.
  - ensure package building aborts if a program is not installed.
  - use dh_prep instead of dh_clean -k.
* debian/dwarves.install:
  - include syscse. Closes: #517180.
  - add ctracer. See README.ctracer for information on how to use it.
* Switch to dpkg-source 3.0 (quilt) format.
* Fix many lintian warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#  DWARF_LIBRARIES   - List of libraries when using elf utils.
6
6
#  DWARF_FOUND       - True if fdo found.
7
7
 
 
8
message(STATUS "Checking availability of DWARF and ELF development libraries")
 
9
 
 
10
INCLUDE(CheckLibraryExists)
8
11
 
9
12
if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
10
13
        # Already in cache, be silent
25
28
)
26
29
 
27
30
set(DWARF_LIBRARY /usr/lib/libdw.so)
28
 
 
29
 
set(ELF_LIBRARY /usr/lib/libelf.a)
30
 
 
31
 
#set(EBL_LIBRARY /usr/lib/libebl.a)
 
31
set(ELF_LIBRARY /usr/lib/libelf.so)
32
32
 
33
33
if (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
34
34
        set(DWARF_FOUND TRUE)
35
 
        set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${DWARF_LIBRARY} ${ELF_LIBRARY})
 
35
        set(DWARF_LIBRARIES ${DWARF_LIBRARY} ${ELF_LIBRARY})
 
36
 
 
37
        set(CMAKE_REQUIRED_LIBRARIES ${DWARF_LIBRARIES})
 
38
        # check if libdw have the dwfl_module_build_id routine, i.e. if it supports the buildid
 
39
        # mechanism to match binaries to detached debug info sections (the -debuginfo packages
 
40
        # in distributions such as fedora). We do it against libelf because, IIRC, some distros
 
41
        # include libdw linked statically into libelf.
 
42
        check_library_exists(elf dwfl_module_build_id "" HAVE_DWFL_MODULE_BUILD_ID)
36
43
else (DWARF_INCLUDE_DIR AND LIBDW_INCLUDE_DIR AND DWARF_LIBRARY AND ELF_LIBRARY)
37
44
        set(DWARF_FOUND FALSE)
38
45
        set(DWARF_LIBRARIES)
44
51
                message(STATUS "Found elfutils/libdw.h header: ${LIBDW_INCLUDE_DIR}")
45
52
                message(STATUS "Found libdw library: ${DWARF_LIBRARY}")
46
53
                message(STATUS "Found libelf library: ${ELF_LIBRARY}")
47
 
                message(STATUS "Found libebl library: ${EBL_LIBRARY}")
48
54
        endif (NOT DWARF_FIND_QUIETLY)
49
55
else (DWARF_FOUND)
50
56
        if (DWARF_FIND_REQUIRED)
51
 
                if (NOT DWARF_INCLUDE_DIR)
52
 
                        message(FATAL_ERROR "Could NOT find dwarf include dir")
53
 
                endif (NOT DWARF_INCLUDE_DIR)
54
 
                if (NOT LIBDW_INCLUDE_DIR)
55
 
                        message(FATAL_ERROR "Could NOT find libdw include dir")
56
 
                endif (NOT LIBDW_INCLUDE_DIR)
57
 
                if (NOT DWARF_LIBRARY)
58
 
                        message(FATAL_ERROR "Could NOT find libdw library")
59
 
                endif (NOT DWARF_LIBRARY)
60
 
                if (NOT ELF_LIBRARY)
61
 
                        message(FATAL_ERROR "Could NOT find libelf library")
62
 
                endif (NOT ELF_LIBRARY)
63
 
                if (NOT EBL_LIBRARY)
64
 
                        message(FATAL_ERROR "Could NOT find libebl library")
65
 
                endif (NOT EBL_LIBRARY)
 
57
                # Check if we are in a Red Hat (RHEL) or Fedora system to tell
 
58
                # exactly which packages should be installed. Please send
 
59
                # patches for other distributions.
 
60
                find_path(FEDORA fedora-release /etc)
 
61
                find_path(REDHAT redhat-release /etc)
 
62
                if (FEDORA OR REDHAT)
 
63
                        if (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR)
 
64
                                message(STATUS "Please install the elfutils-devel package")
 
65
                        endif (NOT DWARF_INCLUDE_DIR OR NOT LIBDW_INCLUDE_DIR)
 
66
                        if (NOT DWARF_LIBRARY)
 
67
                                message(STATUS "Please install the elfutils-libs package")
 
68
                        endif (NOT DWARF_LIBRARY)
 
69
                        if (NOT ELF_LIBRARY)
 
70
                                message(STATUS "Please install the elfutils-libelf package")
 
71
                        endif (NOT ELF_LIBRARY)
 
72
                else (FEDORA OR REDHAT)
 
73
                        if (NOT DWARF_INCLUDE_DIR)
 
74
                                message(STATUS "Could NOT find dwarf include dir")
 
75
                        endif (NOT DWARF_INCLUDE_DIR)
 
76
                        if (NOT LIBDW_INCLUDE_DIR)
 
77
                                message(STATUS "Could NOT find libdw include dir")
 
78
                        endif (NOT LIBDW_INCLUDE_DIR)
 
79
                        if (NOT DWARF_LIBRARY)
 
80
                                message(STATUS "Could NOT find libdw library")
 
81
                        endif (NOT DWARF_LIBRARY)
 
82
                        if (NOT ELF_LIBRARY)
 
83
                                message(STATUS "Could NOT find libelf library")
 
84
                        endif (NOT ELF_LIBRARY)
 
85
                endif (FEDORA OR REDHAT)
 
86
                message(FATAL_ERROR "Could NOT find some ELF and DWARF libraries, please install the missing packages")
66
87
        endif (DWARF_FIND_REQUIRED)
67
88
endif (DWARF_FOUND)
68
89
 
69
 
mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY EBL_LIBRARY)
 
90
mark_as_advanced(DWARF_INCLUDE_DIR LIBDW_INCLUDE_DIR DWARF_LIBRARY ELF_LIBRARY)
70
91
include_directories(${DWARF_INCLUDE_DIR} ${LIBDW_INCLUDE_DIR})
 
92
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
 
93
 
 
94
message(STATUS "Checking availability of DWARF and ELF development libraries - done")