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,21 +781,42 @@ endif(NOT ARMADILLO_FOUND)
# GnuTLS - http://www.gnutls.org/ # GnuTLS - http://www.gnutls.org/
################################################################################ ################################################################################
find_package(GnuTLS) find_package(GnuTLS)
if(NOT GNUTLS_FOUND) find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27
message(" The GnuTLS library has not been found.") HINTS /usr/lib
message(" You can try to install it by typing:") /usr/lib64
if(OS_IS_LINUX) /usr/local/lib
if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") /usr/local/lib64
message(" sudo yum install libgnutls-openssl-devel") /opt/local/lib
else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") /usr/lib/x86_64-linux-gnu
message(" sudo apt-get install libgnutls-openssl-dev") /usr/lib/aarch64-linux-gnu
endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") /usr/lib/arm-linux-gnueabihf
endif(OS_IS_LINUX) /usr/lib/arm-linux-gnueabi
if(OS_IS_MACOSX) /usr/lib/i386-linux-gnu
message(" sudo port install gnutls") )
endif(OS_IS_MACOSX)
message(FATAL_ERROR "GnuTLS libraries are required to build gnss-sdr") if(NOT GNUTLS_OPENSSL_LIBRARY)
endif(NOT GNUTLS_FOUND) 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")
message(" sudo yum install libgnutls-openssl-devel")
else(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
message(" sudo apt-get install libgnutls-openssl-dev")
endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat")
endif(OS_IS_LINUX)
if(OS_IS_MACOSX)
message(" sudo port install gnutls")
endif(OS_IS_MACOSX)
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) add_subdirectory(supl)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
set(CORE_LIBS_SOURCES set(CORE_LIBS_SOURCES
ini.cc ini.cc
INIReader.cc INIReader.cc

View File

@ -23,6 +23,10 @@ set (SUPL_SOURCES
supl.c supl.c
) )
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/libs/supl ${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") endif(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MY_C_FLAGS}") 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}) 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) target_link_libraries (supl_library ${GNUTLS_LIBRARIES} ${GNUTLS_OPENSSL_LIBRARY} gnss_system_parameters)
set_target_properties(supl_library PROPERTIES LINKER_LANGUAGE C) 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) add_definitions(-DOLD_BOOST=1)
endif(Boost_VERSION LESS 105000) endif(Boost_VERSION LESS 105000)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
if(ENABLE_GN3S) if(ENABLE_GN3S)
add_definitions(-DGN3S_DRIVER=1) add_definitions(-DGN3S_DRIVER=1)
endif(ENABLE_GN3S) endif(ENABLE_GN3S)

View File

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

View File

@ -96,6 +96,10 @@ endif(ENABLE_GPERFTOOLS)
if(Boost_VERSION LESS 105000) if(Boost_VERSION LESS 105000)
add_definitions(-DOLD_BOOST=1) add_definitions(-DOLD_BOOST=1)
endif(Boost_VERSION LESS 105000) endif(Boost_VERSION LESS 105000)
if(OPENSSL_FOUND)
add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
include_directories( include_directories(
${GTEST_INCLUDE_DIRECTORIES} ${GTEST_INCLUDE_DIRECTORIES}

View File

@ -17,74 +17,77 @@
# #
#if(ENABLE_OSMOSDR) if(OPENSSL_FOUND)
set(FRONT_END_CAL_SOURCES front_end_cal.cc) add_definitions( -DUSE_OPENSSL_FALLBACK=1 )
endif(OPENSSL_FOUND)
include_directories( set(FRONT_END_CAL_SOURCES front_end_cal.cc)
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${CMAKE_SOURCE_DIR}/src/core/libs
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/adapters
${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_BLOCKS_INCLUDE_DIRS}
${ARMADILLO_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${VOLK_GNSSSDR_INCLUDE_DIRS}
)
file(GLOB FRONT_END_CAL_HEADERS "*.h") include_directories(
add_library(front_end_cal_lib ${FRONT_END_CAL_SOURCES} ${FRONT_END_CAL_HEADERS}) ${CMAKE_SOURCE_DIR}/src/core/system_parameters
source_group(Headers FILES ${FRONT_END_CAL_HEADERS}) ${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/core/receiver
${CMAKE_SOURCE_DIR}/src/core/libs
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/adapters
${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_BLOCKS_INCLUDE_DIRS}
${ARMADILLO_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${VOLK_GNSSSDR_INCLUDE_DIRS}
)
target_link_libraries(front_end_cal_lib ${Boost_LIBRARIES} file(GLOB FRONT_END_CAL_HEADERS "*.h")
${GNURADIO_RUNTIME_LIBRARIES} add_library(front_end_cal_lib ${FRONT_END_CAL_SOURCES} ${FRONT_END_CAL_HEADERS})
${GNURADIO_BLOCKS_LIBRARIES} source_group(Headers FILES ${FRONT_END_CAL_HEADERS})
${GFlags_LIBS}
${GLOG_LIBRARIES} target_link_libraries(front_end_cal_lib ${Boost_LIBRARIES}
${ARMADILLO_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}
gnss_rx ${GFlags_LIBS}
gnss_sp_libs ${GLOG_LIBRARIES}
) ${ARMADILLO_LIBRARIES}
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
gnss_rx
gnss_sp_libs
)
add_dependencies(front_end_cal_lib glog-${glog_RELEASE} armadillo-${armadillo_RELEASE}) add_dependencies(front_end_cal_lib glog-${glog_RELEASE} armadillo-${armadillo_RELEASE})
add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) add_definitions( -DGNSS_SDR_VERSION="${VERSION}" )
add_definitions( -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}" ) add_definitions( -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}" )
add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) add_executable(front-end-cal ${CMAKE_CURRENT_SOURCE_DIR}/main.cc)
add_custom_command(TARGET front-end-cal POST_BUILD add_custom_command(TARGET front-end-cal POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:front-end-cal> COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:front-end-cal>
${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:front-end-cal>) ${CMAKE_SOURCE_DIR}/install/$<TARGET_FILE_NAME:front-end-cal>)
target_link_libraries(front-end-cal ${GNURADIO_RUNTIME_LIBRARIES} target_link_libraries(front-end-cal ${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${GFlags_LIBS} ${GFlags_LIBS}
${GLOG_LIBRARIES} ${GLOG_LIBRARIES}
${ARMADILLO_LIBRARIES} ${ARMADILLO_LIBRARIES}
gnss_rx gnss_rx
gnss_sp_libs gnss_sp_libs
front_end_cal_lib front_end_cal_lib
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
) )
install(TARGETS front-end-cal install(TARGETS front-end-cal
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
COMPONENT "front-end-cal" COMPONENT "front-end-cal"
) )
find_program(GZIP gzip find_program(GZIP gzip
/bin /bin
/usr/bin /usr/bin
/usr/local/bin /usr/local/bin
@ -92,11 +95,11 @@
/sbin /sbin
) )
if(NOT GZIP_NOTFOUND) if(NOT GZIP_NOTFOUND)
execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/front-end-cal-manpage execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/front-end-cal-manpage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/front-end-cal.1.gz") WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/front-end-cal.1.gz")
install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1)
endif(NOT GZIP_NOTFOUND)
install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1)
endif(NOT GZIP_NOTFOUND)
#endif(ENABLE_OSMOSDR)