-AC_CHECK_HEADER(zlib.h,
- AC_CHECK_LIB(z, deflateInit2, ,
- AC_MSG_ERROR([zlib library not found, may need to use --with-zlib option])),
- AC_MSG_ERROR([zlib headers not found, may need to use --with-zlib option]))
+AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
+AC_CHECK_LIB([z],[deflateInit2_],,AC_MSG_ERROR([unable to link with zlib library]))
+
+# OpenSSL settings
+AC_ARG_WITH(openssl,
+ AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
+ [if test x_$with_openssl != x_/usr; then
+ SSLFLAGS="-I${with_openssl}/include"
+ fi])
+
+if test "x$SSLFLAGS" = "x" ; then
+ AC_PATH_PROG(PKG_CONFIG, pkg-config)
+ if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
+ if pkg-config openssl ; then
+ SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
+ else
+ AC_MSG_ERROR([OpenSSL not supported by pkg-config, try --with-openssl instead])
+ fi
+ fi
+fi
+
+AC_MSG_CHECKING(for OpenSSL cflags)
+AC_MSG_RESULT($SSLFLAGS)
+CPPFLAGS="$SSLFLAGS $CPPFLAGS"
+
+AC_CHECK_HEADER([openssl/x509.h],,
+ AC_MSG_ERROR([unable to find openssl header files]))