Make dladdr() code dependent on HAVE_DLADDR

Original commit message from CVS:
Make dladdr() code dependent on HAVE_DLADDR
This commit is contained in:
David Schleef 2003-08-06 03:00:21 +00:00
parent 4b13be22f0
commit 093f00d2df

View file

@ -27,7 +27,9 @@
#ifndef GST_DISABLE_GST_DEBUG #ifndef GST_DISABLE_GST_DEBUG
#ifdef HAVE_DLFCN_H
#include <dlfcn.h> #include <dlfcn.h>
#endif
#include <unistd.h> #include <unistd.h>
#include "gstinfo.h" #include "gstinfo.h"
#include "gstlog.h" #include "gstlog.h"
@ -39,6 +41,7 @@
GST_DEBUG_CATEGORY_STATIC(GST_CAT_DEBUG); GST_DEBUG_CATEGORY_STATIC(GST_CAT_DEBUG);
#if 0
#if defined __sgi__ #if defined __sgi__
#include <rld_interface.h> #include <rld_interface.h>
typedef struct DL_INFO { typedef struct DL_INFO {
@ -60,6 +63,7 @@ int dladdr(void *address, Dl_info *dl)
return (int)v; return (int)v;
} }
#endif /* __sgi__ */ #endif /* __sgi__ */
#endif
extern gchar *_gst_progname; extern gchar *_gst_progname;
@ -876,15 +880,23 @@ gchar *
_gst_debug_nameof_funcptr (void *ptr) _gst_debug_nameof_funcptr (void *ptr)
{ {
gchar *ptrname; gchar *ptrname;
#ifdef HAVE_DLADDR
Dl_info dlinfo; Dl_info dlinfo;
#endif
if (__gst_function_pointers && (ptrname = g_hash_table_lookup(__gst_function_pointers,ptr))) { if (__gst_function_pointers && (ptrname = g_hash_table_lookup(__gst_function_pointers,ptr))) {
return g_strdup(ptrname); 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); return g_strdup(dlinfo.dli_sname);
} else { } else
#endif
{
return g_strdup_printf("%p",ptr); return g_strdup_printf("%p",ptr);
} }
} }
void * void *
_gst_debug_register_funcptr (void *ptr, gchar *ptrname) _gst_debug_register_funcptr (void *ptr, gchar *ptrname)
{ {