summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 10 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e7bbf15..4b90b14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@ set( PACKAGE_VERSION 0.7.0 )
include( FindPkgConfig )
include( FindThreads )
+include( CheckCSourceCompiles )
include( CheckIncludeFile )
include( CheckFunctionExists )
include( CheckLibraryExists )
@@ -59,26 +60,20 @@ option( WITH_GTK "Build support for GTK" OFF )
#### configure checks ###########################
if( WITH_BACKEND_LIBBFD )
- message( STATUS "Checking linker version" )
- execute_process(
- COMMAND ${CMAKE_LINKER} --version
- OUTPUT_VARIABLE _linker_version
- ERROR_VARIABLE _linker_version
- )
- string( REGEX REPLACE "^GNU [^\n]* ([^ ]*)\n.*" "\\1" LINKER_VERSION ${_linker_version} )
- string( REGEX MATCH "^([0-9]+)\\.([0-9]+)(\\.([0-9]+))?.*" LINKER_VERSION_MATCH ${LINKER_VERSION} )
- math( EXPR LINKER_VERSION_MAJOR "${CMAKE_MATCH_1}+0" )
- math( EXPR LINKER_VERSION_MINOR "${CMAKE_MATCH_2}+0" )
- math( EXPR LINKER_VERSION_PATCH "${CMAKE_MATCH_4}+0" )
- math( EXPR LINKER_VERSION_C "(${LINKER_VERSION_MAJOR}*1000000) + (${LINKER_VERSION_MINOR}*1000) + ${LINKER_VERSION_PATCH}" )
- set( LINKER_VERSION_C ${LINKER_VERSION_C} CACHE INTERNAL "Linker version as code number" )
- message( STATUS "Checking linker version - ${LINKER_VERSION}" )
-
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" )