Merge remote-tracking branch 'remotes/origin/upstream'
authorJiyoun Park <jy0703.park@samsung.com>
Thu, 28 Jun 2012 11:02:42 +0000 (20:02 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Thu, 28 Jun 2012 11:02:42 +0000 (20:02 +0900)
Makefile.am
configure.ac
eina.pc.in
m4/common/efl_check_funcs.m4 [new file with mode: 0644]
m4/common/efl_dlfcn.m4 [deleted file]
m4/common/efl_fnmatch.m4 [deleted file]
m4/common/efl_shm_open.m4 [deleted file]
src/lib/Makefile.am
src/tests/Makefile.am

index e11c796..613b8d2 100644 (file)
@@ -40,15 +40,16 @@ eina.spec \
 eina.spec.in \
 m4/common/efl_attribute.m4 \
 m4/common/efl_benchmark.m4 \
+m4/common/efl_check_funcs.m4 \
 m4/common/efl_compiler_flag.m4 \
 m4/common/efl_coverage.m4 \
 m4/common/efl_cpu.m4 \
 m4/common/efl_doxygen.m4 \
-m4/common/efl_fnmatch.m4 \
-m4/common/efl_shm_open.m4 \
+m4/common/efl_examples.m4 \
+m4/common/efl_path_max.m4 \
 m4/common/efl_tests.m4 \
 m4/common/efl_threads.m4 \
-m4/common/efl_path_max.m4 \
+m4/common/efl_voltron.m4 \
 m4/eina/eina_bench.m4 \
 m4/eina/eina_check.m4
 
index d7fcff2..4b4ec62 100644 (file)
@@ -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 <dirent.h>
-#endif
-       ]],
-       [[
-int main(void)
-{
-  DIR *dirp;
-  return dirfd(dirp);
-}
-       ]])
-   ],
-   [have_dirfd="yes"],
-   [have_dirfd="no"])
 
-AC_MSG_RESULT([${have_dirfd}])
+AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp backtrace backtrace_symbols malloc_usable_size mtrace])
 
-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 <stdlib.h>
-#include <iconv.h>
-             ]],
-             [[
-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 <stdlib.h>
-#include <iconv.h>
-             ]],
-             [[
-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 <stdlib.h>
-#include <iconv.h>
-             ]],
-             [[
-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 <stdlib.h>
-#include <sys/types.h>
-#include <sys/xattr.h>
-       ]],
-       [[
-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}"
index e7a5cc0..95b815b 100644 (file)
@@ -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/m4/common/efl_check_funcs.m4 b/m4/common/efl_check_funcs.m4
new file mode 100644 (file)
index 0000000..ba221f0
--- /dev/null
@@ -0,0 +1,431 @@
+dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
+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 <dirent.h>
+#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 <dlfcn.h>
+         ]],
+         [[
+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 <dlfcn.h>
+         ]],
+         [[
+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 <stdlib.h>
+#include <fnmatch.h>
+         ]],
+         [[
+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 <stdlib.h>
+#include <iconv.h>
+         ]],
+         [[
+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 <stdlib.h>
+#include <sys/types.h>
+#include <sys/xattr.h>
+       ]],
+       [[
+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 <sys/mman.h>
+#include <sys/stat.h>        /* For mode constants */
+#include <fcntl.h>           /* 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/m4/common/efl_dlfcn.m4 b/m4/common/efl_dlfcn.m4
deleted file mode 100644 (file)
index 53ca839..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-dnl Copyright (C) 2012 Vincent Torri <vtorri at univ-evry dot fr>
-dnl That code is public domain and can be freely used or copied.
-
-dnl Macro that check if dlopen and dladdr functions are available or not.
-
-dnl Usage: EFL_CHECK_DLOPEN([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl Call AC_SUBST(EFL_DLOPEN_LIBS)
-dnl Define HAVE_DLOPEN to 1if dlopen is available
-
-AC_DEFUN([EFL_CHECK_DLOPEN],
-[
-case "$host_os" in
-   mingw*)
-      _efl_have_dlopen="yes"
-      EFL_DLOPEN_LIBS="-ldl"
-      ;;
-   *)
-   _efl_have_dlopen="no"
-
-dnl Check is dlopen is in libc
-
-   AC_MSG_CHECKING([for dlopen in libc])
-   AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM(
-          [[
-#include <dlfcn.h>
-          ]],
-          [[
-void *h = dlopen(0, 0);
-          ]])],
-      [_efl_have_dlopen="yes"],
-      [_efl_have_dlopen="no"])
-
-   AC_MSG_RESULT([${_efl_have_dlopen}])
-
-   if test "x${_efl_have_dlopen}" = "xno" ; then
-      AC_MSG_CHECKING([for dlopen in libdl])
-
-      LIBS_save="${LIBS}"
-      LIBS="${LIBS} -ldl"
-      AC_LINK_IFELSE(
-         [AC_LANG_PROGRAM(
-             [[
-#include <dlfcn.h>
-             ]],
-             [[
-void *h = dlopen(0, 0);
-             ]])],
-         [
-          EFL_DLOPEN_LIBS="-ldl"
-          _efl_have_dlopen="yes"
-         ],
-         [_efl_have_dlopen="no"])
-
-      LIBS="${LIBS_save}"
-
-      AC_MSG_RESULT([${_efl_have_dlopen}])
-   fi
-   ;;
-esac
-
-AC_SUBST([EFL_DLOPEN_LIBS])
-
-if test "x${_efl_have_dlopen}" = "xyes" ; then
-   AC_DEFINE([HAVE_DLOPEN], [1], [Define to 1 if you have the `dlopen' function.])
-fi
-
-AS_IF([test "x${_efl_have_dlopen}" = "xyes"], [$1], [$2])
-])
-
-dnl Usage: EFL_CHECK_DLADDR([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl Call AC_SUBST(EFL_DLADDR_LIBS)
-dnl Define HAVE_DLADDR to 1if dladdr is available
-
-AC_DEFUN([EFL_CHECK_DLADDR],
-[
-case "$host_os" in
-   mingw*)
-      _efl_have_dladdr="yes"
-      EFL_DLADDR_LIBS="-ldl"
-      ;;
-   *)
-   _efl_have_dladdr="no"
-
-dnl Check is dladdr is in libc
-
-   AC_MSG_CHECKING([for dladdr in libc])
-   AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM(
-          [[
-#define _GNU_SOURCE
-#include <dlfcn.h>
-          ]],
-          [[
-int res = dladdr(0, 0);
-          ]])],
-      [_efl_have_dladdr="yes"],
-      [_efl_have_dladdr="no"])
-
-   AC_MSG_RESULT([${_efl_have_dladdr}])
-
-   if test "x${_efl_have_dladdr}" = "xno" ; then
-      AC_MSG_CHECKING([for dladdr in libdl])
-
-      LIBS_save="${LIBS}"
-      LIBS="${LIBS} -ldl"
-      AC_LINK_IFELSE(
-         [AC_LANG_PROGRAM(
-             [[
-#define _GNU_SOURCE
-#include <dlfcn.h>
-             ]],
-             [[
-int res = dladdr(0, 0);
-             ]])],
-         [
-          EFL_DLADDR_LIBS="-ldl"
-          _efl_have_dladdr="yes"
-         ],
-         [_efl_have_dladdr="no"])
-
-      LIBS="${LIBS_save}"
-
-      AC_MSG_RESULT([${_efl_have_dladdr}])
-   fi
-   ;;
-esac
-
-AC_SUBST([EFL_DLADDR_LIBS])
-
-if test "x${_efl_have_dladdr}" = "xyes" ; then
-   AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if you have the `dladdr' function.])
-fi
-
-AS_IF([test "x${_efl_have_dladdr}" = "xyes"], [$1], [$2])
-])
diff --git a/m4/common/efl_fnmatch.m4 b/m4/common/efl_fnmatch.m4
deleted file mode 100644 (file)
index a92ac6b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
-dnl That code is public domain and can be freely used or copied.
-
-dnl Macro that check if fnmatch functions are available or not.
-
-dnl Usage: EFL_CHECK_FNMATCH([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl Call AC_SUBST(EFL_FNMATCH_LIBS)
-
-AC_DEFUN([EFL_CHECK_FNMATCH],
-[
-
-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],
-      [_efl_have_fnmatch="yes"],
-      [_efl_have_fnmatch="no"])
-fi
-
-EFL_FNMATCH_LIBS=""
-
-if (! test "x${ac_cv_search_fnmatch}" = "xnone required") && (! test "x${ac_cv_search_fnmatch}" = "xno") && (! test "x${ac_cv_search_fnmatch}" = "x-levil") ; then
-   EFL_FNMATCH_LIBS=${ac_cv_search_fnmatch}
-fi
-
-AC_SUBST(EFL_FNMATCH_LIBS)
-
-AS_IF([test "x$_efl_have_fnmatch" = "xyes"], [$1], [$2])
-
-])
diff --git a/m4/common/efl_shm_open.m4 b/m4/common/efl_shm_open.m4
deleted file mode 100644 (file)
index 46254c2..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-dnl Copyright (C) 2012 Vincent Torri <vtorri at univ-evry dot fr>
-dnl That code is public domain and can be freely used or copied.
-
-dnl Macro that check if shm_open function is available or not.
-
-dnl Usage: EFL_CHECK_SHM_OPEN([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl Call AC_SUBST(EFL_SHM_OPEN_LIBS)
-dnl Define HAVE_SHM_OPEN to 1if shm_open is available
-
-AC_DEFUN([EFL_CHECK_SHM_OPEN],
-[
-_efl_have_shm_open="no"
-
-dnl Check is shm_open is in libc
-
-AC_MSG_CHECKING([for shm_open in libc])
-AC_LINK_IFELSE(
-   [AC_LANG_PROGRAM(
-       [[
-#include <sys/mman.h>
-#include <sys/stat.h>        /* For mode constants */
-#include <fcntl.h>           /* For O_* constants */
-       ]],
-       [[
-int fd;
-
-fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
-       ]])],
-   [_efl_have_shm_open="yes"],
-   [_efl_have_shm_open="no"])
-
-AC_MSG_RESULT([${_efl_have_shm_open}])
-
-if test "x${_efl_have_shm_open}" = "xno" ; then
-   AC_MSG_CHECKING([for shm_open in librt])
-
-   LIBS_save="${LIBS}"
-   LIBS="${LIBS} -lrt"
-   AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM(
-          [[
-#include <sys/mman.h>
-#include <sys/stat.h>        /* For mode constants */
-#include <fcntl.h>           /* For O_* constants */
-          ]],
-          [[
-int fd;
-
-fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
-          ]])],
-      [
-       EFL_SHM_OPEN_LIBS="-lrt"
-       _efl_have_shm_open="yes"
-      ],
-      [_efl_have_shm_open="no"])
-
-   LIBS="${LIBS_save}"
-
-   AC_MSG_RESULT([${_efl_have_shm_open}])
-fi
-
-AC_SUBST([EFL_SHM_OPEN_LIBS])
-
-if test "x${_efl_have_shm_open}" = "xyes" ; then
-   AC_DEFINE([HAVE_SHM_OPEN], [1], [Define to 1 if you have the `shm_open' function.])
-fi
-
-AS_IF([test "x${_efl_have_shm_open}" = "xyes"], [$1], [$2])
-
-])
index 19e9175..4f53c2a 100644 (file)
@@ -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@
 
index c637193..64c1fad 100644 (file)
@@ -12,6 +12,7 @@ AM_CPPFLAGS =                                         \
 -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\"   \
 -DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)\"  \
 @CHECK_CFLAGS@                                 \
+@EINA_CFLAGS@                                  \
 @GLIB_CFLAGS@
 
 if EINA_HAVE_GLIB
@@ -122,9 +123,9 @@ noinst_LTLIBRARIES = libcity.la
 libcity_la_SOURCES = city.cc
 
 nodist_EXTRA_eina_bench_SOURCES = dummy.cc
-eina_bench_LDADD = @GLIB_LIBS@ $(top_builddir)/src/lib/libeina.la libcity.la
+eina_bench_LDADD = @GLIB_LIBS@ $(top_builddir)/src/lib/libeina.la libcity.la @EINA_LIBS@
 else
-eina_bench_LDADD = @GLIB_LIBS@ $(top_builddir)/src/lib/libeina.la
+eina_bench_LDADD = @GLIB_LIBS@ $(top_builddir)/src/lib/libeina.la @EINA_LIBS@
 
 endif