Fix compilation problems if dladdr() doesn't exist. Fixes #115005

Original commit message from CVS:
Fix compilation problems if dladdr() doesn't exist.  Fixes #115005
This commit is contained in:
David Schleef 2003-09-25 01:02:47 +00:00
parent e94d234ce5
commit 46534a11bb
2 changed files with 25 additions and 3 deletions

View file

@ -350,6 +350,14 @@ AC_CHECK_FUNC(posix_memalign,
AC_DEFINE(HAVE_POSIX_MEMALIGN, 1,
[Defined if we have posix_memalign ()]))
dnl test if we have dladdr(); we use it for debugging
save_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_GNU_SOURCE"
AC_CHECK_LIB(dl, dladdr,
AC_DEFINE(HAVE_DLADDR, 1,
[Defined if we have dladdr ()]))
CFLAGS="$save_cflags"
if test "x$PLUGINS_USE_BUILDDIR" = xyes; then
AC_DEFINE(PLUGINS_USE_BUILDDIR, 1, [Define if plugins should be loaded from the build tree - only developers should use this])
fi

View file

@ -20,12 +20,19 @@
* Boston, MA 02111-1307, USA.
*/
#include <dlfcn.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gst_private.h"
#include "gstelement.h"
#include "gstpad.h"
#include "gstscheduler.h"
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#if 0
#if defined __sgi__
#include <rld_interface.h>
typedef struct DL_INFO {
@ -47,6 +54,7 @@ int dladdr(void *address, Dl_info *dl)
return (int)v;
}
#endif
#endif
extern gchar *_gst_progname;
@ -497,12 +505,18 @@ gchar *
_gst_debug_nameof_funcptr (void *ptr)
{
gchar *ptrname;
#ifdef HAVE_DLADDR
Dl_info dlinfo;
#endif
if (__gst_function_pointers && (ptrname = g_hash_table_lookup(__gst_function_pointers,ptr))) {
return g_strdup(ptrname);
} else if (dladdr(ptr,&dlinfo) && dlinfo.dli_sname) {
} else
#ifdef HAVE_DLADDR
if (dladdr(ptr,&dlinfo) && dlinfo.dli_sname) {
return g_strdup(dlinfo.dli_sname);
} else {
} else
#endif
{
return g_strdup_printf("%p",ptr);
}
return NULL;