From ed4ebabc902c38b6d93c8d88405fa38cbb081498 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 14 Jan 2011 19:18:38 +0000 Subject: [PATCH] libgo: Check whether we need -lrt for sched_yield. From Rainer Orth. From-SVN: r168816 --- libgo/configure | 57 ++++++++++++++++++++++++++++++++++++++++++++++ libgo/configure.ac | 3 +++ 2 files changed, 60 insertions(+) diff --git a/libgo/configure b/libgo/configure index 9b8aeaa56e6..edc6c1abf8b 100644 --- a/libgo/configure +++ b/libgo/configure @@ -13635,6 +13635,63 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 +$as_echo_n "checking for library containing sched_yield... " >&6; } +if test "${ac_cv_search_sched_yield+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_sched_yield=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_sched_yield+set}" = set; then : + break +fi +done +if test "${ac_cv_search_sched_yield+set}" = set; then : + +else + ac_cv_search_sched_yield=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sched_yield" >&5 +$as_echo "$ac_cv_search_sched_yield" >&6; } +ac_res=$ac_cv_search_sched_yield +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if test "${ac_cv_c_bigendian+set}" = set; then : diff --git a/libgo/configure.ac b/libgo/configure.ac index 7d348dcf803..3d272ec8d60 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -274,6 +274,9 @@ PTHREAD_LIBS= AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread) AC_SUBST(PTHREAD_LIBS) +dnl Test if -lrt is required for sched_yield. +AC_SEARCH_LIBS([sched_yield], [rt]) + AC_C_BIGENDIAN GCC_CHECK_UNWIND_GETIPINFO