2 # Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved.
4 # This program is free software; you can redistribute it and/or modify it under
5 # the terms of the GNU General Public License as published by the Free Software
6 # Foundation; version 2 of the License.
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License along with
13 # this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
14 # Fifth Floor, Boston, MA 02110-1301, USA
17 MYSQL_STORAGE_ENGINE(innodb_plugin,, [InnoDB Storage Engine],
18 [Transactional Tables using InnoDB], [max,max-no-ndb])
19 MYSQL_PLUGIN_DIRECTORY(innodb_plugin, [storage/innodb_plugin])
20 # Enable if you know what you are doing (trying to link both InnoDB and
21 # InnoDB Plugin statically into MySQL does not work).
22 #MYSQL_PLUGIN_STATIC(innodb_plugin, [libinnobase.a])
23 MYSQL_PLUGIN_DYNAMIC(innodb_plugin, [ha_innodb_plugin.la])
24 MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
25 AC_CHECK_HEADERS(sched.h)
26 AC_CHECK_SIZEOF(int, 4)
27 AC_CHECK_SIZEOF(long, 4)
28 AC_CHECK_SIZEOF(void*, 4)
29 AC_CHECK_FUNCS(sched_yield fdatasync localtime_r)
33 CFLAGS="$CFLAGS -DUNIV_LINUX";;
35 CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
37 CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
39 CFLAGS="$CFLAGS -DUNIV_AIX";;
40 irix*|osf*|sysv5uw7*|openbsd*)
41 CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
43 CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
46 INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN"
50 # The AMD64 ABI forbids absolute addresses in shared libraries
53 # Use absolute addresses on IA-32
54 INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
57 AC_SUBST(INNODB_DYNAMIC_CFLAGS)
59 AC_MSG_CHECKING(whether GCC atomic builtins are available)
60 # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
72 res = __sync_bool_compare_and_swap(&x, x, y);
79 res = __sync_bool_compare_and_swap(&x, x + 1, y);
86 res = __sync_add_and_fetch(&x, y);
87 if (res != 123 + 10 || x != 123 + 10) {
92 res = __sync_lock_test_and_set(&c, 123);
93 if (res != 10 || c != 123) {
101 AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
102 [GCC atomic builtins are available])
110 AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
111 # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
117 int main(int argc, char** argv) {
122 memset(&x1, 0x0, sizeof(x1));
123 memset(&x2, 0x0, sizeof(x2));
124 memset(&x3, 0x0, sizeof(x3));
126 __sync_bool_compare_and_swap(&x1, x2, x3);
132 AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
133 [pthread_t can be used by GCC atomic builtins])
141 AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
142 # Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following
143 # functions are present.
144 AC_CHECK_FUNCS(atomic_add_long_nv \
150 if test "${ac_cv_func_atomic_add_long_nv}" = "yes" -a \
151 "${ac_cv_func_atomic_cas_32}" = "yes" -a \
152 "${ac_cv_func_atomic_cas_64}" = "yes" -a \
153 "${ac_cv_func_atomic_cas_ulong}" = "yes" -a \
154 "${ac_cv_func_atomic_swap_uchar}" = "yes" ; then
156 AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
157 [Define to 1 if Solaris libc atomic functions are available]
161 AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
162 # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
168 int main(int argc, char** argv) {
173 memset(&x1, 0x0, sizeof(x1));
174 memset(&x2, 0x0, sizeof(x2));
175 memset(&x3, 0x0, sizeof(x3));
177 if (sizeof(pthread_t) == 4) {
179 atomic_cas_32(&x1, x2, x3);
181 } else if (sizeof(pthread_t) == 8) {
183 atomic_cas_64(&x1, x2, x3);
194 AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
195 [pthread_t can be used by solaris atomics])
203 # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
204 # to use in the source
205 AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
207 # Check for x86 PAUSE instruction
208 AC_MSG_CHECKING(for x86 PAUSE instruction)
209 # We have to actually try running the test program, because of a bug
210 # in Solaris on x86_64, where it wrongly reports that PAUSE is not
211 # supported when trying to run an application. See
212 # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
213 # We use ib_ prefix to avoid collisoins if this code is added to
214 # mysql's configure.in.
218 __asm__ __volatile__ ("pause");
223 AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
235 # vim: set ft=config: