You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libr/ConfigureChecks.cmake

87 lines
2.4 KiB
CMake

#################################################
#
# (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}" )