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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#
--- mysql-4.1.15/acinclude.m4~autofoo
+++ mysql-4.1.15/acinclude.m4
@@ -1,5 +1,88 @@
# Local macros for automake & autoconf
+AH_TEMPLATE([SPRINTF_RETURNS_INT], [sprintf returns an int])
+AH_TEMPLATE([SPRINTF_RETURNS_PTR], [sprintf returns a char *])
+AH_TEMPLATE([SPRINTF_RETURNS_GARBAGE], [sprintf returns something unknown to us])
+
+AC_DEFUN([MYSQL_SPRINTF_RET], [
+ AC_CACHE_CHECK([return type of sprintf],
+ [mysql_cv_func_sprintf_ret], [
+ old_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror"
+ AC_COMPILE_IFELSE([
+#include <stdio.h>
+int sprintf(char *str, const char *format, ...);
+ ], [mysql_cv_func_sprintf_ret=int],
+ AC_COMPILE_IFELSE([
+#include <stdio.h>
+char * sprintf(char *str, const char *format, ...);
+ ], [mysql_cv_func_sprintf_ret=ptr],
+ [mysql_cv_func_sprintf_ret=unknown])
+ )
+ CFLAGS="$old_CFLAGS"
+ ])
+ if test x"$mysql_cv_func_sprintf_ret" = "xint"; then
+ AC_DEFINE([SPRINTF_RETURNS_INT], [1])
+ elif test x"$mysql_cv_func_sprintf_ret" = "xptr"; then
+ AC_DEFINE([SPRINTF_RETURNS_PTR], [1])
+ else
+ AC_DEFINE([SPRINTF_RETURNS_GARBAGE], [1])
+ fi
+])
+
+# _MYSQL_FUNC_ATOMIC_ADD
+# ----------------------
+# Check for Linux specific atomic_add function
+AC_DEFUN([_MYSQL_FUNC_ATOMIC_ADD],
+[AC_CACHE_CHECK([for atomic_add], [mysql_cv_func_atomic_add],
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <asm/atomic.h>]],
+ [
+int main()
+{
+ atomic_t v;
+
+ atomic_set(&v, 23);
+ atomic_add(5, &v);
+ return atomic_read(&v) == 28 ? 0 : -1;
+}
+ ])],
+ [mysql_cv_func_atomic_add=yes],
+ [mysql_cv_func_atomic_add=no])])
+ if test x"$mysql_func_atomic_add" = "xyes"; then
+ AC_DEFINE([HAVE_ATOMIC_ADD], [1])
+ fi[]dnl
+])# _MYSQL_FUNC_ATOMIC_ADD
+
+# _MYSQL_FUNC_ATOMIC_SUB
+# ----------------------
+# Check for Linux specific atomic_sub function
+AC_DEFUN([_MYSQL_FUNC_ATOMIC_SUB],
+[AC_CACHE_CHECK([for atomic_sub], [mysql_cv_func_atomic_sub],
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <asm/atomic.h>]],
+ [
+int main()
+{
+ atomic_t v;
+
+ atomic_set(&v, 23);
+ atomic_sub(5, &v);
+ return atomic_read(&v) == 18 ? 0 : -1;
+}
+ ])],
+ [mysql_cv_func_atomic_sub=yes],
+ [mysql_cv_func_atomic_sub=no])])
+ if test x"$mysql_func_atomic_sub" = "xyes"; then
+ AC_DEFINE([HAVE_ATOMIC_SUB], [1])
+ fi[]dnl
+])# _MYSQL_FUNC_ATOMIC_SUB
+
+# MYSQL_FUNCS_ATOMIC
+# ------------------
+# Check for Linux specific atomic add and sub functions
+AC_DEFUN([MYSQL_FUNCS_ATOMIC], [
+ AC_REQUIRE([_MYSQL_FUNC_ATOMIC_ADD])dnl
+ AC_REQUIRE([_MYSQL_FUNC_ATOMIC_SUB])dnl
+])# MYSQL_FUNCS_ATOMIC
AC_DEFUN([MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY], [
AC_CACHE_CHECK([HIST_ENTRY is declared in readline/readline.h], mysql_cv_hist_entry_declared,
@@ -340,7 +423,7 @@
AC_DEFUN([MYSQL_CHECK_ULONG],
[AC_MSG_CHECKING(for type ulong)
AC_CACHE_VAL(ac_cv_ulong,
-[AC_TRY_RUN([#include <stdio.h>
+[AC_TRY_LINK([#include <stdio.h>
#include <sys/types.h>
main()
{
@@ -358,7 +441,7 @@
AC_DEFUN([MYSQL_CHECK_UCHAR],
[AC_MSG_CHECKING(for type uchar)
AC_CACHE_VAL(ac_cv_uchar,
-[AC_TRY_RUN([#include <stdio.h>
+[AC_TRY_LINK([#include <stdio.h>
#include <sys/types.h>
main()
{
@@ -376,7 +459,7 @@
AC_DEFUN([MYSQL_CHECK_UINT],
[AC_MSG_CHECKING(for type uint)
AC_CACHE_VAL(ac_cv_uint,
-[AC_TRY_RUN([#include <stdio.h>
+[AC_TRY_LINK([#include <stdio.h>
#include <sys/types.h>
main()
{
@@ -395,7 +478,7 @@
AC_DEFUN([MYSQL_CHECK_IN_ADDR_T],
[AC_MSG_CHECKING(for type in_addr_t)
AC_CACHE_VAL(ac_cv_in_addr_t,
-[AC_TRY_RUN([#include <stdio.h>
+[AC_TRY_LINK([#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -456,7 +539,7 @@
AC_DEFUN([MYSQL_CHECK_FP_EXCEPT],
[AC_MSG_CHECKING(for type fp_except)
AC_CACHE_VAL(ac_cv_fp_except,
-[AC_TRY_RUN([#include <stdio.h>
+[AC_TRY_LINK([#include <stdio.h>
#include <sys/types.h>
#include <ieeefp.h>
main()
--- mysql-4.1.15/configure.in~autofoo
+++ mysql-4.1.15/configure.in
@@ -234,8 +234,6 @@
else
AC_PATH_PROG(AS, as, as)
fi
-# Still need ranlib for readline; local static use only so no libtool.
-AC_PROG_RANLIB
# We use libtool
#AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
@@ -256,44 +254,7 @@
AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
AC_CHECK_PROG(DVIS, tex, manual.dvi)
-AC_MSG_CHECKING("return type of sprintf")
-
-#check the return type of sprintf
-case $SYSTEM_TYPE in
- *netware*)
- AC_DEFINE(SPRINTF_RETURNS_INT, [1]) AC_MSG_RESULT("int")
- ;;
- *)
-AC_TRY_RUN([
- int main()
- {
- char* s = "hello";
- char buf[6];
- if((int)sprintf(buf, s) == strlen(s))
- return 0;
-
- return -1;
- }
- ],
- [AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
- AC_MSG_RESULT("int")],
- [AC_TRY_RUN([
- int main()
- {
- char* s = "hello";
- char buf[6];
- if((char*)sprintf(buf,s) == buf + strlen(s))
- return 0;
- return -1;
- } ],
- [AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
- AC_MSG_RESULT("ptr")],
- [AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
- AC_MSG_RESULT("garbage")])
- ])
- ;;
-esac
-
+MYSQL_SPRINTF_RET
# option, cache_name, variable,
# code to execute if yes, code to exectute if fail
@@ -870,42 +831,7 @@
AC_SUBST(WRAPLIBS)
if test "$TARGET_LINUX" = "true"; then
- AC_MSG_CHECKING([for atomic operations])
-
- atom_ops=
- AC_TRY_RUN([
-#include <asm/atomic.h>
-int main()
-{
- atomic_t v;
-
- atomic_set(&v, 23);
- atomic_add(5, &v);
- return atomic_read(&v) == 28 ? 0 : -1;
-}
- ],
- [AC_DEFINE([HAVE_ATOMIC_ADD], [1],
- [atomic_add() from <asm/atomic.h> (Linux only)])
- atom_ops="${atom_ops}atomic_add "],
- )
- AC_TRY_RUN([
-#include <asm/atomic.h>
-int main()
-{
- atomic_t v;
-
- atomic_set(&v, 23);
- atomic_sub(5, &v);
- return atomic_read(&v) == 18 ? 0 : -1;
-}
- ],
- [AC_DEFINE([HAVE_ATOMIC_SUB], [1],
- [atomic_sub() from <asm/atomic.h> (Linux only)])
- atom_ops="${atom_ops}atomic_sub "],
- )
-
- if test -z "$atom_ops"; then atom_ops="no"; fi
- AC_MSG_RESULT($atom_ops)
+ MYSQL_FUNCS_ATOMIC
AC_ARG_WITH(pstack,
[ --with-pstack Use the pstack backtrace library],
@@ -958,13 +884,13 @@
# Later in this script LIBS will be augmented with a threads library.
NON_THREADED_LIBS="$LIBS"
-AC_MSG_CHECKING([for int8])
+AC_CACHE_CHECK([for int8], [mysql_cv_type_int8], [
case $SYSTEM_TYPE in
*netware)
- AC_MSG_RESULT([no])
+ mysql_cv_type_int8=no
;;
*)
-AC_TRY_RUN([
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@ -975,22 +901,21 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
+#endif]], [
int main()
{
int8 i;
return 0;
-}
-],
-[AC_DEFINE([HAVE_INT_8_16_32], [1],
- [whether int8, int16 and int32 types exist])
-AC_MSG_RESULT([yes])],
-[AC_MSG_RESULT([no])]
-)
+}])], [mysql_cv_type_int8=yes], [mysql_cv_type_int8=no])
;;
esac
+if test x"$mysql_cv_type_int8" = "xyes"; then
+ AC_DEFINE([HAVE_INT_8_16_32], [1],
+ [whether int8, int16 and int32 types exist])
+fi
+])
+
#
# Some system specific hacks
#
@@ -1798,7 +1723,7 @@
AC_MSG_ERROR("MySQL needs a long long type.")
fi
# off_t is not a builtin type
-MYSQL_CHECK_SIZEOF(off_t, 4)
+AC_CHECK_SIZEOF(off_t, 4)
if test "$ac_cv_sizeof_off_t" -eq 0
then
AC_MSG_ERROR("MySQL needs a off_t type.")
--- mysql-4.1.15/innobase/configure.in~autofoo
+++ mysql-4.1.15/innobase/configure.in
@@ -3,6 +3,7 @@
AC_CANONICAL_SYSTEM
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(ib_config.h)
+AC_CONFIG_AUX_DIR([..])
AM_INIT_AUTOMAKE(ib, 0.90)
# This is need before AC_PROG_CC
@@ -32,7 +33,6 @@
CXXFLAGS="$CXXFLAGS "
AC_PROG_CC
-AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_CHECK_HEADERS(aio.h sched.h)
|