From 83703eea9ce67d68f2e051fcb6391000f9aebcc0 Mon Sep 17 00:00:00 2001 From: wilson Date: Fri, 30 Sep 2005 23:13:06 +0000 Subject: [PATCH] Don't build thread library for targets that don't support threads. * configure.ac (pthread.h): Use AC_CHECK_HEADERS instead of AC_CHECK_HEADER. (target_thread_file): New. Set from sed'ed gcc output. (posix_threads): New. Set from target_thread_file. Use instead of ac_have_pthread_h. (pthread_create_version): Move initialization before code using it. * configure: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104838 138bc75d-0d04-0410-961f-82ee72b054a4 --- libmudflap/ChangeLog | 8 ++++ libmudflap/configure | 112 ++++++++++++++++++++++++++++-------------------- libmudflap/configure.ac | 34 ++++++++++----- 3 files changed, 97 insertions(+), 57 deletions(-) diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index a6d0a1c433e..e125f01b159 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,5 +1,13 @@ 2005-09-30 James E. Wilson + * configure.ac (pthread.h): Use AC_CHECK_HEADERS instead of + AC_CHECK_HEADER. + (target_thread_file): New. Set from sed'ed gcc output. + (posix_threads): New. Set from target_thread_file. Use instead of + ac_have_pthread_h. + (pthread_create_version): Move initialization before code using it. + * configure: Regenerate. + * mf-heuristics.c (_end, ENTRY_POINT): Make them arrays with unknown bounds. diff --git a/libmudflap/configure b/libmudflap/configure index 3fe9a1a1841..b1f7c72e401 100755 --- a/libmudflap/configure +++ b/libmudflap/configure @@ -6325,19 +6325,22 @@ then mkdir pth fi -pthread_create_version='""' -if test "${ac_cv_header_pthread_h+set}" = set; then - echo "$as_me:$LINENO: checking for pthread.h" >&5 -echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 -if test "${ac_cv_header_pthread_h+set}" = set; then + +for ac_header in pthread.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 -echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? -echo "$as_me:$LINENO: checking pthread.h usability" >&5 -echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6345,7 +6348,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -#include +#include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -6381,15 +6384,15 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? -echo "$as_me:$LINENO: checking pthread.h presence" >&5 -echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -6423,25 +6426,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------- ## @@ -6452,36 +6455,50 @@ _ASBOX sed "s/^/$as_me: WARNING: /" >&2 ;; esac -echo "$as_me:$LINENO: checking for pthread.h" >&5 -echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 -if test "${ac_cv_header_pthread_h+set}" = set; then +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_header_pthread_h=$ac_header_preproc + eval "$as_ac_Header=\$ac_header_preproc" fi -echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 -echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi -if test $ac_cv_header_pthread_h = yes; then - - -cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_H 1 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -ac_have_pthread_h=yes +fi -else +done -ac_have_pthread_h= -fi +echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 +echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6 +target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` +echo "$as_me:$LINENO: result: $target_thread_file" >&5 +echo "${ECHO_T}$target_thread_file" >&6 +# We only support posix threads, or no threads at all. +posix_threads= +case ${target_thread_file} in + posix) + posix_threads=yes + ;; + single) + ;; + *) + echo "${target_thread_file} is an unsupported thread package" 1>&2 + exit 1 + ;; +esac -if test "x$ac_have_pthread_h" != "x"; then +if test "x$posix_threads" != "x"; then LIBMUDFLAPTH_TRUE= LIBMUDFLAPTH_FALSE='#' else @@ -6489,7 +6506,7 @@ else LIBMUDFLAPTH_FALSE= fi -if test "x$ac_have_pthread_h" != "x" +if test "x$posix_threads" != "x" then build_libmudflapth=1 else @@ -6602,7 +6619,8 @@ esac -if test "x$enable_shared" = "xyes" && test "x$ac_have_pthread_h" != "x"; then +pthread_create_version='""' +if test "x$enable_shared" = "xyes" && test "x$posix_threads" != "x"; then # NB: don't check for -lpthread here, because then it would be # added to LIBS. For the thread-unaware libmudflap.la, we don't # want it there. diff --git a/libmudflap/configure.ac b/libmudflap/configure.ac index 038bac54618..039ff4e5f5c 100644 --- a/libmudflap/configure.ac +++ b/libmudflap/configure.ac @@ -114,15 +114,28 @@ then mkdir pth fi -pthread_create_version='""' -AC_CHECK_HEADER(pthread.h,[ -AC_DEFINE_UNQUOTED(HAVE_PTHREAD_H, 1, [define if you have ]) -ac_have_pthread_h=yes -],[ -ac_have_pthread_h= -]) -AM_CONDITIONAL(LIBMUDFLAPTH, [test "x$ac_have_pthread_h" != "x"]) -if test "x$ac_have_pthread_h" != "x" +AC_CHECK_HEADERS(pthread.h) + +AC_MSG_CHECKING([for thread model used by GCC]) +target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` +AC_MSG_RESULT([$target_thread_file]) + +# We only support posix threads, or no threads at all. +posix_threads= +case ${target_thread_file} in + posix) + posix_threads=yes + ;; + single) + ;; + *) + echo "${target_thread_file} is an unsupported thread package" 1>&2 + exit 1 + ;; +esac + +AM_CONDITIONAL(LIBMUDFLAPTH, [test "x$posix_threads" != "x"]) +if test "x$posix_threads" != "x" then build_libmudflapth=1 else @@ -162,7 +175,8 @@ esac AC_SUBST(toolexecdir) AC_SUBST(toolexeclibdir) -if test "x$enable_shared" = "xyes" && test "x$ac_have_pthread_h" != "x"; then +pthread_create_version='""' +if test "x$enable_shared" = "xyes" && test "x$posix_threads" != "x"; then # NB: don't check for -lpthread here, because then it would be # added to LIBS. For the thread-unaware libmudflap.la, we don't # want it there. -- 2.11.0