Parcourir la source

Added test for compiling and linking against SSL libraries

John C. Frickson il y a 9 ans
Parent
commit
ec127ec55c
2 fichiers modifiés avec 51 ajouts et 5 suppressions
  1. 17 2
      build-aux/ax_nagios_get_ssl
  2. 34 3
      configure

+ 17 - 2
build-aux/ax_nagios_get_ssl

@@ -65,7 +65,8 @@ AC_SUBST(SSL_LIB_DIR)
 
 # Which type - openssl, gnutls-openssl, nss
 AC_ARG_WITH([ssl-type],
-	AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls or nss to use one of these instead of openssl]),
+dnl	AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls or nss to use one of these instead of openssl]),
+	AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls to use that instead of openssl]),
 	[SSL_TYPE=$withval])
 
 AC_ARG_WITH([ssl],
@@ -244,13 +245,27 @@ if test x$SSL_TYPE != xNONE; then
 		fi
 	fi
 
+	if test x$found_ssl = xyes ; then
+		# try to compile and link to see if SSL is set up properly
+		AC_MSG_CHECKING([whether compiling and linking against SSL works])
+
+		AC_LINK_IFELSE(
+			[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
+			[
+				AC_MSG_RESULT([yes])
+				$1
+			], [
+				AC_MSG_ERROR([no])
+				$2
+			])
+	fi
+
 	if test x$found_ssl = xyes -a x$need_dh = xyes; then
 
 		# Find the openssl program
 
 		if test x$need_dh = xyes; then
 			AC_PATH_PROG(sslbin,openssl,value-if-not-found,$ssl_dir/sbin$PATH_SEPARATOR$ssl_dir/bin$PATH_SEPARATOR$PATH)
-			#                   ^^^^^^^
 			AC_DEFINE(USE_SSL_DH)
 			# Generate DH parameters
 			if test -f "$sslbin"; then

+ 34 - 3
configure

@@ -1420,8 +1420,8 @@ Optional Packages:
   --with-logdir=DIR       where log files should be placed
   --with-piddir=DIR       where the PID file should be placed
   --with-pipedir=DIR      where socket and pipe files should be placed
-  --with-ssl-type=TYPE    replace TYPE with gnutls or nss to use one of these
-                          instead of openssl
+	  --with-ssl-type=TYPE    replace TYPE with gnutls to use that instead of
+                          openssl
   --with-ssl=DIR          sets location of the SSL installation
   --with-ssl-inc=DIR      sets location of the SSL include files
   --with-ssl-lib=DIR      sets location of the SSL libraries
@@ -7584,6 +7584,38 @@ _ACEOF
 		fi
 	fi
 
+	if test x$found_ssl = xyes ; then
+		# try to compile and link to see if SSL is set up properly
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiling and linking against SSL works" >&5
+$as_echo_n "checking whether compiling and linking against SSL works... " >&6; }
+
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <openssl/ssl.h>
+int
+main ()
+{
+SSL_new(NULL)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+else
+
+				as_fn_error $? "no" "$LINENO" 5
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	fi
+
 	if test x$found_ssl = xyes -a x$need_dh = xyes; then
 
 		# Find the openssl program
@@ -7630,7 +7662,6 @@ $as_echo "no" >&6; }
 fi
 
 
-			#                   ^^^^^^^
 			$as_echo "#define USE_SSL_DH 1" >>confdefs.h
 
 			# Generate DH parameters