summaryrefslogtreecommitdiff
path: root/ext/Time/HiRes/Makefile.PL
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-07-01 05:54:58 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-01 05:54:58 +0000
commit046e3f33bfc965c84e96ed0ef0ba38b777cb38bf (patch)
tree04f50c23a5d649f8b78094892adceec723a07b09 /ext/Time/HiRes/Makefile.PL
parent6bdd71ef1830fa9fb85306405e4da0222df1321d (diff)
downloadperl-046e3f33bfc965c84e96ed0ef0ba38b777cb38bf.tar.gz
Rework Time::HiRes not to need HAS_NANOSLEEP from Configure.
p4raw-id: //depot/perl@19898
Diffstat (limited to 'ext/Time/HiRes/Makefile.PL')
-rw-r--r--ext/Time/HiRes/Makefile.PL60
1 files changed, 18 insertions, 42 deletions
diff --git a/ext/Time/HiRes/Makefile.PL b/ext/Time/HiRes/Makefile.PL
index 83433075cf..f93a5b15d2 100644
--- a/ext/Time/HiRes/Makefile.PL
+++ b/ext/Time/HiRes/Makefile.PL
@@ -11,9 +11,11 @@ use strict;
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 @@ EOM
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 @@ EOD
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 @@ sub main {
if ($^O =~ /Win32/i) {
$DEFINE = '-DSELECT_IS_BROKEN';
- $LIBS = [''];
+ $LIBS = [];
} else {
- unixinit();
+ init();
}
doMakefile;
doConstants;