home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_92dec31f64df4f4a043384ba2ae9f77d
< prev
next >
Wrap
Text File
|
2000-03-23
|
12KB
|
265 lines
<HTML>
<HEAD>
<TITLE>ExtUtils::Liblist - determine libraries to use and how to use them</TITLE>
<LINK REL="stylesheet" HREF="../../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> ExtUtils::Liblist - determine libraries to use and how to use them</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<UL>
<LI><A HREF="#extralibs">EXTRALIBS</A></LI>
<LI><A HREF="#ldloadlibs and ld_run_path">LDLOADLIBS and LD_RUN_PATH</A></LI>
<LI><A HREF="#bsloadlibs">BSLOADLIBS</A></LI>
</UL>
<LI><A HREF="#portability">PORTABILITY</A></LI>
<UL>
<LI><A HREF="#vms implementation">VMS implementation</A></LI>
<LI><A HREF="#win32 implementation">Win32 implementation</A></LI>
</UL>
<LI><A HREF="#see also">SEE ALSO</A></LI>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>ExtUtils::Liblist - determine libraries to use and how to use them</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<P><CODE>require ExtUtils::Liblist;</CODE></P>
<P><CODE>ExtUtils::Liblist::ext($self, $potential_libs, $verbose);</CODE></P>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>This utility takes a list of libraries in the form <CODE>-llib1 -llib2
-llib3</CODE> and prints out lines suitable for inclusion in an extension
Makefile. Extra library paths may be included with the form
<CODE>-L/another/path</CODE> this will affect the searches for all subsequent
libraries.</P>
<P>It returns an array of four scalar values: EXTRALIBS, BSLOADLIBS,
LDLOADLIBS, and LD_RUN_PATH. Some of these don't mean anything
on VMS and Win32. See the details about those platform specifics
below.</P>
<P>Dependent libraries can be linked in one of three ways:</P>
<UL>
<LI><STRONG><A NAME="item_For_static_extensions">For static extensions</A></STRONG><BR>
by the ld command when the perl binary is linked with the extension
library. See EXTRALIBS below.
<P></P>
<LI><STRONG><A NAME="item_For_dynamic_extensions">For dynamic extensions</A></STRONG><BR>
by the ld command when the shared object is built/linked. See
LDLOADLIBS below.
<P></P>
<LI><STRONG>For dynamic extensions</STRONG><BR>
by the DynaLoader when the shared object is loaded. See BSLOADLIBS
below.
<P></P></UL>
<P>
<H2><A NAME="extralibs">EXTRALIBS</A></H2>
<P>List of libraries that need to be linked with when linking a perl
binary which includes this extension. Only those libraries that
actually exist are included. These are written to a file and used
when linking perl.</P>
<P>
<H2><A NAME="ldloadlibs and ld_run_path">LDLOADLIBS and LD_RUN_PATH</A></H2>
<P>List of those libraries which can or must be linked into the shared
library when created using ld. These may be static or dynamic
libraries. LD_RUN_PATH is a colon separated list of the directories
in LDLOADLIBS. It is passed as an environment variable to the process
that links the shared library.</P>
<P>
<H2><A NAME="bsloadlibs">BSLOADLIBS</A></H2>
<P>List of those libraries that are needed but can be linked in
dynamically at run time on this platform. SunOS/Solaris does not need
this because ld records the information (from LDLOADLIBS) into the
object file. This list is used to create a .bs (bootstrap) file.</P>
<P>
<HR>
<H1><A NAME="portability">PORTABILITY</A></H1>
<P>This module deals with a lot of system dependencies and has quite a
few architecture specific <CODE>if</CODE>s in the code.</P>
<P>
<H2><A NAME="vms implementation">VMS implementation</A></H2>
<P>The version of <CODE>ext()</CODE> which is executed under VMS differs from the
Unix-OS/2 version in several respects:</P>
<UL>
<LI>
Input library and path specifications are accepted with or without the
<CODE>-l</CODE> and <CODE>-L</CODE> prefixes used by Unix linkers. If neither prefix is
present, a token is considered a directory to search if it is in fact
a directory, and a library to search for otherwise. Authors who wish
their extensions to be portable to Unix or OS/2 should use the Unix
prefixes, since the Unix-OS/2 version of <CODE>ext()</CODE> requires them.
<P></P>
<LI>
Wherever possible, shareable images are preferred to object libraries,
and object libraries to plain object files. In accordance with VMS
naming conventions, <CODE>ext()</CODE> looks for files named <EM>lib</EM>shr and <EM>lib</EM>rtl;
it also looks for <EM>lib</EM>lib and lib<EM>lib</EM> to accommodate Unix conventions
used in some ported software.
<P></P>
<LI>
For each library that is found, an appropriate directive for a linker options
file is generated. The return values are space-separated strings of
these directives, rather than elements used on the linker command line.
<P></P>
<LI>
LDLOADLIBS contains both the libraries found based on <CODE>$potential_libs</CODE> and
the CRTLs, if any, specified in Config.pm. EXTRALIBS contains just those
libraries found based on <CODE>$potential_libs</CODE>. BSLOADLIBS and LD_RUN_PATH
are always empty.
<P></P></UL>
<P>In addition, an attempt is made to recognize several common Unix library
names, and filter them out or convert them to their VMS equivalents, as
appropriate.</P>
<P>In general, the VMS version of <CODE>ext()</CODE> should properly handle input from
extensions originally designed for a Unix or VMS environment. If you
encounter problems, or discover cases where the search could be improved,
please let us know.</P>
<P>
<H2><A NAME="win32 implementation">Win32 implementation</A></H2>
<P>The version of <CODE>ext()</CODE> which is executed under Win32 differs from the
Unix-OS/2 version in several respects:</P>
<UL>
<LI>
If <CODE>$potential_libs</CODE> is empty, the return value will be empty.
Otherwise, the libraries specified by <CODE>$Config{libs}</CODE> (see Config.pm)
will be appended to the list of <CODE>$potential_libs</CODE>. The libraries
will be searched for in the directories specified in <CODE>$potential_libs</CODE>,
<CODE>$Config{libpth}</CODE>, and in <CODE>$Config{installarchlib}/CORE</CODE>.
For each library that is found, a space-separated list of fully qualified
library pathnames is generated.
<P></P>
<LI>
Input library and path specifications are accepted with or without the
<CODE>-l</CODE> and <CODE>-L</CODE> prefixes used by Unix linkers.
<P>An entry of the form <CODE>-La:\foo</CODE> specifies the <CODE>a:\foo</CODE> directory to look
for the libraries that follow.</P>
<P>An entry of the form <CODE>-lfoo</CODE> specifies the library <CODE>foo</CODE>, which may be
spelled differently depending on what kind of compiler you are using. If
you are using GCC, it gets translated to <CODE>libfoo.a</CODE>, but for other win32
compilers, it becomes <CODE>foo.lib</CODE>. If no files are found by those translated
names, one more attempt is made to find them using either <CODE>foo.a</CODE> or
<CODE>libfoo.lib</CODE>, depending on whether GCC or some other win32 compiler is
being used, respectively.</P>
<P>If neither the <CODE>-L</CODE> or <CODE>-l</CODE> prefix is present in an entry, the entry is
considered a directory to search if it is in fact a directory, and a
library to search for otherwise. The <CODE>$Config{lib_ext}</CODE> suffix will
be appended to any entries that are not directories and don't already have
the suffix.</P>
<P>Note that the <CODE>-L</CODE> and <CODE>-l</CODE> prefixes are <STRONG>not required</STRONG>, but authors
who wish their extensions to be portable to Unix or OS/2 should use the
prefixes, since the Unix-OS/2 version of <CODE>ext()</CODE> requires them.</P>
<P></P>
<LI>
Entries cannot be plain object files, as many Win32 compilers will
not handle object files in the place of libraries.
<P></P>
<LI>
Entries in <CODE>$potential_libs</CODE> beginning with a colon and followed by
alphanumeric characters are treated as flags. Unknown flags will be ignored.
<P>An entry that matches <CODE>/:nodefault/i</CODE> disables the appending of default
libraries found in <CODE>$Config{libs}</CODE> (this should be only needed very rarely).</P>
<P>An entry that matches <CODE>/:nosearch/i</CODE> disables all searching for
the libraries specified after it. Translation of <CODE>-Lfoo</CODE> and
<CODE>-lfoo</CODE> still happens as appropriate (depending on compiler being used,
as reflected by <CODE>$Config{cc}</CODE>), but the entries are not verified to be
valid files or directories.</P>
<P>An entry that matches <CODE>/:search/i</CODE> reenables searching for
the libraries specified after it. You can put it at the end to
enable searching for default libraries specified by <CODE>$Config{libs}</CODE>.</P>
<P></P>
<LI>
The libraries specified may be a mixture of static libraries and
import libraries (to link with DLLs). Since both kinds are used
pretty transparently on the Win32 platform, we do not attempt to
distinguish between them.
<P></P>
<LI>
LDLOADLIBS and EXTRALIBS are always identical under Win32, and BSLOADLIBS
and LD_RUN_PATH are always empty (this may change in future).
<P></P>
<LI>
You must make sure that any paths and path components are properly
surrounded with double-quotes if they contain spaces. For example,
<CODE>$potential_libs</CODE> could be (literally):
<PRE>
"-Lc:\Program Files\vc\lib" msvcrt.lib "la test\foo bar.lib"</PRE>
<P>Note how the first and last entries are protected by quotes in order
to protect the spaces.</P>
<P></P>
<LI>
Since this module is most often used only indirectly from extension
<CODE>Makefile.PL</CODE> files, here is an example <CODE>Makefile.PL</CODE> entry to add
a library to the build process for an extension:
<PRE>
LIBS => ['-lgl']</PRE>
<P>When using GCC, that entry specifies that MakeMaker should first look
for <CODE>libgl.a</CODE> (followed by <CODE>gl.a</CODE>) in all the locations specified by
<CODE>$Config{libpth}</CODE>.</P>
<P>When using a compiler other than GCC, the above entry will search for
<CODE>gl.lib</CODE> (followed by <CODE>libgl.lib</CODE>).</P>
<P>If the library happens to be in a location not in <CODE>$Config{libpth}</CODE>,
you need:</P>
<PRE>
LIBS => ['-Lc:\gllibs -lgl']</PRE>
<P>Here is a less often used example:</P>
<PRE>
LIBS => ['-lgl', ':nosearch -Ld:\mesalibs -lmesa -luser32']</PRE>
<P>This specifies a search for library <CODE>gl</CODE> as before. If that search
fails to find the library, it looks at the next item in the list. The
<CODE>:nosearch</CODE> flag will prevent searching for the libraries that follow,
so it simply returns the value as <CODE>-Ld:\mesalibs -lmesa -luser32</CODE>,
since GCC can use that value as is with its linker.</P>
<P>When using the Visual C compiler, the second item is returned as
<CODE>-libpath:d:\mesalibs mesa.lib user32.lib</CODE>.</P>
<P>When using the Borland compiler, the second item is returned as
<CODE>-Ld:\mesalibs mesa.lib user32.lib</CODE>, and MakeMaker takes care of
moving the <CODE>-Ld:\mesalibs</CODE> to the correct place in the linker
command line.</P>
<P></P></UL>
<P>
<HR>
<H1><A NAME="see also">SEE ALSO</A></H1>
<P><A HREF="../../lib/ExtUtils/MakeMaker.html">the ExtUtils::MakeMaker manpage</A></P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> ExtUtils::Liblist - determine libraries to use and how to use them</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>