From 766a3ce890084b12d9ad80da00c50d4c75541fc6 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Thu, 28 Jun 2012 06:45:12 +0000 Subject: [PATCH] Eina: add nice m4 macro to check function. Will be usable easily in the merge, per EFL lib Please, test. config.h is the same (except useless macro HAVE_ICONV_H) and compilation is correct on linux and mingw here SVN revision: 72972 --- legacy/eina/configure.ac | 186 +--------- legacy/eina/eina.pc.in | 4 +- legacy/eina/m4/common/efl_check_funcs.m4 | 431 +++++++++++++++++++++++ legacy/eina/src/lib/Makefile.am | 2 +- 4 files changed, 448 insertions(+), 175 deletions(-) create mode 100644 legacy/eina/m4/common/efl_check_funcs.m4 diff --git a/legacy/eina/configure.ac b/legacy/eina/configure.ac index d7fcff26d7..4b4ec62698 100644 --- a/legacy/eina/configure.ac +++ b/legacy/eina/configure.ac @@ -66,7 +66,7 @@ AC_SUBST(VMAJ) AC_CANONICAL_BUILD AC_CANONICAL_HOST -requirement_eina="" +requirements_pc_eina="" case "$host_os" in mingw32ce*) @@ -283,7 +283,7 @@ if test "x${want_valgrind}" = "xyes" || test "x${want_valgrind}" = "xauto"; then PKG_CHECK_MODULES([VALGRIND], [valgrind >= 2.4.0], [ - requirement_eina="valgrind ${requirement_eina}" + requirements_pc_eina="valgrind ${requirements_pc_eina}" have_valgrind="yes" ], [ @@ -304,7 +304,7 @@ case "$host_os" in mingw*) PKG_CHECK_MODULES([EVIL], [evil >= 1.0.0]) AC_DEFINE([HAVE_EVIL], [1], [Set to 1 if evil package is installed]) - requirement_eina="${requirement_eina} evil" + requirements_pc_eina="${requirements_pc_eina} evil" EFL_EINA_BUILD="-DEFL_EINA_BUILD" ;; esac @@ -318,7 +318,7 @@ PKG_CHECK_MODULES([EXOTIC], [enable_exotic="no"]) if test "x${enable_exotic}" = "xyes"; then - requirement_eina="exotic ${requirement_eina}" + requirements_pc_eina="exotic ${requirements_pc_eina}" EINA_CFLAGS="${EINA_CFLAGS} ${EXOTIC_CFLAGS}" EINA_LIBS="${EXOTIC_LIBS}" @@ -332,7 +332,7 @@ case "$host_vendor" in ps3*) PKG_CHECK_MODULES([ESCAPE], [escape]) AC_DEFINE(HAVE_ESCAPE, 1, [Set to 1 if Escape package is installed]) - requirement_eina="${requirement_eina} escape" + requirements_pc_eina="${requirements_pc_eina} escape" EINA_CFLAGS="${ESCAPE_CFLAGS} ${EINA_CFLAGS}" ;; esac @@ -472,33 +472,10 @@ EFL_LINKER_FLAG([-fno-strict-aliasing]) ### Checks for library functions AC_FUNC_ALLOCA + AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp backtrace backtrace_symbols malloc_usable_size mtrace]) -AC_MSG_CHECKING([for dirfd]) -AC_LINK_IFELSE( - [ - AC_LANG_PROGRAM( - [[ -#ifdef HAVE_DIRENT_H -# include -#endif - ]], - [[ -int main(void) -{ - DIR *dirp; - return dirfd(dirp); -} - ]]) - ], - [have_dirfd="yes"], - [have_dirfd="no"]) - -AC_MSG_RESULT([${have_dirfd}]) - -if test "x${have_dirfd}" = "xyes" ; then - AC_DEFINE([HAVE_DIRFD], [1], [ Define to 1 if you have the `dirfd' function or macro.]) -fi +EFL_CHECK_FUNCS([eina], [dirfd dlopen dladdr fnmatch iconv shm_open setxattr]) want_debug_malloc="no" AC_ARG_ENABLE([debug-malloc], @@ -515,14 +492,6 @@ if test "x${ac_cv_func_malloc_usable_size}" = "xyes" && test "x${want_debug_mall AC_DEFINE([EINA_DEBUG_MALLOC], [1], [Turn on debugging overhead in mempool]) fi -# dlopen and dladdr -EFL_CHECK_DLOPEN -EFL_CHECK_DLADDR - -have_log="yes" -EFL_CHECK_FNMATCH([have_log="yes"], [have_log="no"]) - -want_log="yes" AC_ARG_ENABLE([log], [AC_HELP_STRING([--disable-log], [disable Eina_Log infrastructure completly @<:@default=enabled@:>@])], [ @@ -535,7 +504,7 @@ AC_ARG_ENABLE([log], [want_log="yes"]) enable_log="no" -if test "x${have_log}" = xyes -a "x${want_log}" = xyes; then +if test "x${efl_func_fnmatch}" = "xyes" && test "x${want_log}" = "xyes" ; then enable_log="yes" fi @@ -549,134 +518,6 @@ fi AC_SUBST([EINA_CONFIGURE_ENABLE_LOG]) -# iconv library -have_iconv="no" -AC_ARG_WITH([iconv-link], - AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]), - [ - LIBS="$withval $LIBS" - have_iconv="yes" - iconv_libs=$withval - ]) - -AC_MSG_CHECKING(for explicit iconv link options) -if test "x${iconv_libs}" = "x" ; then - AC_MSG_RESULT([no explicit iconv link option]) -else - AC_MSG_RESULT([$iconv_libs]) -fi - -if test "x${have_iconv}" = "xno" ; then - AC_CHECK_HEADERS([iconv.h], [have_iconv="yes"]) - - if test "x${have_iconv}" = "xyes" ; then - AC_MSG_CHECKING([whether iconv() is in libc]) - - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[ -iconv_t ic; -size_t count = iconv(ic, NULL, NULL, NULL, NULL); - ]])], - [have_iconv="yes"], - [have_iconv="no"]) - - AC_MSG_RESULT([${have_iconv}]) - fi - - if test "x${have_iconv}" = "xno" ; then - AC_MSG_CHECKING([whether iconv() is in libiconv.a]) - - LIBS_save="${LIBS}" - LIBS="-liconv $LIBS" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[ -iconv_t ic; -size_t count; -count = iconv(ic, NULL, NULL, NULL, NULL); - ]])], - [ - have_iconv="yes" - iconv_libs="-liconv" - ], - [ - have_iconv="no" - LIBS=${LIBS_save} - ]) - - AC_MSG_RESULT([${have_iconv}]) - fi - - if test "x${have_iconv}" = "xno" ; then - AC_MSG_CHECKING([whether iconv() is in libiconv_plug.a]) - - LIBS_save="${LIBS}" - LIBS="-liconv_plug $LIBS" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[ -iconv_t ic; -size_t count = iconv(ic, NULL, NULL, NULL, NULL); - ]])], - [ - have_iconv="yes" - iconv_libs="-liconv_plug" - ], - [ - have_iconv="no" - LIBS=${LIBS_save} - ]) - - AC_MSG_RESULT([${have_iconv}]) - fi -fi - -AC_SUBST([iconv_libs]) - -if test "x${have_iconv}" = "xyes" ; then - AC_DEFINE([HAVE_ICONV], [1], [Set to 1 if iconv library is installed]) -fi - -# shm_open -EFL_CHECK_SHM_OPEN([have_shm_open="yes"], [have_shm_open="no"]) - -# extended attribute - -AC_MSG_CHECKING([for extended attributes]) - -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include -#include - ]], - [[ -size_t tmp = listxattr("/", NULL, 0); -tmp = getxattr("/", "user.ethumb.md5", NULL, 0); -setxattr("/", "user.ethumb.md5", NULL, 0, 0); - ]])], - [ - AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.]) - have_xattr="yes" - ], - [have_xattr="no"]) - -AC_MSG_RESULT([${have_xattr}]) - ### Modules if test "x${have_default_mempool}" = "xyes" ; then @@ -717,7 +558,8 @@ if test -n "$CXX" && test "x$enable_benchmark" = "xyes" ; then fi AM_CONDITIONAL([CITYHASH_BENCH], [test -n "$CXX" && test "x$enable_benchmark" = "xyes"]) -AC_SUBST([requirement_eina]) +AC_SUBST([requirements_pc_eina]) +AC_SUBST([requirements_libs_eina]) ### Build and install examples EFL_CHECK_BUILD_EXAMPLES([enable_build_examples="yes"], [enable_build_examples="no"]) @@ -775,10 +617,10 @@ echo " debug usage........: ${efl_have_debug_threads}" echo " on/off support.....: ${efl_have_on_off_threads}" fi echo " Amalgamation.........: ${do_amalgamation}" -echo " Iconv support........: ${have_iconv}" -echo " File dirfd...........: ${have_dirfd}" -echo " File xattr...........: ${have_xattr}" -echo " shm_open.............: ${have_shm_open}" +echo " Iconv support........: ${efl_func_iconv}" +echo " File dirfd...........: ${efl_func_dirfd}" +echo " File xattr...........: ${efl_func_setxattr}" +echo " shm_open.............: ${efl_func_shm_open}" echo echo " Documentation........: ${build_doc}" echo " Tests................: ${enable_tests}" diff --git a/legacy/eina/eina.pc.in b/legacy/eina/eina.pc.in index e7a5cc0f44..95b815b05f 100644 --- a/legacy/eina/eina.pc.in +++ b/legacy/eina/eina.pc.in @@ -5,8 +5,8 @@ includedir=@includedir@ Name: Eina Description: A Library that implements fast data types and miscellaneous tools -@pkgconfig_requires_private@: @requirement_eina@ +@pkgconfig_requires_private@: @requirements_pc_eina@ Version: @VERSION@ Libs: -L${libdir} -leina @EFL_PTHREAD_LIBS@ -Libs.private: @EFL_FNMATCH_LIBS@ @EFL_SHM_OPEN_LIBS@ @EFL_PTHREAD_LIBS@ @iconv_libs@ @EFL_DLOPEN_LIBS@ @EFL_DLADDR_LIBS@ @EINA_LIBS@ -lm +Libs.private: @EFL_PTHREAD_LIBS@ @requirements_libs_eina@ -lm Cflags: -I${includedir}/eina-@VMAJ@ -I${includedir}/eina-@VMAJ@/eina diff --git a/legacy/eina/m4/common/efl_check_funcs.m4 b/legacy/eina/m4/common/efl_check_funcs.m4 new file mode 100644 index 0000000000..5322c411e1 --- /dev/null +++ b/legacy/eina/m4/common/efl_check_funcs.m4 @@ -0,0 +1,431 @@ +dnl Copyright (C) 2012 Vincent Torri +dnl This code is public domain and can be freely used or copied. + +dnl Macros that check functions availability for the EFL: + +dnl dirfd +dnl dladdr +dnl dlopen +dnl fnmatch +dnl iconv +dnl setxattr (an al.) +dnl shm_open + + +dnl _EFL_CHECK_FUNC_DIRFD is for internal use +dnl _EFL_CHECK_FUNC_DIRFD(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_DIRFD], +[ +AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM( + [[ +#ifdef HAVE_DIRENT_H +# include +#endif + ]], + [[ +int main(void) +{ + DIR *dirp; + return dirfd(dirp); +} + ]]) + ], + [_efl_have_fct="yes"], + [_efl_have_fct="no"]) + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) +]) + +dnl _EFL_CHECK_FUNC_DLADDR_PRIV is for internal use +dnl _EFL_CHECK_FUNC_DLADDR_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_DLADDR_PRIV], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +LIBS_save="${LIBS}" +LIBS="${LIBS} $2" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#define _GNU_SOURCE +#include + ]], + [[ +int res = dladdr(0, 0); + ]])], + [ + m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2" + _efl_have_fct="yes" + ], + [_efl_have_fct="no"]) + +LIBS="${LIBS_save}" + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_DLADDR is for internal use +dnl _EFL_CHECK_FUNC_DLADDR(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_DLADDR], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +case "$host_os" in + mingw*) + _efl_have_fct="yes" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl" + m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} -ldl" + ;; + *) + _efl_have_fct="no" + +dnl Check is dladdr is in libc + _EFL_CHECK_FUNC_DLADDR_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"]) + +dnl Check is dlopen is in libdl + if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_DLADDR_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"]) + fi + ;; +esac + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_DLOPEN_PRIV is for internal use +dnl _EFL_CHECK_FUNC_DLOPEN_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN_PRIV], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +LIBS_save="${LIBS}" +LIBS="${LIBS} $2" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include + ]], + [[ +void *h = dlopen(0, 0); + ]])], + [ + m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2" + _efl_have_fct="yes" + ], + [_efl_have_fct="no"]) + +LIBS="${LIBS_save}" + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_DLOPEN is for internal use +dnl _EFL_CHECK_FUNC_DLOPEN(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +case "$host_os" in + mingw*) + _efl_have_fct="yes" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl" + m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} -ldl" + ;; + *) + _efl_have_fct="no" + +dnl Check is dlopen is in libc + _EFL_CHECK_FUNC_DLOPEN_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"]) + +dnl Check is dlopen is in libdl + if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_DLOPEN_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"]) + fi + ;; +esac + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_FNMATCH_PRIV is for internal use +dnl _EFL_CHECK_FUNC_FNMATCH_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH_PRIV], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +LIBS_save="${LIBS}" +LIBS="${LIBS} $2" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[ +int g = fnmatch(NULL, NULL, 0); + ]])], + [ + m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2" + _efl_have_fct="yes" + ], + [_efl_have_fct="no"]) + +LIBS="${LIBS_save}" + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_FNMATCH is for internal use +dnl _EFL_CHECK_FUNC_FNMATCH(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH], +[ +case "$host_os" in + mingw*) + _efl_have_fct="yes" + ;; + *) +dnl Check is fnmatch is in libfnmatch + _EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [-lfnmatch], [_efl_have_fct="yes"], [_efl_have_fct="no"]) + +dnl Check is fnmatch is in libiberty + if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [-liberty], [_efl_have_fct="yes"], [_efl_have_fct="no"]) + fi + ;; +esac + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) +]) + +dnl _EFL_CHECK_FUNC_ICONV_PRIV is for internal use +dnl _EFL_CHECK_FUNC_ICONV_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_ICONV_PRIV], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +LIBS_save="${LIBS}" +LIBS="${LIBS} $2" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[ +iconv_t ic; +size_t count = iconv(ic, NULL, NULL, NULL, NULL); + ]])], + [ + m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2" + _efl_have_fct="yes" + ], + [_efl_have_fct="no"]) + +LIBS="${LIBS_save}" + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_ICONV is for internal use +dnl _EFL_CHECK_FUNC_ICONV(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_ICONV], +[ +AC_ARG_WITH([iconv-link], + AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]), + [ + _efl_have_fct="yes" + iconv_libs=${withval} + ], + [_efl_have_fct="no"]) + +AC_MSG_CHECKING([for explicit iconv link options]) +if test "x${iconv_libs}" = "x" ; then + AC_MSG_RESULT([no explicit iconv link option]) +else + AC_MSG_RESULT([${iconv_libs}]) +fi + +dnl Check is iconv is in libc +if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_ICONV_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"]) +fi + +dnl Check is iconv is in libiconv +if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_ICONV_PRIV([$1], [-liconv], [_efl_have_fct="yes"], [_efl_have_fct="no"]) +fi + +dnl Check is iconv is in libiconv_plug +if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_ICONV_PRIV([$1], [-liconv_plug], [_efl_have_fct="yes"], [_efl_have_fct="no"]) +fi + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) +]) + +dnl _EFL_CHECK_FUNC_SETXATTR is for internal use +dnl _EFL_CHECK_FUNC_SETXATTR(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_SETXATTR], +[ +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +#include + ]], + [[ +size_t tmp = listxattr("/", NULL, 0); +tmp = getxattr("/", "user.ethumb.md5", NULL, 0); +setxattr("/", "user.ethumb.md5", NULL, 0, 0); + ]])], + [_efl_have_fct="yes"], + [_efl_have_fct="no"]) + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) +]) + +dnl _EFL_CHECK_FUNC_SHM_OPEN_PRIV is for internal use +dnl _EFL_CHECK_FUNC_SHM_OPEN_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN_PRIV], +[ +m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl + +LIBS_save="${LIBS}" +LIBS="${LIBS} $2" +AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include /* For mode constants */ +#include /* For O_* constants */ + ]], + [[ +int fd; + +fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO); + ]])], + [ + m4_defn([UPEFL])[]_LIBS="$ m4_defn([UPEFL])[]_LIBS $2" + requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2" + _efl_have_fct="yes" + ], + [_efl_have_fct="no"]) + +LIBS="${LIBS_save}" + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4]) + +m4_popdef([DOWNEFL]) +m4_popdef([UPEFL]) +]) + +dnl _EFL_CHECK_FUNC_SHM_OPEN is for internal use +dnl _EFL_CHECK_FUNC_SHM_OPEN(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) + +AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN], +[ +_efl_have_fct="no" + +dnl Check is shm_open is in libc +_EFL_CHECK_FUNC_SHM_OPEN_PRIV([$1], [], + [_efl_have_fct="yes"], + [_efl_have_fct="no"]) + +dnl Check is shm_open is in librt +if test "x${_efl_have_fct}" = "xno" ; then + _EFL_CHECK_FUNC_SHM_OPEN_PRIV([$1], [-lrt], + [_efl_have_fct="yes"], + [_efl_have_fct="no"]) +fi + +AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3]) +]) + +dnl Macro that checks function availability +dnl +dnl EFL_CHECK_FUNC(EFL, FUNCTION) +dnl AC_SUBST : EFL_CFLAGS and EFL_LIBS (EFL being replaced by its value) +dnl AC_DEFINE : EFL_HAVE_FUNCTION (FUNCTION being replaced by its value) +dnl result in efl_func_function (function being replaced by its value) + +AC_DEFUN([EFL_CHECK_FUNC], +[ +m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl +m4_pushdef([DOWN], m4_translit([$2], [-A-Z], [_a-z]))dnl + +m4_default([_EFL_CHECK_FUNC_]m4_defn([UP]))($1, [have_fct="yes"], [have_fct="no"]) + +if test "x$2" = "xsetxattr" ; then + AC_MSG_CHECKING([for extended attributes]) +else + AC_MSG_CHECKING([for ]m4_defn([DOWN])) +fi + +AC_MSG_RESULT([${have_fct}]) + +if test "x${have_fct}" = "xyes" ; then + if test "x$2" = "xsetxattr" ; then + AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.]) + else + AC_DEFINE([HAVE_]m4_defn([UP]), [1], [Define to 1 if you have the `]m4_defn([DOWN])[' function.]) + fi +fi + +efl_func_[]m4_defn([DOWN])="${have_fct}" + +m4_popdef([DOWN]) +m4_popdef([UP]) +]) + +dnl Macro that iterates over a sequence of space separated function +dnl and that call EFL_CHECK_FUNC() for each of these functions +dnl +dnl EFL_CHECK_FUNCS(EFL, FUNCTIONS) + +AC_DEFUN([EFL_CHECK_FUNCS], +[ +m4_foreach_w([fct], [$2], [EFL_CHECK_FUNC($1, m4_defn([fct]))]) +]) diff --git a/legacy/eina/src/lib/Makefile.am b/legacy/eina/src/lib/Makefile.am index 19e917548f..4f53c2ab8a 100644 --- a/legacy/eina/src/lib/Makefile.am +++ b/legacy/eina/src/lib/Makefile.am @@ -170,7 +170,7 @@ else libeina_la_SOURCES = $(base_sources) endif -libeina_la_LIBADD = @iconv_libs@ @EFL_SHM_OPEN_LIBS@ @EINA_LIBS@ @EFL_DLOPEN_LIBS@ @EFL_DLADDR_LIBS@ -lm +libeina_la_LIBADD = @EINA_LIBS@ -lm libeina_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ libeina_la_CFLAGS = @EINA_CFLAGS@ @EFL_PTHREAD_CFLAGS@