~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/misc.m4

  • Committer: Padraig O'Sullivan
  • Date: 2009-07-08 04:26:02 UTC
  • mto: (1089.3.4 merge)
  • mto: This revision was merged to the branch mainline in revision 1092.
  • Revision ID: osullivan.padraig@gmail.com-20090708042602-x4hmf9ny8dcpvb22
Replaced an instance where a uint8_t type was being used to hold a
collection of flags. Converted it to a std::bitset<2> instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Local macros for automake & autoconf
 
2
 
 
3
 
 
4
AC_DEFUN([DRIZZLE_PTHREAD_YIELD],[
 
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
 
 
42
 
 
43
 
 
44
AC_DEFUN([DRIZZLE_HAVE_TIOCGWINSZ],
 
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
 
 
57
AC_DEFUN([DRIZZLE_HAVE_TIOCSTAT],
 
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
 
 
71
AC_DEFUN([DRIZZLE_STACK_DIRECTION],
 
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 ---------------------------------------------------------------------------
 
96
dnl Macro: DRIZZLE_CHECK_MAX_INDEXES
 
97
dnl Sets MAX_INDEXES
 
98
dnl ---------------------------------------------------------------------------
 
99
AC_DEFUN([DRIZZLE_CHECK_MAX_INDEXES], [
 
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 ---------------------------------------------------------------------------
 
111
dnl END OF DRIZZLE_CHECK_MAX_INDEXES SECTION
 
112
dnl ---------------------------------------------------------------------------
 
113
 
 
114
AC_DEFUN([DRIZZLE_CHECK_C_VERSION],[
 
115
 
 
116
  dnl Print version of C compiler
 
117
  AC_MSG_CHECKING("C Compiler version")
 
118
  if test "$GCC" = "yes"
 
119
  then
 
120
    CC_VERSION=`$CC --version | sed 1q`
 
121
  elif test "$SUNCC" = "yes"
 
122
  then
 
123
    CC_VERSION=`$CC -V 2>&1 | sed 1q`
 
124
  else
 
125
    CC_VERSION=""
 
126
  fi
 
127
  AC_MSG_RESULT("$CC_VERSION")
 
128
  AC_SUBST(CC_VERSION)
 
129
])
 
130
 
 
131
 
 
132
AC_DEFUN([DRIZZLE_CHECK_CXX_VERSION], [
 
133
  dnl Print version of CXX compiler
 
134
  AC_MSG_CHECKING("C++ Compiler version")
 
135
  if test "$GCC" = "yes"
 
136
  then
 
137
    CXX_VERSION=`$CXX --version | sed 1q`
 
138
  elif test "$SUNCC" = "yes"
 
139
  then
 
140
    CXX_VERSION=`$CXX -V 2>&1 | sed 1q`
 
141
  else
 
142
    CXX_VERSION=""
 
143
  fi
 
144
  AC_MSG_RESULT("$CXX_VERSION")
 
145
  AC_SUBST(CXX_VERSION)
 
146
])
 
147
 
 
148
 
 
149
dnl
 
150
dnl  Macro to check time_t range: according to C standard
 
151
dnl  array index must be greater than 0 => if time_t is signed,
 
152
dnl  the code in the macros below won't compile.
 
153
dnl
 
154
 
 
155
AC_DEFUN([DRIZZLE_CHECK_TIME_T],[
 
156
    AC_MSG_CHECKING(if time_t is unsigned)
 
157
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
158
        [[
 
159
#include <time.h>
 
160
        ]],
 
161
        [[
 
162
        int array[(((time_t)-1) > 0) ? 1 : -1];
 
163
        ]] )
 
164
    ], [
 
165
    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
 
166
    AC_MSG_RESULT(yes)
 
167
    ],
 
168
    [AC_MSG_RESULT(no)]
 
169
    )
 
170
])