diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1926629f190..61084d69a5c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,36 @@ +1997-12-25 Teemu Torma + + * Makefile.in (GTHREAD_FLAGS): New var. + (LIBGCC2_CFLAGS): Added $(GTHREAD_FLAGS). + (distclean): Remove gthr-default.h. + + * configure.in: Accept dce as a thread package. + Check for thread.h and pthread.h. + Link gthr-default.h to appropriate thread file and set + gthread_flags. + (hppa1.1-*-hpux10*): If --enable-threads, use dce threads and + include multilib definitions from pa/t-dce-thr. + (sparc-*-solaris2*): Enable threads by default, if thread.h or + pthread.h is found, preferring posix threads over solaris ones. + + * config/pa/t-dce-thr: New file. + * config/pa/t-pa: Removed multilibs. + * config/sparc/t-sol2: Ditto. + + * gthr.h: New file. + * gthr-single.h: New file. + * gthr-posix.h: New file. + * gthr-solaris.h: New file. + * gthr-dce.h: New file. + * libgcc-thr.h: Removed. + * objc/thr-dce.c: New file copied from thr-decosf1.c. + + * frame.c: Include gthr.h instead of libgcc-thr.h. + * libgcc2.c: Include gthr.h instead of libgcc-thr.h. + (eh_context_initialize): If __gthread_once fails, use static eh + context. + (eh_context_free): Call __gthread_key_dtor. + Wed Dec 24 23:33:17 1997 Jeffrey A Law (law@cygnus.com) * expr.h (MUST_PASS_IN_STACK): Allow target port to override. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 1fe62508d28..4b256b5db04 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -206,6 +206,7 @@ host_xm_file=@host_xm_file_list@ lang_specs_files=@lang_specs_files@ lang_options_files=@lang_options_files@ GCC_THREAD_FILE=@thread_file@ +GTHREAD_FLAGS=@gthread_flags@ version=@version@ mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c` @@ -281,7 +282,7 @@ LIBGCC2 = libgcc2.a # -fexceptions is necessary for eh.o now that the exceptions are # the default for g++ only. LIBGCC2_DEBUG_CFLAGS = -g1 -LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fexceptions @inhibit_libc@ +LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fexceptions @inhibit_libc@ # Additional options to use when compiling libgcc2.a. # Some targets override this to -Iinclude @@ -2157,6 +2158,7 @@ distclean: clean bytecode.distclean lang.distclean -rm -f config.status config.run config.cache config.bak -rm -f Make-lang Make-hooks Make-host Make-target -rm -f Makefile specs.h options.h *.oaux + -rm -f gthr-default.h -rm -f */stage1 */stage2 */stage3 */stage4 */include -rm -f c-parse.output -rm -f *.asm diff --git a/gcc/config/pa/t-dce-thr b/gcc/config/pa/t-dce-thr new file mode 100644 index 00000000000..8d86a418186 --- /dev/null +++ b/gcc/config/pa/t-dce-thr @@ -0,0 +1,5 @@ +MULTILIB_OPTIONS = threads +MULTILIB_DIRNAMES = threads + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib diff --git a/gcc/config/pa/t-pa b/gcc/config/pa/t-pa index b6dcec1212e..a359918a125 100644 --- a/gcc/config/pa/t-pa +++ b/gcc/config/pa/t-pa @@ -16,9 +16,3 @@ ee_fp.asm: $(srcdir)/config/pa/ee_fp.asm cp $(srcdir)/config/pa/ee_fp.asm . TARGET_LIBGCC2_CFLAGS = -fPIC - -MULTILIB_OPTIONS = threads -MULTILIB_DIRNAMES = threads - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib diff --git a/gcc/config/sparc/t-sol2 b/gcc/config/sparc/t-sol2 index 309aedfd9f9..d41254adb44 100644 --- a/gcc/config/sparc/t-sol2 +++ b/gcc/config/sparc/t-sol2 @@ -5,13 +5,6 @@ LIBGCC1 = CROSS_LIBGCC1 = LIBGCC1_TEST = -MULTILIB_OPTIONS = threads -MULTILIB_DIRNAMES = threads -MULTILIB_MATCHES = threads=pthreads - -LIBGCC = stmp-multilib -INSTALL_LIBGCC = install-multilib - # gmon build rule: gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hdrs $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ diff --git a/gcc/configure b/gcc/configure index 9397641f7bb..ff602458239 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 +# Generated automatically using autoconf version 2.12.1 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -71,6 +71,7 @@ mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 @@ -354,7 +355,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" + echo "configure generated by autoconf version 2.12.1" exit 0 ;; -with-* | --with-*) @@ -663,7 +664,7 @@ case x${enable_threads} in thread_file='' ;; xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ - xsolaris | xwin32) + xsolaris | xwin32 | xdce) thread_file=$enable_threads ;; *) @@ -715,33 +716,33 @@ esac # Make sure we can run config.sub. -if $ac_config_sub sun4 >/dev/null 2>&1; then : +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : 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:724: checking host system type" >&5 +echo "configure:725: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) - if host_alias=`$ac_config_guess`; then : + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac -host=`$ac_config_sub $host_alias` +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:745: checking target system type" >&5 +echo "configure:746: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -752,14 +753,14 @@ NONE) esac ;; esac -target=`$ac_config_sub $target_alias` +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:763: checking build system type" >&5 +echo "configure:764: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -770,7 +771,7 @@ NONE) esac ;; esac -build=`$ac_config_sub $build_alias` +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` @@ -786,7 +787,7 @@ test "$host_alias" != "$target_alias" && # 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:790: checking for $ac_word" >&5 +echo "configure:791: 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 @@ -815,7 +816,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:819: checking for $ac_word" >&5 +echo "configure:820: 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 @@ -863,7 +864,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:867: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:868: 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. @@ -873,11 +874,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 @@ -897,12 +898,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:901: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:902: 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:906: checking whether we are using GNU C" >&5 +echo "configure:907: 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 @@ -911,7 +912,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:915: \"$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:916: \"$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 @@ -926,7 +927,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:930: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:931: 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 @@ -954,7 +955,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:958: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:959: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -987,7 +988,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:991: checking for $ac_word" >&5 +echo "configure:992: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1018,7 +1019,7 @@ done # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1022: checking for $ac_word" >&5 +echo "configure:1023: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1051,7 +1052,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1055: checking for yywrap in -l$ac_lib" >&5 +echo "configure:1056: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1059,7 +1060,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1093,7 +1094,7 @@ fi fi echo $ac_n "checking whether ln works""... $ac_c" 1>&6 -echo "configure:1097: checking whether ln works" >&5 +echo "configure:1098: checking whether ln works" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_LN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1125,7 +1126,7 @@ else fi echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1129: checking whether ln -s works" >&5 +echo "configure:1130: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1159,7 +1160,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1163: checking for $ac_word" >&5 +echo "configure:1164: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1190,7 +1191,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:1194: checking for $ac_word" >&5 +echo "configure:1195: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1230,7 +1231,7 @@ test -n "$YACC" || YACC="yacc" # 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:1234: checking for a BSD compatible install" >&5 +echo "configure:1235: 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 @@ -1284,7 +1285,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # 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:1288: checking for $ac_word" >&5 +echo "configure:1289: 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 @@ -1313,7 +1314,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:1317: checking for $ac_word" >&5 +echo "configure:1318: 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 @@ -1361,7 +1362,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1365: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1366: 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. @@ -1371,11 +1372,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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 @@ -1395,12 +1396,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:1399: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1400: 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:1404: checking whether we are using GNU C" >&5 +echo "configure:1405: 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 @@ -1409,7 +1410,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1413: \"$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:1414: \"$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 @@ -1424,7 +1425,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1428: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1429: 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 @@ -1452,7 +1453,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1456: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1457: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1480,7 +1481,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1484: checking how to run the C preprocessor" >&5 +echo "configure:1485: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1495,13 +1496,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1506: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1512,13 +1513,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1541,12 +1542,12 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1545: checking for ANSI C header files" >&5 +echo "configure:1546: 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 < #include @@ -1554,7 +1555,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1559: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1571,7 +1572,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 @@ -1589,7 +1590,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 @@ -1610,7 +1611,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1621,7 +1622,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1645,12 +1646,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1649: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1650: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1659,7 +1660,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1663: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1664: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1683,17 +1684,17 @@ for ac_hdr in limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unist do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1687: checking for $ac_hdr" >&5 +echo "configure:1688: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1720,15 +1721,85 @@ fi done +# Check for thread headers. +ac_safe=`echo "thread.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for thread.h""... $ac_c" 1>&6 +echo "configure:1728: checking for thread.h" >&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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_thread_h=yes +else + echo "$ac_t""no" 1>&6 +have_thread_h= +fi + +ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for pthread.h""... $ac_c" 1>&6 +echo "configure:1762: checking for pthread.h" >&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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1772: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + have_pthread_h=yes +else + echo "$ac_t""no" 1>&6 +have_pthread_h= +fi + + # Use only if it exists, # doesn't clash with , and declares intmax_t. echo $ac_n "checking for inttypes.h""... $ac_c" 1>&6 -echo "configure:1727: checking for inttypes.h" >&5 +echo "configure:1798: checking for inttypes.h" >&5 if eval "test \"`echo '$''{'gcc_cv_header_inttypes_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1736,7 +1807,7 @@ int main() { intmax_t i = -1; ; return 0; } EOF -if { (eval echo configure:1740: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1811: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <&6 for ac_func in strtoul do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1761: checking for $ac_func" >&5 +echo "configure:1832: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1812,12 +1883,12 @@ done for ac_func in bsearch do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1816: checking for $ac_func" >&5 +echo "configure:1887: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1867,12 +1938,12 @@ done for ac_func in strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1871: checking for $ac_func" >&5 +echo "configure:1942: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1922,12 +1993,12 @@ done for ac_func in putenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1926: checking for $ac_func" >&5 +echo "configure:1997: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1977,12 +2048,12 @@ done for ac_func in popen do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1981: checking for $ac_func" >&5 +echo "configure:2052: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2032,12 +2103,12 @@ done for ac_func in vprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2036: checking for $ac_func" >&5 +echo "configure:2107: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2087,12 +2158,12 @@ done for ac_func in bcopy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2091: checking for $ac_func" >&5 +echo "configure:2162: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2142,12 +2213,12 @@ done for ac_func in bzero do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2146: checking for $ac_func" >&5 +echo "configure:2217: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2197,12 +2268,12 @@ done for ac_func in bcmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2201: checking for $ac_func" >&5 +echo "configure:2272: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2252,12 +2323,12 @@ done for ac_func in index do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2256: checking for $ac_func" >&5 +echo "configure:2327: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2307,12 +2378,12 @@ done for ac_func in rindex do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2311: checking for $ac_func" >&5 +echo "configure:2382: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2362,12 +2433,12 @@ done for ac_func in kill do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2366: checking for $ac_func" >&5 +echo "configure:2437: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2417,12 +2488,12 @@ done for ac_func in getrlimit do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2421: checking for $ac_func" >&5 +echo "configure:2492: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2472,12 +2543,12 @@ done for ac_func in setrlimit do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2476: checking for $ac_func" >&5 +echo "configure:2547: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2526,12 +2597,12 @@ done echo $ac_n "checking whether malloc must be declared""... $ac_c" 1>&6 -echo "configure:2530: checking whether malloc must be declared" >&5 +echo "configure:2601: checking whether malloc must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2558,7 +2629,7 @@ int main() { char *(*pfn) = (char *(*)) malloc ; return 0; } EOF -if { (eval echo configure:2562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2633: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_malloc=no else @@ -2580,12 +2651,12 @@ EOF fi echo $ac_n "checking whether realloc must be declared""... $ac_c" 1>&6 -echo "configure:2584: checking whether realloc must be declared" >&5 +echo "configure:2655: checking whether realloc must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_realloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2612,7 +2683,7 @@ int main() { char *(*pfn) = (char *(*)) realloc ; return 0; } EOF -if { (eval echo configure:2616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_realloc=no else @@ -2634,12 +2705,12 @@ EOF fi echo $ac_n "checking whether calloc must be declared""... $ac_c" 1>&6 -echo "configure:2638: checking whether calloc must be declared" >&5 +echo "configure:2709: checking whether calloc must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_calloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2666,7 +2737,7 @@ int main() { char *(*pfn) = (char *(*)) calloc ; return 0; } EOF -if { (eval echo configure:2670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_calloc=no else @@ -2688,12 +2759,12 @@ EOF fi echo $ac_n "checking whether free must be declared""... $ac_c" 1>&6 -echo "configure:2692: checking whether free must be declared" >&5 +echo "configure:2763: checking whether free must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_free'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2720,7 +2791,7 @@ int main() { char *(*pfn) = (char *(*)) free ; return 0; } EOF -if { (eval echo configure:2724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2795: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_free=no else @@ -2742,12 +2813,12 @@ EOF fi echo $ac_n "checking whether index must be declared""... $ac_c" 1>&6 -echo "configure:2746: checking whether index must be declared" >&5 +echo "configure:2817: checking whether index must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_index'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2774,7 +2845,7 @@ int main() { char *(*pfn) = (char *(*)) index ; return 0; } EOF -if { (eval echo configure:2778: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_index=no else @@ -2796,12 +2867,12 @@ EOF fi echo $ac_n "checking whether rindex must be declared""... $ac_c" 1>&6 -echo "configure:2800: checking whether rindex must be declared" >&5 +echo "configure:2871: checking whether rindex must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_rindex'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2828,7 +2899,7 @@ int main() { char *(*pfn) = (char *(*)) rindex ; return 0; } EOF -if { (eval echo configure:2832: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2903: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_rindex=no else @@ -2850,12 +2921,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:2854: checking whether getenv must be declared" >&5 +echo "configure:2925: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'gcc_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2882,7 +2953,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:2886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* gcc_cv_decl_needed_getenv=no else @@ -2905,12 +2976,12 @@ fi echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6 -echo "configure:2909: checking for sys_siglist declaration in signal.h or unistd.h" >&5 +echo "configure:2980: checking for sys_siglist declaration in signal.h or unistd.h" >&5 if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2922,7 +2993,7 @@ int main() { char *msg = *(sys_siglist + 1); ; return 0; } EOF -if { (eval echo configure:2926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2997: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_decl_sys_siglist=yes else @@ -3395,10 +3466,18 @@ for machine in $build $host $target; do tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux10.h" xm_file=pa/xm-pahpux.h xmake_file=pa/x-pa-hpux + tmake_file=pa/t-pa if [ x$gas = xyes ] then tm_file="${tm_file} pa/pa-gas.h" fi + if [ x$enable_threads = x ]; then + enable_threads=$have_pthread_h + fi + if [ x$enable_threads = xyes ]; then + thread_file='dce' + tmake_file="${tmake_file} pa/t-dce-thr" + fi install_headers_dir=install-headers-cpio use_collect2=yes ;; @@ -5238,8 +5317,18 @@ for machine in $build $host $target; do fixincludes=fixinc.svr4 float_format=i128 broken_install=yes - if [ x$enable_threads = xyes ]; then + if [ x${enable_threads} = x ]; then + enable_threads=$have_pthread_h + if [ x${enable_threads} = x ]; then + enable_threads=$have_thread_h + fi + fi + if [ x${enable_threads} = xyes ]; then + if [ x${have_pthread_h} = xyes ]; then + thread_file='posix' + else thread_file='solaris' + fi fi ;; sparc-*-sunos4.0*) @@ -5836,6 +5925,15 @@ do esac done +# Make gthr-default.h if we have a thread file. +gthread_flags= +if [ $thread_file != single ]; then + rm -f gthr-default.h + $symbolic_link gthr-${thread_file}.h gthr-default.h + gthread_flags=-DHAVE_GTHR_DEFAULT +fi + + # Make empty files to contain the specs and options for each language. # Then add #include lines to for a compiler that has specs and/or options. @@ -6095,7 +6193,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set) 2>&1 | grep ac_space` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -6162,7 +6260,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -6181,6 +6279,7 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF $ac_vpsub $extrasub +s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g @@ -6232,6 +6331,7 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g s%@CPP@%$CPP%g s%@manext@%$manext%g s%@objext@%$objext%g +s%@gthread_flags@%$gthread_flags%g s%@inhibit_libc@%$inhibit_libc%g s%@sched_prefix@%$sched_prefix%g s%@sched_cflags@%$sched_cflags%g diff --git a/gcc/configure.in b/gcc/configure.in index 2ce5b305298..4957d517297 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -114,7 +114,7 @@ case x${enable_threads} in thread_file='' ;; xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ - xsolaris | xwin32) + xsolaris | xwin32 | xdce) thread_file=$enable_threads ;; *) @@ -147,6 +147,10 @@ AC_HEADER_STDC AC_HEADER_TIME AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h varargs.h sys/varargs.h) +# Check for thread headers. +AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=]) +AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) + # Use only if it exists, # doesn't clash with , and declares intmax_t. AC_MSG_CHECKING(for inttypes.h) @@ -637,10 +641,18 @@ for machine in $build $host $target; do tm_file="${tm_file} pa/pa-hpux.h pa/pa-hpux10.h" xm_file=pa/xm-pahpux.h xmake_file=pa/x-pa-hpux + tmake_file=pa/t-pa if [[ x$gas = xyes ]] then tm_file="${tm_file} pa/pa-gas.h" fi + if [[ x$enable_threads = x ]]; then + enable_threads=$have_pthread_h + fi + if [[ x$enable_threads = xyes ]]; then + thread_file='dce' + tmake_file="${tmake_file} pa/t-dce-thr" + fi install_headers_dir=install-headers-cpio use_collect2=yes ;; @@ -2480,8 +2492,18 @@ for machine in $build $host $target; do fixincludes=fixinc.svr4 float_format=i128 broken_install=yes - if [[ x$enable_threads = xyes ]]; then + if [[ x${enable_threads} = x ]]; then + enable_threads=$have_pthread_h + if [[ x${enable_threads} = x ]]; then + enable_threads=$have_thread_h + fi + fi + if [[ x${enable_threads} = xyes ]]; then + if [[ x${have_pthread_h} = xyes ]]; then + thread_file='posix' + else thread_file='solaris' + fi fi ;; sparc-*-sunos4.0*) @@ -3078,6 +3100,15 @@ do esac done +# Make gthr-default.h if we have a thread file. +gthread_flags= +if [[ $thread_file != single ]]; then + rm -f gthr-default.h + $symbolic_link gthr-${thread_file}.h gthr-default.h + gthread_flags=-DHAVE_GTHR_DEFAULT +fi +AC_SUBST(gthread_flags) + # Make empty files to contain the specs and options for each language. # Then add #include lines to for a compiler that has specs and/or options. diff --git a/gcc/frame.c b/gcc/frame.c index 5cc4184ce2a..ab0a9705924 100644 --- a/gcc/frame.c +++ b/gcc/frame.c @@ -39,7 +39,7 @@ Boston, MA 02111-1307, USA. */ #include "dwarf2.h" #include #include "frame.h" -#include "libgcc-thr.h" +#include "gthr.h" #ifdef __GTHREAD_MUTEX_INIT static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT; diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h new file mode 100644 index 00000000000..3cba8a0e4b8 --- /dev/null +++ b/gcc/gthr-dce.h @@ -0,0 +1,150 @@ + +/* Compile this one with gcc. */ +/* Copyright (C) 1997 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#ifndef __gthr_dce_h +#define __gthr_dce_h + +/* DCE threads interface. + DCE threads are based on POSIX threads draft 4, and many things + have changed since then. */ + +#define __GTHREADS 1 + +#include + +typedef pthread_key_t __gthread_key_t; +typedef pthread_once_t __gthread_once_t; +typedef pthread_mutex_t __gthread_mutex_t; + +#define __GTHREAD_ONCE_INIT pthread_once_init +/* Howto define __GTHREAD_MUTEX_INIT? */ + +#if SUPPORTS_WEAK && GTHREAD_USE_WEAK + +#pragma weak pthread_once +#pragma weak pthread_once_init +#pragma weak pthread_key_create +#pragma weak pthread_key_delete +#pragma weak pthread_getspecific +#pragma weak pthread_setspecific +#pragma weak pthread_create + +#pragma weak pthread_mutex_lock +#pragma weak pthread_mutex_trylock +#pragma weak pthread_mutex_unlock + +static void *__gthread_active_ptr = &pthread_create; + +static inline int +__gthread_active_p () +{ + return __gthread_active_ptr != 0; +} + +#else /* not SUPPORTS_WEAK */ + +static inline int +__gthread_active_p () +{ + return 1; +} + +#endif /* SUPPORTS_WEAK */ + +static inline int +__gthread_once (__gthread_once_t *once, void (*func) ()) +{ + if (__gthread_active_p ()) + return pthread_once (once, func); + else + return -1; +} + +static inline int +__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) +{ + return pthread_keycreate (key, dtor); +} + +static inline int +__gthread_key_dtor (__gthread_key_t key, void *ptr) +{ + /* Nothing needed. */ + return 0; +} + +static inline int +__gthread_key_delete (__gthread_key_t key) +{ + return pthread_key_delete (key); +} + +static inline void * +__gthread_getspecific (__gthread_key_t key) +{ + void *ptr; + if (pthread_getspecific (key, &ptr) == 0) + return ptr; + else + return 0; +} + +static inline int +__gthread_setspecific (__gthread_key_t key, const void *ptr) +{ + return pthread_setspecific (key, (void *) ptr); +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return pthread_mutex_lock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return pthread_mutex_trylock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return pthread_mutex_unlock (mutex); + else + return 0; +} + +#endif /* not __gthr_dce_h */ diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h new file mode 100644 index 00000000000..19231c3c464 --- /dev/null +++ b/gcc/gthr-posix.h @@ -0,0 +1,147 @@ +/* Threads compatibily routines for libgcc2. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#ifndef __gthr_posix_h +#define __gthr_posix_h + +/* POSIX threads specific definitions. + Easy, since the interface is just one-to-one mapping. */ + +#define __GTHREADS 1 + +#include + +typedef pthread_key_t __gthread_key_t; +typedef pthread_once_t __gthread_once_t; +typedef pthread_mutex_t __gthread_mutex_t; + +#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER +#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT + +#if SUPPORTS_WEAK && GTHREAD_USE_WEAK + +#pragma weak pthread_once +#pragma weak pthread_key_create +#pragma weak pthread_key_delete +#pragma weak pthread_getspecific +#pragma weak pthread_setspecific +#pragma weak pthread_create + +#pragma weak pthread_mutex_lock +#pragma weak pthread_mutex_trylock +#pragma weak pthread_mutex_unlock + +static void *__gthread_active_ptr = &pthread_create; + +static inline int +__gthread_active_p () +{ + return __gthread_active_ptr != 0; +} + +#else /* not SUPPORTS_WEAK */ + +static inline int +__gthread_active_p () +{ + return 1; +} + +#endif /* SUPPORTS_WEAK */ + +static inline int +__gthread_once (__gthread_once_t *once, void (*func) ()) +{ + if (__gthread_active_p ()) + return pthread_once (once, func); + else + return -1; +} + +static inline int +__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) +{ + return pthread_key_create (key, dtor); +} + +static inline int +__gthread_key_dtor (__gthread_key_t key, void *ptr) +{ + /* Just reset the key value to zero. */ + if (ptr) + return pthread_setspecific (key, 0); + else + return 0; +} + +static inline int +__gthread_key_delete (__gthread_key_t key) +{ + return pthread_key_delete (key); +} + +static inline void * +__gthread_getspecific (__gthread_key_t key) +{ + return pthread_getspecific (key); +} + +static inline int +__gthread_setspecific (__gthread_key_t key, const void *ptr) +{ + return pthread_setspecific (key, ptr); +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return pthread_mutex_lock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return pthread_mutex_trylock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return pthread_mutex_unlock (mutex); + else + return 0; +} + +#endif /* not __gthr_posix_h */ diff --git a/gcc/gthr-single.h b/gcc/gthr-single.h new file mode 100644 index 00000000000..72edfc35285 --- /dev/null +++ b/gcc/gthr-single.h @@ -0,0 +1,62 @@ +/* Threads compatibily routines for libgcc2. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#ifndef __gthr_single_h +#define __gthr_single_h + +/* Just provide compatibility for mutex handling. */ + +typedef int __gthread_mutex_t; + +#define __GTHREAD_MUTEX_INIT 0 + +static inline int +__gthread_active_p () +{ + return 0; +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *mutex) +{ + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *mutex) +{ + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *mutex) +{ + return 0; +} + +#endif /* not __gthr_single_h */ diff --git a/gcc/gthr-solaris.h b/gcc/gthr-solaris.h new file mode 100644 index 00000000000..465ececb139 --- /dev/null +++ b/gcc/gthr-solaris.h @@ -0,0 +1,179 @@ +/* Threads compatibily routines for libgcc2. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#ifndef __gthr_solaris_h +#define __gthr_solaris_h + +/* Solaris threads as found in Solaris 2.[456]. + Actually these are Unix International (UI) threads, but I don't + know if anyone else implements these. */ + +#define __GTHREADS 1 + +#include +#include + +typedef thread_key_t __gthread_key_t; +typedef struct +{ + mutex_t mutex; + int once; +} __gthread_once_t; +typedef mutex_t __gthread_mutex_t; + +#define __GTHREAD_ONCE_INIT { DEFAULTMUTEX, 0 } +#define __GTHREAD_MUTEX_INIT DEFAULTMUTEX + +#if SUPPORTS_WEAK && GTHREAD_USE_WEAK + +#pragma weak thr_keycreate +#pragma weak thr_getspecific +#pragma weak thr_setspecific +#pragma weak thr_create + +#pragma weak mutex_lock +#pragma weak mutex_trylock +#pragma weak mutex_unlock + +/* This will not actually work in Solaris 2.5, since libc contains + dummy symbols of all thr_* routines. */ + +static void *__gthread_active_ptr = &thr_create; + +static inline int +__gthread_active_p () +{ + return __gthread_active_ptr != 0; +} + +#else /* not SUPPORTS_WEAK */ + +static inline int +__gthread_active_p () +{ + return 1; +} + +#endif /* SUPPORTS_WEAK */ + +static inline int +__gthread_once (__gthread_once_t *once, void (*func) ()) +{ + if (! __gthread_active_p ()) + return -1; + + if (once == 0 || func == 0) + { + errno = EINVAL; + return -1; + } + + if (once->once == 0) + { + if (mutex_lock (&once->mutex) != 0) + return -1; + if (once->once == 0) + { + (*func) (); + once->once ++; + } + mutex_unlock (&once->mutex); + } + return 0; +} + +static inline int +__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) +{ + /* Solaris 2.5 contains thr_* routines no-op in libc, so test if we actually + got a reasonable key value, and if not, fail. */ + *key = -1; + if (thr_keycreate (key, dtor) == -1 || *key == -1) + return -1; + else + return 0; +} + +static inline int +__gthread_key_dtor (__gthread_key_t key, void *ptr) +{ + /* Nothing needed. */ + return 0; +} + +static inline int +__gthread_key_delete (__gthread_key_t key) +{ + /* Not possible. */ + return -1; +} + +static inline void * +__gthread_getspecific (__gthread_key_t key) +{ + void *ptr; + if (thr_getspecific (key, &ptr) == 0) + return ptr; + else + return 0; +} + +static inline int +__gthread_setspecific (__gthread_key_t key, const void *ptr) +{ + return thr_setspecific (key, (void *) ptr); +} + +static inline int +__gthread_mutex_lock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return mutex_lock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_trylock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return mutex_trylock (mutex); + else + return 0; +} + +static inline int +__gthread_mutex_unlock (__gthread_mutex_t *mutex) +{ + if (__gthread_active_p ()) + return mutex_unlock (mutex); + else + return 0; +} + +#endif /* not __gthr_solaris_h */ diff --git a/gcc/gthr.h b/gcc/gthr.h new file mode 100644 index 00000000000..54ad6b04c8d --- /dev/null +++ b/gcc/gthr.h @@ -0,0 +1,96 @@ +/* Threads compatibily routines for libgcc2. */ +/* Compile this one with gcc. */ +/* Copyright (C) 1997 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library does not by itself cause the resulting executable + to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + +#ifndef __gthr_h +#define __gthr_h + +/* If this file is compiled with threads support, it must + #define __GTHREADS 1 + to indicate that threads support is present. Also it has define + function + int __gthread_active_p () + that returns 1 if thread system is active, 0 if not. + + The threads interface must define the following types: + __gthread_key_t + __gthread_once_t + __gthread_mutex_t + + The threads interface must define the following macros: + + __GTHREAD_ONCE_INIT + to initialize __gthread_once_t + __GTHREAD_MUTEX_INIT + to initialize __gthread_mutex_t to get a fast + non-recursive mutex. + + The threads interface must define the following static functions: + + int __gthread_once (__gthread_once_t *once, void (*func) ()) + + int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) + int __gthread_key_delete (__gthread_key_t key) + + int __gthread_key_dtor (__gthread_key_t key, void *ptr) + + void *__gthread_getspecific (__gthread_key_t key) + int __gthread_setspecific (__gthread_key_t key, const void *ptr) + + int __gthread_mutex_lock (__gthread_mutex_t *mutex); + int __gthread_mutex_trylock (__gthread_mutex_t *mutex); + int __gthread_mutex_unlock (__gthread_mutex_t *mutex); + + All functions returning int should return 0 on success, -1 on error. + + Currently supported threads packages are + POSIX threads with -D_PTHREADS + DCE threads with -D_DCE_THREADS + Solaris/UI threads with -D_SOLARIS_THREADS +*/ + +/* Check first for thread specific defines. */ +#if _PTHREADS +#include "gthr-posix.h" +#elif _DCE_THREADS +#include "gthr-dce.h" +#elif _SOLARIS_THREADS +#include "gthr-solaris.h" + +/* Include GTHREAD_FILE if one is defined. */ +#elif SUPPORTS_WEAK && HAVE_GTHR_DEFAULT +#ifndef GTHREAD_USE_WEAK +#define GTHREAD_USE_WEAK 1 +#endif +#include "gthr-default.h" + +/* Fallback to single thread definitions. */ +#else +#include "gthr-single.h" +#endif + +#endif /* not __gthr_h */ diff --git a/gcc/libgcc-thr.h b/gcc/libgcc-thr.h deleted file mode 100644 index 53813c5c789..00000000000 --- a/gcc/libgcc-thr.h +++ /dev/null @@ -1,321 +0,0 @@ -/* Threads compatibily routines for libgcc2. */ -/* Compile this one with gcc. */ -/* Copyright (C) 1997 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you link this library with other files, - some of which are compiled with GCC, to produce an executable, - this library does not by itself cause the resulting executable - to be covered by the GNU General Public License. - This exception does not however invalidate any other reasons why - the executable file might be covered by the GNU General Public License. */ - -#ifndef __libgcc_thr_h -#define __libgcc_thr_h - -/* If this file is compiled with threads support, it must - #define __GTHREADS 1 - to indicate that threads support is present. - - The threads interface must define the following types: - __gthread_key_t - __gthread_once_t - __gthread_mutex_t - - The threads interface must define the following macros: - - __GTHREAD_ONCE_INIT - to initialize __gthread_once_t - __GTHREAD_MUTEX_INIT - to initialize __gthread_mutex_t to get a fast - non-recursive mutex. - - The threads interface must define the following static functions: - - int __gthread_once (__gthread_once_t *once, void (*func) ()) - - int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) - int __gthread_key_delete (__gthread_key_t key) - - void *__gthread_getspecific (__gthread_key_t key) - int __gthread_setspecific (__gthread_key_t key, const void *ptr) - - int __gthread_mutex_lock (__gthread_mutex_t *mutex); - int __gthread_mutex_trylock (__gthread_mutex_t *mutex); - int __gthread_mutex_unlock (__gthread_mutex_t *mutex); - - All functions returning int should return 0 on success, -1 on error. - - Currently supported threads packages are - POSIX threads with -D_PTHREADS - DCE threads with -D_DCE_THREADS - Solaris/UI threads with -D_SOLARIS_THREADS -*/ - -#if _PTHREADS -/* POSIX threads specific definitions. - Easy, since the interface is just one-to-one mapping. */ - -#define __GTHREADS 1 - -#include - -typedef pthread_key_t __gthread_key_t; -typedef pthread_once_t __gthread_once_t; -typedef pthread_mutex_t __gthread_mutex_t; - -#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER -#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT - -static inline int -__gthread_once (__gthread_once_t *once, void (*func) ()) -{ - return pthread_once (once, func); -} - -static inline int -__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) -{ - return pthread_key_create (key, dtor); -} - -static inline int -__gthread_key_delete (__gthread_key_t key) -{ - return pthread_key_delete (key); -} - -static inline void * -__gthread_getspecific (__gthread_key_t key) -{ - return pthread_getspecific (key); -} - -static inline int -__gthread_setspecific (__gthread_key_t key, const void *ptr) -{ - return pthread_setspecific (key, ptr); -} - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *mutex) -{ - return pthread_mutex_lock (mutex); -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *mutex) -{ - return pthread_mutex_trylock (mutex); -} - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *mutex) -{ - return pthread_mutex_unlock (mutex); -} - -#elif _DCE_THREADS -/* DCE threads interface. - DCE threads are based on POSIX threads draft 4, and many things - have changed since then. */ - -#define __GTHREADS 1 - -#include - -typedef pthread_key_t __gthread_key_t; -typedef pthread_once_t __gthread_once_t; -typedef pthread_mutex_t __gthread_mutex_t; - -#define __GTHREAD_ONCE_INIT pthread_once_init -/* Howto define __GTHREAD_MUTEX_INIT? */ - -static inline int -__gthread_once (__gthread_once_t *once, void (*func) ()) -{ - return pthread_once (once, func); -} - -static inline int -__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) -{ - return pthread_keycreate (key, dtor); -} - -static inline int -__gthread_key_delete (__gthread_key_t key) -{ - return pthread_key_delete (key); -} - -static inline void * -__gthread_getspecific (__gthread_key_t key) -{ - void *ptr; - if (pthread_getspecific (key, &ptr) == 0) - return ptr; - else - return 0; -} - -static inline int -__gthread_setspecific (__gthread_key_t key, const void *ptr) -{ - return pthread_setspecific (key, (void *) ptr); -} - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *mutex) -{ - return pthread_mutex_lock (mutex); -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *mutex) -{ - return pthread_mutex_trylock (mutex); -} - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *mutex) -{ - return pthread_mutex_unlock (mutex); -} - -#elif _SOLARIS_THREADS -/* Solaris threads as found in Solaris 2.[456]. - Actually these are Unix International (UI) threads, but I don't - know if anyone else implements these. */ - -#define __GTHREADS 1 - -#include -#include - -typedef thread_key_t __gthread_key_t; -typedef struct -{ - mutex_t mutex; - int once; -} __gthread_once_t; -typedef mutex_t __gthread_mutex_t; - -#define __GTHREAD_ONCE_INIT { DEFAULTMUTEX, 0 } -#define __GTHREAD_MUTEX_INIT DEFAULTMUTEX - -static inline int -__gthread_once (__gthread_once_t *once, void (*func) ()) -{ - if (once == 0 || func == 0) - { - errno = EINVAL; - return -1; - } - - if (once->once == 0) - { - if (mutex_lock (&once->mutex) != 0) - return -1; - if (once->once == 0) - { - (*func) (); - once->once ++; - } - mutex_unlock (&once->mutex); - } - return 0; -} - -static inline int -__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *)) -{ - return thr_keycreate (key, dtor); -} - -static inline int -__gthread_key_delete (__gthread_key_t key) -{ - /* Not possible. */ - return -1; -} - -static inline void * -__gthread_getspecific (__gthread_key_t key) -{ - void *ptr; - if (thr_getspecific (key, &ptr) == 0) - return ptr; - else - return 0; -} - -static inline int -__gthread_setspecific (__gthread_key_t key, const void *ptr) -{ - return thr_setspecific (key, (void *) ptr); -} - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *mutex) -{ - return mutex_lock (mutex); -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *mutex) -{ - return mutex_trylock (mutex); -} - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *mutex) -{ - return mutex_unlock (mutex); -} - -#else /* no threads */ - -/* Just provide compatibility for mutex handling. */ - -typedef int __gthread_mutex_t; - -#define __GTHREAD_MUTEX_INIT 0 - -static inline int -__gthread_mutex_lock (__gthread_mutex_t *mutex) -{ - return 0; -} - -static inline int -__gthread_mutex_trylock (__gthread_mutex_t *mutex) -{ - return 0; -} - -static inline int -__gthread_mutex_unlock (__gthread_mutex_t *mutex) -{ - return 0; -} - -#endif /* no threads */ - -#endif /* not __libgcc_thr_h */ diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index aede526b29d..46dbdaafb16 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -2965,7 +2965,7 @@ int _exit_dummy_decl = 0; /* prevent compiler & linker warnings */ #ifdef L_eh -#include "libgcc-thr.h" +#include "gthr.h" /* Shared exception handling support routines. */ @@ -3038,6 +3038,7 @@ static __gthread_key_t eh_context_key; static void eh_context_free (void *ptr) { + __gthread_key_dtor (eh_context_key, ptr); if (ptr) free (ptr); } @@ -3094,7 +3095,11 @@ eh_context_initialize () #if __GTHREADS static __gthread_once_t once = __GTHREAD_ONCE_INIT; - __gthread_once (&once, eh_threads_initialize); + if (__gthread_once (&once, eh_threads_initialize) == -1) + { + /* Use static version of EH context. */ + get_eh_context = &eh_context_static; + } #else /* no __GTHREADS */ diff --git a/gcc/objc/thr-dce.c b/gcc/objc/thr-dce.c new file mode 100644 index 00000000000..0f7063b7e83 --- /dev/null +++ b/gcc/objc/thr-dce.c @@ -0,0 +1,281 @@ +/* GNU Objective C Runtime Thread Interface + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Contributed by Galen C. Hunt (gchunt@cs.rochester.edu) + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify it under the +terms of the GNU General Public License as published by the Free Software +Foundation; either version 2, or (at your option) any later version. + +GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +GNU CC; see the file COPYING. If not, write to the Free Software +Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with files compiled with + GCC to produce an executable, this does not cause the resulting executable + to be covered by the GNU General Public License. This exception does not + however invalidate any other reasons why the executable file might be + covered by the GNU General Public License. */ + +#include +#include +#include "runtime.h" + +/* Key structure for maintaining thread specific storage */ +static pthread_key_t _objc_thread_storage; + +/* Backend initialization functions */ + +/* Initialize the threads subsystem. */ +int +__objc_init_thread_system(void) +{ + /* Initialize the thread storage key */ + return pthread_keycreate(&_objc_thread_storage, NULL); +} + +/* Close the threads subsystem. */ +int +__objc_close_thread_system(void) +{ + /* Destroy the thread storage key */ + /* Not implemented yet */ + /* return pthread_key_delete(&_objc_thread_storage); */ + return 0; +} + +/* Backend thread functions */ + +/* Create a new thread of execution. */ +objc_thread_t +__objc_thread_detach(void (*func)(void *arg), void *arg) +{ + objc_thread_t thread_id; + pthread_t new_thread_handle; + + if (pthread_create(&new_thread_handle, pthread_attr_default, + (void *)func, arg) == 0) + { + /* ??? May not work! (64bit) */ + thread_id = *(objc_thread_t *)&new_thread_handle; + pthread_detach(&new_thread_handle); /* Fully detach thread. */ + } + else + thread_id = NULL; + + return thread_id; +} + +/* Set the current thread's priority. */ +int +__objc_thread_set_priority(int priority) +{ + int sys_priority = 0; + + switch (priority) + { + case OBJC_THREAD_INTERACTIVE_PRIORITY: + sys_priority = (PRI_FG_MIN_NP + PRI_FG_MAX_NP) / 2; + break; + default: + case OBJC_THREAD_BACKGROUND_PRIORITY: + sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; + break; + case OBJC_THREAD_LOW_PRIORITY: + sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2; + break; + } + + /* Change the priority. */ + if (pthread_setprio(pthread_self(), sys_priority) >= 0) + return 0; + else + /* Failed */ + return -1; +} + +/* Return the current thread's priority. */ +int +__objc_thread_get_priority(void) +{ + int sys_priority; + + if ((sys_priority = pthread_getprio(pthread_self())) >= 0) { + if (sys_priority >= PRI_FG_MIN_NP && sys_priority <= PRI_FG_MAX_NP) + return OBJC_THREAD_INTERACTIVE_PRIORITY; + if (sys_priority >= PRI_BG_MIN_NP && sys_priority <= PRI_BG_MAX_NP) + return OBJC_THREAD_BACKGROUND_PRIORITY; + return OBJC_THREAD_LOW_PRIORITY; + } + + /* Failed */ + return -1; +} + +/* Yield our process time to another thread. */ +void +__objc_thread_yield(void) +{ + pthread_yield(); +} + +/* Terminate the current thread. */ +int +__objc_thread_exit(void) +{ + /* exit the thread */ + pthread_exit(&__objc_thread_exit_status); + + /* Failed if we reached here */ + return -1; +} + +/* Returns an integer value which uniquely describes a thread. */ +objc_thread_t +__objc_thread_id(void) +{ + pthread_t self = pthread_self(); + + return (objc_thread_t) pthread_getunique_np (&self); +} + +/* Sets the thread's local storage pointer. */ +int +__objc_thread_set_data(void *value) +{ + return pthread_setspecific(_objc_thread_storage, value); +} + +/* Returns the thread's local storage pointer. */ +void * +__objc_thread_get_data(void) +{ + void *value = NULL; + + if ( !(pthread_getspecific(_objc_thread_storage, &value)) ) + return value; + + return NULL; +} + +/* Backend mutex functions */ + +/* Allocate a mutex. */ +int +__objc_mutex_allocate(objc_mutex_t mutex) +{ + if (pthread_mutex_init((pthread_mutex_t *)(&(mutex->backend)), + pthread_mutexattr_default)) + return -1; + else + return 0; +} + +/* Deallocate a mutex. */ +int +__objc_mutex_deallocate(objc_mutex_t mutex) +{ + if (pthread_mutex_destroy((pthread_mutex_t *)(&(mutex->backend)))) + return -1; + else + return 0; +} + +/* Grab a lock on a mutex. */ +int +__objc_mutex_lock(objc_mutex_t mutex) +{ + return pthread_mutex_lock((pthread_mutex_t *)(&(mutex->backend))); +} + +/* Try to grab a lock on a mutex. */ +int +__objc_mutex_trylock(objc_mutex_t mutex) +{ + if (pthread_mutex_trylock((pthread_mutex_t *)(&(mutex->backend))) != 1) + return -1; + else + return 0; +} + +/* Unlock the mutex */ +int +__objc_mutex_unlock(objc_mutex_t mutex) +{ + return pthread_mutex_unlock((pthread_mutex_t *)(&(mutex->backend))); +} + +/* Backend condition mutex functions */ + +/* Allocate a condition. */ +int +__objc_condition_allocate(objc_condition_t condition) +{ + /* Unimplemented. */ + return -1; + + /* + if (pthread_cond_init((pthread_cond_t *)(&(condition->backend)), NULL)) + return -1; + else + return 0; + */ +} + +/* Deallocate a condition. */ +int +__objc_condition_deallocate(objc_condition_t condition) +{ + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_destroy((pthread_cond_t *)(&(condition->backend))); + */ +} + +/* Wait on the condition */ +int +__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex) +{ + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_wait((pthread_cond_t *)(&(condition->backend)), + (pthread_mutex_t *)(&(mutex->backend))); + */ +} + +/* Wake up all threads waiting on this condition. */ +int +__objc_condition_broadcast(objc_condition_t condition) +{ + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_broadcast((pthread_cond_t *)(&(condition->backend))); + */ +} + +/* Wake up one thread waiting on this condition. */ +int +__objc_condition_signal(objc_condition_t condition) +{ + /* Unimplemented. */ + return -1; + + /* + return pthread_cond_signal((pthread_cond_t *)(&(condition->backend))); + */ +} + +/* End of File */