Commit cc6ac522 by James E Wilson Committed by Jim Wilson

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.

From-SVN: r104838
parent 6a82a28a
2005-09-30 James E. Wilson <wilson@specifix.com> 2005-09-30 James E. Wilson <wilson@specifix.com>
* 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 * mf-heuristics.c (_end, ENTRY_POINT): Make them arrays with unknown
bounds. bounds.
......
...@@ -6325,19 +6325,22 @@ then ...@@ -6325,19 +6325,22 @@ then
mkdir pth mkdir pth
fi fi
pthread_create_version='""'
if test "${ac_cv_header_pthread_h+set}" = set; then for ac_header in pthread.h
echo "$as_me:$LINENO: checking for pthread.h" >&5 do
echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if test "${ac_cv_header_pthread_h+set}" = set; then 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 echo $ECHO_N "(cached) $ECHO_C" >&6
fi fi
echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else else
# Is the header compilable? # Is the header compilable?
echo "$as_me:$LINENO: checking pthread.h usability" >&5 echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
...@@ -6345,7 +6348,7 @@ cat confdefs.h >>conftest.$ac_ext ...@@ -6345,7 +6348,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
$ac_includes_default $ac_includes_default
#include <pthread.h> #include <$ac_header>
_ACEOF _ACEOF
rm -f conftest.$ac_objext rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
...@@ -6381,15 +6384,15 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ...@@ -6381,15 +6384,15 @@ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6 echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present? # Is the header present?
echo "$as_me:$LINENO: checking pthread.h presence" >&5 echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */ /* end confdefs.h. */
#include <pthread.h> #include <$ac_header>
_ACEOF _ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
...@@ -6423,25 +6426,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6 ...@@ -6423,25 +6426,25 @@ echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header? # So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
yes:no: ) yes:no: )
{ echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5 { echo "$as_me:$LINENO: WARNING: $ac_header: 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: WARNING: $ac_header: 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:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;} echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes ac_header_preproc=yes
;; ;;
no:yes:* ) no:yes:* )
{ echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;} echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;} echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;} echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&5 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: pthread.h: section \"Present But Cannot Be Compiled\"" >&2;} echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;} echo "$as_me: WARNING: $ac_header: 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:$LINENO: WARNING: $ac_header: 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: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
( (
cat <<\_ASBOX cat <<\_ASBOX
## ------------------------------------- ## ## ------------------------------------- ##
...@@ -6452,36 +6455,50 @@ _ASBOX ...@@ -6452,36 +6455,50 @@ _ASBOX
sed "s/^/$as_me: WARNING: /" >&2 sed "s/^/$as_me: WARNING: /" >&2
;; ;;
esac esac
echo "$as_me:$LINENO: checking for pthread.h" >&5 echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if test "${ac_cv_header_pthread_h+set}" = set; then if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6 echo $ECHO_N "(cached) $ECHO_C" >&6
else else
ac_cv_header_pthread_h=$ac_header_preproc eval "$as_ac_Header=\$ac_header_preproc"
fi fi
echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi fi
if test $ac_cv_header_pthread_h = yes; then if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_H 1
_ACEOF _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_TRUE=
LIBMUDFLAPTH_FALSE='#' LIBMUDFLAPTH_FALSE='#'
else else
...@@ -6489,7 +6506,7 @@ else ...@@ -6489,7 +6506,7 @@ else
LIBMUDFLAPTH_FALSE= LIBMUDFLAPTH_FALSE=
fi fi
if test "x$ac_have_pthread_h" != "x" if test "x$posix_threads" != "x"
then then
build_libmudflapth=1 build_libmudflapth=1
else else
...@@ -6602,7 +6619,8 @@ esac ...@@ -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 # NB: don't check for -lpthread here, because then it would be
# added to LIBS. For the thread-unaware libmudflap.la, we don't # added to LIBS. For the thread-unaware libmudflap.la, we don't
# want it there. # want it there.
......
...@@ -114,15 +114,28 @@ then ...@@ -114,15 +114,28 @@ then
mkdir pth mkdir pth
fi fi
pthread_create_version='""' AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADER(pthread.h,[
AC_DEFINE_UNQUOTED(HAVE_PTHREAD_H, 1, [define if you have <pthread.h>]) AC_MSG_CHECKING([for thread model used by GCC])
ac_have_pthread_h=yes target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
],[ AC_MSG_RESULT([$target_thread_file])
ac_have_pthread_h=
]) # We only support posix threads, or no threads at all.
AM_CONDITIONAL(LIBMUDFLAPTH, [test "x$ac_have_pthread_h" != "x"]) posix_threads=
if test "x$ac_have_pthread_h" != "x" 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 then
build_libmudflapth=1 build_libmudflapth=1
else else
...@@ -162,7 +175,8 @@ esac ...@@ -162,7 +175,8 @@ esac
AC_SUBST(toolexecdir) AC_SUBST(toolexecdir)
AC_SUBST(toolexeclibdir) 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 # NB: don't check for -lpthread here, because then it would be
# added to LIBS. For the thread-unaware libmudflap.la, we don't # added to LIBS. For the thread-unaware libmudflap.la, we don't
# want it there. # want it there.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment