~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
dnl   
dnl pandora-build: A pedantic build system
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
dnl From Monty Taylor


dnl --------------------------------------------------------------------
dnl  Check for libpthread
dnl --------------------------------------------------------------------

AC_DEFUN([PANDORA_PTHREAD_YIELD],[
  AC_REQUIRE([ACX_PTHREAD])

  save_CFLAGS="${CFLAGS}"
  save_CXXFLAGS="${CXXFLAGS}"
  CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}"
  CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}"
  dnl Some OSes like Mac OS X have that as a replacement for pthread_yield()
  AC_CHECK_FUNCS(pthread_yield_np)
  AC_CACHE_CHECK([if pthread_yield takes zero arguments],
    [pandora_cv_pthread_yield_zero_arg],
    [AC_LINK_IFELSE([
      AC_LANG_PROGRAM([[
#include <pthread.h>
        ]],[[
  pthread_yield();
        ]])],
      [pandora_cv_pthread_yield_zero_arg=yes],
      [pandora_cv_pthread_yield_zero_arg=no])])
  AS_IF([test "$pandora_cv_pthread_yield_zero_arg" = "yes"],[
    AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
              [pthread_yield that doesn't take any arguments])
  ])

  AC_CACHE_CHECK([if pthread_yield takes one argument],
    [pandora_cv_pthread_yield_one_arg],
    [AC_LINK_IFELSE([
      AC_LANG_PROGRAM([[
#include <pthread.h>
        ]],[[
  pthread_yield(0);
        ]])],
      [pandora_cv_pthread_yield_one_arg=yes],
      [pandora_cv_pthread_yield_one_arg=no])])
  AS_IF([test "$pandora_cv_pthread_yield_one_arg" = "yes"],[
    AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
              [pthread_yield function with one argument])
  ])

  CFLAGS="${save_CFLAGS}"
  CXXFLAGS="${save_CXXFLAGS}"
])


AC_DEFUN([_PANDORA_SEARCH_PTHREAD],[
  AC_REQUIRE([ACX_PTHREAD])
  LIBS="${PTHREAD_LIBS} ${LIBS}"
  AM_CFLAGS="${PTHREAD_CFLAGS} ${AM_CFLAGS}"
  AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}"
  PANDORA_PTHREAD_YIELD
])


AC_DEFUN([PANDORA_HAVE_PTHREAD],[
  AC_REQUIRE([_PANDORA_SEARCH_PTHREAD])
])

AC_DEFUN([PANDORA_REQUIRE_PTHREAD],[
  AC_REQUIRE([PANDORA_HAVE_PTHREAD])
  AS_IF([test "x$acx_pthread_ok" != "xyes"],[
    AC_MSG_ERROR(could not find libpthread)])
])