From 342cf187482c7e7e3cb25639c63d93d350ba9c42 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 24 Feb 2012 11:16:23 +0000 Subject: [PATCH] embryo: add Exotic support. SVN revision: 68399 --- legacy/embryo/configure.ac | 17 +++++++++- legacy/embryo/m4/efl_fnmatch.m4 | 2 +- legacy/embryo/m4/efl_gettimeofday.m4 | 48 ++++++++++++++++++++++++++++ legacy/embryo/src/lib/embryo_amx.c | 4 +++ legacy/embryo/src/lib/embryo_str.c | 4 +++ legacy/embryo/src/lib/embryo_time.c | 6 +++- 6 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 legacy/embryo/m4/efl_gettimeofday.m4 diff --git a/legacy/embryo/configure.ac b/legacy/embryo/configure.ac index 61c50b850f..14168e201e 100644 --- a/legacy/embryo/configure.ac +++ b/legacy/embryo/configure.ac @@ -109,6 +109,21 @@ AC_SUBST(EFL_EMBRYO_BUILD) # For embryo_cc_prefix.c PKG_CHECK_MODULES([EINA], [eina >= 1.1.0]) +### Checks for portability layer + +PKG_CHECK_MODULES([EXOTIC], + [exotic], + [enable_exotic="yes"], + [enable_exotic="no"]) + +if test "x${enable_exotic}" = "xyes"; then + requirement_eina="exotic ${requirement_eina}" + EINA_CFLAGS="${EINA_CFLAGS} ${EXOTIC_CFLAGS}" + EINA_LIBS="${EXOTIC_LIBS}" + + AC_DEFINE([HAVE_EXOTIC], [1], [Define to 1 if you have Exotic.]) +fi + ### Checks for header files AC_CHECK_HEADERS([unistd.h]) @@ -167,7 +182,7 @@ case "$host_os" in AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defined to 1 (MinGW platform)]) ;; *) - AC_CHECK_FUNCS(gettimeofday) + EFL_CHECK_GETTIMEOFDAY([], [AC_MSG_ERROR([Cannot find gettimeofday()])]) ;; esac diff --git a/legacy/embryo/m4/efl_fnmatch.m4 b/legacy/embryo/m4/efl_fnmatch.m4 index a92ac6b636..c857046e06 100644 --- a/legacy/embryo/m4/efl_fnmatch.m4 +++ b/legacy/embryo/m4/efl_fnmatch.m4 @@ -13,7 +13,7 @@ AC_CHECK_HEADER([fnmatch.h], [_efl_have_fnmatch="yes"], [_efl_have_fnmatch="no"] if test "x${_efl_have_fnmatch}" = "xyes" ; then AC_SEARCH_LIBS([fnmatch], - [fnmatch evil iberty], + [fnmatch evil exotic iberty], [_efl_have_fnmatch="yes"], [_efl_have_fnmatch="no"]) fi diff --git a/legacy/embryo/m4/efl_gettimeofday.m4 b/legacy/embryo/m4/efl_gettimeofday.m4 new file mode 100644 index 0000000000..9b767e5a9b --- /dev/null +++ b/legacy/embryo/m4/efl_gettimeofday.m4 @@ -0,0 +1,48 @@ +dnl Copyright (C) 2011 Cedric Bail +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 +#include + ]], + [[ +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 + ]], + [[ +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]) +]) diff --git a/legacy/embryo/src/lib/embryo_amx.c b/legacy/embryo/src/lib/embryo_amx.c index 4fa84c5193..7a411119d3 100644 --- a/legacy/embryo/src/lib/embryo_amx.c +++ b/legacy/embryo/src/lib/embryo_amx.c @@ -29,6 +29,10 @@ #include #include +#ifdef HAVE_EXOTIC +# include +#endif + #include "Embryo.h" #include "embryo_private.h" diff --git a/legacy/embryo/src/lib/embryo_str.c b/legacy/embryo/src/lib/embryo_str.c index 8f2f5cef28..0c2faa2d15 100644 --- a/legacy/embryo/src/lib/embryo_str.c +++ b/legacy/embryo/src/lib/embryo_str.c @@ -28,6 +28,10 @@ void *alloca (size_t); # endif #endif +#ifdef HAVE_EXOTIC +# include +#endif + #include #include #include diff --git a/legacy/embryo/src/lib/embryo_time.c b/legacy/embryo/src/lib/embryo_time.c index 8392ec362a..90c14cfd89 100644 --- a/legacy/embryo/src/lib/embryo_time.c +++ b/legacy/embryo/src/lib/embryo_time.c @@ -2,7 +2,7 @@ # include "config.h" #endif -#ifndef HAVE_GETTIMEOFDAY +#ifndef EFL_HAVE_GETTIMEOFDAY # error "Your platform isn't supported yet" #endif @@ -17,6 +17,10 @@ # include #endif +#ifdef HAVE_EXOTIC +# include +#endif + #include "Embryo.h" #include "embryo_private.h"