Statistics
| Branch: | Tag: | Revision:

root / config / gr_omnithread.m4 @ 4d88dd87

History | View | Annotate | Download (1.7 kB)

1
# Check for Omnithread (pthread/NT) thread support.             -*- Autoconf -*-
2
3
# Copyright 2003,2007 Free Software Foundation, Inc.
4
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3, or (at your option)
8
# any later version.
9
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Boston, MA
18
# 02110-1301, USA.
19
20
AC_DEFUN([GR_OMNITHREAD],
21
[
22
  # Check first for POSIX
23
  ACX_PTHREAD(
24
  [ AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
25
    ot_posix="yes"
26
    DEFINES="$DEFINES -DOMNITHREAD_POSIX=1"
27
  ],[
28
    # If no POSIX support found, then check for NT threads
29
    AC_MSG_CHECKING([for NT threads])
30
31
    AC_LINK_IFELSE([
32
        #include <windows.h>
33
        #include <winbase.h>
34
        int main() { InitializeCriticalSection(NULL); return 0; }
35
      ],
36
      [ 
37
        ot_nt="yes"
38
        DEFINES="$DEFINES -DOMNITHREAD_NT=1"
39
      ],
40
      [AC_MSG_FAILURE([GNU Radio requires POSIX threads.  pthreads not found.])]
41
    )
42
    AC_MSG_RESULT(yes)
43
  ])
44
  AM_CONDITIONAL(OMNITHREAD_POSIX, test "x$ot_posix" = xyes)
45
  AM_CONDITIONAL(OMNITHREAD_NT, test "x$ot_nt" = xyes)
46
47
  save_LIBS="$LIBS"
48
  AC_SEARCH_LIBS([clock_gettime], [rt], [PTHREAD_LIBS="$PTHREAD_LIBS $LIBS"])
49
  AC_CHECK_FUNCS([clock_gettime gettimeofday nanosleep])
50
  LIBS="$save_LIBS"
51
])
52