Skip to content

Commit b185c42

Browse files
committed
Test -lrt for sched_yield
Apparently, this is needed in some Solaris versions. Author: Oskari Saarenmaa
1 parent 2cb5810 commit b185c42

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

configure

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7984,6 +7984,94 @@ if test "$ac_res" != no; then
79847984

79857985
fi
79867986

7987+
# Required for thread_test.c on Solaris
7988+
{ $as_echo "$as_me:$LINENO: checking for library containing sched_yield" >&5
7989+
$as_echo_n "checking for library containing sched_yield... " >&6; }
7990+
if test "${ac_cv_search_sched_yield+set}" = set; then
7991+
$as_echo_n "(cached) " >&6
7992+
else
7993+
ac_func_search_save_LIBS=$LIBS
7994+
cat >conftest.$ac_ext <<_ACEOF
7995+
/* confdefs.h. */
7996+
_ACEOF
7997+
cat confdefs.h >>conftest.$ac_ext
7998+
cat >>conftest.$ac_ext <<_ACEOF
7999+
/* end confdefs.h. */
8000+
8001+
/* Override any GCC internal prototype to avoid an error.
8002+
Use char because int might match the return type of a GCC
8003+
builtin and then its argument prototype would still apply. */
8004+
#ifdef __cplusplus
8005+
extern "C"
8006+
#endif
8007+
char sched_yield ();
8008+
int
8009+
main ()
8010+
{
8011+
return sched_yield ();
8012+
;
8013+
return 0;
8014+
}
8015+
_ACEOF
8016+
for ac_lib in '' rt; do
8017+
if test -z "$ac_lib"; then
8018+
ac_res="none required"
8019+
else
8020+
ac_res=-l$ac_lib
8021+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8022+
fi
8023+
rm -f conftest.$ac_objext conftest$ac_exeext
8024+
if { (ac_try="$ac_link"
8025+
case "(($ac_try" in
8026+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
8027+
*) ac_try_echo=$ac_try;;
8028+
esac
8029+
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
8030+
$as_echo "$ac_try_echo") >&5
8031+
(eval "$ac_link") 2>conftest.er1
8032+
ac_status=$?
8033+
grep -v '^ *+' conftest.er1 >conftest.err
8034+
rm -f conftest.er1
8035+
cat conftest.err >&5
8036+
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
8037+
(exit $ac_status); } && {
8038+
test -z "$ac_c_werror_flag" ||
8039+
test ! -s conftest.err
8040+
} && test -s conftest$ac_exeext && {
8041+
test "$cross_compiling" = yes ||
8042+
$as_test_x conftest$ac_exeext
8043+
}; then
8044+
ac_cv_search_sched_yield=$ac_res
8045+
else
8046+
$as_echo "$as_me: failed program was:" >&5
8047+
sed 's/^/| /' conftest.$ac_ext >&5
8048+
8049+
8050+
fi
8051+
8052+
rm -rf conftest.dSYM
8053+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
8054+
conftest$ac_exeext
8055+
if test "${ac_cv_search_sched_yield+set}" = set; then
8056+
break
8057+
fi
8058+
done
8059+
if test "${ac_cv_search_sched_yield+set}" = set; then
8060+
:
8061+
else
8062+
ac_cv_search_sched_yield=no
8063+
fi
8064+
rm conftest.$ac_ext
8065+
LIBS=$ac_func_search_save_LIBS
8066+
fi
8067+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_sched_yield" >&5
8068+
$as_echo "$ac_cv_search_sched_yield" >&6; }
8069+
ac_res=$ac_cv_search_sched_yield
8070+
if test "$ac_res" != no; then
8071+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8072+
8073+
fi
8074+
79878075
# Required for thread_test.c on Solaris 2.5:
79888076
# Other ports use it too (HP-UX) so test unconditionally
79898077
{ $as_echo "$as_me:$LINENO: checking for library containing gethostbyname_r" >&5

configure.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,8 @@ AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
878878
AC_SEARCH_LIBS(crypt, crypt)
879879
# Solaris:
880880
AC_SEARCH_LIBS(fdatasync, [rt posix4])
881+
# Required for thread_test.c on Solaris
882+
AC_SEARCH_LIBS(sched_yield, rt)
881883
# Required for thread_test.c on Solaris 2.5:
882884
# Other ports use it too (HP-UX) so test unconditionally
883885
AC_SEARCH_LIBS(gethostbyname_r, nsl)

0 commit comments

Comments
 (0)