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., 51 Franklin
14
# St, Fifth Floor, Boston, MA 02110-1301 USA
17
AC_DEFUN([AC_INNODB_ACTIONS],[
21
AC_REQUIRE([AC_FUNC_MMAP])
23
AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
24
AC_SUBST(innodb_system_libs)
25
AC_CHECK_HEADERS(aio.h 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 pread)
30
AC_CHECK_FUNCS([uname munmap memchr getpagesize bzero])
34
AM_CFLAGS="$AM_CFLAGS -DUNIV_LINUX";;
36
AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
38
AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
40
AM_CFLAGS="$AM_CFLAGS -DUNIV_AIX";;
41
irix*|osf*|sysv5uw7*|openbsd*)
42
AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE";;
44
# Begin Solaris atomic function checks
45
AC_CHECK_FUNCS([atomic_cas_ulong atomic_cas_32 \
46
atomic_cas_64 atomic_add_long],
47
[plugin_innodb_have_solaris_atomics=yes],
48
[plugin_innodb_have_solaris_atomics=no])
50
AS_IF([test "${plugin_innodb_have_solaris_atomics}" = "yes"],[
51
AC_DEFINE([HAVE_SOLARIS_ATOMICS],
53
[Define to 1 if Solaris supports \
56
### End Solaris atomic function checks
57
AM_CFLAGS="$AM_CFLAGS -DUNIV_SOLARIS";;
59
INNODB_DYNAMIC_CFLAGS="-DPANDORA_DYNAMIC_PLUGIN"
62
# The AMD64 ABI forbids absolute addresses in shared libraries
65
# Use absolute addresses on IA-32
66
INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
69
AC_SUBST(INNODB_DYNAMIC_CFLAGS)
71
AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
72
[ac_cv_plugin_innodb_have_gcc_atomic],[
82
memset(&x1, 0x0, sizeof(x1));
83
memset(&x2, 0x0, sizeof(x2));
84
memset(&x3, 0x0, sizeof(x3));
86
__sync_bool_compare_and_swap(&x1, x2, x3);
88
[ac_cv_plugin_innodb_have_gcc_atomic=yes],
89
[ac_cv_plugin_innodb_have_gcc_atomic=no])
91
AS_IF([test "${ac_cv_plugin_innodb_have_gcc_atomic}" = "yes"],[
92
AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
93
[pthread_t can be used by GCC atomic builtins])
97
[whether __attribute__ visibility "hidden" is supported],
98
[ac_cv_can_use_hidden_],[
100
dnl Must be done once we turn on warnings and such
101
save_CXXFLAGS="${CXXFLAGS}"
102
CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
106
__attribute__((visibility ("hidden")))
110
[ac_cv_can_use_hidden_=yes],
111
[ac_cv_can_use_hidden_=no])
112
CXXFLAGS="${save_CXXFLAGS}"
114
AS_IF([test "$ac_cv_can_use_hidden_" = "yes"],[
115
AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
116
[Define to 1 if you have support for __attribute__((visibility("hidden")))])
119
# Try using solaris atomics on SunOS if GCC atomics are not available
120
AS_IF([test "${ac_cv_plugin_innodb_have_gcc_atomic}" = "yes"],[
121
AC_MSG_NOTICE([no need to check pthread_t size])
123
AS_IF([test "${ac_cv_plugin_innodb_have_solaris_atomics}" = "yes"],[
124
AC_CACHE_CHECK([checking if pthread_t size is integral],
125
[ac_cv_plugin_innodb_pthread_integral],[
132
ac_cv_plugin_innodb_pthread_integral=yes
134
ac_cv_plugin_innodb_pthread_integral=no
137
AS_IF([test "${ac_cv_plugin_innodb_pthread_integral}" = "yes"],[
138
AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
139
[pthread_t can be used by solaris atomics])
141
# size of pthread_t is needed for typed solaris atomics
142
AC_CHECK_SIZEOF([pthread_t], [], [
148
# Check for x86 PAUSE instruction
149
AC_CACHE_CHECK([for x86 PAUSE instruction],[ac_cv_plugin_innodb_has_pause],[
150
# We have to actually try running the test program, because of a bug
151
# in Solaris on x86_64, where it wrongly reports that PAUSE is not
152
# supported when trying to run an application. See
153
# http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
154
# We use ib_ prefix to avoid collisoins if this code is added to
155
# mysql's configure.in.
156
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
157
__asm__ __volatile__ ("pause");
159
ac_cv_plugin_innodb_has_pause=yes
161
ac_cv_plugin_innodb_has_pause=no
164
AS_IF([test "${ac_cv_plugin_innodb_has_pause}" = "yes"],[
165
AC_DEFINE([IB_HAVE_PAUSE_INSTRUCTION], [1],
166
[Does x86 PAUSE instruction exist])
172
# vim: set ft=config: