2
dnl Process this file with autoconf to produce a configure script.
4
AC_PREREQ(2.52)dnl Minimum Autoconf version required.
8
# The Docs Makefile.am parses this line!
9
# remember to also update version.c in ndb
10
# When changing major version number please also check switch statement
11
# in mysqlbinlog::check_master_version().
12
AM_INIT_AUTOMAKE(mysql, 6.0.6-alpha)
13
AM_CONFIG_HEADER([include/config.h:config.h.in])
17
# See the libtool docs for information on how to do shared lib versions.
18
SHARED_LIB_MAJOR_VERSION=16
19
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
23
# Set all version vars based on $VERSION. How do we do this more elegant ?
24
# Remember that regexps needs to quote [ and ] since this is run through m4
25
# We take some made up examples
27
# VERSION 5.1.40sp1-alpha 5.0.34a
28
# MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a
29
# MYSQL_NUMERIC_VERSION 5.1.40 5.0.34
30
# MYSQL_BASE_VERSION 5.1 5.0
31
# MYSQL_VERSION_ID 50140 50034
33
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
34
MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
35
MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
36
MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
37
awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
39
# Add previous major version for debian package upgrade path
40
MYSQL_PREVIOUS_BASE_VERSION=5.1
42
# The port should be constant for a LONG time
43
MYSQL_TCP_PORT_DEFAULT=3306
44
MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
47
sinclude(config/ac-macros/alloca.m4)
48
sinclude(config/ac-macros/check_cpu.m4)
49
sinclude(config/ac-macros/character_sets.m4)
50
sinclude(config/ac-macros/compiler_flag.m4)
51
sinclude(config/ac-macros/dtrace.m4)
52
sinclude(config/ac-macros/plugins.m4)
53
sinclude(config/ac-macros/large_file.m4)
54
sinclude(config/ac-macros/misc.m4)
55
sinclude(config/ac-macros/readline.m4)
56
sinclude(config/ac-macros/ssl.m4)
58
# Remember to add a directory sql/share/LANGUAGE
59
AVAILABLE_LANGUAGES="\
60
czech danish dutch english estonian french german greek hungarian \
61
italian japanese korean norwegian norwegian-ny polish portuguese \
62
romanian russian serbian slovak spanish swedish ukrainian"
67
AC_SUBST(MYSQL_NO_DASH_VERSION)
68
AC_SUBST(MYSQL_BASE_VERSION)
69
AC_SUBST(MYSQL_VERSION_ID)
70
AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
71
AC_SUBST(PROTOCOL_VERSION)
72
AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
73
[mysql client protocol version])
74
AC_SUBST(DOT_FRM_VERSION)
75
AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
76
[Version of .frm files])
77
AC_SUBST(SHARED_LIB_MAJOR_VERSION)
78
AC_SUBST(SHARED_LIB_VERSION)
79
AC_SUBST(AVAILABLE_LANGUAGES)
82
# Canonicalize the configuration name.
84
# Check whether --with-system-type or --without-system-type was given.
85
AC_ARG_WITH(system-type,
86
[ --with-system-type Set the system type, like "sun-solaris10"],
87
[SYSTEM_TYPE="$withval"],
88
[SYSTEM_TYPE="$host_vendor-$host_os"])
89
AC_ARG_WITH(machine-type,
90
[ --with-machine-type Set the machine type, like "powerpc"],
91
[MACHINE_TYPE="$withval"],
92
[MACHINE_TYPE="$host_cpu"])
94
AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
95
[Name of system, eg sun-solaris])
96
AC_SUBST(MACHINE_TYPE)
97
AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
98
[Machine type name, eg sparc])
100
# Detect intel x86 like processor
101
BASE_MACHINE_TYPE=$MACHINE_TYPE
102
case $MACHINE_TYPE in
103
i?86) BASE_MACHINE_TYPE=i386 ;;
106
# Save some variables and the command line options for mysqlbug
109
SAVE_ASFLAGS="$ASFLAGS"
110
SAVE_CFLAGS="$CFLAGS"
111
SAVE_CXXFLAGS="$CXXFLAGS"
112
SAVE_LDFLAGS="$LDFLAGS"
113
SAVE_CXXLDFLAGS="$CXXLDFLAGS"
114
CONF_COMMAND="$0 $ac_configure_args"
115
AC_SUBST(CONF_COMMAND)
118
AC_SUBST(SAVE_ASFLAGS)
119
AC_SUBST(SAVE_CFLAGS)
120
AC_SUBST(SAVE_CXXFLAGS)
121
AC_SUBST(SAVE_LDFLAGS)
122
AC_SUBST(SAVE_CXXLDFLAGS)
125
#AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE
128
# This is needed is SUBDIRS is set
131
##############################################################################
132
# The below section needs to be done before AC_PROG_CC
133
##############################################################################
135
if test "x${CFLAGS-}" = x ; then
141
if test "x${CPPFLAGS-}" = x ; then
147
if test "x${LDFLAGS-}" = x ; then
153
################ End of section to be done before AC_PROG_CC #################
155
# The following hack should ensure that configure doesn't add optimizing
156
# or debugging flags to CFLAGS or CXXFLAGS
157
# C_EXTRA_FLAGS are flags that are automaticly added to both
158
# CFLAGS and CXXFLAGS
159
CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
160
CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
162
dnl Checks for programs.
169
# Print version of CC and CXX compiler (if they support --version)
172
CC_VERSION=`$CC -version | grep -i version`
175
CC_VERSION=`$CC --version | sed 1q`
180
AC_MSG_CHECKING("C Compiler version")
181
AC_MSG_RESULT("$CC $CC_VERSION")
186
MYSQL_CHECK_CXX_VERSION
188
if test "$ac_cv_prog_gcc" = "yes"
193
AC_PATH_PROG(AS, as, as)
196
# Still need ranlib for readline; local static use only so no libtool.
199
#AC_LIBTOOL_WIN32_DLL
202
# Ensure that we have --preserve-dup-deps defines, otherwise we get link
203
# problems of 'mysql' with CXX=g++
204
LIBTOOL="$LIBTOOL --preserve-dup-deps"
210
#archive_expsym_cmds= `echo "$archive_expsym_cmds" | sed -e '/"$(CC)"//'`
211
#archive_expsym_cmds= "$CC -q64 $archive_expsym_cmds"
212
# CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
214
#AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC
218
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
220
# Not critical since the generated file is distributed
221
AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
223
#check the return type of sprintf
224
AC_MSG_CHECKING("return type of sprintf")
230
if((int)sprintf(buf, s) == strlen(s))
236
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
237
AC_MSG_RESULT("int")],
243
if((char*)sprintf(buf,s) == buf + strlen(s))
247
[AC_DEFINE(SPRINTF_RETURNS_PTR, [1], [Broken sprintf])
248
AC_MSG_RESULT("ptr")],
249
[AC_DEFINE(SPRINTF_RETURNS_GARBAGE, [1], [Broken sprintf])
250
AC_MSG_RESULT("garbage")]
252
# Cross compile, assume POSIX
253
[AC_DEFINE(SPRINTF_RETURNS_INT, [1], [POSIX sprintf])
254
AC_MSG_RESULT("int (we assume)")]
257
AC_PATH_PROG(uname_prog, uname, no)
259
# We should go through this and put all the explictly system dependent
261
AC_MSG_CHECKING(operating system)
262
AC_CACHE_VAL(mysql_cv_sys_os,
264
if test "$uname_prog" != "no"; then
265
mysql_cv_sys_os="`uname`"
267
mysql_cv_sys_os="Not Solaris"
270
AC_MSG_RESULT($mysql_cv_sys_os)
272
# This should be rewritten to use $target_os
275
TARGET_SOLARIS="true"
276
AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
277
AC_SUBST(TARGET_SOLARIS)
281
# The following is required for portable results of floating point calculations
282
# on PowerPC. The same must also be done for IA-64, but this options is missing
283
# in the IA-64 gcc backend.
285
if test "$GCC" = "yes"
289
CFLAGS="$CFLAGS -mno-fused-madd"
290
CXXFLAGS="$CXXFLAGS -mno-fused-madd"
301
AC_SUBST(INSTALL_SCRIPT)
303
export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
305
if test "$GCC" = "yes"
307
# mysqld requires -fno-implicit-templates.
308
# Disable exceptions as they seams to create problems with gcc and threads.
309
# mysqld doesn't use run-time-type-checking, so we disable it.
310
# We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
311
# regarding offset() usage in C++ which are done in a safe manner in the
313
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
314
AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
315
[1], [Defined by configure. Use explicit template instantiation.])
320
# libmysqlclient versioning when linked with GNU ld.
321
if $LD --version 2>/dev/null|grep -q GNU; then
322
LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
323
AC_CONFIG_FILES(libmysql/libmysql.ver)
325
AC_SUBST(LD_VERSION_SCRIPT)
328
# Avoid bug in fcntl on some versions of linux
329
AC_MSG_CHECKING([if we should use 'skip-external-locking' as default for $target_os])
330
# Any variation of Linux
331
if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
333
MYSQLD_DEFAULT_SWITCHES="--skip-external-locking"
336
AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
338
MYSQLD_DEFAULT_SWITCHES=""
342
AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
343
AC_SUBST(TARGET_LINUX)
345
dnl Find paths to some shell programs
346
AC_PATH_PROG(LN, ln, ln)
347
# This must be able to take a -f flag like normal unix ln.
348
AC_PATH_PROG(LN_CP_F, ln, ln)
350
AC_PATH_PROG(MV, mv, mv)
351
AC_PATH_PROG(RM, rm, rm)
352
AC_PATH_PROG(CP, cp, cp)
353
AC_PATH_PROG(SED, sed, sed)
354
AC_PATH_PROG(CMP, cmp, cmp)
355
AC_PATH_PROG(CHMOD, chmod, chmod)
356
AC_PATH_PROG(HOSTNAME, hostname, hostname)
357
# Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
358
# fall back to 'tar' otherwise and hope that it's a GNU tar as well
359
AC_CHECK_PROGS(TAR, gnutar gtar tar)
361
dnl We use a path for perl so the script startup works
362
dnl We make sure to use perl, not perl5, in hopes that the RPMs will
363
dnl not depend on the perl5 binary being installed (probably a bug in RPM)
364
AC_PATH_PROG(PERL, perl, no)
365
if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
369
AC_PATH_PROG(PERL5, perl5, no)
370
if test "$PERL5" != no
373
ac_cv_path_PERL=$ac_cv_path_PERL5
381
# icheck, used for ABI check
382
AC_PATH_PROG(ICHECK, icheck, no)
383
# "icheck" is also the name of a file system check program on Tru64.
384
# Verify the program found is really the interface checker.
385
if test "x$ICHECK" != "xno"
387
AC_MSG_CHECKING(if $ICHECK works as expected)
388
echo "int foo;" > conftest.h
389
$ICHECK --canonify -o conftest.ic conftest.h 2>/dev/null
390
if test -f "conftest.ic"
397
rm -f conftest.ic conftest.h
402
AC_PATH_PROG(PS, ps, ps)
403
AC_MSG_CHECKING("how to check if pid exists")
406
if $PS p $$ 2> /dev/null | grep `echo $0 | sed s/\-//` > /dev/null
408
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
410
elif $PS -fp $$ 2> /dev/null | grep $0 > /dev/null
412
FIND_PROC="$PS -p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
414
elif $PS -uaxww 2> /dev/null | grep $0 > /dev/null
416
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
418
elif $PS -ef 2> /dev/null | grep $0 > /dev/null
420
FIND_PROC="$PS -ef | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
421
# Do anybody use this?
422
elif $PS $$ 2> /dev/null | grep $0 > /dev/null
424
FIND_PROC="$PS \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
427
*freebsd*|*dragonfly*)
428
FIND_PROC="$PS p \$\$PID | grep -v grep | grep \$\$MYSQLD > /dev/null"
431
FIND_PROC="$PS -uaxww | grep -v grep | grep \$\$MYSQLD | grep \" \$\$PID \" > /dev/null"
434
AC_MSG_ERROR([Could not find the right ps switches. Which OS is this ?. See the Installation chapter in the Reference Manual.])
438
AC_MSG_RESULT("$FIND_PROC")
440
# Check if a pid is valid
441
AC_PATH_PROG(KILL, kill, kill)
442
AC_MSG_CHECKING("for kill switches")
443
if $ac_cv_path_KILL -0 $$
445
CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
448
CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
450
AC_MSG_WARN([kill -0 to check for pid seems to fail])
451
CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
454
AC_MSG_RESULT("$CHECK_PID")
456
# We need an ANSI C compiler
459
# We need an assembler, too
461
CCASFLAGS="$CCASFLAGS $ASFLAGS"
463
# Check if we need noexec stack for assembler
466
if test "$am_cv_prog_cc_stdc" = "no"
468
AC_MSG_ERROR([MySQL requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
471
NOINST_LDFLAGS="-static"
476
AC_ARG_WITH(other-libc,
477
[ --with-other-libc=DIR Link against libc and other standard libraries
478
installed in the specified non-standard location
479
overriding default. Originally added to be able to
480
link against glibc 2.2 without making the user
481
upgrade the standard libc installation.],
483
other_libc_include="$withval/include"
484
other_libc_lib="$withval/lib"
485
with_other_libc="yes"
488
CFLAGS="$CFLAGS -I$other_libc_include"
489
# There seems to be a feature in gcc that treats system and libc headers
490
# silently when they violatate ANSI C++ standard, but it is strict otherwise
491
# since gcc cannot now recognize that our headers are libc, we work around
492
# by telling it to be permissive. Note that this option only works with
493
# new versions of gcc (2.95.x and above)
494
CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include"
495
if test -f "$other_libc_lib/libnss_files.a"
497
# libc has been compiled with --enable-static-nss
498
# we need special flags, but we will have to add those later
499
STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
500
STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
501
OTHER_LIBC_LIB="-static -L$other_libc_lib"
504
# this is a dirty hack. We if we detect static nss glibc in the special
505
# location, we do not re-direct the linker to get libraries from there
506
# during check. The reason is that if we did, we would have to find a
507
# way to append the special static nss flags to LIBS every time we do
508
# any check - this is definitely feasible, but not worthwhile the risk
509
# of breaking other things. So for our purposes it would be sufficient
510
# to assume that whoever is using static NSS knows what he is doing and
511
# has sensible libraries in the regular location
512
LDFLAGS="$LDFLAGS -static -L$other_libc_lib "
515
# When linking against custom libc installed separately, we want to force
516
# all binary builds to be static, including the build done by configure
517
# itself to test for system features.
518
with_mysqld_ldflags="-all-static"
519
with_client_ldflags="-all-static"
520
NOINST_LDFLAGS="-all-static"
528
AC_SUBST(NOINST_LDFLAGS)
531
# Check if we are using Linux and a glibc compiled with static nss
532
# (this is true on the MySQL build machines to avoid NSS problems)
535
if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
537
tmp=`nm /usr/lib*/libc.a | grep _nss_files_getaliasent_r`
540
STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
541
STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
546
AC_ARG_WITH(server-suffix,
547
[ --with-server-suffix Append value to the version string.],
548
[ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ],
549
[ MYSQL_SERVER_SUFFIX= ]
551
AC_SUBST(MYSQL_SERVER_SUFFIX)
553
# Set flags if we want to force to use pthreads
555
[ --with-pthread Force use of pthread library.],
556
[ with_pthread=$withval ],
560
# Force use of thread libs LIBS
561
AC_ARG_WITH(named-thread-libs,
562
[ --with-named-thread-libs=ARG
563
Use specified thread libraries instead of
564
those automatically found by configure.],
565
[ with_named_thread=$withval ],
566
[ with_named_thread=no ]
569
# Force use of a curses libs
570
AC_ARG_WITH(named-curses-libs,
571
[ --with-named-curses-libs=ARG
572
Use specified curses libraries instead of
573
those automatically found by configure.],
574
[ with_named_curses=$withval ],
575
[ with_named_curses=no ]
578
# Make thread safe client
579
AC_ARG_ENABLE(thread-safe-client,
580
[ --disable-thread-safe-client
581
Compile the client without threads.],
582
[ THREAD_SAFE_CLIENT=$enableval ],
583
[ THREAD_SAFE_CLIENT=yes ]
586
# compile with strings functions in assembler
587
AC_ARG_ENABLE(assembler,
588
[ --enable-assembler Use assembler versions of some string
589
functions if available.],
590
[ ENABLE_ASSEMBLER=$enableval ],
591
[ ENABLE_ASSEMBLER=no ]
594
AC_MSG_CHECKING(if we should use assembler functions)
595
# For now we only support assembler on i386 and sparc systems
596
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;))
597
AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
598
AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
599
AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
601
if test "$ASSEMBLER_TRUE" = ""
609
AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
610
AC_ARG_ENABLE(profiling,
611
AS_HELP_STRING([--enable-profiling], [Build a version with query profiling code (req. community-features)]),
612
[ ENABLED_PROFILING=$enableval ],
613
[ ENABLED_PROFILING=no ])
615
if test "$ENABLED_PROFILING" = "yes"
617
AC_DEFINE([ENABLED_PROFILING], [1],
618
[If SHOW PROFILE should be enabled])
624
AC_ARG_WITH(tcp-port,
625
[ --with-tcp-port=port-number
626
Which port to use for MySQL services (default 3306)],
627
[ MYSQL_TCP_PORT=$withval ],
628
[ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT
629
# if we actually defaulted (as opposed to the pathological case of
630
# --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
631
# happen if whole batch of servers was built from a script), set
632
# the default to zero to indicate that; we don't lose information
633
# that way, because 0 obviously indicates that we can get the
634
# default value from MYSQL_TCP_PORT. this seems really evil, but
635
# testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
636
# a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
637
# intend it to mean "use the default, in fact, look up a good default
638
# from /etc/services if you can", but really, really meant 3306 when
639
# they passed in 3306. When they pass in a specific value, let them
640
# have it; don't second guess user and think we know better, this will
641
# just make people cross. this makes the the logic work like this
642
# (which is complicated enough):
644
# - if a port was set during build, use that as a default.
646
# - otherwise, try to look up a port in /etc/services; if that fails,
647
# use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
649
# - allow the MYSQL_TCP_PORT environment variable to override that.
651
# - allow command-line parameters to override all of the above.
653
# the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
654
# so don't mess with that.
655
MYSQL_TCP_PORT_DEFAULT=0 ]
657
AC_SUBST(MYSQL_TCP_PORT)
658
# We might want to document the assigned port in the manual.
659
AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
661
# Use this to set the place used for unix socket used to local communication.
662
AC_ARG_WITH(mysqld-user,
663
[ --with-mysqld-user=username
664
What user the mysqld daemon shall be run as.],
665
[ MYSQLD_USER=$withval ],
666
[ MYSQLD_USER=mysql ]
668
AC_SUBST(MYSQLD_USER)
670
# If we should allow LOAD DATA LOCAL
671
AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
672
AC_ARG_ENABLE(local-infile,
673
[ --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)],
674
[ ENABLED_LOCAL_INFILE=$enableval ],
675
[ ENABLED_LOCAL_INFILE=no ]
677
if test "$ENABLED_LOCAL_INFILE" = "yes"
680
AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
681
[If LOAD DATA LOCAL INFILE should be enabled by default])
686
# If we should allow init-file, skip-grant-table and bootstrap options
687
AC_MSG_CHECKING(If we should should enable init-file, skip-grant-table options and bootstrap)
688
AC_ARG_ENABLE(grant-options,
689
[ --disable-grant-options Disables the use of --init-file, --skip-grant-tables and --bootstrap options],
690
[ mysql_grant_options_enabled=$enableval ],
691
[ mysql_grant_options_enabled=yes ]
693
if test "$mysql_grant_options_enabled" = "yes"
697
AC_DEFINE([DISABLE_GRANT_OPTIONS], [1],
698
[Disables the use of --init-file, --skip-grant-tables and --bootstrap options])
704
# Types that must be checked AFTER large file support is checked
707
#--------------------------------------------------------------------
708
# Check for system header files
709
#--------------------------------------------------------------------
714
AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h fpu_control.h ieeefp.h \
715
limits.h memory.h pwd.h select.h \
716
stdlib.h stddef.h sys/fpu.h \
717
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
718
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
719
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
720
sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
721
sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h \
724
AC_CHECK_HEADERS([xfs/xfs.h])
726
#--------------------------------------------------------------------
727
# Check for system libraries. Adds the library to $LIBS
728
# and defines HAVE_LIBM etc
729
#--------------------------------------------------------------------
731
AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
734
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
735
AC_CHECK_FUNC(yp_get_default_domain, ,
736
AC_CHECK_LIB(nsl, yp_get_default_domain))
737
AC_CHECK_FUNC(p2open, , AC_CHECK_LIB(gen, p2open))
738
# This may get things to compile even if bind-8 is installed
739
AC_CHECK_FUNC(bind, , AC_CHECK_LIB(bind, bind))
740
# Check if crypt() exists in libc or libcrypt, sets LIBS if needed
741
AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
743
# Check rt for aio_read
744
AC_CHECK_LIB(rt, aio_read)
746
# For the sched_yield() function on Solaris
747
AC_CHECK_FUNC(sched_yield, , AC_CHECK_LIB(posix4, sched_yield,
748
[AC_DEFINE(HAVE_SCHED_YIELD) LIBS="$LIBS -lposix4"]))
750
# For large pages support
751
if test "$TARGET_LINUX" = "true"
753
# For SHM_HUGETLB on Linux
754
AC_CHECK_DECLS(SHM_HUGETLB,
755
AC_DEFINE([HAVE_LARGE_PAGES], [1],
756
[Define if you have large pages support])
757
AC_DEFINE([HUGETLB_USE_PROC_MEMINFO], [1],
758
[Define if /proc/meminfo shows the huge page size (Linux only)])
766
#--------------------------------------------------------------------
767
# Check for TCP wrapper support
768
#--------------------------------------------------------------------
770
if test "$TARGET_LINUX" = "true"; then
772
[ --with-pstack Use the pstack backtrace library],
773
[ USE_PSTACK=$withval ],
777
if test "$USE_PSTACK" = yes -a "$TARGET_LINUX" = "true" -a "$BASE_MACHINE_TYPE" = "i386"
779
have_libiberty= have_libbfd=
781
dnl I have no idea if this is a good test - can not find docs for libiberty
782
AC_CHECK_LIB([iberty], [fdmatch],
784
AC_CHECK_LIB([bfd], [bfd_openr], [have_libbfd=yes], , [-liberty])])
787
if test x"$have_libiberty" = xyes -a x"$have_libbfd" = xyes
790
pstack_libs="../pstack/libpstack.a -lbfd -liberty"
791
# We must link staticly when using pstack
792
with_mysqld_ldflags="-all-static"
793
AC_SUBST([pstack_dir])
794
AC_SUBST([pstack_libs])
795
AC_DEFINE([USE_PSTACK], [1], [the pstack backtrace library])
796
dnl This check isn't needed, but might be nice to give some feedback....
797
dnl AC_CHECK_HEADER(libiberty.h,
798
dnl have_libiberty_h=yes,
799
dnl have_libiberty_h=no)
807
AC_MSG_CHECKING([if we should use pstack])
808
AC_MSG_RESULT([$USE_PSTACK])
810
# Check for gtty if termio.h doesn't exists
811
if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
813
AC_CHECK_FUNC(gtty, , AC_CHECK_LIB(compat, gtty))
816
# We make a special variable for non-threaded version of LIBS to avoid
817
# including thread libs into non-threaded version of MySQL client library.
818
# Later in this script LIBS will be augmented with a threads library.
819
NON_THREADED_LIBS="$LIBS"
821
AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
822
uchar, uint, ulong],[],[], [
823
#include <sys/types.h>
825
AC_CHECK_TYPES([fp_except], [], [], [
826
#include <sys/types.h>
831
# Some system specific hacks
835
MAX_CXX_OPTIMIZE="-O3"
839
CFLAGS="$CFLAGS -DHAVE_RWLOCK_T"
840
CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T"
843
if test "$ac_cv_prog_gcc" = "yes"
845
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL"
846
CFLAGS="$CFLAGS $FLAGS"
847
CXXFLAGS="$CXXFLAGS $FLAGS"
851
*freebsd*|*dragonfly*)
852
AC_MSG_WARN([Adding fix for interrupted reads])
853
OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
854
if test "$OSVERSION" -gt "480100" && \
855
test "$OSVERSION" -lt "500000" || \
856
test "$OSVERSION" -gt "500109"
858
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
860
CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
861
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
865
AC_MSG_WARN([Adding flag -Dunix])
866
CFLAGS="$CFLAGS -Dunix"
867
CXXFLAGS="$CXXFLAGS -Dunix"
868
OVERRIDE_MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a"
873
#---START: Used in for client configure
874
# Check if we threads are in libc or if we should use
875
# -lpthread, -lpthreads or mit-pthreads
876
# We have to check libc last because else it fails on Solaris 2.6
878
with_posix_threads="no"
879
# Search thread lib on Linux
880
if test "$with_named_thread" = "no"
882
AC_MSG_CHECKING("Linux threads")
883
if test "$TARGET_LINUX" = "true"
885
AC_MSG_RESULT("starting")
886
# use getconf to check glibc contents
887
AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
888
case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
890
AC_MSG_RESULT("NPTL")
891
AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
892
with_named_thread="-lpthread"
895
AC_MSG_RESULT("Linuxthreads")
896
AC_DEFINE([HAVE_LINUXTHREADS], [1],
897
[Whether we are using Xavier Leroy's LinuxThreads])
898
with_named_thread="-lpthread"
901
AC_MSG_RESULT("unknown")
904
if test "$with_named_thread" = "no"
906
# old method, check headers
907
# Look for LinuxThreads.
908
AC_MSG_CHECKING("LinuxThreads in header file comment")
909
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
912
AC_MSG_RESULT("Found")
913
AC_DEFINE([HAVE_LINUXTHREADS], [1],
914
[Whether we are using Xavier Leroy's LinuxThreads])
915
# Linux 2.0 sanity check
916
AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
917
AC_MSG_ERROR([Syntax error in sched.h. Change _P to __P in the /usr/include/sched.h file. See the Installation chapter in the Reference Manual]))
918
# RedHat 5.0 does not work with dynamic linking of this. -static also
919
# gives a speed increase in linux so it does not hurt on other systems.
920
with_named_thread="-lpthread"
922
AC_MSG_RESULT("Not found")
923
# If this is a linux machine we should barf
924
AC_MSG_ERROR([This is a Linux system without a working getconf,
925
and Linuxthreads was not found. Please install it (or a new glibc) and try again.
926
See the Installation chapter in the Reference Manual for more information.])
929
AC_MSG_RESULT("no need to check headers")
932
AC_MSG_CHECKING("for pthread_create in -lpthread")
934
LIBS="$LIBS -lpthread"
935
AC_TRY_LINK( [#include <pthread.h>],
936
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
937
AC_MSG_RESULT("yes"),
938
[ AC_MSG_RESULT("no")
940
This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
941
Please install one of these (or a new glibc) and try again.
942
See the Installation chapter in the Reference Manual for more information.]) ]
948
fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
950
# Use library named -lpthread
951
if test "$with_named_thread" = "no" -a "$with_pthread" = "yes"
953
with_named_thread="-lpthread"
958
# Hack for Solaris >= 2.5
959
# We want both the new and the old interface
961
if test "$with_named_thread" = "no"
963
AC_MSG_CHECKING("Solaris threads")
964
if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
966
with_named_thread="-lpthread -lthread"
973
# Should we use named pthread library ?
974
AC_MSG_CHECKING("named thread libs:")
975
if test "$with_named_thread" != "no"
977
LIBS="$with_named_thread $LIBS $with_named_thread"
978
CLIENT_THREAD_LIBS="$with_named_thread"
979
with_posix_threads="yes"
980
AC_MSG_RESULT("$with_named_thread")
983
# pthread_create is in standard libraries (As in BSDI 3.0)
984
AC_MSG_CHECKING("for pthread_create in -libc");
986
[#include <pthread.h>],
987
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
988
with_posix_threads=yes, with_posix_threads=no)
989
AC_MSG_RESULT("$with_posix_threads")
990
if test "$with_posix_threads" = "no"
992
AC_MSG_CHECKING("for pthread_create in -lpthread")
994
LIBS="$LIBS -lpthread"
995
CLIENT_THREAD_LIBS="-lpthread"
997
[#include <pthread.h>],
998
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
999
with_posix_threads=yes, with_posix_threads=no)
1000
AC_MSG_RESULT("$with_posix_threads")
1001
if test "$with_posix_threads" = "no"
1003
LIBS=" $ac_save_LIBS -lpthreads"
1004
CLIENT_THREAD_LIBS="-lpthreads"
1005
AC_MSG_CHECKING("for pthread_create in -lpthreads")
1007
[#include <pthread.h>],
1008
[ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1009
with_posix_threads=yes, with_posix_threads=no)
1010
AC_MSG_RESULT("$with_posix_threads")
1011
if test "$with_posix_threads" = "no"
1013
# This is for FreeBSD
1014
LIBS="$ac_save_LIBS -pthread"
1015
CLIENT_THREAD_LIBS="-pthread"
1016
AC_MSG_CHECKING("for pthread_create in -pthread")
1018
[#include <pthread.h>],
1019
[ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1020
with_posix_threads=yes, with_posix_threads=no)
1021
AC_MSG_RESULT("$with_posix_threads")
1027
#---START: Used in for client configure
1028
# Must be checked after, because strtok_r may be in -lpthread
1029
# On AIX strtok_r is in libc_r
1031
my_save_LIBS="$LIBS"
1032
AC_CHECK_LIB(pthread,strtok_r)
1033
LIBS="$my_save_LIBS"
1034
if test "$ac_cv_lib_pthread_strtok_r" = "no"
1036
AC_CHECK_LIB(c_r,strtok_r)
1037
case "$with_osf32_threads---$target_os" in
1038
# Don't keep -lc_r in LIBS; -pthread handles it magically
1039
yes---* | *---freebsd* | *---hpux*) LIBS="$my_save_LIBS" ;;
1042
AC_CHECK_FUNCS(strtok_r pthread_init)
1044
AC_CHECK_FUNCS(strtok_r)
1049
case "$with_mysqld_ldflags " in
1052
# No need to check for dlopen when mysqld is linked with
1053
# -all-static as it won't be able to load any functions.
1054
# NOTE! It would be better if it was possible to test if dlopen
1055
# can be used, but a good way to test it couldn't be found
1060
# Check for dlopen, needed for user definable functions
1061
# This must be checked after threads on AIX
1062
# We only need this for mysqld, not for the clients.
1064
my_save_LIBS="$LIBS"
1066
AC_CHECK_LIB(dl,dlopen)
1068
LIBS="$my_save_LIBS"
1071
my_save_LIBS="$LIBS"
1073
AC_CHECK_FUNCS(dlopen dlerror)
1074
LIBS="$my_save_LIBS"
1080
# System characteristics
1081
case $SYSTEM_TYPE in
1083
AC_SYS_RESTARTABLE_SYSCALLS
1087
# Build optimized or debug version ?
1088
# First check for gcc and g++
1089
if test "$ac_cv_prog_gcc" = "yes"
1092
DEBUG_OPTIMIZE_CC="-O"
1093
OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
1096
DEBUG_OPTIMIZE_CC=""
1097
OPTIMIZE_CFLAGS="-O"
1099
if test "$ac_cv_prog_cxx_g" = "yes"
1102
DEBUG_OPTIMIZE_CXX="-O"
1103
OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
1106
DEBUG_OPTIMIZE_CXX=""
1107
OPTIMIZE_CXXFLAGS="-O"
1110
# If the user specified CFLAGS, we won't add any optimizations
1111
if test -n "$SAVE_CFLAGS"
1114
DEBUG_OPTIMIZE_CC=""
1116
# Ditto for CXXFLAGS
1117
if test -n "$SAVE_CXXFLAGS"
1119
OPTIMIZE_CXXFLAGS=""
1120
DEBUG_OPTIMIZE_CXX=""
1124
[ --with-debug Add debug code
1125
--with-debug=full Add debug code (adds memory checker, very slow)],
1126
[with_debug=$withval],
1128
if test "$with_debug" = "yes"
1131
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
1132
CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
1133
CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
1134
elif test "$with_debug" = "full"
1136
# Full debug. Very slow in some cases
1137
AC_DEFINE([DBUG_ON], [1], [Use libdbug])
1138
CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX $CFLAGS"
1139
CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX $CXXFLAGS"
1141
# Optimized version. No debug
1142
AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
1143
CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
1144
CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
1147
# If we should allow error injection tests
1148
AC_ARG_WITH(error-inject,
1149
AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
1150
[ with_error_inject=$withval ],
1151
[ with_error_inject=no ])
1153
if test $with_debug != "no"
1155
if test "$with_error_inject" = "yes"
1157
AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
1158
[Enable error injection in MySQL Server])
1162
AC_ARG_WITH([fast-mutexes],
1163
AC_HELP_STRING([--with-fast-mutexes],
1164
[Compile with fast mutexes (default is disabled)]),
1165
[with_fast_mutexes=$withval], [with_fast_mutexes=no])
1167
if test "$with_fast_mutexes" != "no"
1169
if test "$with_debug" != "no"
1171
AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
1173
AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1],
1174
[Define to 1 if you want to use fast mutexes])
1178
AC_ARG_WITH([atomic-ops],
1179
AC_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
1180
[Implement atomic operations using pthread rwlocks or atomic CPU
1181
instructions for multi-processor (default) or uniprocessor
1182
configuration]), , [with_atomic_ops=smp])
1183
case "$with_atomic_ops" in
1184
"up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
1185
[Assume single-CPU mode, no concurrency]) ;;
1186
"rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
1187
[Use pthread rwlocks for atomic ops]) ;;
1189
*) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
1192
AC_CACHE_CHECK([whether the compiler provides atomic builtins],
1193
[mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
1196
int foo= -10; int bar= 10;
1197
if (!__sync_fetch_and_add(&foo, bar) || foo)
1199
bar= __sync_lock_test_and_set(&foo, bar);
1200
if (bar || foo != 10)
1202
bar= __sync_val_compare_and_swap(&bar, foo, 15);
1207
], [mysql_cv_gcc_atomic_builtins=yes],
1208
[mysql_cv_gcc_atomic_builtins=no],
1209
[mysql_cv_gcc_atomic_builtins=no])])
1211
if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
1212
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
1213
[Define to 1 if compiler provides atomic builtins.])
1216
# Force static compilation to avoid linking problems/get more speed
1217
AC_ARG_WITH(mysqld-ldflags,
1218
[ --with-mysqld-ldflags Extra linking arguments for mysqld],
1219
[MYSQLD_EXTRA_LDFLAGS=$withval],
1220
[MYSQLD_EXTRA_LDFLAGS=])
1221
AC_SUBST(MYSQLD_EXTRA_LDFLAGS)
1223
AC_ARG_WITH(client-ldflags,
1224
[ --with-client-ldflags Extra linking arguments for clients],
1225
[CLIENT_EXTRA_LDFLAGS=$withval],
1226
[CLIENT_EXTRA_LDFLAGS=])
1227
AC_SUBST(CLIENT_EXTRA_LDFLAGS)
1229
AC_ARG_WITH(mysqld-libs,
1230
[ --with-mysqld-libs Extra libraries to link with for mysqld],
1231
[MYSQLD_EXTRA_LIBS=$withval],
1232
[MYSQLD_EXTRA_LIBS=])
1233
AC_SUBST(MYSQLD_EXTRA_LIBS)
1235
AC_ARG_WITH(lib-ccflags,
1236
[ --with-lib-ccflags Extra CC options for libraries],
1237
[LIB_EXTRA_CCFLAGS=$withval],
1238
[LIB_EXTRA_CCFLAGS=])
1239
AC_SUBST(LIB_EXTRA_CCFLAGS)
1241
# Avoid stupid bug on some OS
1242
AC_ARG_WITH(low-memory,
1243
[ --with-low-memory Try to use less memory to compile to avoid
1244
memory limitations.],
1245
[with_lowmem=$withval],
1247
if test "$with_lowmem" = "yes"
1249
if test "$ac_cv_prog_gcc" = "yes"
1251
LM_CFLAGS="-fno-inline"
1260
AC_ARG_WITH(comment,
1261
[ --with-comment Comment about compilation environment.],
1262
[with_comment=$withval],
1264
if test "$with_comment" != "no"
1266
COMPILATION_COMMENT=$with_comment
1268
COMPILATION_COMMENT="Source distribution"
1270
AC_SUBST(COMPILATION_COMMENT)
1272
AC_MSG_CHECKING("need of special linking flags")
1273
if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
1275
LDFLAGS="$LDFLAGS -rdynamic"
1276
AC_MSG_RESULT("-rdynamic")
1278
case "$SYSTEM_TYPE$with_mysqld_ldflags " in
1279
*freebsd*"-all-static "*|*dragonfly*"-all-static "*)
1280
AC_MSG_RESULT("none")
1282
*freebsd*|*dragonfly*)
1283
MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
1284
AC_MSG_RESULT("-export-dynamic")
1287
AC_MSG_RESULT("none")
1292
dnl Checks for typedefs, structures, and compiler characteristics.
1299
MYSQL_NEEDS_MYSYS_NEW
1300
# AC_CHECK_SIZEOF return 0 when it does not find the size of a
1301
# type. We want a error instead.
1302
AC_CHECK_SIZEOF(char, 1)
1303
if test "$ac_cv_sizeof_char" -eq 0
1305
AC_MSG_ERROR([No size for char type.
1306
A likely cause for this could be that there isn't any
1307
static libraries installed. You can verify this by checking if you have libm.a
1308
in /lib, /usr/lib or some other standard place. If this is the problem,
1309
install the static libraries and try again. If this isn't the problem,
1310
examine config.log for possible errors. If you want to report this, use
1311
'scripts/mysqlbug' and include at least the last 20 rows from config.log!])
1313
AC_CHECK_SIZEOF(char*, 4)
1314
AC_CHECK_SIZEOF(short, 2)
1315
AC_CHECK_SIZEOF(int, 4)
1316
if test "$ac_cv_sizeof_int" -eq 0
1318
AC_MSG_ERROR("No size for int type.")
1320
AC_CHECK_SIZEOF(long, 4)
1321
if test "$ac_cv_sizeof_long" -eq 0
1323
AC_MSG_ERROR("No size for long type.")
1325
AC_CHECK_SIZEOF(long long, 8)
1326
if test "$ac_cv_sizeof_long_long" -eq 0
1328
AC_MSG_ERROR("MySQL needs a long long type.")
1330
# off_t is not a builtin type
1331
AC_CHECK_SIZEOF(off_t, 4)
1332
if test "$ac_cv_sizeof_off_t" -eq 0
1334
AC_MSG_ERROR("MySQL needs a off_t type.")
1338
dnl check if time_t is unsigned
1344
# do we need #pragma interface/#pragma implementation ?
1345
# yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
1346
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
1347
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
1348
# follow any standard), we'll use well-defined preprocessor macros:
1350
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
1351
#error USE_PRAGMA_IMPLEMENTATION
1353
],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
1355
# This always gives a warning. Ignore it unless you are cross compiling
1357
#---START: Used in for client configure
1358
# Check base type of last arg to accept
1361
# Figure out what type of struct rlimit to use with setrlimit
1362
MYSQL_TYPE_STRUCT_RLIMIT
1363
# Find where the stack goes
1364
MYSQL_STACK_DIRECTION
1365
# We want to skip alloca on irix unconditionally. It may work on some version..
1367
# Do struct timespec have members tv_sec or ts_sec
1369
# Do we have the tzname variable
1371
# Do the c++ compiler have a bool type
1373
AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
1374
AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
1375
AC_CHECK_TYPES([u_int32_t])
1379
######################################################################
1380
# For readline/libedit (We simply move the mimimum amount of stuff from
1381
# the readline/libedit configure.in here)
1383
dnl Checks for header files.
1384
AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
1386
dnl Checks for library functions.
1388
AC_PROG_GCC_TRADITIONAL
1390
AC_CHECK_FUNCS(re_comp regcomp strdup)
1392
dnl Sun compilers have their own vis.h that is about something
1393
dnl totally different. So, not to change the libedit source, we
1394
dnl do some additional checks before we define HAVE_VIS_H.
1395
AC_CHECK_HEADER(vis.h,
1396
[AC_CHECK_FUNC(strvis,
1397
[AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
1399
AC_CHECK_FUNCS(strlcat strlcpy)
1400
AC_CHECK_FUNCS(issetugid)
1401
AC_CHECK_FUNCS(fgetln)
1402
AC_CHECK_FUNCS(getline flockfile)
1404
# from old readline settting:
1407
AC_SUBST(MAKE_SHELL)
1409
# Already-done: stdlib.h string.h unistd.h termios.h
1410
AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
1411
sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
1412
sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
1413
paths.h semaphore.h)
1415
# Already-done: strcasecmp
1416
AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
1418
AC_STAT_MACROS_BROKEN
1420
MYSQL_CHECK_GETPW_FUNCS
1421
MYSQL_HAVE_TIOCGWINSZ
1424
MYSQL_STRUCT_DIRENT_D_INO
1425
MYSQL_STRUCT_DIRENT_D_NAMLEN
1426
MYSQL_TYPE_SIGHANDLER
1427
MYSQL_CHECK_MULTIBYTE
1428
if test "$with_named_curses" = "no"
1430
MYSQL_CHECK_LIB_TERMCAP
1432
TERMCAP_LIB="$with_named_curses"
1434
AC_SUBST(TERMCAP_LIB)
1436
# Check if the termcap function 'tgoto' is already declared in
1437
# system header files or if it need to be declared locally
1438
AC_CHECK_DECLS(tgoto,,,[
1439
#ifdef HAVE_CURSES_H
1440
# include <curses.h>
1441
#elif HAVE_NCURSES_H
1442
# include <ncurses.h>
1450
AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
1451
AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
1452
AC_CHECK_FUNC(strlcpy, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcpy.o"])
1453
AC_CHECK_FUNC(strlcat, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcat.o"])
1454
AC_CHECK_FUNC(fgetln, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS fgetln.o"])
1455
AC_SUBST(LIBEDIT_LOBJECTS)
1456
enable_readline="yes"
1458
# End of readline/libedit stuff
1459
#########################################################################
1461
dnl Checks for library functions.
1464
# The following code disables intrinsic function support while we test for
1465
# library functions. This is to avoid configure problems with Intel ecc
1468
ORG_CFLAGS="$CFLAGS"
1469
if test "$GCC" != "yes"; then
1470
AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
1479
AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \
1480
chsize cuserid fchmod fcntl \
1481
fconvert fdatasync finite fpresetsticky fpsetmask fsync ftruncate \
1482
getcwd getpass getpassphrase getpwnam \
1483
getpwuid getrlimit getrusage getwd index initgroups isnan \
1484
localtime_r gethrtime gmtime_r \
1485
locking longjmp lrand48 madvise mallinfo memcpy memmove \
1486
mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
1487
pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
1488
pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
1489
pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
1490
pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
1491
realpath rename rint rwlock_init setupterm \
1492
shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
1493
sighold sigset sigthreadmask port_create sleep \
1494
snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
1495
strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
1496
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
1498
# Check that isinf() is available in math.h and can be used in both C and C++
1500
AC_MSG_CHECKING(for isinf in <math.h>)
1501
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
1503
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1506
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
1508
AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
1513
CFLAGS="$ORG_CFLAGS"
1515
# Sanity check: We chould not have any fseeko symbol unless
1516
# large_file_support=yes
1517
AC_CHECK_FUNC(fseeko,
1518
[if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
1520
AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
1524
# Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments)
1525
ac_save_CXXFLAGS="$CXXFLAGS"
1526
AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
1530
# Test whether madvise() is declared in C++ code -- it is not on some
1531
# systems, such as Solaris
1532
AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
1533
#include <sys/types.h>
1534
#include <sys/mman.h>
1537
# Do not treat warnings as errors if we are linking against other libc
1538
# this is to work around gcc not being permissive on non-system includes
1539
# with respect to ANSI C++
1540
# We also remove the -fbranch-probabilities option as this will give warnings
1541
# about not profiled code, which confuses configure
1542
# We also must remove -W and -Wcheck which on icc produces warnings that
1543
# we don't want to catch with -Werror
1545
if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
1547
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
1552
#if !defined(_REENTRANT)
1555
#include <pthread.h>
1556
#include <sys/types.h>
1557
#include <sys/socket.h>
1558
#include <netinet/in.h>
1559
#include <arpa/inet.h>
1560
#include <netdb.h>],
1562
struct hostent *foo = gethostbyaddr_r((const char *) 0,
1563
0, 0, (struct hostent *) 0, (char *) NULL, 0, &skr); return (foo == 0);],
1564
mysql_cv_gethost_style=solaris, mysql_cv_gethost_style=other))
1566
CXXFLAGS="$ac_save_CXXFLAGS"
1567
if test "$mysql_cv_gethost_style" = "solaris"
1569
AC_DEFINE([HAVE_SOLARIS_STYLE_GETHOST], [1],
1570
[Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines this with 8 arguments])
1573
#---START: Used in for client configure
1575
# Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris)
1576
ac_save_CXXFLAGS="$CXXFLAGS"
1577
AC_CACHE_CHECK([style of gethostbyname_r routines], mysql_cv_gethostbyname_style,
1580
if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
1582
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
1586
#if !defined(_REENTRANT)
1589
#include <pthread.h>
1590
#include <sys/types.h>
1591
#include <sys/socket.h>
1592
#include <netinet/in.h>
1593
#include <arpa/inet.h>
1594
#include <netdb.h>],
1597
skr = gethostbyname_r((const char *) 0,
1598
(struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);],
1599
mysql_cv_gethostbyname_style=glibc2, mysql_cv_gethostbyname_style=other))
1601
CXXFLAGS="$ac_save_CXXFLAGS"
1602
if test "$mysql_cv_gethostbyname_style" = "glibc2"
1604
AC_DEFINE([HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE], [1],
1605
[Solaris define gethostbyname_r with 5 arguments. glibc2 defines this with 6 arguments])
1608
# Check 3rd argument of getthostbyname_r
1609
ac_save_CXXFLAGS="$CXXFLAGS"
1610
AC_CACHE_CHECK([3 argument to gethostbyname_r routines], mysql_cv_gethostbyname_arg,
1613
if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
1615
CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
1619
#if !defined(_REENTRANT)
1622
#include <pthread.h>
1623
#include <sys/types.h>
1624
#include <sys/socket.h>
1625
#include <netinet/in.h>
1626
#include <arpa/inet.h>
1627
#include <netdb.h>],
1630
skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);],
1631
mysql_cv_gethostbyname_arg=hostent_data, mysql_cv_gethostbyname_arg=char))
1633
CXXFLAGS="$ac_save_CXXFLAGS"
1634
if test "$mysql_cv_gethostbyname_arg" = "hostent_data"
1636
AC_DEFINE([HAVE_GETHOSTBYNAME_R_RETURN_INT], [1],
1637
[In OSF 4.0f the 3'd argument to gethostbyname_r is hostent_data *])
1641
# Check definition of pthread_getspecific
1642
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
1644
[#if !defined(_REENTRANT)
1647
#define _POSIX_PTHREAD_SEMANTICS
1648
#include <pthread.h> ],
1649
[ void *pthread_getspecific(pthread_key_t key);
1650
pthread_getspecific((pthread_key_t) NULL); ],
1651
mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
1652
if test "$mysql_cv_getspecific_args" = "other"
1654
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1655
[For some non posix threads])
1658
# Check definition of pthread_mutex_init
1659
AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
1662
#define _POSIX_PTHREAD_SEMANTICS
1663
#include <pthread.h> ],
1665
pthread_mutexattr_t attr;
1667
pthread_mutex_init(&mp,&attr); ],
1668
mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
1669
if test "$mysql_cv_mutex_init_args" = "other"
1671
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1672
[For some non posix threads])
1676
#---START: Used in for client configure
1677
# Check definition of readdir_r
1678
AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
1681
#define _POSIX_PTHREAD_SEMANTICS
1682
#include <pthread.h>
1683
#include <dirent.h>],
1684
[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1685
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
1686
mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
1687
if test "$mysql_cv_readdir_r" = "POSIX"
1689
AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1692
# Check definition of posix sigwait()
1693
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
1696
#define _POSIX_PTHREAD_SEMANTICS
1697
#include <pthread.h>
1698
#include <signal.h>],
1704
mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
1705
if test "$mysql_cv_sigwait" = "POSIX"
1707
AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1710
if test "$mysql_cv_sigwait" != "POSIX"
1712
unset mysql_cv_sigwait
1713
# Check definition of posix sigwait()
1714
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
1717
#define _POSIX_PTHREAD_SEMANTICS
1718
#include <pthread.h>
1719
#include <signal.h>],
1723
mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
1724
if test "$mysql_cv_sigwait" = "NONPOSIX"
1726
AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1731
# Check if pthread_attr_setscope() exists
1732
AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
1735
#define _POSIX_PTHREAD_SEMANTICS
1736
#include <pthread.h>],
1737
[pthread_attr_t thr_attr;
1738
pthread_attr_setscope(&thr_attr,0);],
1739
mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
1740
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1742
AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1745
# Check for bad includes
1746
AC_MSG_CHECKING("can netinet files be included")
1748
[#include <sys/types.h>
1749
#include <sys/socket.h>
1750
#include <netinet/in_systm.h>
1751
#include <netinet/in.h>
1752
#include <netinet/ip.h>
1753
#include <netinet/tcp.h>],
1755
netinet_inc=yes, netinet_inc=no)
1756
if test "$netinet_inc" = "no"
1758
AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1760
AC_MSG_RESULT("$netinet_inc")
1764
AC_CHECK_HEADERS(cxxabi.h)
1765
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
1766
[AC_TRY_LINK([#include <cxxabi.h>], [
1767
char *foo= 0; int bar= 0;
1768
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
1769
], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])])
1772
if test "x$mysql_cv_cxa_demangle" = xyes; then
1773
AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1774
[Define to 1 if you have the `abi::__cxa_demangle' function.])
1777
#--------------------------------------------------------------------
1778
# Check for requested features
1779
#--------------------------------------------------------------------
1781
MYSQL_CHECK_BIG_TABLES
1782
MYSQL_CHECK_MAX_INDEXES
1785
#--------------------------------------------------------------------
1786
# Declare our plugin modules
1787
# Has to be done late, as the plugin may need to check for existence of
1788
# functions tested above
1789
#--------------------------------------------------------------------
1791
MYSQL_CONFIGURE_PLUGINS([none])
1793
# Only build client code?
1795
[ --without-server Only build the client.],
1796
[with_server=$withval],
1802
# If we have threads generate some library functions and test programs
1807
dnl This probably should be cleaned up more - for now the threaded
1808
dnl client is just using plain-old libs.
1809
sql_client_dirs="strings regex mysys libmysql"
1811
AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
1813
if test "$THREAD_SAFE_CLIENT" != "no"
1815
sql_client_dirs="$sql_client_dirs libmysql_r"
1816
AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe])
1818
sql_client_dirs="$sql_client_dirs client"
1820
CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
1822
AC_SUBST(CLIENT_LIBS)
1823
AC_SUBST(CLIENT_THREAD_LIBS)
1824
AC_SUBST(NON_THREADED_LIBS)
1825
AC_SUBST(STATIC_NSS_FLAGS)
1826
AC_SUBST(sql_client_dirs)
1828
if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
1830
AC_DEFINE([THREAD], [1],
1831
[Define if you want to have threaded code. This may be undef on client code])
1832
# Avoid _PROGRAMS names
1833
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o"
1834
AC_SUBST(THREAD_LOBJECTS)
1835
server_scripts="mysqld_safe mysql_install_db"
1836
sql_server_dirs="strings mysys dbug extra regex"
1838
sql_server="vio sql"
1841
# IMPORTANT - do not modify LIBS past this line - this hack is the only way
1842
# I know to add the static NSS magic if we have static NSS libraries with
1845
LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
1846
LIBS="$LIBS $STATIC_NSS_FLAGS"
1848
AC_SUBST(sql_server_dirs)
1849
AC_SUBST(sql_server)
1850
AC_SUBST(server_scripts)
1852
AC_SUBST(mysql_plugin_dirs)
1853
AC_SUBST(mysql_plugin_libs)
1854
AC_SUBST(mysql_plugin_defs)
1857
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
1858
# Start with the (longer) server list, add each client item not yet present.
1859
sql_union_dirs=" $sql_server_dirs "
1860
for DIR in $sql_client_dirs
1862
if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
1864
: # already present, skip
1866
sql_union_dirs="$sql_union_dirs $DIR "
1869
AC_SUBST(sql_union_dirs)
1871
# Some usefull subst
1875
# Set configuration options for make_binary_distribution
1876
case $SYSTEM_TYPE in
1878
MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
1881
: # no change for other platforms yet
1884
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
1887
if test -d "$srcdir/pstack" ; then
1888
AC_CONFIG_FILES(pstack/Makefile pstack/aout/Makefile)
1891
AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
1892
unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
1893
unittest/mysys/Makefile unittest/examples/Makefile dnl
1894
strings/Makefile regex/Makefile storage/Makefile dnl
1895
BUILD/Makefile vio/Makefile dnl
1896
libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
1897
sql/Makefile sql/share/Makefile dnl
1898
sql/sql_builtin.cc sql-common/Makefile dnl
1899
dbug/Makefile scripts/Makefile include/Makefile dnl
1900
tests/Makefile support-files/Makefile dnl
1901
support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
1902
mysql-test/Makefile dnl
1903
include/mysql_version.h plugin/Makefile)
1905
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
1907
# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
1908
AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")