~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to config/ac-macros/misc.m4

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Local macros for automake & autoconf
 
2
 
 
3
#---START: Used in for client configure
 
4
AC_DEFUN([MYSQL_TYPE_ACCEPT],
 
5
[ac_save_CXXFLAGS="$CXXFLAGS"
 
6
AC_CACHE_CHECK([base type of last arg to accept], mysql_cv_btype_last_arg_accept,
 
7
AC_LANG_PUSH(C++)
 
8
if test "$ac_cv_prog_gxx" = "yes"
 
9
then
 
10
  # Add -Werror, remove -fbranch-probabilities (Bug #268)
 
11
  CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
 
12
fi
 
13
mysql_cv_btype_last_arg_accept=none
 
14
[AC_TRY_COMPILE([#if defined(inline)
 
15
#undef inline
 
16
#endif
 
17
#include <stdlib.h>
 
18
#include <sys/types.h>
 
19
#include <sys/socket.h>
 
20
],
 
21
[int a = accept(1, (struct sockaddr *) 0, (socklen_t *) 0); return (a != 0);],
 
22
mysql_cv_btype_last_arg_accept=socklen_t)]
 
23
if test "$mysql_cv_btype_last_arg_accept" = "none"; then
 
24
[AC_TRY_COMPILE([#if defined(inline)
 
25
#undef inline
 
26
#endif
 
27
#include <stdlib.h>
 
28
#include <sys/types.h>
 
29
#include <sys/socket.h>
 
30
],
 
31
[int a = accept(1, (struct sockaddr *) 0, (size_t *) 0); return (a != 0);],
 
32
mysql_cv_btype_last_arg_accept=size_t)]
 
33
fi
 
34
if test "$mysql_cv_btype_last_arg_accept" = "none"; then
 
35
mysql_cv_btype_last_arg_accept=int
 
36
fi)
 
37
AC_LANG_POP(C++)
 
38
AC_DEFINE_UNQUOTED([SOCKET_SIZE_TYPE], [$mysql_cv_btype_last_arg_accept],
 
39
                   [The base type of the last arg to accept])
 
40
CXXFLAGS="$ac_save_CXXFLAGS"
 
41
])
 
42
#---END:
 
43
 
 
44
dnl Find type of qsort
 
45
AC_DEFUN([MYSQL_TYPE_QSORT],
 
46
[AC_CACHE_CHECK([return type of qsort], mysql_cv_type_qsort,
 
47
[AC_TRY_COMPILE([#include <stdlib.h>
 
48
#ifdef __cplusplus
 
49
extern "C"
 
50
#endif
 
51
void qsort(void *base, size_t nel, size_t width,
 
52
 int (*compar) (const void *, const void *));
 
53
],
 
54
[int i;], mysql_cv_type_qsort=void, mysql_cv_type_qsort=int)])
 
55
AC_DEFINE_UNQUOTED([RETQSORTTYPE], [$mysql_cv_type_qsort],
 
56
                   [The return type of qsort (int or void).])
 
57
if test "$mysql_cv_type_qsort" = "void"
 
58
then
 
59
 AC_DEFINE_UNQUOTED([QSORT_TYPE_IS_VOID], [1], [qsort returns void])
 
60
fi
 
61
])
 
62
 
 
63
#---START: Figure out whether to use 'struct rlimit' or 'struct rlimit64'
 
64
AC_DEFUN([MYSQL_TYPE_STRUCT_RLIMIT],
 
65
[ac_save_CXXFLAGS="$CXXFLAGS"
 
66
AC_CACHE_CHECK([struct type to use with setrlimit], mysql_cv_btype_struct_rlimit,
 
67
AC_LANG_PUSH(C++)
 
68
if test "$ac_cv_prog_gxx" = "yes"
 
69
then
 
70
  # Add -Werror, remove -fbranch-probabilities (Bug #268)
 
71
  CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-Wcheck//'`
 
72
fi
 
73
mysql_cv_btype_struct_rlimit=none
 
74
[AC_TRY_COMPILE([#if defined(inline)
 
75
#undef inline
 
76
#endif
 
77
#include <stdlib.h>
 
78
#include <sys/resource.h>
 
79
],
 
80
[struct rlimit64 rl; setrlimit(RLIMIT_CORE, &rl);],
 
81
mysql_cv_btype_struct_rlimit="struct rlimit64")]
 
82
if test "$mysql_cv_btype_struct_rlimit" = "none"; then
 
83
mysql_cv_btype_struct_rlimit="struct rlimit"
 
84
fi)
 
85
AC_LANG_POP(C++)
 
86
AC_DEFINE_UNQUOTED([STRUCT_RLIMIT], [$mysql_cv_btype_struct_rlimit],
 
87
                   [The struct rlimit type to use with setrlimit])
 
88
CXXFLAGS="$ac_save_CXXFLAGS"
 
89
])
 
90
#---END:
 
91
 
 
92
AC_DEFUN([MYSQL_TIMESPEC_TS],
 
93
[AC_CACHE_CHECK([if struct timespec has a ts_sec member], mysql_cv_timespec_ts,
 
94
[AC_TRY_COMPILE([#include <pthread.h>
 
95
#ifdef __cplusplus
 
96
extern "C"
 
97
#endif
 
98
],
 
99
[struct timespec abstime;
 
100
 
 
101
abstime.ts_sec = time(NULL)+1;
 
102
abstime.ts_nsec = 0;
 
103
], mysql_cv_timespec_ts=yes, mysql_cv_timespec_ts=no)])
 
104
if test "$mysql_cv_timespec_ts" = "yes"
 
105
then
 
106
  AC_DEFINE([HAVE_TIMESPEC_TS_SEC], [1],
 
107
            [Timespec has a ts_sec instead of tv_sev])
 
108
fi
 
109
])
 
110
 
 
111
AC_DEFUN([MYSQL_TZNAME],
 
112
[AC_CACHE_CHECK([if we have tzname variable], mysql_cv_tzname,
 
113
[AC_TRY_COMPILE([#include <time.h>
 
114
#ifdef __cplusplus
 
115
extern "C"
 
116
#endif
 
117
],
 
118
[ tzset();
 
119
  return tzname[0] != 0;
 
120
], mysql_cv_tzname=yes, mysql_cv_tzname=no)])
 
121
if test "$mysql_cv_tzname" = "yes"
 
122
then
 
123
  AC_DEFINE([HAVE_TZNAME], [1], [Have the tzname variable])
 
124
fi
 
125
])
 
126
 
 
127
 
 
128
AC_DEFUN([MYSQL_PTHREAD_YIELD],
 
129
[AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
 
130
[AC_TRY_LINK([#define _GNU_SOURCE
 
131
#include <pthread.h>
 
132
#ifdef __cplusplus
 
133
extern "C"
 
134
#endif
 
135
],
 
136
[
 
137
  pthread_yield();
 
138
], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
 
139
if test "$ac_cv_pthread_yield_zero_arg" = "yes"
 
140
then
 
141
  AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
 
142
            [pthread_yield that doesn't take any arguments])
 
143
fi
 
144
]
 
145
[AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
 
146
[AC_TRY_LINK([#define _GNU_SOURCE
 
147
#include <pthread.h>
 
148
#ifdef __cplusplus
 
149
extern "C"
 
150
#endif
 
151
],
 
152
[
 
153
  pthread_yield(0);
 
154
], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
 
155
if test "$ac_cv_pthread_yield_one_arg" = "yes"
 
156
then
 
157
  AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
 
158
            [pthread_yield function with one argument])
 
159
fi
 
160
]
 
161
)
 
162
 
 
163
 
 
164
 
 
165
#---END:
 
166
 
 
167
# From fileutils-3.14/aclocal.m4
 
168
 
 
169
# @defmac AC_PROG_CC_STDC
 
170
# @maindex PROG_CC_STDC
 
171
# @ovindex CC
 
172
# If the C compiler in not in ANSI C mode by default, try to add an option
 
173
# to output variable @code{CC} to make it so.  This macro tries various
 
174
# options that select ANSI C on some system or another.  It considers the
 
175
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
 
176
# handles function prototypes correctly.
 
177
#
 
178
# Patched by monty to only check if __STDC__ is defined. With the original 
 
179
# check it's impossible to get things to work with the Sunpro compiler from
 
180
# Workshop 4.2
 
181
#
 
182
# If you use this macro, you should check after calling it whether the C
 
183
# compiler has been set to accept ANSI C; if not, the shell variable
 
184
# @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
 
185
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
 
186
# program @code{ansi2knr}, which comes with Ghostscript.
 
187
# @end defmac
 
188
 
 
189
AC_DEFUN([AM_PROG_CC_STDC],
 
190
[AC_REQUIRE([AC_PROG_CC])
 
191
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
 
192
AC_CACHE_VAL(am_cv_prog_cc_stdc,
 
193
[am_cv_prog_cc_stdc=no
 
194
ac_save_CC="$CC"
 
195
# Don't try gcc -ansi; that turns off useful extensions and
 
196
# breaks some systems' header files.
 
197
# AIX                   -qlanglvl=ansi
 
198
# Ultrix and OSF/1      -std1
 
199
# HP-UX                 -Aa -D_HPUX_SOURCE
 
200
# SVR4                  -Xc -D__EXTENSIONS__
 
201
# removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it.
 
202
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" 
 
203
do
 
204
  CC="$ac_save_CC $ac_arg"
 
205
  AC_TRY_COMPILE(
 
206
[#if !defined(__STDC__)
 
207
choke me
 
208
#endif
 
209
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
 
210
#ifdef _SEQUENT_
 
211
# include <sys/types.h>
 
212
# include <sys/stat.h>
 
213
#endif
 
214
], [
 
215
int test (int i, double x);
 
216
struct s1 {int (*f) (int a);};
 
217
struct s2 {int (*f) (double a);};],
 
218
[am_cv_prog_cc_stdc="$ac_arg"; break])
 
219
done
 
220
CC="$ac_save_CC"
 
221
])
 
222
AC_MSG_RESULT($am_cv_prog_cc_stdc)
 
223
case "x$am_cv_prog_cc_stdc" in
 
224
  x|xno) ;;
 
225
  *) CC="$CC $am_cv_prog_cc_stdc" ;;
 
226
esac
 
227
])
 
228
 
 
229
# Orginal from bash-2.0 aclocal.m4, Changed to use termcap last by monty.
 
230
 
 
231
AC_DEFUN([MYSQL_CHECK_LIB_TERMCAP],
 
232
[
 
233
AC_CACHE_VAL(mysql_cv_termcap_lib,
 
234
    [AC_CHECK_LIB(ncursesw, tgetent, mysql_cv_termcap_lib=libncursesw,
 
235
        [AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
 
236
            [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
 
237
                [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
 
238
                    [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
 
239
                        mysql_cv_termcap_lib=NOT_FOUND)])])])])])
 
240
AC_MSG_CHECKING(for termcap functions library)
 
241
if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
 
242
AC_MSG_ERROR([No curses/termcap library found])
 
243
elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
 
244
TERMCAP_LIB=-ltermcap
 
245
elif test "$mysql_cv_termcap_lib" = "libncursesw"; then
 
246
TERMCAP_LIB=-lncursesw
 
247
elif test "$mysql_cv_termcap_lib" = "libncurses"; then
 
248
TERMCAP_LIB=-lncurses
 
249
elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
 
250
TERMCAP_LIB=-ltinfo
 
251
else
 
252
TERMCAP_LIB=-lcurses
 
253
fi
 
254
AC_MSG_RESULT($TERMCAP_LIB)
 
255
])
 
256
 
 
257
dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
 
258
AC_DEFUN([MYSQL_SIGNAL_CHECK],
 
259
[AC_REQUIRE([AC_TYPE_SIGNAL])
 
260
AC_MSG_CHECKING(for type of signal functions)
 
261
AC_CACHE_VAL(mysql_cv_signal_vintage,
 
262
[
 
263
  AC_TRY_LINK([#include <signal.h>],[
 
264
    sigset_t ss;
 
265
    struct sigaction sa;
 
266
    sigemptyset(&ss); sigsuspend(&ss);
 
267
    sigaction(SIGINT, &sa, (struct sigaction *) 0);
 
268
    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
 
269
  ], mysql_cv_signal_vintage=posix,
 
270
  [
 
271
    AC_TRY_LINK([#include <signal.h>], [
 
272
        int mask = sigmask(SIGINT);
 
273
        sigsetmask(mask); sigblock(mask); sigpause(mask);
 
274
    ], mysql_cv_signal_vintage=4.2bsd,
 
275
    [
 
276
      AC_TRY_LINK([
 
277
        #include <signal.h>
 
278
        RETSIGTYPE foo() { }], [
 
279
                int mask = sigmask(SIGINT);
 
280
                sigset(SIGINT, foo); sigrelse(SIGINT);
 
281
                sighold(SIGINT); sigpause(SIGINT);
 
282
        ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7
 
283
    )]
 
284
  )]
 
285
)
 
286
])
 
287
AC_MSG_RESULT($mysql_cv_signal_vintage)
 
288
if test "$mysql_cv_signal_vintage" = posix; then
 
289
AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
 
290
          [Signal handling is POSIX (sigset/sighold, etc)])
 
291
elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
 
292
AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
 
293
elif test "$mysql_cv_signal_vintage" = svr3; then
 
294
AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
 
295
fi
 
296
])
 
297
 
 
298
AC_DEFUN([MYSQL_CHECK_GETPW_FUNCS],
 
299
[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
 
300
AC_CACHE_VAL(mysql_cv_can_redecl_getpw,
 
301
[AC_TRY_COMPILE([#include <sys/types.h>
 
302
#include <pwd.h>
 
303
extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
 
304
  mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
 
305
AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
 
306
if test "$mysql_cv_can_redecl_getpw" = "no"; then
 
307
AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
 
308
fi
 
309
])
 
310
 
 
311
AC_DEFUN([MYSQL_HAVE_TIOCGWINSZ],
 
312
[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
 
313
AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
 
314
[AC_TRY_COMPILE([#include <sys/types.h>
 
315
#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
 
316
  mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
 
317
AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
 
318
if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then   
 
319
AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
 
320
          [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
 
321
fi
 
322
])
 
323
 
 
324
AC_DEFUN([MYSQL_HAVE_FIONREAD],
 
325
[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
 
326
AC_CACHE_VAL(mysql_cv_fionread_in_ioctl,
 
327
[AC_TRY_COMPILE([#include <sys/types.h>
 
328
#include <sys/ioctl.h>], [int x = FIONREAD;],
 
329
  mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)])
 
330
AC_MSG_RESULT($mysql_cv_fionread_in_ioctl)
 
331
if test "$mysql_cv_fionread_in_ioctl" = "yes"; then   
 
332
AC_DEFINE([FIONREAD_IN_SYS_IOCTL], [1], [Do we have FIONREAD])
 
333
fi
 
334
])
 
335
 
 
336
AC_DEFUN([MYSQL_HAVE_TIOCSTAT],
 
337
[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
 
338
AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
 
339
[AC_TRY_COMPILE([#include <sys/types.h>
 
340
#include <sys/ioctl.h>], [int x = TIOCSTAT;],
 
341
  mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
 
342
AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
 
343
if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then   
 
344
AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
 
345
          [declaration of TIOCSTAT in sys/ioctl.h])
 
346
fi
 
347
])
 
348
 
 
349
AC_DEFUN([MYSQL_STRUCT_DIRENT_D_INO],
 
350
[AC_REQUIRE([AC_HEADER_DIRENT])
 
351
AC_MSG_CHECKING(if struct dirent has a d_ino member)
 
352
AC_CACHE_VAL(mysql_cv_dirent_has_dino,
 
353
[AC_TRY_COMPILE([
 
354
#include <stdio.h>
 
355
#include <sys/types.h>
 
356
#ifdef HAVE_UNISTD_H
 
357
# include <unistd.h>
 
358
#endif /* HAVE_UNISTD_H */
 
359
#if defined(HAVE_DIRENT_H)
 
360
# include <dirent.h>
 
361
#else
 
362
# define dirent direct
 
363
# ifdef HAVE_SYS_NDIR_H
 
364
#  include <sys/ndir.h>
 
365
# endif /* SYSNDIR */
 
366
# ifdef HAVE_SYS_DIR_H
 
367
#  include <sys/dir.h>
 
368
# endif /* SYSDIR */
 
369
# ifdef HAVE_NDIR_H
 
370
#  include <ndir.h>
 
371
# endif
 
372
#endif /* HAVE_DIRENT_H */
 
373
],[
 
374
struct dirent d; int z; z = d.d_ino;
 
375
], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)])
 
376
AC_MSG_RESULT($mysql_cv_dirent_has_dino)
 
377
if test "$mysql_cv_dirent_has_dino" = "yes"; then
 
378
AC_DEFINE(STRUCT_DIRENT_HAS_D_INO, [1],
 
379
          [d_ino member present in struct dirent])
 
380
fi
 
381
])
 
382
 
 
383
AC_DEFUN([MYSQL_STRUCT_DIRENT_D_NAMLEN],
 
384
[AC_REQUIRE([AC_HEADER_DIRENT])
 
385
AC_MSG_CHECKING(if struct dirent has a d_namlen member)
 
386
AC_CACHE_VAL(mysql_cv_dirent_has_dnamlen,
 
387
[AC_TRY_COMPILE([
 
388
#include <stdio.h>
 
389
#include <sys/types.h>
 
390
#ifdef HAVE_UNISTD_H
 
391
# include <unistd.h>
 
392
#endif /* HAVE_UNISTD_H */
 
393
#if defined(HAVE_DIRENT_H)
 
394
# include <dirent.h>
 
395
#else
 
396
# define dirent direct
 
397
# ifdef HAVE_SYS_NDIR_H
 
398
#  include <sys/ndir.h>
 
399
# endif /* SYSNDIR */
 
400
# ifdef HAVE_SYS_DIR_H
 
401
#  include <sys/dir.h>
 
402
# endif /* SYSDIR */
 
403
# ifdef HAVE_NDIR_H
 
404
#  include <ndir.h>
 
405
# endif
 
406
#endif /* HAVE_DIRENT_H */
 
407
],[
 
408
struct dirent d; int z; z = (int)d.d_namlen;
 
409
], mysql_cv_dirent_has_dnamlen=yes, mysql_cv_dirent_has_dnamlen=no)])
 
410
AC_MSG_RESULT($mysql_cv_dirent_has_dnamlen)
 
411
if test "$mysql_cv_dirent_has_dnamlen" = "yes"; then
 
412
AC_DEFINE(STRUCT_DIRENT_HAS_D_NAMLEN, [1],
 
413
          [d_namlen member present in struct dirent])
 
414
fi
 
415
])
 
416
 
 
417
 
 
418
AC_DEFUN([MYSQL_TYPE_SIGHANDLER],
 
419
[AC_MSG_CHECKING([whether signal handlers are of type void])
 
420
AC_CACHE_VAL(mysql_cv_void_sighandler,
 
421
[AC_TRY_COMPILE([#include <sys/types.h>
 
422
#include <signal.h>
 
423
#ifdef signal
 
424
#undef signal
 
425
#endif
 
426
#ifdef __cplusplus
 
427
extern "C"
 
428
#endif
 
429
void (*signal ()) ();],
 
430
[int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl
 
431
AC_MSG_RESULT($mysql_cv_void_sighandler)
 
432
if test "$mysql_cv_void_sighandler" = "yes"; then
 
433
AC_DEFINE(VOID_SIGHANDLER, [1], [sighandler type is void (*signal ()) ();])
 
434
fi
 
435
])
 
436
 
 
437
AC_DEFUN([MYSQL_CXX_BOOL],
 
438
[
 
439
AC_REQUIRE([AC_PROG_CXX])
 
440
AC_MSG_CHECKING(if ${CXX} supports bool types)
 
441
AC_CACHE_VAL(mysql_cv_have_bool,
 
442
[
 
443
AC_LANG_SAVE
 
444
AC_LANG_CPLUSPLUS
 
445
AC_TRY_COMPILE(,[bool b = true;],
 
446
mysql_cv_have_bool=yes,
 
447
mysql_cv_have_bool=no)
 
448
AC_LANG_RESTORE
 
449
])
 
450
AC_MSG_RESULT($mysql_cv_have_bool)
 
451
if test "$mysql_cv_have_bool" = yes; then
 
452
AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
 
453
fi
 
454
])dnl
 
455
 
 
456
AC_DEFUN([MYSQL_STACK_DIRECTION],
 
457
 [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
 
458
 [AC_TRY_RUN([#include <stdlib.h>
 
459
 /* Prevent compiler optimization by HP's compiler, see bug#42213 */
 
460
#if defined(__HP_cc) || defined (__HP_aCC) || defined (__hpux)
 
461
#pragma noinline
 
462
#endif
 
463
 int find_stack_direction ()
 
464
 {
 
465
   static char *addr = 0;
 
466
   auto char dummy;
 
467
   if (addr == 0)
 
468
     {
 
469
       addr = &dummy;
 
470
       return find_stack_direction ();
 
471
     }
 
472
   else
 
473
     return (&dummy > addr) ? 1 : -1;
 
474
 }
 
475
 int main ()
 
476
 {
 
477
   exit (find_stack_direction() < 0);
 
478
 }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
 
479
   ac_cv_c_stack_direction=)])
 
480
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
 
481
])dnl
 
482
 
 
483
AC_DEFUN([MYSQL_CHECK_LONGLONG_TO_FLOAT],
 
484
[
 
485
AC_MSG_CHECKING(if conversion of longlong to float works)
 
486
AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
 
487
[AC_TRY_RUN([#include <stdio.h>
 
488
typedef long long longlong;
 
489
int main()
 
490
{
 
491
  longlong ll=1;
 
492
  float f;
 
493
  FILE *file=fopen("conftestval", "w");
 
494
  f = (float) ll;
 
495
  fprintf(file,"%g\n",f);
 
496
  fclose(file);
 
497
  return (0);
 
498
}], ac_cv_conv_longlong_to_float=`cat conftestval`,
 
499
    ac_cv_conv_longlong_to_float=0,
 
500
    ac_cv_conv_longlong_to_float="yes")])dnl  # Cross compiling, assume can convert
 
501
if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
 
502
then
 
503
  ac_cv_conv_longlong_to_float=yes
 
504
else
 
505
  ac_cv_conv_longlong_to_float=no
 
506
fi
 
507
AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
 
508
])
 
509
 
 
510
AC_DEFUN([MYSQL_CHECK_VIO], [
 
511
dnl
 
512
dnl we always use vio: no need for special defines 
 
513
dnl
 
514
  AC_DEFINE([HAVE_VIO_READ_BUFF], [1],
 
515
            [Define to enable buffered read. This works only if syscalls
 
516
            read/recv return as soon as there is some data in the kernel
 
517
            buffer, no matter how big the given buffer is.])
 
518
])
 
519
 
 
520
# Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
 
521
# include #stdlib.h as default as this breaks things on Solaris
 
522
# (Conflicts with pthreads and big file handling)
 
523
 
 
524
m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
 
525
[for ac_declaration in \
 
526
   ''\
 
527
   'extern "C" void std::exit (int) throw (); using std::exit;' \
 
528
   'extern "C" void std::exit (int); using std::exit;' \
 
529
   'extern "C" void exit (int) throw ();' \
 
530
   'extern "C" void exit (int);' \
 
531
   'void exit (int);' \
 
532
   '#include <stdlib.h>'
 
533
do
 
534
  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
 
535
@%:@include <stdlib.h>],
 
536
                                      [exit (42);])],
 
537
                     [],
 
538
                     [continue])
 
539
  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration],
 
540
                                      [exit (42);])],
 
541
                     [break])
 
542
done
 
543
rm -f conftest*
 
544
if test -n "$ac_declaration"; then
 
545
  echo '#ifdef __cplusplus' >>confdefs.h
 
546
  echo $ac_declaration      >>confdefs.h
 
547
  echo '#endif'             >>confdefs.h
 
548
fi
 
549
])# _AC_PROG_CXX_EXIT_DECLARATION
 
550
 
 
551
dnl ---------------------------------------------------------------------------
 
552
 
 
553
 
 
554
dnl ---------------------------------------------------------------------------
 
555
dnl Macro: MYSQL_CHECK_BIG_TABLES
 
556
dnl Sets BIG_TABLES if --with-big-tables is used
 
557
dnl ---------------------------------------------------------------------------
 
558
AC_DEFUN([MYSQL_CHECK_BIG_TABLES], [
 
559
  AC_ARG_WITH([big-tables],
 
560
  AS_HELP_STRING([--with-big-tables],
 
561
              [Support tables with more than 4 G rows even on 32 bit platforms]),
 
562
              [bigtables="$withval"],
 
563
              [bigtables=no])
 
564
  AC_MSG_CHECKING([for big tables support])
 
565
 
 
566
  case "$bigtables" in
 
567
    yes )
 
568
      AC_DEFINE([BIG_TABLES], [1], [Support big tables])
 
569
      AC_MSG_RESULT([yes])
 
570
      ;;
 
571
    * )
 
572
      AC_MSG_RESULT([no])
 
573
      ;;
 
574
  esac
 
575
 
 
576
])
 
577
dnl ---------------------------------------------------------------------------
 
578
dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
 
579
dnl ---------------------------------------------------------------------------
 
580
 
 
581
 
 
582
dnl ---------------------------------------------------------------------------
 
583
dnl Macro: MYSQL_CHECK_MAX_INDEXES
 
584
dnl Sets MAX_INDEXES
 
585
dnl ---------------------------------------------------------------------------
 
586
AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [
 
587
  AC_ARG_WITH([max-indexes],
 
588
              AS_HELP_STRING([--with-max-indexes=N],
 
589
                             [Sets the maximum number of indexes per table, default 64]),
 
590
              [max_indexes="$withval"],
 
591
              [max_indexes=64])
 
592
  AC_MSG_CHECKING([max indexes per table])
 
593
  AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
 
594
                     [Maximum number of indexes per table])
 
595
  AC_MSG_RESULT([$max_indexes])
 
596
])
 
597
dnl ---------------------------------------------------------------------------
 
598
dnl END OF MYSQL_CHECK_MAX_INDEXES SECTION
 
599
dnl ---------------------------------------------------------------------------
 
600
 
 
601
 
 
602
dnl MYSQL_NEEDS_MYSYS_NEW
 
603
AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
 
604
[AC_CACHE_CHECK([needs mysys_new helpers], mysql_cv_use_mysys_new,
 
605
[
 
606
AC_LANG_PUSH(C++)
 
607
AC_TRY_LINK([], [
 
608
class A { public: int b; }; A *a=new A; a->b=10; delete a;
 
609
], mysql_cv_use_mysys_new=no, mysql_cv_use_mysys_new=yes)
 
610
AC_LANG_POP(C++)
 
611
])
 
612
if test "$mysql_cv_use_mysys_new" = "yes"
 
613
then
 
614
  AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
 
615
fi
 
616
])
 
617
 
 
618
 
 
619
AC_DEFUN([MYSQL_CHECK_CXX_VERSION], [
 
620
case $SYSTEM_TYPE in
 
621
  *netware*)
 
622
    CXX_VERSION=`$CXX -version | grep -i version`
 
623
  ;;
 
624
  *)
 
625
    CXX_VERSION=`$CXX --version | sed 1q`
 
626
    if test $? -ne "0" -o -z "$CXX_VERSION"
 
627
    then
 
628
      CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI
 
629
    fi
 
630
    if test $? -ne "0" -o -z "$CXX_VERSION"
 
631
    then
 
632
      CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha
 
633
    fi
 
634
    if test $? -ne "0" -o -z "$CXX_VERSION"
 
635
    then
 
636
      CXX_VERSION=""
 
637
    fi
 
638
esac
 
639
if test "$CXX_VERSION"
 
640
then
 
641
  AC_MSG_CHECKING("C++ compiler version")
 
642
  AC_MSG_RESULT("$CXX $CXX_VERSION")
 
643
fi
 
644
AC_SUBST(CXX_VERSION)
 
645
])
 
646
 
 
647
AC_DEFUN([MYSQL_PROG_AR], [
 
648
case $CXX_VERSION in
 
649
  MIPSpro*)
 
650
    AR=$CXX
 
651
    ARFLAGS="-ar -o"
 
652
  ;;
 
653
  *Forte*)
 
654
    AR=$CXX
 
655
    ARFLAGS="-xar -o"
 
656
  ;;
 
657
  *)
 
658
    AC_CHECK_PROG([AR], [ar], [ar])
 
659
    if test -z "$AR" || test "$AR" = "false"
 
660
    then
 
661
      AC_MSG_ERROR([You need ar to build the library])
 
662
    fi
 
663
    if test -z "$ARFLAGS"
 
664
    then
 
665
      ARFLAGS="cru"
 
666
    fi
 
667
esac
 
668
AC_SUBST(AR)
 
669
AC_SUBST(ARFLAGS)
 
670
])
 
671
 
 
672
dnl
 
673
dnl  Macro to check time_t range: according to C standard
 
674
dnl  array index must be greater than 0 => if time_t is signed,
 
675
dnl  the code in the macros below won't compile.
 
676
dnl
 
677
 
 
678
AC_DEFUN([MYSQL_CHECK_TIME_T],[
 
679
    AC_MSG_CHECKING(if time_t is unsigned)
 
680
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
681
        [[
 
682
#include <time.h>
 
683
        ]],
 
684
        [[
 
685
        int array[(((time_t)-1) > 0) ? 1 : -1];
 
686
        ]] )
 
687
    ], [
 
688
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
 
689
    AC_MSG_RESULT(yes)
 
690
    ],
 
691
    [AC_MSG_RESULT(no)]
 
692
    )
 
693
])
 
694