~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/innobase/plugin.ac

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved.
 
3
 
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.
 
7
 
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.
 
11
 
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
 
15
#
 
16
 
 
17
AC_DEFUN([AC_INNODB_ACTIONS],[
 
18
  AC_REQUIRE([AC_PROG_LEX])
 
19
  AC_REQUIRE([AC_FUNC_MMAP])
 
20
 
 
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 pread)
 
28
  AC_CHECK_FUNCS([uname munmap memchr getpagesize bzero])
 
29
  AC_C_BIGENDIAN
 
30
  case "$target_os" in
 
31
         lin*)
 
32
           AM_CFLAGS="$AM_CFLAGS -DUNIV_LINUX";;
 
33
         hpux10*)
 
34
           AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
 
35
         hp*)
 
36
           AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
 
37
         aix*)
 
38
           AM_CFLAGS="$AM_CFLAGS -DUNIV_AIX";;
 
39
         irix*|osf*|sysv5uw7*|openbsd*)
 
40
           AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE";;
 
41
         *solaris*|*SunOS*)
 
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])
 
47
 
 
48
                AS_IF([test "${plugin_innodb_have_solaris_atomics}" = "yes"],[
 
49
                        AC_DEFINE([HAVE_SOLARIS_ATOMICS],
 
50
                                  [1],
 
51
                                  [Define to 1 if Solaris supports \
 
52
                                   atomic functions.])
 
53
                ])
 
54
                ### End Solaris atomic function checks
 
55
           AM_CFLAGS="$AM_CFLAGS -DUNIV_SOLARIS";;
 
56
  esac
 
57
  INNODB_DYNAMIC_CFLAGS="-DPANDORA_DYNAMIC_PLUGIN"
 
58
  case "$target_cpu" in
 
59
        x86_64)
 
60
                # The AMD64 ABI forbids absolute addresses in shared libraries
 
61
                ;;
 
62
        *86)
 
63
                # Use absolute addresses on IA-32
 
64
                INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
 
65
                ;;
 
66
  esac
 
67
  AC_SUBST(INNODB_DYNAMIC_CFLAGS)
 
68
 
 
69
  AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
 
70
    [ac_cv_plugin_innodb_have_gcc_atomic],[
 
71
    AC_RUN_IFELSE([
 
72
      AC_LANG_PROGRAM([[
 
73
      #include <pthread.h>
 
74
      #include <string.h>
 
75
      ]],[[
 
76
        pthread_t       x1;
 
77
        pthread_t       x2;
 
78
        pthread_t       x3;
 
79
 
 
80
        memset(&x1, 0x0, sizeof(x1));
 
81
        memset(&x2, 0x0, sizeof(x2));
 
82
        memset(&x3, 0x0, sizeof(x3));
 
83
 
 
84
        __sync_bool_compare_and_swap(&x1, x2, x3);
 
85
      ]])],
 
86
      [ac_cv_plugin_innodb_have_gcc_atomic=yes],
 
87
      [ac_cv_plugin_innodb_have_gcc_atomic=no])
 
88
    ])
 
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])
 
92
  ])
 
93
 
 
94
  AC_CACHE_CHECK(
 
95
    [whether __attribute__ visibility "hidden" is supported],
 
96
    [ac_cv_can_use_hidden_],[
 
97
      AC_LANG_PUSH(C++)
 
98
      dnl Must be done once we turn on warnings and such
 
99
      save_CXXFLAGS="${CXXFLAGS}"
 
100
      CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
 
101
      AC_LINK_IFELSE([
 
102
        AC_LANG_PROGRAM(
 
103
          [[
 
104
__attribute__((visibility ("hidden")))
 
105
void testme() {  }
 
106
          ]],[[testme()]]
 
107
        )],
 
108
        [ac_cv_can_use_hidden_=yes],
 
109
        [ac_cv_can_use_hidden_=no])
 
110
      CXXFLAGS="${save_CXXFLAGS}"
 
111
      AC_LANG_POP()])
 
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")))])
 
115
  ])
 
116
 
 
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])
 
120
    ],[
 
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],[
 
124
          AC_COMPILE_IFELSE([
 
125
            AC_LANG_PROGRAM([[
 
126
              #include <pthread.h>
 
127
            ]],[[
 
128
                pthread_t x = 0;
 
129
            ]])],[
 
130
              ac_cv_plugin_innodb_pthread_integral=yes
 
131
            ],[
 
132
              ac_cv_plugin_innodb_pthread_integral=no
 
133
            ])
 
134
        ])
 
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])
 
138
      ])
 
139
      # size of pthread_t is needed for typed solaris atomics
 
140
      AC_CHECK_SIZEOF([pthread_t], [], [
 
141
#include <pthread.h>
 
142
        ])
 
143
    ])
 
144
  ])
 
145
 
 
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");
 
159
    ]])],[
 
160
      ac_cv_plugin_innodb_has_pause=yes
 
161
    ],[
 
162
      ac_cv_plugin_innodb_has_pause=no
 
163
    ])
 
164
  ])
 
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])
 
169
  ])
 
170
 
 
171
])
 
172
 
 
173
AC_INNODB_ACTIONS
 
174
# vim: set ft=config: