Tweaks to constant.pm
[p5sagit/p5-mst-13.2.git] / INSTALL
CommitLineData
8e07c86e 1=head1 NAME
2
3Install - Build and Installation guide for perl5.
4
5=head1 SYNOPSIS
6
7f678428 7The basic steps to build and install perl5 on a Unix system are:
8e07c86e 8
9 rm -f config.sh
10 sh Configure
11 make
12 make test
13 make install
36477c24 14
aa689395 15 # You may also wish to add these:
16 (cd /usr/include && h2ph *.h sys/*.h)
17 (cd pod && make html && mv *.html <www home dir>)
18 (cd pod && make tex && <process the latex files>)
8e07c86e 19
20Each of these is explained in further detail below.
21
3fe9a6f1 22For information on non-Unix systems, see L<"Porting information"> below.
7f678428 23
1ec51d55 24For information on what's new in this release, see the pod/perldelta.pod
25file. For more detailed information about specific changes, see the
26Changes file.
c3edaffb 27
1ec51d55 28=head1 DESCRIPTION
edb1cbcb 29
c3edaffb 30This document is written in pod format as an easy way to indicate its
31structure. The pod format is described in pod/perlpod.pod, but you can
1ec51d55 32read it as is with any pager or editor. Headings and items are marked
33by lines beginning with '='. The other mark-up used is
34
35 B<text> embolden text, used for switches, programs or commands
36 C<code> literal code
37 L<name> A link (cross reference) to name
38
39You should probably at least skim through this entire document before
40proceeding.
c3edaffb 41
eed2e782 42If you're building Perl on a non-Unix system, you should also read
43the README file specific to your operating system, since this may
44provide additional or different instructions for building Perl.
45
aa689395 46=head1 Space Requirements
eed2e782 47
1ec51d55 48The complete perl5 source tree takes up about 7 MB of disk space. The
49complete tree after completing make takes roughly 15 MB, though the
50actual total is likely to be quite system-dependent. The installation
51directories need something on the order of 7 MB, though again that
52value is system-dependent.
8e07c86e 53
aa689395 54=head1 Start with a Fresh Distribution
8e07c86e 55
edb1cbcb 56If you have built perl before, you should clean out the build directory
57with the command
58
59 make realclean
c3edaffb 60
8e07c86e 61The results of a Configure run are stored in the config.sh file. If
62you are upgrading from a previous version of perl, or if you change
63systems or compilers or make other significant changes, or if you are
1ec51d55 64experiencing difficulties building perl, you should probably not
8e07c86e 65re-use your old config.sh. Simply remove it or rename it, e.g.
66
67 mv config.sh config.sh.old
4633a7c4 68
e57fd563 69If you wish to use your old config.sh, be especially attentive to the
70version and architecture-specific questions and answers. For example,
71the default directory for architecture-dependent library modules
72includes the version name. By default, Configure will reuse your old
73name (e.g. /opt/perl/lib/i86pc-solaris/5.003) even if you're running
74Configure for a different version, e.g. 5.004. Yes, Configure should
75probably check and correct for this, but it doesn't, presently.
76Similarly, if you used a shared libperl.so (see below) with version
77numbers, you will probably want to adjust them as well.
78
79Also, be careful to check your architecture name. Some Linux systems
1ec51d55 80(such as Debian) use i386, while others may use i486 or i586. If you
81pick up a precompiled binary, it might not use the same name.
e57fd563 82
83In short, if you wish to use your old config.sh, I recommend running
84Configure interactively rather than blindly accepting the defaults.
8e07c86e 85
aa689395 86=head1 Run Configure
8e07c86e 87
88Configure will figure out various things about your system. Some
89things Configure will figure out for itself, other things it will ask
1ec51d55 90you about. To accept the default, just press RETURN. The default
8e07c86e 91is almost always ok.
92
93After it runs, Configure will perform variable substitution on all the
1ec51d55 94*.SH files and offer to run make depend.
8e07c86e 95
96Configure supports a number of useful options. Run B<Configure -h>
97to get a listing. To compile with gcc, for example, you can run
98
99 sh Configure -Dcc=gcc
100
101This is the preferred way to specify gcc (or another alternative
102compiler) so that the hints files can set appropriate defaults.
103
4633a7c4 104If you want to use your old config.sh but override some of the items
105with command line options, you need to use B<Configure -O>.
106
8e07c86e 107If you are willing to accept all the defaults, and you want terse
108output, you can run
109
110 sh Configure -des
111
112By default, for most systems, perl will be installed in
113/usr/local/{bin, lib, man}. You can specify a different 'prefix' for
114the default installation directory, when Configure prompts you or by
115using the Configure command line option -Dprefix='/some/directory',
116e.g.
117
25f94b33 118 sh Configure -Dprefix=/opt/perl
4633a7c4 119
120If your prefix contains the string "perl", then the directories
121are simplified. For example, if you use prefix=/opt/perl,
122then Configure will suggest /opt/perl/lib instead of
4fdae800 123/opt/perl/lib/perl5/.
8e07c86e 124
aa689395 125By default, Configure will compile perl to use dynamic loading if
8e07c86e 126your system supports it. If you want to force perl to be compiled
56c6f531 127statically, you can either choose this when Configure prompts you or
128you can use the Configure command line option -Uusedl.
8e07c86e 129
46bb10fb 130=head2 GNU-style configure
131
1ec51d55 132If you prefer the GNU-style configure command line interface, you can
133use the supplied configure command, e.g.
46bb10fb 134
135 CC=gcc ./configure
136
1ec51d55 137The configure script emulates a few of the more common configure
46bb10fb 138options. Try
139
140 ./configure --help
141
142for a listing.
143
aa689395 144Cross compiling is not supported.
46bb10fb 145
146For systems that do not distinguish the files "Configure" and
1ec51d55 147"configure", Perl includes a copy of configure named
148configure.gnu.
46bb10fb 149
24b3df7f 150=head2 Extensions
151
edb1cbcb 152By default, Configure will offer to build every extension which appears
153to be supported. For example, Configure will offer to build GDBM_File
154only if it is able to find the gdbm library. (See examples below.)
5f05dabc 155DynaLoader, Fcntl, and IO are always built by default. Configure does
156not contain code to test for POSIX compliance, so POSIX is always built
157by default as well. If you wish to skip POSIX, you can set the
158Configure variable useposix=false either in a hint file or from the
159Configure command line. Similarly, the Opcode extension is always built
160by default, but you can skip it by setting the Configure variable
c3edaffb 161useopcode=false either in a hint file for from the command line.
24b3df7f 162
1ec51d55 163You can learn more about each of these extensions by consulting the
164documentation in the individual .pm modules, located under the
165ext/ subdirectory.
166
56c6f531 167Even if you do not have dynamic loading, you must still build the
168DynaLoader extension; you should just build the stub dl_none.xs
169version. (Configure will suggest this as the default.)
170
24b3df7f 171In summary, here are the Configure command-line variables you can set
172to turn off each extension:
173
174 DB_File i_db
56c6f531 175 DynaLoader (Must always be included as a static extension)
24b3df7f 176 Fcntl (Always included by default)
177 GDBM_File i_gdbm
9d67150a 178 IO (Always included by default)
24b3df7f 179 NDBM_File i_ndbm
180 ODBM_File i_dbm
181 POSIX useposix
182 SDBM_File (Always included by default)
c3edaffb 183 Opcode useopcode
24b3df7f 184 Socket d_socket
185
186Thus to skip the NDBM_File extension, you can use
187
188 sh Configure -Ui_ndbm
189
190Again, this is taken care of automatically if you don't have the ndbm
191library.
192
193Of course, you may always run Configure interactively and select only
aa689395 194the extensions you want.
24b3df7f 195
1ec51d55 196Note: The DB_File module will only work with version 1.x of
197Berkeley DB. Once Berkeley DB version 2 is released, DB_File will be
198upgraded to work with it. Configure will automatically detect this
199for you and refuse to try to build DB_File with version 2.
200
24b3df7f 201Finally, if you have dynamic loading (most modern Unix systems do)
202remember that these extensions do not increase the size of your perl
203executable, nor do they impact start-up time, so you probably might as
204well build all the ones that will work on your system.
205
8e07c86e 206=head2 Including locally-installed libraries
207
4633a7c4 208Perl5 comes with interfaces to number of database extensions, including
209dbm, ndbm, gdbm, and Berkeley db. For each extension, if
210Configure can find the appropriate header files and libraries, it will
211automatically include that extension. The gdbm and db libraries
1ec51d55 212are not included with perl. See the library documentation for
4633a7c4 213how to obtain the libraries.
8e07c86e 214
1ec51d55 215Note: If your database header (.h) files are not in a
8e07c86e 216directory normally searched by your C compiler, then you will need to
1ec51d55 217include the appropriate -I/your/directory option when prompted by
8e07c86e 218Configure. If your database library (.a) files are not in a directory
219normally searched by your C compiler and linker, then you will need to
1ec51d55 220include the appropriate -L/your/directory option when prompted by
8e07c86e 221Configure. See the examples below.
222
223=head2 Examples
224
225=over 4
226
aa689395 227=item gdbm in /usr/local
8e07c86e 228
229Suppose you have gdbm and want Configure to find it and build the
1ec51d55 230GDBM_File extension. This examples assumes you have gdbm.h
231installed in /usr/local/include/gdbm.h and libgdbm.a installed in
232/usr/local/lib/libgdbm.a. Configure should figure all the
8e07c86e 233necessary steps out automatically.
234
235Specifically, when Configure prompts you for flags for
1ec51d55 236your C compiler, you should include -I/usr/local/include.
8e07c86e 237
238When Configure prompts you for linker flags, you should include
1ec51d55 239-L/usr/local/lib.
8e07c86e 240
241If you are using dynamic loading, then when Configure prompts you for
242linker flags for dynamic loading, you should again include
1ec51d55 243-L/usr/local/lib.
8e07c86e 244
245Again, this should all happen automatically. If you want to accept the
246defaults for all the questions and have Configure print out only terse
247messages, then you can just run
248
249 sh Configure -des
250
251and Configure should include the GDBM_File extension automatically.
252
253This should actually work if you have gdbm installed in any of
254(/usr/local, /opt/local, /usr/gnu, /opt/gnu, /usr/GNU, or /opt/GNU).
255
256=item gdbm in /usr/you
257
258Suppose you have gdbm installed in some place other than /usr/local/,
259but you still want Configure to find it. To be specific, assume you
1ec51d55 260have /usr/you/include/gdbm.h and /usr/you/lib/libgdbm.a. You
261still have to add -I/usr/you/include to cc flags, but you have to take
262an extra step to help Configure find libgdbm.a. Specifically, when
8e07c86e 263Configure prompts you for library directories, you have to add
1ec51d55 264/usr/you/lib to the list.
8e07c86e 265
266It is possible to specify this from the command line too (all on one
267line):
268
269 sh Configure -des \
270 -Dlocincpth="/usr/you/include" \
271 -Dloclibpth="/usr/you/lib"
272
1ec51d55 273locincpth is a space-separated list of include directories to search.
274Configure will automatically add the appropriate -I directives.
8e07c86e 275
1ec51d55 276loclibpth is a space-separated list of library directories to search.
277Configure will automatically add the appropriate -L directives. If
278you have some libraries under /usr/local/ and others under
279/usr/you, then you have to include both, namely
8e07c86e 280
281 sh Configure -des \
282 -Dlocincpth="/usr/you/include /usr/local/include" \
283 -Dloclibpth="/usr/you/lib /usr/local/lib"
284
285=back
286
aa689395 287=head2 Installation Directories
4633a7c4 288
289The installation directories can all be changed by answering the
290appropriate questions in Configure. For convenience, all the
291installation questions are near the beginning of Configure.
292
1ec51d55 293It is highly recommend that you running Configure interactively
294to be sure it puts everything where you want it. At any point
295during the Configure process, you can answer a question with
296C<&-d> and Configure will use the defaults from then on.
297
4633a7c4 298By default, Configure uses the following directories for
299library files (archname is a string like sun4-sunos, determined
300by Configure)
301
46bb10fb 302 /usr/local/lib/perl5/archname/5.004
4633a7c4 303 /usr/local/lib/perl5/
24b3df7f 304 /usr/local/lib/perl5/site_perl/archname
305 /usr/local/lib/perl5/site_perl
4633a7c4 306
307and the following directories for manual pages:
308
309 /usr/local/man/man1
310 /usr/local/lib/perl5/man/man3
311
312(Actually, Configure recognizes the SVR3-style
313/usr/local/man/l_man/man1 directories, if present, and uses those
314instead.) The module man pages are stuck in that strange spot so that
315they don't collide with other man pages stored in /usr/local/man/man3,
316and so that Perl's man pages don't hide system man pages. On some
317systems, B<man less> would end up calling up Perl's less.pm module man
1ec51d55 318page, rather than the less program. (This location may change in a
319future release of perl.)
320
321Note: Many users prefer to store the module man pages in
322/usr/local/man/man3. You can do this from the command line with
323
324 sh Configure -Dman3dir=/usr/local/man/man3
325
326Some users also prefer to use a .3pm suffix. You can do that with
327
328 sh Configure -Dman3ext=3pm
4633a7c4 329
330If you specify a prefix that contains the string "perl", then the
aa689395 331directory structure is simplified. For example, if you Configure with
332-Dprefix=/opt/perl, then the defaults are
4633a7c4 333
46bb10fb 334 /opt/perl/lib/archname/5.004
4633a7c4 335 /opt/perl/lib
336 /opt/perl/lib/site_perl/archname
337 /opt/perl/lib/site_perl
338
339 /opt/perl/man/man1
340 /opt/perl/man/man3
341
342The perl executable will search the libraries in the order given
343above.
344
345The directories site_perl and site_perl/archname are empty, but are
346intended to be used for installing local or site-wide extensions. Perl
347will automatically look in these directories. Previously, most sites
348just put their local extensions in with the standard distribution.
349
46bb10fb 350In order to support using things like #!/usr/local/bin/perl5.004 after
4633a7c4 351a later version is released, architecture-dependent libraries are
352stored in a version-specific directory, such as
46bb10fb 353/usr/local/lib/perl5/archname/5.004/. In Perl 5.000 and 5.001, these
a6006777 354files were just stored in /usr/local/lib/perl5/archname/. If you will
355not be using 5.001 binaries, you can delete the standard extensions from
356the /usr/local/lib/perl5/archname/ directory. Locally-added extensions
357can be moved to the site_perl and site_perl/archname directories.
4633a7c4 358
359Again, these are just the defaults, and can be changed as you run
360Configure.
361
aa689395 362=head2 Changing the installation directory
363
364Configure distinguishes between the directory in which perl (and its
365associated files) should be installed and the directory in which it
366will eventually reside. For most sites, these two are the same; for
367sites that use AFS, this distinction is handled automatically.
1ec51d55 368However, sites that use software such as depot to manage software
aa689395 369packages may also wish to install perl into a different directory and
370use that management software to move perl to its final destination.
371This section describes how to do this. Someday, Configure may support
372an option -Dinstallprefix=/foo to simplify this.
373
1ec51d55 374Suppose you want to install perl under the /tmp/perl5 directory.
375You can edit config.sh and change all the install* variables to
376point to /tmp/perl5 instead of /usr/local/wherever. You could
aa689395 377also set them all from the Configure command line. Or, you can
378automate this process by placing the following lines in a file
1ec51d55 379config.over before you run Configure (replace /tmp/perl5 by a
aa689395 380directory of your choice):
381
382 installprefix=/tmp/perl5
383 test -d $installprefix || mkdir $installprefix
384 test -d $installprefix/bin || mkdir $installprefix/bin
385 installarchlib=`echo $installarchlib | sed "s!$prefix!$installprefix!"`
386 installbin=`echo $installbin | sed "s!$prefix!$installprefix!"`
387 installman1dir=`echo $installman1dir | sed "s!$prefix!$installprefix!"`
388 installman3dir=`echo $installman3dir | sed "s!$prefix!$installprefix!"`
389 installprivlib=`echo $installprivlib | sed "s!$prefix!$installprefix!"`
390 installscript=`echo $installscript | sed "s!$prefix!$installprefix!"`
391 installsitelib=`echo $installsitelib | sed "s!$prefix!$installprefix!"`
392 installsitearch=`echo $installsitearch | sed "s!$prefix!$installprefix!"`
393
394Then, you can Configure and install in the usual way:
395
396 sh Configure -des
397 make
398 make test
399 make install
400
401=head2 Creating an installable tar archive
402
403If you need to install perl on many identical systems, it is
404convenient to compile it once and create an archive that can be
405installed on multiple systems. Here's one way to do that:
406
407 # Set up config.over to install perl into a different directory,
408 # e.g. /tmp/perl5 (see previous part).
409 sh Configure -des
410 make
411 make test
412 make install
413 cd /tmp/perl5
414 tar cvf ../perl5-archive.tar .
415 # Then, on each machine where you want to install perl,
416 cd /usr/local # Or wherever you specified as $prefix
417 tar xvf perl5-archive.tar
418
419=head2 Configure-time Options
420
421There are several different ways to Configure and build perl for your
422system. For most users, the defaults are sensible and will work.
423Some users, however, may wish to further customize perl. Here are
424some of the main things you can change.
425
426=head2 Binary Compatibility With Earlier Versions of Perl 5
427
428If you have dynamically loaded extensions that you built under
429perl 5.003 and that you wish to continue to use with perl 5.004, then you
430need to ensure that 5.004 remains binary compatible with 5.003.
431
432Starting with Perl 5.003, all functions in the Perl C source code have
433been protected by default by the prefix Perl_ (or perl_) so that you
434may link with third-party libraries without fear of namespace
435collisions. This change broke compatibility with version 5.002, so
436installing 5.003 or 5.004 over 5.002 or earlier will force you to
437re-build and install all of your dynamically loadable extensions.
438(The standard extensions supplied with Perl are handled
439automatically). You can turn off this namespace protection by adding
440-DNO_EMBED to your ccflags variable in config.sh.
441
442Perl 5.003's namespace protection was incomplete, but this has
443been fixed in 5.004. However, some sites may need to maintain
444complete binary compatibility with Perl 5.003. If you are building
1ec51d55 445Perl for such a site, then when Configure asks if you want binary
aa689395 446compatibility, answer "y".
447
448On the other hand, if you are embedding perl into another application
449and want the maximum namespace protection, then you probably ought to
1ec51d55 450answer "n" when Configure asks if you want binary compatibility.
aa689395 451
452The default answer of "y" to maintain binary compatibility is probably
453appropriate for almost everyone.
454
1ec51d55 455In a related issue, old extensions may possibly be affected by the changes
456in the Perl language in the current release. Please see pod/perldelta for
3fe9a6f1 457a description of what's changed.
458
46bb10fb 459=head2 Selecting File IO mechanisms
460
461Previous versions of perl used the standard IO mechanisms as defined in
1ec51d55 462stdio.h. Versions 5.003_02 and later of perl allow alternate IO
46bb10fb 463mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
464the default and is the only supported mechanism.
465
466This PerlIO abstraction can be enabled either on the Configure command
467line with
468
469 sh Configure -Duseperlio
470
471or interactively at the appropriate Configure prompt.
472
473If you choose to use the PerlIO abstraction layer, there are two
474(experimental) possibilities for the underlying IO calls. These have been
475tested to some extent on some platforms, but are not guaranteed to work
476everywhere.
477
478=over 4
479
480=item 1.
481
1ec51d55 482AT&T's "sfio". This has superior performance to stdio.h in many
aa689395 483cases, and is extensible by the use of "discipline" modules. Sfio
46bb10fb 484currently only builds on a subset of the UNIX platforms perl supports.
485Because the data structures are completely different from stdio, perl
486extension modules or external libraries may not work. This
487configuration exists to allow these issues to be worked on.
488
489This option requires the 'sfio' package to have been built and installed.
490A (fairly old) version of sfio is in CPAN, and work is in progress to make
491it more easily buildable by adding Configure support.
492
493You select this option by
494
495 sh Configure -Duseperlio -Dusesfio
496
497If you have already selected -Duseperlio, and if Configure detects
498that you have sfio, then sfio will be the default suggested by
499Configure.
500
1ec51d55 501Note: On some systems, sfio's iffe configuration script fails
502to detect that you have an atexit function (or equivalent).
33e6ee5f 503Apparently, this is a problem at least for some versions of Linux
504and SunOS 4.
505
506You can test if you have this problem by trying the following shell
507script. (You may have to add some extra cflags and libraries. A
508portable version of this may eventually make its way into Configure.)
509
510 #!/bin/sh
511 cat > try.c <<'EOCP'
512 #include <stdio.h>
513 main() { printf("42\n"); }
514 EOCP
515 cc -o try try.c -lsfio
516 val=`./try`
517 if test X$val = X42; then
518 echo "Your sfio looks ok"
519 else
520 echo "Your sfio has the exit problem."
521 fi
522
523If you have this problem, the fix is to go back to your sfio sources
524and correct iffe's guess about atexit (or whatever is appropriate for
525your platform.)
526
527There also might be a more recent release of Sfio that fixes your
528problem.
529
46bb10fb 530=item 2.
531
532Normal stdio IO, but with all IO going through calls to the PerlIO
533abstraction layer. This configuration can be used to check that perl and
534extension modules have been correctly converted to use the PerlIO
535abstraction.
536
537This configuration should work on all platforms (but might not).
538
aa689395 539You select this option via:
46bb10fb 540
541 sh Configure -Duseperlio -Uusesfio
542
543If you have already selected -Duseperlio, and if Configure does not
544detect sfio, then this will be the default suggested by Configure.
545
546=back
547
aa689395 548=head2 Building a shared libperl.so Perl library
c3edaffb 549
550Currently, for most systems, the main perl executable is built by
551linking the "perl library" libperl.a with perlmain.o, your static
552extensions (usually just DynaLoader.a) and various extra libraries,
553such as -lm.
554
9d67150a 555On some systems that support dynamic loading, it may be possible to
556replace libperl.a with a shared libperl.so. If you anticipate building
c3edaffb 557several different perl binaries (e.g. by embedding libperl into
558different programs, or by using the optional compiler extension), then
9d67150a 559you might wish to build a shared libperl.so so that all your binaries
c3edaffb 560can share the same library.
561
562The disadvantages are that there may be a significant performance
9d67150a 563penalty associated with the shared libperl.so, and that the overall
aa689395 564mechanism is still rather fragile with respect to different versions
c3edaffb 565and upgrades.
566
567In terms of performance, on my test system (Solaris 2.5_x86) the perl
9d67150a 568test suite took roughly 15% longer to run with the shared libperl.so.
c3edaffb 569Your system and typical applications may well give quite different
570results.
571
572The default name for the shared library is typically something like
a6006777 573libperl.so.3.2 (for Perl 5.003_02) or libperl.so.302 or simply
9d67150a 574libperl.so. Configure tries to guess a sensible naming convention
c3edaffb 575based on your C library name. Since the library gets installed in a
576version-specific architecture-dependent directory, the exact name
577isn't very important anyway, as long as your linker is happy.
578
579For some systems (mostly SVR4), building a shared libperl is required
580for dynamic loading to work, and hence is already the default.
581
582You can elect to build a shared libperl by
583
584 sh Configure -Duseshrplib
585
586To actually build perl, you must add the current working directory to your
aa689395 587LD_LIBRARY_PATH environment variable before running make. You can do
c3edaffb 588this with
589
590 LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
591
592for Bourne-style shells, or
593
594 setenv LD_LIBRARY_PATH `pwd`
595
596for Csh-style shells. You *MUST* do this before running make.
597Folks running NeXT OPENSTEP must substitute DYLD_LIBRARY_PATH for
598LD_LIBRARY_PATH above.
599
9d67150a 600There is also an potential problem with the shared perl library if you
601want to have more than one "flavor" of the same version of perl (e.g.
602with and without -DDEBUGGING). For example, suppose you build and
a6006777 603install a standard Perl 5.004 with a shared library. Then, suppose you
604try to build Perl 5.004 with -DDEBUGGING enabled, but everything else
9d67150a 605the same, including all the installation directories. How can you
606ensure that your newly built perl will link with your newly built
7f678428 607libperl.so.4 rather with the installed libperl.so.4? The answer is
9d67150a 608that you might not be able to. The installation directory is encoded
56c6f531 609in the perl binary with the LD_RUN_PATH environment variable (or
610equivalent ld command-line option). On Solaris, you can override that
611with LD_LIBRARY_PATH; on Linux you can't.
9d67150a 612
613The only reliable answer is that you should specify a different
614directory for the architecture-dependent library for your -DDEBUGGING
615version of perl. You can do this with by changing all the *archlib*
616variables in config.sh, namely archlib, archlib_exp, and
617installarchlib, to point to your new architecture-dependent library.
618
55479bb6 619=head2 Malloc Issues
620
621Perl relies heavily on malloc(3) to grow data structures as needed, so
622perl's performance can be noticeably affected by the performance of
623the malloc function on your system.
624
625The perl source is shipped with a version of malloc that is very fast
626but somewhat wasteful of space. On the other hand, your system's
627malloc() function is probably a bit slower but also a bit more frugal.
628
629For many uses, speed is probably the most important consideration, so
630the default behavior (for most systems) is to use the malloc supplied
631with perl. However, if you will be running very large applications
632(e.g. Tk or PDL) or if your system already has an excellent malloc, or
633if you are experiencing difficulties with extensions that use
634third-party libraries that call malloc, then you might wish to use
635your system's malloc. (Or, you might wish to explore the experimental
636malloc flags discussed below.)
637
638To build without perl's malloc, you can use the Configure command
639
640 sh Configure -Uusemymalloc
641
642or you can answer 'n' at the appropriate interactive Configure prompt.
643
aa689395 644=head2 Malloc Performance Flags
c3edaffb 645
55479bb6 646If you are using Perl's malloc, you may add one or
1ec51d55 647more of the following items to your cflags config.sh variable
55479bb6 648to change its behavior in potentially useful ways. You can find out
1ec51d55 649more about these flags by reading the malloc.c source.
55479bb6 650In a future version of perl, these might be enabled by default.
c3edaffb 651
aa689395 652=over 4
653
2ae324a7 654=item -DDEBUGGING_MSTATS
655
1ec51d55 656If DEBUGGING_MSTATS is defined, you can extract malloc
2ae324a7 657statistics from the Perl interpreter. The overhead this imposes is not
658large (perl just twiddles integers at malloc/free/sbrk time). When you
1ec51d55 659run perl with the environment variable PERL_DEBUG_MSTATS set to
2ae324a7 660either 1 or 2, the interpreter will dump statistics to stderr at exit
661time and (with a value of 2) after compilation. If you install the
662Devel::Peek module you can get the statistics whenever you like by
663invoking its mstat() function.
664
aa689395 665=item -DEMERGENCY_SBRK
666
1ec51d55 667If EMERGENCY_SBRK is defined, running out of memory need not be a
2ae324a7 668fatal error: a memory pool can allocated by assigning to the special
1ec51d55 669variable $^M. See perlvar(1) for more details.
aa689395 670
671=item -DPACK_MALLOC
672
1ec51d55 673If PACK_MALLOC is defined, malloc.c uses a slightly different
55479bb6 674algorithm for small allocations (up to 64 bytes long). Such small
675allocations are quite common in typical Perl scripts.
aa689395 676
1ec51d55 677The expected memory savings (with 8-byte alignment in $alignbytes) is
55479bb6 678about 20% for typical Perl usage. The expected slowdown due to the
679additional malloc overhead is in fractions of a percent. (It is hard
680to measure because of the effect of the saved memory on speed).
aa689395 681
682=item -DTWO_POT_OPTIMIZE
683
1ec51d55 684If TWO_POT_OPTIMIZE is defined, malloc.c uses a slightly different
55479bb6 685algorithm for large allocations that are close to a power of two
686(starting with 16K). Such allocations are typical for big hashes and
687special-purpose scripts, especially image processing. If you will be
688manipulating very large blocks with sizes close to powers of two, it
689might be wise to define this macro.
aa689395 690
55479bb6 691The expected saving of memory is 0-100% (100% in applications which
692require most memory in such 2**n chunks). The expected slowdown is
aa689395 693negligible.
694
695=back
696
3bf462b8 697=head2 Building a debugging perl
698
699You can run perl scripts under the perl debugger at any time with
3fe9a6f1 700B<perl -d your_script>. If, however, you want to debug perl itself,
3bf462b8 701you probably want to do
702
703 sh Configure -Doptimize='-g'
704
705This will do two things: First, it will force compilation to use
1ec51d55 706cc -g so that you can use your system's debugger on the executable.
707Second, it will add a -DDEBUGGING to your ccflags variable in
708config.sh so that you can use B<perl -D> to access perl's internal
3fe9a6f1 709state. Note, however, that Configure will only add -DDEBUGGING by
1ec51d55 710default if you are not reusing your old config.sh. If you want to
711reuse your old config.sh, then you can just edit it and change the
3fe9a6f1 712optimize and ccflags variables by hand and then propagate your changes
713as shown in L<"Propagating your changes to config.sh"> below.
3bf462b8 714
715If you are using a shared libperl, see the warnings about multiple
716versions of perl under L<Building a shared libperl.so Perl library>.
717
aa689395 718=head2 Other Compiler Flags
719
720For most users, all of the Configure defaults are fine. However,
721you can change a number of factors in the way perl is built
1ec51d55 722by adding appropriate -D directives to your ccflags variable in
aa689395 723config.sh.
724
725For example, you can replace the rand() and srand() functions in the
726perl source by any other random number generator by a trick such as the
727following:
728
729 sh Configure -Dccflags='-Drand=random -Dsrand=srandom'
730
1ec51d55 731or by adding -Drand=random and -Dsrandom=srandom to your ccflags
aa689395 732at the appropriate Configure prompt. (You may also have to adjust
733Configure's guess for 'randbits' as well.)
c3edaffb 734
8e07c86e 735=head2 What if it doesn't work?
736
737=over 4
738
25f94b33 739=item Running Configure Interactively
740
741If Configure runs into trouble, remember that you can always run
742Configure interactively so that you can check (and correct) its
743guesses.
744
745All the installation questions have been moved to the top, so you don't
aa689395 746have to wait for them. Once you've handled them (and your C compiler and
1ec51d55 747flags) you can type &-d at the next Configure prompt and Configure
25f94b33 748will use the defaults from then on.
749
750If you find yourself trying obscure command line incantations and
751config.over tricks, I recommend you run Configure interactively
752instead. You'll probably save yourself time in the long run.
753
aa689395 754=item Hint files
8e07c86e 755
756The perl distribution includes a number of system-specific hints files
757in the hints/ directory. If one of them matches your system, Configure
758will offer to use that hint file.
759
760Several of the hint files contain additional important information.
761If you have any problems, it is a good idea to read the relevant hint
1ec51d55 762file for further information. See hints/solaris_2.sh for an
8e07c86e 763extensive example.
764
edb1cbcb 765=item *** WHOA THERE!!! ***
766
767Occasionally, Configure makes a wrong guess. For example, on SunOS
7684.1.3, Configure incorrectly concludes that tzname[] is in the
769standard C library. The hint file is set up to correct for this. You
770will see a message:
771
772 *** WHOA THERE!!! ***
773 The recommended value for $d_tzname on this machine was "undef"!
774 Keep the recommended value? [y]
775
776You should always keep the recommended value unless, after reading the
777relevant section of the hint file, you are sure you want to try
778overriding it.
779
780If you are re-using an old config.sh, the word "previous" will be
781used instead of "recommended". Again, you will almost always want
782to keep the previous value, unless you have changed something on your
783system.
784
785For example, suppose you have added libgdbm.a to your system
786and you decide to reconfigure perl to use GDBM_File. When you run
787Configure again, you will need to add -lgdbm to the list of libraries.
788Now, Configure will find your gdbm library and will issue a message:
789
790 *** WHOA THERE!!! ***
791 The previous value for $i_gdbm on this machine was "undef"!
792 Keep the previous value? [y]
793
1ec51d55 794In this case, you do not want to keep the previous value, so you
c3edaffb 795should answer 'n'. (You'll also have to manually add GDBM_File to
edb1cbcb 796the list of dynamic extensions to build.)
797
8e07c86e 798=item Changing Compilers
799
800If you change compilers or make other significant changes, you should
1ec51d55 801probably not re-use your old config.sh. Simply remove it or
8e07c86e 802rename it, e.g. mv config.sh config.sh.old. Then rerun Configure
803with the options you want to use.
804
1ec51d55 805This is a common source of problems. If you change from cc to
806gcc, you should almost always remove your old config.sh.
8e07c86e 807
c3edaffb 808=item Propagating your changes to config.sh
8e07c86e 809
1ec51d55 810If you make any changes to config.sh, you should propagate
811them to all the .SH files by running
812
813 sh Configure -S
814
815You will then have to rebuild by running
9d67150a 816
817 make depend
818 make
8e07c86e 819
820=item config.over
821
822You can also supply a shell script config.over to over-ride Configure's
823guesses. It will get loaded up at the very end, just before config.sh
824is created. You have to be careful with this, however, as Configure
d52d4e46 825does no checking that your changes make sense. See the section on
7f678428 826L<"Changing the installation directory"> for an example.
8e07c86e 827
828=item config.h
829
1ec51d55 830Many of the system dependencies are contained in config.h.
831Configure builds config.h by running the config_h.SH script.
832The values for the variables are taken from config.sh.
8e07c86e 833
1ec51d55 834If there are any problems, you can edit config.h directly. Beware,
835though, that the next time you run Configure, your changes will be
8e07c86e 836lost.
837
838=item cflags
839
840If you have any additional changes to make to the C compiler command
1ec51d55 841line, they can be made in cflags.SH. For instance, to turn off the
842optimizer on toke.c, find the line in the switch structure for
843toke.c and put the command optimize='-g' before the ;; . You
844can also edit cflags directly, but beware that your changes will be
845lost the next time you run Configure.
8e07c86e 846
1ec51d55 847To change the C flags for all the files, edit config.sh
848and change either $ccflags or $optimize,
849and then re-run
850
851 sh Configure -S
852 make depend
8e07c86e 853
aa689395 854=item No sh
8e07c86e 855
856If you don't have sh, you'll have to copy the sample file config_H to
857config.h and edit the config.h to reflect your system's peculiarities.
858You'll probably also have to extensively modify the extension building
859mechanism.
860
c3edaffb 861=item Porting information
862
2ae324a7 863Specific information for the OS/2, Plan9, VMS and Win32 ports is in the
1ec51d55 864corresponding README files and subdirectories. Additional information,
865including a glossary of all those config.sh variables, is in the Porting
c3edaffb 866subdirectory.
867
7f678428 868Ports for other systems may also be available. You should check out
1ec51d55 869http://www.perl.com/CPAN/ports for current information on ports to
7f678428 870various other operating systems.
871
8e07c86e 872=back
873
874=head1 make depend
875
876This will look for all the includes.
1ec51d55 877The output is stored in makefile. The only difference between
878Makefile and makefile is the dependencies at the bottom of
879makefile. If you have to make any changes, you should edit
880makefile, not Makefile since the Unix make command reads
881makefile first. (On non-Unix systems, the output may be stored in
c3edaffb 882a different file. Check the value of $firstmakefile in your config.sh
883if in doubt.)
8e07c86e 884
885Configure will offer to do this step for you, so it isn't listed
886explicitly above.
887
888=head1 make
889
890This will attempt to make perl in the current directory.
891
892If you can't compile successfully, try some of the following ideas.
7f678428 893If none of them help, and careful reading of the error message and
894the relevant manual pages on your system doesn't help, you can
895send a message to either the comp.lang.perl.misc newsgroup or to
896perlbug@perl.com with an accurate description of your problem.
aa689395 897See L<"Reporting Problems"> below.
8e07c86e 898
899=over 4
900
1ec51d55 901=item hints
8e07c86e 902
903If you used a hint file, try reading the comments in the hint file
904for further tips and information.
905
1ec51d55 906=item extensions
8e07c86e 907
1ec51d55 908If you can successfully build miniperl, but the process crashes
c3edaffb 909during the building of extensions, you should run
910
911 make minitest
912
913to test your version of miniperl.
914
e57fd563 915=item locale
916
917If you have any locale-related environment variables set, try
918unsetting them. I have some reports that some versions of IRIX hang
919while running B<./miniperl configpm> with locales other than the C
920locale. See the discussion under L<make test> below about locales.
921
1ec51d55 922=item malloc duplicates
c3edaffb 923
aa689395 924If you get duplicates upon linking for malloc et al, add -DHIDEMYMALLOC
925or -DEMBEDMYMALLOC to your ccflags variable in config.sh.
c3edaffb 926
7f678428 927=item varargs
c3edaffb 928
929If you get varargs problems with gcc, be sure that gcc is installed
930correctly. When using gcc, you should probably have i_stdarg='define'
931and i_varargs='undef' in config.sh. The problem is usually solved by
932running fixincludes correctly. If you do change config.sh, don't
7f678428 933forget to propagate your changes (see
934L<"Propagating your changes to config.sh"> below).
935See also the L<"vsprintf"> item below.
c3edaffb 936
1ec51d55 937=item croak
c3edaffb 938
939If you get error messages such as the following (the exact line
940numbers will vary in different versions of perl):
941
942 util.c: In function `Perl_croak':
943 util.c:962: number of arguments doesn't match prototype
944 proto.h:45: prototype declaration
945
946it might well be a symptom of the gcc "varargs problem". See the
7f678428 947previous L<"varargs"> item.
c3edaffb 948
9d67150a 949=item Solaris and SunOS dynamic loading
c3edaffb 950
951If you have problems with dynamic loading using gcc on SunOS or
952Solaris, and you are using GNU as and GNU ld, you may need to add
1ec51d55 953-B/bin/ (for SunOS) or -B/usr/ccs/bin/ (for Solaris) to your
c3edaffb 954$ccflags, $ldflags, and $lddlflags so that the system's versions of as
955and ld are used. Alternatively, you can use the GCC_EXEC_PREFIX
956environment variable to ensure that Sun's as and ld are used. Consult
1ec51d55 957your gcc documentation for further information on the -B option and
c3edaffb 958the GCC_EXEC_PREFIX variable.
959
9d67150a 960=item ld.so.1: ./perl: fatal: relocation error:
961
962If you get this message on SunOS or Solaris, and you're using gcc,
7f678428 963it's probably the GNU as or GNU ld problem in the previous item
964L<"Solaris and SunOS dynamic loading">.
9d67150a 965
1ec51d55 966=item LD_LIBRARY_PATH
c3edaffb 967
968If you run into dynamic loading problems, check your setting of
aa689395 969the LD_LIBRARY_PATH environment variable. If you're creating a static
970Perl library (libperl.a rather than libperl.so) it should build
c3edaffb 971fine with LD_LIBRARY_PATH unset, though that may depend on details
972of your local set-up.
973
974=item dlopen: stub interception failed
975
976The primary cause of the 'dlopen: stub interception failed' message is
977that the LD_LIBRARY_PATH environment variable includes a directory
978which is a symlink to /usr/lib (such as /lib).
979
aa689395 980The reason this causes a problem is quite subtle. The file libdl.so.1.0
c3edaffb 981actually *only* contains functions which generate 'stub interception
982failed' errors! The runtime linker intercepts links to
983"/usr/lib/libdl.so.1.0" and links in internal implementation of those
984functions instead. [Thanks to Tim Bunce for this explanation.]
985
aa689395 986=item nm extraction
c3edaffb 987
988If Configure seems to be having trouble finding library functions,
989try not using nm extraction. You can do this from the command line
990with
991
992 sh Configure -Uusenm
993
994or by answering the nm extraction question interactively.
1ec51d55 995If you have previously run Configure, you should not reuse your old
c3edaffb 996config.sh.
997
7f678428 998=item vsprintf
c3edaffb 999
1000If you run into problems with vsprintf in compiling util.c, the
1001problem is probably that Configure failed to detect your system's
1002version of vsprintf(). Check whether your system has vprintf().
1003(Virtually all modern Unix systems do.) Then, check the variable
1004d_vprintf in config.sh. If your system has vprintf, it should be:
1005
1006 d_vprintf='define'
1007
1008If Configure guessed wrong, it is likely that Configure guessed wrong
1009on a number of other common functions too. You are probably better off
1010re-running Configure without using nm extraction (see previous item).
1011
3fe9a6f1 1012=item do_aspawn
1013
1014If you run into problems relating to do_aspawn or do_spawn, the
1015problem is probably that Configure failed to detect your system's
1016fork() function. Follow the procedure in the previous items
1017on L<"vsprintf"> and L<"nm extraction">.
1018
aa689395 1019=item Optimizer
c3edaffb 1020
9d67150a 1021If you can't compile successfully, try turning off your compiler's
aa689395 1022optimizer. Edit config.sh and change the line
9d67150a 1023
1024 optimize='-O'
1025
1026to something like
1027
1028 optimize=' '
1029
1030then propagate your changes with B<sh Configure -S> and rebuild
1031with B<make depend; make>.
1032
1ec51d55 1033=item CRIPPLED_CC
9d67150a 1034
1ec51d55 1035If you still can't compile successfully, try adding a -DCRIPPLED_CC
56c6f531 1036flag. (Just because you get no errors doesn't mean it compiled right!)
1037This simplifies some complicated expressions for compilers that get
1038indigestion easily.
9d67150a 1039
1040=item Missing functions
1041
1042If you have missing routines, you probably need to add some library or
1043other, or you need to undefine some feature that Configure thought was
1044there but is defective or incomplete. Look through config.h for
1045likely suspects.
8e07c86e 1046
1ec51d55 1047=item toke.c
8e07c86e 1048
1ec51d55 1049Some compilers will not compile or optimize the larger files (such as
1050toke.c) without some extra switches to use larger jump offsets or
1051allocate larger internal tables. You can customize the switches for
1052each file in cflags. It's okay to insert rules for specific files into
1053makefile since a default rule only takes effect in the absence of a
8e07c86e 1054specific rule.
1055
7f678428 1056=item Missing dbmclose
8e07c86e 1057
c3edaffb 1058SCO prior to 3.2.4 may be missing dbmclose(). An upgrade to 3.2.4
1059that includes libdbm.nfs (which includes dbmclose()) may be available.
8e07c86e 1060
f3d9a6ba 1061=item Note (probably harmless): No library found for -lsomething
7f678428 1062
1063If you see such a message during the building of an extension, but
1064the extension passes its tests anyway (see L<"make test"> below),
1065then don't worry about the warning message. The extension
1066Makefile.PL goes looking for various libraries needed on various
aa689395 1067systems; few systems will need all the possible libraries listed.
7f678428 1068For example, a system may have -lcposix or -lposix, but it's
1069unlikely to have both, so most users will see warnings for the one
f3d9a6ba 1070they don't have. The phrase 'probably harmless' is intended to
1071reassure you that nothing unusual is happening, and the build
1072process is continuing.
7f678428 1073
1074On the other hand, if you are building GDBM_File and you get the
1075message
1076
f3d9a6ba 1077 Note (probably harmless): No library found for -lgdbm
7f678428 1078
1079then it's likely you're going to run into trouble somewhere along
1080the line, since it's hard to see how you can use the GDBM_File
1081extension without the -lgdbm library.
1082
1083It is true that, in principle, Configure could have figured all of
1084this out, but Configure and the extension building process are not
1085quite that tightly coordinated.
1086
aa689395 1087=item sh: ar: not found
1088
1089This is a message from your shell telling you that the command 'ar'
1090was not found. You need to check your PATH environment variable to
1091make sure that it includes the directory with the 'ar' command. This
1ec51d55 1092is a common problem on Solaris, where 'ar' is in the /usr/ccs/bin
aa689395 1093directory.
1094
1095=item db-recno failure on tests 51, 53 and 55
1096
1097Old versions of the DB library (including the DB library which comes
1098with FreeBSD 2.1) had broken handling of recno databases with modified
1099bval settings. Upgrade your DB library or OS.
1100
1ec51d55 1101=item Miscellaneous
8e07c86e 1102
1103Some additional things that have been reported for either perl4 or perl5:
1104
1105Genix may need to use libc rather than libc_s, or #undef VARARGS.
1106
1107NCR Tower 32 (OS 2.01.01) may need -W2,-Sl,2000 and #undef MKDIR.
1108
1ec51d55 1109UTS may need one or more of -DCRIPPLED_CC, -K or -g, and undef LSTAT.
8e07c86e 1110
1111If you get syntax errors on '(', try -DCRIPPLED_CC.
1112
1113Machines with half-implemented dbm routines will need to #undef I_ODBM
1114
8e07c86e 1115=back
1116
1117=head1 make test
1118
1119This will run the regression tests on the perl you just made. If it
1120doesn't say "All tests successful" then something went wrong. See the
1ec51d55 1121file t/README in the t subdirectory. Note that you can't run the
aa689395 1122tests in background if this disables opening of /dev/tty.
c3edaffb 1123
1ec51d55 1124If make test bombs out, just cd to the t directory and run ./TEST
1125by hand to see if it makes any difference. If individual tests
c3edaffb 1126bomb, you can run them by hand, e.g.,
8e07c86e 1127
1128 ./perl op/groups.t
1129
aa689395 1130Another way to get more detailed information about failed tests and
1ec51d55 1131individual subtests is to cd to the t directory and run
aa689395 1132
1133 ./perl harness
1134
1ec51d55 1135(this assumes that most tests succeed, since harness uses
aa689395 1136complicated constructs).
1137
c3edaffb 1138You can also read the individual tests to see if there are any helpful
1139comments that apply to your system.
1140
1ec51d55 1141Note: One possible reason for errors is that some external programs
c07a80fd 1142may be broken due to the combination of your environment and the way
3fe9a6f1 1143B<make test> exercises them. For example, this may happen if you have
1ec51d55 1144one or more of these environment variables set: LC_ALL LC_CTYPE
1145LC_COLLATE LANG. In some versions of UNIX, the non-English locales
e57fd563 1146are known to cause programs to exhibit mysterious errors.
1147
1148If you have any of the above environment variables set, please try
aa689395 1149
1150 setenv LC_ALL C
1151
1152(for C shell) or
1153
1154 LC_ALL=C;export LC_ALL
1155
1ec51d55 1156for Bourne or Korn shell) from the command line and then retry
1157make test. If the tests then succeed, you may have a broken program that
aa689395 1158is confusing the testing. Please run the troublesome test by hand as
e57fd563 1159shown above and see whether you can locate the program. Look for
1ec51d55 1160things like: exec, `backquoted command`, system, open("|...") or
1161open("...|"). All these mean that Perl is trying to run some
e57fd563 1162external program.
eed2e782 1163
8e07c86e 1164=head1 make install
1165
1166This will put perl into the public directory you specified to
1ec51d55 1167Configure; by default this is /usr/local/bin. It will also try
8e07c86e 1168to put the man pages in a reasonable place. It will not nroff the man
aa689395 1169pages, however. You may need to be root to run B<make install>. If you
8e07c86e 1170are not root, you must own the directories in question and you should
1171ignore any messages about chown not working.
1172
1173If you want to see exactly what will happen without installing
1174anything, you can run
4633a7c4 1175
8e07c86e 1176 ./perl installperl -n
1177 ./perl installman -n
1178
1ec51d55 1179make install will install the following:
8e07c86e 1180
1181 perl,
1182 perl5.nnn where nnn is the current release number. This
1183 will be a link to perl.
1184 suidperl,
1185 sperl5.nnn If you requested setuid emulation.
1186 a2p awk-to-perl translator
1187 cppstdin This is used by perl -P, if your cc -E can't
1188 read from stdin.
1189 c2ph, pstruct Scripts for handling C structures in header files.
1190 s2p sed-to-perl translator
1191 find2perl find-to-perl translator
aa689395 1192 h2ph Extract constants and simple macros from C headers
8e07c86e 1193 h2xs Converts C .h header files to Perl extensions.
24b3df7f 1194 perlbug Tool to report bugs in Perl.
8e07c86e 1195 perldoc Tool to read perl's pod documentation.
aa689395 1196 pl2pm Convert Perl 4 .pl files to Perl 5 .pm modules
8e07c86e 1197 pod2html, Converters from perl's pod documentation format
aa689395 1198 pod2latex, to other useful formats.
1199 pod2man, and
1200 pod2text
1201 splain Describe Perl warnings and errors
8e07c86e 1202
1203 library files in $privlib and $archlib specified to
1204 Configure, usually under /usr/local/lib/perl5/.
1205 man pages in the location specified to Configure, usually
1206 something like /usr/local/man/man1.
1207 module in the location specified to Configure, usually
1208 man pages under /usr/local/lib/perl5/man/man3.
1209 pod/*.pod in $privlib/pod/.
1210
4633a7c4 1211Installperl will also create the library directories $siteperl and
1212$sitearch listed in config.sh. Usually, these are something like
24b3df7f 1213 /usr/local/lib/perl5/site_perl/
1214 /usr/local/lib/perl5/site_perl/$archname
4633a7c4 1215where $archname is something like sun4-sunos. These directories
1216will be used for installing extensions.
1217
56c6f531 1218Perl's *.h header files and the libperl.a library are also installed
1219under $archlib so that any user may later build new extensions, run the
1220optional Perl compiler, or embed the perl interpreter into another
1221program even if the Perl source is no longer available.
8e07c86e 1222
aa689395 1223=head1 Coexistence with earlier versions of perl5
4633a7c4 1224
eed2e782 1225You can safely install the current version of perl5 and still run scripts
56c6f531 1226under the old binaries for versions 5.003 and later ONLY. Instead of
eed2e782 1227starting your script with #!/usr/local/bin/perl, just start it with
56c6f531 1228#!/usr/local/bin/perl5.003 (or whatever version you want to run.)
a6006777 1229If you want to retain a version of Perl 5 prior to 5.003, you'll
eed2e782 1230need to install the current version in a separate directory tree,
1231since some of the architecture-independent library files have changed
1232in incompatible ways.
4633a7c4 1233
1ec51d55 1234The old architecture-dependent files are stored in a version-specific
1235directory (such as /usr/local/lib/perl5/sun4-sunos/5.003) so that they
1236will still be accessible even after a later version is installed.
1237(Note: Perl 5.000 and 5.001 did not put their architecture-dependent
1238libraries in a version-specific directory. They are simply in
1239/usr/local/lib/perl5/$archname. If you will not be using 5.000 or
12405.001, you may safely remove those files.)
1241
1242In general, the standard library files in /usr/local/lib/perl5 should
1243be usable by all versions of perl5. However, the diagnostics.pm module
1244uses the /usr/local/lib/perl5/pod/perldiag.pod documentation file, so
1245the C<use diagnostics;> pragma and the splain script will only identify
1246and explain any warnings or errors that the most recently-installed
1247version of perl can generate.
4633a7c4 1248
d52d4e46 1249Most extensions will probably not need to be recompiled to use with a newer
4633a7c4 1250version of perl. If you do run into problems, and you want to continue
1251to use the old version of perl along with your extension, simply move
1252those extension files to the appropriate version directory, such as
1ec51d55 1253/usr/local/lib/perl/archname/5.003. Then Perl 5.003 will find your
aa689395 1254files in the 5.003 directory, and newer versions of perl will find your
4633a7c4 1255newer extension in the site_perl directory.
1256
1ec51d55 1257Many users prefer to keep all versions of perl in completely
d52d4e46 1258separate directories. One convenient way to do this is by
1259using a separate prefix for each version, such as
1260
46bb10fb 1261 sh Configure -Dprefix=/opt/perl5.004
d52d4e46 1262
46bb10fb 1263and adding /opt/perl5.004/bin to the shell PATH variable. Such users
d52d4e46 1264may also wish to add a symbolic link /usr/local/bin/perl so that
1265scripts can still start with #!/usr/local/bin/perl.
1266
8e07c86e 1267=head1 Coexistence with perl4
1268
1269You can safely install perl5 even if you want to keep perl4 around.
1270
1ec51d55 1271By default, the perl5 libraries go into /usr/local/lib/perl5/, so
1272they don't override the perl4 libraries in /usr/local/lib/perl/.
8e07c86e 1273
1274In your /usr/local/bin directory, you should have a binary named
1ec51d55 1275perl4.036. That will not be touched by the perl5 installation
8e07c86e 1276process. Most perl4 scripts should run just fine under perl5.
1277However, if you have any scripts that require perl4, you can replace
1ec51d55 1278the #! line at the top of them by #!/usr/local/bin/perl4.036
edb1cbcb 1279(or whatever the appropriate pathname is). See pod/perltrap.pod
1280for possible problems running perl4 scripts under perl5.
8e07c86e 1281
aa689395 1282=head1 cd /usr/include; h2ph *.h sys/*.h
1283
1284Some perl scripts need to be able to obtain information from
1285the system header files. This command will convert the most commonly used
1ec51d55 1286header files in /usr/include into files that can be easily interpreted
aa689395 1287by perl. These files will be placed in the architectural library directory
1ec51d55 1288you specified to Configure; by default this is
1289/usr/local/lib/perl5/ARCH/VERSION, where ARCH is your architecture
1290(such as sun4-solaris) and VERSION is the version of perl you are
1291building (for example, 5.004).
aa689395 1292
1ec51d55 1293Note: Due to differences in the C and perl languages, the
aa689395 1294conversion of the header files is not perfect. You will probably have
1295to hand-edit some of the converted files to get them to parse
1296correctly. For example, h2ph breaks spectacularly on type casting and
1297certain structures.
1298
1299=head1 cd pod && make html && mv *.html (www home dir)
1300
1301Some sites may wish to make the documentation in the pod/ directory
1302available in HTML format. Type
1303
1304 cd pod && make html && mv *.html <www home dir>
1305
1306where F<www home dir> is wherever your site keeps HTML files.
1307
1308=head1 cd pod && make tex && (process the latex files)
1309
1310Some sites may also wish to make the documentation in the pod/ directory
1311available in TeX format. Type
1312
1313 (cd pod && make tex && <process the latex files>)
1314
1315=head1 Reporting Problems
1316
1317If you have difficulty building perl, and none of the advice in this
1318file helps, and careful reading of the error message and the relevant
1319manual pages on your system doesn't help either, then you should send a
1320message to either the comp.lang.perl.misc newsgroup or to
1321perlbug@perl.com with an accurate description of your problem.
1322
1ec51d55 1323Please include the output of the ./myconfig shell script
aa689395 1324that comes with the distribution. Alternatively, you can use the
1ec51d55 1325perlbug program that comes with the perl distribution,
aa689395 1326but you need to have perl compiled and installed before you can use it.
1327
1ec51d55 1328You might also find helpful information in the Porting
aa689395 1329directory of the perl distribution.
1330
8e07c86e 1331=head1 DOCUMENTATION
1332
1333Read the manual entries before running perl. The main documentation is
1334in the pod/ subdirectory and should have been installed during the
1335build process. Type B<man perl> to get started. Alternatively, you
1ec51d55 1336can type B<perldoc perl> to use the supplied perldoc script. This
8e07c86e 1337is sometimes useful for finding things in the library modules.
1338
1ec51d55 1339Under UNIX, you can produce a documentation book in postscript form,
1340along with its table of contents, by going to the pod/ subdirectory
34a2a22e 1341and running (either):
1342
1343 ./roffitall -groff # If you have GNU groff installed
aa689395 1344 ./roffitall -psroff # If you have psroff
34a2a22e 1345
1346This will leave you with two postscript files ready to be printed.
aa689395 1347(You may need to fix the roffitall command to use your local troff
1348set-up.)
34a2a22e 1349
1350Note that you must have performed the installation already before
1351running the above, since the script collects the installed files to
1352generate the documentation.
1353
8e07c86e 1354=head1 AUTHOR
1355
1ec51d55 1356Andy Dougherty doughera@lafcol.lafayette.edu , borrowing very heavily
1357from the original README by Larry Wall, and also with lots of helpful
1358feedback from the perl5-porters@perl.org folks.
8e07c86e 1359
a5f75d66 1360=head1 LAST MODIFIED
24b3df7f 1361
1ec51d55 1362$Id: INSTALL,v 1.11 1997/03/26 19:08:06 doughera Released $