Disable /Zend/tests/inter_06.php in repo mode
[hiphop-php.git] / CMake / FindLibElf.cmake
blob413401ea20eda0809531ff046bb81bd700fd7383
1 # - Try to find libelf
2 # Once done this will define
4 #  LIBELF_FOUND - system has libelf
5 #  LIBELF_INCLUDE_DIRS - the libelf include directory
6 #  LIBELF_LIBRARIES - Link these to use libelf
7 #  LIBELF_DEFINITIONS - Compiler switches required for using libelf
9 #  Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de>
11 #  Redistribution and use is allowed according to the terms of the New
12 #  BSD license.
13 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
17 if (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
18   set (LibElf_FIND_QUIETLY TRUE)
19 endif (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
21 find_path (LIBELF_INCLUDE_DIRS
22     NAMES
23       libelf.h
24     PATHS
25       /usr/include
26       /usr/include/libelf
27       /usr/local/include
28       /usr/local/include/libelf
29       /opt/local/include
30       /opt/local/include/libelf
31       /sw/include
32       /sw/include/libelf
33       ENV CPATH)
35 find_library (LIBELF_LIBRARIES
36     NAMES
37       elf
38     PATHS
39       /usr/lib
40       /usr/local/lib
41       /opt/local/lib
42       /sw/lib
43       ENV LIBRARY_PATH
44       ENV LD_LIBRARY_PATH)
46 include (FindPackageHandleStandardArgs)
49 # handle the QUIETLY and REQUIRED arguments and set LIBELF_FOUND to TRUE if all listed variables are TRUE
50 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf DEFAULT_MSG
51     LIBELF_LIBRARIES
52     LIBELF_INCLUDE_DIRS)
54 SET(CMAKE_REQUIRED_LIBRARIES elf)
55 INCLUDE(CheckCXXSourceCompiles)
56 CHECK_CXX_SOURCE_COMPILES("#include <libelf.h>
57 int main() {
58   Elf *e = (Elf*)0;
59   size_t sz;
60   elf_getshdrstrndx(e, &sz);
61   return 0;
62 }" ELF_GETSHDRSTRNDX)
64 mark_as_advanced(LIBELF_INCLUDE_DIRS LIBELF_LIBRARIES ELF_GETSHDRSTRNDX)