ICU-132 add '--enable-threads=no' option to disable threading, and FORCE_LIBS to allow overriding of build libraries.

X-SVN-Rev: 361
This commit is contained in:
Steven R. Loomis 1999-12-09 23:11:48 +00:00
parent 4c2da39849
commit f313ba28b5
4 changed files with 308 additions and 120 deletions

View File

@ -36,7 +36,21 @@
#endif
#if defined(POSIX) && !defined(APP_NO_THREADS)
/* Check our settings... */
#include "platform.h"
/* APP_NO_THREADS is an old symbol. We'll honour it if present. */
#ifdef APP_NO_THREADS
# define ICU_USE_THREADS 0
#endif
/* Default: use threads. */
#ifndef ICU_USE_THREADS
# define ICU_USE_THREADS 1
#endif
#if defined(POSIX) && (ICU_USE_THREADS==1)
/* Usage: uncomment the following, and breakpoint WeAreDeadlocked to
find reentrant issues. */
/* # define POSIX_DEBUG_REENTRANCY 1 */
@ -53,7 +67,7 @@
puts("ARGH!! We're deadlocked.. break on WeAreDeadlocked() next time.");
}
# endif /* POSIX_DEBUG_REENTRANCY */
#endif /* POSIX && APP_NO_THREADS not defined */
#endif /* POSIX && (ICU_USE_THREADS==1) */
#ifdef _WIN32
# include <WINDOWS.H>
@ -67,7 +81,7 @@ UMTX gGlobalMutex = NULL;
void umtx_lock( UMTX *mutex )
{
#ifndef APP_NO_THREADS
#if (ICU_USE_THREADS == 1)
if( mutex == NULL )
{
mutex = &gGlobalMutex;
@ -97,12 +111,12 @@ void umtx_lock( UMTX *mutex )
gInMutex = TRUE;
# endif
#endif
#endif /* APP_NO_THREADS not defined */
#endif /* ICU_USE_THREADS==1 */
}
void umtx_unlock( UMTX* mutex )
{
#ifndef APP_NO_THREADS
#if (ICU_USE_THREADS==1)
if( mutex == NULL )
{
mutex = &gGlobalMutex;
@ -124,12 +138,12 @@ void umtx_unlock( UMTX* mutex )
#endif
#endif
#endif /* APP_NO_THREADS not defined */
#endif /* ICU_USE_THREADS == 1 */
}
U_CAPI void umtx_init( UMTX *mutex )
{
#ifndef APP_NO_THREADS
#if (ICU_USE_THREADS == 1)
if( mutex == NULL ) /* initialize the global mutex */
{
@ -159,7 +173,7 @@ if( mutex == NULL ) /* initialize the global mutex */
# endif
#endif
#endif /* APP_NO_THREADS not defined */
#endif /* ICU_USE_THREADS==1 */
}

276
icu4c/source/configure vendored
View File

@ -11,6 +11,8 @@
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
--enable-threads build ICU with threads [default=yes]"
ac_help="$ac_help
--enable-extras build ICU extras [default=yes]"
ac_help="$ac_help
@ -18,7 +20,8 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-tests build ICU tests [default=yes]"
ac_help="$ac_help
--enable-samples build ICU samples [default=yes]"
--enable-samples build ICU samples [default=yes]
Additionally, the variable FORCE_LIBS may be set before calling configure. If set, it will REPLACE any automatic list of libraries."
# Initialize some variables set by options.
# The variables have the same names as the options, with
@ -530,6 +533,7 @@ fi
PACKAGE="icu"
VERSION="1.3.1"
@ -540,7 +544,7 @@ UNICODE_VERSION="3.0.0"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:544: checking for $ac_word" >&5
echo "configure:548: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -570,7 +574,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:574: checking for $ac_word" >&5
echo "configure:578: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -621,7 +625,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:625: checking for $ac_word" >&5
echo "configure:629: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -653,7 +657,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:657: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:661: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -664,12 +668,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 668 "configure"
#line 672 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -695,12 +699,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:699: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:703: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:704: checking whether we are using GNU C" >&5
echo "configure:708: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -709,7 +713,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -728,7 +732,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:732: checking whether ${CC-cc} accepts -g" >&5
echo "configure:736: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -764,7 +768,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:768: checking for $ac_word" >&5
echo "configure:772: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -796,7 +800,7 @@ test -n "$CXX" || CXX="gcc"
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:800: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
echo "configure:804: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -807,12 +811,12 @@ cross_compiling=$ac_cv_prog_cxx_cross
cat > conftest.$ac_ext << EOF
#line 811 "configure"
#line 815 "configure"
#include "confdefs.h"
int main(){return(0);}
EOF
if { (eval echo configure:816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cxx_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -838,12 +842,12 @@ if test $ac_cv_prog_cxx_works = no; then
{ echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:842: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:846: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
echo "configure:847: checking whether we are using GNU C++" >&5
echo "configure:851: checking whether we are using GNU C++" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -852,7 +856,7 @@ else
yes;
#endif
EOF
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
@ -871,7 +875,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
echo "configure:875: checking whether ${CXX-g++} accepts -g" >&5
echo "configure:879: checking whether ${CXX-g++} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -933,7 +937,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:937: checking for a BSD compatible install" >&5
echo "configure:941: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -988,7 +992,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Extract the first word of "autoconf", so it can be a program name with args.
set dummy autoconf; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:992: checking for $ac_word" >&5
echo "configure:996: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1018,7 +1022,7 @@ fi
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1022: checking for $ac_word" >&5
echo "configure:1026: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1053,7 +1057,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:1057: checking host system type" >&5
echo "configure:1061: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -1075,7 +1079,7 @@ echo "$ac_t""$host" 1>&6
echo $ac_n "checking which Makefile fragment to use""... $ac_c" 1>&6
echo "configure:1079: checking which Makefile fragment to use" >&5
echo "configure:1083: checking which Makefile fragment to use" >&5
if eval "test \"`echo '$''{'icu_cv_host_frag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1106,7 +1110,7 @@ echo "$ac_t""$icu_cv_host_frag" 1>&6
case "${host}" in
*-*-hpux*) echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
echo "configure:1110: checking for floor in -lm" >&5
echo "configure:1114: checking for floor in -lm" >&5
ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1114,7 +1118,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1118 "configure"
#line 1122 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1125,7 +1129,7 @@ int main() {
floor()
; return 0; }
EOF
if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1146,7 +1150,7 @@ else
fi
;;
*) echo $ac_n "checking for floor in -lm""... $ac_c" 1>&6
echo "configure:1150: checking for floor in -lm" >&5
echo "configure:1154: checking for floor in -lm" >&5
ac_lib_var=`echo m'_'floor | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1154,7 +1158,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1158 "configure"
#line 1162 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1165,7 +1169,7 @@ int main() {
floor()
; return 0; }
EOF
if { (eval echo configure:1169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1196,8 +1200,35 @@ fi
esac
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:1201: checking for pthread_create in -lpthread" >&5
threads=true
# Check whether --enable-threads or --disable-threads was given.
if test "${enable_threads+set}" = set; then
enableval="$enable_threads"
case "${enableval}" in
yes) threads=true ;;
no) threads=false ;;
*) { echo "configure: error: bad value ${enableval} for --enable-threads" 1>&2; exit 1; } ;;
esac
else
threads=true
fi
if test "$threads" = true; then
THREADS_TRUE=
THREADS_FALSE='#'
else
THREADS_TRUE='#'
THREADS_FALSE=
fi
ICU_USE_THREADS=0
if test $threads = yes; then
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
echo "configure:1232: checking for pthread_create in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1205,7 +1236,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1209 "configure"
#line 1240 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1216,7 +1247,7 @@ int main() {
pthread_create()
; return 0; }
EOF
if { (eval echo configure:1220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1243,9 +1274,13 @@ else
echo "$ac_t""no" 1>&6
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:1249: checking for pthread_create in -lpthreads" >&5
if test $ac_cv_lib_pthread_pthread_create = yes; then
ICU_USE_THREADS=1
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
echo "configure:1284: checking for pthread_create in -lpthreads" >&5
ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1253,7 +1288,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthreads $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1257 "configure"
#line 1292 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1264,7 +1299,7 @@ int main() {
pthread_create()
; return 0; }
EOF
if { (eval echo configure:1268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1291,10 +1326,13 @@ else
echo "$ac_t""no" 1>&6
fi
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
echo $ac_n "checking for pthread_create in -lcma""... $ac_c" 1>&6
echo "configure:1298: checking for pthread_create in -lcma" >&5
if test $ac_cv_lib_pthreads_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
echo $ac_n "checking for pthread_create in -lcma""... $ac_c" 1>&6
echo "configure:1336: checking for pthread_create in -lcma" >&5
ac_lib_var=`echo cma'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1302,7 +1340,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcma $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1306 "configure"
#line 1344 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1313,7 +1351,7 @@ int main() {
pthread_create()
; return 0; }
EOF
if { (eval echo configure:1317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1340,7 +1378,61 @@ else
echo "$ac_t""no" 1>&6
fi
if test $ac_cv_lib_cma_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
echo $ac_n "checking for pthread_mutex_create""... $ac_c" 1>&6
echo "configure:1387: checking for pthread_mutex_create" >&5
if eval "test \"`echo '$''{'ac_cv_func_pthread_mutex_create'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1392 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pthread_mutex_create(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char pthread_mutex_create();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_pthread_mutex_create) || defined (__stub___pthread_mutex_create)
choke me
#else
pthread_mutex_create();
#endif
; return 0; }
EOF
if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_pthread_mutex_create=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_pthread_mutex_create=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'pthread_mutex_create`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
fi
fi
# check for dlopen()
@ -1348,7 +1440,7 @@ HAVE_DLOPEN=0
#add more libs here..
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
echo "configure:1352: checking for dlopen in -ldl" >&5
echo "configure:1444: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1356,7 +1448,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1360 "configure"
#line 1452 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1367,7 +1459,7 @@ int main() {
dlopen()
; return 0; }
EOF
if { (eval echo configure:1371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1402,7 +1494,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1406: checking how to run the C preprocessor" >&5
echo "configure:1498: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1417,13 +1509,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1421 "configure"
#line 1513 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1519: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1434,13 +1526,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1438 "configure"
#line 1530 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1444: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1451,13 +1543,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1455 "configure"
#line 1547 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1485,17 +1577,17 @@ for ac_hdr in inttypes.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1489: checking for $ac_hdr" >&5
echo "configure:1581: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1494 "configure"
#line 1586 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1529,14 +1621,14 @@ fi
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:1533: checking whether byte ordering is bigendian" >&5
echo "configure:1625: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
#line 1540 "configure"
#line 1632 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@ -1547,11 +1639,11 @@ int main() {
#endif
; return 0; }
EOF
if { (eval echo configure:1551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
#line 1555 "configure"
#line 1647 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@ -1562,7 +1654,7 @@ int main() {
#endif
; return 0; }
EOF
if { (eval echo configure:1566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@ -1582,7 +1674,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 1586 "configure"
#line 1678 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@ -1595,7 +1687,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
if { (eval echo configure:1599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@ -1627,12 +1719,12 @@ fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:1631: checking for ANSI C header files" >&5
echo "configure:1723: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1636 "configure"
#line 1728 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1640,7 +1732,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1657,7 +1749,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1661 "configure"
#line 1753 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1675,7 +1767,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1679 "configure"
#line 1771 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1696,7 +1788,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1700 "configure"
#line 1792 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1707,7 +1799,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -1731,12 +1823,12 @@ EOF
fi
echo $ac_n "checking for int8_t""... $ac_c" 1>&6
echo "configure:1735: checking for int8_t" >&5
echo "configure:1827: checking for int8_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_int8_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1740 "configure"
#line 1832 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1764,12 +1856,12 @@ EOF
fi
echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
echo "configure:1768: checking for uint8_t" >&5
echo "configure:1860: checking for uint8_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1773 "configure"
#line 1865 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1797,12 +1889,12 @@ EOF
fi
echo $ac_n "checking for int16_t""... $ac_c" 1>&6
echo "configure:1801: checking for int16_t" >&5
echo "configure:1893: checking for int16_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1806 "configure"
#line 1898 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1830,12 +1922,12 @@ EOF
fi
echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
echo "configure:1834: checking for uint16_t" >&5
echo "configure:1926: checking for uint16_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1839 "configure"
#line 1931 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1863,12 +1955,12 @@ EOF
fi
echo $ac_n "checking for int32_t""... $ac_c" 1>&6
echo "configure:1867: checking for int32_t" >&5
echo "configure:1959: checking for int32_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1872 "configure"
#line 1964 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1896,12 +1988,12 @@ EOF
fi
echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
echo "configure:1900: checking for uint32_t" >&5
echo "configure:1992: checking for uint32_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1905 "configure"
#line 1997 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -1929,12 +2021,12 @@ EOF
fi
echo $ac_n "checking for bool_t""... $ac_c" 1>&6
echo "configure:1933: checking for bool_t" >&5
echo "configure:2025: checking for bool_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_bool_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1938 "configure"
#line 2030 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2135,6 +2227,10 @@ case "${host}" in
;;
esac
if test "${FORCE_LIBS}" != ""; then
echo " *** Overriding automatically chosen LIBS=$LIBS, using instead FORCE_LIBS=${FORCE_LIBS}" 1>&6
LIBS=${FORCE_LIBS}
fi
trap '' 1 2 15
cat > confcache <<\EOF
@ -2295,6 +2391,9 @@ s%@host_cpu@%$host_cpu%g
s%@host_vendor@%$host_vendor%g
s%@host_os@%$host_os%g
s%@LIB_M@%$LIB_M%g
s%@THREADS_TRUE@%$THREADS_TRUE%g
s%@THREADS_FALSE@%$THREADS_FALSE%g
s%@ICU_USE_THREADS@%$ICU_USE_THREADS%g
s%@HAVE_DLOPEN@%$HAVE_DLOPEN%g
s%@CPP@%$CPP%g
s%@HAVE_INTTYPES_H@%$HAVE_INTTYPES_H%g
@ -2547,3 +2646,8 @@ chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
if test $ICU_USE_THREADS = 0; then
echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages above to see why we couldn't find pthread_create()" 1>&6
fi

View File

@ -4,6 +4,7 @@ dnl Stephen F. Booth
dnl Process this file with autoconf to produce a configure script
AC_INIT(common/utypes.h)
AC_CONFIG_HEADER(common/icucfg.h)
PACKAGE="icu"
AC_SUBST(PACKAGE)
@ -33,16 +34,46 @@ case "${host}" in
esac
AC_SUBST(LIB_M)
dnl special pthread handling
dnl AIX uses pthreads instead of pthread, and HP/UX uses cma
AC_CHECK_LIB(pthread, pthread_create)
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(pthreads, pthread_create)
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(cma, pthread_create)
threads=true
dnl Enable/disable threads
AC_ARG_ENABLE(threads,
[ --enable-threads build ICU with threads [default=yes]],
[case "${enableval}" in
yes) threads=true ;;
no) threads=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-threads) ;;
esac],
threads=true)
ICU_CONDITIONAL(THREADS, test "$threads" = true)
ICU_USE_THREADS=0
if test $threads = yes; then
dnl special pthread handling
dnl AIX uses pthreads instead of pthread, and HP/UX uses cma
AC_CHECK_LIB(pthread, pthread_create)
if test $ac_cv_lib_pthread_pthread_create = yes; then
ICU_USE_THREADS=1
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(pthreads, pthread_create)
if test $ac_cv_lib_pthreads_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
if test $ac_cv_lib_pthread_pthread_create = no; then
AC_CHECK_LIB(cma, pthread_create)
if test $ac_cv_lib_cma_pthread_create = yes; then
ICU_USE_THREADS=1
fi
fi
AC_CHECK_FUNC(pthread_mutex_create)
fi
AC_SUBST(ICU_USE_THREADS)
# check for dlopen()
HAVE_DLOPEN=0
@ -170,7 +201,8 @@ ICU_CONDITIONAL(TESTS, test "$tests" = true)
dnl Enable/disable samples
AC_ARG_ENABLE(samples,
[ --enable-samples build ICU samples [default=yes]],
[ --enable-samples build ICU samples [default=yes]
Additionally, the variable FORCE_LIBS may be set before calling configure. If set, it will REPLACE any automatic list of libraries.],
[case "${enableval}" in
yes) samples=true ;;
no) samples=false ;;
@ -218,6 +250,10 @@ case "${host}" in
;;
esac
if test "${FORCE_LIBS}" != ""; then
echo " *** Overriding automatically chosen [LIBS=$LIBS], using instead [FORCE_LIBS=${FORCE_LIBS}]" 1>&6
LIBS=${FORCE_LIBS}
fi
dnl output the Makefiles
AC_OUTPUT([Makefile \
@ -231,3 +267,8 @@ AC_OUTPUT([Makefile \
test/ieeetest/Makefile \
samples/Makefile samples/date/Makefile samples/cal/Makefile \
samples/XMLConverter/Makefile])
if test $ICU_USE_THREADS = 0; then
echo " *** Note: configuring the ICU without pthread support or testing. If this isn't what you want, then run configure with --enable-threads=yes or check the messages [above] to see why we couldn't find pthread_create()" 1>&6
fi

View File

@ -13,6 +13,49 @@
// define NO_THREADED_INTL to not test ICU in a threaded way.
/* Check our settings... */
#include "platform.h"
/* APP_NO_THREADS is an old symbol. We'll honour it if present. */
#ifdef APP_NO_THREADS
# define ICU_USE_THREADS 0
#endif
/* Default: use threads. */
#ifndef ICU_USE_THREADS
# define ICU_USE_THREADS 1
#endif
#include "tsmthred.h"
MultithreadTest::MultithreadTest()
{
}
MultithreadTest::~MultithreadTest()
{
}
#if (ICU_USE_THREADS==0)
void MultithreadTest::runIndexedTest( int32_t index, bool_t exec,
char* &name, char* par ) {
if (exec) logln("TestSuite MultithreadTest: ");
if(index == 0)
name = "NO_THREADED_TESTS";
else
name = "";
if(exec) { logln("MultithreadTest - test DISABLED. ICU_USE_THREADS set to 0, check your configuration if this is a problem..");
}
}
#else
// Note: A LOT OF THE FUNCTIONS IN THIS FILE SHOULD LIVE ELSEWHERE!!!!!
// Note: A LOT OF THE FUNCTIONS IN THIS FILE SHOULD LIVE ELSEWHERE!!!!!
// -srl
@ -22,7 +65,6 @@
#include <ctype.h> // tolower, toupper
#include "putil.h"
#include "tsmthred.h"
/* for mthreadtest*/
#include "numfmt.h"
@ -112,6 +154,7 @@ SimpleThread::sleep(int32_t millis)
#define POSIX 1
#endif
#if defined(POSIX)||defined(SOLARIS)||defined(AIX)||defined(HPUX)
#define HAVE_IMP
@ -192,14 +235,6 @@ void SimpleThread::sleep(int32_t millis)
// *************** end fluff ******************
/* now begins the real test. */
MultithreadTest::MultithreadTest()
{
}
MultithreadTest::~MultithreadTest()
{
}
void MultithreadTest::runIndexedTest( int32_t index, bool_t exec,
char* &name, char* par ) {
if (exec) logln("TestSuite MultithreadTest: ");
@ -368,13 +403,6 @@ void MultithreadTest::TestMutex()
#ifdef NO_THREADED_INTL
void MultithreadTest::TestThreadedIntl()
{
logln("TestThreadedIntl - test DISABLED. see tsutil/tsmthred.cpp, look for NO_THREADED_INTL. ");
}
#else
// ** First, some utility classes.
@ -748,4 +776,5 @@ void MultithreadTest::TestThreadedIntl()
errln("patience exceeded. ");
}
#endif // NO_THREADED_INTL
#endif // ICU_USE_THREADS