2
# Copyright (c) 2006, 2009, 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., 59 Temple
14
# Place, Suite 330, Boston, MA 02111-1307 USA
17
AC_DEFUN([AC_INNODB_ACTIONS],[
18
AC_REQUIRE([AC_PROG_LEX])
19
AC_REQUIRE([AC_FUNC_MMAP])
21
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
22
AC_SUBST(innodb_system_libs)
23
AC_CHECK_HEADERS(aio.h sched.h)
24
AC_CHECK_SIZEOF(int, 4)
25
AC_CHECK_SIZEOF(long, 4)
26
AC_CHECK_SIZEOF(void*, 4)
27
AC_CHECK_FUNCS(sched_yield fdatasync localtime_r)
28
AC_CHECK_FUNCS([uname munmap memchr getpagesize bzero])
32
AM_CFLAGS="$AM_CFLAGS -DUNIV_LINUX";;
34
AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
36
AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
38
AM_CFLAGS="$AM_CFLAGS -DUNIV_AIX";;
39
irix*|osf*|sysv5uw7*|openbsd*)
40
AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE";;
42
# Begin Solaris atomic function checks
43
AC_CHECK_FUNCS([atomic_cas_ulong atomic_cas_32 \
44
atomic_cas_64 atomic_add_long],
45
[plugin_innodb_have_solaris_atomics=yes],
46
[plugin_innodb_have_solaris_atomics=no])
48
AS_IF([test "${plugin_innodb_have_solaris_atomics}" = "yes"],[
49
AC_DEFINE([HAVE_SOLARIS_ATOMICS],
51
[Define to 1 if Solaris supports \
54
### End Solaris atomic function checks
55
AM_CFLAGS="$AM_CFLAGS -DUNIV_SOLARIS";;
57
INNODB_DYNAMIC_CFLAGS="-DPANDORA_DYNAMIC_PLUGIN"
60
# The AMD64 ABI forbids absolute addresses in shared libraries
63
# Use absolute addresses on IA-32
64
INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
67
AC_SUBST(INNODB_DYNAMIC_CFLAGS)
69
AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
70
[ac_cv_plugin_innodb_have_gcc_atomic],[
80
memset(&x1, 0x0, sizeof(x1));
81
memset(&x2, 0x0, sizeof(x2));
82
memset(&x3, 0x0, sizeof(x3));
84
__sync_bool_compare_and_swap(&x1, x2, x3);
86
[ac_cv_plugin_innodb_have_gcc_atomic=yes],
87
[ac_cv_plugin_innodb_have_gcc_atomic=no])
89
AS_IF([test "${ac_cv_plugin_innodb_have_gcc_atomic}" = "yes"],[
90
AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
91
[pthread_t can be used by GCC atomic builtins])
95
[whether __attribute__ visibility "hidden" is supported],
96
[ac_cv_can_use_hidden_],[
98
dnl Must be done once we turn on warnings and such
99
save_CXXFLAGS="${CXXFLAGS}"
100
CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
104
__attribute__((visibility ("hidden")))
108
[ac_cv_can_use_hidden_=yes],
109
[ac_cv_can_use_hidden_=no])
110
CXXFLAGS="${save_CXXFLAGS}"
112
AS_IF([test "$ac_cv_can_use_hidden_" = "yes"],[
113
AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
114
[Define to 1 if you have support for __attribute__((visibility("hidden")))])
117
# Try using solaris atomics on SunOS if GCC atomics are not available
118
AS_IF([test "${ac_cv_plugin_innodb_have_gcc_atomic}" = "yes"],[
119
AC_MSG_NOTICE([no need to check pthread_t size])
121
AS_IF([test "${ac_cv_plugin_innodb_have_solaris_atomics}" = "yes"],[
122
AC_CACHE_CHECK([checking if pthread_t size is integral],
123
[ac_cv_plugin_innodb_pthread_integral],[
130
ac_cv_plugin_innodb_pthread_integral=yes
132
ac_cv_plugin_innodb_pthread_integral=no
135
AS_IF([test "${ac_cv_plugin_innodb_pthread_integral}" = "yes"],[
136
AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
137
[pthread_t can be used by solaris atomics])
139
# size of pthread_t is needed for typed solaris atomics
140
AC_CHECK_SIZEOF([pthread_t], [], [
146
# Check for x86 PAUSE instruction
147
AC_CACHE_CHECK([for x86 PAUSE instruction],[ac_cv_plugin_innodb_has_pause],[
148
# We have to actually try running the test program, because of a bug
149
# in Solaris on x86_64, where it wrongly reports that PAUSE is not
150
# supported when trying to run an application. See
151
# http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
152
# We use ib_ prefix to avoid collisoins if this code is added to
153
# mysql's configure.in.
154
dnl Must be done once we turn on warnings and such
155
save_CFLAGS="${CFLAGS}"
156
CFLAGS="${AM_CFLAGS} ${CFLAGS}"
157
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
158
__asm__ __volatile__ ("pause");
160
ac_cv_plugin_innodb_has_pause=yes
162
ac_cv_plugin_innodb_has_pause=no
165
CFLAGS="${save_CFLAGS}"
166
AS_IF([test "${ac_cv_plugin_innodb_has_pause}" = "yes"],[
167
AC_DEFINE([IB_HAVE_PAUSE_INSTRUCTION], [1],
168
[Does x86 PAUSE instruction exist])
174
# vim: set ft=config: