~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/plug.in

pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.

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
MYSQL_STORAGE_ENGINE(innobase,  innodb, [InnoDB Storage Engine],
 
18
        [Transactional Tables using InnoDB], [max,max-no-ndb])
 
19
MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase])
 
20
MYSQL_PLUGIN_STATIC(innobase,   [libinnobase.a])
 
21
MYSQL_PLUGIN_DYNAMIC(innobase,  [ha_innodb.la])
 
22
MYSQL_PLUGIN_ACTIONS(innobase,  [
 
23
  AC_CHECK_HEADERS(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_C_BIGENDIAN
 
29
  case "$target_os" in
 
30
        lin*)
 
31
                CFLAGS="$CFLAGS -DUNIV_LINUX";;
 
32
        hpux10*)
 
33
                CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
 
34
        hp*)
 
35
                CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
 
36
        aix*)
 
37
                CFLAGS="$CFLAGS -DUNIV_AIX";;
 
38
        irix*|osf*|sysv5uw7*|openbsd*)
 
39
                CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
 
40
        *solaris*|*SunOS*)
 
41
                # Begin Solaris atomic function checks
 
42
                AC_CHECK_FUNCS(atomic_cas_ulong atomic_cas_32 \
 
43
                               atomic_cas_64 atomic_add_long,
 
44
                        AC_DEFINE(
 
45
                                [HAVE_SOLARIS_ATOMICS],
 
46
                                [1],
 
47
                                [Define to 1 if Solaris supports \
 
48
                                 atomic functions.]))
 
49
                ### End Solaris atomic function checks
 
50
 
 
51
                CFLAGS="$CFLAGS -DUNIV_SOLARIS";;
 
52
  esac
 
53
  INNODB_DYNAMIC_CFLAGS="-DPANDORA_DYNAMIC_PLUGIN"
 
54
  case "$target_cpu" in
 
55
        x86_64)
 
56
                # The AMD64 ABI forbids absolute addresses in shared libraries
 
57
                ;;
 
58
        *86)
 
59
                # Use absolute addresses on IA-32
 
60
                INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
 
61
                ;;
 
62
  esac
 
63
  AC_SUBST(INNODB_DYNAMIC_CFLAGS)
 
64
  AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
 
65
  AC_TRY_RUN(
 
66
    [
 
67
      #include <pthread.h>
 
68
      #include <string.h>
 
69
 
 
70
      int main(int argc, char** argv) {
 
71
        pthread_t       x1;
 
72
        pthread_t       x2;
 
73
        pthread_t       x3;
 
74
 
 
75
        memset(&x1, 0x0, sizeof(x1));
 
76
        memset(&x2, 0x0, sizeof(x2));
 
77
        memset(&x3, 0x0, sizeof(x3));
 
78
 
 
79
        __sync_bool_compare_and_swap(&x1, x2, x3);
 
80
 
 
81
        return(0);
 
82
      }
 
83
    ],
 
84
    [
 
85
      AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
 
86
                [pthread_t can be used by GCC atomic builtins])
 
87
      AC_MSG_RESULT(yes)
 
88
    ],
 
89
    [
 
90
      AC_MSG_RESULT(no)
 
91
    ]
 
92
    )
 
93
 
 
94
  # Try using solaris atomics on SunOS if GCC atomics are not available
 
95
  AC_CHECK_DECLS(
 
96
    [HAVE_ATOMIC_PTHREAD_T],
 
97
    [
 
98
      AC_MSG_NOTICE(no need to check pthread_t size)
 
99
    ],
 
100
    [
 
101
      AC_CHECK_DECLS(
 
102
        [HAVE_SOLARIS_ATOMICS],
 
103
        [
 
104
          AC_MSG_CHECKING(checking if pthread_t size is integral)
 
105
          AC_TRY_RUN(
 
106
            [
 
107
              #include <pthread.h>
 
108
              int main()
 
109
              {
 
110
                pthread_t x = 0;
 
111
                return(0);
 
112
              }
 
113
            ],
 
114
            [
 
115
              AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
 
116
                [pthread_t can be used by solaris atomics])
 
117
              AC_MSG_RESULT(yes)
 
118
              # size of pthread_t is needed for typed solaris atomics
 
119
              AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
 
120
            ],
 
121
            [
 
122
              AC_MSG_RESULT(no)
 
123
            ])
 
124
        ])
 
125
    ])
 
126
  # Check for x86 PAUSE instruction
 
127
  AC_MSG_CHECKING(for x86 PAUSE instruction)
 
128
  # We have to actually try running the test program, because of a bug
 
129
  # in Solaris on x86_64, where it wrongly reports that PAUSE is not
 
130
  # supported when trying to run an application. See
 
131
  # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
 
132
  # We use ib_ prefix to avoid collisoins if this code is added to
 
133
  # mysql's configure.in.
 
134
  AC_TRY_RUN(
 
135
    [
 
136
      int main() {
 
137
        __asm__ __volatile__ ("pause");
 
138
        return(0);
 
139
      }
 
140
    ],
 
141
    [
 
142
      AC_DEFINE([IB_HAVE_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
 
143
      AC_MSG_RESULT(yes)
 
144
    ],
 
145
    [
 
146
      AC_MSG_RESULT(no)
 
147
    ],
 
148
    [
 
149
      AC_MSG_RESULT(no)
 
150
    ]
 
151
  )
 
152
 
 
153
dnl Must be done once we turn on warnings and such
 
154
AC_CACHE_CHECK(
 
155
  [whether __attribute__ visibility "hidden" is supported],
 
156
  [ac_cv_can_use_hidden_],[
 
157
    AC_LANG_PUSH(C++)
 
158
    save_CXXFLAGS="${CXXFLAGS}"
 
159
    CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
 
160
    AC_LINK_IFELSE([
 
161
      AC_LANG_PROGRAM(
 
162
        [[
 
163
__attribute__((visibility ("hidden")))
 
164
void testme() {  }
 
165
        ]],[[testme()]]
 
166
      )],  
 
167
      [ac_cv_can_use_hidden_=yes],
 
168
      [ac_cv_can_use_hidden_=no])
 
169
    CXXFLAGS="${save_CXXFLAGS}"
 
170
    AC_LANG_POP()])
 
171
AS_IF([test "$ac_cv_can_use_hidden_" = "yes"],[
 
172
  AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
 
173
  [Define to 1 if you have support for __attribute__((visibility("hidden")))])
 
174
])
 
175
 
 
176
  ])
 
177
 
 
178
# vim: set ft=config: