فهرست منبع

Squashed 'macros/' changes from d570c9b..925d86b

925d86b Merge branch 'master' of github.com:NagiosEnterprises/autoconf-macros
c5ea9fe Fix for Solaris, AIX and HP-UX
4aeb50e HPUX - set init to "unknown". Let admin do it.
009ccc5 Typo in ax_nagios_get_paths
7f1a5ca Changes to init stuff for AIX
3a89a81 Package name and the program name are not always the same
a12bbc9 localstatedir was not being eval'd
b7fffb0 Missed a comma
3ae63db Change to say ndo2db needs to know the NEB directory
405b9b6 Forgot to reset a switch
ca39514 Having trouble getting gnutls/compat to work. Backing off for now.
03f9fde Changes for SSL portability. Also uses pgk-config if available.

git-subtree-dir: macros
git-subtree-split: 925d86b11bac90d2ff899df3840740d594027441
John C. Frickson 9 سال پیش
والد
کامیت
23159e45ff
5فایلهای تغییر یافته به همراه128 افزوده شده و 88 حذف شده
  1. 5 3
      ax_nagios_get_distrib
  2. 1 1
      ax_nagios_get_files
  3. 10 5
      ax_nagios_get_init
  4. 59 47
      ax_nagios_get_paths
  5. 53 32
      ax_nagios_get_ssl

+ 5 - 3
ax_nagios_get_distrib

@@ -96,10 +96,12 @@ AC_SUBST(dist_ver)
 					[bsd],
 						dist_type=`uname -s | tr ["[A-Z]" "[a-z]"]`
 						dist_ver=`uname -r`,
-					[aix|hp-ux],
-						dist_ver=$OSTYPE,
+					[aix],
+						dist_ver="`uname -v`.`uname -r`",
+					[hp-ux],
+						dist_ver=`uname -r | cut -d'.' -f1-3`,
 					[solaris],
-						dist_ver=`echo $OSTYPE | cut -d'.' -f2`,
+						dist_ver=`uname -r | cut -d'.' -f2`,
 					[*],
 						dist_ver=$OSTYPE
 				)

+ 1 - 1
ax_nagios_get_files

@@ -97,7 +97,7 @@ AS_CASE([$init_type],
 		fi,
 
 	[launchd],
-		src_init="mac-init.plist"
+		src_init="mac-init.plist",
 
 	[*],
 		src_init="unknown"

+ 10 - 5
ax_nagios_get_init

@@ -119,14 +119,19 @@ AC_SUBST(init_type)
 			elif test "$dist_type" = "slackware"; then
 				init_type="bsd"
 				init_type_wanted=no
+			elif test "$dist_type" = "aix"; then
+				init_type="bsd"
+				init_type_wanted=no
+			elif test "$dist_type" = "hp-ux"; then
+				init_type="unknown"
+				init_type_wanted=no
 			fi
 		fi
 
 		PSCMD="ps -p1 -o args"
-		AS_CASE([$dist_type],
-			[aix],		PSCMD="env UNIX95=1; ps -p1 -o args",
-			[solaris],	PSCMD="env UNIX95=1; ps -p1 -o args",
-			[hp-ux],	PSCMD="env UNIX95=1; ps -p1 -o args")
+		if test $dist_type = solaris; then
+			PSCMD="env UNIX95=1; ps -p1 -o args"
+		fi
 
 		if test "$init_type_wanted" = yes; then
 			pid1=`$PSCMD | grep -vi COMMAND | cut -d' ' -f1`
@@ -173,7 +178,7 @@ AC_SUBST(init_type)
 
 			if test "$init_type_wanted" = yes; then
 				if test "$pid1" = "/sbin/init" -o "$pid1" = "/usr/sbin/init"; then
-					if `/sbin/init --version 2>/dev/null | grep "upstart" >/dev/null`; then
+					if `$pid1 --version 2>/dev/null | grep "upstart" >/dev/null`; then
 						init_type="upstart"
 						init_type_wanted=no
 					elif test -f "/etc/rc" -a ! -L "/etc/rc"; then

+ 59 - 47
ax_nagios_get_paths

@@ -119,16 +119,21 @@ AS_CASE([$dist_type],
 	[*solaris*|*hp-ux*|*aix*|*osx*], opsys=unix)
 
 
-need_cgi=no
-need_web=no
-need_brk=no
-need_plg=no
-need_pipe=no
-need_spl=no
-need_loc=no
-need_log_subdir=no
-need_etc_subdir=no
-need_pls_dir=no
+						# Does this package need to know:
+need_cgi=no				# where the cgi-bin directory is
+need_web=no				# where the website directory is
+need_brk=no				# where the event broker modules directory is
+need_plg=no				# where the plugins directory is
+need_pipe=no			# where the pipe directory is
+need_spl=no				# where the spool directory is
+need_loc=no				# where the locale directory is
+need_log_subdir=no		# where the loc sub-directory is
+need_etc_subdir=no		# where the etc sub-directory is
+need_pls_dir=no			# where the package locate state directory is
+
+if test x"$INIT_PROG" = x; then
+	INIT_PROG="$PKG_NAME"
+fi
 
 AS_CASE([$PKG_NAME],
 	[nagios],
@@ -143,6 +148,7 @@ AS_CASE([$PKG_NAME],
 		need_web=yes,
 
 	[ndoutils],
+		need_brk=yes
 		need_spl=yes,
 
 	[nrpe],
@@ -284,14 +290,14 @@ tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"}
 if test ! -d "$tmpfilesd"; then
 	tmpfilesd="N/A"
 else
-	tmpfilesd="$tmpfilesd/$PKG_NAME.conf"
+	tmpfilesd="$tmpfilesd/$INIT_PROG.conf"
 fi
 subsyslockdir=${subsyslockdir="/var/lock/subsys"}
 if test ! -d "$subsyslockdir"; then
 	subsyslockdir="N/A"
 	subsyslockfile="N/A"
 else
-	subsyslockfile="$subsyslockdir/$PKG_NAME"
+	subsyslockfile="$subsyslockdir/$INIT_PROG"
 fi
 if test "$need_loc" = no; then
 	localedir="N/A"
@@ -372,23 +378,23 @@ elif test $opsys = "linux"; then
 	fi
 	privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
 	if test $need_log_subdir = yes; then
-		logdir=${logdir="$localstatedir/log/$PKG_NAME"}
+		logdir=${logdir="$localstatedir/log/$INIT_PROG"}
 	else
 		logdir=${logdir="$localstatedir/log"}
 	fi
-	piddir=${piddir="$localstatedir/run/${PKG_NAME}"}
+	piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
 	if test "$need_pipe" = yes; then
-		pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"}
+		pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
 	else
 		pipedir="N/A"
 	fi
 	if test "$need_pls_dir" = yes; then
-		pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"}
+		pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
 	else
 		pkglocalstatedir="N/A"
 	fi
 	if test "$need_spl" = yes; then
-		spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"}
+		spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
 	else
 		spooldir="N/A"
 	fi
@@ -437,7 +443,7 @@ elif test $opsys = "unix"; then
 	fi
 	privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
 	if test "$need_pls_dir" = yes; then
-		pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"}
+		pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
 	else
 		pkglocalstatedir="N/A"
 	fi
@@ -445,7 +451,7 @@ elif test $opsys = "unix"; then
 		localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
 	fi
 	if test "$need_spl" = yes; then
-		spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"}
+		spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
 	else
 		spooldir="N/A"
 	fi
@@ -471,14 +477,14 @@ elif test $opsys = "unix"; then
 			logdir=${logdir="$pkglocalstatedir/log"},
 
 		[*],
-			piddir=${piddir="$localstatedir/run/${PKG_NAME}"}
+			piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
 			if test "$need_pipe" = yes; then
-				pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"}
+				pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
 			else
 				pipedir="N/A"
 			fi
 			if test $need_log_subdir = yes; then
-				logdir=${logdir="$localstatedir/log/$PKG_NAME"}
+				logdir=${logdir="$localstatedir/log/$INIT_PROG"}
 			else
 				logdir=${logdir="$localstatedir/log"}
 			fi
@@ -528,7 +534,7 @@ elif test $opsys = "bsd"; then
 	fi
 	privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
 	if test "$need_pls_dir" = yes; then
-		pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$PKG_NAME"}
+		pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
 	else
 		pkglocalstatedir="N/A"
 	fi
@@ -536,7 +542,7 @@ elif test $opsys = "bsd"; then
 		localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
 	fi
 	if test "$need_spl" = yes; then
-		spooldir=${spooldir="$localstatedir/spool/$PKG_NAME"}
+		spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
 	else
 		spooldir="N/A"
 	fi
@@ -561,14 +567,14 @@ elif test $opsys = "bsd"; then
 	else
 		cgibindir="N/A"
 	fi
-	piddir=${piddir="$localstatedir/run/${PKG_NAME}"}
+	piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
 	if test "$need_pipe" = yes; then
-		pipedir=${pipedir="$localstatedir/run/${PKG_NAME}"}
+		pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
 	else
 		pipedir="N/A"
 	fi
 	if test $need_log_subdir = yes; then
-		logdir=${logdir="$localstatedir/log/$PKG_NAME"}
+		logdir=${logdir="$localstatedir/log/$INIT_PROG"}
 	else
 		logdir=${logdir="$localstatedir/log"}
 	fi
@@ -604,6 +610,7 @@ eval libexecdir=$libexecdir
 eval brokersdir=$brokersdir
 eval pluginsdir=$pluginsdir
 eval cgibindir=$cgibindir
+eval localstatedir=$localstatedir
 eval pkglocalstatedir=$pkglocalstatedir
 eval webdir=$webdir
 eval localedir=$localedir
@@ -622,9 +629,9 @@ AS_CASE([$init_type],
 		else
 			initdir=${initdir="/etc/init.d"}
 		fi
-		initname=${initname="$PKG_NAME"}
+		initname=${initname="$INIT_PROG"}
 		initconfdir=${initconfdir="/etc/conf.d"}
-		initconf=${initconf="$initconfdir/$PKG_NAME"},
+		initconf=${initconf="$initconfdir/$INIT_PROG"},
 
 	[systemd],
 		if test $dist_type = "debian"; then
@@ -632,27 +639,32 @@ AS_CASE([$init_type],
 		else
 			initdir=${initdir="/usr/lib/systemd/system"}
 		fi
-		initname=${initname="$PKG_NAME.service"},
+		initname=${initname="$INIT_PROG.service"},
 
 	[bsd],
-		initdir=${initdir="/etc/rc.d"}
-		initname=${initname="rc.$PKG_NAME"},
+		if test $dist_type = "aix"; then
+			initdir=${initdir="/sbin/rc.d/init.d"}
+			initname=${initname="$INIT_PROG"}
+		else
+			initdir=${initdir="/etc/rc.d"}
+			initname=${initname="rc.$INIT_PROG"}
+		fi,
 
 	[newbsd],
 		initdir=${initdir="/etc/rc.d"}
-		initname=${initname="$PKG_NAME"},
+		initname=${initname="$INIT_PROG"},
 
 	[gentoo],
 		initdir=${initdir="/etc/init.d"}
-		initname=${initname="$PKG_NAME"}
+		initname=${initname="$INIT_PROG"}
 		initconfdir=${initconfdir="/etc/init.d"}
-		initconf=${initconf="$initconfdir/$PKG_NAME"},
+		initconf=${initconf="$initconfdir/$INIT_PROG"},
 
 	[openrc],
 		initdir=${initdir="/etc/init.d"}
-		initname=${initname="$PKG_NAME"}
+		initname=${initname="$INIT_PROG"}
 		initconfdir=${initconfdir="/etc/conf.d"}
-		initconf=${initconf="$initconfdir/$PKG_NAME"},
+		initconf=${initconf="$initconfdir/$INIT_PROG"},
 
 	[smf*],
 		if test $init_type = smf10; then
@@ -660,21 +672,21 @@ AS_CASE([$init_type],
 		else
 			initdir=${initdir="/lib/svc/manifest/network/nagios"}
 		fi
-		initname=${initname="$PKG_NAME.xml"}
+		initname=${initname="$INIT_PROG.xml"}
 		initconfdir=unknown
 		initconf=unknown,
 
 	[upstart],
 		initdir=${initdir="/etc/init"}
-		initname=${initname="$PKG_NAME.conf"}
+		initname=${initname="$INIT_PROG.conf"}
 		initconfdir=${initconfdir="/etc/default"}
-		initconf=${initconf="$initconfdir/$PKG_NAME"},
+		initconf=${initconf="$initconfdir/$INIT_PROG"},
 
 	[launchd],
 		initdir=${initdir="/Library/LaunchDaemons"}
-		initname=${initname="org.nagios.$PKG_NAME.plist"},
+		initname=${initname="org.nagios.$INIT_PROG.plist"},
 #		initconfdir=${initconfdir="/private/etc"}
-#		initconf=${initconf="$initconfdir/$PKG_NAME"},
+#		initconf=${initconf="$initconfdir/$INIT_PROG"},
 
 
 	[*],
@@ -691,7 +703,7 @@ AS_CASE([$inetd_type],
 
 	[xinetd],
 		inetddir=${inetddir="/etc/xinetd.d"}
-		inetdname=${inetdname="$PKG_NAME"},
+		inetdname=${inetdname="$INIT_PROG"},
 
 	[systemd],
 		if test $dist_type = "debian"; then
@@ -699,7 +711,7 @@ AS_CASE([$inetd_type],
 		else
 			inetddir=${inetddir="/usr/lib/systemd/system"}
 		fi
-		netdname=${inetdname="$PKG_NAME.socket"},
+		netdname=${inetdname="$INIT_PROG.socket"},
 
 	[smf*],
 		if test $init_type = smf10; then
@@ -707,15 +719,15 @@ AS_CASE([$inetd_type],
 		else
 			inetddir=${inetddir="/lib/svc/manifest/network/nagios"}
 		fi
-		inetdname=${inetdname="$PKG_NAME.xml"},
+		inetdname=${inetdname="$INIT_PROG.xml"},
 
 #	[upstart],
 #		inetddir=${inetddir="/etc/init.d"}
-#		inetdname=${inetdname="$PKG_NAME"},
+#		inetdname=${inetdname="$INIT_PROG"},
 
 	[launchd],
 		inetddir=${inetddir="/Library/LaunchDaemons"}
-		inetdname=${inetdname="org.nagios.$PKG_NAME.plist"},
+		inetdname=${inetdname="org.nagios.$INIT_PROG.plist"},
 
 	[*],
 		inetddir=${inetddir="unknown"}

+ 53 - 32
ax_nagios_get_ssl

@@ -49,25 +49,30 @@ AC_DEFUN([AX_NAGIOS_GET_SSL],
 # -------------------------------
 
 SSL_TYPE=openssl
+try_pkg_config=1
 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)
 
 
 # gnutls/openssl.h
 # nss_compat_ossl/nss_compat_ossl.h
 
-# Which type - openssl, gnutls-openssl, nss
-AC_ARG_WITH([ssl-type],
-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])
+dnl # Which type - openssl, gnutls-openssl, nss
+dnl AC_ARG_WITH([ssl-type],
+dnl dnl	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 to use that instead of openssl]),
+dnl 	[SSL_TYPE=$withval])
 
 AC_ARG_WITH([ssl],
 	AS_HELP_STRING([--with-ssl=DIR],[sets location of the SSL installation]),
@@ -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,20 @@ 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_TYPE=gnutls_compat
+		 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 +166,53 @@ 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 $? -eq 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
+				if test "$SSL_HDR" != compat.h ; then
+					SSL_INC_PREFIX=""
+				fi
 				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 +264,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