[PATCH] Add platform tests for Dtrace linker magic

Alan Coopersmith alan.coopersmith at sun.com
Mon Oct 5 17:18:42 PDT 2009


Replaces special handling for Xquartz DDX and scales better to handling
the multiple platforms that now have some level of Dtrace support available.

Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
---
 configure.ac           |   14 +++++++++++++-
 dix/Makefile.am        |    2 +-
 hw/xfree86/Makefile.am |    2 +-
 os/Makefile.am         |    4 +---
 test/Makefile.am       |    2 +-
 test/xi2/Makefile.am   |    2 +-
 6 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index ba52329..eab315d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,8 +102,20 @@ fi
 if test "x$WDTRACE" != "xno" ; then
   AC_DEFINE(XSERVER_DTRACE, 1, 
       [Define to 1 if the DTrace Xserver provider probes should be built in.])
+
+# Solaris/OpenSolaris require dtrace -G to build dtrace probe information into
+# object files, and require linking with those as relocatable objects, not .a
+# archives. MacOS X handles all this in the normal compiler toolchain, and on
+# some releases (like Tiger), will error out on dtrace -G.  For now, other
+# platforms with Dtrace ports are assumed to support -G (the FreeBSD and Linux
+# ports appear to, based on my web searches, but have not yet been tested).
+	case $host_os in
+		darwin*)	SPECIAL_DTRACE_OBJECTS=no ;;
+		*)		SPECIAL_DTRACE_OBJECTS=yes ;;
+	esac
 fi
 AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
+AM_CONDITIONAL(SPECIAL_DTRACE_OBJECTS, [test "x$SPECIAL_DTRACE_OBJECTS" = "xyes"])
 
 AC_HEADER_DIRENT
 AC_HEADER_STDC
@@ -1245,7 +1257,7 @@ AC_DEFINE(XSYNC, 1, [Support XSync extension])
 AC_DEFINE(XCMISC, 1, [Support XCMisc extension])
 AC_DEFINE(BIGREQS, 1, [Support BigRequests extension])
 
-if test "x$WDTRACE" != "xno" && test "x$XQUARTZ" = "xno"; then
+if test "x$SPECIAL_DTRACE_OBJECTS" = "xyes" ; then
   DIX_LIB='$(top_builddir)/dix/dix.O'
   OS_LIB='$(top_builddir)/os/os.O'
 else
diff --git a/dix/Makefile.am b/dix/Makefile.am
index 85a8767..0996cff 100644
--- a/dix/Makefile.am
+++ b/dix/Makefile.am
@@ -54,7 +54,7 @@ Xserver-dtrace.h: $(srcdir)/Xserver.d
 	$(DTRACE) -C -h -o $@ -s $(srcdir)/Xserver.d \
 		|| cp Xserver-dtrace.h.in $@
 
-if !XQUARTZ	
+if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libdix
 dtrace-dix.o: $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS)
 	$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d $(am_libdix_la_OBJECTS:%.lo=.libs/%.o)
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 48db5a1..159b935 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -80,7 +80,7 @@ BUILT_SOURCES = xorg.conf.example
 DISTCLEANFILES += xorg.conf.example xorg.conf.example.pre
 EXTRA_DIST = xorgconf.cpp
 
-if XSERVER_DTRACE
+if SPECIAL_DTRACE_OBJECTS
 # Re-add dtrace object code that gets lost when building static libraries
 Xorg_LDADD += $(XSERVER_LIBS)
 endif
diff --git a/os/Makefile.am b/os/Makefile.am
index 9ce8ff2..22ed194 100644
--- a/os/Makefile.am
+++ b/os/Makefile.am
@@ -41,8 +41,7 @@ endif
 EXTRA_DIST = $(SECURERPC_SRCS) $(INTERNALMALLOC_SRCS) \
      $(XDMCP_SRCS) $(STRLCAT_SRCS)
 
-if !XQUARTZ
-if XSERVER_DTRACE
+if SPECIAL_DTRACE_OBJECTS
 # Generate dtrace object code for probes in libos & libdix
 dtrace.o: $(top_srcdir)/dix/Xserver.d $(am_libos_la_OBJECTS)
 	$(DTRACE) -G -C -o $@ -s $(top_srcdir)/dix/Xserver.d .libs/*.o ../dix/.libs/*.o
@@ -52,7 +51,6 @@ noinst_PROGRAMS = os.O
 os.O: dtrace.o $(am_libos_la_OBJECTS)
 	ld -r -o $@ dtrace.o .libs/*.o
 endif
-endif
 
 os.c:
 	touch $@
diff --git a/test/Makefile.am b/test/Makefile.am
index 1bd76f5..7c44671 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -9,7 +9,7 @@ AM_CFLAGS = $(DIX_CFLAGS) $(GLIB_CFLAGS) @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@
 TEST_LDADD=libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLIB_LIBS)
 
-if XSERVER_DTRACE
+if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
 endif
 
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index ef6d0f0..0e2de6b 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -17,7 +17,7 @@ INCLUDES = @XORG_INCS@
 TEST_LDADD=../libxservertest.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) $(GLIB_LIBS)
 COMMON_SOURCES=protocol-common.h protocol-common.c
 
-if XSERVER_DTRACE
+if SPECIAL_DTRACE_OBJECTS
 TEST_LDADD += $(OS_LIB) $(DIX_LIB)
 endif
 
-- 
1.5.6.5



More information about the xorg-devel mailing list