⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile.pl

📁 source of perl for linux application,
💻 PL
📖 第 1 页 / 共 2 页
字号:
	print "NOT found.\n";    }    print "Looking for getitimer()... ";    my $has_getitimer;    if (exists $Config{'d_getitimer'}) {        $has_getitimer++ if $Config{'d_getitimer'};    } elsif (has_x("getitimer(ITIMER_REAL, 0)")) {        $has_getitimer++;        $DEFINE .= ' -DHAS_GETITIMER';    }    if ($has_getitimer) {        print "found.\n";    } else {	print "NOT found.\n";    }    if ($has_setitimer && $has_getitimer) {	print "You have interval timers (both setitimer and getitimer).\n";    } else {	print "You do not have interval timers.\n";    }    print "Looking for ualarm()... ";    my $has_ualarm;    if (exists $Config{d_ualarm}) {        $has_ualarm++ if $Config{d_ualarm};    } elsif (has_x ("ualarm (0, 0)")) {        $has_ualarm++;	$DEFINE .= ' -DHAS_UALARM';    }    if ($has_ualarm) {        print "found.\n";    } else {	print "NOT found.\n";	if ($has_setitimer) {	    print "But you have setitimer().\n";	    print "We can make a Time::HiRes::ualarm().\n";	}    }    print "Looking for usleep()... ";    my $has_usleep;    if (exists $Config{d_usleep}) {	$has_usleep++ if $Config{d_usleep};    } elsif (has_x ("usleep (0)")) {	$has_usleep++;	$DEFINE .= ' -DHAS_USLEEP';    }    if ($has_usleep) {	print "found.\n";    } else {	print "NOT found.\n";        print "Let's see if you have select()... ";        if ($Config{'d_select'}) {	    print "found.\n";	    print "We can make a Time::HiRes::usleep().\n";	} else {	    print "NOT found.\n";	    print "You won't have a Time::HiRes::usleep().\n";	}    }    print "Looking for nanosleep()... ";    my $has_nanosleep;    if ($ENV{FORCE_NANOSLEEP_SCAN}) {	print "forced scan... ";	if (has_nanosleep()) {	    $has_nanosleep++;	    $DEFINE .= ' -DTIME_HIRES_NANOSLEEP';	}    }    elsif (exists $Config{d_nanosleep}) {	print "believing \$Config{d_nanosleep}... ";	if ($Config{d_nanosleep}) {	    $has_nanosleep++;	    $DEFINE .= ' -DTIME_HIRES_NANOSLEEP';	}    } elsif ($^O =~ /^(mpeix)$/) {	# MPE/iX falsely finds nanosleep from its libc equivalent.	print "skipping because in $^O... ";    } else {	if (has_nanosleep()) {	    $has_nanosleep++;	    $DEFINE .= ' -DTIME_HIRES_NANOSLEEP';	}    }    if ($has_nanosleep) {	print "found.\n";        print "You can mix subsecond sleeps with signals, if you want to.\n";        print "(It's still not portable, though.)\n";    } else {	print "NOT found.\n";	my $nt = ($^O eq 'os2' ? '' : 'not');        print "You can$nt mix subsecond sleeps with signals.\n";        print "(It would not be portable anyway.)\n";    }    print "Looking for clock_gettime()... ";    my $has_clock_gettime;    if (exists $Config{d_clock_gettime}) {        $has_clock_gettime++ if $Config{d_clock_gettime}; # Unlikely...    } elsif (has_clock_xxx('gettime')) {        $has_clock_gettime++;	$DEFINE .= ' -DTIME_HIRES_CLOCK_GETTIME';    } elsif (defined $SYSCALL_H && has_clock_xxx_syscall('gettime')) {        $has_clock_gettime++;	$DEFINE .= ' -DTIME_HIRES_CLOCK_GETTIME -DTIME_HIRES_CLOCK_GETTIME_SYSCALL';    }    if ($has_clock_gettime) {        if ($DEFINE =~ /-DTIME_HIRES_CLOCK_GETTIME_SYSCALL/) {	    print "found (via syscall).\n";	} else {	    print "found.\n";	}    } else {	print "NOT found.\n";    }    print "Looking for clock_getres()... ";    my $has_clock_getres;    if (exists $Config{d_clock_getres}) {        $has_clock_getres++ if $Config{d_clock_getres}; # Unlikely...    } elsif (has_clock_xxx('getres')) {        $has_clock_getres++;	$DEFINE .= ' -DTIME_HIRES_CLOCK_GETRES';    } elsif (defined $SYSCALL_H && has_clock_xxx_syscall('getres')) {        $has_clock_getres++;	$DEFINE .= ' -DTIME_HIRES_CLOCK_GETRES -DTIME_HIRES_CLOCK_GETRES_SYSCALL';    }    if ($has_clock_getres) {        if ($DEFINE =~ /-DTIME_HIRES_CLOCK_GETRES_SYSCALL/) {	    print "found (via syscall).\n";	} else {	    print "found.\n";	}    } else {	print "NOT found.\n";    }    print "Looking for clock_nanosleep()... ";    my $has_clock_nanosleep;    if (exists $Config{d_clock_nanosleep}) {        $has_clock_nanosleep++ if $Config{d_clock_nanosleep}; # Unlikely...    } elsif (has_clock_nanosleep()) {        $has_clock_nanosleep++;	$DEFINE .= ' -DTIME_HIRES_CLOCK_NANOSLEEP';    }    if ($has_clock_nanosleep) {        print "found.\n";    } else {	print "NOT found.\n";    }    print "Looking for clock()... ";    my $has_clock;    if (exists $Config{d_clock}) {        $has_clock++ if $Config{d_clock}; # Unlikely...    } elsif (has_clock()) {        $has_clock++;	$DEFINE .= ' -DTIME_HIRES_CLOCK';    }    if ($has_clock) {        print "found.\n";    } else {	print "NOT found.\n";    }    print "Looking for stat() subsecond timestamps...\n";    print "Trying struct stat st_atimespec.tv_nsec...";    my $has_stat_st_xtimespec;    if (try_compile_and_link(<<EOM)) {$TIME_HEADERS#include <sys/stat.h>int main(int argc, char** argv) {    struct stat st;    st.st_atimespec.tv_nsec = 0;}EOM      $has_stat_st_xtimespec++;      DEFINE('TIME_HIRES_STAT', 1);    }    if ($has_stat_st_xtimespec) {        print "found.\n";    } else {	print "NOT found.\n";    }    print "Trying struct stat st_atimensec...";    my $has_stat_st_xtimensec;    if (try_compile_and_link(<<EOM)) {$TIME_HEADERS#include <sys/stat.h>int main(int argc, char** argv) {    struct stat st;    st.st_atimensec = 0;}EOM      $has_stat_st_xtimensec++;      DEFINE('TIME_HIRES_STAT', 2);    }    if ($has_stat_st_xtimensec) {        print "found.\n";    } else {	print "NOT found.\n";    }    print "Trying struct stat st_atime_n...";    my $has_stat_st_xtime_n;    if (try_compile_and_link(<<EOM)) {$TIME_HEADERS#include <sys/stat.h>int main(int argc, char** argv) {    struct stat st;    st.st_atime_n = 0;}EOM      $has_stat_st_xtime_n++;      DEFINE('TIME_HIRES_STAT', 3);    }    if ($has_stat_st_xtime_n) {        print "found.\n";    } else {	print "NOT found.\n";    }    print "Trying struct stat st_atim.tv_nsec...";    my $has_stat_st_xtim;    if (try_compile_and_link(<<EOM)) {$TIME_HEADERS#include <sys/stat.h>int main(int argc, char** argv) {    struct stat st;    st.st_atim.tv_nsec = 0;}EOM      $has_stat_st_xtim++;      DEFINE('TIME_HIRES_STAT', 4);    }    if ($has_stat_st_xtim) {        print "found.\n";    } else {	print "NOT found.\n";    }    print "Trying struct stat st_uatime...";    my $has_stat_st_uxtime;    if (try_compile_and_link(<<EOM)) {$TIME_HEADERS#include <sys/stat.h>int main(int argc, char** argv) {    struct stat st;    st.st_uatime = 0;}EOM      $has_stat_st_uxtime++;      DEFINE('TIME_HIRES_STAT', 5);    }    if ($has_stat_st_uxtime) {        print "found.\n";    } else {	print "NOT found.\n";    }   if ($DEFINE =~ /-DTIME_HIRES_STAT=\d+/) {    print "You seem to have stat() subsecond timestamps.\n";    print "(Your struct stat has them, but the filesystems must help.)\n";   } else {    print "You do not seem to have stat subsecond timestamps.\n";   }    my $has_w32api_windows_h;    if ($^O eq 'cygwin') {        print "Looking for <w32api/windows.h>... ";        if (has_include('w32api/windows.h')) {	    $has_w32api_windows_h++;	    DEFINE('HAS_W32API_WINDOWS_H');	}        if ($has_w32api_windows_h) {	    print "found.\n";	} else {	    print "NOT found.\n";	}    }    if ($DEFINE) {        $DEFINE =~ s/^\s+//;        if (open(XDEFINE, ">xdefine")) {	    print XDEFINE $DEFINE, "\n";	    close(XDEFINE);        }    }}sub doMakefile {    my @makefileopts = ();    if ($] >= 5.005) {	push (@makefileopts,	    'AUTHOR'    => 'Jarkko Hietaniemi <jhi@iki.fi>',	    'ABSTRACT_FROM' => 'HiRes.pm',	);	DEFINE('ATLEASTFIVEOHOHFIVE');    }    push (@makefileopts,	'NAME'	=> 'Time::HiRes',	'VERSION_FROM' => 'HiRes.pm', # finds $VERSION	'LIBS'	=> $LIBS,   # e.g., '-lm'	'DEFINE'	=> $DEFINE,     # e.g., '-DHAS_SOMETHING'	'XSOPT'	=> $XSOPT,	  # Do not even think about 'INC' => '-I/usr/ucbinclude',	  # Solaris will avenge.	'INC'	=> '',     # e.g., '-I/usr/include/other'	'INSTALLDIRS' => ($] >= 5.008 ? 'perl' : 'site'),	'dist'      => {	    'CI'       => 'ci -l',	    'COMPRESS' => 'gzip -9f',	    'SUFFIX'   => 'gz',	},        clean => { FILES => "xdefine" },        realclean => { FILES=> 'const-c.inc const-xs.inc' },    );    if ($ENV{PERL_CORE}) {	push @makefileopts, MAN3PODS => {};    }    WriteMakefile(@makefileopts);}sub doConstants {    if (eval {require ExtUtils::Constant; 1}) {	my @names = qw(CLOCK_HIGHRES CLOCK_MONOTONIC		       CLOCK_PROCESS_CPUTIME_ID		       CLOCK_REALTIME		       CLOCK_SOFTTIME		       CLOCK_THREAD_CPUTIME_ID		       CLOCK_TIMEOFDAY		       CLOCKS_PER_SEC		       ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF		       ITIMER_REALPROF		       TIMER_ABSTIME);	foreach (qw (d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer		     d_nanosleep d_clock_gettime d_clock_getres		     d_clock d_clock_nanosleep d_hires_stat)) {	    my $macro = $_;	    if ($macro =~ /^(d_nanosleep|d_clock_gettime|d_clock_getres|d_clock|d_clock_nanosleep)$/) {		$macro =~ s/^d_(.+)/TIME_HIRES_\U$1/;	    } elsif ($macro =~ /^(d_hires_stat)$/) {		my $d_hires_stat = 0;		$d_hires_stat = $1 if ($DEFINE =~ /-DTIME_HIRES_STAT=(\d+)/);		push @names, {name => $_, macro => "TIME_HIRES_STAT", value => $d_hires_stat,			      default => ["IV", "0"]};		next;	    } else {		$macro =~ s/^d_(.+)/HAS_\U$1/;	    }	    push @names, {name => $_, macro => $macro, value => 1,			  default => ["IV", "0"]};	}	ExtUtils::Constant::WriteConstants(					   NAME => 'Time::HiRes',					   NAMES => \@names,					  );    } else {        my $file;	foreach $file ('const-c.inc', 'const-xs.inc') {	    my $fallback = File::Spec->catfile('fallback', $file);	    local $/;	    open IN, "<$fallback" or die "Can't open $fallback: $!";	    open OUT, ">$file" or die "Can't open $file: $!";	    print OUT <IN> or die $!;	    close OUT or die "Can't close $file: $!";	    close IN or die "Can't close $fallback: $!";	}    }}sub main {    print "Configuring Time::HiRes...\n";    if ($] == 5.007002) {	die "Cannot Configure Time::HiRes for Perl $], aborting.\n";    }    if ($^O =~ /Win32/i) {      DEFINE('SELECT_IS_BROKEN');      $LIBS = [];      print "System is $^O, skipping full configure...\n";    } else {      init();    }    doMakefile;    doConstants;    my $make = $Config{'make'} || "make";    unless (exists $ENV{PERL_CORE} && $ENV{PERL_CORE}) {	print  <<EOM;Now you may issue '$make'.  Do not forget also '$make test'.EOM       if ((exists $ENV{LC_ALL}   && $ENV{LC_ALL}   =~ /utf-?8/i) ||           (exists $ENV{LC_CTYPE} && $ENV{LC_CTYPE} =~ /utf-?8/i) ||           (exists $ENV{LANG}     && $ENV{LANG}     =~ /utf-?8/i)) {            print <<EOM;NOTE: if you get an error like this (the Makefile line number may vary):Makefile:91: *** missing separatorthen set the environment variable LC_ALL to "C" and retryfrom scratch (re-run perl "Makefile.PL").(And consider upgrading your Perl.)(You got this message because you seem to have an UTF-8 locale active in your shell environment, this used to cause broken Makefiles to be created from Makefile.PLs.)EOM        }    }}&main;# EOF

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -