~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to m4/misc.m4

  • Committer: Monty Taylor
  • Date: 2009-06-30 18:09:07 UTC
  • mto: This revision was merged to the branch mainline in revision 1083.
  • Revision ID: mordred@inaugust.com-20090630180907-r24363hlhgxg4cbw
Whole boat-load of build fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
#---END:
41
41
 
42
 
# From fileutils-3.14/aclocal.m4
43
 
 
44
 
# @defmac AC_PROG_CC_STDC
45
 
# @maindex PROG_CC_STDC
46
 
# @ovindex CC
47
 
# If the C compiler in not in ANSI C mode by default, try to add an option
48
 
# to output variable @code{CC} to make it so.  This macro tries various
49
 
# options that select ANSI C on some system or another.  It considers the
50
 
# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
51
 
# handles function prototypes correctly.
52
 
#
53
 
# Patched by monty to only check if __STDC__ is defined. With the original 
54
 
# check it's impossible to get things to work with the Sunpro compiler from
55
 
# Workshop 4.2
56
 
#
57
 
# If you use this macro, you should check after calling it whether the C
58
 
# compiler has been set to accept ANSI C; if not, the shell variable
59
 
# @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
60
 
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
61
 
# program @code{ansi2knr}, which comes with Ghostscript.
62
 
# @end defmac
63
 
 
64
 
AC_DEFUN([AM_PROG_CC_STDC],
65
 
[AC_REQUIRE([AC_PROG_CC])
66
 
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
67
 
AC_CACHE_VAL(am_cv_prog_cc_stdc,
68
 
[am_cv_prog_cc_stdc=no
69
 
ac_save_CC="$CC"
70
 
# Don't try gcc -ansi; that turns off useful extensions and
71
 
# breaks some systems' header files.
72
 
# AIX                   -qlanglvl=ansi
73
 
# Ultrix and OSF/1      -std1
74
 
# HP-UX                 -Aa -D_HPUX_SOURCE
75
 
# SVR4                  -Xc -D__EXTENSIONS__
76
 
# removed "-Xc -D__EXTENSIONS__" beacause sun c++ does not like it.
77
 
for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" 
78
 
do
79
 
  CC="$ac_save_CC $ac_arg"
80
 
  AC_TRY_COMPILE(
81
 
[#if !defined(__STDC__)
82
 
choke me
83
 
#endif
84
 
/* DYNIX/ptx V4.1.3 can't compile sys/stat.h with -Xc -D__EXTENSIONS__. */
85
 
#ifdef _SEQUENT_
86
 
# include <sys/types.h>
87
 
# include <sys/stat.h>
88
 
#endif
89
 
], [
90
 
int test (int i, double x);
91
 
struct s1 {int (*f) (int a);};
92
 
struct s2 {int (*f) (double a);};],
93
 
[am_cv_prog_cc_stdc="$ac_arg"; break])
94
 
done
95
 
CC="$ac_save_CC"
96
 
])
97
 
AC_MSG_RESULT($am_cv_prog_cc_stdc)
98
 
case "x$am_cv_prog_cc_stdc" in
99
 
  x|xno) ;;
100
 
  *) CC="$CC $am_cv_prog_cc_stdc" ;;
101
 
esac
102
 
])
103
 
 
104
 
 
105
 
dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
106
 
AC_DEFUN([DRIZZLE_SIGNAL_CHECK],
107
 
[AC_REQUIRE([AC_TYPE_SIGNAL])
108
 
AC_MSG_CHECKING(for type of signal functions)
109
 
AC_CACHE_VAL(mysql_cv_signal_vintage,
110
 
[
111
 
  AC_TRY_LINK([#include <signal.h>],[
112
 
    sigset_t ss;
113
 
    struct sigaction sa;
114
 
    sigemptyset(&ss); sigsuspend(&ss);
115
 
    sigaction(SIGINT, &sa, (struct sigaction *) 0);
116
 
    sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
117
 
  ], mysql_cv_signal_vintage=posix,
118
 
  [
119
 
    AC_TRY_LINK([#include <signal.h>], [
120
 
        int mask = sigmask(SIGINT);
121
 
        sigsetmask(mask); sigblock(mask); sigpause(mask);
122
 
    ], mysql_cv_signal_vintage=4.2bsd,
123
 
    [
124
 
      AC_TRY_LINK([
125
 
        #include <signal.h>
126
 
        void foo() { }], [
127
 
                int mask = sigmask(SIGINT);
128
 
                sigset(SIGINT, foo); sigrelse(SIGINT);
129
 
                sighold(SIGINT); sigpause(SIGINT);
130
 
        ], mysql_cv_signal_vintage=svr3, mysql_cv_signal_vintage=v7
131
 
    )]
132
 
  )]
133
 
)
134
 
])
135
 
AC_MSG_RESULT($mysql_cv_signal_vintage)
136
 
if test "$mysql_cv_signal_vintage" = posix; then
137
 
AC_DEFINE(HAVE_POSIX_SIGNALS, [1],
138
 
          [Signal handling is POSIX (sigset/sighold, etc)])
139
 
elif test "$mysql_cv_signal_vintage" = "4.2bsd"; then
140
 
AC_DEFINE([HAVE_BSD_SIGNALS], [1], [BSD style signals])
141
 
elif test "$mysql_cv_signal_vintage" = svr3; then
142
 
AC_DEFINE(HAVE_USG_SIGHOLD, [1], [sighold() is present and usable])
143
 
fi
144
 
])
145
 
 
146
 
AC_DEFUN([DRIZZLE_CHECK_GETPW_FUNCS],
147
 
[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions)
148
 
AC_CACHE_VAL(mysql_cv_can_redecl_getpw,
149
 
[AC_TRY_COMPILE([#include <sys/types.h>
150
 
#include <pwd.h>
151
 
extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
152
 
  mysql_cv_can_redecl_getpw=yes,mysql_cv_can_redecl_getpw=no)])
153
 
AC_MSG_RESULT($mysql_cv_can_redecl_getpw)
154
 
if test "$mysql_cv_can_redecl_getpw" = "no"; then
155
 
AC_DEFINE(HAVE_GETPW_DECLS, [1], [getpwent() declaration present])
156
 
fi
157
 
])
 
42
 
158
43
 
159
44
AC_DEFUN([DRIZZLE_HAVE_TIOCGWINSZ],
160
45
[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
206
91
 AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
207
92
])dnl
208
93
 
209
 
AC_DEFUN([DRIZZLE_CHECK_LONGLONG_TO_FLOAT],
210
 
[
211
 
AC_MSG_CHECKING(if conversion of int64_t to float works)
212
 
AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
213
 
[AC_TRY_RUN([#include <stdio.h>
214
 
#include <stdint.h>
215
 
int main()
216
 
{
217
 
  int64_t ll=1;
218
 
  float f;
219
 
  FILE *file=fopen("conftestval", "w");
220
 
  f = (float) ll;
221
 
  fprintf(file,"%g\n",f);
222
 
  fclose(file);
223
 
  return (0);
224
 
}], ac_cv_conv_longlong_to_float=`cat conftestval`,
225
 
    ac_cv_conv_longlong_to_float=0,
226
 
    ac_cv_conv_longlong_to_float="yes")])dnl  # Cross compiling, assume can convert
227
 
if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
228
 
then
229
 
  ac_cv_conv_longlong_to_float=yes
230
 
else
231
 
  ac_cv_conv_longlong_to_float=no
232
 
fi
233
 
AC_MSG_RESULT($ac_cv_conv_longlong_to_float)
234
 
])
235
 
 
236
94
 
237
95
dnl ---------------------------------------------------------------------------
238
96
dnl Macro: DRIZZLE_CHECK_MAX_INDEXES
287
145
  AC_SUBST(CXX_VERSION)
288
146
])
289
147
 
290
 
AC_DEFUN([DRIZZLE_PROG_AR], [
291
 
case $CXX_VERSION in
292
 
  MIPSpro*)
293
 
    AR=$CXX
294
 
    ARFLAGS="-ar -o"
295
 
  ;;
296
 
  *Forte*)
297
 
    AR=$CXX
298
 
    ARFLAGS="-xar -o"
299
 
  ;;
300
 
  *)
301
 
    AC_CHECK_PROG([AR], [ar], [ar])
302
 
    if test -z "$AR" || test "$AR" = "false"
303
 
    then
304
 
      AC_MSG_ERROR([You need ar to build the library])
305
 
    fi
306
 
    if test -z "$ARFLAGS"
307
 
    then
308
 
      ARFLAGS="cru"
309
 
    fi
310
 
esac
311
 
AC_SUBST(AR)
312
 
AC_SUBST(ARFLAGS)
313
 
])
314
148
 
315
149
dnl
316
150
dnl  Macro to check time_t range: according to C standard
334
168
    [AC_MSG_RESULT(no)]
335
169
    )
336
170
])
337