~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
dnl -*- ksh -*-
2
dnl Process this file with autoconf to produce a configure script.
3
77.1.65 by Monty Taylor
We don't really require 2.61, 2.59 is actually fine.
4
AC_PREREQ(2.59)dnl		Minimum Autoconf version required.
1 by brian
clean slate
5
261.2.5 by Monty Taylor
Changed bug contact location to a url..
6
AC_INIT(drizzle, [7.0.0], [http://bugs.launchpad.net/drizzle])
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
7
AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
39 by Brian Aker
Move build helper files into config
8
AC_CONFIG_AUX_DIR(config)
236.1.9 by Monty Taylor
Cleaned up configure.ac line.
9
AC_CONFIG_HEADERS([config.h])
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
10
11
# Save some variables and the command line options for mysqlbug
12
SAVE_CC="$CC"
13
SAVE_CXX="$CXX"
14
SAVE_ASFLAGS="$ASFLAGS"
15
SAVE_CFLAGS="$CFLAGS"
16
SAVE_CXXFLAGS="$CXXFLAGS"
17
SAVE_LDFLAGS="$LDFLAGS"
18
SAVE_CXXLDFLAGS="$CXXLDFLAGS"
19
CONF_COMMAND="$0 $ac_configure_args"
20
AC_SUBST(CONF_COMMAND)
21
AC_SUBST(SAVE_CC)
22
AC_SUBST(SAVE_CXX)
23
AC_SUBST(SAVE_ASFLAGS)
24
AC_SUBST(SAVE_CFLAGS)
25
AC_SUBST(SAVE_CXXFLAGS)
26
AC_SUBST(SAVE_LDFLAGS)
27
AC_SUBST(SAVE_CXXLDFLAGS)
28
AC_SUBST(CXXLDFLAGS)
29
28.1.33 by Monty Taylor
Added -Wall
30
AC_CANONICAL_TARGET
261.2.4 by Monty Taylor
Updated to more modern AC_INIT and AM_INIT_AUTOMAKE invocations.
31
AM_INIT_AUTOMAKE(-Wall -Werror)
1 by brian
clean slate
32
33
PROTOCOL_VERSION=10
34
DOT_FRM_VERSION=6
35
# See the libtool docs for information on how to do shared lib versions.
383.1.47 by Monty Taylor
Couple of tiny changes.
36
SHARED_LIB_MAJOR_VERSION=1
1 by brian
clean slate
37
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
38
39
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
40
dnl AC_CANONICAL_HOST thinks it's a good idea to just set CFLAGS to 
41
dnl -g -O2 if you're running gcc. We would like to use something else, thanks.
42
if test "x${CFLAGS}" = "x-g -O2"
43
then
44
  CFLAGS=
45
fi
46
if test "x${CXXFLAGS}" = "x-g -O2"
47
then
48
  CXXFLAGS=
49
fi
50
1 by brian
clean slate
51
52
# Set all version vars based on $VERSION. How do we do this more elegant ?
53
# Remember that regexps needs to quote [ and ] since this is run through m4
54
# We take some made up examples
55
#
56
#  VERSION                  5.1.40sp1-alpha     5.0.34a
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
57
#  DRIZZLE_NO_DASH_VERSION    5.1.40sp1           5.0.34a
58
#  DRIZZLE_NUMERIC_VERSION    5.1.40              5.0.34
59
#  DRIZZLE_BASE_VERSION       5.1                 5.0
60
#  DRIZZLE_VERSION_ID         50140               50034
1 by brian
clean slate
61
#
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
62
DRIZZLE_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
63
DRIZZLE_NUMERIC_VERSION=`echo $DRIZZLE_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
64
DRIZZLE_BASE_VERSION=`echo $DRIZZLE_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
65
DRIZZLE_VERSION_ID=`echo $DRIZZLE_NUMERIC_VERSION | \
1 by brian
clean slate
66
    awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
67
68
# The port should be constant for a LONG time
301 by Brian Aker
Clean up port startup
69
DRIZZLE_TCP_PORT_DEFAULT=4427
1 by brian
clean slate
70
71
dnl Include m4 
202.3.14 by Monty Taylor
Moved m4 macros to top-level m4 dir, per GNU standards (and where gettext wanted it :)
72
sinclude(m4/alloca.m4)
73
sinclude(m4/check_cpu.m4)
74
sinclude(m4/character_sets.m4)
75
sinclude(m4/compiler_flag.m4)
76
sinclude(m4/dtrace.m4)
77
sinclude(m4/plugins.m4)
78
sinclude(m4/large_file.m4)
79
sinclude(m4/misc.m4)
80
sinclude(m4/readline.m4)
81
sinclude(m4/ssl.m4)
82
sinclude(m4/pkg.m4)
83
sinclude(m4/lib-link.m4)
84
sinclude(m4/lib-prefix.m4)
85
sinclude(m4/gettext.m4)
86
sinclude(m4/progtest.m4)
87
sinclude(m4/po.m4)
88
sinclude(m4/nls.m4)
89
sinclude(m4/iconv.m4)
90
sinclude(m4/lib-ld.m4)
91
sinclude(m4/ac_cxx_header_stdcxx_98.m4)
202.3.1 by Monty Taylor
Added very initial gettextize stuff.
92
202.3.2 by Monty Taylor
Added gettext calls in to my_getopt.c and drizzle.c
93
AM_GNU_GETTEXT([external])
287.3.25 by Monty Taylor
Make autoreconf happy.
94
AM_GNU_GETTEXT_VERSION(0.17)
95
384 by Monty Taylor
Expanded po subdir trap to catch the case where we're setting programs to :.
96
AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"])
1 by brian
clean slate
97
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
98
AC_SUBST(DRIZZLE_NO_DASH_VERSION)
99
AC_SUBST(DRIZZLE_BASE_VERSION)
100
AC_SUBST(DRIZZLE_VERSION_ID)
101
AC_SUBST(DRIZZLE_PREVIOUS_BASE_VERSION)
1 by brian
clean slate
102
AC_SUBST(PROTOCOL_VERSION)
103
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
104
                   [mysql client protocol version])
105
AC_SUBST(DOT_FRM_VERSION)
106
AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
107
                   [Version of .frm files])
108
AC_SUBST(SHARED_LIB_MAJOR_VERSION)
109
AC_SUBST(SHARED_LIB_VERSION)
110
AC_SUBST(AVAILABLE_LANGUAGES)
111
390.1.6 by Monty Taylor
Oh dear god the changes. The changes. I'd tell you what they are, but I'd just be making stuff up. Suffice it to day it's mostly all around splitting files in libdrizzle into different files and removing interdepends. And whatever else I happened to see...
112
# General Constants
113
AC_DEFINE([IO_SIZE], [4096], [Io buffer size; Must be a power of 2 and 
114
  a multiple of 512. May be
115
  smaller what the disk page size. This influences the speed of the
116
  isam btree library. eg to big to slow.])
117
AC_DEFINE([SC_MAXWIDTH],[256], [Max width of screen (for error messages)])
118
AC_DEFINE([FN_LEN],[256	], [Max file name len ])
119
AC_DEFINE([FN_HEADLEN],[253], [Max length of filepart of file name ])
120
AC_DEFINE([FN_EXTLEN],[20], [Max length of extension (part of FN_LEN) ])
121
AC_DEFINE([FN_REFLEN],[512], [Max length of full path-name ])
122
AC_DEFINE([FN_EXTCHAR],['.'], [File extension character])
123
AC_DEFINE([FN_HOMELIB],['~'], [~/ is used as abbrev for home dir ])
124
AC_DEFINE([FN_CURLIB],['.'], [./ is used as abbrev for current dir ])
125
AC_DEFINE([FN_PARENTDIR],[".."], [Parent directory; Must be a string ])
1 by brian
clean slate
126
448 by Monty Taylor
Moved global defines to configure.ac.
127
AC_DEFINE([MASTER],[1],[Compile without unireg])
128
457 by Monty
Re-worked a few defines to work around old autoconf version.
129
AH_VERBATIM([QUOTE_ARG],[
130
/* Quote argument (before cpp) */
131
#ifndef QUOTE_ARG
132
# define QUOTE_ARG(x) #x
133
#endif
134
/* Quote argument, (after cpp) */
135
#ifndef STRINGIFY_ARG
136
# define STRINGIFY_ARG(x) QUOTE_ARG(x)
137
#endif
138
])
139
140
AH_VERBATIM([builtin_expect],[
141
/*
142
 * The macros below are borrowed from include/linux/compiler.h in the
143
 * Linux kernel. Use them to indicate the likelyhood of the truthfulness
144
 * of a condition. This serves two purposes - newer versions of gcc will be
145
 * able to optimize for branch predication, which could yield siginficant
146
 * performance gains in frequently executed sections of the code, and the
147
 * other reason to use them is for documentation
148
 */
149
#if !defined(__GNUC__)
150
#define __builtin_expect(x, expected_value) (x)
151
#endif
152
153
#define likely(x)  __builtin_expect((x),1)
154
#define unlikely(x)  __builtin_expect((x),0)
155
])
448 by Monty Taylor
Moved global defines to configure.ac.
156
443 by Monty Taylor
Moved POSIX_PTHREAD flag.
157
AC_DEFINE([HAVE_REPLICATION],[1],[We always have replication])
441 by Monty Taylor
Move unconditional defines to config.h.
158
159
dnl  InnoDB depends on some Drizzle's internals which other plugins should not
160
dnl  need.  This is because of InnoDB's foreign key support, "safe" binlog
161
dnl  truncation, and other similar legacy features.
162
163
dnl  We define accessors for these internals unconditionally, but do not
164
dnl  expose them in mysql/plugin.h.  They are declared in ha_innodb.h for
165
dnl  InnoDB's use.
166
443 by Monty Taylor
Moved POSIX_PTHREAD flag.
167
AC_DEFINE([INNODB_COMPATIBILITY_HOOKS],[1],[TODO: Remove the need for this])
444 by Monty Taylor
Moved REENTRANT.
168
dnl TODO: Make a test for when this needs to be set.
169
AC_DEFINE([_REENTRANT],[1],[Some thread libraries require this])
443 by Monty Taylor
Moved POSIX_PTHREAD flag.
170
171
AH_VERBATIM([posix_pthread],[
172
/* We want posix threads */
173
#ifndef _POSIX_PTHREAD_SEMANTICS
174
#define _POSIX_PTHREAD_SEMANTICS
175
#endif
176
])
441 by Monty Taylor
Move unconditional defines to config.h.
177
178
1 by brian
clean slate
179
# Canonicalize the configuration name.
180
181
# Check whether --with-system-type or --without-system-type was given.
28.1.33 by Monty Taylor
Added -Wall
182
AC_ARG_WITH([system-type],
183
    [AS_HELP_STRING([--with-system-type],
184
       [Set the system type, like "sun-solaris10"])],
1 by brian
clean slate
185
    [SYSTEM_TYPE="$withval"],
186
    [SYSTEM_TYPE="$host_vendor-$host_os"])
28.1.33 by Monty Taylor
Added -Wall
187
AC_ARG_WITH([machine-type],
188
    [AS_HELP_STRING([--with-machine-type],
189
       [Set the machine type, like "powerpc"])],
1 by brian
clean slate
190
    [MACHINE_TYPE="$withval"],
191
    [MACHINE_TYPE="$host_cpu"])
192
AC_SUBST(SYSTEM_TYPE)
193
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
194
                   [Name of system, eg sun-solaris])
195
AC_SUBST(MACHINE_TYPE)
196
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
197
                   [Machine type name, eg sparc])
198
199
# Detect intel x86 like processor
200
BASE_MACHINE_TYPE=$MACHINE_TYPE
201
case $MACHINE_TYPE in
202
  i?86) BASE_MACHINE_TYPE=i386 ;;
203
esac
204
205
AM_SANITY_CHECK
206
# This is needed is SUBDIRS is set
207
AC_PROG_MAKE_SET
208
209
##############################################################################
210
# The below section needs to be done before AC_PROG_CC
211
##############################################################################
212
213
if test "x${CFLAGS-}" = x ; then
214
  cflags_is_set=no
215
else
216
  cflags_is_set=yes
217
fi
218
219
if test "x${CPPFLAGS-}" = x ; then
220
  cppflags_is_set=no
221
else
222
  cppflags_is_set=yes
223
fi
224
225
if test "x${LDFLAGS-}" = x ; then
226
  ldflags_is_set=no
227
else
228
  ldflags_is_set=yes
229
fi
230
231
################ End of section to be done before AC_PROG_CC #################
232
233
dnl Checks for programs.
234
AC_PROG_CC
236.1.2 by Monty Taylor
Changed the way we work around autoconf2.59
235
ifdef([AC_PROG_CC_C99],[
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
236
  dnl TODO: Need to fix this to use c99 instead of gnu99
236.1.2 by Monty Taylor
Changed the way we work around autoconf2.59
237
  AC_PROG_CC_C99([],[AC_MSG_ERROR([C99 support required for compiling Drizzle])])
238
  C99_SUPPORT_HACK=""
239
],[C99_SUPPORT_HACK="-std=gnu99"])
1 by brian
clean slate
240
AC_PROG_CXX
236.1.10 by Monty Taylor
Changed C++ check to actually check for CXX98 instead (since the plain C++ check can't be trusted)
241
AC_CXX_HEADER_STDCXX_98
242
if test "$ac_cv_cxx_stdcxx_98" = "no"
230.3.1 by Monty Taylor
Bug 252805: ./configure not detecting missing g++
243
then
244
  AC_MSG_ERROR([C++ Compiler required to compile Drizzle])
245
fi
1 by brian
clean slate
246
AC_PROG_CPP
247
AM_PROG_CC_C_O
248
249
# Print version of CC and CXX compiler (if they support --version)
250
case $SYSTEM_TYPE in
271 by Brian Aker
OSX fix
251
  *apple-darwin*)
252
    AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
1 by brian
clean slate
253
    ;;
254
  *)
255
CC_VERSION=`$CC --version | sed 1q`
256
    ;;
257
esac
258
if test $? -eq "0"
259
then
260
  AC_MSG_CHECKING("C Compiler version")
261
  AC_MSG_RESULT("$CC $CC_VERSION")
262
else
263
CC_VERSION=""
264
fi
265
AC_SUBST(CC_VERSION)
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
266
267
dnl AC_CANONICAL_HOST thinks it's a good idea to just set CFLAGS to 
268
dnl -g -O2 if you're running gcc. We would like to use something else, thanks.
269
if test "x${CFLAGS}" = "x-g -O2"
270
then
271
  CFLAGS=
272
fi
273
if test "x${CXXFLAGS}" = "x-g -O2"
274
then
275
  CXXFLAGS=
276
fi
277
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
278
DRIZZLE_CHECK_CXX_VERSION
1 by brian
clean slate
279
230.3.1 by Monty Taylor
Bug 252805: ./configure not detecting missing g++
280
AC_PROG_AWK
281
28.1.33 by Monty Taylor
Added -Wall
282
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
283
then
284
  AS="$CC -c"
285
  AC_SUBST(AS)
286
else
287
  AC_PATH_PROG(AS, as, as)
288
fi
289
446 by Monty Taylor
Moved GNU_SOURCE define to configure.
290
dnl TODO: This needs to go away and be replaced with _ISOC99_SOURCE
291
if test "$ac_cv_compiler_gnu" = "yes" -o "$target_os" = "linux-gnu"
292
then
293
  AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
294
fi
295
445 by Monty Taylor
Moved sun defines to configure.ac.
296
dnl  Solaris 9 include file <sys/feature_tests.h> refers to X/Open document
297
298
dnl  System Interfaces and Headers, Issue 5
299
300
dnl  saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes,
301
dnl  but apparently other systems (namely FreeBSD) don't agree.
302
303
dnl  On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600.
304
dnl  Furthermore, it tests that if a program requires older standard
305
dnl  (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be
306
dnl  run on a new compiler (that defines _STDC_C99) and issues an #error.
307
dnl  It's also an #error if a program requires new standard (_XOPEN_SOURCE=600
308
dnl  or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99.
309
310
dnl  To add more to this mess, Sun Studio C compiler defines _STDC_C99 while
311
dnl  C++ compiler does not!
312
455 by Monty Taylor
Rewored Sun C99 stuff in autoconf. (Trond... will this work?)
313
dnl TODO: Can _ISOC99_SOURCE be defined on all platforms and remove the 
314
dnl       Need for all of this? 
445 by Monty Taylor
Moved sun defines to configure.ac.
315
if test "${build_vendor}" = "sun"
316
then
455 by Monty Taylor
Rewored Sun C99 stuff in autoconf. (Trond... will this work?)
317
  dnl Do we need both of these? 
318
  dnl This is for C++
319
  AC_DEFINE([__C99FEATURES__],[1],[C99 Features])
320
  dnl This is for C
321
  AC_DEFINE([_XOPEN_SOURCE],[600],[X/Open Level])
445 by Monty Taylor
Moved sun defines to configure.ac.
322
fi
323
1 by brian
clean slate
324
# We use libtool
325
#AC_LIBTOOL_WIN32_DLL
326
AC_PROG_LIBTOOL
327
328
# Ensure that we have --preserve-dup-deps defines, otherwise we get link
329
# problems of 'mysql' with CXX=g++
330
LIBTOOL="$LIBTOOL --preserve-dup-deps"
331
AC_SUBST(LIBTOOL)dnl
332
333
AC_SUBST(NM)dnl
334
335
AC_PROG_INSTALL
336
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
337
338
# Not critical since the generated file is distributed
339
AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
77.1.70 by Monty Taylor
Added a failure if you don't have bison and you're building from a .bzr branch.
340
if test -z "$YACC" && test -d ".bzr"
341
then
342
  AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
343
fi
1 by brian
clean slate
344
345
AC_PATH_PROG(uname_prog, uname, no)
346
347
# We should go through this and put all the explictly system dependent
348
# stuff in one place
349
AC_MSG_CHECKING(operating system)
350
AC_CACHE_VAL(mysql_cv_sys_os,
351
[
352
if test "$uname_prog" != "no"; then
353
  mysql_cv_sys_os="`uname`"
354
else
355
  mysql_cv_sys_os="Not Solaris"
356
fi
357
])
358
AC_MSG_RESULT($mysql_cv_sys_os)
359
360
# This should be rewritten to use $target_os
361
case "$target_os" in
362
  *solaris*)
363
    TARGET_SOLARIS="true"
364
    AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
365
    AC_SUBST(TARGET_SOLARIS)
366
  ;;
367
esac
368
369
# The following is required for portable results of floating point calculations
370
# on PowerPC. The same must also be done for IA-64, but this options is missing
371
# in the IA-64 gcc backend.
372
373
if test "$GCC" = "yes"
374
then
375
  case "$host_cpu" in
376
    *ppc* | *powerpc*)
287.3.28 by Monty Taylor
Expanded the move to AM_CFLAGS and AM_CXXFLAGS. Now we should be more correct.
377
      AM_CFLAGS="$CFLAGS -mno-fused-madd"
378
      AM_CXXFLAGS="$CXXFLAGS -mno-fused-madd"
1 by brian
clean slate
379
    ;;
380
  esac
381
fi
382
383
AC_SUBST(CC)
384
AC_SUBST(CFLAGS)
385
AC_SUBST(CXX)
386
AC_SUBST(CXXFLAGS)
387
AC_SUBST(ASFLAGS)
388
AC_SUBST(LD)
389
AC_SUBST(INSTALL_SCRIPT)
390
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
391
1 by brian
clean slate
392
export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
393
394
if test "$GCC" = "yes"
395
then
396
  # Disable exceptions as they seams to create problems with gcc and threads.
279.2.7 by Monty Taylor
Replaced DYNAMIC_ARRAY in drizzlecheck with vector<string>
397
  # drizzled doesn't use run-time-type-checking, so we disable it.
139.1.8 by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot.
398
  AM_CXXFLAGS="${AM_CXXFLAGS} -fno-exceptions"
1 by brian
clean slate
399
fi
400
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
401
DRIZZLE_PROG_AR
1 by brian
clean slate
402
261.2.3 by Monty Taylor
Moved libdrizzle.ver.in to libdrizzle.ver.
403
# libdrizzle versioning when linked with GNU ld.
1 by brian
clean slate
404
if $LD --version 2>/dev/null|grep -q GNU; then
312.1.14 by Monty Taylor
Fixed bug#257694 - added various files to EXTRA_DIST and noinst_HEADERS to make make distcheck (and with-it out-of-tree builds) work.
405
  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libdrizzle/libdrizzle.ver"
1 by brian
clean slate
406
fi
407
AC_SUBST(LD_VERSION_SCRIPT)
408
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
409
#--------------------------------------------------------------------
410
# Check for Google Proto Buffers
411
#--------------------------------------------------------------------
412
413
AC_LANG_PUSH([C++])
414
AC_CHECK_HEADERS([google/protobuf/message.h])
415
if test "x$ac_cv_header_google_protobuf_message_h" != "xyes"
416
then
417
  AC_MSG_ERROR([Couldn't find message.h. Try installing Google Protocol Buffer development packages])
418
fi
419
420
save_CFLAGS="$CFLAGS"
421
save_LIBS="$LIBS"
422
CFLAGS=""
423
LIBS="-lprotobuf"
424
425
AC_CACHE_CHECK([for Message in libprotobuf], ac_libprotobuf_works, [
426
  AC_TRY_LINK([
427
#include <google/protobuf/descriptor.pb.h>
428
  ],[
429
    google::protobuf::FileDescriptorProto testFdp;
430
  ], ac_libprotobuf_works=yes, [
431
        AC_ERROR([could not find Google's libprotobuf])
432
  ])
433
434
])
435
436
PROTOBUF_LIBS="${LIBS}"
437
AC_SUBST(PROTOBUF_LIBS)
438
CFLAGS="$save_CFLAGS"
439
LIBS="$save_LIBS"
440
AC_LANG_POP()
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
441
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
442
#--------------------------------------------------------------------
443
# Check for libevent
444
#--------------------------------------------------------------------
445
134.2.1 by Antony Curtis
Changes for proper detection of libraries
446
AC_MSG_CHECKING(for libevent)
447
AC_ARG_WITH(libevent,
236.1.14 by Monty Taylor
Merged build changes from Antony.
448
  [AS_HELP_STRING([--with-libevent],
236.1.15 by Monty Taylor
Fixed the previous merge. (since I suck)
449
       [Use libevent build directory])],
236.1.14 by Monty Taylor
Merged build changes from Antony.
450
  [ with_libevent=$withval ],
451
  [ with_libevent=yes ])
452
236.1.35 by Monty Taylor
Fixed another libevent on OSX searching problem.
453
if test "$with_libevent" = "yes"
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
454
then
236.1.14 by Monty Taylor
Merged build changes from Antony.
455
    AC_CHECK_HEADERS(event.h)
456
    if test "x$ac_cv_header_event_h" != "xyes"
457
    then
458
      AC_MSG_ERROR([Couldn't find event.h. Try installing libevent development packages])
459
    fi
460
    my_save_LIBS="$LIBS"
461
    LIBS=""
462
    AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
463
    LIBEVENT_LIBS="${LIBS}"
464
    LIBS="${my_save_LIBS}"
465
    LIBEVENT_CFLAGS=""
466
else
467
    AC_MSG_RESULT($withval)
468
    if test -f $withval/event.h -a -f $withval/libevent.a; then
469
       owd=`pwd`
470
       if cd $withval; then withval=`pwd`; cd $owd; fi
471
       LIBEVENT_CFLAGS="-I$withval"
472
       LIBEVENT_LIBS="-L$withval -levent"
473
    elif test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then
474
       owd=`pwd`
475
       if cd $withval; then withval=`pwd`; cd $owd; fi
476
       LIBEVENT_CFLAGS="-I$withval/include"
477
       LIBEVENT_LIBS="-L$withval/lib -levent"
478
    else
236.1.39 by Monty Taylor
autoconf warning cleanups.
479
       AC_MSG_ERROR([event.h or libevent.a not found in $withval])
236.1.14 by Monty Taylor
Merged build changes from Antony.
480
    fi
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
481
fi
236.1.14 by Monty Taylor
Merged build changes from Antony.
482
483
AC_SUBST(LIBEVENT_CFLAGS)
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
484
AC_SUBST(LIBEVENT_LIBS)
134.2.1 by Antony Curtis
Changes for proper detection of libraries
485
486
AC_CACHE_CHECK([for bufferevent in libevent], ac_libevent_works, [
487
  save_CFLAGS="$CFLAGS"
488
  save_LIBS="$LIBS"
236.1.14 by Monty Taylor
Merged build changes from Antony.
489
  CFLAGS="$LIBEVENT_CFLAGS"
490
  LIBS="$LIBEVENT_LIBS"
134.2.1 by Antony Curtis
Changes for proper detection of libraries
491
  AC_TRY_LINK([
492
#include <sys/types.h>
493
#include <sys/time.h>
494
#include <stdlib.h>
495
#include <event.h>],[
496
	struct bufferevent bev;
497
	bufferevent_settimeout(&bev, 1, 1);
498
  ], ac_libevent_works=yes, [
499
        AC_ERROR([you need to install a more recent version of libevent,
500
	check http://www.monkey.org/~provos/libevent/])
501
  ])
502
503
  CFLAGS="$save_CFLAGS"
504
  LIBS="$save_LIBS"
505
])
506
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
507
508
#--------------------------------------------------------------------
509
# Check for libpthread
510
#--------------------------------------------------------------------
511
512
AC_CHECK_HEADERS(pthread.h)
513
if test "x$ac_cv_header_pthread_h" != "xyes"
514
then
515
  AC_MSG_ERROR([Couldn't find pthread.h.])
516
fi
517
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR(could not find libpthread)])
518
519
#--------------------------------------------------------------------
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
520
# Check for tcmalloc
521
#--------------------------------------------------------------------
522
523
AC_ARG_ENABLE([tcmalloc],
524
    [AS_HELP_STRING([--enable-tcmalloc],
525
       [Enable linking with tcmalloc @<:@default=off@:>@])],
236.1.14 by Monty Taylor
Merged build changes from Antony.
526
    [ac_enable_tcmalloc="$enableval"],
527
    [ac_enable_tcmalloc="no"])
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
528
236.1.14 by Monty Taylor
Merged build changes from Antony.
529
if test "x$ac_enable_tcmalloc" = "xyes"
77.1.111 by Monty Taylor
Added --enable-tcmalloc which will enable searching for and linking with tcmalloc if you have it.
530
then
531
  AC_CHECK_LIB(tcmalloc,malloc,[],[])
532
fi
533
534
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
535
# Check for libz
536
#--------------------------------------------------------------------
537
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
538
my_save_LIBS="$LIBS"
539
LIBS=""
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
540
AC_CHECK_HEADERS(zlib.h)
541
if test "x$ac_cv_header_zlib_h" != "xyes"
542
then
543
  AC_MSG_ERROR([Couldn't find zlib.h. Try installing zlib development packages])
544
fi
545
AC_CHECK_LIB(z, crc32, [], [AC_MSG_ERROR(could not find libz)])
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
546
ZLIB_LIBS="$LIBS"
547
LIBS="$my_save_LIBS"
548
AC_SUBST(ZLIB_LIBS)
549
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
550
182.1.5 by Jim Winstead
Detect and make the Mac OS X libedit readline interface look like the
551
#--------------------------------------------------------------------
552
# Check for libreadline or compatible (libedit on Mac OS X)
553
#--------------------------------------------------------------------
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
554
236.1.14 by Monty Taylor
Merged build changes from Antony.
555
AC_CHECK_HEADERS(readline/history.h readline/readline.h)
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
556
if test "x$ac_cv_header_readline_readline_h" != "xyes"
557
then
558
  AC_MSG_ERROR([Couldn't find readline/readline.h. Try installing readline development packages.])
559
fi
236.1.14 by Monty Taylor
Merged build changes from Antony.
560
AC_CHECK_TYPES([HIST_ENTRY], [], [], [AC_INCLUDES_DEFAULT[
561
#ifdef HAVE_READLINE_HISTORY_H
562
#include <readline/history.h>
563
#endif
564
#include <readline/readline.h>
565
]])
566
AC_CHECK_DECLS([completion_matches], [], [], [AC_INCLUDES_DEFAULT[
567
#ifdef HAVE_READLINE_HISTORY_H
568
#include <readline/history.h>
569
#endif
570
#include <readline/readline.h>
571
]])
207.1.2 by Jim Winstead
Fix test for libreadline to test a function that exists in all usable
572
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
573
DRIZZLE_CHECK_NEW_RL_INTERFACE
207.1.2 by Jim Winstead
Fix test for libreadline to test a function that exists in all usable
574
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
575
my_save_LIBS="$LIBS"
576
LIBS=""
207.1.2 by Jim Winstead
Fix test for libreadline to test a function that exists in all usable
577
AC_CHECK_LIB(readline, rl_initialize, [],
224.1.1 by Monty Taylor
Fixed readline build problem on Centos.
578
  [AC_CHECK_LIB(ncurses, tgetent, [], [AC_MSG_ERROR(Couldn't find ncurses)]) 
579
   AC_SEARCH_LIBS(rl_initialize, readline, [],
580
    [AC_MSG_ERROR(Couldn't find libreadline.)])])
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
581
READLINE_LIBS="$LIBS"
582
LIBS="$my_save_LIBS"
583
AC_SUBST(READLINE_LIBS)
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
584
287.3.30 by Monty Taylor
Added step one of finding libprotobuf.
585
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
586
#--------------------------------------------------------------------
587
# Check for libpcre
588
#--------------------------------------------------------------------
589
590
AC_LANG_PUSH([C++])
591
AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found.]))
236.1.18 by Monty Taylor
Put in actual PCRE linking test.
592
PKG_CHECK_MODULES(PCRE, [libpcrecpp >= 3], [found_pcre="yes"],[found_pcre="no"])
593
594
if test "$found_pcre" = "no"
595
then
77.1.64 by Monty Taylor
YA fix for libpcrecpp finding...
596
  dnl Only check the header here, because autoconf can't handle
597
  dnl checking for C++ methods without C linkages
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
598
  AC_CHECK_HEADERS(pcrecpp.h)
77.1.102 by Monty Taylor
Fixed a PCRE detection bug.
599
  if test "x$ac_cv_header_pcrecpp_h" != "xyes" 
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
600
  then
601
    AC_MSG_ERROR([Couldn't find pcrecpp.h. Try installing the development package associated with libpcre on your system.])
236.1.18 by Monty Taylor
Put in actual PCRE linking test.
602
  else
603
    # Found headers, now see if we can link
604
    AC_MSG_CHECKING(for libpcrecpp)
605
    save_LDFLAGS="$LDFLAGS"
606
    LDFLAGS="-lpcrecpp -lpcre"
607
    AC_TRY_LINK([
608
#include <pcrecpp.h>
609
    ],
610
    [pcrecpp::RE_Options opt;],
611
    [found_pcre="yes"],
612
    [AC_MSG_ERROR([Couldn't link libpcrecpp])])
613
614
    PCRE_LIBS="$LDFLAGS"
615
    LDFLAGS="$save_LDFLAGS"
616
    AC_MSG_RESULT([yes])
617
  fi
77.1.63 by Monty Taylor
Fail also if we can't find libevent or pthread.h.
618
fi
619
AC_LANG_POP([])
620
AC_SUBST(PCRE_LIBS)
621
AC_SUBST(PCRE_CFLAGS)
622
1 by brian
clean slate
623
dnl Find paths to some shell programs
624
AC_PATH_PROG(LN, ln, ln)
625
# This must be able to take a -f flag like normal unix ln.
626
AC_PATH_PROG(LN_CP_F, ln, ln)
627
628
AC_PATH_PROG(MV, mv, mv)
629
AC_PATH_PROG(RM, rm, rm)
630
AC_PATH_PROG(CP, cp, cp)
631
AC_PATH_PROG(SED, sed, sed)
632
AC_PATH_PROG(CMP, cmp, cmp)
633
AC_PATH_PROG(CHMOD, chmod, chmod)
634
AC_PATH_PROG(HOSTNAME, hostname, hostname)
635
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
636
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
637
AC_CHECK_PROGS(TAR, gnutar gtar tar)
638
639
dnl We use a path for perl so the script startup works
640
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
641
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
642
AC_PATH_PROG(PERL, perl, no)
643
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
644
then
645
  PERL5=$PERL
646
else
647
  AC_PATH_PROG(PERL5, perl5, no)
648
  if test "$PERL5" != no
649
  then
650
    PERL=$PERL5
651
    ac_cv_path_PERL=$ac_cv_path_PERL5
652
  fi
653
fi
654
655
AC_SUBST(HOSTNAME)
656
AC_SUBST(PERL)
657
AC_SUBST(PERL5)
658
659
# icheck, used for ABI check
660
AC_PATH_PROG(ICHECK, icheck, no)
661
# "icheck" is also the name of a file system check program on Tru64.
662
# Verify the program found is really the interface checker.
663
if test "x$ICHECK" != "xno"
664
then
665
  AC_MSG_CHECKING(if $ICHECK works as expected)
666
  echo "int foo;" > conftest.h
667
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
668
  if test -f "conftest.ic"
669
  then
670
    AC_MSG_RESULT(yes)
671
  else
672
    AC_MSG_RESULT(no)
673
    ICHECK=no
674
  fi
675
  rm -f conftest.ic conftest.h
676
fi
677
AC_SUBST(ICHECK)
678
679
# Lock for PS
680
AC_PATH_PROG(PS, ps, ps)
681
AC_MSG_CHECKING("how to check if pid exists")
682
PS=$ac_cv_path_PS
683
# Linux style
684
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
685
then
686
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
687
# Solaris
688
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
689
then
690
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
691
# BSD style
692
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
693
then
694
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
695
# SysV style
696
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
697
then
698
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
699
# Do anybody use this?
700
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
701
then
702
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
703
else
704
  case $SYSTEM_TYPE in
394 by Monty Taylor
Fix configure problem on cygwin. Thanks awfief.
705
    *freebsd*|*dragonfly*|*cygwin*)
1 by brian
clean slate
706
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
707
      ;;
708
    *darwin*)
709
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
710
      ;;
711
    *)
712
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
236.1.39 by Monty Taylor
autoconf warning cleanups.
713
      ;;
1 by brian
clean slate
714
  esac
715
fi
716
AC_SUBST(FIND_PROC)
717
AC_MSG_RESULT("$FIND_PROC")
718
719
# Check if a pid is valid
720
AC_PATH_PROG(KILL, kill, kill)
721
AC_MSG_CHECKING("for kill switches")
722
if $ac_cv_path_KILL -0 $$
723
then
724
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
725
elif kill -s 0 $$
726
then
727
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
728
else
729
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
730
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
731
fi
732
AC_SUBST(CHECK_PID)
733
AC_MSG_RESULT("$CHECK_PID")
734
735
# We need an ANSI C compiler
736
AM_PROG_CC_STDC
737
738
# We need an assembler, too
739
AM_PROG_AS
740
CCASFLAGS="$CCASFLAGS $ASFLAGS"
741
742
# Check if we need noexec stack for assembler
743
AC_CHECK_NOEXECSTACK
744
745
if test "$am_cv_prog_cc_stdc" = "no"
746
then
91 by Brian Aker
Main binary now named drizzled
747
  AC_MSG_ERROR([Drizzle requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
1 by brian
clean slate
748
fi
749
750
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
751
AC_ARG_WITH([server-suffix],
752
    [AS_HELP_STRING([--with-server-suffix],
753
      [Append value to the version string.])],
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
754
    [ DRIZZLE_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
755
    [ DRIZZLE_SERVER_SUFFIX= ]
1 by brian
clean slate
756
    )
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
757
AC_SUBST(DRIZZLE_SERVER_SUFFIX)
1 by brian
clean slate
758
759
# Force use of a curses libs
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
760
AC_ARG_WITH([named-curses-libs],
761
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
762
            [Use specified curses libraries instead of those
763
		automatically found by configure.])],
1 by brian
clean slate
764
    [ with_named_curses=$withval ],
765
    [ with_named_curses=no ]
766
    )
767
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
768
AC_ARG_WITH([tcp-port],
769
    [AS_HELP_STRING([--with-tcp-port=port-number],
165.1.1 by Elliot Murphy
new port number from IANA
770
            [Which port to use for Drizzle services @<:@default=4427@:>@])],
301 by Brian Aker
Clean up port startup
771
    [ DRIZZLE_TCP_PORT=$withval ],
772
    [ DRIZZLE_TCP_PORT=$DRIZZLE_TCP_PORT_DEFAULT
1 by brian
clean slate
773
      # if we actually defaulted (as opposed to the pathological case of
301 by Brian Aker
Clean up port startup
774
      # --with-tcp-port=<DRIZZLE_TCP_PORT_DEFAULT> which might in theory
1 by brian
clean slate
775
      # happen if whole batch of servers was built from a script), set
776
      # the default to zero to indicate that; we don't lose information
777
      # that way, because 0 obviously indicates that we can get the
301 by Brian Aker
Clean up port startup
778
      # default value from DRIZZLE_TCP_PORT. this seems really evil, but
779
      # testing for DRIZZLE_TCP_PORT==DRIZZLE_TCP_PORT_DEFAULT would make a
780
      # a port of DRIZZLE_TCP_PORT_DEFAULT magic even if the builder did not
1 by brian
clean slate
781
      # intend it to mean "use the default, in fact, look up a good default
165.1.1 by Elliot Murphy
new port number from IANA
782
      # from /etc/services if you can", but really, really meant 4427 when
783
      # they passed in 4427. When they pass in a specific value, let them
1 by brian
clean slate
784
      # have it; don't second guess user and think we know better, this will
785
      # just make people cross.  this makes the the logic work like this
786
      # (which is complicated enough):
787
      #
788
      # - if a port was set during build, use that as a default.
789
      #
790
      # - otherwise, try to look up a port in /etc/services; if that fails,
301 by Brian Aker
Clean up port startup
791
      #   use DRIZZLE_TCP_PORT_DEFAULT (at the time of this writing 4427)
1 by brian
clean slate
792
      #
301 by Brian Aker
Clean up port startup
793
      # - allow the DRIZZLE_TCP_PORT environment variable to override that.
1 by brian
clean slate
794
      #
795
      # - allow command-line parameters to override all of the above.
796
      #
301 by Brian Aker
Clean up port startup
797
      # the top-most DRIZZLE_TCP_PORT_DEFAULT is read from win/configure.js,
1 by brian
clean slate
798
      # so don't mess with that.
301 by Brian Aker
Clean up port startup
799
      DRIZZLE_TCP_PORT_DEFAULT=0 ]
1 by brian
clean slate
800
    )
301 by Brian Aker
Clean up port startup
801
AC_SUBST(DRIZZLE_TCP_PORT)
1 by brian
clean slate
802
# We might want to document the assigned port in the manual.
301 by Brian Aker
Clean up port startup
803
AC_SUBST(DRIZZLE_TCP_PORT_DEFAULT)
1 by brian
clean slate
804
805
# Use this to set the place used for unix socket used to local communication.
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
806
AC_ARG_WITH([mysqld-user],
807
    [AS_HELP_STRING([--with-mysqld-user=username],
808
            [What user the mysqld daemon shall be run as.
809
		@<:@default=mysql@:>@])],
1 by brian
clean slate
810
    [ MYSQLD_USER=$withval ],
811
    [ MYSQLD_USER=mysql ]
812
    )
813
AC_SUBST(MYSQLD_USER)
814
815
# If we should allow LOAD DATA LOCAL
816
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
817
AC_ARG_ENABLE(local-infile,
818
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
819
    [ ENABLED_LOCAL_INFILE=$enableval ],
820
    [ ENABLED_LOCAL_INFILE=no ]
821
    )
822
if test "$ENABLED_LOCAL_INFILE" = "yes"
823
then
824
  AC_MSG_RESULT([yes])
825
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
826
            [If LOAD DATA LOCAL INFILE should be enabled by default])
827
else
828
  AC_MSG_RESULT([no])
829
fi
830
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
831
DRIZZLE_SYS_LARGEFILE
1 by brian
clean slate
832
833
# Types that must be checked AFTER large file support is checked
834
AC_TYPE_SIZE_T
835
836
#--------------------------------------------------------------------
837
# Check for system header files
838
#--------------------------------------------------------------------
839
840
AC_HEADER_DIRENT
841
AC_HEADER_STDC
842
AC_HEADER_SYS_WAIT
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
843
AC_HEADER_STDBOOL
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
844
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
845
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
846
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
847
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h)
77.1.57 by Monty Taylor
Removed dual-compile needs on client.c. Get the symbols now from libdrizzle.
848
AC_CHECK_HEADERS(sys/timeb.h sys/vadvise.h sys/wait.h term.h)
202.1.4 by Monty Taylor
Removed openssl refs.
849
AC_CHECK_HEADERS(termio.h termios.h sched.h alloca.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
850
AC_CHECK_HEADERS(sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h)
851
AC_CHECK_HEADERS(sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h)
852
AC_CHECK_HEADERS(execinfo.h)
1 by brian
clean slate
853
854
AC_CHECK_HEADERS([xfs/xfs.h])
77.1.62 by Monty Taylor
Added checks for libz and readline devel files.
855
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
856
#--------------------------------------------------------------------
1 by brian
clean slate
857
# Check for system libraries. Adds the library to $LIBS
858
# and defines HAVE_LIBM etc
859
#--------------------------------------------------------------------
860
861
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
862
AC_CHECK_FUNCS(log2)
863
236.1.39 by Monty Taylor
autoconf warning cleanups.
864
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
865
AC_CHECK_FUNC(yp_get_default_domain, [],
866
  [AC_CHECK_LIB(nsl, yp_get_default_domain)])
867
AC_CHECK_FUNC(p2open, [], [AC_CHECK_LIB(gen, p2open)])
1 by brian
clean slate
868
# This may get things to compile even if bind-8 is installed
236.1.39 by Monty Taylor
autoconf warning cleanups.
869
AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
1 by brian
clean slate
870
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
871
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
872
873
# Check rt for aio_read
874
AC_CHECK_LIB(rt, aio_read)
875
876
# For the sched_yield() function on Solaris
236.1.39 by Monty Taylor
autoconf warning cleanups.
877
AC_CHECK_FUNC(sched_yield, [],
878
  [AC_CHECK_LIB(posix4, [sched_yield],
879
    [AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"])])
1 by brian
clean slate
880
881
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
882
then
236.1.39 by Monty Taylor
autoconf warning cleanups.
883
  AC_CHECK_FUNC(gtty, [], [AC_CHECK_LIB(compat, gtty)])
1 by brian
clean slate
884
fi
885
886
AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
887
                uchar, uint, ulong],[],[], [
888
#include <sys/types.h>
889
])
890
AC_CHECK_TYPES([fp_except], [], [], [
891
#include <sys/types.h>
892
#include <ieeefp.h>
893
])
894
25 by Brian Aker
Clean up of configure.in
895
my_save_LIBS="$LIBS"
896
LIBS=""
897
AC_CHECK_LIB(dl,dlopen)
177.3.1 by mark
remove ifdef HAVE_DLOPEN, make configure require dlopen()
898
AC_CHECK_FUNCS(dlopen dlerror)
899
if test "$ac_cv_func_dlopen" != "yes"
900
then
901
  AC_MSG_ERROR([Drizzle requires dlopen])
902
fi
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
903
LIBDL_LIBS="$LIBS"
25 by Brian Aker
Clean up of configure.in
904
LIBS="$my_save_LIBS"
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
905
AC_SUBST(LIBDL_LIBS)
25 by Brian Aker
Clean up of configure.in
906
907
AC_CHECK_FUNCS(strtok_r)
1 by brian
clean slate
908
201.2.4 by Monty Taylor
Re-enabled optimizations for the normal build, and added back the --with-debug option to turn them off.
909
910
1 by brian
clean slate
911
AC_ARG_WITH([fast-mutexes],
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
912
    [AS_HELP_STRING([--with-fast-mutexes],
913
	    [Compile with fast mutexes  @<:@default=off@:>@])],
914
    [with_fast_mutexes=$withval],
915
    [with_fast_mutexes=no])
1 by brian
clean slate
916
917
if test "$with_fast_mutexes" != "no"
918
then
51.3.26 by Jay Pipes
Final removal of DBUG library and cleanup of Makefiles
919
	AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
920
			[Define to 1 if you want to use fast mutexes])
1 by brian
clean slate
921
fi
922
236.1.56 by Monty Taylor
Made build of thr_mutex.c conditional on --with-fast-mutexes, since that's
923
AM_CONDITIONAL(BUILD_FAST_MUTEX,[test "$with_fast_mutexes" != "no"])
924
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
925
AC_ARG_WITH([comment],
926
    [AS_HELP_STRING([--with-comment],
927
            [Comment about compilation environment. @<:@default=off@:>@])],
1 by brian
clean slate
928
    [with_comment=$withval],
929
    [with_comment=no])
930
if test "$with_comment" != "no"
931
then
932
  COMPILATION_COMMENT=$with_comment
933
else
934
  COMPILATION_COMMENT="Source distribution"
935
fi
936
AC_SUBST(COMPILATION_COMMENT)
937
77.1.96 by Monty Taylor
Removed skip-external-locking.
938
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
939
then
940
  TARGET_LINUX="true"
941
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
942
else
943
  TARGET_LINUX="false"
944
fi
945
1 by brian
clean slate
946
dnl Checks for typedefs, structures, and compiler characteristics.
947
AC_C_CONST
948
AC_C_INLINE
949
AC_TYPE_OFF_T
950
AC_HEADER_TIME
951
AC_STRUCT_TM
952
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
953
# type. We want a error instead.
954
AC_CHECK_SIZEOF(char, 1)
955
if test "$ac_cv_sizeof_char" -eq 0
956
then
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
957
  AC_MSG_ERROR([No size for char type.])
1 by brian
clean slate
958
fi
959
AC_CHECK_SIZEOF(char*, 4)
960
AC_CHECK_SIZEOF(short, 2)
961
AC_CHECK_SIZEOF(int, 4)
962
if test "$ac_cv_sizeof_int" -eq 0
963
then
964
  AC_MSG_ERROR("No size for int type.")
965
fi
966
AC_CHECK_SIZEOF(long, 4)
967
if test "$ac_cv_sizeof_long" -eq 0
968
then
969
  AC_MSG_ERROR("No size for long type.")
970
fi
971
AC_CHECK_SIZEOF(long long, 8)
972
if test "$ac_cv_sizeof_long_long" -eq 0
973
then
91 by Brian Aker
Main binary now named drizzled
974
  AC_MSG_ERROR("Drizzle needs a long long type.")
1 by brian
clean slate
975
fi
976
# off_t is not a builtin type
977
AC_CHECK_SIZEOF(off_t, 4)
978
if test "$ac_cv_sizeof_off_t" -eq 0
979
then
91 by Brian Aker
Main binary now named drizzled
980
  AC_MSG_ERROR("Drizzle needs a off_t type.")
1 by brian
clean slate
981
fi
982
983
dnl
984
dnl check if time_t is unsigned
985
dnl
986
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
987
DRIZZLE_CHECK_TIME_T
1 by brian
clean slate
988
989
990
# do we need #pragma interface/#pragma implementation ?
991
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
992
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
993
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
994
# follow any standard), we'll use well-defined preprocessor macros:
28.1.33 by Monty Taylor
Added -Wall
995
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1 by brian
clean slate
996
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
997
#error USE_PRAGMA_IMPLEMENTATION
998
#endif
440 by Monty Taylor
Moved PRAGMA_INTERFACE to configure.ac
999
]])],[
1000
  AC_MSG_RESULT(no)
1001
],[
1002
  AC_MSG_RESULT(yes)
443 by Monty Taylor
Moved POSIX_PTHREAD flag.
1003
  AC_DEFINE(USE_PRAGMA_IMPLEMENTATION,[1],[pragma implementation is a good idea])
1004
  AC_DEFINE(USE_PRAGMA_INTERFACE,[1],[pragma interface is a good idea])
440 by Monty Taylor
Moved PRAGMA_INTERFACE to configure.ac
1005
])
1 by brian
clean slate
1006
1007
# This always gives a warning. Ignore it unless you are cross compiling
1008
AC_C_BIGENDIAN
1009
#---START: Used in for client configure
1010
# Check base type of last arg to accept
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1011
DRIZZLE_TYPE_ACCEPT
1 by brian
clean slate
1012
#---END:
1013
# Figure out what type of struct rlimit to use with setrlimit
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1014
DRIZZLE_TYPE_STRUCT_RLIMIT
1 by brian
clean slate
1015
# Find where the stack goes
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1016
DRIZZLE_STACK_DIRECTION
1 by brian
clean slate
1017
# We want to skip alloca on irix unconditionally. It may work on some version..
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1018
DRIZZLE_FUNC_ALLOCA
1 by brian
clean slate
1019
# Do struct timespec have members tv_sec or ts_sec
236.1.24 by Monty Taylor
Renamed MYSQL_TIME to DRIZZLE_TIME.
1020
DRIZZLE_TIMESPEC_TS
1 by brian
clean slate
1021
# Do we have the tzname variable
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1022
DRIZZLE_TZNAME
1 by brian
clean slate
1023
# Do the c++ compiler have a bool type
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1024
DRIZZLE_CXX_BOOL
1 by brian
clean slate
1025
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
1026
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
1027
AC_CHECK_TYPES([u_int32_t])
1028
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1029
DRIZZLE_PTHREAD_YIELD
1 by brian
clean slate
1030
134.2.1 by Antony Curtis
Changes for proper detection of libraries
1031
1 by brian
clean slate
1032
dnl Checks for header files.
1033
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
1034
1035
dnl Checks for library functions.
1036
AC_FUNC_ALLOCA
1037
AC_PROG_GCC_TRADITIONAL
1038
AC_TYPE_SIGNAL
1039
AC_CHECK_FUNCS(re_comp regcomp strdup)
1040
1041
dnl Sun compilers have their own vis.h that is about something
1042
dnl totally different. So, not to change the libedit source, we
1043
dnl do some additional checks before we define HAVE_VIS_H.
1044
AC_CHECK_HEADER(vis.h,
1045
  [AC_CHECK_FUNC(strvis,
1046
    [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
1047
1048
AC_CHECK_FUNCS(strlcat strlcpy)
1049
AC_CHECK_FUNCS(issetugid)
1050
AC_CHECK_FUNCS(getline flockfile)
1051
1052
# from old readline settting:
1053
1054
MAKE_SHELL=/bin/sh
1055
AC_SUBST(MAKE_SHELL)
1056
1057
# Already-done: stdlib.h string.h unistd.h termios.h
398.1.9 by Monty Taylor
Cleaned up stuff out of global.h.
1058
AC_CHECK_HEADERS(stdarg.h dirent.h locale.h ndir.h sys/dir.h \
1 by brian
clean slate
1059
 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
1060
 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
1061
paths.h semaphore.h)
1062
1063
# Already-done: strcasecmp
1064
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
1065
28.1.33 by Monty Taylor
Added -Wall
1066
AC_HEADER_STAT
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1067
DRIZZLE_SIGNAL_CHECK
1068
DRIZZLE_CHECK_GETPW_FUNCS
1069
DRIZZLE_HAVE_TIOCGWINSZ
1070
DRIZZLE_HAVE_FIONREAD
1071
DRIZZLE_HAVE_TIOCSTAT
1072
DRIZZLE_STRUCT_DIRENT_D_INO
1073
DRIZZLE_STRUCT_DIRENT_D_NAMLEN
1074
DRIZZLE_TYPE_SIGHANDLER
1075
DRIZZLE_CHECK_MULTIBYTE
1 by brian
clean slate
1076
if test "$with_named_curses" = "no"
1077
then
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1078
  DRIZZLE_CHECK_LIB_TERMCAP
1 by brian
clean slate
1079
else
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
1080
  TERMCAP_LIBS="$with_named_curses"
1 by brian
clean slate
1081
fi
201.2.3 by Monty Taylor
Cleaned up some LIBS bits in the build.
1082
AC_SUBST(TERMCAP_LIBS)
1 by brian
clean slate
1083
1084
# Check if the termcap function 'tgoto' is already declared in
1085
# system header files or if it need to be declared locally
1086
AC_CHECK_DECLS(tgoto,,,[
1087
#ifdef HAVE_CURSES_H
1088
# include <curses.h>
1089
#elif HAVE_NCURSES_H
1090
# include <ncurses.h>
1091
#endif
1092
#ifdef HAVE_TERM_H
1093
# include <term.h>
1094
#endif
1095
])
1096
1097
# End of readline/libedit stuff
1098
#########################################################################
1099
1100
dnl Checks for library functions.
1101
1102
#
1103
# The following code disables intrinsic function support while we test for
1104
# library functions.  This is to avoid configure problems with Intel ecc
1105
# compiler
1106
1107
ORG_CFLAGS="$CFLAGS"
1108
if test "$GCC" != "yes"; then
1109
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
1110
fi
1111
1112
#AC_FUNC_MMAP
1113
AC_TYPE_SIGNAL
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1114
DRIZZLE_TYPE_QSORT
1 by brian
clean slate
1115
AC_FUNC_UTIME_NULL
1116
AC_FUNC_VPRINTF
1117
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
1118
AC_CHECK_FUNCS(fcntl)
1119
if test "x$ac_cv_func_fcntl" != "xyes"
1120
then
1121
  AC_MSG_ERROR("Drizzle requires fcntl.")
1122
fi
1123
236.1.50 by Monty Taylor
Added automake conditional compilation of distributed system replacement functions.
1124
AC_CONFIG_LIBOBJ_DIR([mystrings])
1125
212.6.3 by Mats Kindahl
Removing deprecated functions from code and replacing them with C99 equivalents:
1126
AC_CHECK_FUNCS(bsearch \
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
1127
  cuserid fchmod \
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
1128
  fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
425 by Monty Taylor
Removed getpass references.
1129
  getcwd getpassphrase getpwnam \
1 by brian
clean slate
1130
  getpwuid getrlimit getrusage getwd index initgroups isnan \
1131
  localtime_r gethrtime gmtime_r \
212.6.1 by Mats Kindahl
Replacing all bzero() calls with memset() calls and removing the bzero.c file.
1132
  locking longjmp lrand48 madvise mallinfo \
212.6.3 by Mats Kindahl
Removing deprecated functions from code and replacing them with C99 equivalents:
1133
  memmove \
236.1.53 by Monty Taylor
Made getpagesize an automake compat LIBOBJ.
1134
  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 \
1 by brian
clean slate
1135
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
1136
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
1137
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
1138
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
449 by Monty Taylor
Removed rint check - rint is part of C99.
1139
  realpath rename rwlock_init setupterm \
1 by brian
clean slate
1140
  shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
1141
  sighold sigset sigthreadmask port_create sleep \
266.1.12 by Monty Taylor
Renamed strnmov to stpncpy. Made it conditional.
1142
  snprintf socket strcasecmp strerror strsignal strpbrk \
236.1.54 by Monty Taylor
Removed double check for string functions.
1143
  tell tempnam vidattr \
1 by brian
clean slate
1144
  posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
1145
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
1146
AC_LANG_PUSH(C++)
1147
# Test whether madvise() is declared in C++ code -- it is not on some
1148
# systems, such as Solaris
373.1.3 by Monty Taylor
Fixed test for HAVE_DECL_MADVISE to actually work.
1149
AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
1150
#if HAVE_SYS_MMAN_H
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
1151
#include <sys/types.h>
1152
#include <sys/mman.h>
373.1.3 by Monty Taylor
Fixed test for HAVE_DECL_MADVISE to actually work.
1153
#endif
1154
]])
287.3.18 by Monty Taylor
Put -fno-exceptions flag in selectively. Add back HAVE_DECL_MADVISE check so
1155
AC_LANG_POP()
1156
1157
236.1.59 by Monty Taylor
Turn thr_rwlock.c into a conditionally built source file.
1158
AM_CONDITIONAL(BUILD_THR_RWLOCK,[test "$ac_cv_func_rwlock_init" -a "$ac_cv_funn_pthread_rwlock_rdlock"])
1159
28.1.33 by Monty Taylor
Added -Wall
1160
# Check that isinf() is available in math.h and can be used in both C and C++
1 by brian
clean slate
1161
# code
28.1.33 by Monty Taylor
Added -Wall
1162
AC_MSG_CHECKING(for isinf in math.h)
1163
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1164
    float f = 0.0; 
1165
    int r = isinf(f); 
1166
    return r;
1167
  ]])],[
1 by brian
clean slate
1168
    AC_MSG_RESULT(yes)
28.1.33 by Monty Taylor
Added -Wall
1169
    AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1170
    AC_LANG_PUSH([C++])
1171
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1172
      float f = 0.0;
1173
      int r = isinf(f);
1174
      return r;
1175
    ]])],[
1176
      AC_MSG_RESULT(yes)
1177
      AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function])
1178
    ],[
1179
      AC_MSG_RESULT(no)
1180
    ])
1181
    AC_LANG_POP([])
1182
  ],[
1183
  AC_MSG_RESULT(no)])
1184
1185
1 by brian
clean slate
1186
CFLAGS="$ORG_CFLAGS"
1187
1188
# Sanity check: We chould not have any fseeko symbol unless
1189
# large_file_support=yes
1190
AC_CHECK_FUNC(fseeko,
1191
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
1192
then
1193
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
1194
fi]
1195
)
1196
1197
# Check definition of pthread_getspecific
236.1.39 by Monty Taylor
autoconf warning cleanups.
1198
AC_CACHE_CHECK([args to pthread_getspecific], [mysql_cv_getspecific_args],
1199
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(_REENTRANT)
1 by brian
clean slate
1200
#define _REENTRANT
1201
#endif
1202
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1203
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1204
pthread_getspecific((pthread_key_t) NULL); ]])],
1205
    [mysql_cv_getspecific_args=POSIX],
1206
    [mysql_cv_getspecific_args=other])])
1 by brian
clean slate
1207
  if test "$mysql_cv_getspecific_args" = "other"
1208
  then
1209
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1210
              [For some non posix threads])
1211
  fi
1212
1213
  # Check definition of pthread_mutex_init
236.1.39 by Monty Taylor
autoconf warning cleanups.
1214
  AC_CACHE_CHECK([args to pthread_mutex_init], [mysql_cv_mutex_init_args],
1215
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1216
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1217
#include <pthread.h> ]], [[ 
1 by brian
clean slate
1218
  pthread_mutexattr_t attr;
1219
  pthread_mutex_t mp;
236.1.39 by Monty Taylor
autoconf warning cleanups.
1220
  pthread_mutex_init(&mp,&attr); ]])],
1221
      [mysql_cv_mutex_init_args=POSIX],
1222
      [mysql_cv_mutex_init_args=other])])
1 by brian
clean slate
1223
  if test "$mysql_cv_mutex_init_args" = "other"
1224
  then
1225
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1226
              [For some non posix threads])
1227
  fi
1228
#---END:
1229
1230
#---START: Used in for client configure
1231
# Check definition of readdir_r
236.1.39 by Monty Taylor
autoconf warning cleanups.
1232
AC_CACHE_CHECK([args to readdir_r], [mysql_cv_readdir_r],
1233
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1234
#define _POSIX_PTHREAD_SEMANTICS 
1235
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1236
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1237
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
1238
    [mysql_cv_readdir_r=POSIX],
1239
    [mysql_cv_readdir_r=other])])
1 by brian
clean slate
1240
if test "$mysql_cv_readdir_r" = "POSIX"
1241
then
1242
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1243
fi
1244
1245
# Check definition of posix sigwait()
236.1.39 by Monty Taylor
autoconf warning cleanups.
1246
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
1247
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1248
#define _REENTRANT
1 by brian
clean slate
1249
#define _POSIX_PTHREAD_SEMANTICS 
1250
#include <pthread.h>
236.1.39 by Monty Taylor
autoconf warning cleanups.
1251
#include <signal.h>
1252
      ]], [[
1253
#ifndef _AIX
1 by brian
clean slate
1254
sigset_t set;
1255
int sig;
1256
sigwait(&set,&sig);
236.1.39 by Monty Taylor
autoconf warning cleanups.
1257
#endif
1258
      ]])],
1259
    [mysql_cv_sigwait=POSIX],
1260
    [mysql_cv_sigwait=other])])
1 by brian
clean slate
1261
if test "$mysql_cv_sigwait" = "POSIX"
1262
then
1263
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1264
fi
1265
1266
if test "$mysql_cv_sigwait" != "POSIX"
1267
then
1268
unset mysql_cv_sigwait
1269
# Check definition of posix sigwait()
236.1.39 by Monty Taylor
autoconf warning cleanups.
1270
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
1271
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1272
#define _REENTRANT
1 by brian
clean slate
1273
#define _POSIX_PTHREAD_SEMANTICS 
1274
#include <pthread.h>
236.1.39 by Monty Taylor
autoconf warning cleanups.
1275
#include <signal.h>
1276
      ]], [[
1277
sigset_t set;
1 by brian
clean slate
1278
int sig;
236.1.39 by Monty Taylor
autoconf warning cleanups.
1279
sigwait(&set);
1280
      ]])],
1281
    [mysql_cv_sigwait=NONPOSIX],
1282
    [mysql_cv_sigwait=other])])
1 by brian
clean slate
1283
if test "$mysql_cv_sigwait" = "NONPOSIX"
1284
then
1285
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1286
fi
1287
fi
1288
#---END:
1289
1290
# Check if pthread_attr_setscope() exists
236.1.39 by Monty Taylor
autoconf warning cleanups.
1291
AC_CACHE_CHECK([for pthread_attr_setscope], [mysql_cv_pthread_attr_setscope],
1292
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1293
#define _REENTRANT
1 by brian
clean slate
1294
#define _POSIX_PTHREAD_SEMANTICS 
236.1.39 by Monty Taylor
autoconf warning cleanups.
1295
#include <pthread.h>
1296
      ]], [[
1297
pthread_attr_t thr_attr;
1298
pthread_attr_setscope(&thr_attr,0);
1299
      ]])],
1300
    [mysql_cv_pthread_attr_setscope=yes],
1301
    [mysql_cv_pthread_attr_setscope=no])])
1 by brian
clean slate
1302
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1303
then
1304
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1305
fi
1306
1307
# Check for bad includes
1308
AC_MSG_CHECKING("can netinet files be included")
28.1.33 by Monty Taylor
Added -Wall
1309
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1 by brian
clean slate
1310
#include <sys/socket.h>
1311
#include <netinet/in_systm.h>
1312
#include <netinet/in.h>
1313
#include <netinet/ip.h>
28.1.33 by Monty Taylor
Added -Wall
1314
#include <netinet/tcp.h>]], [[ printf("1\n"); ]])],[netinet_inc=yes],[netinet_inc=no])
1 by brian
clean slate
1315
if test "$netinet_inc" = "no"
1316
then
1317
  AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1318
fi
1319
AC_MSG_RESULT("$netinet_inc")
1320
28.1.33 by Monty Taylor
Added -Wall
1321
AC_LANG_PUSH([C++])
1 by brian
clean slate
1322
AC_CHECK_HEADERS(cxxabi.h)
1323
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
28.1.33 by Monty Taylor
Added -Wall
1324
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1 by brian
clean slate
1325
  char *foo= 0; int bar= 0;
1326
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
28.1.33 by Monty Taylor
Added -Wall
1327
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1328
AC_LANG_POP([])
1 by brian
clean slate
1329
1330
if test "x$mysql_cv_cxa_demangle" = xyes; then
1331
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1332
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1333
fi
1334
1335
#--------------------------------------------------------------------
1336
# Check for requested features
1337
#--------------------------------------------------------------------
1338
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1339
DRIZZLE_CHECK_BIG_TABLES
1340
DRIZZLE_CHECK_MAX_INDEXES
1341
DRIZZLE_CHECK_VIO
1 by brian
clean slate
1342
1343
#--------------------------------------------------------------------
1344
# Declare our plugin modules
1345
# Has to be done late, as the plugin may need to check for existence of
1346
# functions tested above
1347
#--------------------------------------------------------------------
1348
319.1.1 by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_
1349
DRIZZLE_CONFIGURE_PLUGINS([none])
1 by brian
clean slate
1350
1351
AC_SUBST(mysql_plugin_dirs)
1352
AC_SUBST(mysql_plugin_libs)
1353
AC_SUBST(mysql_plugin_defs)
1354
435.1.1 by Monty Taylor
Fixed -O3 optimization for gcc.
1355
# Build optimized or debug version ?
1356
# First check for gcc and g++
1357
if test "$ac_cv_c_compiler_gnu" = "yes"
1358
then
1359
  SYMBOLS_CFLAGS="-ggdb3"
1360
  DEBUG_OPTIMIZE_CC="-O0"
1361
  OPTIMIZE_CFLAGS="-O3"
1362
else
1363
  SYMBOLS_CFLAGS="-g"
1364
  DEBUG_OPTIMIZE_CC=""
1365
  OPTIMIZE_CFLAGS="-O"
1366
fi
1367
if test "$ac_cv_prog_cxx_g" = "yes"
1368
then
1369
  SYMBOLS_CXXFLAGS="-ggdb3"
1370
  DEBUG_OPTIMIZE_CXX="-O0"
1371
  OPTIMIZE_CXXFLAGS="-O3"
1372
else
1373
  SYMBOLS_CXXFLAGS="-g"
1374
  DEBUG_OPTIMIZE_CXX=""
1375
  OPTIMIZE_CXXFLAGS="-O"
1376
fi
1377
1378
dnl TODO: Remove this define once we are using 2.61 across the board.
1379
# AC_HEADER_ASSERT
1380
# ----------------
1381
# Check whether to enable assertions.
1382
ifdef([AC_HEADER_ASSERT], [], [AC_DEFUN([AC_HEADER_ASSERT],
1383
[
1384
  AC_MSG_CHECKING([whether to enable assertions])
1385
  AC_ARG_ENABLE([assert],
1386
    [  --disable-assert        turn off assertions],
1387
    [AC_MSG_RESULT([no])
1388
     AC_DEFINE(NDEBUG, 1, [Define to 1 if assertions should be disabled.])],
1389
    [AC_MSG_RESULT(yes)])
1390
])])
1391
1392
AC_HEADER_ASSERT
1393
1394
CFLAGS="${SYMBOLS_CFLAGS} ${CFLAGS}"
1395
CXXFLAGS="${SYMBOLS_CXXFLAGS} ${CXXFLAGS}  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
1396
1397
AC_ARG_WITH([debug],
1398
    [AS_HELP_STRING([--with-debug],
1399
       [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
1400
    [with_debug=$withval],
1401
    [with_debug=no])
1402
if test "$with_debug" = "yes"
1403
then
1404
  # Medium debug.
1405
  CFLAGS="$DEBUG_OPTIMIZE_CC $CFLAGS ${SAVE_CFLAGS}"
1406
  CXXFLAGS="$DEBUG_OPTIMIZE_CXX $CXXFLAGS ${SAVE_CXXFLAGS}"
1407
else
1408
  # Optimized version. No debug
1409
  CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS} ${SAVE_CFLAGS}"
1410
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS ${SAVE_CXXFLAGS}"
1411
fi
1412
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1413
AC_ARG_ENABLE([profiling],
1414
    [AS_HELP_STRING([--enable-profiling],
1415
       [Toggle profiling @<:@default=off@:>@])],
1416
    [ac_profiling="$enableval"],
1417
    [ac_profiling="no"])
1418
1419
AC_ARG_ENABLE([coverage],
1420
    [AS_HELP_STRING([--enable-coverage],
1421
       [Toggle coverage @<:@default=off@:>@])],
1422
    [ac_coverage="$enableval"],
1423
    [ac_coverage="no"])
1424
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1425
AC_ARG_ENABLE([pedantic-warnings],
1426
    [AS_HELP_STRING([--disable-pedantic-warnings],
1427
       [Toggle pedanticness @<:@default=on@:>@])],
1428
    [ac_warn_pedantic="$enableval"],
1429
    [ac_warn_pedantic="yes"])
1430
1431
AC_ARG_ENABLE([fail],
77.1.112 by Monty Taylor
Fixed comment on --enable-fail -> --disable-fail.
1432
    [AS_HELP_STRING([--disable-fail],
1433
       [Turn warnings into failures @<:@default=on@:>@])],
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1434
    [ac_warn_fail="$enableval"],
77.1.108 by Monty Taylor
Turn on -Werror again by default.
1435
    [ac_warn_fail="yes"])
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1436
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1437
AC_ARG_ENABLE([unreachable],
1438
    [AS_HELP_STRING([--enable-unreachable],
1439
       [Enable warnings about unreachable code @<:@default=off@:>@])],
1440
    [ac_warn_unreachable="$enableval"],
1441
    [ac_warn_unreachable="no"])
1442
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1443
AC_ARG_ENABLE([longlong-warnings],
1444
    [AS_HELP_STRING([--enable-longlong-warnings],
1445
       [Enable warnings about longlong in C++ @<:@default=off@:>@])],
1446
    [ac_warn_longlong="$enableval"],
421 by Monty
Made including stdint.h work.
1447
    [ac_warn_longlong="no"])
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1448
1449
AC_ARG_ENABLE([strict-aliasing],
1450
    [AS_HELP_STRING([--enable-strict-aliasing],
1451
       [Enable warnings about stict-aliasing @<:@default=off@:>@])],
1452
    [ac_warn_strict_aliasing="$enableval"],
1453
    [ac_warn_strict_aliasing="no"])
1454
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1455
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1456
if test "$GCC" = "yes"
1457
then
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1458
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1459
  if test "$ac_warn_longlong" = "yes"
1460
  then
1461
    W_LONGLONG="-Wlong-long"
1462
  else
1463
    W_LONGLONG="-Wno-long-long"
1464
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1465
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1466
  if test "$ac_warn_strict_aliasing" = "yes"
1467
  then
1468
    W_STRICT_ALIASING="-Wstrict-aliasing"
1469
  else
77.1.110 by Monty Taylor
Fixed a typo.
1470
    W_STRICT_ALIASING="-Wno-strict-aliasing"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1471
  fi
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1472
189 by Brian Aker
Refactor of configure.ac. Added profile. One note... I believe this should
1473
  if test "$ac_profiling" = "yes"
1474
  then
1475
    GPROF_PROFILING="-pg"
1476
  else
1477
    GPROF_PROFILING=" "
1478
  fi
1479
1480
  if test "$ac_coverage" = "yes"
1481
  then
1482
    GPROF_COVERAGE="-fprofile-arcs -ftest-coverage"
1483
  else
1484
    GPROF_COVERAGE=" "
1485
  fi
1486
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1487
  if test "$ac_warn_pedantic" = "yes"
1488
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1489
    GCC_PEDANTIC="-pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls ${W_STRICT_ALIASING}"
1490
    GXX_PEDANTIC="-pedantic -Wundef -Wredundant-decls ${W_LONGLONG} ${W_STRICT_ALIASING}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1491
  fi
1492
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1493
  if test "$ac_warn_unreachable" = "yes"
1494
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1495
    W_UNREACHABLE="-Wunreachable-code"
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1496
  fi
1497
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1498
  if test "$ac_warn_fail" = "yes"
1499
  then
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1500
    W_FAIL="-Werror"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1501
  fi
1502
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1503
  BASE_WARNINGS="-W -Wall -Wextra"
236.1.2 by Monty Taylor
Changed the way we work around autoconf2.59
1504
  GCC_WARNINGS="${C99_SUPPORT_HACK} ${BASE_WARNINGS} ${GCC_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL} ${GPROF_PROFILING} ${GPROF_COVERAGE}"
230.3.1 by Monty Taylor
Bug 252805: ./configure not detecting missing g++
1505
  GXX_WARNINGS="${BASE_WARNINGS} ${GXX_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL} ${GPROF_PROFILING} ${GPROF_COVERAGE}"
77.1.109 by Monty Taylor
Made --disable-pedantic-warnings only disable the pedantic warnings, rather than also removing the -std=gnu99 part.
1506
287.3.28 by Monty Taylor
Expanded the move to AM_CFLAGS and AM_CXXFLAGS. Now we should be more correct.
1507
  AM_CXXFLAGS="${GXX_WARNINGS} ${AM_CXXFLAGS}"
1508
  AM_CFLAGS="${GCC_WARNINGS} ${AM_CFLAGS}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1509
fi
1510
212.5.43 by Monty Taylor
Removed global include dir from CPPFLAGS.
1511
AC_SUBST([GLOBAL_CPPFLAGS],['-I$(top_srcdir) -I$(top_builddir)'])
202.1.23 by Monty Taylor
Moved the includes we use everywhere to to GLOBAL_CPPFLAGS and added AM_CPPFLAGS to an AC_SUBST, so that we could take out the redundant declaration from most fof the Makefiles.
1512
AC_SUBST([AM_CPPFLAGS],['${GLOBAL_CPPFLAGS}'])
287.3.26 by Monty Taylor
Put warnings into AM_C*FLAGS so they can be overridden per lib.
1513
AC_SUBST([AM_CFLAGS])
1514
AC_SUBST([AM_CXXFLAGS])
202.1.23 by Monty Taylor
Moved the includes we use everywhere to to GLOBAL_CPPFLAGS and added AM_CPPFLAGS to an AC_SUBST, so that we could take out the redundant declaration from most fof the Makefiles.
1515
1 by brian
clean slate
1516
# Some usefull subst
1517
AC_SUBST(CC)
1518
AC_SUBST(GXX)
1519
1520
# Set configuration options for make_binary_distribution
1521
case $SYSTEM_TYPE in
1522
  *netware*)
1523
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1524
    ;;
1525
  *)
1526
    : # no change for other platforms yet
1527
    ;;
1528
esac
1529
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1530
287.3.1 by Monty Taylor
Removed mysys/tests.
1531
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
264.1.15 by Monty Taylor
Removed a bunch of files from mystrings that aren't build or used at all.
1532
 mystrings/Makefile storage/Makefile dnl
202.3.2 by Monty Taylor
Added gettext calls in to my_getopt.c and drizzle.c
1533
 vio/Makefile po/Makefile.in dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1534
 libdrizzle/Makefile client/Makefile dnl
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
1535
 drizzled/Makefile dnl
1536
 drizzled/field/Makefile dnl
316 by Brian Aker
First pass of new sql_db.cc work
1537
 drizzled/serialize/Makefile dnl
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
1538
 drizzled/sql_builtin.cc dnl
28.1.31 by Monty Taylor
Deleted tons of pointless garbage from scripts.
1539
 support-files/Makefile dnl
77.1.47 by Monty Taylor
Moved test to tests...
1540
 tests/Makefile tests/install_test_db dnl
212.5.36 by Monty Taylor
Moved drizzle_version.
1541
 drizzled/version.h plugin/Makefile dnl
214 by Brian Aker
Rename of fields (fix issue with string and decimal .h clashing).
1542
 drizzled/drizzled_safe support-files/libdrizzle.pc dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1543
 support-files/drizzle.server support-files/drizzle-log-rotate)
1 by brian
clean slate
1544
1545
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1546
1547
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
287.3.28 by Monty Taylor
Expanded the move to AM_CFLAGS and AM_CXXFLAGS. Now we should be more correct.
1548
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS' AM_CFLAGS='$AM_CFLAGS' AM_CXXFLAGS='$AM_CXXFLAGS'")
1 by brian
clean slate
1549
1550
AC_OUTPUT