Index: configure.in
==================================================================
--- configure.in
+++ configure.in
@@ -42,10 +42,13 @@
 	tcltls_ssl_lib="$withval"
 ], [
 	tcltls_ssl_lib='auto'
 ])
 
+
+AC_CHECK_TOOL([PKGCONFIG], [pkg-config], [false])
+
 dnl XXX:TODO: Automatically determine the SSL library to use
 dnl           defaulting to OpenSSL for compatibility reasons
 if test "$tcltls_ssl_lib" = 'auto'; then
 	tcltls_ssl_lib='openssl'
 fi
@@ -52,10 +55,14 @@
 
 AC_MSG_CHECKING([which TLS library to use])
 AS_CASE([$tcltls_ssl_lib],
 	[openssl], [
 		AC_MSG_RESULT([openssl])
+
+		LIBS="${LIBS} `"${PKGCONFIG}" openssl --libs`"
+		CFLAGS="${CFLAGS} `"${PKGCONFIG}" openssl --cflags-only-other`"
+		CPPFLAGS="${CPPFLAGS} `"${PKGCONFIG}" openssl --cflags-only-I`"
 	],
 	[libressl], [
 		AC_MSG_RESULT([libressl])
 	],
 	[nss], [
@@ -63,9 +70,8 @@
 	],
 	[
 		AC_MSG_ERROR([Unsupported SSL library: $tcltls_ssl_lib])
 	]
 )
-
 
 dnl Produce output
 AC_OUTPUT(Makefile pkgIndex.tcl)