This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
probe in Configure whether dtrace builds an object
authorAaron Crane <arc@cpan.org>
Thu, 21 Apr 2016 11:55:30 +0000 (12:55 +0100)
committerAaron Crane <arc@cpan.org>
Thu, 21 Apr 2016 11:55:30 +0000 (12:55 +0100)
backport of:

commit c2538af7458bf317cdc7bc684f65831744010d80
Author: Tony Cook <tony@develop-help.com>
Date:   Wed Mar 9 11:54:13 2016 +1100

    [perl #122287] probe in Configure whether dtrace builds an object

    When building the object file, newer versions of dtrace (on Illumos
    based systems at least) require an input object file that uses
    at least one of the probes defined in the .d file.

    The test in Makefile.SH didn't provide that definition so the test
    would fail, and not build an object file, and fail to link later on,
    on systems that *do* need the object file.

    Moved the probe to Configure (where it probably belongs) and supplied
    an object file that uses a probe.

    Tested successfully on OmniOS (with the new dtrace), Solaris 11,
    and darwin.

commit 5fa8e144165a5c086facccf35630b9c4a781c4ad
Author: David Mitchell <davem@iabyn.com>
Date:   Fri Mar 18 23:29:44 2016 +0000

    Configure: silence 'dtrace -G' probe

    When built with -Dusedtrace, Configure checks to see whether 'dtrace -G'
    is supported, by running it. If it fails, it may spew error messages
    to stderr, so use >/dev/null 2>&1.

U/perl/dtraceobject.U [new file with mode: 0644]

diff --git a/U/perl/dtraceobject.U b/U/perl/dtraceobject.U
new file mode 100644 (file)
index 0000000..e9f07dc
--- /dev/null
@@ -0,0 +1,39 @@
+?RCS: Copyright (c) 2016 Tony Cook
+?RCS:
+?RCS: You may distribute under the terms of either the GNU General Public
+?RCS: License or the Artistic License, as specified in the README file.
+?RCS:
+?MAKE:dtraceobject: usedtrace dtrace cc ccflags rm optimize Compile cat
+?MAKE: -pick add $@ $@
+?S:dtraceobject:
+?S:    Whether we need to build an object file with the dtrace tool.
+?S:.
+: Probe whether dtrace builds an object, as newer Illumos requires an input
+: object file that uses at least one of the probes defined in the .d file
+case "$usedtrace" in
+$define)
+    case "$dtraceobject" in
+    $define|true|[yY]*)
+        dtraceobject=$define
+        ;;
+    ' '|'')
+        $dtrace -h -s ../perldtrace.d -o perldtrace.h
+        $cat >try.c <<EOM
+#include "perldtrace.h"
+int main(void) {
+    PERL_LOADED_FILE("dummy");
+    return 0;
+}
+EOM
+        dtraceobject=$undef
+        if $cc -c -o try.o $optimize $ccflags try.c \
+                    && $dtrace -G -s ../perldtrace.d try.o >/dev/null 2>&1; then
+                dtraceobject=$define
+            echo "Your dtrace builds an object file"
+        fi
+        $rm -f try.c try.o perldtrace.o
+        ;;
+    *) dtraceobject=$undef ;;
+    esac
+esac
+