From dfe181ff2a4277d5ce705cca709c702213b56f73 Mon Sep 17 00:00:00 2001 From: cedric Date: Tue, 9 Aug 2011 08:39:39 +0000 Subject: [PATCH] eina: make dlopen optional. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@62236 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- configure.ac | 4 ++-- src/lib/eina_module.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1a25f68..86cae0f 100644 --- a/configure.ac +++ b/configure.ac @@ -463,13 +463,13 @@ case "$host_os" in AC_CHECK_FUNCS([dlopen], [res="yes"], [res="no"]) if test "x${res}" = "xyes" ; then AC_CHECK_FUNCS([dladdr], [AC_DEFINE(HAVE_DLADDR)]) + AC_DEFINE(HAVE_DLOPEN) else AC_CHECK_LIB([dl], [dlopen], [res="yes"], [res="no"]) if test "x${res}" = "xyes" ; then AC_CHECK_LIB([dl], [dladdr], [AC_DEFINE(HAVE_DLADDR)]) + AC_DEFINE(HAVE_DLOPEN) dlopen_libs="-ldl" - else - AC_MSG_ERROR([Cannot find dlopen]) fi fi ;; diff --git a/src/lib/eina_module.c b/src/lib/eina_module.c index 16ff18b..d3d3f70 100644 --- a/src/lib/eina_module.c +++ b/src/lib/eina_module.c @@ -46,7 +46,9 @@ void *alloca (size_t); # include #endif -#include +#ifdef HAVE_DLOPEN +# include +#endif #ifdef HAVE_EVIL # include @@ -313,6 +315,7 @@ EAPI Eina_Bool eina_module_free(Eina_Module *m) EAPI Eina_Bool eina_module_load(Eina_Module *m) { +#ifdef HAVE_DLOPEN void *dl_handle; Eina_Module_Init *initcall; @@ -352,10 +355,14 @@ loaded: eina_error_set(0); return EINA_TRUE; +#else + return EINA_FALSE; +#endif } EAPI Eina_Bool eina_module_unload(Eina_Module *m) { +#ifdef HAVE_DLOPEN Eina_Module_Shutdown *shut; EINA_SAFETY_ON_NULL_RETURN_VAL(m, EINA_FALSE); @@ -375,13 +382,20 @@ EAPI Eina_Bool eina_module_unload(Eina_Module *m) } return EINA_FALSE; +#else + return EINA_FALSE; +#endif } EAPI void *eina_module_symbol_get(const Eina_Module *m, const char *symbol) { +#ifdef HAVE_DLOPEN EINA_SAFETY_ON_NULL_RETURN_VAL(m, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(m->handle, NULL); return dlsym(m->handle, symbol); +#else + return NULL; +#endif } EAPI const char *eina_module_file_get(const Eina_Module *m) -- 2.7.4