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

📄 ch24.htm

📁 《Perl 5 Unreleased》
💻 HTM
📖 第 1 页 / 共 5 页
字号:
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' &amp; 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">&nbsp;&nbsp;1 # hints/linux.sh<BR>

&nbsp;&nbsp;2 # Original version by rsanders<BR>

&nbsp;&nbsp;3 # Additional support by Kenneth Albanowski &lt;kjahds@kjahds.com&gt;

<BR>

&nbsp;&nbsp;4 #<BR>

&nbsp;&nbsp;5 # ELF support by H.J. Lu &lt;hjl@nynexst.com&gt;

<BR>

&nbsp;&nbsp;6 # Additional info from Nigel Head &lt;nhead@ESOC.bitnet&gt;

<BR>

&nbsp;&nbsp;7 # and Kenneth Albanowski &lt;kjahds@kjahds.com&gt;

<BR>

&nbsp;&nbsp;8 #<BR>

&nbsp;&nbsp;9 # Consolidated by Andy Dougherty &lt;doughera@lafcol.lafayette.edu&gt;

<BR>

&nbsp;10 #<BR>

&nbsp;11 # Last updated Tue May 30 14:25:02 EDT 1995<BR>

&nbsp;12 #<BR>

&nbsp;13 # If you wish to use something other than 'gcc' for your

compiler,<BR>

&nbsp;14 # you should specify it on the Configure command line.&nbsp;&nbsp;To

use<BR>

&nbsp;15 # gcc-elf, for exmample, type<BR>

&nbsp;16 # ./Configure -Dcc=gcc-elf<BR>

&nbsp;17<BR>

&nbsp;18 # perl goes into the /usr tree.&nbsp;&nbsp;See the Filesystem

Standard<BR>

&nbsp;19 # available via anonymous FTP at tsx-11.mit.edu in<BR>

&nbsp;20 # /pub/linux/docs/linux-standards/fsstnd.<BR>

&nbsp;21 # Allow a command line override, e.g. Configure -Dprefix=/foo/bar

<BR>

&nbsp;22 case &quot;$prefix&quot; in<BR>

&nbsp;23 '') prefix='/usr' ;;<BR>

&nbsp;24 esac<BR>

&nbsp;25<BR>

&nbsp;26 # Perl expects BSD style signal handling.<BR>

&nbsp;27 # gcc-2.6.3 defines _G_HAVE_BOOL to 1, but doesn't actually

supply bool.<BR>

&nbsp;28 ccflags=&quot;-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL

$ccflags&quot;<BR>

&nbsp;29<BR>

&nbsp;30 # The following functions are gcc built-ins, but the

Configure tests<BR>

&nbsp;31 # may fail because they don't supply proper prototypes.

<BR>

&nbsp;32 # This should be fixed as of 5.001f.&nbsp;&nbsp;I'd appreciate

reports.<BR>

&nbsp;33 d_memcmp=define<BR>

&nbsp;34 d_memcpy=define<BR>

&nbsp;35<BR>

&nbsp;36 # Configure may fail to find lstat() because it's a static/inline

<BR>

&nbsp;37 # function in &lt;sys/stat.h&gt;.<BR>

&nbsp;38 d_lstat=define<BR>

&nbsp;39<BR>

&nbsp;40 # Explanation?<BR>

&nbsp;41 d_dosuid='define'<BR>

&nbsp;42<BR>

&nbsp;43 # I think Configure gets this right now, but I'd appreciate

reports.<BR>

&nbsp;44 malloctype='void *'<BR>

&nbsp;45<BR>

&nbsp;46 # Explanation?<BR>

&nbsp;47 usemymalloc='n'<BR>

&nbsp;48<BR>

&nbsp;49 case &quot;$optimize&quot; in<BR>

&nbsp;50 '') optimize='-O2' ;;<BR>

&nbsp;51 esac<BR>

&nbsp;52<BR>

&nbsp;53 # Are we using ELF?&nbsp;&nbsp;Thanks to Kenneth Albanowski

&lt;kjahds@kjahds.com&gt;<BR>

&nbsp;54 # for this test.<BR>

&nbsp;55 cat &gt;try.c &lt;&lt;'EOM'<BR>

&nbsp;56 /* Test for whether ELF binaries are produced */<BR>

&nbsp;57 #include &lt;fcntl.h&gt;<BR>

&nbsp;58 #include &lt;stdlib.h&gt;<BR>

&nbsp;59 main() {<BR>

&nbsp;60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char

buffer[4];<BR>

&nbsp;61&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int

i=open(&quot;a.out&quot;,O_RDONLY);<BR>

&nbsp;62&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(i==-1)

<BR>

&nbsp;63&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(1);

/* fail */<BR>

&nbsp;64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(read(i,&amp;buffer[0],4)&lt;4)

<BR>

&nbsp;65&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(1);

/* fail */<BR>

&nbsp;66&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(buffer[0]

!= 127 || buffer[1] != 'E' ||<BR>

&nbsp;67&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer[2]

!= 'L' || buffer[3] != 'F')<BR>

&nbsp;68&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(1);

/* fail */<BR>

&nbsp;69&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(0);

/* succeed (yes, it's ELF) */<BR>

&nbsp;70 }<BR>

&nbsp;71 EOM<BR>

&nbsp;72 if ${cc:-gcc} try.c &gt;/dev/null 2&gt;&amp;1 &amp;&amp;

./a.out; then<BR>

&nbsp;73&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cat &lt;&lt;'EOM'<BR>

&nbsp;74<BR>

&nbsp;75 You appear to have ELF support.&nbsp;&nbsp;I'll try to

use it for dynamic loading.<BR>

&nbsp;76 EOM<BR>

&nbsp;77 else<BR>

&nbsp;78&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cat &lt;&lt;'EOM'<BR>

&nbsp;79<BR>

⌨️ 快捷键说明

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