~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
# Local macros for automake & autoconf
2
3
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
4
AC_DEFUN([DRIZZLE_PTHREAD_YIELD],[
1 by brian
clean slate
5
# Some OSes like Mac OS X have that as a replacement for pthread_yield()
6
AC_CHECK_FUNCS(pthread_yield_np, AC_DEFINE([HAVE_PTHREAD_YIELD_NP],[],[Define if you have pthread_yield_np]))
7
AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
8
[AC_TRY_LINK([#define _GNU_SOURCE
9
#include <pthread.h>
10
#ifdef __cplusplus
11
extern "C"
12
#endif
13
],
14
[
15
  pthread_yield();
16
], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
17
if test "$ac_cv_pthread_yield_zero_arg" = "yes"
18
then
19
  AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
20
            [pthread_yield that doesn't take any arguments])
21
fi
22
AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
23
[AC_TRY_LINK([#define _GNU_SOURCE
24
#include <pthread.h>
25
#ifdef __cplusplus
26
extern "C"
27
#endif
28
],
29
[
30
  pthread_yield(0);
31
], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
32
if test "$ac_cv_pthread_yield_one_arg" = "yes"
33
then
34
  AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
35
            [pthread_yield function with one argument])
36
fi
37
]
38
)
39
40
#---END:
41
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
42
1 by brian
clean slate
43
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
44
AC_DEFUN([DRIZZLE_HAVE_TIOCGWINSZ],
1 by brian
clean slate
45
[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
46
AC_CACHE_VAL(mysql_cv_tiocgwinsz_in_ioctl,
47
[AC_TRY_COMPILE([#include <sys/types.h>
48
#include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
49
  mysql_cv_tiocgwinsz_in_ioctl=yes,mysql_cv_tiocgwinsz_in_ioctl=no)])
50
AC_MSG_RESULT($mysql_cv_tiocgwinsz_in_ioctl)
51
if test "$mysql_cv_tiocgwinsz_in_ioctl" = "yes"; then   
52
AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
53
          [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
54
fi
55
])
56
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
57
AC_DEFUN([DRIZZLE_HAVE_TIOCSTAT],
1 by brian
clean slate
58
[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
59
AC_CACHE_VAL(mysql_cv_tiocstat_in_ioctl,
60
[AC_TRY_COMPILE([#include <sys/types.h>
61
#include <sys/ioctl.h>], [int x = TIOCSTAT;],
62
  mysql_cv_tiocstat_in_ioctl=yes,mysql_cv_tiocstat_in_ioctl=no)])
63
AC_MSG_RESULT($mysql_cv_tiocstat_in_ioctl)
64
if test "$mysql_cv_tiocstat_in_ioctl" = "yes"; then   
65
AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL, [1],
66
          [declaration of TIOCSTAT in sys/ioctl.h])
67
fi
68
])
69
70
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
71
AC_DEFUN([DRIZZLE_STACK_DIRECTION],
1 by brian
clean slate
72
 [AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction,
73
 [AC_TRY_RUN([#include <stdlib.h>
74
 int find_stack_direction ()
75
 {
76
   static char *addr = 0;
77
   auto char dummy;
78
   if (addr == 0)
79
     {
80
       addr = &dummy;
81
       return find_stack_direction ();
82
     }
83
   else
84
     return (&dummy > addr) ? 1 : -1;
85
 }
86
 int main ()
87
 {
88
   exit (find_stack_direction() < 0);
89
 }], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1,
90
   ac_cv_c_stack_direction=)])
91
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
92
])dnl
93
94
95
dnl ---------------------------------------------------------------------------
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
96
dnl Macro: DRIZZLE_CHECK_MAX_INDEXES
1 by brian
clean slate
97
dnl Sets MAX_INDEXES
98
dnl ---------------------------------------------------------------------------
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
99
AC_DEFUN([DRIZZLE_CHECK_MAX_INDEXES], [
1 by brian
clean slate
100
  AC_ARG_WITH([max-indexes],
101
              AS_HELP_STRING([--with-max-indexes=N],
102
                             [Sets the maximum number of indexes per table, default 64]),
103
              [max_indexes="$withval"],
104
              [max_indexes=64])
105
  AC_MSG_CHECKING([max indexes per table])
106
  AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes],
107
                     [Maximum number of indexes per table])
108
  AC_MSG_RESULT([$max_indexes])
109
])
110
dnl ---------------------------------------------------------------------------
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
111
dnl END OF DRIZZLE_CHECK_MAX_INDEXES SECTION
1 by brian
clean slate
112
dnl ---------------------------------------------------------------------------
113
114
115
116
dnl
117
dnl  Macro to check time_t range: according to C standard
118
dnl  array index must be greater than 0 => if time_t is signed,
119
dnl  the code in the macros below won't compile.
120
dnl
121
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
122
AC_DEFUN([DRIZZLE_CHECK_TIME_T],[
1 by brian
clean slate
123
    AC_MSG_CHECKING(if time_t is unsigned)
124
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
125
        [[
126
#include <time.h>
127
        ]],
128
        [[
129
        int array[(((time_t)-1) > 0) ? 1 : -1];
130
        ]] )
131
    ], [
132
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
133
    AC_MSG_RESULT(yes)
134
    ],
135
    [AC_MSG_RESULT(no)]
136
    )
137
])