Term-Gnuplot
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
use File::Basename;
use ExtUtils::MakeMaker;
use Config;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
$common::x = "$ENV{X11ROOT}/XFree86"
if exists $ENV{X11ROOT} and -d "$ENV{X11ROOT}/XFree86/lib" and -d "$ENV{X11ROOT}/XFree86/include";
$try_libs = $common::x ? "-L$common::x/lib" : '';
$try_libs .= ' -L/usr/openwin/lib -lX11 -lm -lsocket -lvga -llinuxvga -lgd -lpng -ljpeg -lfreetype -lz -ljmgraph -lvesa -lpdf';
@ARGV = grep !(/^TRY_LIBS=(.*)$/ and $try_libs = $1), @ARGV;
use Config;
my (%libs, %symb);
{
print "...Looking for libs, expect some warnings...\n";
my $loadlibs;
if ($] >= 5.008001) {
require ExtUtils::Liblist; # Buggy before this
($loadlibs) = ExtUtils::Liblist->ext( $try_libs );
} else {
push @INC, 'utils';
require FindLib;
$loadlibs = FindLib::findlib( $try_libs );
}
if ($^O =~ /MSWin32/) { # Semantic of ext() is very different.
my ($sep, @grep) = (($loadlibs =~ /^".*"$/ ? '"\s+"' : '\s+'), ($try_libs =~ /(?!<\S)-l(.*?)(?!\S)/g));
(my $l = $loadlibs) =~ s/^"|"$//g;
my (@found) = split /$sep/, $l; # Check for "" just in case: should be always present
s(^.*[/\\](?:lib)?(.*)\E$Config{lib_ext}\E$)($1) for @found;
# warn "Win libs: <@found>\n";
my %check = map +($_, 1), @grep;
$loadlibs = join ' -l', '', grep $check{$_}, @found;
}
print "...Found libs: '$loadlibs'\n";
my (@libs) = ($loadlibs =~ /\B-l(\S*)/g);
@libs{@libs} = @libs;
my %funcs = ( gd => [qw(trygd.h gd.h gdImageCreate gdImageGif
gdImageJpeg gdImageStringFT
gdImageStringTTF gdImagePng)],
png => [qw(trypng.h png.h png_read_image detected_PNGversion89
png_create_write_struct)],
pdf => [qw(trypdf.h pdflib.h PDF_get_majorversion
PDF_begin_pattern)],
);
if (not $libs{z} and $libs{gd}) {
print "-lz not found, required for -lgd\n";
delete $libs{gd};
}
for my $l (keys %funcs) {
my($have, $in);
print "-l$l not found\n", next unless $libs{$l};
my @symb = @{$funcs{$l}};
my $header = shift @symb;
my $header1 = shift @symb;
# Need to check for functions, if not found, abort... How?!!!
my $cppflags = $Config{cppflags};
$cppflags =~ s/-Zmt\b// if $^O eq 'os2'; # Better fixed in Configure...
# Use $Config{cpprun}, instead of $Config{cpp}. cpp is simply set to
# 'cpp' after Configure has run, which is not useful, since it lives
# in /lib/ on many systems, which is normally not on the path. This
# is documented, but silly behaviour. $Config{cpprun} is what is
# documented to be set to a cpp that will take stuff on stdin
my $cpp = $Config{cpprun} || $Config{cpp};
my $cmd = "$cpp $cppflags $header";
my %this_symb;
if (open IN, "$cmd |") {{
local $/;
$in = <IN>;
close IN or (warn("close pipe from `$cmd': $!"), last);
for my $s (@symb) {
$this_symb{$s}++, $symb{$s}++, $have++ if $in =~ /$s/;
}
}}
if ($have) {
my @s = sort keys %this_symb;
print "...Found @s (out of @symb) in $header1, keeping -l$l.\n";
} else {
$loadlibs =~ s/-l\Q$l\E\b//g; # //g just in case
$try_libs =~ s/-l\Q$l\E\b//g; # //g just in case
print "...Could not find @symb in $header1, removing -l$l.\n";
}
}
$common::loadlibs = $loadlibs;
}
$common::try_libs = $try_libs;
$common::pm_exe = 'gplpmdrb'; # Usual: gnupmdrv
$common::x_exe = 'gnuplot_x11b'; # Usual: without b
$common::defines = '-DPM3D -DUSE_ULIG_FILLEDBOXES -DUSE_ACTIVE_EVENTS';
my $png;
$common::defines .= ' -DHAVE_LIBPNG', $png++
if $symb{png_create_write_struct} and $symb{detected_PNGversion89};
$common::defines .= ' -DHAVE_LIBGD' if $symb{gdImageCreate};
$common::defines .= ' -DHAVE_GD_GIF -DHAVE_GIF' if $symb{gdImageGif}; # new/old
$common::defines .= ' -DHAVE_GD_JPEG' if $symb{gdImageJpeg}
and $libs{jpeg};
my $gd_png;
$common::defines .= ' -DHAVE_GD_PNG -DHAVE_NEWGD -DHAVE_PNG', $gd_png++
if $symb{gdImagePng} and $libs{png};
$common::defines .= ' -DgdImageStringFT=gdImageStringTTF'
if $symb{gdImageStringTTF} and not $symb{gdImageStringFT};
$common::defines .= ' -DHAVE_GD_TTF'
if ($symb{gdImageStringTTF} or $symb{gdImageStringFT})
and $libs{freetype};
if ($symb{PDF_get_majorversion}) {
$common::defines .= ' -DHAVE_LIBPDF';
$common::defines .= ' -DHAVE_OLD_LIBPDF' unless $symb{PDF_begin_pattern};
}
# No IPC is needed without mouse enabled
if ($^O eq 'os2') {
# $common::defines .= ' -DOS2_IPC';
} else {
# $common::defines .= ' -DPIPE_IPC';
}
$common::cflags = '';
# Not used: inline, STDC_HEADERS, NOCWDRC, HAVE_ERF, HAVE_GAMMA,
# HAVE_GETCWD, HAVE_LGAMMA, HAVE_SETVBUF, HAVE_SYSINFO, HAVE_TCGETATTR,
# HAVE_SGTTY_H, HAVE_SYS_BSDTYPES_H, HAVE_SYS_SYSTEMINFO_H
# Cannot find: DOS32, EXTERN_ERRNO, HAVE_LIBGD, HAVE_LIBPNG, LINUXVGA,
# MSDOS, NO_ERRNO_H, READLINE, X11, HAVE_SLEEP,
# Cannot find, probably important: NO_ATEXIT, HAVE_ON_EXIT, PIPES, HAVE_LIBC_H
$common::cflags .= ' -DNO_STDLIB_H' unless $Config{i_stdlib}; # not used now
$common::cflags .= ' -DNO_FLOAT_H' unless $Config{i_float};
$common::cflags .= ' -DHAVE_UNISTD_H' if $Config{i_unistd};
$common::cflags .= ' -DHAVE_FLOAT_H' if $Config{i_float};
$common::cflags .= ' -DHAVE_LIMITS_H' if $Config{i_limits};
$common::cflags .= ' -DHAVE_LOCALE_H' if $Config{i_locale};
$common::cflags .= ' -DHAVE_MATH_H' if $Config{i_math};
$common::cflags .= ' -DHAVE_MALLOC_H' if $Config{i_malloc};
$common::cflags .= ' -DHAVE_STDLIB_H' if $Config{i_stdlib};
$common::cflags .= ' -DHAVE_UNISTD_H' if $Config{i_unistd};
$common::cflags .= ' -DHAVE_STRING_H' if $Config{i_string};
$common::cflags .= ' -DHAVE_TERMIOS_H' if $Config{i_termios};
$common::cflags .= ' -DHAVE_VALUES_H' if $Config{i_values};
$common::cflags .= ' -DHAVE_SYS_TYPES_H' if $Config{i_systypes};
$common::cflags .= ' -DHAVE_SYS_STAT_H' if $Config{i_sysstat};
$common::cflags .= ' -DHAVE_SYS_PARAM_H' if $Config{i_sysparam};
if ($Config{i_time} or $Config{timeincl} and $Config{timeincl} =~ /\W/) {
$common::cflags .= ' -DHAVE_TIME_H' # Is it reasonable?
} else {
$common::cflags .= ' -DNO_TIME_H' # Is it reasonable?
}
$common::cflags .= ' -DOLD_SELECT' unless $Config{i_sysselct};
$common::cflags .= ' -DNO_MEMCPY' unless $Config{d_memcpy};
$common::cflags .= ' -DHAVE_MEMCPY' if $Config{d_memcpy};
$common::cflags .= ' -DNO_MEMSET' unless $Config{d_memset};
$common::cflags .= ' -DHAVE_MEMSET' if $Config{d_memset};
$common::cflags .= ' -DNO_STRCHR' unless $Config{d_strchr};
# Assume that STRSTR and STRCHR are present simultaneously:
$common::cflags .= ' -DHAVE_STRCHR -DHAVE_STRSTR' if $Config{d_strchr};
( run in 0.548 second using v1.01-cache-2.11-cpan-13bb782fe5a )