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
#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 */
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}) {
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;
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) {
if ($^O =~ /Win32/i) {
$DEFINE = '-DSELECT_IS_BROKEN';
- $LIBS = [''];
+ $LIBS = [];
} else {
- unixinit();
+ init();
}
doMakefile;
doConstants;