Prefer pkg-config for gpgme and gpg-error detection.

Use LARGEFILES_DEFINITIONS instead of hard-coded _FILE_OFFSET_BITS=64.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 29a136eee1)
r14.0.x r14.0.13
Slávek Banko 2 years ago
parent 11226549a5
commit afb8ab8526
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -67,88 +67,90 @@ if( WITH_GNOKII AND (BUILD_KADDRESSBOOK OR BUILD_KMOBILE) )
endif( ) endif( )
if( BUILD_LIBTDENETWORK OR BUILD_CERTMANAGER OR BUILD_KMAIL OR BUILD_KADDRESSBOOK OR BUILD_KONTACT ) if( (BUILD_LIBTDENETWORK OR BUILD_CERTMANAGER OR BUILD_KMAIL OR BUILD_KADDRESSBOOK OR BUILD_KONTACT) AND NOT HAVE_GPGME_0_4_BRANCH )
if( NOT HAVE_GPGME_0_4_BRANCH ) message( STATUS "checking for 'gpgme'" )
message( STATUS "checking for 'gpgme'" )
endif( )
# find gpgme-config # check for gpgme
find_program( GPGME_EXECUTABLE NAMES gpgme-config ) pkg_search_module( GPGME gpgme )
if( NOT GPGME_EXECUTABLE ) if( NOT GPGME_FOUND )
tde_message_fatal( "gpgme-config was NOT found.\n gpgme library is installed?" )
endif( )
# find gpg-error-config # find gpgme-config
find_program( GPG_ERR_EXECUTABLE NAMES gpgrt-config gpg-error-config ) find_program( GPGME_EXECUTABLE NAMES gpgme-config )
if( NOT GPG_ERR_EXECUTABLE ) if( NOT GPGME_EXECUTABLE )
tde_message_fatal( "gpgrt-config or gpg-error-config was NOT found.\n gpg-error library is installed?" ) tde_message_fatal( "gpgme-config was NOT found.\n gpgme library is installed?" )
endif( ) endif( )
macro( __run_gpgme_config __type __var ) macro( __run_gpgme_config __type __var )
execute_process( execute_process(
COMMAND ${GPGME_EXECUTABLE} --${__type} COMMAND ${GPGME_EXECUTABLE} --${__type}
OUTPUT_VARIABLE ${__var} OUTPUT_VARIABLE ${__var}
RESULT_VARIABLE __result RESULT_VARIABLE __result
OUTPUT_STRIP_TRAILING_WHITESPACE ) OUTPUT_STRIP_TRAILING_WHITESPACE )
if( _result ) if( _result )
tde_message_fatal( "Unable to run ${GPGME_EXECUTABLE}!\n gpgme library incorrectly installed?\n Path to gpgme-config incorrect?" ) tde_message_fatal( "Unable to run ${GPGME_EXECUTABLE}!\n gpgme library incorrectly installed?\n Path to gpgme-config incorrect?" )
endif( )
endmacro( )
__run_gpgme_config( version GPGME_VERSION )
__run_gpgme_config( cflags GPGME_INCLUDE_DIRS )
__run_gpgme_config( libs GPGME_LIBRARIES )
if( GPGME_INCLUDE_DIRS )
string( REGEX REPLACE "(^| +)-I" ";" GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS}" )
endif( ) endif( )
endmacro( ) if( GPGME_LIBRARIES )
string( REGEX REPLACE "(^| +)-l" ";" GPGME_LIBRARIES "${GPGME_LIBRARIES}" )
macro( __run_gpgerr_config __type __var )
execute_process(
COMMAND ${GPG_ERR_EXECUTABLE} --${__type}
OUTPUT_VARIABLE ${__var}
RESULT_VARIABLE __result
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( _result )
tde_message_fatal( "Unable to run ${GPG_ERR_EXECUTABLE}!\n gpg-error library incorrectly installed?\n Path to gpgme-config are incorrect?" )
endif( ) endif( )
endmacro( )
__run_gpgme_config( version GPGME_VERSION ) endif()
__run_gpgme_config( cflags GPGME_INCLUDE_DIRS )
__run_gpgme_config( libs GPGME_LIBRARIES )
__run_gpgerr_config( version GPGERR_VERSION ) # check for gpg-error
__run_gpgerr_config( cflags GPGERR_INCLUDE_DIRS ) pkg_search_module( GPGERR gpg-error )
__run_gpgerr_config( libs GPGERR_LIBRARIES ) if( NOT GPGERR_FOUND )
# cleanup # find gpg-error-config
if( GPGME_INCLUDE_DIRS ) find_program( GPG_ERR_EXECUTABLE NAMES gpgrt-config gpg-error-config )
string( REGEX REPLACE "(^| +)-I" ";" GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS}" ) if( NOT GPG_ERR_EXECUTABLE )
endif( ) tde_message_fatal( "gpgrt-config or gpg-error-config was NOT found.\n gpg-error library is installed?" )
if( GPGME_LIBRARIES ) endif( )
string( REGEX REPLACE "(^| +)-l" ";" GPGME_LIBRARIES "${GPGME_LIBRARIES}" )
endif( )
if( GPGERR_INCLUDE_DIRS )
string( REGEX REPLACE "(^| +)-I" ";" GPGERR_INCLUDE_DIRS "${GPGERR_INCLUDE_DIRS}" )
endif( )
if( GPGERR_LIBRARIES )
string( REGEX REPLACE "(^| +)-l" ";" GPGERR_LIBRARIES "${GPGERR_LIBRARIES}" )
endif( )
set( GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS};${GPGERR_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
set( GPGME_LIBRARIES "${GPGME_LIBRARIES};${GPGERR_LIBRARIES}" CACHE INTERNAL "" FORCE )
# assuming that all newer system have gpgme >= 0.4 macro( __run_gpgerr_config __type __var )
set( HAVE_GPGME_0_4_BRANCH 1 CACHE INTERNAL "" ) execute_process(
COMMAND ${GPG_ERR_EXECUTABLE} --${__type}
OUTPUT_VARIABLE ${__var}
RESULT_VARIABLE __result
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( _result )
tde_message_fatal( "Unable to run ${GPG_ERR_EXECUTABLE}!\n gpg-error library incorrectly installed?\n Path to gpgme-config are incorrect?" )
endif( )
endmacro( )
__run_gpgerr_config( version GPGERR_VERSION )
__run_gpgerr_config( cflags GPGERR_INCLUDE_DIRS )
__run_gpgerr_config( libs GPGERR_LIBRARIES )
if( GPGERR_INCLUDE_DIRS )
string( REGEX REPLACE "(^| +)-I" ";" GPGERR_INCLUDE_DIRS "${GPGERR_INCLUDE_DIRS}" )
endif( )
if( GPGERR_LIBRARIES )
string( REGEX REPLACE "(^| +)-l" ";" GPGERR_LIBRARIES "${GPGERR_LIBRARIES}" )
endif( )
# NOTE: assume we have largefile support (need for gpgme) endif()
# FIXME: to be sure, we must check it
add_definitions( -D_FILE_OFFSET_BITS=64 )
if( NOT HAVE_GPGME_0_4_BRANCH ) # assuming that all newer system have gpgme >= 0.4
message( STATUS " found 'gpgme', version ${GPGME_VERSION}" ) set( GPGME_INCLUDE_DIRS "${GPGME_INCLUDE_DIRS};${GPGERR_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
endif( ) set( GPGME_LIBRARIES "${GPGME_LIBRARIES};${GPGERR_LIBRARIES}" CACHE INTERNAL "" FORCE )
set( HAVE_GPGME_0_4_BRANCH 1 CACHE INTERNAL "" )
message( STATUS " found 'gpgme', version ${GPGME_VERSION}" )
# check for various GPGME features # check for various GPGME features
tde_save( CMAKE_CXX_FLAGS ) tde_save( CMAKE_CXX_FLAGS )
tde_save( CMAKE_REQUIRED_INCLUDES ) tde_save( CMAKE_REQUIRED_INCLUDES )
tde_save( CMAKE_REQUIRED_LIBRARIES ) tde_save( CMAKE_REQUIRED_LIBRARIES )
string( REGEX REPLACE "-include tqt.h" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" ) string( REGEX REPLACE "-include tqt.h" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
# See FIXME above regarding -D_FILE_OFFSET_BITS=64 set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LARGEFILES_DEFINITIONS}")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64")
set( CMAKE_REQUIRED_INCLUDES "${GPGME_INCLUDE_DIRS}") set( CMAKE_REQUIRED_INCLUDES "${GPGME_INCLUDE_DIRS}")
set( CMAKE_REQUIRED_LIBRARIES "${GPGME_LIBRARIES}") set( CMAKE_REQUIRED_LIBRARIES "${GPGME_LIBRARIES}")

Loading…
Cancel
Save