[build] Check for dlsym in both libdl and libc.

The BSDs have dlsym() in libc rather than libdl.
This commit is contained in:
M Joonas Pihlaja 2009-09-13 17:35:29 -06:00
parent 1c7ac6c47a
commit cf0fed2191
3 changed files with 14 additions and 8 deletions

View file

@ -45,7 +45,7 @@
#include <assert.h>
#include <errno.h>
#if HAVE_DL
#if HAVE_DLFCN_H
#include <dlfcn.h>
#endif
@ -349,7 +349,7 @@ probe_target (const cairo_boilerplate_target_t *target)
if (target->probe == NULL)
return TRUE;
#if HAVE_DL
#if HAVE_DLSYM
return dlsym (NULL, target->probe) != NULL;
#else
return TRUE;

View file

@ -37,10 +37,12 @@ AC_CHECK_LIB(z, compress,
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
AC_CHECK_LIB(dl, dlsym,
[AC_CHECK_HEADER(dlfcn.h, [
have_dl=yes
AC_DEFINE(HAVE_DL, 1, [Define to 1 if you have dl available])
], [have_dl=no])], [have_dl=no])
[have_dlsym=yes; have_dl=yes],
[have_dlsym=no; have_dl=no])
if test "x$have_dlsym" = "xno"; then
AC_CHECK_FUNC(dlsym, [have_dlsym=yes], [have_dlsym=no])
fi
AC_CHECK_HEADERS(dlfcn.h, [have_dlsym=yes], [have_dlsym=no])
AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
dnl ===========================================================================
@ -659,7 +661,7 @@ esac
CAIRO_ENABLE(trace, cairo-trace, auto, [
if test "x$have_ld_preload" != "xyes" -o \
"x$have_libz" != "xyes" -o \
"x$have_dl" != "xyes"; then
"x$have_dlsym" != "xyes"; then
use_trace="no (requires dynamic linker and zlib)"
fi
])

View file

@ -12,7 +12,11 @@ cairo_trace_la_CPPFLAGS = -DCAIRO_TRACE_OUTDIR="\"$(cairooutdir)\"" \
$(AM_CPPFLAGS)
cairo_trace_la_CFLAGS = $(CAIRO_CFLAGS)
cairo_trace_la_LDFLAGS = -module -no-undefined
cairo_trace_la_LIBADD = -ldl -lz
cairo_trace_la_LIBADD = -lz
if CAIRO_HAS_DL
cairo_trace_la_LIBADD += -ldl
endif
if CAIRO_HAS_SYMBOL_LOOKUP
cairo_trace_la_SOURCES += \