anmd fix dlopen link detection , actually check for dladdr as it's a gnu

extension etc.


SVN revision: 19777
This commit is contained in:
Carsten Haitzler 2006-01-14 12:36:25 +00:00
parent f435375b19
commit 55172140f9
3 changed files with 42 additions and 15 deletions

View File

@ -124,6 +124,21 @@ AC_PATH_GENERIC(freetype, 9.5.0,
[ AC_MSG_ERROR(Freetype isn't installed) ]
)
dlopen_libs=""
AC_CHECK_FUNCS(dlopen, res=yes, res=no)
if test "x$res" = "xyes"; then
AC_CHECK_FUNCS(dladdr, AC_DEFINE(HAVE_DLADDR))
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))
dlopen_libs=-ldl
else
AC_MSG_ERROR(Cannot find dlopen)
fi
fi
AC_SUBST(dlopen_libs)
#####################################################################
## Engines

View File

@ -24,7 +24,7 @@ libevas_la_LIBADD = \
imaging/libevas_imaging.la \
engines/common/libevas_engine_common.la \
-lm \
-ldl \
@dlopen_libs@ \
@FREETYPE_LIBS@ \
@png_libs@ @jpeg_libs@ @eet_libs@ @edb_libs@

View File

@ -53,7 +53,6 @@ evas_module_paths_init(void)
char *path;
int i;
Evas_List *paths = NULL;
Dl_info evas_dl;
/* 1. ~/.evas/modules/ */
prefix = getenv("HOME");
@ -65,23 +64,36 @@ evas_module_paths_init(void)
paths = evas_list_append(paths,path);
else
free(path);
#ifdef HAVE_DLADDR
if (dladdr(evas_module_paths_init, &evas_dl))
{
int length;
length = strlen(rindex(evas_dl.dli_fname, '/'));
path = malloc(strlen(evas_dl.dli_fname) - length + strlen("/evas/modules") + 1);
strncpy(path, evas_dl.dli_fname, strlen(evas_dl.dli_fname) - length);
strcat(path, "/evas/modules");
if (evas_file_path_exists(path))
paths = evas_list_append(paths, path);
else
free(path);
Dl_info evas_dl;
/* 3. libevas.so/../evas/modules/ */
if (dladdr(evas_module_paths_init, &evas_dl))
{
int length;
if (strrchr(evas_dl.dli_fname, '/'))
{
length = strlen(strrchr(evas_dl.dli_fname, '/'));
path = malloc(strlen(evas_dl.dli_fname) - length +
strlen("/evas/modules") + 1);
if (path)
{
strncpy(path, evas_dl.dli_fname,
strlen(evas_dl.dli_fname) - length);
path[strlen(evas_dl.dli_fname) - length] = 0;
strcat(path, "/evas/modules");
if (evas_file_path_exists(path))
paths = evas_list_append(paths, path);
else
free(path);
}
}
}
}
#else
/* 2. PREFIX/evas/modules/ */
/* 3. PREFIX/evas/modules/ */
prefix = PACKAGE_LIB_DIR;
path = malloc(strlen(prefix) + 1 + strlen("/evas/modules"));
strcpy(path, prefix);