~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Monty Taylor
  • Date: 2008-11-16 05:36:13 UTC
  • mto: (584.1.9 devel)
  • mto: This revision was merged to the branch mainline in revision 589.
  • Revision ID: monty@inaugust.com-20081116053613-bld4rqxhlkb49c02
Split out cache_row and type_holder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
dnl -*- bash -*-
2
2
dnl Process this file with autoconf to produce a configure script.
3
3
 
4
 
dnl  Copyright (C) 2009 Sun Microsystems, Inc.
5
 
dnl
6
 
dnl  This program is free software; you can redistribute it and/or modify
7
 
dnl  it under the terms of the GNU General Public License as published by
8
 
dnl  the Free Software Foundation; version 2 of the License.
9
 
dnl
10
 
dnl  This program is distributed in the hope that it will be useful,
11
 
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
dnl  GNU General Public License for more details.
14
 
dnl
15
 
dnl  You should have received a copy of the GNU General Public License
16
 
dnl  along with this program; if not, write to the Free Software
17
 
dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 
19
 
 
20
4
AC_PREREQ(2.59)dnl              Minimum Autoconf version required.
21
 
dnl Version from the AC_INIT call below is overridden later
22
 
dnl So don't update it here
23
 
AC_INIT([drizzle7],[7],[http://bugs.launchpad.net/drizzle])
 
5
 
 
6
AC_INIT(drizzle, [7.0.0], [http://bugs.launchpad.net/drizzle])
24
7
AC_CONFIG_SRCDIR([drizzled/drizzled.cc])
25
 
AC_CONFIG_AUX_DIR([config])
26
 
 
27
 
PANDORA_CANONICAL_TARGET(less-warnings, require-cxx, force-gcc42, version-from-vc) 
28
 
 
29
 
LIBDRIZZLE_LIBRARY_VERSION=1:0:0
30
 
#                          | | |
31
 
#                   +------+ | +---+
32
 
#                   |        |     |
33
 
#                current:revision:age
34
 
#                   |        |     |
35
 
#                   |        |     +- increment if interfaces have been added
36
 
#                   |        |        set to zero if interfaces have been
37
 
#                   |        |        removed or changed
38
 
#                   |        +- increment if source code has changed
39
 
#                   |           set to zero if current is incremented
40
 
#                   +- increment if interfaces have been added, removed or
41
 
#                      changed
42
 
AC_SUBST(LIBDRIZZLE_LIBRARY_VERSION)
 
8
AC_CONFIG_AUX_DIR(config)
 
9
AC_CONFIG_HEADERS([config.h])
 
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
 
 
30
AC_CANONICAL_TARGET
 
31
AM_INIT_AUTOMAKE(-Wall -Wno-portability -Werror)
 
32
 
 
33
PROTOCOL_VERSION=10
 
34
DOT_FRM_VERSION=6
 
35
# See the libtool docs for information on how to do shared lib versions.
 
36
SHARED_LIB_MAJOR_VERSION=1
 
37
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
 
38
 
 
39
##############################################################################
 
40
# The below section needs to be done before AC_PROG_CC
 
41
##############################################################################
 
42
 
 
43
if test "x${CFLAGS-}" = x ; then
 
44
  cflags_is_set=no
 
45
else
 
46
  cflags_is_set=yes
 
47
fi
 
48
 
 
49
if test "x${CPPFLAGS-}" = x ; then
 
50
  cppflags_is_set=no
 
51
else
 
52
  cppflags_is_set=yes
 
53
fi
 
54
 
 
55
if test "x${LDFLAGS-}" = x ; then
 
56
  ldflags_is_set=no
 
57
else
 
58
  ldflags_is_set=yes
 
59
fi
 
60
 
 
61
################ End of section to be done before AC_PROG_CC #################
 
62
 
 
63
dnl Checks for programs.
 
64
AC_PROG_CC
 
65
ifdef([AC_PROG_CC_C99],[
 
66
  dnl TODO: Need to fix this to use c99 instead of gnu99
 
67
  AC_PROG_CC_C99([],[AC_MSG_ERROR([C99 support required for compiling Drizzle])])
 
68
  C99_SUPPORT_HACK=""
 
69
],[C99_SUPPORT_HACK="-std=gnu99"])
 
70
 
 
71
ifdef([AC_USE_SYSTEM_EXTENSIONS],[
 
72
  AC_USE_SYSTEM_EXTENSIONS
 
73
],[
 
74
 
 
75
  AH_VERBATIM([__EXTENSIONS__],
 
76
[/* Enable extensions on Solaris.  */
 
77
#ifndef __EXTENSIONS__
 
78
# undef __EXTENSIONS__
 
79
#endif
 
80
#ifndef _POSIX_PTHREAD_SEMANTICS
 
81
# undef _POSIX_PTHREAD_SEMANTICS
 
82
#endif
 
83
#ifndef _TANDEM_SOURCE
 
84
# undef _TANDEM_SOURCE
 
85
#endif])
 
86
 
 
87
  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
 
88
    [ac_cv_safe_to_define___extensions__],
 
89
    [AC_COMPILE_IFELSE(
 
90
       [AC_LANG_PROGRAM([
 
91
#         define __EXTENSIONS__ 1
 
92
          AC_INCLUDES_DEFAULT])],
 
93
       [ac_cv_safe_to_define___extensions__=yes],
 
94
       [ac_cv_safe_to_define___extensions__=no])])
 
95
  test $ac_cv_safe_to_define___extensions__ = yes &&
 
96
    AC_DEFINE([__EXTENSIONS__])
 
97
  AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
 
98
  AC_DEFINE([_TANDEM_SOURCE])
 
99
])
 
100
 
 
101
AC_PROG_CXX
 
102
AC_CXX_HEADER_STDCXX_98
 
103
if test "$ac_cv_cxx_stdcxx_98" = "no"
 
104
then
 
105
  AC_MSG_ERROR([C++ Compiler required to compile Drizzle])
 
106
fi
 
107
AC_PROG_CPP
 
108
AM_PROG_CC_C_O
 
109
 
 
110
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
 
111
 
 
112
dnl AC_CANONICAL_HOST thinks it's a good idea to just set CFLAGS to 
 
113
dnl -g -O2 if you're running gcc. We would like to use something else, thanks.
 
114
if test "x${CFLAGS}" = "x-g -O2"
 
115
then
 
116
  CFLAGS=
 
117
fi
 
118
if test "x${CXXFLAGS}" = "x-g -O2"
 
119
then
 
120
  CXXFLAGS=
 
121
fi
 
122
 
 
123
 
 
124
# Set all version vars based on $VERSION. How do we do this more elegant ?
 
125
# Remember that regexps needs to quote [ and ] since this is run through m4
 
126
# We take some made up examples
 
127
#
 
128
#  VERSION                  5.1.40sp1-alpha     5.0.34a
 
129
#  DRIZZLE_NO_DASH_VERSION    5.1.40sp1           5.0.34a
 
130
#  DRIZZLE_NUMERIC_VERSION    5.1.40              5.0.34
 
131
#  DRIZZLE_BASE_VERSION       5.1                 5.0
 
132
#  DRIZZLE_VERSION_ID         50140               50034
 
133
#
 
134
DRIZZLE_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
 
135
DRIZZLE_NUMERIC_VERSION=`echo $DRIZZLE_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
 
136
DRIZZLE_BASE_VERSION=`echo $DRIZZLE_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
 
137
DRIZZLE_VERSION_ID=`echo $DRIZZLE_NUMERIC_VERSION | \
 
138
    awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
 
139
 
 
140
# The port should be constant for a LONG time
 
141
DRIZZLE_TCP_PORT_DEFAULT=4427
 
142
 
 
143
sinclude(m4/dtrace.m4)
 
144
sinclude(m4/character_sets.m4)
 
145
sinclude(m4/gettext.m4)
 
146
 
 
147
AM_GNU_GETTEXT([external])
 
148
AM_GNU_GETTEXT_VERSION(0.17)
 
149
 
 
150
AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"])
 
151
 
 
152
AC_SUBST(DRIZZLE_NO_DASH_VERSION)
 
153
AC_DEFINE_UNQUOTED(DRIZZLE_BASE_VERSION,["$DRIZZLE_BASE_VERSION"],
 
154
                  [Major and minor version])
 
155
AC_SUBST(DRIZZLE_VERSION_ID)
 
156
AC_DEFINE_UNQUOTED([DRIZZLE_VERSION_ID],[$DRIZZLE_VERSION_ID],
 
157
                   [Version ID that can be easily used for numeric comparison])
 
158
AC_SUBST(DRIZZLE_PREVIOUS_BASE_VERSION)
 
159
AC_SUBST(PROTOCOL_VERSION)
 
160
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
 
161
                   [mysql client protocol version])
 
162
AC_SUBST(DOT_FRM_VERSION)
 
163
AC_DEFINE_UNQUOTED([FRM_VER], [$DOT_FRM_VERSION],
 
164
                   [Version of .frm files])
 
165
AC_DEFINE_UNQUOTED([DRIZZLE_CONFIG_NAME],["drizzled"],[Name of server config section])
 
166
 
 
167
AC_SUBST(SHARED_LIB_MAJOR_VERSION)
 
168
AC_SUBST(SHARED_LIB_VERSION)
 
169
AC_SUBST(AVAILABLE_LANGUAGES)
 
170
 
 
171
dnl Ok. This is sort of lame, but we need to be nice to plugins Makefile.am's.
 
172
AM_CONDITIONAL(BUILDING_DRIZZLE,[test "x" = "x"])
 
173
 
 
174
 
 
175
# General Constants
 
176
AC_DEFINE([IO_SIZE], [4096], [Io buffer size; Must be a power of 2 and 
 
177
  a multiple of 512. May be
 
178
  smaller what the disk page size. This influences the speed of the
 
179
  isam btree library. eg to big to slow.])
 
180
AC_DEFINE([SC_MAXWIDTH],[256], [Max width of screen (for error messages)])
 
181
AC_DEFINE([FN_LEN],[256 ], [Max file name len ])
 
182
AC_DEFINE([FN_EXTLEN],[20], [Max length of extension (part of FN_LEN) ])
 
183
AC_DEFINE([FN_REFLEN],[512], [Max length of full path-name ])
 
184
AC_DEFINE([FN_EXTCHAR],['.'], [File extension character])
 
185
AC_DEFINE([FN_HOMELIB],['~'], [~/ is used as abbrev for home dir ])
 
186
AC_DEFINE([FN_CURLIB],['.'], [./ is used as abbrev for current dir ])
 
187
AC_DEFINE([FN_PARENTDIR],[".."], [Parent directory; Must be a string ])
 
188
 
 
189
AC_DEFINE([MASTER],[1],[Compile without unireg])
 
190
 
 
191
AH_VERBATIM([QUOTE_ARG],[
 
192
/* Quote argument (before cpp) */
 
193
#ifndef QUOTE_ARG
 
194
# define QUOTE_ARG(x) #x
 
195
#endif
 
196
/* Quote argument, (after cpp) */
 
197
#ifndef STRINGIFY_ARG
 
198
# define STRINGIFY_ARG(x) QUOTE_ARG(x)
 
199
#endif
 
200
])
 
201
 
 
202
AH_VERBATIM([builtin_expect],[
 
203
/*
 
204
 * The macros below are borrowed from include/linux/compiler.h in the
 
205
 * Linux kernel. Use them to indicate the likelyhood of the truthfulness
 
206
 * of a condition. This serves two purposes - newer versions of gcc will be
 
207
 * able to optimize for branch predication, which could yield siginficant
 
208
 * performance gains in frequently executed sections of the code, and the
 
209
 * other reason to use them is for documentation
 
210
 */
 
211
#if !defined(__GNUC__)
 
212
#define __builtin_expect(x, expected_value) (x)
 
213
#endif
 
214
 
 
215
#define likely(x)  __builtin_expect((x),1)
 
216
#define unlikely(x)  __builtin_expect((x),0)
 
217
])
 
218
 
 
219
dnl  InnoDB depends on some Drizzle's internals which other plugins should not
 
220
dnl  need.  This is because of InnoDB's foreign key support, "safe" binlog
 
221
dnl  truncation, and other similar legacy features.
 
222
 
 
223
dnl  We define accessors for these internals unconditionally, but do not
 
224
dnl  expose them in mysql/plugin.h.  They are declared in ha_innodb.h for
 
225
dnl  InnoDB's use.
 
226
 
 
227
AC_DEFINE([INNODB_COMPATIBILITY_HOOKS],[1],[TODO: Remove the need for this])
 
228
dnl TODO: Make a test for when this needs to be set.
 
229
AC_DEFINE([_REENTRANT],[1],[Some thread libraries require this])
 
230
 
 
231
AH_VERBATIM([posix_pthread],[
 
232
/* We want posix threads */
 
233
#ifndef _POSIX_PTHREAD_SEMANTICS
 
234
#define _POSIX_PTHREAD_SEMANTICS
 
235
#endif
 
236
])
 
237
 
 
238
 
 
239
# Canonicalize the configuration name.
 
240
 
 
241
# Check whether --with-system-type or --without-system-type was given.
 
242
AC_ARG_WITH([system-type],
 
243
    [AS_HELP_STRING([--with-system-type],
 
244
       [Set the system type, like "sun-solaris10"])],
 
245
    [SYSTEM_TYPE="$withval"],
 
246
    [SYSTEM_TYPE="$host_vendor-$host_os"])
 
247
AC_ARG_WITH([machine-type],
 
248
    [AS_HELP_STRING([--with-machine-type],
 
249
       [Set the machine type, like "powerpc"])],
 
250
    [MACHINE_TYPE="$withval"],
 
251
    [MACHINE_TYPE="$host_cpu"])
 
252
AC_SUBST(SYSTEM_TYPE)
 
253
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
 
254
                   [Name of system, eg sun-solaris])
 
255
AC_SUBST(MACHINE_TYPE)
 
256
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
 
257
                   [Machine type name, eg sparc])
 
258
 
 
259
# Detect intel x86 like processor
 
260
BASE_MACHINE_TYPE=$MACHINE_TYPE
 
261
case $MACHINE_TYPE in
 
262
  i?86) BASE_MACHINE_TYPE=i386 ;;
 
263
esac
 
264
 
 
265
AM_SANITY_CHECK
 
266
# This is needed is SUBDIRS is set
 
267
AC_PROG_MAKE_SET
 
268
 
 
269
 
 
270
case "$target_os" in
 
271
  *linux*)
 
272
  TARGET_LINUX="true"
 
273
  AC_SUBST(TARGET_LINUX)
 
274
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
 
275
    ;;
 
276
  *apple-darwin*)
 
277
    TARGET_OSX="true"
 
278
    AC_SUBST(TARGET_OSX)
 
279
    AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
 
280
    ;;
 
281
  *solaris*)
 
282
    TARGET_SOLARIS="true"
 
283
    AC_SUBST(TARGET_SOLARIS)
 
284
    AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
 
285
    ;;
 
286
  *)
 
287
    ;;
 
288
esac
 
289
 
 
290
dnl AC_CANONICAL_HOST thinks it's a good idea to just set CFLAGS to 
 
291
dnl -g -O2 if you're running gcc. We would like to use something else, thanks.
 
292
if test "x${CFLAGS}" = "x-g -O2"
 
293
then
 
294
  CFLAGS=
 
295
fi
 
296
if test "x${CXXFLAGS}" = "x-g -O2"
 
297
then
 
298
  CXXFLAGS=
 
299
fi
 
300
 
 
301
DRIZZLE_CHECK_C_VERSION
 
302
DRIZZLE_CHECK_CXX_VERSION
 
303
 
 
304
AC_PROG_AWK
 
305
 
 
306
if test "$ac_cv_c_compiler_gnu" = "yes"
 
307
then
 
308
  AS="$CC -c"
 
309
  AC_SUBST(AS)
 
310
else
 
311
  AC_PATH_PROG(AS, as, as)
 
312
fi
 
313
 
 
314
dnl TODO: This needs to go away and be replaced with _ISOC99_SOURCE
 
315
if test "$ac_cv_c_compiler_gnu" = "yes" -o "$target_os" = "linux-gnu"
 
316
then
 
317
  AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
 
318
fi
 
319
 
 
320
dnl  Solaris 9 include file <sys/feature_tests.h> refers to X/Open document
 
321
 
 
322
dnl  System Interfaces and Headers, Issue 5
 
323
 
 
324
dnl  saying we should define _XOPEN_SOURCE=500 to get POSIX.1c prototypes,
 
325
dnl  but apparently other systems (namely FreeBSD) don't agree.
 
326
 
 
327
dnl  On a newer Solaris 10, the above file recognizes also _XOPEN_SOURCE=600.
 
328
dnl  Furthermore, it tests that if a program requires older standard
 
329
dnl  (_XOPEN_SOURCE<600 or _POSIX_C_SOURCE<200112L) it cannot be
 
330
dnl  run on a new compiler (that defines _STDC_C99) and issues an #error.
 
331
dnl  It's also an #error if a program requires new standard (_XOPEN_SOURCE=600
 
332
dnl  or _POSIX_C_SOURCE=200112L) and a compiler does not define _STDC_C99.
 
333
 
 
334
dnl  To add more to this mess, Sun Studio C compiler defines _STDC_C99 while
 
335
dnl  C++ compiler does not!
 
336
 
 
337
dnl TODO: Can _ISOC99_SOURCE be defined on all platforms and remove the 
 
338
dnl       Need for all of this? 
 
339
if test "$GCC" = "yes"
 
340
then
 
341
  case "$target_os" in
 
342
    *solaris*)
 
343
    CFLAGS="${CFLAGS} -D_XOPEN_SOURCE=600"
 
344
    CXXFLAGS="${CXXFLAGS} -D__C99FEATURES__"
 
345
    ;;
 
346
  esac
 
347
fi
 
348
 
 
349
# We use libtool
 
350
AC_PROG_LIBTOOL
 
351
 
 
352
# Ensure that we have --preserve-dup-deps defines, otherwise we get link
 
353
# problems of 'mysql' with CXX=g++
 
354
LIBTOOL="$LIBTOOL --preserve-dup-deps"
 
355
AC_SUBST(LIBTOOL)dnl
 
356
 
 
357
AC_SUBST(NM)dnl
 
358
 
 
359
AC_PROG_INSTALL
 
360
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 
361
 
 
362
# Look for "(group|user)add". 
 
363
# TODO: If the programs do not exist, inform the DBA that the user
 
364
#       was not created at the end of the install routine.
 
365
AC_CHECK_PROGS(GROUPADD, groupadd addgroup)
 
366
AC_CHECK_PROGS(USERADD, useradd adduser)
 
367
 
 
368
# Not critical since the generated file is distributed
 
369
AC_CHECK_PROGS(YACC, ['bison -y -p DRIZZLE'])
 
370
if test -z "$YACC" && test -d ".bzr"
 
371
then
 
372
  AC_MSG_ERROR(["bison is required for Drizzle to build from a bzr branch"])
 
373
fi
 
374
 
 
375
AC_PATH_PROG(uname_prog, uname, no)
 
376
 
 
377
# We should go through this and put all the explictly system dependent
 
378
# stuff in one place
 
379
AC_MSG_CHECKING(operating system)
 
380
AC_CACHE_VAL(mysql_cv_sys_os,
 
381
[
 
382
if test "$uname_prog" != "no"; then
 
383
  mysql_cv_sys_os="`uname`"
 
384
else
 
385
  mysql_cv_sys_os="Not Solaris"
 
386
fi
 
387
])
 
388
AC_MSG_RESULT($mysql_cv_sys_os)
 
389
 
 
390
 
 
391
# The following is required for portable results of floating point calculations
 
392
# on PowerPC. The same must also be done for IA-64, but this options is missing
 
393
# in the IA-64 gcc backend.
 
394
 
 
395
if test "$GCC" = "yes"
 
396
then
 
397
  case "$host_cpu" in
 
398
    *ppc* | *powerpc*)
 
399
      AM_CFLAGS="$CFLAGS -mno-fused-madd"
 
400
      AM_CXXFLAGS="$CXXFLAGS -mno-fused-madd"
 
401
    ;;
 
402
  esac
 
403
fi
 
404
# Build optimized or debug version ?
 
405
# First check for gcc and g++
 
406
SYMBOLS_FLAGS="-g"
 
407
DEBUG_OPTIMIZE_CC=""
 
408
OPTIMIZE_CFLAGS="-O"
 
409
DEBUG_OPTIMIZE_CXX=""
 
410
OPTIMIZE_CXXFLAGS="-O"
 
411
if test "$GCC" = "yes"
 
412
then
 
413
  SYMBOLS_FLAGS="-ggdb3"
 
414
  DEBUG_OPTIMIZE_CC="-O0"
 
415
  OPTIMIZE_CFLAGS="-O3"
 
416
  DEBUG_OPTIMIZE_CXX="-O0"
 
417
  OPTIMIZE_CXXFLAGS="-O3"
 
418
fi
 
419
if test "$SUNCC" = "yes"
 
420
then
 
421
  dnl I'm cheating here and sticking C99 support in SYMBOLS_FLAGS
 
422
  SYMBOLS_FLAGS=""
 
423
  DEBUG_OPTIMIZE_CC=""
 
424
  OPTIMIZE_CFLAGS="-xO4 -xlibmil -xdepend -Xa -mt -xstrconst -D_FORTEC_"
 
425
  DEBUG_OPTIMIZE_CXX=""
 
426
  #Put back in once isnan is figured out
 
427
  OPTIMIZE_CXXFLAGS="-xO4 -xlibmil -mt -D_FORTEC_ -xlang=c99 -compat=5 -library=stlport4"
 
428
fi
 
429
 
 
430
dnl TODO: Remove this define once we are using 2.61 across the board.
 
431
# AX_HEADER_ASSERT
 
432
# ----------------
 
433
# Check whether to enable assertions.
 
434
AC_DEFUN([AX_HEADER_ASSERT],
 
435
[
 
436
  AC_MSG_CHECKING([whether to enable assertions])
 
437
  AC_ARG_ENABLE([assert],
 
438
    [AS_HELP_STRING([--disable-assert],
 
439
       [Turn off assertions])],
 
440
    [ac_cv_assert="no"],
 
441
    [ac_cv_assert="yes"])
 
442
  AC_MSG_RESULT([$ac_cv_assert])
 
443
])
 
444
 
 
445
AX_HEADER_ASSERT
 
446
 
 
447
CFLAGS="${SYMBOLS_FLAGS} ${CFLAGS}"
 
448
CXXFLAGS="${SYMBOLS_FLAGS} ${CXXFLAGS}"
 
449
 
 
450
AC_ARG_WITH([debug],
 
451
    [AS_HELP_STRING([--with-debug],
 
452
       [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
 
453
    [with_debug=$withval],
 
454
    [with_debug=no])
 
455
if test "$with_debug" = "yes"
 
456
then
 
457
  # Medium debug.
 
458
  CFLAGS="$DEBUG_OPTIMIZE_CC -DDEBUG $CFLAGS ${SAVE_CFLAGS}"
 
459
  CXXFLAGS="$DEBUG_OPTIMIZE_CXX -DDEBUG $CXXFLAGS ${SAVE_CXXFLAGS}"
 
460
else
 
461
  # Optimized version. No debug
 
462
  CFLAGS="${OPTIMIZE_CFLAGS} ${CFLAGS} ${SAVE_CFLAGS}"
 
463
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS ${SAVE_CXXFLAGS}"
 
464
fi
 
465
 
 
466
AC_SUBST(CC)
 
467
AC_SUBST(CFLAGS)
 
468
AC_SUBST(CXX)
 
469
AC_SUBST(CXXFLAGS)
 
470
AC_SUBST(ASFLAGS)
 
471
AC_SUBST(LD)
 
472
AC_SUBST(INSTALL_SCRIPT)
 
473
 
 
474
 
 
475
export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
 
476
 
 
477
AC_CXX_STL_HASH
 
478
AC_CXX_CSTDINT
 
479
AC_CXX_CINTTYPES
 
480
AC_CXX_CMATH
 
481
 
 
482
DRIZZLE_PROG_AR
43
483
 
44
484
# libdrizzle versioning when linked with GNU ld.
45
 
AS_IF([test "$lt_cv_prog_gnu_ld" = "yes"],[
46
 
  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/config/drizzle.ver"
47
 
  ])
 
485
if test "$lt_cv_prog_gnu_ld" = "yes" -a $LD --version 2>/dev/null|grep -q GNU; then
 
486
  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libdrizzle/libdrizzle.ver"
 
487
fi
48
488
AC_SUBST(LD_VERSION_SCRIPT)
49
489
 
50
 
dnl Set the default datadir location to /usr/local/var/drizzle. If a
51
 
dnl localstatedir is explicitly given, just use that.
52
 
AS_IF([test "x${localstatedir}" = 'x${prefix}/var'],[
53
 
  localstatedir='${prefix}/var/drizzle'
54
 
])
55
 
 
56
 
AC_PATH_PROG(GPERF, gperf)
57
 
AS_IF([test "x$GPERF" = "x"],
58
 
      AC_MSG_ERROR("Drizzle requires gperf to build."))
59
 
 
60
 
# libexecinfo provides backtrace_symbols on FreeBSD
61
 
AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
62
 
 
63
 
PANDORA_REQUIRE_LIBPROTOBUF
64
 
PANDORA_PROTOBUF_REQUIRE_VERSION([2.1.0])
65
 
PANDORA_REQUIRE_PROTOC
66
 
 
67
 
AC_LANG_PUSH(C++)
68
 
PANDORA_REQUIRE_PTHREAD
69
 
PANDORA_REQUIRE_LIBUUID
70
 
PANDORA_REQUIRE_LIBZ
71
 
PANDORA_REQUIRE_LIBPCRE
72
 
PANDORA_REQUIRE_LIBREADLINE
73
 
PANDORA_REQUIRE_LIBDL
74
 
AC_LANG_POP
75
 
 
76
 
DRIZZLE_STACK_DIRECTION
77
 
 
78
 
PANDORA_USE_BETTER_MALLOC
79
 
 
80
 
PANDORA_DRIZZLE_BUILD
81
 
AC_DEFINE([BUILDING_DRIZZLED],[1],
82
 
          [Define indicating we are building and not consuming drizzle.])
83
 
 
84
 
PANDORA_HAVE_BOOST_TEST
85
 
PANDORA_HAVE_LIBSQLITE3
86
 
 
87
 
AC_CHECK_FUNC(inet_ntoa, [], [AC_CHECK_LIB(nsl, inet_ntoa)])
 
490
#--------------------------------------------------------------------
 
491
# Check for Google Proto Buffers
 
492
#--------------------------------------------------------------------
 
493
 
 
494
AC_MSG_CHECKING(for Google Protocol Buffers)
 
495
AC_ARG_WITH(protobuf,
 
496
  [AS_HELP_STRING([--with-protobuf@<:@=DIR@:>@],
 
497
       [search for protobuf in DIR/include and DIR/lib])],
 
498
  [ with_protobuf=$withval ],
 
499
  [ with_protobuf=yes ])
 
500
 
 
501
save_CPPFLAGS="$CPPFLAGS"
 
502
save_LIBS="$LIBS"
 
503
 
 
504
if test "$with_protobuf" = "yes"
 
505
then
 
506
  CPPFLAGS=""
 
507
  LIBS="-lprotobuf"
 
508
  PROTO_PATH="$PATH"
 
509
else
 
510
  CPPFLAGS="-I$withval/include"
 
511
  LIBS="-L$withval/lib -lprotobuf"
 
512
  PROTO_PATH="${withval}/bin:$PATH"
 
513
fi 
 
514
 
 
515
AC_CHECK_TOOL([PROTOC],[protoc],[no],[$PROTO_PATH])
 
516
if test "x$PROTOC" = "xno"
 
517
then
 
518
  AC_MSG_ERROR([Couldn't find protoc. Try installing Google Protocol Buffer.])
 
519
fi
 
520
 
 
521
AC_LANG_PUSH([C++])
 
522
AC_CHECK_HEADERS([google/protobuf/message.h])
 
523
if test "x$ac_cv_header_google_protobuf_message_h" != "xyes"
 
524
then
 
525
  AC_MSG_ERROR([Couldn't find message.h. Try installing Google Protocol Buffer development packages])
 
526
fi
 
527
AC_MSG_RESULT("$wthval")
 
528
 
 
529
AC_CACHE_CHECK([for Message in libprotobuf], ac_libprotobuf_works, [
 
530
  AC_TRY_LINK([
 
531
#include <google/protobuf/descriptor.pb.h>
 
532
  ],[
 
533
    google::protobuf::FileDescriptorProto testFdp;
 
534
  ], ac_libprotobuf_works=yes, [
 
535
        AC_ERROR([could not find Google's libprotobuf])
 
536
  ])
 
537
 
 
538
])
 
539
 
 
540
PROTOBUF_LIBS="${LIBS}"
 
541
PROTOBUF_CPPFLAGS="${CPPFLAGS}"
 
542
AC_SUBST(PROTOBUF_LIBS)
 
543
AC_SUBST(PROTOBUF_CPPFLAGS)
 
544
CPPFLAGS="$save_CPPFLAGS"
 
545
LIBS="$save_LIBS"
 
546
AC_LANG_POP()
 
547
 
 
548
#--------------------------------------------------------------------
 
549
# Check for libuuid
 
550
#--------------------------------------------------------------------
 
551
 
 
552
AC_CHECK_HEADERS(uuid/uuid.h)
 
553
if test "x$ac_cv_header_uuid_uuid_h" = "xno"
 
554
then
 
555
  AC_MSG_ERROR([Couldn't find uuid/uuid.h. Try installing libuuid development packages])
 
556
fi
 
557
AC_CHECK_LIB(uuid, uuid_generate)
 
558
 
 
559
#--------------------------------------------------------------------
 
560
# Check for libevent
 
561
#--------------------------------------------------------------------
 
562
 
 
563
AC_ARG_WITH(libevent,
 
564
  [AS_HELP_STRING([--with-libevent@<:@=DIR@:>@],
 
565
       [Use libevent in DIR])],
 
566
  [ with_libevent=$withval ],
 
567
  [ with_libevent=yes ])
 
568
 
 
569
if test "$with_libevent" = "yes"
 
570
then
 
571
    AC_CHECK_HEADERS(event.h)
 
572
    if test "x$ac_cv_header_event_h" != "xyes"
 
573
    then
 
574
      AC_MSG_ERROR([Couldn't find event.h. Try installing libevent development packages])
 
575
    fi
 
576
    my_save_LIBS="$LIBS"
 
577
    LIBS=""
 
578
    AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
 
579
    LIBEVENT_LIBS="${LIBS}"
 
580
    LIBS="${my_save_LIBS}"
 
581
    LIBEVENT_CPPFLAGS=""
 
582
else
 
583
    AC_MSG_CHECKING(for libevent in $withval)
 
584
    if test -f $withval/event.h -a -f $withval/libevent.a; then
 
585
       owd=`pwd`
 
586
       if cd $withval; then withval=`pwd`; cd $owd; fi
 
587
       LIBEVENT_CPPFLAGS="-I$withval"
 
588
       LIBEVENT_LIBS="-L$withval -levent"
 
589
    elif test -f $withval/include/event.h -a -f $withval/lib/libevent.a; then
 
590
       owd=`pwd`
 
591
       if cd $withval; then withval=`pwd`; cd $owd; fi
 
592
       LIBEVENT_CPPFLAGS="-I$withval/include"
 
593
       LIBEVENT_LIBS="-L$withval/lib -levent"
 
594
    else
 
595
       AC_MSG_ERROR([event.h or libevent.a not found in $withval])
 
596
    fi
 
597
fi
 
598
 
 
599
AC_SUBST(LIBEVENT_CPPFLAGS)
 
600
AC_SUBST(LIBEVENT_LIBS)
 
601
 
 
602
AC_CACHE_CHECK([for bufferevent in libevent], ac_libevent_works, [
 
603
  save_CPPFLAGS="$CPPFLAGS"
 
604
  save_LIBS="$LIBS"
 
605
  CPPFLAGS="$LIBEVENT_CPPFLAGS"
 
606
  LIBS="$LIBEVENT_LIBS"
 
607
  AC_TRY_LINK([
 
608
#include <sys/types.h>
 
609
#include <sys/time.h>
 
610
#include <stdlib.h>
 
611
#include <event.h>],[
 
612
        struct bufferevent bev;
 
613
        bufferevent_settimeout(&bev, 1, 1);
 
614
  ], ac_libevent_works=yes, [
 
615
        AC_ERROR([you need to install a more recent version of libevent,
 
616
        check http://www.monkey.org/~provos/libevent/])
 
617
  ])
 
618
 
 
619
  CPPFLAGS="$save_CPPFLAGS"
 
620
  LIBS="$save_LIBS"
 
621
])
 
622
 
 
623
 
 
624
#--------------------------------------------------------------------
 
625
# Check for libpthread
 
626
#--------------------------------------------------------------------
 
627
 
 
628
AC_CHECK_HEADERS(pthread.h)
 
629
if test "x$ac_cv_header_pthread_h" != "xyes"
 
630
then
 
631
  AC_MSG_ERROR([Couldn't find pthread.h.])
 
632
fi
 
633
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR(could not find libpthread)])
 
634
 
 
635
#--------------------------------------------------------------------
 
636
# Check for tcmalloc
 
637
#--------------------------------------------------------------------
 
638
 
 
639
AC_ARG_ENABLE([tcmalloc],
 
640
    [AS_HELP_STRING([--enable-tcmalloc],
 
641
       [Enable linking with tcmalloc @<:@default=off@:>@])],
 
642
    [ac_enable_tcmalloc="$enableval"],
 
643
    [ac_enable_tcmalloc="no"])
 
644
 
 
645
if test "x$ac_enable_tcmalloc" = "xyes"
 
646
then
 
647
  AC_CHECK_LIB(tcmalloc,malloc,[],[])
 
648
fi
 
649
 
 
650
#--------------------------------------------------------------------
 
651
# Check for libz
 
652
#--------------------------------------------------------------------
 
653
 
 
654
my_save_LIBS="$LIBS"
 
655
LIBS=""
 
656
AC_CHECK_HEADERS(zlib.h)
 
657
if test "x$ac_cv_header_zlib_h" != "xyes"
 
658
then
 
659
  AC_MSG_ERROR([Couldn't find zlib.h. Try installing zlib development packages])
 
660
fi
 
661
AC_CHECK_LIB(z, crc32, [], [AC_MSG_ERROR(could not find libz)])
 
662
ZLIB_LIBS="$LIBS"
 
663
LIBS="$my_save_LIBS"
 
664
AC_SUBST(ZLIB_LIBS)
 
665
 
 
666
 
 
667
#--------------------------------------------------------------------
 
668
# Check for libreadline or compatible (libedit on Mac OS X)
 
669
#--------------------------------------------------------------------
 
670
 
 
671
AC_CHECK_HEADERS(readline/history.h readline/readline.h)
 
672
if test "x$ac_cv_header_readline_readline_h" != "xyes"
 
673
then
 
674
  AC_MSG_ERROR([Couldn't find readline/readline.h. Try installing readline development packages.])
 
675
fi
 
676
AC_CHECK_TYPES([HIST_ENTRY], [], [], [AC_INCLUDES_DEFAULT[
 
677
#ifdef HAVE_READLINE_HISTORY_H
 
678
#include <readline/history.h>
 
679
#endif
 
680
#include <readline/readline.h>
 
681
]])
 
682
AC_CHECK_DECLS([completion_matches], [], [], [AC_INCLUDES_DEFAULT[
 
683
#ifdef HAVE_READLINE_HISTORY_H
 
684
#include <readline/history.h>
 
685
#endif
 
686
#include <readline/readline.h>
 
687
]])
 
688
 
 
689
DRIZZLE_CHECK_NEW_RL_INTERFACE
 
690
 
 
691
my_save_LIBS="$LIBS"
 
692
LIBS=""
 
693
AC_CHECK_LIB(readline, rl_initialize, [],
 
694
  [AC_CHECK_LIB(ncurses, tgetent, [], [AC_MSG_ERROR(Couldn't find ncurses)]) 
 
695
   AC_SEARCH_LIBS(rl_initialize, readline, [],
 
696
    [AC_MSG_ERROR(Couldn't find libreadline.)])])
 
697
READLINE_LIBS="$LIBS"
 
698
LIBS="$my_save_LIBS"
 
699
AC_SUBST(READLINE_LIBS)
 
700
 
 
701
 
 
702
#--------------------------------------------------------------------
 
703
# Check for libpcre
 
704
#--------------------------------------------------------------------
 
705
 
 
706
AC_LANG_PUSH([C++])
 
707
AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found.]))
 
708
PKG_CHECK_MODULES(PCRE, [libpcrecpp >= 3], [found_pcre="yes"],[found_pcre="no"])
 
709
 
 
710
if test "$found_pcre" = "no"
 
711
then
 
712
  dnl Only check the header here, because autoconf can't handle
 
713
  dnl checking for C++ methods without C linkages
 
714
  AC_CHECK_HEADERS(pcrecpp.h)
 
715
  if test "x$ac_cv_header_pcrecpp_h" != "xyes" 
 
716
  then
 
717
    AC_MSG_ERROR([Couldn't find pcrecpp.h. Try installing the development package associated with libpcre on your system.])
 
718
  else
 
719
    # Found headers, now see if we can link
 
720
    AC_MSG_CHECKING(for libpcrecpp)
 
721
    save_LDFLAGS="$LDFLAGS"
 
722
    LDFLAGS="-lpcrecpp -lpcre"
 
723
    AC_TRY_LINK([
 
724
#include <pcrecpp.h>
 
725
    ],
 
726
    [pcrecpp::RE_Options opt;],
 
727
    [found_pcre="yes"],
 
728
    [AC_MSG_ERROR([Couldn't link libpcrecpp])])
 
729
 
 
730
    PCRE_LIBS="$LDFLAGS"
 
731
    LDFLAGS="$save_LDFLAGS"
 
732
    AC_MSG_RESULT([yes])
 
733
  fi
 
734
fi
 
735
AC_LANG_POP([])
 
736
AC_SUBST(PCRE_LIBS)
 
737
AC_SUBST(PCRE_CFLAGS)
 
738
 
 
739
dnl Find paths to some shell programs
 
740
AC_PATH_PROG(LN, ln, ln)
 
741
# This must be able to take a -f flag like normal unix ln.
 
742
AC_PATH_PROG(LN_CP_F, ln, ln)
 
743
 
 
744
AC_PATH_PROG(MV, mv, mv)
 
745
AC_PATH_PROG(RM, rm, rm)
 
746
AC_PATH_PROG(CP, cp, cp)
 
747
AC_PATH_PROG(SED, sed, sed)
 
748
AC_PATH_PROG(CMP, cmp, cmp)
 
749
AC_PATH_PROG(CHMOD, chmod, chmod)
 
750
AC_PATH_PROG(HOSTNAME, hostname, hostname)
 
751
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
 
752
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
 
753
AC_CHECK_PROGS(TAR, gnutar gtar tar)
 
754
 
 
755
dnl We use a path for perl so the script startup works
 
756
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
 
757
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
 
758
AC_PATH_PROG(PERL, perl, no)
 
759
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
 
760
then
 
761
  PERL5=$PERL
 
762
else
 
763
  AC_PATH_PROG(PERL5, perl5, no)
 
764
  if test "$PERL5" != no
 
765
  then
 
766
    PERL=$PERL5
 
767
    ac_cv_path_PERL=$ac_cv_path_PERL5
 
768
  fi
 
769
fi
 
770
 
 
771
AC_SUBST(HOSTNAME)
 
772
AC_SUBST(PERL)
 
773
AC_SUBST(PERL5)
 
774
 
 
775
# icheck, used for ABI check
 
776
AC_PATH_PROG(ICHECK, icheck, no)
 
777
# "icheck" is also the name of a file system check program on Tru64.
 
778
# Verify the program found is really the interface checker.
 
779
if test "x$ICHECK" != "xno"
 
780
then
 
781
  AC_MSG_CHECKING(if $ICHECK works as expected)
 
782
  echo "int foo;" > conftest.h
 
783
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
 
784
  if test -f "conftest.ic"
 
785
  then
 
786
    AC_MSG_RESULT(yes)
 
787
  else
 
788
    AC_MSG_RESULT(no)
 
789
    ICHECK=no
 
790
  fi
 
791
  rm -f conftest.ic conftest.h
 
792
fi
 
793
AC_SUBST(ICHECK)
 
794
 
 
795
# Lock for PS
 
796
AC_PATH_PROG(PS, ps, ps)
 
797
AC_MSG_CHECKING("how to check if pid exists")
 
798
PS=$ac_cv_path_PS
 
799
# Linux style
 
800
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
 
801
then
 
802
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
 
803
# Solaris
 
804
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
 
805
then
 
806
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
 
807
# BSD style
 
808
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
 
809
then
 
810
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
 
811
# SysV style
 
812
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
 
813
then
 
814
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
 
815
# Do anybody use this?
 
816
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
 
817
then
 
818
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
 
819
else
 
820
  case $SYSTEM_TYPE in
 
821
    *freebsd*|*dragonfly*|*cygwin*)
 
822
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
 
823
      ;;
 
824
    *darwin*)
 
825
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
 
826
      ;;
 
827
    *)
 
828
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
 
829
      ;;
 
830
  esac
 
831
fi
 
832
AC_SUBST(FIND_PROC)
 
833
AC_MSG_RESULT("$FIND_PROC")
 
834
 
 
835
# Check if a pid is valid
 
836
AC_PATH_PROG(KILL, kill, kill)
 
837
AC_MSG_CHECKING("for kill switches")
 
838
if $ac_cv_path_KILL -0 $$
 
839
then
 
840
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
 
841
elif kill -s 0 $$
 
842
then
 
843
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
 
844
else
 
845
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
 
846
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
 
847
fi
 
848
AC_SUBST(CHECK_PID)
 
849
AC_MSG_RESULT("$CHECK_PID")
 
850
 
 
851
# We need an ANSI C compiler
 
852
AM_PROG_CC_STDC
 
853
 
 
854
# We need an assembler, too
 
855
AM_PROG_AS
 
856
CCASFLAGS="$CCASFLAGS $ASFLAGS"
 
857
 
 
858
# Check if we need noexec stack for assembler
 
859
AC_CHECK_NOEXECSTACK
 
860
 
 
861
if test "$am_cv_prog_cc_stdc" = "no"
 
862
then
 
863
  AC_MSG_ERROR([Drizzle requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
 
864
fi
88
865
 
89
866
 
90
867
AC_ARG_WITH([server-suffix],
91
868
    [AS_HELP_STRING([--with-server-suffix],
92
869
      [Append value to the version string.])],
93
 
    [ DRIZZLE_SERVER_SUFFIX="$withval" ]
94
 
    [ DRIZZLE_SERVER_SUFFIX= ])
95
 
 
 
870
    [ DRIZZLE_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
 
871
    [ DRIZZLE_SERVER_SUFFIX= ]
 
872
    )
96
873
AC_DEFINE_UNQUOTED([DRIZZLE_SERVER_SUFFIX],[$DRIZZLE_SERVER_SUFFIX],
97
874
                   [Append value to the version string])
98
875
 
99
 
 
 
876
# Force use of a curses libs
 
877
AC_ARG_WITH([named-curses-libs],
 
878
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
 
879
            [Use specified curses libraries instead of those
 
880
                automatically found by configure.])],
 
881
    [ with_named_curses=$withval ],
 
882
    [ with_named_curses=no ]
 
883
    )
 
884
 
 
885
AC_ARG_WITH([tcp-port],
 
886
    [AS_HELP_STRING([--with-tcp-port=port-number],
 
887
            [Which port to use for Drizzle services @<:@default=4427@:>@])],
 
888
    [ DRIZZLE_TCP_PORT=$withval ],
 
889
    [ DRIZZLE_TCP_PORT=$DRIZZLE_TCP_PORT_DEFAULT
 
890
      # if we actually defaulted (as opposed to the pathological case of
 
891
      # --with-tcp-port=<DRIZZLE_TCP_PORT_DEFAULT> which might in theory
 
892
      # happen if whole batch of servers was built from a script), set
 
893
      # the default to zero to indicate that; we don't lose information
 
894
      # that way, because 0 obviously indicates that we can get the
 
895
      # default value from DRIZZLE_TCP_PORT. this seems really evil, but
 
896
      # testing for DRIZZLE_TCP_PORT==DRIZZLE_TCP_PORT_DEFAULT would make a
 
897
      # a port of DRIZZLE_TCP_PORT_DEFAULT magic even if the builder did not
 
898
      # intend it to mean "use the default, in fact, look up a good default
 
899
      # from /etc/services if you can", but really, really meant 4427 when
 
900
      # they passed in 4427. When they pass in a specific value, let them
 
901
      # have it; don't second guess user and think we know better, this will
 
902
      # just make people cross.  this makes the the logic work like this
 
903
      # (which is complicated enough):
 
904
      #
 
905
      # - if a port was set during build, use that as a default.
 
906
      #
 
907
      # - otherwise, try to look up a port in /etc/services; if that fails,
 
908
      #   use DRIZZLE_TCP_PORT_DEFAULT (at the time of this writing 4427)
 
909
      #
 
910
      # - allow the DRIZZLE_TCP_PORT environment variable to override that.
 
911
      #
 
912
      # - allow command-line parameters to override all of the above.
 
913
      #
 
914
      # the top-most DRIZZLE_TCP_PORT_DEFAULT is read from win/configure.js,
 
915
      # so don't mess with that.
 
916
      DRIZZLE_TCP_PORT_DEFAULT=0 ]
 
917
    )
 
918
AC_SUBST(DRIZZLE_TCP_PORT)
 
919
# We might want to document the assigned port in the manual.
 
920
AC_SUBST(DRIZZLE_TCP_PORT_DEFAULT)
 
921
AC_DEFINE_UNQUOTED([DRIZZLE_PORT],[$DRIZZLE_TCP_PORT],
 
922
                   [Drizzle port to use])
 
923
AC_DEFINE_UNQUOTED([DRIZZLE_PORT_DEFAULT],[$DRIZZLE_TCP_PORT_DEFAULT],
 
924
                   [If we defaulted to DRIZZLE_PORT, then this will be zero])
 
925
 
 
926
# Use this to set the place used for unix socket used to local communication.
100
927
AC_ARG_WITH([drizzled-user],
101
928
    [AS_HELP_STRING([--with-drizzled-user=username],
102
929
            [What user the drizzled daemon shall be run as.
103
930
                @<:@default=drizzle@:>@])],
104
 
    [ DRIZZLED_USER="$withval" ],
105
 
    [ DRIZZLED_USER=drizzle ])
 
931
    [ DRIZZLED_USER=$withval ],
 
932
    [ DRIZZLED_USER=drizzle ]
 
933
    )
106
934
AC_SUBST(DRIZZLED_USER)
107
935
 
 
936
# If we should allow LOAD DATA LOCAL
 
937
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
 
938
AC_ARG_ENABLE(local-infile,
 
939
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
 
940
    [ ENABLED_LOCAL_INFILE=$enableval ],
 
941
    [ ENABLED_LOCAL_INFILE=no ]
 
942
    )
 
943
if test "$ENABLED_LOCAL_INFILE" = "yes"
 
944
then
 
945
  AC_MSG_RESULT([yes])
 
946
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
 
947
            [If LOAD DATA LOCAL INFILE should be enabled by default])
 
948
else
 
949
  AC_MSG_RESULT([no])
 
950
fi
 
951
 
 
952
AC_SYS_LARGEFILE
 
953
AC_FUNC_FSEEKO
 
954
 
 
955
# Types that must be checked AFTER large file support is checked
 
956
AC_TYPE_SIZE_T
 
957
 
 
958
#--------------------------------------------------------------------
 
959
# Check for system header files
 
960
#--------------------------------------------------------------------
 
961
 
 
962
AC_HEADER_DIRENT
 
963
AC_HEADER_STDC
 
964
AC_HEADER_SYS_WAIT
 
965
AC_HEADER_STDBOOL
 
966
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
 
967
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
 
968
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
 
969
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h)
 
970
AC_CHECK_HEADERS([curses.h term.h],[],[],
 
971
[[#ifdef HAVE_CURSES_H
 
972
# include <curses.h>
 
973
#endif
 
974
]])
 
975
AC_CHECK_HEADERS(termio.h termios.h sched.h alloca.h)
 
976
AC_CHECK_HEADERS(sys/prctl.h ieeefp.h)
 
977
AC_CHECK_HEADERS(execinfo.h)
 
978
 
 
979
#--------------------------------------------------------------------
 
980
# Check for system libraries. Adds the library to $LIBS
 
981
# and defines HAVE_LIBM etc
 
982
#--------------------------------------------------------------------
 
983
 
 
984
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
 
985
 
 
986
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
 
987
AC_CHECK_FUNC(yp_get_default_domain, [],
 
988
  [AC_CHECK_LIB(nsl, yp_get_default_domain)])
 
989
AC_CHECK_FUNC(p2open, [], [AC_CHECK_LIB(gen, p2open)])
 
990
# This may get things to compile even if bind-8 is installed
 
991
AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
 
992
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
 
993
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
 
994
 
 
995
# Check rt for aio_read
 
996
AC_CHECK_LIB(rt, aio_read)
 
997
 
 
998
# For the sched_yield() function on Solaris
 
999
AC_CHECK_FUNC(sched_yield, [],
 
1000
  [AC_CHECK_LIB(posix4, [sched_yield],
 
1001
    [AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"])])
 
1002
 
 
1003
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
 
1004
then
 
1005
  AC_CHECK_FUNC(gtty, [], [AC_CHECK_LIB(compat, gtty)])
 
1006
fi
 
1007
 
 
1008
AC_CHECK_TYPES([fp_except], [], [], [
 
1009
#include <sys/types.h>
 
1010
#include <ieeefp.h>
 
1011
])
 
1012
 
 
1013
my_save_LIBS="$LIBS"
 
1014
LIBS=""
 
1015
AC_CHECK_LIB(dl,dlopen)
 
1016
AC_CHECK_FUNCS(dlopen)
 
1017
if test "$ac_cv_func_dlopen" != "yes"
 
1018
then
 
1019
  AC_MSG_ERROR([Drizzle requires dlopen])
 
1020
fi
 
1021
LIBDL_LIBS="$LIBS"
 
1022
LIBS="$my_save_LIBS"
 
1023
AC_SUBST(LIBDL_LIBS)
 
1024
 
 
1025
AC_CHECK_FUNCS(strtok_r)
 
1026
 
 
1027
 
 
1028
 
 
1029
AC_ARG_WITH([fast-mutexes],
 
1030
    [AS_HELP_STRING([--with-fast-mutexes],
 
1031
            [Compile with fast mutexes  @<:@default=off@:>@])],
 
1032
    [with_fast_mutexes=$withval],
 
1033
    [with_fast_mutexes=no])
 
1034
 
 
1035
if test "$with_fast_mutexes" != "no"
 
1036
then
 
1037
        AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
 
1038
                        [Define to 1 if you want to use fast mutexes])
 
1039
fi
 
1040
 
 
1041
AM_CONDITIONAL(BUILD_FAST_MUTEX,[test "$with_fast_mutexes" != "no"])
108
1042
 
109
1043
AC_ARG_WITH([comment],
110
1044
    [AS_HELP_STRING([--with-comment],
111
1045
            [Comment about compilation environment. @<:@default=off@:>@])],
112
1046
    [with_comment=$withval],
113
1047
    [with_comment=no])
114
 
AS_IF([test "$with_comment" != "no"],[
 
1048
if test "$with_comment" != "no"
 
1049
then
115
1050
  COMPILATION_COMMENT=$with_comment
116
 
],[
117
 
  COMPILATION_COMMENT="Source distribution (${PANDORA_RELEASE_COMMENT})"
118
 
])
 
1051
else
 
1052
  COMPILATION_COMMENT="Source distribution"
 
1053
fi
119
1054
AC_DEFINE_UNQUOTED([COMPILATION_COMMENT],["$COMPILATION_COMMENT"],
120
1055
                   [Comment about compilation environment])
121
1056
 
122
 
 
 
1057
dnl Checks for typedefs, structures, and compiler characteristics.
 
1058
AC_C_CONST
 
1059
AC_C_INLINE
 
1060
AC_TYPE_OFF_T
 
1061
AC_HEADER_TIME
 
1062
AC_STRUCT_TM
 
1063
# off_t is not a builtin type
 
1064
AC_CHECK_SIZEOF(off_t, 4)
 
1065
if test "$ac_cv_sizeof_off_t" -eq 0
 
1066
then
 
1067
  AC_MSG_ERROR("Drizzle needs a off_t type.")
 
1068
fi
 
1069
 
 
1070
dnl
 
1071
dnl check if time_t is unsigned
 
1072
dnl
 
1073
 
 
1074
DRIZZLE_CHECK_TIME_T
 
1075
 
 
1076
 
 
1077
# This always gives a warning. Ignore it unless you are cross compiling
 
1078
AC_C_BIGENDIAN
 
1079
#---START: Used in for client configure
 
1080
# Check base type of last arg to accept
 
1081
DRIZZLE_TYPE_ACCEPT
 
1082
#---END:
 
1083
# Figure out what type of struct rlimit to use with setrlimit
 
1084
DRIZZLE_TYPE_STRUCT_RLIMIT
 
1085
# Find where the stack goes
 
1086
DRIZZLE_STACK_DIRECTION
 
1087
# We want to skip alloca on irix unconditionally. It may work on some version..
 
1088
DRIZZLE_FUNC_ALLOCA
 
1089
# Do struct timespec have members tv_sec or ts_sec
 
1090
DRIZZLE_TIMESPEC_TS
 
1091
# Do we have the tzname variable
 
1092
DRIZZLE_TZNAME
 
1093
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
 
1094
AC_CHECK_TYPES([uint, ulong])
 
1095
 
 
1096
DRIZZLE_PTHREAD_YIELD
 
1097
 
 
1098
 
 
1099
dnl Checks for header files.
 
1100
AC_CHECK_HEADERS(malloc.h)
 
1101
 
 
1102
dnl Checks for library functions.
 
1103
AC_FUNC_ALLOCA
 
1104
AC_PROG_GCC_TRADITIONAL
 
1105
AC_TYPE_SIGNAL
 
1106
 
 
1107
AC_CHECK_FUNCS(issetugid)
 
1108
 
 
1109
# from old readline settting:
 
1110
 
 
1111
MAKE_SHELL=/bin/sh
 
1112
AC_SUBST(MAKE_SHELL)
 
1113
 
 
1114
# Already-done: stdlib.h string.h unistd.h termios.h
 
1115
AC_CHECK_HEADERS(stdarg.h dirent.h locale.h ndir.h sys/dir.h \
 
1116
 sys/ndir.h sys/select.h \
 
1117
 sys/mman.h termcap.h termio.h asm/termbits.h grp.h \
 
1118
 paths.h)
 
1119
 
 
1120
# Already-done: strcasecmp
 
1121
AC_CHECK_FUNCS(lstat select)
 
1122
 
 
1123
AC_HEADER_STAT
 
1124
DRIZZLE_SIGNAL_CHECK
 
1125
DRIZZLE_CHECK_GETPW_FUNCS
 
1126
DRIZZLE_HAVE_TIOCGWINSZ
 
1127
DRIZZLE_HAVE_TIOCSTAT
 
1128
DRIZZLE_TYPE_SIGHANDLER
 
1129
if test "$with_named_curses" = "no"
 
1130
then
 
1131
  DRIZZLE_CHECK_LIB_TERMCAP
 
1132
else
 
1133
  TERMCAP_LIBS="$with_named_curses"
 
1134
fi
 
1135
AC_SUBST(TERMCAP_LIBS)
 
1136
 
 
1137
# End of readline/libedit stuff
123
1138
#########################################################################
124
1139
 
125
 
 
126
 
dnl Has to be done late, as the plugin may need to check for existence of
127
 
dnl functions tested above
128
 
PANDORA_PLUGINS([drizzled/module/load_list.h])
 
1140
dnl Checks for library functions.
 
1141
 
 
1142
#
 
1143
# The following code disables intrinsic function support while we test for
 
1144
# library functions.  This is to avoid configure problems with Intel ecc
 
1145
# compiler
 
1146
 
 
1147
ORG_CFLAGS="$CFLAGS"
 
1148
if test "$GCC" != "yes"; then
 
1149
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
 
1150
fi
 
1151
 
 
1152
#AC_FUNC_MMAP
 
1153
AC_TYPE_SIGNAL
 
1154
DRIZZLE_TYPE_QSORT
 
1155
AC_FUNC_UTIME_NULL
 
1156
AC_FUNC_VPRINTF
 
1157
 
 
1158
AC_CHECK_FUNCS(fcntl)
 
1159
if test "x$ac_cv_func_fcntl" != "xyes"
 
1160
then
 
1161
  AC_MSG_ERROR("Drizzle requires fcntl.")
 
1162
fi
 
1163
 
 
1164
AC_CONFIG_LIBOBJ_DIR([mystrings])
 
1165
 
 
1166
AC_CHECK_FUNCS( \
 
1167
  cuserid fchmod \
 
1168
  fdatasync fpresetsticky fpsetmask fsync \
 
1169
  getpassphrase getpwnam \
 
1170
  getpwuid getrlimit getrusage index initgroups isnan \
 
1171
  localtime_r gethrtime gmtime_r \
 
1172
  madvise \
 
1173
  mkstemp mlockall poll pread pthread_attr_create mmap mmap64 \
 
1174
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
 
1175
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
 
1176
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
 
1177
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
 
1178
  realpath rename rwlock_init setupterm \
 
1179
  sigaction \
 
1180
  sigthreadmask \
 
1181
  snprintf strpbrk \
 
1182
  tell tempnam \
 
1183
  backtrace backtrace_symbols backtrace_symbols_fd)
 
1184
 
 
1185
AC_LANG_PUSH(C++)
 
1186
# Test whether madvise() is declared in C++ code -- it is not on some
 
1187
# systems, such as Solaris
 
1188
AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
 
1189
#if HAVE_SYS_MMAN_H
 
1190
#include <sys/types.h>
 
1191
#include <sys/mman.h>
 
1192
#endif
 
1193
]])
 
1194
AC_LANG_POP()
 
1195
 
 
1196
 
 
1197
AM_CONDITIONAL(BUILD_THR_RWLOCK,[test "$ac_cv_func_rwlock_init" -a "$ac_cv_funn_pthread_rwlock_rdlock"])
 
1198
 
 
1199
 
 
1200
CFLAGS="$ORG_CFLAGS"
 
1201
 
 
1202
# Sanity check: We chould not have any fseeko symbol unless
 
1203
# large_file_support=yes
 
1204
AC_CHECK_FUNC(fseeko,
 
1205
[if test "$large_file_support" = no -a "x$TARGET_LINUX" = "xtrue";
 
1206
then
 
1207
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
 
1208
fi]
 
1209
)
 
1210
 
 
1211
# Check definition of pthread_getspecific
 
1212
AC_CACHE_CHECK([args to pthread_getspecific], [mysql_cv_getspecific_args],
 
1213
  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(_REENTRANT)
 
1214
#define _REENTRANT
 
1215
#endif
 
1216
#define _POSIX_PTHREAD_SEMANTICS 
 
1217
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
 
1218
pthread_getspecific((pthread_key_t) NULL); ]])],
 
1219
    [mysql_cv_getspecific_args=POSIX],
 
1220
    [mysql_cv_getspecific_args=other])])
 
1221
  if test "$mysql_cv_getspecific_args" = "other"
 
1222
  then
 
1223
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
 
1224
              [For some non posix threads])
 
1225
  fi
 
1226
 
 
1227
  # Check definition of pthread_mutex_init
 
1228
  AC_CACHE_CHECK([args to pthread_mutex_init], [mysql_cv_mutex_init_args],
 
1229
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
 
1230
#define _POSIX_PTHREAD_SEMANTICS 
 
1231
#include <pthread.h> ]], [[ 
 
1232
  pthread_mutexattr_t attr;
 
1233
  pthread_mutex_t mp;
 
1234
  pthread_mutex_init(&mp,&attr); ]])],
 
1235
      [mysql_cv_mutex_init_args=POSIX],
 
1236
      [mysql_cv_mutex_init_args=other])])
 
1237
  if test "$mysql_cv_mutex_init_args" = "other"
 
1238
  then
 
1239
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
 
1240
              [For some non posix threads])
 
1241
  fi
 
1242
#---END:
 
1243
 
 
1244
#---START: Used in for client configure
 
1245
# Check definition of readdir_r
 
1246
AC_CACHE_CHECK([args to readdir_r], [mysql_cv_readdir_r],
 
1247
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
 
1248
#define _POSIX_PTHREAD_SEMANTICS 
 
1249
#include <pthread.h>
 
1250
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
 
1251
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
 
1252
    [mysql_cv_readdir_r=POSIX],
 
1253
    [mysql_cv_readdir_r=other])])
 
1254
if test "$mysql_cv_readdir_r" = "POSIX"
 
1255
then
 
1256
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
 
1257
fi
 
1258
 
 
1259
# Check definition of posix sigwait()
 
1260
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
 
1261
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 
1262
#define _REENTRANT
 
1263
#define _POSIX_PTHREAD_SEMANTICS 
 
1264
#include <pthread.h>
 
1265
#include <signal.h>
 
1266
      ]], [[
 
1267
#ifndef _AIX
 
1268
sigset_t set;
 
1269
int sig;
 
1270
sigwait(&set,&sig);
 
1271
#endif
 
1272
      ]])],
 
1273
    [mysql_cv_sigwait=POSIX],
 
1274
    [mysql_cv_sigwait=other])])
 
1275
if test "$mysql_cv_sigwait" = "POSIX"
 
1276
then
 
1277
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
 
1278
fi
 
1279
 
 
1280
if test "$mysql_cv_sigwait" != "POSIX"
 
1281
then
 
1282
unset mysql_cv_sigwait
 
1283
# Check definition of posix sigwait()
 
1284
AC_CACHE_CHECK([style of sigwait], [mysql_cv_sigwait],
 
1285
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 
1286
#define _REENTRANT
 
1287
#define _POSIX_PTHREAD_SEMANTICS 
 
1288
#include <pthread.h>
 
1289
#include <signal.h>
 
1290
      ]], [[
 
1291
sigset_t set;
 
1292
int sig;
 
1293
sigwait(&set);
 
1294
      ]])],
 
1295
    [mysql_cv_sigwait=NONPOSIX],
 
1296
    [mysql_cv_sigwait=other])])
 
1297
if test "$mysql_cv_sigwait" = "NONPOSIX"
 
1298
then
 
1299
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
 
1300
fi
 
1301
fi
 
1302
#---END:
 
1303
 
 
1304
# Check if pthread_attr_setscope() exists
 
1305
AC_CACHE_CHECK([for pthread_attr_setscope], [mysql_cv_pthread_attr_setscope],
 
1306
  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 
1307
#define _REENTRANT
 
1308
#define _POSIX_PTHREAD_SEMANTICS 
 
1309
#include <pthread.h>
 
1310
      ]], [[
 
1311
pthread_attr_t thr_attr;
 
1312
pthread_attr_setscope(&thr_attr,0);
 
1313
      ]])],
 
1314
    [mysql_cv_pthread_attr_setscope=yes],
 
1315
    [mysql_cv_pthread_attr_setscope=no])])
 
1316
if test "$mysql_cv_pthread_attr_setscope" = "yes"
 
1317
then
 
1318
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
 
1319
fi
 
1320
 
 
1321
AC_LANG_PUSH([C++])
 
1322
AC_CHECK_HEADERS(cxxabi.h)
 
1323
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
 
1324
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
 
1325
  char *foo= 0; int bar= 0;
 
1326
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
 
1327
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
 
1328
AC_LANG_POP([])
 
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
 
 
1339
DRIZZLE_CHECK_MAX_INDEXES
 
1340
DRIZZLE_CHECK_VIO
 
1341
 
 
1342
#--------------------------------------------------------------------
 
1343
# Declare our plugin modules
 
1344
# Has to be done late, as the plugin may need to check for existence of
 
1345
# functions tested above
 
1346
#--------------------------------------------------------------------
 
1347
 
 
1348
DRIZZLE_CONFIGURE_PLUGINS([none])
 
1349
 
 
1350
AC_SUBST(mysql_plugin_dirs)
 
1351
AC_SUBST(mysql_plugin_libs)
 
1352
AC_SUBST(mysql_plugin_defs)
 
1353
 
 
1354
 
 
1355
AC_ARG_ENABLE([profiling],
 
1356
    [AS_HELP_STRING([--enable-profiling],
 
1357
       [Toggle profiling @<:@default=off@:>@])],
 
1358
    [ac_profiling="$enableval"],
 
1359
    [ac_profiling="no"])
 
1360
 
 
1361
AC_ARG_ENABLE([coverage],
 
1362
    [AS_HELP_STRING([--enable-coverage],
 
1363
       [Toggle coverage @<:@default=off@:>@])],
 
1364
    [ac_coverage="$enableval"],
 
1365
    [ac_coverage="no"])
 
1366
 
 
1367
AC_ARG_ENABLE([pedantic-warnings],
 
1368
    [AS_HELP_STRING([--disable-pedantic-warnings],
 
1369
       [Toggle pedanticness @<:@default=on@:>@])],
 
1370
    [ac_warn_pedantic="$enableval"],
 
1371
    [ac_warn_pedantic="yes"])
 
1372
 
 
1373
AC_ARG_ENABLE([fail],
 
1374
    [AS_HELP_STRING([--disable-fail],
 
1375
       [Turn warnings into failures @<:@default=on@:>@])],
 
1376
    [ac_warn_fail="$enableval"],
 
1377
    [ac_warn_fail="yes"])
 
1378
 
 
1379
AC_ARG_ENABLE([unreachable],
 
1380
    [AS_HELP_STRING([--enable-unreachable],
 
1381
       [Enable warnings about unreachable code @<:@default=off@:>@])],
 
1382
    [ac_warn_unreachable="$enableval"],
 
1383
    [ac_warn_unreachable="no"])
 
1384
 
 
1385
AC_ARG_ENABLE([longlong-warnings],
 
1386
    [AS_HELP_STRING([--enable-longlong-warnings],
 
1387
       [Enable warnings about longlong in C++ @<:@default=off@:>@])],
 
1388
    [ac_warn_longlong="$enableval"],
 
1389
    [ac_warn_longlong="no"])
 
1390
 
 
1391
AC_ARG_ENABLE([strict-aliasing],
 
1392
    [AS_HELP_STRING([--enable-strict-aliasing],
 
1393
       [Enable warnings about stict-aliasing @<:@default=off@:>@])],
 
1394
    [ac_warn_strict_aliasing="$enableval"],
 
1395
    [ac_warn_strict_aliasing="no"])
 
1396
 
 
1397
AC_ARG_ENABLE([cast-warnings],
 
1398
    [AS_HELP_STRING([--enable-cast-warnings],
 
1399
       [Enable warnings about use of old C-style casts @<:@default=off@:>@])],
 
1400
    [ac_warn_cast="$enableval"],
 
1401
    [ac_warn_cast="no"])
 
1402
 
 
1403
AC_ARG_ENABLE([effective-style],
 
1404
    [AS_HELP_STRING([--enable-effective-style],
 
1405
       [Enable warnings violating Effective C++ Style Guidelines @<:@default=off@:>@])],
 
1406
    [ac_warn_effc="$enableval"],
 
1407
    [ac_warn_effc="no"])
 
1408
 
 
1409
AC_ARG_ENABLE([go-crazy],
 
1410
    [AS_HELP_STRING([--enable-go-crazy],
 
1411
       [Enables extra little warnings that might be too much @<:@default=off@:>@])],
 
1412
    [ac_warn_go_crazy="$enableval"],
 
1413
    [ac_warn_go_crazy="no"])
 
1414
 
 
1415
 
 
1416
if test "$GCC" = "yes"
 
1417
then
 
1418
 
 
1419
 
 
1420
  if test "$ac_warn_fail" = "yes"
 
1421
  then
 
1422
    W_FAIL="-Werror"
 
1423
  fi
 
1424
  BASE_WARNINGS="-W -Wall -Wextra -Wunused-macros ${W_FAIL}"
 
1425
 
 
1426
  if test "$ac_warn_longlong" = "yes"
 
1427
  then
 
1428
    W_LONGLONG="-Wlong-long"
 
1429
  else
 
1430
    W_LONGLONG="-Wno-long-long"
 
1431
  fi
 
1432
 
 
1433
  if test "$ac_warn_strict_aliasing" = "yes"
 
1434
  then
 
1435
    W_STRICT_ALIASING="-Wstrict-aliasing"
 
1436
  else
 
1437
    W_STRICT_ALIASING="-Wno-strict-aliasing"
 
1438
  fi
 
1439
 
 
1440
  if test "$ac_profiling" = "yes"
 
1441
  then
 
1442
    GPROF_PROFILING="-pg"
 
1443
  else
 
1444
    GPROF_PROFILING=" "
 
1445
  fi
 
1446
 
 
1447
  if test "$ac_coverage" = "yes"
 
1448
  then
 
1449
    GPROF_COVERAGE="-fprofile-arcs -ftest-coverage"
 
1450
  else
 
1451
    GPROF_COVERAGE=" "
 
1452
  fi
 
1453
 
 
1454
  if test "$ac_warn_pedantic" = "yes"
 
1455
  then
 
1456
    save_CXXFLAGS="${CXXFLAGS}"
 
1457
    CXXFLAGS="${CXXFLAGS} ${W_FAIL} -Wredundant-decls"
 
1458
    AC_CACHE_CHECK([whether it is safe to use -Wredundant-decls],
 
1459
      [ac_cv_safe_to_use_Wredundant_decls_],
 
1460
      [AC_LANG_PUSH(C++)
 
1461
       AC_COMPILE_IFELSE(
 
1462
         [AC_LANG_PROGRAM([
 
1463
template <typename E> struct C { void foo(); };
 
1464
template <typename E> void C<E>::foo() { }
 
1465
template <> void C<int>::foo();
 
1466
            AC_INCLUDES_DEFAULT])],
 
1467
          [ac_cv_safe_to_use_Wredundant_decls_=yes],
 
1468
          [ac_cv_safe_to_use_Wredundant_decls_=no])
 
1469
        AC_LANG_POP()])
 
1470
    if test $ac_cv_safe_to_use_Wredundant_decls_ = yes
 
1471
    then
 
1472
      GXX_W_REDUNDANT_DECLS="-Wredundant-decls"
 
1473
    else
 
1474
      GXX_W_REDUNDANT_DECLS="-Wno-redundant-decls"
 
1475
    fi
 
1476
    
 
1477
    GCC_PEDANTIC="-pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls ${W_STRICT_ALIASING}"
 
1478
    GXX_PEDANTIC="-pedantic -Wundef ${GXX_W_REDUNDANT_DECLS} ${W_LONGLONG} ${W_STRICT_ALIASING}"
 
1479
 
 
1480
    AC_CACHE_CHECK([whether __attribute__ visibility "hidden" is supported],
 
1481
      [ac_cv_can_use_hidden_],
 
1482
      [AC_LANG_PUSH(C++)
 
1483
       AC_COMPILE_IFELSE(
 
1484
         [AC_LANG_PROGRAM([
 
1485
          AC_INCLUDES_DEFAULT
 
1486
__attribute__((visibility ("hidden")))
 
1487
void testme() {  };],[
 
1488
     testme();])],  
 
1489
         [ac_cv_can_use_hidden_=yes],
 
1490
         [ac_cv_can_use_hidden_=no])
 
1491
       AC_LANG_POP()])
 
1492
    if test "$ac_cv_can_use_hidden_" = "yes"
 
1493
    then
 
1494
      AC_DEFINE(HAVE_ATTR_HIDDEN, 1,
 
1495
                [Define to 1 if you have support for __attribute__((visibility("hidden")))])
 
1496
    fi
 
1497
 
 
1498
    CXXFLAGS="${save_CXXFLAGS}"
 
1499
  fi
 
1500
 
 
1501
  if test "$ac_warn_unreachable" = "yes"
 
1502
  then
 
1503
    W_UNREACHABLE="-Wunreachable-code"
 
1504
  fi
 
1505
  if test "$ac_warn_cast" = "yes"
 
1506
  then
 
1507
    W_CAST="-Wold-style-cast"
 
1508
  fi
 
1509
 
 
1510
  if test "$ac_warn_effc" = "yes"
 
1511
  then
 
1512
    W_EFFC="-Weffc++"
 
1513
  fi
 
1514
 
 
1515
  if test "$ac_warn_gocrazy" = "yes"
 
1516
  then
 
1517
    W_CRAZY="-Wshadow -Wconversion -Winvalid-pch"
 
1518
  fi
 
1519
 
 
1520
  CC_WARNINGS="${C99_SUPPORT_HACK} ${BASE_WARNINGS} ${GCC_PEDANTIC} ${W_UNREACHABLE} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${W_CRAZY}"
 
1521
  CXX_WARNINGS="${BASE_WARNINGS} ${GXX_PEDANTIC} ${W_UNREACHABLE} ${GPROF_PROFILING} ${GPROF_COVERAGE} ${W_CAST} ${W_EFFC} ${W_CRAZY}"
 
1522
 
 
1523
  NO_EXCEPTIONS="-fno-exceptions"
 
1524
  W_EXCEPTIONS="-fexceptions"
 
1525
  NO_UNUSED_MACROS="-Wno-unused-macros"
 
1526
  NO_REDUNDANT_DECLS="-Wno-redundant-decls"
 
1527
  # Disable exceptions as they seams to create problems with gcc and threads.
 
1528
  # drizzled doesn't use run-time-type-checking, so we disable it.
 
1529
  AM_CXXFLAGS="${AM_CXXFLAGS} -fno-rtti"
 
1530
  CPPFLAGS="${CPPFLAGS} -fpch-deps"
 
1531
fi
 
1532
if test "$SUNCC" = "yes"
 
1533
then
 
1534
  CC_WARNINGS="-v -xc99=all -errtags=yes"
 
1535
  CXX_WARNINGS="+w +w2 -xport64 -errtags=yes -erroff=attrskipunsup -compat=5"
 
1536
  NO_EXCEPTIONS="-features=no%except"
 
1537
  W_EXCEPTIONS="-features=except"
 
1538
fi
 
1539
AM_CXXFLAGS="${CXX_WARNINGS} ${NO_EXCEPTIONS}  ${AM_CXXFLAGS}"
 
1540
AM_CFLAGS="${CC_WARNINGS} ${AM_CFLAGS}"
 
1541
 
 
1542
AC_SUBST(NO_EXCEPTIONS)
 
1543
AC_SUBST(W_EXCEPTIONS)
 
1544
AC_SUBST(NO_UNUSED_MACROS)
 
1545
AC_SUBST(NO_REDUNDANT_DECLS)
 
1546
 
 
1547
AC_SUBST([GLOBAL_CPPFLAGS],['-I$(top_srcdir) -I$(top_builddir)'])
 
1548
AC_SUBST([AM_CPPFLAGS],['${GLOBAL_CPPFLAGS}'])
 
1549
AC_SUBST([AM_CFLAGS])
 
1550
AC_SUBST([AM_CXXFLAGS])
 
1551
 
 
1552
# Some usefull subst
 
1553
AC_SUBST(CC)
 
1554
AC_SUBST(GXX)
 
1555
 
 
1556
# Set configuration options for make_binary_distribution
 
1557
case $SYSTEM_TYPE in
 
1558
  *netware*)
 
1559
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
 
1560
    ;;
 
1561
  *)
 
1562
    : # no change for other platforms yet
 
1563
    ;;
 
1564
esac
 
1565
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
129
1566
 
130
1567
dnl GCC Precompiled Header Support
131
1568
dnl re-enable later
132
 
dnl AM_CONDITIONAL([BUILD_GCC_PCH],[test "$GCC" = "yes"])
133
 
AM_CONDITIONAL([BUILD_GCC_PCH],[test "no" = "yes"])
134
 
 
135
 
AS_IF([test "$lt_cv_prog_gnu_ld" = "yes"],[
136
 
  LDFLAGS="${LDFLAGS} ${LD_VERSION_SCRIPT}"
137
 
  ])
138
 
 
139
 
WITH_VALGRIND
140
 
AS_IF([test "x${ac_gcc_profile_mode}" = "xyes" -a "x${pandora_cv_boost_profile}" = "xyes"],[
141
 
    AC_DEFINE([_GLIBCXX_PROFILE],[1],[Enable GCC Profile Mode])
142
 
    ])
143
 
 
144
 
 
145
 
AC_CONFIG_FILES(Makefile dnl
146
 
 tests/Makefile dnl
147
 
 drizzled/plugin/version.h dnl
148
 
 support-files/drizzle7.pc dnl
149
 
 support-files/libdrizzle.pc dnl
150
 
 support-files/smf/install.sh dnl
151
 
 support-files/smf/drizzle.xml dnl
152
 
 support-files/smf/drizzle)
153
 
 
154
 
scheduling_plugins_available="
155
 
  pool_of_threads 
156
 
  single_thread
157
 
"
158
 
 
159
 
for sched_plugin in $scheduling_plugins_available
160
 
do
161
 
  varname="\${with_plugin_${sched_plugin}}"
162
 
  result=`eval "echo $varname"`
163
 
  if test "x$result" = "xyes"
164
 
  then
165
 
    scheduling_plugins="$sched_plugin $scheduling_plugins"
166
 
  fi
167
 
done
 
1569
dnl AM_CONDITIONAL([GCC_PCH],[test "$GCC" = "yes"])
 
1570
AM_CONDITIONAL([GCC_PCH],[test "no" = "yes"])
 
1571
 
 
1572
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
 
1573
 mystrings/Makefile storage/Makefile dnl
 
1574
 po/Makefile.in dnl
 
1575
 libdrizzle/Makefile client/Makefile dnl
 
1576
 drizzled/Makefile dnl
 
1577
 drizzled/field/Makefile dnl
 
1578
 drizzled/serialize/Makefile dnl
 
1579
 drizzled/functions/Makefile dnl
 
1580
 drizzled/functions/str/Makefile dnl
 
1581
 drizzled/functions/time/Makefile dnl
 
1582
 drizzled/util/Makefile dnl
 
1583
 drizzled/sql_builtin.cc dnl
 
1584
 support-files/Makefile dnl
 
1585
 tests/Makefile tests/install_test_db dnl
 
1586
 plugin/Makefile dnl
 
1587
 drizzled/drizzled_safe support-files/libdrizzle.pc dnl
 
1588
 support-files/drizzle.server support-files/drizzle-log-rotate)
 
1589
 
 
1590
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
 
1591
 
 
1592
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
 
1593
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS' AM_CFLAGS='$AM_CFLAGS' AM_CXXFLAGS='$AM_CXXFLAGS'")
168
1594
 
169
1595
AC_OUTPUT
170
1596
 
171
1597
echo "---"
172
 
echo "Configuration summary for $PACKAGE_NAME version $VERSION $PANDORA_RELEASE_COMMENT"
 
1598
echo "Configuration summary for $PACKAGE_NAME version $VERSION"
173
1599
echo ""
174
1600
echo "   * Installation prefix:       $prefix"
175
 
echo "   * System type:               $host_vendor-$host_os"
176
 
echo "   * pandora-build version:     PANDORA_CANONICAL_VERSION"
 
1601
echo "   * System type:               $SYSTEM_TYPE"
177
1602
echo "   * Host CPU:                  $host_cpu"
178
1603
echo "   * C Compiler:                $CC_VERSION"
179
 
echo "   * C++ Compiler:              $CXX_VERSION"
 
1604
echo "   * C++ Compiler:              $CXX"
 
1605
echo "   * Build auth_pam:            $ac_cv_header_security_pam_appl_h"
180
1606
echo "   * Assertions enabled:        $ac_cv_assert"
181
1607
echo "   * Debug enabled:             $with_debug"
182
1608
echo "   * Profiling enabled:         $ac_profiling"
183
1609
echo "   * Coverage enabled:          $ac_coverage"
184
 
echo "   * Warnings as failure:       $ac_cv_warnings_as_errors"
 
1610
echo "   * Warnings as failure:       $ac_warn_fail"
 
1611
echo "   * C++ cstdint location:      $ac_cv_cxx_cstdint"
 
1612
echo "   * C++ hash_map location:     $ac_cv_cxx_hash_map"
 
1613
echo "   * C++ hash namespace:        $ac_cv_cxx_hash_namespace"
 
1614
echo "   * C++ cmath location:        $ac_cv_cxx_cmath"
 
1615
echo "   * C++ cmath namespace:       $ac_cv_cxx_cmath_namespace"
185
1616
echo ""
186
1617
echo "---"
187
 
 
188
 
case "$host_os" in
189
 
  *freebsd*)
190
 
    echo "*****"
191
 
    echo "*"
192
 
    echo "*  NOTE: You are on FreeBSD. BSD make will not work."
193
 
    echo "*"
194
 
    echo "*   use 'gmake' To build Drizzle"
195
 
    echo "*"
196
 
    echo "*  And ensure that /usr/local/lib/gcc44 is in your LD_LIBRARY_PATH"
197
 
    echo "*" 
198
 
    echo "*****"
199
 
  ;;
200
 
esac
201
 
 
202
 
 
203
 
dnl libtoolize scans configure.ac  and needs to see some text
204
 
m4_define([LIBTOOLIZE_AC_INIT], [])