2 dnl Process this file with autoconf to produce a configure script.
4 # Minimum Autoconf version required.
7 dnl Various people throughout the community may parse configure.in to
8 dnl get the MySQL version from the source branch. If the formatting
9 dnl of this line is going to be changed, please announce the change to
10 dnl internals@lists.mysql.com in advance of pushing the change.
12 dnl When changing the major version number please also check the switch
13 dnl statement in mysqlbinlog::check_master_version(). You may also need
14 dnl to update version.c in ndb.
15 AC_INIT([MySQL Server], [5.1.73], [], [mysql])
17 AC_CONFIG_SRCDIR([sql/mysqld.cc])
19 # USTAR format gives us the possibility to store longer path names in
20 # TAR files, the path name is split into two parts, a 155 chacater
21 # first part and a 100 character second part.
22 AM_INIT_AUTOMAKE([1.9 tar-ustar])
25 AC_CONFIG_HEADERS([include/config.h])
27 # Request support for automake silent-rules if available.
28 # Default to verbose output. One can use the configure-time
29 # option --enable-silent-rules or make V=0 to activate
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])])
35 # See the libtool docs for information on how to do shared lib versions.
36 SHARED_LIB_MAJOR_VERSION=16
37 SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
38 NDB_SHARED_LIB_MAJOR_VERSION=3
39 NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
41 # Set all version vars based on $VERSION. How do we do this more elegant ?
42 # Remember that regexps needs to quote [ and ] since this is run through m4
43 # We take some made up examples
45 # VERSION 5.1.40sp1-alpha 5.0.34a 5.5.1-m2
46 # MYSQL_U_SCORE_VERSION 5.1.40sp1_alpha 5.0.34a 5.5.1_m2
47 # MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a 5.5.1
48 # MYSQL_NUMERIC_VERSION 5.1.40 5.0.34 5.5.1
49 # MYSQL_BASE_VERSION 5.1 5.0 5.5
50 # MYSQL_VERSION_ID 50140 50034 50501
52 MYSQL_U_SCORE_VERSION=`echo $VERSION | sed -e "s|-|_|"`
53 MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"`
54 MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"`
55 MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"`
56 MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
57 awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
58 MYSQL_COPYRIGHT_YEAR=`date '+%Y'`
60 # Add previous major version for debian package upgrade path
61 MYSQL_PREVIOUS_BASE_VERSION=5.0
63 # The port should be constant for a LONG time
64 MYSQL_TCP_PORT_DEFAULT=3306
65 MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
68 sinclude(config/ac-macros/maintainer.m4)
69 sinclude(config/ac-macros/alloca.m4)
70 sinclude(config/ac-macros/check_cpu.m4)
71 sinclude(config/ac-macros/character_sets.m4)
72 sinclude(config/ac-macros/compiler_flag.m4)
73 sinclude(config/ac-macros/plugins.m4)
74 sinclude(config/ac-macros/ha_ndbcluster.m4)
75 sinclude(config/ac-macros/large_file.m4)
76 sinclude(config/ac-macros/misc.m4)
77 sinclude(config/ac-macros/readline.m4)
78 sinclude(config/ac-macros/ssl.m4)
79 sinclude(config/ac-macros/zlib.m4)
81 # Remember to add a directory sql/share/LANGUAGE
82 AVAILABLE_LANGUAGES="\
83 czech danish dutch english estonian french german greek hungarian \
84 italian japanese korean norwegian norwegian-ny polish portuguese \
85 romanian russian serbian slovak spanish swedish ukrainian"
90 AC_SUBST(MYSQL_U_SCORE_VERSION)
91 AC_SUBST(MYSQL_NO_DASH_VERSION)
92 AC_SUBST(MYSQL_BASE_VERSION)
93 AC_SUBST(MYSQL_VERSION_ID)
94 AC_SUBST(MYSQL_PREVIOUS_BASE_VERSION)
95 AC_SUBST(MYSQL_COPYRIGHT_YEAR)
96 AC_SUBST(PROTOCOL_VERSION)
97 AC_DEFINE_UNQUOTED([PROTOCOL_VERSION], [$PROTOCOL_VERSION],
98 [mysql client protocol version])
99 AC_SUBST(DOT_FRM_VERSION)
100 AC_DEFINE_UNQUOTED([DOT_FRM_VERSION], [$DOT_FRM_VERSION],
101 [Version of .frm files])
102 AC_SUBST(SHARED_LIB_MAJOR_VERSION)
103 AC_SUBST(SHARED_LIB_VERSION)
104 AC_SUBST(AVAILABLE_LANGUAGES)
106 # Check whether a debug mode should be enabled.
108 AS_HELP_STRING([--with-debug@<:@=full@:>@],
109 [Enable various amounts of debugging support (full adds a slow memory checker).]),
110 [with_debug=$withval],
113 # Whether the maintainer mode should be enabled.
116 # Canonicalize the configuration name.
118 # Check whether --with-system-type or --without-system-type was given.
119 AC_ARG_WITH(system-type,
120 [ --with-system-type Set the system type, like "sun-solaris10"],
121 [SYSTEM_TYPE="$withval"],
122 [SYSTEM_TYPE="$host_vendor-$host_os"])
123 AC_ARG_WITH(machine-type,
124 [ --with-machine-type Set the machine type, like "powerpc"],
125 [MACHINE_TYPE="$withval"],
126 [MACHINE_TYPE="$host_cpu"])
127 AC_SUBST(SYSTEM_TYPE)
128 AC_DEFINE_UNQUOTED([SYSTEM_TYPE], ["$SYSTEM_TYPE"],
129 [Name of system, eg sun-solaris])
130 AC_SUBST(MACHINE_TYPE)
131 AC_DEFINE_UNQUOTED([MACHINE_TYPE], ["$MACHINE_TYPE"],
132 [Machine type name, eg sparc])
134 # Detect intel x86 like processor
135 BASE_MACHINE_TYPE=$MACHINE_TYPE
136 case $MACHINE_TYPE in
137 i?86) BASE_MACHINE_TYPE=i386 ;;
140 # Save some variables and the command line options for mysqlbug
143 SAVE_ASFLAGS="$ASFLAGS"
144 SAVE_CFLAGS="$CFLAGS"
145 SAVE_CXXFLAGS="$CXXFLAGS"
146 SAVE_LDFLAGS="$LDFLAGS"
147 SAVE_CXXLDFLAGS="$CXXLDFLAGS"
148 CONF_COMMAND="$0 $ac_configure_args"
149 AC_SUBST(CONF_COMMAND)
152 AC_SUBST(SAVE_ASFLAGS)
153 AC_SUBST(SAVE_CFLAGS)
154 AC_SUBST(SAVE_CXXFLAGS)
155 AC_SUBST(SAVE_LDFLAGS)
156 AC_SUBST(SAVE_CXXLDFLAGS)
159 #AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE
162 # This is needed is SUBDIRS is set
165 ##############################################################################
166 # The below section needs to be done before AC_PROG_CC
167 ##############################################################################
169 # Hack for OS X/Darwin and Metrowerks CodeWarrior
170 AC_ARG_WITH(darwin-mwcc,
171 [ --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS X/Darwin],[
172 if [ "with_darwin_mwcc" = yes ] ; then
174 ccwrapper="$builddir/support-files/MacOSX/mwcc-wrapper"
175 arwrapper="$builddir/support-files/MacOSX/mwar-wrapper"
181 export CC CXX LD AR RANLIB
187 AM_CONDITIONAL(DARWIN_MWCC, test x$with_darwin_mwcc = xyes)
189 if test "x${CFLAGS-}" = x ; then
195 if test "x${CPPFLAGS-}" = x ; then
201 if test "x${LDFLAGS-}" = x ; then
207 ################ End of section to be done before AC_PROG_CC #################
209 # The following hack should ensure that configure doesn't add optimizing
210 # or debugging flags to CFLAGS or CXXFLAGS
211 # C_EXTRA_FLAGS are flags that are automaticly added to both
212 # CFLAGS and CXXFLAGS
213 CFLAGS="$CFLAGS $C_EXTRA_FLAGS "
214 CXXFLAGS="$CXXFLAGS $C_EXTRA_FLAGS "
216 dnl Checks for programs.
222 # Print version of CC and CXX compiler (if they support --version)
225 CC_VERSION=`$CC -version | grep -i version`
228 CC_VERSION=`$CC --version | sed 1q`
233 AC_MSG_CHECKING("C Compiler version")
234 AC_MSG_RESULT("$CC $CC_VERSION")
239 MYSQL_CHECK_CXX_VERSION
241 # Fix for sgi gcc / sgiCC which tries to emulate gcc
242 if test "$CC" = "sgicc"
246 if test "$CXX" = "sgi++"
251 if test "$ac_cv_prog_gcc" = "yes"
256 AC_PATH_PROG(AS, as, as)
259 # Still need ranlib for readline; local static use only so no libtool.
262 #AC_LIBTOOL_WIN32_DLL
265 # Ensure that we have --preserve-dup-deps defines, otherwise we get link
266 # problems of 'mysql' with CXX=g++
267 LIBTOOL="$LIBTOOL --preserve-dup-deps"
272 ##############################################################################
273 # In automake 1.12, the extension on generated yacc/bison header files changed
274 ##############################################################################
277 MAKEFILE_1ST=`head -1 "$srcdir/Makefile.in"`
278 AMAKE_MAJOR=`expr "$MAKEFILE_1ST" : '.*generated by automake \([[0-9]]*\).*'`
279 if test $? -eq "0" ; then
280 if test "$AMAKE_MAJOR" -gt "1" ; then
282 CXXFLAGS="$CXXFLAGS -DYACC_HEXT_HH"
283 elif test "$AMAKE_MAJOR" -eq "1" ; then
284 AMAKE_MINOR=`expr "$MAKEFILE_1ST" : '.*generated by automake 1.\([[0-9]]*\).*'`
285 if test $? -eq "0" ; then
286 if test "$AMAKE_MINOR" -ge "12" ; then
288 CXXFLAGS="$CXXFLAGS -DYACC_HEXT_HH"
295 ##############################################################################
298 #archive_expsym_cmds= `echo "$archive_expsym_cmds" | sed -e '/"$(CC)"//'`
299 #archive_expsym_cmds= "$CC -q64 $archive_expsym_cmds"
300 # CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
302 #AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_DISABLE_FAST_INSTALL AC_DISABLE_SHARED AC_DISABLE_STATIC
306 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
308 # Not critical since the generated file is distributed
309 AC_CHECK_PROGS(YACC, ['bison -y -p MYSQL'])
310 AC_CHECK_PROG(PDFMANUAL, pdftex, manual.pdf)
311 AC_CHECK_PROG(DVIS, tex, manual.dvi)
313 AC_PATH_PROG(uname_prog, uname, no)
315 # We should go through this and put all the explictly system dependent
317 AC_MSG_CHECKING(operating system)
318 AC_CACHE_VAL(mysql_cv_sys_os,
320 if test "$uname_prog" != "no"; then
321 mysql_cv_sys_os="`uname`"
323 mysql_cv_sys_os="Not Solaris"
326 AC_MSG_RESULT($mysql_cv_sys_os)
328 # This should be rewritten to use $target_os
331 CFLAGS="$CFLAGS -DSCO"
332 CXXFLAGS="$CXXFLAGS -DSCO"
336 AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
339 *) AC_MSG_WARN([Adding -belf option to ldflags.])
340 LDFLAGS="$LDFLAGS -belf"
346 AC_SYS_COMPILER_FLAG(-belf,sco_belf_option,CFLAGS,[],[
350 AC_MSG_WARN([Adding -belf option to ldflags.])
351 LDFLAGS="$LDFLAGS -belf"
358 sysv5UnixWare* | sysv5OpenUNIX8*)
359 if test "$GCC" != "yes"; then
360 # Use the built-in alloca()
361 CFLAGS="$CFLAGS -Kalloca"
363 CXXFLAGS="$CXXFLAGS -DNO_CPLUSPLUS_ALLOCA"
366 if test "$GCC" != "yes"; then
367 # Use the built-in alloca()
368 CFLAGS="$CFLAGS -Kalloca"
369 CXXFLAGS="$CFLAGS -Kalloca"
370 # Use no_implicit for templates
371 CXXFLAGS="$CXXFLAGS -Tno_implicit"
372 AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
373 [1], [Defined by configure. Use explicit template instantiation.])
383 AC_SUBST(INSTALL_SCRIPT)
385 export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
387 if test "$GCC" = "yes"
389 # mysqld requires -fno-implicit-templates.
390 # Disable exceptions as they seams to create problems with gcc and threads.
391 # mysqld doesn't use run-time-type-checking, so we disable it.
392 # We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
393 # regarding offset() usage in C++ which are done in a safe manner in the
395 CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
396 AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
397 [1], [Defined by configure. Use explicit template instantiation.])
402 # libmysqlclient versioning when linked with GNU ld.
403 if $LD --version 2>/dev/null| grep GNU >/dev/null 2>&1; then
404 LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
405 AC_CONFIG_FILES(libmysql/libmysql.ver)
407 AC_SUBST(LD_VERSION_SCRIPT)
410 # Avoid bug in fcntl on some versions of linux
411 AC_MSG_CHECKING([if we should use 'skip-external-locking' as default for $target_os])
412 # Any variation of Linux
413 if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
415 MYSQLD_DEFAULT_SWITCHES="--skip-external-locking"
418 AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
420 MYSQLD_DEFAULT_SWITCHES=""
424 AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
425 AC_SUBST(TARGET_LINUX)
427 dnl Find paths to some shell programs
428 AC_PATH_PROG(LN, ln, ln)
429 # This must be able to take a -f flag like normal unix ln.
430 AC_PATH_PROG(LN_CP_F, ln, ln)
434 # If ln -f does not exists use -s (AFS systems)
435 if test -n "$LN_CP_F"; then
436 LN_CP_F="$LN_CP_F -s"
441 AC_PATH_PROG(MV, mv, mv)
442 AC_PATH_PROG(RM, rm, rm)
443 AC_PATH_PROG(CP, cp, cp)
444 AC_PATH_PROG(SED, sed, sed)
445 AC_PATH_PROG(CMP, cmp, cmp)
446 AC_PATH_PROG(CHMOD, chmod, chmod)
447 AC_PATH_PROG(HOSTNAME, hostname, hostname)
448 AC_PATH_PROG(DIFF, diff, diff)
449 # Check for a GNU tar named 'gtar', or 'gnutar' (MacOS X) and
450 # fall back to 'tar' otherwise and hope that it's a GNU tar as well
451 AC_CHECK_PROGS(TAR, gnutar gtar tar)
453 dnl We use a path for perl so the script startup works
454 dnl We make sure to use perl, not perl5, in hopes that the RPMs will
455 dnl not depend on the perl5 binary being installed (probably a bug in RPM)
456 AC_PATH_PROG(PERL, perl, no)
457 if test "$PERL" != "no" && $PERL -e 'require 5' > /dev/null 2>&1
461 AC_PATH_PROG(PERL5, perl5, no)
462 if test "$PERL5" != no
465 ac_cv_path_PERL=$ac_cv_path_PERL5
473 # Enable the abi_check rule only if gcc is available
475 if test "$GCC" != "yes" || expr "$CC" : ".*icc.*"
479 ABI_CHECK="abi_check"
484 # Look for PS usage. We use double dollar-signs in FIND_PROC because this
485 # value is written to a makefile, which interprets away one level of
486 # dollar-signs. So, interpretation stages are m4 and then shell in autoconf,
487 # then Make, then shell. The autoconf substitution uses single quotes, so
488 # no unprotected single quotes should appear in the expression.
489 AC_PATH_PROG(PS, ps, ps)
490 AC_MSG_CHECKING("how to check if pid exists")
493 if $PS wwwp $$ 2> /dev/null | grep -- "$0" > /dev/null
495 FIND_PROC="$PS wwwp \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
497 elif $PS -fp $$ 2> /dev/null | grep -- $0 > /dev/null
499 FIND_PROC="$PS -p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
501 elif $PS -uaxww 2> /dev/null | grep -- $0 > /dev/null
503 FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
505 elif $PS -ef 2> /dev/null | grep -- $0 > /dev/null
507 FIND_PROC="$PS -ef | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
508 # Do anybody use this?
509 elif $PS $$ 2> /dev/null | grep -- $0 > /dev/null
511 FIND_PROC="$PS \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
514 *freebsd*|*dragonfly*)
515 FIND_PROC="$PS p \$\$PID | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" > /dev/null"
518 FIND_PROC="$PS -uaxww | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
521 FIND_PROC="$PS -e | grep -v \" grep\" | grep -v mysqld_safe | grep -- \"\$\$MYSQLD\" | grep \" \$\$PID \" > /dev/null"
527 AC_MSG_ERROR([Could not find the right ps and/or grep switches. Which OS is this? See the Installation chapter in the Reference Manual.])
531 AC_MSG_RESULT("$FIND_PROC")
533 # Check if a pid is valid
534 AC_PATH_PROG(KILL, kill, kill)
535 AC_MSG_CHECKING("for kill switches")
536 if $ac_cv_path_KILL -0 $$
538 CHECK_PID="$ac_cv_path_KILL -0 \$\$PID > /dev/null 2> /dev/null"
541 CHECK_PID="$ac_cv_path_KILL -s 0 \$\$PID > /dev/null 2> /dev/null"
543 AC_MSG_WARN([kill -0 to check for pid seems to fail])
544 CHECK_PID="$ac_cv_path_KILL -s SIGCONT \$\$PID > /dev/null 2> /dev/null"
547 AC_MSG_RESULT("$CHECK_PID")
549 # We need an ANSI C compiler
552 # We need an assembler, too
554 CCASFLAGS="$CCASFLAGS $ASFLAGS"
556 # Check if we need noexec stack for assembler
559 if test "$am_cv_prog_cc_stdc" = "no"
561 AC_MSG_ERROR([MySQL requires an ANSI C compiler (and a C++ compiler). Try gcc. See the Installation chapter in the Reference Manual.])
564 NOINST_LDFLAGS="-static"
569 AC_ARG_WITH(other-libc,
570 [ --with-other-libc=DIR Link against libc and other standard libraries
571 installed in the specified non-standard location
572 overriding default. Originally added to be able to
573 link against glibc 2.2 without making the user
574 upgrade the standard libc installation.],
576 other_libc_include="$withval/include"
577 other_libc_lib="$withval/lib"
578 with_other_libc="yes"
581 CFLAGS="$CFLAGS -I$other_libc_include"
582 # There seems to be a feature in gcc that treats system and libc headers
583 # silently when they violatate ANSI C++ standard, but it is strict otherwise
584 # since gcc cannot now recognize that our headers are libc, we work around
585 # by telling it to be permissive. Note that this option only works with
586 # new versions of gcc (2.95.x and above)
587 CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include"
588 if test -f "$other_libc_lib/libnss_files.a"
590 # libc has been compiled with --enable-static-nss
591 # we need special flags, but we will have to add those later
592 STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
593 STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
594 OTHER_LIBC_LIB="-static -L$other_libc_lib"
597 # this is a dirty hack. We if we detect static nss glibc in the special
598 # location, we do not re-direct the linker to get libraries from there
599 # during check. The reason is that if we did, we would have to find a
600 # way to append the special static nss flags to LIBS every time we do
601 # any check - this is definitely feasible, but not worthwhile the risk
602 # of breaking other things. So for our purposes it would be sufficient
603 # to assume that whoever is using static NSS knows what he is doing and
604 # has sensible libraries in the regular location
605 LDFLAGS="$LDFLAGS -static -L$other_libc_lib "
608 # When linking against custom libc installed separately, we want to force
609 # all binary builds to be static, including the build done by configure
610 # itself to test for system features.
611 with_mysqld_ldflags="-all-static"
612 with_client_ldflags="-all-static"
613 NOINST_LDFLAGS="-all-static"
621 AC_SUBST(NOINST_LDFLAGS)
624 # Check if we are using Linux and a glibc compiled with static nss
625 # (this is true on the MySQL build machines to avoid NSS problems)
627 AC_CHECK_TOOL([NM], [nm])
629 if test "$TARGET_LINUX" = "true" -a "$static_nss" = ""
631 tmp=`$NM ${other_libc_lib:-/usr/lib*}/libc.a | grep _nss_files_getaliasent_r1`
634 STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
635 STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
640 AC_MSG_CHECKING(whether features provided by the user community should be included.)
641 AC_ARG_ENABLE(community-features,
643 [--disable-community-features],
644 [Disable additional features provided by the user community.]),
645 [ ENABLE_COMMUNITY_FEATURES=$enableval ],
646 [ ENABLE_COMMUNITY_FEATURES=yes ]
649 if test "$ENABLE_COMMUNITY_FEATURES" = "yes"
651 AC_DEFINE([COMMUNITY_SERVER], [1],
652 [Whether features provided by the user community should be included])
658 AC_ARG_WITH(server-suffix,
659 [ --with-server-suffix Append value to the version string.],
660 [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ],
661 [ MYSQL_SERVER_SUFFIX= ]
663 AC_SUBST(MYSQL_SERVER_SUFFIX)
665 # Set flags if we want to force to use pthreads
667 [ --with-pthread Force use of pthread library.],
668 [ with_pthread=$withval ],
672 # Force use of thread libs LIBS
673 AC_ARG_WITH(named-thread-libs,
674 [ --with-named-thread-libs=ARG
675 Use specified thread libraries instead of
676 those automatically found by configure.],
677 [ with_named_thread=$withval ],
678 [ with_named_thread=no ]
681 # Force use of a curses libs
682 AC_ARG_WITH(named-curses-libs,
683 [ --with-named-curses-libs=ARG
684 Use specified curses libraries instead of
685 those automatically found by configure.],
686 [ with_named_curses=$withval ],
687 [ with_named_curses=no ]
690 # Make thread safe client
691 AC_ARG_ENABLE(thread-safe-client,
692 [ --disable-thread-safe-client
693 Compile the client without threads.],
694 [ THREAD_SAFE_CLIENT=$enableval ],
695 [ THREAD_SAFE_CLIENT=yes ]
698 # compile with strings functions in assembler
699 AC_ARG_ENABLE(assembler,
700 [ --enable-assembler Use assembler versions of some string
701 functions if available.],
702 [ ENABLE_ASSEMBLER=$enableval ],
703 [ ENABLE_ASSEMBLER=no ]
706 AC_MSG_CHECKING(if we should use assembler functions)
707 # For now we only support assembler on i386 and sparc systems
708 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;))
709 AM_CONDITIONAL(ASSEMBLER_sparc32, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparc")
710 AM_CONDITIONAL(ASSEMBLER_sparc64, test "$ENABLE_ASSEMBLER" = "yes" -a "$BASE_MACHINE_TYPE" = "sparcv9")
711 AM_CONDITIONAL(ASSEMBLER, test "$ASSEMBLER_x86_TRUE" = "" -o "$ASSEMBLER_sparc32_TRUE" = "")
713 if test "$ASSEMBLER_TRUE" = ""
721 AC_MSG_CHECKING(if SHOW PROFILE should be enabled.)
722 AC_ARG_ENABLE(profiling,
723 AS_HELP_STRING([--enable-profiling], [Build a version with query profiling code (req. community-features)]),
724 [ ENABLED_PROFILING=$enableval ],
725 [ ENABLED_PROFILING=$ENABLE_COMMUNITY_FEATURES ])
727 if test "$ENABLED_PROFILING" = "yes"
729 if test "$ENABLE_COMMUNITY_FEATURES" = "yes";
731 AC_DEFINE([ENABLED_PROFILING], [1],
732 [If SHOW PROFILE should be enabled])
735 ENABLED_PROFILING="no"
736 AC_MSG_RESULT([no, overridden by community-features disabled])
742 # Use this to set the place used for unix socket used to local communication.
743 AC_ARG_WITH(unix-socket-path,
744 [ --with-unix-socket-path=SOCKET
745 Where to put the unix-domain socket. SOCKET must be
746 an absolute file name.],
747 [ MYSQL_UNIX_ADDR=$withval ],
748 [ MYSQL_UNIX_ADDR=$MYSQL_UNIX_ADDR_DEFAULT ]
750 AC_SUBST(MYSQL_UNIX_ADDR)
752 AC_ARG_WITH(tcp-port,
753 [ --with-tcp-port=port-number
754 Which port to use for MySQL services (default 3306)],
755 [ MYSQL_TCP_PORT=$withval ],
756 [ MYSQL_TCP_PORT=$MYSQL_TCP_PORT_DEFAULT
757 # if we actually defaulted (as opposed to the pathological case of
758 # --with-tcp-port=<MYSQL_TCP_PORT_DEFAULT> which might in theory
759 # happen if whole batch of servers was built from a script), set
760 # the default to zero to indicate that; we don't lose information
761 # that way, because 0 obviously indicates that we can get the
762 # default value from MYSQL_TCP_PORT. this seems really evil, but
763 # testing for MYSQL_TCP_PORT==MYSQL_TCP_PORT_DEFAULT would make a
764 # a port of MYSQL_TCP_PORT_DEFAULT magic even if the builder did not
765 # intend it to mean "use the default, in fact, look up a good default
766 # from /etc/services if you can", but really, really meant 3306 when
767 # they passed in 3306. When they pass in a specific value, let them
768 # have it; don't second guess user and think we know better, this will
769 # just make people cross. this makes the the logic work like this
770 # (which is complicated enough):
772 # - if a port was set during build, use that as a default.
774 # - otherwise, try to look up a port in /etc/services; if that fails,
775 # use MYSQL_TCP_PORT_DEFAULT (at the time of this writing 3306)
777 # - allow the MYSQL_TCP_PORT environment variable to override that.
779 # - allow command-line parameters to override all of the above.
781 # the top-most MYSQL_TCP_PORT_DEFAULT is read from win/configure.js,
782 # so don't mess with that.
783 MYSQL_TCP_PORT_DEFAULT=0 ]
785 AC_SUBST(MYSQL_TCP_PORT)
786 # We might want to document the assigned port in the manual.
787 AC_SUBST(MYSQL_TCP_PORT_DEFAULT)
789 # Use this to set the place used for unix socket used to local communication.
790 AC_ARG_WITH(mysqld-user,
791 [ --with-mysqld-user=username
792 What user the mysqld daemon shall be run as.],
793 [ MYSQLD_USER=$withval ],
794 [ MYSQLD_USER=mysql ]
796 AC_SUBST(MYSQLD_USER)
798 # If we should allow LOAD DATA LOCAL
799 AC_MSG_CHECKING(If we should should enable LOAD DATA LOCAL by default)
800 AC_ARG_ENABLE(local-infile,
801 [ --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled)],
802 [ ENABLED_LOCAL_INFILE=$enableval ],
803 [ ENABLED_LOCAL_INFILE=no ]
805 if test "$ENABLED_LOCAL_INFILE" = "yes"
808 AC_DEFINE([ENABLED_LOCAL_INFILE], [1],
809 [If LOAD DATA LOCAL INFILE should be enabled by default])
814 # If we should allow init-file, skip-grant-table and bootstrap options
815 AC_MSG_CHECKING(If we should should enable init-file, skip-grant-table options and bootstrap)
816 AC_ARG_ENABLE(grant-options,
817 [ --disable-grant-options Disables the use of --init-file, --skip-grant-tables and --bootstrap options],
818 [ mysql_grant_options_enabled=$enableval ],
819 [ mysql_grant_options_enabled=yes ]
821 if test "$mysql_grant_options_enabled" = "yes"
825 AC_DEFINE([DISABLE_GRANT_OPTIONS], [1],
826 [Disables the use of --init-file, --skip-grant-tables and --bootstrap options])
832 # Types that must be checked AFTER large file support is checked
835 #--------------------------------------------------------------------
836 # Check for system header files
837 #--------------------------------------------------------------------
842 AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \
843 ieeefp.h limits.h memory.h pwd.h select.h \
845 strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
846 sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
847 unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
848 sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \
849 sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h \
852 AC_CHECK_HEADERS([xfs/xfs.h])
854 #--------------------------------------------------------------------
855 # Check for system libraries. Adds the library to $LIBS
856 # and defines HAVE_LIBM etc
857 #--------------------------------------------------------------------
859 AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
861 AC_CHECK_LIB(nsl_r, gethostbyname_r, [],
862 AC_CHECK_LIB(nsl, gethostbyname_r))
863 AC_CHECK_FUNC(gethostbyname_r)
865 AC_SEARCH_LIBS(setsockopt, socket)
866 # This may get things to compile even if bind-8 is installed
867 AC_SEARCH_LIBS(bind, bind)
868 # Check if crypt() exists in libc or libcrypt, sets LIBS if needed
869 AC_SEARCH_LIBS(crypt, crypt, AC_DEFINE(HAVE_CRYPT, 1, [crypt]))
870 # See if we need a library for address lookup.
871 AC_SEARCH_LIBS(inet_aton, [socket nsl resolv])
873 # For the sched_yield() function on Solaris
874 AC_SEARCH_LIBS(sched_yield, posix4,
875 AC_DEFINE(HAVE_SCHED_YIELD, 1, [sched_yield]))
877 MYSQL_CHECK_ZLIB_WITH_COMPRESS
879 # For large pages support
880 if test "$TARGET_LINUX" = "true"
882 # For SHM_HUGETLB on Linux
883 AC_CHECK_DECLS(SHM_HUGETLB,
884 AC_DEFINE([HAVE_LARGE_PAGES], [1],
885 [Define if you have large pages support])
886 AC_DEFINE([HUGETLB_USE_PROC_MEMINFO], [1],
887 [Define if /proc/meminfo shows the huge page size (Linux only)])
895 #--------------------------------------------------------------------
896 # Check for TCP wrapper support
897 #--------------------------------------------------------------------
900 [ --with-libwrap[=DIR] Compile in libwrap (tcp_wrappers) support],[
901 case "$with_libwrap" in
904 _cppflags=${CPPFLAGS}
907 if test "$with_libwrap" != "yes"; then
908 CPPFLAGS="${CPPFLAGS} -I$with_libwrap/include"
909 LDFLAGS="${LDFLAGS} -L$with_libwrap/lib"
913 AC_CHECK_HEADER(tcpd.h,
915 AC_MSG_CHECKING(for TCP wrappers library -lwrap)
916 AC_TRY_LINK([#include <tcpd.h>
917 int allow_severity = 0;
918 int deny_severity = 0;
920 struct request_info *req;
921 ],[hosts_access (req)],
923 AC_DEFINE([LIBWRAP], [1], [Define if you have -lwrap])
924 AC_DEFINE([HAVE_LIBWRAP], [1], [Define if have -lwrap])
925 if test "$with_libwrap" != "yes"; then
926 WRAPLIBS="-L${with_libwrap}/lib"
928 WRAPLIBS="${WRAPLIBS} -lwrap",
930 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
931 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
932 LDFLAGS=${_ldflags} LIBS=${_libs}
938 # Check for gtty if termio.h doesn't exists
939 if test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"
941 AC_SEARCH_LIBS(gtty, compat)
944 # We make a special variable for non-threaded version of LIBS to avoid
945 # including thread libs into non-threaded version of MySQL client library.
946 # Later in this script LIBS will be augmented with a threads library.
947 NON_THREADED_LIBS="$LIBS"
949 AC_CHECK_TYPES([int8, uint8, int16, uint16, int32, uint32, int64, uint64,
950 uchar, uint, ulong],[],[], [
951 #include <sys/types.h>
953 AC_CHECK_TYPES([in_addr_t], [], [], [
954 #include <sys/types.h>
955 #include <sys/socket.h>
956 #include <netinet/in.h>
957 #include <arpa/inet.h>
959 AC_CHECK_TYPES([fp_except], [], [], [
960 #include <sys/types.h>
965 # Some system specific hacks
969 MAX_CXX_OPTIMIZE="-O3"
973 # Solaris 2.7 has a broken /usr/include/widec.h
974 # Make a fixed copy in ./include
975 AC_MSG_WARN([Fixing broken include files for $SYSTEM_TYPE])
976 echo " - Creating local copy of widec.h"
982 sed -e "s|^#if[ ]*!defined(lint) && !defined(__lint)|#if !defined\(lint\) \&\& !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h
983 CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
984 CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
987 # Solaris 2.8 has a broken /usr/include/widec.h
988 # Make a fixed copy in ./include
989 AC_MSG_WARN([Fixing broken include files for $SYSTEM_TYPE])
990 echo " - Creating local copy of widec.h"
996 sed -e "s|^#if[ ]*!defined(__lint)|#if !defined\(__lint\) \&\& !defined\(getwc\)|" < /usr/include/widec.h > include/widec.h
997 CFLAGS="$CFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
998 CXXFLAGS="$CXXFLAGS -DHAVE_CURSES_H -I$builddir/include -DHAVE_RWLOCK_T"
1001 AC_MSG_WARN([Enabling getpass() workaround for Solaris 2.5.1])
1002 CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS -DHAVE_RWLOCK_T";
1003 CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T -DSOLARIS"
1006 CFLAGS="$CFLAGS -DHAVE_RWLOCK_T"
1007 CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T"
1010 AC_MSG_WARN([Enabling getpass() workaround for SunOS])
1011 CFLAGS="$CFLAGS -DHAVE_BROKEN_GETPASS -DSOLARIS";
1014 AC_MSG_WARN([Enabling workarounds for hpux 10.20])
1015 CFLAGS="$CFLAGS -DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
1016 CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX10 -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT -DHAVE_POSIX1003_4a_MUTEX"
1017 if test "$with_named_thread" = "no"
1019 AC_MSG_WARN([Using --with-named-thread=-lpthread])
1020 with_named_thread="-lcma"
1024 AC_MSG_WARN([Enabling workarounds for hpux 11])
1025 CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
1026 CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
1027 if test "$with_named_thread" = "no"
1029 AC_MSG_WARN([Using --with-named-thread=-lpthread])
1030 with_named_thread="-lpthread"
1032 # Fixes for HPUX 11.0 compiler
1033 if test "$ac_cv_prog_gcc" = "no"
1035 CFLAGS="$CFLAGS -DHAVE_BROKEN_INLINE"
1036 # set working flags first in line, letting override it (i. e. for debug):
1037 CXXFLAGS="+O2 $CXXFLAGS"
1040 ndb_cxxflags_fix="$ndb_cxxflags_fix -Aa"
1044 if test "$ac_cv_prog_gcc" = "yes"
1046 CPPFLAGS="$CPPFLAGS -traditional-cpp "
1047 CFLAGS="-DHAVE_CTHREADS_WRAPPER -DDO_NOT_REMOVE_THREAD_WRAPPERS"
1048 CXXFLAGS="-DHAVE_CTHREADS_WRAPPER"
1049 if test $with_named_curses = "no"
1051 with_named_curses=""
1056 if test "$ac_cv_prog_gcc" = "yes"
1058 FLAGS="-traditional-cpp -DHAVE_DARWIN5_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
1059 CFLAGS="$CFLAGS $FLAGS"
1060 CXXFLAGS="$CXXFLAGS $FLAGS"
1062 with_named_curses=""
1066 if test "$ac_cv_prog_gcc" = "yes"
1068 FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DDONT_DECLARE_CXA_PURE_VIRTUAL "
1069 CFLAGS="$CFLAGS $FLAGS"
1070 CXXFLAGS="$CXXFLAGS $FLAGS"
1075 if test "$ac_cv_prog_gcc" = "yes"
1077 FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL"
1078 CFLAGS="$CFLAGS $FLAGS"
1079 CXXFLAGS="$CXXFLAGS $FLAGS"
1083 *freebsd*|*dragonfly*)
1084 AC_MSG_WARN([Adding fix for interrupted reads])
1085 OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
1086 if test "$OSVERSION" -gt "480100" && \
1087 test "$OSVERSION" -lt "500000" || \
1088 test "$OSVERSION" -gt "500109"
1090 CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
1092 CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
1093 CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
1097 AC_MSG_WARN([Adding flag -Dunix])
1098 CFLAGS="$CFLAGS -Dunix"
1099 CXXFLAGS="$CXXFLAGS -Dunix"
1100 OVERRIDE_MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a"
1103 AC_MSG_WARN([Adding fix for BSDI])
1104 CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH"
1105 AC_DEFINE_UNQUOTED([SOCKOPT_OPTLEN_TYPE], [size_t],
1106 [Last argument to get/setsockopt])
1109 if test "$with_named_thread" = "no"
1111 AC_MSG_WARN([Using --with-named-thread=-lpthread])
1112 with_named_thread="-lpthread"
1114 CXXFLAGS="$CXXFLAGS -D_BOOL"
1117 AC_MSG_WARN([Adding defines for AIX])
1118 CFLAGS="$CFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ"
1119 CXXFLAGS="$CXXFLAGS -Wa,-many -DUNDEF_HAVE_INITGROUPS -DSIGNALS_DONT_BREAK_READ"
1121 dnl Is this the right match for DEC OSF on alpha?
1123 if test "$ac_cv_prog_gcc" = "yes" && test "$host_cpu" = "alpha"
1125 AC_MSG_WARN([Adding defines for DEC OSF on alpha])
1126 CFLAGS="$CFLAGS -mieee"
1127 CXXFLAGS="$CXXFLAGS -mieee"
1129 AC_MSG_WARN([Adding defines for OSF1])
1130 # gethostbyname_r is deprecated and doesn't work ok on OSF1
1131 CFLAGS="$CFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
1132 CXXFLAGS="$CXXFLAGS -DUNDEF_HAVE_GETHOSTBYNAME_R -DSNPRINTF_RETURN_TRUNC"
1133 # fix to handle include of <stdint.h> correctly on OSF1 with cxx compiler
1134 CXXFLAGS="$CXXFLAGS -I/usr/include/cxx -I/usr/include/cxx_cname -I/usr/include -I/usr/include.dtk"
1137 # No need for curses library so set it to null
1138 with_named_curses=""
1140 # No thread library - in LibC
1141 with_named_thread=""
1144 # Edit Makefile.in files.
1146 echo -n "configuring Makefile.in files for NetWare... "
1147 for file in sql/Makefile.in extra/Makefile.in client/Makefile.in
1149 # echo "#### $file ####"
1150 filedir="`dirname $file`"
1151 filebase="`basename $file`"
1152 filesed=$filedir/$filebase.sed
1154 # Backup and always use original file
1158 cp -fp $file.bk $file
1160 cp -fp $file $file.bk
1164 # Use gen_lex_hash.linux instead of gen_lex_hash
1165 # Add library dependencies to mysqld_DEPENDENCIES
1166 lib_DEPENDENCIES="\$(openssl_libs) \$(yassl_libs)"
1167 cat > $filesed << EOF
1168 s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,
1169 s%\(mysqld_DEPENDENCIES = \)%\1$lib_DEPENDENCIES %
1173 cat > $filesed << EOF
1174 s,\(extra/comp_err\)\$(EXEEXT),\1.linux,
1177 libmysql/Makefile.in)
1178 cat > $filesed << EOF
1179 s,libyassl.la,.libs/libyassl.a,
1180 s,libtaocrypt.la,.libs/libtaocrypt.a,
1183 libmysql_r/Makefile.in)
1184 cat > $filesed << EOF
1185 s,libyassl.la,.libs/libyassl.a,
1186 s,libtaocrypt.la,.libs/libtaocrypt.a,
1191 cat > $filesed << EOF
1192 s,libmysqlclient.la,.libs/libmysqlclient.a,
1196 if `sed -f $filesed $file > $file.nw`;\
1198 mv -f $file.nw $file
1203 # wait for file system changes to complete
1209 # Make sure the following files are writable.
1211 # When the files are retrieved from some source code control systems they are read-only.
1213 echo -n "making sure specific build files are writable... "
1217 Docs/INSTALL-BINARY \
1221 if test -e $file; then
1231 #---START: Used in for client configure
1232 # Check if we threads are in libc or if we should use
1233 # -lpthread, -lpthreads or mit-pthreads
1234 # We have to check libc last because else it fails on Solaris 2.6
1236 with_posix_threads="no"
1237 # Search thread lib on Linux
1238 if test "$with_named_thread" = "no"
1240 AC_MSG_CHECKING("Linux threads")
1241 if test "$TARGET_LINUX" = "true"
1243 AC_MSG_RESULT("starting")
1244 # use getconf to check glibc contents
1245 AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
1246 case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
1248 AC_MSG_RESULT("NPTL")
1249 AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
1250 with_named_thread="-lpthread"
1253 AC_MSG_RESULT("Linuxthreads")
1254 AC_DEFINE([HAVE_LINUXTHREADS], [1],
1255 [Whether we are using Xavier Leroy's LinuxThreads])
1256 with_named_thread="-lpthread"
1259 AC_MSG_RESULT("unknown")
1262 if test "$with_named_thread" = "no"
1264 # old method, check headers
1265 # Look for LinuxThreads.
1266 AC_MSG_CHECKING("LinuxThreads in header file comment")
1267 res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
1268 if test "$res" -gt 0
1270 AC_MSG_RESULT("Found")
1271 AC_DEFINE([HAVE_LINUXTHREADS], [1],
1272 [Whether we are using Xavier Leroy's LinuxThreads])
1273 # Linux 2.0 sanity check
1274 AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
1275 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]))
1276 # RedHat 5.0 does not work with dynamic linking of this. -static also
1277 # gives a speed increase in linux so it does not hurt on other systems.
1278 with_named_thread="-lpthread"
1280 AC_MSG_RESULT("Not found")
1281 # If this is a linux machine we should barf
1282 AC_MSG_ERROR([This is a Linux system without a working getconf,
1283 and Linuxthreads was not found. Please install it (or a new glibc) and try again.
1284 See the Installation chapter in the Reference Manual for more information.])
1287 AC_MSG_RESULT("no need to check headers")
1290 AC_MSG_CHECKING("for pthread_create in -lpthread")
1291 ac_save_LIBS="$LIBS"
1292 LIBS="$LIBS -lpthread"
1293 AC_TRY_LINK( [#include <pthread.h>],
1294 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1295 AC_MSG_RESULT("yes"),
1296 [ AC_MSG_RESULT("no")
1298 This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
1299 Please install one of these (or a new glibc) and try again.
1300 See the Installation chapter in the Reference Manual for more information.]) ]
1302 LIBS="$ac_save_LIBS"
1305 fi # "$TARGET_LINUX"
1306 fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
1309 # Hack for DEC-UNIX (OSF1 -> Tru64)
1310 if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
1312 AC_MSG_CHECKING("DEC threads post OSF/1 3.2")
1313 if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
1315 with_named_thread="-lpthread -lmach -lexc"
1316 CFLAGS="$CFLAGS -D_REENTRANT"
1317 CXXFLAGS="$CXXFLAGS -D_REENTRANT"
1318 AC_DEFINE(HAVE_DEC_THREADS, [1], [Whether we are using DEC threads])
1319 AC_MSG_RESULT("yes")
1323 fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
1326 dnl This is needed because -lsocket has to come after the thread
1328 AC_DEFUN([MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK], [
1329 LIBS=`echo " $LIBS " | sed -e 's/ -lsocket / /g'`
1332 if test "$with_named_thread" = "no"
1334 AC_MSG_CHECKING("SCO threads")
1335 if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
1337 if test -f /usr/lib/libgthreads.a -o -f /usr/lib/libgthreads.so
1339 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1340 with_named_thread="-lgthreads -lsocket -lgthreads"
1341 # sched.h conflicts with fsu-threads
1342 touch ./include/sched.h
1343 touch ./include/semaphore.h
1346 if expr "$CC" : ".*gcc.*"
1348 AC_MSG_RESULT("yes")
1350 AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.])
1352 AC_MSG_RESULT("yes")
1353 elif test -f /usr/local/lib/libpthread.a -o -f /usr/local/lib/libpthread.so
1355 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1356 with_named_thread="-lpthread -lsocket"
1357 # sched.h conflicts with fsu-threads
1358 # touch ./include/sched.h
1360 AC_MSG_CHECKING("for gcc")
1362 if expr "$CC" : ".*gcc.*"
1364 AC_MSG_RESULT("yes")
1366 AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.])
1368 AC_MSG_RESULT("yes")
1369 # Hack for SCO UnixWare 7.1.x
1371 elif test "$with_named_thread" = "no"
1374 AC_MSG_CHECKING("SCO UnixWare 7.1.x native threads")
1375 if expr "$SYSTEM_TYPE" : ".*sco.*" > /dev/null
1377 if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
1379 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1380 if expr "$CC" : ".*gcc.*"
1382 with_named_thread="-pthread -lsocket -lnsl"
1384 with_named_thread="-Kthread -lsocket -lnsl"
1386 if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
1388 AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1])
1390 AC_MSG_RESULT("yes")
1392 AC_MSG_CHECKING("for gcc")
1393 if expr "$CC" : ".*gcc.*"
1395 CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1396 CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1398 CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1399 CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK"
1402 AC_MSG_ERROR([configure: error: Can't find thread libs on SCO UnixWare7. See the Installation chapter in the Reference Manual.])
1408 AC_MSG_ERROR([On SCO UNIX MySQL requires that the FSUThreads package is installed. See the Installation chapter in the Reference Manual.])
1416 # Check for SCO threading libraries
1418 if test "$with_named_thread" = "no"
1420 AC_MSG_CHECKING([SCO OpenServer 6, UnixWare 7 or OpenUNIX 8 native threads])
1421 if expr "$SYSTEM_TYPE" : ".*UnixWare.*" > /dev/null || \
1422 expr "$SYSTEM_TYPE" : ".*SCO_SV6.*" > /dev/null || \
1423 expr "$SYSTEM_TYPE" : ".*OpenUNIX.*" > /dev/null
1425 if test -f /usr/lib/libthread.so -o -f /usr/lib/libthreadT.so
1427 MYSQL_REMOVE_SOCKET_FROM_LIBS_HACK
1428 if expr "$CC" : ".*gcc.*" > /dev/null
1430 with_named_thread="-pthread -lsocket -lnsl"
1431 CC="$CC -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1432 CXX="$CXX -pthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1434 with_named_thread="-Kthread -lsocket -lnsl"
1435 CC="$CC -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1436 CXX="$CXX -Kthread -DUNIXWARE_7 -DHAVE_BROKEN_RWLOCK";
1438 if expr "$SYSTEM_TYPE" : ".*unixware7.0.0" > /dev/null
1440 AC_DEFINE(HAVE_UNIXWARE7_THREADS, [1], [Have UnixWare 7 (or similar) almost-POSIX threading library])
1444 AC_MSG_ERROR([configure: error: Can't find thread library on SCO/Caldera system. See the Installation chapter in the Reference Manual.])
1451 # Hack for Siemens UNIX
1452 if test "$with_named_thread" = "no"
1454 AC_MSG_CHECKING("Siemens threads")
1455 if test -f /usr/lib/libxnet.so -a "$SYSTEM_TYPE" = "sni-sysv4"
1458 NON_THREADED_LIBS="-lxnet $NON_THREADED_LIBS"
1459 with_named_thread="-Kthread $LDFLAGS -lxnet"
1461 CFLAGS="-Kthread $CFLAGS"
1462 CXXFLAGS="-Kthread $CXXFLAGS"
1463 AC_MSG_RESULT("yes")
1469 # Use library named -lpthread
1470 if test "$with_named_thread" = "no" -a "$with_pthread" = "yes"
1472 with_named_thread="-lpthread"
1477 # Hack for Solaris >= 2.5
1478 # We want both the new and the old interface
1480 if test "$with_named_thread" = "no"
1482 AC_MSG_CHECKING("Solaris threads")
1483 if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
1485 with_named_thread="-lpthread -lthread"
1486 AC_MSG_RESULT("yes")
1492 # Should we use named pthread library ?
1493 AC_MSG_CHECKING("named thread libs:")
1494 if test "$with_named_thread" != "no"
1496 LIBS="$with_named_thread $LIBS $with_named_thread"
1497 CLIENT_THREAD_LIBS="$with_named_thread"
1498 with_posix_threads="yes"
1499 AC_MSG_RESULT("$with_named_thread")
1502 # pthread_create is in standard libraries (As in BSDI 3.0)
1503 AC_MSG_CHECKING("for pthread_create in -libc");
1505 [#include <pthread.h>],
1506 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1507 with_posix_threads=yes, with_posix_threads=no)
1508 AC_MSG_RESULT("$with_posix_threads")
1509 if test "$with_posix_threads" = "no"
1511 AC_MSG_CHECKING("for pthread_create in -lpthread")
1512 ac_save_LIBS="$LIBS"
1513 LIBS="$LIBS -lpthread"
1514 CLIENT_THREAD_LIBS="-lpthread"
1516 [#include <pthread.h>],
1517 [ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1518 with_posix_threads=yes, with_posix_threads=no)
1519 AC_MSG_RESULT("$with_posix_threads")
1520 if test "$with_posix_threads" = "no"
1522 LIBS=" $ac_save_LIBS -lpthreads"
1523 CLIENT_THREAD_LIBS="-lpthreads"
1524 AC_MSG_CHECKING("for pthread_create in -lpthreads")
1526 [#include <pthread.h>],
1527 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1528 with_posix_threads=yes, with_posix_threads=no)
1529 AC_MSG_RESULT("$with_posix_threads")
1530 if test "$with_posix_threads" = "no"
1532 # This is for FreeBSD
1533 LIBS="$ac_save_LIBS -pthread"
1534 CLIENT_THREAD_LIBS="-pthread"
1535 AC_MSG_CHECKING("for pthread_create in -pthread")
1537 [#include <pthread.h>],
1538 [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
1539 with_posix_threads=yes, with_posix_threads=no)
1540 AC_MSG_RESULT("$with_posix_threads")
1546 #---START: Used in for client configure
1547 # Must be checked after, because strtok_r may be in -lpthread
1548 # On AIX strtok_r is in libc_r
1550 my_save_LIBS="$LIBS"
1551 AC_CHECK_LIB(pthread,strtok_r)
1552 LIBS="$my_save_LIBS"
1553 if test "$ac_cv_lib_pthread_strtok_r" = "no"
1555 AC_CHECK_LIB(c_r,strtok_r)
1556 case "$with_osf32_threads---$target_os" in
1557 # Don't keep -lc_r in LIBS; -pthread handles it magically
1558 yes---* | *---freebsd* | *---hpux*) LIBS="$my_save_LIBS" ;;
1561 AC_CHECK_FUNCS(strtok_r pthread_init)
1563 AC_CHECK_FUNCS(strtok_r)
1568 case "$with_mysqld_ldflags " in
1571 # No need to check for dlopen when mysqld is linked with
1572 # -all-static as it won't be able to load any functions.
1573 # NOTE! It would be better if it was possible to test if dlopen
1574 # can be used, but a good way to test it couldn't be found
1579 # Check for dlopen, needed for user definable functions
1580 # This must be checked after threads on AIX
1581 # We only need this for mysqld, not for the clients.
1583 my_save_LIBS="$LIBS"
1585 AC_CHECK_LIB(dl,dlopen)
1587 LIBS="$my_save_LIBS"
1590 my_save_LIBS="$LIBS"
1592 AC_CHECK_FUNCS(dlopen dlerror)
1593 LIBS="$my_save_LIBS"
1599 # System characteristics
1600 case $SYSTEM_TYPE in
1603 AC_SYS_RESTARTABLE_SYSCALLS
1607 # Build optimized or debug version ?
1608 # First check for gcc and g++
1609 if test "$GCC" = "yes"
1612 DEBUG_OPTIMIZE_CC="-O"
1613 OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE"
1616 DEBUG_OPTIMIZE_CC=""
1617 case $SYSTEM_TYPE in
1619 OPTIMIZE_CFLAGS="-O1"
1622 OPTIMIZE_CFLAGS="-O"
1626 if test "$GXX" = "yes"
1629 DEBUG_OPTIMIZE_CXX="-O"
1630 OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE"
1632 DEBUG_OPTIMIZE_CXX=""
1633 case $SYSTEM_TYPE in
1635 DEBUG_CXXFLAGS="-g0"
1636 OPTIMIZE_CXXFLAGS="-O1"
1640 OPTIMIZE_CXXFLAGS="-O"
1645 case $SYSTEM_TYPE in
1647 DEBUG_CFLAGS="-g -DDEBUG -sym internal,codeview4"
1648 DEBUG_CXXFLAGS="-g -DDEBUG -sym internal,codeview4"
1649 DEBUG_OPTIMIZE_CC="-DDEBUG"
1650 DEBUG_OPTIMIZE_CXX="-DDEBUG"
1651 OPTIMIZE_CFLAGS="-O3 -DNDEBUG"
1652 OPTIMIZE_CXXFLAGS="-O3 -DNDEBUG"
1656 # If the user specified CFLAGS, we won't add any optimizations
1657 if test -n "$SAVE_CFLAGS"
1660 DEBUG_OPTIMIZE_CC=""
1662 # Ditto for CXXFLAGS
1663 if test -n "$SAVE_CXXFLAGS"
1665 OPTIMIZE_CXXFLAGS=""
1666 DEBUG_OPTIMIZE_CXX=""
1669 if test "$with_debug" = "yes"
1672 AC_DEFINE([DBUG_ON], [1], [Use libdbug])
1673 CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DSAFE_MUTEX $CFLAGS"
1674 CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS"
1675 elif test "$with_debug" = "full"
1677 # Full debug. Very slow in some cases
1678 AC_DEFINE([DBUG_ON], [1], [Use libdbug])
1679 CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
1680 CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
1682 # Optimized version. No debug
1683 AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])
1684 CFLAGS="$OPTIMIZE_CFLAGS $CFLAGS"
1685 CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
1688 AC_ARG_WITH([valgrind],
1689 [AS_HELP_STRING([--with-valgrind],
1690 [Valgrind instrumentation @<:@default=no@:>@])],
1691 [], [with_valgrind=no])
1693 if test "$with_valgrind" != "no"
1695 AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h],
1696 [AC_DEFINE([HAVE_VALGRIND], [1], [Define for Valgrind support])])
1699 # Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
1700 AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
1701 AC_ARG_ENABLE(debug_sync,
1702 AS_HELP_STRING([--enable-debug-sync],
1703 [Build a version with Debug Sync Facility]),
1704 [ enable_debug_sync=$enableval ],
1705 [ enable_debug_sync=$with_debug ])
1707 if test "$enable_debug_sync" != "no"
1709 AC_DEFINE([ENABLED_DEBUG_SYNC], [1],
1710 [If Debug Sync Facility should be enabled])
1711 AC_MSG_RESULT([yes])
1716 # If we should allow error injection tests
1717 AC_ARG_WITH(error-inject,
1718 AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
1719 [ with_error_inject=$withval ],
1720 [ with_error_inject=no ])
1722 if test $with_debug != "no"
1724 if test "$with_error_inject" = "yes"
1726 AC_DEFINE([ERROR_INJECT_SUPPORT], [1],
1727 [Enable error injection in MySQL Server])
1731 AC_ARG_WITH([fast-mutexes],
1732 AC_HELP_STRING([--with-fast-mutexes],
1733 [Compile with fast mutexes (default is disabled)]),
1734 [with_fast_mutexes=$withval], [with_fast_mutexes=no])
1736 if test "$with_fast_mutexes" != "no"
1738 if test "$with_debug" != "no"
1740 AC_MSG_WARN(['--with-fast-mutexes' ignored when '--with-debug' is given])
1742 AC_DEFINE([MY_PTHREAD_FASTMUTEX], [1],
1743 [Define to 1 if you want to use fast mutexes])
1747 AC_ARG_WITH([atomic-ops],
1748 AC_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
1749 [Implement atomic operations using pthread rwlocks or atomic CPU
1750 instructions for multi-processor (default) or uniprocessor
1751 configuration]), , [with_atomic_ops=smp])
1752 case "$with_atomic_ops" in
1753 "up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
1754 [Assume single-CPU mode, no concurrency]) ;;
1755 "rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
1756 [Use pthread rwlocks for atomic ops]) ;;
1758 *) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
1761 AC_CACHE_CHECK([whether the compiler provides atomic builtins],
1762 [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
1765 int foo= -10; int bar= 10;
1766 if (!__sync_fetch_and_add(&foo, bar) || foo)
1768 bar= __sync_lock_test_and_set(&foo, bar);
1769 if (bar || foo != 10)
1771 bar= __sync_val_compare_and_swap(&bar, foo, 15);
1776 ], [mysql_cv_gcc_atomic_builtins=yes],
1777 [mysql_cv_gcc_atomic_builtins=no],
1778 [mysql_cv_gcc_atomic_builtins=no])])
1780 if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
1781 AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
1782 [Define to 1 if compiler provides atomic builtins.])
1785 # Force static compilation to avoid linking problems/get more speed
1786 AC_ARG_WITH(mysqld-ldflags,
1787 [ --with-mysqld-ldflags Extra linking arguments for mysqld],
1788 [MYSQLD_EXTRA_LDFLAGS=$withval],
1789 [MYSQLD_EXTRA_LDFLAGS=])
1790 AC_SUBST(MYSQLD_EXTRA_LDFLAGS)
1792 AC_ARG_WITH(client-ldflags,
1793 [ --with-client-ldflags Extra linking arguments for clients],
1794 [CLIENT_EXTRA_LDFLAGS=$withval],
1795 [CLIENT_EXTRA_LDFLAGS=])
1796 AC_SUBST(CLIENT_EXTRA_LDFLAGS)
1798 AC_ARG_WITH(mysqld-libs,
1799 [ --with-mysqld-libs Extra libraries to link with for mysqld],
1800 [MYSQLD_EXTRA_LIBS=$withval],
1801 [MYSQLD_EXTRA_LIBS=])
1802 AC_SUBST(MYSQLD_EXTRA_LIBS)
1804 AC_ARG_WITH(lib-ccflags,
1805 [ --with-lib-ccflags Extra CC options for libraries],
1806 [LIB_EXTRA_CCFLAGS=$withval],
1807 [LIB_EXTRA_CCFLAGS=])
1808 AC_SUBST(LIB_EXTRA_CCFLAGS)
1810 # Avoid stupid bug on some OS
1811 AC_ARG_WITH(low-memory,
1812 [ --with-low-memory Try to use less memory to compile to avoid
1813 memory limitations.],
1814 [with_lowmem=$withval],
1816 if test "$with_lowmem" = "yes"
1818 if test "$ac_cv_prog_gcc" = "yes"
1820 LM_CFLAGS="-fno-inline"
1829 AC_ARG_WITH(comment,
1830 [ --with-comment Comment about compilation environment.],
1831 [with_comment=$withval],
1833 if test "$with_comment" != "no"
1835 COMPILATION_COMMENT=$with_comment
1837 COMPILATION_COMMENT="Source distribution"
1839 AC_SUBST(COMPILATION_COMMENT)
1841 AC_MSG_CHECKING("need of special linking flags")
1842 if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
1844 LDFLAGS="$LDFLAGS -rdynamic"
1845 AC_MSG_RESULT("-rdynamic")
1847 case "$SYSTEM_TYPE$with_mysqld_ldflags " in
1848 *freebsd*"-all-static "*|*dragonfly*"-all-static "*)
1849 AC_MSG_RESULT("none")
1851 *freebsd*|*dragonfly*)
1852 MYSQLD_EXTRA_LDFLAGS="$MYSQLD_EXTRA_LDFLAGS -export-dynamic"
1853 AC_MSG_RESULT("-export-dynamic")
1856 AC_MSG_RESULT("none")
1861 dnl Checks for typedefs, structures, and compiler characteristics.
1868 MYSQL_NEEDS_MYSYS_NEW
1869 # AC_CHECK_SIZEOF return 0 when it does not find the size of a
1870 # type. We want a error instead.
1871 AC_CHECK_SIZEOF(char, 1)
1872 if test "$ac_cv_sizeof_char" -eq 0
1874 AC_MSG_ERROR([No size for char type.
1875 A likely cause for this could be that there isn't any
1876 static libraries installed. You can verify this by checking if you have libm.a
1877 in /lib, /usr/lib or some other standard place. If this is the problem,
1878 install the static libraries and try again. If this isn't the problem,
1879 examine config.log for possible errors. If you want to report this, use
1880 'scripts/mysqlbug' and include at least the last 20 rows from config.log!])
1882 AC_CHECK_SIZEOF(char*, 4)
1883 AC_CHECK_SIZEOF(short, 2)
1884 AC_CHECK_SIZEOF(int, 4)
1885 if test "$ac_cv_sizeof_int" -eq 0
1887 AC_MSG_ERROR("No size for int type.")
1889 AC_CHECK_SIZEOF(long, 4)
1890 if test "$ac_cv_sizeof_long" -eq 0
1892 AC_MSG_ERROR("No size for long type.")
1894 AC_CHECK_SIZEOF(long long, 8)
1895 if test "$ac_cv_sizeof_long_long" -eq 0
1897 AC_MSG_ERROR("MySQL needs a long long type.")
1899 # off_t is not a builtin type
1900 AC_CHECK_SIZEOF(off_t, 4)
1901 if test "$ac_cv_sizeof_off_t" -eq 0
1903 AC_MSG_ERROR("MySQL needs a off_t type.")
1907 dnl check if time_t is unsigned
1913 dnl check size of time_t
1916 AC_CHECK_SIZEOF(time_t, 8)
1917 if test "$ac_cv_sizeof_time_t" -eq 0
1919 AC_MSG_ERROR("MySQL needs a time_t type.")
1922 # do we need #pragma interface/#pragma implementation ?
1923 # yes if it's gcc 2.x, and not icc pretending to be gcc, and not cygwin
1924 AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
1925 # instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
1926 # follow any standard), we'll use well-defined preprocessor macros:
1928 #if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
1929 #error USE_PRAGMA_IMPLEMENTATION
1931 ],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
1933 # This always gives a warning. Ignore it unless you are cross compiling
1935 #---START: Used in for client configure
1936 # Check base type of last arg to accept
1939 # Figure out what type of struct rlimit to use with setrlimit
1940 MYSQL_TYPE_STRUCT_RLIMIT
1941 # Find where the stack goes
1942 MYSQL_STACK_DIRECTION
1943 # We want to skip alloca on irix unconditionally. It may work on some version..
1945 # Do struct timespec have members tv_sec or ts_sec
1947 # Do we have the tzname variable
1949 # Do the c++ compiler have a bool type
1951 # Check some common bugs with gcc 2.8.# on sparc
1952 case $SYSTEM_TYPE in
1955 MYSQL_CHECK_LONGLONG_TO_FLOAT
1956 if test "$ac_cv_conv_longlong_to_float" != "yes"
1958 AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float!
1959 If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try
1964 AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include <sys/types.h>])
1965 AC_CHECK_TYPES([size_t], [], [], [#include <stdio.h>])
1966 AC_CHECK_TYPES([u_int32_t])
1970 ######################################################################
1971 # For readline/libedit (We simply move the mimimum amount of stuff from
1972 # the readline/libedit configure.in here)
1974 dnl Checks for header files.
1975 AC_CHECK_HEADERS(malloc.h sys/cdefs.h)
1977 dnl Checks for library functions.
1979 AC_PROG_GCC_TRADITIONAL
1981 AC_CHECK_FUNCS(re_comp regcomp strdup)
1983 dnl Sun compilers have their own vis.h that is about something
1984 dnl totally different. So, not to change the libedit source, we
1985 dnl do some additional checks before we define HAVE_VIS_H.
1986 AC_CHECK_HEADER(vis.h,
1987 [AC_CHECK_FUNC(strvis,
1988 [AC_DEFINE([HAVE_VIS_H], [1],[Found vis.h and the strvis() function])])])
1990 AC_CHECK_FUNCS(strlcat strlcpy)
1991 AC_CHECK_FUNCS(issetugid getuid geteuid getgid getegid)
1992 AC_CHECK_FUNCS(fgetln)
1993 AC_CHECK_FUNCS(getline flockfile)
1995 # from old readline settting:
1998 AC_SUBST(MAKE_SHELL)
2000 # Already-done: stdlib.h string.h unistd.h termios.h
2001 AC_CHECK_HEADERS(varargs.h stdarg.h dirent.h locale.h ndir.h sys/dir.h \
2002 sys/file.h sys/ndir.h sys/ptem.h sys/pte.h sys/select.h sys/stream.h \
2003 sys/mman.h curses.h termcap.h termio.h termbits.h asm/termbits.h grp.h \
2004 paths.h semaphore.h)
2006 # Already-done: strcasecmp
2007 AC_CHECK_FUNCS(lstat putenv select setenv setlocale strcoll tcgetattr)
2009 AC_STAT_MACROS_BROKEN
2011 MYSQL_CHECK_GETPW_FUNCS
2012 MYSQL_HAVE_TIOCGWINSZ
2015 MYSQL_STRUCT_DIRENT_D_INO
2016 MYSQL_STRUCT_DIRENT_D_NAMLEN
2017 MYSQL_TYPE_SIGHANDLER
2018 MYSQL_CHECK_MULTIBYTE
2019 if test "$with_named_curses" = "no"
2021 MYSQL_CHECK_LIB_TERMCAP
2023 TERMCAP_LIB="$with_named_curses"
2025 AC_SUBST(TERMCAP_LIB)
2027 # Check if the termcap function 'tgoto' is already declared in
2028 # system header files or if it need to be declared locally
2029 AC_CHECK_DECLS(tgoto,,,[
2030 #ifdef HAVE_CURSES_H
2031 # include <curses.h>
2032 #elif HAVE_NCURSES_H
2033 # include <ncurses.h>
2041 AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
2042 AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
2043 AC_CHECK_FUNC(strlcpy, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcpy.o"])
2044 AC_CHECK_FUNC(strlcat, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS strlcat.o"])
2045 AC_CHECK_FUNC(fgetln, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS fgetln.o"])
2046 AC_SUBST(LIBEDIT_LOBJECTS)
2047 enable_readline="yes"
2049 # End of readline/libedit stuff
2050 #########################################################################
2052 dnl Checks for library functions.
2055 # The following code disables intrinsic function support while we test for
2056 # library functions. This is to avoid configure problems with Intel ecc
2059 ORG_CFLAGS="$CFLAGS"
2060 if test "$GCC" != "yes"; then
2061 AC_SYS_COMPILER_FLAG(-nolib_inline,nolib_inline,CFLAGS,[],[])
2070 AC_CHECK_DECLS([fdatasync, bzero])
2072 AC_CHECK_FUNCS(alarm bfill bmove bsearch bzero \
2073 chsize cuserid fchmod fcntl \
2074 fconvert fdatasync fesetround finite fpresetsticky fpsetmask fsync ftruncate \
2075 getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
2076 getpwuid getrlimit getrusage getwd index initgroups isnan \
2077 localtime_r gethrtime gmtime_r \
2078 locking longjmp lrand48 madvise mallinfo memcpy memmove \
2079 mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
2080 pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
2081 pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
2082 pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
2083 pthread_setprio_np pthread_setschedparam pthread_sigmask readlink \
2084 realpath rename rint rwlock_init setupterm \
2085 shmget shmat shmdt shmctl sigaction sigemptyset sigaddset \
2086 sighold sigset sigthreadmask port_create sleep \
2087 snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \
2088 strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \
2089 posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd printstack \
2096 *-*-aix4* | *-*-sco*)
2097 # (grr) aix 4.3 has a stub for clock_gettime, (returning ENOSYS)
2098 # and using AC_TRY_RUN is hard when cross-compiling
2099 # We also disable for SCO for the time being, the headers for the
2100 # thread library we use conflicts with other headers.
2102 *) AC_CHECK_FUNCS(clock_gettime)
2106 case "$mysql_cv_sys_os" in
2107 OS400) # i5/OS (OS/400) emits a SIGILL (Function not implemented) when
2108 # unsupported priority values are passed to pthread_setschedprio.
2109 # Since the only supported value is 1, treat it as inexistent.
2111 SunOS) # Bug#42599 error: `pthread_setschedprio' was not declared in this scope
2112 # In some installations, the pthread.h header used by GCC does not
2113 # declare the pthread_setscheprio prototype, but the function is
2114 # implemented. Since the function is used in C++ code, ensure that
2115 # the function prototype is present.
2116 AC_MSG_CHECKING([whether pthread_setschedprio is declared])
2119 AC_LANG_PROGRAM([#include <pthread.h>],
2120 [(void)(pthread_setschedprio);])],
2121 [ac_cv_func_pthread_setschedprio=yes],
2122 [ac_cv_func_pthread_setschedprio=no])
2124 AC_MSG_RESULT([$ac_cv_func_pthread_setschedprio])
2125 if test "$ac_cv_func_pthread_setschedprio" = yes; then
2126 AC_DEFINE(HAVE_PTHREAD_SETSCHEDPRIO, 1,
2127 [Define to 1 if you have the `pthread_setschedprio' function.])
2130 *) AC_CHECK_FUNCS(pthread_setschedprio)
2134 # Check that isinf() is available in math.h and can be used in both C and C++
2136 AC_MSG_CHECKING(for isinf in <math.h>)
2137 AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
2139 AC_MSG_CHECKING(whether isinf() is safe to use in C code)
2147 return !isinf(a * b);
2150 [AC_MSG_RESULT(yes)],
2152 AC_DEFINE([HAVE_BROKEN_ISINF], [1],
2153 [Define to 1 if isinf() uses 80-bit register for intermediate values])
2156 # Let's be optimistic when cross-compiling, since the only compiler known
2157 # to be affected by this isinf() bug is GCC 4.3 on 32-bit x86.
2158 AC_MSG_RESULT([[cross-compiling, assuming 'yes']])
2160 AC_MSG_CHECKING(whether isinf() can be used in C++ code)
2163 AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
2165 AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
2170 CFLAGS="$ORG_CFLAGS"
2172 # Sanity check: We chould not have any fseeko symbol unless
2173 # large_file_support=yes
2174 AC_CHECK_FUNC(fseeko,
2175 [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true";
2177 AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!")
2181 # Check definition of gethostbyaddr_r (glibc2 defines this with 8 arguments)
2182 ac_save_CXXFLAGS="$CXXFLAGS"
2183 AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
2187 # Test whether madvise() is declared in C++ code -- it is not on some
2188 # systems, such as Solaris
2189 AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
2190 #include <sys/types.h>
2191 #include <sys/mman.h>
2194 # Do not treat warnings as errors if we are linking against other libc
2195 # this is to work around gcc not being permissive on non-system includes
2196 # with respect to ANSI C++
2197 # We also remove the -fbranch-probabilities option as this will give warnings
2198 # about not profiled code, which confuses configure
2199 # We also must remove -W and -Wcheck which on icc produces warnings that
2200 # we don't want to catch with -Werror
2202 if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
2204 CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
2209 #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2212 #include <pthread.h>
2213 #include <sys/types.h>
2214 #include <sys/socket.h>
2215 #include <netinet/in.h>
2216 #include <arpa/inet.h>
2217 #include <netdb.h>],
2219 struct hostent *foo = gethostbyaddr_r((const char *) 0,
2220 0, 0, (struct hostent *) 0, (char *) NULL, 0, &skr); return (foo == 0);],
2221 mysql_cv_gethost_style=solaris, mysql_cv_gethost_style=other))
2223 CXXFLAGS="$ac_save_CXXFLAGS"
2224 if test "$mysql_cv_gethost_style" = "solaris"
2226 AC_DEFINE([HAVE_SOLARIS_STYLE_GETHOST], [1],
2227 [Solaris define gethostbyaddr_r with 7 arguments. glibc2 defines this with 8 arguments])
2230 #---START: Used in for client configure
2232 # Check definition of gethostbyname_r (glibc2.0.100 is different from Solaris)
2233 ac_save_CXXFLAGS="$CXXFLAGS"
2234 AC_CACHE_CHECK([style of gethostbyname_r routines], mysql_cv_gethostbyname_style,
2237 if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
2239 CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
2243 #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2246 #include <pthread.h>
2247 #include <sys/types.h>
2248 #include <sys/socket.h>
2249 #include <netinet/in.h>
2250 #include <arpa/inet.h>
2251 #include <netdb.h>],
2254 skr = gethostbyname_r((const char *) 0,
2255 (struct hostent*) 0, (char*) 0, 0, (struct hostent **) 0, &skr);],
2256 mysql_cv_gethostbyname_style=glibc2, mysql_cv_gethostbyname_style=other))
2258 CXXFLAGS="$ac_save_CXXFLAGS"
2259 if test "$mysql_cv_gethostbyname_style" = "glibc2"
2261 AC_DEFINE([HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE], [1],
2262 [Solaris define gethostbyname_r with 5 arguments. glibc2 defines this with 6 arguments])
2265 # Check 3rd argument of getthostbyname_r
2266 ac_save_CXXFLAGS="$CXXFLAGS"
2267 AC_CACHE_CHECK([3 argument to gethostbyname_r routines], mysql_cv_gethostbyname_arg,
2270 if test "$ac_cv_prog_gxx" = "yes" -a "$with_other_libc" = "no"
2272 CXXFLAGS=`echo "$CXXFLAGS -Werror" | sed -e 's/-fbranch-probabilities//; s/-Wall//; s/-ansi//; s/-pedantic//; s/-Wcheck//'`
2276 #if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2279 #include <pthread.h>
2280 #include <sys/types.h>
2281 #include <sys/socket.h>
2282 #include <netinet/in.h>
2283 #include <arpa/inet.h>
2284 #include <netdb.h>],
2287 skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);],
2288 mysql_cv_gethostbyname_arg=hostent_data, mysql_cv_gethostbyname_arg=char))
2290 CXXFLAGS="$ac_save_CXXFLAGS"
2291 if test "$mysql_cv_gethostbyname_arg" = "hostent_data"
2293 AC_DEFINE([HAVE_GETHOSTBYNAME_R_RETURN_INT], [1],
2294 [In OSF 4.0f the 3'd argument to gethostbyname_r is hostent_data *])
2298 # Check definition of pthread_getspecific
2299 AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
2301 [#if !defined(SCO) && !defined(__osf__) && !defined(_REENTRANT)
2304 #define _POSIX_PTHREAD_SEMANTICS
2305 #include <pthread.h> ],
2306 [ void *pthread_getspecific(pthread_key_t key);
2307 pthread_getspecific((pthread_key_t) NULL); ],
2308 mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
2309 if test "$mysql_cv_getspecific_args" = "other"
2311 AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
2312 [For some non posix threads])
2315 # Check definition of pthread_mutex_init
2316 AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
2318 [#if !defined(SCO) && !defined(__osf__)
2321 #define _POSIX_PTHREAD_SEMANTICS
2322 #include <pthread.h> ],
2324 pthread_mutexattr_t attr;
2326 pthread_mutex_init(&mp,&attr); ],
2327 mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
2328 if test "$mysql_cv_mutex_init_args" = "other"
2330 AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
2331 [For some non posix threads])
2335 #---START: Used in for client configure
2336 # Check definition of readdir_r
2337 AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
2339 [#if !defined(SCO) && !defined(__osf__)
2342 #define _POSIX_PTHREAD_SEMANTICS
2343 #include <pthread.h>
2344 #include <dirent.h>],
2345 [ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
2346 readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
2347 mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
2348 if test "$mysql_cv_readdir_r" = "POSIX"
2350 AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
2353 # Check definition of posix sigwait()
2354 AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
2356 [#if !defined(SCO) && !defined(__osf__)
2359 #define _POSIX_PTHREAD_SEMANTICS
2360 #include <pthread.h>
2361 #include <signal.h>],
2367 mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
2368 if test "$mysql_cv_sigwait" = "POSIX"
2370 AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
2373 if test "$mysql_cv_sigwait" != "POSIX"
2375 unset mysql_cv_sigwait
2376 # Check definition of posix sigwait()
2377 AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
2379 [#if !defined(SCO) && !defined(__osf__)
2382 #define _POSIX_PTHREAD_SEMANTICS
2383 #include <pthread.h>
2384 #include <signal.h>],
2388 mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
2389 if test "$mysql_cv_sigwait" = "NONPOSIX"
2391 AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
2396 # Check if pthread_attr_setscope() exists
2397 AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
2399 [#if !defined(SCO) && !defined(__osf__)
2402 #define _POSIX_PTHREAD_SEMANTICS
2403 #include <pthread.h>],
2404 [pthread_attr_t thr_attr;
2405 pthread_attr_setscope(&thr_attr,0);],
2406 mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
2407 if test "$mysql_cv_pthread_attr_setscope" = "yes"
2409 AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
2412 # Check for bad includes
2413 AC_MSG_CHECKING("can netinet files be included")
2415 [#include <sys/types.h>
2416 #include <sys/socket.h>
2417 #include <netinet/in_systm.h>
2418 #include <netinet/in.h>
2419 #include <netinet/ip.h>
2420 #include <netinet/tcp.h>],
2422 netinet_inc=yes, netinet_inc=no)
2423 if test "$netinet_inc" = "no"
2425 AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
2427 AC_MSG_RESULT("$netinet_inc")
2429 AC_CACHE_CHECK([support for weak symbols], mysql_cv_weak_symbol,
2431 extern void __attribute__((weak)) foo(void);
2432 ], [mysql_cv_weak_symbol=yes], [mysql_cv_weak_symbol=no])])
2434 if test "x$mysql_cv_weak_symbol" = xyes; then
2435 AC_DEFINE(HAVE_WEAK_SYMBOL, 1,
2436 [Define to 1 if compiler supports weak symbol attribute.])
2439 AC_CACHE_CHECK([whether __bss_start is defined], mysql_cv_bss_start,
2441 extern char *__bss_start;
2442 return __bss_start ? 1 : 0;
2443 ], [mysql_cv_bss_start=yes], [mysql_cv_bss_start=no])])
2445 if test "x$mysql_cv_bss_start" = xyes; then
2446 AC_DEFINE(HAVE_BSS_START, 1,
2447 [Define to 1 if compiler defines __bss_start.])
2452 AC_CHECK_HEADERS(cxxabi.h)
2453 AC_CACHE_CHECK([for abi::__cxa_demangle], mysql_cv_cxa_demangle,
2454 [AC_TRY_LINK([#include <cxxabi.h>], [
2455 char *foo= 0; int bar= 0;
2456 foo= abi::__cxa_demangle(foo, foo, 0, &bar);
2457 ], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])])
2460 if test "x$mysql_cv_cxa_demangle" = xyes; then
2461 AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
2462 [Define to 1 if you have the `abi::__cxa_demangle' function.])
2465 #--------------------------------------------------------------------
2466 # Check for requested features
2467 #--------------------------------------------------------------------
2469 MYSQL_CHECK_BIG_TABLES
2470 MYSQL_CHECK_MAX_INDEXES
2474 #--------------------------------------------------------------------
2475 # Declare our plugin modules
2476 # Has to be done late, as the plugin may need to check for existence of
2477 # functions tested above
2478 #--------------------------------------------------------------------
2480 MYSQL_STORAGE_ENGINE(partition, partition, [Partition Support],
2481 [MySQL Partitioning Support], [max,max-no-ndb])
2483 dnl -- ndbcluster requires partition to be enabled
2485 MYSQL_CONFIGURE_PLUGINS([none])
2487 # Only build client code?
2489 [ --without-server Only build the client.],
2490 [with_server=$withval],
2494 AC_ARG_WITH(embedded-server,
2495 [ --with-embedded-server Build the embedded server (libmysqld).],
2496 [with_embedded_server=$withval],
2497 [with_embedded_server=no]
2500 AC_ARG_WITH(query_cache,
2501 [ --without-query-cache Do not build query cache.],
2502 [with_query_cache=$withval],
2503 [with_query_cache=yes]
2506 if test "$with_query_cache" = "yes"
2508 AC_DEFINE([HAVE_QUERY_CACHE], [1], [If we want to have query cache])
2511 AC_ARG_WITH(geometry,
2512 [ --without-geometry Do not build geometry-related parts.],
2513 [with_geometry=$withval],
2517 if test "$with_geometry" = "yes"
2519 AC_DEFINE([HAVE_SPATIAL], [1], [Spatial extentions])
2520 AC_DEFINE([HAVE_RTREE_KEYS], [1], [RTree keys])
2523 AC_ARG_WITH(embedded_privilege_control,
2524 [ --with-embedded-privilege-control
2525 Build parts to check user's privileges.
2526 Only affects embedded library.],
2527 [with_embedded_privilege_control=$withval],
2528 [with_embedded_privilege_control=no]
2531 if test "$with_embedded_privilege_control" = "yes"
2533 AC_DEFINE([HAVE_EMBEDDED_PRIVILEGE_CONTROL], [1],
2534 [Access checks in embedded library])
2539 AC_ARG_WITH([mysqlmanager],
2540 AC_HELP_STRING([--with-mysqlmanager], [Build the mysqlmanager binary: yes/no (default: build if server is built.)]),,)
2542 if test "$with_mysqlmanager" = "yes" -o \
2543 '(' "$with_mysqlmanager:$with_server" = ":yes" -a \
2544 -d "$srcdir/server-tools" ')' ; then
2545 tools_dirs="server-tools"
2548 AC_SUBST(tools_dirs)
2553 if test "$with_embedded_server" = "yes"
2555 libmysqld_dirs=libmysqld
2557 # We can't build embedded library without building the server, because
2558 # we depend on libmysys, libmystrings, libmyisam, etc.
2561 # XXX: We need to add @libmysqld_extra_libs@ (or whatever) so that
2562 # mysql_config --libmysqld-libs will print out something like
2563 # -L/path/to/lib/mysql -lmysqld -lmyisam -lmysys -lmystrings -ldbug ...
2564 AC_SUBST([libmysqld_dirs])
2566 # Shall we build the docs?
2568 [ --without-docs Skip building of the documentation.],
2569 [with_docs=$withval],
2573 if test "$with_docs" = "yes"
2576 if test -f "$srcdir/Docs/manual.chm" ; then
2577 extra_docs="manual.chm"
2584 AC_SUBST(extra_docs)
2586 # Shall we build the man pages?
2588 [ --without-man Skip building of the man pages.],
2589 [with_man=$withval],
2593 # Don't build readline, i have it already
2594 AC_ARG_WITH(readline,
2595 [ --without-readline Use system readline instead of bundled copy.],
2596 [ with_readline=$withval ],
2597 [ with_readline=undefined ]
2600 AC_ARG_WITH(libedit,
2601 [ --without-libedit Use system libedit instead of bundled copy.],
2602 [ with_libedit=$withval ],
2603 [ with_libedit=undefined ]
2606 if test "$with_readline/$with_libedit" = "undefined/undefined" -a ! -e "$srcdir/cmd-line-utils"
2613 # We support next variants of compilation:
2615 # | yes | no | undefined
2616 # --with-libedit | | |
2617 # ---------------+----------------+------+----------------------------------
2618 # yes | ERROR! | use libedit from mysql sources
2619 # ---------------+----------------+------+----------------------------------
2620 # no | use readline | use system readline or external libedit
2621 # | from mysql | according to results of m4 tests
2622 # ---------------+ sources (if it + +----------------------------------
2623 # undefined | is presented) | | use libedit from mysql sources
2626 compile_readline="no"
2627 compile_libedit="no"
2629 if [test "$with_libedit" = "yes"] && [test "$with_readline" = "yes"]
2631 AC_MSG_ERROR([You can not use --with-readline and --with-libedit at the same time, please choose one of it])
2637 readline_h_ln_cmd=""
2639 want_to_use_readline="no"
2641 case $SYSTEM_TYPE in
2643 # For NetWare, do not need readline
2644 echo "Skipping readline"
2647 if [test "$with_libedit" = "yes"] || [test "$with_libedit" = "undefined"] && [test "$with_readline" = "undefined"]
2649 readline_topdir="cmd-line-utils"
2650 readline_basedir="libedit"
2651 readline_dir="$readline_topdir/$readline_basedir"
2652 readline_link="\$(top_builddir)/cmd-line-utils/libedit/libedit.a"
2653 readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/libedit/readline readline"
2655 AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, 1)
2656 AC_DEFINE_UNQUOTED(USE_LIBEDIT_INTERFACE, 1)
2657 elif test "$with_readline" = "yes"
2659 readline_topdir="cmd-line-utils"
2660 readline_basedir="readline"
2661 readline_dir="$readline_topdir/$readline_basedir"
2662 readline_link="\$(top_builddir)/cmd-line-utils/readline/libreadline.a"
2663 readline_h_ln_cmd="\$(LN) -s \$(top_srcdir)/cmd-line-utils/readline readline"
2664 compile_readline=yes
2665 want_to_use_readline="yes"
2666 AC_DEFINE_UNQUOTED(USE_NEW_READLINE_INTERFACE, 1)
2668 # Use system readline library
2671 MYSQL_CHECK_LIBEDIT_INTERFACE
2672 MYSQL_CHECK_NEW_RL_INTERFACE
2673 MYSQL_CHECK_READLINE_DECLARES_HIST_ENTRY
2675 if [test "$mysql_cv_new_rl_interface" = "yes"] && [test -d "$srcdir/cmd-line-utils/readline"]
2677 # Use the new readline interface, but only if the package includes a bundled libreadline
2678 # this way we avoid linking commercial source with GPL readline
2679 readline_link="-lreadline"
2680 want_to_use_readline="yes"
2681 elif [test "$mysql_cv_libedit_interface" = "yes"]
2684 readline_link="-ledit"
2686 AC_MSG_ERROR([Could not find system readline or libedit libraries
2687 Use --with-readline or --with-libedit to use the bundled
2688 versions of libedit or readline])
2692 # if there is no readline, but we want to build with readline, we fail
2693 if [test "$want_to_use_readline" = "yes"] && [test ! -d "$srcdir/cmd-line-utils/readline"]
2695 AC_MSG_ERROR([This commercially licensed MySQL source package can't
2696 be built with libreadline. Please use --with-libedit to use
2697 the bundled version of libedit instead.])
2702 AC_SUBST(readline_dir)
2703 AC_SUBST(readline_topdir)
2704 AC_SUBST(readline_basedir)
2705 AC_SUBST(readline_link)
2706 AC_SUBST(readline_h_ln_cmd)
2710 # Include man pages, if desired, adapted to the configured parts.
2711 if test X"$with_man" = Xyes
2713 # First, create the list of all man pages present.
2714 MANLISTFIL=manlist.$$
2715 TMPLISTFIL=`echo $MANLISTFIL | sed -e 's/manlist/tmplist/'`
2716 if test -f $MANLISTFIL -o -f $TMPLISTFIL
2718 echo "Temp file '$MANLISTFIL' or '$TMPLISTFIL' already exists in '`pwd`' - aborting"
2721 touch $MANLISTFIL $TMPLISTFIL
2723 ls $srcdir/man/*.[[18]] > $MANLISTFIL
2725 # Then, remove all those pages from the list which are specific to parts
2726 # (table handlers, features, ...) which are not configured in this run.
2727 AC_MSG_CHECKING("for man pages to remove")
2729 if test X"$with_plugin_ndbcluster" != Xyes
2731 MAN_DROP="$MAN_DROP ndbcluster"
2732 grep -v '/ndb' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
2734 if test X"$with_embedded_server" != Xyes
2736 MAN_DROP="$MAN_DROP embedded"
2737 grep -v 'embedded' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
2739 if test X"$with_plugin_innobase" != Xyes -a X"$with_plugin_innodb_plugin" != Xyes
2741 MAN_DROP="$MAN_DROP innodb"
2742 grep -v 'inno' $MANLISTFIL > $TMPLISTFIL ; mv -f $TMPLISTFIL $MANLISTFIL
2744 AC_MSG_RESULT([$MAN_DROP])
2746 # Finally, split the man pages into sections 1 and 8.
2747 # Get rid of line breaks.
2748 man1_files=`sed -n -e '/\.1$/s/^.*man\///p' <$MANLISTFIL`
2749 man8_files=`sed -n -e '/\.8$/s/^.*man\///p' <$MANLISTFIL`
2752 man1_files=`echo $man1_files`
2753 man8_files=`echo $man8_files`
2754 rm -f $MANLISTFIL $TMPLISTFIL
2761 AC_SUBST(man1_files)
2762 AC_SUBST(man8_files)
2764 # If we have threads generate some library functions and test programs
2769 dnl This probably should be cleaned up more - for now the threaded
2770 dnl client is just using plain-old libs.
2771 sql_client_dirs="strings mysys dbug extra regex libmysql"
2773 AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no")
2775 if test "$THREAD_SAFE_CLIENT" != "no"
2777 sql_client_dirs="$sql_client_dirs libmysql_r"
2778 AC_DEFINE([THREAD_SAFE_CLIENT], [1], [Should the client be thread safe])
2780 sql_client_dirs="$sql_client_dirs client"
2782 CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
2784 AC_SUBST(CLIENT_LIBS)
2785 AC_SUBST(CLIENT_THREAD_LIBS)
2786 AC_SUBST(NON_THREADED_LIBS)
2787 AC_SUBST(STATIC_NSS_FLAGS)
2788 AC_SUBST(sql_client_dirs)
2790 # If configuring for NetWare, build the netware directory
2792 if expr "$SYSTEM_TYPE" : ".*netware.*" > /dev/null
2794 netware_dir="netware"
2796 AC_SUBST(netware_dir)
2797 AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
2799 if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no"
2801 AC_DEFINE([THREAD], [1],
2802 [Define if you want to have threaded code. This may be undef on client code])
2803 # Avoid _PROGRAMS names
2804 THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o"
2805 AC_SUBST(THREAD_LOBJECTS)
2807 AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no")
2809 if test "$with_server" != "no"
2811 server_scripts="mysqld_safe mysql_install_db"
2812 sql_server_dirs="strings mysys dbug extra regex storage plugin"
2814 sql_server="vio sql"
2817 # "innochecksum" is not in the "innobase/" subdirectory, but should be switched
2818 AM_CONDITIONAL([BUILD_INNODB_TOOLS], [test X"$with_plugin_innobase" = Xyes -o X"$with_plugin_innodb_plugin" = Xyes ])
2820 # IMPORTANT - do not modify LIBS past this line - this hack is the only way
2821 # I know to add the static NSS magic if we have static NSS libraries with
2824 LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
2825 LIBS="$LIBS $STATIC_NSS_FLAGS"
2827 AC_SUBST(sql_server_dirs)
2828 AC_SUBST(sql_server)
2829 AC_SUBST(server_scripts)
2831 AC_SUBST(mysql_plugin_dirs)
2832 AC_SUBST(mysql_plugin_libs)
2833 AC_SUBST(mysql_plugin_defs)
2836 # Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
2837 # We support client-only builds by "--without-server", but not vice versa,
2838 # so we start with the client list, then add each server item not yet present.
2839 sql_union_dirs=" $sql_client_dirs "
2840 for DIR in $sql_server_dirs
2842 if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
2844 : # already present, skip
2846 sql_union_dirs="$sql_union_dirs $DIR "
2849 AC_SUBST(sql_union_dirs)
2852 # Setup maintainer mode options by the end to not disturb
2853 # system and other checks.
2855 MY_MAINTAINER_MODE_SETUP
2857 # Some usefull subst
2861 # Set configuration options for make_binary_distribution
2862 case $SYSTEM_TYPE in
2864 MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --no-strip"
2867 : # no change for other platforms yet
2870 AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
2873 if test -d "$srcdir/cmd-line-utils/readline" ; then
2874 AC_CONFIG_FILES(cmd-line-utils/readline/Makefile)
2877 AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
2878 unittest/Makefile unittest/mytap/Makefile unittest/mytap/t/Makefile dnl
2879 unittest/mysys/Makefile unittest/strings/Makefile dnl
2880 unittest/examples/Makefile unittest/my_decimal/Makefile dnl
2881 strings/Makefile regex/Makefile storage/Makefile dnl
2882 man/Makefile BUILD/Makefile vio/Makefile dnl
2883 libmysql/Makefile libmysql_r/Makefile client/Makefile dnl
2884 sql/Makefile sql/share/Makefile dnl
2885 sql/sql_builtin.cc sql-common/Makefile dnl
2886 dbug/Makefile scripts/Makefile include/Makefile dnl
2887 tests/Makefile Docs/Makefile support-files/Makefile dnl
2888 support-files/MacOSX/Makefile support-files/RHEL4-SElinux/Makefile dnl
2889 server-tools/Makefile server-tools/instance-manager/Makefile dnl
2890 cmd-line-utils/Makefile cmd-line-utils/libedit/Makefile dnl
2891 libmysqld/Makefile libmysqld/examples/Makefile dnl
2892 mysql-test/Makefile mysql-test/lib/My/SafeProcess/Makefile dnl
2893 netware/Makefile sql-bench/Makefile dnl
2894 include/mysql_version.h plugin/Makefile win/Makefile)
2896 AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
2898 # Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
2899 AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
2903 # Add warning if user configures with --with-ndbcluster
2904 if test X"$with_plugin_ndbcluster" = Xyes ; then
2906 echo This version of MySQL Cluster is no longer maintained.
2907 echo Please use the separate sources provided for MySQL Cluster instead.
2908 echo See http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster.html
2909 echo for more details.
2912 # The first line "Thank you ..." is checked in ./Do-compile to verify that configure
2913 # ended sucessfully - don't remove it.
2915 echo "Thank you for choosing MySQL!"
2917 echo "Remember to check the platform specific part of the reference manual"
2918 echo "for hints about installing MySQL on your platform."
2919 echo "Also have a look at the files in the Docs directory."