1 dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4 dnl pandora-build: A pedantic build system
5 dnl Copyright (C) 2009 Sun Microsystems, Inc.
6 dnl This file is free software; Sun Microsystems
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
13 dnl --------------------------------------------------------------------
14 dnl Check for libpthread
15 dnl --------------------------------------------------------------------
17 AC_DEFUN([PANDORA_PTHREAD_YIELD],[
18 AC_REQUIRE([ACX_PTHREAD])
20 save_CFLAGS="${CFLAGS}"
21 save_CXXFLAGS="${CXXFLAGS}"
22 CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}"
23 CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}"
24 dnl Some OSes like Mac OS X have that as a replacement for pthread_yield()
25 AC_CHECK_FUNCS(pthread_yield_np)
26 AC_CACHE_CHECK([if pthread_yield takes zero arguments],
27 [pandora_cv_pthread_yield_zero_arg],
34 [pandora_cv_pthread_yield_zero_arg=yes],
35 [pandora_cv_pthread_yield_zero_arg=no])])
36 AS_IF([test "$pandora_cv_pthread_yield_zero_arg" = "yes"],[
37 AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
38 [pthread_yield that doesn't take any arguments])
41 AC_CACHE_CHECK([if pthread_yield takes one argument],
42 [pandora_cv_pthread_yield_one_arg],
49 [pandora_cv_pthread_yield_one_arg=yes],
50 [pandora_cv_pthread_yield_one_arg=no])])
51 AS_IF([test "$pandora_cv_pthread_yield_one_arg" = "yes"],[
52 AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
53 [pthread_yield function with one argument])
56 CFLAGS="${save_CFLAGS}"
57 CXXFLAGS="${save_CXXFLAGS}"
61 AC_DEFUN([_PANDORA_SEARCH_PTHREAD],[
62 AC_REQUIRE([ACX_PTHREAD])
63 LIBS="${PTHREAD_LIBS} ${LIBS}"
64 AM_CFLAGS="${PTHREAD_CFLAGS} ${AM_CFLAGS}"
65 AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}"
70 AC_DEFUN([PANDORA_HAVE_PTHREAD],[
71 AC_REQUIRE([_PANDORA_SEARCH_PTHREAD])
74 AC_DEFUN([PANDORA_REQUIRE_PTHREAD],[
75 AC_REQUIRE([PANDORA_HAVE_PTHREAD])
76 AS_IF([test "x$acx_pthread_ok" != "xyes"],[
77 AC_MSG_ERROR(could not find libpthread)])