Revision: 1090
Author: tim.bunce
Date: Mon Mar  1 09:18:51 2010
Log: Added Makefile.PL options to control use of zlib/clock_gettime/machtime.
Minor grammar tweak in NYTProf docs.

http://code.google.com/p/perl-devel-nytprof/source/detail?r=1090

Modified:
 /trunk/Makefile.PL
 /trunk/lib/Devel/NYTProf.pm

=======================================
--- /trunk/Makefile.PL  Wed Jan  6 13:56:15 2010
+++ /trunk/Makefile.PL  Mon Mar  1 09:18:51 2010
@@ -40,6 +40,9 @@
     'g!'      => \my $opt_g,            # compile with -g (for debugging)
'assert!' => \my $opt_assert, # enable assert()ions in the code (and perl headers) 'pg!' => \my $opt_pg, # compile with -pg (for profiling NYTProf itself) + 'zlib!' => \(my $opt_zlib=1), # --nozlib to disallow use of zlib + 'gettime!' => \(my $opt_gettime=1), # --nogettime to disallow use of POSIX clock_gettime + 'machtime!' => \(my $opt_machtime=1), # --nomachtime to disallow use of mac osx clock
 ) or exit 1;

 if (not defined $opt_assert) {
@@ -77,21 +80,22 @@
 my %mm_opts;
 my @libs = ();

-foreach (['time.h', qr/(clock_gettime)\s*\(/, '-DHAS_CLOCK_GETTIME', '-lrt'], - ['zlib.h', qr/(deflateInit2)(?:_)?\s*\(/, '-DHAS_ZLIB', '-lz'],
-        ) {
+my @hdr_match_lib;
+push @hdr_match_lib, ['time.h', qr/(clock_gettime)\s*\(/, '-DHAS_CLOCK_GETTIME', '-lrt']
+    if $opt_gettime;
+push @hdr_match_lib, ['zlib.h', qr/(deflateInit2)(?:_)?\s*\(/, '-DHAS_ZLIB', '-lz']
+    if $opt_zlib;
+push @hdr_match_lib, ['mach_time.h', qr/(mach_absolute_time)\s*\(/, '-DHAS_MACH_TIME', undef]
+    if $opt_machtime and $^O eq 'darwin';
+
+foreach (@hdr_match_lib) {
     my ($header, $regexp, $define, $libs) = @$_;
     if (my $result = search_h_file($header, $regexp)) {
         print "Found $result in $header\n";
-        push @libs, $libs;
-        $mm_opts{DEFINE} .= " $define";
+        push @libs, $libs if $libs;
+        $mm_opts{DEFINE} .= " $define" if $define;
     }
 }
-
-if( $^O eq 'darwin' and search_h_file('mach_time.h', qr/(mach_absolute_time)\s*\(/)) {
-    print "Found mach_absolute_time in mach/mach_time.h\n";
-    $mm_opts{DEFINE} .= " -DHAS_MACH_TIME";
-}

 if ($opt_assert or (not defined $opt_assert and $is_developer)) {
     warn "Assertion testing enabled\n";
=======================================
--- /trunk/lib/Devel/NYTProf.pm Mon Mar  1 09:07:54 2010
+++ /trunk/lib/Devel/NYTProf.pm Mon Mar  1 09:18:51 2010
@@ -571,7 +571,7 @@
 accurate but surprising. In some cases it can appear to be misleading.
 (Of course, in some cases it may actually be plain wrong. Caveat lector.)

-=head2 Perl 5.10.1+ (or else 5.8.9+) are Recommended
+=head2 Perl 5.10.1+ (or else 5.8.9+) is Recommended

 These versions of perl yield much more detailed information about calls to
 BEGIN, CHECK, INIT, and END blocks, the code handling tied or overloaded

--
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to