* configure.in: fix dtrace didn't work on darwin.

* configure.in (RUBY_DTRACE_AVAILABLE): unify RUBY_DTRACE_POSTPROCESS
  and RUBY_DTRACE_BSD_BROKEN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-11-20 08:35:57 +00:00
Родитель b6161a3bad
Коммит da56cb6bf2
2 изменённых файлов: 30 добавлений и 32 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Tue Nov 20 17:31:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
* 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@zacharyscott.net>
* file.c (File.extname): Documentation for extname on dotfiles and

Просмотреть файл

@ -464,25 +464,8 @@ fi
MAKEDIRS="$MKDIR_P"
AC_SUBST(MAKEDIRS)
AC_DEFUN([RUBY_DTRACE_POSTPROCESS],
[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g,
[
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,
AC_DEFUN([RUBY_DTRACE_AVAILABLE],
[AC_CACHE_CHECK(whether dtrace USDT is available, rb_cv_dtrace_available,
[
cat <<EOF > conftest.c
#define _DTRACE_VERSION 1
@ -494,15 +477,23 @@ int main(void)
}
EOF
echo "provider conftest{ probe fire(); };" > conftest_provider.d
$DTRACE -h -o conftest_provider.h -s conftest_provider.d
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
rb_cv_dtrace_bsd_broken=no
$2
# Solaris and FreeBSD need `dtrace -G`
rb_cv_prog_dtrace_g=yes
else
rb_cv_dtrace_bsd_broken=yes
$1
# darwin doesn't need `dtrace -G`
fi
else
# 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 @@ fi
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 @@ if test "${enable_dtrace}" = "yes"; then
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)'