[cairo-commit] 4 commits - boilerplate/cairo-boilerplate.c configure.ac src/cairo-atomic-private.h util/cairo-trace

M. Joonas Pihlaja joonas at kemper.freedesktop.org
Mon Sep 14 03:35:01 PDT 2009


 boilerplate/cairo-boilerplate.c |    4 ++--
 configure.ac                    |   12 +++++++-----
 src/cairo-atomic-private.h      |    4 ++++
 util/cairo-trace/Makefile.am    |    6 +++++-
 util/cairo-trace/cairo-trace.in |   17 ++++++++++++++++-
 util/cairo-trace/trace.c        |    5 ++++-
 6 files changed, 38 insertions(+), 10 deletions(-)

New commits:
commit cd94bf8bf30de9aa8dfec1a06a7ef3386944c974
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Mon Sep 14 03:41:42 2009 -0600

    [trace] Look harder for the cairo-trace.so library.
    
    On OpenBSD the convention is to not use symlinks from
    unversioned library names to versioned library names.
    This breaks cairo-trace because it looks for cairo-trace.so
    explicitly, but on OpenBSD only cairo-trace.so.0.0 is
    installed.
    
    The right thing to do is probably to source the cairo-trace.la
    file and look for a file name there somehow.  Instead this commit
    just looks for a likely looking file or symlink in the install
    directory.

diff --git a/util/cairo-trace/cairo-trace.in b/util/cairo-trace/cairo-trace.in
index f2a5b8f..fc830bf 100644
--- a/util/cairo-trace/cairo-trace.in
+++ b/util/cairo-trace/cairo-trace.in
@@ -88,7 +88,22 @@ fi
 CAIRO_TRACE_PROG_NAME="$1"
 export CAIRO_TRACE_PROG_NAME
 
-LD_PRELOAD=@libdir@/cairo/cairo-trace.so 
+if test "x$CAIRO_TRACE_SO" = "x"; then
+    CAIRO_TRACE_SO=""
+    for lib in @libdir@/cairo/cairo-trace.so @libdir@/cairo/cairo-trace.so*; do
+	if test -h "$lib" -o -f "$lib"; then
+	    CAIRO_TRACE_SO="$lib"
+	    break
+	fi
+    done
+fi
+if test "x$CAIRO_TRACE_SO" = "x"; then
+    echo "Could not find the cairo-trace shared library in @libdir@/cairo/." >&2
+    echo "Set the CAIRO_TRACE_SO environment variable to the full path of the library." >&2
+    exit 15
+fi
+
+LD_PRELOAD="$CAIRO_TRACE_SO"
 export LD_PRELOAD
 
 if test -n "$nocallers"; then
commit a343c8c42d3adc8f52afd09bdfbbcfd5299df49e
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Mon Sep 14 02:33:26 2009 -0600

    [trace] Don't use pthread_key_delete.
    
    On OpenBSD libc doesn't provide pthread stubs like glibc on Linux
    or newer libcs from FreeBSD.  However libX11 does provide a stubs
    for a subset of the pthread functions (formerly in libXThrStub,
    now moved into libX11 proper), but pthread_key_delete() is not
    one of the stubbed ones.  So, on OpenBSD cairo's non-linking of
    libpthread accidentally works as long as the xlib-surface is enabled,
    which is nearly always the case.
    
    This patch makes trace.c stand at the same precipice as cairo itself
    by reverting to only a subset of the pthreads functions stubbed by
    libX11.

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 2cbc682..c4fae7c 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -485,7 +485,6 @@ _fini_trace (void)
 	}
     }
 
-    pthread_key_delete (counter_key);
     pthread_mutex_destroy (&Types.mutex);
 }
 
commit cf0fed2191c2b5ebce8855def1dd302ccf8e039a
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Sun Sep 13 17:35:29 2009 -0600

    [build] Check for dlsym in both libdl and libc.
    
    The BSDs have dlsym() in libc rather than libdl.

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 46bb057..1414699 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -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;
diff --git a/configure.ac b/configure.ac
index d2c1231..c38d2c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
 ])
diff --git a/util/cairo-trace/Makefile.am b/util/cairo-trace/Makefile.am
index 7e2f66e..814a0f0 100644
--- a/util/cairo-trace/Makefile.am
+++ b/util/cairo-trace/Makefile.am
@@ -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 += \
commit 1c7ac6c47addd6825c4f49f514fe3ffb708e3813
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Sun Sep 13 17:56:56 2009 -0600

    [build] Work around autoconf void* -> VOID__ name conversion bug.
    
    The autoconf shipping with OpenBSD 4.5 converts sizeof(void*)
    to SIZEOF_VOID__ rather than SIZEOF_VOID_P.  Work around that
    by defining SIZEOF_VOID_P if required.

diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h
index 10c014c..86e400f 100644
--- a/src/cairo-atomic-private.h
+++ b/src/cairo-atomic-private.h
@@ -43,6 +43,10 @@
 #include "config.h"
 #endif
 
+#if !defined(SIZEOF_VOID_P) && defined(SIZEOF_VOID__)
+# define SIZEOF_VOID_P SIZEOF_VOID__
+#endif
+
 CAIRO_BEGIN_DECLS
 
 #if HAVE_INTEL_ATOMIC_PRIMITIVES
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index a3b3697..2cbc682 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -22,6 +22,10 @@
 #include "config.h"
 #endif
 
+#if !defined(SIZEOF_VOID_P) && defined(SIZEOF_VOID__)
+# define SIZEOF_VOID_P SIZEOF_VOID__
+#endif
+
 #include <dlfcn.h>
 #include <stdbool.h>
 #include <stdint.h>


More information about the cairo-commit mailing list