summaryrefslogtreecommitdiff
path: root/package/mysql/0000-ac_cache_check.patch
blob: c3b55ba8d39de87edc6b3263ca5ec08f192349a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
Patch borrowed from
http://code.google.com/p/minimyth/source/browse/trunk/gar-minimyth/script/db/mysql/files/mysql-5.1.47-ac_cache_check.patch?r=6493.

It allows to override through ac_cv_* variables various checks that
cannot be performed when cross-compiling.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

---
 storage/innodb_plugin/plug.in |   59 ++++++++++++++++++++++++++++--------------
 1 file changed, 40 insertions(+), 19 deletions(-)

Index: mysql-5.1.53/storage/innodb_plugin/plug.in
===================================================================
--- mysql-5.1.53.orig/storage/innodb_plugin/plug.in
+++ mysql-5.1.53/storage/innodb_plugin/plug.in
@@ -53,9 +53,10 @@
   esac
   AC_SUBST(INNODB_DYNAMIC_CFLAGS)
 
-  AC_MSG_CHECKING(whether GCC atomic builtins are available)
+  AC_CACHE_CHECK([whether GCC atomic builtins are available],
+                 [ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS],
   # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
-  AC_TRY_RUN(
+  [AC_TRY_RUN(
     [
       int main()
       {
@@ -95,18 +96,23 @@
       }
     ],
     [
-      AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
-                [GCC atomic builtins are available])
       AC_MSG_RESULT(yes)
+      ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS=yes
     ],
     [
       AC_MSG_RESULT(no)
+      ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS=no
     ]
-  )
+  )])
+  if test "x$ac_cv_have_decl_HAVE_IB_GCC_ATOMIC_BUILTINS"= "xyes" ; then
+    AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
+              [GCC atomic builtins are available])
+  fi
 
-  AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
+  AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
+                 [ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC],
   # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
-  AC_TRY_RUN(
+  [AC_TRY_RUN(
     [
       #include <pthread.h>
       #include <string.h>
@@ -126,14 +132,18 @@
       }
     ],
     [
-      AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
-                [pthread_t can be used by GCC atomic builtins])
       AC_MSG_RESULT(yes)
+      ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC=yes
     ],
     [
       AC_MSG_RESULT(no)
+      ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC=no
     ]
-  )
+  )])
+  if test "x$ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_GCC"= "xyes" ; then
+    AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
+              [pthread_t can be used by GCC atomic builtins])
+  fi
 
   AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
   # either define HAVE_IB_SOLARIS_ATOMICS or not
@@ -148,9 +158,10 @@
 			    are available])
   )
 
-  AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
+  AC_CACHE_CHECK([whether pthread_t can be used by Solaris libc atomic functions],
+                 [ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS],
   # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
-  AC_TRY_RUN(
+  [AC_TRY_RUN(
     [
       #include <pthread.h>
       #include <string.h>
@@ -181,28 +192,33 @@
       }
     ],
     [
-      AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
-                [pthread_t can be used by solaris atomics])
       AC_MSG_RESULT(yes)
+      ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS=yes
     ],
     [
       AC_MSG_RESULT(no)
+      ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS=no
     ]
-  )
+  )])
+  if test "x$ac_cv_have_decl_HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS"= "xyes" ; then
+    AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
+              [pthread_t can be used by solaris atomics])
+  fi
 
   # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
   # to use in the source
   AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
 
   # Check for x86 PAUSE instruction
-  AC_MSG_CHECKING(for x86 PAUSE instruction)
+  AC_CACHE_CHECK([for x86 PAUSE instruction],
+                 [ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION],
   # We have to actually try running the test program, because of a bug
   # in Solaris on x86_64, where it wrongly reports that PAUSE is not
   # supported when trying to run an application. See
   # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
   # We use ib_ prefix to avoid collisoins if this code is added to
   # mysql's configure.in.
-  AC_TRY_RUN(
+  [AC_TRY_RUN(
     [
       int main() {
         __asm__ __volatile__ ("pause");
@@ -210,16 +226,21 @@
       }
     ],
     [
-      AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
       AC_MSG_RESULT(yes)
+      ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION=yes
     ],
     [
       AC_MSG_RESULT(no)
+      ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION=no
     ],
     [
       AC_MSG_RESULT(no)
+      ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION=no
     ]
-  )
+  )])
+  if test "x$ac_cv_have_decl_HAVE_IB_PAUSE_INSTRUCTION"= "xyes" ; then
+    AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist])
+  fi
   ])
 
 # vim: set ft=config: