1 dnl ===========================================================================
3 dnl ===========================================================================
7 dnl ---------------------------------------------------------------------------
8 dnl Macro: MYSQL_USE_BUNDLED_YASSL
11 dnl MYSQL_USE_BUNDLED_YASSL()
14 dnl Add defines so yassl is built and linked with
15 dnl ---------------------------------------------------------------------------
16 AC_DEFUN([MYSQL_USE_BUNDLED_YASSL], [
18 with_bundled_yassl="yes"
23 yassl_libs="\$(top_builddir)/extra/yassl/src/libyassl.la \
24 \$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la"
27 AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for SSL.])
28 AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for SSL.])
30 # System specific checks
31 yassl_integer_extra_cxxflags=""
32 case $host_cpu--$CXX_VERSION in
33 sparc*--*Sun*C++*5.6*)
34 # Disable inlining when compiling taocrypt/src/
35 yassl_taocrypt_extra_cxxflags="+d"
36 AC_MSG_NOTICE([disabling inlining for yassl/taocrypt/src/])
39 AC_SUBST([yassl_taocrypt_extra_cxxflags])
42 yassl_thread_cxxflags=""
44 if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"; then
45 yassl_thread_cxxflags="-DMULTI_THREADED"
46 yassl_thread_safe="(thread-safe)"
48 AC_SUBST([yassl_thread_cxxflags])
50 # Link extra/yassl/include/openssl subdir to include/
51 yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
52 AC_SUBST(yassl_h_ln_cmd)
54 AC_MSG_RESULT([using bundled yaSSL $yassl_thread_safe])
58 dnl ---------------------------------------------------------------------------
59 dnl Macro: MYSQL_CHECK_SSL_DIR
62 dnl MYSQL_CHECK_SSL_DIR(includes, libs)
65 dnl Auxiliary macro to check for ssl at given path
67 dnl ---------------------------------------------------------------------------
69 AC_DEFUN([MYSQL_CHECK_SSL_DIR], [
72 save_CPPFLAGS="$CPPFLAGS"
74 CPPFLAGS="$ssl_incs $CPPFLAGS"
75 LIBS="$LIBS $ssl_libs"
76 AC_TRY_LINK([#include <openssl/ssl.h>],
77 [return SSL_library_init();],
78 [mysql_ssl_found="yes"],
79 [mysql_ssl_found="no"])
80 CPPFLAGS="$save_CPPFLAGS"
85 dnl ---------------------------------------------------------------------------
86 dnl Macro: MYSQL_FIND_OPENSSL
89 dnl MYSQL_FIND_OPENSSL(location)
92 dnl Search the location for OpenSSL support
94 dnl ---------------------------------------------------------------------------
95 AC_DEFUN([MYSQL_FIND_OPENSSL], [
101 openssl_include="$location/include"
104 # Don't set ssl_includes to /usr/include as this gives us a lot of
105 # compiler warnings when using gcc 3.x
106 if test "$openssl_include" != "/usr/include"
108 openssl_includes="-I$openssl_include"
112 # Try to link with openSSL libs in <location>
114 openssl_libs="-L$location/lib/ -lssl -lcrypto"
115 MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs])
117 if test "$mysql_ssl_found" == "no"
120 # BUG 764: Compile failure with OpenSSL on Red Hat Linux (krb5.h missing)
121 # Try to link with include paths to kerberos set
123 openssl_includes="$openssl_includes -I/usr/kerberos/include"
124 MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs])
127 if test "$mysql_ssl_found" == "no"
129 AC_MSG_ERROR([Could not link with SSL libs at $location])
132 # openssl-devel-0.9.6 requires dlopen() and we can't link staticly
133 # on many platforms (We should actually test this here, but it's quite
134 # hard to do as we are doing libtool for linking.)
135 case "$CLIENT_EXTRA_LDFLAGS $MYSQLD_EXTRA_LDFLAGS" in
137 AC_MSG_ERROR([You can't use the --all-static link option when using openssl.])
141 AC_SUBST(openssl_includes)
142 AC_SUBST(openssl_libs)
144 NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs"
146 AC_DEFINE([HAVE_OPENSSL], [1], [OpenSSL])
147 AC_MSG_RESULT([using openSSL from $location])
152 dnl ------------------------------------------------------------------------
153 dnl Macro: MYSQL_CHECK_SSL
158 dnl Provides the following configure options:
160 dnl Possible DIR values are:
161 dnl - no - the macro will disable use of ssl
162 dnl - bundled, empty or not specified - means use ssl lib
163 dnl bundled along with MySQL sources
164 dnl - ssl location prefix - given location prefix, the macro expects
165 dnl to find the header files in $prefix/include/, and libraries in
166 dnl $prefix/lib. If headers or libraries weren't found at $prefix, the
167 dnl macro bails out with error.
169 dnl ------------------------------------------------------------------------
170 AC_DEFUN([MYSQL_CHECK_SSL], [
172 AC_CONFIG_FILES(extra/yassl/Makefile dnl
173 extra/yassl/taocrypt/Makefile dnl
174 extra/yassl/taocrypt/benchmark/Makefile dnl
175 extra/yassl/taocrypt/src/Makefile dnl
176 extra/yassl/taocrypt/test/Makefile dnl
177 extra/yassl/src/Makefile dnl
178 extra/yassl/testsuite/Makefile)
180 AC_MSG_CHECKING(for SSL)
182 [ --with-ssl[=DIR] Include SSL support],
183 [mysql_ssl_dir="$withval"],
186 if test "$with_yassl"
188 AC_MSG_ERROR([The flag --with-yassl is deprecated, use --with-ssl])
191 if test "$with_openssl"
193 AC_MSG_ERROR([The flag --with-openssl is deprecated, use --with-ssl])
196 case "$mysql_ssl_dir" in
199 # Don't include SSL support
201 AC_MSG_RESULT([disabled])
206 # Use the bundled SSL implementation (yaSSL)
208 MYSQL_USE_BUNDLED_YASSL
213 # A location where to search for OpenSSL was specified
215 MYSQL_FIND_OPENSSL([$mysql_ssl_dir])
218 AM_CONDITIONAL([HAVE_YASSL], [ test "$with_bundled_yassl" = "yes" ])