1# yield.m4 serial 2
2dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_YIELD],
8[
9  AC_REQUIRE([gl_THREADLIB])
10  dnl On some systems, sched_yield is in librt, rather than in libpthread.
11  YIELD_LIB=
12  if test $gl_threads_api = posix; then
13    dnl Solaris has sched_yield in librt, not in libpthread or libc.
14    AC_CHECK_LIB([rt], [sched_yield], [YIELD_LIB=-lrt],
15      [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt.
16       AC_CHECK_LIB([posix4], [sched_yield], [YIELD_LIB=-lposix4])])
17  fi
18  AC_SUBST([YIELD_LIB])
19])
20