Browse Source

Changes for SSL portability. Also uses pgk-config if available.

John C. Frickson 9 years ago
parent
commit
71568528d9
8 changed files with 240 additions and 104 deletions
  1. 1 0
      .gitignore
  2. 0 3
      Makefile.in
  3. 189 62
      configure
  4. 1 0
      configure.ac
  5. 4 0
      include/common.h.in
  6. 0 11
      include/config.h.in
  7. 45 27
      macros/ax_nagios_get_ssl
  8. 0 1
      src/nrpe.c

+ 1 - 0
.gitignore

@@ -2,6 +2,7 @@ Makefile
 config.log
 config.status
 include/config.h
+include/common.h
 include/dh.h
 nrpe.spec
 paths

+ 0 - 3
Makefile.in

@@ -57,7 +57,6 @@ default:
 	echo "     install-config       install the nrpe configuration file";\
 	echo "     install-inetd        install the startup files for inetd, launchd, etc.";\
 	echo "     install-init         install the startup files for init, systemd, etc.";\
-	echo "     solaris-package      create the solaris package";\
 	echo
 
 all:
@@ -174,13 +173,11 @@ install-groups-users:
 
 clean:
 	cd $(SRC_BASE); $(MAKE) $@; cd ..
-	cd package/solaris; $(MAKE) $@; cd ../..
 	rm -f core
 	rm -f *~ */*~
 
 distclean: clean
 	cd $(SRC_BASE); $(MAKE) $@; cd ..
-	cd package/solaris; $(MAKE) $@; cd ../..
 	rm -rf autom4te.cache
 	rm -f config.log config.status config.cache sample-config/nrpe.cfg $(SRC_INCLUDE)/config.h
 	rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd

+ 189 - 62
configure

@@ -625,7 +625,10 @@ ac_includes_default="\
 
 ac_subst_vars='PERL
 sslbin
+PKG_CONFIG
 SSL_LIB_DIR
+SSL_INC_PREFIX
+SSL_HDR
 SSL_INC_DIR
 HAVE_SSL
 EGREP
@@ -640,13 +643,10 @@ CFLAGS
 CC
 LTLIBOBJS
 LIBOBJS
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
 bsd_enable
+src_tmpfile
 src_inetd
 src_init
-src_tmpfile
 subsyslockfile
 subsyslockdir
 tmpfilesd
@@ -672,6 +672,9 @@ dist_ver
 dist_type
 arch
 opsys
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
 TARGET_PLATFORM
 TARGET_ARCH
 TARGET_OS
@@ -2517,36 +2520,6 @@ LC_TIME=C
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 
@@ -2647,6 +2620,10 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 
+
+
+
+
 #
 # Get user hints
 #
@@ -2721,6 +2698,10 @@ esac
 $as_echo "$opsys" >&6; }
 
 
+
+
+
+
 #
 # Get user hints for possible cross-compile
 #
@@ -2838,6 +2819,9 @@ esac
 $as_echo "$dist_type" >&6; }
 
 
+
+
+
 #
 # Get user hints for possible cross-compile
 #
@@ -2989,6 +2973,9 @@ esac
 $as_echo "$init_type" >&6; }
 
 
+
+
+
 #
 # Get user hints for possible cross-compile
 #
@@ -3088,6 +3075,27 @@ $as_echo "$inetd_type" >&6; }
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 if test x$DBG_PATHS != x; then
 	echo
 	echo Incoming paths:
@@ -3779,6 +3787,11 @@ $as_echo "$install_method" >&6; }
 
 
 
+
+
+
+
+
 src_inetd=""
 src_init=""
 bsd_enable=""
@@ -4949,7 +4962,7 @@ fi
 
 ac_config_headers="$ac_config_headers include/config.h"
 
-ac_config_files="$ac_config_files Makefile src/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist startup/newbsd-init startup/openbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init"
+ac_config_files="$ac_config_files Makefile src/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist startup/newbsd-init startup/openbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init include/common.h"
 
 
 ac_ext=c
@@ -7264,10 +7277,13 @@ if test x$check_for_ssl = xyes; then
 # -------------------------------
 
 SSL_TYPE=openssl
+try_pkg_config=0
 ssl_dir=
 ssl_inc_dir=
 ssl_lib_dir=
 SSL_INC_DIR=
+SSL_INC_PREFIX=
+SSL_HDR=
 SSL_LIB_DIR=
 
 
@@ -7275,6 +7291,8 @@ SSL_LIB_DIR=
 
 
 
+
+
 # gnutls/openssl.h
 # nss_compat_ossl/nss_compat_ossl.h
 
@@ -7305,6 +7323,10 @@ if test "${with_ssl_lib+set}" = set; then :
 fi
 
 
+if test x$ssl_inc_dir != x -o x$ssl_lib_dir != x; then
+	try_pkg_config=0
+fi
+
 
 # Check whether --with-kerberos-inc was given.
 if test "${with_kerberos_inc+set}" = set; then :
@@ -7317,8 +7339,8 @@ if test x$SSL_TYPE = xyes; then
 fi
 
 
-dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_dir/include $ssl_dir/include \
-			/usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include{BBB} \
+dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_inc_dir/include $ssl_dir/include \
+			/usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include/{BBB} \
 			/usr/local/{AAA} /usr/local/{BBB} /usr/lib/{AAA} /usr/lib/{BBB} \
 			/usr/{AAA} /usr/pkg /usr/local /usr /usr/freeware/lib/{BBB} \
 			/usr/sfw /usr/sfw/include /opt/{BBB}"
@@ -7337,17 +7359,19 @@ case $SSL_TYPE in #(
   yes|openssl) :
     ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
 		 ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
-		 ssl_hdr=ssl.h
+		 SSL_INC_PREFIX=openssl
+		 SSL_HDR=ssl.h
 		 ssl_lib=libssl ;; #(
   gnutls) :
     ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
 		 ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
-		 ssl_hdr=compat.h
+		 SSL_INC_PREFIX=gnutls
+		 SSL_HDR=compat.h
 		 ssl_lib=libgnutls ;; #(
   nss) :
     ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
 		 ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
-		 ssl_hdr=nss_compat_ossl.h
+		 SSL_HDR=nss_compat_ossl.h
 		 ssl_lib=libnss_compat ;; #(
   *) :
     echo >&6; as_fn_error $? "'--with-ssl-type=$SSL_TYPE' is invalid" "$LINENO" 5
@@ -7393,49 +7417,147 @@ $as_echo "found Kerberos include files in $kerbdir" >&6; }
 	fi
 
 	# First, try using pkg_config
-#	AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
-#	if test x"$PKG_CONFIG" != x ; then
-#		cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
-#		if test $? = 0; then
-#			CFLAGS="$CFLAGS $cflags"
-#			LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
-#			LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
-#			found_ssl=yes
-#			AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
-#		fi
-#	fi
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PKG_CONFIG"; then
+  ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+PKG_CONFIG=$ac_cv_prog_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_PKG_CONFIG"; then
+  ac_ct_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_PKG_CONFIG"; then
+  ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG
+if test -n "$ac_ct_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PKG_CONFIG" >&5
+$as_echo "$ac_ct_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_ct_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_prog_PKG_CONFIG"
+fi
+
+	if test x"$PKG_CONFIG" != x -a $try_pkg_config -ne 0 ; then
+		cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
+		if test $? = 0; then
+			CFLAGS="$CFLAGS $cflags"
+			LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
+			LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
+			found_ssl=yes
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SSL 1
+_ACEOF
+
+		fi
+	fi
 
 	if test x_$found_ssl != x_yes; then
 
 		# Find the SSL Headers
-
 		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL headers" >&5
 $as_echo_n "checking for SSL headers... " >&6; }
 		for dir in $ssl_hdr_dirs; do
+			if test "$dir" = "/include"; then
+				continue
+			fi
 			ssldir="$dir"
-			if test -f "$dir/include/openssl/$ssl_hdr"; then
+			if test -f "$dir/include/$SSL_INC_PREFIX/$SSL_HDR"; then
 				found_ssl=yes
-				CFLAGS="$CFLAGS -I$dir/include/openssl -I$ssldir/include"
-				SSL_INC_DIR="$dir/include/openssl"
+				CFLAGS="$CFLAGS -I$dir/include/$SSL_INC_PREFIX -I$ssldir/include"
+				SSL_INC_DIR="$dir/include/$SSL_INC_PREFIX"
 				break
 			fi
-			if test -f "$dir/include/$ssl_hdr"; then
+			if test -f "$dir/include/$SSL_HDR"; then
 				found_ssl=yes
+				SSL_INC_PREFIX=""
 				CFLAGS="$CFLAGS -I$dir/include"
 				SSL_INC_DIR="$dir/include"
 				break
 			fi
-			if test -f "$dir/$ssl_hdr"; then
+			if test -f "$dir/$SSL_HDR"; then
 				found_ssl=yes
+				SSL_INC_PREFIX=""
 				CFLAGS="$CFLAGS -I$dir"
 				SSL_INC_DIR="$dir"
-				ssldir="$dir/.."
 				break
 			fi
-			if test -f "$dir/openssl/$ssl_hdr"; then
+			if test -f "$dir/$SSL_INC_PREFIX/$SSL_HDR"; then
 				found_ssl=yes
-				CFLAGS="$CFLAGS -I$dir/openssl"
-				SSL_INC_DIR="$dir/openssl"
+				CFLAGS="$CFLAGS -I$dir/$SSL_INC_PREFIX"
+				SSL_INC_DIR="$dir/$SSL_INC_PREFIX"
 				ssldir="$dir/.."
 				break
 			fi
@@ -7494,13 +7616,17 @@ _ACEOF
 	fi
 
 	if test x$found_ssl = xyes ; then
+		if test -n "$SSL_INC_PREFIX" ; then
+			SSL_INC_PREFIX="${SSL_INC_PREFIX}/"
+		fi
+
 		# 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>
+#include <${SSL_INC_PREFIX}${SSL_HDR}>
 int
 main ()
 {
@@ -8349,6 +8475,7 @@ do
     "startup/tmpfile.conf") CONFIG_FILES="$CONFIG_FILES startup/tmpfile.conf" ;;
     "startup/upstart-init") CONFIG_FILES="$CONFIG_FILES startup/upstart-init" ;;
     "startup/rh-upstart-init") CONFIG_FILES="$CONFIG_FILES startup/rh-upstart-init" ;;
+    "include/common.h") CONFIG_FILES="$CONFIG_FILES include/common.h" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac

+ 1 - 0
configure.ac

@@ -98,6 +98,7 @@ AC_CONFIG_FILES([Makefile
 	startup/tmpfile.conf
 	startup/upstart-init
 	startup/rh-upstart-init
+	include/common.h
 ])
 
 dnl Checks for programs.

+ 4 - 0
include/common.h → include/common.h.in

@@ -23,6 +23,10 @@
 
 #include "config.h"
 
+#ifdef HAVE_SSL
+#include <@SSL_INC_PREFIX@@SSL_HDR@>
+#endif
+
 #define PROGRAM_VERSION "nrpe-3.0-PRE2"
 #define MODIFICATION_DATE "06-07-2016"
 

+ 0 - 11
include/config.h.in

@@ -242,17 +242,6 @@ typedef int int32_t;
 #endif
 
 #undef HAVE_SSL
-#ifdef HAVE_SSL
-#include <rsa.h>
-#include <crypto.h>
-# ifdef USE_SSL_DH
-#include <dh.h>
-# endif
-#include <pem.h>
-#include <ssl.h>
-#include <err.h>
-#include <rand.h>
-#endif
 
 #undef HAVE_KRB5_H
 #ifdef HAVE_KRB5_H

+ 45 - 27
macros/ax_nagios_get_ssl

@@ -49,14 +49,19 @@ AC_DEFUN([AX_NAGIOS_GET_SSL],
 # -------------------------------
 
 SSL_TYPE=openssl
+try_pkg_config=0
 ssl_dir=
 ssl_inc_dir=
 ssl_lib_dir=
 SSL_INC_DIR=
+SSL_INC_PREFIX=
+SSL_HDR=
 SSL_LIB_DIR=
 
 AC_SUBST(HAVE_SSL)
 AC_SUBST(SSL_INC_DIR)
+AC_SUBST(SSL_HDR)
+AC_SUBST(SSL_INC_PREFIX)
 AC_SUBST(SSL_LIB_DIR)
 
 
@@ -80,6 +85,10 @@ AC_ARG_WITH([ssl-lib],
 	AS_HELP_STRING([--with-ssl-lib=DIR],[sets location of the SSL libraries]),
 	[ssl_lib_dir=$withval])
 
+if test x$ssl_inc_dir != x -o x$ssl_lib_dir != x; then
+	try_pkg_config=0
+fi
+
 AC_ARG_WITH([kerberos-inc],
 	AS_HELP_STRING([--with-kerberos-inc=DIR],
 		[sets location of the Kerberos include files]),
@@ -90,8 +99,8 @@ if test x$SSL_TYPE = xyes; then
 fi
 
 
-dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_dir/include $ssl_dir/include \
-			/usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include{BBB} \
+dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_inc_dir/include $ssl_dir/include \
+			/usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include/{BBB} \
 			/usr/local/{AAA} /usr/local/{BBB} /usr/lib/{AAA} /usr/lib/{BBB} \
 			/usr/{AAA} /usr/pkg /usr/local /usr /usr/freeware/lib/{BBB} \
 			/usr/sfw /usr/sfw/include /opt/{BBB}"
@@ -109,17 +118,19 @@ AS_CASE([$SSL_TYPE],
 	[yes|openssl],
 		[ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
 		 ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
-		 ssl_hdr=ssl.h
+		 SSL_INC_PREFIX=openssl
+		 SSL_HDR=ssl.h
 		 ssl_lib=libssl],
 	[gnutls],
 		[ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
 		 ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
-		 ssl_hdr=compat.h
+		 SSL_INC_PREFIX=gnutls
+		 SSL_HDR=compat.h
 		 ssl_lib=libgnutls],
 	[nss],
 		[ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
 		 ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
-		 ssl_hdr=nss_compat_ossl.h
+		 SSL_HDR=nss_compat_ossl.h
 		 ssl_lib=libnss_compat],
 	[*], echo >&6; AC_MSG_ERROR(['--with-ssl-type=$SSL_TYPE' is invalid])
 )
@@ -154,48 +165,51 @@ if test x$SSL_TYPE != xNONE; then
 	fi
 
 	# First, try using pkg_config
-#	AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
-#	if test x"$PKG_CONFIG" != x ; then
-#		cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
-#		if test $? = 0; then
-#			CFLAGS="$CFLAGS $cflags"
-#			LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
-#			LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
-#			found_ssl=yes
-#			AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
-#		fi
-#	fi
+	AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
+	if test x"$PKG_CONFIG" != x -a $try_pkg_config -ne 0 ; then
+		cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
+		if test $? = 0; then
+			CFLAGS="$CFLAGS $cflags"
+			LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
+			LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
+			found_ssl=yes
+			AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
+		fi
+	fi
 
 	if test x_$found_ssl != x_yes; then
 
 		# Find the SSL Headers
-
 		AC_MSG_CHECKING(for SSL headers)
 		for dir in $ssl_hdr_dirs; do
+			if test "$dir" = "/include"; then
+				continue
+			fi
 			ssldir="$dir"
-			if test -f "$dir/include/openssl/$ssl_hdr"; then
+			if test -f "$dir/include/$SSL_INC_PREFIX/$SSL_HDR"; then
 				found_ssl=yes
-				CFLAGS="$CFLAGS -I$dir/include/openssl -I$ssldir/include"
-				SSL_INC_DIR="$dir/include/openssl"
+				CFLAGS="$CFLAGS -I$dir/include/$SSL_INC_PREFIX -I$ssldir/include"
+				SSL_INC_DIR="$dir/include/$SSL_INC_PREFIX"
 				break
 			fi
-			if test -f "$dir/include/$ssl_hdr"; then
+			if test -f "$dir/include/$SSL_HDR"; then
 				found_ssl=yes
+				SSL_INC_PREFIX=""
 				CFLAGS="$CFLAGS -I$dir/include"
 				SSL_INC_DIR="$dir/include"
 				break
 			fi
-			if test -f "$dir/$ssl_hdr"; then
+			if test -f "$dir/$SSL_HDR"; then
 				found_ssl=yes
+				SSL_INC_PREFIX=""
 				CFLAGS="$CFLAGS -I$dir"
 				SSL_INC_DIR="$dir"
-				ssldir="$dir/.."
 				break
 			fi
-			if test -f "$dir/openssl/$ssl_hdr"; then
+			if test -f "$dir/$SSL_INC_PREFIX/$SSL_HDR"; then
 				found_ssl=yes
-				CFLAGS="$CFLAGS -I$dir/openssl"
-				SSL_INC_DIR="$dir/openssl"
+				CFLAGS="$CFLAGS -I$dir/$SSL_INC_PREFIX"
+				SSL_INC_DIR="$dir/$SSL_INC_PREFIX"
 				ssldir="$dir/.."
 				break
 			fi
@@ -247,11 +261,15 @@ if test x$SSL_TYPE != xNONE; then
 	fi
 
 	if test x$found_ssl = xyes ; then
+		if test -n "$SSL_INC_PREFIX" ; then
+			SSL_INC_PREFIX="${SSL_INC_PREFIX}/"
+		fi
+
 		# 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_LANG_PROGRAM([#include <${SSL_INC_PREFIX}${SSL_HDR}>], [SSL_new(NULL)])],
 			[
 				AC_MSG_RESULT([yes])
 				$1

+ 0 - 1
src/nrpe.c

@@ -31,7 +31,6 @@
 #include "acl.h"
 
 #ifdef HAVE_SSL
-# include <ssl.h>
 # ifdef USE_SSL_DH
 #  include "../include/dh.h"
 # endif