mainly the result of collapsing folds in vimdiff from 2.2
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12445 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
336
configure.in
336
configure.in
@@ -3189,204 +3189,204 @@ dnl ---------------------------------------------------------------------------
|
|||||||
dnl under MSW we always have thread support
|
dnl under MSW we always have thread support
|
||||||
if test "$TOOLKIT" != "MSW"; then
|
if test "$TOOLKIT" != "MSW"; then
|
||||||
|
|
||||||
dnl the code below:
|
dnl the code below:
|
||||||
dnl defines THREADS_OBJ which contains the object files to build
|
dnl defines THREADS_OBJ which contains the object files to build
|
||||||
dnl defines THREADS_LINK which contains the thread library to link with
|
dnl defines THREADS_LINK which contains the thread library to link with
|
||||||
dnl defines wxUSE_THREADS=1 if thread support is activated
|
dnl defines wxUSE_THREADS=1 if thread support is activated
|
||||||
|
|
||||||
THREADS_LINK=
|
THREADS_LINK=
|
||||||
THREADS_OBJ=
|
THREADS_OBJ=
|
||||||
CODE_GEN_FLAGS=
|
CODE_GEN_FLAGS=
|
||||||
CODE_GEN_FLAGS_CXX=
|
CODE_GEN_FLAGS_CXX=
|
||||||
|
|
||||||
if test "$wxUSE_THREADS" = "yes" ; then
|
if test "$wxUSE_THREADS" = "yes" ; then
|
||||||
if test "$wxUSE_WINE" = 1 ; then
|
if test "$wxUSE_WINE" = 1 ; then
|
||||||
AC_MSG_WARN([Threads are not supported under WINE])
|
AC_MSG_WARN([Threads are not supported under WINE])
|
||||||
wxUSE_THREADS="no"
|
wxUSE_THREADS="no"
|
||||||
elif test "$USE_BEOS" = 1; then
|
elif test "$USE_BEOS" = 1; then
|
||||||
AC_MSG_WARN([BeOS threads are not yet supported])
|
AC_MSG_WARN([BeOS threads are not yet supported])
|
||||||
wxUSE_THREADS="no"
|
wxUSE_THREADS="no"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$wxUSE_THREADS" = "yes" ; then
|
|
||||||
dnl find if POSIX threads are available
|
|
||||||
|
|
||||||
dnl AIX calls the library libpthreads - thanks IBM!
|
|
||||||
if test "$USE_AIX" = 1; then
|
|
||||||
THREADS_LIB=pthreads
|
|
||||||
else
|
|
||||||
THREADS_LIB=pthread
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl standard lib name is pthread
|
if test "$wxUSE_THREADS" = "yes" ; then
|
||||||
dnl We no longer test for pthread-0.7 as it breaks compilation on some
|
dnl find if POSIX threads are available
|
||||||
dnl glibc2 systems, especially for static linkage.
|
|
||||||
AC_CHECK_LIB($THREADS_LIB, pthread_create, [
|
dnl AIX calls the library libpthreads - thanks IBM!
|
||||||
THREADS_OBJ="threadpsx.lo"
|
if test "$USE_AIX" = 1; then
|
||||||
THREADS_LINK=$THREADS_LIB
|
THREADS_LIB=pthreads
|
||||||
], [
|
else
|
||||||
dnl thread functions are in libc_r under FreeBSD
|
THREADS_LIB=pthread
|
||||||
AC_CHECK_LIB(c_r, pthread_create, [
|
fi
|
||||||
|
|
||||||
|
dnl standard lib name is pthread
|
||||||
|
dnl We no longer test for pthread-0.7 as it breaks compilation on some
|
||||||
|
dnl glibc2 systems, especially for static linkage.
|
||||||
|
AC_CHECK_LIB($THREADS_LIB, pthread_create, [
|
||||||
THREADS_OBJ="threadpsx.lo"
|
THREADS_OBJ="threadpsx.lo"
|
||||||
THREADS_LINK="c_r"
|
THREADS_LINK=$THREADS_LIB
|
||||||
], [
|
], [
|
||||||
dnl VZ: SGI threads are not supported currently
|
dnl thread functions are in libc_r under FreeBSD
|
||||||
AC_CHECK_HEADER(sys/prctl.h, [
|
AC_CHECK_LIB(c_r, pthread_create, [
|
||||||
THREADS_OBJ="threadsgi.lo"
|
THREADS_OBJ="threadpsx.lo"
|
||||||
|
THREADS_LINK="c_r"
|
||||||
|
], [
|
||||||
|
dnl VZ: SGI threads are not supported currently
|
||||||
|
AC_CHECK_HEADER(sys/prctl.h, [
|
||||||
|
THREADS_OBJ="threadsgi.lo"
|
||||||
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
|
||||||
|
|
||||||
if test -z "$THREADS_OBJ" ; then
|
if test -z "$THREADS_OBJ" ; then
|
||||||
wxUSE_THREADS=no
|
wxUSE_THREADS=no
|
||||||
AC_MSG_WARN(No thread support on this system)
|
AC_MSG_WARN(No thread support on this system)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
dnl do other tests only if we are using threads
|
dnl do other tests only if we are using threads
|
||||||
if test "$wxUSE_THREADS" = "yes" ; then
|
if test "$wxUSE_THREADS" = "yes" ; then
|
||||||
AC_CHECK_FUNCS(thr_setconcurrency)
|
AC_CHECK_FUNCS(thr_setconcurrency)
|
||||||
|
|
||||||
dnl define autoconf macro to check for given function in both pthread and
|
dnl define autoconf macro to check for given function in both pthread and
|
||||||
dnl posix4 libraries
|
dnl posix4 libraries
|
||||||
dnl usage: AC_FUNC_THREAD(FUNCTION_NAME)
|
dnl usage: AC_FUNC_THREAD(FUNCTION_NAME)
|
||||||
dnl VZ: TODO
|
dnl VZ: TODO
|
||||||
dnl AC_DEFUN(AC_FUNC_THREAD,
|
dnl AC_DEFUN(AC_FUNC_THREAD,
|
||||||
dnl [
|
dnl [
|
||||||
dnl AC_CHECK_LIB($THREADS_LINK, $1,
|
dnl AC_CHECK_LIB($THREADS_LINK, $1,
|
||||||
dnl AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'),
|
dnl AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'),
|
||||||
dnl [AC_CHECK_LIB([posix4], $1,
|
dnl [AC_CHECK_LIB([posix4], $1,
|
||||||
dnl [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
|
dnl [AC_DEFINE(HAVE_`'translit($1, `A-Z', 'a-z'))
|
||||||
dnl POSIX4_LINK=" -lposix4"
|
dnl POSIX4_LINK=" -lposix4"
|
||||||
dnl ])
|
dnl ])
|
||||||
dnl ])
|
dnl ])
|
||||||
dnl ])
|
dnl ])
|
||||||
|
|
||||||
AC_CHECK_HEADERS(sched.h)
|
AC_CHECK_HEADERS(sched.h)
|
||||||
|
|
||||||
AC_CHECK_LIB($THREADS_LINK, sched_yield,
|
AC_CHECK_LIB($THREADS_LINK, sched_yield,
|
||||||
AC_DEFINE(HAVE_SCHED_YIELD),
|
AC_DEFINE(HAVE_SCHED_YIELD),
|
||||||
[AC_CHECK_LIB([posix4], sched_yield,
|
[AC_CHECK_LIB([posix4], sched_yield,
|
||||||
[AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK=" -lposix4"],
|
[AC_DEFINE(HAVE_SCHED_YIELD) POSIX4_LINK=" -lposix4"],
|
||||||
AC_MSG_WARN(wxThread::Yield will not work properly)
|
AC_MSG_WARN(wxThread::Yield will not work properly)
|
||||||
)]
|
)]
|
||||||
)
|
|
||||||
|
|
||||||
dnl to be able to set the thread priority, we need to have all of the
|
|
||||||
dnl following functions:
|
|
||||||
dnl 1. pthread_attr_getschedpolicy
|
|
||||||
dnl 2. sched_get_priority_min and sched_get_priority_max
|
|
||||||
dnl (this one can be in either libpthread or libposix4 (under Solaris))
|
|
||||||
dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam
|
|
||||||
HAVE_PRIOR_FUNCS=0
|
|
||||||
AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy,
|
|
||||||
AC_CHECK_LIB($THREADS_LINK, pthread_attr_setschedparam,
|
|
||||||
AC_CHECK_LIB($THREADS_LINK, sched_get_priority_max,
|
|
||||||
HAVE_PRIOR_FUNCS=1,
|
|
||||||
AC_CHECK_LIB([posix4], sched_get_priority_max,
|
|
||||||
[
|
|
||||||
HAVE_PRIOR_FUNCS=1
|
|
||||||
POSIX4_LINK=" -lposix4"
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if test "$HAVE_PRIOR_FUNCS" = 1; then
|
dnl to be able to set the thread priority, we need to have all of the
|
||||||
AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS)
|
dnl following functions:
|
||||||
else
|
dnl 1. pthread_attr_getschedpolicy
|
||||||
AC_MSG_WARN(Setting thread priority will not work)
|
dnl 2. sched_get_priority_min and sched_get_priority_max
|
||||||
fi
|
dnl (this one can be in either libpthread or libposix4 (under Solaris))
|
||||||
|
dnl 3. pthread_attr_getschedparam and pthread_attr_setschedparam
|
||||||
|
HAVE_PRIOR_FUNCS=0
|
||||||
|
AC_CHECK_LIB($THREADS_LINK, pthread_attr_getschedpolicy,
|
||||||
|
AC_CHECK_LIB($THREADS_LINK, pthread_attr_setschedparam,
|
||||||
|
AC_CHECK_LIB($THREADS_LINK, sched_get_priority_max,
|
||||||
|
HAVE_PRIOR_FUNCS=1,
|
||||||
|
AC_CHECK_LIB([posix4], sched_get_priority_max,
|
||||||
|
[
|
||||||
|
HAVE_PRIOR_FUNCS=1
|
||||||
|
POSIX4_LINK=" -lposix4"
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
AC_CHECK_LIB($THREADS_LINK, pthread_cancel,
|
if test "$HAVE_PRIOR_FUNCS" = 1; then
|
||||||
AC_DEFINE(HAVE_PTHREAD_CANCEL),
|
AC_DEFINE(HAVE_THREAD_PRIORITY_FUNCTIONS)
|
||||||
AC_MSG_WARN([wxThread::Kill() will not work properly]))
|
else
|
||||||
|
AC_MSG_WARN(Setting thread priority will not work)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup_push,
|
AC_CHECK_LIB($THREADS_LINK, pthread_cancel,
|
||||||
[
|
AC_DEFINE(HAVE_PTHREAD_CANCEL),
|
||||||
AC_TRY_COMPILE([#include <pthread.h>],
|
AC_MSG_WARN([wxThread::Kill() will not work properly]))
|
||||||
[
|
|
||||||
pthread_cleanup_push(NULL, NULL);
|
|
||||||
pthread_cleanup_pop(0);
|
|
||||||
], [
|
|
||||||
wx_cv_func_pthread_cleanup_push=yes
|
|
||||||
], [
|
|
||||||
wx_cv_func_pthread_cleanup_push=no
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then
|
AC_CACHE_CHECK([for pthread_cleanup_push/pop], wx_cv_func_pthread_cleanup_push,
|
||||||
AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
|
[
|
||||||
fi
|
AC_TRY_COMPILE([#include <pthread.h>],
|
||||||
|
[
|
||||||
|
pthread_cleanup_push(NULL, NULL);
|
||||||
|
pthread_cleanup_pop(0);
|
||||||
|
], [
|
||||||
|
wx_cv_func_pthread_cleanup_push=yes
|
||||||
|
], [
|
||||||
|
wx_cv_func_pthread_cleanup_push=no
|
||||||
|
])
|
||||||
|
])
|
||||||
|
|
||||||
dnl mutexattr_t initialization is done in quite different ways on different
|
if test "$wx_cv_func_pthread_cleanup_push" = "yes"; then
|
||||||
dnl platforms, so check for a few things:
|
AC_DEFINE(HAVE_THREAD_CLEANUP_FUNCTIONS)
|
||||||
dnl
|
fi
|
||||||
dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
|
|
||||||
dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
|
|
||||||
dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
|
|
||||||
dnl defined, we do it by directly assigned
|
|
||||||
dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
|
|
||||||
|
|
||||||
dnl we need _GNU_SOURCE to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+
|
dnl mutexattr_t initialization is done in quite different ways on different
|
||||||
dnl (strictly speaking we only need _XOPEN_SOURCE=500 but just defining
|
dnl platforms, so check for a few things:
|
||||||
dnl this disables _BSD_SOURCE which breaks libtiff compilation, so it is
|
dnl
|
||||||
dnl simpler to just define _GNU_SOURCE to get everything)
|
dnl HAVE_MUTEX_RECURSIVE means that we can create recursive mutexes
|
||||||
if test "x$wx_lib_glibc21" = "xyes"; then
|
dnl HAVE_MUTEXATTR_SETTYPE means that we do it using
|
||||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
dnl pthread_mutexattr_settype(PTHREAD_MUTEX_RECURSIVE) and if it is not
|
||||||
fi
|
dnl defined, we do it by directly assigned
|
||||||
|
dnl PTHREAD_MUTEX_RECURSIVE_MUTEX_INITIALIZER_NP to attr
|
||||||
|
|
||||||
AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
|
dnl we need _GNU_SOURCE to get PTHREAD_MUTEX_RECURSIVE with glibc 2.1+
|
||||||
[
|
dnl (strictly speaking we only need _XOPEN_SOURCE=500 but just defining
|
||||||
AC_TRY_COMPILE([#include <pthread.h>],
|
dnl this disables _BSD_SOURCE which breaks libtiff compilation, so it is
|
||||||
[
|
dnl simpler to just define _GNU_SOURCE to get everything)
|
||||||
pthread_mutexattr_t attr;
|
if test "x$wx_lib_glibc21" = "xyes"; then
|
||||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||||
], [
|
fi
|
||||||
wx_cv_type_pthread_mutexattr_t=yes
|
|
||||||
], [
|
|
||||||
wx_cv_type_pthread_mutexattr_t=no
|
|
||||||
]
|
|
||||||
)
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
|
AC_CACHE_CHECK([for pthread_mutexattr_t], wx_cv_type_pthread_mutexattr_t,
|
||||||
AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
|
[
|
||||||
else
|
|
||||||
dnl don't despair, there may be another way to do it
|
|
||||||
AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
|
|
||||||
wx_cv_type_pthread_rec_mutex_init,
|
|
||||||
[
|
|
||||||
AC_TRY_COMPILE([#include <pthread.h>],
|
AC_TRY_COMPILE([#include <pthread.h>],
|
||||||
[
|
[
|
||||||
pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
|
pthread_mutexattr_t attr;
|
||||||
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||||
], [
|
], [
|
||||||
wx_cv_type_pthread_rec_mutex_init=yes
|
wx_cv_type_pthread_mutexattr_t=yes
|
||||||
], [
|
], [
|
||||||
wx_cv_type_pthread_rec_mutex_init=no
|
wx_cv_type_pthread_mutexattr_t=no
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
if test "$wx_cv_type_pthread_rec_mutex_init" = "yes"; then
|
|
||||||
AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
|
if test "$wx_cv_type_pthread_mutexattr_t" = "yes"; then
|
||||||
else
|
AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_T)
|
||||||
dnl this may break code working elsewhere, so at least warn about it
|
else
|
||||||
AC_MSG_WARN([wxMutex won't be recursive on this platform])
|
dnl don't despair, there may be another way to do it
|
||||||
|
AC_CACHE_CHECK([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER],
|
||||||
|
wx_cv_type_pthread_rec_mutex_init,
|
||||||
|
[
|
||||||
|
AC_TRY_COMPILE([#include <pthread.h>],
|
||||||
|
[
|
||||||
|
pthread_mutex_t attr = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
|
||||||
|
], [
|
||||||
|
wx_cv_type_pthread_rec_mutex_init=yes
|
||||||
|
], [
|
||||||
|
wx_cv_type_pthread_rec_mutex_init=no
|
||||||
|
]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
if test "$wx_cv_type_pthread_rec_mutex_init" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
|
||||||
|
else
|
||||||
|
dnl this may break code working elsewhere, so at least warn about it
|
||||||
|
AC_MSG_WARN([wxMutex won't be recursive on this platform])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
THREADS_LINK=" -l$THREADS_LINK"
|
||||||
|
|
||||||
|
dnl building MT programs under Solaris with the native compiler requires -mt
|
||||||
|
dnl switch
|
||||||
|
if test "$USE_SOLARIS" = "yes" -a "$GCC" != "yes"; then
|
||||||
|
CPPFLAGS="$CFLAGS -mt"
|
||||||
|
CXXFLAGS="$CXXFLAGS -mt"
|
||||||
|
LDFLAGS="$LDFLAGS -mt"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
THREADS_LINK=" -l$THREADS_LINK"
|
|
||||||
|
|
||||||
dnl building MT programs under Solaris with the native compiler requires -mt
|
|
||||||
dnl switch
|
|
||||||
if test "$USE_SOLARIS" = "yes" -a "$GCC" != "yes"; then
|
|
||||||
CPPFLAGS="$CFLAGS -mt"
|
|
||||||
CXXFLAGS="$CXXFLAGS -mt"
|
|
||||||
LDFLAGS="$LDFLAGS -mt"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl from if !MSW
|
dnl from if !MSW
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user