[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 02/02: cmake, gnutls.
From: |
gnunet |
Subject: |
[gnurl] 02/02: cmake, gnutls. |
Date: |
Fri, 22 Nov 2019 22:36:47 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 70745a84166af548bfec23bd1c504143a5393afc
Author: ng0 <address@hidden>
AuthorDate: Mon Nov 18 23:28:12 2019 +0000
cmake, gnutls.
---
CMake/FindGCrypt.cmake | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
CMake/FindIDN.cmake | 68 +++++++++++++++++++++++++++++++++++++++++++++++
CMake/FindIDN2.cmake | 69 +++++++++++++++++++++++++++++++++++++++++++++++
CMake/FindNettle.cmake | 23 ++++++++++++++++
CMakeLists.txt | 15 ++++++++++-
5 files changed, 246 insertions(+), 1 deletion(-)
diff --git a/CMake/FindGCrypt.cmake b/CMake/FindGCrypt.cmake
new file mode 100644
index 000000000..8fd6c9417
--- /dev/null
+++ b/CMake/FindGCrypt.cmake
@@ -0,0 +1,72 @@
+# - Try to find GCrypt
+# Once done this will define
+#
+# GCRYPT_FOUND - system has GCrypt
+# GCRYPT_INCLUDE_DIRS - the GCrypt include directory
+# GCRYPT_LIBRARIES - Link these to use GCrypt
+# GCRYPT_DEFINITIONS - Compiler switches required for using GCrypt
+#
+#=============================================================================
+# Copyright (c) 2009-2011 Andreas Schneider <address@hidden>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+#
+
+if (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS)
+ # in cache already
+ # set(GCRYPT_FOUND TRUE)
+else (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS)
+
+ set(_GCRYPT_ROOT_PATHS
+ "$ENV{PROGRAMFILES}/libgcrypt"
+ )
+
+ find_path(GCRYPT_ROOT_DIR
+ NAMES
+ include/gcrypt.h
+ PATHS
+ ${_GCRYPT_ROOT_PATHS}
+ )
+ #mark_as_advanced(ZLIB_ROOT_DIR)
+ mark_as_advanced(GCRYPT_ROOT_DIR)
+
+ find_path(GCRYPT_INCLUDE_DIR
+ NAMES
+ gcrypt.h
+ PATHS
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ /usr/lib/sfw/include
+ ${GCRYPT_ROOT_DIR}/include
+ )
+ set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR})
+
+ find_library(GCRYPT_LIBRARY
+ NAMES
+ gcrypt
+ gcrypt11
+ libgcrypt-11
+ PATHS
+ /opt/local/lib
+ /sw/lib
+ /usr/sfw/lib/64
+ /usr/sfw/lib
+ ${GCRYPT_ROOT_DIR}/lib
+ )
+ set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY})
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(GCrypt DEFAULT_MSG GCRYPT_LIBRARIES
GCRYPT_INCLUDE_DIRS)
+
+ # show the GCRYPT_INCLUDE_DIRS and GCRYPT_LIBRARIES variables only in the
advanced view
+ mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES)
+
+endif (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS)
+
diff --git a/CMake/FindIDN.cmake b/CMake/FindIDN.cmake
new file mode 100644
index 000000000..76921f776
--- /dev/null
+++ b/CMake/FindIDN.cmake
@@ -0,0 +1,68 @@
+# - Try to find idn
+# Once done this will define
+#
+# IDN_FOUND - system has idn
+# IDN_INCLUDE_DIRS - the idn include directory
+# IDN_LIBRARIES - Link these to use idn
+# IDN_DEFINITIONS - Compiler switches required for using idn
+#
+#=============================================================================
+# Copyright (c) 2019 ng0 <address@hidden>
+#
+# Distributed under the OSI-approved 0BSD License.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+#
+
+if (IDN_LIBRARIES AND IDN_INCLUDE_DIRS)
+ # in cache already
+ # set(IDN_FOUND TRUE)
+else (IDN_LIBRARIES AND IDN_INCLUDE_DIRS)
+
+ set(_IDN_ROOT_PATHS
+ "$ENV{PROGRAMFILES}/libidn"
+ )
+
+ find_path(IDN_ROOT_DIR
+ NAMES
+ include/idna.h
+ PATHS
+ ${_IDN_ROOT_PATHS}
+ )
+ mark_as_advanced(IDN_ROOT_DIR)
+
+ find_path(IDN_INCLUDE_DIR
+ NAMES
+ idna.h
+ PATHS
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ /usr/lib/sfw/include
+ ${IDN_ROOT_DIR}/include
+ )
+ set(IDN_INCLUDE_DIRS ${IDN_INCLUDE_DIR})
+
+ find_library(IDN_LIBRARY
+ NAMES
+ libidn
+ PATHS
+ /opt/local/lib
+ /sw/lib
+ /usr/sfw/lib/64
+ /usr/sfw/lib
+ ${IDN_ROOT_DIR}/lib
+ )
+ set(IDN_LIBRARIES ${IDN_LIBRARY})
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(IDN DEFAULT_MSG IDN_LIBRARIES
IDN_INCLUDE_DIRS)
+
+ # show the IDN_INCLUDE_DIRS and IDN_LIBRARIES variables only in the
advanced view
+ mark_as_advanced(IDN_INCLUDE_DIRS IDN_LIBRARIES)
+
+endif (IDN_LIBRARIES AND IDN_INCLUDE_DIRS)
+
diff --git a/CMake/FindIDN2.cmake b/CMake/FindIDN2.cmake
new file mode 100644
index 000000000..c7a85149d
--- /dev/null
+++ b/CMake/FindIDN2.cmake
@@ -0,0 +1,69 @@
+# - Try to find idn2
+# Once done this will define
+#
+# IDN2_FOUND - system has idn2
+# IDN2_INCLUDE_DIRS - the idn2 include directory
+# IDN2_LIBRARIES - Link these to use idn2
+# IDN2_DEFINITIONS - Compiler switches required for using idn2
+#
+#=============================================================================
+# Copyright (c) 2019 ng0 <address@hidden>
+#
+# Distributed under the OSI-approved 0BSD License.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+#
+
+if (IDN2_LIBRARIES AND IDN2_INCLUDE_DIRS)
+ # in cache already
+ # set(IDN2_FOUND TRUE)
+else (IDN2_LIBRARIES AND IDN2_INCLUDE_DIRS)
+
+ set(_IDN2_ROOT_PATHS
+ "$ENV{PROGRAMFILES}/libidn2"
+ )
+
+ find_path(IDN2_ROOT_DIR
+ NAMES
+ include/idn2.h
+ PATHS
+ ${_IDN2_ROOT_PATHS}
+ )
+ mark_as_advanced(IDN2_ROOT_DIR)
+
+ find_path(IDN2_INCLUDE_DIR
+ NAMES
+ idn2.h
+ idn2/idn2.h
+ PATHS
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ /usr/lib/sfw/include
+ ${IDN2_ROOT_DIR}/include
+ )
+ set(IDN2_INCLUDE_DIRS ${IDN2_INCLUDE_DIR})
+
+ find_library(IDN2_LIBRARY
+ NAMES
+ libidn2
+ PATHS
+ /opt/local/lib
+ /sw/lib
+ /usr/sfw/lib/64
+ /usr/sfw/lib
+ ${IDN2_ROOT_DIR}/lib
+ )
+ set(IDN2_LIBRARIES ${IDN2_LIBRARY})
+
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(IDN2 DEFAULT_MSG IDN2_LIBRARIES
IDN2_INCLUDE_DIRS)
+
+ # show the IDN2_INCLUDE_DIRS and IDN2_LIBRARIES variables only in the
advanced view
+ mark_as_advanced(IDN2_INCLUDE_DIRS IDN2_LIBRARIES)
+
+endif (IDN2_LIBRARIES AND IDN2_INCLUDE_DIRS)
+
diff --git a/CMake/FindNettle.cmake b/CMake/FindNettle.cmake
new file mode 100644
index 000000000..54ec9f5d3
--- /dev/null
+++ b/CMake/FindNettle.cmake
@@ -0,0 +1,23 @@
+# - Find Nettle
+# Find the Nettle include directory and library
+#
+# NETTLE_INCLUDE_DIR - where to find <nettle/sha.h>, etc.
+# NETTLE_LIBRARIES - List of libraries when using libnettle.
+# NETTLE_FOUND - True if libnettle found.
+
+IF (NETTLE_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(NETTLE_FIND_QUIETLY TRUE)
+ENDIF (NETTLE_INCLUDE_DIR)
+
+FIND_PATH(NETTLE_INCLUDE_DIR nettle/md5.h nettle/ripemd160.h nettle/sha.h)
+FIND_LIBRARY(NETTLE_LIBRARY NAMES nettle libnettle)
+
+# handle the QUIETLY and REQUIRED arguments and set NETTLE_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETTLE DEFAULT_MSG NETTLE_LIBRARY
NETTLE_INCLUDE_DIR)
+
+IF(NETTLE_FOUND)
+ SET(NETTLE_LIBRARIES ${NETTLE_LIBRARY})
+ENDIF(NETTLE_FOUND)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f4d38fbb..c476facad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -387,6 +387,19 @@ if(CMAKE_USE_GNUTLS)
list(APPEND GNURL_LIBS ${GNUTLS_LIBRARIES})
include_directories(${GNUTLS_INCLUDE_DIR})
set(USE_GNUTLS ON)
+ find_package(GCrypt)
+ find_package(Nettle)
+ if(NETTLE_FOUND)
+ check_library_exists_concat("nettle" nettle_MD5Init USE_GNUTLS_NETTLE)
+ list(APPEND GNURL_LIBS ${NETTLE_LIBRARIES})
+ include_directories(${NETTLE_INCLUDE_DIR})
+ # set(USE_GNUTLS_NETTLE ON)
+ else()
+ check_library_exists_concat("gcrypt" gcry_control USE_GNUTLS_GCRYPT)
+ list(APPEND GNURL_LIBS ${GCRYPT_LIBRARIES})
+ include_directories(${GCRYPT_INCLUDE_DIRS})
+ set(USE_GNUTLS_NETTLE OFF)
+ endif()
endif()
option(USE_NGHTTP2 "Use Nghttp2 library" OFF)
@@ -1059,7 +1072,7 @@ _add_if("Kerberos" NOT CURL_DISABLE_CRYPTO_AUTH AND
(HAVE_GSSAPI OR USE_WINDOWS_SSPI))
# NTLM support requires crypto function adaptions from various SSL libs
# TODO alternative SSL libs tests for SSP1, GNUTLS, NSS
-if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_WINDOWS_SSPI OR
USE_SECTRANSP OR USE_MBEDTLS))
+if(NOT CURL_DISABLE_CRYPTO_AUTH AND (USE_OPENSSL OR USE_WINDOWS_SSPI OR
USE_SECTRANSP OR USE_MBEDTLS OR USE_GNUTLS))
_add_if("NTLM" 1)
# TODO missing option (autoconf: --enable-ntlm-wb)
_add_if("NTLM_WB" NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED)
--
To stop receiving notification emails like this one, please contact
address@hidden.