48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
-
+
-
-
-
+
+
+
+
+
+
+
+
-
+
+
+
-
-
+
+
-
-
+
+
+
+
+
-
-
+
+
-
+
+
+
+
-
+
+
|
${MAKE:-make} V=1 install || exit 1
) || return 1
# We always statically link
KC_TLS_LINKSSLSTATIC='1'
SSLDIR="$(pwd)/libressl-${version}/INST"
SSLPKGCONFIGDIR="$(pwd)/libressl-${version}/INST/lib/pkgconfig"
PKG_CONFIG_PATH="${SSLDIR}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH
return 0
}
function preconfigure() {
# Determine SSL directory
if [ -z "${CPP}" ]; then
CPP="${CC:-cc} -E"
fi
SSLPKGCONFIGDIR=''
SSLDIR=''
if [ -n "${KC_TLS_SSLDIR}" ]; then
case "${KC_TLS_SSLDIR}" in
*/pkgconfig|*/pkgconfig/)
SSLPKGCONFIGDIR="${KC_TLS_SSLDIR}"
;;
*)
SSLDIR="${KC_TLS_SSLDIR}"
SSLDIR="${KC_TLS_SSLDIR}"
;;
esac
else
SSLDIR=''
SSLGUESS='0'
if [ -z "${KC_TLS_BUILDSSL}" ]; then
if ! "${PKG_CONFIG:-pkg-config}" --exists openssl >/dev/null 2>/dev/null; then
SSLDIR="$(echo '#include <openssl/ssl.h>' 2>/dev/null | ${CPP} - 2> /dev/null | awk '/# 1 "\/.*\/ssl\.h/{ print $3; exit }' | sed 's@^"@@;s@"$@@;s@/include/openssl/ssl\.h$@@')"
fi
SSLDIR="$(echo '#include <openssl/ssl.h>' 2>/dev/null | ${CPP} - 2> /dev/null | awk '/# 1 "\/.*\/ssl\.h/{ print $3; exit }' | sed 's@^"@@;s@"$@@;s@/include/openssl/ssl\.h$@@')"
else
SSLGUESS='1'
fi
fi
if [ -z "${SSLDIR}" ]; then
buildSSLLibrary || SSLDIR=''
if [ -z "${SSLDIR}" -a "${SSLGUESS}" = '0' ]; then
buildSSLLibrary || SSLPKGCONFIGDIR=''
fi
if [ -z "${SSLDIR}" ]; then
if [ -z "${SSLPKGCONFIGDIR}" -a -z "${SSLDIR}" -a "${SSLGUESS}" = '0' ]; then
echo "Unable to find OpenSSL, aborting." >&2
return 1
fi
fi
# Add SSL library to configure options
if [ -n "${SSLPKGCONFIGDIR}" ]; then
configure_extra=("${configure_extra[@]}" --with-openssl-pkgconfig="${SSLPKGCONFIGDIR}")
elif [ -n "${SSLDIR}" ]; then
configure_extra=("${configure_extra[@]}" --with-openssl-dir="${SSLDIR}")
configure_extra=("${configure_extra[@]}" --with-openssl-dir="${SSLDIR}")
fi
# If we are statically linking to libssl, let tcltls know so it asks for the right
# packages
if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then
configure_extra=("${configure_extra[@]}" --enable-static-ssl)
fi
}
|