blob: 3590495b960caad85b316bd8ead86717877f8c7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#################################################
#
# (C) 2014 Slávek Banko
# slavek (DOT) banko (AT) axis.cz
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
# required stuff
tde_setup_compiler_flags( )
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
tde_setup_largefiles( )
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( )
# check backend
if( WITH_BACKEND_LIBBFD )
tde_save_and_set( CMAKE_REQUIRED_DEFINITIONS "-DPACKAGE" "-DPACKAGE_VERSION" )
check_include_file( bfd.h HAVE_BFD_H )
if( NOT HAVE_BFD_H )
tde_message_fatal( "Could not find libbfd header file (bfd.h)!\nThis file is usually included in the package binutils-dev." )
endif( NOT HAVE_BFD_H )
tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "bfd" )
check_symbol_exists( bfd_asymbol_section bfd.h HAVE_BFD_2_34 )
check_c_source_compiles(
"#include <bfd.h>
int main() { bfd *ihandle, *ohandle; asection *iscn, *oscn;
bfd_copy_private_section_data(ihandle, iscn, ohandle, oscn, NULL);
}"
HAVE_BFD_2_45)
tde_restore( CMAKE_REQUIRED_LIBRARIES )
tde_restore( CMAKE_REQUIRED_DEFINITIONS )
set( BACKEND_LIBRARIES "-lbfd" )
set( LIBR_BACKEND "bfd" )
set( BACKEND_NAME "libbfd" )
check_include_file( libiberty.h HAVE_LIBIBERTY_H )
if( HAVE_LIBIBERTY_H )
list( APPEND BACKEND_LIBRARIES "-liberty" )
endif( HAVE_LIBIBERTY_H )
elseif( WITH_BACKEND_LIBELF )
# Is libelf 0.8.2 safe enough? testing is currently on 0.8.6
pkg_search_module( BACKEND libelf>=0.8.2 )
if( NOT BACKEND_FOUND )
tde_message_fatal( "libelf >= 0.8.2 are required, but not found on your system" )
endif( NOT BACKEND_FOUND )
set( LIBR_BACKEND "elf" )
set( BACKEND_NAME "libelf" )
elseif( WITH_BACKEND_READONLY )
set( BACKEND_NAME "readonly" )
set( LIBR_BACKEND "ro" )
else( )
tde_message_fatal( "Backend is not selected, cannot build." )
endif( )
# check other libraries
find_package( ZLIB )
if( NOT ZLIB_FOUND )
tde_message_fatal( "zlib are required, but not found on your system" )
endif( NOT ZLIB_FOUND )
if( WITH_GTK )
pkg_search_module( GTK gtk+-2.0 )
if( NOT GTK_FOUND )
tde_message_fatal( "gtk2 is required but was not found on your system" )
endif( )
endif( WITH_GTK )
message( STATUS "Ready to build with backend ${BACKEND_NAME}" )
|