This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure: eliminate some left over debug output
[metaconfig.git] / U / perl / libperl.U
CommitLineData
959f3c4c
JH
1?RCS: $Id: libperl.U,v $
2?RCS:
3?RCS: Copyright (c) 1996-1998, Andy Dougherty
4?RCS:
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.
7?RCS:
8?MAKE:libperl useshrplib shrpenv ldlibpthname: \
9 Myread Oldconfig archlibexp awk cat libc \
10 _a osname osvers so patchlevel subversion usedl ld \
ce87fced 11 ccdlflags installarchlib userelocatableinc
959f3c4c
JH
12?MAKE: -pick wipe $@ %<
13?S:libperl:
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
19?S: library.
20?S:.
21?S:useshrplib:
472f992b
MB
22?S: This variable is set to 'true' if the user wishes
23?S: to build a shared libperl, and 'false' otherwise.
959f3c4c
JH
24?S:.
25?S:shrpenv:
26?S: If the user builds a shared libperl.so, then we need to tell the
2f125bce 27?S: 'perl' executable where it will be able to find the installed libperl.so.
959f3c4c
JH
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"
34?S: or
35?S: shrpenv=''
36?S: See the main perl Makefile.SH for actual working usage.
5e4145e4
MBT
37?S:
38?S: Alternatively, we might be able to use a command line option such
4d5de5cd 39?S: as -R $archlibexp/CORE (Solaris) or -Wl,-rpath
959f3c4c
JH
40?S: $archlibexp/CORE (Linux).
41?S:.
42?S:ldlibpthname:
43?S: This variable holds the name of the shared library
44?S: search path, often LD_LIBRARY_PATH. To get an empty
45?S: string, the hints file must set this to 'none'.
46?S:.
47?T:shrpdir majonly majmin also xxx tmp_shrpenv
48?X: metalint gets confused and thinks we're actually setting LDOPTS
49?X: and LD_RUN_PATH.
50?LINT:extern LDOPTS
51?LINT:change LDOPTS
52?LINT:extern LD_RUN_PATH
53?LINT:change LD_RUN_PATH
54?LINT:change ccdlflags
55?LINT:extern maintloc maintname
56?Y:top
d9c563cf 57: Do we want a shared libperl?
959f3c4c
JH
58also=''
59case "$usedl" in
60$undef)
61 # No dynamic loading being used, so don't bother even to prompt.
62 useshrplib='false'
63 ;;
64*) case "$useshrplib" in
65 '') case "$osname" in
a3c22f16 66 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
959f3c4c
JH
67 dflt=y
68 also='Building a shared libperl is required for dynamic loading to work on your system.'
69 ;;
959f3c4c
JH
70 *) dflt=n
71 ;;
72 esac
73 ;;
74 $define|true|[Yy]*)
75 dflt=y
76 ;;
77 *) dflt=n
78 ;;
79 esac
80 $cat << EOM
81
82The perl executable is normally obtained by linking perlmain.c with
83libperl${_a}, any static extensions (usually just DynaLoader), and
84any other libraries needed on this system (such as -lm, etc.). Since
85your system supports dynamic loading, it is probably possible to build
86a shared libperl.$so. If you will have more than one executable linked
87to libperl.$so, this will significantly reduce the size of each
fc0fa78a 88executable, but it may have a noticeable effect on performance. The
959f3c4c
JH
89default is probably sensible for your system.
90$also
91
92EOM
93 rp="Build a shared libperl.$so (y/n)"
94 . ./myread
95 case "$ans" in
96 true|$define|[Yy]*)
97 useshrplib='true' ;;
98 *) useshrplib='false' ;;
99 esac
100 ;;
101esac
102
103case "$useshrplib" in
104true)
ce87fced
MB
105 case "$userelocatableinc" in
106 true|define)
107 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
108 echo "See INSTALL for an explanation why that won't work." >&4
109 exit 4
110 ;;
111 esac
959f3c4c
JH
112 case "$libperl" in
113 '')
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.
117 #
cfba7844 118 # A name such as libperl.so.10.1
959f3c4c 119 majmin="libperl.$so.$patchlevel.$subversion"
cfba7844 120 # A name such as libperl.so.100
959f3c4c
JH
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
9c11722e 127 *linux*|gnu*) # ld won't link with a bare -lperl otherwise.
959f3c4c
JH
128 dflt=libperl.$so
129 ;;
cfba7844
RU
130 cygwin*) # ld links now against the dll directly
131 majmin="cygperl5_${patchlevel}_${subversion}.${so}"
132 majonly=`echo $patchlevel $subversion |
133 $awk '{printf "%03d%03d", $1, $2}'`
134 majonly=cygperl5.$majonly.$so
135 dflt=$majmin
edd6115f 136 ;;
959f3c4c
JH
137 *) # Try to guess based on whether libc has major.minor.
138 case "$libc" in
139 *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
140 *libc.$so.[0-9]*) dflt=$majonly ;;
141 *) dflt=libperl.$so ;;
142 esac
143 ;;
144 esac
145 ;;
146 *) dflt=$libperl
147 ;;
148 esac
149 cat << EOM
150
151I need to select a good name for the shared libperl. If your system uses
152library names with major and minor numbers, then you might want something
153like $majmin. Alternatively, if your system uses a single version
154number for shared libraries, then you might want to use $majonly.
155Or, your system might be quite happy with a simple libperl.$so.
156
157Since the shared libperl will get installed into a version-specific
158architecture-dependent directory, the version number of the shared perl
159library probably isn't important, so the default should be o.k.
160
161EOM
162 rp='What name do you want to give to the shared libperl?'
163 . ./myread
164 libperl=$ans
165 echo "Ok, I'll use $libperl"
166 ;;
167*)
168 libperl="libperl${_a}"
169 ;;
170esac
171
172# Detect old use of shrpdir via undocumented Configure -Dshrpdir
173case "$shrpdir" in
174'') ;;
175*) $cat >&4 <<EOM
176WARNING: Use of the shrpdir variable for the installation location of
177the shared $libperl is not supported. It was never documented and
178will not work in this version. Let me (<$maintloc>)
179know of any problems this may cause.
180
181EOM
182 case "$shrpdir" in
183 "$archlibexp/CORE")
184 $cat >&4 <<EOM
185But your current setting of $shrpdir is
186the default anyway, so it's harmless.
187EOM
188 ;;
189 *)
190 $cat >&4 <<EOM
191Further, your current attempted setting of $shrpdir
192conflicts with the value of $archlibexp/CORE
193that installperl will use.
194EOM
195 ;;
196 esac
197 ;;
198esac
199
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.
204shrpdir=$archlibexp/CORE
205xxx=''
206tmp_shrpenv=''
207if "$useshrplib"; then
2f125bce 208 case "$osname" in
959f3c4c
JH
209 aix)
210 # We'll set it in Makefile.SH...
211 ;;
4d5de5cd 212 solaris)
959f3c4c
JH
213 xxx="-R $shrpdir"
214 ;;
7d0a57a8 215 freebsd|minix|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
959f3c4c
JH
216 xxx="-Wl,-R$shrpdir"
217 ;;
9374e729 218 bsdos|linux|irix*|dec_osf|gnu*|haiku)
959f3c4c
JH
219 xxx="-Wl,-rpath,$shrpdir"
220 ;;
959f3c4c
JH
221 hpux*)
222 # hpux doesn't like the default, either.
223 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
224 ;;
cfba7844
RU
225 cygwin)
226 # cygwin needs only ldlibpth
227 ;;
959f3c4c
JH
228 *)
229 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
230 ;;
231 esac
232 case "$xxx" in
233 '') ;;
2f125bce 234 *)
959f3c4c
JH
235 # Only add $xxx if it isn't already in ccdlflags.
236 case " $ccdlflags " in
237 *" $xxx "*) ;;
238 *) ccdlflags="$ccdlflags $xxx"
239 cat <<EOM >&4
240
241Adding $xxx to the flags
2f125bce 242passed to $ld so that the perl executable will find the
959f3c4c
JH
243installed shared $libperl.
244
245EOM
246 ;;
247 esac
248 ;;
249 esac
250fi
251# Fix ccdlflags in AIX for building external extensions.
252# (For building Perl itself bare -bE:perl.exp is needed,
253# Makefile.SH takes care of this.)
254case "$osname" in
255aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
256esac
257# Respect a hint or command-line value.
258case "$shrpenv" in
259'') shrpenv="$tmp_shrpenv" ;;
260esac
261case "$ldlibpthname" in
262'') ldlibpthname=LD_LIBRARY_PATH ;;
263none) ldlibpthname='' ;;
264esac
265