~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to config/ac-macros/ssl.m4

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl ===========================================================================
 
2
dnl Support for SSL
 
3
dnl ===========================================================================
 
4
dnl
 
5
dnl
 
6
 
 
7
dnl ---------------------------------------------------------------------------
 
8
dnl Macro: MYSQL_USE_BUNDLED_YASSL
 
9
dnl
 
10
dnl SYNOPSIS
 
11
dnl   MYSQL_USE_BUNDLED_YASSL()
 
12
dnl
 
13
dnl DESCRIPTION
 
14
dnl  Add defines so yassl is built and linked with
 
15
dnl ---------------------------------------------------------------------------
 
16
AC_DEFUN([MYSQL_USE_BUNDLED_YASSL], [
 
17
 
 
18
  with_bundled_yassl="yes"
 
19
 
 
20
  yassl_dir="yassl"
 
21
  AC_SUBST([yassl_dir])
 
22
 
 
23
  yassl_libs="\$(top_builddir)/extra/yassl/src/libyassl.la \
 
24
              \$(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la"
 
25
  AC_SUBST(yassl_libs)
 
26
 
 
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.])
 
29
 
 
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/])
 
37
        ;;
 
38
  esac
 
39
  AC_SUBST([yassl_taocrypt_extra_cxxflags])
 
40
 
 
41
  # Link extra/yassl/include/openssl subdir to include/
 
42
  yassl_h_ln_cmd="\$(LN) -s \$(top_srcdir)/extra/yassl/include/openssl openssl"
 
43
  AC_SUBST(yassl_h_ln_cmd)
 
44
 
 
45
  AC_MSG_RESULT([using bundled yaSSL])
 
46
])
 
47
 
 
48
 
 
49
dnl ---------------------------------------------------------------------------
 
50
dnl Macro: MYSQL_CHECK_SSL_DIR
 
51
dnl
 
52
dnl SYNOPSIS
 
53
dnl   MYSQL_CHECK_SSL_DIR(includes, libs)
 
54
dnl
 
55
dnl DESCRIPTION
 
56
dnl  Auxiliary macro to check for ssl at given path
 
57
dnl
 
58
dnl ---------------------------------------------------------------------------
 
59
 
 
60
AC_DEFUN([MYSQL_CHECK_SSL_DIR], [
 
61
ssl_incs="$1"
 
62
ssl_libs="$2"
 
63
save_CPPFLAGS="$CPPFLAGS"
 
64
save_LIBS="$LIBS"
 
65
CPPFLAGS="$ssl_incs $CPPFLAGS"
 
66
LIBS="$LIBS $ssl_libs"
 
67
AC_TRY_LINK([#include <openssl/ssl.h>],
 
68
    [return SSL_library_init();],
 
69
    [mysql_ssl_found="yes"],
 
70
    [mysql_ssl_found="no"])
 
71
CPPFLAGS="$save_CPPFLAGS"
 
72
LIBS="$save_LIBS"
 
73
])
 
74
 
 
75
 
 
76
dnl ---------------------------------------------------------------------------
 
77
dnl Macro: MYSQL_FIND_OPENSSL
 
78
dnl
 
79
dnl SYNOPSIS
 
80
dnl   MYSQL_FIND_OPENSSL(location)
 
81
dnl
 
82
dnl DESCRIPTION
 
83
dnl  Search the location for OpenSSL support
 
84
dnl
 
85
dnl ---------------------------------------------------------------------------
 
86
AC_DEFUN([MYSQL_FIND_OPENSSL], [
 
87
  location="$1"
 
88
 
 
89
  #
 
90
  # Set include paths
 
91
  #
 
92
  openssl_include="$location/include"
 
93
  openssl_includes=""
 
94
 
 
95
  # Don't set ssl_includes to /usr/include as this gives us a lot of
 
96
  # compiler warnings when using gcc 3.x
 
97
  if test "$openssl_include" != "/usr/include"
 
98
  then
 
99
    openssl_includes="-I$openssl_include"
 
100
  fi
 
101
 
 
102
  #
 
103
  # Try to link with openSSL libs in <location>
 
104
  #
 
105
  openssl_libs="-L$location/lib/ -lssl -lcrypto"
 
106
  MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs])
 
107
 
 
108
  if test "$mysql_ssl_found" == "no"
 
109
  then
 
110
    #
 
111
    # BUG 764: Compile failure with OpenSSL on Red Hat Linux (krb5.h missing)
 
112
    # Try to link with include paths to kerberos set
 
113
    #
 
114
    openssl_includes="$openssl_includes -I/usr/kerberos/include"
 
115
    MYSQL_CHECK_SSL_DIR([$openssl_includes], [$openssl_libs])
 
116
  fi
 
117
 
 
118
  if test "$mysql_ssl_found" == "no"
 
119
  then
 
120
    AC_MSG_ERROR([Could not link with SSL libs at $location])
 
121
  fi
 
122
 
 
123
  # openssl-devel-0.9.6 requires dlopen() and we can't link staticly
 
124
  # on many platforms (We should actually test this here, but it's quite
 
125
  # hard to do as we are doing libtool for linking.)
 
126
  case "$CLIENT_EXTRA_LDFLAGS $MYSQLD_EXTRA_LDFLAGS" in
 
127
    *-all-static*)
 
128
    AC_MSG_ERROR([You can't use the --all-static link option when using openssl.])
 
129
    ;;
 
130
  esac
 
131
 
 
132
  AC_SUBST(openssl_includes)
 
133
  AC_SUBST(openssl_libs)
 
134
 
 
135
  NON_THREADED_CLIENT_LIBS="$NON_THREADED_CLIENT_LIBS $openssl_libs"
 
136
 
 
137
  AC_DEFINE([HAVE_OPENSSL], [1], [OpenSSL])
 
138
  AC_MSG_RESULT([using openSSL from $location])
 
139
])
 
140
 
 
141
 
 
142
 
 
143
dnl ------------------------------------------------------------------------
 
144
dnl Macro: MYSQL_CHECK_SSL
 
145
dnl
 
146
dnl SYNOPSIS
 
147
dnl   MYSQL_CHECK_SSL
 
148
dnl
 
149
dnl Provides the following configure options:
 
150
dnl --with-ssl=DIR
 
151
dnl Possible DIR values are:
 
152
dnl - no - the macro will disable use of ssl
 
153
dnl - bundled, empty or not specified - means use ssl lib
 
154
dnl   bundled along with MySQL sources
 
155
dnl - ssl location prefix - given location prefix, the macro expects
 
156
dnl   to find the header files in $prefix/include/, and libraries in
 
157
dnl   $prefix/lib. If headers or libraries weren't found at $prefix, the
 
158
dnl   macro bails out with error.
 
159
dnl
 
160
dnl ------------------------------------------------------------------------
 
161
AC_DEFUN([MYSQL_CHECK_SSL], [
 
162
 
 
163
  AC_CONFIG_FILES(extra/yassl/Makefile dnl
 
164
    extra/yassl/taocrypt/Makefile dnl
 
165
    extra/yassl/taocrypt/benchmark/Makefile dnl
 
166
    extra/yassl/taocrypt/src/Makefile dnl
 
167
    extra/yassl/taocrypt/test/Makefile dnl
 
168
    extra/yassl/src/Makefile dnl
 
169
    extra/yassl/testsuite/Makefile)
 
170
 
 
171
AC_MSG_CHECKING(for SSL)
 
172
  AC_ARG_WITH([ssl],
 
173
              [  --with-ssl[=DIR]    Include SSL support],
 
174
              [mysql_ssl_dir="$withval"],
 
175
              [mysql_ssl_dir=no])
 
176
 
 
177
  if test "$with_yassl"
 
178
  then
 
179
    AC_MSG_ERROR([The flag --with-yassl is deprecated, use --with-ssl])
 
180
  fi
 
181
 
 
182
  if test "$with_openssl"
 
183
  then
 
184
    AC_MSG_ERROR([The flag --with-openssl is deprecated, use --with-ssl])
 
185
  fi
 
186
 
 
187
  case "$mysql_ssl_dir" in
 
188
    "no")
 
189
      #
 
190
      # Don't include SSL support
 
191
      #
 
192
      AC_MSG_RESULT([disabled])
 
193
      ;;
 
194
 
 
195
    "bundled"|"yes")
 
196
      #
 
197
      # Use the bundled SSL implementation (yaSSL)
 
198
      #
 
199
      MYSQL_USE_BUNDLED_YASSL
 
200
      ;;
 
201
 
 
202
     *)
 
203
      #
 
204
      # A location where to search for OpenSSL was specified
 
205
      #
 
206
      MYSQL_FIND_OPENSSL([$mysql_ssl_dir])
 
207
      ;;
 
208
  esac
 
209
  AM_CONDITIONAL([HAVE_YASSL], [ test "$with_bundled_yassl" = "yes" ])
 
210
])