📄 ch24.htm
字号:
80 You don't have an ELF gcc. I will use dld
if possible. If you are<BR>
81 using a version of DLD earlier than 3.2.6, or don't have
it at all, you<BR>
82 should probably upgrade. If you are forced to use 3.2.4,
you should<BR>
83 uncomment a couple of lines in hints/linux.sh and restart
Configure so<BR>
84 that shared libraries will be disallowed.<BR>
85<BR>
86 EOM<BR>
87 lddlflags="-r $lddlflags"
<BR>
88 # These empty values are
so that Configure doesn't put in the<BR>
89 # Linux ELF values.<BR>
90 ccdlflags=' '<BR>
91 cccdlflags=' '<BR>
92 so='sa'<BR>
93 dlext='o'<BR>
94 ## If you are using DLD
3.2.4 which does not support shared libs,<BR>
95 ## uncomment the next two
lines:<BR>
96 #ldflags="-static"
<BR>
97 #so='none'<BR>
98 fi<BR>
99<BR>
100 rm -f try.c a.out<BR>
101<BR>
102 if /bin/bash -c exit; then<BR>
103 echo You appear to have a working bash. Good.
<BR>
104 else<BR>
105 cat << 'EOM'<BR>
106 Warning: it would appear you have a defective bash shell installed.
This is<BR>
107 likely to give you a failure of op/exec test #5 during the
test phase of the<BR>
108 build, Upgrading to a recent version (1.14.4 or later) should
fix the<BR>
109 problem.<BR>
110<BR>
111 EOM<BR>
112<BR>
113 fi<BR>
114<BR>
115 # In addition, on some systems there is a problem with perl
and NDBM, which<BR>
116 # causes AnyDBM and NDBM_File to lock up. This is evidenced
in the tests as<BR>
117 # AnyDBM just freezing. Currently we disable NDBM
for all linux systems.<BR>
118 # If someone can suggest a more robust test, that would be
appreciated.<BR>
119 # This will generate a harmless message:<BR>
120 # Hmm...You had some extra variables I don't know about...I'll
try to keep 'em.<BR>
121 # Propagating
recommended variable d_dbm_open<BR>
122 d_dbm_open=undef</FONT></TT>
</BLOCKQUOTE>
<HR>
<P>
A <TT><FONT FACE="Courier">hint</FONT></TT> is simply a shell
script run by <TT><FONT FACE="Courier">Configure</FONT></TT> that
sets things it needs for your system. Usually the <TT><FONT FACE="Courier">hint</FONT></TT>
files are documented well enough to know why certain variables
are defined.
<P>
And sometimes they're not. It's usually not that hard to figure
out what the <TT><FONT FACE="Courier">define</FONT></TT> is about,
though. Case in point: the lines from the <TT><FONT FACE="Courier">linux.sh</FONT></TT>
file. Turning <TT><FONT FACE="Courier">malloc</FONT></TT> off
turns off Perl's version of <TT><FONT FACE="Courier">malloc</FONT></TT>.
There is really no need for an explanation here:
<BLOCKQUOTE>
<TT><FONT FACE="Courier"># Explanation?<BR>
usemymalloc='n'</FONT></TT>
</BLOCKQUOTE>
<P>
I use <TT><FONT FACE="Courier">linux.sh</FONT></TT> here as the
example because it's the system I happen to run. If you are on
an SCO system, you have some choices to make, depending on the
type of system you have. Here are the <TT><FONT FACE="Courier">hints</FONT></TT>
files included with <TT><FONT FACE="Courier">5.002:</FONT></TT>
<BLOCKQUOTE>
<TT><FONT
FACE="Courier">3b1.sh dnix.sh irix_6.sh&nb
sp;
opus.sh svr4.sh<BR>
3b1cc dynix.sh isc.sh powerunix .sh
ti1500.sh<BR>
README.hints epix.sh isc_2.sh sco_2_3_0 .sh
titanos.sh<BR>
aix.sh esix4.sh linux.sh sco_2_3_1 .sh
ultrix_4.sh<BR>
altos486.sh fps.sh machten.sh sco_2_3_2 .sh
unicos.sh<BR>
apollo.sh freebsd.sh mips.sh sco_2_3_3 .sh
unisysdynix.sh<BR>
aux.sh genix.sh mpc.sh sco_2_3_4 .sh
utekv.sh<BR>
bsd386.sh greenhills.sh mpeix.sh sco_3 .sh
uts.sh<BR>
convexos.sh hpux_9.sh ncr_tower.sh solaris_2.sh
<BR>
cxux.sh i386.sh netbsd.sh stellar.sh
<BR>
dec_osf.sh irix_4.sh next_3.sh sunos_4_0.sh
<BR>
dgux.sh irix_5.sh next_3_0.sh sunos_4_1.sh</FONT></TT>
</BLOCKQUOTE>
<H2><A NAME="RunningSomeTests"><B><FONT SIZE=5 COLOR=#FF0000>Running
Some Tests</FONT></B></A></H2>
<P>
Just because everything compiled doesn't mean you are out of the
woods. You have to run the regression tests on the <TT><FONT FACE="Courier">perl</FONT></TT>
you just made. You should see the message <TT><FONT FACE="Courier">All
tests successful</FONT></TT>. (See Figure 24.4.)
<P>
<A HREF="f24-4.gif" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/f24-4.gif" ><B>Figure 24.4 : </B><I>Results from a test run.</I></A>
<P>
If it doesn't say <TT><FONT FACE="Courier">All tests successful</FONT></TT>,
something went wrong. Figure 24.4 shows a sample run without any
error messages.<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR VALIGN=TOP><TD ><B>Tip</B></TD></TR>
<TR VALIGN=TOP><TD >
<BLOCKQUOTE>
You can't run the <TT><FONT FACE="Courier">make test</FONT></TT> command in the background because running that command disables the opening of the device <TT><FONT FACE="Courier">/dev/tty</FONT></TT>.
</BLOCKQUOTE>
</TD></TR>
</TABLE></CENTER>
<P>
<P>
In the unfortunate event that you do not see the successful message,
you have to figure out what went wrong. Go to the <TT><FONT FACE="Courier">t</FONT></TT>
directory. (I just love these directory names in UNIX.) Then run
the <TT><FONT FACE="Courier">TEST</FONT></TT> command to see the
results.
<P>
If an individual test has cratered, you can run that test manually
with this command:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">./perl op/groups.t</FONT></TT>
</BLOCKQUOTE>
<P>
Note that in the <TT><FONT FACE="Courier">t</FONT></TT> directory,
<TT><FONT FACE="Courier">./perl</FONT></TT> is linked to <TT><FONT FACE="Courier">../perl</FONT></TT>.
This is a fully working version of the real enchilada!
<H3><A NAME="FinishingItUp"><B>Finishing It Up</B></A></H3>
<P>
You've now run the test, and the doubts in your mind are a faded
memory. Let's discuss how to install Perl so that other users
on your system are able to use it.
<P>
It would be a good idea to run as root now if you are writing
in the <TT><FONT FACE="Courier">/usr</FONT></TT> tree. Of course,
you could have specified a totally different location over which
you have write privileges-in which case being root is a moot point.
Keep in mind that if you are not root, you must own the directories
where you are writing and ignore any messages about <TT><FONT FACE="Courier">chown</FONT></TT>
not working.
<P>
Now, take a deep breath and run the <TT><FONT FACE="Courier">make
install</FONT></TT> command:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">make install</FONT></TT>
</BLOCKQUOTE>
<P>
This command puts Perl into a public directory. If you used the
defaults, the location is <TT><FONT FACE="Courier">/usr/local/bin</FONT></TT>.
The <TT><FONT FACE="Courier">make install</FONT></TT> command
will also try to put the <TT><FONT FACE="Courier">man</FONT></TT>
pages in a reasonable place, possibly under <TT><FONT FACE="Courier">/usr/man</FONT></TT>.
You may have to <TT><FONT FACE="Courier">nroff</FONT></TT> the
<TT><FONT FACE="Courier">man</FONT></TT> page yourself, though.
(In newer systems, the first time you run the <TT><FONT FACE="Courier">man(1)</FONT></TT>
command, it will automatically run <TT><FONT FACE="Courier">nroff</FONT></TT>
and update the cat-files for you.)
<P>
The <TT><FONT FACE="Courier">make install</FONT></TT> command
creates the following files for you (I'm using <TT><FONT FACE="Courier">/usr/local/bin</FONT></TT>
as the default location):
<UL>
<LI><TT><FONT COLOR=#000000 FACE="Courier">perl5.002</FONT></TT>
and link <TT><FONT FACE="Courier">/usr/local/bin/perl</FONT></TT>
to it
<LI><TT><FONT FACE="Courier">suidperl</FONT></TT> if you requested
<TT><FONT FACE="Courier">setuid</FONT></TT> emulation
<LI><TT><FONT FACE="Courier">cppstdin,</FONT></TT> which is used
by <TT><FONT FACE="Courier">perl -P</FONT></TT> if your <TT><FONT FACE="Courier">cc
-E</FONT></TT> can't read from <TT><FONT FACE="Courier">stdin</FONT></TT>
<LI><TT><FONT FACE="Courier">c2ph</FONT></TT> and <TT><FONT FACE="Courier">pstruct</FONT></TT>
scripts, which are used for handling C structures in header files
<LI><TT><FONT FACE="Courier">a2p,</FONT></TT> which converts <TT><FONT FACE="Courier">awk</FONT></TT>
scripts to Perl
<LI><TT><FONT FACE="Courier">s2p,</FONT></TT> which converts <TT><FONT FACE="Courier">sed</FONT></TT>
scripts to Perl
<LI><TT><FONT FACE="Courier">find2perl,</FONT></TT> which converts
<TT><FONT FACE="Courier">find</FONT></TT> command options to the
Perl translator
<LI><TT><FONT FACE="Courier">h2xs</FONT></TT> and other header
files to Perl extensions
<LI><TT><FONT FACE="Courier">pod2html,</FONT></TT> which contains
Perl's <TT><FONT FACE="Courier">pod</FONT></TT> documentation
format to HTML
<LI><TT><FONT FACE="Courier">pod2latex,</FONT></TT> which contains
programs to convert documentation in the <TT><FONT FACE="Courier">pod</FONT></TT>
format to LaTeX
<LI><TT><FONT FACE="Courier">pod2man,</FONT></TT> which contains
programs to convert documentation in the <TT><FONT FACE="Courier">pod</FONT></TT>
format to <TT><FONT FACE="Courier">man</FONT></TT> pages
<LI><TT><FONT FACE="Courier">perldoc</FONT></TT>, a tool for reading
Perl's <TT><FONT FACE="Courier">pod</FONT></TT> documentation
</UL>
<P>
The library files go in <TT><FONT FACE="Courier">$privlib</FONT></TT>
and <TT><FONT FACE="Courier">$archlib</FONT></TT> as defined in
the <TT><FONT FACE="Courier">Configure.sh</FONT></TT> file. (This
is defaulted to <TT><FONT FACE="Courier">/usr/local/lib/perl5/</FONT></TT>.)
The Perl documentation pages go in <TT><FONT FACE="Courier">/usr/lib/perl5/pod/</FONT></TT>.
Perl's <TT><FONT FACE="Courier">*.h</FONT></TT> header files and
the <TT><FONT FACE="Courier">libperl.a</FONT></TT> library are
also installed under <TT><FONT FACE="Courier">$archlib</FONT></TT>
so that you may later build new extensions even if the Perl source
is no longer available. The <TT><FONT FACE="Courier">man</FONT></TT>
pages go in <BR>
<TT><FONT FACE="Courier">/usr/local/man/man1</FONT></TT> and <TT><FONT FACE="Courier">/usr/local/lib/perl5/man/man3</FONT></TT>.
<P>
After the installation is complete, you should see the message
<TT><FONT FACE="Courier">Installation complete</FONT></TT>, as
shown in Figure 24.5. If you do not see this message, you have
to run this script again to see what went wrong. Chances are that
either you do not have permission to write to the directories
you requested or that the directory in which you chose to install
Perl doesn't have the space, or both.
<P>
<A HREF="f24-5.gif" tppabs="http://www.mcp.com/815097600/0-672/0-672-30891-6/f24-5.gif" ><B>Figure 24.5 : </B><I>Installation and verification.</I></A>
<P>
This is optional. If you want to make the documentation available
in <TT><FONT FACE="Courier">man</FONT></TT>, HTML, or TeX format,
use the following commands for HTML files:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">cd pod; make html</FONT></TT>
</BLOCKQUOTE>
<P>
For the documentation in TeX format, from the Perl source directory
type the following command:
<BLOCKQUOTE>
<TT><FONT FACE="Courier">cd pod; make tex</FONT></TT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -