1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
#!../../perl -w
use Config;
use ExtUtils::MakeMaker;
# Curses needs the following two variables defined here in order to
# compile the library. They are:
#
# $inc contains any includes or defines (-I or -D) that are
# needed to compile libcurses applications
# $libs contains any libraries or library paths (-l or -L) that are
# needed to compile libcurses applications
my $inc;
my $libs;
# If you do not set these explicitly, Makefile.PL will try in a fairly
# stupid fashion to pick them for you, along with a "c-config.h" file.
#
# If you want to see examples of what needs to go in the $inc and
# $libs variables, check out the `guess_cfg' tables of values below.
# In fact, one way to set the variables would be to add or modify an
# entry for your 'osname'. If you're not sure what the osname is for
# your machine, you can use the following at your command line to
# print it out:
#
# perl -e 'use Config; print "$Config{osname}\n"'
#
# Some lines have multiple versions (such as `freebsd' and `linux'),
# representing different versions of curses that an OS might have.
# You can pick the version you want by setting the `default' entry.
# Here are some notes provided by the hint providers for certain of the
# OSes. You should scan them first to see if they apply to you.
#
# Notes for FreeBSD ncurses:
# [Courtesy of "Andrew V. Stesin" <stesin@elvisti.kiev.ua>]
# FreeBSD-2.0.5 ncurses + mytinfo NOTE! Straight curses works much
# better for me!
#
# Notes for Solaris:
# Under 2.3, it was reported that to get the module to compile properly
# with gcc, you must add `-DSYSV=1' to $inc. This will disable the
# redefinition of memcpy to bcopy that is present in /usr/include/curses.h.
# [Courtesy of Dave Blaszyk <dvb@ycc.Kodak.COM>]
#
# $inc also contained "-I/usr/include", but this seems to cause a great
# deal of trouble for gcc under perl5.002, so I removed it by default.
# I have tested Curses-a9 with perl5.002 and gcc263 and Sun's unbundled
# cc on Solaris 2.4 with an empty $inc and had no problems, but your
# mileage may vary.
#
# If you are having trouble compiling under Solaris, try various
# combinations of "-I/usr/include" and "-DSYSV=1" in $inc to see if
# it fixes things.
## OS default guess for $inc default guess for $libs
#
my $guess_cfg =
{ 'aix' => [ '' => '-lcurses -ltermcap' ],
'bsd386' => [ '' => '-lcurses -ltermcap' ],
'bsdos' => [ '' => '-lcurses -ltermcap' ],
'dec_osf' => [ '' => '-lcurses -ltermcap' ],
'dgux' => [ '' => '-lcurses -ltermcap' ],
'dynixptx' => [ '' => '-lcurses -lc' ],
'freebsd' =>
{ 'bsd' => [ '' => '-lcurses -ltermcap' ],
'ncurses' => [ '' => '-lncurses' ],
'default' => 'bsd'
},
'hpux' => [ '' => '-lcurses -ltermcap' ],
'irix' => [ '' => '-lcurses -ltermcap' ], ##
'isc' => [ '' => '-lcurses -ltermcap' ], ##
'linux' =>
{ 'bsd' => ['' => '-lcurses -ltermcap' ],
'ncurses' => [ '-I/usr/include/ncurses' => '-lncurses' ],
'default' => 'ncurses'
},
'netbsd' => [ '' => '-lcurses -ltermcap' ],
'next' => [ '' => '-lcurses -ltermcap' ],
'os2' =>
{ 'bsd' => [ '' => '-lcurses -ltermcap' ],
'ncurses' => [ '' => '-lncurses' ], ##
'default' => 'ncurses'
},
'sco' => [ '' => '-lcurses -ltermcap' ], ##
'solaris' => [ '' => '-L/usr/ccs/lib -lcurses' ],
'sunos' =>
{ 'bsd' => [ '' => '-lcurses -ltermcap' ],
'sysv' => [ '-I/usr/5include' => '-L/usr/5lib -lcurses' ],
'ncurses' => [ '' => '-lncurses' ], ##
'default' => 'sysv'
},
'vms' => [ '' => 'sys$library:vaxcurse.olb' ],
'MSWin32' =>
{ 'borland' => [ '-w- -Id:\bc5\include' => '-Ld:\bc5\lib pdcurses.lib' ],
'visualc' => [ '' => 'pdcurses' ],
'default' => 'visualc'
},
'' => undef
};
###
## You shouldn't need to change anything below
#
unless (defined $inc and defined $libs) {
print qq{Making a guess for \$inc and \$libs...\n};
my $osname = $Config{'osname'};
my $guess = $guess_cfg->{$osname};
my $source = "hints/c-$osname";
if (not defined $guess) {
print STDERR <<'EOW';
I'm sorry, but I could not make a good guess for the includes and
libraries that are needed. You will need to edit Makefile.PL and
follow the instructions for defining the $inc and $libs variables.
EOW
exit 1;
}
if (ref $guess eq 'HASH') {
my $libtyp = $guess->{'default'};
$guess = $guess->{$libtyp};
$source .= ".$libtyp";
}
$inc = $guess->[0];
$libs = $guess->[1];
if (not -e "c-config.h") {
print qq{Making a guess for "c-config.h"...\n};
if (not -f "$source.h") {
print STDERR <<"EOW";
I'm sorry, but I couldn't find a hints file that was configured for
your OS. You will need to create and configure a "c-config.h" file
for yourself. Please see the "INSTALL" directions for pointers on how
to do this.
EOW
exit 1;
}
my $lns = $Config{'lns'}
|| ($osname eq 'MSWin32' && "perl -MExtUtils::Command -e cp")
|| "/bin/cp";
my $sys = "$lns $source.h c-config.h";
if (not $sys =~ m!([^\\:\w/. -])!) {
system $sys;
}
else {
print STDERR <<"EOW";
I'm sorry. I was going to try and pick a "c-config.h" for you, but it
looks like there are some non-standard characters in the exec string.
I'm feeling rather paranoid, so I'll let you look at the line and do
it by hand if it looks OK. I wanted to execute a symbolic link or
copy as follows:
ln -s $source.h c-config.h [or]
cp $source.h c-config.h
Config said I might be able to use:
$sys
but it has the (possibly) naughty character '$1' in it.
EOW
exit 1;
}
}
}
&WriteMakefile(NAME => 'Curses',
INC => $inc,
LIBS => [ $libs ],
H => [ 'pCurses.h' ],
VERSION => '1.02',
SKIP => [ 'xs_c', 'xs_o' ],
clean => { FILES => 'pCurses.h c-config.h cdemo' },
dist => { COMPRESS => 'gzip' }
);
sub MY::postamble
{
'
pCurses.h: c-config.h Makefile.PL
$(PERL) test.syms
c-config.h:
@echo "You need to make a c-config.h. See the INSTALL document.";
@false
cdemo: cdemo.c
$(CC) $(INC) -o cdemo cdemo.c $(EXTRALIBS)
'
}
|