Try to use OpenSSL if GnuTLS with openssl compatibility enabled is not

found.
This commit is contained in:
Carles Fernandez 2015-10-27 20:18:48 +01:00
parent d1e15734ca
commit e4206d38f6
7 changed files with 120 additions and 101 deletions

View File

@ -781,8 +781,28 @@ endif(NOT ARMADILLO_FOUND)
# GnuTLS - http://www.gnutls.org/
################################################################################
find_package(GnuTLS)
if(NOT GNUTLS_FOUND)
message(" The GnuTLS library has not been found.")
find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27
HINTS /usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/i386-linux-gnu
)
if(NOT GNUTLS_OPENSSL_LIBRARY)
message(STATUS "Looking for OpenSSL instead...")
find_package(OpenSSL)
if(OPENSSL_FOUND)
set(GNUTLS_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
set(GNUTLS_LIBRARIES "")
set(GNUTLS_OPENSSL_LIBRARY ${OPENSSL_SSL_LIBRARY})
else(OPENSSL_FOUND)
message(" The GnuTLS library with openssl compatibility enabled has not been found.")
message(" You can try to install it by typing:")
if(OS_IS_LINUX)
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
@ -794,8 +814,9 @@ if(NOT GNUTLS_FOUND)
if(OS_IS_MACOSX)
message(" sudo port install gnutls")
endif(OS_IS_MACOSX)
message(FATAL_ERROR "GnuTLS libraries are required to build gnss-sdr")
endif(NOT GNUTLS_FOUND)
message(FATAL_ERROR "GnuTLS libraries with openssl compatibility are required to build gnss-sdr")
endif(OPENSSL_FOUND)
endif(NOT GNUTLS_OPENSSL_LIBRARY)
################################################################################

View File

@ -18,6 +18,10 @@
add_subdirectory(supl)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
set(CORE_LIBS_SOURCES
ini.cc
INIReader.cc

View File

@ -23,6 +23,10 @@ set (SUPL_SOURCES
supl.c
)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/libs/supl
@ -38,31 +42,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_C_FLAGS}")
find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27
HINTS /usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/local/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabi
/usr/lib/i386-linux-gnu
)
if(NOT GNUTLS_OPENSSL_LIBRARY)
message(STATUS "The OpenSSL implementation provided by the GnuTLS library has not been found.")
if(OS_IS_LINUX)
message("Please install it by doing:")
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(FATAL_ERROR " sudo yum install libgnutls-openssl-devel")
else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(FATAL_ERROR " sudo apt-get install libgnutls-openssl-dev")
endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
endif(OS_IS_LINUX)
endif(NOT GNUTLS_OPENSSL_LIBRARY)
add_library (supl_library STATIC ${ASN_RRLP_SOURCES} ${ASN_SUPL_SOURCES} ${SUPL_SOURCES})
target_link_libraries (supl_library ${GNUTLS_LIBRARIES} ${GNUTLS_OPENSSL_LIBRARY} gnss_system_parameters)
set_target_properties(supl_library PROPERTIES LINKER_LANGUAGE C)

View File

@ -83,6 +83,10 @@ if(Boost_VERSION LESS 105000)
add_definitions(-DOLD_BOOST=1)
endif(Boost_VERSION LESS 105000)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
if(ENABLE_GN3S)
add_definitions(-DGN3S_DRIVER=1)
endif(ENABLE_GN3S)

View File

@ -33,6 +33,10 @@ if(ENABLE_UHD)
set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${UHD_INCLUDE_DIRS})
endif(ENABLE_UHD)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
if(ENABLE_CUDA)
add_definitions(-DCUDA_GPU_ACCEL=1)
set(GNSS_SDR_OPTIONAL_LIBS ${GNSS_SDR_OPTIONAL_LIBS} ${CUDA_LIBRARIES})

View File

@ -97,6 +97,10 @@ if(Boost_VERSION LESS 105000)
add_definitions(-DOLD_BOOST=1)
endif(Boost_VERSION LESS 105000)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
include_directories(
${GTEST_INCLUDE_DIRECTORIES}
${CMAKE_SOURCE_DIR}/src/core/system_parameters

View File

@ -17,7 +17,10 @@
#
#if(ENABLE_OSMOSDR)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
set(FRONT_END_CAL_SOURCES front_end_cal.cc)
include_directories(
@ -99,4 +102,4 @@
install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1)
endif(NOT GZIP_NOTFOUND)
#endif(ENABLE_OSMOSDR)