📄 ch24.htm
字号:
with your distribution and just start over with a fresh release
from the Internet. Chances are that even if you actually paid
someone for this crippled Perl release, they won't be interested
in providing you with free support.
<P>
The <TT><FONT FACE="Courier">config.sh</FONT></TT> file is the
one you need to know about if you have to modify the compiler
switches. The file is too long to list here, but I have listed
some of the switches that you should definitely take a look at
if you need to correct something:
<UL>
<LI><FONT COLOR=#000000>For the architecture type of CPU in your
machine:</FONT>
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">archname='i486-linux'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For your binary files' directories:</FONT>
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">bin='/usr/bin' & binexp='/usr/bin'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the </FONT><TT><FONT FACE="Courier">little
endian</FONT></TT> or <TT><FONT FACE="Courier">big endian</FONT></TT>
order of your machine:
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">byteorder='1234'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the </FONT><TT><FONT FACE="Courier">c</FONT></TT>
flags for your compiler:
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">ccflags='-D__USE_BSD_SIGNAL -Dbool=char
-DHAS_BOOL'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the preprocessor flags:</FONT>
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">cppflags='-D__USE_BSD_SIGNAL -Dbool=char
-DHAS_BOOL'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For any extensions you have added to Perl:</FONT>
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">extensions='DB_File Fcntl GDBM_File ODBM_File
POSIX SDBM_File Socket'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the </FONT><TT><FONT FACE="Courier">gcc</FONT></TT>
version number:
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">gccversion='2.6.3'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the locations where the binaries pages
will be installed:</FONT>
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">installbin='/usr/bin'<BR>
installprivlib='/usr/lib/perl5'<BR>
installscript='/usr/bin'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the locations where </FONT><TT><FONT FACE="Courier">man</FONT></TT>
pages will be installed:
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">installman1dir='/usr/man/man1'<BR>
installman3dir='/usr/lib/perl5/man/man3'<BR>
man1dir='/usr/man/man1'<BR>
man1direxp='/usr/man/man1'<BR>
man1ext='1'<BR>
man3dir='/usr/lib/perl5/man/man3'<BR>
man3direxp='/usr/lib/perl5/man/man3'<BR>
man3ext='3'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For the libraries used to build Perl:</FONT>
</UL>
<BLOCKQUOTE>
<TT><FONT FACE="Courier">libs='-lgdbm -ldbm -ldb -ldld -lm -lc
-lbsd'</FONT></TT>
</BLOCKQUOTE>
<UL>
<LI><FONT COLOR=#000000>For your system's generic shell:</FONT>
</UL>
<P>
<TT><FONT FACE="Courier">startsh='#!/bin/bash'</FONT></TT>
<P>
Some compilers will not compile or optimize the larger files without
some extra switches for using larger jump offsets or allocating
larger internal tables.
<P>
Perl without any extensions is referred to as <I>Miniperl</I>.
If you run into problems while building with extensions, you should
try to build Miniperl. If you can successfully build Miniperl
but the process crashes during the building of extensions, you
need to get the later versions of the extensions. In such an event,
get a completely new package and try to avoid doing piecemeal
patches, unless you know what you are doing-in which case you
should not even be reading this chapter ;-) .
<P>
Machines with incomplete <TT><FONT FACE="Courier">dbm</FONT></TT>
routines (specifically the <TT><FONT FACE="Courier">dbm_open()</FONT></TT>
function) will need to set the <TT><FONT FACE="Courier">#undef
I_ODBM</FONT></TT> preprocessor directive. For duplicate reference
error messages when linking files that call <TT><FONT FACE="Courier">malloc</FONT></TT>,
try the <TT><FONT FACE="Courier">-DHIDEMYMALLOC</FONT></TT> switch.
Both of these problems did <I>not</I> disappear on my Linux machine
until I upgraded the entire system and kernel to ELF. I did not
have to use <TT><FONT FACE="Courier">I_ODBM</FONT></TT> or the
<TT><FONT FACE="Courier">-DHIDEMYMALLOC</FONT></TT> flag after
the upgrade.
<H3><A NAME="WhatArehintsFiles"><B>What Are </B><TT><B><FONT SIZE=4 FACE="Courier">hints</FONT></B></TT><B><FONT SIZE=4>
Files?</FONT></B></A></H3>
<P>
In the Perl distribution, you'll find a <TT><FONT FACE="Courier">./hints</FONT></TT>
subdirectory. The <TT><FONT FACE="Courier">./hints</FONT></TT>
subdirectory is where platform-specific declarations are kept.
The files here are used by <TT><FONT FACE="Courier">Configure</FONT></TT>
to set things that <TT><FONT FACE="Courier">Configure</FONT></TT>
either cannot or does not guess properly. You may have to edit
these files for special versions of your computer operating system.
<P>
Generally, you should not have to use the <TT><FONT FACE="Courier">hints</FONT></TT>
file if you are using a UNIX-like operating system. Check the
contents of this directory to see whether your system is listed
and whether Perl works correctly with it. Check the <TT><FONT FACE="Courier">README.hints</FONT></TT>
file for a list of those systems for which Perl has been tested.
<P>
A sample listing of the <TT><FONT FACE="Courier">linux.sh</FONT></TT>
file is shown in Listing 24.2.
<HR>
<BLOCKQUOTE>
<B>Listing 24.2. The </B><TT><B><FONT FACE="Courier">linux.sh</FONT></B></TT><B>
</B><TT><B><FONT FACE="Courier">hints</FONT></B></TT><B> file.
<BR>
</B>
</BLOCKQUOTE>
<BLOCKQUOTE>
<TT><FONT FACE="Courier"> 1 # hints/linux.sh<BR>
2 # Original version by rsanders<BR>
3 # Additional support by Kenneth Albanowski <kjahds@kjahds.com>
<BR>
4 #<BR>
5 # ELF support by H.J. Lu <hjl@nynexst.com>
<BR>
6 # Additional info from Nigel Head <nhead@ESOC.bitnet>
<BR>
7 # and Kenneth Albanowski <kjahds@kjahds.com>
<BR>
8 #<BR>
9 # Consolidated by Andy Dougherty <doughera@lafcol.lafayette.edu>
<BR>
10 #<BR>
11 # Last updated Tue May 30 14:25:02 EDT 1995<BR>
12 #<BR>
13 # If you wish to use something other than 'gcc' for your
compiler,<BR>
14 # you should specify it on the Configure command line. To
use<BR>
15 # gcc-elf, for exmample, type<BR>
16 # ./Configure -Dcc=gcc-elf<BR>
17<BR>
18 # perl goes into the /usr tree. See the Filesystem
Standard<BR>
19 # available via anonymous FTP at tsx-11.mit.edu in<BR>
20 # /pub/linux/docs/linux-standards/fsstnd.<BR>
21 # Allow a command line override, e.g. Configure -Dprefix=/foo/bar
<BR>
22 case "$prefix" in<BR>
23 '') prefix='/usr' ;;<BR>
24 esac<BR>
25<BR>
26 # Perl expects BSD style signal handling.<BR>
27 # gcc-2.6.3 defines _G_HAVE_BOOL to 1, but doesn't actually
supply bool.<BR>
28 ccflags="-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL
$ccflags"<BR>
29<BR>
30 # The following functions are gcc built-ins, but the
Configure tests<BR>
31 # may fail because they don't supply proper prototypes.
<BR>
32 # This should be fixed as of 5.001f. I'd appreciate
reports.<BR>
33 d_memcmp=define<BR>
34 d_memcpy=define<BR>
35<BR>
36 # Configure may fail to find lstat() because it's a static/inline
<BR>
37 # function in <sys/stat.h>.<BR>
38 d_lstat=define<BR>
39<BR>
40 # Explanation?<BR>
41 d_dosuid='define'<BR>
42<BR>
43 # I think Configure gets this right now, but I'd appreciate
reports.<BR>
44 malloctype='void *'<BR>
45<BR>
46 # Explanation?<BR>
47 usemymalloc='n'<BR>
48<BR>
49 case "$optimize" in<BR>
50 '') optimize='-O2' ;;<BR>
51 esac<BR>
52<BR>
53 # Are we using ELF? Thanks to Kenneth Albanowski
<kjahds@kjahds.com><BR>
54 # for this test.<BR>
55 cat >try.c <<'EOM'<BR>
56 /* Test for whether ELF binaries are produced */<BR>
57 #include <fcntl.h><BR>
58 #include <stdlib.h><BR>
59 main() {<BR>
60 char
buffer[4];<BR>
61 int
i=open("a.out",O_RDONLY);<BR>
62 if(i==-1)
<BR>
63 exit(1);
/* fail */<BR>
64 if(read(i,&buffer[0],4)<4)
<BR>
65 exit(1);
/* fail */<BR>
66 if(buffer[0]
!= 127 || buffer[1] != 'E' ||<BR>
67 buffer[2]
!= 'L' || buffer[3] != 'F')<BR>
68 exit(1);
/* fail */<BR>
69 exit(0);
/* succeed (yes, it's ELF) */<BR>
70 }<BR>
71 EOM<BR>
72 if ${cc:-gcc} try.c >/dev/null 2>&1 &&
./a.out; then<BR>
73 cat <<'EOM'<BR>
74<BR>
75 You appear to have ELF support. I'll try to
use it for dynamic loading.<BR>
76 EOM<BR>
77 else<BR>
78 cat <<'EOM'<BR>
79<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -