~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
28.1.33 by Monty Taylor
Added -Wall
4
AC_PREREQ(2.61)dnl		Minimum Autoconf version required.
1 by brian
clean slate
5
28.1.33 by Monty Taylor
Added -Wall
6
AC_INIT
77.1.34 by Monty Taylor
Renamed more things to match the drizzled rename.
7
AC_CONFIG_SRCDIR([sql/drizzled.cc])
39 by Brian Aker
Move build helper files into config
8
AC_CONFIG_AUX_DIR(config)
28.1.33 by Monty Taylor
Added -Wall
9
AC_CONFIG_HEADERS([include/config.h:config.h.in])
10
AC_CANONICAL_TARGET
91 by Brian Aker
Main binary now named drizzled
11
AM_INIT_AUTOMAKE(drizzle, 7.0.0, no-define)
1 by brian
clean slate
12
13
PROTOCOL_VERSION=10
14
DOT_FRM_VERSION=6
15
# See the libtool docs for information on how to do shared lib versions.
16
SHARED_LIB_MAJOR_VERSION=16
17
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
18
19
20
21
# Set all version vars based on $VERSION. How do we do this more elegant ?
22
# Remember that regexps needs to quote [ and ] since this is run through m4
23
# We take some made up examples
24
#
25
#  VERSION                  5.1.40sp1-alpha     5.0.34a
26
#  MYSQL_NO_DASH_VERSION    5.1.40sp1           5.0.34a
27
#  MYSQL_NUMERIC_VERSION    5.1.40              5.0.34
28
#  MYSQL_BASE_VERSION       5.1                 5.0
29
#  MYSQL_VERSION_ID         50140               50034
30
#
31
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
32
MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
33
MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
34
MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
35
    awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
36
37
# The port should be constant for a LONG time
38
MYSQL_TCP_PORT_DEFAULT=3306
39
40
dnl Include m4 
41
sinclude(config/ac-macros/alloca.m4)
42
sinclude(config/ac-macros/check_cpu.m4)
43
sinclude(config/ac-macros/character_sets.m4)
44
sinclude(config/ac-macros/compiler_flag.m4)
45
sinclude(config/ac-macros/dtrace.m4)
46
sinclude(config/ac-macros/plugins.m4)
47
sinclude(config/ac-macros/large_file.m4)
48
sinclude(config/ac-macros/misc.m4)
49
sinclude(config/ac-macros/readline.m4)
50
sinclude(config/ac-macros/ssl.m4)
51
52
# Remember to add a directory sql/share/LANGUAGE
53
AVAILABLE_LANGUAGES="\
54
czech danish dutch english estonian french german greek hungarian \
55
italian japanese korean norwegian norwegian-ny polish portuguese \
56
romanian russian serbian slovak spanish swedish ukrainian"
57
58
#####
59
#####
60
61
AC_SUBST(MYSQL_NO_DASH_VERSION)
62
AC_SUBST(MYSQL_BASE_VERSION)
63
AC_SUBST(MYSQL_VERSION_ID)
64
AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
65
AC_SUBST(PROTOCOL_VERSION)
66
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
67
                   [mysql client protocol version])
68
AC_SUBST(DOT_FRM_VERSION)
69
AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
70
                   [Version of .frm files])
71
AC_SUBST(SHARED_LIB_MAJOR_VERSION)
72
AC_SUBST(SHARED_LIB_VERSION)
73
AC_SUBST(AVAILABLE_LANGUAGES)
74
75
76
# Canonicalize the configuration name.
77
78
# Check whether --with-system-type or --without-system-type was given.
28.1.33 by Monty Taylor
Added -Wall
79
AC_ARG_WITH([system-type],
80
    [AS_HELP_STRING([--with-system-type],
81
       [Set the system type, like "sun-solaris10"])],
1 by brian
clean slate
82
    [SYSTEM_TYPE="$withval"],
83
    [SYSTEM_TYPE="$host_vendor-$host_os"])
28.1.33 by Monty Taylor
Added -Wall
84
AC_ARG_WITH([machine-type],
85
    [AS_HELP_STRING([--with-machine-type],
86
       [Set the machine type, like "powerpc"])],
1 by brian
clean slate
87
    [MACHINE_TYPE="$withval"],
88
    [MACHINE_TYPE="$host_cpu"])
89
AC_SUBST(SYSTEM_TYPE)
90
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
91
                   [Name of system, eg sun-solaris])
92
AC_SUBST(MACHINE_TYPE)
93
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
94
                   [Machine type name, eg sparc])
95
96
# Detect intel x86 like processor
97
BASE_MACHINE_TYPE=$MACHINE_TYPE
98
case $MACHINE_TYPE in
99
  i?86) BASE_MACHINE_TYPE=i386 ;;
100
esac
101
102
# Save some variables and the command line options for mysqlbug
103
SAVE_CC="$CC"
104
SAVE_CXX="$CXX"
105
SAVE_ASFLAGS="$ASFLAGS"
106
SAVE_CFLAGS="$CFLAGS"
107
SAVE_CXXFLAGS="$CXXFLAGS"
108
SAVE_LDFLAGS="$LDFLAGS"
109
SAVE_CXXLDFLAGS="$CXXLDFLAGS"
110
CONF_COMMAND="$0 $ac_configure_args"
111
AC_SUBST(CONF_COMMAND)
112
AC_SUBST(SAVE_CC)
113
AC_SUBST(SAVE_CXX)
114
AC_SUBST(SAVE_ASFLAGS)
115
AC_SUBST(SAVE_CFLAGS)
116
AC_SUBST(SAVE_CXXFLAGS)
117
AC_SUBST(SAVE_LDFLAGS)
118
AC_SUBST(SAVE_CXXLDFLAGS)
119
AC_SUBST(CXXLDFLAGS)
120
121
AM_SANITY_CHECK
122
# This is needed is SUBDIRS is set
123
AC_PROG_MAKE_SET
124
125
##############################################################################
126
# The below section needs to be done before AC_PROG_CC
127
##############################################################################
128
129
if test "x${CFLAGS-}" = x ; then
130
  cflags_is_set=no
131
else
132
  cflags_is_set=yes
133
fi
134
135
if test "x${CPPFLAGS-}" = x ; then
136
  cppflags_is_set=no
137
else
138
  cppflags_is_set=yes
139
fi
140
141
if test "x${LDFLAGS-}" = x ; then
142
  ldflags_is_set=no
143
else
144
  ldflags_is_set=yes
145
fi
146
147
################ End of section to be done before AC_PROG_CC #################
148
149
# The following hack should ensure that configure doesn't add optimizing
150
# or debugging flags to CFLAGS or CXXFLAGS
151
# C_EXTRA_FLAGS are flags that are automaticly added to both
152
# CFLAGS and CXXFLAGS
153
CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
154
CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
155
156
dnl Checks for programs.
157
AC_PROG_AWK
158
AC_PROG_CC
159
AC_PROG_CXX
160
AC_PROG_CPP
161
AM_PROG_CC_C_O
162
163
# Print version of CC and CXX compiler (if they support --version)
164
case $SYSTEM_TYPE in
165
  *netware*)
166
CC_VERSION=`$CC -version | grep -i version`
167
    ;;
168
  *)
169
CC_VERSION=`$CC --version | sed 1q`
170
    ;;
171
esac
172
if test $? -eq "0"
173
then
174
  AC_MSG_CHECKING("C Compiler version")
175
  AC_MSG_RESULT("$CC $CC_VERSION")
176
else
177
CC_VERSION=""
178
fi
179
AC_SUBST(CC_VERSION)
180
MYSQL_CHECK_CXX_VERSION
181
28.1.33 by Monty Taylor
Added -Wall
182
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
183
then
184
  AS="$CC -c"
185
  AC_SUBST(AS)
186
else
187
  AC_PATH_PROG(AS, as, as)
188
fi
189
190
# Still need ranlib for readline; local static use only so no libtool.
191
AC_PROG_RANLIB
192
# We use libtool
193
#AC_LIBTOOL_WIN32_DLL
194
AC_PROG_LIBTOOL
195
196
# Ensure that we have --preserve-dup-deps defines, otherwise we get link
197
# problems of 'mysql' with CXX=g++
198
LIBTOOL="$LIBTOOL --preserve-dup-deps"
199
AC_SUBST(LIBTOOL)dnl
200
201
AC_SUBST(NM)dnl
202
203
AC_PROG_INSTALL
204
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
205
206
# Not critical since the generated file is distributed
207
AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
208
209
AC_PATH_PROG(uname_prog, uname, no)
210
211
# We should go through this and put all the explictly system dependent
212
# stuff in one place
213
AC_MSG_CHECKING(operating system)
214
AC_CACHE_VAL(mysql_cv_sys_os,
215
[
216
if test "$uname_prog" != "no"; then
217
  mysql_cv_sys_os="`uname`"
218
else
219
  mysql_cv_sys_os="Not Solaris"
220
fi
221
])
222
AC_MSG_RESULT($mysql_cv_sys_os)
223
224
# This should be rewritten to use $target_os
225
case "$target_os" in
226
  *solaris*)
227
    TARGET_SOLARIS="true"
228
    AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
229
    AC_SUBST(TARGET_SOLARIS)
230
  ;;
231
esac
232
233
# The following is required for portable results of floating point calculations
234
# on PowerPC. The same must also be done for IA-64, but this options is missing
235
# in the IA-64 gcc backend.
236
237
if test "$GCC" = "yes"
238
then
239
  case "$host_cpu" in
240
    *ppc* | *powerpc*)
241
      CFLAGS="$CFLAGS -mno-fused-madd"
242
      CXXFLAGS="$CXXFLAGS -mno-fused-madd"
243
    ;;
244
  esac
245
fi
246
247
AC_SUBST(CC)
248
AC_SUBST(CFLAGS)
249
AC_SUBST(CXX)
250
AC_SUBST(CXXFLAGS)
251
AC_SUBST(ASFLAGS)
252
AC_SUBST(LD)
253
AC_SUBST(INSTALL_SCRIPT)
254
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
255
1 by brian
clean slate
256
export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
257
258
if test "$GCC" = "yes"
259
then
260
  # mysqld requires -fno-implicit-templates.
261
  # Disable exceptions as they seams to create problems with gcc and threads.
262
  # mysqld doesn't use run-time-type-checking, so we disable it.
263
  # We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
264
  # regarding offset() usage in C++ which are done in a safe manner in the
265
  # server
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
266
  CXXFLAGS="$CXXFLAGS ${GCC_WARNINGS} -fno-implicit-templates -fno-exceptions -fno-rtti"
267
  CFLAGS="$CFLAGS ${GCC_WARNINGS} "
1 by brian
clean slate
268
  AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
269
    [1], [Defined by configure. Use explicit template instantiation.])
270
fi
271
272
MYSQL_PROG_AR
273
274
# libmysqlclient versioning when linked with GNU ld.
275
if $LD --version 2>/dev/null|grep -q GNU; then
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
276
  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libdrizzle/libdrizzle.ver"
277
  AC_CONFIG_FILES(libdrizzle/libdrizzle.ver)
1 by brian
clean slate
278
fi
279
AC_SUBST(LD_VERSION_SCRIPT)
280
281
282
# Avoid bug in fcntl on some versions of linux
283
AC_MSG_CHECKING([if we should use 'skip-external-locking' as default for $target_os])
284
# Any variation of Linux
285
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
286
then
287
  MYSQLD_DEFAULT_SWITCHES="--skip-external-locking"
288
  TARGET_LINUX="true"
289
  AC_MSG_RESULT([yes])
290
  AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
291
else
292
  MYSQLD_DEFAULT_SWITCHES=""
293
  TARGET_LINUX="false"
294
  AC_MSG_RESULT([no])
295
fi
296
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
297
AC_SUBST(TARGET_LINUX)
298
299
dnl Find paths to some shell programs
300
AC_PATH_PROG(LN, ln, ln)
301
# This must be able to take a -f flag like normal unix ln.
302
AC_PATH_PROG(LN_CP_F, ln, ln)
303
304
AC_PATH_PROG(MV, mv, mv)
305
AC_PATH_PROG(RM, rm, rm)
306
AC_PATH_PROG(CP, cp, cp)
307
AC_PATH_PROG(SED, sed, sed)
308
AC_PATH_PROG(CMP, cmp, cmp)
309
AC_PATH_PROG(CHMOD, chmod, chmod)
310
AC_PATH_PROG(HOSTNAME, hostname, hostname)
311
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
312
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
313
AC_CHECK_PROGS(TAR, gnutar gtar tar)
314
315
dnl We use a path for perl so the script startup works
316
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
317
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
318
AC_PATH_PROG(PERL, perl, no)
319
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
320
then
321
  PERL5=$PERL
322
else
323
  AC_PATH_PROG(PERL5, perl5, no)
324
  if test "$PERL5" != no
325
  then
326
    PERL=$PERL5
327
    ac_cv_path_PERL=$ac_cv_path_PERL5
328
  fi
329
fi
330
331
AC_SUBST(HOSTNAME)
332
AC_SUBST(PERL)
333
AC_SUBST(PERL5)
334
335
# icheck, used for ABI check
336
AC_PATH_PROG(ICHECK, icheck, no)
337
# "icheck" is also the name of a file system check program on Tru64.
338
# Verify the program found is really the interface checker.
339
if test "x$ICHECK" != "xno"
340
then
341
  AC_MSG_CHECKING(if $ICHECK works as expected)
342
  echo "int foo;" > conftest.h
343
  $ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
344
  if test -f "conftest.ic"
345
  then
346
    AC_MSG_RESULT(yes)
347
  else
348
    AC_MSG_RESULT(no)
349
    ICHECK=no
350
  fi
351
  rm -f conftest.ic conftest.h
352
fi
353
AC_SUBST(ICHECK)
354
355
# Lock for PS
356
AC_PATH_PROG(PS, ps, ps)
357
AC_MSG_CHECKING("how to check if pid exists")
358
PS=$ac_cv_path_PS
359
# Linux style
360
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
361
then
362
  FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
363
# Solaris
364
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
365
then
366
  FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
367
# BSD style
368
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
369
then
370
  FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
371
# SysV style
372
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
373
then
374
  FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
375
# Do anybody use this?
376
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
377
then
378
  FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
379
else
380
  case $SYSTEM_TYPE in
381
    *freebsd*|*dragonfly*)
382
      FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
383
      ;;
384
    *darwin*)
385
      FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
386
      ;;
387
    *)
388
      AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
389
  esac
390
fi
391
AC_SUBST(FIND_PROC)
392
AC_MSG_RESULT("$FIND_PROC")
393
394
# Check if a pid is valid
395
AC_PATH_PROG(KILL, kill, kill)
396
AC_MSG_CHECKING("for kill switches")
397
if $ac_cv_path_KILL -0 $$
398
then
399
  CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
400
elif kill -s 0 $$
401
then
402
  CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
403
else
404
  AC_MSG_WARN([kill -0 to check for pid seems to fail])
405
    CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
406
fi
407
AC_SUBST(CHECK_PID)
408
AC_MSG_RESULT("$CHECK_PID")
409
410
# We need an ANSI C compiler
411
AM_PROG_CC_STDC
412
413
# We need an assembler, too
414
AM_PROG_AS
415
CCASFLAGS="$CCASFLAGS $ASFLAGS"
416
417
# Check if we need noexec stack for assembler
418
AC_CHECK_NOEXECSTACK
419
420
if test "$am_cv_prog_cc_stdc" = "no"
421
then
91 by Brian Aker
Main binary now named drizzled
422
  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
423
fi
424
425
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
426
AC_ARG_WITH([server-suffix],
427
    [AS_HELP_STRING([--with-server-suffix],
428
      [Append value to the version string.])],
1 by brian
clean slate
429
    [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e  's/^\(...................................\)..*$/\1/'` ],
430
    [ MYSQL_SERVER_SUFFIX= ]
431
    )
432
AC_SUBST(MYSQL_SERVER_SUFFIX)
433
434
# 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)
435
AC_ARG_WITH([named-curses-libs],
436
    [AS_HELP_STRING([--with-named-curses-libs=ARG],
437
            [Use specified curses libraries instead of those
438
		automatically found by configure.])],
1 by brian
clean slate
439
    [ with_named_curses=$withval ],
440
    [ with_named_curses=no ]
441
    )
442
443
# compile with strings functions in assembler
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
444
AC_ARG_ENABLE([assembler],
445
    [AS_HELP_STRING([--enable-assembler],
446
	    [Use assembler versions of some string functions if available.])],
1 by brian
clean slate
447
    [ ENABLE_ASSEMBLER=$enableval ],
448
    [ ENABLE_ASSEMBLER=no ]
449
    )
450
451
AC_MSG_CHECKING(if we should use assembler functions)
452
# For now we only support assembler on i386 and sparc systems
453
AM_CONDITIONAL(ASSEMBLER_x86, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "i386" && $AS strings/strings-x86.s -o checkassembler >/dev/null 2>&1 && test -f checkassembler && (rm -f checkassembler; exit 0;))
454
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
455
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
456
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
457
458
if test "$ASSEMBLER_TRUE" = ""
459
then
460
  AC_MSG_RESULT([yes])
461
else
462
  AC_MSG_RESULT([no])
463
fi
464
465
# Add query profiler
466
AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
467
AC_ARG_ENABLE([profiling],
468
    [AS_HELP_STRING([--enable-profiling], 
469
	    [Build a version with query profiling code])],
1 by brian
clean slate
470
    [ ENABLED_PROFILING=$enableval ],
471
    [ ENABLED_PROFILING=no ])
472
473
if test "$ENABLED_PROFILING" = "yes"
474
then
475
  AC_DEFINE([ENABLED_PROFILING], [1],
476
            [If SHOW PROFILE should be enabled])
477
  AC_MSG_RESULT([yes]) 
478
else
479
  AC_MSG_RESULT([no])
480
fi
481
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
482
AC_ARG_WITH([tcp-port],
483
    [AS_HELP_STRING([--with-tcp-port=port-number],
91 by Brian Aker
Main binary now named drizzled
484
            [Which port to use for Drizzle services @<:@default=3306@:>@])],
1 by brian
clean slate
485
    [ MYSQL_TCP_PORT=$withval ],
486
    [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT
487
      # if we actually defaulted (as opposed to the pathological case of
488
      # --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
489
      # happen if whole batch of servers was built from a script), set
490
      # the default to zero to indicate that; we don't lose information
491
      # that way, because 0 obviously indicates that we can get the
492
      # default value from MYSQL_TCP_PORT. this seems really evil, but
493
      # testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
494
      # a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
495
      # intend it to mean "use the default, in fact, look up a good default
496
      # from /etc/services if you can", but really, really meant 3306 when
497
      # they passed in 3306. When they pass in a specific value, let them
498
      # have it; don't second guess user and think we know better, this will
499
      # just make people cross.  this makes the the logic work like this
500
      # (which is complicated enough):
501
      #
502
      # - if a port was set during build, use that as a default.
503
      #
504
      # - otherwise, try to look up a port in /etc/services; if that fails,
505
      #   use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
506
      #
507
      # - allow the MYSQL_TCP_PORT environment variable to override that.
508
      #
509
      # - allow command-line parameters to override all of the above.
510
      #
511
      # the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
512
      # so don't mess with that.
513
      MYSQL_TCP_PORT_DEFAULT=0 ]
514
    )
515
AC_SUBST(MYSQL_TCP_PORT)
516
# We might want to document the assigned port in the manual.
517
AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
518
519
# 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)
520
AC_ARG_WITH([mysqld-user],
521
    [AS_HELP_STRING([--with-mysqld-user=username],
522
            [What user the mysqld daemon shall be run as.
523
		@<:@default=mysql@:>@])],
1 by brian
clean slate
524
    [ MYSQLD_USER=$withval ],
525
    [ MYSQLD_USER=mysql ]
526
    )
527
AC_SUBST(MYSQLD_USER)
528
529
# If we should allow LOAD DATA LOCAL
530
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
531
AC_ARG_ENABLE(local-infile,
532
    [  --enable-local-infile   Enable LOAD DATA LOCAL INFILE (default: disabled)],
533
    [ ENABLED_LOCAL_INFILE=$enableval ],
534
    [ ENABLED_LOCAL_INFILE=no ]
535
    )
536
if test "$ENABLED_LOCAL_INFILE" = "yes"
537
then
538
  AC_MSG_RESULT([yes])
539
  AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
540
            [If LOAD DATA LOCAL INFILE should be enabled by default])
541
else
542
  AC_MSG_RESULT([no])
543
fi
544
545
MYSQL_SYS_LARGEFILE
546
547
# Types that must be checked AFTER large file support is checked
548
AC_TYPE_SIZE_T
549
550
#--------------------------------------------------------------------
551
# Check for system header files
552
#--------------------------------------------------------------------
553
554
AC_HEADER_DIRENT
555
AC_HEADER_STDC
556
AC_HEADER_SYS_WAIT
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
557
AC_HEADER_STDBOOL
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
558
AC_CHECK_HEADERS(fcntl.h float.h fpu_control.h ieeefp.h)
53.2.29 by Monty Taylor
Cleaned up headers a little more.
559
AC_CHECK_HEADERS(limits.h pwd.h select.h linux/config.h)
560
AC_CHECK_HEADERS(sys/fpu.h utime.h sys/utime.h )
561
AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h)
562
AC_CHECK_HEADERS(sys/timeb.h ys/un.h sys/vadvise.h sys/wait.h term.h)
563
AC_CHECK_HEADERS(termio.h termios.h sched.h crypt.h alloca.h)
564
AC_CHECK_HEADERS(sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h)
565
AC_CHECK_HEADERS(sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h)
566
AC_CHECK_HEADERS(execinfo.h)
1 by brian
clean slate
567
568
AC_CHECK_HEADERS([xfs/xfs.h])
23 by Brian Aker
Adding back in simple test for libevent
569
#--------------------------------------------------------------------
570
# Check for libevent
571
#--------------------------------------------------------------------
572
573
AC_CHECK_LIB(event, event_loop, [], [AC_MSG_ERROR(could not find libevent)])
1 by brian
clean slate
574
575
#--------------------------------------------------------------------
25 by Brian Aker
Clean up of configure.in
576
# Check for libpthread
577
#--------------------------------------------------------------------
578
579
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR(could not find libpthread)])
580
581
#--------------------------------------------------------------------
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
582
# Check for libpcre
583
#--------------------------------------------------------------------
584
585
AC_PATH_PROG(PKG_CONFIG, pkg-config, AC_MSG_ERROR([pkg-config wasn't found.]))
586
PKG_CHECK_MODULES(PCRE, [libpcrecpp >= 3], [
587
  AC_DEFINE([HAVE_PCRE], [1], [Perl Compatible Regex Lib for mysqltest])
588
  ],[
77.1.35 by Monty Taylor
Fix to look more thoroughly for PCRE and then die if we don't have it.
589
  AC_CHECK_LIB(pcrecpp, [DoMatch], AC_MSG_ERROR([PCRE not found]))
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
590
  AC_MSG_WARN([PCRE not found - mysqltest will not be built])
591
  ])
592
AC_SUBST(PCRE_LIBS)
593
AC_SUBST(PCRE_CFLAGS)
594
595
#--------------------------------------------------------------------
1 by brian
clean slate
596
# Check for system libraries. Adds the library to $LIBS
597
# and defines HAVE_LIBM etc
598
#--------------------------------------------------------------------
599
600
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
601
AC_CHECK_FUNCS(log2)
602
603
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
604
AC_CHECK_FUNC(yp_get_default_domain, ,
605
  AC_CHECK_LIB(nsl, yp_get_default_domain))
606
AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
607
# This may get things to compile even if bind-8 is installed
608
AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
609
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
610
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
611
612
# Check rt for aio_read
613
AC_CHECK_LIB(rt, aio_read)
614
615
# For the sched_yield() function on Solaris
616
AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield,
617
[AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"]))
618
619
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
620
then
621
  AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
622
fi
623
624
AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
625
                uchar, uint, ulong],[],[], [
626
#include <sys/types.h>
627
])
628
AC_CHECK_TYPES([fp_except], [], [], [
629
#include <sys/types.h>
630
#include <ieeefp.h>
631
])
632
25 by Brian Aker
Clean up of configure.in
633
634
my_save_LIBS="$LIBS"
635
LIBS=""
636
AC_CHECK_LIB(dl,dlopen)
637
LIBDL=$LIBS
638
LIBS="$my_save_LIBS"
639
AC_SUBST(LIBDL)
640
641
my_save_LIBS="$LIBS"
642
LIBS="$LIBS $LIBDL"
643
AC_CHECK_FUNCS(dlopen dlerror)
644
LIBS="$my_save_LIBS"
645
646
AC_CHECK_FUNCS(strtok_r)
1 by brian
clean slate
647
648
# Build optimized or debug version ?
649
# First check for gcc and g++
28.1.33 by Monty Taylor
Added -Wall
650
if test "$ac_cv_c_compiler_gnu" = "yes"
1 by brian
clean slate
651
then
652
  DEBUG_CFLAGS="-g"
653
  DEBUG_OPTIMIZE_CC="-O"
654
  OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
655
else
656
  DEBUG_CFLAGS="-g"
657
  DEBUG_OPTIMIZE_CC=""
658
  OPTIMIZE_CFLAGS="-O"
659
fi
660
if test "$ac_cv_prog_cxx_g" = "yes"
661
then
662
  DEBUG_CXXFLAGS="-g"
663
  DEBUG_OPTIMIZE_CXX="-O"
664
  OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
665
else
666
  DEBUG_CXXFLAGS="-g"
667
  DEBUG_OPTIMIZE_CXX=""
668
  OPTIMIZE_CXXFLAGS="-O"
669
fi
670
671
# If the user specified CFLAGS, we won't add any optimizations
672
if test -n "$SAVE_CFLAGS"
673
then
674
  OPTIMIZE_CFLAGS=""
675
  DEBUG_OPTIMIZE_CC=""
676
fi
677
# Ditto for CXXFLAGS
678
if test -n "$SAVE_CXXFLAGS"
679
then
680
  OPTIMIZE_CXXFLAGS=""
681
  DEBUG_OPTIMIZE_CXX=""
682
fi
683
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
684
AC_ARG_WITH([debug],
685
    [AS_HELP_STRING([--with-debug],
686
            [Add debug code (yes|no|full) @<:@default=no@:>@ 
687
	    Full adds memory checked, very slow.])],
1 by brian
clean slate
688
    [with_debug=$withval],
689
    [with_debug=no])
53.2.24 by Monty Taylor
Added an automake conditional to not build the dbug dir, since I don't want to keep seeing errors for it while cleaning up other parts of the tree.
690
AM_CONDITIONAL(BUILD_DBUG, test "$with_debug" != "no")
1 by brian
clean slate
691
if test "$with_debug" = "yes"
692
then
693
  # Medium debug.
694
  AC_DEFINE([DBUG_ON], [1], [Use libdbug])
7 by Brian Aker
Further cleanup on pthreads.
695
  CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC $CFLAGS"
696
  CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX $CXXFLAGS"
53.2.24 by Monty Taylor
Added an automake conditional to not build the dbug dir, since I don't want to keep seeing errors for it while cleaning up other parts of the tree.
697
  
1 by brian
clean slate
698
elif test "$with_debug" = "full"
699
then
700
  # Full debug. Very slow in some cases
701
  AC_DEFINE([DBUG_ON], [1], [Use libdbug])
7 by Brian Aker
Further cleanup on pthreads.
702
  CFLAGS="$DEBUG_CFLAGS $CFLAGS"
703
  CXXFLAGS="$DEBUG_CXXFLAGS $CXXFLAGS"
1 by brian
clean slate
704
else
705
  # Optimized version. No debug
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
706
  AC_DEFINE([DBUG_OFF], [1], [Dont use libdbug])
1 by brian
clean slate
707
  CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
708
  CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
709
fi
710
711
# If we should allow error injection tests
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
712
AC_ARG_WITH([error-inject],
713
    [AS_HELP_STRING([--with-error-inject],
91 by Brian Aker
Main binary now named drizzled
714
	    [Enable error injection in Drizzle Server @<:@default=off@:>@])],
1 by brian
clean slate
715
    [ with_error_inject=$withval ],
716
    [ with_error_inject=no ])
717
718
if test $with_debug != "no"
719
then
720
  if test "$with_error_inject" = "yes"
721
  then
722
    AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
91 by Brian Aker
Main binary now named drizzled
723
              [Enable error injection in Drizzle Server])
1 by brian
clean slate
724
  fi
725
fi
726
727
AC_ARG_WITH([fast-mutexes],
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
728
    [AS_HELP_STRING([--with-fast-mutexes],
729
	    [Compile with fast mutexes  @<:@default=off@:>@])],
730
    [with_fast_mutexes=$withval],
731
    [with_fast_mutexes=no])
1 by brian
clean slate
732
733
if test "$with_fast_mutexes" != "no"
734
then
735
  if test "$with_debug" != "no"
736
  then
737
    AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
738
  else
739
    AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1], 
740
	      [Define to 1 if you want to use fast mutexes])
741
  fi
742
fi
743
28.1.39 by Monty Taylor
Made everything use AS_HELP_STRING (except for charsets, which are dying anyway)
744
AC_ARG_WITH([comment],
745
    [AS_HELP_STRING([--with-comment],
746
            [Comment about compilation environment. @<:@default=off@:>@])],
1 by brian
clean slate
747
    [with_comment=$withval],
748
    [with_comment=no])
749
if test "$with_comment" != "no"
750
then
751
  COMPILATION_COMMENT=$with_comment
752
else
753
  COMPILATION_COMMENT="Source distribution"
754
fi
755
AC_SUBST(COMPILATION_COMMENT)
756
757
AC_MSG_CHECKING("need of special linking flags")
28.1.33 by Monty Taylor
Added -Wall
758
if test "$TARGET_LINUX" = "true" -a "$ac_cv_c_compiler_gnu" = "yes" -a "$all_is_static" != "yes"
1 by brian
clean slate
759
then
760
  LDFLAGS="$LDFLAGS -rdynamic"
761
  AC_MSG_RESULT("-rdynamic")
762
else
763
  case "$SYSTEM_TYPE$with_mysqld_ldflags " in
764
  *freebsd*"-all-static "*|*dragonfly*"-all-static "*)
765
    AC_MSG_RESULT("none")
766
    ;;
767
  *freebsd*|*dragonfly*)
768
    MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
769
    AC_MSG_RESULT("-export-dynamic")
770
    ;;
771
  *)
772
    AC_MSG_RESULT("none")
773
    ;;
774
  esac
775
fi
776
777
dnl Checks for typedefs, structures, and compiler characteristics.
778
AC_C_CONST
779
AC_C_INLINE
780
AC_TYPE_OFF_T
781
AC_HEADER_TIME
782
AC_STRUCT_TM
783
MYSQL_NEEDS_MYSYS_NEW
784
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
785
# type. We want a error instead.
786
AC_CHECK_SIZEOF(char, 1)
787
if test "$ac_cv_sizeof_char" -eq 0
788
then
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
789
  AC_MSG_ERROR([No size for char type.])
1 by brian
clean slate
790
fi
791
AC_CHECK_SIZEOF(char*, 4)
792
AC_CHECK_SIZEOF(short, 2)
793
AC_CHECK_SIZEOF(int, 4)
794
if test "$ac_cv_sizeof_int" -eq 0
795
then
796
  AC_MSG_ERROR("No size for int type.")
797
fi
798
AC_CHECK_SIZEOF(long, 4)
799
if test "$ac_cv_sizeof_long" -eq 0
800
then
801
  AC_MSG_ERROR("No size for long type.")
802
fi
803
AC_CHECK_SIZEOF(long long, 8)
804
if test "$ac_cv_sizeof_long_long" -eq 0
805
then
91 by Brian Aker
Main binary now named drizzled
806
  AC_MSG_ERROR("Drizzle needs a long long type.")
1 by brian
clean slate
807
fi
808
# off_t is not a builtin type
809
AC_CHECK_SIZEOF(off_t, 4)
810
if test "$ac_cv_sizeof_off_t" -eq 0
811
then
91 by Brian Aker
Main binary now named drizzled
812
  AC_MSG_ERROR("Drizzle needs a off_t type.")
1 by brian
clean slate
813
fi
814
815
dnl
816
dnl check if time_t is unsigned
817
dnl
818
819
MYSQL_CHECK_TIME_T
820
821
822
# do we need #pragma interface/#pragma implementation ?
823
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
824
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
825
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
826
# follow any standard), we'll use well-defined preprocessor macros:
28.1.33 by Monty Taylor
Added -Wall
827
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
1 by brian
clean slate
828
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
829
#error USE_PRAGMA_IMPLEMENTATION
830
#endif
28.1.33 by Monty Taylor
Added -Wall
831
]])],[AC_MSG_RESULT(no) ],[AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION"])
1 by brian
clean slate
832
833
# This always gives a warning. Ignore it unless you are cross compiling
834
AC_C_BIGENDIAN
835
#---START: Used in for client configure
836
# Check base type of last arg to accept
837
MYSQL_TYPE_ACCEPT
838
#---END:
839
# Figure out what type of struct rlimit to use with setrlimit
840
MYSQL_TYPE_STRUCT_RLIMIT
841
# Find where the stack goes
842
MYSQL_STACK_DIRECTION
843
# We want to skip alloca on irix unconditionally. It may work on some version..
844
MYSQL_FUNC_ALLOCA
845
# Do struct timespec have members tv_sec or ts_sec
846
MYSQL_TIMESPEC_TS
847
# Do we have the tzname variable
848
MYSQL_TZNAME
849
# Do the c++ compiler have a bool type
850
MYSQL_CXX_BOOL
851
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
852
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
853
AC_CHECK_TYPES([u_int32_t])
854
855
MYSQL_PTHREAD_YIELD
856
857
######################################################################
858
# For readline/libedit (We simply move the mimimum amount of stuff from
859
# the readline/libedit configure.in here)
860
861
dnl Checks for header files.
862
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
863
864
dnl Checks for library functions.
865
AC_FUNC_ALLOCA
866
AC_PROG_GCC_TRADITIONAL
867
AC_TYPE_SIGNAL
868
AC_CHECK_FUNCS(re_comp regcomp strdup)
869
870
dnl Sun compilers have their own vis.h that is about something
871
dnl totally different. So, not to change the libedit source, we
872
dnl do some additional checks before we define HAVE_VIS_H.
873
AC_CHECK_HEADER(vis.h,
874
  [AC_CHECK_FUNC(strvis,
875
    [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
876
877
AC_CHECK_FUNCS(strlcat strlcpy)
878
AC_CHECK_FUNCS(issetugid)
879
AC_CHECK_FUNCS(getline flockfile)
880
881
# from old readline settting:
882
883
MAKE_SHELL=/bin/sh
884
AC_SUBST(MAKE_SHELL)
885
886
# Already-done: stdlib.h string.h unistd.h termios.h
887
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
888
 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
889
 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
890
paths.h semaphore.h)
891
892
# Already-done: strcasecmp
893
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
894
28.1.33 by Monty Taylor
Added -Wall
895
AC_HEADER_STAT
1 by brian
clean slate
896
MYSQL_SIGNAL_CHECK
897
MYSQL_CHECK_GETPW_FUNCS
898
MYSQL_HAVE_TIOCGWINSZ
899
MYSQL_HAVE_FIONREAD
900
MYSQL_HAVE_TIOCSTAT
901
MYSQL_STRUCT_DIRENT_D_INO
902
MYSQL_STRUCT_DIRENT_D_NAMLEN
903
MYSQL_TYPE_SIGHANDLER
904
MYSQL_CHECK_MULTIBYTE
905
if test "$with_named_curses" = "no"
906
then
907
  MYSQL_CHECK_LIB_TERMCAP
908
else
909
  TERMCAP_LIB="$with_named_curses"
910
fi
911
AC_SUBST(TERMCAP_LIB)
912
913
# Check if the termcap function 'tgoto' is already declared in
914
# system header files or if it need to be declared locally
915
AC_CHECK_DECLS(tgoto,,,[
916
#ifdef HAVE_CURSES_H
917
# include <curses.h>
918
#elif HAVE_NCURSES_H
919
# include <ncurses.h>
920
#endif
921
#ifdef HAVE_TERM_H
922
# include <term.h>
923
#endif
924
])
925
926
# End of readline/libedit stuff
927
#########################################################################
928
929
dnl Checks for library functions.
930
931
#
932
# The following code disables intrinsic function support while we test for
933
# library functions.  This is to avoid configure problems with Intel ecc
934
# compiler
935
936
ORG_CFLAGS="$CFLAGS"
937
if test "$GCC" != "yes"; then
938
  AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
939
fi
940
941
#AC_FUNC_MMAP
942
AC_TYPE_SIGNAL
943
MYSQL_TYPE_QSORT
944
AC_FUNC_UTIME_NULL
945
AC_FUNC_VPRINTF
946
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
947
AC_CHECK_FUNCS(fcntl)
948
if test "x$ac_cv_func_fcntl" != "xyes"
949
then
950
  AC_MSG_ERROR("Drizzle requires fcntl.")
951
fi
952
53.2.16 by Monty Taylor
Removed my_alarm. Made my_lock only do the non-alarm version. Moved my_lock to MyISAM where it belongs.
953
AC_CHECK_FUNCS(bcmp bfill bmove bsearch bzero \
77.1.24 by Monty Taylor
Removed non-fcntl code and made it a fatal configure error if it's not there.
954
  cuserid fchmod \
77.1.22 by Monty Taylor
Removed refs to floatingpoint.h (which we only used for fconvert) and fconvert
955
  fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
1 by brian
clean slate
956
  getcwd getpass getpassphrase getpwnam \
957
  getpwuid getrlimit getrusage getwd index initgroups isnan \
958
  localtime_r gethrtime gmtime_r \
959
  locking longjmp lrand48 madvise mallinfo memcpy memmove \
960
  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
961
  pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
962
  pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
963
  pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
964
  pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
965
  realpath rename rint rwlock_init setupterm \
966
  shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
967
  sighold sigset sigthreadmask port_create sleep \
968
  snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
6 by Brian Aker
Second pass on pthread cleanup
969
  strtol strtoll strtoul strtoull tell tempnam vidattr \
1 by brian
clean slate
970
  posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
971
28.1.33 by Monty Taylor
Added -Wall
972
# Check that isinf() is available in math.h and can be used in both C and C++
1 by brian
clean slate
973
# code
28.1.33 by Monty Taylor
Added -Wall
974
AC_MSG_CHECKING(for isinf in math.h)
975
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
976
    float f = 0.0; 
977
    int r = isinf(f); 
978
    return r;
979
  ]])],[
1 by brian
clean slate
980
    AC_MSG_RESULT(yes)
28.1.33 by Monty Taylor
Added -Wall
981
    AC_MSG_CHECKING(whether isinf() can be used in C++ code)
982
    AC_LANG_PUSH([C++])
983
    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
984
      float f = 0.0;
985
      int r = isinf(f);
986
      return r;
987
    ]])],[
988
      AC_MSG_RESULT(yes)
989
      AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function])
990
    ],[
991
      AC_MSG_RESULT(no)
992
    ])
993
    AC_LANG_POP([])
994
  ],[
995
  AC_MSG_RESULT(no)])
996
997
1 by brian
clean slate
998
CFLAGS="$ORG_CFLAGS"
999
1000
# Sanity check: We chould not have any fseeko symbol unless
1001
# large_file_support=yes
1002
AC_CHECK_FUNC(fseeko,
1003
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
1004
then
1005
  AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
1006
fi]
1007
)
1008
1009
# Check definition of pthread_getspecific
1010
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
28.1.33 by Monty Taylor
Added -Wall
1011
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(_REENTRANT)
1 by brian
clean slate
1012
#define _REENTRANT
1013
#endif
1014
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1015
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
1016
pthread_getspecific((pthread_key_t) NULL); ]])],[mysql_cv_getspecific_args=POSIX],[mysql_cv_getspecific_args=other]))
1 by brian
clean slate
1017
  if test "$mysql_cv_getspecific_args" = "other"
1018
  then
1019
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1020
              [For some non posix threads])
1021
  fi
1022
1023
  # Check definition of pthread_mutex_init
1024
  AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
28.1.33 by Monty Taylor
Added -Wall
1025
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1026
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1027
#include <pthread.h> ]], [[ 
1 by brian
clean slate
1028
  pthread_mutexattr_t attr;
1029
  pthread_mutex_t mp;
28.1.33 by Monty Taylor
Added -Wall
1030
  pthread_mutex_init(&mp,&attr); ]])],[mysql_cv_mutex_init_args=POSIX],[mysql_cv_mutex_init_args=other]))
1 by brian
clean slate
1031
  if test "$mysql_cv_mutex_init_args" = "other"
1032
  then
1033
    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1034
              [For some non posix threads])
1035
  fi
1036
#---END:
1037
1038
#---START: Used in for client configure
1039
# Check definition of readdir_r
1040
AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
28.1.33 by Monty Taylor
Added -Wall
1041
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1042
#define _POSIX_PTHREAD_SEMANTICS 
1043
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1044
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1045
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],[mysql_cv_readdir_r=POSIX],[mysql_cv_readdir_r=other]))
1 by brian
clean slate
1046
if test "$mysql_cv_readdir_r" = "POSIX"
1047
then
1048
  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1049
fi
1050
1051
# Check definition of posix sigwait()
1052
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
28.1.33 by Monty Taylor
Added -Wall
1053
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1054
#define _POSIX_PTHREAD_SEMANTICS 
1055
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1056
#include <signal.h>]], [[#ifndef _AIX
1 by brian
clean slate
1057
sigset_t set;
1058
int sig;
1059
sigwait(&set,&sig);
28.1.33 by Monty Taylor
Added -Wall
1060
#endif]])],[mysql_cv_sigwait=POSIX],[mysql_cv_sigwait=other]))
1 by brian
clean slate
1061
if test "$mysql_cv_sigwait" = "POSIX"
1062
then
1063
  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1064
fi
1065
1066
if test "$mysql_cv_sigwait" != "POSIX"
1067
then
1068
unset mysql_cv_sigwait
1069
# Check definition of posix sigwait()
1070
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
28.1.33 by Monty Taylor
Added -Wall
1071
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1072
#define _POSIX_PTHREAD_SEMANTICS 
1073
#include <pthread.h>
28.1.33 by Monty Taylor
Added -Wall
1074
#include <signal.h>]], [[sigset_t set;
1 by brian
clean slate
1075
int sig;
28.1.33 by Monty Taylor
Added -Wall
1076
sigwait(&set);]])],[mysql_cv_sigwait=NONPOSIX],[mysql_cv_sigwait=other]))
1 by brian
clean slate
1077
if test "$mysql_cv_sigwait" = "NONPOSIX"
1078
then
1079
  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1080
fi
1081
fi
1082
#---END:
1083
1084
# Check if pthread_attr_setscope() exists
1085
AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
28.1.33 by Monty Taylor
Added -Wall
1086
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1 by brian
clean slate
1087
#define _POSIX_PTHREAD_SEMANTICS 
28.1.33 by Monty Taylor
Added -Wall
1088
#include <pthread.h>]], [[pthread_attr_t thr_attr;
1089
pthread_attr_setscope(&thr_attr,0);]])],[mysql_cv_pthread_attr_setscope=yes],[mysql_cv_pthread_attr_setscope=no]))
1 by brian
clean slate
1090
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1091
then
1092
  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1093
fi
1094
1095
# Check for bad includes
1096
AC_MSG_CHECKING("can netinet files be included")
28.1.33 by Monty Taylor
Added -Wall
1097
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1 by brian
clean slate
1098
#include <sys/socket.h>
1099
#include <netinet/in_systm.h>
1100
#include <netinet/in.h>
1101
#include <netinet/ip.h>
28.1.33 by Monty Taylor
Added -Wall
1102
#include <netinet/tcp.h>]], [[ printf("1\n"); ]])],[netinet_inc=yes],[netinet_inc=no])
1 by brian
clean slate
1103
if test "$netinet_inc" = "no"
1104
then
1105
  AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1106
fi
1107
AC_MSG_RESULT("$netinet_inc")
1108
28.1.33 by Monty Taylor
Added -Wall
1109
AC_LANG_PUSH([C++])
1 by brian
clean slate
1110
AC_CHECK_HEADERS(cxxabi.h)
1111
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
28.1.33 by Monty Taylor
Added -Wall
1112
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1 by brian
clean slate
1113
  char *foo= 0; int bar= 0;
1114
  foo= abi::__cxa_demangle(foo, foo, 0, &bar);
28.1.33 by Monty Taylor
Added -Wall
1115
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1116
AC_LANG_POP([])
1 by brian
clean slate
1117
1118
if test "x$mysql_cv_cxa_demangle" = xyes; then
1119
  AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1120
            [Define to 1 if you have the `abi::__cxa_demangle' function.])
1121
fi
1122
1123
#--------------------------------------------------------------------
1124
# Check for requested features
1125
#--------------------------------------------------------------------
1126
1127
MYSQL_CHECK_BIG_TABLES
1128
MYSQL_CHECK_MAX_INDEXES
1129
MYSQL_CHECK_VIO
1130
1131
#--------------------------------------------------------------------
1132
# Declare our plugin modules
1133
# Has to be done late, as the plugin may need to check for existence of
1134
# functions tested above
1135
#--------------------------------------------------------------------
1136
1137
MYSQL_CONFIGURE_PLUGINS([none])
1138
1139
AC_SUBST(CLIENT_LIBS)
1140
1141
AC_SUBST(mysql_plugin_dirs)
1142
AC_SUBST(mysql_plugin_libs)
1143
AC_SUBST(mysql_plugin_defs)
1144
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1145
AC_ARG_ENABLE([pedantic-warnings],
1146
    [AS_HELP_STRING([--disable-pedantic-warnings],
1147
       [Toggle pedanticness @<:@default=on@:>@])],
1148
    [ac_warn_pedantic="$enableval"],
1149
    [ac_warn_pedantic="yes"])
1150
1151
AC_ARG_ENABLE([fail],
1152
    [AS_HELP_STRING([--enable-fail],
1153
       [Turn warnings into failures @<:@default=off@:>@])],
1154
    [ac_warn_fail="$enableval"],
1155
    [ac_warn_fail="no"])
1156
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1157
AC_ARG_ENABLE([unreachable],
1158
    [AS_HELP_STRING([--enable-unreachable],
1159
       [Enable warnings about unreachable code @<:@default=off@:>@])],
1160
    [ac_warn_unreachable="$enableval"],
1161
    [ac_warn_unreachable="no"])
1162
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1163
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1164
if test "$GCC" = "yes"
1165
then
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1166
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1167
  GCC_WARNINGS="-W -Wall"
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1168
  GXX_WARNINGS="${GCC_WARNINGS}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1169
1170
1171
  if test "$ac_warn_pedantic" = "yes"
1172
  then
53.2.4 by Monty Taylor
Changes so that client/ builds cleanly with no warnings.
1173
    GCC_WARNINGS="${GCC_WARNINGS}  -std=gnu99 -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls  "
77.1.25 by Monty Taylor
Merged from trunk.
1174
    GXX_WARNINGS="${GXX_WARNINGS}  -std=gnu++98 -pedantic -Wundef -Wredundant-decls -Wno-long-long "
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1175
  fi
1176
53.2.6 by Monty Taylor
Turned unreachable code warnings into a configure option.
1177
  if test "$ac_warn_unreachable" = "yes"
1178
  then
1179
    GCC_WARNINGS="${GCC_WARNINGS} -Wunreachable-code"
1180
    GXX_WARNINGS="${GXX_WARNINGS} -Wunreachable-code"
1181
  fi
1182
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1183
  if test "$ac_warn_fail" = "yes"
1184
  then
1185
    GCC_WARNINGS="${GCC_WARNINGS} -Werror"
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1186
    GXX_WARNINGS="${GXX_WARNINGS} -Werror"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1187
  fi
1188
53.2.2 by Monty Taylor
Updated everything that needs updating to compile with -std=gnu99 -pedantic
1189
    CXXFLAGS="$CXXFLAGS ${GXX_WARNINGS}"
53.2.1 by Monty Taylor
Added --disable-pedantic-warnings and --enable-fail.
1190
    CFLAGS="$CFLAGS ${GCC_WARNINGS} "
1191
fi
1192
1 by brian
clean slate
1193
# Some usefull subst
1194
AC_SUBST(CC)
1195
AC_SUBST(GXX)
1196
1197
# Set configuration options for make_binary_distribution
1198
case $SYSTEM_TYPE in
1199
  *netware*)
1200
    MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1201
    ;;
1202
  *)
1203
    : # no change for other platforms yet
1204
    ;;
1205
esac
1206
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1207
28.1.2 by Monty Taylor
First stab at back porting libtool convenience lib patch from telco-6.2
1208
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile mysys/tests/Makefile dnl
77.1.31 by Monty Taylor
Replaced regex lib with pcre. Reworked mysqltest to use it.
1209
 strings/Makefile strings/tests/Makefile storage/Makefile dnl
13 by brian
Incomming patch to clean up build.
1210
 vio/Makefile dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1211
 libdrizzle/Makefile client/Makefile dnl
1 by brian
clean slate
1212
 sql/Makefile sql/share/Makefile dnl
1213
 sql/sql_builtin.cc sql-common/Makefile dnl
77.1.28 by Monty Taylor
Removed a crapload of files I hate.
1214
 dbug/Makefile include/Makefile dnl
28.1.31 by Monty Taylor
Deleted tons of pointless garbage from scripts.
1215
 support-files/Makefile dnl
77.1.40 by Monty Taylor
More naming changes.
1216
 test/Makefile test/install_test_db dnl
77.1.39 by Monty Taylor
More mysql->drizzle renaming.
1217
 include/drizzle_version.h plugin/Makefile dnl
77.1.38 by Monty Taylor
Renamed more stuff to drizzle.
1218
 sql/drizzled_safe support-files/libdrizzle.pc dnl
1219
 support-files/drizzle.server support-files/drizzle-log-rotate)
1 by brian
clean slate
1220
1221
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1222
1223
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
1224
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
1225
1226
AC_OUTPUT