FindBin.pm on Win32 systems
[p5sagit/p5-mst-13.2.git] / Porting / pumpkin.pod
CommitLineData
aa689395 1=head1 NAME
2
3Pumpkin - Notes on handling the Perl Patch Pumpkin
4
5=head1 SYNOPSIS
6
7There is no simple synopsis, yet.
8
9=head1 DESCRIPTION
10
98dddfbd 11This document attempts to begin to describe some of the considerations
12involved in patching, porting, and maintaining perl.
aa689395 13
14This document is still under construction, and still subject to
15significant changes. Still, I hope parts of it will be useful,
16so I'm releasing it even though it's not done.
17
18For the most part, it's a collection of anecdotal information that
19already assumes some familiarity with the Perl sources. I really need
20an introductory section that describes the organization of the sources
21and all the various auxiliary files that are part of the distribution.
22
23=head1 Where Do I Get Perl Sources and Related Material?
24
25The Comprehensive Perl Archive Network (or CPAN) is the place to go.
26There are many mirrors, but the easiest thing to use is probably
7b5757d1 27http://www.perl.com/CPAN/README.html , which automatically points you to a
aa689395 28mirror site "close" to you.
29
30=head2 Perl5-porters mailing list
31
32The mailing list perl5-porters@perl.org
33is the main group working with the development of perl. If you're
34interested in all the latest developments, you should definitely
35subscribe. The list is high volume, but generally has a
36fairly low noise level.
37
38Subscribe by sending the message (in the body of your letter)
39
40 subscribe perl5-porters
41
42to perl5-porters-request@perl.org .
43
fb73857a 44Archives of the list are held at:
45
46 http://www.rosat.mpe-garching.mpg.de/mailing-lists/perl-porters/
47
aa689395 48=head1 How are Perl Releases Numbered?
49
7b5757d1 50Perl version numbers are floating point numbers, such as 5.004.
51(Observations about the imprecision of floating point numbers for
52representing reality probably have more relevance than you might
53imagine :-) The major version number is 5 and the '004' is the
54patchlevel. (Questions such as whether or not '004' is really a minor
55version number can safely be ignored.:)
56
57The version number is available as the magic variable $],
aa689395 58and can be used in comparisons, e.g.
59
60 print "You've got an old perl\n" if $] < 5.002;
61
aa689395 62You can also require particular version (or later) with
63
64 use 5.002;
65
7b5757d1 66At some point in the future, we may need to decide what to call the
67next big revision. In the .package file used by metaconfig to
68generate Configure, there are two variables that might be relevant:
69$baserev=5.0 and $package=perl5. At various times, I have suggested
70we might change them to $baserev=5.1 and $package=perl5.1 if want
71to signify a fairly major update. Or, we might want to jump to perl6.
72Let's worry about that problem when we get there.
73
aa689395 74=head2 Subversions
75
76In addition, there may be "developer" sub-versions available. These
77are not official releases. They may contain unstable experimental
78features, and are subject to rapid change. Such developer
79sub-versions are numbered with sub-version numbers. For example,
fb73857a 80version 5.003_04 is the 4'th developer version built on top of
815.003. It might include the _01, _02, and _03 changes, but it
82also might not. Sub-versions are allowed to be subversive. (But see
83the next section for recent changes.)
aa689395 84
85These sub-versions can also be used as floating point numbers, so
86you can do things such as
87
7b5757d1 88 print "You've got an unstable perl\n" if $] == 5.00303;
aa689395 89
90You can also require particular version (or later) with
91
7b5757d1 92 use 5.003_03; # the "_" is optional
aa689395 93
94Sub-versions produced by the members of perl5-porters are usually
95available on CPAN in the F<src/5.0/unsupported> directory.
96
7b5757d1 97=head2 Maintenance and Development Subversions
98
99As an experiment, starting with version 5.004, subversions _01 through
100_49 will be reserved for bug-fix maintenance releases, and subversions
101_50 through _99 will be available for unstable development versions.
102
103The separate bug-fix track is being established to allow us an easy
104way to distribute important bug fixes without waiting for the
105developers to untangle all the other problems in the current
106developer's release.
107
fb73857a 108Trial releases of bug-fix maintenance releases are announced on
109perl5-porters. Trial releases use the new subversion number (to avoid
110testers installing it over the previous release) and include a 'local
111patch' entry in patchlevel.h.
112
7b5757d1 113Watch for announcements of maintenance subversions in
114comp.lang.perl.announce.
115
20f245af 116The first rule of maintenance work is "First, do no harm."
117
aa689395 118=head2 Why such a complicated scheme?
119
120Two reasons, really. At least.
121
7b5757d1 122First, we need some way to identify and release collections of patches
123that are known to have new features that need testing and exploration. The
aa689395 124subversion scheme does that nicely while fitting into the
125C<use 5.004;> mold.
126
127Second, since most of the folks who help maintain perl do so on a
128free-time voluntary basis, perl development does not proceed at a
129precise pace, though it always seems to be moving ahead quickly.
130We needed some way to pass around the "patch pumpkin" to allow
131different people chances to work on different aspects of the
132distribution without getting in each other's way. It wouldn't be
133constructive to have multiple people working on incompatible
134implementations of the same idea. Instead what was needed was
135some kind of "baton" or "token" to pass around so everyone knew
136whose turn was next.
137
138=head2 Why is it called the patch pumpkin?
139
140Chip Salzenberg gets credit for that, with a nod to his cow orker,
141David Croy. We had passed around various names (baton, token, hot
142potato) but none caught on. Then, Chip asked:
143
144[begin quote]
145
146 Who has the patch pumpkin?
147
148To explain: David Croy once told me once that at a previous job,
149there was one tape drive and multiple systems that used it for backups.
150But instead of some high-tech exclusion software, they used a low-tech
151method to prevent multiple simultaneous backups: a stuffed pumpkin.
152No one was allowed to make backups unless they had the "backup pumpkin".
153
154[end quote]
155
156The name has stuck.
157
a6968aa6 158=head1 Philosophical Issues in Patching and Porting Perl
aa689395 159
160There are no absolute rules, but there are some general guidelines I
161have tried to follow as I apply patches to the perl sources.
162(This section is still under construction.)
163
164=head2 Solve problems as generally as possible
165
7b5757d1 166Never implement a specific restricted solution to a problem when you
167can solve the same problem in a more general, flexible way.
168
169For example, for dynamic loading to work on some SVR4 systems, we had
170to build a shared libperl.so library. In order to build "FAT" binaries
171on NeXT 4.0 systems, we had to build a special libperl library. Rather
172than continuing to build a contorted nest of special cases, I
173generalized the process of building libperl so that NeXT and SVR4 users
174could still get their work done, but others could build a shared
175libperl if they wanted to as well.
aa689395 176
a6968aa6 177Contain your changes carefully. Assume nothing about other operating
178systems, not even closely related ones. Your changes must not affect
179other platforms.
180
181Spy shamelessly on how similar patching or porting issues have been
182settled elsewhere.
183
184If feasible, try to keep filenames 8.3-compliant to humor those poor
185souls that get joy from running Perl under such dire limitations.
186
aa689395 187=head2 Seek consensus on major changes
188
189If you are making big changes, don't do it in secret. Discuss the
190ideas in advance on perl5-porters.
191
192=head2 Keep the documentation up-to-date
193
194If your changes may affect how users use perl, then check to be sure
195that the documentation is in sync with your changes. Be sure to
196check all the files F<pod/*.pod> and also the F<INSTALL> document.
197
198Consider writing the appropriate documentation first and then
7b5757d1 199implementing your change to correspond to the documentation.
aa689395 200
201=head2 Avoid machine-specific #ifdef's
202
203To the extent reasonable, try to avoid machine-specific #ifdef's in
204the sources. Instead, use feature-specific #ifdef's. The reason is
205that the machine-specific #ifdef's may not be valid across major
206releases of the operating system. Further, the feature-specific tests
207may help out folks on another platform who have the same problem.
208
a6968aa6 209=head2 Machine-specific files
210
98dddfbd 211=over 4
212
213=item source code
214
a6968aa6 215If you have many machine-specific #defines or #includes, consider
216creating an "osish.h" (os2ish.h, vmsish.h, and so on) and including
217that in perl.h. If you have several machine-specific files (function
218emulations, function stubs, build utility wrappers) you may create a
219separate subdirectory (djgpp, win32) and put the files in there.
98dddfbd 220Remember to update C<MANIFEST> when you add files.
a6968aa6 221
98dddfbd 222If your system support dynamic loading but none of the existing
223methods at F<ext/DynaLoader/dl_*.xs> work for you, you must write
224a new one. Study the existing ones to see what kind of interface
225you must supply.
226
227=item build hints
a6968aa6 228
229There are two kinds of hints: hints for building Perl and hints for
230extensions. The former live in the C<hints> subdirectory, the latter
231in C<ext/*/hints> subdirectories.
232
233The top level hints are Bourne-shell scripts that set, modify and
234unset appropriate Configure variables, based on the Configure command
235line options and possibly existing config.sh and Policy.sh files from
236previous Configure runs.
237
238The extension hints are written Perl (by the time they are used
239miniperl has been built) and control the building of their respective
240extensions. They can be used to for example manipulate compilation
241and linking flags.
242
98dddfbd 243=item build and installation Makefiles, scripts, and so forth
244
245Sometimes you will also need to tweak the Perl build and installation
246procedure itself, like for example F<Makefile.SH> and F<installperl>.
247Tread very carefully, even more than usual. Contain your changes
248with utmost care.
a6968aa6 249
98dddfbd 250=item test suite
251
252Many of the tests in C<t> subdirectory assume machine-specific things
a6968aa6 253like existence of certain functions, something about filesystem
254semantics, certain external utilities and their error messages. Use
255the C<$^O> and the C<Config> module (which contains the results of the
256Configure run, in effect the C<config.sh> converted to Perl) to either
98dddfbd 257skip (preferably not) or customize (preferable) the tests for your
258platform.
259
260=item modules
261
262Certain standard modules may need updating if your operating system
263sports for example a native filesystem naming. You may want to update
264some or all of the modules File::Basename, File::Spec, File::Path, and
265File::Copy to become aware of your native filesystem syntax and
266peculiarities.
267
268=item documentation
269
270If your operating system comes from outside UNIX you almost certainly
271will have differences in the available operating system functionality
272(missing system calls, different semantics, whatever). Please
273document these at F<pod/perlport.pod>. If your operating system is
274the first B<not> to have a system call also update the list of
275"portability-bewares" at the beginning of F<pod/perlfunc.pod>.
276
277A file called F<README.youros> at the top level that explains things
278like how to install perl at this platform, where to get any possibly
279required additional software, and for example what test suite errors
280to expect, is nice too.
281
282You may also want to write a separate F<.pod> file for your operating
283system to tell about existing mailing lists, os-specific modules,
284documentation, whatever. Please name these along the lines of
285F<perl>I<youros>.pod. [unfinished: where to put this file (the pod/
286subdirectory, of course: but more importantly, which/what index files
287should be updated?)]
288
289=back
a6968aa6 290
aa689395 291=head2 Allow for lots of testing
292
293We should never release a main version without testing it as a
294subversion first.
295
6877a1cf 296=head2 Test popular applications and modules.
297
298We should never release a main version without testing whether or not
299it breaks various popular modules and applications. A partial list of
300such things would include majordomo, metaconfig, apache, Tk, CGI,
301libnet, and libwww, to name just a few. Of course it's quite possible
302that some of those things will be just plain broken and need to be fixed,
303but, in general, we ought to try to avoid breaking widely-installed
304things.
305
98dddfbd 306=head2 Automated generation of derivative files
aa689395 307
308The F<embed.h>, F<keywords.h>, F<opcode.h>, and F<perltoc.pod> files
309are all automatically generated by perl scripts. In general, don't
310patch these directly; patch the data files instead.
311
312F<Configure> and F<config_h.SH> are also automatically generated by
313B<metaconfig>. In general, you should patch the metaconfig units
a6968aa6 314instead of patching these files directly. However, very minor changes
315to F<Configure> may be made in between major sync-ups with the
316metaconfig units, which tends to be complicated operations. But be
317careful, this can quickly spiral out of control. Running metaconfig
318is not really hard.
aa689395 319
98dddfbd 320Also F<Makefile> is automatically produced from F<Makefile.SH>.
321In general, look out for all F<*.SH> files.
322
a8119d38 323Finally, the sample files in the F<Porting/> subdirectory are
324generated automatically by the script F<U/mksample> included
325with the metaconfig units. See L<"run metaconfig"> below for
326information on obtaining the metaconfig units.
327
aa689395 328=head1 How to Make a Distribution
329
330There really ought to be a 'make dist' target, but there isn't.
331The 'dist' suite of tools also contains a number of tools that I haven't
332learned how to use yet. Some of them may make this all a bit easier.
333
334Here are the steps I go through to prepare a patch & distribution.
335
3e3baf6d 336Lots of it could doubtless be automated but isn't. The Porting/makerel
337(make release) perl script does now help automate some parts of it.
aa689395 338
339=head2 Announce your intentions
340
341First, you should volunteer out loud to take the patch pumpkin. It's
342generally counter-productive to have multiple people working in secret
343on the same thing.
344
345At the same time, announce what you plan to do with the patch pumpkin,
346to allow folks a chance to object or suggest alternatives, or do it for
347you. Naturally, the patch pumpkin holder ought to incorporate various
348bug fixes and documentation improvements that are posted while he or
349she has the pumpkin, but there might also be larger issues at stake.
350
351One of the precepts of the subversion idea is that we shouldn't give
7b5757d1 352the patch pumpkin to anyone unless we have some idea what he or she
353is going to do with it.
aa689395 354
355=head2 refresh pod/perltoc.pod
356
357Presumably, you have done a full C<make> in your working source
358directory. Before you C<make spotless> (if you do), and if you have
359changed any documentation in any module or pod file, change to the
360F<pod> directory and run C<make toc>.
361
3e3baf6d 362=head2 run installhtml to check the validity of the pod files
363
aa689395 364=head2 update patchlevel.h
365
366Don't be shy about using the subversion number, even for a relatively
367modest patch. We've never even come close to using all 99 subversions,
368and it's better to have a distinctive number for your patch. If you
369need feedback on your patch, go ahead and issue it and promise to
370incorporate that feedback quickly (e.g. within 1 week) and send out a
371second patch.
372
373=head2 run metaconfig
374
375If you need to make changes to Configure or config_h.SH, it may be best to
376change the appropriate metaconfig units instead, and regenerate Configure.
377
378 metaconfig -m
379
20f245af 380will regenerate Configure and config_h.SH. Much more information
381on obtaining and running metaconfig is in the F<U/README> file
382that comes with Perl's metaconfig units. Perl's metaconfig units
383should be available on CPAN. A set of units that will work with
384perl5.005 is in the file F<mc_units-5.005_00-01.tar.gz> under
385http://www.perl.com/CPAN/authors/id/ANDYD/ . The mc_units tar file
386should be unpacked in your main perl source directory. Note: those
387units were for use with 5.005. There may have been changes since then.
d562869c 388Check for later versions or contact perl5-porters@perl.org to obtain a
20f245af 389pointer to the current version.
aa689395 390
391Alternatively, do consider if the F<*ish.h> files might be a better
392place for your changes.
393
394=head2 MANIFEST
395
396Make sure the MANIFEST is up-to-date. You can use dist's B<manicheck>
397program for this. You can also use
398
3e3baf6d 399 perl -w -MExtUtils::Manifest=fullcheck -e fullcheck
aa689395 400
3e3baf6d 401Both commands will also list extra files in the directory that are not
402listed in MANIFEST.
aa689395 403
bfb7748a 404The MANIFEST is normally sorted.
aa689395 405
406If you are using metaconfig to regenerate Configure, then you should note
407that metaconfig actually uses MANIFEST.new, so you want to be sure
408MANIFEST.new is up-to-date too. I haven't found the MANIFEST/MANIFEST.new
409distinction particularly useful, but that's probably because I still haven't
410learned how to use the full suite of tools in the dist distribution.
411
412=head2 Check permissions
413
414All the tests in the t/ directory ought to be executable. The
415main makefile used to do a 'chmod t/*/*.t', but that resulted in
416a self-modifying distribution--something some users would strongly
d562869c 417prefer to avoid. The F<t/TEST> script will check for this
418and do the chmod if needed, but the tests still ought to be
419executable.
aa689395 420
421In all, the following files should probably be executable:
422
423 Configure
424 configpm
32fcaa0b 425 configure.gnu
aa689395 426 embed.pl
427 installperl
428 installman
429 keywords.pl
aa689395 430 myconfig
431 opcode.pl
432 perly.fixer
433 t/TEST
434 t/*/*.t
435 *.SH
436 vms/ext/Stdio/test.pl
437 vms/ext/filespec.t
aa689395 438 x2p/*.SH
439
440Other things ought to be readable, at least :-).
441
442Probably, the permissions for the files could be encoded in MANIFEST
443somehow, but I'm reluctant to change MANIFEST itself because that
444could break old scripts that use MANIFEST.
445
446I seem to recall that some SVR3 systems kept some sort of file that listed
447permissions for system files; something like that might be appropriate.
448
449=head2 Run Configure
450
451This will build a config.sh and config.h. You can skip this if you haven't
693762b4 452changed Configure or config_h.SH at all. I use the following command
aa689395 453
693762b4 454 sh Configure -Dprefix=/opt/perl -Doptimize=-O -Dusethreads \
455 -Dcf_by='yourname' \
456 -Dcf_email='yourname@yourhost.yourplace.com' \
457 -Dperladmin='yourname@yourhost.yourplace.com' \
458 -Dmydomain='.yourplace.com' \
459 -Dmyhostname='yourhost' \
460 -des
aa689395 461
693762b4 462=head2 Update Porting/config.sh and Porting/config_H
dfe9444c 463
693762b4 464[XXX
465This section needs revision. We're currently working on easing
466the task of keeping the vms, win32, and plan9 config.sh info
467up-to-date. The plan is to use keep up-to-date 'canned' config.sh
468files in the appropriate subdirectories and then generate 'canned'
469config.h files for vms, win32, etc. from the generic config.sh file.
470This is to ease maintenance. When Configure gets updated, the parts
471sometimes get scrambled around, and the changes in config_H can
472sometimes be very hard to follow. config.sh, on the other hand, can
473safely be sorted, so it's easy to track (typically very small) changes
474to config.sh and then propoagate them to a canned 'config.h' by any
475number of means, including a perl script in win32/ or carrying
476config.sh and config_h.SH to a Unix system and running sh
477config_h.SH.)
478XXX]
479
480The Porting/config.sh and Porting/config_H files are provided to
481help those folks who can't run Configure. It is important to keep
482them up-to-date. If you have changed config_h.SH, those changes must
483be reflected in config_H as well. (The name config_H was chosen to
484distinguish the file from config.h even on case-insensitive file systems.)
485Simply edit the existing config_H file; keep the first few explanatory
486lines and then copy your new config.h below.
aa689395 487
d562869c 488It may also be necessary to update win32/config.?c, vms/config.vms and
aa689395 489plan9/config.plan9, though you should be quite careful in doing so if
490you are not familiar with those systems. You might want to issue your
491patch with a promise to quickly issue a follow-up that handles those
492directories.
493
494=head2 make run_byacc
495
496If you have byacc-1.8.2 (available from CPAN), and if there have been
497changes to F<perly.y>, you can regenerate the F<perly.c> file. The
498run_byacc makefile target does this by running byacc and then applying
499some patches so that byacc dynamically allocates space, rather than
500having fixed limits. This patch is handled by the F<perly.fixer>
501script. Depending on the nature of the changes to F<perly.y>, you may
502or may not have to hand-edit the patch to apply correctly. If you do,
503you should include the edited patch in the new distribution. If you
504have byacc-1.9, the patch won't apply cleanly. Changes to the printf
505output statements mean the patch won't apply cleanly. Long ago I
506started to fix F<perly.fixer> to detect this, but I never completed the
507task.
508
ebb99254 509If C<perly.c> changes, make sure you run C<perl vms/vms_yfix.pl> to
510update the corresponding VMS files. See L<VMS-specific updates>.
511
aa689395 512Some additional notes from Larry on this:
513
e262e9be 514Don't forget to regenerate perly_c.diff.
aa689395 515
7b5757d1 516 byacc -d perly.y
aa689395 517 mv y.tab.c perly.c
e262e9be 518 patch perly.c <perly_c.diff
aa689395 519 # manually apply any failed hunks
e262e9be 520 diff -c2 perly.c.orig perly.c >perly_c.diff
aa689395 521
522One chunk of lines that often fails begins with
523
524 #line 29 "perly.y"
525
526and ends one line before
527
528 #define YYERRCODE 256
529
530This only happens when you add or remove a token type. I suppose this
531could be automated, but it doesn't happen very often nowadays.
532
533Larry
534
535=head2 make regen_headers
536
537The F<embed.h>, F<keywords.h>, and F<opcode.h> files are all automatically
538generated by perl scripts. Since the user isn't guaranteed to have a
539working perl, we can't require the user to generate them. Hence you have
540to, if you're making a distribution.
541
542I used to include rules like the following in the makefile:
543
544 # The following three header files are generated automatically
545 # The correct versions should be already supplied with the perl kit,
546 # in case you don't have perl or 'sh' available.
547 # The - is to ignore error return codes in case you have the source
548 # installed read-only or you don't have perl yet.
549 keywords.h: keywords.pl
550 @echo "Don't worry if this fails."
551 - perl keywords.pl
552
553
7b5757d1 554However, I got B<lots> of mail consisting of people worrying because the
aa689395 555command failed. I eventually decided that I would save myself time
556and effort by manually running C<make regen_headers> myself rather
557than answering all the questions and complaints about the failing
558command.
559
3e3baf6d 560=head2 global.sym, interp.sym and perlio.sym
aa689395 561
562Make sure these files are up-to-date. Read the comments in these
563files and in perl_exp.SH to see what to do.
564
565=head2 Binary compatibility
566
567If you do change F<global.sym> or F<interp.sym>, think carefully about
568what you are doing. To the extent reasonable, we'd like to maintain
569souce and binary compatibility with older releases of perl. That way,
570extensions built under one version of perl will continue to work with
571new versions of perl.
572
573Of course, some incompatible changes may well be necessary. I'm just
574suggesting that we not make any such changes without thinking carefully
575about them first. If possible, we should provide
576backwards-compatibility stubs. There's a lot of XS code out there.
577Let's not force people to keep changing it.
578
579=head2 Changes
580
581Be sure to update the F<Changes> file. Try to include both an overall
582summary as well as detailed descriptions of the changes. Your
3e3baf6d 583audience will include other developers and users, so describe
aa689395 584user-visible changes (if any) in terms they will understand, not in
585code like "initialize foo variable in bar function".
586
587There are differing opinions on whether the detailed descriptions
588ought to go in the Changes file or whether they ought to be available
589separately in the patch file (or both). There is no disagreement that
590detailed descriptions ought to be easily available somewhere.
591
2a26e2f1 592=head2 Todo
593
594The F<Todo> file contains a roughly-catgorized unordered list of
595aspects of Perl that could use enhancement, features that could be
596added, areas that could be cleaned up, and so on. During your term as
597pumpkin-holder, you will probably address some of these issues, and
598perhaps identify others which, while you decide not to address them
599this time around, may be tackled in the future. Update the file
600reflect the situation as it stands when you hand over the pumpkin.
601
602You might like, early in your pumpkin-holding career, to see if you
603can find champions for partiticular issues on the to-do list: an issue
604owned is an issue more likely to be resolved.
605
c4f23d77 606There are also some more porting-specific L<Todo> items later in this
607file.
608
aa689395 609=head2 OS/2-specific updates
610
611In the os2 directory is F<diff.configure>, a set of OS/2-specific
612diffs against B<Configure>. If you make changes to Configure, you may
613want to consider regenerating this diff file to save trouble for the
614OS/2 maintainer.
615
7b5757d1 616You can also consider the OS/2 diffs as reminders of portability
617things that need to be fixed in Configure.
618
aa689395 619=head2 VMS-specific updates
620
ebb99254 621If you have changed F<perly.y> or F<perly.c>, then you most probably want
622to update F<vms/perly_{h,c}.vms> by running C<perl vms/vms_yfix.pl>.
aa689395 623
624The Perl version number appears in several places under F<vms>.
625It is courteous to update these versions. For example, if you are
626making 5.004_42, replace "5.00441" with "5.00442".
627
628=head2 Making the new distribution
629
630Suppose, for example, that you want to make version 5.004_08. Then you can
631do something like the following
632
633 mkdir ../perl5.004_08
634 awk '{print $1}' MANIFEST | cpio -pdm ../perl5.004_08
635 cd ../
636 tar cf perl5.004_08.tar perl5.004_08
637 gzip --best perl5.004_08.tar
638
3e3baf6d 639These steps, with extra checks, are automated by the Porting/makerel
640script.
641
aa689395 642=head2 Making a new patch
643
644I find the F<makepatch> utility quite handy for making patches.
645You can obtain it from any CPAN archive under
3e3baf6d 646http://www.perl.com/CPAN/authors/Johan_Vromans/ . There are a couple
647of differences between my version and the standard one. I have mine do
648a
aa689395 649
650 # Print a reassuring "End of Patch" note so people won't
651 # wonder if their mailer truncated patches.
652 print "\n\nEnd of Patch.\n";
653
3e3baf6d 654at the end. That's because I used to get questions from people asking
655if their mail was truncated.
656
657It also writes Index: lines which include the new directory prefix
658(change Index: print, approx line 294 or 310 depending on the version,
659to read: print PATCH ("Index: $newdir$new\n");). That helps patches
660work with more POSIX conformant patch programs.
aa689395 661
662Here's how I generate a new patch. I'll use the hypothetical
6635.004_07 to 5.004_08 patch as an example.
664
665 # unpack perl5.004_07/
666 gzip -d -c perl5.004_07.tar.gz | tar -xof -
667 # unpack perl5.004_08/
668 gzip -d -c perl5.004_08.tar.gz | tar -xof -
669 makepatch perl5.004_07 perl5.004_08 > perl5.004_08.pat
670
671Makepatch will automatically generate appropriate B<rm> commands to remove
672deleted files. Unfortunately, it will not correctly set permissions
673for newly created files, so you may have to do so manually. For example,
674patch 5.003_04 created a new test F<t/op/gv.t> which needs to be executable,
675so at the top of the patch, I inserted the following lines:
676
677 # Make a new test
678 touch t/op/gv.t
679 chmod +x t/opt/gv.t
680
681Now, of course, my patch is now wrong because makepatch didn't know I
682was going to do that command, and it patched against /dev/null.
683
684So, what I do is sort out all such shell commands that need to be in the
685patch (including possible mv-ing of files, if needed) and put that in the
686shell commands at the top of the patch. Next, I delete all the patch parts
687of perl5.004_08.pat, leaving just the shell commands. Then, I do the
688following:
689
7b5757d1 690 cd perl5.004_07
691 sh ../perl5.004_08.pat
aa689395 692 cd ..
7b5757d1 693 makepatch perl5.004_07 perl5.004_08 >> perl5.004_08.pat
aa689395 694
695(Note the append to preserve my shell commands.)
696Now, my patch will line up with what the end users are going to do.
697
698=head2 Testing your patch
699
700It seems obvious, but be sure to test your patch. That is, verify that
701it produces exactly the same thing as your full distribution.
702
7b5757d1 703 rm -rf perl5.004_07
704 gzip -d -c perl5.004_07.tar.gz | tar -xf -
705 cd perl5.004_07
706 sh ../perl5.004_08.pat
707 patch -p1 -N < ../perl5.004_08.pat
aa689395 708 cd ..
7b5757d1 709 gdiff -r perl5.004_07 perl5.004_08
aa689395 710
711where B<gdiff> is GNU diff. Other diff's may also do recursive checking.
712
713=head2 More testing
714
715Again, it's obvious, but you should test your new version as widely as you
716can. You can be sure you'll hear about it quickly if your version doesn't
717work on both ANSI and pre-ANSI compilers, and on common systems such as
718SunOS 4.1.[34], Solaris, and Linux.
719
720If your changes include conditional code, try to test the different
721branches as thoroughly as you can. For example, if your system
722supports dynamic loading, you can also test static loading with
723
724 sh Configure -Uusedl
725
726You can also hand-tweak your config.h to try out different #ifdef
727branches.
728
729=head1 Common Gotcha's
730
731=over 4
732
733=item #elif
734
735The '#elif' preprocessor directive is not understood on all systems.
736Specifically, I know that Pyramids don't understand it. Thus instead of the
737simple
738
739 #if defined(I_FOO)
740 # include <foo.h>
741 #elif defined(I_BAR)
742 # include <bar.h>
743 #else
744 # include <fubar.h>
745 #endif
746
747You have to do the more Byzantine
748
749 #if defined(I_FOO)
750 # include <foo.h>
751 #else
752 # if defined(I_BAR)
753 # include <bar.h>
754 # else
755 # include <fubar.h>
756 # endif
757 #endif
758
759Incidentally, whitespace between the leading '#' and the preprocessor
760command is not guaranteed, but is very portable and you may use it freely.
761I think it makes things a bit more readable, especially once things get
762rather deeply nested. I also think that things should almost never get
763too deeply nested, so it ought to be a moot point :-)
764
765=item Probably Prefer POSIX
766
767It's often the case that you'll need to choose whether to do
768something the BSD-ish way or the POSIX-ish way. It's usually not
769a big problem when the two systems use different names for similar
770functions, such as memcmp() and bcmp(). The perl.h header file
771handles these by appropriate #defines, selecting the POSIX mem*()
772functions if available, but falling back on the b*() functions, if
773need be.
774
775More serious is the case where some brilliant person decided to
776use the same function name but give it a different meaning or
777calling sequence :-). getpgrp() and setpgrp() come to mind.
778These are a real problem on systems that aim for conformance to
779one standard (e.g. POSIX), but still try to support the other way
780of doing things (e.g. BSD). My general advice (still not really
781implemented in the source) is to do something like the following.
782Suppose there are two alternative versions, fooPOSIX() and
783fooBSD().
784
785 #ifdef HAS_FOOPOSIX
786 /* use fooPOSIX(); */
787 #else
788 # ifdef HAS_FOOBSD
789 /* try to emulate fooPOSIX() with fooBSD();
790 perhaps with the following: */
791 # define fooPOSIX fooBSD
792 # else
793 # /* Uh, oh. We have to supply our own. */
794 # define fooPOSIX Perl_fooPOSIX
795 # endif
796 #endif
797
798=item Think positively
799
800If you need to add an #ifdef test, it is usually easier to follow if you
801think positively, e.g.
802
803 #ifdef HAS_NEATO_FEATURE
804 /* use neato feature */
805 #else
806 /* use some fallback mechanism */
807 #endif
808
809rather than the more impenetrable
810
811 #ifndef MISSING_NEATO_FEATURE
812 /* Not missing it, so we must have it, so use it */
813 #else
814 /* Are missing it, so fall back on something else. */
815 #endif
816
817Of course for this toy example, there's not much difference. But when
818the #ifdef's start spanning a couple of screen fulls, and the #else's
819are marked something like
820
821 #else /* !MISSING_NEATO_FEATURE */
822
823I find it easy to get lost.
824
825=item Providing Missing Functions -- Problem
826
827Not all systems have all the neat functions you might want or need, so
828you might decide to be helpful and provide an emulation. This is
829sound in theory and very kind of you, but please be careful about what
830you name the function. Let me use the C<pause()> function as an
831illustration.
832
833Perl5.003 has the following in F<perl.h>
834
835 #ifndef HAS_PAUSE
836 #define pause() sleep((32767<<16)+32767)
837 #endif
838
839Configure sets HAS_PAUSE if the system has the pause() function, so
840this #define only kicks in if the pause() function is missing.
841Nice idea, right?
842
843Unfortunately, some systems apparently have a prototype for pause()
844in F<unistd.h>, but don't actually have the function in the library.
845(Or maybe they do have it in a library we're not using.)
846
847Thus, the compiler sees something like
848
849 extern int pause(void);
850 /* . . . */
851 #define pause() sleep((32767<<16)+32767)
852
853and dies with an error message. (Some compilers don't mind this;
854others apparently do.)
855
856To work around this, 5.003_03 and later have the following in perl.h:
857
858 /* Some unistd.h's give a prototype for pause() even though
859 HAS_PAUSE ends up undefined. This causes the #define
860 below to be rejected by the compiler. Sigh.
861 */
862 #ifdef HAS_PAUSE
863 # define Pause pause
864 #else
865 # define Pause() sleep((32767<<16)+32767)
866 #endif
867
868This works.
869
870The curious reader may wonder why I didn't do the following in
871F<util.c> instead:
872
873 #ifndef HAS_PAUSE
874 void pause()
875 {
876 sleep((32767<<16)+32767);
877 }
878 #endif
879
880That is, since the function is missing, just provide it.
881Then things would probably be been alright, it would seem.
882
883Well, almost. It could be made to work. The problem arises from the
884conflicting needs of dynamic loading and namespace protection.
885
886For dynamic loading to work on AIX (and VMS) we need to provide a list
887of symbols to be exported. This is done by the script F<perl_exp.SH>,
888which reads F<global.sym> and F<interp.sym>. Thus, the C<pause>
889symbol would have to be added to F<global.sym> So far, so good.
890
891On the other hand, one of the goals of Perl5 is to make it easy to
892either extend or embed perl and link it with other libraries. This
893means we have to be careful to keep the visible namespace "clean".
894That is, we don't want perl's global variables to conflict with
895those in the other application library. Although this work is still
896in progress, the way it is currently done is via the F<embed.h> file.
897This file is built from the F<global.sym> and F<interp.sym> files,
898since those files already list the globally visible symbols. If we
899had added C<pause> to global.sym, then F<embed.h> would contain the
900line
901
902 #define pause Perl_pause
903
904and calls to C<pause> in the perl sources would now point to
905C<Perl_pause>. Now, when B<ld> is run to build the F<perl> executable,
906it will go looking for C<perl_pause>, which probably won't exist in any
907of the standard libraries. Thus the build of perl will fail.
908
909Those systems where C<HAS_PAUSE> is not defined would be ok, however,
910since they would get a C<Perl_pause> function in util.c. The rest of
911the world would be in trouble.
912
913And yes, this scenario has happened. On SCO, the function C<chsize>
914is available. (I think it's in F<-lx>, the Xenix compatibility
915library.) Since the perl4 days (and possibly before), Perl has
916included a C<chsize> function that gets called something akin to
917
918 #ifndef HAS_CHSIZE
919 I32 chsize(fd, length)
920 /* . . . */
921 #endif
922
923When 5.003 added
924
925 #define chsize Perl_chsize
926
927to F<embed.h>, the compile started failing on SCO systems.
928
929The "fix" is to give the function a different name. The one
930implemented in 5.003_05 isn't optimal, but here's what was done:
931
932 #ifdef HAS_CHSIZE
933 # ifdef my_chsize /* Probably #defined to Perl_my_chsize in embed.h */
934 # undef my_chsize
935 # endif
936 # define my_chsize chsize
937 #endif
938
939My explanatory comment in patch 5.003_05 said:
940
941 Undef and then re-define my_chsize from Perl_my_chsize to
942 just plain chsize if this system HAS_CHSIZE. This probably only
943 applies to SCO. This shows the perils of having internal
944 functions with the same name as external library functions :-).
945
946Now, we can safely put C<my_chsize> in F<global.sym>, export it, and
947hide it with F<embed.h>.
948
949To be consistent with what I did for C<pause>, I probably should have
950called the new function C<Chsize>, rather than C<my_chsize>.
951However, the perl sources are quite inconsistent on this (Consider
952New, Mymalloc, and Myremalloc, to name just a few.)
953
954There is a problem with this fix, however, in that C<Perl_chsize>
955was available as a F<libperl.a> library function in 5.003, but it
956isn't available any more (as of 5.003_07). This means that we've
957broken binary compatibility. This is not good.
958
959=item Providing missing functions -- some ideas
960
961We currently don't have a standard way of handling such missing
962function names. Right now, I'm effectively thinking aloud about a
963solution. Some day, I'll try to formally propose a solution.
964
965Part of the problem is that we want to have some functions listed as
966exported but not have their names mangled by embed.h or possibly
967conflict with names in standard system headers. We actually already
968have such a list at the end of F<perl_exp.SH> (though that list is
969out-of-date):
970
971 # extra globals not included above.
972 cat <<END >> perl.exp
973 perl_init_ext
974 perl_init_fold
975 perl_init_i18nl14n
976 perl_alloc
977 perl_construct
978 perl_destruct
979 perl_free
980 perl_parse
981 perl_run
982 perl_get_sv
983 perl_get_av
984 perl_get_hv
985 perl_get_cv
986 perl_call_argv
987 perl_call_pv
988 perl_call_method
989 perl_call_sv
990 perl_requirepv
991 safecalloc
992 safemalloc
993 saferealloc
994 safefree
995
996This still needs much thought, but I'm inclined to think that one
997possible solution is to prefix all such functions with C<perl_> in the
998source and list them along with the other C<perl_*> functions in
999F<perl_exp.SH>.
1000
1001Thus, for C<chsize>, we'd do something like the following:
1002
1003 /* in perl.h */
1004 #ifdef HAS_CHSIZE
1005 # define perl_chsize chsize
1006 #endif
1007
1008then in some file (e.g. F<util.c> or F<doio.c>) do
1009
1010 #ifndef HAS_CHSIZE
1011 I32 perl_chsize(fd, length)
1012 /* implement the function here . . . */
1013 #endif
1014
1015Alternatively, we could just always use C<chsize> everywhere and move
1016C<chsize> from F<global.sym> to the end of F<perl_exp.SH>. That would
1017probably be fine as long as our C<chsize> function agreed with all the
1018C<chsize> function prototypes in the various systems we'll be using.
1019As long as the prototypes in actual use don't vary that much, this is
1020probably a good alternative. (As a counter-example, note how Configure
1021and perl have to go through hoops to find and use get Malloc_t and
1022Free_t for C<malloc> and C<free>.)
1023
1024At the moment, this latter option is what I tend to prefer.
1025
1026=item All the world's a VAX
1027
1028Sorry, showing my age:-). Still, all the world is not BSD 4.[34],
1029SVR4, or POSIX. Be aware that SVR3-derived systems are still quite
1030common (do you have any idea how many systems run SCO?) If you don't
1031have a bunch of v7 manuals handy, the metaconfig units (by default
1032installed in F</usr/local/lib/dist/U>) are a good resource to look at
1033for portability.
1034
1035=back
1036
1037=head1 Miscellaneous Topics
1038
1039=head2 Autoconf
1040
1041Why does perl use a metaconfig-generated Configure script instead of an
1042autoconf-generated configure script?
1043
1044Metaconfig and autoconf are two tools with very similar purposes.
1045Metaconfig is actually the older of the two, and was originally written
1046by Larry Wall, while autoconf is probably now used in a wider variety of
1047packages. The autoconf info file discusses the history of autoconf and
1048how it came to be. The curious reader is referred there for further
1049information.
1050
1051Overall, both tools are quite good, I think, and the choice of which one
1052to use could be argued either way. In March, 1994, when I was just
1053starting to work on Configure support for Perl5, I considered both
1054autoconf and metaconfig, and eventually decided to use metaconfig for the
1055following reasons:
1056
1057=over 4
1058
1059=item Compatibility with Perl4
1060
1061Perl4 used metaconfig, so many of the #ifdef's were already set up for
1062metaconfig. Of course metaconfig had evolved some since Perl4's days,
1063but not so much that it posed any serious problems.
1064
1065=item Metaconfig worked for me
1066
1067My system at the time was Interactive 2.2, a SVR3.2/386 derivative that
1068also had some POSIX support. Metaconfig-generated Configure scripts
1069worked fine for me on that system. On the other hand, autoconf-generated
1070scripts usually didn't. (They did come quite close, though, in some
1071cases.) At the time, I actually fetched a large number of GNU packages
1072and checked. Not a single one configured and compiled correctly
1073out-of-the-box with the system's cc compiler.
1074
1075=item Configure can be interactive
1076
1077With both autoconf and metaconfig, if the script works, everything is
1078fine. However, one of my main problems with autoconf-generated scripts
1079was that if it guessed wrong about something, it could be B<very> hard to
1080go back and fix it. For example, autoconf always insisted on passing the
1081-Xp flag to cc (to turn on POSIX behavior), even when that wasn't what I
1082wanted or needed for that package. There was no way short of editing the
1083configure script to turn this off. You couldn't just edit the resulting
1084Makefile at the end because the -Xp flag influenced a number of other
1085configure tests.
1086
1087Metaconfig's Configure scripts, on the other hand, can be interactive.
1088Thus if Configure is guessing things incorrectly, you can go back and fix
1089them. This isn't as important now as it was when we were actively
1090developing Configure support for new features such as dynamic loading,
1091but it's still useful occasionally.
1092
1093=item GPL
1094
1095At the time, autoconf-generated scripts were covered under the GNU Public
1096License, and hence weren't suitable for inclusion with Perl, which has a
1097different licensing policy. (Autoconf's licensing has since changed.)
1098
1099=item Modularity
1100
1101Metaconfig builds up Configure from a collection of discrete pieces
1102called "units". You can override the standard behavior by supplying your
1103own unit. With autoconf, you have to patch the standard files instead.
1104I find the metaconfig "unit" method easier to work with. Others
1105may find metaconfig's units clumsy to work with.
1106
1107=back
1108
1109=head2 @INC search order
1110
1111By default, the list of perl library directories in @INC is the
1112following:
1113
1114 $archlib
1115 $privlib
1116 $sitearch
1117 $sitelib
1118
1119Specifically, on my Solaris/x86 system, I run
1120B<sh Configure -Dprefix=/opt/perl> and I have the following
1121directories:
1122
1123 /opt/perl/lib/i86pc-solaris/5.00307
1124 /opt/perl/lib
1125 /opt/perl/lib/site_perl/i86pc-solaris
1126 /opt/perl/lib/site_perl
1127
1128That is, perl's directories come first, followed by the site-specific
1129directories.
1130
1131The site libraries come second to support the usage of extensions
1132across perl versions. Read the relevant section in F<INSTALL> for
1133more information. If we ever make $sitearch version-specific, this
1134topic could be revisited.
1135
1136=head2 Why isn't there a directory to override Perl's library?
1137
1138Mainly because no one's gotten around to making one. Note that
1139"making one" involves changing perl.c, Configure, config_h.SH (and
1140associated files, see above), and I<documenting> it all in the
1141INSTALL file.
1142
1143Apparently, most folks who want to override one of the standard library
1144files simply do it by overwriting the standard library files.
1145
1146=head2 APPLLIB
1147
1148In the perl.c sources, you'll find an undocumented APPLLIB_EXP
1149variable, sort of like PRIVLIB_EXP and ARCHLIB_EXP (which are
1150documented in config_h.SH). Here's what APPLLIB_EXP is for, from
1151a mail message from Larry:
1152
1153 The main intent of APPLLIB_EXP is for folks who want to send out a
1154 version of Perl embedded in their product. They would set the symbol
1155 to be the name of the library containing the files needed to run or to
1156 support their particular application. This works at the "override"
1157 level to make sure they get their own versions of any library code that
1158 they absolutely must have configuration control over.
1159
1160 As such, I don't see any conflict with a sysadmin using it for a
1161 override-ish sort of thing, when installing a generic Perl. It should
1162 probably have been named something to do with overriding though. Since
1163 it's undocumented we could still change it... :-)
1164
1165Given that it's already there, you can use it to override
1166distribution modules. If you do
1167
1168 sh Configure -Dccflags='-DAPPLLIB_EXP=/my/override'
1169
1170then perl.c will put /my/override ahead of ARCHLIB and PRIVLIB.
1171
c4f23d77 1172=head2 Shared libperl.so location
1173
1174Why isn't the shared libperl.so installed in /usr/lib/ along
1175with "all the other" shared libraries? Instead, it is installed
1176in $archlib, which is typically something like
1177
1178 /usr/local/lib/perl5/archname/5.00404
1179
1180and is architecture- and version-specific.
1181
1182The basic reason why a shared libperl.so gets put in $archlib is so that
1183you can have more than one version of perl on the system at the same time,
1184and have each refer to its own libperl.so.
1185
1186Three examples might help. All of these work now; none would work if you
1187put libperl.so in /usr/lib.
1188
1189=over
1190
1191=item 1.
1192
1193Suppose you want to have both threaded and non-threaded perl versions
1194around. Configure will name both perl libraries "libperl.so" (so that
1195you can link to them with -lperl). The perl binaries tell them apart
1196by having looking in the appropriate $archlib directories.
1197
1198=item 2.
1199
1200Suppose you have perl5.004_04 installed and you want to try to compile
1201it again, perhaps with different options or after applying a patch.
1202If you already have libperl.so installed in /usr/lib/, then it may be
1203either difficult or impossible to get ld.so to find the new libperl.so
1204that you're trying to build. If, instead, libperl.so is tucked away in
1205$archlib, then you can always just change $archlib in the current perl
1206you're trying to build so that ld.so won't find your old libperl.so.
1207(The INSTALL file suggests you do this when building a debugging perl.)
1208
1209=item 3.
1210
1211The shared perl library is not a "well-behaved" shared library with
1212proper major and minor version numbers, so you can't necessarily
1213have perl5.004_04 and perl5.004_05 installed simultaneously. Suppose
1214perl5.004_04 were to install /usr/lib/libperl.so.4.4, and perl5.004_05
1215were to install /usr/lib/libperl.so.4.5. Now, when you try to run
1216perl5.004_04, ld.so might try to load libperl.so.4.5, since it has
1217the right "major version" number. If this works at all, it almost
1218certainly defeats the reason for keeping perl5.004_04 around. Worse,
1219with development subversions, you certaily can't guarantee that
1220libperl.so.4.4 and libperl.so.4.55 will be compatible.
1221
1222Anyway, all this leads to quite obscure failures that are sure to drive
1223casual users crazy. Even experienced users will get confused :-). Upon
1224reflection, I'd say leave libperl.so in $archlib.
1225
1226=back
1227
aa689395 1228=head1 Upload Your Work to CPAN
1229
1230You can upload your work to CPAN if you have a CPAN id. Check out
1231http://www.perl.com/CPAN/modules/04pause.html for information on
1232_PAUSE_, the Perl Author's Upload Server.
1233
1234I typically upload both the patch file, e.g. F<perl5.004_08.pat.gz>
1235and the full tar file, e.g. F<perl5.004_08.tar.gz>.
1236
1237If you want your patch to appear in the F<src/5.0/unsupported>
1238directory on CPAN, send e-mail to the CPAN master librarian. (Check
7b5757d1 1239out http://www.perl.com/CPAN/CPAN.html ).
aa689395 1240
1241=head1 Help Save the World
1242
1243You should definitely announce your patch on the perl5-porters list.
1244You should also consider announcing your patch on
1245comp.lang.perl.announce, though you should make it quite clear that a
1246subversion is not a production release, and be prepared to deal with
1247people who will not read your disclaimer.
1248
1249=head1 Todo
1250
1251Here, in no particular order, are some Configure and build-related
1252items that merit consideration. This list isn't exhaustive, it's just
1253what I came up with off the top of my head.
1254
1255=head2 Good ideas waiting for round tuits
1256
1257=over 4
1258
1259=item installprefix
1260
1261I think we ought to support
1262
1263 Configure -Dinstallprefix=/blah/blah
1264
1265Currently, we support B<-Dprefix=/blah/blah>, but the changing the install
1266location has to be handled by something like the F<config.over> trick
1267described in F<INSTALL>. AFS users also are treated specially.
1268We should probably duplicate the metaconfig prefix stuff for an
1269install prefix.
1270
c4f23d77 1271=item Configure -Dsrc=/blah/blah
aa689395 1272
1273We should be able to emulate B<configure --srcdir>. Tom Tromey
1274tromey@creche.cygnus.com has submitted some patches to
c4f23d77 1275the dist-users mailing list along these lines. They have been folded
1276back into the main distribution, but various parts of the perl
1277Configure/build/install process still assume src='.'.
aa689395 1278
1279=item Hint file fixes
1280
1281Various hint files work around Configure problems. We ought to fix
1282Configure so that most of them aren't needed.
1283
1284=item Hint file information
1285
1286Some of the hint file information (particularly dynamic loading stuff)
1287ought to be fed back into the main metaconfig distribution.
1288
c4f23d77 1289=item Catch GNU Libc "Stub" functions
1290
1291Some functions (such as lchown()) are present in libc, but are
1292unimplmented. That is, they always fail and set errno=ENOSYS.
1293
1294Thomas Bushnell provided the following sample code and the explanation
1295that follows:
1296
1297 /* System header to define __stub macros and hopefully few prototypes,
1298 which can conflict with char FOO(); below. */
1299 #include <assert.h>
1300 /* Override any gcc2 internal prototype to avoid an error. */
1301 /* We use char because int might match the return type of a gcc2
1302 builtin and then its argument prototype would still apply. */
1303 char FOO();
1304
1305 int main() {
1306
1307 /* The GNU C library defines this for functions which it implements
1308 to always fail with ENOSYS. Some functions are actually named
1309 something starting with __ and the normal name is an alias. */
1310 #if defined (__stub_FOO) || defined (__stub___FOO)
1311 choke me
1312 #else
1313 FOO();
1314 #endif
1315
1316 ; return 0; }
1317
1318The choice of <assert.h> is essentially arbitrary. The GNU libc
1319macros are found in <gnu/stubs.h>. You can include that file instead
1320of <assert.h> (which itself includes <gnu/stubs.h>) if you test for
1321its existence first. <assert.h> is assumed to exist on every system,
1322which is why it's used here. Any GNU libc header file will include
1323the stubs macros. If either __stub_NAME or __stub___NAME is defined,
1324then the function doesn't actually exist. Tests using <assert.h> work
1325on every system around.
1326
1327The declaration of FOO is there to override builtin prototypes for
1328ANSI C functions.
1329
aa689395 1330=back
1331
1332=head2 Probably good ideas waiting for round tuits
1333
1334=over 4
1335
1336=item GNU configure --options
1337
1338I've received sensible suggestions for --exec_prefix and other
1339GNU configure --options. It's not always obvious exactly what is
1340intended, but this merits investigation.
1341
1342=item make clean
1343
1344Currently, B<make clean> isn't all that useful, though
1345B<make realclean> and B<make distclean> are. This needs a bit of
1346thought and documentation before it gets cleaned up.
1347
1348=item Try gcc if cc fails
1349
1350Currently, we just give up.
1351
1352=item bypassing safe*alloc wrappers
1353
1354On some systems, it may be safe to call the system malloc directly
1355without going through the util.c safe* layers. (Such systems would
1356accept free(0), for example.) This might be a time-saver for systems
1357that already have a good malloc. (Recent Linux libc's apparently have
1358a nice malloc that is well-tuned for the system.)
1359
1360=back
1361
1362=head2 Vague possibilities
1363
1364=over 4
1365
aa689395 1366=item MacPerl
1367
3e3baf6d 1368Get some of the Macintosh stuff folded back into the main distribution.
aa689395 1369
1370=item gconvert replacement
1371
1372Maybe include a replacement function that doesn't lose data in rare
1373cases of coercion between string and numerical values.
1374
aa689395 1375=item Improve makedepend
1376
1377The current makedepend process is clunky and annoyingly slow, but it
1378works for most folks. Alas, it assumes that there is a filename
1379$firstmakefile that the B<make> command will try to use before it uses
1380F<Makefile>. Such may not be the case for all B<make> commands,
1381particularly those on non-Unix systems.
1382
1383Probably some variant of the BSD F<.depend> file will be useful.
1384We ought to check how other packages do this, if they do it at all.
1385We could probably pre-generate the dependencies (with the exception of
1386malloc.o, which could probably be determined at F<Makefile.SH>
1387extraction time.
1388
1389=item GNU Makefile standard targets
1390
1391GNU software generally has standardized Makefile targets. Unless we
1392have good reason to do otherwise, I see no reason not to support them.
1393
1394=item File locking
1395
1396Somehow, straighten out, document, and implement lockf(), flock(),
1397and/or fcntl() file locking. It's a mess.
1398
1399=back
1400
fb73857a 1401=head1 AUTHORS
aa689395 1402
fb73857a 1403Original author: Andy Dougherty doughera@lafcol.lafayette.edu .
1404Additions by Chip Salzenberg chip@perl.com and
1405Tim Bunce Tim.Bunce@ig.co.uk .
aa689395 1406
1407All opinions expressed herein are those of the authorZ<>(s).
1408
1409=head1 LAST MODIFIED
1410
20f245af 1411$Id: pumpkin.pod,v 1.22 1998/07/22 16:33:55 doughera Released $