Commit 70ed0ea4 authored by joerg@mysql.com's avatar joerg@mysql.com

Step 3 of the switch to support configuration with NPTL:

Change "configure.in".

The branches for Tru64 (ex: OSF/1) and Linux are separated,
and for Linux 'getconf GNU_LIBPTHREAD_VERSION' is used to tell between Linuxthreads and NPTL.
parent eaa79cb4
...@@ -411,12 +411,12 @@ if expr "$target_os" : "[[Ll]]inux.*" > /dev/null ...@@ -411,12 +411,12 @@ if expr "$target_os" : "[[Ll]]inux.*" > /dev/null
then then
MYSQLD_DEFAULT_SWITCHES="--skip-locking" MYSQLD_DEFAULT_SWITCHES="--skip-locking"
TARGET_LINUX="true" TARGET_LINUX="true"
AC_MSG_RESULT("yes"); AC_MSG_RESULT("yes")
AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux]) AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
else else
MYSQLD_DEFAULT_SWITCHES="" MYSQLD_DEFAULT_SWITCHES=""
TARGET_LINUX="false" TARGET_LINUX="false"
AC_MSG_RESULT("no"); AC_MSG_RESULT("no")
fi fi
AC_SUBST(MYSQLD_DEFAULT_SWITCHES) AC_SUBST(MYSQLD_DEFAULT_SWITCHES)
AC_SUBST(TARGET_LINUX) AC_SUBST(TARGET_LINUX)
...@@ -1267,61 +1267,93 @@ esac ...@@ -1267,61 +1267,93 @@ esac
# We have to check libc last because else it fails on Solaris 2.6 # We have to check libc last because else it fails on Solaris 2.6
with_posix_threads="no" with_posix_threads="no"
# Hack for DEC-UNIX (OSF1) # Search thread lib on Linux
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no" if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
then then
# Look for LinuxThreads. AC_MSG_CHECKING("Linux threads")
AC_MSG_CHECKING("LinuxThreads") if test "$TARGET_LINUX" = "true"
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
if test "$res" -gt 0
then then
AC_MSG_RESULT("Found") AC_MSG_RESULT("starting")
AC_DEFINE([HAVE_LINUXTHREADS], [1], # use getconf to check glibc contents
[Whether we are using Xavier Leroy's LinuxThreads]) AC_MSG_CHECKING("getconf GNU_LIBPTHREAD_VERSION")
# Linux 2.0 sanity check case `getconf GNU_LIBPTHREAD_VERSION | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` in
AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], , NPTL* )
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])) AC_MSG_RESULT("NPTL")
# RedHat 5.0 does not work with dynamic linking of this. -static also AC_DEFINE([HAVE_NPTL], [1], [NPTL threads implementation])
# gives a speed increase in linux so it does not hurt on other systems. with_named_thread="-lpthread"
with_named_thread="-lpthread" ;;
else LINUXTHREADS* )
AC_MSG_RESULT("Not found") AC_MSG_RESULT("Linuxthreads")
# If this is a linux machine we should barf AC_DEFINE([HAVE_LINUXTHREADS], [1],
if test "$TARGET_LINUX" = "true" [Whether we are using Xavier Leroy's LinuxThreads])
then with_named_thread="-lpthread"
AC_MSG_ERROR([This is a linux system and Linuxthreads was not ;;
found. On linux Linuxthreads should be used. Please install Linuxthreads * )
(or a new glibc) and try again. See the Installation chapter in the AC_MSG_RESULT("unknown")
Reference Manual for more information.]) ;;
else esac
AC_MSG_CHECKING("DEC threads") if test "$with_named_thread" = "no"
if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a then
then # old method, check headers
with_named_thread="-lpthread -lmach -lexc" # Look for LinuxThreads.
CFLAGS="$CFLAGS -D_REENTRANT" AC_MSG_CHECKING("LinuxThreads in header file comment")
CXXFLAGS="$CXXFLAGS -D_REENTRANT" res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
AC_DEFINE(HAVE_DEC_THREADS, [1], if test "$res" -gt 0
[Whether we are using DEC threads]) then
AC_MSG_RESULT("yes") AC_MSG_RESULT("Found")
else AC_DEFINE([HAVE_LINUXTHREADS], [1],
AC_MSG_RESULT("no") [Whether we are using Xavier Leroy's LinuxThreads])
AC_MSG_CHECKING("DEC 3.2 threads") # Linux 2.0 sanity check
if test -f /usr/shlib/libpthreads.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a AC_TRY_COMPILE([#include <sched.h>], [int a = sched_get_priority_min(1);], ,
then 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]))
with_named_thread="-lpthreads -lmach -lc_r" # RedHat 5.0 does not work with dynamic linking of this. -static also
AC_DEFINE(HAVE_DEC_THREADS, [1]) # gives a speed increase in linux so it does not hurt on other systems.
AC_DEFINE([HAVE_DEC_3_2_THREADS], [1], with_named_thread="-lpthread"
[Whether we are using OSF1 DEC threads on 3.2]) else
with_osf32_threads="yes" AC_MSG_RESULT("Not found")
MYSQLD_DEFAULT_SWITCHES="--skip-thread-priority" # If this is a linux machine we should barf
AC_MSG_RESULT("yes") AC_MSG_ERROR([This is a Linux system without a working getconf,
else and Linuxthreads was not found. Please install it (or a new glibc) and try again.
AC_MSG_RESULT("no") See the Installation chapter in the Reference Manual for more information.])
fi fi
fi else
fi AC_MSG_RESULT("no need to check headers")
fi fi
fi
AC_MSG_CHECKING("for pthread_create in -lpthread");
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lpthread"
AC_TRY_LINK( [#include <pthread.h>],
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
AC_MSG_RESULT("yes"),
[ AC_MSG_RESULT("no")
AC_MSG_ERROR([
This is a Linux system claiming to support threads, either Linuxthreads or NPTL, but linking a test program failed.
Please install one of these (or a new glibc) and try again.
See the Installation chapter in the Reference Manual for more information.]) ]
)
LIBS="$ac_save_LIBS"
else
AC_MSG_RESULT("no")
fi # "$TARGET_LINUX"
fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
# Hack for DEC-UNIX (OSF1 -> Tru64)
if test "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
then
AC_MSG_CHECKING("DEC threads post OSF/1 3.2")
if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
then
with_named_thread="-lpthread -lmach -lexc"
CFLAGS="$CFLAGS -D_REENTRANT"
CXXFLAGS="$CXXFLAGS -D_REENTRANT"
AC_DEFINE(HAVE_DEC_THREADS, [1], [Whether we are using DEC threads])
AC_MSG_RESULT("yes")
else
AC_MSG_RESULT("no")
fi # DEC threads
fi # "$with_named_thread" = "no" -a "$with_mit_threads" = "no"
dnl This is needed because -lsocket has to come after the thread dnl This is needed because -lsocket has to come after the thread
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment