1 ?RCS: $Id: libperl.U,v $
3 ?RCS: Copyright (c) 1996-1998, Andy Dougherty
5 ?RCS: You may distribute under the terms of either the GNU General Public
6 ?RCS: License or the Artistic License, as specified in the README file.
8 ?MAKE:libperl useshrplib shrpenv ldlibpthname: \
9 Myread Oldconfig archlibexp awk cat libc \
10 _a osname osvers so patchlevel subversion usedl ld \
11 version lib_ext ccdlflags installarchlib
12 ?MAKE: -pick wipe $@ %<
14 ?S: The perl executable is obtained by linking perlmain.c with
15 ?S: libperl, any static extensions (usually just DynaLoader),
16 ?S: and any other libraries needed on this system. libperl
17 ?S: is usually libperl.a, but can also be libperl.so.xxx if
18 ?S: the user wishes to build a perl executable with a shared
22 ?S: This variable is set to 'yes' if the user wishes
23 ?S: to build a shared libperl, and 'no' otherwise.
26 ?S: If the user builds a shared libperl.so, then we need to tell the
27 ?S: 'perl' executable where it will be able to find the installed libperl.so.
28 ?S: One way to do this on some systems is to set the environment variable
29 ?S: LD_RUN_PATH to the directory that will be the final location of the
30 ?S: shared libperl.so. The makefile can use this with something like
31 ?S: $shrpenv $(CC) -o perl perlmain.o $libperl $libs
32 ?S: Typical values are
33 ?S: shrpenv="env LD_RUN_PATH=$archlibexp/CORE"
36 ?S: See the main perl Makefile.SH for actual working usage.
37 ?S: Alternatively, we might be able to use a command line option such
38 ?S: as -R $archlibexp/CORE (Solaris, NetBSD) or -Wl,-rpath
39 ?S: $archlibexp/CORE (Linux).
42 ?S: This variable holds the name of the shared library
43 ?S: search path, often LD_LIBRARY_PATH. To get an empty
44 ?S: string, the hints file must set this to 'none'.
46 ?T:shrpdir majonly majmin also xxx tmp_shrpenv
47 ?X: metalint gets confused and thinks we're actually setting LDOPTS
51 ?LINT:extern LD_RUN_PATH
52 ?LINT:change LD_RUN_PATH
53 ?LINT:change ccdlflags
54 ?LINT:extern maintloc maintname
59 # No dynamic loading being used, so don't bother even to prompt.
62 *) case "$useshrplib" in
64 svr4*|dgux|dynixptx|esix|powerux|beos|cygwin*)
66 also='Building a shared libperl is required for dynamic loading to work on your system.'
71 also='Building a shared libperl is needed for MAB support.'
89 The perl executable is normally obtained by linking perlmain.c with
90 libperl${_a}, any static extensions (usually just DynaLoader), and
91 any other libraries needed on this system (such as -lm, etc.). Since
92 your system supports dynamic loading, it is probably possible to build
93 a shared libperl.$so. If you will have more than one executable linked
94 to libperl.$so, this will significantly reduce the size of each
95 executable, but it may have a noticeable affect on performance. The
96 default is probably sensible for your system.
100 rp="Build a shared libperl.$so (y/n)"
105 *) useshrplib='false' ;;
110 case "$useshrplib" in
114 # Figure out a good name for libperl.so. Since it gets stored in
115 # a version-specific architecture-dependent library, the version
116 # number isn't really that important, except for making cc/ld happy.
118 # A name such as libperl.so.3.1
119 majmin="libperl.$so.$patchlevel.$subversion"
120 # A name such as libperl.so.301
121 majonly=`echo $patchlevel $subversion |
122 $awk '{printf "%d%02d", $1, $2}'`
123 majonly=libperl.$so.$majonly
124 # I'd prefer to keep the os-specific stuff here to a minimum, and
125 # rely on figuring it out from the naming of libc.
126 case "${osname}${osvers}" in
129 # XXX How handle the --version stuff for MAB?
131 linux*) # ld won't link with a bare -lperl otherwise.
134 cygwin*) # include version
135 dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
137 *) # Try to guess based on whether libc has major.minor.
139 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
140 *libc.$so.[0-9]*) dflt=$majonly ;;
141 *) dflt=libperl.$so ;;
151 I need to select a good name for the shared libperl. If your system uses
152 library names with major and minor numbers, then you might want something
153 like $majmin. Alternatively, if your system uses a single version
154 number for shared libraries, then you might want to use $majonly.
155 Or, your system might be quite happy with a simple libperl.$so.
157 Since the shared libperl will get installed into a version-specific
158 architecture-dependent directory, the version number of the shared perl
159 library probably isn't important, so the default should be o.k.
162 rp='What name do you want to give to the shared libperl?'
165 echo "Ok, I'll use $libperl"
168 libperl="libperl${_a}"
172 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
176 WARNING: Use of the shrpdir variable for the installation location of
177 the shared $libperl is not supported. It was never documented and
178 will not work in this version. Let me (<$maintloc>)
179 know of any problems this may cause.
185 But your current setting of $shrpdir is
186 the default anyway, so it's harmless.
191 Further, your current attempted setting of $shrpdir
192 conflicts with the value of $archlibexp/CORE
193 that installperl will use.
200 # How will the perl executable find the installed shared $libperl?
201 # Add $xxx to ccdlflags.
202 # If we can't figure out a command-line option, use $shrpenv to
203 # set env LD_RUN_PATH. The main perl makefile uses this.
204 shrpdir=$archlibexp/CORE
207 if "$useshrplib"; then
210 # We'll set it in Makefile.SH...
219 xxx="-Wl,-rpath,$shrpdir"
222 # next doesn't like the default...
225 # beos doesn't like the default, either.
228 # hpux doesn't like the default, either.
229 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
232 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
238 # Only add $xxx if it isn't already in ccdlflags.
239 case " $ccdlflags " in
241 *) ccdlflags="$ccdlflags $xxx"
244 Adding $xxx to the flags
245 passed to $ld so that the perl executable will find the
246 installed shared $libperl.
254 # Fix ccdlflags in AIX for building external extensions.
255 # (For building Perl itself bare -bE:perl.exp is needed,
256 # Makefile.SH takes care of this.)
258 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
260 # Respect a hint or command-line value.
262 '') shrpenv="$tmp_shrpenv" ;;
264 case "$ldlibpthname" in
265 '') ldlibpthname=LD_LIBRARY_PATH ;;
266 none) ldlibpthname='' ;;