~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/misc.m4

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
 
# Local macros for automake & autoconf
2
 
 
3
 
#---START: Used in for client configure
4
 
AC_DEFUN([DRIZZLE_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([DRIZZLE_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([DRIZZLE_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([DRIZZLE_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([DRIZZLE_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([DRIZZLE_PTHREAD_YIELD],[
129
 
# Some OSes like Mac OS X have that as a replacement for pthread_yield()
130
 
AC_CHECK_FUNCS(pthread_yield_np, AC_DEFINE([HAVE_PTHREAD_YIELD_NP],[],[Define if you have pthread_yield_np]))
131
 
AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
132
 
[AC_TRY_LINK([#define _GNU_SOURCE
133
 
#include <pthread.h>
134
 
#ifdef __cplusplus
135
 
extern "C"
136
 
#endif
137
 
],
138
 
[
139
 
  pthread_yield();
140
 
], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
141
 
if test "$ac_cv_pthread_yield_zero_arg" = "yes"
142
 
then
143
 
  AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
144
 
            [pthread_yield that doesn't take any arguments])
145
 
fi
146
 
AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
147
 
[AC_TRY_LINK([#define _GNU_SOURCE
148
 
#include <pthread.h>
149
 
#ifdef __cplusplus
150
 
extern "C"
151
 
#endif
152
 
],
153
 
[
154
 
  pthread_yield(0);
155
 
], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
156
 
if test "$ac_cv_pthread_yield_one_arg" = "yes"
157
 
then
158
 
  AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
159
 
            [pthread_yield function with one argument])
160
 
fi
161
 
]
162
 
)
163
 
 
164
 
#---END:
165
 
 
166
 
# From fileutils-3.14/aclocal.m4
167
 
 
168
 
# @defmac AC_PROG_CC_STDC
169
 
# @maindex PROG_CC_STDC
170
 
# @ovindex CC
171
 
# If the C compiler in not in ANSI C mode by default, try to add an option
172
 
# to output variable @code{CC} to make it so.  This macro tries various
173
 
# options that select ANSI C on some system or another.  It considers the
174
 
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
175
 
# handles function prototypes correctly.
176
 
#
177
 
# Patched by monty to only check if __STDC__ is defined. With the original 
178
 
# check it's impossible to get things to work with the Sunpro compiler from
179
 
# Workshop 4.2
180
 
#
181
 
# If you use this macro, you should check after calling it whether the C
182
 
# compiler has been set to accept ANSI C; if not, the shell variable
183
 
# @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
184
 
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
185
 
# program @code{ansi2knr}, which comes with Ghostscript.
186
 
# @end defmac
187
 
 
188
 
AC_DEFUN([AM_PROG_CC_STDC],
189
 
[AC_REQUIRE([AC_PROG_CC])
190
 
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
191
 
AC_CACHE_VAL(am_cv_prog_cc_stdc,
192
 
[am_cv_prog_cc_stdc=no
193
 
ac_save_CC="$CC"
194
 
# Don't try gcc -ansi; that turns off useful extensions and
195
 
# breaks some systems' header files.
196
 
# AIX                   -qlanglvl=ansi
197
 
# Ultrix and OSF/1      -std1
198
 
# HP-UX                 -Aa -D_HPUX_SOURCE
199
 
# SVR4                  -Xc -D__EXTENSIONS__
200
 
# removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it.
201
 
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" 
202
 
do
203
 
  CC="$ac_save_CC $ac_arg"
204
 
  AC_TRY_COMPILE(
205
 
[#if !defined(__STDC__)
206
 
choke me
207
 
#endif
208
 
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
209
 
#ifdef _SEQUENT_
210
 
# include <sys/types.h>
211
 
# include <sys/stat.h>
212
 
#endif
213
 
], [
214
 
int test (int i, double x);
215
 
struct s1 {int (*f) (int a);};
216
 
struct s2 {int (*f) (double a);};],
217
 
[am_cv_prog_cc_stdc="$ac_arg"; break])
218
 
done
219
 
CC="$ac_save_CC"
220
 
])
221
 
AC_MSG_RESULT($am_cv_prog_cc_stdc)
222
 
case "x$am_cv_prog_cc_stdc" in
223
 
  x|xno) ;;
224
 
  *) CC="$CC $am_cv_prog_cc_stdc" ;;
225
 
esac
226
 
])
227
 
 
228
 
# Orginal from bash-2.0 aclocal.m4, Changed to use termcap last by monty.
229
 
 
230
 
AC_DEFUN([DRIZZLE_CHECK_LIB_TERMCAP],
231
 
[
232
 
AC_CACHE_VAL(mysql_cv_termcap_lib,
233
 
[AC_CHECK_LIB(ncurses, tgetent, mysql_cv_termcap_lib=libncurses,
234
 
    [AC_CHECK_LIB(curses, tgetent, mysql_cv_termcap_lib=libcurses,
235
 
        [AC_CHECK_LIB(termcap, tgetent, mysql_cv_termcap_lib=libtermcap,
236
 
          [AC_CHECK_LIB(tinfo, tgetent, mysql_cv_termcap_lib=libtinfo,
237
 
            mysql_cv_termcap_lib=NOT_FOUND)])])])])
238
 
AC_MSG_CHECKING(for termcap functions library)
239
 
if test "$mysql_cv_termcap_lib" = "NOT_FOUND"; then
240
 
AC_MSG_ERROR([No curses/termcap library found])
241
 
elif test "$mysql_cv_termcap_lib" = "libtermcap"; then
242
 
TERMCAP_LIB=-ltermcap
243
 
elif test "$mysql_cv_termcap_lib" = "libncurses"; then
244
 
TERMCAP_LIB=-lncurses
245
 
elif test "$mysql_cv_termcap_lib" = "libtinfo"; then
246
 
TERMCAP_LIB=-ltinfo
247
 
else
248
 
TERMCAP_LIB=-lcurses
249
 
fi
250
 
AC_MSG_RESULT($TERMCAP_LIB)
251
 
])
252
 
 
253
 
dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
254
 
AC_DEFUN([DRIZZLE_SIGNAL_CHECK],
255
 
[AC_REQUIRE([AC_TYPE_SIGNAL])
256
 
AC_MSG_CHECKING(for type of signal functions)
257
 
AC_CACHE_VAL(mysql_cv_signal_vintage,
258
 
[
259
 
  AC_TRY_LINK([#include <signal.h>],[
260
 
    sigset_t ss;
261
 
    struct sigaction sa;
262
 
    sigemptyset(&ss); sigsuspend(&ss);
263
 
    sigaction(SIGINT, &sa, (struct sigaction *) 0);
264
 
    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
265
 
  ], mysql_cv_signal_vintage=posix,
266
 
  [
267
 
    AC_TRY_LINK([#include <signal.h>], [
268
 
        int mask = sigmask(SIGINT);
269
 
        sigsetmask(mask); sigblock(mask); sigpause(mask);
270
 
    ], mysql_cv_signal_vintage=4.2bsd,
271
 
    [
272
 
      AC_TRY_LINK([
273
 
        #include <signal.h>
274
 
        RETSIGTYPE foo() { }], [
275
 
                int mask = sigmask(SIGINT);
276
 
                sigset(SIGINT, foo); sigrelse(SIGINT);
277
 
                sighold(SIGINT); sigpause(SIGINT);
278
 
        ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7
279
 
    )]
280
 
  )]
281
 
)
282
 
])
283
 
AC_MSG_RESULT($mysql_cv_signal_vintage)
284
 
if test "$mysql_cv_signal_vintage" = posix; then
285
 
AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
286
 
          [Signal handling is POSIX (sigset/sighold, etc)])
287
 
elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
288
 
AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
289
 
elif test "$mysql_cv_signal_vintage" = svr3; then
290
 
AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
291
 
fi
292
 
])
293
 
 
294
 
AC_DEFUN([DRIZZLE_CHECK_GETPW_FUNCS],
295
 
[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
296
 
AC_CACHE_VAL(mysql_cv_can_redecl_getpw,
297
 
[AC_TRY_COMPILE([#include <sys/types.h>
298
 
#include <pwd.h>
299
 
extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
300
 
  mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
301
 
AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
302
 
if test "$mysql_cv_can_redecl_getpw" = "no"; then
303
 
AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
304
 
fi
305
 
])
306
 
 
307
 
AC_DEFUN([DRIZZLE_HAVE_TIOCGWINSZ],
308
 
[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
309
 
AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
310
 
[AC_TRY_COMPILE([#include <sys/types.h>
311
 
#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
312
 
  mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
313
 
AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
314
 
if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then   
315
 
AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
316
 
          [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
317
 
fi
318
 
])
319
 
 
320
 
AC_DEFUN([DRIZZLE_HAVE_FIONREAD],
321
 
[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
322
 
AC_CACHE_VAL(mysql_cv_fionread_in_ioctl,
323
 
[AC_TRY_COMPILE([#include <sys/types.h>
324
 
#include <sys/ioctl.h>], [int x = FIONREAD;],
325
 
  mysql_cv_fionread_in_ioctl=yes,mysql_cv_fionread_in_ioctl=no)])
326
 
AC_MSG_RESULT($mysql_cv_fionread_in_ioctl)
327
 
if test "$mysql_cv_fionread_in_ioctl" = "yes"; then   
328
 
AC_DEFINE([FIONREAD_IN_SYS_IOCTL], [1], [Do we have FIONREAD])
329
 
fi
330
 
])
331
 
 
332
 
AC_DEFUN([DRIZZLE_HAVE_TIOCSTAT],
333
 
[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
334
 
AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
335
 
[AC_TRY_COMPILE([#include <sys/types.h>
336
 
#include <sys/ioctl.h>], [int x = TIOCSTAT;],
337
 
  mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
338
 
AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
339
 
if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then   
340
 
AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
341
 
          [declaration of TIOCSTAT in sys/ioctl.h])
342
 
fi
343
 
])
344
 
 
345
 
AC_DEFUN([DRIZZLE_STRUCT_DIRENT_D_INO],
346
 
[AC_REQUIRE([AC_HEADER_DIRENT])
347
 
AC_MSG_CHECKING(if struct dirent has a d_ino member)
348
 
AC_CACHE_VAL(mysql_cv_dirent_has_dino,
349
 
[AC_TRY_COMPILE([
350
 
#include <stdio.h>
351
 
#include <sys/types.h>
352
 
#ifdef HAVE_UNISTD_H
353
 
# include <unistd.h>
354
 
#endif /* HAVE_UNISTD_H */
355
 
#if defined(HAVE_DIRENT_H)
356
 
# include <dirent.h>
357
 
#else
358
 
# define dirent direct
359
 
# ifdef HAVE_SYS_NDIR_H
360
 
#  include <sys/ndir.h>
361
 
# endif /* SYSNDIR */
362
 
# ifdef HAVE_SYS_DIR_H
363
 
#  include <sys/dir.h>
364
 
# endif /* SYSDIR */
365
 
# ifdef HAVE_NDIR_H
366
 
#  include <ndir.h>
367
 
# endif
368
 
#endif /* HAVE_DIRENT_H */
369
 
],[
370
 
struct dirent d; int z; z = d.d_ino;
371
 
], mysql_cv_dirent_has_dino=yes, mysql_cv_dirent_has_dino=no)])
372
 
AC_MSG_RESULT($mysql_cv_dirent_has_dino)
373
 
if test "$mysql_cv_dirent_has_dino" = "yes"; then
374
 
AC_DEFINE(STRUCT_DIRENT_HAS_D_INO, [1],
375
 
          [d_ino member present in struct dirent])
376
 
fi
377
 
])
378
 
 
379
 
AC_DEFUN([DRIZZLE_STRUCT_DIRENT_D_NAMLEN],
380
 
[AC_REQUIRE([AC_HEADER_DIRENT])
381
 
AC_MSG_CHECKING(if struct dirent has a d_namlen member)
382
 
AC_CACHE_VAL(mysql_cv_dirent_has_dnamlen,
383
 
[AC_TRY_COMPILE([
384
 
#include <stdio.h>
385
 
#include <sys/types.h>
386
 
#ifdef HAVE_UNISTD_H
387
 
# include <unistd.h>
388
 
#endif /* HAVE_UNISTD_H */
389
 
#if defined(HAVE_DIRENT_H)
390
 
# include <dirent.h>
391
 
#else
392
 
# define dirent direct
393
 
# ifdef HAVE_SYS_NDIR_H
394
 
#  include <sys/ndir.h>
395
 
# endif /* SYSNDIR */
396
 
# ifdef HAVE_SYS_DIR_H
397
 
#  include <sys/dir.h>
398
 
# endif /* SYSDIR */
399
 
# ifdef HAVE_NDIR_H
400
 
#  include <ndir.h>
401
 
# endif
402
 
#endif /* HAVE_DIRENT_H */
403
 
],[
404
 
struct dirent d; int z; z = (int)d.d_namlen;
405
 
], mysql_cv_dirent_has_dnamlen=yes, mysql_cv_dirent_has_dnamlen=no)])
406
 
AC_MSG_RESULT($mysql_cv_dirent_has_dnamlen)
407
 
if test "$mysql_cv_dirent_has_dnamlen" = "yes"; then
408
 
AC_DEFINE(STRUCT_DIRENT_HAS_D_NAMLEN, [1],
409
 
          [d_namlen member present in struct dirent])
410
 
fi
411
 
])
412
 
 
413
 
 
414
 
AC_DEFUN([DRIZZLE_TYPE_SIGHANDLER],
415
 
[AC_MSG_CHECKING([whether signal handlers are of type void])
416
 
AC_CACHE_VAL(mysql_cv_void_sighandler,
417
 
[AC_TRY_COMPILE([#include <sys/types.h>
418
 
#include <signal.h>
419
 
#ifdef signal
420
 
#undef signal
421
 
#endif
422
 
#ifdef __cplusplus
423
 
extern "C"
424
 
#endif
425
 
void (*signal ()) ();],
426
 
[int i;], mysql_cv_void_sighandler=yes, mysql_cv_void_sighandler=no)])dnl
427
 
AC_MSG_RESULT($mysql_cv_void_sighandler)
428
 
if test "$mysql_cv_void_sighandler" = "yes"; then
429
 
AC_DEFINE(VOID_SIGHANDLER, [1], [sighandler type is void (*signal ()) ();])
430
 
fi
431
 
])
432
 
 
433
 
AC_DEFUN([DRIZZLE_CXX_BOOL],
434
 
[
435
 
AC_REQUIRE([AC_PROG_CXX])
436
 
AC_MSG_CHECKING(if ${CXX} supports bool types)
437
 
AC_CACHE_VAL(mysql_cv_have_bool,
438
 
[
439
 
AC_LANG_SAVE
440
 
AC_LANG_CPLUSPLUS
441
 
AC_TRY_COMPILE(,[bool b = true;],
442
 
mysql_cv_have_bool=yes,
443
 
mysql_cv_have_bool=no)
444
 
AC_LANG_RESTORE
445
 
])
446
 
AC_MSG_RESULT($mysql_cv_have_bool)
447
 
if test "$mysql_cv_have_bool" = yes; then
448
 
AC_DEFINE([HAVE_BOOL], [1], [bool is not defined by all C++ compilators])
449
 
fi
450
 
])dnl
451
 
 
452
 
AC_DEFUN([DRIZZLE_STACK_DIRECTION],
453
 
 [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
454
 
 [AC_TRY_RUN([#include <stdlib.h>
455
 
 int find_stack_direction ()
456
 
 {
457
 
   static char *addr = 0;
458
 
   auto char dummy;
459
 
   if (addr == 0)
460
 
     {
461
 
       addr = &dummy;
462
 
       return find_stack_direction ();
463
 
     }
464
 
   else
465
 
     return (&dummy > addr) ? 1 : -1;
466
 
 }
467
 
 int main ()
468
 
 {
469
 
   exit (find_stack_direction() < 0);
470
 
 }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
471
 
   ac_cv_c_stack_direction=)])
472
 
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
473
 
])dnl
474
 
 
475
 
AC_DEFUN([DRIZZLE_CHECK_LONGLONG_TO_FLOAT],
476
 
[
477
 
AC_MSG_CHECKING(if conversion of longlong to float works)
478
 
AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
479
 
[AC_TRY_RUN([#include <stdio.h>
480
 
typedef long long longlong;
481
 
int main()
482
 
{
483
 
  longlong ll=1;
484
 
  float f;
485
 
  FILE *file=fopen("conftestval", "w");
486
 
  f = (float) ll;
487
 
  fprintf(file,"%g\n",f);
488
 
  fclose(file);
489
 
  return (0);
490
 
}], ac_cv_conv_longlong_to_float=`cat conftestval`,
491
 
    ac_cv_conv_longlong_to_float=0,
492
 
    ac_cv_conv_longlong_to_float="yes")])dnl  # Cross compiling, assume can convert
493
 
if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
494
 
then
495
 
  ac_cv_conv_longlong_to_float=yes
496
 
else
497
 
  ac_cv_conv_longlong_to_float=no
498
 
fi
499
 
AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
500
 
])
501
 
 
502
 
AC_DEFUN([DRIZZLE_CHECK_VIO], [
503
 
dnl
504
 
dnl we always use vio: no need for special defines 
505
 
dnl
506
 
  AC_DEFINE([HAVE_VIO_READ_BUFF], [1],
507
 
            [Define to enable buffered read. This works only if syscalls
508
 
            read/recv return as soon as there is some data in the kernel
509
 
            buffer, no matter how big the given buffer is.])
510
 
])
511
 
 
512
 
# Local version of _AC_PROG_CXX_EXIT_DECLARATION that does not
513
 
# include #stdlib.h as default as this breaks things on Solaris
514
 
# (Conflicts with pthreads and big file handling)
515
 
 
516
 
m4_define([_AC_PROG_CXX_EXIT_DECLARATION],
517
 
[for ac_declaration in \
518
 
   ''\
519
 
   'extern "C" void std::exit (int) throw (); using std::exit;' \
520
 
   'extern "C" void std::exit (int); using std::exit;' \
521
 
   'extern "C" void exit (int) throw ();' \
522
 
   'extern "C" void exit (int);' \
523
 
   'void exit (int);' \
524
 
   '#include <stdlib.h>'
525
 
do
526
 
  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration
527
 
@%:@include <stdlib.h>],
528
 
                                      [exit (42);])],
529
 
                     [],
530
 
                     [continue])
531
 
  _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration],
532
 
                                      [exit (42);])],
533
 
                     [break])
534
 
done
535
 
rm -f conftest*
536
 
if test -n "$ac_declaration"; then
537
 
  echo '#ifdef __cplusplus' >>confdefs.h
538
 
  echo $ac_declaration      >>confdefs.h
539
 
  echo '#endif'             >>confdefs.h
540
 
fi
541
 
])# _AC_PROG_CXX_EXIT_DECLARATION
542
 
 
543
 
dnl ---------------------------------------------------------------------------
544
 
 
545
 
 
546
 
dnl ---------------------------------------------------------------------------
547
 
dnl Macro: DRIZZLE_CHECK_BIG_TABLES
548
 
dnl Sets BIG_TABLES if --with-big-tables is used
549
 
dnl ---------------------------------------------------------------------------
550
 
AC_DEFUN([DRIZZLE_CHECK_BIG_TABLES], [
551
 
  AC_ARG_WITH([big-tables],
552
 
  AS_HELP_STRING([--with-big-tables],
553
 
              [Support tables with more than 4 G rows even on 32 bit platforms]),
554
 
              [bigtables="$withval"],
555
 
              [bigtables=no])
556
 
  AC_MSG_CHECKING([for big tables support])
557
 
 
558
 
  case "$bigtables" in
559
 
    yes )
560
 
      AC_DEFINE([BIG_TABLES], [1], [Support big tables])
561
 
      AC_MSG_RESULT([yes])
562
 
      ;;
563
 
    * )
564
 
      AC_MSG_RESULT([no])
565
 
      ;;
566
 
  esac
567
 
 
568
 
])
569
 
dnl ---------------------------------------------------------------------------
570
 
dnl END OF DRIZZLE_CHECK_BIG_TABLES SECTION
571
 
dnl ---------------------------------------------------------------------------
572
 
 
573
 
 
574
 
dnl ---------------------------------------------------------------------------
575
 
dnl Macro: DRIZZLE_CHECK_MAX_INDEXES
576
 
dnl Sets MAX_INDEXES
577
 
dnl ---------------------------------------------------------------------------
578
 
AC_DEFUN([DRIZZLE_CHECK_MAX_INDEXES], [
579
 
  AC_ARG_WITH([max-indexes],
580
 
              AS_HELP_STRING([--with-max-indexes=N],
581
 
                             [Sets the maximum number of indexes per table, default 64]),
582
 
              [max_indexes="$withval"],
583
 
              [max_indexes=64])
584
 
  AC_MSG_CHECKING([max indexes per table])
585
 
  AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
586
 
                     [Maximum number of indexes per table])
587
 
  AC_MSG_RESULT([$max_indexes])
588
 
])
589
 
dnl ---------------------------------------------------------------------------
590
 
dnl END OF DRIZZLE_CHECK_MAX_INDEXES SECTION
591
 
dnl ---------------------------------------------------------------------------
592
 
 
593
 
 
594
 
AC_DEFUN([DRIZZLE_CHECK_CXX_VERSION], [
595
 
case $SYSTEM_TYPE in
596
 
  *netware*)
597
 
    CXX_VERSION=`$CXX -version | grep -i version`
598
 
  ;;
599
 
  *)
600
 
    CXX_VERSION=`$CXX --version | sed 1q`
601
 
    if test $? -ne "0" -o -z "$CXX_VERSION"
602
 
    then
603
 
      CXX_VERSION=`$CXX -V 2>&1|sed 1q` # trying harder for Sun and SGI
604
 
    fi
605
 
    if test $? -ne "0" -o -z "$CXX_VERSION"
606
 
    then
607
 
      CXX_VERSION=`$CXX -v 2>&1|sed 1q` # even harder for Alpha
608
 
    fi
609
 
    if test $? -ne "0" -o -z "$CXX_VERSION"
610
 
    then
611
 
      CXX_VERSION=""
612
 
    fi
613
 
esac
614
 
if test "$CXX_VERSION"
615
 
then
616
 
  AC_MSG_CHECKING("C++ compiler version")
617
 
  AC_MSG_RESULT("$CXX $CXX_VERSION")
618
 
fi
619
 
AC_SUBST(CXX_VERSION)
620
 
])
621
 
 
622
 
AC_DEFUN([DRIZZLE_PROG_AR], [
623
 
case $CXX_VERSION in
624
 
  MIPSpro*)
625
 
    AR=$CXX
626
 
    ARFLAGS="-ar -o"
627
 
  ;;
628
 
  *Forte*)
629
 
    AR=$CXX
630
 
    ARFLAGS="-xar -o"
631
 
  ;;
632
 
  *)
633
 
    AC_CHECK_PROG([AR], [ar], [ar])
634
 
    if test -z "$AR" || test "$AR" = "false"
635
 
    then
636
 
      AC_MSG_ERROR([You need ar to build the library])
637
 
    fi
638
 
    if test -z "$ARFLAGS"
639
 
    then
640
 
      ARFLAGS="cru"
641
 
    fi
642
 
esac
643
 
AC_SUBST(AR)
644
 
AC_SUBST(ARFLAGS)
645
 
])
646
 
 
647
 
dnl
648
 
dnl  Macro to check time_t range: according to C standard
649
 
dnl  array index must be greater than 0 => if time_t is signed,
650
 
dnl  the code in the macros below won't compile.
651
 
dnl
652
 
 
653
 
AC_DEFUN([DRIZZLE_CHECK_TIME_T],[
654
 
    AC_MSG_CHECKING(if time_t is unsigned)
655
 
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
656
 
        [[
657
 
#include <time.h>
658
 
        ]],
659
 
        [[
660
 
        int array[(((time_t)-1) > 0) ? 1 : -1];
661
 
        ]] )
662
 
    ], [
663
 
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
664
 
    AC_MSG_RESULT(yes)
665
 
    ],
666
 
    [AC_MSG_RESULT(no)]
667
 
    )
668
 
])
669