embryo: add Exotic support.
[framework/uifw/embryo.git] / m4 / efl_gettimeofday.m4
1 dnl Copyright (C) 2011 Cedric Bail <cedric.bail@free.fr>
2 dnl This code is public domain and can be freely used or copied.
3
4 dnl Macro that check for gettimeofday definition
5
6 dnl Usage: EFL_CHECK_GETTIMEOFDAY(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
7 dnl Define EFL_HAVE_GETTIMEOFDAY
8
9 AC_DEFUN([EFL_CHECK_GETTIMEOFDAY],
10 [
11
12 _efl_have_gettimeofday="no"
13
14 AC_LINK_IFELSE(
15    [AC_LANG_PROGRAM([[
16 #include <stdlib.h>
17 #include <sys/time.h>
18                     ]],
19                     [[
20 int res;
21 res = gettimeofday(NULL, NULL);
22                     ]])],
23    [_efl_have_gettimeofday="yes"],
24    [_efl_have_gettimeofday="no"])
25
26 if test "x${_efl_have_gettimeofday}" = "xno" -a "x${enable_exotic}" = "xyes"; then
27    SAVE_LIBS="${LIBS}"
28    SAVE_CFLAGS="${CFLAGS}"
29    LIBS="${LIBS} ${EXOTIC_LIBS}"
30    CFLAGS="${CFLAGS} ${EXOTIC_CFLAGS}"
31    AC_LINK_IFELSE(
32       [AC_LANG_PROGRAM([[
33 #include <Exotic.h>
34                        ]],
35                        [[
36 int res;
37 res = gettimeofday(NULL, NULL);
38                        ]])],
39       [_efl_have_gettimeofday="yes"],
40       [_efl_have_gettimeofday="no"])
41 fi
42
43 if test "x${_efl_have_gettimeofday}" = "xyes"; then
44    AC_DEFINE([EFL_HAVE_GETTIMEOFDAY], [1], [Defined if gettimeofday is available.])
45 fi
46
47 AS_IF([test "x${_efl_have_gettimeofday}" = "xyes"], [$1], [$2])
48 ])