source: trunk/m4/nanosleep.m4 @ 704

Revision 664, 1.2 KB checked in by dcarter, 3 years ago (diff)

see #126: Check for nanosleep link options

Line 
1# Copyright (C) 2005-2008 David Carter <arm4@arm4.org>
2
3# This file is free software; as a special exception the author gives
4# unlimited permission to copy and/or distribute it, with or without
5# modifications, as long as this notice is preserved.
6#
7# This program is distributed in the hope that it will be useful, but
8# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
9# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
11# Macros to check the link flags for the nanosleep function
12
13AC_DEFUN([__ARM4_NANOSLEEP_CHECKLINK],
14[
15  NANOSLEEP_LIBS="$1"
16  ac_save_LIBS="$LIBS"
17  LIBS="$LIBS $NANOSLEEP_LIBS"
18  AC_LINK_IFELSE([
19#include <time.h>
20
21main ()
22{
23    struct timespec request;
24    nanosleep (&request, (struct timespec *)0);
25}
26], ,[NANOSLEEP_LIBS="fail"])
27  LIBS="$ac_save_libs"
28  AC_SUBST(NANOSLEEP_LIBS)
29])
30
31AC_DEFUN([ARM4_CHECK_NANOSLEEP],
32[
33  AC_MSG_CHECKING(for nanosleep link options)
34  __ARM4_NANOSLEEP_CHECKLINK([])
35  if test "x$NANOSLEEP_LIBS" = xfail ; then
36    __ARM4_NANOSLEEP_CHECKLINK([-lrt])
37  fi
38  if test "x$NANOSLEEP_LIBS" = xfail ; then
39    AC_MSG_RESULT(no)
40    AC_MSG_ERROR(Unable to link nanosleep)
41  else
42    AC_MSG_RESULT($NANOSLEEP_LIBS)
43  fi
44])
Note: See TracBrowser for help on using the repository browser.