aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/embryo/m4/efl_gettimeofday.m4
blob: 9b767e5a9b60029cecb7be3808a4829f2cde98b7 (plain)
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
dnl Copyright (C) 2011 Cedric Bail <cedric.bail@free.fr>
dnl This code is public domain and can be freely used or copied.

dnl Macro that check for gettimeofday definition

dnl Usage: EFL_CHECK_GETTIMEOFDAY(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
dnl Define EFL_HAVE_GETTIMEOFDAY

AC_DEFUN([EFL_CHECK_GETTIMEOFDAY],
[

_efl_have_gettimeofday="no"

AC_LINK_IFELSE(
   [AC_LANG_PROGRAM([[
#include <stdlib.h>
#include <sys/time.h>
		    ]],
		    [[
int res;
res = gettimeofday(NULL, NULL);
      	            ]])],
   [_efl_have_gettimeofday="yes"],
   [_efl_have_gettimeofday="no"])

if test "x${_efl_have_gettimeofday}" = "xno" -a "x${enable_exotic}" = "xyes"; then
   SAVE_LIBS="${LIBS}"
   SAVE_CFLAGS="${CFLAGS}"
   LIBS="${LIBS} ${EXOTIC_LIBS}"
   CFLAGS="${CFLAGS} ${EXOTIC_CFLAGS}"
   AC_LINK_IFELSE(
      [AC_LANG_PROGRAM([[
#include <Exotic.h>
		       ]],
		       [[
int res;
res = gettimeofday(NULL, NULL);
      		       ]])],
      [_efl_have_gettimeofday="yes"],
      [_efl_have_gettimeofday="no"])
fi

if test "x${_efl_have_gettimeofday}" = "xyes"; then
   AC_DEFINE([EFL_HAVE_GETTIMEOFDAY], [1], [Defined if gettimeofday is available.])
fi

AS_IF([test "x${_efl_have_gettimeofday}" = "xyes"], [$1], [$2])
])