[前][次][番号順一覧][スレッド一覧]

ruby-changes:25693

From: naruse <ko1@a...>
Date: Tue, 20 Nov 2012 17:38:19 +0900 (JST)
Subject: [ruby-changes:25693] naruse:r37750 (trunk): * configure.in: fix dtrace didn't work on darwin.

naruse	2012-11-20 17:35:57 +0900 (Tue, 20 Nov 2012)

  New Revision: 37750

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37750

  Log:
    * configure.in: fix dtrace didn't work on darwin.
    
    * configure.in (RUBY_DTRACE_AVAILABLE): unify RUBY_DTRACE_POSTPROCESS
      and RUBY_DTRACE_BSD_BROKEN.

  Modified files:
    trunk/ChangeLog
    trunk/configure.in

Index: configure.in
===================================================================
--- configure.in	(revision 37749)
+++ configure.in	(revision 37750)
@@ -464,26 +464,9 @@
 MAKEDIRS="$MKDIR_P"
 AC_SUBST(MAKEDIRS)
 
-AC_DEFUN([RUBY_DTRACE_POSTPROCESS],
-[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g,
+AC_DEFUN([RUBY_DTRACE_AVAILABLE],
+[AC_CACHE_CHECK(whether dtrace USDT is available, rb_cv_dtrace_available,
 [
- echo "int main(void){ return 0; }" > conftest.c
- echo "provider conftest{};" > conftest_provider.d
- $CC $CFLAGS -c -o conftest.o conftest.c
- if $DTRACE -G -s conftest_provider.d conftest.o 2>/dev/null; then
-   rb_cv_prog_dtrace_g=yes
-   $1
- else
-   rb_cv_prog_dtrace_g=no
-   $2
- fi
- rm -f conftest.o conftest.c conftest_provider.d conftest_provider.o
-])
-])
-
-AC_DEFUN([RUBY_DTRACE_BSD_BROKEN],
-[AC_CACHE_CHECK(whether dtrace USDT is broken, rb_cv_dtrace_bsd_broken,
-[
     cat <<EOF > conftest.c
 #define _DTRACE_VERSION 1
 #include "conftest_provider.h"
@@ -494,15 +477,23 @@
 }
 EOF
     echo "provider conftest{ probe fire(); };" > conftest_provider.d
-    $DTRACE -h -o conftest_provider.h -s conftest_provider.d
-    $CC $CFLAGS -c -o conftest.o conftest.c
-    if $DTRACE -G -o conftest_provider.o -s conftest_provider.d conftest.o >/dev/null 2>/dev/null; then
-        rb_cv_dtrace_bsd_broken=no
-        $2
+    rb_cv_prog_dtrace_g=no
+    if $DTRACE -h -o conftest_provider.h -s conftest_provider.d >/dev/null 2>/dev/null; then
+      # DTrace is available on the system
+      enable_dtrace=yes
+      $CC $CFLAGS -c -o conftest.o conftest.c
+      if $DTRACE -G -o conftest_provider.o -s conftest_provider.d conftest.o >/dev/null 2>/dev/null; then
+        # Solaris and FreeBSD need `dtrace -G`
+        rb_cv_prog_dtrace_g=yes
+      else
+        # darwin doesn't need `dtrace -G`
+      fi
     else
-        rb_cv_dtrace_bsd_broken=yes
-        $1
+        # DTrace is not available while dtrace command exists
+        # for example FreeBSD 8 or FreeBSD 9 without DTrace build option
+        enable_dtrace=no
     fi
+    rb_cv_dtrace_available=$enable_dtrace
     rm -f conftest.[co] conftest_provider.[dho]
 ])
 ])
@@ -2731,14 +2722,12 @@
 
 AC_ARG_ENABLE(dtrace,
         AS_HELP_STRING([--enable-dtrace],
-        [enable DTrace for tracing ruby's internal. enabled by default on systems having dtrace]),
+        [enable DTrace for tracing inside ruby. enabled by default on systems having dtrace]),
         [enable_dtrace=$enableval], [enable_dtrace=auto])
 
 if test "${enable_dtrace}" = "auto"; then
     if test x"$DTRACE" != x -a x"$cross_compiling" != xyes; then
-        RUBY_DTRACE_POSTPROCESS()
-        enable_dtrace=yes
-        RUBY_DTRACE_BSD_BROKEN([enable_dtrace=no], [enable_dtrace=yes])
+        RUBY_DTRACE_AVAILABLE()
     else
         enable_dtrace=no
     fi
@@ -2751,9 +2740,11 @@
     elif test "$cross_compiling" = yes; then
         AC_MSG_ERROR([--enable-dtrace, however, cross compiling])
     else
-        RUBY_DTRACE_POSTPROCESS()
+        RUBY_DTRACE_AVAILABLE()
+        if test "${enable_dtrace}" = "no"; then
+            AC_MSG_ERROR([--enable-dtrace, however, USDT is not available])
+        fi
         if test "$rb_cv_prog_dtrace_g" = 'yes'; then
-            RUBY_DTRACE_BSD_BROKEN([AC_MSG_ERROR([--enable-dtrace, however, USDT is broken])], [])
             DTRACE_OBJ='probes.$(OBJEXT)'
             DTRACE_GLOMMED_OBJ='ruby-glommed.$(OBJEXT)'
             LIBRUBY_A_OBJS='$(DTRACE_GLOMMED_OBJ)'
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37749)
+++ ChangeLog	(revision 37750)
@@ -1,3 +1,10 @@
+Tue Nov 20 17:31:12 2012  NARUSE, Yui  <naruse@r...>
+
+	* configure.in: fix dtrace didn't work on darwin.
+
+	* configure.in (RUBY_DTRACE_AVAILABLE): unify RUBY_DTRACE_POSTPROCESS
+	  and RUBY_DTRACE_BSD_BROKEN.
+
 Tue Nov 20 15:20:00 2012  Zachary Scott  <zachary@z...>
 
 	* file.c (File.extname): Documentation for extname on dotfiles and

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]