Evil: integrate the dlfcn code into Evil
authorVincent Torri <vincent dot torri at gmail dot com>
Mon, 28 Dec 2015 13:22:29 +0000 (14:22 +0100)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 29 Dec 2015 13:13:58 +0000 (22:13 +0900)
This will remove some incompatibilities with other packages,
especially for win-builds

26 files changed:
configure.ac
m4/efl_check_funcs.m4
src/Makefile_Ector.am
src/Makefile_Eina.am
src/Makefile_Evil.am
src/bin/evil/evil_test_dlfcn.c
src/lib/ecore/ecore_main.c
src/lib/eina/eina_module.c
src/lib/eina/eina_prefix.c
src/lib/eo/eo.c
src/lib/ethumb/ethumb.c
src/lib/evil/Evil.h
src/lib/evil/evil_dlfcn.c [moved from src/lib/evil/dlfcn.c with 99% similarity]
src/lib/evil/evil_dlfcn.h [moved from src/lib/evil/dlfcn.h with 94% similarity]
src/lib/evil/evil_stdio.h
src/modules/evas/engines/gl_common/evas_gl_api.c
src/modules/evas/engines/gl_common/evas_gl_api_ext.c
src/modules/evas/engines/gl_common/evas_gl_api_gles1.c
src/modules/evas/engines/gl_common/evas_gl_common.h
src/modules/evas/engines/gl_common/evas_gl_context.c
src/modules/evas/engines/gl_common/evas_gl_core.c
src/modules/evas/engines/gl_generic/evas_engine.c
src/modules/evas/engines/gl_sdl/evas_engine.c
src/modules/evas/engines/software_generic/evas_engine.c
src/tests/evas/evas_test_evasgl.c
src/tests/evil/evil_test_dlfcn.c

index 6e5953b..a7f97c9 100644 (file)
@@ -714,8 +714,6 @@ fi
 AM_CONDITIONAL([WANT_SYSTEMD], [test "${want_systemd}" = "yes"])
 AM_CONDITIONAL([HAVE_SYSTEMD], [test "${want_systemd}" = "yes" -a "${have_systemd_pkg}" = "yes"])
 #### Platform-dependent
-DL_LIBS=""
-DL_INTERNAL_LIBS=""
 
 #### Evil
 EFL_LIB_START_OPTIONAL([Evil], [test "${have_windows}" = "yes"])
@@ -729,10 +727,7 @@ EFL_SELECT_WINDOWS_VERSION
 
 ### Checks for libraries
 
-EFL_ADD_LIBS([EVIL], [-lole32 -lws2_32 -lsecur32 -luuid])
-EVIL_DLFCN_LIBS="-lpsapi"
-
-AC_SUBST([EVIL_DLFCN_LIBS])
+EFL_ADD_LIBS([EVIL], [-lpsapi -lole32 -lws2_32 -lsecur32 -luuid])
 
 ### Checks for header files
 
@@ -742,7 +737,7 @@ AC_SUBST([EVIL_DLFCN_LIBS])
 
 ### Checks for compiler characteristics
 
-EVIL_DLFCN_CPPFLAGS="-DEFL_EVIL_DLFCN_BUILD -DPSAPI_VERSION=1"
+EVIL_CPPFLAGS="-DPSAPI_VERSION=1"
 # TODO: should we have these at EFL (global?)
 # Note: these warnings should not be used with C++ code
 EVIL_CFLAGS_WRN="-Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
@@ -753,7 +748,7 @@ if test "x${have_win32}" = "xyes" ; then
    EVIL_CXXFLAGS="-fno-rtti -fno-exceptions -DSECURITY_WIN32 ${EVIL_CXXFLAGS}"
 fi
 
-AC_SUBST([EVIL_DLFCN_CPPFLAGS])
+AC_SUBST([EVIL_CPPFLAGS])
 AC_SUBST([EVIL_CFLAGS_WRN])
 AC_SUBST([EVIL_CXXFLAGS])
 
@@ -761,9 +756,6 @@ AC_SUBST([EVIL_CXXFLAGS])
 
 ### Checks for library functions
 
-DL_LIBS="lib/evil/libdl.la"
-DL_INTERNAL_LIBS="lib/evil/libdl.la"
-
 EFL_LIB_END_OPTIONAL([Evil])
 
 AC_SUBST([USE_EVIL_CFLAGS])
index e538db7..24c3dba 100644 (file)
@@ -71,7 +71,7 @@ esac
 case "$host_os" in
    mingw*)
       $2="yes"
-      EFL_ADD_LIBS([$1], [lib/evil/libdl.la])
+      EFL_ADD_LIBS([$1], [lib/evil/libevil.la])
    ;;
    *)
       EFL_FIND_LIB_FOR_CODE([$1], [$dllibs], [$2], [[
@@ -100,7 +100,7 @@ esac
 case "$host_os" in
    mingw*)
       $2="yes"
-      EFL_ADD_LIBS([$1], [lib/evil/libdl.la])
+      EFL_ADD_LIBS([$1], [lib/evil/libevil.la])
    ;;
    *)
       EFL_FIND_LIB_FOR_CODE([$1], [$dllibs], [$2], [[
@@ -125,7 +125,7 @@ esac
 case "$host_os" in
    mingw*)
       $2="yes"
-      EFL_ADD_LIBS([$1], [lib/evil/libdl.la])
+      EFL_ADD_LIBS([$1], [lib/evil/libevil.la])
    ;;
    *)
       EFL_FIND_LIB_FOR_CODE([$1], [$dllibs], [$2], [[
index 1855b17..8f862c2 100644 (file)
@@ -130,8 +130,8 @@ lib_ector_libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
 @VALGRIND_CFLAGS@ \
 @SSE3_CFLAGS@
 
-lib_ector_libector_la_LIBADD = @ECTOR_LIBS@ @DL_LIBS@
-lib_ector_libector_la_DEPENDENCIES = @ECTOR_INTERNAL_LIBS@ @DL_INTERNAL_LIBS@
+lib_ector_libector_la_LIBADD = @ECTOR_LIBS@
+lib_ector_libector_la_DEPENDENCIES = @ECTOR_INTERNAL_LIBS@
 lib_ector_libector_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
 
 ### Unit tests
index 7e65a26..abfff07 100644 (file)
@@ -241,8 +241,8 @@ lib_eina_libeina_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
 -DPACKAGE_DATA_DIR=\"$(datadir)/eina\" \
 @VALGRIND_CFLAGS@
 
-lib_eina_libeina_la_LIBADD = @EINA_LIBS@ @DL_LIBS@ @UNWIND_LIBS@
-lib_eina_libeina_la_DEPENDENCIES = @EINA_INTERNAL_LIBS@ @DL_INTERNAL_LIBS@
+lib_eina_libeina_la_LIBADD = @EINA_LIBS@ @UNWIND_LIBS@
+lib_eina_libeina_la_DEPENDENCIES = @EINA_INTERNAL_LIBS@
 lib_eina_libeina_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
 
 ### Binaries
index 60fc567..d4cc0be 100644 (file)
@@ -2,11 +2,12 @@
 if HAVE_WINDOWS
 ### Library
 
-lib_LTLIBRARIES += lib/evil/libevil.la lib/evil/libdl.la
+lib_LTLIBRARIES += lib/evil/libevil.la
 
 install_evilheadersdir = $(includedir)/evil-@VMAJ@
 dist_install_evilheaders_DATA = \
 lib/evil/Evil.h \
+lib/evil/evil_dlfcn.h \
 lib/evil/evil_fcntl.h \
 lib/evil/evil_inet.h \
 lib/evil/evil_langinfo.h \
@@ -22,7 +23,6 @@ lib/evil/evil_time.h \
 lib/evil/evil_unistd.h \
 lib/evil/evil_util.h \
 lib/evil/dirent.h \
-lib/evil/dlfcn.h \
 lib/evil/fnmatch.h \
 lib/evil/pwd.h
 
@@ -32,6 +32,7 @@ lib/evil/sys/mman.h
 
 lib_evil_libevil_la_SOURCES = \
 lib/evil/evil_dirent.c \
+lib/evil/evil_dlfcn.c \
 lib/evil/evil_fcntl.c \
 lib/evil/evil_fnmatch.c \
 lib/evil/evil_fnmatch_list_of_states.c \
@@ -51,6 +52,7 @@ lib/evil/evil_util.c \
 lib/evil/evil_private.h \
 lib/evil/evil_fnmatch_private.h
 
+lib_evil_libevil_la_CPPFLAGS = @EVIL_CPPFLAGS@
 lib_evil_libevil_la_CFLAGS = @EVIL_CFLAGS@ @EVIL_CFLAGS_WRN@ -D__USE_MINGW_ANSI_STDIO
 lib_evil_libevil_la_CXXFLAGS = @EVIL_CXXFLAGS@ @EVIL_CFLAGS@
 lib_evil_libevil_la_LIBADD = @EVIL_LIBS@
@@ -71,23 +73,11 @@ lib/evil/regex/cname.h \
 lib/evil/regex/regex2.h \
 lib/evil/regex/utils.h
 
-lib_evil_libevil_la_CPPFLAGS = \
+lib_evil_libevil_la_CPPFLAGS += \
 -I$(top_srcdir)/src/lib/evil \
 -I$(top_srcdir)/src/lib/evil/regex \
 -DPOSIX_MISTAKE
 
-#libdl
-
-lib_evil_libdl_la_SOURCES = lib/evil/dlfcn.c
-
-lib_evil_libdl_la_CPPFLAGS = \
--I$(top_builddir)/src/lib/efl \
-@EVIL_CFLAGS@ \
-@EVIL_DLFCN_CPPFLAGS@
-lib_evil_libdl_la_LIBADD = @USE_EVIL_LIBS@ @EVIL_DLFCN_LIBS@
-lib_evil_libdl_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
-lib_evil_libdl_la_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@
-
 ### Binary
 
 bin_PROGRAMS += bin/evil/evil_suite bin/evil/test_evil
@@ -120,12 +110,12 @@ bin/evil/evil_test_util.h
 #suite_SOURCES +=  bin/evil/memcpy_glibc_i686.S # see EXTRA_DIST below!
 
 bin_evil_evil_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EVIL_CFLAGS@
-bin_evil_evil_suite_LDADD = @USE_EVIL_LIBS@ @DL_LIBS@ -lm
-bin_evil_evil_suite_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@ @DL_INTERNAL_LIBS@
+bin_evil_evil_suite_LDADD = @USE_EVIL_LIBS@ -lm
+bin_evil_evil_suite_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@
 
 bin_evil_test_evil_SOURCES = bin/evil/test_evil.c
 bin_evil_test_evil_LDADD = @USE_EVIL_LIBS@
-bin_evil_test_evil_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@ @DL_INTERNAL_LIBS@
+bin_evil_test_evil_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@
 
 ### Unit tests
 
@@ -147,8 +137,8 @@ tests_evil_evil_suite_CPPFLAGS = \
 -DTESTS_BUILD_DIR=PACKAGE_BUILD_DIR \
 @CHECK_CFLAGS@ \
 @EVIL_CFLAGS@
-tests_evil_evil_suite_LDADD = @USE_EVIL_LIBS@ @DL_LIBS@ @CHECK_LIBS@
-tests_evil_evil_suite_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@ @DL_INTERNAL_LIBS@
+tests_evil_evil_suite_LDADD = @USE_EVIL_LIBS@ @CHECK_LIBS@
+tests_evil_evil_suite_DEPENDENCIES = @USE_EVIL_INTERNAL_LIBS@
 
 endif
 
index b84a9eb..605f5c4 100644 (file)
@@ -3,7 +3,6 @@
 #endif /* HAVE_CONFIG_H */
 
 #include <string.h>
-#include <dlfcn.h>
 
 #include <Evil.h>
 
index f7e6a8a..801e66e 100644 (file)
@@ -172,7 +172,9 @@ timerfd_settime(int                      fd EINA_UNUSED,
 #error No uv.h header found?
 #endif
 
-#include <dlfcn.h>
+#if defined HAVE_DLOPEN && ! defined _WIN32
+# include <dlfcn.h>
+#endif
 
 static uv_prepare_t _ecore_main_uv_prepare;
 static uv_check_t _ecore_main_uv_check;
index 2cfcde7..41d1fb3 100644 (file)
@@ -27,7 +27,7 @@
 #include <libgen.h>
 #include <unistd.h>
 
-#ifdef HAVE_DLOPEN
+#if defined HAVE_DLOPEN && ! defined _WIN32
 # include <dlfcn.h>
 #endif
 
index a01b5fa..2165d05 100644 (file)
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <limits.h>
 
-#ifdef HAVE_DLADDR
+#if defined HAVE_DLADDR && ! defined _WIN32
 # include <dlfcn.h>
 #endif
 
index ef4a625..b2a498c 100644 (file)
@@ -2,7 +2,7 @@
 # include <config.h>
 #endif
 
-#ifdef HAVE_DLADDR
+#if defined HAVE_DLADDR && ! defined _WIN32
 # include <dlfcn.h>
 #endif
 
index 7d21b0c..4e2c5a7 100644 (file)
@@ -41,7 +41,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
-#include <dlfcn.h>
 #include <ctype.h>
 #include <pwd.h>
 
index c4ee0a1..837803c 100644 (file)
@@ -108,6 +108,7 @@ typedef unsigned long  gid_t;
 
 
 #include "evil_macro.h"
+#include "evil_dlfcn.h"
 #include "evil_fcntl.h"
 #include "evil_inet.h"
 #include "evil_langinfo.h"
similarity index 99%
rename from src/lib/evil/dlfcn.c
rename to src/lib/evil/evil_dlfcn.c
index 76fbf85..8dc07df 100644 (file)
 
 #include "evil_macro.h"
 #include "evil_util.h"
+#include "evil_dlfcn.h"
 #include "evil_private.h"
 
-#include "dlfcn.h"
-
 
 static char *_dl_err = NULL;
 static int _dl_err_viewed = 0;
similarity index 94%
rename from src/lib/evil/dlfcn.h
rename to src/lib/evil/evil_dlfcn.h
index 349a9b4..96fd30a 100644 (file)
@@ -5,30 +5,8 @@
 #include <limits.h>
 
 
-#ifdef EAPI
-# undef EAPI
-#endif /* EAPI */
-
-#ifdef _WIN32
-# ifdef EFL_EVIL_DLFCN_BUILD
-#  ifdef DLL_EXPORT
-#   define EAPI __declspec(dllexport)
-#  else
-#   define EAPI
-#  endif /* ! DLL_EXPORT */
-# else
-#  define EAPI __declspec(dllimport)
-# endif /* ! EFL_EVIL_DLFCN_BUILD */
-#endif /* _WIN32 */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
 /**
- * @file dlfcn.h
+ * @file evil_dlfcn.h
  * @brief The file that provides functions to manage dynamic-link libraries
  * @defgroup Evil_Dlfcn Functions that manage dynamic-link libraries.
  * @ingroup Evil
@@ -181,7 +159,7 @@ EAPI void *dlopen(const char* path, int mode);
  *
  * @ingroup Evil_Dlfcn
  */
-EAPI int   dlclose(void* handle);
+EAPI int dlclose(void* handle);
 
 /**
  * @brief Get the address of a symbol.
@@ -260,9 +238,4 @@ EAPI int dladdr (const void *addr, Dl_info *info);
 EAPI char *dlerror (void);
 
 
-#ifdef __cplusplus
-}
-#endif
-
-
 #endif /* __EVIL_DLFCN_H__ */
index 1f65609..7b61a33 100644 (file)
@@ -10,7 +10,6 @@
  *
  * This header provides functions ported from Unix in stdio.h.
  *
- * 
  */
 
 #define EVIL_PATH_SEP_SWAP(p, s1, s2) \
index 42e6c7e..649b63a 100644 (file)
@@ -1,7 +1,10 @@
 #define GL_ERRORS_NODEF 1
 #include "evas_gl_core_private.h"
 #include "evas_gl_api_ext.h"
-#include <dlfcn.h>
+
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
 
 #define EVGL_FUNC_BEGIN() if (UNLIKELY(_need_context_restore)) _context_restore()
 
index b826df7..adc9cbb 100644 (file)
@@ -1,7 +1,9 @@
 
 #include "evas_gl_api_ext.h"
 
-#include <dlfcn.h>
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
 
 #define EVGL_FUNC_BEGIN() if (UNLIKELY(_need_context_restore)) _context_restore()
 
index 28d4784..0619c03 100644 (file)
@@ -1,7 +1,9 @@
 #define GL_ERRORS_NODEF 1
 #include "evas_gl_core_private.h"
 
-#include <dlfcn.h>
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
 
 #define EVGL_FUNC_BEGIN() if (UNLIKELY(_need_context_restore)) _context_restore()
 
index 378a806..24a5c3a 100644 (file)
@@ -763,7 +763,11 @@ void pt_unref(Evas_GL_Texture_Pool *pt);
 //#define GL_ERRORS_TRACE 1
 
 #ifdef GL_ERRORS
-#include <dlfcn.h>
+
+# ifndef _WIN32
+#  include <dlfcn.h>
+# endif
+
 static inline void
 __evas_gl_errdyn(int err, const char *file, const char *func, int line, const char *op)
 {
index 00445d8..caf1619 100644 (file)
@@ -1,7 +1,7 @@
 #define _EVAS_GL_CONTEXT_C
 #include "evas_gl_private.h"
 
-#ifdef HAVE_DLSYM
+#if defined HAVE_DLSYM && ! defined _WIN32
 # include <dlfcn.h>      /* dlopen,dlclose,etc */
 #else
 # error gl_common should not get compiled if dlsym is not found on the system!
index 16e163b..ba3496a 100644 (file)
@@ -1,5 +1,8 @@
 #include "evas_gl_core_private.h"
-#include <dlfcn.h>
+
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
 
 // EVGL GL Format Pair
 typedef struct _GL_Format
index c462225..24d2c06 100644 (file)
@@ -4,7 +4,7 @@
 #include "software/Ector_Software.h"
 #include "cairo/Ector_Cairo.h"
 
-#ifdef HAVE_DLSYM
+#if defined HAVE_DLSYM && ! defined _WIN32
 # include <dlfcn.h>      /* dlopen,dlclose,etc */
 #else
 # error gl_x11 should not get compiled if dlsym is not found on the system!
index 56a2c7d..8c70fba 100644 (file)
@@ -2,7 +2,9 @@
 #include "evas_private.h"
 #include "evas_engine.h"
 
-#include <dlfcn.h>
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
 
 #include <SDL2/SDL_opengl.h>
 
index 73334c2..728a736 100644 (file)
 #include <software/Ector_Software.h>
 #include "cairo/Ector_Cairo.h"
 
-#ifdef HAVE_DLSYM
+#if defined HAVE_DLSYM && ! defined _WIN32
 # include <dlfcn.h>      /* dlopen,dlclose,etc */
+#endif
 
+#if defined HAVE_DLSYM
 # define EVAS_GL 1
 # define EVAS_GL_NO_GL_H_CHECK 1
 # include "Evas_GL.h"
index 8b75777..3263cfa 100644 (file)
 #endif
 
 #include <stdio.h>
-#include <dlfcn.h>
+
+#ifndef _WIN32
+# include <dlfcn.h>
+#endif
 
 #define EFL_GFX_FILTER_BETA
 #include "evas_suite.h"
index 28ee5b5..0d0980e 100644 (file)
@@ -20,7 +20,6 @@
 # include "config.h"
 #endif
 
-#include <dlfcn.h>
 #include <Evil.h>
 
 #include "evil_suite.h"