474
440
STATIC_NSS_FLAGS=""
475
441
OTHER_LIBC_LIB=""
476
AC_ARG_WITH(other-libc,
477
[ --with-other-libc=DIR Link against libc and other standard libraries
478
installed in the specified non-standard location
479
overriding default. Originally added to be able to
480
link against glibc 2.2 without making the user
481
upgrade the standard libc installation.],
483
other_libc_include="$withval/include"
484
other_libc_lib="$withval/lib"
485
with_other_libc="yes"
488
CFLAGS="$CFLAGS -I$other_libc_include"
489
# There seems to be a feature in gcc that treats system and libc headers
490
# silently when they violatate ANSI C++ standard, but it is strict otherwise
491
# since gcc cannot now recognize that our headers are libc, we work around
492
# by telling it to be permissive. Note that this option only works with
493
# new versions of gcc (2.95.x and above)
494
CXXFLAGS="$CXXFLAGS -fpermissive -I$other_libc_include"
495
if test -f "$other_libc_lib/libnss_files.a"
497
# libc has been compiled with --enable-static-nss
498
# we need special flags, but we will have to add those later
499
STATIC_NSS_FLAGS="-lc -lnss_files -lnss_dns -lresolv"
500
STATIC_NSS_FLAGS="$STATIC_NSS_FLAGS $STATIC_NSS_FLAGS"
501
OTHER_LIBC_LIB="-static -L$other_libc_lib"
504
# this is a dirty hack. We if we detect static nss glibc in the special
505
# location, we do not re-direct the linker to get libraries from there
506
# during check. The reason is that if we did, we would have to find a
507
# way to append the special static nss flags to LIBS every time we do
508
# any check - this is definitely feasible, but not worthwhile the risk
509
# of breaking other things. So for our purposes it would be sufficient
510
# to assume that whoever is using static NSS knows what he is doing and
511
# has sensible libraries in the regular location
512
LDFLAGS="$LDFLAGS -static -L$other_libc_lib "
515
# When linking against custom libc installed separately, we want to force
516
# all binary builds to be static, including the build done by configure
517
# itself to test for system features.
518
with_mysqld_ldflags="-all-static"
519
with_client_ldflags="-all-static"
520
NOINST_LDFLAGS="-all-static"
528
AC_SUBST(NOINST_LDFLAGS)
531
444
# Check if we are using Linux and a glibc compiled with static nss
779
666
#include <ieeefp.h>
783
# Some system specific hacks
787
MAX_CXX_OPTIMIZE="-O3"
791
CFLAGS="$CFLAGS -DHAVE_RWLOCK_T"
792
CXXFLAGS="$CXXFLAGS -DHAVE_RWLOCK_T"
795
if test "$ac_cv_prog_gcc" = "yes"
797
FLAGS="-D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL"
798
CFLAGS="$CFLAGS $FLAGS"
799
CXXFLAGS="$CXXFLAGS $FLAGS"
803
*freebsd*|*dragonfly*)
804
AC_MSG_WARN([Adding fix for interrupted reads])
805
OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`
806
if test "$OSVERSION" -gt "480100" && \
807
test "$OSVERSION" -lt "500000" || \
808
test "$OSVERSION" -gt "500109"
810
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000"
812
CFLAGS="$CFLAGS -DHAVE_BROKEN_REALPATH"
813
CXXFLAGS="$CXXFLAGS -DMYSQLD_NET_RETRY_COUNT=1000000 -DHAVE_BROKEN_REALPATH"
817
AC_MSG_WARN([Adding flag -Dunix])
818
CFLAGS="$CFLAGS -Dunix"
819
CXXFLAGS="$CXXFLAGS -Dunix"
820
OVERRIDE_MT_LD_ADD="\$(top_srcdir)/mit-pthreads/obj/libpthread.a"
825
#---START: Used in for client configure
826
# Check if we threads are in libc or if we should use
827
# -lpthread, -lpthreads or mit-pthreads
828
# We have to check libc last because else it fails on Solaris 2.6
830
with_posix_threads="no"
831
# Search thread lib on Linux
832
if test "$with_named_thread" = "no"
834
AC_MSG_CHECKING("Linux threads")
835
if test "$TARGET_LINUX" = "true"
837
AC_MSG_RESULT("starting")
838
# use getconf to check glibc contents
839
AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
840
case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
842
AC_MSG_RESULT("NPTL")
843
AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
844
with_named_thread="-lpthread"
847
AC_MSG_RESULT("Linuxthreads")
848
AC_DEFINE([HAVE_LINUXTHREADS], [1],
849
[Whether we are using Xavier Leroy's LinuxThreads])
850
with_named_thread="-lpthread"
853
AC_MSG_RESULT("unknown")
856
if test "$with_named_thread" = "no"
858
# old method, check headers
859
# Look for LinuxThreads.
860
AC_MSG_CHECKING("LinuxThreads in header file comment")
861
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
864
AC_MSG_RESULT("Found")
865
AC_DEFINE([HAVE_LINUXTHREADS], [1],
866
[Whether we are using Xavier Leroy's LinuxThreads])
867
# Linux 2.0 sanity check
868
AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
869
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]))
870
# RedHat 5.0 does not work with dynamic linking of this. -static also
871
# gives a speed increase in linux so it does not hurt on other systems.
872
with_named_thread="-lpthread"
874
AC_MSG_RESULT("Not found")
875
# If this is a linux machine we should barf
876
AC_MSG_ERROR([This is a Linux system without a working getconf,
877
and Linuxthreads was not found. Please install it (or a new glibc) and try again.
878
See the Installation chapter in the Reference Manual for more information.])
881
AC_MSG_RESULT("no need to check headers")
884
AC_MSG_CHECKING("for pthread_create in -lpthread")
886
LIBS="$LIBS -lpthread"
887
AC_TRY_LINK( [#include <pthread.h>],
888
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
889
AC_MSG_RESULT("yes"),
890
[ AC_MSG_RESULT("no")
892
This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
893
Please install one of these (or a new glibc) and try again.
894
See the Installation chapter in the Reference Manual for more information.]) ]
900
fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
902
# Use library named -lpthread
903
if test "$with_named_thread" = "no" -a "$with_pthread" = "yes"
905
with_named_thread="-lpthread"
910
# Hack for Solaris >= 2.5
911
# We want both the new and the old interface
913
if test "$with_named_thread" = "no"
915
AC_MSG_CHECKING("Solaris threads")
916
if test -f /usr/lib/libpthread.so -a -f /usr/lib/libthread.so
918
with_named_thread="-lpthread -lthread"
925
# Should we use named pthread library ?
926
AC_MSG_CHECKING("named thread libs:")
927
if test "$with_named_thread" != "no"
929
LIBS="$with_named_thread $LIBS $with_named_thread"
930
CLIENT_THREAD_LIBS="$with_named_thread"
931
with_posix_threads="yes"
932
AC_MSG_RESULT("$with_named_thread")
935
# pthread_create is in standard libraries (As in BSDI 3.0)
936
AC_MSG_CHECKING("for pthread_create in -libc");
938
[#include <pthread.h>],
939
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
940
with_posix_threads=yes, with_posix_threads=no)
941
AC_MSG_RESULT("$with_posix_threads")
942
if test "$with_posix_threads" = "no"
944
AC_MSG_CHECKING("for pthread_create in -lpthread")
946
LIBS="$LIBS -lpthread"
947
CLIENT_THREAD_LIBS="-lpthread"
949
[#include <pthread.h>],
950
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
951
with_posix_threads=yes, with_posix_threads=no)
952
AC_MSG_RESULT("$with_posix_threads")
953
if test "$with_posix_threads" = "no"
955
LIBS=" $ac_save_LIBS -lpthreads"
956
CLIENT_THREAD_LIBS="-lpthreads"
957
AC_MSG_CHECKING("for pthread_create in -lpthreads")
959
[#include <pthread.h>],
960
[ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
961
with_posix_threads=yes, with_posix_threads=no)
962
AC_MSG_RESULT("$with_posix_threads")
963
if test "$with_posix_threads" = "no"
965
# This is for FreeBSD
966
LIBS="$ac_save_LIBS -pthread"
967
CLIENT_THREAD_LIBS="-pthread"
968
AC_MSG_CHECKING("for pthread_create in -pthread")
970
[#include <pthread.h>],
971
[ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
972
with_posix_threads=yes, with_posix_threads=no)
973
AC_MSG_RESULT("$with_posix_threads")
979
#---START: Used in for client configure
980
# Must be checked after, because strtok_r may be in -lpthread
981
# On AIX strtok_r is in libc_r
984
AC_CHECK_LIB(pthread,strtok_r)
986
if test "$ac_cv_lib_pthread_strtok_r" = "no"
988
AC_CHECK_LIB(c_r,strtok_r)
989
case "$with_osf32_threads---$target_os" in
990
# Don't keep -lc_r in LIBS; -pthread handles it magically
991
yes---* | *---freebsd* | *---hpux*) LIBS="$my_save_LIBS" ;;
994
AC_CHECK_FUNCS(strtok_r pthread_init)
996
AC_CHECK_FUNCS(strtok_r)
1001
case "$with_mysqld_ldflags " in
1004
# No need to check for dlopen when mysqld is linked with
1005
# -all-static as it won't be able to load any functions.
1006
# NOTE! It would be better if it was possible to test if dlopen
1007
# can be used, but a good way to test it couldn't be found
1012
# Check for dlopen, needed for user definable functions
1013
# This must be checked after threads on AIX
1014
# We only need this for mysqld, not for the clients.
1016
my_save_LIBS="$LIBS"
1018
AC_CHECK_LIB(dl,dlopen)
1020
LIBS="$my_save_LIBS"
1023
my_save_LIBS="$LIBS"
1025
AC_CHECK_FUNCS(dlopen dlerror)
1026
LIBS="$my_save_LIBS"
672
AC_CHECK_LIB(dl,dlopen)
679
AC_CHECK_FUNCS(dlopen dlerror)
682
AC_CHECK_FUNCS(strtok_r)
1032
685
# System characteristics
1130
AC_ARG_WITH([atomic-ops],
1131
AC_HELP_STRING([--with-atomic-ops=rwlocks|smp|up],
1132
[Implement atomic operations using pthread rwlocks or atomic CPU
1133
instructions for multi-processor (default) or uniprocessor
1134
configuration]), , [with_atomic_ops=smp])
1135
case "$with_atomic_ops" in
1136
"up") AC_DEFINE([MY_ATOMIC_MODE_DUMMY], [1],
1137
[Assume single-CPU mode, no concurrency]) ;;
1138
"rwlocks") AC_DEFINE([MY_ATOMIC_MODE_RWLOCKS], [1],
1139
[Use pthread rwlocks for atomic ops]) ;;
1141
*) AC_MSG_ERROR(["$with_atomic_ops" is not a valid value for --with-atomic-ops]) ;;
1144
AC_CACHE_CHECK([whether the compiler provides atomic builtins],
1145
[mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([
1148
int foo= -10; int bar= 10;
1149
if (!__sync_fetch_and_add(&foo, bar) || foo)
1151
bar= __sync_lock_test_and_set(&foo, bar);
1152
if (bar || foo != 10)
1154
bar= __sync_val_compare_and_swap(&bar, foo, 15);
1159
], [mysql_cv_gcc_atomic_builtins=yes],
1160
[mysql_cv_gcc_atomic_builtins=no],
1161
[mysql_cv_gcc_atomic_builtins=no])])
1163
if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then
1164
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
1165
[Define to 1 if compiler provides atomic builtins.])
1168
# Force static compilation to avoid linking problems/get more speed
1169
AC_ARG_WITH(mysqld-ldflags,
1170
[ --with-mysqld-ldflags Extra linking arguments for mysqld],
1171
[MYSQLD_EXTRA_LDFLAGS=$withval],
1172
[MYSQLD_EXTRA_LDFLAGS=])
1173
AC_SUBST(MYSQLD_EXTRA_LDFLAGS)
1175
AC_ARG_WITH(client-ldflags,
1176
[ --with-client-ldflags Extra linking arguments for clients],
1177
[CLIENT_EXTRA_LDFLAGS=$withval],
1178
[CLIENT_EXTRA_LDFLAGS=])
1179
AC_SUBST(CLIENT_EXTRA_LDFLAGS)
1181
AC_ARG_WITH(mysqld-libs,
1182
[ --with-mysqld-libs Extra libraries to link with for mysqld],
1183
[MYSQLD_EXTRA_LIBS=$withval],
1184
[MYSQLD_EXTRA_LIBS=])
1185
AC_SUBST(MYSQLD_EXTRA_LIBS)
1187
AC_ARG_WITH(lib-ccflags,
1188
[ --with-lib-ccflags Extra CC options for libraries],
1189
[LIB_EXTRA_CCFLAGS=$withval],
1190
[LIB_EXTRA_CCFLAGS=])
1191
AC_SUBST(LIB_EXTRA_CCFLAGS)
1193
# Avoid stupid bug on some OS
1194
AC_ARG_WITH(low-memory,
1195
[ --with-low-memory Try to use less memory to compile to avoid
1196
memory limitations.],
1197
[with_lowmem=$withval],
1199
if test "$with_lowmem" = "yes"
1201
if test "$ac_cv_prog_gcc" = "yes"
1203
LM_CFLAGS="-fno-inline"
1212
783
AC_ARG_WITH(comment,
1213
784
[ --with-comment Comment about compilation environment.],
1214
785
[with_comment=$withval],