diff make/linux/makefiles/dtrace.make @ 6837:75982791ddb6

7170638: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field. Summary: Don't use HS_DTRACE_PROBE_CDECL_N and HS_DTRACE_PROBE_N directly. Reviewed-by: coleenp, kamg, dholmes, sspitsyn Contributed-by: Mark Wielaard <mjw@redhat.com>
author coleenp
date Mon, 08 Oct 2012 09:18:54 -0400
parents c18cbe5936b8
children a00b8f42c4c4 42c0a8631742
line wrap: on
line diff
--- a/make/linux/makefiles/dtrace.make	Thu Oct 04 20:09:46 2012 -0400
+++ b/make/linux/makefiles/dtrace.make	Mon Oct 08 09:18:54 2012 -0400
@@ -1,5 +1,6 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 Red Hat, Inc.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,3 +26,40 @@
 # Linux does not build jvm_db
 LIBJVM_DB =
 
+# Only OPENJDK builds test and support SDT probes currently.
+ifndef OPENJDK
+REASON = "This JDK does not support SDT probes"
+else
+
+# We need a recent GCC for the default
+ifeq "$(shell expr \( $(CC_VER_MAJOR) \>= 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) )" "0"
+REASON = "gcc version is too old"
+else
+
+# But it does have a SystemTap dtrace compatible sys/sdt.h
+ifneq ($(ALT_SDT_H),)
+  SDT_H_FILE = $(ALT_SDT_H)
+else
+  SDT_H_FILE = /usr/include/sys/sdt.h
+endif
+DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE))
+REASON = "$(SDT_H_FILE) not found"
+
+ifneq ($(DTRACE_ENABLED),)
+  CFLAGS += -DDTRACE_ENABLED
+endif
+
+endif
+endif
+
+# Phony target used in vm.make build target to check whether enabled.
+.PHONY: dtraceCheck
+ifeq ($(DTRACE_ENABLED),)
+dtraceCheck:
+	$(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)"
+else
+dtraceCheck:
+endif
+
+# It doesn't support HAVE_DTRACE_H though.
+