2
2
dnl Process this file with autoconf to produce a configure script.
4
AC_PREREQ(2.52)dnl Minimum Autoconf version required.
4
AC_PREREQ(2.61)dnl Minimum Autoconf version required.
7
AC_CONFIG_SRCDIR([sql/mysqld.cc])
7
8
AC_CONFIG_AUX_DIR(config)
8
AM_CONFIG_HEADER([include/config.h:config.h.in])
9
AC_CONFIG_HEADERS([include/config.h:config.h.in])
10
11
AM_INIT_AUTOMAKE(mysql, 7.0.0, no-define)
12
13
PROTOCOL_VERSION=10
33
34
MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \
34
35
awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'`
36
# Add previous major version for debian package upgrade path
37
MYSQL_PREVIOUS_BASE_VERSION=5.1
39
37
# The port should be constant for a LONG time
40
38
MYSQL_TCP_PORT_DEFAULT=3306
78
76
# Canonicalize the configuration name.
80
78
# Check whether --with-system-type or --without-system-type was given.
81
AC_ARG_WITH(system-type,
82
[ --with-system-type Set the system type, like "sun-solaris10"],
79
AC_ARG_WITH([system-type],
80
[AS_HELP_STRING([--with-system-type],
81
[Set the system type, like "sun-solaris10"])],
83
82
[SYSTEM_TYPE="$withval"],
84
83
[SYSTEM_TYPE="$host_vendor-$host_os"])
85
AC_ARG_WITH(machine-type,
86
[ --with-machine-type Set the machine type, like "powerpc"],
84
AC_ARG_WITH([machine-type],
85
[AS_HELP_STRING([--with-machine-type],
86
[Set the machine type, like "powerpc"])],
87
87
[MACHINE_TYPE="$withval"],
88
88
[MACHINE_TYPE="$host_cpu"])
89
89
AC_SUBST(SYSTEM_TYPE)
270
270
# We should use -Wno-invalid-offsetof flag to disable some warnings from gcc
271
271
# regarding offset() usage in C++ which are done in a safe manner in the
273
CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
273
CXXFLAGS="$CXXFLAGS -Wall -fno-implicit-templates -fno-exceptions -fno-rtti"
274
CFLAGS="$CFLAGS -Wall"
274
275
AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
275
276
[1], [Defined by configure. Use explicit template instantiation.])
728
729
# If we should allow error injection tests
729
730
AC_ARG_WITH(error-inject,
730
AC_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
731
AS_HELP_STRING([--with-error-inject],[Enable error injection in MySQL Server]),
731
732
[ with_error_inject=$withval ],
732
733
[ with_error_inject=no ])
743
744
AC_ARG_WITH([fast-mutexes],
744
AC_HELP_STRING([--with-fast-mutexes],
745
[Compile with fast mutexes (default is disabled)]),
745
AS_HELP_STRING([--with-fast-mutexes],[Compile with fast mutexes (default is disabled)]),
746
746
[with_fast_mutexes=$withval], [with_fast_mutexes=no])
748
748
if test "$with_fast_mutexes" != "no"
769
769
AC_SUBST(COMPILATION_COMMENT)
771
771
AC_MSG_CHECKING("need of special linking flags")
772
if test "$TARGET_LINUX" = "true" -a "$ac_cv_prog_gcc" = "yes" -a "$all_is_static" != "yes"
772
if test "$TARGET_LINUX" = "true" -a "$ac_cv_c_compiler_gnu" = "yes" -a "$all_is_static" != "yes"
774
774
LDFLAGS="$LDFLAGS -rdynamic"
775
775
AC_MSG_RESULT("-rdynamic")
845
844
AC_MSG_CHECKING(the need for @%:@pragma interface/implementation)
846
845
# instead of trying to match SYSTEM_TYPE and CC_VERSION (that doesn't
847
846
# follow any standard), we'll use well-defined preprocessor macros:
847
AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
849
848
#if !defined(__CYGWIN__) && !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3)
850
849
#error USE_PRAGMA_IMPLEMENTATION
852
],AC_MSG_RESULT(no) ,AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION")
851
]])],[AC_MSG_RESULT(no) ],[AC_MSG_RESULT(yes) ; CXXFLAGS="$CXXFLAGS -DUSE_PRAGMA_IMPLEMENTATION"])
854
853
# This always gives a warning. Ignore it unless you are cross compiling
994
993
strtol strtoll strtoul strtoull tell tempnam vidattr \
995
994
posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd)
997
# Check that isinf() is available in math.h and can be used in both C and C++
996
# Check that isinf() is available in math.h and can be used in both C and C++
999
AC_MSG_CHECKING(for isinf in <math.h>)
1000
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
1002
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1005
AC_TRY_LINK([#include <math.h>], [float f = 0.0; int r = isinf(f); return r],
998
AC_MSG_CHECKING(for isinf in math.h)
999
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1006
1004
AC_MSG_RESULT(yes)
1007
AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function]),
1005
AC_MSG_CHECKING(whether isinf() can be used in C++ code)
1007
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[
1013
AC_DEFINE(HAVE_ISINF, [1], [isinf() macro or function])
1012
1022
CFLAGS="$ORG_CFLAGS"
1014
1024
# Sanity check: We chould not have any fseeko symbol unless
1023
1033
# Check definition of pthread_getspecific
1024
1034
AC_CACHE_CHECK("args to pthread_getspecific", mysql_cv_getspecific_args,
1026
[#if !defined(_REENTRANT)
1035
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if !defined(_REENTRANT)
1027
1036
#define _REENTRANT
1029
1038
#define _POSIX_PTHREAD_SEMANTICS
1030
#include <pthread.h> ],
1031
[ void *pthread_getspecific(pthread_key_t key);
1032
pthread_getspecific((pthread_key_t) NULL); ],
1033
mysql_cv_getspecific_args=POSIX, mysql_cv_getspecific_args=other))
1039
#include <pthread.h> ]], [[ void *pthread_getspecific(pthread_key_t key);
1040
pthread_getspecific((pthread_key_t) NULL); ]])],[mysql_cv_getspecific_args=POSIX],[mysql_cv_getspecific_args=other]))
1034
1041
if test "$mysql_cv_getspecific_args" = "other"
1036
1043
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
1040
1047
# Check definition of pthread_mutex_init
1041
1048
AC_CACHE_CHECK("args to pthread_mutex_init", mysql_cv_mutex_init_args,
1049
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1044
1050
#define _POSIX_PTHREAD_SEMANTICS
1045
#include <pthread.h> ],
1051
#include <pthread.h> ]], [[
1047
1052
pthread_mutexattr_t attr;
1048
1053
pthread_mutex_t mp;
1049
pthread_mutex_init(&mp,&attr); ],
1050
mysql_cv_mutex_init_args=POSIX, mysql_cv_mutex_init_args=other))
1054
pthread_mutex_init(&mp,&attr); ]])],[mysql_cv_mutex_init_args=POSIX],[mysql_cv_mutex_init_args=other]))
1051
1055
if test "$mysql_cv_mutex_init_args" = "other"
1053
1057
AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
1058
1062
#---START: Used in for client configure
1059
1063
# Check definition of readdir_r
1060
1064
AC_CACHE_CHECK("args to readdir_r", mysql_cv_readdir_r,
1065
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1063
1066
#define _POSIX_PTHREAD_SEMANTICS
1064
1067
#include <pthread.h>
1065
#include <dirent.h>],
1066
[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1067
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ],
1068
mysql_cv_readdir_r=POSIX, mysql_cv_readdir_r=other))
1068
#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
1069
readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],[mysql_cv_readdir_r=POSIX],[mysql_cv_readdir_r=other]))
1069
1070
if test "$mysql_cv_readdir_r" = "POSIX"
1071
1072
AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
1074
1075
# Check definition of posix sigwait()
1075
1076
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
1077
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1078
1078
#define _POSIX_PTHREAD_SEMANTICS
1079
1079
#include <pthread.h>
1080
#include <signal.h>],
1080
#include <signal.h>]], [[#ifndef _AIX
1084
1083
sigwait(&set,&sig);
1086
mysql_cv_sigwait=POSIX, mysql_cv_sigwait=other))
1084
#endif]])],[mysql_cv_sigwait=POSIX],[mysql_cv_sigwait=other]))
1087
1085
if test "$mysql_cv_sigwait" = "POSIX"
1089
1087
AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
1094
1092
unset mysql_cv_sigwait
1095
1093
# Check definition of posix sigwait()
1096
1094
AC_CACHE_CHECK("style of sigwait", mysql_cv_sigwait,
1095
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1099
1096
#define _POSIX_PTHREAD_SEMANTICS
1100
1097
#include <pthread.h>
1101
#include <signal.h>],
1098
#include <signal.h>]], [[sigset_t set;
1105
mysql_cv_sigwait=NONPOSIX, mysql_cv_sigwait=other))
1100
sigwait(&set);]])],[mysql_cv_sigwait=NONPOSIX],[mysql_cv_sigwait=other]))
1106
1101
if test "$mysql_cv_sigwait" = "NONPOSIX"
1108
1103
AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
1113
1108
# Check if pthread_attr_setscope() exists
1114
1109
AC_CACHE_CHECK("for pthread_attr_setscope", mysql_cv_pthread_attr_setscope,
1110
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define _REENTRANT
1117
1111
#define _POSIX_PTHREAD_SEMANTICS
1118
#include <pthread.h>],
1119
[pthread_attr_t thr_attr;
1120
pthread_attr_setscope(&thr_attr,0);],
1121
mysql_cv_pthread_attr_setscope=yes, mysql_cv_pthread_attr_setscope=no))
1112
#include <pthread.h>]], [[pthread_attr_t thr_attr;
1113
pthread_attr_setscope(&thr_attr,0);]])],[mysql_cv_pthread_attr_setscope=yes],[mysql_cv_pthread_attr_setscope=no]))
1122
1114
if test "$mysql_cv_pthread_attr_setscope" = "yes"
1124
1116
AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
1127
1119
# Check for bad includes
1128
1120
AC_MSG_CHECKING("can netinet files be included")
1130
[#include <sys/types.h>
1121
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1131
1122
#include <sys/socket.h>
1132
1123
#include <netinet/in_systm.h>
1133
1124
#include <netinet/in.h>
1134
1125
#include <netinet/ip.h>
1135
#include <netinet/tcp.h>],
1137
netinet_inc=yes, netinet_inc=no)
1126
#include <netinet/tcp.h>]], [[ printf("1\n"); ]])],[netinet_inc=yes],[netinet_inc=no])
1138
1127
if test "$netinet_inc" = "no"
1140
1129
AC_DEFINE([HAVE_BROKEN_NETINET_INCLUDES], [1], [Can netinet be included])
1142
1131
AC_MSG_RESULT("$netinet_inc")
1146
1134
AC_CHECK_HEADERS(cxxabi.h)
1147
1135
AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle,
1148
[AC_TRY_LINK([#include <cxxabi.h>], [
1136
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
1149
1137
char *foo= 0; int bar= 0;
1150
1138
foo= abi::__cxa_demangle(foo, foo, 0, &bar);
1151
], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])])
1139
]])],[mysql_cv_cxa_demangle=yes],[mysql_cv_cxa_demangle=no])])
1154
1142
if test "x$mysql_cv_cxa_demangle" = xyes; then
1155
1143
AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
1173
1161
MYSQL_CONFIGURE_PLUGINS([none])
1175
# Only build client code?
1177
[ --without-server Only build the client.],
1178
[with_server=$withval],
1184
# If we have threads generate some library functions and test programs
1189
dnl This probably should be cleaned up more - for now the threaded
1190
dnl client is just using plain-old libs.
1191
sql_client_dirs="strings regex mysys libmysql"
1193
sql_client_dirs="$sql_client_dirs client"
1195
CLIENT_LIBS="$NON_THREADED_LIBS $openssl_libs $ZLIB_LIBS $STATIC_NSS_FLAGS"
1197
1163
AC_SUBST(CLIENT_LIBS)
1198
1164
AC_SUBST(CLIENT_THREAD_LIBS)
1199
AC_SUBST(NON_THREADED_LIBS)
1200
1165
AC_SUBST(STATIC_NSS_FLAGS)
1201
AC_SUBST(sql_client_dirs)
1203
if test "$with_server" = "yes"
1205
AC_DEFINE([THREAD], [1],
1206
[Define if you want to have threaded code. This may be undef on client code])
1207
# Avoid _PROGRAMS names
1208
THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_thr_init.o mf_keycache.o"
1209
AC_SUBST(THREAD_LOBJECTS)
1210
server_scripts="mysqld_safe mysql_install_db"
1211
sql_server_dirs="strings mysys dbug extra regex"
1167
AC_DEFINE([THREAD], [1],
1168
[Define if you want to have threaded code. This may be undef on client code])
1216
1170
# IMPORTANT - do not modify LIBS past this line - this hack is the only way
1217
1171
# I know to add the static NSS magic if we have static NSS libraries with
1220
1174
LDFLAGS="$LDFLAGS $OTHER_LIBC_LIB"
1221
1175
LIBS="$LIBS $STATIC_NSS_FLAGS"
1223
AC_SUBST(sql_server_dirs)
1224
AC_SUBST(sql_server)
1225
AC_SUBST(server_scripts)
1227
1177
AC_SUBST(mysql_plugin_dirs)
1228
1178
AC_SUBST(mysql_plugin_libs)
1229
1179
AC_SUBST(mysql_plugin_defs)
1232
# Now that sql_client_dirs and sql_server_dirs are stable, determine the union.
1233
# Start with the (longer) server list, add each client item not yet present.
1234
sql_union_dirs=" $sql_server_dirs "
1235
for DIR in $sql_client_dirs
1237
if echo " $sql_union_dirs " | grep " $DIR " >/dev/null
1239
: # already present, skip
1241
sql_union_dirs="$sql_union_dirs $DIR "
1244
AC_SUBST(sql_union_dirs)
1246
1181
# Some usefull subst
1269
1204
dbug/Makefile scripts/Makefile include/Makefile dnl
1270
1205
support-files/Makefile dnl
1271
1206
mysql-test/Makefile dnl
1272
1208
include/mysql_version.h plugin/Makefile)
1274
1210
AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)