~drizzle-trunk/drizzle/development

1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
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
1802.10.2 by Monty Taylor
Update all of the copyright headers to include the correct address.
13
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
14
# St, Fifth Floor, Boston, MA 02110-1301 USA
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
15
#
16
17
AC_DEFUN([AC_INNODB_ACTIONS],[
1823.5.1 by Monty Taylor
Updated pandora-build files to version 0.157
18
  PANDORA_REQUIRE_FLEX
1730.7.4 by Hartmut Holzgraefe
lex/yacc check for Innobase modified
19
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
20
  AC_REQUIRE([AC_FUNC_MMAP])
21
22
  AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"])
23
  AC_SUBST(innodb_system_libs)
24
  AC_CHECK_HEADERS(aio.h sched.h)
25
  AC_CHECK_SIZEOF(int, 4)
26
  AC_CHECK_SIZEOF(long, 4)
27
  AC_CHECK_SIZEOF(void*, 4)
1192.3.43 by Monty Taylor
Removed many, many checks for functions that do not need to be checked.
28
  AC_CHECK_FUNCS(sched_yield fdatasync localtime_r pread)
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
29
  AC_CHECK_FUNCS([uname munmap memchr getpagesize bzero])
30
  AC_C_BIGENDIAN
31
  case "$target_os" in
32
         lin*)
33
           AM_CFLAGS="$AM_CFLAGS -DUNIV_LINUX";;
34
         hpux10*)
35
           AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";;
36
         hp*)
37
           AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";;
38
         aix*)
39
           AM_CFLAGS="$AM_CFLAGS -DUNIV_AIX";;
40
         irix*|osf*|sysv5uw7*|openbsd*)
41
           AM_CFLAGS="$AM_CFLAGS -DUNIV_MUST_NOT_INLINE";;
42
	 *solaris*|*SunOS*)
43
		# Begin Solaris atomic function checks
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
44
		AC_CHECK_FUNCS([atomic_cas_ulong atomic_cas_32 \
45
			       atomic_cas_64 atomic_add_long],
46
                              [plugin_innodb_have_solaris_atomics=yes],
47
                              [plugin_innodb_have_solaris_atomics=no])
48
 
49
                AS_IF([test "${plugin_innodb_have_solaris_atomics}" = "yes"],[
50
			AC_DEFINE([HAVE_SOLARIS_ATOMICS],
51
				  [1],
52
			  	  [Define to 1 if Solaris supports \
53
				   atomic functions.])
54
                ])
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
55
		### End Solaris atomic function checks
56
           AM_CFLAGS="$AM_CFLAGS -DUNIV_SOLARIS";;
57
  esac
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
58
  INNODB_DYNAMIC_CFLAGS="-DPANDORA_DYNAMIC_PLUGIN"
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
59
  case "$target_cpu" in
60
	x86_64)
61
		# The AMD64 ABI forbids absolute addresses in shared libraries
62
		;;
63
	*86)
64
		# Use absolute addresses on IA-32
65
		INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic"
66
		;;
67
  esac
68
  AC_SUBST(INNODB_DYNAMIC_CFLAGS)
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
69
70
  AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
71
    [ac_cv_plugin_innodb_have_gcc_atomic],[
72
    AC_RUN_IFELSE([
73
      AC_LANG_PROGRAM([[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
74
      #include <pthread.h>
75
      #include <string.h>
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
76
      ]],[[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
77
        pthread_t       x1;
78
        pthread_t       x2;
79
        pthread_t       x3;
80
81
	memset(&x1, 0x0, sizeof(x1));
82
	memset(&x2, 0x0, sizeof(x2));
83
	memset(&x3, 0x0, sizeof(x3));
84
85
        __sync_bool_compare_and_swap(&x1, x2, x3);
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
86
      ]])],
87
      [ac_cv_plugin_innodb_have_gcc_atomic=yes],
88
      [ac_cv_plugin_innodb_have_gcc_atomic=no])
89
    ])
90
  AS_IF([test "${ac_cv_plugin_innodb_have_gcc_atomic}" = "yes"],[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
91
      AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
92
                [pthread_t can be used by GCC atomic builtins])
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
93
  ])
94
95
  AC_CACHE_CHECK(
96
    [whether __attribute__ visibility "hidden" is supported],
97
    [ac_cv_can_use_hidden_],[
98
      AC_LANG_PUSH(C++)
99
      dnl Must be done once we turn on warnings and such
100
      save_CXXFLAGS="${CXXFLAGS}"
101
      CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
102
      AC_LINK_IFELSE([
103
        AC_LANG_PROGRAM(
104
          [[
105
__attribute__((visibility ("hidden")))
106
void testme() {  }
107
          ]],[[testme()]]
108
        )],
109
        [ac_cv_can_use_hidden_=yes],
110
        [ac_cv_can_use_hidden_=no])
111
      CXXFLAGS="${save_CXXFLAGS}"
112
      AC_LANG_POP()])
113
  AS_IF([test "$ac_cv_can_use_hidden_" = "yes"],[
114
    AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
115
    [Define to 1 if you have support for __attribute__((visibility("hidden")))])
116
  ])
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
117
118
  # Try using solaris atomics on SunOS if GCC atomics are not available
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
119
  AS_IF([test "${ac_cv_plugin_innodb_have_gcc_atomic}" = "yes"],[
120
      AC_MSG_NOTICE([no need to check pthread_t size])
121
    ],[
122
    AS_IF([test "${ac_cv_plugin_innodb_have_solaris_atomics}" = "yes"],[
123
      AC_CACHE_CHECK([checking if pthread_t size is integral],
124
        [ac_cv_plugin_innodb_pthread_integral],[
125
          AC_COMPILE_IFELSE([
126
            AC_LANG_PROGRAM([[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
127
              #include <pthread.h>
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
128
            ]],[[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
129
                pthread_t x = 0;
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
130
            ]])],[
131
              ac_cv_plugin_innodb_pthread_integral=yes
132
            ],[
133
              ac_cv_plugin_innodb_pthread_integral=no
134
            ])
135
        ])
136
      AS_IF([test "${ac_cv_plugin_innodb_pthread_integral}" = "yes"],[        
137
        AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
138
                [pthread_t can be used by solaris atomics])
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
139
      ])
140
      # size of pthread_t is needed for typed solaris atomics
141
      AC_CHECK_SIZEOF([pthread_t], [], [
142
#include <pthread.h>
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
143
        ])
144
    ])
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
145
  ])
146
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
147
  # Check for x86 PAUSE instruction
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
148
  AC_CACHE_CHECK([for x86 PAUSE instruction],[ac_cv_plugin_innodb_has_pause],[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
149
  # We have to actually try running the test program, because of a bug
150
  # in Solaris on x86_64, where it wrongly reports that PAUSE is not
151
  # supported when trying to run an application. See
152
  # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
153
  # We use ib_ prefix to avoid collisoins if this code is added to
154
  # mysql's configure.in.
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
155
  AC_RUN_IFELSE([AC_LANG_PROGRAM([[]],[[
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
156
        __asm__ __volatile__ ("pause");
1114.1.6 by Monty Taylor
Fixed plugin.ac file. (I hope)
157
    ]])],[
158
      ac_cv_plugin_innodb_has_pause=yes
159
    ],[
160
      ac_cv_plugin_innodb_has_pause=no
161
    ])
162
  ])
163
  AS_IF([test "${ac_cv_plugin_innodb_has_pause}" = "yes"],[
164
    AC_DEFINE([IB_HAVE_PAUSE_INSTRUCTION], [1],
165
              [Does x86 PAUSE instruction exist])
166
  ])
167
168
])
1114.1.1 by Monty Taylor
Merged InnoDB Plugin 1.0.4
169
170
AC_INNODB_ACTIONS
171
# vim: set ft=config: