Change 19898 by [EMAIL PROTECTED] on 2003/07/01 05:54:58
Rework Time::HiRes not to need HAS_NANOSLEEP from Configure.
Affected files ...
... //depot/perl/MANIFEST#1031 edit
... //depot/perl/ext/Time/HiRes/HiRes.xs#37 edit
... //depot/perl/ext/Time/HiRes/Makefile.PL#13 edit
... //depot/perl/ext/Time/HiRes/hints/dec_osf.pl#1 add
... //depot/perl/ext/Time/HiRes/hints/sco.pl#2 edit
Differences ...
==== //depot/perl/MANIFEST#1031 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1030~19831~ Fri Jun 20 00:31:11 2003
+++ perl/MANIFEST Mon Jun 30 22:54:58 2003
@@ -733,6 +733,7 @@
ext/Time/HiRes/Changes Time::HiRes extension
ext/Time/HiRes/fallback/const-c.inc Time::HiRes extension
ext/Time/HiRes/fallback/const-xs.inc Time::HiRes extension
+ext/Time/HiRes/hints/dec_osf.pl Hint for Time::HiRes for named
architecture
ext/Time/HiRes/hints/dynixptx.pl Hint for Time::HiRes for named architecture
ext/Time/HiRes/hints/irix.pl Hint for Time::HiRes for named architecture
ext/Time/HiRes/hints/sco.pl Hints for Time::HiRes for named architecture
==== //depot/perl/ext/Time/HiRes/HiRes.xs#37 (text) ====
Index: perl/ext/Time/HiRes/HiRes.xs
--- perl/ext/Time/HiRes/HiRes.xs#36~19824~ Thu Jun 19 08:11:48 2003
+++ perl/ext/Time/HiRes/HiRes.xs Mon Jun 30 22:54:58 2003
@@ -340,7 +340,10 @@
#endif
-#if !defined(HAS_USLEEP) && defined(HAS_NANOSLEEP)
+ /* Do not use H A S _ N A N O S L E E P
+ * so that Perl Configure doesn't scan for it.
+ * The TIME_HIRES_NANOSLEEP is set by Makefile.PL. */
+#if !defined(HAS_USLEEP) && defined(TIME_HIRES_NANOSLEEP)
#define HAS_USLEEP
#define usleep hrt_nanosleep /* could conflict with ncurses for static build */
==== //depot/perl/ext/Time/HiRes/Makefile.PL#13 (text) ====
Index: perl/ext/Time/HiRes/Makefile.PL
--- perl/ext/Time/HiRes/Makefile.PL#12~19789~ Sun Jun 15 10:08:02 2003
+++ perl/ext/Time/HiRes/Makefile.PL Mon Jun 30 22:54:58 2003
@@ -11,9 +11,11 @@
my $VERBOSE = $ENV{VERBOSE};
my $DEFINE;
-my $LIBS;
+my $LIBS = [];
my $XSOPT;
+use vars qw($self); # Used in 'sourcing' the hints.
+
my $ld_exeext = ($^O eq 'os2' and $Config{ldflags} =~ /-Zexe\b/) ? '.exe' : '';
unless($ENV{PERL_CORE}) {
@@ -212,46 +214,19 @@
return 0;
}
-sub unixinit {
- $DEFINE = '';
-
- $LIBS = [];
-
- # this might break the link, try it if it can't find some things you
- # honestly think should be in there...
- # $LIBS = ['-lucb -lbsd'];
-
- # ... but ucb is poison for Solaris, and probably Linux. honest.
- $LIBS = [] if $Config{'osname'} eq 'solaris';
- $LIBS = [] if $Config{'osname'} eq 'linux';
- $LIBS = ['-lm'] if $Config{'osname'} =~ /sco/i;
- $LIBS = ['-lc'] if $Config{'osname'} =~ /dynixptx/i;
-
- # For nanosleep
- push @$LIBS, '-lrt' unless $Config{'osname'} =~ /^(?:irix|linux)$/;
- push @$LIBS, '-lposix4';
-
- my @goodlibs;
-
- select(STDOUT);
- $| = 1;
-
- print "Checking for libraries...\n";
- my $lib;
- for $lib (@$LIBS) {
- print "Checking for $lib... ";
- $LIBS = [ $lib ];
- if ($Config{libs} =~ /\b$lib\b/ || has_x("time(0)")) {
- push @goodlibs, $lib;
- print "found.\n";
- } else {
- print "NOT found.\n";
+sub init {
+ my $hints = File::Spec->catfile("hints", "$^O.pl");
+ if (-f $hints) {
+ print "Using hints $hints...\n";
+ local $self;
+ do $hints;
+ if (exists $self->{LIBS}) {
+ $LIBS = $self->{LIBS};
+ print "Extra libraries: @$LIBS...\n";
}
}
- $LIBS = [ @goodlibs ];
- print @$LIBS ?
- "You have extra libraries: @$LIBS.\n" :
- "You have no applicable extra libraries.\n";
+
+ $DEFINE = '';
print "Looking for gettimeofday()... ";
my $has_gettimeofday;
@@ -360,9 +335,10 @@
my $has_nanosleep;
if ($Config{d_nanosleep}) {
$has_nanosleep++;
+ $DEFINE .= ' -DTIME_HIRES_NANOSLEEP';
} elsif (has_x ("nanosleep (NULL, NULL)")) {
$has_nanosleep++;
- $DEFINE .= ' -DHAS_NANOSLEEP';
+ $DEFINE .= ' -DTIME_HIRES_NANOSLEEP';
}
if ($has_nanosleep) {
@@ -452,9 +428,9 @@
if ($^O =~ /Win32/i) {
$DEFINE = '-DSELECT_IS_BROKEN';
- $LIBS = [''];
+ $LIBS = [];
} else {
- unixinit();
+ init();
}
doMakefile;
doConstants;
==== //depot/perl/ext/Time/HiRes/hints/dec_osf.pl#1 (text) ====
Index: perl/ext/Time/HiRes/hints/dec_osf.pl
--- /dev/null Tue May 5 13:32:27 1998
+++ perl/ext/Time/HiRes/hints/dec_osf.pl Mon Jun 30 22:54:58 2003
@@ -0,0 +1,3 @@
+# needs to explicitly link against librt to pull in nanosleep
+$self->{LIBS} = ['-lrt'];
+
==== //depot/perl/ext/Time/HiRes/hints/sco.pl#2 (text) ====
Index: perl/ext/Time/HiRes/hints/sco.pl
--- perl/ext/Time/HiRes/hints/sco.pl#1~10953~ Tue Jun 26 05:33:55 2001
+++ perl/ext/Time/HiRes/hints/sco.pl Mon Jun 30 22:54:58 2003
@@ -1,3 +1,4 @@
# osr5 needs to explicitly link against libc to pull in usleep
-$self->{LIBS} = ['-lc'];
+# what's the reason for -lm?
+$self->{LIBS} = ['-lm', '-lc'];
End of Patch.