eina: make dlopen optional.

SVN revision: 62236
This commit is contained in:
Cedric BAIL 2011-08-09 08:39:39 +00:00
parent f78d33c9cf
commit c89dfa73b6
2 changed files with 17 additions and 3 deletions

View File

@ -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
;;

View File

@ -46,7 +46,9 @@ void *alloca (size_t);
# include <libgen.h>
#endif
#include <dlfcn.h>
#ifdef HAVE_DLOPEN
# include <dlfcn.h>
#endif
#ifdef HAVE_EVIL
# include <Evil.h>
@ -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)