diff options
576 files changed, 60445 insertions, 0 deletions
diff --git a/Artistic b/Artistic new file mode 100644 index 0000000..a05f9e8 --- /dev/null +++ b/Artistic @@ -0,0 +1,125 @@ + The "Artistic License" + + Preamble + +The intent of this document is to state the conditions under which a +Package may be copied, such that the Copyright Holder maintains some +semblance of artistic control over the development of the Package, +while giving the users of the package the right to use and distribute +the Package in a more-or-less customary fashion, plus the right to make +reasonable modifications. + +It also grants you the rights to reuse parts of a Package in your own +programs without transferring this License to those programs, provided +that you meet some reasonable requirements. + +Definitions: + + "Package" refers to the collection of files distributed by the + Copyright Holder, and derivatives of that collection of files + created through textual modification. + + "Standard Version" refers to such a Package if it has not been + modified, or has been modified in accordance with the wishes + of the Copyright Holder as specified below. + + "Copyright Holder" is whoever is named in the copyright or + copyrights for the package. + + "You" is you, if you're thinking about copying or distributing + this Package. + + "Reasonable copying fee" is whatever you can justify on the + basis of media cost, duplication charges, time of people involved, + and so on. (You will not be required to justify it to the + Copyright Holder, but only to the computing community at large + as a market that must bear the fee.) + + "Freely Available" means that no fee is charged for the item + itself, though there may be fees involved in handling the item. + It also means that recipients of the item may redistribute it + under the same conditions they received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications +derived from the Public Domain or from the Copyright Holder. A Package +modified in such a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and +when you changed that file, and provided that you do at least ONE of the +following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or + an equivalent medium, or placing the modifications on a major archive + site such as uunet.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict + with standard executables, which must also be provided, and provide + a separate manual page for each non-standard executable that clearly + documents how it differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or +executable form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where + to get the Standard Version. + + b) accompany the distribution with the machine-readable source of + the Package with your modifications. + + c) give non-standard executables non-standard names, and clearly + document the differences in manual pages (or equivalent), together + with instructions on where to get the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this +Package. You may not charge a fee for this Package itself. However, +you may distribute this Package in aggregate with other (possibly +commercial) programs as part of a larger (possibly commercial) software +distribution provided that you do not advertise this Package as a +product of your own. + +6. The scripts and library files supplied as input to or produced as +output from the programs of this Package do not automatically fall +under the copyright of this Package, but belong to whoever generated +them, and may be sold commercially, and may be aggregated with this +Package. If such scripts or library files are aggregated with this +Package via the so-called "undump" or "unexec" methods of producing a +binary executable image, then distribution of such an image shall +neither be construed as a distribution of this Package nor shall it +fall under the restrictions of Paragraphs 3 and 4, provided that you do +not represent such an executable image as a Standard Version of this +Package. + +7. You may reuse parts of this Package in your own programs, provided that +you explicitly state where you got them from, in the source code (and, left +to your courtesy, in the documentation), duplicating all the associated +copyright notices and disclaimers. Besides your changes, if any, must be +clearly marked as such. Parts reused that way will no longer fall under this +license if, and only if, the name of your program(s) have no immediate +connection with the name of the Package itself or its associated programs. +You may then apply whatever restrictions you wish on the reused parts or +choose to place them in the Public Domain--this will apply only within the +context of your package. + +8. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + The End diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..3dce502 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1457 @@ +Fri Feb 28 17:48:41 MET 1997 Raphael Manfredi <Raphael_Manfredi@grenoble.hp.com> + +. Description: + + This huge set of patch results from an integration of the + perl5 units into the dist-3.0 package. A few improvements + of mine are also incorporated here, but this patch set should + mainly be credited to Andy Dougherty and Chip Salzenberg, who + have both assumed the perl5 Patch Pumpkin with success and brio. + + I won't document most of the changes in detail. Only the obvious + ones were kept here. You can look closer to the patches themselves + to see what really changed. Especially the new units, since you + now have more symbols to check for in your C code... + + Regenerated Configure with current set of units. + + Added Perl Patch Pumpkin credits. Thanks to Andy Dougherty and + to Chip Salzenberg for their incredible contributions to + metaconfig. + + Changed my email address and updated copyright dates + + Added support for src.U. This means you can now run Configure + from a remote directory to separate the build directory and + the (possibly read-only) source tree. + Note that some of your private units may require some changes + due to that... + + Removed support for NO_PROTOTYPE detection on SCO. + + Added cute quoting trick for wild stringify support, which + allows non-ANSI stringification to occur. + + Replaced .a with $_a all over the place. + Likewise for .o replaced by $_o. + You'll have to do that to your own private units. + + Integrated new units from perl5. I will not document most + of the perl5-related changes here. People interested can + look at Andy's notes in the perl5 distribution. + + New USE_BSD_GETPGRP to detect the getpgrp() flavour. The old + USE_BSDPGRP has been obsoleted in favor of USE_BSD_SETPGRP. + Indeed, setpgrp() and getpgrp() can have distinct flavors, + so we need two distinct tests for them. + + Useless units dropped: d_group.U and d_passwd.U. + + Mention that <poll.h> can be included if HAS_POLL defined. + + Improved overlapping copy check. + + Added support for Free_t, the type of free(). + + Don't use nm with the GNU C library. + Added support for Linux shared libs. + + Don't prompt them if the void support is high enough for us + and don't ask for the include path unless they are on a MIPS. + + Added the srcdir support to "configure" now that we have src.U. + + Documented the runnning environment and the src.U unit in + the metaconfig man page. The $_a and $_o are also mentionned. + All the generated scripts must now start with a "$startsh" + to ensure proper shell execution. + + New "create" and "empty" lint directives. + + New -L option for metaxref to match metaconfig and metalint. + + Documents contents of the message sent by patnotify: + we now let them know the patch priority and description. + + Added a whole bunch of new units, mostly from the perl5 team. + +. Files changed: + + * bin/packinit.SH: Fixed one wrong ':' comment in .package. + + * jmake/files/Jmake.rules: Now handles USRINC for dependencies. + Smarter about dependencies computation. + + * jmake/files/Jmake.tmpl: Lex path can now be configured. + + * mcon/U/Begin.U: Added Extractall dependency. + + * mcon/U/Config_sh.U, mcon/U/Oldsym.U, mcon/U/Extract.U, + mcon/U/patchlevel.U, mcon/U/MailAuthor.U, mcon/U/Chk_MANI.U, + mcon/U/Config_h.U: Added support for src.U. + + * mcon/U/Configdir.U: Have README explicitely mention the package + name. + + * mcon/U/make.U, mcon/U/d_strtoul.U, mcon/U/Unix.U, + mcon/U/d_inetaton.U, mcon/U/sitearch.U, mcon/U/d_sanemcmp.U, + mcon/U/i_locale.U, mcon/U/d_sigaction.U, mcon/U/d_getpgid.U, + mcon/U/src.U, mcon/U/sitelib.U, mcon/U/d_brokstat.U, mcon/U/man3dir.U, + , mcon/U/d_sigsetjmp.U, mcon/U/i_sysstat.U, mcon/U/d_strtod.U, + mcon/U/d_byacc.U, mcon/U/sh.U, mcon/U/Signal.U, mcon/U/d_gnulibc.U, + mcon/U/man1dir.U, mcon/U/Extractall.U, mcon/U/i_values.U, + mcon/U/i_sfio.U: Created. + + * mcon/U/Getfile.U: Getfile script now begins with "startsh". + + * mcon/U/Head.U: Make sure we unset CDPATH for shells that support + this. Improved Korn shell detection and handling. + + * mcon/U/Instruct.U: Logname / whoami sequence rewritten to use case. + + * mcon/U/Loc.U: Allow users to specify paths on the command line. + Will now substitute cp for ln if not supported. + + * mcon/U/Myread.U: Myread script now starts with a "startsh". + Miscellaneous fixes. + + * mcon/U/Oldconfig.U: Added support for src.U. New OSNAME define. + Can now sense new OSes. + + * mcon/U/Options.U: Optdef.sh now starts with a "startsh". Moved + some code from Head.U. + + * mcon/U/Whoa.U: Whoa script now starts with leading "startsh". + + * mcon/U/afs.U: Can now explicitely tell Configure whether AFS is + running. + + * mcon/U/archlib.U: Skip existence checks for archlib. + + * mcon/U/archname.U: Changed the way the archname is mangled from + uname. + + * mcon/U/byteorder.U: No longer ask the user if the test runs ok. + + * mcon/U/ccflags.U: Removed support for NO_PROTOTYPE detection on + SCO. New locincpth variable. Added info on the "additional ld + flags" question. + + * mcon/U/cf_who.U: New computation method avoiding use of temporary + file. + + * mcon/U/cpp_stuff.U: Added cute quoting trick for wild stringify + support. + + * mcon/U/d_bsdjmp.U, mcon/U/d_fd_set.U, mcon/U/models.U, + mcon/U/d_scannl.U, mcon/U/d_open3.U, mcon/U/d_closedir.U: Added ?F: + metalint hint. + + * mcon/U/libs.U, mcon/U/libnm.U, mcon/U/libyacc.U, mcon/U/libflex.U, + mcon/U/libdbm.U, mcon/U/d_socket.U, mcon/U/d_normsig.U, + mcon/U/d_crypt.U: Replaced .a with $_a all over the place. + + * mcon/U/d_csh.U: Added full_csh to preserve the full path even when + portable. + + * mcon/U/d_dosuid.U: Moved unit to TOP via a ?Y: layout directive. + Tell them /dev/fd is not about floppy disks. + + * mcon/U/d_gconvert.U: Integrated new unit from perl5. + + * mcon/U/d_getpgrp.U: New USE_BSD_GETPGRP to detect the getpgrp() + flavour. + + * mcon/U/d_group.U, mcon/U/d_passwd.U: Useless unit dropped. + + * mcon/U/d_usendir.U, mcon/U/d_havetlib.U, mcon/U/errnolist.U: + Replaced .a with $_a all over the place. Likewise for .o replaced by + $_o. + + * mcon/U/d_newsadm.U: Added Guess dependency. + + * mcon/U/d_pidcheck.U: Replaced .o with $_o all over the place. + Added ?F: metalint hint. + + * mcon/U/d_poll.U: Mention that <poll.h> can be included if HAS_POLL + defined. + + * mcon/U/d_safebcpy.U, mcon/U/d_safemcpy.U: Improved overlapping copy + check. Comfort them if they have memmove. Added ?F: metalint hint. + + * mcon/U/d_setpgid.U: Reworded symbol comments. + + * mcon/U/d_setpgrp.U: Obsoleted USE_BSDGRP in favor of + USE_BSD_SETPGRP. Another unit now also defines a USE_BSD_GETPGRP. + Fallback for test program failure improved. + + * mcon/U/d_sgndchr.U, mcon/U/d_wifstat.U: Added a ?F: metalint hint. + + * mcon/U/d_sigvec.U: There is now a separate routine for sigaction(). + + * mcon/U/d_stdstdio.U: Merged with perl5's unit. + + * mcon/U/d_syslog.U, mcon/U/mkdep.U: Replaced .o with $_o all over + the place. + + * mcon/U/i_dbm.U: Added I_RPCSVC_DBM check. + + * mcon/U/i_varhdr.U: Varargs script now starts with leading "startsh". + + * mcon/U/intsize.U: Avoid prompting the user if the test runs ok. + Moved code from longsize.U into there. New tests for shortsize as + well. + + * mcon/U/libc.U: Replaced .a with $_a all over the place. Added + support for HPUX-10 nm output. + + * mcon/U/libnlist.U: Added usrinc and mips on the dependency line. + Make sure we call ./mips. Added a ?LINT: hint. + + * mcon/U/libpth.U: New loclibpth variable. + + * mcon/U/longsize.U: Code moved to intsize.U. + + * mcon/U/mallocsrc.U: Added support for Free_t, the type of free(). + Replaced .o with $_o all over the place. + + * mcon/U/manfmt.U, mcon/U/mansrc.U: Don't ask for AFS when they + choose to not install pages. + + * mcon/U/myhostname.U: Improved hostname lookup by using ypmatch when + NIS is used. + + * mcon/U/nblock_io.U: Simplify here document for shells that can't + handle them well. Force use of "startsh" at the head of the + generated script. Added new files to the ?F: metalint hint. + + * mcon/U/nis.U: Ensure suitable defaults for hostcat and friends. + + * mcon/U/orderlib.U: Replaced .a with $_a all over the place. + Likewise for .o replaced by $_o. Now uses the ar located by Loc.U. + + * mcon/U/randbits.U: Added <unistd.h> and <stdlib.h> to the C program + test. + + * mcon/U/registers.U: Removed empty ?LINT lines. + + * mcon/U/selecttype.U: Always include <sys/select.h> when available + for test. + + * mcon/U/sig_name.U: Brand new algorithm for sig_name and (new!) + sig_num. + + * mcon/U/spitshell.U: Removed useless chatter as this is now done + very early. + + * mcon/U/ssizetype.U: Integrated perl5 concerns for mis-configured + sfio. + + * mcon/U/startperl.U: Warn them if the #! line is too long for their + OS. + + * mcon/U/startsh.U: Avoid needless chatter since this is now done + very early. + + * mcon/U/usenm.U: Don't use nm with the GNU C library. Added support + for Linux shared libs. + + * mcon/U/usrinc.U: Don't ask for the include path unless they are on + a MIPS. + + * mcon/U/voidflags.U: Don't prompt them if the void support is high + enough for us. + + * mcon/configure: Added the srcdir support now that we have src.U. + Random cleanup for nicer help message. + + * mcon/man/mconfig.SH: Documents the runnning environment and the + src.U unit. Added warnings for $_a and $_o, as well as "startsh". + + * mcon/man/mlint.SH: New "create" and "empty" lint directives. + Documented new messages. + + * mcon/mxref.SH, mcon/man/mxref.SH: New -L option to match metaconfig + and metalint. + + * mcon/pl/lint.pl: Added support for ?F: lines to monitor file usage. + Now honours "create" and "empty" lint directives. + + * pat/pat.man: Documents contents of the message sent by patnotify. + + * pat/patlog.SH: Typo fix. + + * pat/patnotify.SH: Let them know the patch priority and description. + +Mon Sep 25 10:33:26 MET 1995 Raphael Manfredi <ram@hptnos02.grenoble.hp.com> + +. Description: + + Smarter sed command to strip /usr/include dependencies in + jmake-generated Makfiles. Thanks to Ulrich Pfeifer + <pfeifer@buster.informatik.uni-dortmund.de> for contributing it. + + In response to the discussion on dist-users, jmake will now force + macro definitions to the left in the generated Makefile, even + though they may be nicely formatted in the imake-style within + the Jmakefile itself (centered on the =). + + Commented the purpose of the #un-def directive in the relevant + unit, since I tend to forget about this hack and almost considered + removing it without seeing the consequences. ;-) + + Configure will now abort when a mandatory command is missing. + Indeed, Configure relies on such commands to perform its various + tasks, and a miss can have dreadful consequences, without the + end-users noticing it. + + Protected option parsing code against 'echo -*' option failure. + + Various units are now forced to the top of Configure, if possible. + This is mainly interactive questions. Note that dependencies are + still respected, i.e. all the units on which those depend will + come before, so the top-ness is a relative issue. + + All possible install programs are now looked for, instead of + breaking the loop once one was found. Also, to optimize cache + access on AFS directories, the lookup is done on directories + first, then on programs instead of the other way round. + + New ?Y: directive to change unit layout. You may specify a + TOP, DEFAULT or BOTTOM request on that line to respectively + force the unit to the earliest possible, default or latest + possible place in the Configure script, as dependencies + permit. + + Symbols are now sorted according to the ?Y: layout directive. + + If you use the MailAuthor.U unit, you will be interested by the + new -i option for patsend to add extra instructions for people + receiving mailed patches. patnotify also tells users how to directly + request for mailed patches. The patch making process now automatically + supply the -i when invoking patsend. Changes contributed by Graham + Stoney <greyham@research.canon.oz.au>. + +. Files changed: + + * jmake/files/Jmake.rules: Smarter sed command to strip /usr/include + dependencies. + + * jmake/jmake.SH: Will now force macro definitions to the left. + + * mcon/U/Config_h.U: Commented the purpose of the #un-def directive. + + * mcon/U/Loc.U: Commented the purpose of the #un-def directive. + Abort Configure run when mandatory command is missing. + + * mcon/U/Options.U: Protected option parsing code against 'echo -*' + option failure. + + * mcon/U/perlpath.U, mcon/U/manfmt.U, mcon/U/mansrc.U, + mcon/U/scriptdir.U, mcon/U/archlib.U, mcon/U/lib.U, mcon/U/privlib.U, + mcon/U/bin.U: Unit is now forced to the top of Configure, if possible. + + * mcon/U/install.U: All possible install programs are now looked for. + + * mcon/man/mconfig.SH, mcon/man/mlint.SH: Documented new ?Y: + directive. Fixed my e-mail address. + + * mcon/pl/depend.pl, mcon/pl/init.pl, mcon/pl/lint.pl: New ?Y: + directive to change unit layout. + + * mcon/pl/makefile.pl: Symbols are now sorted according to the ?Y: + layout directive. + + * mcon/pl/xref.pl: Added empty p_layout stub for new ?Y: directives. + + * pat/pat.man: New -i option for patsend to add extra instructions. + + * pat/patmake.SH: Now calls patsend with -i to add more instructions. + + * pat/patnotify.SH: Now tells users how to directly request for + mailed patches. + + * pat/patsend.SH: New -i option to add more instructions for + end-users. + +Tue Jul 25 16:41:40 METDST 1995 Raphael Manfredi <ram@hptnos02.grenoble.hp.com> + +. Description: + + pat/Jmakefile was missing an entry for the patlog program, which + prevented it from being installed, leading to chaos when patmake + was run. + + New contributions from Ilya Zakharevich <ilya@math.ohio-state.edu> + to provide OS/2 support. Configure can now be run under OS/2 using + a ksh shell interpreter. Support for pdksh is undergoing, as far + as I understand. + + The installation of script man pages can now cope with missing + files. The jmake rules used to require that all scripts or none + have .man files associated with them. From now on, the generated + Makefile will check for the manual page existence before trying + to install it. + + The clobber target now removes the .config directory as well, + which is generated by Configure to cache various information + over runs. Since clobber is intended to make a clean distribution, + that directory must be removed at that stage. + + All jmake error messages are now prefixed with the program name. + + Re-arranged compile line to include ldflags before objects + within all the compile-link tests in the metaconfig units, since + some systems require that ld flags be specfied at that place. + The only exception to this being the -llib directive, which stays + at the end of the line (from Spider Boardman). + + added SVR4-ish /opt directories to path list (ADO) + + Added backslash escapes within evals in Typedef.U to prevent problems + when the assigned variables have space in them (such as 'int *')... + + Force compile-link test for dl* routines since those symbols might lie + in crt0.o, and not in any other library (ADO) + + Improved comments about the Gconvert macro and forced a compile-link + test since the gconvert routine may exist but be unusable because + it would refer to otherwise missing routines... Sigh! (ADO) + + Made cc and ccflags optional dependencies in several units. + + Added knowledge of the O_NONBLOCK symbol in d_open3.U (required for + non-blocking I/O support, which is now computed by the new nblock_io.U + unit). + + Use findhdr to find <sys/shm.h>, to get the right one (ADO) + + Typo fix on ?C: line for FILE_bufsiz in d_stdstdio.U. + Also fixed unbalanced parenthesis and check whether FILE_cnt + and FILE_ptr can be assigned to, i.e. may be used as lvalues. (ADO) + + Typo fix, sytem -> system in d_time.U and d_times.U. + + Conditionally use const in test programs for i_db.U (ADO) + + Use setvar so hint file values can override our guesses in + i_pwd.U. (ADO) + + Removed <> characters from comments, per metalint suggestion + + Ensure ctrl-A characters are visible in prompt within the + mboxchar.U unit (WED) + + Removed harmful spaces in assignment for selecttype.U. + + Added <asm/signal.h> lookup for correct signal name lookup + under linux. That's probably as far as we'll get to support + those idiosyncracies. + + Obsoleted KEEPALIVE in favor of CAN_KEEPALIVE for consistency + with the 3.0 naming scheme. + + New metaconfig -G option to include a GNU configure-like + wrapper over the generated Configure script. That way, + people with a GNU background will be able to use (some) of + the GNU configure options to configure the package. The + wrapper computes suitable Configure options and then launches + that script. + + Manual page for metaconfig now documents the new -G option, + includes an extended description of the Csym.U unit and + mentions what a compile-link test line should look like. + + Metalint will now check : comments line for potential danger, + since those lines are really interpreted by the shell. Therefore, + unbalanced quotes could cause huge parts of the Configure script + to be ignored at run time, yielding weird results. Anyway, + metalint will tell you about them. + + Two new files: a new unit, and the GNU configure-like wrapper. + +. Files changed: + + * Jmakefile: Re-ordered macros, moving the install at the end. + + * bin/packinit.man: Fixed a typo. + + * jmake/files/Jmake.rules: Install of script man pages can now cope + with missing files. The clobber target now removes the .config + directory as well. + + * jmake/jmake.SH: All error messages are now prefixed with the + program name. + + * mcon/Jmakefile: Installs the GNU configure-like front-end to + Configure. + + * mcon/U/Csym.U: Re-arranged compile line to include ldflags before + objects. Added quotes for OS/2 support. + + * mcon/U/libs.U, mcon/U/Loc.U, mcon/U/Guess.U, mcon/U/Oldconfig.U, + mcon/U/libc.U: Now knows about OS/2 platforms. + + * mcon/U/Head.U: Added SVR4-ish /opt directories to path list (ADO). + OS/2 platforms are using another path separator. + + * mcon/U/Typedef.U: Added backslash escapes within evals to prevent + space problems. + + * mcon/U/d_safebcpy.U, mcon/U/d_wifstat.U, mcon/U/d_setpgrp.U, + mcon/U/ccflags.U, mcon/U/d_safemcpy.U: Re-arranged compile line to + include ldflags before objects. + + * mcon/U/d_dlerror.U, mcon/U/d_dlopen.U: Force compile-link test + since symbol might lie in crt0.o (ADO). + + * mcon/U/d_gconvert.U: Improved comments about the Gconvert macro + (ADO). Force compile-link test since it may exist but be unusable + (ADO). + + * mcon/U/d_volatile.U, mcon/U/d_sgndchr.U, mcon/U/d_scannl.U, + mcon/U/d_keepsig.U: Made cc and ccflags optional dependencies. + + * mcon/U/d_open3.U: Added knowledge of the O_NONBLOCK symbol. + + * mcon/U/d_shmat.U: Use findhdr to find <sys/shm.h>, to get the right + one (ADO). + + * mcon/U/d_stdstdio.U: Typo fix on ?C: line for FILE_bufsiz. Fixed + unbalanced parenthesis (ADO). Check whether FILE_cnt and FILE_ptr + can be assigned to (ADO). + + * mcon/U/d_times.U, mcon/U/d_time.U: Typo fix, sytem -> system. + + * mcon/U/i_db.U: Conditionally use const in test programs (ADO). + + * mcon/U/i_pwd.U: Use setvar so hint file values can override our + guesses (ADO). + + * mcon/U/i_sysfile.U: Removed <> characters from comment, per + metalint suggestion. + + * mcon/U/mboxchar.U: Ensure ctrl-A characters are visible in prompt + (WED). + + * mcon/U/nblock_io.U, mcon/configure: Created. + + * mcon/U/selecttype.U: Removed harmful spaces in assignment. + + * mcon/U/sig_name.U: Added <asm/signal.h> lookup for linux. + + * mcon/U/sockopt.U: Obsoleted KEEPALIVE in favor of CAN_KEEPALIVE for + consistency. + + * mcon/man/mconfig.SH: Added extra nroff escapes at line heads to + keep leading dots. Documented new -G option. Extended description + of the Csym.U unit. Now mentions what a compile-link test line + should look like. + + * mcon/man/mlint.SH: Added two new warnings for : comments lines in + Configure. + + * mcon/mconfig.SH: New -G option. + + * mcon/pl/cosmetic.pl: Added support for new -G option. + + * mcon/pl/lint.pl: Will now check : comments line for potential + danger. + + * pat/Jmakefile: Was missing an entry for the patlog program. + +Fri May 12 14:39:16 METDST 1995 Raphael Manfredi <ram@hptnos02.grenoble.hp.com> + +. Description: + + Regenerated Configure with pre-release of PL54. + + Updated my e-mail address in all manual pages. I had forgotten + about that in my previous patch. + + Various fixes in units from Andy Dougherty. Thanks to him and + to the efficient perl5-porters team that strive to port perl5 + to every possible existing platform on Earth, hence making + Configure more and more robust ;-). Here are Andy's fixes: + + . split awk command onto two lines for older awks + . fixed C test program to bypasss gcc builtin type checks + . deleted tabs that caused some /bin/sh to core dump + . cleaned up and extended osvers for DEC OSF/1 + . added MachTen detection + . protect against spaces in "uname -m" output + . extended for more intimate DB probing + . made more robust [ng]dbm units by checking both header + and libraries for features + . can now grok linux nm output with leading __IO + . added support for linux ELF output, using 'W' for alias + . now looks for <linux/signal.h> too + . ensure that ./mips always exists + + Added -K option for experts. That Configure option should only + be used when you know what you are doing. The config.sh reload + logic now knows about new -K switch so that you now have to say: + Configure -dK + to get the old + Configure -d + behaviour. + + Configure now checks for a valid C compiler and that the + specified ccflags and ldflags are coherent with the choice + of the C compiler. It aborts if the C compiler does not + work (since it might be used for feature testing), but only + offers to abort when a flag inconsistency is detected. + Contributed by Tye McQueen (again!). + + Complete rewrite of d_stdstdio.U by Tye McQueen to fit modern + systems. The USE_STD_STDIO symbol has been obsoleted by the + new USE_STDIO_PTR symbol. Also, access to _ptr, _cnt and + _base fields in the FILE structure should be made only via the + new metaconfig macros FILE_ptr, FILE_cnt, etc... + + Made sure only most recent version of shared lib is picked. + This is for systems where libc.so.3 and libc.so.13 might + co-exist. We really need to pick the second one, whereas the + previous alphabetic sort was picking the first. + + Final "nm -p" check now uses xscan and xrun like everybody. + It used to do its checking manually. Using xscan and xrun allows + for the printing of the busy dots while scanning. + + The patpost script will now add an explicit From: header line + pointing to the maintainer address, as configured in your + .package. This is to prevent broken inews to insert the hostname + where patpost is ran, which might not be visible from the outside. + +. Files changed: + + * pat/pat.man, bin/packinit.man, jmake/jmake.man, kit/kitpost.man, + bin/manilist.man, kit/makedist.man, jmake/jmkmf.man, kit/manifake.man, + , dist.man: Updated my e-mail address. + + * mcon/U/Cppsym.U: Split awk command onto two lines for older awks + (ADO). + + * mcon/U/Csym.U: Fixed C test program to bypasss gcc builtin type + checks (ADO). + + * mcon/U/Inhdr.U: Deleted tabs that caused some /bin/sh to core dump + (ADO). + + * mcon/U/Oldconfig.U: Config.sh reload logic now knows about new -K + switch. Cleaned up and extended osvers for DEC OSF/1 (ADO). Added + MachTen detection (ADO). + + * mcon/U/Options.U: Added -K option for experts. + + * mcon/U/archname.U: Protect against spaces in "uname -m" output + (ADO). + + * mcon/U/cc.U: May now abort Configure when cc does not work. + + * mcon/U/ccflags.U: Now checks for cc/ccflags/ldflags coherency. + + * mcon/U/d_casti32.U: Made sure cc and ccflags are conditional + dependencies. + + * mcon/U/d_castneg.U: Made sure cc and ccflags are conditional + dependencies. Added improved test case for Interactive Unix. + + * mcon/U/d_stdstdio.U: Complete rewrite by Tye McQueen to fit modern + systems. + + * mcon/U/d_voidsig.U: Made cppflags dependency optional. + + * mcon/U/i_db.U: Extended for more intimate DB probing (ADO). + + * mcon/U/i_gdbm.U, mcon/U/i_ndbm.U, mcon/U/i_dbm.U: Made more robust + by checking both header and lib (ADO). + + * mcon/U/libc.U: Made sure only most recent version of shared lib is + picked. Final "nm -p" check now uses xscan and xrun like everybody. + Can now grok linux nm output with lead __IO (ADO). Added support for + linux ELF output, using 'W' for alias (ADO). + + * mcon/U/sig_name.U: Now looks for <linux/signal.h> too (ADO). + + * mcon/U/usrinc.U: Ensure that ./mips always exists (ADO). + + * mcon/man/mconfig.SH: Documented new -K switch for knowledgeable + users. + + * pat/patpost.SH: Added explicit From: header line pointing to the + maintainer. + +Tue Mar 21 09:55:57 MET 1995 Raphael Manfredi <ram@hptnos02.grenoble.hp.com> + +. Description: + + Regenerated Configure to reflect my email address change. I moved + from ACRI to HP, and my email is now: <ram@hptnos02.grenoble.hp.com>. + The "critical" nature of this patch is due to that mere fix. + + Jmake was not working at all on HP-UX due to the way their cpp + systematically removes trailing backslashes in text. The new + fixcpp script is now a wrapper over cpp to first escape those + backslashes that should be preserved accross cpp before feeding + it with the text of the Jmakefile... + + Suppressed extra argument to NormalProgramTarget call in jmake rules. + + Definition of the paths variable in Head.U wrongly added spurious + ':' chars. Thanks to Karst Koymans <Karst.Koymans@phil.ruu.nl> for + pointing it out. + + Swapped two first arguments of memcpy() calls for memcpy safe + overlapping copy tests. Indeed, the memcpy() calling sequence used + was the same as bcopy(), but the first two arguments should be + swapped to preserve the same semantics. + + Continued fix for NeXT NIS/NetInfo handling, from Graham Stoney. + + Two new files. + +. Files changed: + + * jmake/Jmakefile: Now installs new fixcpp script in the private + libdir. + + * jmake/files/Jmake.rules: Suppressed extra argument to + NormalProgramTarget call. + + * jmake/fixcpp.SH, mcon/U/d_wifstat.U: Created. + + * jmake/jmake.SH: Now invokes cpp through new fixcpp script. First + pass now skips cpp comments alltogether. + + * mcon/U/Head.U: Definition of paths wrongly added spurious ':' chars. + + * mcon/U/d_safemcpy.U: Swapped two first arguments of memcpy() calls. + + * mcon/U/nis.U: Continued fix for NeXT NIS/NetInfo handling. + +Wed Feb 15 15:23:06 MET 1995 Raphael Manfredi <ram@acri.fr> + +. Description: + + This patch only contains random cleanup and minor fixes that were + brought to my attention on the dist-users list. + + Regenerated Configure with pre-release of 3.0 PL51, since it + was a little outdated. + + Wayne Davison's changes: + . now clearer about how to edit config.sh at the end of Configure. + . Getfile was not working if ~'s allowed with d_portable on + . Instruct.U: author name now appears at the end of a paragraph + + Andy Dougherty adapted osvers computation for AIX. He also + fixed mansrc.U where I had mistakenly duplicated /usr/local/man/man1. + He added /opt/man/man1 to the lookpath instead, a change originating + from Tye McQueen <tye@metronet.com>. + + Architecture name is now computed by a separate unit. This allows + authors to precompute it in a hint file, while warning the user + when the machine's architecture name changes (because for instance + the OS was upgraded), preventing mistakes. + + Now correctly handles NeXT using NIS rather than NetInfo, thanks + to a patch sent by Graham Stoney <greyham@research.canon.oz.au>. + + One new file (unit archname.U). + +. Files changed: + + * mcon/U/Finish.U: Now clearer about how to edit config.sh at the + prompt (WED). + + * mcon/U/Getfile.U: Was not working if ~'s allowed with d_portable on + (WED). + + * mcon/U/Instruct.U: Author name now appears at the end of the + paragraph (WED). + + * mcon/U/Oldconfig.U: Adapted osvers computation for AIX (ADO). + + * mcon/U/archlib.U: Architecture name is now computed by a separate + unit. + + * mcon/U/archname.U: Created. + + * mcon/U/mansrc.U: Was mistakenly duplicating /usr/local/man/man1 + (ADO). Added /opt/man/man1 to the lookpath (ADO). + + * mcon/U/nis.U: Now correctly handles NeXT using NIS rather than + NetInfo. + +Mon Jan 30 15:59:00 MET 1995 Raphael Manfredi <ram@acri.fr> + +. Description: + + The dist-3.0 package now works with perl 5.0. I have made perl 5.0 + the default perl on my machine and ran the whole set of pat* tools, + jmake and metaconfig without any trouble so far. However, you need + a patched-up version of perl 5.0 PL0, as explained in README. + + This set of patches is mainly an integration of Wayne Davison's + changes for trn. His changes are flagged as WED. + + Begin.U: + Avoid an empty rmlist: systems might choke on it (WED). + + Config_h.U: + Typo fixes in leading config.h comment (WED). + + Oldconfig.U: + Update code for myuname changed (WED). + + Configure can now handle installation prefix changes. I have + slightly adapted the changes proposed by Wayne, introducing two + new special units (Prefixit.U and Prefixup.U) to factorize code. + + d_attribut.U: + Test C program now includes <stdio.h> (WED) + + page.U: + Ensure dflt gets initialized in case no pagers are found (WED) + + prefix.U: + Save off previous prefix value in oldprefix if changed (WED) + Added the INSTALLPREFIX define for C programs to use (WED) + + Archname is now systematically recomputed. This avoids problem when + the user changes his mind about the OS name. + + Now looks for POSIX regcomp() routine, and for <regex.h>, thanks + to Sidney C. Smith <scsmith@cbda9.apgea.army.mil>. + + New installmanfmt and AFS-lookup for formatted man pages, derived + from what is done for troffed man pages. + + New prefixexp variable holding a fully expanded prefix, in case + they use ~name expansion in their prefix. + + Documented new special units Prefixit.U and Prefixup.U. + + Clean-up and workarounds for perl 5.0 PL0 port: + Removed old "do name()" routine call constructs. + Forgot to localize the spaces variable. + Random clean-up in &record_obsolete. + + Three new files. + +. Files changed: + + * mcon/U/Begin.U: Avoid an empty rmlist: systems might choke on it + (WED). + + * mcon/U/Config_h.U: Typo fixes in leading config.h comment (WED). + + * mcon/U/Oldconfig.U: Unit Options.U now exports file optdef.sh, not + a variable. Update code for myuname changed (WED). + + * mcon/U/Options.U: This unit now exports file optdef.sh, not a + variable. + + * mcon/U/i_regex.U, mcon/U/Prefixit.U, mcon/U/Prefixup.U: Created. + + * mcon/U/archlib.U: Archname is now systematically recomputed. Can + now handle installation prefix changes (from WED). + + * mcon/U/mansrc.U, mcon/U/scriptdir.U, mcon/U/lib.U, mcon/U/privlib.U, + , mcon/U/bin.U: Can now handle installation prefix changes (from WED). + + * mcon/U/d_attribut.U: Test C program now includes <stdio.h> (WED). + + * mcon/U/d_regcmp.U: Now looks for POSIX regcomp() routine. + + * mcon/U/manfmt.U: New installmanfmt and AFS-lookup for formatted man + pages. Can now handle installation prefix changes (from WED). + + * mcon/U/pager.U: Ensure dflt gets initialized in case no pagers are + found (WED). + + * mcon/U/prefix.U: New prefixexp variable holding a fully expanded + prefix. Save off previous prefix value in oldprefix if changed + (WED). Added the INSTALLPREFIX define for C programs to use (WED). + + * mcon/U/rootid.U: Now only prints a single empty line when + outputting something. + + * mcon/man/mconfig.SH: Documented new special units Prefixit.U and + Prefixup.U. + + * mcon/pl/configure.pl, mcon/pl/eval.pl: Removed old "do name()" + routine call constructs. + + * mcon/pl/cosmetic.pl: Forgot to localize the spaces variable. + + * mcon/pl/obsolete.pl: Random clean-up in &record_obsolete. + +Wed Jan 11 17:03:22 MET 1995 Raphael Manfredi <ram@acri.fr> + +. Description: + + Regenerated Configure with pre-release of metaconfig PL45 to + benefit from the new install program lookup. From now on, the + supplied install.SH script will not be used if a BSD-compatible + install executable is found on your host (to accelerate the whole + install procedure). + + Regenerated many Makefile.SH files with pre-release of jmake PL45 + to correctly handle the new install and installdir configuration + variables. + + Updated the Wishlist file. + + New jmake macros. Also the MakeDirs macro was modified to benefit + from the information gathered by Configure concerning the way to + install nested directories (uses the new installdir variable). + + As a consequence, Makefile.SH files now pre-compute INSTALL and + INSTALLDIR variables before substituting (concerns jmake-generated + makefiles). + + Moved path stripping from d_portable.U to end of Configure. This + lets Configure use $vi and $perl, etc... set to their fully + qualified path name, hence making it easier for units to know + whether a particular program was located. Formerly, you had to + use $_vi, $_perl, etc... in case they asked for portability, which + stripped out executable paths. + + New cc vs. cpp symbol checking, as well as more cpp symbols in + the attribute list. Configure will now try to determine separately + symbols defined by cpp and by the cc wrapper, letting you know about + what is defined and by whom. Thanks to Jarkko Hietaniemi for this + suggestion. + + Added support for escaping answers to skip various checks in the + Getfile.U unit. For instance, you may now say: + fn='/fe~(foo)' + . ./getfile + and let them answer only fully qualified paths OR the string 'foo'. + You may supply a comma-separated list between the parenthesis. See + the manual page or the new install.U unit for more information. + + Modified message issued after file expansion in the Getfile unit. + + Protected various "sh -c" calls within backquotes for Linux and + SGI shells (to prevent an "ambiguous output redirection" message). + Thanks to Xavier Le Vourch for suggesting it. + + Added & escape allowing user to turn on -d from the prompt. Several + people have expressed the need for such a feature, arguing that + once they have re-run a Configure script to fix the answer to a + particular question, they would like to have the remaining of the + script ran as if -d had been given to Configure. Well, they now + may reply '& -d' at the Myread prompt to turn -d on. + + New -O option allowing -D and -U to override config.sh setttings. + This may be used to alter particular variables but still re-use + most of the previously guessed-at ones. Still, this may produce + inconsistencies and therefore is not the default behaviour (the + -D and -U switches have no effect by default if a previous config + file is loaded). + + Therefore, file optdef.sh is no longer removed after sourcing from + the UU directory. + + Changed gcc checking message to a more explicit one (WED) + Call ./mips instead of just mips (WED) + Use 'test -f' instead of 'test -r' for exec-only cat progs (WED) + Fixed typo in the d_attribut variable (ADO) + + New unit install.U to locate BSD-compatible install programs. + New unit poll.U to check for the poll() routine availability. + + Allows hint files to specify their own value for 'ranlib', to + overcome a bug in the NeXT ranlib program. Suggested by + Andreas Koenig <k@franz.ww.tu-berlin.de> on the perl5-porters + mailing list. Thanks! + + Now sets sbrksmart to undef explicitely when lacking sbrk(). + Forgot a cast when using return value from sbrk(). Both fixes + reported by Xavier Le Vourch <xavierl@eiffel.com>. + + Now allows @if statements for the add.Config_sh unit inclusion. + + Metaconfig will now tell users about possible extra file-extension + lookups they have requested via 'packinit'. + +. Files changed: + + * jmake/files/Jmake.rules: New macros ShellScriptTargetExt and + SimpleShellScriptTargetExt. Directory installation is now made via + INSTALLDIR (Configure). + + * jmake/files/Jmake.tmpl: Now pre-computes INSTALL and INSTALLDIR + variables. + + * mcon/U/Config_sh.U: Moved path stripping from d_portable.U to end + of Configure. + + * mcon/U/Cppsym.U: New cc vs. cpp symbol checking suggested by JHI. + Added more cpp symbols (JHI). + + * mcon/U/Getfile.U: Added support for escaping answers to skip + various checks. Modified message issued after file expansion. + + * mcon/U/Instruct.U: Now documents the & escape to turn -d on at the + read prompt. + + * mcon/U/Loc.U: Protected "sh -c" within backquotes for Linux and + SGI. Added path lookup for the 'comm' program. + + * mcon/U/Myread.U: Added & escape allowing user to turn on -d from + the prompt. + + * mcon/U/Oldconfig.U: Added quotes around the INITPROG variable + (ADO). Allows variable overriding after config file loading. + + * mcon/U/Options.U: New -O option allowing -D and -U to override + config.sh setttings. File optdef.sh is no longer removed after + sourcing. + + * mcon/U/cc.U: Changed gcc checking message to a more explicit one + (WED). + + * mcon/U/d_attribut.U: Fixed typo in the d_attribut variable (ADO). + + * mcon/U/d_keepsig.U: Protected "sh -c" within backquotes for Linux + and SGI. + + * mcon/U/install.U, mcon/U/d_poll.U: Created. + + * mcon/U/d_portable.U: Executable path stripping moved to the end in + Config_sh.U. + + * mcon/U/d_safebcpy.U: Added 'ldflags' to the test compile line (ADO). + + * mcon/U/defeditor.U: Can now use the 'vi' variable since path + stripping is deferred. + + * mcon/U/libpth.U: Call ./mips instead of just mips (WED). + + * mcon/U/perlpath.U, mcon/U/mansrc.U, mcon/U/mailer.U: Can now use + Loc variables since path stripping is deferred. + + * mcon/U/orderlib.U: Allows hint files to specify their own value for + 'ranlib'. + + * mcon/U/sbrksmart.U: Now sets sbrksmart to undef explicitely when + lacking sbrk(). Forgot a cast when using return value from sbrk(). + + * mcon/U/spitshell.U: Use 'test -f' instead of 'test -r' for + exec-only cat progs (WED). Protected "sh -c" within backquotes for + Linux and SGI. + + * mcon/U/voidflags.U: Cosmetic change to avoid spurious blank lines + when using -s. + + * mcon/man/mconfig.SH: Documents new -O option and new Getfile escape + supports. Documents the & escape in Myread and the new cc symbol + lookup. + + * mcon/pl/configure.pl: Now allows @if statements for the + add.Config_sh unit inclusion. + + * mcon/pl/wanted.pl: Added % in front of hash table names for perl5's + each() (ADO). Tell users about possible extra file-extension lookups. + +Mon Oct 31 10:57:05 MET 1994 Raphael Manfredi <ram@acri.fr> + +. Description: + + It used to be that option processing was done before Configure + initializations were performed, because Options was listed in + the dependency line of Init.U. However, this was wrong because + -D and -U command line switches were then unable to override any + default setting done in Myinit.U, which is counter-intuitive at + best. Thanks to Andras Salamon <andras@is.co.za> for pointing + this out. + + I therefore created a new unit Begin.U, which clearly marks + the beginning of the configuration questions (so End.U now + has its pending unit). On that unit, we list Myinit followed + by Options on the ?MAKE: line, so that option processing + comes after user-defined or default initializations but before + the real interactive start (which is mandatory for a correct + Configure -h processing, for instance). + + A few units were making use of variables set up in Options.U + and made visible. However, those did not need to list Options + in their ?MAKE: line due to the way metalint performs its visible + symbol lookup (by following dependencies recursively and implicitely + placing Init at the top). Since Options is no longer a dependency + of Init, Myread.U and Csym.U now explicitely mention Options in + their dependency line. + + Also, the leading comment in Chk_MANI.U now explains how this + unit gets included into the Configure script. There used to be + an explaination there, but it was no longer accurate. + + One new unit file (Begin.U). + +. Files changed: + + * mcon/U/Begin.U: Created. + + * mcon/U/Chk_MANI.U: Now lists Begin instead of Myinit in its + dependencies. Leading comment now explains how this unit is included. + + * mcon/U/Myread.U, mcon/U/Csym.U: Added Options to the MAKE line + since it's no longer in Init.U. + + * mcon/U/Init.U: Removed Options from MAKE to prevent Init overrides. + Option processing now done after Myinit thanks to new Begin.U. Moved + "Beginning of configuration questions" to Begin.U. Moved signal + trapping instruction to Begin.U as well. + + * mcon/U/Myinit.U: Leading comment states this unit comes before + option processing. + +Sat Oct 29 19:05:42 MET 1994 Raphael Manfredi <ram@acri.fr> + +. Description: + + I forgot to quote $@ to protect against "evil" characters. + Unfortunately, this causes Configure to output an error message + when calling the created 'tr' script (which it does all the time + given the leading '.' in PATH) with arguments like '\012'. The + final + exec tr $@ + line causes a 'tr' failure because it does not understand the + arguments it is given. Saying + exec tr "$@" + fixes the problem since then the original quotes are "propagated" + to the new call. + + The amazing thing is that I have tested this, but apparently the + simple Configure script I generated for that purpose did not make + use of the "tr '/012' ' '" construct. Hence I missed it. Sorry. + +. Files changed: + + * mcon/U/Tr.U: Forgot to quote $@ to protect against "evil" + characters. + +Sat Oct 29 18:16:03 MET 1994 Raphael Manfredi <ram@acri.fr> + +. Description: + + Regenerated Configure with metaconfig 3.0 PL35 to benefit from + the lattest enhancements. Unfortunately, I have not pre-installed + the patch relased before regenerating, so Configure is still behind + the current patchlevel. I hope you don't mind ;-) + + The good news is: I've made sure all the scripts compile fine + with perl 5.0. This involved fixing an open precedence problem + in manilist, and some escapes in strings and regexps to make + sure all dangerous '@' are protected since they now interpolate. + I also fixed perload since perl5's packages are now introduced + by '::' instead of the single quote. + + The bad news is: it's not guaranteed to work. At least with the + pre-release version of perl 5.0 I have, metaconfig (the dataloaded + version) fails, and I've not been able to narrow down the problem + to a small test-case so I don't know what's happening. The non + dataloaded version appears to be running fine, but if you get + strange problems, make sure you use perl 4.0 PL36 before sending + me a bug report. :-) + + Added support for user-defined C and shell file extensions. This + was needed in perl5 for instance (.xs files are containing C + symbols and metaconfig should really look at those). Well, you + may now add as many extensions (C or SH) from within packinit. + + Packinit also asks whether a ChangeLog file is to be managed. + This is a new feature relying on the new patlog script. If you + don't ask for a ChangeLog file, you should get the old behaviour. + If you do, well you will have to read the documentation to know + what changes it involves (mainly at the user-interface level when + running 'patmake', which now calls 'patlog'). Don't forget to + add ChangeLog to your MANIFEST.new before running patmake anyway. + + Optionally, you can include the RCS logs within your ChangeLog + file, and they will follow the description (what you are reading + now) which normally appears within the Description: section of + the patch itself. + + Packinit now creates new variables cext, shext, changelog and + changercs in the .package file to handle user-defined file extensions + and the ChangeLog file. + + Added new RemoteDependency rule for jmake. + + Don't use rootid as a variable, it is known by metaconfig and + results in having Configure compute the root uid when it's not + needed. Renamed it to rootmsgid to avoid this kind of problem. + + Added ?F: lines in units creating files for metalint checking. + This incurred many small changes in units where things like + if usg; then + were written when in fact meaning: + if ./usg; then + Well, I know Configure sets '.' at the beginning of the PATH, but + since metalint now systematically warns about such abuse (provided + files are declared in the ?F: lines in the special unit defining + them), it was the only way to shut up metalint. + + Metalint also now checks for variables used as ${var}. + + Symbols ardent and titan are now looked at for cpp definition. (ADO) + + Make sure ENV is unset before calling /bin/ksh. Not doing this + is known to produce strange results. For instance, if one has + a ~/.kshrc aliasing 'cd' to something else. Configure might + get confused and do the wrong thing. Not setting ENV ensures + no such startup file will be used. Of course, this does not + work if you say 'ksh Configure', but then you are supposed to + know what you are doing. + + The loc script can now perform safe wildcard searching. (ADO) + + The Oldconfig.U unit was merged with the version used for perl5's + Configure (ADO). Be careful if you use hints, the behaviour you + will now get might not be fully backward compatible. Since the + Author currently does not have any such package, he did not test + that specific feature. You have been warned. (But everything + should be fine). + + Configure now protects variable definitions with spaces in them, + so that people saying: + Configure -D cc='cc -posix' + will get what they expect. + + Added checks for secure setuid scripts. (Tye McQueen) + + Spurious single quote in the lex.U unit could cause Configure + to crash, reported by Xavier Le Vourch <xavierl@eiffel.com>. + Indeed, the unit was saying something like + : .... and they'll ... + so the shell happily began to eat everything up to the next + single quote it could found, resulting in weird behaviours... + + Now looks for shared libraries before anything else and + removed the old broken thislib/thatlib processing in libs.U. + This has been tested in the perl5 distribution and is believed + to be better than the previous scheme. (ADO) + + New Tr unit to convert to/from lowercase. Whenever you need + to say: + tr '[A-Z]' '[a-z]' + or the other way round, add Tr in your dependency line and + say something like + ./tr '[A-Z]' '[a-z]' + i.e. you need to call a local tr script that will trap the + arguments and possibly call + tr '[:upper:]' '[:lower:]' + if your machine supports this. Otherwise, with a non-ascii + character set, you will get strange results (HP is know + to exercise this, thanks to Andreas Sahlbach + <a.sahlbach@tu-bs.de> for letting me know about it). + + ranlib checking is more accurate now (ADO) + + Newer RCS programs chop trailing spaces in log messages, and + that could cause 'patcil -s' to fail stripping the RSC logs. + + separated V/E and v/e commands in the patcil built-in prompter. + The new 'v' command now edits the file being patcil'ed. + added hook for 'V' command (not implemented yet) + The 'e' and 'E' commands have retained their semantics. + + 19 new files, mostly metaconfig units. + +. Files changed: + + * bin/manilist.SH: Fixed open precedence problem for perl5. + + * bin/packinit.SH: Added support for user-defined C and shell file + extensions. Now asks whether a ChangeLog file is to be managed. + + * bin/packinit.man: Added new variables cext, shext, changelog and + changercs. + + * bin/perload: Added minimal support for perl5 dataloading. + + * dist.man: Mentions new patlog script and ChangeLog file. + + * jmake/files/Jmake.rules: Added RemoteDependency rule. + + * jmake/jmake.SH, pat/patnotify.SH, mcon/pl/depend.pl: Added various + escapes in strings for perl5 support. + + * kit/kitpost.SH: Don't use rootid as a variable, it is known by + metaconfig. + + * mcon/U/bitpbyte.U, mcon/U/d_NOFILE.U, mcon/U/mkdep.U, + mcon/U/d_PORTAR.U, mcon/U/alignbytes.U, mcon/U/byteorder.U, + mcon/U/Finish.U, mcon/U/nlist_pfx.U, mcon/U/charorder.U, + mcon/U/d_getpagsz.U, mcon/U/ptrsize.U, mcon/U/intsize.U, + mcon/U/Getfile.U, mcon/U/Extract.U, mcon/U/Myread.U, mcon/U/Whoa.U, + mcon/U/longsize.U, mcon/U/floatsize.U, mcon/U/Config_sh.U, + mcon/U/cppstdin.U, mcon/U/doublesize.U, mcon/U/Findhdr.U, + mcon/U/i_varhdr.U, mcon/U/charsize.U: Added ?F: line for metalint + file checking. + + * mcon/U/Cppsym.U: Added ?F: line for metalint file checking. New + symbols ardent and titan (ADO). + + * mcon/U/Filexp.U: Added ?F: line for metalint file checking. Added + HOME to the ?T: line since metalint now checks ${HOME}. + + * mcon/U/Guess.U: Added ?F: line for metalint file checking. Call + ./xenix explicitely instead of relying on PATH. + + * mcon/U/Head.U: Make sure ENV is unset before calling /bin/ksh. + + * mcon/U/Setvar.U, mcon/U/Inhdr.U, mcon/U/Inlibc.U: Call ./whoa + explicitely instead of relying on PATH. + + * mcon/U/Loc.U: Added ?F: line for metalint file checking. Be + careful and guard against wildcard searching (ADO). + + * mcon/U/Oldconfig.U: Added ?F: line for metalint file checking. + Merged with the version used for perl5's Configure (ADO). + + * mcon/U/Options.U: Ensure option definition file is removed before + appending. Protect variable definitions with spaces in them. + + * pat/patlog.SH, mcon/U/Tr.U: Created. + + * mcon/U/Typedef.U: Don't clobber visible 'val' variable, use + 'varval' instead. + + * mcon/U/Warn_v7EXT.U, mcon/U/Warn_v7ND.U: Call ./v7 explicitely + instead of relying on PATH. + + * mcon/U/abortsig.U, mcon/U/d_bsdjmp.U: Call ./usg explicitely + instead of relying on PATH. + + * mcon/U/d_attribut.U, mcon/U/d_gconvert.U, mcon/U/d_drem.U, + mcon/U/d_locconv.U, mcon/U/d_mkfifo.U, mcon/U/d_fmod.U, + mcon/U/d_linuxstd.U, mcon/U/d_pathconf.U, mcon/U/archlib.U, + mcon/U/d_dlerror.U, mcon/U/d_sysconf.U, mcon/U/i_dld.U, + mcon/U/modetype.U: Created by ADO. + + * mcon/U/cc.U: Detect gcc even when not called as 'gcc' (ADO). + Simplified gcc version checking (ADO). Added ?F: line for metalint + file checking. + + * mcon/U/ccflags.U: Gcc versionning no longer relies on the C + compiler's name. Simplified check for gcc version checking (ADO). + + * mcon/U/cpp_stuff.U: Now uses cppstdin instead of plain cpp for + consistency (ADO). Remove temporary files when done. + + * mcon/U/d_casti32.U: Declare signal handler correctly (ADO). + + * mcon/U/d_castneg.U: Don't forget to tell user about compilation + failures (ADO). Declare signal handler correctly using 'signal_t' + (ADO). + + * mcon/U/d_closedir.U, mcon/U/d_safemcpy.U, mcon/U/d_isascii.U: Added + 'ldflags' to the test compile line (ADO). + + * mcon/U/d_dosuid.U: Added checks for secure setuid scripts (Tye + McQueen). + + * mcon/U/d_keepsig.U, mcon/U/d_eofpipe.U, mcon/U/d_normsig.U, + mcon/U/d_tzmin.U: Call ./bsd explicitely instead of relying on PATH. + + * mcon/U/d_gethname.U: Call ./xenix explicitely instead of relying on + PATH. + + * mcon/U/d_newsadm.U: Call ./eunice explicitely instead of relying on + PATH. + + * mcon/U/d_setpgrp.U: Added 'ldflags' to the test compile line (ADO). + Call ./usg explicitely instead of relying on PATH. + + * mcon/U/registers.U, mcon/U/shm_for.U, mcon/U/d_speedopt.U: Call + ./Cppsym explicitely instead of relying on PATH. + + * mcon/U/d_time.U: Now uses new Typedef unit to compute type + information (ADO). + + * mcon/U/groupstype.U: No longer uses Setvar to set 'groupstype' + (ADO). Typo fix in the word 'argument' (ADO). + + * mcon/U/i_dirent.U: Failed scanning for 'd_namlen' with missing + <dirent.h> (ADO). + + * mcon/U/i_neterrno.U: Forgot to initialize 'val' to an empty value + (ADO). + + * mcon/U/i_termio.U: Call ./usg and ./Cppsym explicitely instead of + relying on PATH. + + * mcon/U/lex.U: Spurious single quote could cause Configure to crash. + (reported by Xavier Le Vourch <xavierl@eiffel.com>.). + + * mcon/U/libc.U: Now looks for shared libraries before anything else + (ADO). Added new nm output format (ADO). + + * mcon/U/libs.U: Removed old broken thislib/thatlib processing (ADO). + + * mcon/U/mailfile.U: The Loc unit was missing from the dependency + line. + + * mcon/U/myhostname.U: Call ./xenix explicitely instead of relying on + PATH. Now uses new Tr unit to convert to/from lowercase. + + * mcon/U/nametype.U: Call ./usg and ./bsd explicitely instead of + relying on PATH. + + * mcon/U/orderlib.U: Now performs a real small compile for accurate + checks (ADO). + + * mcon/U/package.U: Beware of non-ascii character sets when + translating case. + + * mcon/U/pager.U: Replaced Myread by Getfile in the dependency line. + + * mcon/U/prefshell.U: Added SHELL temporary since metalint now sees + ${SHELL}. + + * mcon/U/so.U: Now tells user how he can suppress shared lib lookup + (ADO). Removed echo at the top, since it's now in the here-doc (ADO). + + * mcon/U/ssizetype.U: Added ?F: line for metalint file checking. + Added 'ldflags' to the test compile line (ADO). + + * mcon/man/mconfig.SH: Added nroff protection for lines beginning + with '.'. Documents new ?F: line for file declarations. Added + example showing how ./loc can be used. + + * mcon/man/mlint.SH: Documents new ?F: lines and the related metalint + warnings. Removed statement in BUGS since all warnings may now be + shut. + + * mcon/man/mxref.SH: The leading .TH was referring to metaconfig. + + * mcon/pl/common.pl: Metaconfig and metaxref ignore ?F: lines from + now on. + + * mcon/pl/files.pl: Added user-defined file extension support for + lookups. + + * mcon/pl/lint.pl: Now extensively checks created files thanks to new + ?F: lines. + + * mcon/pl/locate.pl: Misspelled a 'closedir' as a 'close' statement. + + * pat/pat.SH: Now unlinks all the files created by patlog in bugs. + + * pat/pat.man: Documents new patlog script and the files it uses. + The RCS layer section has been extended slightly. + + * pat/patcil.SH: Now honors the VISUAL and EDITOR environment + variables. Newer RCS programs chop trailing spaces in log messages. + Separated V/E and v/e commands. New 'v' command to edit the file + being patcil'ed. Added hook for 'V' command (not implemented yet). + + * pat/patmake.SH: A lot of setup is now performed by patlog. Added + various escapes in strings for perl5 support. + diff --git a/Configure b/Configure new file mode 100755 index 0000000..686a86a --- /dev/null +++ b/Configure @@ -0,0 +1,3551 @@ +#! /bin/sh +# +# If these # comments don't work, trim them. Don't worry about any other +# shell scripts, Configure will trim # comments from them for you. +# +# (If you are trying to port this package to a machine without sh, +# I would suggest you have a look at the prototypical config_h.SH file +# and edit it to reflect your system. Some packages may include samples +# of config.h for certain machines, so you might look for one of those.) +# +# Yes, you may rip this off to use in other distribution packages. This +# script belongs to the public domain and cannot be copyrighted. +# +# (Note: this Configure script was generated automatically. Rather than +# working with this copy of Configure, you may wish to get metaconfig. +# The dist-3.0 package (which contains metaconfig) was posted in +# comp.sources.misc and is available on CPAN under authors/id/RAM so +# you may fetch it yourself from your nearest archive site.) +# + +# $Id: Configure,v 3.0.1.11 1997/02/28 14:52:55 ram Exp $ +# +# Generated on Fri Feb 28 15:36:04 MET 1997 [metaconfig 3.0 PL60] + +cat >/tmp/c1$$ <<EOF +ARGGGHHHH!!!!! + +SCO csh still thinks true is false. Write to SCO today and tell them that next +year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-) + +(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All +we'd have to do is go in and swap the && and || tokens, wherever they are.) + +[End of diatribe. We now return you to your regularly scheduled programming...] +EOF +cat >/tmp/c2$$ <<EOF + +OOPS! You naughty creature! You didn't run Configure with sh! +I will attempt to remedy the situation by running sh for you... +EOF + +true || cat /tmp/c1$$ /tmp/c2$$ +true || exec sh $0 $argv:q + +(exit $?0) || cat /tmp/c2$$ +(exit $?0) || exec sh $0 $argv:q +rm -f /tmp/c1$$ /tmp/c2$$ + +: compute my invocation name +me=$0 +case "$0" in +*/*) + me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null` + test "$me" || me=$0 + ;; +esac + +: Proper PATH separator +p_=: +: On OS/2 this directory should exist if this is not floppy only system :-] +if test -d c:/.; then + p_=\; + PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` + OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` +fi + +: Proper PATH setting +paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' +paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" +paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" +paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" +paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" +paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin" +paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" +paths="$paths /sbin /usr/sbin /usr/libexec" + +for p in $paths +do + case "$p_$PATH$p_" in + *$p_$p$p_*) ;; + *) test -d $p && PATH=$PATH$p_$p ;; + esac +done + +PATH=.$p_$PATH +export PATH + +: shall we be using ksh? +inksh='' +needksh='' +avoidksh='' +newsh=/bin/ksh +changesh='' +if (PATH=.; alias -x) >/dev/null 2>&1; then + inksh=true +fi +if test -f /hp-ux -a -f /bin/ksh; then + needksh='to avoid sh bug in "here document" expansion' +fi +if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then + if test X`/usr/bin/uname -v` = X4; then + avoidksh="to avoid AIX 4's /bin/sh" + newsh=/usr/bin/bsh + fi +fi +case "$inksh/$needksh" in +/[a-z]*) + unset ENV + changesh=true + reason="$needksh" + ;; +esac +case "$inksh/$avoidksh" in +true/[a-z]*) + changesh=true + reason="$avoidksh" + ;; +esac +case "$inksh/$needksh-$avoidksh-" in +true/--) + cat <<EOM +(I see you are using the Korn shell. Some ksh's blow up on $me, +mainly on older exotic systems. If yours does, try the Bourne shell instead.) +EOM + ;; +esac +case "$changesh" in +true) + echo "(Feeding myself to $newsh $reason.)" + case "$0" in + Configure|*/Configure) exec $newsh $0 "$@";; + *) exec $newsh Configure "$@";; + esac + ;; +esac + +: Configure runs within the UU subdirectory +test -d UU || mkdir UU +unset CDPATH +cd UU && rm -f ./* + +d_bsd='' +d_eunice='' +d_xenix='' +eunicefix='' +Mcc='' +ar='' +awk='' +bash='' +bison='' +byacc='' +cat='' +chgrp='' +chmod='' +chown='' +comm='' +compress='' +cp='' +cpio='' +cpp='' +csh='' +date='' +echo='' +egrep='' +emacs='' +expr='' +find='' +flex='' +gcc='' +grep='' +gzip='' +inews='' +ksh='' +less='' +line='' +lint='' +ln='' +lp='' +lpr='' +ls='' +mail='' +mailx='' +make='' +mkdir='' +more='' +mv='' +nroff='' +perl='' +pg='' +pmake='' +pr='' +rm='' +rmail='' +sed='' +sendmail='' +shar='' +sleep='' +smail='' +sort='' +submit='' +tail='' +tar='' +tbl='' +test='' +touch='' +tr='' +troff='' +uname='' +uniq='' +uuname='' +vi='' +zcat='' +zip='' +mailpatches='' +notifypatches='' +usermail='' +hint='' +myuname='' +osname='' +osvers='' +Author='' +Date='' +Header='' +Id='' +Locker='' +Log='' +RCSfile='' +Revision='' +Source='' +State='' +archobjs='' +firstmakefile='' +afs='' +baserev='' +cf_email='' +cf_by='' +cf_time='' +contains='' +cpplast='' +cppminus='' +cpprun='' +cppstdin='' +d_portable='' +defeditor='' +install='' +installdir='' +lns='' +mailer='' +make_set_make='' +installmansrc='' +manext='' +mansrc='' +mansrcexp='' +mkdep='' +mydomain='' +myhostname='' +phostname='' +c='' +n='' +d_berknames='' +d_passnames='' +d_usgnames='' +nametype='' +groupcat='' +hostcat='' +passcat='' +orgname='' +package='' +spackage='' +pager='' +patchlevel='' +perlpath='' +prefix='' +prefixexp='' +installprivlib='' +privlib='' +privlibexp='' +installscript='' +scriptdir='' +scriptdirexp='' +sh='' +sharpbang='' +shsharp='' +spitshell='' +src='' +startperl='' +startsh='' +sysman='' +CONFIG='' + +define='define' +undef='undef' +smallmach='pdp11 i8086 z8000 i80286 iAPX286' +rmlist='' + +: We must find out about Eunice early +eunicefix=':' +if test -f /etc/unixtovms; then + eunicefix=/etc/unixtovms +fi +if test -f /etc/unixtovms.exe; then + eunicefix=/etc/unixtovms.exe +fi + +: No trailing extension on UNIX executables +_exe='' +: Extra object files, if any, needed on this platform. +archobjs='' +bin='/usr/local/bin' +cc='cc' +cppflags='' +usrinc='/usr/include' + +: Find the basic shell for Bourne shell scripts +case "$sh" in +'') + case "$SYSTYPE" in + *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";; + *) xxx='/bin/sh';; + esac + if test -f "$xxx"; then + sh="$xxx" + else + : Build up a list and do a single loop so we can 'break' out. + pth=`echo $PATH | sed -e "s/$p_/ /g"` + for xxx in sh bash ksh pdksh ash; do + for p in $pth; do + try="$try ${p}/${xxx}" + done + done + for xxx in $try; do + if test -f "$xxx"; then + sh="$xxx"; + break + elif test -f "$xxx.exe"; then + sh="$xxx"; + break + fi + done + fi + ;; +esac + +case "$sh" in +'') cat <<EOM >&2 +$me: Fatal Error: I can't find a Bourne Shell anywhere. + +Usually it's in /bin/sh. How did you even get this far? +Please contact me (Raphael Manfredi) at Raphael_Manfredi@grenoble.hp.com and +we'll try to straighten this all out. +EOM + exit 1 + ;; +esac + +: see if sh knows # comments +if `$sh -c '#' >/dev/null 2>&1`; then + shsharp=true + spitshell=cat + xcat=/bin/cat + test -f $xcat || xcat=/usr/bin/cat + echo "#!$xcat" >try + $eunicefix try + chmod +x try + ./try > today + if test -s today; then + sharpbang='#!' + else + echo "#! $xcat" > try + $eunicefix try + chmod +x try + ./try > today + if test -s today; then + sharpbang='#! ' + else + sharpbang=': use ' + fi + fi +else + echo " " + echo "Your $sh doesn't grok # comments--I will strip them later on." + shsharp=false + cd .. + echo "exec grep -v '^[ ]*#'" >spitshell + chmod +x spitshell + $eunicefix spitshell + spitshell=`pwd`/spitshell + cd UU + echo "I presume that if # doesn't work, #! won't work either!" + sharpbang=': use ' +fi +rm -f try today + +: figure out how to guarantee sh startup +case "$startsh" in +'') startsh=${sharpbang}${sh} ;; +*) +esac +cat >try <<EOSS +$startsh +set abc +test "$?abc" != 1 +EOSS + +chmod +x try +$eunicefix try +if ./try; then + : echo "Yup, it does." +else + echo "Hmm... '$startsh' does not guarantee sh startup..." + echo "You may have to fix up the shell scripts to make sure $sh runs them." +fi +rm -f try + +: produce awk script to parse command line options +cat >options.awk <<'EOF' +BEGIN { + optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification + + len = length(optstr); + for (i = 1; i <= len; i++) { + c = substr(optstr, i, 1); + if (i < len) a = substr(optstr, i + 1, 1); else a = ""; + if (a == ":") { + arg[c] = 1; + i++; + } + opt[c] = 1; + } +} +{ + expect = 0; + str = $0; + if (substr(str, 1, 1) != "-") { + printf("'%s'\n", str); + next; + } + len = length($0); + for (i = 2; i <= len; i++) { + c = substr(str, i, 1); + if (!opt[c]) { + printf("-%s\n", substr(str, i)); + next; + } + printf("-%s\n", c); + if (arg[c]) { + if (i < len) + printf("'%s'\n", substr(str, i + 1)); + else + expect = 1; + next; + } + } +} +END { + if (expect) + print "?"; +} +EOF + +: process the command line options +set X `for arg in "$@"; do echo "X$arg"; done | + sed -e s/X// | awk -f options.awk` +eval "set $*" +shift +rm -f options.awk + +: set up default values +fastread='' +reuseval=false +config_sh='' +alldone='' +error='' +silent='' +extractsh='' +override='' +knowitall='' +rm -f optdef.sh +cat >optdef.sh <<EOS +$startsh +EOS + + +: option parsing +while test $# -gt 0; do + case "$1" in + -d) shift; fastread=yes;; + -e) shift; alldone=cont;; + -f) + shift + cd .. + if test -r "$1"; then + config_sh="$1" + else + echo "$me: cannot read config file $1." >&2 + error=true + fi + cd UU + shift;; + -h) shift; error=true;; + -r) shift; reuseval=true;; + -s) shift; silent=true; realsilent=true;; + -E) shift; alldone=exit;; + -K) shift; knowitall=true;; + -O) shift; override=true;; + -S) shift; silent=true; extractsh=true;; + -D) + shift + case "$1" in + *=) + echo "$me: use '-U symbol=', not '-D symbol='." >&2 + echo "$me: ignoring -D $1" >&2 + ;; + *=*) echo "$1" | \ + sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; + *) echo "$1='define'" >> optdef.sh;; + esac + shift + ;; + -U) + shift + case "$1" in + *=) echo "$1" >> optdef.sh;; + *=*) + echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 + echo "$me: ignoring -U $1" >&2 + ;; + *) echo "$1='undef'" >> optdef.sh;; + esac + shift + ;; + -V) echo "$me generated by metaconfig 3.0 PL60." >&2 + exit 0;; + --) break;; + -*) echo "$me: unknown option $1" >&2; shift; error=true;; + *) break;; + esac +done + +case "$error" in +true) + cat >&2 <<EOM +Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value] + [-U symbol] [-U symbol=] + -d : use defaults for all answers. + -e : go on without questioning past the production of config.sh. + -f : specify an alternate default configuration file. + -h : print this help message and exit (with an error status). + -r : reuse C symbols value if possible (skips costly nm extraction). + -s : silent mode, only echoes questions and essential information. + -D : define symbol to have some value: + -D symbol symbol gets the value 'define' + -D symbol=value symbol gets the value 'value' + -E : stop at the end of questions, after having produced config.sh. + -K : do not use unless you know what you are doing. + -O : let -D and -U override definitions from loaded configuration file. + -S : perform variable substitutions on all .SH files (can mix with -f) + -U : undefine symbol: + -U symbol symbol gets the value 'undef' + -U symbol= symbol gets completely empty + -V : print version number and exit (with a zero status). +EOM + exit 1 + ;; +esac + +: Sanity checks +case "$fastread$alldone" in +yescont|yesexit) ;; +*) + if test ! -t 0; then + echo "Say 'sh Configure', not 'sh <Configure'" + exit 1 + fi + ;; +esac + +exec 4>&1 +case "$silent" in +true) exec 1>/dev/null;; +esac + +: run the defines and the undefines, if any, but leave the file out there... +touch optdef.sh +. ./optdef.sh + +: set package name +package=dist +first=`echo $package | sed -e 's/^\(.\).*/\1/'` +last=`echo $package | sed -e 's/^.\(.*\)/\1/'` +case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in +ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; +*) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; +esac + +: Some greps do not return status, grrr. +echo "grimblepritz" >grimble +if grep blurfldyick grimble >/dev/null 2>&1 ; then + contains=contains +elif grep grimblepritz grimble >/dev/null 2>&1 ; then + contains=grep +else + contains=contains +fi +rm -f grimble +: the following should work in any shell +case "$contains" in +contains*) + echo " " + echo "AGH! Grep doesn't return a status. Attempting remedial action." + cat >contains <<'EOSS' +grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp +EOSS +chmod +x contains +esac + +: first determine how to suppress newline on echo command +echo " " +echo "Checking echo to see how to suppress newlines..." +(echo "hi there\c" ; echo " ") >.echotmp +if $contains c .echotmp >/dev/null 2>&1 ; then + echo "...using -n." + n='-n' + c='' +else + cat <<'EOM' +...using \c +EOM + n='' + c='\c' +fi +echo $n "The star should be here-->$c" +echo '*' +rm -f .echotmp + +: compute the number of columns on the terminal for proper question formatting +case "$COLUMNS" in +'') COLUMNS='80';; +esac + +: set up the echo used in my read +myecho="case \"\$xxxm\" in +'') echo $n \"\$rp $c\" >&4;; +*) case \"\$rp\" in + '') echo $n \"[\$xxxm] $c\";; + *) + if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then + echo \"\$rp\" >&4 + echo $n \"[\$xxxm] $c\" >&4 + else + echo $n \"\$rp [\$xxxm] $c\" >&4 + fi + ;; + esac;; +esac" + +: now set up to do reads with possible shell escape and default assignment +cat <<EOSC >myread +$startsh +xxxm=\$dflt +$myecho +ans='!' +case "\$fastread" in +yes) case "\$dflt" in + '') ;; + *) ans=''; + case "\$silent-\$rp" in + true-) ;; + *) echo " " >&4;; + esac;; + esac;; +*) case "\$silent" in + true) case "\$rp" in + '') ans='';; + esac;; + esac;; +esac +while expr "X\$ans" : "X!" >/dev/null; do + read answ + set x \$xxxm + shift + aok=''; eval "ans=\\"\$answ\\"" && aok=y + case "\$answ" in + "!") + sh 1>&4 + echo " " + $myecho + ;; + !*) + set x \`expr "X\$ans" : "X!\(.*\)\$"\` + shift + sh 1>&4 -c "\$*" + echo " " + $myecho + ;; + "\$ans") + case "\$ans" in + \\&*) + set x \`expr "X\$ans" : "X&\(.*\)\$"\` + shift + case "\$1" in + -d) + fastread=yes + echo "(OK, I'll run with -d after this question.)" >&4 + ;; + -*) + echo "*** Sorry, \$1 not supported yet." >&4 + ;; + esac + $myecho + ans=! + ;; + esac;; + *) + case "\$aok" in + y) + echo "*** Substitution done -- please confirm." + xxxm="\$ans" + ans=\`echo $n "\$ans$c" | tr '\012' ' '\` + xxxm="\$ans" + ans=! + ;; + *) + echo "*** Error -- try again." + ans=! + ;; + esac + $myecho + ;; + esac + case "\$ans\$xxxm\$nostick" in + '') + ans=! + $myecho + ;; + esac +done +case "\$ans" in +'') ans="\$xxxm";; +esac +EOSC + +: Find the path to the source tree +case "$src" in +'') src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;; +esac +case "$src" in +'') + src=. + rsrc=.. + ;; +/*) rsrc="$src/..";; +*) rsrc="../$src";; +esac +if test -f $rsrc/Configure && \ + $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1 +then + : found it, so we are ok. +else + rsrc='' + for src in . .. ../.. ../../.. ../../../..; do + if test -f ../$src/Configure && \ + $contains "^package=$package" ../$src/Configure >/dev/null 2>&1 + then + rsrc=../$src + break + fi + done +fi +case "$rsrc" in +'') + echo " " + dflt= + rp="Directory where sources for $package are located?" + . ./myread + src="$ans" + rsrc="$src" + if test -f $rsrc/Configure && \ + $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1 + then + echo "Ok, I've found them under $src" + else + echo "Sorry, I can't seem to be able to locate $package sources." >&4 + exit 1 + fi + ;; +../.) ;; +*) + echo " " + echo "Sources for $package found in $src" >&4 + ;; +esac + +: script used to extract .SH files with variable substitutions +cat >extract <<'EOS' +CONFIG=true +echo "Doing variable substitutions on .SH files..." +if test -f $src/MANIFEST; then + set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'` +else + echo "(Looking for .SH files under the source directory.)" + set x `(cd $src; find . -name "*.SH" -print)` +fi +shift +case $# in +0) set x `(cd $src; echo *.SH)`; shift;; +esac +if test ! -f $src/$1; then + shift +fi +mkdir_p=' +name=$1; +create=""; +while test $name; do + if test ! -d "$name"; then + create="$name $create"; + name=`echo $name | sed -e "s|^[^/]*$||"`; + name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`; + else + name=""; + fi; +done; +for file in $create; do + mkdir $file; +done +' +for file in $*; do + case "$src" in + ".") + case "$file" in + */*) + dir=`expr X$file : 'X\(.*\)/'` + file=`expr X$file : 'X.*/\(.*\)'` + (cd $dir && . ./$file) + ;; + *) + . ./$file + ;; + esac + ;; + *) + case "$file" in + */*) + dir=`expr X$file : 'X\(.*\)/'` + file=`expr X$file : 'X.*/\(.*\)'` + (set x $dir; shift; eval $mkdir_p) + sh <$src/$dir/$file + ;; + *) + sh <$src/$file + ;; + esac + ;; + esac +done +if test -f $src/config_h.SH; then + if test ! -f config.h; then + : oops, they left it out of MANIFEST, probably, so do it anyway. + . $src/config_h.SH + fi +fi +EOS + +: extract files and exit if asked to do so +case "$extractsh" in +true) + case "$realsilent" in + true) ;; + *) exec 1>&4;; + esac + case "$config_sh" in + '') config_sh='config.sh'; config="$rsrc/config.sh";; + /*) config="$config_sh";; + *) config="$rsrc/$config_sh";; + esac + echo " " + echo "Fetching answers from $config_sh..." + . $config + test "$override" && . ./optdef.sh + echo " " + cd .. + . UU/extract + rm -rf UU + echo "Done." + exit 0 + ;; +esac + +: Eunice requires " " instead of "", can you believe it +echo " " +: Here we go... +echo "Beginning of configuration questions for $package." + +trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 + +: Now test for existence of everything in MANIFEST +echo " " +if test -f $rsrc/MANIFEST; then + echo "First let's make sure your kit is complete. Checking..." >&4 + awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50 + rm -f missing + tmppwd=`pwd` + for filelist in x??; do + (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing) + done + if test -s missing; then + cat missing >&4 + cat >&4 <<'EOM' + +THIS PACKAGE SEEMS TO BE INCOMPLETE. + +You have the option of continuing the configuration process, despite the +distinct possibility that your kit is damaged, by typing 'y'es. If you +do, don't blame me if something goes wrong. I advise you to type 'n'o +and contact the author (Raphael_Manfredi@grenoble.hp.com). + +EOM + echo $n "Continue? [n] $c" >&4 + read ans + case "$ans" in + y*) + echo "Continuing..." >&4 + rm -f missing + ;; + *) + echo "ABORTING..." >&4 + kill $$ + ;; + esac + else + echo "Looks good..." + fi +else + echo "There is no MANIFEST file. I hope your kit is complete !" +fi +rm -f missing x?? + +: create .config dir to save info across Configure sessions +test -d ../.config || mkdir ../.config +cat >../.config/README <<EOF +This directory created by Configure to save information that should +persist across sessions for $package. + +You may safely delete it if you wish. +EOF + +: general instructions +needman=true +firsttime=true +user=`(logname) 2>/dev/null` +case "$user" in +'') user=`whoami 2>&1`;; +esac +if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then + firsttime=false + echo " " + rp='Would you like to see the instructions?' + dflt=n + . ./myread + case "$ans" in + [yY]*) ;; + *) needman=false;; + esac +fi +if $needman; then + cat <<EOH + +This installation shell script will examine your system and ask you questions +to determine how the dist package should be installed. If you get +stuck on a question, you may use a ! shell escape to start a subshell or +execute a command. Many of the questions will have default answers in square +brackets; typing carriage return will give you the default. + +On some of the questions which ask for file or directory names you are allowed +to use the ~name construct to specify the login directory belonging to "name", +even if you don't have a shell which knows about that. Questions where this is +allowed will be marked "(~name ok)". + +EOH + rp='' + dflt='Type carriage return to continue' + . ./myread + cat <<'EOH' + +The prompter used in this script allows you to use shell variables and +backticks in your answers. You may use $1, $2, etc... to refer to the words +in the default answer, as if the default line was a set of arguments given to a +script shell. This means you may also use $* to repeat the whole default line, +so you do not have to re-type everything to add something to the default. + +Everytime there is a substitution, you will have to confirm. If there is an +error (e.g. an unmatched backtick), the default answer will remain unchanged +and you will be prompted again. + +If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all +the questions and use the computed defaults (or the previous answers if there +was already a config.sh file). Type 'Configure -h' for a list of options. +You may also start interactively and then answer '& -d' at any prompt to turn +on the non-interactive behaviour for the remaining of the execution. + +EOH + . ./myread + cat <<EOH + +Much effort has been expended to ensure that this shell script will run on any +Unix system. If despite that it blows up on yours, your best bet is to edit +Configure and run it again. If you can't run Configure for some reason, +you'll have to generate a config.sh file by hand. Whatever problems you +have, let me (Raphael_Manfredi@grenoble.hp.com) know how I blew it. + +This installation script affects things in two ways: + +1) it may do direct variable substitutions on some of the files included + in this kit. +2) it builds a config.h file for inclusion in C programs. You may edit + any of these files as the need arises after running this script. + +If you make a mistake on a question, there is no easy way to back up to it +currently. The easiest thing to do is to edit config.sh and rerun all the SH +files. Configure will offer to let you do this before it runs the SH files. + +EOH + dflt='Type carriage return to continue' + . ./myread + case "$firsttime" in + true) echo $user >>../.config/instruct;; + esac +fi + +: find out where common programs are +echo " " +echo "Locating common programs..." >&4 +cat <<EOSC >loc +$startsh +case \$# in +0) exit 1;; +esac +thing=\$1 +shift +dflt=\$1 +shift +for dir in \$*; do + case "\$thing" in + .) + if test -d \$dir/\$thing; then + echo \$dir + exit 0 + fi + ;; + *) + for thisthing in \$dir/\$thing; do + : just loop through to pick last item + done + if test -f \$thisthing; then + echo \$thisthing + exit 0 + elif test -f \$dir/\$thing.exe; then + : on Eunice apparently + echo \$dir/\$thing + exit 0 + fi + ;; + esac +done +echo \$dflt +exit 1 +EOSC +chmod +x loc +$eunicefix loc +loclist=" +awk +cat +chgrp +chmod +chown +echo +expr +grep +make +mkdir +mv +rm +sed +sort +touch +tr +uniq +" +trylist=" +cpp +date +inews +less +line +ln +mail +more +nroff +perl +pg +rmail +sendmail +smail +test +uname +vi +zcat +" +pth=`echo $PATH | sed -e "s/$p_/ /g"` +pth="$pth /lib /usr/lib" +for file in $loclist; do + eval xxx=\$$file + case "$xxx" in + /*|?:[\\/]*) + if test -f "$xxx"; then + : ok + else + echo "WARNING: no $xxx -- ignoring your setting for $file." >&4 + xxx=`./loc $file $file $pth` + fi + ;; + '') xxx=`./loc $file $file $pth`;; + *) xxx=`./loc $xxx $xxx $pth`;; + esac + eval $file=$xxx + eval _$file=$xxx + case "$xxx" in + /*) + echo $file is in $xxx. + ;; + ?:[\\/]*) + echo $file is in $xxx. + ;; + *) + echo "I don't know where '$file' is, and my life depends on it." >&4 + echo "Go find a public domain implementation or fix your PATH setting!" >&4 + exit 1 + ;; + esac +done +echo " " +echo "Don't worry if any of the following aren't found..." +say=offhand +for file in $trylist; do + eval xxx=\$$file + case "$xxx" in + /*|?:[\\/]*) + if test -f "$xxx"; then + : ok + else + echo "WARNING: no $xxx -- ignoring your setting for $file." >&4 + xxx=`./loc $file $file $pth` + fi + ;; + '') xxx=`./loc $file $file $pth`;; + *) xxx=`./loc $xxx $xxx $pth`;; + esac + eval $file=$xxx + eval _$file=$xxx + case "$xxx" in + /*) + echo $file is in $xxx. + ;; + ?:[\\/]*) + echo $file is in $xxx. + ;; + *) + echo "I don't see $file out there, $say." + say=either + ;; + esac +done +case "$egrep" in +egrep) + echo "Substituting grep for egrep." + egrep=$grep + ;; +esac +case "$ln" in +ln) + echo "Substituting cp for ln." + ln=$cp + ;; +esac +case "$test" in +test) + echo "Hopefully test is built into your sh." + ;; +*) + if `sh -c "PATH= test true" >/dev/null 2>&1`; then + echo "Using the test built into your sh." + test=test + _test=test + fi + ;; +esac +case "$echo" in +echo) + echo "Hopefully echo is built into your sh." + ;; +'') ;; +*) + echo " " +echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 + $echo $n "hi there$c" >foo1 + echo $n "hi there$c" >foo2 + if cmp foo1 foo2 >/dev/null 2>&1; then + echo "They are compatible. In fact, they may be identical." + else + case "$n" in + '-n') n='' c='\c';; + *) n='-n' c='';; + esac + cat <<FOO +They are not compatible! You are probably running ksh on a non-USG system. +I'll have to use $echo instead of the builtin, since Bourne shell doesn't +have echo built in and we may have to run some Bourne shell scripts. That +means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. + +FOO + $echo $n "The star should be here-->$c" + $echo "*" + fi + $rm -f foo1 foo2 + ;; +esac + +: determine whether symbolic links are supported +echo " " +$touch blurfl +if $ln -s blurfl sym > /dev/null 2>&1 ; then + echo "Symbolic links are supported." >&4 + lns="$ln -s" +else + echo "Symbolic links are NOT supported." >&4 + lns="$ln" +fi +$rm -f blurfl sym + +: see whether [:lower:] and [:upper:] are supported character classes +echo " " +up='[A-Z]' +low='[a-z]' +case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in +ABYZ) + echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 + up='[:upper:]' + low='[:lower:]' + ;; +*) + echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 + ;; +esac +: set up the translation script tr, must be called with ./tr of course +cat >tr <<EOSC +$startsh +case "\$1\$2" in +'[A-Z][a-z]') exec $tr '$up' '$low';; +'[a-z][A-Z]') exec $tr '$low' '$up';; +esac +exec $tr "\$@" +EOSC +chmod +x tr +$eunicefix tr + +: Try to determine whether config.sh was made on this system +case "$config_sh" in +'') +myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` +myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ + ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` +newmyuname="$myuname" +dflt=n +case "$knowitall" in +'') + if test -f ../config.sh; then + if $contains myuname= ../config.sh >/dev/null 2>&1; then + eval "`grep myuname= ../config.sh`" + fi + if test "X$myuname" = "X$newmyuname"; then + dflt=y + fi + fi + ;; +*) dflt=y;; +esac + +: Get old answers, if there is a config file out there +hint=default +hintfile='' +if test -f ../config.sh; then + echo " " + rp="I see a config.sh file. Shall I use it to set the defaults?" + . ./myread + case "$ans" in + n*|N*) echo "OK, I'll ignore it.";; + *) echo "Fetching default answers from your old config.sh file..." >&4 + tmp_n="$n" + tmp_c="$c" + . ../config.sh + cp ../config.sh . + n="$tmp_n" + c="$tmp_c" + hint=previous + ;; + esac +fi +;; +*) + echo " " + echo "Fetching default answers from $config_sh..." >&4 + tmp_n="$n" + tmp_c="$c" + cd .. + cp $config_sh config.sh 2>/dev/null + chmod +w config.sh + . ./config.sh + cd UU + cp ../config.sh . + n="$tmp_n" + c="$tmp_c" + hint=previous + ;; +esac +test "$override" && . ./optdef.sh +myuname="$newmyuname" + +: Restore computed paths +for file in $loclist $trylist; do + eval $file="\$_$file" +done + +: who configured the system +cf_time=`$date 2>&1` +cf_by=`(logname) 2>/dev/null` +case "$cf_by" in +"") + cf_by=`(whoami) 2>/dev/null` + case "$cf_by" in + "") cf_by=unknown ;; + esac ;; +esac + +: is AFS running? +echo " " +case "$afs" in +$define|true) afs=true ;; +$undef|false) afs=false ;; +*) if test -d /afs; then + afs=true + else + afs=false + fi + ;; +esac +if $afs; then + echo "AFS may be running... I'll be extra cautious then..." >&4 +else + echo "AFS does not seem to be running..." >&4 +fi + +: determine where manual pages are on this system +echo " " +case "$sysman" in +'') + syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' + syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" + syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" + syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" + syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" + sysman=`./loc . /usr/man/man1 $syspath` + ;; +esac +if $test -d "$sysman"; then + echo "System manual is in $sysman." >&4 +else + echo "Could not find manual pages in source form." >&4 +fi + +: decide how portable to be +case "$d_portable" in +"$define") dflt=y;; +*) dflt=n;; +esac +$cat <<'EOH' + +I can set things up so that your shell scripts and binaries are more portable, +at what may be a noticable cost in performance. In particular, if you +ask to be portable, the following happens: + + 1) Shell scripts will rely on the PATH variable rather than using + the paths derived above. + 2) ~username interpretations will be done at run time rather than + by Configure. + +EOH +rp="Do you expect to run these scripts and binaries on multiple machines?" +. ./myread +case "$ans" in + y*) d_portable="$define" + ;; + *) d_portable="$undef" ;; +esac + +: set up shell script to do ~ expansion +cat >filexp <<EOSS +$startsh +: expand filename +case "\$1" in + ~/*|~) + echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" + ;; + ~*) + if $test -f /bin/csh; then + /bin/csh -f -c "glob \$1" + failed=\$? + echo "" + exit \$failed + else + name=\`$expr x\$1 : '..\([^/]*\)'\` + dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` + if $test ! -d "\$dir"; then + me=\`basename \$0\` + echo "\$me: can't locate home directory for: \$name" >&2 + exit 1 + fi + case "\$1" in + */*) + echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` + ;; + *) + echo \$dir + ;; + esac + fi + ;; +*) + echo \$1 + ;; +esac +EOSS +chmod +x filexp +$eunicefix filexp + +: now set up to get a file name +cat <<EOS >getfile +$startsh +EOS +cat <<'EOSC' >>getfile +tilde='' +fullpath='' +already='' +skip='' +none_ok='' +exp_file='' +nopath_ok='' +orig_rp="$rp" +orig_dflt="$dflt" + +case "$fn" in +*\(*) + expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok + fn=`echo $fn | sed 's/(.*)//'` + ;; +esac + +case "$fn" in +*:*) + loc_file=`expr $fn : '.*:\(.*\)'` + fn=`expr $fn : '\(.*\):.*'` + ;; +esac + +case "$fn" in +*~*) tilde=true;; +esac +case "$fn" in +*/*) fullpath=true;; +esac +case "$fn" in +*+*) skip=true;; +esac +case "$fn" in +*n*) none_ok=true;; +esac +case "$fn" in +*e*) exp_file=true;; +esac +case "$fn" in +*p*) nopath_ok=true;; +esac + +case "$fn" in +*f*) type='File';; +*d*) type='Directory';; +*l*) type='Locate';; +esac + +what="$type" +case "$what" in +Locate) what='File';; +esac + +case "$exp_file" in +'') + case "$d_portable" in + "$define") ;; + *) exp_file=true;; + esac + ;; +esac + +cd .. +while test "$type"; do + redo='' + rp="$orig_rp" + dflt="$orig_dflt" + case "$tilde" in + true) rp="$rp (~name ok)";; + esac + . UU/myread + if test -f UU/getfile.ok && \ + $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 + then + value="$ans" + ansexp="$ans" + break + fi + case "$ans" in + none) + value='' + ansexp='' + case "$none_ok" in + true) type='';; + esac + ;; + *) + case "$tilde" in + '') value="$ans" + ansexp="$ans";; + *) + value=`UU/filexp $ans` + case $? in + 0) + if test "$ans" != "$value"; then + echo "(That expands to $value on this system.)" + fi + ;; + *) value="$ans";; + esac + ansexp="$value" + case "$exp_file" in + '') value="$ans";; + esac + ;; + esac + case "$fullpath" in + true) + case "$ansexp" in + /*) value="$ansexp" ;; + *) + redo=true + case "$already" in + true) + echo "I shall only accept a full path name, as in /bin/ls." >&4 + echo "Use a ! shell escape if you wish to check pathnames." >&4 + ;; + *) + echo "Please give a full path name, starting with slash." >&4 + case "$tilde" in + true) + echo "Note that using ~name is ok provided it expands well." >&4 + already=true + ;; + esac + esac + ;; + esac + ;; + esac + case "$redo" in + '') + case "$type" in + File) + if test -f "$ansexp"; then + type='' + elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 + then + echo "($value is not a plain file, but that's ok.)" + type='' + fi + ;; + Directory) + if test -d "$ansexp"; then + type='' + fi + ;; + Locate) + if test -d "$ansexp"; then + echo "(Looking for $loc_file in directory $value.)" + value="$value/$loc_file" + ansexp="$ansexp/$loc_file" + fi + if test -f "$ansexp"; then + type='' + fi + case "$nopath_ok" in + true) case "$value" in + */*) ;; + *) echo "Assuming $value will be in people's path." + type='' + ;; + esac + ;; + esac + ;; + esac + + case "$skip" in + true) type=''; + esac + + case "$type" in + '') ;; + *) + if test "$fastread" = yes; then + dflt=y + else + dflt=n + fi + rp="$what $value doesn't exist. Use that name anyway?" + . UU/myread + dflt='' + case "$ans" in + y*) type='';; + *) echo " ";; + esac + ;; + esac + ;; + esac + ;; + esac +done +cd UU +ans="$value" +rp="$orig_rp" +dflt="$orig_dflt" +rm -f getfile.ok +EOSC + +: determine root of directory hierarchy where package will be installed. +case "$prefix" in +'') + dflt=`./loc . /usr/local /usr/local /local /opt /usr` + ;; +*) + dflt="$prefix" + ;; +esac +$cat <<EOM + +By default, $package will be installed in $dflt/bin, manual +pages under $dflt/man, etc..., i.e. with $dflt as prefix for +all installation directories. Typically set to /usr/local, but you +may choose /usr if you wish to install $package among your system +binaries. If you wish to have binaries under /bin but manual pages +under /usr/local/man, that's ok: you will be prompted separately +for each of the installation directories, the prefix being only used +to set the defaults. + +EOM +fn=d~ +rp='Installation prefix to use?' +. ./getfile +oldprefix='' +case "$prefix" in +'') ;; +*) + case "$ans" in + "$prefix") ;; + *) oldprefix="$prefix";; + esac + ;; +esac +prefix="$ans" +prefixexp="$ansexp" + +: set the prefixit variable, to compute a suitable default value +prefixit='case "$3" in +""|none) + case "$oldprefix" in + "") eval "$1=\"\$$2\"";; + *) + case "$3" in + "") eval "$1=";; + none) + eval "tp=\"\$$2\""; + case "$tp" in + ""|" ") eval "$1=\"\$$2\"";; + *) eval "$1=";; + esac;; + esac;; + esac;; +*) + eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; + case "$tp" in + --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; + /*-$oldprefix/*|\~*-$oldprefix/*) + eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; + *) eval "$1=\"\$$2\"";; + esac;; +esac' + +: set the prefixup variable, to restore leading tilda escape +prefixup='case "$prefixexp" in +"$prefix") ;; +*) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; +esac' + +: determine where manual pages go +set mansrc mansrc none +eval $prefixit +$cat <<EOM + +$spackage has manual pages available in source form. +EOM +case "$nroff" in +nroff) + echo "However, you don't have nroff, so they're probably useless to you." + case "$mansrc" in + '') mansrc="none";; + esac;; +esac +echo "If you don't want the manual sources installed, answer 'none'." +case "$mansrc" in +'') + lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1" + lookpath="$lookpath $prefixexp/man/l_man/man1" + lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl" + lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1" + lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" + lookpath="$lookpath /usr/man/man.L" + mansrc=`./loc . $prefixexp/man/man1 $lookpath` + if $test -d "$mansrc"; then + dflt="$mansrc" + else + dflt="$sysman" + fi + set dflt + eval $prefixup + ;; +' ') dflt=none;; +*) dflt="$mansrc" + ;; +esac +echo " " +fn=dn~ +rp='Where do the manual pages (source) go?' +. ./getfile +if test "X$mansrcexp" != "X$ansexp"; then + installmansrc='' +fi +mansrc="$ans" +mansrcexp="$ansexp" +case "$mansrc" in +'') mansrc=' ' + installmansrc='';; +esac +if $afs && $test "$mansrc"; then + $cat <<EOM + +Since you are running AFS, I need to distinguish the directory in which +manual pages reside from the directory in which they are installed (and from +which they are presumably copied to the former directory by occult means). + +EOM + case "$installmansrc" in + '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;; + *) dflt="$installmansrc";; + esac + fn=de~ + rp='Where will man pages be installed?' + . ./getfile + installmansrc="$ans" +else + installmansrc="$mansrcexp" +fi + +case "$mansrc" in +' ') manext='0';; +*l) manext=l;; +*n) manext=n;; +*o) manext=l;; +*p) manext=n;; +*C) manext=C;; +*L) manext=L;; +*L1) manext=L1;; +*) manext=1;; +esac + +: determine where private executables go +set dflt privlib lib/$package +eval $prefixit +$cat <<EOM + +There are some auxiliary files for $package that need to be put into a +private library directory that is accessible by everyone. + +EOM +fn=d~+ +rp='Pathname where the private library files will reside?' +. ./getfile +if $test "X$privlibexp" != "X$ansexp"; then + installprivlib='' +fi +privlib="$ans" +privlibexp="$ansexp" +if $afs; then + $cat <<EOM + +Since you are running AFS, I need to distinguish the directory in which +private files reside from the directory in which they are installed (and from +which they are presumably copied to the former directory by occult means). + +EOM + case "$installprivlib" in + '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; + *) dflt="$installprivlib";; + esac + fn=de~ + rp='Where will private files be installed?' + . ./getfile + installprivlib="$ans" +else + installprivlib="$privlibexp" +fi + +: determine where public executable scripts go +set scriptdir scriptdir +eval $prefixit +case "$scriptdir" in +'') + dflt="$bin" + : guess some guesses + $test -d /usr/share/scripts && dflt=/usr/share/scripts + $test -d /usr/share/bin && dflt=/usr/share/bin + $test -d /usr/local/script && dflt=/usr/local/script + $test -d $prefixexp/script && dflt=$prefixexp/script + set dflt + eval $prefixup + ;; +*) dflt="$scriptdir" + ;; +esac +$cat <<EOM + +Some installations have a separate directory just for executable scripts so +that they can mount it across multiple architectures but keep the scripts in +one spot. You might, for example, have a subdirectory of /usr/share for this. +Or you might just lump your scripts in with all your other executables. + +EOM +fn=d~ +rp='Where do you keep publicly executable scripts?' +. ./getfile +if $test "X$ansexp" != "X$scriptdirexp"; then + installscript='' +fi +scriptdir="$ans" +scriptdirexp="$ansexp" +if $afs; then + $cat <<EOM + +Since you are running AFS, I need to distinguish the directory in which +scripts reside from the directory in which they are installed (and from +which they are presumably copied to the former directory by occult means). + +EOM + case "$installscript" in + '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;; + *) dflt="$installscript";; + esac + fn=de~ + rp='Where will public scripts be installed?' + . ./getfile + installscript="$ans" +else + installscript="$scriptdirexp" +fi + +: preserve RCS keywords in files with variable substitution, grrr +Header='$Header' +Id='$Id' +Locker='$Locker' +Log='$Log' + +: set the base revision +baserev=3.0 + +: make some quick guesses about what we are up against +echo " " +$echo $n "Hmm... $c" +echo exit 1 >bsd +echo exit 1 >usg +echo exit 1 >v7 +echo exit 1 >osf1 +echo exit 1 >eunice +echo exit 1 >xenix +echo exit 1 >venix +echo exit 1 >os2 +d_bsd="$undef" +$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null +if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 +then + echo "Looks kind of like an OSF/1 system, but we'll see..." + echo exit 0 >osf1 +elif test `echo abc | tr a-z A-Z` = Abc ; then + xxx=`./loc addbib blurfl $pth` + if $test -f $xxx; then + echo "Looks kind of like a USG system with BSD features, but we'll see..." + echo exit 0 >bsd + echo exit 0 >usg + else + if $contains SIGTSTP foo >/dev/null 2>&1 ; then + echo "Looks kind of like an extended USG system, but we'll see..." + else + echo "Looks kind of like a USG system, but we'll see..." + fi + echo exit 0 >usg + fi +elif $contains SIGTSTP foo >/dev/null 2>&1 ; then + echo "Looks kind of like a BSD system, but we'll see..." + d_bsd="$define" + echo exit 0 >bsd +else + echo "Looks kind of like a Version 7 system, but we'll see..." + echo exit 0 >v7 +fi +case "$eunicefix" in +*unixtovms*) + $cat <<'EOI' +There is, however, a strange, musty smell in the air that reminds me of +something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. +EOI + echo exit 0 >eunice + d_eunice="$define" +: it so happens the Eunice I know will not run shell scripts in Unix format + ;; +*) + echo " " + echo "Congratulations. You aren't running Eunice." + d_eunice="$undef" + ;; +esac +case "$p_" in +:) ;; +*) + $cat <<'EOI' +I have the feeling something is not exactly right, however...don't tell me... +lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! +EOI + echo exit 0 >os2 + ;; +esac +if test -f /xenix; then + echo "Actually, this looks more like a XENIX system..." + echo exit 0 >xenix + d_xenix="$define" +else + echo " " + echo "It's not Xenix..." + d_xenix="$undef" +fi +chmod +x xenix +$eunicefix xenix +if test -f /venix; then + echo "Actually, this looks more like a VENIX system..." + echo exit 0 >venix +else + echo " " + if ./xenix; then + : null + else + echo "Nor is it Venix..." + fi +fi +chmod +x bsd usg v7 osf1 eunice xenix venix os2 +$eunicefix bsd usg v7 osf1 eunice xenix venix os2 +$rm -f foo + +: see if we have to deal with yellow pages, now NIS. +if $test -d /usr/etc/yp || $test -d /etc/yp; then + if $test -f /usr/etc/nibindd; then + echo " " + echo "I'm fairly confident you're on a NeXT." + echo " " + rp='Do you get the passwd file via NetInfo?' + dflt=y + case "$passcat" in + nidump*) ;; + '') ;; + *) dflt=n;; + esac + . ./myread + case "$ans" in + y*) passcat='nidump passwd .' + ;; + *) echo "You told me, so don't blame me." + case "$passcat" in + nidump*) passcat='' + esac + ;; + esac + echo " " + rp='Do you get the hosts file via NetInfo?' + dflt=y + case "$hostcat" in + nidump*) ;; + '') ;; + *) dflt=n;; + esac + . ./myread + case "$ans" in + y*) hostcat='nidump hosts .';; + *) case "$hostcat" in + nidump*) hostcat='';; + esac + ;; + esac + fi + case "$passcat" in + nidump*) ;; + *) + case "$passcat" in + *ypcat*) dflt=y;; + '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then + dflt=y + else + dflt=n + fi;; + *) dflt=n;; + esac + echo " " + rp='Are you getting the passwd file via yellow pages?' + . ./myread + case "$ans" in + y*) passcat='ypcat passwd' + ;; + *) passcat='cat /etc/passwd' + ;; + esac + ;; + esac + case "$hostcat" in + nidump*) ;; + *) + case "$hostcat" in + *ypcat*) dflt=y;; + '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then + dflt=y + else + dflt=n + fi;; + *) dflt=n;; + esac + echo " " + rp='Are you getting the hosts file via yellow pages?' + . ./myread + case "$ans" in + y*) hostcat='ypcat hosts';; + *) hostcat='cat /etc/hosts';; + esac + ;; + esac +fi +case "$hostcat" in +'') hostcat='cat /etc/hosts';; +esac +case "$groupcat" in +'') groupcat='cat /etc/group';; +esac +case "$passcat" in +'') passcat='cat /etc/passwd';; +esac + +: now get the host name +echo " " +echo "Figuring out host name..." >&4 +case "$myhostname" in +'') cont=true + echo 'Maybe "hostname" will work...' + if tans=`sh -c hostname 2>&1` ; then + myhostname=$tans + phostname=hostname + cont='' + fi + ;; +*) cont='';; +esac +if $test "$cont"; then + if ./xenix; then + echo 'Oh, dear. Maybe "/etc/systemid" is the key...' + if tans=`cat /etc/systemid 2>&1` ; then + myhostname=$tans + phostname='cat /etc/systemid' + echo "Whadyaknow. Xenix always was a bit strange..." + cont='' + fi + elif $test -r /etc/systemid; then + echo "(What is a non-Xenix system doing with /etc/systemid?)" + fi +fi +if $test "$cont"; then + echo 'No, maybe "uuname -l" will work...' + if tans=`sh -c 'uuname -l' 2>&1` ; then + myhostname=$tans + phostname='uuname -l' + else + echo 'Strange. Maybe "uname -n" will work...' + if tans=`sh -c 'uname -n' 2>&1` ; then + myhostname=$tans + phostname='uname -n' + else + echo 'Oh well, maybe I can mine it out of whoami.h...' + if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then + myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` + phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" + else + case "$myhostname" in + '') echo "Does this machine have an identity crisis or something?" + phostname='';; + *) + echo "Well, you said $myhostname before..." + phostname='echo $myhostname';; + esac + fi + fi + fi +fi +: you do not want to know about this +set $myhostname +myhostname=$1 + +: verify guess +if $test "$myhostname" ; then + dflt=y + rp='Your host name appears to be "'$myhostname'".'" Right?" + . ./myread + case "$ans" in + y*) ;; + *) myhostname='';; + esac +fi + +: bad guess or no guess +while $test "X$myhostname" = X ; do + dflt='' + rp="Please type the (one word) name of your host:" + . ./myread + myhostname="$ans" +done + +: translate upper to lower if necessary +case "$myhostname" in +*[A-Z]*) + echo "(Normalizing case in your host name)" + myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'` + ;; +esac + +case "$myhostname" in +*.*) + dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"` + myhostname=`expr "X$myhostname" : "X\([^.]*\)\."` + echo "(Trimming domain name from host name--host name is now $myhostname)" + ;; +*) case "$mydomain" in + '') + { + : If we use NIS, try ypmatch. + : Is there some reason why this was not done before? + test "X$hostcat" = "Xypcat hosts" && + ypmatch "$myhostname" hosts 2>/dev/null |\ + $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \ + $test -s hosts + } || { + : Extract only the relevant hosts, reducing file size, + : remove comments, insert trailing space for later use. + $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ / + /[ ]$myhostname[ . ]/p" > hosts + } + tmp_re="[ . ]" + $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ } + END { print sum }" hosts` = x1 || tmp_re="[ ]" + dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \ + hosts | $sort | $uniq | \ + $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"` + case `$echo X$dflt` in + X*\ *) echo "(Several hosts in /etc/hosts matched hostname)" + dflt=. + ;; + X.) echo "(You do not have fully-qualified names in /etc/hosts)" + ;; + esac + case "$dflt" in + .) + tans=`./loc resolv.conf X /etc /usr/etc` + if $test -f "$tans"; then + echo "(Attempting domain name extraction from $tans)" + dflt=.`$sed -n -e 's/ / /g' \ + -e 's/^search *\([^ ]*\).*/\1/p' $tans \ + | ./tr '[A-Z]' '[a-z]' 2>/dev/null` + case "$dflt" in + .) dflt=.`$sed -n -e 's/ / /g' \ + -e 's/^domain *\([^ ]*\).*/\1/p' $tans \ + | ./tr '[A-Z]' '[a-z]' 2>/dev/null` + ;; + esac + fi + ;; + esac + case "$dflt" in + .) echo "(No help from resolv.conf either -- attempting clever guess)" + dflt=.`sh -c domainname 2>/dev/null` + case "$dflt" in + '') dflt='.';; + .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;; + esac + ;; + esac + case "$dflt" in + .) echo "(Lost all hope -- silly guess then)" + dflt='.uucp' + ;; + esac + $rm -f hosts + ;; + *) dflt="$mydomain";; + esac;; +esac +echo " " +rp="What is your domain name?" +. ./myread +tans="$ans" +case "$ans" in +'') ;; +.*) ;; +*) tans=".$tans";; +esac +mydomain="$tans" + +: translate upper to lower if necessary +case "$mydomain" in +*[A-Z]*) + echo "(Normalizing case in your domain name)" + mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'` + ;; +esac + +: a little sanity check here +case "$phostname" in +'') ;; +*) + case `$phostname | ./tr '[A-Z]' '[a-z]'` in + $myhostname$mydomain|$myhostname) ;; + *) + case "$phostname" in + sed*) + echo "(That doesn't agree with your whoami.h file, by the way.)" + ;; + *) + echo "(That doesn't agree with your $phostname command, by the way.)" + ;; + esac + ;; + esac + ;; +esac + +$cat <<EOM + +I need to get your e-mail address in Internet format if possible, i.e. +something like user@host.domain. Please answer accurately since I have +no easy means to double check it. The default value provided below +is most probably close to the reality but may not be valid from outside +your organization... + +EOM +cont=x +while test "$cont"; do + case "$cf_email" in + '') dflt="$cf_by@$myhostname$mydomain";; + *) dflt="$cf_email";; + esac + rp='What is your e-mail address?' + . ./myread + cf_email="$ans" + case "$cf_email" in + *@*.*) cont='' ;; + *) + rp='Address does not look like an Internet one. Use it anyway?' + case "$fastread" in + yes) dflt=y ;; + *) dflt=n ;; + esac + . ./myread + case "$ans" in + y*) cont='' ;; + *) echo " " ;; + esac + ;; + esac +done + +: determine default editor +echo " " +case "$defeditor" in +'') + case "$vi" in + */*) dflt="$vi";; + *) dflt=/usr/ucb/vi;; + esac + ;; +*) dflt="$defeditor" + ;; +esac +fn=f/ +rp="What is the default editor on your system?" +. ./getfile +defeditor="$ans" + +: locate a BSD compatible install program +echo " " +echo "Looking for a BSD-compatible install program..." >&4 +creatdir='' +case "$install" in +'') + tryit='' + for dir in $pth; do + for file in ginstall installbsd scoinst install; do + if $test -f $dir/$file; then + tryit="$tryit $dir/$file" + fi + done + done + $cat >try.c <<EOC +main() +{ + printf("OK\n"); + exit(0); +} +EOC + if $cc try.c -o try >/dev/null 2>&1; then + cp try try.ns + strip try >/dev/null 2>&1 + else + echo "(I can't seem to compile a trivial C program -- bypassing.)" + echo "try" >try + cp try try.ns + fi + $cat >tryinst <<EOS +$startsh +$rm -rf foo d +\$1 -d foo/bar +$mkdir d +\$1 -c -m 764 try.ns d +\$1 -c -s -m 642 try.ns d/try +EOS + chmod +x tryinst + $eunicefix tryinst + dflt='' + either='' + for prog in $tryit; do + $echo $n "Checking $prog... $c" + ./tryinst $prog >/dev/null 2>&1 + if $test -d foo/bar; then + creatdir="$prog -d" + fi + (ls -l d/try >try.ls; ls -l d/try.ns >tryno.ls) 2>/dev/null + if (cmp -s d/try try && cmp -s d/try.ns try.ns && \ + $contains 'rwxrw-r--' tryno.ls && \ + $contains 'rw-r---w-' try.ls) >/dev/null 2>&1 + then + dflt="$prog" + echo "ok, that will do." + break + fi + echo "not good$either." + either=' either' + $rm -f try*.ls + done + $rm -rf foo d tryinst try try*.ls try.* + case "$dflt" in + '') + echo "Hopefully, $package comes with its own install script!" + dflt='./install' + ;; + esac + ;; +*) dflt="$install";; +esac +$cat <<EOM + +I will be requiring a BSD-compatible install program (one that allows +options like -s to strip executables or -m to specify a file mode) to +install $package. + +If the question below contains a fully qualified default path, then it +is probably ok. If it is an unqualified name such as 'install', then it +means I was unable to find out a good install program I could use. If +you know of one, please tell me about it. If the default is './install', +then I shall be using the install script supplied with $package. + +EOM +fn='/fe~(install,./install)' +rp='Which install program shall I use?' +. ./getfile +install="$ans" + +: how can we create nested directories? +echo " " +echo "Ok, let's see how we can create nested directories..." >&4 +case "$installdir" in +'') + case "$creatdir" in + '') + $mkdir -p foo/bar >/dev/null 2>&1 + if $test -d foo/bar; then + echo "Great, we can build them using 'mkdir -p'." + creatdir='mkdir -p' + elif eval "$install -d foo/bar"; $test -d foo/bar; then + creatdir="install -d" + echo "It looks like '$creatdir' will do it for us." + fi + ;; + *) + eval "$creatdir foo/bar" >/dev/null 2>&1 + if $test -d foo/bar; then + echo "Ah! We can use '$creatdir' to do just that." + fi + ;; + esac + $rm -rf foo + case "$creatdir" in + '') + echo "Heck! Another ancient system lacking the comfort of modern ones!" + echo "You can thank $package for bringing you its own install script!" + installdir='./install -d' + ;; + *) installdir="$creatdir";; + esac + ;; +*) echo "As you already told me, '$installdir' should work.";; +esac + +: determine the name of a reasonable mailer +case "$mailer" in +'') + if $test -f "$sendmail"; then + dflt="$sendmail" + elif $test -f "$smail"; then + dflt="$smail" + elif $test -f "$rmail"; then + dflt="$rmail" + elif $test -f /bin/mail; then + dflt=/bin/mail + else + dflt=$mail + fi + ;; +*) dflt="$mailer";; +esac +$cat <<EOM + +I need the full pathname of the program used to deliver mail on your system. +A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose +any other program, as long as it can be fed from standard input and will +honour any user-supplied headers. + +EOM +fn=f +rp='Mail transport agent to be used?' +. ./getfile +mailer="$ans" + +: see how we invoke the C preprocessor +echo " " +echo "Now, how can we feed standard input to your C preprocessor..." >&4 +cat <<'EOT' >testcpp.c +#define ABC abc +#define XYZ xyz +ABC.XYZ +EOT +cd .. +echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin +chmod 755 cppstdin +wrapper=`pwd`/cppstdin +ok='false' +cd UU + +if $test "X$cppstdin" != "X" && \ + $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 +then + echo "You used to use $cppstdin $cppminus so we'll use that again." + case "$cpprun" in + '') echo "But let's see if we can live without a wrapper..." ;; + *) + if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 + then + echo "(And we'll use $cpprun $cpplast to preprocess directly.)" + ok='true' + else + echo "(However, $cpprun $cpplast does not work, let's see...)" + fi + ;; + esac +else + case "$cppstdin" in + '') ;; + *) + echo "Good old $cppstdin $cppminus does not seem to be of any help..." + ;; + esac +fi + +if $ok; then + : nothing +elif echo 'Maybe "'"$cc"' -E" will work...'; \ + $cc -E <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Yup, it does." + x_cpp="$cc -E" + x_minus=''; +elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ + $cc -E - <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Yup, it does." + x_cpp="$cc -E" + x_minus='-'; +elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ + $cc -P <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Yipee, that works!" + x_cpp="$cc -P" + x_minus=''; +elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ + $cc -P - <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "At long last!" + x_cpp="$cc -P" + x_minus='-'; +elif echo 'No such luck, maybe "'$cpp'" will work...'; \ + $cpp <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "It works!" + x_cpp="$cpp" + x_minus=''; +elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ + $cpp - <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Hooray, it works! I was beginning to wonder." + x_cpp="$cpp" + x_minus='-'; +elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ + $wrapper <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + x_cpp="$wrapper" + x_minus='' + echo "Eureka!" +else + dflt='' + rp="No dice. I can't find a C preprocessor. Name one:" + . ./myread + x_cpp="$ans" + x_minus='' + $x_cpp <testcpp.c >testcpp.out 2>&1 + if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "OK, that will do." >&4 + else +echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 + exit 1 + fi +fi + +case "$ok" in +false) + cppstdin="$x_cpp" + cppminus="$x_minus" + cpprun="$x_cpp" + cpplast="$x_minus" + set X $x_cpp + shift + case "$1" in + "$cpp") + echo "Perhaps can we force $cc -E using a wrapper..." + if $wrapper <testcpp.c >testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 + then + echo "Yup, we can." + cppstdin="$wrapper" + cppminus=''; + else + echo "Nope, we'll have to live without it..." + fi + ;; + esac + case "$cpprun" in + "$wrapper") + cpprun='' + cpplast='' + ;; + esac + ;; +esac + +case "$cppstdin" in +"$wrapper") ;; +*) $rm -f $wrapper;; +esac +$rm -f testcpp.c testcpp.out + +: Define several unixisms. +: Hints files or command line option can be used to override them. +case "$_a" in +'') _a='.a';; +esac +case "$_o" in +'') _o='.o';; +esac + +: find out how to generate dependencies +echo " " +echo "Checking how to generate makefile dependencies on your machine..." >&4 +toplev=`cd ..;pwd` +$cat >dep.c <<'EOCP' +#include "dep.h" +EOCP +$cat >dep.h <<'EOCP' + +EOCP +takeflags='flags="" +case "$@" in +*--*) + for arg + do + shift + case "$arg" in + --) break;; + *) flags="$flags $arg";; + esac + done;; +esac' +case "$mkdep" in +'') + ;; +*) + if test -x "$mkdep" && + $mkdep dep.c >dep.out 2>/dev/null && + $contains "dep\$_o:.*dep\.h" dep.out >/dev/null 2>&1 + then + echo "$mkdep works." + else + mkdep= + fi +esac + +case "$mkdep" in +'') + $spitshell > ../mkdep <<EOM +$startsh +$takeflags +for srcfile +do + $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null +done +exit 0 +EOM + mkdep=$toplev/mkdep + chmod +x $mkdep + $eunicefix $mkdep + if $mkdep dep.c >dep.out 2>/dev/null && + $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 + then + echo "Looks like we can use $cpp -M." + else + mkdep= + fi + ;; +esac + +case "$mkdep" in +'') + $spitshell > ../mkdep <<EOM +$startsh +$takeflags +for srcfile +do + $cc -MM -I. $cppflags \$flags \$srcfile 2>/dev/null +done +exit 0 +EOM + mkdep=$toplev/mkdep + chmod +x $mkdep + $eunicefix $mkdep + if $mkdep dep.c >dep.out 2>/dev/null && + $contains "dep$_o: dep.h" dep.out >/dev/null 2>&1 + then + echo "Looks like we can use $cc -MM." + else + mkdep= + fi + ;; +esac + +case "$mkdep" in +'') + $spitshell >../mkdep <<EOS +$startsh +$takeflags +for srcfile +do + case "\$srcfile" in + *.c) c='.c';; + *.y) c='.y';; + *.l) c='.l';; + esac + filebase=\`basename \$srcfile \$c\` + <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\ + $sed -e '/^# *[0-9]/!d' \\ + -e 's/^.*"\(.*\)".*\$/'\$filebase'$_o: \1/' \\ + -e 's|: \./|: |' \\ + -e 's|: *$|: '\$srcfile'|' | \\ + $grep -v '^#' | $sort | $uniq +done +exit 0 +EOS + mkdep=$toplev/mkdep + chmod +x $mkdep + $eunicefix $mkdep + if $mkdep dep.c >dep.out 2>/dev/null && + $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 + then + echo "A shell script using $cpp does the trick." + else + echo "$cpp doesn't seem to be any use at all." + $spitshell >../mkdep <<EOS +$startsh +$takeflags +files="\$@" +set X \$flags +shift +inc='.' +while test \$# -gt 0 +do + case "\$1" in + -I) + shift + inc="\$inc:\$1" + ;; + -I*) + dir=\`echo \$1 | sed -e 's/^-I//'\` + inc="\$inc:\$dir" + ;; + esac + shift +done +set X \$files +shift +trap "$rm -f /tmp/mkdep\$\$; exit 1" 1 2 3 15 +for srcfile +do + case "\$srcfile" in + *.c) c='.c';; + *.y) c='.y';; + *.l) c='.l';; + esac + filebase=\`basename \$srcfile \$c\` + echo \$filebase$_o: \$srcfile + $grep '^#[ ]*include' \$srcfile /dev/null | \ + $sed -n -e 's/#[ ]*include[ ]*//' \\ + -e '/<\(.*\)>/ d' \\ + -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\ + -e "s/\\.c:/$_o:/p" > /tmp/mkdep\$\$ + IFS=': ' + while read file dep; do + for dir in \$inc; do + if $test -f "\$dir/\$dep"; then + dep="\$dir/\$dep" + break + fi + done + echo "\$file: \$dep" | $sed -e 's,: \./,: ,' + done </tmp/mkdep\$\$ + IFS=' ' + $rm -f /tmp/mkdep\$\$ +done +exit 0 +EOS + mkdep=$toplev/mkdep + chmod +x $mkdep + $eunicefix $mkdep + if $mkdep dep.c >dep.out 2>/dev/null && + $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 + then + cat << EOM + +I can use a script with grep instead, but it will make some incorrect +dependencies, since it doesn't understand about conditional compilation. +Moreover, some dependencies may be missing, because scanning won't be +a recursive process. +If you have a program which generates makefile dependencies, you may want +to use it. If not, you can use the script and edit the Makefile by hand +if you need to. +EOM + else + mkdep= + cat << EOM + +I can't seem to generate makefile dependencies at all! Perhaps you have a +program that does? If you don't, you might look at the mkdep script to +see if you can create one which works. +EOM + fi + fi +esac +dflt="$mkdep" +fn=f~/ +rp="Name of program to make makefile dependencies?" +. ./getfile +mkdep="$ans" +$rm -f dep.c dep.h dep$_o dep.out + +: find out how to find out full name +case "$d_berknames" in +"$define") + dflt=y;; +"$undef") + dflt=n;; +*) + if ./bsd; then + dflt=y + elif ./xenix; then + dflt=y + else + dflt=n + fi + ;; +esac +$cat <<'EOM' + +Does your /etc/passwd file keep full names in Berkeley/V7 format (name first +thing after ':' in GCOS field)? In that case, a typical entry in the password +file looks like this: + + guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh + ^^^^^^^^^^^^^^^^^ +EOM +rp="Berkeley/V7 format for full name in /etc/passwd?" +. ./myread +case "$ans" in +y*) d_passnames="$define" + d_berknames="$define" + d_usgnames="$undef" + nametype=bsd + ;; +*) + case "$d_usgnames" in + "$define") dflt=y;; + "$undef") dflt=n;; + *) + if ./usg; then + dflt=y + else + dflt=n + fi + ;; + esac +$cat <<'EOM' + +Does your passwd file keep full names in USG format (name sandwiched between a +'-' and a '(')? In that case, a typical entry in the password file looks like +this: + + guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh + ^^^^^^^^^^^^^^^^^ +EOM + rp="USG format for full name in /etc/passwd?" + . ./myread + case "$ans" in + n*) echo "Full name will be taken from ~/.fullname" + d_passnames="$undef" + d_berknames="$undef" + d_usgnames="$undef" + nametype=other + ;; + *) + d_passnames="$define" + d_berknames="$undef" + d_usgnames="$define" + nametype=usg + ;; + esac;; +esac + +: get organization name +longshots='/local/src /usr/src/new /usr/src/local /usr/local/src' +case "$orgname" in +'') if xxx=`./loc news/src/defs.h x $longshots`; then + dflt=`$sed -n 's/^.*MYORG[ ]*"\(.*\)".*$/\1/p' $xxx` + else + dflt='' + fi + ;; +*) dflt="$orgname";; +esac +$cat << 'EOH' + +Please type the name of your organization as you want it to appear on the +Organization line of outgoing articles. (It's nice if this also specifies +your location. Your city name is probably sufficient if well known.) +For example: + + University of Southern North Dakota, Hoople + +You may also put the name of a file, as long as it begins with a slash. +For example: + + /etc/organization + +EOH +orgname="" +while test "X$orgname" = "X"; do + rp='Organization:' + . ./myread + orgname="$ans" +done + +: locate the preferred pager for this system +case "$pager" in +'') + dflt='' + case "$pg" in + /*) dflt=$pg;; + esac + case "$more" in + /*) dflt=$more;; + esac + case "$less" in + /*) dflt=$less;; + esac + case "$dflt" in + '') dflt=/usr/ucb/more;; + esac + ;; +*) dflt="$pager";; +esac +echo " " +fn=f/ +rp='What pager is used on your system?' +. ./getfile +pager="$ans" + +: get the patchlevel +echo " " +echo "Getting the current patchlevel..." >&4 +if $test -r $rsrc/patchlevel.h;then + patchlevel=`awk '/PATCHLEVEL/ {print $3}' < $rsrc/patchlevel.h` +else + patchlevel=0 +fi +echo "(You have $package $baserev PL$patchlevel.)" + +: determine perl absolute location +case "$perlpath" in +'') + if test -f /usr/bin/perl; then + dflt=/usr/bin/perl + else + case "$perl" in + */*) dflt="$perl";; + *) dflt=/usr/bin/perl;; + esac + fi + ;; +*) dflt="$perlpath" + ;; +esac +echo " " +fn=f~/ +rp="Where is perl located on your system?" +. ./getfile +perlpath="$ans" + +: figure out how to guarantee perl startup +case "$sharpbang" in +*!) + $cat >xtry <<EOP +#!$perlpath +system("exit 0"); +EOP + chmod a+x xtry + if ./xtry >/dev/null 2>&1; then + $cat <<EOH + +I can use the #! construct to start perl on your system. This will make +startup of perl scripts faster, but may cause problems if you want to share +those scripts and perl is not in a standard place (/usr/bin/perl) on all your +platforms. The alternative is to force a shell by starting the script with a +single ':' character. + +EOH + pdflt=y + else + $cat <<EOH + +I could use the #! construct to start perl on your system, but using + #!$perlpath +would be too long for your kernel to grok. Indeed, most systems do +limit the size of the leading #! string to 32 characters. + +EOH + pdflt=n + fi + $rm -f xtry + case "$startperl" in + *!*) dflt=y;; + '') case "$d_portable" in + "$define") dflt=n;; + *) dflt=$pdflt;; + esac;; + esac + rp='Shall I use #! to start up perl?' + . ./myread + case "$ans" in + y*|Y*) startperl="#!$perlpath";; + *) startperl=": # use perl";; + esac;; +*) startperl=": # use perl";; +esac + +: notify author that his package is used +if $test -f ../.config/mailauthor && + cmp $rsrc/patchlevel.h ../.config/mailauthor >/dev/null 2>&1 +then + status="say that you're using $package"; + case "$mailpatches" in + true) status='have patches mailed to you as they are issued';; + esac + case "$notifypatches" in + true) status='be notified when new patches are issued';; + esac + $cat <<EOM + +You have already sent the author of $package (Raphael_Manfredi@grenoble.hp.com) mail to +$status. If you wish, you may modify +your previous request by sending a new mail with different options. + +EOM + rp='Should I send a status update to Raphael_Manfredi@grenoble.hp.com?' + dflt=n +else + $cat <<EOM + +If you are able to send mail to the Internet, the author of $package would +really appreciate you letting me send off a quick note, just to say that you've +tried it. The author is more likely to spend time maintaining $package if it's +known that many people are using it, and you can even ask to get sent new +patches automagically this way if you wish. To protect your privacy, all I'll +say in the mail is the version of $package that you're using. + +EOM + rp='Should I send mail to Raphael_Manfredi@grenoble.hp.com?' + dflt=y + $test -f ../.config/nomail && dflt=n +fi +. ./myread +case "$ans" in +[yY]*) + echo " " + echo "Great! Your cooperation is really appreciated." + $cat <<EOM + +Some braindead sites do not set a proper return address in the From: header of +their outgoing mail, making it impossible to reply to mail they generate. +If your site is broken in this way, write to your system administrator and get +it fixed!!! In the mean time, you can manually specify the Internet e-mail +address by which the author can get back to you, should there be a need to do +so. If manually specified, it should be something like "user@domain.top". +If your mail system generates addresses correctly, specify "none". + +EOM + case "$usermail" in + '-'|'') dflt=none;; + *) dflt="$usermail";; + esac + rp='Manually specify a return address to use:' + . ./myread + case "$ans" in + none|*@*.*) + case "$ans" in + none) usermail='-';; + *) usermail="$ans";; + esac + ;; + *) + echo "(Address does not look like an Internet one -- ignoring it.)" + usermail='-' + mailpatches=false + notifypatches=false + ;; + esac + echo " " + opt='' + rp='Would you like to have new patches automatically mailed to you?' + case "$mailpatches" in + true) dflt=y;; + *) dflt=n;; + esac + . ./myread + case "$ans" in + [yY]*) opt=' mailpatches'; mailpatches=true;; + *) + mailpatches=false + echo " " + rp='Ok, would you like to simply be notified of new patches?' + case "$notifypatches" in + false) dflt=n;; + *) dflt=y;; + esac + . ./myread + echo " " + case "$ans" in + [yY]*) opt=' notifypatches'; notifypatches=true;; + *) + echo "Fine, I'll simply say that you've tried it then." + notifypatches=false + ;; + esac + ;; + esac + echo "Sending mail to Raphael_Manfredi@grenoble.hp.com..." >&4 + atsh='@SH' + $mailer Raphael_Manfredi@grenoble.hp.com <<EOM >/dev/null 2>&1 +Subject: Command +Precedence: junk +To: Raphael_Manfredi@grenoble.hp.com + +$atsh package $usermail $package $baserev $patchlevel$opt +EOM + $rm -f ../.config/mailauthor ../.config/nomail + cp $rsrc/patchlevel.h ../.config/mailauthor + ;; +*) + case "$dflt" in + "y") + echo "Oh well, maybe next time." + cp /dev/null ../.config/nomail + ;; + esac + ;; +esac + +: figure out their full name +case "$NAME" in +'') case "$nametype" in + other) + fn=`./filexp ~/.fullname` + xxx=usg + $test -f $fn && xxx=other + ;; + *) + xxx="$nametype" + ;; + esac + + case "$xxx" in + bsd) + cf_name=`$passcat | grep "^$cf_by:" | \ + sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \ + -e 's/,.*//'` + ;; + usg) + cf_name=`$passcat | grep "^$cf_by:" | \ + sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \ + -e 's/[^-]*-\(.*\)(.*)/\1/'` + ;; + *) + cf_name=`$cat $fn` + ;; + esac + ;; +*) + cf_name="$NAME" + ;; +esac +echo " " +echo "Pleased to meet you, $cf_name." + +: offer to join the mailing list +list_request='majordomo@foretune.co.jp' +list_sub="subscribe dist-users $cf_email" +list_unsub="unsubscribe dist-users $cf_email" +list_name="dist-users" +$cat <<EOM + +There is a mailing list for discussion about $package and related issues. +This is the preferred place to ask questions about the program and discuss +modifications and additions with the author and other users. If you are able +to send mail to the Internet, you are encouraged to subscribe. You need only +ever subscribe once, and you can unsubscribe automatically at any time in the +future. If you have already subscribed and you wish to unsubscribe now, you +may do so by answering "unsubscribe". Answer "subscribe" to subscribe to the +list. + +EOM +rp="Subscribe to or unsubscribe from the $list_name mailing list?" +dflt=neither +. ./myread +case "$ans" in +[sS]*) $cat <<EOM + +You will be sent a message from the list server to let you know when your +subscription has been successful and telling you how to submit articles and +how to unsubscribe again when necessary. You may also unsubscribe by running +this script again and asking it to do so for you. + +EOM + echo "Sending mail to subscribe you to the $list_name list..." >&4 + $mailer $list_request <<EOM >/dev/null 2>&1 +Precedence: junk +To: $list_request + +$list_sub +EOM + ;; +[uU]*) echo "Sending mail to unsubscribe you from the $list_name list..." >&4 + $mailer $list_request <<EOM >/dev/null 2>&1 +Precedence: junk +To: $list_request + +$list_unsub +EOM + ;; +esac + +: end of configuration questions +echo " " +echo "End of configuration questions." +echo " " + +: back to where it started +if test -d ../UU; then + cd .. +fi + +: configuration may be patched via a 'config.over' file +if $test -f config.over; then + echo " " + dflt=y + rp='I see a config.over file. Do you wish to load it?' + . UU/myread + case "$ans" in + n*) echo "OK, I'll ignore it.";; + *) . ./config.over + echo "Configuration override changes have been loaded." + ;; + esac +fi + +: in case they want portability, strip down executable paths +case "$d_portable" in +"$define") + echo " " + echo "Stripping down executable paths..." >&4 + for file in $loclist $trylist; do + eval $file="\$file" + done + ;; +esac + +: create config.sh file +echo " " +echo "Creating config.sh..." >&4 +$spitshell <<EOT >config.sh +$startsh +# +# This file was produced by running the Configure script. It holds all the +# definitions figured out by Configure. Should you modify one of these values, +# do not forget to propagate your changes by running "Configure -der". You may +# instead choose to run each of the .SH files by yourself, or "Configure -S". +# + +# Package name : $package +# Source directory : $src +# Configuration time: $cf_time +# Configured by : $cf_by +# Target system : $myuname + +Author='$Author' +Date='$Date' +Header='$Header' +Id='$Id' +Locker='$Locker' +Log='$Log' +Mcc='$Mcc' +RCSfile='$RCSfile' +Revision='$Revision' +Source='$Source' +State='$State' +afs='$afs' +ar='$ar' +archobjs='$archobjs' +awk='$awk' +baserev='$baserev' +bash='$bash' +bison='$bison' +byacc='$byacc' +c='$c' +cat='$cat' +cf_by='$cf_by' +cf_email='$cf_email' +cf_time='$cf_time' +chgrp='$chgrp' +chmod='$chmod' +chown='$chown' +comm='$comm' +compress='$compress' +contains='$contains' +cp='$cp' +cpio='$cpio' +cpp='$cpp' +cpplast='$cpplast' +cppminus='$cppminus' +cpprun='$cpprun' +cppstdin='$cppstdin' +csh='$csh' +d_berknames='$d_berknames' +d_bsd='$d_bsd' +d_eunice='$d_eunice' +d_passnames='$d_passnames' +d_portable='$d_portable' +d_usgnames='$d_usgnames' +d_xenix='$d_xenix' +date='$date' +defeditor='$defeditor' +echo='$echo' +egrep='$egrep' +emacs='$emacs' +eunicefix='$eunicefix' +expr='$expr' +find='$find' +firstmakefile='$firstmakefile' +flex='$flex' +gcc='$gcc' +grep='$grep' +groupcat='$groupcat' +gzip='$gzip' +hint='$hint' +hostcat='$hostcat' +inews='$inews' +install='$install' +installdir='$installdir' +installmansrc='$installmansrc' +installprivlib='$installprivlib' +installscript='$installscript' +ksh='$ksh' +less='$less' +line='$line' +lint='$lint' +ln='$ln' +lns='$lns' +lp='$lp' +lpr='$lpr' +ls='$ls' +mail='$mail' +mailer='$mailer' +mailpatches='$mailpatches' +mailx='$mailx' +make='$make' +make_set_make='$make_set_make' +manext='$manext' +mansrc='$mansrc' +mansrcexp='$mansrcexp' +mkdep='$mkdep' +mkdir='$mkdir' +more='$more' +mv='$mv' +mydomain='$mydomain' +myhostname='$myhostname' +myuname='$myuname' +n='$n' +nametype='$nametype' +notifypatches='$notifypatches' +nroff='$nroff' +orgname='$orgname' +osname='$osname' +osvers='$osvers' +package='$package' +pager='$pager' +passcat='$passcat' +patchlevel='$patchlevel' +perl='$perl' +perlpath='$perlpath' +pg='$pg' +phostname='$phostname' +pmake='$pmake' +pr='$pr' +prefix='$prefix' +prefixexp='$prefixexp' +privlib='$privlib' +privlibexp='$privlibexp' +rm='$rm' +rmail='$rmail' +scriptdir='$scriptdir' +scriptdirexp='$scriptdirexp' +sed='$sed' +sendmail='$sendmail' +sh='$sh' +shar='$shar' +sharpbang='$sharpbang' +shsharp='$shsharp' +sleep='$sleep' +smail='$smail' +sort='$sort' +spackage='$spackage' +spitshell='$spitshell' +src='$src' +startperl='$startperl' +startsh='$startsh' +submit='$submit' +sysman='$sysman' +tail='$tail' +tar='$tar' +tbl='$tbl' +test='$test' +touch='$touch' +tr='$tr' +troff='$troff' +uname='$uname' +uniq='$uniq' +usermail='$usermail' +uuname='$uuname' +vi='$vi' +zcat='$zcat' +zip='$zip' +EOT + +: add special variables +$test -f $src/patchlevel.h && \ +awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh +echo "CONFIG=true" >>config.sh + +: propagate old symbols +if $test -f UU/config.sh; then + <UU/config.sh sort | uniq >UU/oldconfig.sh + sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ + sort | uniq -u >UU/oldsyms + set X `cat UU/oldsyms` + shift + case $# in + 0) ;; + *) + cat <<EOM +Hmm...You had some extra variables I don't know about...I'll try to keep 'em... +EOM + echo "# Variables propagated from previous config.sh file." >>config.sh + for sym in `cat UU/oldsyms`; do + echo " Propagating $hint variable "'$'"$sym..." + eval 'tmp="$'"${sym}"'"' + echo "$tmp" | \ + sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh + done + ;; + esac +fi + +: Finish up by extracting the .SH files +case "$alldone" in +exit) + $rm -rf UU + echo "Done." + exit 0 + ;; +cont) + ;; +'') + dflt='' + nostick=true + $cat <<EOM + +If you'd like to make any changes to the config.sh file before I begin +to configure things, do it as a shell escape now (e.g. !vi config.sh). + +EOM + rp="Press return or use a shell escape to edit config.sh:" + . UU/myread + nostick='' + case "$ans" in + '') ;; + *) : in case they cannot read + sh 1>&4 -c "$ans";; + esac + ;; +esac + +: if this fails, just run all the .SH files by hand +. ./config.sh + +echo " " +exec 1>&4 +. ./UU/extract + +if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then + dflt=y + case "$silent" in + true) ;; + *) + $cat <<EOM + +Now you need to generate make dependencies by running "make depend". +You might prefer to run it in background: "make depend > makedepend.out &" +It can take a while, so you might not want to run it right now. + +EOM + ;; + esac + rp="Run make depend now?" + . UU/myread + case "$ans" in + y*) + make depend && echo "Now you must run a make." + ;; + *) + echo "You must run 'make depend' then 'make'." + ;; + esac +elif test -f [Mm]akefile; then + echo " " + echo "Now you must run a make." +else + echo "Done." +fi + +$rm -f kit*isdone ark*isdone +$rm -rf UU + +: End of Configure + @@ -0,0 +1,112 @@ +INTRO + +This version of dist has been written by Raphael Manfredi based on +previous work from Larry Wall and Harlan Stenn. + +HISTORY + +I started working on this in September 1990 while I was still a student +at the Ecole des Mines de Saint-Etienne, France. From then on, I worked +during two years at ISE (building the Eiffel 3.0 compiler -- the run-time +part and code generation). Since I chose to use metaconfig for the run-time +library, which is written in plain C, I had the chance to continue improving +the whole dist package. + +By the end of 1991, I contacted Harlan Stenn <harlan@mumps.pfcs.com> who had +been working separately on his own dist version. I started the painful merge. +At the same time, I started releasing alpha version of dist 3.0. + +In 1992, I started a parallel project: mailagent. The dist 2.0 release upon +which this work is based included a simple perl script called mailagent, whose +sole job was to filter out @SH commands to automatically mail patches to some +people. I liked the idea of having a perl mail filter and so I extended +mailagent up to the point where it became really big and only marginally +dist-related. I released it on the net (comp.sources.misc) on July 1992, after +7 months of hard work. + +In March 1993, I left ISE and returned to France to join ACRI. The dist 3.0 +package was "almost" finished by that time, but the documentation was no +longer accurate and needed a lot of work. My new job does not give me enough +free time, so things have been longer than I expected. + +In July 1993, under the pressure of many of my alpha testers, I decided to +go into the final process, sacrifying nights and week ends to finish up what +turns out to have been a 3 years process... + +CREDITS + +My first thanks will go to Larry Wall <lwall@netlabs.com> who wrote perl +and dist 2.0 in the first place. I would never have dived into dist 2.0 +if it had not been written in perl. + +During my work, I had the chance to benefit some useful comments and +contributions from Craig Kolb <craig@weedeater.math.yale.edu> who +has been the very first user of metaconfig (with a rather pre-historic +version). He used it on its rayshade 4.0 release (a ray tracing program). + +Then of course, many thanks are due to my co-worker, Harlan Stenn +<harlan@mumps.pfcs.com>. Although I did the integration of his work all by +myself, I have found many good ideas in his early work. For instance, he wrote +the first implementation of the metalint program, something I could not live +without today! His remarks, comments and encouragements have always been +appreciated, even though we did not always agree on the same things at the +same time... + +Then I would like to thank the many contributors to the metaconfig units. +I hope I'm not forgetting anybody! Here they come, in alphabetical order: +(sorted on the first name) + + Andy Dougherty <doughera@lafcol.lafayette.edu> + Craig Kolb <craig@weedeater.math.yale.edu> + Graham Stoney <greyham@research.canon.oz.au> + Harlan Stenn <harlan@mumps.pfcs.com> + Jan Djarv <Jan.Djarv@sa.erisoft.se> + Larry Wall <lwall@netlabs.com> + Ralf E. Stranzenbach <ralf@reswi.en.open.de> + Scott Grosch <garath@engin.umich.edu> + Syd Weinstein <syd@dsi.com> + Thomas Neumann <tom@smart.bo.open.de> + Wayne Davison <davison@borland.com> + +If I forgot your name, please let me know, and accept my apologies (not +necessarily in that order ;-). + +Finally, thank you Shigeya Suzuki <shigeya@foretune.co.jp> for hosting the +dist-users mailing list. Send mail to majordomo@foretune.co.jp to subscribe. + + Raphael Manfredi <ram@acri.fr> + Lyon, France, August 1993 + +[This section added by subsequent patches] + +PATCHES + +I'm grateful to the following people for sending me patches and/or reporting +bugs and giving me some suggestions (sorted on the first name): + + Andy Dougherty <andy@crystal.phys.lafayette.edu> + Graham Stoney <greyham@research.canon.oz.au> + Ilya Zakharevich <ilya@math.ohio-state.edu> + Jarkko Hietaniemi <jhi@snakemail.hut.fi> + Joseph H Buehler <jhpb@sarto.gaithersburg.md.us> + Keith Walker <kew@timesink.spk.wa.us> + Scott Presnell <srp@cgl.ucsf.edu> + Wayne Davison <davison@borland.com> + +Due to a mistake of mine, changes from Wayne Davison were flagged 'WAD', +but his middle initial being an 'E', new ones are now flagged as 'WED'. +Sorry Wayne, I did not know. We don't use middle initials here in Europe. + +Special thanks to the perl5 Patch Pumpkin Holders (in chronological order): + + Andy Dougherty <andy@crystal.phys.lafayette.edu> + Chip Salzenberg <chip@atlantic.net> + +for their wonderful creativity. Perl5 is by far the largest metaconfig +customer with the widest audience, so Configure got run on a variety +of new platforms requiring specific fixes... which they provided, +thereby greatly enhancing the metaconfig "portability database". + + Raphael Manfredi <Raphael_Manfredi@grenoble.hp.com> + Grenoble, France, February 1997 + diff --git a/Jmakefile b/Jmakefile new file mode 100644 index 0000000..9ce633d --- /dev/null +++ b/Jmakefile @@ -0,0 +1,35 @@ +/* + * Main Jmakefile for dist 3.0 + */ + +;# $Id: Jmakefile,v 3.0.1.2 1995/07/25 13:29:41 ram Exp $ +;# +;# Copyright (c) 1991-1993, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 3.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.2 1995/07/25 13:29:41 ram +;# patch56: re-ordered macros, moving the install at the end +;# +;# Revision 3.0.1.1 1994/01/24 13:42:41 ram +;# patch16: added dependency generation stage +;# +;# Revision 3.0 1993/08/18 12:03:53 ram +;# Baseline for dist 3.0 netwide release. +;# + +>MANSRC /* This should really become automated */ + +all:: /* So that default target is not clobber! */ + +SetSubdirs(bin mcon jmake pat kit lib) +DependDirs(bin mcon pat jmake kit) +AddedByConfigure(install) + +InstallManPage(dist,$(MANSRC)) + diff --git a/Known_bugs b/Known_bugs new file mode 100644 index 0000000..b5c6180 --- /dev/null +++ b/Known_bugs @@ -0,0 +1,14 @@ +Here are some known bugs that I plan to fix soon. + ++ Patname ought to ask for a log message for the symbolic number. + ++ A unit name is always wanted by Configure. Hence in a unit d_waitpid, if +you write: + + @if WAITPID || d_waitpid + ..... + @end + +then the <....> part of the code will always be loaded even if no shell +script references d_waitpid or C code references WAITPID. + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..99c267d --- /dev/null +++ b/MANIFEST @@ -0,0 +1,590 @@ +Artistic The Artistic Licence +ChangeLog Where changes are recorded. +Configure Portability tool +Credits Traditional "thank you" list +Jmakefile Description of the main Makefile +Known_bugs A list of known bugs +MANIFEST This list of files +Makefile.SH A makefile to run subsidiary makefiles +README Basic instructions +Wishlist Features I would like to add +bin/ Some binary tools +bin/Jmakefile Generic makefile description for bin +bin/Makefile.SH Jmake-generated configured makefile +bin/manicheck.SH Check manifest accuracy +bin/manicheck.man Manual page for manicheck +bin/manilist.SH Produces reports based on manifest +bin/manilist.man Manual page for manilist +bin/packinit.SH Creates a .package file describing your package +bin/packinit.man Manual page for packinit +bin/perload Build dynamically loaded perl scripts +dist.man Introduction to dist +install.SH Installation script with a BSD-like syntax +jmake/ Where makefile generator is stored +jmake/Jmakefile High level makefile description for jmake +jmake/Makefile.SH Generated makefile for jmake +jmake/NOTES Quick description of the internal syntax +jmake/README Welcome to jmake +jmake/bindex.SH Script to build an index of rules +jmake/files/ Where rules for jmake are held +jmake/files/Jmake.rules Generic rules for jmake +jmake/files/Jmake.tmpl Template used by jmake to produce Makefile.SH +jmake/fixcpp.SH Wrapper around cpp to fix buggy backslash hanling +jmake/jmake.SH The makefile generator +jmake/jmake.man Manual page for jmake +jmake/jmkmf.SH Wrapper for jmake +jmake/jmkmf.man Manual page for jmkmf +kit/ Where distribution tools are stored +kit/Jmakefile Jmake's description of kit builder's makefile +kit/Makefile.SH Builds kit builder +kit/README Instructions on makedist +kit/kitpost.SH Post shell archive kits +kit/kitpost.man Manual page for kitpost +kit/kitsend.SH Mail shell archive kits +kit/kitsend.man Manual page for kitsend +kit/makeSH Does most of turning a script into an SH file +kit/makeSH.man Manual page for same +kit/makedist.SH Makes a set of kits in the current directory +kit/makedist.man Manual page for same +kit/manifake.SH Makes a MANIFEST.new file out of a MANIFEST +kit/manifake.man Manual page for same +lib/ Some library support files +lib/C/ Some useful C routines +lib/C/Jmakefile Generic makefile for C lib routines +lib/C/Makefile.SH Produces Makefile for C lib routines +lib/C/fake/ Fake implementations of real routines +lib/C/fake/Jmakefile Generic makefile for faked C routines +lib/C/fake/Makefile.SH Jmake-generated configured makefile +lib/C/fake/dup2.C A dup2() replacement +lib/C/fake/getopt.C A getopt() replacement +lib/C/fake/rename.C A rename() replacement for files +lib/C/fake/scandir.C A scandir() replacement +lib/C/fake/setsid.C A setsid() pale imitation +lib/Jmakefile Generic makefile description for lib +lib/Makefile.SH Jmake-generated configured makefile +lib/errnolist.a Awk script to build sys_errnolist[] +lib/errnolist.mk Rule files to add for errnolist.c +lib/errnolist.sh Script to build errnolist.c +lib/makedepend.sh Script to make dependecies, Larry Wall's way +lib/makedir.sh Emulates 'mkdir -p' +mcon/ Where metaconfig tools are stored +mcon/INTRO Quick introduction for newcommers +mcon/Jmakefile The file used by jmake to produce the Makefile +mcon/Makefile.SH Builds metaconfig +mcon/NOTES Documents the changes in metaconfig +mcon/README Instructions on using metaconfig +mcon/U/ Holds Units for metaconfig +mcon/U/AAAAA.U Does magic before Head.U +mcon/U/Begin.U "Beginning of configuration questions" +mcon/U/Chk_MANI.U MANIFEST checks +mcon/U/Chk_whoami.U A unit which checks for conflicts +mcon/U/Config_h.U Makes config.h.SH--bizarrity here +mcon/U/Config_sh.U Makes config.sh +mcon/U/Configdir.U Creates .config directory to store persistent info +mcon/U/Cppsym.U Makes program to test for cpp symbols +mcon/U/Csym.U Determines whether C symbol is defined +mcon/U/End.U "End of configuration questions" +mcon/U/Extract.U .SH file extraction +mcon/U/Extractall.U Support for the -S Configure option +mcon/U/Filexp.U Makes program to do tilde expansion +mcon/U/Findhdr.U Locate header files +mcon/U/Finish.U A unit which always goes last +mcon/U/Getfile.U Get file/directory name +mcon/U/Guess.U Hazard guesses as to overall philosophy +mcon/U/Head.U First unit, does "#!/bin/sh" et al +mcon/U/Inhdr.U Defines a look-for-header function +mcon/U/Init.U Magically gathers ?Init: lines from other units +mcon/U/Inlibc.U Defines an is-in-libc? function +mcon/U/Instruct.U Prints instructions +mcon/U/Loc.U Look for common programs +mcon/U/Loc_sed.U Full path of sed interpreter, even when portable +mcon/U/Magic_h.U Makes confmagic.h--bizarrity here +mcon/U/MailAuthor.U Offers user to register himself +mcon/U/MailList.U Offers user to subscribe to users list +mcon/U/Myinit.U For copying to private U directories +mcon/U/Myread.U Makes program to do read with shell escape +mcon/U/Nothing.U For empty dependencies +mcon/U/Null.U Zeroes out variables. Probably unnecessary +mcon/U/Obsol_h.U Warnings about obsolete C symbols +mcon/U/Obsol_sh.U Warnings about obsolete shell symbols +mcon/U/Oldconfig.U Looks for old config.sh file +mcon/U/Oldsym.U Try to propagate symbols +mcon/U/Options.U Configure option parsing +mcon/U/Prefixit.U Fixes path prefix in variables in case it changed +mcon/U/Prefixup.U Fixes vars with path prefix using ~name expansion +mcon/U/Rcs.U Some stupid redefinitions to keep RCS happy +mcon/U/Setvar.U Set a variable with some sanity checks +mcon/U/Signal.U Utilities for sig_name.U +mcon/U/Tr.U Builds a tr script to handle lower and upper classes +mcon/U/Typedef.U Defines a typedef lookup function +mcon/U/Unix.U Common UNIX settings and assumptions +mcon/U/Warn_v7EXT.U V7 has some ideosyncracies +mcon/U/Warn_v7ND.U V7 has no O_NDELAY read +mcon/U/Whoa.U Warning function +mcon/U/abortsig.U Which signal is sent by abort()? +mcon/U/active.U Find the news active file +mcon/U/afs.U Look whether AFS is running or not +mcon/U/alignbytes.U Check for alignment constraints +mcon/U/archlib.U Where architecture-dependent files are installed +mcon/U/archname.U Computes the architecture name (cpu-osname) +mcon/U/baserev.U Base revision of package +mcon/U/basicshell.U Which basic shell is available +mcon/U/bin.U Find where to install public executables +mcon/U/bitpbyte.U Computes the number of bits in a byte +mcon/U/byteorder.U Computes the byte order (big-endian?) +mcon/U/cc.U Which C compiler should be used? +mcon/U/ccflags.U Any additional C flags? +mcon/U/cf_email.U Computes user's e-mail address +mcon/U/cf_name.U Computes user's full name +mcon/U/cf_who.U Who configured the sytem, where and when +mcon/U/charorder.U Character order within a byte +mcon/U/charsize.U What is the size of "char"? +mcon/U/contains.U Makes status-returning grep +mcon/U/cpp_stuff.U Some cpp stuff +mcon/U/cppfilecom.U Running cpp while preserving C comments +mcon/U/cppstdin.U Check how to invoke the C pre-processor +mcon/U/d_NOFILE.U Maximum # of file descriptors +mcon/U/d_NeWS.U Old NeWS stuff +mcon/U/d_PORTAR.U Do we know about portable archives? +mcon/U/d_SHM_MAC.U SHMLBA macro stuff +mcon/U/d_access.U Do we have access()? +mcon/U/d_alarm.U Do we have alarm()? +mcon/U/d_attribut.U Checks wether your cc groks __attribute__ +mcon/U/d_bcmp.U Do we have bcmp() or memcmp()? +mcon/U/d_bcopy.U Do we have bcopy() or memcpy()? +mcon/U/d_brokstat.U Check whether stat() macros are broken +mcon/U/d_bsdjmp.U Do we have BSD _setjmp() and _longjmp()? +mcon/U/d_byacc.U Is byacc available? +mcon/U/d_bzero.U Do we have bzero() or memset()? +mcon/U/d_casti32.U Can the compiler cast large flots to 32-bit ints? +mcon/U/d_castneg.U Can the C compiler cast negative to unsigned? +mcon/U/d_cbrt.U Do we have cubic root cbrt()? +mcon/U/d_charsprf.U How is sprintf() defined? +mcon/U/d_chown.U Do we have chown()? +mcon/U/d_chroot.U Do we have chroot()? +mcon/U/d_chsize.U Size of a char +mcon/U/d_ckeypad.U Do we have the curses keypad()? +mcon/U/d_closedir.U Do we have closedir()? +mcon/U/d_const.U Can cc grok the const keyword? +mcon/U/d_crypt.U Does crypt() exist? +mcon/U/d_csh.U csh path +mcon/U/d_ctermid.U Do we have ctermid()? +mcon/U/d_cuserid.U Do we have cuserid()? +mcon/U/d_dbl_dig.U Is DBL_DIG defined in <limits.h> or <float.h>? +mcon/U/d_difftime.U Do we have difftime()? +mcon/U/d_dlerror.U Do we have dlerror()? +mcon/U/d_dlopen.U Do we have dlopen()? +mcon/U/d_dosuid.U Do they want setuid emulation? +mcon/U/d_drem.U Do we have drem()? +mcon/U/d_dup2.U Do we have dup2()? +mcon/U/d_eofpipe.U Will EOF be seen on closed pipes? +mcon/U/d_euc2jis.U Do we have euc2jis()? +mcon/U/d_fchmod.U Do we have fchmod()? +mcon/U/d_fchown.U Do we have fchown()? +mcon/U/d_fcntl.U Do we have fcntl()? +mcon/U/d_fd_set.U Do we have the fd set manipulation macros? +mcon/U/d_ffs.U Do we have ffs()? +mcon/U/d_fgetpos.U Do we have fgetpos()? +mcon/U/d_flexfnam.U Long filenames? +mcon/U/d_flock.U Do we have flock()? +mcon/U/d_fmod.U Do we have fmod()? +mcon/U/d_fork.U Do we have fork()? +mcon/U/d_fsetpos.U Do we have fsetpos()? +mcon/U/d_ftime.U Do we have ftime()? +mcon/U/d_ftrncate.U Do we have ftruncate()? +mcon/U/d_gconvert.U Do we have gconvert() or gcvt()? +mcon/U/d_getgrps.U Do we have getgroups()? +mcon/U/d_gethbynm.U Do we have gethostbyname()? +mcon/U/d_gethent.U Do we have gethostent()? +mcon/U/d_gethid.U Do we have gethostid()? +mcon/U/d_gethname.U What is the C function to get host name? +mcon/U/d_getlogin.U Do we have getlogin()? +mcon/U/d_getopt.U Do we have getopt()? +mcon/U/d_getpagsz.U Computes system's page size +mcon/U/d_getpgid.U Do we have getpgid()? +mcon/U/d_getpgrp.U Do we have getpgrp()? +mcon/U/d_getpgrp2.U Do we have getpgrp2()? (DG/UX) +mcon/U/d_getppid.U Do we have getppid()? +mcon/U/d_getprior.U Do we have getpriority()? +mcon/U/d_getpwent.U How is passwd info gotten? +mcon/U/d_getwd.U Do we have getwd()? +mcon/U/d_gnulibc.U Are we using the GNU C library? +mcon/U/d_group.U Do we have group()? +mcon/U/d_havetlib.U Where is termlib? +mcon/U/d_hidnet.U Do hiddennet stuff? +mcon/U/d_htonl.U Do we have htonl() and friends? +mcon/U/d_inetaton.U Do we have inet_aton()? +mcon/U/d_inetd.U Should internet communication be done via inetd? +mcon/U/d_internet.U Use internet addresses? +mcon/U/d_isascii.U Do we have isascii()? +mcon/U/d_itimer.U Do we have setitimer()? +mcon/U/d_keepsig.U Will signal handlers need to be rearmed? +mcon/U/d_killpg.U Do we have killpg()? +mcon/U/d_link.U Do we have link()? +mcon/U/d_linuxstd.U Do we have Linux standard I/O structures? +mcon/U/d_locconv.U Do we have localeconv()? +mcon/U/d_lockf.U Do we have lockf()? +mcon/U/d_lstat.U Do we have lstat()? +mcon/U/d_mblen.U Do we have mblen()? +mcon/U/d_mbstowcs.U Do we have mbstowcs()? +mcon/U/d_mbtowc.U Do we have mbtowc()? +mcon/U/d_memccpy.U Do we have memccpy()? +mcon/U/d_memchr.U Do we have memchr()? +mcon/U/d_memcmp.U Do we have memcmp()? +mcon/U/d_memcpy.U Do we have memcpy()? +mcon/U/d_memmove.U Do we have memmove()? +mcon/U/d_memset.U Do we have memset()? +mcon/U/d_mkdir.U Do we have mkdir()? +mcon/U/d_mkfifo.U Do we have mkfifo()? +mcon/U/d_mktime.U Do we have mktime()? +mcon/U/d_mmap.U Do we have mmap()? +mcon/U/d_msg.U Do we have full msg(2) support? +mcon/U/d_msgctl.U Do we have msgctl()? +mcon/U/d_msgget.U Do we have msgget()? +mcon/U/d_msgrcv.U Do we have msgrcv()? +mcon/U/d_msgsnd.U Do we have msgsnd()? +mcon/U/d_msync.U Do we have msync()? +mcon/U/d_munmap.U Do we have munmap()? +mcon/U/d_newsadm.U Who is news administrator? +mcon/U/d_nice.U Do we have nice()? +mcon/U/d_nolnbuf.U Is stdout line buffered? +mcon/U/d_normsig.U signal() vs sigset() +mcon/U/d_open3.U Do we have the 3 arguments form for open()? +mcon/U/d_passwd.U Do we have passwd()? +mcon/U/d_pathconf.U Do we have pathconf()? +mcon/U/d_pause.U Do we have pause()? +mcon/U/d_perror.U Do we have perror()? +mcon/U/d_pidcheck.U Is kill(pid, 0) allowed for PID checks? +mcon/U/d_pipe.U Do we have pipe()? +mcon/U/d_poll.U Do we have poll()? +mcon/U/d_popen.U Do we have popen()? +mcon/U/d_portable.U How portable do we want to be? +mcon/U/d_psignal.U Do we have psignal()? +mcon/U/d_raster.U Is this a Raster Tech machine? +mcon/U/d_rdchk.U Is rdchk() there to check for input? +mcon/U/d_readdir.U Do we have readdir()? +mcon/U/d_readlink.U Do we have readlink()? +mcon/U/d_regcmp.U Do we have regcmp()? +mcon/U/d_rename.U Do we have rename()? +mcon/U/d_rmdir.U Do we have rmdir()? +mcon/U/d_rusage.U Do we have getrusage()? +mcon/U/d_safebcpy.U Can bcopy() handle overlapping blocks? +mcon/U/d_safemcpy.U Can memcpy() handle overlapping blocks? +mcon/U/d_sanemcmp.U Can we compare 8th bit in chars with memcmp()? +mcon/U/d_sbrk.U Do we have sbrk()? +mcon/U/d_scandir.U Do we have scandir()? +mcon/U/d_scannl.U Does scanf() groks '\n' correctly? +mcon/U/d_scorfl.U Keep scoreboards by full name? +mcon/U/d_select.U Do we have select()? +mcon/U/d_sem.U Do we have full sem(2) support? +mcon/U/d_semctl.U Do we have d_semctl()? +mcon/U/d_semget.U Do we have semget()? +mcon/U/d_semop.U Do we have semop()? +mcon/U/d_setegid.U Do we have setegid()? +mcon/U/d_seteuid.U Do we have seteuid()? +mcon/U/d_setlnbuf.U Do we have setlinebuf()? +mcon/U/d_setlocale.U Do we have setlocale()? +mcon/U/d_setpgid.U Do we have setpgid()? +mcon/U/d_setpgrp.U Do we have setpgrp()? +mcon/U/d_setpgrp2.U Do we have setpgrp2()? (DG/UX) +mcon/U/d_setprior.U Do we have setpriority()? +mcon/U/d_setregid.U Do we have setregid()? +mcon/U/d_setreuid.U Do we have setreuid()? +mcon/U/d_setrgid.U Do we have setrgid()? +mcon/U/d_setruid.U Do we have setruid()? +mcon/U/d_setsid.U Do we have setsid()? +mcon/U/d_sgndchr.U Are chars signed? +mcon/U/d_shm.U Do we have full shm(2) support? +mcon/U/d_shmat.U Do we have shmat()? +mcon/U/d_shmctl.U Do we have shmctl()? +mcon/U/d_shmdt.U Do we have shmdt()? +mcon/U/d_shmget.U Do we have shmget()? +mcon/U/d_sigaction.U Do we have sigaction()? +mcon/U/d_sigblock.U Do we have sigblock()? +mcon/U/d_sighold.U Do we have sighold()? +mcon/U/d_siglist.U Do we have sys_siglist[]? +mcon/U/d_sigsetjmp.U Do we have sigsetjmp()? +mcon/U/d_sigsetmk.U Do we have sigsetmask()? +mcon/U/d_sigvec.U BSD reliable signals supported? +mcon/U/d_sjis2jis.U Do we have sjis2jis()? +mcon/U/d_socket.U BSD socket interface supported? +mcon/U/d_speedopt.U Optimize speed vs memory? +mcon/U/d_stat.U Do we have stat()? +mcon/U/d_statblks.U Does stat know about blksize and blocks? +mcon/U/d_stdstdio.U How standard is stdio? +mcon/U/d_strccmp.U Do we have strcasecmp()? +mcon/U/d_strchr.U Use strchr() or index()? +mcon/U/d_strcoll.U Do we have strcoll()? +mcon/U/d_strcspn.U Do we have strcspn()? +mcon/U/d_strctcpy.U Do we do struct copies? +mcon/U/d_strdup.U Do we have strdup()? +mcon/U/d_strerror.U Do we have strerror()? +mcon/U/d_strftime.U Do we have strftime()? +mcon/U/d_strstr.U Do we have strtr()? +mcon/U/d_strtod.U Do we have strtod()? +mcon/U/d_strtok.U Do we have strtok()? +mcon/U/d_strtol.U Do we have strtol()? +mcon/U/d_strtoul.U Do we have strtoul()? +mcon/U/d_strxfrm.U Do we have strxfrm()? +mcon/U/d_su_chown.U Do we need to be root to do a chown? +mcon/U/d_symlink.U Does symlink() exist? +mcon/U/d_syscall.U Do we have syscall()? +mcon/U/d_sysconf.U Do we have sysconf()? +mcon/U/d_syslog.U Do we have syslog()? +mcon/U/d_system.U Do we have system()? +mcon/U/d_table.U De we have table()? +mcon/U/d_tcgtpgrp.U Do we have tcgetpgrp()? +mcon/U/d_tcstpgrp.U Do we have tcsetpgrp()? +mcon/U/d_time.U Do we have time()? +mcon/U/d_times.U Do we have a times() function? +mcon/U/d_tminsys.U Is struct tm in <sys/time.h>? +mcon/U/d_truncate.U Do we have truncate()? +mcon/U/d_tzmin.U Do we use tz_minuteswest? +mcon/U/d_tzname.U Do we have tzname[]? +mcon/U/d_ulimit.U Do we have ulimit()? +mcon/U/d_umask.U Do we have umask()? +mcon/U/d_usendir.U Use our own ndir routines? +mcon/U/d_usleep.U Do we have usleep()? +mcon/U/d_uwait.U Is there a 'union wait' declaration around here? +mcon/U/d_vfork.U vfork() vs fork() +mcon/U/d_voidsig.U How is signal() declared? +mcon/U/d_volatile.U Does our C compiler support "volatile"? +mcon/U/d_vprintf.U Do we have vprintf()? +mcon/U/d_wait3.U Do we have wait3()? +mcon/U/d_wait4.U Do we have wait4()? +mcon/U/d_waitpid.U Do we have waitpid() system call? +mcon/U/d_wcstombs.U Do we have wcstombs()? +mcon/U/d_wctomb.U Do we have wctomb()? +mcon/U/d_wifstat.U Can we safely use WIFEXITED() and friends? +mcon/U/d_xdrs.U Do we have XDR serialization routines? +mcon/U/defeditor.U Find default editor +mcon/U/doublesize.U What is the size of "double"? +mcon/U/errnolist.U See if we need our own .c to get sys_errnolist[] +mcon/U/etc.U Where administrative executable should go +mcon/U/filexp.U Finds location of filexp made by Filexp.U +mcon/U/floatsize.U What is the size of "float"? +mcon/U/fpostype.U What is the type for file positions? +mcon/U/fpu.U What kind of Sun fpu is in use? +mcon/U/gidtype.U What is the type of gids? +mcon/U/groupstype.U What is the type for groups in getgroups()? +mcon/U/h_fcntl.U Do we need to include fcntl.h? +mcon/U/h_sysfile.U Do we need to include sys/file.h? +mcon/U/i_arpainet.U Shall we include <arpa/inet.h>? +mcon/U/i_db.U Shall we include <db.h>? +mcon/U/i_dbm.U Shall we include <dbm.h>? +mcon/U/i_dirent.U Shall we include <dirent.h> +mcon/U/i_dld.U Shall we include <dld.h>? +mcon/U/i_dlfcn.U Shall we include <dlfcn.h>? +mcon/U/i_fcntl.U Shall we include <fcntl.h>? +mcon/U/i_float.U Shall we include <float.h>? +mcon/U/i_gdbm.U Shall we include <gdbm.h>? +mcon/U/i_grp.U Shall we include <grp.h>? +mcon/U/i_limits.U Shall we include <limits.h>? +mcon/U/i_locale.U Shall we include <locale.h>? +mcon/U/i_malloc.U Shall we include <malloc.h>? +mcon/U/i_math.U Shall we include <math.h>? +mcon/U/i_memory.U Shall we include <memory.h>? +mcon/U/i_ndbm.U Shall we include <ndbm.h>? +mcon/U/i_neterrno.U Shall we include <net/errno.h>? +mcon/U/i_niin.U Shall we include <netinet/in.h>? +mcon/U/i_pwd.U Shall we include <pwd.h>? +mcon/U/i_regex.U Shall we include <regex.h>? +mcon/U/i_sfio.U Shall we include <sfio.h>? +mcon/U/i_stddef.U Shall we include <stddef.h>? +mcon/U/i_stdlib.U Shall we include <stdlib.h>? +mcon/U/i_string.U <string.h> or <strings.h>? +mcon/U/i_sysdir.U Shall we include <sys/dir.h>? +mcon/U/i_sysfile.U Do we need <sys/file.h>? +mcon/U/i_sysioctl.U Include <sys/ioctl.h> or <sgtty.h>? +mcon/U/i_sysmman.U Do we have to include <sys/mman.h>? +mcon/U/i_sysndir.U Shall we include <sys/ndir.h>? +mcon/U/i_sysparam.U Shall we include <sys/param.h>? +mcon/U/i_sysresrc.U Shall we include <sys/resource.h>? +mcon/U/i_sysselct.U Shall we include <sys/select.h>? +mcon/U/i_syssock.U Shall we include <sys/socket.h>? +mcon/U/i_sysstat.U Shall we include <sys/stat.h> +mcon/U/i_systable.U De we have to include <sys/table.h>? +mcon/U/i_systimeb.U Is struct timeb defined in <sys/timeb.h>? +mcon/U/i_systimes.U Shall we include <sys/times.h>? +mcon/U/i_systwgcf.U Shall we include <sys/twg_config.h>? +mcon/U/i_systypes.U Do we have to include <sys/types.h>? +mcon/U/i_sysun.U Shall we include <sys/un.h>? +mcon/U/i_syswait.U Is there a <sys/wait.h>? +mcon/U/i_termio.U Include <termio.h> or <sgtty.h>? +mcon/U/i_time.U Which time.h should we include? +mcon/U/i_unistd.U Include <unistd.h>? +mcon/U/i_utime.U Include <utime.h>? +mcon/U/i_values.U Shall we include <values.h> +mcon/U/i_varhdr.U Choose between <varargs.h> and <stdarg.h> +mcon/U/i_vfork.U Include <vfork.h>? +mcon/U/i_whoami.U Include <whoami.h>? +mcon/U/inc.U Where to put public include files? +mcon/U/install.U Look for a BSD-compatible install +mcon/U/intsize.U What is the size of "int"? +mcon/U/ipc.U Choose IPC mechanism +mcon/U/kernel.U Compute the kernel pathname +mcon/U/lex.U Use lex or flex? +mcon/U/lib.U Where to put public library files ? +mcon/U/libc.U Where is libc? +mcon/U/libdbm.U Look for a suitable dbm library +mcon/U/libflex.U Locate flex library +mcon/U/libnlist.U Locate an nlist library +mcon/U/libnm.U New math library? +mcon/U/libpth.U Set path to locate libraries +mcon/U/libs.U Optional libraries? +mcon/U/libyacc.U Locate yacc library +mcon/U/lintlib.U Where lint library should be placed +mcon/U/lns.U Are symbolic links supported by ln? +mcon/U/locdist.U Find distribution names for news +mcon/U/longsize.U What is the size of "long"? +mcon/U/lseektype.U What is the type of lseek()? +mcon/U/maildir.U Where is mail spooled +mcon/U/mailer.U What delivers mail? +mcon/U/mailfile.U What filename in maildir? +mcon/U/make.U Does make set the $(MAKE) macro? +mcon/U/mallocsrc.U Use malloc included in kit? +mcon/U/man1dir.U Where to put traditional section 1 manpage sources +mcon/U/man3dir.U Where to put traditional section 3 manpage sources +mcon/U/manfmt.U Formatted man directories +mcon/U/mansrc.U Where to put manual pages source +mcon/U/mboxchar.U How to determine if file is mailbox +mcon/U/mkdep.U How to generate makefile dependencies? +mcon/U/models.U Large vs small, split I&D, etc +mcon/U/modetype.U What is the type for file modes? +mcon/U/myhostname.U How to determine hostname from shell +mcon/U/n.U How to suppress newline with echo +mcon/U/nametype.U How to get user's fullname +mcon/U/nblock_io.U Support for non-blocking I/O +mcon/U/newslevel.U What version of news are we running? +mcon/U/newslib.U Where is the news library? +mcon/U/newsspool.U Where is news spooled? +mcon/U/nis.U Do we have to deal with NIS (former YP)? +mcon/U/nlist_pfx.U nlist() related stuff +mcon/U/orderlib.U Shall we order components libraries? +mcon/U/orgname.U What is the organizaton name? +mcon/U/packadmin.U E-mail address of the package administrator +mcon/U/package.U Gets package name from .package magically +mcon/U/pager.U What's the pager, more or less? +mcon/U/patchlevel.U Grab current patchlevel out of patchlevel.h +mcon/U/perlpath.U The full path of perl +mcon/U/pidtype.U What is the type of a PID? +mcon/U/prefix.U Installation prefix setting (none, /usr/local) +mcon/U/prefshell.U Preferred user shell +mcon/U/privlib.U Where is the private library? +mcon/U/prototype.U Do we support prototypes? +mcon/U/ptrsize.U What is the size of a pointer? +mcon/U/randbits.U How many bits in rand()? +mcon/U/randfunc.U Which random number function shall we use? +mcon/U/rcs_branch.U Does RCS know about the -b switch? +mcon/U/registers.U How many register declarations to use +mcon/U/rootid.U Root user id +mcon/U/sbrksmart.U Can sbrk() be used to release core? +mcon/U/sbrktype.U What is the return type of sbrk()? +mcon/U/scriptdir.U Where to put public scripts +mcon/U/selecttype.U What type for select() file bitfields? +mcon/U/sh.U Where the shell is located +mcon/U/shm_for.U More shared memory stuff +mcon/U/sig_name.U Signal names +mcon/U/sitearch.U Where user-installed arch-dependant files should go +mcon/U/sitelib.U Where user-installed regular library files should go +mcon/U/sizetype.U What is the type for byte size? +mcon/U/so.U Shared object extension +mcon/U/sockopt.U Check for socket options +mcon/U/spitshell.U Shell comment stripper, maybe +mcon/U/src.U Build and source tree separation support +mcon/U/ssizetype.U What is the signed type for byte size? +mcon/U/startperl.U Do we start perl with #! or what? +mcon/U/startsh.U How to guarantee sh startup +mcon/U/stdchar.U Are chars unsigned in stdio? +mcon/U/sunscanf.U Is this Sun's version of scanf()? +mcon/U/sysman.U Where is the man(1) located? +mcon/U/uidtype.U What is the type of uids? +mcon/U/usenm.U Shall we use the costly nm extraction? +mcon/U/usrinc.U Where are include files located? +mcon/U/vaproto.U How do we prototype varargs, with ...? +mcon/U/voidflags.U How supported is void? +mcon/U/warnflags.U Any additional cc warning flags? +mcon/U/yacc.U Which compiler-compiler to use? +mcon/configure GNU configure-like wrapper to metaconfig's Configure +mcon/files/ Templates for new units +mcon/files/Internal.U Template for special units with internal symbols +mcon/files/README Why those templates are here... +mcon/files/d_function.U Template for C defines +mcon/files/dir.U Template to get a directory +mcon/files/file.U Template get a file +mcon/files/i_include.U Template for include files +mcon/files/keyword.U Template for keyword checking +mcon/files/locate.U Template to locate a file +mcon/files/question.U Template for setvar questions +mcon/files/rcshead.U Template for unit head +mcon/files/shell.U Template for non-setvar questions +mcon/files/type.U Template for type lookup +mcon/makegloss.SH Extracts Glossary from Unit files +mcon/man/ Manual pages for metaconfig et al. +mcon/man/Jmakefile Generic makefile description for manual pages +mcon/man/Makefile.SH Jmake-generated makefile for manual pages +mcon/man/mconfig.SH Manual page for metaconfig +mcon/man/mlint.SH Manual page for metalint +mcon/man/mxref.SH Manual page for metaxref +mcon/mconfig.SH Writes Configure scripts for you +mcon/mlint.SH Lints metaconfig units +mcon/mxref.SH Builds symbol cross-reference files +mcon/pl/ Perl library for metaconfig et al. +mcon/pl/common.pl Common control lines extraction +mcon/pl/configure.pl Generates Configure +mcon/pl/cosmetic.pl Some cosmetic fixes +mcon/pl/depend.pl Metaconfig-only dependencies +mcon/pl/eval.pl Built-in interpreter +mcon/pl/extract.pl Dependency extractor engine +mcon/pl/files.pl Extracts files from MANIFEST.new +mcon/pl/gensym.pl Dynamic symbol generator +mcon/pl/init.pl Initialization of dependency control array +mcon/pl/lint.pl Lint-only dependencies +mcon/pl/locate.pl Locate units +mcon/pl/makefile.pl Builds temporary Makefiles +mcon/pl/obsolete.pl Deals with obsolete symbols +mcon/pl/order.pl Re-order units within Configure +mcon/pl/tsort.pl Topological sort +mcon/pl/wanted.pl Set up Wanted file +mcon/pl/xref.pl Metaxref-only dependencies +mcon/pl/xwant.pl Metaxref symbol extraction +pat/ Where patching tools are stored +pat/Jmakefile High level makefile description for pat +pat/Makefile.SH Makefile for pat tools +pat/README Instructions for patch/developping tools +pat/pat.SH Check in, do diffs, make patch, send it +pat/pat.man Manual page for patch tools +pat/patbase.SH To set the base for future differences +pat/patchlevel.h Prototypical patchlevel.h +pat/patcil.SH Check in the latest changes +pat/patclean.SH Check in latest changes and remove files +pat/patcol.SH Check out working file +pat/patdiff.SH Find the differences since last patch +pat/patftp.SH Put patches in ftp pub directory +pat/patindex.SH Create an index of patches sent out +pat/patlog.SH Handles the ChangeLog file +pat/patmake.SH Put together a patch file +pat/patname.SH Assign symbolic name to a revision +pat/patnotify.SH Notifies that new patches have been released +pat/patpost.SH Send patches via news +pat/patsend.SH Sends patches via mail +pat/patsnap.SH Builds RCS snapshot file +patchlevel.h The current patchlevel for dist +pl/ Directory for public perl libraries +pl/comment.pl Perl library to find comment in front of $Log +pl/copyright.pl Perl library to expand copyright +pl/editor.pl Perl library to compute suitable editor name +pl/fullname.pl Perl library to get full name +pl/listedit.pl Perl library to edit list of items +pl/logname.pl Perl library to get login name +pl/makedir.pl Perl library to emulate 'mkdir -p' +pl/manifake.pl Perl library to build a MANIFEST.new if none found +pl/newer.pl Perl library to Find files newer than patchlevel.h +pl/package.pl Perl library to read .package +pl/patseq.pl Perl library to compute issued patch sequence +pl/profile.pl Perl library to get ~/.dist_profile +pl/rangeargs.pl Perl library to expand number lists +pl/rcsargs.pl Perl library to expand rcs filename lists +pl/snapshot.pl Perl library to parse RCS snapshot file +pl/tilde.pl Perl library to perform ~name expansion +pl/users.pl Perl library to parse users file diff --git a/Makefile.SH b/Makefile.SH new file mode 100644 index 0000000..86f370e --- /dev/null +++ b/Makefile.SH @@ -0,0 +1,218 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL55] +: $X-Id: Jmake.tmpl,v 3.0.1.2 1995/01/11 14:50:21 ram Exp ram $ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=. +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` + +$spitshell >Makefile <<!GROK!THIS! +######################################################################## +# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = . +CURRENT = $CURRENT +DIR = $DIR +INSTALL = $INSTALL + +######################################################################## +# Parameters set by Configure -- edit config.sh if changes are needed + +CTAGS = ctags +L = $manext +MANSRC = $installmansrc +MAKE = make +MV = $mv +RM = $rm -f + +######################################################################## +# Automatically generated parameters -- do not edit + +SUBDIRS = bin mcon jmake pat kit lib + +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.3 1995/03/21 08:35:28 ram Exp ram $ +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.2 1995/07/25 13:29:41 ram Exp ram $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.2 1995/07/25 13:29:41 ram +# patch56: re-ordered macros, moving the install at the end +# +# Revision 3.0.1.1 1994/01/24 13:42:41 ram +# patch16: added dependency generation stage +# +# Revision 3.0 1993/08/18 12:03:53 ram +# Baseline for dist 3.0 netwide release. +# + +all:: + +depend:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in bin mcon pat jmake kit ;\ + do \ + (cd $$i ; echo "Depending" "in $(DIR)$$i..."; \ + $(MAKE) $(MFLAGS) depend); \ + done + +local_clobber:: + $(RM) install + +install.man:: dist.man + $(INSTALL) -c -m 444 dist.man $(MANSRC)/dist.$(L) + +deinstall.man:: + $(RM) $(MANSRC)/dist.$(L) + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: sub_clean local_clean +realclean: sub_realclean local_realclean +clobber: sub_clobber local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + $(RM) -r UU + +local_clobber:: local_realclean + $(RM) config.sh config.h + $(RM) -r .config + $(RM) Makefile + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; exit 0; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Rules for building in sub-directories -- do not edit + +subdirs: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \ + $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)); \ + done + +install:: + @$(MAKE) subdirs TARGET=install VERB="Installing" FLAGS= + +deinstall:: + @$(MAKE) subdirs TARGET=deinstall VERB="Deinstalling" FLAGS= + +install.man:: + @$(MAKE) subdirs TARGET=install.man VERB="Installing man pages" FLAGS= + +deinstall.man:: + @$(MAKE) subdirs TARGET=deinstall.man VERB="Deinstalling man pages" FLAGS= + +sub_clean:: + @$(MAKE) subdirs TARGET=clean VERB="Cleaning" FLAGS= + @echo "Back to $(CURRENT) for "clean... + +sub_realclean:: + @$(MAKE) subdirs TARGET=realclean VERB="Real cleaning" FLAGS= + @echo "Back to $(CURRENT) for "realclean... + +sub_clobber:: + @$(MAKE) subdirs TARGET=clobber VERB="Clobbering" FLAGS= + @echo "Back to $(CURRENT) for "clobber... + +tag:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "Tagging" "in $(DIR)$$i..."; \ + $(MAKE) $(MFLAGS) tag); \ + done + +Makefiles:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS);\ + do \ + echo "Making "Makefiles" in $(DIR)$$i..."; \ + (cd $$i || exit 1; \ + if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \ + $(MAKE) $(MFLAGS) Makefiles) \ + done + +Makefiles.SH:: Makefile.SH + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS);\ + do \ + case "$(DIR)$$i/" in \ + */*/*/*/) newtop=../../../..;; \ + */*/*/) newtop=../../..;; \ + */*/) newtop=../..;; \ + */) newtop=..;; \ + esac; \ + case "$(TOP)" in \ + /*) newtop="$(TOP)" ;; \ + esac; \ + echo "Making Makefiles.SH in $(DIR)$$i..."; \ + (cd $$i || exit 1; $(MAKE) $(MFLAGS) -f ../Makefile \ + Makefile TOP=$$newtop CURRENT=$(DIR)$$i;\ + $(MAKE) $(MFLAGS) Makefiles.SH) \ + done + +all:: + @$(MAKE) subdirs TARGET=all VERB="Making all" FLAGS= + +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + @@ -0,0 +1,136 @@ + dist 3.0 + + Copyright (c) 1988, Larry Wall + Copyright (c) 1990-1992, Harlan Stenn + Copyright (c) 1991-1997, Raphael Manfredi + +------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify + it under the terms of the Artistic License, a copy of which can be + found with this package. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + Artistic License for more details. +------------------------------------------------------------------------ + +This version of dist requires you to have at least perl 4.0 PL36. +It has also been ported to work with perl 5.0 PL0, provided you have +at least integrated patches 0a-0h, issued by Andy Dougherty and made +available at the following ftp sites: + + ftp.demon.co.uk:/pub/perl/db/perl5.000-p0a-p0h.tar.gz + ftp.funet.fi:/pub/languages/perl/ports/perl5/perl5.000-p0a-p0h.tar.gz + +Please read all the directions below before you proceed any further, and +then follow them carefully. + +After you have unpacked your kit, you should have all the files listed +in MANIFEST. + +======================================================================== + It's not the way I wrote it, but the + way you play it makes it sound a lot better. + -- Camille Saint-Saens (French composer) + +The dist package consists of four parts: + + 1) The Configure generator (metaconfig) and its supporting files. + 2) The distribution kit maker (makedist) and its supporting files. + 3) The patch distribution system (pat*) and its supporting files. + 4) The Makefile generator (jmake) and its supporting files. + +Each of these can be used separately from the others. Before you can +use any of those, however, the directory containing your package (not this +package) must be initialized by putting a .package file into it. This +can be done by running packinit in that directory. + +There is a mailing list hosted in Japan and set up by Shigeya Suzuki +<shigeya@foretune.co.jp>, for discussion about the dist package as a +whole. It's a good place to ask questions (or answer them) and to +send your patches. I will post official patches to the net, as well +as to the dist-users list. + +To send a mail to the list, address it to <dist-users@foretune.co.jp>. +To subscribe, send a mail to <majordomo@foretune.co.jp>. If you don't +know how to use majordomo, the syntax of the subscribe command is: + + subscribe dist-users [address] + +where the address part is optional. You may unsubscribe automatically +at any time by sending: + + unsubscribe dist-users + +If you have a problem with this version of dist, it is recommended that +you subscribe to the list, then send a description of your problem to it. +If you send mail to me personally, I may not be able to answer in a +timely fashion. + +This mailing list has low traffic (a few articles per week, typically), +and it is expected to remain so, with a high signal/noise ratio. + +Notes: + + If you are running on a system with <= 14 char filenames, don't + distribute any files with filenames longer than 12 chars (with the + exception of patchlevel.h), so that there will be room for a + 2-digit extension indicating patch number in your bugs direcory. + This includes .SH files, so any shell script built by a .SH file + should be 9 characters or less. On systems with flexfilenames you + don't have to worry about it. + + This package has been designed on top of dist 2.0, which has been + written by Larry Wall <lwall@netlabs.com>. +======================================================================== + +INSTALLATION + +1) Run Configure. This will figure out various things about your +system. After it has completed, it will produce config.h and config.sh. + +You might possibly have to trim # comments from the front of Configure +if your shell doesn't handle them, but all other comments will be taken +care of. + +2) Run make. + +3) If make succeeded, you may wish to do "make install install.man". Be +sure your rights are correct (if you install manual pages, you may need +super-user privileges). By not running "make install.man", you avoid the +installation of the manual pages. + +4) Read the manual entry before running. + +5) IMPORTANT! Communicate any problem and suggested patches to me, +ram@hptnos02.grenoble.hp.com (Raphael Manfredi), so we can keep this +distribution in sync. If you have a problem, there will be someone else +who had it or will have it too... + +If possible, send me patches such that the patch program will apply +them. Context diffs are the best, then normal diffs. Do not send ed +scripts, I have probably changed my copy since the version you got. + +6) After everything is installed, you can do make clobber. This will +clean up everything and let you re-distribute this kit, without +carrying useless files. You should keep this distribution intact, so +that future patches will be applyable. + +7) I have an automatic patch sender. Send me the following mail: + + Subject: Command + @SH mailhelp PATH + +and you'll get instructions (PATH stands for YOUR e-mail address, either +in INTERNET or in bang notation). I would recommend you to get all the +issued patches before you start making some modifications on this +package. + +8) If you wish to deinstall the package, you may run "make deinstall". +A separate "make deinstall.man" will remove the manual pages. Be sure +the makefiles are correctly set before running any deinstall target. +On USG systems, some executable have a chance to remain despite the +deinstall (text file busy...). + + Raphael Manfredi <Raphael_Manfredi@grenoble.hp.com> diff --git a/Wishlist b/Wishlist new file mode 100644 index 0000000..81bbb8c --- /dev/null +++ b/Wishlist @@ -0,0 +1,60 @@ +*** List of wishes for dist version 3.0 *** + +======================================================================= +If you wish to implement one of the following, you're welcome :-). In +that case, please let me know about it. I will probably integrate your +changes in my version (after some sanity checks, because I can't +maintain something I don't understand). + +This list has no priority order whatsoever, so you may pick up one of +the following suggestion and start working on it. In that case, you +may want to get all the official patches for dist 3.0 first and make +sure nobody is already working on that topic. +======================================================================= + +*** jmake + +Make the names used more uniform. For instance, 'Simple' appears in +many rules, but with different meanings, thus making the Jmakefile +harder to understand at a first glance. + +Allow per-system compilation rules, so that objects and source file +do not inter-mix but are kept in separate directories. + +*** metaconfig + +Write some "generic" templates for writing new units, so that the user +only needs to fill up some fields. For instance, there could be a +template for d_* and i_* units. [That's done, they are under mcon/files. +Now I only need to write the generator on top of them] + +Make Configure know about cross-compiling. + +Make Configure know about VPATH for separate object directory, with +proper support from jmake. + +Implement the ?I: and ?L: lines. The ?I: fills in inclwanted for you, +while ?L: fills in the libswanted variable. For instance, when using +a socket() call, one may need to look at -lbsd. If d_socket.U lists +'bsd' within its ?L: line, then the libswanted variable will be +correctly set. [Note: there are some hooks for this already] + +Build a library of PD routines that may be otherwise missing on +some older systems, eg: getopt(). Those routines will be automagically +added to the package by relying on ?P: lines, something like: + + ?P:getopt (HAS_GETOPT): getopt.c + +which would include getopt.c in the package (under some PD dir) +when getopt is used and HAS_GETOPT is *not* used within the sources, +in order to achieve transparent implementation. + +*** metalint + +Process '@' pre-processor lines, and signal mismatches, unrecognized +commands, etc... Also warn when testing wantedness of unknown symbols +or obsolete ones, etc... + +*** pat tools + +Clean that stuff. diff --git a/bin/Jmakefile b/bin/Jmakefile new file mode 100644 index 0000000..d9d80d5 --- /dev/null +++ b/bin/Jmakefile @@ -0,0 +1,45 @@ +/* + * Jmakefile for bin subdirectory. + */ + +;# $Id: Jmakefile,v 3.0.1.1 1994/01/24 13:42:53 ram Exp $ +;# +;# Copyright (c) 1991-1993, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 3.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.1 1994/01/24 13:42:53 ram +;# patch16: added dependency generation stage +;# +;# Revision 3.0 1993/08/18 12:04:00 ram +;# Baseline for dist 3.0 netwide release. +;# + +BINPL = packinit manilist +BIN = manicheck $(BINPL) + +ShellScriptTarget($(BIN)) + +BINSH = \ +|expand f!$(BINPL)! + !f.SH \ +-expand \\ + +>SED +>RM +>MKDEP + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(BINSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>[ ]*\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + diff --git a/bin/Makefile.SH b/bin/Makefile.SH new file mode 100644 index 0000000..49f9770 --- /dev/null +++ b/bin/Makefile.SH @@ -0,0 +1,216 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44] +: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=bin +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` + +$spitshell >Makefile <<!GROK!THIS! +######################################################################## +# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = .. +CURRENT = $CURRENT +DIR = $DIR +INSTALL = $INSTALL + +######################################################################## +# Parameters set by Configure -- edit config.sh if changes are needed + +CTAGS = ctags +L = $manext +MANSRC = $installmansrc +MAKE = make +MKDEP = $mkdep \$(DPFLAGS) -- +MV = $mv +RM = $rm -f +SCRIPTDIR = $installscript +SED = $sed + +######################################################################## +# Automatically generated parameters -- do not edit + +SCRIPTS = \$(BIN) + +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $ + +######################################################################## +# Force 'make depend' to be performed first -- do not edit + +.FORCE_DEPEND:: + +all:: .FORCE_DEPEND + +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.1 1994/01/24 13:42:53 ram Exp ram $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.1 1994/01/24 13:42:53 ram +# patch16: added dependency generation stage +# +# Revision 3.0 1993/08/18 12:04:00 ram +# Baseline for dist 3.0 netwide release. +# + +BINPL = packinit manilist +BIN = manicheck $(BINPL) + +all:: $(BIN) + +local_realclean:: + $(RM) $(BIN) + +manicheck: manicheck.SH + /bin/sh manicheck.SH + +packinit: packinit.SH + /bin/sh packinit.SH + +manilist: manilist.SH + /bin/sh manilist.SH + + +install:: $(SCRIPTS) $(LSCRIPTS) + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(INSTALL) -c -m 555 $$file $(SCRIPTDIR)); \ + done + +deinstall:: + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(RM) $(SCRIPTDIR)/$$file); \ + done + +install.man:: + @if test "$(MANSRC)"; then \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; \ + $(INSTALL) -c -m 444 $$file.man $(MANSRC)/$$file.$(L)); \ + done; \ + else exit 0; fi + +deinstall.man:: + @if test "$(MANSRC)"; then \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; $(RM) $(MANSRC)/$$file.$(L)); \ + done; \ + else exit 0; fi + +BINSH = \ + packinit.SH \ + manilist.SH + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(BINSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>[ ]*\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: local_clean +realclean: local_realclean +clobber: local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + +local_clobber:: local_realclean + $(RM) Makefile config.sh + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; exit 0; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Empty rules for directories with no sub-directories -- do not edit + +install:: + @echo "install in $(CURRENT) done." + +deinstall:: + @echo "deinstall in $(CURRENT) done." + +install.man:: + @echo "install.man in $(CURRENT) done." + +deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." + +Makefiles:: + +Makefiles.SH:: + +######################################################################## +# Dependencies generated by make depend +# DO NOT DELETE THIS LINE -- make depend relies on it + +# Put nothing here or make depend will gobble it up +.FORCE_DEPEND:: + @echo "You must run 'make depend' in $(TOP) first."; exit 1 +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/bin/manicheck.SH b/bin/manicheck.SH new file mode 100755 index 0000000..f2aa5a6 --- /dev/null +++ b/bin/manicheck.SH @@ -0,0 +1,82 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting bin/manicheck (with variable substitutions)" +$spitshell >manicheck <<!GROK!THIS! +$startsh +!GROK!THIS! +$spitshell >>manicheck <<'!NO!SUBS!' +# $Id: manicheck.SH,v 3.0.1.1 1993/08/19 06:41:51 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# Original Author: Harlan Stenn <harlan@mumps.pfcs.com> +# +# $Log: manicheck.SH,v $ +# Revision 3.0.1.1 1993/08/19 06:41:51 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:02 ram +# Baseline for dist 3.0 netwide release. +# + +find . ! -type d -print | sed -e ' +s|^./|| +/RCS\//d +/UU\//d +/core$/d +/\.bak$/d +/\.orig$/d +' | sort > check.present + +manifest='' +if test -r MANIFEST.new; then + manifest='MANIFEST.new' +else + if test -r MANIFEST; then + manifest='MANIFEST' + else + echo "No MANIFEST.new or MANIFEST file--don't know what to look for." + fi +fi + +awk '{print $1}' $manifest | sort > check.expected + +comm -23 check.expected check.present > check.want +comm -13 check.expected check.present > check.extra + +rm -f check.expected check.present + +if test -s check.want; then + echo "Some files listed in $manifest are missing; see check.want." +else + rm check.want +fi + +if test -s check.extra; then + echo "Some files not listed in $manifest are present; see check.extra." +else + rm check.extra +fi +!NO!SUBS! +chmod 755 manicheck +$eunicefix manicheck diff --git a/bin/manicheck.man b/bin/manicheck.man new file mode 100644 index 0000000..fdee36c --- /dev/null +++ b/bin/manicheck.man @@ -0,0 +1,51 @@ +''' $Id: manicheck.man,v 3.0 1993/08/18 12:04:02 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: manicheck.man,v $ +''' Revision 3.0 1993/08/18 12:04:02 ram +''' Baseline for dist 3.0 netwide release. +''' +''' +.TH MANICHECK 1 ram +.SH NAME +manicheck \- check manifest accuracy +.SH SYNOPSIS +.B manicheck +.SH DESCRIPTION +.I Manicheck +compares the files listed in your MANIFEST.new (or MANIFEST if that file +is not present) with the files within your distribution. It will report +files listed in the manifest but not present or files missing from your +manifest file. +.SH FILES +.I Manicheck +produces the following temporary files: +.TP 20 +.PD 0 +check.expected +lists filenames from manifest +.TP +check.present +lists all potential source files +.PD +.PP +If MANIFEST is not 100% accurate, the following files may be created: +.TP 20 +.PD 0 +check.extra +files not listed in manifest +.TP +check.want +files missing from manifest +.PD +.SH AUTHOR +Harlan Stenn <harlan@mumps.pfcs.com> +.SH "SEE ALSO" +manifake(1), makedist(1), manilist(1). diff --git a/bin/manilist.SH b/bin/manilist.SH new file mode 100755 index 0000000..991365a --- /dev/null +++ b/bin/manilist.SH @@ -0,0 +1,484 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting bin/manilist (with variable substitutions)" +$spitshell >manilist <<!GROK!THIS! +$startperl + eval 'exec perl -S \$0 "\$@"' + if \$running_under_some_shell; + +# $Id: manilist.SH,v 3.0.1.3 1994/10/29 15:42:42 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: manilist.SH,v $ +# Revision 3.0.1.3 1994/10/29 15:42:42 ram +# patch36: fixed open precedence problem for perl5 +# +# Revision 3.0.1.2 1994/01/24 13:52:33 ram +# patch16: added ~/.dist_profile awareness +# +# Revision 3.0.1.1 1993/08/19 06:41:52 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:03 ram +# Baseline for dist 3.0 netwide release. +# + +\$version = '$VERSION'; +\$pl = '$PATCHLEVEL'; +!GROK!THIS! +$spitshell >>manilist <<'!NO!SUBS!' + +# This script scans the MANIFEST.new file and builds some reports. + +# The output can be somewhat changed to produce other kind of reports. +# The format is specified with a leading set of activation character, followed +# by a ':', and then a set of formatting macros. The leading characters tell +# when a report line shall be issued: +# a: all files (shortcut for 'ix') +# A: all files but the excluded ones +# f: report for files only +# d: report for directories only +# m: report for files/directories found in the MANIFEST.new +# n: report for files/directories not found in the MANIFEST.new +# i: included files are listed +# x: excluded files are listed +# Then a set of macros introduced by %: +# %c: the leading one character code defined as follows: +# . if the file is up to date (i.e. not newer than patchlevel.h) +# - if the file is present in the manifest but is missing +# > if the file has changed since last patch. +# + if the file is not present in the manifest but exists +# o if the file is not listed but exists and is older than patchlevel.h +# x if the file in manifest and exists but was excluded +# ? if the file in manifest but was excluded and does not exist +# %n: the name of the file (its path from the top directory) +# %t: time stamp of last modification +# %d: description from MANIFEST.new file, if any +# %s: size of the file, in bytes + +$format = 'A:%c %n'; + +# By default, only the source files whith the following extensions are reported +# (but a -a option will report ALL the files, and a -i option can specify some +# other extensions as well). +# .sh .SH .c .h .l .y .man + +@include = ('.sh', '.SH', '.c', '.h', '.l', '.y', '.man'); + +# By default, the following extensions are excluded from the list. More +# exclusions can be added with the -x option: +# ^core .o .bak .rej .new .old .orig ,v + +@exclude = ('^core', '.o', '.bak', '.rej', '.new', '.old', '.orig', ',v'); + +# The column separator character (or string) is used to separate each formatted +# column on the output. Formatting is requested by adding a '|' character in +# the format string. A new separator can be specified via the -C option. +# The maximum column size is fixed by the -L. + +$col_separator = ' '; +$col_size = ''; + +&profile; # Read ~/.dist_profile +require 'getopts.pl'; +require 'stat.pl'; +&usage unless &Getopts('abcdhntVi:f:p:s:w:x:C:L:I:X:'); + +&usage if $opt_h; +if ($opt_V) { + print "manilist $version PL$pl\n"; + exit 0; +} + +# Go to the top of the package, and update any file name given as argument +# by prepending the needed path. The process then performs a chdir to the +# top. +unless ($opt_b) { + chop($pwd = `pwd`) unless -f '.package'; + until (-f '.package') { + die "No .package file! Run packinit.\n" unless $pwd; + chdir '..' || die "Can't cd ..\n"; + $pwd =~ s|(.*)/(.*)|$1|; + $prefix = $2 . '/' . $prefix; + } + if ($prefix) { + for (@ARGV) { + s/^\.$/$prefix/ && next; + s/^/$prefix/ unless m|^[-/]|; + } + } +} + +# We now are at the top level + +# Build up the file hierarchy filter in @filter +foreach $entry (@ARGV) { + $entry =~ s|/$||; # Remove final / in directory names + if (-d $entry) { + push(@filter, "d:$entry"); + } elsif (-f $entry) { + push(@filter, "f:$entry"); + } else { + die "$entry: No such file or directory.\n"; + } +} + +$prefix = '.' unless $prefix; +($top = $prefix) =~ s|/$||; +$top = '.' if $opt_t; # Start from top, not from original dir +@ARGV = ($top) unless @ARGV; + +if ($opt_n) { # "manifest" files are found by scanning the directory + open(MANIFEST, "find @ARGV -print|") || die "Can't run find: $!\n"; + while (<MANIFEST>) { + chop; + s|^./||; + push(@manifest, $_); + } + close MANIFEST; +} else { + $MANIFEST = $opt_f; + $MANIFEST = 'MANIFEST.new' unless $opt_f; + open(MANIFEST, $MANIFEST) || die "Can't open $MANIFEST: $!\n"; + while (<MANIFEST>) { + chop; + s|^./||; + s|^(\S+)||; + local($name) = $1; + push(@manifest, $name); + m|^\s+(\d+)*\s*(.*)| && ($comment{$name} = $2); + } + close MANIFEST; +} + +# If we have to compare the files in the MANIFEST with the actual files on +# the file system, then grab them... +if ($opt_c && !$opt_n) { + open(FILES, "find @ARGV -print|") || die "Can't run find: $!\n"; + while (<FILES>) { + chop; + s|^./||; + push(@files, $_); + } + close FILES; +} + +# If there is a patchlevel.h file, get its time stamp. +$pl_mtime = 0; +$pl_mtime = (stat('patchlevel.h'))[$ST_MTIME] if -f 'patchlevel.h'; + +# Dealing with command-line options +$format = $opt_p if $opt_p; +$col_separator = $opt_C if $opt_C; +$col_size = $opt_L if $opt_L; +unless ($opt_p) { # -p may be used as a shortcut for -w and -s + local($which) = ($format =~ /^(\w+):/); + local($string) = ($format =~ /^\w+:(.*)/); + $which = $opt_w if $opt_w; + $string = $opt_s if $opt_s; + $format = "$which:$string"; +} +@include = split(' ', $opt_I) if $opt_I; # First reset included with -I +@exclude = split(' ', $opt_X) if $opt_X; # and excluded with -X +push(@include, split(' ', $opt_i)) if $opt_i; # before applying additions +push(@exclude, split(' ', $opt_x)) if $opt_x; +&mode_opt; # Compute $mode_xxx variables +&init_functions; # Compile &included and &excluded + +# Option -d requests dumping of inclusion and exclusion lists on stderr +if ($opt_d) { + print STDERR "Included: ", join(' ', @include), "\n"; + print STDERR "Excluded: ", join(' ', @exclude), "\n"; +} + +@manifest = sort @manifest; +@files = sort @files if defined(@files); + +# Build up the %manifest array so that we quickly know whether a file is in the +# manifest or not. +foreach (@manifest) { + ++$manifest{$_}; +} + +# Now loop other the files held in @manifest and perform your job... +foreach $mani (@manifest) { + if ($opt_c && !$opt_n) { # Check MANIFEST with actual files on disk + for (;;) { + $disk = $files[0]; # Next file coming up + last unless $disk; + last if $disk gt $mani; # Past the current point + shift(@files); # Remove the file from list + last if $disk eq $mani; # Reached the manifest point + # This means the file is before the current MANIFEST point + &report($disk); # File exists and not in MANIFEST + } + } + &report($mani); +} + +&flush_report; # Flush the @Report array if formatting is needed + +# Print usage and exit with a non-zero status +sub usage { + print STDERR <<EOH; +Usage: manilist [-abcdhnptV] [-i ext] [-f manifest] [-p format] [-s string] + [-w which] [-x ext] [-C separator] [-I included] [-L colsize] + [-X excluded] [files] + -a : report for all the files, regardless of (dis)allowed extensions. + -b : take current directory as base top (do not look for .package). + -c : check files against those in manifest and report differences. + -d : dump include and exclude lists on stderr. + -f : specify an alternate MANIFEST.new file. + -h : print this help message. + -i : specify a new extension to be included in the list of scanned files. + -n : do not use any MANIFEST file, rather scan directories for files. + -p : set new printing format (default is '$format'), shortcut for -s and -w. + -s : set string to be printed (with escapes) for each file on report. + -t : start from top directory, regardless of current dir. + -w : give leading letter(s) for printing format (file selection on report). + -x : give a new extension to be excluded from the list of scanned files. + -C : specify column separator (replaces '|' in format string). + -I : override default include list (space separated). + -L : specify maximum column size before truncation (',' separated). + -V : print version number. + -X : override default exclude list (space separated). +EOH + exit 1; +} + +# Set up $mode_xxx variables, where xxx is one of the options which may be set +# in the printing mode. For instance, $mode_i is true if and only if 'i' is +# mentionnned in the printing mode. +sub mode_opt { + local($fmt) = $format; + $fmt =~ s/^(\w+)://; + local($mode) = $1; + $mode .= 'ix' if $mode =~ /a/; + local($mode_eval) = ''; + foreach (split(//, $mode)) { + $mode_eval .= "\$mode_$_ = 1;" + } + eval $mode_eval; + chop($@) && die "Can't set mode variables: $@.\n"; +} + +# Write a report about a file, either on stdout or into @Report if some +# formatting post-processing is needed (aligned on '|' characters in the +# report format string). +sub report { + local($file) = @_; + return unless &report_wanted($file); + + local($fmt) = $format; + local($postproc) = 0; # Do we need formatting post-processing ? + $fmt =~ s/^\w+://; + $fmt =~ s/\|/\02/g && ($postproc = 1); # Formatted colum separator + + # If neither 'd' nor 'f' is specified, then all the files are candidate + # for report. Specifying 'df' is the same, but is less efficient. + if (($mode_d || $mode_f) && -e $file) { # File exists on disk + return if -f _ && !$mode_f; + return if -d _ && !$mode_d; + } + + # Mode 'm' and 'n', if present, respectively ask for a report when a file + # is in the manifest and when a file is not in the manifest. Not specifying + # any of those modes is the same as specifying both of them. + local($in_mani) = defined $manifest{$file}; + if ($mode_m || $mode_n) { + return if $in_mani && !$mode_m; + return if !$in_mani && !$mode_n; + } + + # Mode 'i' and 'x' are used to control included and excluded files. By + # default all the files not excluded are reported. Specifying 'x' also asks + # for excluded files. The 'i' restricts the report to included files. + local($included) = $mode_i ? &included($file) : 1; + local($excluded) = &excluded($file); + if (!$included || $excluded) { + return if !$mode_x && $excluded; + return if ($mode_i && !$included) && !$excluded; + } + + local($c_macro); + local($mtime) = (stat($file))[$ST_MTIME]; + if ($in_mani) { # File in MANIFEST + if (-e $file) { # And file exists + $c_macro = '.' if $mtime <= $pl_mtime; + $c_macro = '>' if $mtime > $pl_mtime; + $c_macro = 'x' if &excluded($file); + } else { + $c_macro = '-'; + $c_macro = '?' if &excluded($file); + } + } else { # File not in MANIFEST + if (-e $file) { # And file exists + $c_macro = $mtime < $pl_mtime ? 'o' : '+'; + } else { + return if -l $file; + warn "$file seems to have been removed...\n"; + } + } + + # Perform the macro substitution + $fmt =~ s/%%/\0/g; # Escape %% + $fmt =~ s/%/\01/g; # Transform %, in case substitution add some + $fmt =~ s/\01c/$c_macro/g; # %c is the code + $fmt =~ s/\01n/$file/g; # %n is the file name + $fmt =~ s/\01t/&fstamp/ge; # %t is the time stamp + $fmt =~ s/\01s/&fsize/ge; # %s is the file size, in bytes + $fmt =~ s/\01d/&mdesc/ge; # %d is the manifest description + $fmt =~ s/\01/%/g; # All other %'s are left undisturbed + + print "$fmt\n" unless $postproc; + push(@Report, $fmt) if $postproc; +} + +# Format and flush report on stdout. Columns are aligned on what was originally +# a '|' character in the format string, translated into a ^B by the reporting +# routine. +sub flush_report { + return unless @Report; # Early return if nothing to be done + local(@length); # Stores maximum length for each field + local(@max); # Maximum allowed column sizes + local($i); + local($report); + local($len); + local(@fields); + @max = split(',', $col_size); + foreach $report (@Report) { # First pass: compute fields lengths + $i = 0; + foreach (split(/\02/, $report)) { + $len = length($_); + $length[$i] = $length[$i] < $len ? $len : $length[$i]; + $i++; + } + } + for ($i = 0; $i < @length; $i++) { # Adapt to maximum specified length + $length[$i] = $max[$i] if $max[$i] > 0 && $length[$i] > $max[$i]; + } + foreach $report (@Report) { # Second pass: formats each line + @fields = split(/\02/, $report); + $i = 0; + foreach (@fields) { + $len = length($_); + if ($max[$i] > 0 && $len > $max[$i]) { + $_ = substr($_, 0, $max[$i]); # Truncate field + } else { + $_ .= ' ' x ($length[$i] - $len); # Pad with blanks + } + $i++; + } + print join($col_separator, @fields), "\n"; + } +} + +# The following macro subsitution functions are called with $file set + +# Return the modification time on file +sub fstamp { + (stat($file))[$ST_MTIME]; +} + +# Return the file size, in bytes +sub fsize { + (stat($file))[$ST_SIZE]; +} + +# Return the description from the MANIFEST file, if any +sub mdesc { + return '' unless defined $comment{$file}; + $comment{$file}; +} + +# Do we have to report informations on the specified file? +sub report_wanted { + return 1 unless @filter; + local($file) = @_; + local($filter); + foreach (@filter) { + $filter = $_; # Work on a copy + if ($filter =~ s/^d://) { + return 1 if $file =~ m|^$filter(/[^/]*)*|; + } else { + $filter =~ s/^f://; + return 1 if $filter eq $file; + } + } + return 0; +} + +# Build up the 'included' and 'excluded' functions which return true if a file +# is in the include or exclude set. +sub init_functions { + &build_function('included', *include, 1); + &build_function('excluded', *exclude, 0); +} + +# Build a function which returns true if a given name is found in the array +# list of regular expression. Each regular expression is applied on the file +# name, anchored at the end. False is returned only if none of the expressions +# match. The purpose of building such a function dynamically is to avoid the +# costly pattern recompilation every time. +sub build_function { + local($name) = shift(@_); # The name of the function to be built + local(*array) = shift(@_); # The extension array we have to check with + local($dflt) = shift(@_); # Default value when -a is used + local($fn) = &q(<<EOF); # Function being built. +:sub $name { +: return $dflt if \$opt_a; # All files are included, none excluded. +: local(\$_) = \@_; +: study; +EOF + foreach (@array) { + $ext = $_; # Work on a copy + # Convert shell-style globbing into perl's RE meta-characters + $ext =~ s/\./\\./g; # Escape . + $ext =~ s/\?/./g; # ? turns into . + $ext =~ s/\*/.*/g; # And * turns into .* + $fn .= &q(<<EOL); +: return 1 if /$ext\$/; +EOL + } + $fn .= &q(<<EOF); +: 0; # None of the extensions can be applied to the file +:} +EOF + eval $fn; + chop($@) && die "Can't compile '$name':\n$fn\n$@.\n"; +} + +# Remove ':' quotations in front of the lines +sub q { + local($_) = @_; + local($*) = 1; + s/^://g; + $_; +} + +!NO!SUBS! +$grep -v '^;#' ../pl/tilde.pl >> manilist +$grep -v '^;#' ../pl/profile.pl >> manilist +chmod 755 manilist +$eunicefix manilist diff --git a/bin/manilist.man b/bin/manilist.man new file mode 100644 index 0000000..3aaa934 --- /dev/null +++ b/bin/manilist.man @@ -0,0 +1,332 @@ +''' $Id: manilist.man,v 3.0.1.3 1995/05/12 11:57:31 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: manilist.man,v $ +''' Revision 3.0.1.3 1995/05/12 11:57:31 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0.1.2 1994/01/24 13:52:55 ram +''' patch16: typo fix +''' +''' Revision 3.0.1.1 1993/08/24 12:11:02 ram +''' patch3: typo fix +''' +''' Revision 3.0 1993/08/18 12:04:04 ram +''' Baseline for dist 3.0 netwide release. +''' +''' +.TH MANILIST 1 ram +.SH NAME +manilist \- report status of files in a source directory +.SH SYNOPSIS +.B manilist +[ +.B \-abcdhnptV +] [ +.B \-i +.I extension +] [ +.B \-f +.I manifest +] [ +.B \-p +.I format +] [ +.B \-s +.I string +] [ +.B \-w +.I which +] [ +.B \-x +.I extension +] [ +.B \-C +.I separator +] [ +.B \-I +.I included +] [ +.B \-L +.I colsize +] [ +.B \-X +.I excluded +] [ +.I files or directories +] +.SH DESCRIPTION +.I Manilist +scans a source directory and produces a report on the status of each file: +whether it is up-to-date or not with respect to +.I patchlevel.h , +if it is missing from MANIFEST.new, and some other useful information which +may be dynamically configured. It can be use to maintain a MANIFEST.new file, +produce a detailed listing and status of a group of directories, etc... The +rich set of options concur to make \fImanilist\fR a perfect low-level tool. +.PP +Under its simplest invocation form at the top level directory of a package, +with no arguments, \fImanilist\fR will scan the MANIFEST.new and produce +a report on the status of each file listed there. Each line starts with a +single character flag which indicates the state of the file, followed by the +name of the file. +.PP +What happens in fact is more complex than that. \fIManilist\fR scans the +MANIFEST.new file and then loops over all the files listed there. Internally, +\fImanilist\fR maintains an inclusion and an exclusion list, both specifying +extensions for files. For instance, the inclusion list could be ('.c', '.h') +and the exclusion ('.o', ',v') so that C sources are included and object +or RCS files excluded. By default, all files but those excluded are used. +Some other selections may be applied at this stage, as will be explained later +on. For those files which pass this selection process, a report is issued +according to a report \fIformat\fR, which by default is "\fIA:%c %n\fR". +The letter \fIA\fR (or anything before the initial ':' character is the +file selection specification we've been talking about. The remaining is the +formatting, a string which is printed as-is, modulo some escape sequences. +It so happens that \fI%c\fR is the character flag and \fI%n\fR is the name +of the current file. +.PP +Generally speaking, \fImanilist\fR should be regarded as a tool which emits +configurable reports on a set of files, selectively picking them among a list +or by directly scanning the directories to see what's out there... +.PP +By specifying a set of directories or files as arguments on the command line, +you restrict the scanning area, limiting to reports concerning those files +or directories. If you do not specify any, manilist restricts its report to +the current directory and its subdirectories, unless the \fB\-t\fR option is +given. +.SH OPTIONS +.I Manilist +recognizes the following options: +.TP 15 +.B \-a +Make a report for \fIall\fR the files, regardless of what is specified by +the \fIincluded\fR and \fIexcluded\fR suffix lists. +.TP +.B \-b +Assume current directory is the base (root) of the package tree. When this +option is not specified, \fImanilist\fR will look for a \fI.package\fR file +to indicate the root directory of the package (also called the top) and +complain if it does not find it. +.TP +.B \-c +Check files against those listed in MANIFEST.new (or whatever file specified +via the \fB\-f\fR option) and report discrepancies via the \fI%c\fR macro. +.TP +.B \-d +Dump included and excluded suffix lists on stderr, extensions being space +separated. A good way to know the default lists is to run: \fImanilist +\-f /dev/null \-bd. +.TP +.B \-f\fI manifest +Specify an alternate manifest file, the default being to use MANIFEST.new. +.TP +.B \-h +Print the usage help message and exit. +.TP +.B \-i\fI extensions +Add new extensions to the included suffix list. The \fIextensions\fR argument +must list the suffixes separated by spaces, as in \fB\-i\fI '.ph .pl'\fR to add +both \fI.ph\fR and \fI.pl\fR to the existing suffixes. Note that the argument +needs to be quoted to protect spaces against shell interpretation. +.TP +.B \-n +Do not use any manifest file. Rather scan the directories and act as with all +the files there were already listed in a manifest. +.TP +.B \-p\fI format +Set the new printing format, which has the form \fIselection\fR:\fIstring\fR, +with \fIselection\fR being a list of single letters specifying which files +from the manifest are to be used for reports, and \fIstring\fR being a +message to print as report, with some macro substitutions. It is also possible +to have column formatting by specifying a '|' inside the string to delimit +the different columns you wish to see. See also \fB\-C\fR and \fB\-L\fR for +more formatting parameters. +.TP +.B \-s\fI string +Specify the \fIstring\fR part of the printing format (see \fB\-p\fR for a +general description of the \fIformat\fR). Available macros are listed further +down the manual page. +.TP +.B \-t +Start from the top directory (the root directory of the distribution) regardless +of the current directory. There must be a \fI.package\fR file to indicate +what the top directory is. +.TP +.B \-w\fI selection +Specifiy the \fIselection\fR part of the printing format. Available selections +will be discussed later. +.TP +.B \-x\fI extensions +Add new extensions to the excluded suffix list. The \fIextensions\fR argument +must list the suffixes separated by spaces, as in \fB\-x\fI '.s .p'\fR to add +both \fI.s\fR and \fI.p\fR to the existing list. Note that the argument +needs to be quoted to protect spaces against shell interpretation. +.TP +.B \-C\fI separator +Give the column separator, which is to be used in place of the '|' character +in the report format string. By default, it is a single space. +.TP +.B \-I\fI included +Specify a new list of suffixes to be included in the reports. This overrides +the original default list (whereas \fB\-i\fR is used to \fIadd\fR suffixes to +the list). Suffixes must be space separated. +.TP +.B \-L\fI colsize +When using column formatting (the '|' character being used to denote columns), +this option may be used to specify the maximum column width, separating each +width by a single ','. Leaving a width unspecified does not impose any limit +on its width. For instance, if the format string is \fI%n|%d|%t\fR, one could +limit the middle column (descriptions from MANIFEST.new) to 40 characters and +the name column (first one) to 15 characters, leaving the last one with no +imposed limits, by using \fB\-L\fI 15,40,\fR. +.TP +.B \-V +Print version number and exit. +.TP +.B \-X\fI excluded +Specify a new list of suffixes to be excluded in the reports. This overrides +the original default list (whereas \fB\-x\fR is used to \fIadd\fR suffixes to +the list). Suffixes must be space separated. +.SH USING FORMATS +The flexibility of \fImanilist\fR is brought by its use of a dynamic formatting +string for providing its reports. It is possible to specify a format via the +\fB\-p\fR option or just parts of it: the text string via \fB\-s\fR and the +file selection with \fB\-w\fR. +.SS "File Selection" +.PP +The leading part of the formatting string tells \fImanilist\fR which files you +wish to see in the final report. Available selectors are: +.sp +.PD 0 +.TP 5 +.B A +All the files but the excluded ones (i.e. those files whose suffix is listed +in the exclusion list). This is the default action. +.TP +.B a +All the files included and/or excluded (shortcut for \fIix\fR). Note that files +which are neither included nor excluded will not appear in the report. +.TP +.B d +Report only for directories. +.TP +.B f +Report only for files. +.TP +.B i +Only included files are listed. +.TP +.B m +Only those files or directories found in the manifest are listed. +.TP +.B n +Only those files or directories \fInot\fR found in the manifest are listed. +.TP +.B x +Only excluded files are listed. +.PD +.PP +When you specify more than one letter, the resulting report depends on the +nature of the selection. For \fId\fR, \fIf\fR, \fIm\fR and \fIn\fR, a logical +union is performed. This means specifying \fIfd\fR or \fImn\fR is the same +as not specifying anything, but it's less efficient since \fImanilist\fR is +forced to perform the checks it would otherwise bypass. The \fIi\fR and \fIx\fR +selectors are special: by default, all the files not excluded are reported. +Specifying \fIx\fR also asks for excluded files. Specifying \fIi\fR restricts +the report to the included files. Using both at the same time (\fIix\fR) will +force a report for files which are included or excluded. +.SS "Macro Substitution" +.PP +The string part of the report format can make use of the following macros: +.sp +.PD 0 +.TP 5 +%c +A character coding the status of the file. +.TP +%d +Description from the manifest file, if any. +.TP +%n +Name of the file (its path from the top directory). +.TP +%s +Size of the file, in bytes. +.TP +%t +Time stamp of the last modification. +.PD +.SS "File Status" +.PP +The \fI%c\fR macro, giving a single character coding the file status, can +expand into one of the following. +.PD 0 +.TP 5 +\&. +The file is up to date (not newer than \fIpatchlevel.h\fR). +.TP +- +The file is present in the manifest but is missing. +.TP +> +The file has been modified since last patch (newer than \fIpatchlevel.h\fR). +.TP ++ +The file exists but is not listed in the manifest. +.TP +o +The file exists but is not listed in the manifest and is older than +\fIpatchlevel.h\fR +.TP +x +The file is listed in the manifest and exists, but has been excluded. Naturally, +this will appear in the report only if the \fIx\fR selector is given in the +report format. +.TP +? +The file is listed in the manifest, does not exist, and was excluded. +.PD +.SH EXAMPLES +The command +.in +5 +.nf +.sp +\fImanilist -ct -p 'ni:%n'\fR +.sp +.fi +.in -5 +will list all the source files from your distribution which are not listed +in your MANIFEST.new file. Note that this includes only "source" files, that +is to say files whose extension is listed in the inclusion list. +If you do not wish this restriction, replace the formatting string with +\fIn:%n\fR (only the excluded files will not appear). +.PP +To build an initial MANIFEST file, use: +.in +5 +.nf +.sp +\fImanilist -n -p 'Af:%n' > MANIFEST\fR +.sp +.fi +.in -5 +from the top directory. You will eventually want to fill in descriptions for +each file listed in the manifest. +.SH FILES +.PD 0 +.TP 20 +MANIFEST.new +Default manifest file, listing files and giving a small description for each +of them. +.PD +.SH AUTHOR +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH "SEE ALSO" +manifake(1), makedist(1), pat(1). diff --git a/bin/packinit.SH b/bin/packinit.SH new file mode 100644 index 0000000..55dee75 --- /dev/null +++ b/bin/packinit.SH @@ -0,0 +1,447 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting bin/packinit (with variable substitutions)" +cat >packinit <<!GROK!THIS! +# feed this into perl + eval "exec perl -S \$0 \$*" + if \$running_under_some_shell; + +# $Id: packinit.SH,v 3.0.1.4 1997/02/28 14:55:14 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: packinit.SH,v $ +# Revision 3.0.1.4 1997/02/28 14:55:14 ram +# patch61: fixed one wrong ':' comment in .package +# +# Revision 3.0.1.3 1994/10/29 15:43:49 ram +# patch36: added support for user-defined C and shell file extensions +# patch36: now asks whether a ChangeLog file is to be managed +# +# Revision 3.0.1.2 1994/01/24 13:54:07 ram +# patch16: can now configure mailing list knowledge from packinit +# +# Revision 3.0.1.1 1993/08/19 06:41:53 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:05 ram +# Baseline for dist 3.0 netwide release. +# + +\$orgname='$orgname'; +\$myhostname='$myhostname'; +\$mydomain='$mydomain'; +\$nametype='$nametype'; +!GROK!THIS! +cat >>packinit <<'!NO!SUBS!' + +print <<EOM; + +This program designates the current directory as the top level directory +of a package on which you want to use the programs metaconfig, makedist, +or the patch generation programs. It will not damage the current directory +in any way except to create a .package file. + +EOM + +$mypackver = 3.036; # Base revision number plus patchlevel + +if (-f '.package') { + &readpackage; + if ($packver > $mypackver) { + die "This .package file was produced by a newer packinit than I am.\n". + "Please find a packinit of version $packver or greater.\n"; + } +} elsif (-f '../.package' || -f '../../.package' || -f '../../../.package') { + die "Run in top level directory only.\n"; +} + +# Now set up to do reads with possible shell escape. +sub myread { + ($rp,$dflt) = @_; + $rp .= " [$dflt]"; + print "$rp "; + $ans='!'; + while ($ans =~ /^!/) { + $ans = <STDIN>; + chop($ans); + if ($ans eq '!') { + system '/bin/sh'; + print "\n$rp "; + } elsif ($ans =~ s/^!//) { + system '/bin/sh', '-c', $ans; + print "\n$rp "; + } + } + $ans = $dflt if $ans eq ''; + $ans = '' if $ans eq 'none'; + $ans; +} + +$dflt = $package; +($dflt) = (`pwd | tr "[A-Z]" "[a-z]"` =~ m|.*/(.*)|) unless $package; + +print <<EOM; +Your package will be known by some name, which should be a single word. +Generally it is the name of the chief executable program. + +EOM +$package = &myread('What is the name of your package?',$dflt); + +if ($baserev ne '') { + $dflt=$baserev; +} else { + print "\n"; + $dflt=''; + print "Checking RCS files for current version..."; + @rcs = <RCS/*,v *,v>; + $rcs = shift(@rcs); + if (! -f $rcs) { + $rcs = shift(@rcs); + if (! -f $1) { + print "I don't see any RCS files there (yet)."; + $dflt='1.1'; + } + } + $revs=0; + if ($dflt eq '') { + $rlog = `rlog $rcs`; + ($dflt) = ($rlog =~ /\nhead:\s*(\d+\.\d+)/); + $rlog = `rlog -r$dflt.1- -r$dflt.2- -r$dflt.3- -r$dflt.4- $rcs`; + ($revs) = ($rlog =~ /selected revisions:\s*([\d.]+)/); + $dflt='1.1' if $dflt eq ''; + } + + print <<EOM; + +To use the patch generating portion of the system, you must have RCS. You +must begin with a freshly checked-in trunk revision (n.n) and choose a branch +number for patches. The trunk revision upon which the patch branch is based +is called the base revision. + +EOM + + if ($revs > 1) { + print <<EOM; +(The current revision ($dflt) has branches--you may have to check in a new +trunk revision, or use patbase to mark the base revisions.) +EOM + ($first,$second) = split(/\./,$dflt); + ++$second; + $dflt="$first.$second"; + } +} + +print "\n"; +$foo = &myread('What is or will be the base revision number?', $dflt); +if ($baserev ne $foo) { + $baserev = $foo; + $ftpdir = ''; # invalidate ftp directory on version change +} + +print "\n"; +$dflt = ($patchbranch ne '' ? $patchbranch : 1); +$patchbranch = + &myread('What branch number do you want to use for patches?', $dflt); + +$dflt = $cext eq '' ? 'none' : $cext; +print <<EOM; + +Metaconfig will lookup for files listed in MANIFEST.new to scan for +known symbols. If you have non-standard extensions containing some +C symbols, you may wish to list them there, separating them with white +spaces and using shell regular expressions, such as '.xs .p .t' to let +metaconfig know about them. Say "none" for none. + +EOM +$cext = &myread('Additional file extensions to identify C files?', $dflt); +$cext = '' if $cext eq 'none'; + +$dflt = $shext eq '' ? 'none' : $shext; +print <<EOM; + +Likewise, metaconfig needs to know about the files containing at least +some shell symbols. Automatic symbol substitution will be performed on +the .SH files only, but you may want metaconfig to scan other files as +well, provided you ensure proper variable substitutions by your own +means. Please add extensions using shell-style regexps. Say "none" if +no specific file extensions are used. + +EOM +$shext = &myread('Additional file extensions to identify SH files?', $dflt); +$shext = '' if $shext eq 'none'; + +$dflt = $copyright eq ' ' ? 'n' : 'y'; +print <<'EOM'; + +If you wish, you may use a generic copyright. This is appropriate if all +your source file have to be distributed under the same conditions. Using +this facility means you will not be able to change the copyright notice +between patches (i.e. while in the same version number). All you need to +do is write a copyright file containing the proper copyright notice, and +then use @COPYRIGHT@ within your source code (before any RCS marker). That +will be extended to the full copyright, preserving any leading comment. + +EOM +$use_copyright = &myread('Do you wish to use a generic copyright?', $dflt); +if ($use_copyright =~ /^y/i) { + print "\n"; + $copyright = '' if $copyright eq ' '; # They changed their mind! + $dflt = $copyright || 'COPYRIGHT'; + $copyright = &myread('What file do you wish to store it in?', $dflt); +} else { + $copyright = ' '; # Remember they don't want it +} + +if ($use_copyright =~ /^y/i) { + $ans = 'yes'; # Yes, use our own diff (have to expand copyright) +} else { + print "\n"; + $dflt = ($mydiff eq '' ? 'n' : 'y'); + $ans = &myread( + 'Do you want to use your own diff (rather than rcsdiff -c) for patches?', + $dflt); +} +if ($ans =~ /^n/i) { + $mydiff=''; +} else { + print "\n"; + $dflt = $mydiff || 'diff -c'; + $mydiff = &myread('What diff command do you want to use?', $dflt); +} + +$dflt = $changelog eq ' ' ? 'n' : 'y'; +print <<'EOM'; + +I can set up things so that a ChangeLog file is maintained automatically. +This file will contain the description which is filled in into every issued +patches, and optionally, the list of RCS logs for each modified file. The +ChangeLog file is sorted in reverse order of issued patches, i.e. the most +recent changes are at the top of the file. + +EOM +$use_changelog = &myread('Do you wish me to maintain a ChangeLog file?', $dflt); +if ($use_changelog =~ /^y/i) { + print "\n"; + $changelog = '' if $changelog eq ' '; # They changed their mind! + $dflt = $changelog || 'ChangeLog'; + $changelog = &myread('What file do you wish to store changes in?', $dflt); + $dflt = $changercs ? 'y' : 'n'; + print "\n"; + $ans = &myread('Do you wish to include RCS logs as well?', $dflt); + $changercs = $ans =~ /^y/i; +} else { + $changelog = ' '; # Remember they don't want it + $changercs = 0; +} + +print <<EOM; + +Over the lifetime of the $package package, people will want to request +distribution kits and patches. In particular, automatically generated +patches will say where to get previous patches from. + +EOM +$logname = &getlogname; +$dflt = $maintname || &getfullname($logname); +$maintname = &myread('Who should requests be sent to (full name)?', $dflt); + +print <<EOM; + +Now you need to give a one-line network mailing address for $maintname. +It does not need to be parseable by machine, but can be of the form: + + {name1,name2,name3}!myhost!myname + + or + + myname\@myhost.domain + +EOM +$dflt = $maintloc || "$logname\@$myhostname$mydomain"; +$maintloc = &myread('What is the network mailing address?', $dflt); + +print "\n"; +$dflt = $ftpsite ? 'y' : 'n'; +$ans = &myread( + 'Will you put patches where they can be acquired by anonymous FTP?',$dflt); +if ($ans =~ /^n/i) { + $ftpsite=''; +} else { + print "\n"; + $dflt = $ftpsite; + ($dflt = $maintloc) =~ s/.*@([^\s,()]*).*/$1/ unless $dflt; + $ftpsite = &myread('What is the Internet sitename for that?',$dflt); +} + +print <<EOM; + +If you have mailagent installed (posted in comp.sources.misc), you may choose +to distribute patches via e-mail and have all the issued patches mention +this, as well as instructions telling how to get those (missing) patches. + +EOM +$dflt = $mailagent eq 'true' ? 'y' : 'n'; +$mailagent = &myread( + 'Do you wish to let people retrieve patches via mailagent?', $dflt); +$mailagent = ($mailagent =~ /^y/i) ? 'true' : 'false'; + +print "\n"; +$dflt = $list_users eq 'true' ? 'y' : 'n'; +$list_users = &myread( + "Do you have a mailing list set up for $package users?", $dflt); +$list_users = ($list_users =~ /^y/i) ? 'true' : 'false'; + +if ($list_users eq 'true') { + print "\n"; + $dflt = $list_name || "$package-users"; + $list_name = &myread('How is the mailing list named?', $dflt); + + print <<EOM; + +The $list_name mailing list is now to be defined in terms of e-mail +addresses where users can send messages to the whole list (that's the +mailing list address) or send administrative requests to subscribe or +unsubscribe among other things (that's the administrative mailing +address). Usually, this last address will turn out to be that of a +mailing list manager program like majordomo or listserv. + +EOM + $dflt = $list_addr || "$list_name\@$myhostname$mydomain"; + $list_addr = &myread('What is Internet mailing list address?', $dflt); + + print "\n"; + ($list_domain) = $list_addr =~ /^[\w-]+\@(.*)/; + $list_domain = "$myhostname$mydomain" unless $list_domain; + $dflt = $list_request || "$list_name-request\@$list_domain"; + $list_request = &myread('What is administrative mailing address?', $dflt); + + %mlm = ( + 'majordomo', + "subscribe $list_name \$cf_email;unsubscribe $list_name \$cf_email", + 'listserv', + "SUBSCRIBE $package \$cf_name;UNSUBSCRIBE $package", + 'human', + "subscribe $list_name \$cf_email;unsubscribe $list_name \$cf_email", + ); + + print "\n"; + ($dflt) = $list_request =~ /^([\w-]+)\@/; + $dflt =~ tr/A-Z/a-z/; + $list_cmds = $mlm{$dflt}; + $dflt = 'human' if $list_cmds eq ''; + $old_list_manager = $list_manager; + $list_manager = &myread( + 'What type of mailing list manager are you using?', $dflt); + $list_manager =~ tr/A-Z/a-z/; + $list_sub = $list_unsub = '' if $old_list_manager ne $list_manager; + + $list_cmds = $mlm{$list_manager}; + $list_cmds = $mlm{'human'} if $list_cmds eq ''; + @list_cmds = split(/;/, $list_cmds); + + print <<'EOM'; + +In the next two questions, you may use the following variables in your +answers: + + $cf_email e-mail address of the user + $cf_name full name of the user + +Those variables will be set by Configure prior sending the requests to +the administrative mailing list address. + +EOM + $dflt = $list_sub || $list_cmds[0]; + $list_sub = &myread('Subscribe command?', $dflt); + print "\n"; + $dflt = $list_unsub || $list_cmds[1]; + $list_unsub = &myread('Unsubscribe command?', $dflt); +} + +print "\n"; +$dflt = $orgname || $ENV{'ORGANIZATION'}; +$orgname = &myread('Organization:',$dflt); +$orgname = &tilda_expand($orgname); # Can specify filename with ~user + +print "\n"; +$dflt = $newsgroups || 'comp.sources.bugs'; +$newsgroups = &myread('Newsgroup(s) to post patches to:', $dflt); + +print "\n"; +$dflt = $recipients || 'source-archives@mirror.TMC.COM'; +$recipients = &myread('Recipient(s) to send patches to:',$dflt); + +if ($ftpsite) { + print "\n"; + $dflt = $ftpdir || "/usr/spool/ftp/pub/$package.$baserev/patches"; + $ftpdir = &myread('FTP directory to copy patches to:',$dflt); +} else { + $ftpdir = ''; +} + +print "\nCreating .package...\n"; +open(PACKAGE, '>.package') || die "Can't create .package"; +chop($date = `date`); +print PACKAGE <<EOF; +: This file was created by running packinit on $date. +: Do not hand edit -- run packinit again if changes are to be made. +packver='$mypackver' +: Basic variables +package=$package +baserev=$baserev +patchbranch=$patchbranch +copyright='$copyright' +mydiff='$mydiff' +maintname='$maintname' +maintloc='$maintloc' +ftpsite='$ftpsite' +orgname='$orgname' +newsgroups='$newsgroups' +recipients='$recipients' +ftpdir='$ftpdir' +mailagent='$mailagent' +changelog='$changelog' +changercs=$changercs +: File lookup extensions +cext='$cext' +shext='$shext' +: Mailing list variables +list_users='$list_users' +list_name='$list_name' +list_addr='$list_addr' +list_request='$list_request' +list_manager='$list_manager' +list_sub='$list_sub' +list_unsub='$list_unsub' +: Derivative variables -- do not change +revbranch=\"\$baserev.\$patchbranch\" +EOF + +!NO!SUBS! +$grep -v '^;#' ../pl/package.pl >>packinit +$grep -v '^;#' ../pl/logname.pl >>packinit +$grep -v '^;#' ../pl/fullname.pl >>packinit +$grep -v '^;#' ../pl/tilde.pl >>packinit +chmod 755 packinit +$eunicefix packinit diff --git a/bin/packinit.man b/bin/packinit.man new file mode 100644 index 0000000..002b25e --- /dev/null +++ b/bin/packinit.man @@ -0,0 +1,148 @@ +''' $Id: packinit.man,v 3.0.1.4 1995/07/25 13:31:38 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: packinit.man,v $ +''' Revision 3.0.1.4 1995/07/25 13:31:38 ram +''' patch56: fixed a typo +''' +''' Revision 3.0.1.3 1995/05/12 11:57:38 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0.1.2 1994/10/29 15:45:17 ram +''' patch36: added new variables cext, shext, changelog and changercs +''' +''' Revision 3.0.1.1 1994/01/24 13:54:31 ram +''' patch16: now documents variables set in .package by packinit +''' +''' Revision 3.0 1993/08/18 12:04:06 ram +''' Baseline for dist 3.0 netwide release. +''' +''' +.TH PACKINIT 1 ram +.SH NAME +packinit \- initialize or update your .package file +.SH SYNOPSIS +.B packinit +.SH DESCRIPTION +.B Packinit +will create (or update) a \fI.package\fR file, so that all the +.B dist +tools can be smart and know some basic things about your package, +such as its revision number, or the e-mail address of its maintainer. +.PP +.I Packinit +should be run from the top level directory of your package, before +using any other \fIdist\fR tool. Later on, you may rerun it to +update some of its values. +.I Packinit +will create a single file and leave the remaining of +your directory undisturbed. +.SH VARIABLES +.I Packinit +defines the following variables in your \fI.package\fR file: +.TP 15 +.PD 0 +baserev +The baseline revision number. +.TP +cext +The list (space separated) of file extensions identifying potential holders of +C symbols. This is added to the default .[chyl] extension lookup. +Shell-style patterns may be used. +.TP +changelog +The name of the \fIChangeLog\fR file managed by \fIpatlog\fR. +.TP +changercs +Boolean stating whether RCS logs are to be made part of \fIChangeLog\fR. +.TP +copyright +Name of the file used for Copyright expansion. +.TP +ftpdir +Directory where patches are located on the FTP site. +.TP +ftpsite +Name of the FTP site where patches may be retrieved from. +.TP +list_addr +Address of the package mailing list where users may post messages to. +.TP +list_manager +Type of list manager attached to the list administrative request address. +.TP +list_name +Name of the package users mailing list. +.TP +list_request +Address where subscribe and unsubscribe requests for the package mailing +list should be sent to. +.TP +list_sub +Format of the subscribe requests. +.TP +list_unsub +Format of the unsubscribe requests. +.TP +list_users +A boolean string set to 'true' when there is a mailing list set up for +discussion about the package. +.TP +mailagent +A boolean string set to 'true' when people are allowed to retrieve +patches via mailagent \fI@SH mailpatch\fR commands. +.TP +maintloc +E-mail address of the package maintainer, preferably in Internet format. +.TP +maintname +Full name of the package maintainer. +.TP +mydiff +Name of the \fIdiff\fR program to be used when computing a patch. +.TP +newsgroups +Newsgroup list where new patches should be posted to, empty for no +postings. +.TP +orgname +Full name of the organization where the package maitainer resides, or +path to a file containing that name. +.TP +package +Name of the package. +.TP +packver +Version of the \fIpackinit\fR program that built the \fI.package\fR file. +.TP +patchbranch +Name of the RCS branch used to store subsequent updates of a file after +a baseline has been released. +.TP +recipients +People who should be sent newly issued patches. +.TP +shext +The list (space separated) of file extensions identifying potential holders of +shell symbols. This is added to the default .SH extension lookup. +Shell-style patterns may be used. Note that only .SH extensions are looked +up by Configure for automatic shell extraction with variable substitutions, +no matter what this variable is set to. +.PD +.SH FILE +.TP 15 +\&.package +File holding all the package-related values +.SH AUTHORS +Larry Wall <lwall@netlabs.com> (version 2.0) +.br +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH "SEE ALSO" +dist(1). diff --git a/bin/perload b/bin/perload new file mode 100755 index 0000000..6b426fa --- /dev/null +++ b/bin/perload @@ -0,0 +1,646 @@ +: # feed this into perl +'/bin/true' && eval 'exec perl -S $0 "$@"' + if $running_under_some_shell; +'di'; +'ig00'; + +# +# This perl script is its own manual page [generated by wrapman] +# + +# $Id: perload,v 3.0.1.1 1994/10/29 15:45:36 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: perload,v $ +# Revision 3.0.1.1 1994/10/29 15:45:36 ram +# patch36: added minimal support for perl5 dataloading +# +# Revision 3.0 1993/08/18 12:04:06 ram +# Baseline for dist 3.0 netwide release. +# + +# Replace each function definition in a loading section by two stubs and +# reject the definition into the DATA part of the script if in a dataload +# section or into a FILE if in an autoload section. + +$in_load = 0; # In a loading section +$autoload = ''; # Name of autoloaded file +$has_invocation_stub = 0; # True if we detect a #! stub +$current_package = 'main'; # Current package +$init_emitted = 0; # True when dataloading stamp was emitted +$in_function = 0; + +require 'getopt.pl'; +&Getopt; + +while (<>) { + if ($. == 1 && /^(:|#).*perl/) { # Invocation stub + $has_invocation_stub = 1; + print; + next; + } + if ($. <= 3 && $has_invocation_stub) { + print; + next; + } + if (/^\s*$/) { + &flush_comment; + print unless $in_function; + print if $in_function && !$in_load; + if ($in_function && $in_load) { + push(@Data, "\n") unless $autoload; + $Auto{$autoload} .= "\n" if $autoload; + } + next; + } + if (/^\s*;?#/) { + if (/#\s*perload on/i) { # Enter a loading section + print unless /:$/; + $in_load = 1; + next; + } + if (/#\s*perload off/i) { # End a loading section + print unless /:$/; + $in_load = 0; + next; + } + if (/#\s*autoload (\S+)/i) { # Enter autoloading section + print unless /:$/; + push(@autoload, $autoload); # Directives may be nested + $autoload = $1; + $in_load += 2; + next; + } + if (/#\s*offload/i) { # End autoloading section + print unless /:$/; + $autoload = pop(@autoload); # Revert to previously active file + $in_load -= 2; + next; + } + &emit_init unless $init_emitted; + push(@Comment, $_) unless $in_function; + print if $in_function && !$in_load; + next unless $in_function; + push(@Data, $_) unless $autoload; + $Auto{$autoload} .= $_ if $autoload; + next; + } + &emit_init unless $init_emitted; + /^package (\S+)\s*;/ && ($current_package = $1); + unless ($in_load) { + &flush_comment; + print; + next; + } + # We are in a loading section + if (/^sub\s+([\w']+)\s*\{(.*)/) { + die "line $.: function $1 defined within another function.\n" + if $in_function; + # Silently ignore one-line functions + if (/\}/) { + &flush_comment; + print; + next; + } + $comment = $2; + $in_function = 1; + $function = $1; + ($fn_package, $fn_basename) = $function =~ /^(\w+)'(\w+)/; + unless ($fn_package) { + $fn_package = $current_package; + $fn_basename = $function; + } + # Keep leading function comment + foreach (@Comment) { + push(@Data, $_) unless $autoload; + $Auto{$autoload} .= $_ if $autoload; + } + @Comment = (); + # Change package context for correct compilation: the name is visible + # within the original function package while the body of the function + # is compiled within the current package. + $declaration = "sub $fn_package" . "'load_$fn_basename {$comment\n"; + $package_context = "\tpackage $current_package;\n"; + if ($autoload) { + $Auto{$autoload} .= $declaration . $package_context; + } else { + push(@Data, $declaration, $package_context); + } + # Emit stubs + print "sub $fn_package", "'$fn_basename"; + print " { &auto_$fn_package", "'$fn_basename; }\n"; + print "sub auto_$fn_package", "'$fn_basename { "; + print '&main\'dataload' unless $autoload; + print '&main\'autoload(' . "'$autoload'" . ', @_)' if $autoload; + print "; }\n"; + next; + } + unless ($in_function) { + &flush_comment; + print; + next; + } + # We are in a loading section and inside a function body + push(@Data, $_) unless $autoload; + $Auto{$autoload} .= $_ if $autoload; + $in_function = 0 if /^\}/; + if (/^\}/) { + push(@Data, "\n") unless $autoload; + $Auto{$autoload} .= "\n" if $autoload; + } +} + +@auto = keys %Auto; +if (@auto > 0) { + print &q(<<'EOC'); +:# Load the calling function from file and call it. This function is called +:# only once per file to be loaded. +:sub main'autoload { +: local($__file__) = shift(@_); +: local($__packname__) = (caller(1))[3]; +: $__packname__ =~ s/::/'/; +: local($__rpackname__) = $__packname__; +: local($__saved__) = $@; +: $__rpackname__ =~ s/^auto_//; +: &perload'load_from_file($__file__); +: $__rpackname__ =~ s/'/'load_/; +: $@ = $__saved__; # Restore value $@ had on entrance +: &$__rpackname__(@_); # Call newly loaded function +:} +: +:# Load file and compile it, substituing the second stub function with the +:# loaded ones. Location of the file uses the @AUTO array. +:sub perload'load_from_file { +: package perload; +: local($file) = @_; # File to be loaded +: local($body) = ' ' x 1024; # Pre-extent +: local($load) = ' ' x 256; # Loading operations +: # Avoid side effects by protecting special variables which will be +: # changed by the autoloading operation. +: local($., $_, $@); +: $body = ''; +: $load = ''; +: &init_auto unless defined(@'AUTO); # Make sure we have a suitable @AUTO +: &locate_file unless -f "$file"; # Locate file if relative path +: open(FILE, $file) || +: die "Can't load $'__rpackname__ from $file: $!\n"; +: while (<FILE>) { +: $load .= '*auto_' . $1 . '\'' . $2 . '= *' . $1 . '\'' . "load_$2;\n" +: if (/^sub\s+(\w+)'load_(\w+)\s*\{/); +: $body .= $_; +: } +: close FILE; +EOC + if ($opt_t) { + print &q(<<'EOC'); +: # Untaint body when running setuid +: $body =~ /^([^\0]*)/; +: # No need to untaint $load, as it was built using trusted variables +: eval $1 . $load; +EOC + } else { + print &q(<<'EOC'); +: eval $body . $load; +EOC + } + print &q(<<'EOC'); +: chop($@) && die "$@, while parsing code of $file.\n"; +:} +: +:# Initialize the @AUTO array. Attempt defining it by using the AUTOLIB +:# environment variable if set, otherwise look in auto/ first, then in the +:# current directory. +:sub perload'init_auto { +: if (defined $ENV{'AUTOLIB'} && $ENV{'AUTOLIB'}) { +: @AUTO = split(':', $ENV{'AUTOLIB'}); +: } else { +: @AUTO = ('auto', '.'); +: } +:} +: +:# Locate to-be-loaded file held in $file by looking through the @AUTO array. +:# This variable, defined in 'load_from_file', is modified as a side effect. +:sub perload'locate_file { +: package perload; +: local($fullpath); +: foreach $dir (@'AUTO) { +: $fullpath = $dir . '/' . $file; +: last if -f "$fullpath"; +: $fullpath = ''; +: } +: $file = $fullpath if $fullpath; # Update var from 'load_from_file' +:} +: +EOC +} + +if (@Data > 0) { + print &q(<<'EOC'); +:# Load the calling function from DATA segment and call it. This function is +:# called only once per routine to be loaded. +:sub main'dataload { +: local($__packname__) = (caller(1))[3]; +: $__packname__ =~ s/::/'/; +: local($__rpackname__) = $__packname__; +: local($__at__) = $@; +: $__rpackname__ =~ s/^auto_//; +: &perload'load_from_data($__rpackname__); +: local($__fun__) = "$__rpackname__"; +: $__fun__ =~ s/'/'load_/; +: eval "*$__packname__ = *$__fun__;"; # Change symbol table entry +: die $@ if $@; # Should not happen +: $@ = $__at__; # Restore value $@ had on entrance +: &$__fun__; # Call newly loaded function +:} +: +:# Load function name given as argument, fatal error if not existent +:sub perload'load_from_data { +: package perload; +: local($pos) = $Datapos{$_[0]}; # Offset within DATA +: # Avoid side effects by protecting special variables which will be changed +: # by the dataloading operation. +: local($., $_, $@); +: $pos = &fetch_function_code unless $pos; +: die "Function $_[0] not found in data section.\n" unless $pos; +: die "Cannot seek to $pos into data section.\n" +: unless seek(main'DATA, $pos, 0); +: local($/) = "\n}"; +: local($body) = scalar(<main'DATA>); +: local($*) = 1; +: die "End of file found while loading $_[0].\n" unless $body =~ /^\}$/; +EOC + if ($opt_t) { + print &q(<<'EOC'); +: # Untaint body when running setuid +: $body =~ /^([^\0]*)/; +: # Now we may safely eval it without getting an insecure dependency +: eval $1; # Load function into perl space +EOC + } else { + print &q(<<'EOC'); +: eval $body; # Load function into perl space +EOC + } + print &q(<<'EOC'); +: chop($@) && die "$@, while parsing code of $_[0].\n"; +:} +: +EOC + print &q(<<'EOC') unless $opt_o; +:# Parse text after the END token and record defined loadable functions (i.e. +:# those whose name starts with load_) into the %Datapos array. Such function +:# definitions must be left adjusted. Stop as soon as the function we want +:# has been found. +:sub perload'fetch_function_code { +: package perload; +: local($pos) = tell main'DATA; +: local($in_function) = 0; +: local($func_name); +: local($., $_); +: while (<main'DATA>) { +: if (/^sub\s+(\w+)'load_(\w+)\s*\{/) { +: die "DATA line $.: function $1'$2 defined within $func_name.\n" +: if $in_function; +: $func_name = $1 . '\'' . $2; +: $Datapos{$func_name} = $pos; +: $in_function = 1; +: next; +: } +: $in_function = 0 if /^\}/; +: next if $in_function; +: return $pos if $func_name eq $_[0]; +: $pos = tell main'DATA; +: } +: 0; # Function not found +:} +: +EOC + print &q(<<'EOC') if $opt_o; +:# This function is called only once, and fills in the %Datapos array with +:# the offset of each of the dataloaded routines held in the data section. +:sub perload'fetch_function_code { +: package perload; +: local($start) = 0; +: local($., $_); +: while (<main'DATA>) { # First move to start of offset table +: next if /^#/; +: last if /^$/ && ++$start > 2; # Skip two blank line after end token +: } +: $start = tell(main'DATA); # Offsets in table are relative to here +: local($key, $value); +: while (<main'DATA>) { # Load the offset table +: last if /^$/; # Ends with a single blank line +: ($key, $value) = split(' '); +: $Datapos{$key} = $value + $start; +: } +: $Datapos{$_[0]}; # All that pain to get this offset... +:} +: +EOC + print &q(<<'EOC'); +:# +:# The perl compiler stops here. +:# +: +:__END__ +: +:# +:# Beyond this point lie functions we may never compile. +:# +: +EOC + # Option -o directs us to optimize the function location by emitting an + # offset table, which lists all the position within DATA for each possible + # dataloaded routine. + if ($opt_o) { + print &q(<<'EOC'); +:# +:# DO NOT CHANGE A IOTA BEYOND THIS COMMENT! +:# The following table lists offsets of functions within the data section. +:# Should modifications be needed, change original code and rerun perload +:# with the -o option to regenerate a proper offset table. +:# +: +EOC + $trailing_message = &q(<<'EOC'); +: +:# +:# End of offset table and beginning of dataloading section. +:# +: +EOC + $pos = 0; # Offset relative to this point (start of table) + foreach (@Data) { + $Datapos{"$1\'$2"} = $pos - $now + if /^sub\s+(\w+)'load_(\w+)\s*\{/; # } for vi + $pos += length; + } + @poskeys = keys %Datapos; # Array of routine names (fully qualified) + + # Write out a formatted table, each entry stored on $entry bytes and + # formatted with the $format string. + ($entry, $format) = &get_format(*poskeys); + + # The total size occupied by the table is the size of one item times + # the number of items plus the final trailing message at the end of + # the table. + $table_size = $entry * @poskeys + length($trailing_message); + + # Output formatted table + foreach (sort @poskeys) { + printf($format, $_, $table_size + $Datapos{$_}); + } + print $trailing_message; + } + + # Output code for each dataloaded function + foreach (@Data) { + print; + } + print &q(<<'EOC'); +:# +:# End of dataloading section. +:# +: +EOC +} + +if (@auto > 0) { + mkdir('auto',0755) unless -d 'auto'; + foreach $file (@auto) { + unless (open(AUTO, ">auto/$file")) { + warn "Can't create auto/$file: $!\n"; + next; + } + print AUTO &q(<<'EOC'); +:# This file was generated by perload +: +EOC + print AUTO $Auto{$file}; + close AUTO; + } +} + +# Compute optimum format for routine offset table, returning both the size of +# each entry and the formating string for printf. +sub get_format { + local(*names) = @_; + local($name_len) = 0; + local($max_len) = 0; + foreach (@names) { + $name_len = length; + $max_len = $name_len if $name_len > $max_len; + } + # The size of each entry (preceded by one tab, followed by 12 chars) + $name_len = $max_len + 1 + 12; + ($name_len, "\t%${max_len}s %10d\n"); +} + +sub emit_init { + print &q(<<'EOC'); +:# +:# This perl program uses dynamic loading [generated by perload] +:# +: +EOC + $init_emitted = 1; +} + +sub flush_comment { + print @Comment if @Comment > 0; + @Comment = (); +} + +sub q { + local($_) = @_; + local($*) = 1; + s/^://g; + $_; +} + +# +# These next few lines are legal in both perl and nroff. +# + +.00; # finish .ig + +'di \" finish diversion--previous line must be blank +.nr nl 0-1 \" fake up transition to first page again +.nr % 0 \" start at page 1 +'; __END__ \" the perl compiler stops here + +''' +''' From here on it's a standard manual page. +''' + +.TH PERLOAD 1 "June 20, 1992" +.AT 3 +.SH NAME +perload \- builds up autoloaded and dataloaded perl scripts +.SH SYNOPSIS +.B perload +[ \fB\-ot\fR ] +[ \fIfile\fR ] +.SH DESCRIPTION +.I Perload +takes a perl script as argument (or from stdin if no argument is supplied) +and prints out on stdout an equivalent script set-up to perform autoloading +or dataloading. The translation is directed by special comments within the +original script. Using dynamic loading can drastically improve start-up +performances, both in time and in memory, as perl does not need to compile +the whole script nor store its whole compiled form in memory. +.PP +.I Autoloading +delays compilation of some functions until they are needed. The code for these +functions is loaded dynamically at run-time. The atomicity of loading is a +file, which means that putting more than one function into a file will cause +all these functions to be loaded and compiled as soon as one among them is +needed. +.PP +.I Dataloading +is a form of autoloading where no extra file are needed. The script carries +all the functions whose compilation is to be delayed in its data segment +(in the \fIperl\fR sense, i.e. they are accessible via the DATA filehandle). +The scripts parses the data segment and extracts only the code for the needed +subroutine, which means granularity is better than with autloading. +.PP +It is possible for a single script to use both autoloading and dataloading at +the same time. However, it should be noted that a script using only dataloading +is self contained and can be moved or shared accross different platforms without +fear. On the contrary, a script using only autoloading relies on some externally +provided files. Sharing this script among different platforms requires sharing +of these external files. The script itself cannot be redistributed without +also giving the extra files holding the autoloaded functions. +.PP +The major drawback with dataloading is that the DATA filehandle cannot be used +for anything else and may result in code duplication when two scripts could +share the same pieces of code. Autoloading appears as the perfect solution in +this case since two scripts may freely share the same functions without +actually duplicating them on the disk (hence saving some precious disk blocks +:-). +.SH CRITERIA +Functions to be dataloaded or autoloaded must meet the following layout +criteria: +.TP 5 +\- +They must not be one-line functions like \fIsub sorter { $a <=> $b }\fR. +Those functions are simply output verbatim, as they are already so +small that it would not be worth to dynamically load them, +.TP +\- +The first line must be of the form \fIsub routine_name {\fR, with an optional +comment allowed after the '{'. +.TP +\- +The function definition must end with a single '}' character left aligned. +.TP +\- +Package directives outside any function must be left aligned. +.PP +All the above restrictions should not be source of a problem if "standard" +writing style is used. There are also some name restrictions: the package +name \fIperload\fR is reserved, as is the \fI@AUTO\fR array when autoloading +is used. Packages must not start with \fIauto_\fR, as this is prepended to +user's package names when building the stubs. Furthermore, the subroutines +names \fImain'autoload\fR and +\fImain'dataload\fR must not be used by the original script. Again, these +should not cause any grief. +.SH DIRECTIVES +The translation performed by +.I Perload +is driven by some special comment directives placed directly within the code. +Ending those directives with a ':' character will actually prevent them from +being output into the produced script. Case is irrelevant for all the directives +and the comment need not be left-aligned, although it must be the first +non-space item on the line. +.PP +The following directives are available: +.TP 10 +# Perload ON +Turns on the \fIperload\fR processing. Any function definition which meets +the criteria listed in the previous section will be replaced by two stubs and +its actual definition will be rejected into the data segment (default) or a +file when inside an autoloading section. +.TP +# Perload OFF +Turns off any processing. The script is written as-is on the standard output. +.TP +# Autoload \fIpath\fR +Requests autoloading from file \fIpath\fR, which may be an absolute path or +a relative path. The file will be located at run-time using the @AUTO array +if a non-absolute path is supplied or if the file does not exist as listed. +Autoloading directives may be nested. +.TP +# Offload \fIpath\fR +The argument is not required. The directive ends the previous autoloading +directive (the inmost one). This does not turn off the \fIperload\fR processing +though. The \fIpath\fR name is optional here (in fact, it has only a comment +value). +.SH OPTIONS +Perload accepts only two options. Using \fB\-o\fR is meaningful only when +dataloading is used. It outputs an offset table which lists the relative +offset of the dataloaded functions within the data section. This will spare +perl the run-time parsing needed to locate the function, and results in an good +speed gain. However, it has one major drawback: it prevents people from +actually modifying the source beyond the start of the table. But anything +before can be freely edited, which is particulary useful when tailoring the +script. +.PP +This option should not be used when editing of functions within the data +section is necessary for whatever reason. When \fB\-o\fR is used, any +change in the dataloaded function must be committed by re-running perload +on the original script. +.PP +The other option \fB\-t\fR is to be used when producing a script which is +going to run setuid. The body of the loaded function is untainted before being +fed to eval, which slightly slows down loading (the first time the function is +called), but avoids either an insecure dependency report or weird warnings from +taintperl stating something is wrong (which is the behaviour with 4.0 PL35). +.SH FILES +.TP 10 +auto +the subdirectory where all produced autoloaded files are written. +.SH ENVIRONMENT +No environment variables are used by \fIperload\fR. However, the autoloaded +version of the script pays attention to the \fIAUTOLIB\fR variable as a colon +separated set of directories where the to-be-loaded files are to be found +when a non-absolute path was specified. If the \fIAUTOLIB\fR variable is not +set, the default value 'auto:.' is used (i.e. look first in the auto/ +subdirectory, then in the current directory. +.SH CAVEAT +Special care is required when using an autoloading script, especially when +executed by the super-user: it would be very easy for someone to leave a +special version of a routine to be loaded, in the hope the super-user (or +another suitable target) executes the autoloaded version of the script with +some \fIad hoc\fR changes... +.PP +The directory holding the to-be-loaded files should therefore be protected +against unauthorized access, and no file should have write permission on them. +The directory itself should not be world-writable either, or someone might +substitute his own version. +It should also be considered wise to manually set the @AUTO variable to a +suitable value within the script itself. +.PP +The \fB\-o\fR option uses \fIperl\fR's special variable \fI$/\fR with a +multi-character value. I suspect this did not work with versions of \fIperl\fR +prior to 4.0, so any script using this optimized form of dataloading will not +be 100% backward compatible. +.SH AUTHOR +Raphael Manfredi <ram@acri.fr> +.SH CREDITS +Valuable input came from Wayne H. Scott <wscott@ecn.purdue.edu>. He is +merely the author of the optimizing offset table (\fB\-o\fR option). +.PP +.I Perload +is based on an article from Tom Christiansen <tchrist@convex.com>, +.I Autoloading in Perl, +explaining the concept of dataloading and giving a basic implementation. +.SH "SEE ALSO" +perl(1). diff --git a/dist.man b/dist.man new file mode 100644 index 0000000..b1aed8f --- /dev/null +++ b/dist.man @@ -0,0 +1,317 @@ +''' $Id: dist.man,v 3.0.1.6 1995/05/12 11:57:53 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: dist.man,v $ +''' Revision 3.0.1.6 1995/05/12 11:57:53 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0.1.5 1994/10/29 15:46:03 ram +''' patch36: mentions new patlog script and ChangeLog file +''' +''' Revision 3.0.1.4 1994/05/06 13:54:17 ram +''' patch23: extended copyright notice to 1994 +''' patch23: new script kitpost +''' +''' Revision 3.0.1.3 1994/01/24 13:55:41 ram +''' patch16: documents profile and its components +''' +''' Revision 3.0.1.2 1993/11/10 17:31:03 ram +''' patch14: added mention for new confmagic.h file +''' +''' Revision 3.0.1.1 1993/08/24 12:12:00 ram +''' patch3: added entries for patnotify and patsnap +''' +''' Revision 3.0 1993/08/18 12:04:07 ram +''' Baseline for dist 3.0 netwide release. +''' +''' +.de Ex \" Start of Example +.sp +.in +5 +.nf +.. +.de Ef \" End of Example +.sp +.in -5 +.fi +.. +.TH DIST 1 ram +.SH NAME +dist \- introduction to dist +.SH DESCRIPTION +The \fIdist\fR package is a set of tools meant to ease the construction and +maintenance of portable software. There are four distinct parts in \fIdist\fR, +and it is also meant to be used with two external products, which are +publicly available: \fImailagent\fR and \fIpatch\fR. +.PP +The first component is the \fIConfigure\fR script generator, which is a +portability tool. It is automatically build up by \fImetaconfig\fR from your +sources and a set of units. Ideally, the end-user receiving your source code +will simply have to read your README file, run the \fIConfigure\fR script +(which is self-documented), and then run \fImake\fR. Your package should then +build cleanly on every UNIX platform. +.PP +The second component is the \fIMakefile.SH\fR generator, which is a generic +configured Makefile, reusing some of the information figured out by +.I Configure. +Although you may write your own Makefile and then use \fImakeSH\fR to transform +it into a \fIMakefile.SH\fR, it is better to write a generic \fIJmakefile\fR +description, which does not rely on a particular position within the source +tree, and then use \fIjmake\fR to recursively build your Makefiles. +.PP +The third component is the package generator, which is used when it's time +to build up the shell archives used to distribute your program. Although you +may use your own archiving mechanism, the one included here knows about RCS +files and will properly check out the lattest revisions, leaving your working +files alone. The \fImakedist\fR program will also perform Copyright expansion, +an useful feature when you share source files among more than one program, +placed under distinct Copyright information. +.PP +The fourth and latest component is the patch generator, used to make updates +of your sources, which can later be applied on the original distribution by +using the \fIpatch\fR program. +.PP +Before using any of the \fIdist\fR programs, you should probably identify your +package by running the \fIpackinit\fR program, which will create +a \fI.package\fR file in the top-level directory of your package. +.SH COMMANDS +The \fIdist\fR package implements the following commands (those +tagged as \fIlibrary\fR commands are to be found in the dist +library and should not be made publicly available in everyone's path): +.TP 15 +bindex +builds the \fIIndex\fR file (library). +.PD 0 +.TP +jmake +a Makefile.SH generator. +.TP +jmkmf +bootstraps top-level Makefile.SH file. +.TP +kitpost +posts distribution kits made by \fImakedist\fR. +.TP +kitsend +sends distribution kits made by \fImakedist\fR. +.TP +makeSH +wraps existing scripts into a .SH file. +.TP +makedist +builds up distribution kits. +.TP +makegloss +builds the \fIGlossary\fR file (library). +.TP +manicheck +checks MANIFEST.new accuracy +.TP +manifake +makes MANIFEST.new out of an existing MANIFEST. +.TP +manilist +builds MANIFEST.new reports. +.TP +metaconfig +a Configure script generator. +.TP +metalint +a metaconfig unit consistency checker. +.TP +metaxref +a metaconfig cross-reference builder. +.TP +packinit +initializes a package (creates a .package file). +.TP +pat +main patch generator. +.TP +patbase +resets patch base to current version. +.TP +patcil +checks new version in. +.TP +patclean +remove working version of up-to-date files. +.TP +patcol +checks file out. +.TP +patdiff +builds (contextual) diffs for the patch. +.TP +patftp +copies patches to public ftp directory. +.TP +patindex +builds a patch index. +.TP +patlog +handles ChangeLog file updates. +.TP +patmake +puts diffs together into a patch. +.TP +patnotify +notifies users that new patches have been released. +.TP +patpost +posts patch to some newsgroup. +.TP +patsend +mails patch to some people. +.TP +patsnap +builds a release snapshot with files and RCS revisions. +.PD +.SH PROFILE +Commands having a set of meaningful options (other +than \fB\-h\fR or \fB\-V\fR) can also take arguments from +the \fI~/.dist_profile\fR file, or whatever file the \fIDIST\fR +environment variable points to. Each line of the file is in the +format: +.Ex +profile-component: \fIvalue\fR +.Ef +whith shell-style comments (#) allowed provided they start the line. +.PP +Each command looks for a profile component entry matching its +name and loads the \fIvalue\fR as if it were arguments specified +on the command line. Those arguments precede any other argument +specified manually, in case order is meaningful. +.PP +Some commands may also be configured from within the profile, by setting +a specific \fIvariable\fR attached to the command by a profile +entry looking like this: +.Ex +cmdname-\fIvariable\fR: \fIvalue\fR +.Ef +For instance, assuming the variable \fIc-files\fR is recognized by the +\fImetaconfig\fR program, its default value could be overwritten by +this profile entry: +.Ex +metaconfig-c-files: \fIsuitable value\fR +.Ef +Only the first '-' after the command name is part of the syntax, the +other one used in the variable name is pure convention. Please refer to the +manual page of each command for a list of valid profile variables +which may be set. +.SH FILES +.PD 0 +.TP 15 +\&.MT +Temporary directory created by \fImetaconfig\fR and friends. +.TP +\&.newer +A list of files newer than \fIpatchlevel.h\fR, used by the patching tools. +.TP +\&.package +Main configuration file used by most of the dist tools to make them smart. +.TP +ChangeLog +The file where changes are recorded. Its name may be configured by +running \fIpackinit\fR, but this is the default "generic" name under +which it is referred to within the documentation. +.TP +Configure +The generated configuration script. +.TP +Glossary +A list of all the known portability symbols known by \fImetaconfig\fR. This +file is located in the dist library directory. +.TP +I.fui +Cross-reference file generated by \fImetaxref\fR, sorted by file, unit, item. +.TP +I.uif +Cross-reference file generated by \fImetaxref\fR, sorted by unit, item, file. +.TP +Index +A list of all the rules known by \fIjmake\fR. This file is located in the +dist library directory. +.TP +Jmakefile +Generic makefile description used by \fIjmake\fR. +.TP +MANIFEST +List of all the files to be included in the distribution. Usually a copy (not +a link) of MANIFEST.new. +.TP +MANIFEST.new +List of all the files to be taken into account by the dist tools. +.TP +Makefile.SH +The generated configured makefile (via Jmakefile) or hand-generated Makefile +making use of known metaconfig symbols. +.TP +Obsolete +A list of obsolete symbol used and their new equivalents. +.TP +RCS +Directory where RCS files are stored. +.TP +README +Main file explaining how to build your package. +.TP +U +Private unit directory. +.TP +Wanted +File used by \fImetaconfig\fR, listing all the symbols used by the sources. +.TP +bugs +Directory where patches are stored. +.TP +check.extra +Extra files present in MANIFEST.new, generated by \fImanicheck\fR. +.TP +check.want +Missing files from MANIFEST.new, generated by \fImanicheck\fR. +.TP +config_h.SH +Generated config.h template. +.TP +confmagic.h +Magic symbol remapping, activated via metaconfig's \fB\-M\fR option. +.TP +hints +This directory lists all the configuration hints for your package. +.TP +patchlevel.h +File recording your package patch level, should not be part of MANIFEST.new, +but may be listed in MANIFEST, at your discretion. +.TP +users +File recording the users of your package, generated by mailagent's \fIpackage\fR +command (see the MailAuthor.U unit and mailagent 3.0). +.PD +.SH ENVIRONMENT +The following environment variable is paid attention to: +.TP 15 +DIST +Location of the dist profile, defaults to ~/.dist_profile. This variable is +subject to ~name substitution, even if your shell does not support it. +.SH AUTHORS +By chronological order: +.sp +Larry Wall <lwall@netlabs.com> (dist 2.0 in 1988) +.br +Harlan Stenn <harlan@mumps.pfcs.com> (worked on dist 3.0 1990-1992) +.br +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> (dist 3.0 and +integration 1991-1995) +.sp +Please look at the \fICredits\fR file in the distribution source tree for a +list of all the known contributors. +.SH "SEE ALSO" +jmake(1), metaconfig(1), pat(1). diff --git a/install.SH b/install.SH new file mode 100755 index 0000000..6bf1a5c --- /dev/null +++ b/install.SH @@ -0,0 +1,216 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting install (with variable substitutions)" +$spitshell >install <<!GROK!THIS! +$startsh +# @(#) Installing script accepting bsd-style arguments + +# $Id: install.SH,v 3.0.1.1 1993/08/19 06:42:10 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: install.SH,v $ +# Revision 3.0.1.1 1993/08/19 06:42:10 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:08 ram +# Baseline for dist 3.0 netwide release. +# + +chown='$chown' +chmod='$chmod' +chgrp='$chgrp' +rm='$rm' +mv='$mv' +test='$test' +sed='$sed' +!GROK!THIS! +$spitshell >>install <<'!NO!SUBS!' + +mode="" +dst="" +src="" +dostrip="" +newdir="" +uid="" +gid="" + +# simulates mkdir -p +mkdir_p=' +name=$1; +create=""; +while $test $name; do + if $test ! -d "$name"; then + create="$name $create"; + name=`echo $name | $sed -e "s|^[^/]*$||"`; + name=`echo $name | $sed -e "s|\(.*\)/.*|\1|"`; + else + name=""; + fi; +done; +for file in $create; do + mkdir $file && $test $verbose && + echo "install: created directory $file" >&2; +done +' + +verbose='' + +while $test x$1 != x +do + case $1 in + -c) shift + continue + ;; + -m) mode="$2 " + shift + shift + continue + ;; + -o) uid="$2 " + shift + shift + continue + ;; + -g) gid="$2 " + shift + shift + continue + ;; + -s) dostrip="strip" + shift + continue + ;; + -d) newdir="$newdir$2 " + shift + shift + continue + ;; + -v) verbose='true' + shift + ;; + *) if $test x$src = x + then + src=$1 + else + dst=$1 + fi + shift + continue + ;; + esac +done + +# if -d option is used, we have to create the path given +if $test ! x$newdir = x +then + for i in $newdir + do + set x $i + shift + eval $mkdir_p + done + exit 0 # -d is the only action +fi + +if $test x$src = x +then + echo "install: no input file specified" >&2 + exit 1 +fi + +if $test x$dst = x +then + echo "install: no destination specified" >&2 + exit 1 +fi + +srcbase=`basename $src` +dstbase=`basename $dst` + +# If the destination is a directory, the target name is srcbase... +if $test -d $dst; then + dstbase=$srcbase +else + dst="`echo $dst | sed 's,^\(.*\)/.*$,\1,'`" + if $test ! -d $dst; then + dstbase=$dst + dst="." + fi +fi + +# If the src has a directory, extract the dir name... +if $test "$src" != "$srcbase" -a "$src" != "./$srcbase"; then + src="`echo $src | sed 's,^\(.*\)/.*$,\1,'`" +else + src="." +fi + +# dst is the destination directory and dstbase the base name. +# srcbase is the base name of source and src the source dir. + +srcpth=`(cd $src; pwd)`/$srcbase +destpth=`(cd $dst; pwd)`/$dstbase +if $test x$srcpth = x$destpth; then + $test $verbose && \ + echo "install: destination and source are identical" + exit 0 +fi + +# Do the install +( + cd $src + + if $test -f $dst/$dstbase; then + $rm -f $dst/$dstbase && $test $verbose && + echo "install: $dst/$dstbase removed" + fi + if $test -f $dst/$dstbase; then + $mv $dst/$dstbase $dst/OLD$dstbase && $test $verbose && + echo "install: $dst/$dstbase renamed as OLD$dstbase" + fi + + cp $srcbase $dst/$dstbase && $test $verbose && + echo "install: $srcbase installed as $dst/$dstbase" + + if $test ! x$dostrip = x; then + strip $dst/$dstbase 2>/dev/null && $test $verbose && + echo "install: stripped $dst/$dstbase" + fi + + if $test ! x$uid = x; then + $chown $uid $dst/$dstbase + fi + if $test ! x$gid = x; then + $chgrp $gid $dst/$dstbase + fi + if $test ! x$mode = x + then + $chmod $mode $dst/$dstbase + fi +) + +exit 0 +!NO!SUBS! +chmod 755 install +$eunicefix install diff --git a/jmake/Jmakefile b/jmake/Jmakefile new file mode 100644 index 0000000..5fdb3eb --- /dev/null +++ b/jmake/Jmakefile @@ -0,0 +1,57 @@ +/* + * Jmakefile for jmake + */ + +;# $Id: Jmakefile,v 3.0.1.2 1995/03/21 08:34:16 ram Exp $ +;# +;# Copyright (c) 1991-1993, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 3.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.2 1995/03/21 08:34:16 ram +;# patch52: now installs new fixcpp script in the private libdir +;# +;# Revision 3.0.1.1 1994/01/24 13:42:36 ram +;# patch16: added dependency generation stage +;# +;# Revision 3.0 1993/08/18 12:04:09 ram +;# Baseline for dist 3.0 netwide release. +;# + +AllTarget(Index) + +Index: bindex + chmod +x bindex + ./bindex + +ShellScriptTarget(jmake jmkmf) +SimpleShellScriptTarget(bindex fixcpp) + +>PRIVLIB /* We need the privlib definition */ + +MakeInstallDirectories($(PRIVLIB) $(PRIVLIB)/files) +InstallNonExec(Index,$(PRIVLIB)) +InstallScript(bindex,$(PRIVLIB)) +InstallScript(fixcpp,$(PRIVLIB)/files) +InstallMultipleFlags(files/Jmake*,$(PRIVLIB)/files,-m 444) + +BINSH = jmake.SH fixcpp.SH + +>SED +>RM +>MKDEP + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(BINSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + diff --git a/jmake/Makefile.SH b/jmake/Makefile.SH new file mode 100644 index 0000000..987b3ab --- /dev/null +++ b/jmake/Makefile.SH @@ -0,0 +1,271 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL51] +: $X-Id: Jmake.tmpl,v 3.0.1.2 1995/01/11 14:50:21 ram Exp ram $ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=jmake +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` + +$spitshell >Makefile <<!GROK!THIS! +######################################################################## +# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = .. +CURRENT = $CURRENT +DIR = $DIR +INSTALL = $INSTALL +INSTALLDIR = $INSTALLDIR + +######################################################################## +# Parameters set by Configure -- edit config.sh if changes are needed + +CTAGS = ctags +L = $manext +MANSRC = $installmansrc +MAKE = make +MKDEP = $mkdep \$(DPFLAGS) -- +MV = $mv +PRIVLIB = $installprivlib +RM = $rm -f +SCRIPTDIR = $installscript +SED = $sed + +######################################################################## +# Automatically generated parameters -- do not edit + +SCRIPTS = jmake jmkmf + +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.2 1995/01/11 14:49:55 ram Exp ram $ +######################################################################## +# Force 'make depend' to be performed first -- do not edit + +.FORCE_DEPEND:: + +all:: .FORCE_DEPEND + +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.2 1995/03/21 08:34:16 ram Exp ram $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.2 1995/03/21 08:34:16 ram +# patch52: now installs new fixcpp script in the private libdir +# +# Revision 3.0.1.1 1994/01/24 13:42:36 ram +# patch16: added dependency generation stage +# +# Revision 3.0 1993/08/18 12:04:09 ram +# Baseline for dist 3.0 netwide release. +# + +all:: Index + +local_realclean:: + $(RM) Index + +Index: bindex + chmod +x bindex + ./bindex + +all:: jmake jmkmf + +local_realclean:: + $(RM) jmake jmkmf + +jmake: jmake.SH + /bin/sh jmake.SH + +jmkmf: jmkmf.SH + /bin/sh jmkmf.SH + + +install:: $(SCRIPTS) $(LSCRIPTS) + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(INSTALL) -c -m 555 $$file $(SCRIPTDIR)); \ + done + +deinstall:: + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(RM) $(SCRIPTDIR)/$$file); \ + done + +install.man:: + @if test "$(MANSRC)"; then \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; \ + $(INSTALL) -c -m 444 $$file.man $(MANSRC)/$$file.$(L)); \ + done; \ + else exit 0; fi + +deinstall.man:: + @if test "$(MANSRC)"; then \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; $(RM) $(MANSRC)/$$file.$(L)); \ + done; \ + else exit 0; fi + +all:: bindex fixcpp + +local_realclean:: + $(RM) bindex fixcpp + +bindex: bindex.SH + /bin/sh bindex.SH + +fixcpp: fixcpp.SH + /bin/sh fixcpp.SH + + +install:: + @for dir in $(PRIVLIB) $(PRIVLIB)/files; do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $$dir || $(INSTALLDIR) $$dir); \ + done + +deinstall:: + $(RM) -r $(PRIVLIB) $(PRIVLIB)/files + +install:: Index + $(INSTALL) -c -m 444 Index $(PRIVLIB) + +deinstall:: + $(RM) $(PRIVLIB)/Index + +install:: bindex + $(INSTALL) -c -m 555 bindex $(PRIVLIB) + +deinstall:: + $(RM) $(PRIVLIB)/bindex + +install:: fixcpp + $(INSTALL) -c -m 555 fixcpp $(PRIVLIB)/files + +deinstall:: + $(RM) $(PRIVLIB)/files/fixcpp + +install:: files/Jmake* + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for i in files/Jmake*; do \ + (set -x; $(INSTALL) -c -m 444 $$i $(PRIVLIB)/files); \ + done + +deinstall:: + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for i in files/Jmake*; do \ + (set -x; $(RM) $(PRIVLIB)/files/$$i); \ + done + +BINSH = jmake.SH fixcpp.SH + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(BINSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: local_clean +realclean: local_realclean +clobber: local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + +local_clobber:: local_realclean + $(RM) Makefile config.sh + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; exit 0; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Empty rules for directories with no sub-directories -- do not edit + +install:: + @echo "install in $(CURRENT) done." + +deinstall:: + @echo "deinstall in $(CURRENT) done." + +install.man:: + @echo "install.man in $(CURRENT) done." + +deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." +Makefiles:: + +Makefiles.SH:: + +######################################################################## +# Dependencies generated by make depend +# DO NOT DELETE THIS LINE -- make depend relies on it + +# Put nothing here or make depend will gobble it up +.FORCE_DEPEND:: + @echo "You must run 'make depend' in $(TOP) first."; exit 1 +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/jmake/NOTES b/jmake/NOTES new file mode 100644 index 0000000..a11618d --- /dev/null +++ b/jmake/NOTES @@ -0,0 +1,189 @@ +The syntax in Jmake.rules is not elegant at all, but: + + - It is easy to parse (like sendmail.cf or troff files). + - The rules are not supposed to change very often. + - It is simple enough to be mastered in five minutes. :-) + +Here is a small description: + +o To deal with various cpp implementations: + +Final @!\ means: end of line, next line starts at the left margin. +Final @@\ means: end of line, next line is to be indented by one tab. + +The conversion occurs during Pass1. + + +o Symbol definitions + +>SYMBOL: defines the symbol (Pass 1). +?SYMBOL:<text>: keeps <text> iff SYMBOL is defined (Pass 2). +%SYMBOL:<text>: keeps <text> iff SYMBOL is not defined (Pass 2). + +The ?SYM can be nested (logical AND), as in: + + ?SYMBOL:%TOKEN:text /* Keeps text if SYMBOL and not TOKEN */ + +To implement a logical OR, see below. + + +o Commands + +Commands can be passed to 'jmake'. They start with a leading '|'. + +Available commands are: + +|suffix <sx>: adds <sx> to the .SUFFIXES: list in the makefile (Pass 1 & 2). +|rule:<text>: adds <text> to the building rule section (Pass 1 & 2). +|rule: <text>: same as before, with a leading tab. +|skip: skips text until a line starting with '-skip' is found (Pass 2). +|expand <pattern>: expand lines until '-expand' with <pattern> (Pass 2). +|once <symbol>: text up to '-once' appears only the first time (Pass 1). + +Thus, a way to implement a logical OR could be: + + /* Implements SYMBOL or not TOKEN */ + ?SYMBOL:text /* Keeps text if SYMBOL */ + %SYMBOL:|skip + %TOKEN:text /* Keeps text if not TOKEN */ + -skip + +Actually, this is ugly, because the text has to appear twice. +Fortunately, I did not use it. :-) + +The '|' commands cannot be nested. In particular, due to the simple +implementation of '|skip', it is impossible to put '|skip' inside +a skipped part. However, a '|once' section may have '|skip' sections. + +But actually, as you have surely already guessed, the best way to +implement a logical OR is to use De Morgan's Law: + + not (p or q) <=> not p and not q + + /* Implements SYMBOL or not TOKEN (attempt #2) */ + %SYMBOL:?TOKEN:|skip + text /* If SYMBOL or not TOKEN */ + -skip + +Who said they don't care ? ;-) + +o Expansion + +Expansion is done with the 'expand' command. It has been provided to +avoid some cumbersome writings in makefiles when you have to repeat some +silly lines that only differ in file names, for instance. Let's look at +an example first: + + |expand a!foo bar! b!yes no! + !a:: + echo !a, !b + -expand + +Then two rules will be printed, and the values of (a,b) for the first +will be (foo, yes), for the second (bar, no). Substitution is controled +by the '!' character. If the word to be substituted is part of another +one, detach with the ^^ construct as in: !b^^c. It is possible to +use Makefile macros in the <pattern>, and they will be expanded by +jmake. If this is not what you want, escape the first '$' sign (this is +a Makefile escape, i.e. you must double the '$', not precede it with a +backslash). A // stands for the null substitution value. + +Here is another example which shows how the macro Expand can be used. +It is defined in Jmake.rules as: + + #define Expand(rule, pattern) @!\ + |expand pattern @!\ + rule @!\ + -expand + +So we can write in the Jmakefile: + + |skip + A = foo bar + -skip + + #define Rule @!\ + $(DIR)/!a^^.o: !a^^.o @@\ + $(CC) -c !a^^.c @@\ + $(MV) !a^^.o $(DIR) + + Expand(Rule, a!$(A)!) + +which will generate in Makefile.SH: + + $(DIR)/foo.o: foo.o + $(CC) -c foo.c + $(MV) foo.o $(DIR) + + $(DIR)/bar.o: bar.o + $(CC) -c bar.c + $(MV) bar.o $$(DIR) + +The 'A' declaration has been surrounded by skip, so that it does +not appear in the generated Makefile.SH, but it will be taken into +account by jmake for the substitution in the pattern. + +The number of expansions is determined by the number of possible +values for the _first_ parameter. If other parameters have less +substitution values, they will get void ones. + +It is possible to add a regular expression at the end of '-expand'. +This regular expression will be removed from the final set of expansion +at the end of each line. It is also possible to do substitutions in the +expanded item, by using the syntax (if 'f' is the expanded variable) +!f:<p>=<q> where <p> and <q> are two regular expressions (without +spaces). The pattern <p> will be replaced by pattern <q> (only the +first occurrence will be replaced). + +Finally, you may refer in the expanded section to variables whose value +is computed via another expansion, which makes it easy to define generic +Jmakefiles. + +Example: + + SRC = foo.c bar.c + OBJ = \ + |expand f!$(SRC)! + !f:\.c=\.o \ + -expand \\ + INC = \ + |expand f!$(OBJ)! + !f:\.o=\.h \ + -expand \\ + +which will generate in Makefile.SH: + + SRC = foo.c bar.c + OBJ = \ + foo.o \ + bar.o + INC = \ + foo.h \ + bar.h + +Do not forget to protect special characters in your regular expressions such +as backslash, point, etc... + +o Once + +The once command is tagged with a name. The first time the name appears, +the once construct is ignored and the text up to '-once' will be copied +in the generated Makefile.SH. However, future occurences of the same +name will be ignored (once will behave like skip). + +Example: + + |once this_is_a_name + <text> + -once + +o Initializations + ++<line>: Puts the whole line in the initialization section (Pass 1 & 2). +++SYMBOL <value>: Adds <value> to the SYMBOL macro (Pass 1 and 2). + +o User-defined variables + +CFLAGS: added flags to C compiler +DPFLAGS: cpp flags to be added to mkdep for dependency +LDFLAGS: flags/libraries to be added at linking stage diff --git a/jmake/README b/jmake/README new file mode 100644 index 0000000..636cc8f --- /dev/null +++ b/jmake/README @@ -0,0 +1,70 @@ +This is the root directory for jmake. + +The jmake program is a Makefile generator. It comes from 'imake' one +may find in the X11R4 distribution, but it produces a Makefile.SH +instead of a Makefile. Jmake has a template which knows some metaconfig +symbols and has built-in commands which make it more powerful than imake. + +The jmkmf script may be used to produce the Makefile.SH from a Jmakefile. +Once the bootstrap is done, you can run 'make Makefile.SH' to rebuild the +Makefile.SH in the current directory, or 'make Makefiles.SH' to build the +Makefiles in a recursive manner. + +All the rules used by jmake are listed in an automatically built index. +The jmake's cryptic syntax is documented in file NOTES. You may also +have a look at the sample Jmakefiles that come with this package. +Usually, you do not include them in the release, but I kept them so +that you may have a real example and see how things are organized. + +If you choose to use jmake, then you will have to use metaconfig, in +order to get a meaningful value for all the needed symbol. Thus, each +time you change your Jmakefiles, it may be necessary to update the +Configure script. + +Here is how to use jmake... + +First, you have to write a Jmakefile for each directory where you want +to put a Makefile. Be sure to declare all the sub-directories with the +SetSubdirs rule. Usually, the order of the rules is not significant, +but you should make sure the Makefile begins with an 'all::' target, +so that a default 'make' does not run a clean for instance. + +Then, if this is the first time, you have to bootstrap. Go to the main +directory of your package and run: + + jmkmf + make Makefiles.SH + +which will first produce the main makefile and then recursively build +all the makefiles. + +Once you have bootstrapped once, you can edit a Jmakefile and rebuild +the local makefile with + + make Makefile + +or all the hierachy below with: + + make Makefiles.SH + +If you want to extract all the makefiles, you may run + + sh Makefile.SH + make Makefiles + +in the top-level directory. Finally, if you only want to test the +generated Makefile.SH without disturbing the Makefile, run + + make Makefile.SH + +which will stop before running the produced file through sh. + + +CAUTION: + +On machines whose cpp eats up tabs in macro expansion, the Makefile.SH +produced might not be indented properly inside rules. + +Perl 4.0 PL10 sometimes dumps core, while PL3 does not. Thus, perl 4.0 +PL10 should NOT be used with jmake, at least on a MIPS. + diff --git a/jmake/bindex.SH b/jmake/bindex.SH new file mode 100755 index 0000000..b665600 --- /dev/null +++ b/jmake/bindex.SH @@ -0,0 +1,184 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting bindex (with variable substitutions)" +$spitshell >bindex <<!GROK!THIS! +$startperl +!GROK!THIS! +$spitshell >>bindex <<'!NO!SUBS!' + eval 'exec perl -S $0 "$@"' + if $runnning_under_some_shell; + +# $Id: bindex.SH,v 3.0.1.1 1993/08/19 06:42:12 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: bindex.SH,v $ +# Revision 3.0.1.1 1993/08/19 06:42:12 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:13 ram +# Baseline for dist 3.0 netwide release. +# + +$file = "files/Jmake.rules"; + +open(INDEX, ">Index") || die "Cannot create Index.\n"; +open(RULES, "$file") || die "Cannot open $file.\n"; + +print INDEX +"[This Index is automatically generated from Jmake.rules file. Do not +edit this file or your changes will be lost. Edit Jmake.rules instead.] + +This file contains a listing of all the macros that can be used in a +Jmakefile. Only a few of these should be used in the Jmakefile (they +are the top-level macros). However, some low-level ones may be useful, +but it is up to you to make that decision. This explains why this file +holds all the available macros for jmake. + +In the following listing, the macros are separated by a line of dashes. +The signature of the macro is given, then a small comment of what it +does precedes the actual definition. + +Lines preceded by '->' show the set of symbols defined when the macro is +used. Initialization lines are shown as-is, i.e. have the form SYM = val +while concatenation is shown by SYM += val (which means val is added to +the value of SYM). + +Conditional lines are preceded by tests like (if SYM). This means the line +is to be kept if and only if the symbol SYM is defined. Other internal +requests are not formatted yet. + +"; +$inrule = 0; # Not inside a rule at the beginning +$incomment = 0; # Not inside a comment +$last_was_text = 0; # Last line was not a rule text +while (<RULES>) { + $inrule || next unless /^\s\*\s(\w+)\s*:/; + if ($inrule) { # We are already in a rule + if ($incomment) { + if (m|^\s*\*/|) { # End of comment + $incomment = 0; + $Comment{$current} .= "\n"; + } else { + s/^\s*\*\s*//; # Remove leading comment sign + $Comment{$current} .= " $_"; + } + next; # Anyway, go to next line + } + if (/^\s*$/) { # Empty line = end of rule + $inrule = 0; + next; + } + # Here, we have to print the body of the rule, after some cleaning + s/(@#|@@|@!)\\$//; # Remove final continuations + s/^(#define.*)\\/$1/; # Remove single '\' on first rule line + s/\|rule:\s*$/\n/; + s/\|rule:\s+/ /; # Remove rule markers + s/\|rule://; + s/%(\w+):\|skip/#ifdef $1/; # Deal with ugly skip syntax + s/\?(\w+):\|skip/#ifndef $1/; # Deal with ugly skip syntax + s/\-skip/#endif/; + s/\?(\w+):/(if $1) /; # Simple '?' test + s/%(\w+):/(not $1) /; # Simple '%' test + s/\|suffix/.SUFFIXES:/; # Make suffix command explicit + s/\t/ /g; # Expand all tabs to 4 chars + s/\s*$/\n/; # Remove any trailing space + s|\^\^|/**/|; # Restore ^^ to the more visual /**/ + if (/^$/) { # If empty line + $Index{$current} .= "\n" if $last_was_text; + $last_was_text = 0; + next; + } + if (/^[>+]/) { # Special commands + if (s/^>\s*//) { # Wanted symbol + chop; + $Wants{$current} .= " $_"; + } elsif (/^\+\+\s*(\S+)\s*(.*)/) { # Added symbol + $Added{$current} .= "\t$1 += $2\n"; + } else { + s/^\+\s*(.*)//; + $Init{$current} .= "\t$1\n"; + } + next; + } + if (s/^#define\s+//) { # Definition of the rule + chop; + $Sig{$current} = $_; # Signature of rule + } else { + $Index{$current} .= " $_"; # Rule's body + $last_was_text = 1; + } + } else { # We've just entered a rule + $current = $1; + next if $current =~ /patch\d/; # Skip RCS log messages + $inrule = 1; + $incomment = 1; # We're still in the leading comment + $Seen{$current} = 1; + $last_was_text = 0; + } +} +close RULES; + +# Now sort the rules in alphabetical order + +print INDEX '-' x 72, "\n"; +foreach $rule (sort(keys %Seen)) { + print INDEX "$Sig{$rule}:\n"; + print INDEX $Comment{$rule}; + $line = $Wants{$rule}; + if (length($line)) { + $line = "->$line."; + $line = do format($line); + print INDEX "$line\n"; + } + $line = $Init{$rule}; + print INDEX "$line\n" if length($line); + $line = $Added{$rule}; + print INDEX "$line\n" if length($line); + $line = $Index{$rule}; + print INDEX $line; + print INDEX "\n" if (length($line)); + print INDEX '-' x 72, "\n"; +} + +close INDEX; + +# Format $_ to fit in 80 columns (70 + size of tabs) +# Long lines are split, and the all but the first are indented +# by two leading spaces. The whole thing is then indented by +# one tab. +sub format { + local($tmp); + local($head) = ''; + local($_) = shift(@_); + while (length($_) > 70) { + $tmp = substr($_,0,70); + $tmp =~ s/^(.*) .*/$1/; + $head .= "\t$tmp\n"; + $_ = ' ' . substr($_,length($tmp),9999); + } + $head .= "\t$_\n"; +} +!NO!SUBS! +chmod 755 bindex +$eunicefix bindex diff --git a/jmake/files/Jmake.rules b/jmake/files/Jmake.rules new file mode 100644 index 0000000..410fbc8 --- /dev/null +++ b/jmake/files/Jmake.rules @@ -0,0 +1,1902 @@ +;######################################################################## +;# Jmake rules for building libraries, programs, scripts, and data files +;# $Id: Jmake.rules,v 3.0.1.6 1997/02/28 14:56:01 ram Exp $ + +/* + * MACHINE-INDEPENDENT RULES -- DO NOT MODIFY + */ + +/* $Id: Jmake.rules,v 3.0.1.6 1997/02/28 14:56:01 ram Exp $ + * + * Copyright (c) 1991-1993, Raphael Manfredi + * + * You may redistribute only under the terms of the Artistic Licence, + * as specified in the README file that comes with the distribution. + * You may reuse parts of this distribution only within the terms of + * that same Artistic Licence; a copy of which may be found at the root + * of the source tree for dist 3.0. + * + * $Log: Jmake.rules,v $ + * Revision 3.0.1.6 1997/02/28 14:56:01 ram + * patch61: now handles USRINC for dependencies + * patch61: smarter about dependencies computation + * + * Revision 3.0.1.5 1995/09/25 09:07:19 ram + * patch59: smarter sed command to strip /usr/include dependencies + * + * Revision 3.0.1.4 1995/07/25 13:33:59 ram + * patch56: install of script man pages can now cope with missing files + * patch56: the clobber target now removes the .config directory as well + * + * Revision 3.0.1.3 1995/03/21 08:35:28 ram + * patch52: suppressed extra argument to NormalProgramTarget call + * + * Revision 3.0.1.2 1995/01/11 14:49:55 ram + * patch45: new macros ShellScriptTargetExt and SimpleShellScriptTargetExt + * patch45: directory installation is now made via INSTALLDIR (Configure) + * + * Revision 3.0.1.1 1994/10/29 15:46:30 ram + * patch36: added RemoteDependency rule + * + * Revision 3.0 1993/08/18 12:04:14 ram + * Baseline for dist 3.0 netwide release. + * + */ + +/* Please, edit only with tabstops = 4 (":set ts=4" under vi) */ + +/* + * AddedByConfigure: + * Gives name of the files generated by Configure that can safely + * be removed when a "make clobber" is issued. Not that it is useless + * to name config.h or config.sh because these are already taken care + * of by jmake. + */ +#define AddedByConfigure(files) @!\ +>RM @!\ +local_clobber:: @@\ + $(RM) files + +/* + * AddSuffix: + * Adds a sufix to the .SUFFIXES: list. + */ +#define AddSuffix(ext) @!\ +|suffix ext + + +/* + * AllTarget: + * Generate rules to build necessary things during make all. + */ +#define AllTarget(depends) @!\ +>RM @!\ +all:: depends @!\ + @!\ +local_realclean:: @@\ + $(RM) depends + +/* + * RemoveTargetProgram: + * This is used in some other macros in order to remove the target + * before starting its building (saves disk space). There should be + * no '@!' at the end of the '#define' line, because this macro is + * used *inside* building rules. + */ +#define RemoveTargetProgram(program) \ +>RM @!\ +>MV @@\ + $(RM) program @@\ + if test -f program; then $(MV) program program^^~; else exit 0; fi + +/* + * NormalProgramTarget: + * Generate rules to compile and link the indicated program; since + * it does not use any default object files, it may be used for + * multiple programs in the same Jmakefile. + */ +#define NormalProgramTarget(program,sources,objects) @!\ +>CC @!\ +>RM @!\ +>JLDFLAGS @!\ +>LIBS @!\ +++OBJECTS objects @!\ +++SOURCES sources @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: objects @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ objects $(JLDFLAGS) $(LIBS) @!\ + + +/* + * SingleProgramTarget: + * Obsolete version of NormalProgramTarget that doesn't have + * deplibs. + */ +#define SingleProgramTarget(program,objects,libs) \ +NormalProgramTarget(program,objects,libs) + +/* + * SimpleProgramTarget: + * Generate rules for compiling and linking programs that only have + * one C source file. It should only be used in Jmakefiles that + * describe a single program. + */ +#define SimpleProgramTarget(program) @!\ +NormalProgramTarget(program,program.c,program.o) + + + +/* + * ComplexProgramTarget: + * Generate rules for compiling and linking the program specified by + * $(OBJS) and $(SRCS), installing the program and its man page, and + * generating dependencies. It should only be used in Jmakefiles + * that describe a single program. + */ +#define ComplexProgramTarget(program) @!\ +>CC @!\ +>JLDFLAGS @!\ +>LIBS @!\ +>BINDIR @!\ +>MANSRC @!\ +++OBJECTS $(OBJS) @!\ +++SOURCES $(SRCS) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) @!\ +DependTarget() @!\ +LintTarget() + + +/* + * ComplexProgramTarget_1: + * Generate rules for compiling and linking the program specified by + * $(OBJS1) and $(SRCS1), installing the program and its man page, + * and generating dependencies for it and any programs described by + * $(SRCS2) and $(SRCS3). It should be used to build the primary + * program in Jmakefiles that describe multiple programs. + */ +#define ComplexProgramTarget_1(program) @!\ +>CC @!\ +>JLDFLAGS @!\ +>LIBS @!\ +>BINDIR @!\ +>MANSRC @!\ +++OBJECTS $(OBJS1) @!\ +++SOURCES $(SRCS1) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS1) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS1) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) @!\ + @!\ +DependTarget() @!\ +LintTarget() + + +/* + * ComplexProgramTarget_2: + * Generate rules for compiling and linking the program specified by + * $(OBJS2) and $(SRCS2) and installing the program and man page. + * It should be used to build the second program in Jmakefiles + * describing more than one program. + */ +#define ComplexProgramTarget_2(program) @!\ +>CC @!\ +>JLDFLAGS @!\ +>LIBS @!\ +>BINDIR @!\ +>MANSRC @!\ +++OBJECTS $(OBJS2) @!\ +++SOURCES $(SRCS2) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS2) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS2) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) + + +/* + * ComplexProgramTarget_3: + * Generate rules for compiling and linking the program specified by + * $(OBJS3) and $(SRCS3) and installing the program and man page. It + * should be used to build the third program in Jmakefiles describing + * more than one program. + */ +#define ComplexProgramTarget_3(program) @!\ +>CC @!\ +>JLDFLAGS @!\ +>LIBS @!\ +>BINDIR @!\ +>MANSRC @!\ +++OBJECTS $(OBJS3) @!\ +++SOURCES $(SRCS3) @!\ +NormalObjectRule() @!\ +AllTarget(program) @!\ + @!\ +program: $(OBJS3) @@\ + RemoveTargetProgram($@) @@\ + $(CC) -o $@ $(OBJS3) $(JLDFLAGS) $(LIBS) @!\ + @!\ +InstallProgram(program,$(BINDIR)) @!\ +InstallManPage(program,$(MANSRC)) + + +/* + * ComplexShellManualTarget: + * Builds manual pages that are to be extracted from .SH files into + * .$manext files. + */ +#define ComplexShellManualTarget(manpages) @!\ +>INSTALL @!\ +>MANSRC @!\ +>RM @!\ +++MANPAGE manpages @!\ +|once _ShellManualRule_ @!\ +|rule:.SH.$manext: @!\ +|rule: /bin/sh $< @!\ +|rule: @!\ +-once @!\ +AddSuffix(.SH) @!\ +AddSuffix(.$manext) @!\ +AllTarget(manpages) @!\ + @!\ +install.man:: @@\ + @if test "$(MANSRC)"; then \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for file in manpages; do \ @@\ + (set -x; $(INSTALL) -c -m 444 $$file $(MANSRC)); \ @@\ + done; \ @@\ + else exit 0; fi @!\ + @!\ +deinstall.man:: @@\ + @if test "$(MANSRC)"; then \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for file in manpages; do \ @@\ + (set -x; $(RM) $(MANSRC)/$$file); \ @@\ + done; \ @@\ + else exit 0; fi + + +/* + * Initialize: + * Puts the line symbol = value in the initialization section of + * Makefile.SH (the one that is subject to parameter substitutions). + */ +#define Initialize(symbol,value) @!\ ++symbol = value + + +/* + * InstallLibrary: + * Generate rules to install the indicated library. + */ +#define InstallLibrary(libname,dest) @!\ +>RANLIB @!\ +>INSTALL @!\ +>RM @!\ +install:: lib^^libname.a @@\ + $(INSTALL) -c -m 644 lib^^libname.a dest @@\ + $(RANLIB) dest/lib^^libname.a @@\ + chmod 444 dest/lib^^libnane.a @!\ + @!\ +deinstall:: @@\ + $(RM) dest/lib^^libname.a + + +/* + * InstallSharedLibrary: + * Generate rules to install the shared library. + */ +#define InstallSharedLibrary(libname,rev,dest) @!\ +>INSTALL @!\ +>RM @!\ +install:: lib^^libname.so.rev @@\ + $(INSTALL) -c -m 444 lib^^libname.so.rev dest @!\ + @!\ +deinstall:: @@\ + $(RM) dest/lib^^libname.so.rev + + +/* + * InstallSharedLibraryData: + * Generate rules to install the shared library data + */ +#define InstallSharedLibraryData(libname,rev,dest) @!\ +>INSTALL @!\ +>RM @!\ +install:: lib^^libname.sa.rev @@\ + $(INSTALL) -c -m 444 lib^^libname.sa.rev dest @!\ + @!\ +deinstall:: @@\ + $(RM) dest/lib^^libname.sa.rev + + +/* + * InstallLibraryAlias: + * Generate rules to create a link from one library name to another + * for the purposes of aliasing. + */ +#define InstallLibraryAlias(libname,alias,dest) @!\ +>LN @!\ +>RM @!\ +install:: lib^^libname.a @@\ + $(RM) lib^^alias.a @@\ + -(cd dest; $(LN) lib^^libname.a lib^^alias.a) @!\ + @!\ +deinstall:: @@\ + $(RM) dest/lib^^alias.a + + +/* + * InstallLintLibrary: + * Generate rules to install the indicated lint library. + */ +#define InstallLintLibrary(libname,dest) @!\ +>INSTALL @!\ +>RM @!\ +install.ln:: llib-l^^libname.ln @@\ + $(INSTALL) -c -m 444 llib-l^^libname.ln dest @!\ + @!\ +deinstall.ln:: @@\ + $(RM) dest/llib-l^^libname.ln + + +/* + * InstallManPageLong: + * Generate rules to install the indicated manual page, giving it an + * alternate name. This is used for installing man pages whose base + * name without the .man suffix would normally be longer than 8 + * characters (the limit for using source code control systems on + * files systems with short file names). + */ +#define InstallManPageLong(file,destdir,dest) @!\ +>L @!\ +>INSTALL @!\ +>RM @!\ +install.man:: file.man @@\ + $(INSTALL) -c -m 444 file.man destdir/dest.$(L) @!\ + @!\ +deinstall.man:: @@\ + $(RM) destdir/dest.$(L) @!\ + + +/* + * InstallManPage: + * Generate rules to install the indicated manual page. + */ +#define InstallManPage(file,dest) @!\ +InstallManPageLong(file,dest,file) + + +/* + * InstallNonExec: + * Generate rules to install a data file using any special + * install flags. + */ +#define InstallNonExec(file,dest) @!\ +>INSTALL @!\ +>RM @!\ +install:: file @@\ + $(INSTALL) -c -m 444 file dest @!\ + @!\ +deinstall:: @@\ + $(RM) dest/file + + +/* + * InstallProgramWithFlags: + * Generate rules to install an executable program using given + * install flags. + */ +#define InstallProgramWithFlags(program,dest,flags) @!\ +>INSTALL @!\ +>RM @!\ +install:: program @@\ + $(INSTALL) -c -s -m 555 flags program dest @!\ + @!\ +deinstall:: @@\ + $(RM) dest/program + + +/* + * InstallProgram: + * Generate rules to install an executable program using any special + * install flags set in $(INSTALLFLAGS). + */ +#define InstallProgram(program,dest) @!\ +InstallProgramWithFlags(program,dest,^^) + + +/* + * InstallScriptWithFlags: + * Generate rules to install an executable script using given + * install flags. + */ +#define InstallScriptWithFlags(script,dest,flags) @!\ +>INSTALL @!\ +>RM @!\ +install:: script @@\ + $(INSTALL) -c -m 555 flags script dest @!\ + @!\ +deinstall:: @@\ + $(RM) dest/script + + +/* + * InstallScript: + * Generate rules to install an executable script using any special + * install flags set in $(INSTALLFLAGS). + */ +#define InstallScript(script,dest) @!\ +InstallScriptWithFlags(script,dest,^^) + + +/* + * InstallScripts: + * Generate rules to install all the scripts listed in the generated + * $(SCRIPTS) and $(LSCRIPTS) macros. + */ +#define InstallScripts() @!\ +>SCRIPTDIR @!\ +>INSTALL @!\ +>RM @!\ +|once _InstallScripts_ @!\ +install:: $(SCRIPTS) $(LSCRIPTS) @@\ + @for file in $(SCRIPTS) $(LSCRIPTS); do \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + (set -x; $(INSTALL) -c -m 555 $$file $(SCRIPTDIR)); \ @@\ + done @!\ + @!\ +deinstall:: @@\ + @for file in $(SCRIPTS) $(LSCRIPTS); do \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + (set -x; $(RM) $(SCRIPTDIR)/$$file); \ @@\ + done @!\ +-once + +/* + * InstallManScripts: + * Generate rule to install/deinstall manual pages for scripts listed + * in the automatically generated $(SCRIPTS) macro. + */ +#define InstallManScripts() @!\ +>RM @!\ +>INSTALL @!\ +>MANSRC @!\ +>L @!\ +|once _InstallManScripts_ @!\ +?NOMAN:|skip @!\ +install.man:: @@\ + @if test "$(MANSRC)"; then \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for file in $(SCRIPTS); do \ @@\ + if test -f $$file.man; then \ @@\ + (set -x; \ @@\ + $(INSTALL) -c -m 444 $$file.man $(MANSRC)/$$file.$(L)); \ @@\ + fi; \ @@\ + done; \ @@\ + else exit 0; fi @!\ + @!\ +deinstall.man:: @@\ + @if test "$(MANSRC)"; then \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for file in $(SCRIPTS); do \ @@\ + (set -x; $(RM) $(MANSRC)/$$file.$(L)); \ @@\ + done; \ @@\ + else exit 0; fi @!\ + @!\ +-skip @!\ +-once + + + +/* + * LinkFileList: + * Link a list of list of files from one place to another + */ +#define LinkFileList(step,list,dir,sub) @!\ +>LN @!\ +step:: list @@\ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + echo " cd" dir; cd dir; for i in list; do (set -x; $(LN) sub/$$i .); done + + +/* + * InstallMultipleDestFlags: + * Generate rules to install multiple files at once during a particular + * step in the build using a specific set of install flags. The `step' + * must begin with "install". + */ +#define InstallMultipleDestFlags(step,list,dest,flags) @!\ +>INSTALL @!\ +>RM @!\ +step:: list @@\ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for i in list; do \ @@\ + (set -x; $(INSTALL) -c flags $$i dest); \ @@\ + done @!\ + @!\ +de^^step:: @@\ + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + for i in list; do \ @@\ + (set -x; $(RM) dest/$$i); \ @@\ + done + + +/* + * InstallMultipleDest: + * Generate rules to install multiple files at once during a particular + * step in the build using any install flags set in $(INSTALLFLAGS). + */ +#define InstallMultipleDest(step,list,dest) @!\ +InstallMultipleDestFlags(step,list,dest,$(INSTALLFLAGS)) + +/* + * InstallMultiple: + * Generate rules to install multiple files at once during the install + * step of the build using any install flags set in $(INSTALLFLAGS). + */ +#define InstallMultiple(list,dest) @!\ +InstallMultipleDest(install,list,dest) + + +/* + * InstallMultipleFlags: + * Generate rules to install multiple files at once during the + * install step of the build using the given install flags. + */ +#define InstallMultipleFlags(list,dest,flags) @!\ +InstallMultipleDestFlags(install,list,dest,flags) + + +/* + * InstallMultipleMan: + * Generate rules to install a variety of manual pages + * during the install.man step of the build. + */ +#define InstallMultipleMan(list,dest) @!\ +>L @!\ +InstallMultipleDest(install.$(L),list,dest) + + +/* + * DependDependency: + * Generate rules to build the makedepend program. + */ +#define DependDependency() @!\ +depend:: TOPDIR/mkdep @!\ + @!\ +TOPDIR/mkdep: @!\ +?TOP: @echo "You have to run Configure first."; exit 1 @!\ +%TOP: @echo "You have to run Configure in $(TOP) first."; exit 1 + + +/* + * DependTarget: + * Generate rules to compute dependencies for all files listed + * in $(SOURCES) (automatically generated macro). + */ +#define DependTarget() @!\ +>MKDEP @!\ +>SED @!\ +>RM @!\ ++USRINC = $usrinc @!\ +|once _DependTarget_ @!\ +DependDependency() @!\ + @!\ +depend:: @@\ + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ @@\ + $(MKDEP) $(SOURCES) | \ @@\ + $(SED) -e 's:/usr/include[^ ]*::g; s:$(USRINC)[^ ]*::g; ' \ @@\ + -e '/: / b print' -e 'H; d; n; : print' -e 'x; s/\\\n//g' \ @@\ + -e 's/ ^^ */ /g; s/ :/:/;' -e '/: *$$/d' \ @@\ + ) > Makefile.new @@\ + cp Makefile Makefile.bak @@\ + cp Makefile.new Makefile @@\ + $(RM) Makefile.new @!\ + @!\ +-once + + +/* + * CleanTarget: + * Generate rules to remove any garbage files. + */ +#define CleanTarget() @!\ +>RM @!\ +?SUBDIRS:clean: sub_clean local_clean @!\ +%SUBDIRS:clean: local_clean @!\ +?SUBDIRS:realclean: sub_realclean local_realclean @!\ +%SUBDIRS:realclean: local_realclean @!\ +?SUBDIRS:clobber: sub_clobber local_clobber @!\ +%SUBDIRS:clobber: local_clobber @!\ + @!\ +local_clean:: @@\ + $(RM) core *~ *.o @!\ + @!\ +local_realclean:: local_clean @!\ +?TOP: $(RM) -r UU @!\ + @!\ +local_clobber:: local_realclean @!\ +%TOP: $(RM) Makefile config.sh @!\ +?TOP: $(RM) config.sh config.h @!\ +?TOP: $(RM) -r .config @!\ +?TOP: $(RM) Makefile @!\ + + +/* + * TagsTarget: + * Generate rules to compute tags files for C source code. + */ +#define TagsTarget() @!\ +>CTAGS @!\ +>RM @!\ +tags:: @@\ + $(CTAGS) -w *.[ch] @@\ + $(CTAGS) -xw *.[ch] > tags @!\ + @!\ +local_clobber:: @@\ + $(RM) tags + + + +/* + * BuildMakefileSH: + * Generate rules to build a Makefile.SH from an Jmakefile and any + * special jmake flags. This is generally done automatically by the + * template or by any special Jmakefiles. + * This function will simply touch Makefile.SH if no $(TOP)/.package + * exists, assuming the Jmakefile is not in a production environment. + */ +#define BuildMakefileSH(jmakeflags) @!\ +>RM @!\ +>MV @!\ +Makefile.SH: Jmakefile @@\ + -@if test -f $(TOP)/.package; then \ @@\ + if test -f Makefile.SH; then \ @@\ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ @@\ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ @@\ + fi; \ @@\ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" jmakeflags; \ @@\ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) jmakeflags; \ @@\ + else touch $@; exit 0; fi + + +/* + * BuildMakefile: + * Generate rules to build a Makefile from a Makefile.SH. + */ +#define BuildMakefile() @!\ +Makefile: Makefile.SH @@\ + /bin/sh Makefile.SH + + +/* + * MakefileTarget: + * Generate rules to build a normal Makefile. + */ +#define MakefileTarget() @!\ +BuildMakefileSH(^^) @!\ +BuildMakefile() + + +/* + * NormalObjectRule: + * Generate make rule to build usual object files. + */ +#define NormalObjectRule() @!\ +>CC @!\ +>JCFLAGS @!\ +|once _ObjectRule_ @!\ +|rule:.c.o: @!\ +|rule: $(CC) -c $(JCFLAGS) $< @!\ +|rule: @!\ +-once + +/* + * NormalLibraryObjectRule: + * Generate make rules to build "normal" objects. + */ +#define NormalLibraryObjectRule() @!\ +>CC @!\ +>JCFLAGS @!\ +>RM @!\ +|once _ObjectRule_ @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ @!\ +|rule: $(CC) -c $(JCFLAGS) $< @!\ +|rule: @!\ +-once + +/* + * ProfiledLibraryObjectRule: + * Generate make rules to build both profiled and "normal" objects. + */ +#define ProfiledLibraryObjectRule() @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ profiled/$@ @!\ +|rule: $(CC) -pg -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o profiled/$*.o @!\ +|rule: $(CC) -c $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ + $(RM) profiled/?*.o; else exit 0; fi + + +/* + * DebuggedLibraryObjectRule: + * Generate make rules to build both debuggable and "normal" + * objects. + */ +#define DebuggedLibraryObjectRule() @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ debugger/$@ @!\ +|rule: $(CC) -g -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o debugger/$*.o @!\ +|rule: $(CC) -c $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ + $(RM) debugger/?*.o; else exit 0; fi + + +/* + * DebuggedAndProfiledLibraryOjbectRule: + * Generate make rules to build debuggable, profiled, and "normal" + * objects. + */ +#define DebuggedAndProfiledLibraryObjectRule() @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ profiled/$@ debugger/$@ @!\ +|rule: $(CC) -pg -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o profiled/$*.o @!\ +|rule: $(CC) -g -c $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o debugger/$*.o @!\ +|rule: $(CC) -c $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ + $(RM) profiled/?*.o; else exit 0; fi @@\ + -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ + $(RM) debugger/?*.o; else exit 0; fi + + +/* + * SharedLibraryObjectRule: + * Generate make rules to build shared and "normal" object files. + */ +#define SharedLibraryObjectRule() @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ shared/$@ @!\ +|rule: $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o shared/$*.o @!\ +|rule: $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ @@\ + $(RM) shared/?*.o; else exit 0; fi + +/* + * SharedAndDebuggedLibraryObjectRule: + * Generate make rules to build shared, debuggable, and "normal" + * object files. + */ +#define SharedAndDebuggedLibraryObjectRule() @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @!\ + @!\ +|rule:.c.o: @!\ +|rule: $(RM) $@ shared/$@ debugger/$@ @!\ +|rule: $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o shared/$*.o @!\ +|rule: $(CC) -g -c $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: $(MV) $*.o debugger/$*.o @!\ +|rule: $(CC) -c $(SHLIBDEF) $(JCFLAGS) $*.c @!\ +|rule: @!\ +local_clean:: @@\ + -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ @@\ + $(RM) shared/?*.o; else exit 0; fi @@\ + -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ + $(RM) debugger/?*.o; else exit 0; fi + +/* + * SpecialSharedAndDebuggedObjectRule: + * Generate rules to compile a file with special flags and to make + * shared and debuggable versions. + */ +#define SpecialSharedAndDebuggedObjectRule(objs,depends,options) @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ shared/$@ debugger/$@ @@\ + $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c @@\ + $(MV) $*.o shared/$*.o @@\ + $(CC) -g -c $(SHLIBDEF) $(JCFLAGS) options $*.c @@\ + $(MV) $*.o debugger/$*.o @@\ + $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c + +/* + * SpecialSharedObjectRule: + * Generate rules to compile a file with special flags and to make + * shared and debuggable versions. + */ +#define SpecialSharedObjectRule(objs,depends,options) @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ shared/$@ @@\ + $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(JCFLAGS) options $*.c @@\ + $(MV) $*.o shared/$*.o @@\ + $(CC) -c $(SHLIBDEF) $(JCFLAGS) options $*.c + + +/* + * SpecialObjectRule: + * Generate rules to compile a file with special flags. + */ +#define SpecialObjectRule(objs,depends,options) @!\ +>RM @!\ +>CC @!\ +>JCFLAGS @!\ +objs: depends @@\ + $(RM) $@ @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * SpecialProfiledObjectRule: + * Generate rules to compile a file with special flags and to make a + * profiled version. + */ +#define SpecialProfiledObjectRule(objs,depends,options) @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ profiled/$@ @@\ + $(CC) -pg -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o profiled/$*.o @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * SpecialDebuggedObjectRule: + * Generate rules to compile a file with special flags and to make a + * debuggable version. + */ +#define SpecialDebuggedObjectRule(objs,depends,options) @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ debugger/$@ @@\ + $(CC) -g -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o debugger/$*.o @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * SpecialDebuggedAndProfiledObjectRule: + * Generate rules to compile a file with special flags and to make + * debuggable and profiled versions. + */ +#define SpecialDebuggedAndProfiledObjectRule(objs,depends,options) @!\ +>RM @!\ +>CC @!\ +>MV @!\ +>JCFLAGS @!\ +all:: @@\ + @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ + @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @!\ + @!\ +objs: depends @@\ + $(RM) $@ profiled/$@ debugger/$@ @@\ + $(CC) -pg -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o profiled/$*.o @@\ + $(CC) -g -c $(JCFLAGS) options $*.c @@\ + $(MV) $*.o debugger/$*.o @@\ + $(CC) -c $(JCFLAGS) options $*.c + + +/* + * NormalLibraryTarget: + * Generate rules to create a library. The 'srclist' and 'objlist' + * parameters are added to SOURCES and OBJECTS macros. The 'srclist' + * is not otherwise used by this rule, but is necessary for make depend. + */ +#define NormalLibraryTarget(libname,srclist,objlist) @!\ +>RM @!\ +>AR @!\ +>RANLIB @!\ +++OBJECTS objlist @!\ +++SOURCES srclist @!\ +NormalLibraryObjectRule() @!\ +AllTarget(lib^^libname.a) @!\ + @!\ +lib^^libname.a: objlist @@\ + $(RM) $@ @@\ + $(AR) $@ objlist @@\ + $(RANLIB) $@ + + +/* + * NormalSharedLibraryTarget: + * Generate rules to create a shared library; build it into a + * different name so that the we don't hose people by having the + * library gone for long periods. + */ +#define NormalSharedLibraryTarget(libname,rev,solist) @!\ +>RM @!\ +>LD @!\ +>MV @!\ +AllTarget(lib^^libname.so.rev) @!\ + @!\ +lib^^libname.so.rev: solist @@\ + $(RM) $@~ @@\ + (cd shared; $(LD) -o ../$@~ -assert pure-text solist) @@\ + $(RM) $@ @@\ + $(MV) $@~ $@ + +/* + * NormalSharedLibraryDataTarget: + * Generate rules to create shlib data file; build it into a + * different name so that the we don't hose people by having the + * library gone for long periods. + */ +#define NormalSharedLibraryDataTarget(libname,rev,salist) @!\ +>RM @!\ +>AR @!\ +>RANLIB @!\ +AllTarget(lib^^libname.sa.rev) @!\ + @!\ +lib^^libname.sa.rev: salist @@\ + $(RM) $@ @@\ + $(AR) $@ salist @@\ + $(RANLIB) $@ + + +/* + * NormalLibraryTarget2: + * Generate rules to create a library in two steps. This is used to + * create libraries with large numbers of files. + */ +#define NormalLibraryTarget2(libname,srclist,objlist1,objlist2) @!\ +>RM @!\ +>AR @!\ +>RANLIB @!\ +++SOURCES srclist @!\ +++OBJECTS objlist1 @!\ +++OBJECTS objlist2 @!\ +NormalLibraryObjectRule() @!\ +AllTarget(lib^^libname.a) @!\ + @!\ +lib^^libname.a: objlist1 objlist2 @@\ + $(RM) $@ @@\ + $(AR) $@ objlist1 @@\ + $(AR) $@ objlist2 @@\ + $(RANLIB) $@ + + +/* + * ProfiledLibraryTarget: + * Generate rules to create a profiled library. + */ +#define ProfiledLibraryTarget(libname,srclist,objlist) @!\ +>RM @!\ +>AR @!\ +>RANLIB @!\ +++SOURCES srclist @!\ +++OBJECTS objlist @!\ +AllTarget(lib^^libname^^_p.a) @!\ + @!\ +lib^^libname^^_p.a: objlist @@\ + $(RM) $@ @@\ + cd profiled; $(AR) ../$@ objlist @@\ + $(RANLIB) $@ + + +/* + * DebuggedLibraryTarget: + * Generate rules to create a debuggable library. + */ +#define DebuggedLibraryTarget(libname,srclist,objlist) @!\ +>RM @!\ +>AR @!\ +>RANLIB @!\ +++SOURCES srclist @!\ +++OBJECTS objlist @!\ +AllTarget(lib^^libname^^_d.a) @!\ + @!\ +lib^^libname^^_d.a: objlist @@\ + $(RM) $@ @@\ + cd debugger; $(AR) ../$@ objlist @@\ + $(RANLIB) $@ + + +/* + * AliasedLibraryTarget: + * Generate rules to link one library to another. + */ +#define AliasedLibraryTarget(libname,alias) @!\ +>RM @!\ +>LN @!\ +AllTarget(lib^^alias.a) @!\ + @!\ +lib^^alias.a: lib^^libname.a @@\ + $(RM) $@ @@\ + $(LN) lib^^libname.a $@ + + +/* + * PrelinkedRelocatableTarget: + * Generate rules to produce a relocatable object file instead of a + * library. + */ +#define PrelinkedRelocatableTarget(objname,objlist,libs) @!\ +>RM @!\ +>LD @!\ +>JLKFLAGS @!\ +AllTarget(objname.o) @!\ + @!\ +objname.o: objlist @@\ + $(RM) $@ @@\ + $(LD) $(JLKFLAGS) -r objlist -o $@ libs + + +/* + * NormalRelocatableTarget: + * Generate rules to produce a relocatable object file instead of a + * library. + */ +#define NormalRelocatableTarget(objname,objlist) @!\ +>RM @!\ +>LD @!\ +>JLKFLAGS @!\ +AllTarget(objname.o) @!\ + @!\ +objname.o: objlist @@\ + $(RM) $@ @@\ + $(LD) $(JLKFLAGS) -r objlist -o $@ + + +/* + * ProfiledRelocatableTarget: + * Generate rules to produce a profiled relocatable object file + * instead of a library. + */ +#define ProfiledRelocatableTarget(objname,objlist) @!\ +>RM @!\ +>LD @!\ +AllTarget(objname^^_p.o) @!\ + @!\ +objname^^_p.o: objlist @@\ + $(RM) $@ @@\ + $(LD) -X -r objlist -o $@ + + +/* + * DebuggedRelocatableTarget: + * Generate rules to produce a debuggable relocatable object file + * instead of a library. + */ +#define DebuggedRelocatableTarget(objname,objlist) @!\ +>RM @!\ +>LD @!\ +AllTarget(objname^^_d.o) @!\ + @!\ +objname^^_d.o: objlist @@\ + $(RM) $@ @@\ + $(LD) -X -r objlist -o $@ + +/* + * LintLibraryTarget: + * Generate rules to create a lint library. Note that the lint + * library is always forced to be newer than the library itself. + */ +#define LintLibraryTarget(libname,srclist) @!\ +>RM @!\ +>LINT @!\ +lintlib:: llib-l^^libname.ln @!\ + @!\ +llib-l^^libname.ln: srclist @@\ + $(RM) $@ @@\ + $(LINT) $(LINTLIBFLAG)^^libname $(LINTFLAGS) srclist + + +/* + * NormalLintTarget: + * Generate rules to lint a set of sources. + */ +#define NormalLintTarget(srclist) @!\ +>LINT @!\ +lint: @@\ + $(LINT) $(LINTFLAGS) srclist $(LINTLIBS) + + +/* + * LintTarget: + * Generate rules to lint $(SOURCES) (automatically generated) + */ +#define LintTarget() @!\ +|once _LintTarget_ @!\ +NormalLintTarget($(SOURCES)) @!\ +-once + + +/* + * LinkSourceFile: + * Snag source file from some other directory + */ +#define LinkSourceFile(src,dir) @!\ +>RM @!\ +>LN @!\ +src: dir/src @@\ + $(RM) $@ @@\ + $(LN) $? $@ @!\ + + +/* + * MakeSubincludesForBuild: + * Make includes in sub directories. + */ +#define MakeSubincludesForBuild(step,dir,srclist) @!\ +>RM @!\ +>LN @!\ +step:: dir srclist @@\ + @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\ + set -x; cd dir; $(RM) $$list) @@\ + @for i in srclist; do \ @@\ + (set -x; cd dir; $(LN) ../$$i .); \ @@\ + done @!\ + @!\ +MakeDirectories(dir,dir) @!\ + @!\ +local_realclean:: @@\ + @-(if [ -d dir ]; then \ @@\ + list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\ + set -x; cd dir; $(RM) $$list; else exit 0; fi) + + +/* + * CommonSubdirsRule: + * Rule for making $(TARGET) in every subdirectory, with $(VERB) as + * verbose message and $(FLAGS) as additional flags. + */ +#define CommonSubdirsRule(dirs) @!\ +>MAKE @!\ +subdirs: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \ @@\ + $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)); \ @@\ + done + + +/* + * NamedTargetSubdirsRule: + * Recursively make a series of steps in the specified directories. + */ +#define NamedTargetSubdirsRule(dirs,name,verb,flags) @!\ +>MAKE @!\ +name:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + (cd $$i ; echo verb "in $(DIR)$$i..."; \ @@\ + $(MAKE) $(MFLAGS) flags name); \ @@\ + done + + +/* + * NamedTargetSubdirs: + * Recursively make a series of steps. + */ +#define NamedTargetSubdirs(name,verb,flags) @!\ +>MAKE @!\ +name:: @@\ + @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags + + +/* + * NamedCleanTargetSubdirs: + * Recursively make a series of cleaning. We first clean the + * subdirectories, in case the Makefile is removed by the + * clean entry. + */ +#define NamedCleanTargetSubdirs(name,verb,flags) @!\ +>MAKE @!\ +sub_^^name:: @@\ + @$(MAKE) subdirs TARGET=name VERB=verb FLAGS=flags @@\ + @echo "Back to $(CURRENT) for "name^^... + + +/* + * MakeSubdirs: + * Generate rules to do makes in the given subdirectories. + */ +#define MakeSubdirs() \ +NamedTargetSubdirs(all,"Making all",^^) + + +/* + * DependDirs: + * Generate rules to recursively compute dependencies as part of the + * make depend step. + */ +#define DependDirs(dirs) \ +NamedTargetSubdirsRule(dirs,depend,"Depending",^^) + + +/* + * DependSubdirs: + * Generate rules to recursively compute dependencies as part of the + * make depend step. + */ +#define DependSubdirs() \ +DependDirs($(SUBDIRS)) + + +/* + * InstallSubdirs: + * Generate rules to recursively install and deinstall programs and + * files. + */ +#define InstallSubdirs() \ +NamedTargetSubdirs(install,"Installing",^^) @!\ +NamedTargetSubdirs(deinstall,"Deinstalling",^^) + + +/* + * InstallManSubdirs: + * Generate rules to recursively install and deinstall manual pages. + */ +#define InstallManSubdirs() \ +NamedTargetSubdirs(install.man,"Installing man pages",^^) @!\ +NamedTargetSubdirs(deinstall.man,"Deinstalling man pages",^^) + + +/* + * IncludesSubdirs: + * Generate rules to recursively put include files in build + */ +#define IncludesSubdirs() \ +NamedTargetSubdirs(includes,including,^^) + + +/* + * CleanSubdirs: + * Generate rules to recursively clean out garbage files. + */ +#define CleanSubdirs() \ +NamedCleanTargetSubdirs(clean,"Cleaning",^^) @!\ +NamedCleanTargetSubdirs(realclean,"Real cleaning",^^) @!\ +NamedCleanTargetSubdirs(clobber,"Clobbering",^^) + + +/* + * TagSubdirs: + * Generate rules to recursively create tags files. + */ +#define TagSubdirs(dirs) \ +NamedTargetSubdirsRule(dirs,tag,"Tagging",^^) + +/* + * MakeLintSubdirs: + * Generate rules to recursively lint directories as part of the + * named step. + */ +#define MakeLintSubdirs(dirs,target) \ +NamedTargetSubdirsRule(dirs,target,"Linting",^^) + + +/* + * LintDirs: + * Generate rules to recursively lint directories as part of the + * make lint step. + */ +#define LintDirs(dirs) \ +MakeLintSubdirs(dirs,lint) + + +/* + * LintSubdirs: + * Generate rules to recursively lint directories as part of the + * make lint step. + */ +#define LintSubdirs() \ +LintDirs($(SUBDIRS)) + + +/* + * MakeDirs: + * Creates a set of directories, even if some directories in the path + * do not already exist.There should be no '@!' at the end of the + * '#define' line, because this macro is used *inside* building rules. + */ +#define MakeDirs(dirs) \ +>INSTALLDIR @@\ + @for dir in dirs; do \ @@\ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ + (set -x; test -d $$dir || $(INSTALLDIR) $$dir); \ @@\ + done + +/* + * MakeDirectories: + * Generate rules to create a hierarchy of directories. + */ +#define MakeDirectories(step,dirs) @!\ +step:: @@\ + MakeDirs(dirs) + + +/* + * MakeInstallDirectories: + * Generate a rule to create a set of directories at installation + * time (removed by deinstall). + */ +#define MakeInstallDirectories(dirs) @!\ +>RM @!\ +install:: @@\ + MakeDirs(dirs) @!\ + @!\ +deinstall:: @@\ + $(RM) -r dirs + + +/* + * MakeLintLibSubdirs: + * Generate rules to recursively create lint libraries. + */ +#define MakeLintLibSubdirs(dirs) @!\ +MakeLintSubdirs(dirs,lintlib) + + +/* + * MakeMakeSubdirs: + * Generate rules to recursively recreate target as part of the + * specified step in the build. This assumes Makefile.SH has + * already been built (which is the case for a delivery), but does + * not rely on the existence of a Makefile. + */ +#define MakeMakeSubdirs(target) @!\ +>MAKE @!\ +target:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in $(SUBDIRS);\ @@\ + do \ @@\ + echo "Making "target" in $(DIR)$$i..."; \ @@\ + (cd $$i || exit 1; \ @@\ + if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \ @@\ + $(MAKE) $(MFLAGS) target) \ @@\ + done + + +/* + * MakeMakefilesSH: + * Generate rules to recursively recreate target as part of the + * specified step in the build. If $(TOP) is set to an absolute + * path, don't prepend the ../ prefix. This makes running things + * outside of the source tree to be much easier. + */ +#define MakeMakefilesSH() @!\ +>MAKE @!\ +Makefiles.SH:: Makefile.SH @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in $(SUBDIRS);\ @@\ + do \ @@\ + case "$(DIR)$$i/" in \ @@\ + ^^*^^/^^*^^/^^*^^/^^*^^/) newtop=../../../..;; \ @@\ + ^^*^^/^^*^^/^^*^^/) newtop=../../..;; \ @@\ + ^^*^^/^^*^^/) newtop=../..;; \ @@\ + *^^/) newtop=..;; \ @@\ + esac; \ @@\ + case "$(TOP)" in \ @@\ + /^^*) newtop="$(TOP)" ;; \ @@\ + esac; \ @@\ + echo "Making Makefiles.SH in $(DIR)$$i..."; \ @@\ + (cd $$i || exit 1; $(MAKE) $(MFLAGS) -f ../Makefile \ @@\ + Makefile TOP=$$newtop CURRENT=$(DIR)$$i;\ @@\ + $(MAKE) $(MFLAGS) Makefiles.SH) \ @@\ + done + + +/* + * MakefileSubdirs: + * Generate rules to create Makefiles. + */ +#define MakefileSubdirs() @!\ +MakeMakeSubdirs(Makefiles) @!\ +MakeMakefilesSH() + + +/* + * CppScriptTarget: + * Generate rules to create a shell script by running the input + * through cpp. + */ +#define CppScriptTarget(dst,src,defs,deplist) @!\ +>RM @!\ +>CPP @!\ +dst:: src deplist @@\ + $(RM) $@ @@\ + $(CPP) defs <src | \ @@\ + sed -e '/^# *[0-9][0-9]* *.*$$/d' >$@ @@\ + chmod a+x $@ + + +/* + * MakeScriptFromCpp: + * Generate rules to create a script from a file with a + * .cpp suffix. + */ +#define MakeScriptFromCpp(name,defs) @!\ +CppScriptTarget(name,name.cpp,defs,^^) + + +/* + * ShellScriptTargetExt: + * Generate rules to create and install a set of scripts from + * ext files (.sh and .SH are the most common examples). Man pages + * derived from the name of the scripts are also installed unless + * NoManPages() is specified. + */ +#define ShellScriptTargetExt(scripts,ext) @!\ +++SCRIPTS scripts @!\ +SimpleShellScriptTargetExt(scripts,ext) @!\ +InstallScripts() @!\ +InstallManScripts() + + +/* + * ShellScriptTarget: + * Generate rules to create and install a set of scripts from + * .SH files. Man pages derived from the name of the scripts are + * also installed unless NoManPages() is specified. + */ +#define ShellScriptTarget(scripts) @!\ +ShellScriptTargetExt(scripts,.SH) + + +/* + * SimpleShellScriptTargetExt: + * Generate rules to create a set of scripts from ext files where + * ext is usually something like .sh or .SH, or whatever file + * extension you like.. + */ +#define SimpleShellScriptTargetExt(scripts,ext) @!\ +>RM @!\ +AllTarget(scripts) @!\ + @!\ +|expand s!scripts! @!\ +!s: !s^^ext @@\ + /bin/sh !s^^ext @!\ + @!\ +-expand + + +/* + * SimpleShellScriptTarget: + * Generate rules to create a set of scripts from .SH files. + */ +#define SimpleShellScriptTarget(scripts) @!\ +SimpleShellScriptTargetExt(scripts,.SH) + + +/* + * ShellScriptLongTarget: + * Generate rules to create a set of scripts from .SH files where + * the name of the generated file is different from the basename of + * the .SH file (when, for instance, the total length with the .SH + * extension would not leave enough space for RCS ,v extension). + */ +#define ShellScriptLongTarget(basename,scriptname) @!\ +>RM @!\ +>MANSRC @!\ +++LSCRIPTS scriptname @!\ +AllTarget(scriptname) @!\ + @!\ +scriptname: basename^^.SH @@\ + /bin/sh basename^^.SH @!\ + @!\ +InstallScripts() @!\ +?NOMAN:|skip @!\ +InstallManPageLong(basename,$(MANSRC),scriptname) @!\ +-skip + + +/* + * ForceTarget: + * The force target will force reconstruction of all the other + * targets which include .FORCE in their own dependencies. + */ +#define ForceTarget() @!\ +|once _force_ @!\ +.FORCE: @!\ + @!\ +-once + + +/* + * RemoteTargetDependency: + * A local target may rely on a remote dependency (e.g. a library) + * made in a separate directory. This rule explicits the dependency + * and forces a make of that dependency in the remote directory. + */ +#define RemoteTargetDependency(target,directory,dependency) @!\ +>MAKE @!\ +RemoteDependency(directory,dependency) @!\ +target: directory/dependency @!\ + + +/* + * RemoteDependency: + * Specify rules for making a remote dependency. + */ +#define RemoteDependency(directory,dependency) @!\ +>MAKE @!\ +ForceTarget() @!\ +|once =directory/dependency= @!\ +directory/dependency: .FORCE @@\ + @echo "Checking "dependency" in "directory"..." @@\ + cd directory; $(MAKE) dependency @@\ + @echo "Continuing in $(CURRENT)..." @!\ + @!\ +-once + +/* + * SetSubdirs: + * Actually forces the definition of SUBDIRS, and lets the user + * specify what the sub-directories are. This will be added to the + * customization part. + */ +#define SetSubdirs(subdirs) @!\ +>SUBDIRS @!\ ++SUBDIRS = subdirs + + +/* + * NoManPages: + * Actually forces the definition of NOMAN, which tells the jmake + * program to not generate rules for installing manual pages. + */ +#define NoManPages() @!\ +>NOMAN + + +/* + * Expand: + * This powerful macro expands the `rule' given a `pattern'. It + * relies on a built-in command in jmake. The expansion is + * documented in the short notes file that comes with jmake and + * gives some insights on the internal syntax. + */ +#define Expand(rule, pattern) @!\ +|expand pattern @!\ +rule @!\ +-expand + + +/* + * Lex and yacc stuff. + */ + +/* + * YaccRule: + * This is the rule which is used to build a .c file from a .y file. + */ +#define YaccRule() @!\ +AddSuffix(.y) @!\ +|once _YaccRule_ @!\ +|rule:.y.c: @!\ +|rule: $(YACC) $(JYFLAGS) $< @!\ +|rule: $(MV) y.tab.c $@ @!\ +|rule: @!\ +-once + +/* + * SimpleYaccTarget: + * Declare a yacc base.y file to be used in the building of the + * specified target program. The source file must be given without + * its final .y extension. The name of the .c and .o will be + * derived from the source file basename provided. + */ +#define SimpleYaccTarget(program,base) @!\ +>JYFLAGS @!\ +>YACC @!\ +>RM @!\ +>MV @!\ +++SOURCES base.y @!\ +++OBJECTS base.o @!\ +YaccRule() @!\ +program: base.c @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * ComplexYaccTarget: + * Declare a yacc base.y file to be used in the building of the + * specified target program. The source file must be given without + * its final .y extension. The name of the .c and .o will be + * derived from the source file basename provided. + * The difference with SimpleYaccTarget is the identifying process + * where all the 'yy' are replaced by the specified prefix. + */ +#define ComplexYaccTarget(program,base,prefix) @!\ +>JYFLAGS @!\ +>YACC @!\ +>RM @!\ +>SED @!\ +++SOURCES base.y @!\ +++OBJECTS base.o @!\ +program: base.c @!\ + @!\ +base.c: base.y @@\ + $(YACC) $(JYFLAGS) base.y @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.c > base.c @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h @@\ + $(RM) y.tab.c y.tab.h @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * SimpleYaccInclude: + * Declare that program will need an include file produced by + * the output of yacc on base.y, which typically produces a file + * named y.tab.h, which will be renamed as base.h. + * The only problem is that the dependencies towards base.h have + * to be manually given in the Jmakefile. + */ +#define SimpleYaccInclude(base) @!\ +>MV @!\ +>RM @!\ +base.h: base.c @@\ + @if test -f y.tab.h; then \ @@\ + echo " $(MV) y.tab.h $@"; \ @@\ + $(MV) y.tab.h $@; \ @@\ + else \ @@\ + exit 0; \ @@\ + fi @!\ + @!\ +local_realclean:: @@\ + $(RM) base.h + +/* + * ComplexYaccInclude: + * Declare that program will need an include file produced by + * the output of yacc on base.y, which typically produces a file + * named y.tab.h, which will be renamed as base.h. + * The difference with SimpleYaccInclude is the identifying process + * of the y.tab.h file where all 'yy' are renamed to prefix. + * The only problem is that the dependencies towards base.h have + * to be manually given in the Jmakefile. + */ +#define ComplexYaccInclude(base,prefix) @!\ +>RM @!\ +>SED @!\ +>CP @!\ +base.h: base.c @@\ + @if test -f y.tab.h; then \ @@\ + echo " $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h"; \ @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < y.tab.h > base.h; \ @@\ + echo " $(RM) y.tab.h"; \ @@\ + $(RM) y.tab.h; \ @@\ + elif test -f base.h; then \ @@\ + echo " $(CP) base.h base.ht"; \ @@\ + $(CP) base.h base.ht; \ @@\ + echo " $(SED) -e 's/yy\(.\)/prefix\1/g' < base.ht > base.h"; \ @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < base.ht > base.h; \ @@\ + echo " $(RM) base.ht"; \ @@\ + $(RM) base.ht; \ @@\ + else \ @@\ + exit 0; \ @@\ + fi @!\ + @!\ +local_realclean:: @@\ + $(RM) base.h + + +/* + * NormalYaccTarget: + * Declare a yacc base.y file which should produce a base.c and + * base.h file as derived from the output of yacc, to be used by + * the specified program. + */ +#define NormalYaccTarget(program,base) @!\ +SimpleYaccTarget(program,base) @!\ +SimpleYaccInclude(base) + + +/* + * IdentifiedYaccTarget: + * Declare a yacc base.y file which should produce a base.c and + * base.h file as derived from the output of yacc, to be used by + * the specified program. The specified prefix is used to remplace + * all the 'yy' in the generated file, for use when more than a + * single parser is needed in one executable. + */ +#define IdentifiedYaccTarget(program,base,prefix) @!\ +ComplexYaccTarget(program,base,prefix) @!\ +ComplexYaccInclude(base,prefix) + + +/* + * SimpleLexTarget: + * This declares a lex base.l file which is to be ran through + * lex to produce a base.c file. + */ +#define SimpleLexTarget(program,base) @!\ +>JLFLAGS @!\ +>LEX @!\ +>RM @!\ +>MV @!\ +++SOURCES base.l @!\ +++OBJECTS base.o @!\ +|once _LexRule_ @!\ +|rule:.l.c: @!\ +|rule: $(LEX) $(JLFLAGS) $< @!\ +|rule: $(MV) lex.yy.c $@ @!\ +|rule: @!\ +-once @!\ +AddSuffix(.l) @!\ +program: base.c @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * IdentifiedLexTarget: + * This declares a lex base.l file which is to be ran through + * lex to produce a base.c file. The prefix is used to replace + * the 'yy', so that the lexical analyzer may be identified. + */ +#define IdentifiedLexTarget(program,base,prefix) @!\ +>JLFLAGS @!\ +>LEX @!\ +>RM @!\ +>SED @!\ +++SOURCES base.l @!\ +++OBJECTS base.o @!\ +program: base.c @!\ + @!\ +base.c: base.l @@\ + $(LEX) $(JLFLAGS) base.l @@\ + $(SED) -e 's/yy\(.\)/prefix\1/g' < lex.yy.c > base.c @@\ + $(RM) lex.yy.c @!\ + @!\ +local_realclean:: @@\ + $(RM) base.c @!\ + + +/* + * NormalLexDependTarget: + * Declare that program will need an include file produced by + * the output of lex on base.l, which typically produces a file + * named lex.yy.c which will be renamed as base.c. Besides, the + * lexical analyzer needs the file parser.h produced by running + * parser.y through yacc and renaming y.tab.h as parser.h. + */ +#define NormalLexDependTarget(program,base,parser) @!\ +base.o: parser.h @!\ + @!\ +SimpleLexTarget(program,base) + + +/* + * IdentifiedLexDependTarget: + * Declare that program will need an include file produced by + * the output of lex on base.l, which typically produces a file + * named lex.yy.c which will be renamed as base.c. Besides, the + * lexical analyzer needs the file parser.h produced by running + * parser.y through yacc and renaming y.tab.h as parser.h. + * The lexical analyzer is identified with the supplied prefix, + * which replaces the regular 'yy' prefix in the symbol names. + */ +#define IdentifiedLexDependTarget(program,base,parser,prefix) @!\ +base.o: parser.h @!\ + @!\ +IdentifiedLexTarget(program,base,prefix) + + +/* + * NormalParserTarget: + * Specify that program is using the lex/yacc combination to + * produce a parser. The lexic and parser parameters are the + * base name of the .l and .y file, respectively. + */ +#define NormalParserTarget(program,lexic,parser) @!\ +NormalLexDependTarget(program,lexic,parser) @!\ +NormalYaccTarget(program,parser) + + +/* + * IdentifiedParserTarget: + * Specify that program is using the lex/yacc combination to + * produce a parser. The lexic and parser parameters are the + * base name of the .l and .y file, respectively. The parser + * produced is identified via its prefix, which replaces all + * the normally supplied 'yy' prefix, hence making it possible + * to have multiple parsers in a single executable. + */ +#define IdentifiedParserTarget(program,lexic,parser,prefix) @!\ +IdentifiedLexDependTarget(program,lexic,parser,prefix) @!\ +IdentifiedYaccTarget(program,parser,prefix) + + diff --git a/jmake/files/Jmake.tmpl b/jmake/files/Jmake.tmpl new file mode 100644 index 0000000..dceb604 --- /dev/null +++ b/jmake/files/Jmake.tmpl @@ -0,0 +1,208 @@ +/* + * Generic jmake template + * + * $Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp $ + * + * Copyright (c) 1991-1993, Raphael Manfredi + * + * You may redistribute only under the terms of the Artistic Licence, + * as specified in the README file that comes with the distribution. + * You may reuse parts of this distribution only within the terms of + * that same Artistic Licence; a copy of which may be found at the root + * of the source tree for dist 3.0. + * + * $Log: Jmake.tmpl,v $ + * Revision 3.0.1.3 1997/02/28 14:56:16 ram + * patch61: lex path can now be configured + * + * Revision 3.0.1.2 1995/01/11 14:50:21 ram + * patch45: now pre-computes INSTALL and INSTALLDIR variables + * + * Revision 3.0.1.1 1993/08/20 07:36:36 ram + * patch3: config.sh searching was not aborting properly + * + * Revision 3.0 1993/08/18 12:04:16 ram + * Baseline for dist 3.0 netwide release. + * + */ + +: Makefile.SH generated from Jmake.tmpl and Jmakefile <TAG> +: $Id: Jmake.tmpl,v 3.0.1.3 1997/02/28 14:56:16 ram Exp $ + +/************************************************************************* + * * + * DO NOT MODIFY BELOW THIS LINE * + * * + *************************************************************************/ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/#*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +|expand cur!CURDIR! +CURRENT=!cur:^\./= +-expand +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" +/* + * Variable pre-computation. + */ +?INSTALL:INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +?INSTALLDIR:INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` +/* + * Makefile generation. + */ +$spitshell >Makefile <<!GROK!THIS! +;######################################################################## +;# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = TOPDIR +CURRENT = $CURRENT +DIR = $DIR +?INSTALL:INSTALL = $INSTALL +?INSTALLDIR:INSTALLDIR = $INSTALLDIR + +;######################################################################## +;# Parameters set by Configure -- edit config.sh if changes are needed + +?AR:AR = ar rc /* FIXME */ +?BINDIR:BINDIR = $installbin +?CC:CC = $cc +?CP:CP = $cp +?CPP:CPP = $cpp $cppminus $cppflags +?CTAGS:CTAGS = ctags /* FIXME */ +?JCFLAGS:JCFLAGS = \$(CFLAGS) $optimize $ccflags $large +?JLDFLAGS:JLDFLAGS = \$(LDFLAGS) $optimize $ldflags +?JLFLAGS:JLFLAGS = \$(LFLAGS) +?JYFLAGS:JYFLAGS = \$(YFLAGS) $yaccflags +?L:L = $manext +?LD:LD = ld +?LEX:LEX = $lex +?LIBS:LIBS = $libs +?LINT:LINT = lint +?LN:LN = $ln +?MANSRC:MANSRC = $installmansrc +?MAKE:MAKE = make /* Otherwise $(MAKE) doesn't work on SONY */ +?MKDEP:MKDEP = $mkdep \$(DPFLAGS) -- +?MV:MV = $mv +?PRIVLIB:PRIVLIB = $installprivlib +?RANLIB:RANLIB = $ranlib +?RM:RM = $rm -f +?SCRIPTDIR:SCRIPTDIR = $installscript +?SED:SED = $sed +?YACC:YACC = $yacc + +/* + * The following will only be added if at least one initialization + * rule was found in the Jmakefile. + */ +%INIT:|skip /* Skip if no initializations are necessary */ +;######################################################################## +;# Automatically generated parameters -- do not edit + +INIT_SECTION + +-skip /* Initializations */ +%SUFFIX:|skip /* Skip if no suffixes/rules are defined */ +;######################################################################## +;# New suffixes and associated building rules -- edit with care + +SUFFIX_SECTION +-skip /* Suffixes/Rules */ +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +#include <Jmake.rules> + +%MKDEP:|skip /* Skip if no depend target */ +;######################################################################## +;# Force 'make depend' to be performed first -- do not edit + +.FORCE_DEPEND:: + +all:: .FORCE_DEPEND + +-skip /* Depend target */ +;######################################################################## +;# Start of Jmakefile +#include <Jmakefile> + +;######################################################################## +;# Common rules for all Makefiles -- do not edit +/* + * These need to be here so that rules in Jmakefile occur first; the blank + * all is to make sure that an empty Jmakefile doesn't default to make clean. + */ +emptyrule:: + +CleanTarget() +MakefileTarget() +TagsTarget() + +%SUBDIRS:|skip /* Skip if no sub-directories */ +;######################################################################## +;# Rules for building in sub-directories -- do not edit + +CommonSubdirsRule($(SUBDIRS)) +InstallSubdirs() +InstallManSubdirs() +CleanSubdirs() +TagSubdirs($(SUBDIRS)) +MakefileSubdirs() +MakeSubdirs() + +-skip /* Sub-directories */ +?SUBDIRS:|skip /* Skip if sub-directories */ +;######################################################################## +;# Empty rules for directories with no sub-directories -- do not edit + +install:: + @echo "install in $(CURRENT) done." + +deinstall:: + @echo "deinstall in $(CURRENT) done." + +install.man:: + @echo "install.man in $(CURRENT) done." + +deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." + +/* + * Action for 'Makefiles' would be required, if a .SUFFIXES: .SH rule + * were added, because in that case, a "/bin/sh Makefiles.SH" would + * be issued and raise an error. + */ +Makefiles:: + +Makefiles.SH:: + +-skip /* No sub-directories */ +%MKDEP:|skip /* Skip if no depend target */ +;######################################################################## +;# Dependencies generated by make depend +;# DO NOT DELETE THIS LINE -- make depend relies on it + +;# Put nothing here or make depend will gobble it up +.FORCE_DEPEND:: +?TOP: @echo "You haven't run a 'make depend' yet!"; exit 1 +%TOP: @echo "You must run 'make depend' in $(TOP) first."; exit 1 +-skip /* Depend target */ +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/jmake/fixcpp.SH b/jmake/fixcpp.SH new file mode 100644 index 0000000..804325b --- /dev/null +++ b/jmake/fixcpp.SH @@ -0,0 +1,183 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting jmake/fixcpp (with variable substitutions)" +$spitshell >fixcpp <<!GROK!THIS! +$startperl + eval 'exec perl -S \$0 "\$@"' + if \$runnning_under_some_shell; + +# $Id: fixcpp.SH,v 3.0.1.1 1995/03/21 08:35:37 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: fixcpp.SH,v $ +# Revision 3.0.1.1 1995/03/21 08:35:37 ram +# patch52: created +# + +# Thank you HP-UX for having a cpp that strips trailing backslashes in the +# text. As of today, you are the only reason for this program to exist. +# People designing such things should have their hands cut off to prevent +# them from doing further damage :-) +# +# This program is meant to be called from jmake. All it does is pre-process +# the file it is given as argument, focusing on #include directives and +# resolving them as cpp would (but without the #line stuff since we don't +# really care about it), escaping all the trailing \ into '\ ^M'. The resulting +# temporary file is then handed off to the real cpp for macro processing, and +# the output is printed on stdout, after restoration of any original trailing \. +# Again, thanks HP-UX for making this so challenging and exciting... :-) +# +# Note that we MUST leave alone all the trailing @!\ or @@\, since those appear +# in macros and must go away some way or the other. Also trailing backslashes +# on #define lines are really continuations and are left un-escaped. + +\$cpp = '$cpp'; +\$version = '$VERSION'; +\$patchlevel = '$PATCHLEVEL'; +!GROK!THIS! +$spitshell >>fixcpp <<'!NO!SUBS!' + +while ($ARGV[0] =~ /^-/) { + $_ = shift; + last if /--/; + $cpp_opt .= "$_ "; + next unless s/-I//; + push(@lookpath, $_); +} + +($file) = @ARGV; +$counter = 0; # Counter for temporary files + +$SIG{'INT'} = 'PLUMBER'; # Install cleaner in case of an interrupt... + +$result = &process($file); # Process file, result in a temporary +&cpp($result); # Pass resulting file with escaped \ to cpp +unlink $result; +exit 0; + +# Cleanup any temporary files... +sub PLUMBER { + warn "Could not cleanup all temporaries.\n" if @tmps != unlink(@tmps); + exit 1; +} + +# Compute a suitable temporary file name +sub mktmp { + $counter++; + local($tmp) = "/tmp/jmk.$counter.$$"; + push(@tmps, $tmp); # Keep track of them for &PLUMBER... + $tmp; +} + +# Process a given file, returning the name of the temporary file into which +# the result is left over. +# This routine is recursively called to process nested include directives. +sub process { + local($file) = @_; + local(*FILE, *TMP); + open(FILE, $file) || die "Can't read $file: $!\n"; + local($tmpfile) = &mktmp; + open(TMP, ">$tmpfile") || die "Can't create $tmpfile: $!\n"; + local($here, $include); + local($_); + while (<FILE>) { + if (s/^#\s*include\s*//) { # Ah, we found a #include something... + chop; + if (/"(\S+)"/) { + ($include, $here) = ($1, 1); + } elsif (/<(\S+)\>/) { + ($include, $here) = ($1, 0); + } else { + warn "Ignoring unkown include directive $_.\n"; + next; + } + local($incfile) = &lookup($include, $here); + unless (defined $incfile) { + warn "Can't locate include file $include.\n"; + next; + } + $include = &process($incfile); # Recursively process this file + &append($include, 'TMP'); # Append result to current tmp file + unlink $include; + } else { + &escape; + print TMP; + } + } + close FILE; + close TMP; + $tmpfile; # Return name of file where results has been left over +} + +# Perform necessary escaping work on current line. +sub escape { + # Don't escape trailing backslashes in macro definition or cpp + # won't see them as macro continuation any longer, and also within + # macro definitions, all those @@ or @! continuations... + s/\\$/\\ \015/ unless /\@[!@]\\$/ || /^#define/; +} + +# Append file to given (opened) file descriptor +sub append { + local($file, $fd) = @_; + local(*FILE); + open(FILE, $file) || die "Can't re-open $file: $!\n"; + local($_); + while (<FILE>) { + &escape; + print $fd $_; + } + close FILE; +} + +# Lookup file, returning its located name or undef if not found. +sub lookup { + local($file, $here) = @_; + unless ($here) { + foreach $dir (@lookpath) { + if (-r "$dir/$file") { # Use -r instead of -f for symlinks + $file = "$dir/$file"; + last; + } + } + } + return undef unless -r $file; + $file; +} + +# This is the final cpp processing. The output from cpp is filtered to un-escape +# all the trailing backslashes. +sub cpp { + local($file) = @_; + open(CPP, "$cpp $cpp_opt $file |") || die "Can't fork: $!\n"; + while (<CPP>) { + s/\\ \015$/\\/; # Un-escape trailing \ + print STDOUT; + } + close CPP; +} + +!NO!SUBS! +chmod 755 fixcpp +$eunicefix fixcpp diff --git a/jmake/jmake.SH b/jmake/jmake.SH new file mode 100755 index 0000000..38a49eb --- /dev/null +++ b/jmake/jmake.SH @@ -0,0 +1,390 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting jmake/jmake (with variable substitutions)" +$spitshell >jmake <<!GROK!THIS! +$startperl + eval 'exec perl -S \$0 "\$@"' + if \$runnning_under_some_shell; + +# $Id: jmake.SH,v 3.0.1.6 1995/09/25 09:08:01 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: jmake.SH,v $ +# Revision 3.0.1.6 1995/09/25 09:08:01 ram +# patch59: will now force macro definitions to the left +# +# Revision 3.0.1.5 1995/07/25 13:34:47 ram +# patch56: all error messages are now prefixed with the program name +# +# Revision 3.0.1.4 1995/03/21 08:45:27 ram +# patch52: now invokes cpp through new fixcpp script +# patch52: first pass now skips cpp comments alltogether +# +# Revision 3.0.1.3 1994/10/29 15:47:01 ram +# patch36: added various escapes in strings for perl5 support +# +# Revision 3.0.1.2 1993/08/24 12:12:50 ram +# patch3: privlib dir was ~name expanded in the wrong place +# +# Revision 3.0.1.1 1993/08/19 06:42:13 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:17 ram +# Baseline for dist 3.0 netwide release. +# + +\$dir = '$privlib/files'; +\$cpp = '$cpp'; +\$version = '$VERSION'; +\$patchlevel = '$PATCHLEVEL'; +!GROK!THIS! +$spitshell >>jmake <<'!NO!SUBS!' + +($me = $0) =~ s|.*/(.*)|$1|; +$dir = &tilda_expand($dir); # ~name expansion +$file = $dir . '/Jmake.tmpl'; + +$cpp_opt = "-I. "; # For Jmakefile, which is local +while ($ARGV[0] =~ /^-/) { + $_ = shift; + last if /--/; + $cpp_opt .= "$_ "; +} +$cpp_opt .= "-I$dir"; + +# Thank you HP-UX for having a cpp that blindly strips trailing backslashes +# in the text. Run through cpp by using the fixcpp script... + +open(CPP, "$dir/fixcpp $cpp_opt $file |"); +while (<CPP>) { + # Record defined symbols in Jmakefile. We won't catch symbols + # in conditional commands, but that's ok, I hope. + if ($in_symbol) { + $val = $_; + $in_symbol = 0 if !($val =~ s/\\\s*$//); # Last line + if ($val = /^\|expand/) { # Found an expand command + $in_symbol = 0; # Stop gathering value + $val .= "void::x"; # Stop any incomplete escape sequence + } + chop($val); + $Makesym{$current_symbol} .= $val; + } elsif (/^\s*(\w+)\s*=(.*)/ && !$in_symbol) { + # Found a makefile's macro declaration + $val = $2; + $current_symbol = $1; + if ($val =~ s/\\\s*$//) { # Remove final '\' + $in_symbol = 1; # This is a continuation line + } + $Makesym{$current_symbol} = $val; + push(@Order, $current_symbol); # Keep track of order + } + # Protect RCS keyword Id or Header from normal substitution + s/\$(Id|Header|Log)/\$X-$1/; + # Restore possibly escaped C comments + s|/#\*|/*|g; + s|\*#/|*/|g; + # Remove all ^^ (null space character) + s|\^\^||g; + # Restore escaped ^^ sequence + s|\^\\\^|^^|g; + next if /^#\s+\d+/; # Skip cpp commments + + s/^;#/#/; + s/@#\s?/\n/g; # Kept for backward compatibility + s/@!\s?/\n/g; + s/@@\s?/\n\t/g; + + $* = 1; + # A '\r' is added to all lines, in order to let 'split' keep them + # As lines ending with '\' won't fit in the next regular + # expression (why ?), we have to treat that special case separately + s/\n$/\r\n/g; + s/\\\s*$/\\\r/g; # Remove spaces after final '\' and add '\r' + $* = 0; + @macro = split(/\n/); + for ($i = 0; $i <= $#macro; $i++) { + chop($_ = $macro[$i]); # Remove final '\r' + s/\s+$//g; # Remove possible useless spaces + if (/^TOP\s*=\s*(\S+)/) { # Get the top from generated file + $top = $1; + } + if (s/^\s*>//) { # '>' means "symbol wanted" + $symbol{$_} = 1; + } elsif (s/^\s*\+//) { # '+' means "initialization section" + if (s/^\+(\w+)//) { # '++' means add to variable list + $added{$1} .= $_; + } else { # A single '+' means "add as is". + push(@init, $_); + } + } elsif (s/^\|//) { # Command for us + if (/suffix\s+(\S+)/) { # Add suffix + push(@suffix, $1) unless $seen{$1}; + $seen{$1} = 1; + } elsif (s/^rule://) { # Add building rule + s/^\s(\s*\S+)/\t$1/; # Make sure leading tab is there + push(@rule, $_); + } elsif (/^skip/) { # Unconditional skip... funny! + push(@makefile, "|$_"); # Skip handled in pass 2 + } elsif (/^expand/) { + push(@makefile, "|$_"); # Expand handled in pass 2 + } elsif (/^once\s+(\S+)/) { # Once handled in pass 1 + if ($Once{$1}++) { # Symbol already seen -- skip + for (; $i <= $#macro; $i++) { + last if $macro[$i] =~/^-once/; + } + warn("$me: -once not found for $1") + unless $macro[$i] =~/^-once/; + } + } else { + print "$me: Warning: unknown command $_\n"; + } + } else { + next if /^-once/; # Control statement removed + push(@makefile, $_); + } + } +} +close CPP; + +@key = keys(%added); +$last_was_blank = 1; # To avoid blank line at the top of the file +$symbol{'INIT'} = 1 if ($#init >= 0 || $#key >=0); # Initializations +$symbol{'SUFFIX'} = 1 if ($#suffix >= 0 || $#rule >=0); # Rules or suffixes +$symbol{'TOP'} = 1 if $top eq '.'; # If imake invoked for the top + +open(MAKEFILE, ">Makefile.SH"); +# We have to use for instead of foreach to handle 'skip' easily +line: for ($i = 0; $i <= $#makefile; $i++) { + $_ = $makefile[$i]; + next if /^-skip|-expand/; # They might have made a mistake + + s/<TAG>/[jmake $version PL$patchlevel]/; + if (/^\s*$/) { + next if ($last_was_blank); + $last_was_blank = 1; + } else { + $last_was_blank = 0; + } + + # Lines starting with ?SYMBOL: (resp. %SYMBOL:) are to be processed + # only if SYMBOL is defined (resp. undefined). + + # Apply in sequence + while (/^\s*\?|\s*%/) { + if (s/^\s*\?(\w+)://) { # Wanted symbol ? + next line unless $symbol{$1}; + } elsif (s/^\s*%(\w+)://) { # Unwanted symbol ? + next line if $symbol{$1}; + } else { + print "$me: Warning: missing ':' in $_\n"; + last; + } + } + + # We wish to make sure there is a leading tab if the line starts with + # a space to prevent problems later on. However, variable definitions + # might want to be aligned on the '=' (imake style). Not all make + # may be able to cope with those though, so they are left justified + # again. + + s/^\s/\t/ unless /^\s+\w+\s+=/; # Make sure leading tab is there + s/^\s+(\w+\s+=)/$1/; # Left justify variable definition + s/^;#/#/; # Comments in Jmakefile + + if (s/^\|//) { # Command for us + if (/^skip/) { # Skip until -skip + for (; $i <= $#makefile; $i++) { + last if $makefile[$i] =~ /^-skip/; + } + } elsif (s/^expand//) { + do init_expand($_); # Initializes data structures + $i++; # Skip expand line + undef @Expand; # Storage for expanded lines + $pattern = ''; # Assume no pattern + for (; $i <= $#makefile; $i++) { + $_ = $makefile[$i]; + if (s/^-expand//) { # Reached end of expansion + if (s/^\s*(.*)/$1/) { # Expand followed by a pattern + $pattern = $_; # Get pattern to be removed + } + last; + } + s/^\s/\t/; # Make sure leading tab is there + push(@Expand, $_); # Line to be expanded + } + do expand($pattern); # Expand all lines in buffer + } else { + print "$me: Warning: unknown command $_\n"; + } + } elsif (/^INIT/) { # Initialization section + # All the initializations are put in the variable substitution + # section of the Makefile.SH. Therefore, we have to protect all + # the '$' signs that are not followed by an alphanumeric character. + foreach (@init) { + # Dumps core sometimes with perl 4.0 PL10 + # do protect_dollars(*_); + $_ = do protect_dollars($_); + do print_makefile($_); + } + foreach (@key) { # @key set earlier to keys(%added) + $_ .= " = " . $added{$_}; + # Dumps core sometimes with perl 4.0 PL10 + # do protect_dollars(*_); + $_ = do protect_dollars($_); + do print_makefile($_); + } + } elsif (/^SUFFIX/) { # Suffixes/Rules section + # Rules and suffixes are put in the variable substitution + # section of the Makefile.SH. Therefore, we have to protect all + # the '$' signs that are not followed by an alphanumeric character. + if ($#suffix >= 0) { + print MAKEFILE ".SUFFIXES:"; + foreach (@suffix) { + # Dumps core sometimes with perl 4.0 PL10 + # do protect_dollars(*_); + $_ = do protect_dollars($_); + print MAKEFILE " $_"; + } + print MAKEFILE "\n\n"; + } + foreach (@rule) { + # Dumps core sometimes with perl 4.0 PL10 + # do protect_dollars(*_); + $_ = do protect_dollars($_); + print MAKEFILE "$_\n"; + } + } else { + do print_makefile($_); + } +} +close MAKEFILE; + +sub protect_dollars { + # Dumps core sometimes with perl 4.0 PL10 + # local(*_) = shift(@_); + s/\\\$/\\=/g; # Protect already escaped '$' + s/(\$\W)/\\$1/g; # Escape unprotected '$' + s/\\=/\\\$/g; # Restore escaped '$' + $_; # Because perl dumps core... :-( +} + +# Initializes data structures for expansion. If we detect Makefile +# macro in the 'expand' line (the argument), then we write a small +# makefile that will do the substitution for us -- I'm lazy today :-) +sub init_expand { + local($_) = shift(@_); + undef %Vars; # Reset array of variables + $Vars_len = 0; # Number of "symbols" in first expanded + if (/\$\(\w+\)/) { # If at least one macro + local($make) = "/tmp/mkjm$$"; + open(MAKE, ">$make") || die "$me: can't create $make: $!\n"; + do gen_variables(); # Generates already computed variables + foreach $var (@Order) { # Print each in order we found them + print MAKE "$var = $Makesym{$var}\n" if !$Gvars{$var}; + } + print MAKE "all:\n\t\@echo '$_'\n"; + close MAKE; + chop($_ = `make -f $make all`); + unlink($make); + } + while (s/^\s*(\w+)!([^!]*)!//) { + $Vars{$1} = $2; + # Record only length for _first_ expanded symbol + $Vars_len = split(/\s\s*/, $2) unless $Vars_len; + } +} + +# Expand lines in the @Expand array. The argument is a pattern which is to +# be removed from the last chunk of expanded lines. +# For each symbol s, !s is replaced by the next item, and !s:p=q does the +# same after having replaced the pattern 'p' by pattern 'q' in the item. +# Spaces are NOT allowed in 'p' or 'q'. Substitution is done once (no /g). +sub expand { + local($pattern) = shift; # To-be-removed pattern for last chunk + local($_); + local($sub); + local($i); + local(@expands); + for ($i = 0; $i < $Vars_len; $i++) { + foreach $line (@Expand) { + $_ = $line; # Don't modify elements in array + foreach $sym (keys %Vars) { + @expands = split(/\s\s*/, $Vars{$sym}); + $sub = $expands[$i]; + $sub =~ s/\/\///g; # // is a void value + while (s/!${sym}:([^\s]*)=([^\s]*)/,x##x,/) { + # Replacing item is altered by some pattern + local($p) = $1; + local($q) = $2; + local($subq) = $sub; + eval "\$subq =~ s=${p}=${q}="; + s/,x##x,/${subq}/; + } + s/!${sym}/${sub}/g; + } + # Protect substitution in an 'eval' in case of error + eval "s/${pattern}\$//" if $pattern && $i == ($Vars_len - 1); + do print_makefile($_); + } + } +} + +# Prints its argument in MAKEFILE and records it also in Generated +sub print_makefile { + local($_) = shift(@_); # Line to be printed + print MAKEFILE "$_\n"; + push(@Generated, "$_\n"); +} + +# Generates in MAKE file all the generated variable we have so far for +# final Makefile. This is mainly intended to allow expansion of variables +# which are already defined with an expand. +sub gen_variables { + undef %Gvars; # Reset already generated variables + local ($in_symbol) = 0; # True when in variable (Makefile's macro) + foreach (@Generated) { + if ($in_symbol) { + if (/^\s*(\w+)\s*=(.*)/) { # Missed the end of previous macro + $in_symbol = 0; + $Gvars{$1} = 1; # Definition of variable seen + $in_symbol = 1 if (/\\\s*$/); # There is a final '\' + print MAKE "void::\n"; # Cut incomplete esc sequence + } else { + $in_symbol = 0 if !(/\\\s*$/); # Last line + } + print MAKE; + } elsif (/^\s*(\w+)\s*=(.*)/ && !$in_symbol) { + # Found a makefile's macro declaration + $Gvars{$1} = 1; # Definition of variable seen + $in_symbol = 1 if (/\\\s*$/); # There is a final '\' + print MAKE; + } + } + print MAKE "void::\n"; # Cut incomplete escape sequence +} + +!NO!SUBS! +$grep -v '^;#' ../pl/tilde.pl >>jmake +chmod 755 jmake +$eunicefix jmake diff --git a/jmake/jmake.man b/jmake/jmake.man new file mode 100644 index 0000000..235b0ba --- /dev/null +++ b/jmake/jmake.man @@ -0,0 +1,398 @@ +''' $Id: jmake.man,v 3.0.1.1 1995/05/12 11:57:58 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: jmake.man,v $ +''' Revision 3.0.1.1 1995/05/12 11:57:58 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0 1993/08/18 12:04:18 ram +''' Baseline for dist 3.0 netwide release. +''' +.TH JMAKE 1 ram +.SH NAME +jmake \- a generic makefile builder +.SH SYNOPSIS +.B jmake +[ +.I cpp options +] +.SH DESCRIPTION +.I Jmake +builds a makefile out of a rather high level description held in a +.I Jmakefile +file. The generated file is a +.I Makefile.SH +rather than a simple makefile, which means it is ready to be used in +conjonction with +.I metaconfig. +In particular, parameters such as "where to install executables" will +be automatically determined by +.I Configure +and only the needed parameters will be taken into account. +.PP +To use +.I jmake +you have to write a +.I Jmakefile +first, which describes the way things are to be built. Your +.I Jmakefile +will be included inside a generic template through the C pre-processor. +This means you may use the usual C /**/ comments, but not the shell # comments. +The C comments will not appear in the generated +.I Makefile.SH +but lines starting with ;# will finally appear as shell comments. If you +have to write the string /* in the generated +.I Makefile.SH +then you have to escape it (otherwise +.I jmake +will think of it as the start of a C comment). Simply put a # in front +of the *, as in /#*. +.PP +You have a set of macros at your disposal, and all these macros are +listed in the Index file, along with the piece of code they will +expand to. Usually, a +.I Jmakefile +is fairly small and thus easier to maintain than a huge +.I Makefile. +Some internal powerful commands allow you to write +portable makefiles easily, without having to spend many efforts, because +someone else already did the job for you :-). +.PP +When you want to generate your makefile, you usually do not run +.I jmake +but use the +.I jmkmf +script which is a wrapper and will invoke +.I jmake +with the correct options. +.PP +All the knowledge of +.I jmake +is held in two files: the template +.I Jmake.tmpl +and the macro definition file +.I Jmake.rules. +The first file includes the second, along with the +.I Jmakefile. +It is sometimes necessary to know how things works to be able to correctly +use all the features provided. For instance, you may have to write your +own rules for a specific project. Although you cannot overwrite the +predefined rules, you can extent the +.I Jmake.rules +file or simply add your macros in your +.I Jmakefile. +You may also use +.I #include +statements when you want to share these macros and do not want to duplicate +the code. +.PP +The syntax in Jmake.rules is not elegant at all, but: +.sp +.PD 0 +.IP - +It is easy to parse (like sendmail.cf or troff files). +.IP - +The rules are not supposed to change very often. +.IP - +It is simple enough to be mastered in five minutes. :-) +.sp +Here is a small description: +.sp +.IP 1) +To deal with various \fIcpp\fR implementations: +.sp +.RS +.IP \(bu +Final @!\\ means: end of line, next line starts at the left margin. +.IP \(bu +Final @@\\ means: end of line, next line is to be indented by one tab. +.sp +.PP +There should always be one of @!\\ or @@\\ at the end of each line. +The only exception is for macros that are to be used as part of a +rule body (e.g. \fIRemoveTargetProgram\fR). In that case, the first +line (which holds the \fI#define\fR) should end with a single backslash. +.RE +.sp +.IP 2) +Symbol definitions: +.sp +.RS +.IP \(bu +>SYMBOL: defines the symbol. +.IP \(bu +?SYMBOL:<text>: keeps <text> iff SYMBOL is defined. +.IP \(bu +%SYMBOL:<text>: keeps <text> iff SYMBOL is not defined. +.sp +.PP +The ?SYM can be nested (logical AND), as in: +.sp +.in +5 +?SYMBOL:%TOKEN:text +.in -5 +.sp +which will keep text if SYMBOL is defined and TOKEN undefined. +To implement a logical OR, see below. +.RE +.sp +.IP 3) +Commands: +.sp +.RS +Commands can be passed to \fIjmake\fR. They start with a leading '|'. +Available commands are: +.sp +.IP \(bu +|suffix <sx>: adds <sx> to the .SUFFIXES: list in the makefile. +.IP \(bu +|rule:<text>: adds <text> to the building rule section. +.IP \(bu +|rule: <text>: same as before, with a leading tab. +.IP \(bu +|skip: skips text until a line starting with '-skip' is found. +.IP \(bu +|expand <pattern>: expand lines until '-expand' with <pattern>. A +complete example is shown below. +.IP \(bu +|once <symbol>: text up to '-once' appears only the first time. +.sp +.PP +Here is a way to implement a logical OR: +.sp +.in +5 +.nf +/* Implements SYMBOL or not TOKEN */ +?SYMBOL:text /* Keeps text if SYMBOL */ +%SYMBOL:|skip + %TOKEN:text /* Keeps text if not TOKEN */ +-skip +.fi +.in -5 +.sp +Actually, this is ugly, because the text has to appear twice. +Fortunately, I did not use it. :-) +.sp +.PP +The '|' commands cannot be nested. In particular, due to the simple +implementation of \fI|skip\fR, it is impossible to put \fI|skip\fR inside +a skipped part. However, a \fI|once\fR section may have \fI|skip\fR sections. +.sp +But actually, as you have surely already guessed, the best way to +implement a logical OR is to use De Morgan's Law: +.sp +.in +5 +.nf +not (p or q) <=> not p and not q + +/* Implements SYMBOL or not TOKEN (attempt #2) */ +%SYMBOL:?TOKEN:|skip +text /* If SYMBOL or not TOKEN */ +-skip +.sp +.in -5 +.fi +Who said they don't care ? ;-) +.sp +.PP +Expansion is done with the \fIexpand\fR command. It has been provided to +avoid some cumbersome writings in makefiles when you have to repeat some +silly lines that only differ in file names, for instance. Let's look at +an example first: +.sp +.in +5 +.nf +|expand a!foo bar! b!yes no! +!a:: + echo !a, !b +-expand +.fi +.in -5 +.sp +.PP +Then two rules will be printed, and the values of (a,b) for the first +will be (foo, yes), for the second (bar, no). Substitution is controled +by the '!' character. If the word to be substituted is part of another +one, detach with the ^^ construct as in: !b^^c. It is possible to +use Makefile macros in the <pattern>, and they will be expanded by +jmake. If this is not what you want, escape the first '$' sign (this is +a Makefile escape, i.e. you must double the '$', not precede it with a +backslash). A // stands for the null substitution value. +.sp +.PP +Here is another example which shows how the macro Expand can be used. +It is defined in \fIJmake.rules\fR as: +.sp +.in +5 +.nf +#define Expand(rule, pattern) @!\\ +|expand pattern @!\\ +rule @!\\ +-expand +.sp +.in -5 +.fi +So we can write in the \fIJmakefile\fR: +.sp +.in +5 +.nf +|skip +A = foo bar +-skip + +#define Rule @!\\ +$(DIR)/!a^^.o: !a^^.o @@\\ + $(CC) -c !a^^.c @@\\ + $(MV) !a^^.o $(DIR) + +Expand(Rule, a!$(A)!) +.sp +.in -5 +.fi +which will generate in \fIMakefile.SH\fR: +.sp +.in +5 +.nf +$(DIR)/foo.o: foo.o + $(CC) -c foo.c + $(MV) foo.o $(DIR) + +$(DIR)/bar.o: bar.o + $(CC) -c bar.c + $(MV) bar.o $$(DIR) +.sp +.in -5 +.fi +.sp +.PP +The 'A' declaration has been surrounded by \fIskip\fR, so that it does +not appear in the generated Makefile.SH, but it will be taken into +account by \fIjmake\fR for the substitution in the pattern. +.sp +.PP +The number of expansions is determined by the number of possible +values for the \fBfirst\fR parameter. If other parameters have less +substitution values, they will get void ones. +.sp +.PP +It is possible to add a regular expression at the end of '-expand'. This +regular expression will be removed from the final set of expansion at the +end of each line. It is also possible to do substitutions in the expanded +item, by using the syntax (if 'f' is the expanded variable) +!f:\fI<p>\fR=\fI<q>\fR +where \fI<p>\fR and \fI<q>\fR are two regular expressions (without spaces). +The pattern \fI<p>\fR will be replaced by the pattern \fI<q>\fR (only the first +occurrence will be replaced). +.sp +.PP +Finally, you may refer in the expanded section to variables whose value is +computed via another expansion, which makes it easy to define generic +\fIJmakefiles\fR. +.sp +Example: +.sp +.in +5 +.nf +SRC = foo.c bar.c +OBJ = \\ +|expand f!$(SRC)! + !f:\\.c=\\.o \\ +-expand \\\\ +INC = \\ +|expand f!$(OBJ)! + !f:\\.o=\\.h \\ +-expand \\\\ +.fi +.in -5 +.sp +which will generate in \fIMakefile.SH\fR: +.sp +.in +5 +.nf +SRC = foo.c bar.c +OBJ = \\ + foo.o \\ + bar.o +INC = \\ + foo.h \\ + bar.h +.in -5 +.fi +.sp +Do not forget to protect special characters in your regular expressions such +as backslash, point, etc... +.sp +.PP +The \fIonce\fR command is tagged with a name. The first time the name +appears, the once construct is ignored and the text up to '-once' will +be copied in the generated Makefile.SH. However, future occurences of +the same name will be ignored (\fIonce\fR will behave like \fIskip\fR). +.sp +Example: +.sp +.in +5 +.nf +|once this_is_a_name +<text> +-once +.sp +.in -5 +.fi +.sp +.RE +.IP 4) +Initializations: +.sp +.RS +.IP \(bu ++<line>: Puts the whole line in the initialization section. +.IP \(bu +++SYMBOL <value>: Adds <value> to the SYMBOL macro. +.RE +.sp +.IP 5) +User-defined variables: +.sp +The user may define CFLAGS, LDFLAGS or DPFLAGS as additional flags to be used +in C compilation, linking phase or depend target. It is thus possible to add +some extra flags such as -I or libraries for Makefiles in specific +sub-directories. +.sp +.PD +.SH AUTHOR +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH FILES +.PD 0 +.TP 20 +Jmakefile +High level description of Makefile.SH +.TP +Jmake.rules +File holding the macro definitions +.TP +Jmake.tmpl +Template used to mould Makefile.SH +.PD +.SH BUGS +On systems whose +.I cpp +reduces multiple tabs and spaces to a single space, +.I jmake +attempts to put back any necessary tabs (which +.I make +expects in front of rules) but does not properly formats the +body of the rule itself. +.PP +There is a bootstraping problem when creating the first Makefile.SH, because +you cannot run it through a shell until there is a decent Configure +script, but you can't run \fImetaconfig\fR before there is a Makefile.SH +or some needed symbols will not be defined. +.SH "SEE ALSO" +jmkmf(1), metaconfig(1). diff --git a/jmake/jmkmf.SH b/jmake/jmkmf.SH new file mode 100755 index 0000000..8648306 --- /dev/null +++ b/jmake/jmkmf.SH @@ -0,0 +1,71 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting jmake/jmkmf (with variable substitutions)" +$spitshell >jmkmf <<!GROK!THIS! +$startsh +!GROK!THIS! +$spitshell >>jmkmf <<'!NO!SUBS!' +# @(#) Generates a Makefile from a Jmakefile + +# $Id: jmkmf.SH,v 3.0.1.1 1993/08/19 06:42:14 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: jmkmf.SH,v $ +# Revision 3.0.1.1 1993/08/19 06:42:14 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:19 ram +# Baseline for dist 3.0 netwide release. +# + +usage="usage: $0 [top_of_sources_pathname [current_directory]]" + +topdir=. +curdir=. + +case $# in + 0) ;; + 1) topdir=$1 ;; + 2) topdir=$1 curdir=$2 ;; + *) echo "$usage" 1>&2; exit 1 ;; +esac + +case "$topdir" in + -*) echo "$usage" 1>&2; exit 1 ;; +esac + +if test -f Makefile.SH; then + echo mv Makefile.SH Makefile.SH~ + mv Makefile.SH Makefile.SH~ +fi + +args="-DTOPDIR=$topdir -DCURDIR=$curdir" + +echo jmake $args +jmake $args +echo sh Makefile.SH +sh Makefile.SH +!NO!SUBS! +chmod 755 jmkmf +$eunicefix jmkmf diff --git a/jmake/jmkmf.man b/jmake/jmkmf.man new file mode 100644 index 0000000..d39b1f7 --- /dev/null +++ b/jmake/jmkmf.man @@ -0,0 +1,70 @@ +''' $Id: jmkmf.man,v 3.0.1.1 1995/05/12 11:58:03 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: jmkmf.man,v $ +''' Revision 3.0.1.1 1995/05/12 11:58:03 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0 1993/08/18 12:04:20 ram +''' Baseline for dist 3.0 netwide release. +''' +.TH JMKMF 1 ram +.SH NAME +jmkmf \- runs jmake with the correct options +.SH SYNOPSIS +.B jmkmf +[ +.I top-level dir +[ +.I current dir +] +] +.SH DESCRIPTION +.I Jmkmf +is a wrapper which calls +.I jmake +with the correct options, defining the symbols +.SM TOPDIR +(location of the top-level directory) and +.SM CURDIR +(current directory). The generated +.I Makefile.SH +is then ran through +.I /bin/sh +to produce a +.I Makefile. +.PP +.I Jmkmf +is useful when you generate a makefile for the first time. +Once you have a +.I Makefile.SH +generated by +.I jmake, +you can use +.I make Makefile.SH +to build the Makefile.SH again and +.I make Makefile +to run the Makefile.SH through +.I /bin/sh. +To use the recursive commands, you have to append an 's' at the +end of the name as in +.I make Makefiles.SH +and +.I make Makefiles. +.SH AUTHOR +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH FILES +.PD 0 +.TP 20 +Jmakefile +High level description of makefile +.PD +.SH "SEE ALSO" +jmake(1). diff --git a/kit/Jmakefile b/kit/Jmakefile new file mode 100644 index 0000000..cfeca34 --- /dev/null +++ b/kit/Jmakefile @@ -0,0 +1,49 @@ +/* + * Jmakefile for kit maker + */ + +;# $Id: Jmakefile,v 3.0.1.2 1994/04/22 09:35:35 ram Exp $ +;# +;# Copyright (c) 1991-1993, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 3.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.2 1994/04/22 09:35:35 ram +;# patch23: new kitpost script +;# +;# Revision 3.0.1.1 1994/01/24 13:42:21 ram +;# patch16: added dependency generation stage +;# +;# Revision 3.0 1993/08/18 12:04:21 ram +;# Baseline for dist 3.0 netwide release. +;# + +SCRIPT = makedist manifake kitsend kitpost + +ShellScriptTarget($(SCRIPT)) +InstallScript(makeSH,$(SCRIPTDIR)) +InstallManPage(makeSH,$(MANSRC)) + +SCRIPTSH = \ +|expand f!$(SCRIPT)! + !f.SH \ +-expand \\ + +>SED +>RM +>MKDEP + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(SCRIPTSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>[ ]*\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + diff --git a/kit/Makefile.SH b/kit/Makefile.SH new file mode 100644 index 0000000..f1e5209 --- /dev/null +++ b/kit/Makefile.SH @@ -0,0 +1,235 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44] +: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=kit +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` + +$spitshell >Makefile <<!GROK!THIS! +######################################################################## +# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = .. +CURRENT = $CURRENT +DIR = $DIR +INSTALL = $INSTALL + +######################################################################## +# Parameters set by Configure -- edit config.sh if changes are needed + +CTAGS = ctags +L = $manext +MANSRC = $installmansrc +MAKE = make +MKDEP = $mkdep \$(DPFLAGS) -- +MV = $mv +RM = $rm -f +SCRIPTDIR = $installscript +SED = $sed + +######################################################################## +# Automatically generated parameters -- do not edit + +SCRIPTS = \$(SCRIPT) + +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $ + +######################################################################## +# Force 'make depend' to be performed first -- do not edit + +.FORCE_DEPEND:: + +all:: .FORCE_DEPEND + +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.2 1994/04/22 09:35:35 ram Exp ram $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.2 1994/04/22 09:35:35 ram +# patch23: new kitpost script +# +# Revision 3.0.1.1 1994/01/24 13:42:21 ram +# patch16: added dependency generation stage +# +# Revision 3.0 1993/08/18 12:04:21 ram +# Baseline for dist 3.0 netwide release. +# + +SCRIPT = makedist manifake kitsend kitpost + +all:: $(SCRIPT) + +local_realclean:: + $(RM) $(SCRIPT) + +makedist: makedist.SH + /bin/sh makedist.SH + +manifake: manifake.SH + /bin/sh manifake.SH + +kitsend: kitsend.SH + /bin/sh kitsend.SH + +kitpost: kitpost.SH + /bin/sh kitpost.SH + + +install:: $(SCRIPTS) $(LSCRIPTS) + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(INSTALL) -c -m 555 $$file $(SCRIPTDIR)); \ + done + +deinstall:: + @for file in $(SCRIPTS) $(LSCRIPTS); do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; $(RM) $(SCRIPTDIR)/$$file); \ + done + +install.man:: + @if test "$(MANSRC)"; then \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; \ + $(INSTALL) -c -m 444 $$file.man $(MANSRC)/$$file.$(L)); \ + done; \ + else exit 0; fi + +deinstall.man:: + @if test "$(MANSRC)"; then \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for file in $(SCRIPTS); do \ + (set -x; $(RM) $(MANSRC)/$$file.$(L)); \ + done; \ + else exit 0; fi + +install:: makeSH + $(INSTALL) -c -m 555 makeSH $(SCRIPTDIR) + +deinstall:: + $(RM) $(SCRIPTDIR)/makeSH + +install.man:: makeSH.man + $(INSTALL) -c -m 444 makeSH.man $(MANSRC)/makeSH.$(L) + +deinstall.man:: + $(RM) $(MANSRC)/makeSH.$(L) + +SCRIPTSH = \ + makedist.SH \ + manifake.SH \ + kitsend.SH \ + kitpost.SH + +depend:: + ($(SED) '/^# DO NOT DELETE/q' Makefile && \ + grep '^\$$grep' $(SCRIPTSH) | \ + $(SED) -e "s/^.*' \([^ ]*\) >>[ ]*\([^ ]*\)/\2: \1/" \ + ) > Makefile.new + cp Makefile Makefile.bak + cp Makefile.new Makefile + $(RM) Makefile.new + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: local_clean +realclean: local_realclean +clobber: local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + +local_clobber:: local_realclean + $(RM) Makefile config.sh + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; exit 0; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Empty rules for directories with no sub-directories -- do not edit + +install:: + @echo "install in $(CURRENT) done." + +deinstall:: + @echo "deinstall in $(CURRENT) done." + +install.man:: + @echo "install.man in $(CURRENT) done." + +deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." + +Makefiles:: + +Makefiles.SH:: + +######################################################################## +# Dependencies generated by make depend +# DO NOT DELETE THIS LINE -- make depend relies on it + +# Put nothing here or make depend will gobble it up +.FORCE_DEPEND:: + @echo "You must run 'make depend' in $(TOP) first."; exit 1 +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/kit/README b/kit/README new file mode 100644 index 0000000..a521da2 --- /dev/null +++ b/kit/README @@ -0,0 +1,35 @@ +This directory contains a rudimentary kit maker. + +N.B.: This must not be confused with the kit package, which is a set of shell +scripts for sending arbitrary files and directories by mail and unpacking them. +One could call kit a binary tarmailer. The kit package has been released +separately from dist (posted on comp.sources.unix in 1991). + +Larry Wall said: + + Depending on where you are going to send your kits you might prefer + to use Rich $alz's kit maker instead--it makes more robust kits + but assumes more about the target system. + +I say: + + If you are using RCS 4.3, be sure to use makedist instead of your + own shell archiver, unless you do not use $Id, $Header or $Locker + markers. Moreover, makedist will take the latest checked in + revision intead of the working file, so that you archive a coherent + package even if you made some mods since the last patch. + +You run makedist in the top level directory of your package and it uses +the MANIFEST.new file to generate shar scripts of about 50000 bytes each. + +Just make sure MANIFEST.new contains everything you want, including any +Configure, config.h.SH, or patchlevel.h files. A prototype patchlevel.h +may be found in ../gen/patchlevel.h. See the manpage for more details. + +If you do not wish to build up shell archives but an up-to-date copy of +your source tree, run someting like: + + makedist -c dir + +to build an up-to-date source tree in dir, which you can then archive using +your own shell archiver. diff --git a/kit/kitpost.SH b/kit/kitpost.SH new file mode 100644 index 0000000..d8f3c81 --- /dev/null +++ b/kit/kitpost.SH @@ -0,0 +1,237 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting kit/kitpost (with variable substitutions)" +cat >kitpost <<!GROK!THIS! +$startperl + eval "exec perl -S \$0 \$*" + if \$running_under_some_shell; + +# $Id: kitpost.SH,v 3.0.1.2 1994/10/29 15:48:26 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: kitpost.SH,v $ +# Revision 3.0.1.2 1994/10/29 15:48:26 ram +# patch36: don't use rootid as a variable, it is known by metaconfig +# +# Revision 3.0.1.1 1994/05/06 13:54:53 ram +# patch23: created +# + +\$inews='${inews-/usr/lib/news/inews}'; +\$mailer='$mailer'; +\$orgname='$orgname'; +\$version = '$VERSION'; +\$patchlevel = '$PATCHLEVEL'; +!GROK!THIS! + +cat >>kitpost <<'!NO!SUBS!' + +$progname = &profile; # Read ~/.dist_profile +require 'getopts.pl'; +&usage unless $#ARGV >= 0; +&usage unless &Getopts("hrVm:D:H:"); + +if ($opt_V) { + print STDERR "$progname $version PL$patchlevel\n"; + exit 0; +} elsif ($opt_h) { + &usage; +} + +$RCSEXT = ',v' unless $RCSEXT; +if ($inews eq 'inews') { + $inews = '/usr/lib/news/inews' if -f '/usr/lib/news/inews'; +} + +chdir '..' if -d '../bugs'; + +&readpackage; + +$orgname = &tilda_expand($orgname); +chop($orgname = `cat $orgname`) if $orgname =~ m|^/|; + +if ($opt_r) { + $repost = ' (REPOST)'; +} + +while ($_ = shift) { + if (/^(kit)?[1-9][\d\-]*$/) { + s/^kit//; + push(@argv,$_); + } else { + push(@ngroups,$_); + } +} +$ngroups = join(',',@ngroups) unless $#ngroups < 0; +$dest = $opt_m; +&usage unless $ngroups || $dest; + +@ARGV = @argv; + +if (-f "$package.kit10") { + @filelist = <$package.kit[0-9][0-9]>; +} +else { + @filelist = <$package.kit[0-9]>; +} +pop(@filelist) =~ /(\d+)$/ && ($maxnum = $1 + 0); + +if ($#ARGV < 0) { + $argv = "1-$maxnum"; + @ARGV = $argv; +} + +$argv = &rangeargs(@ARGV); +@ARGV = split(' ', $argv); + +$argv =~ s/ $//; + +if ($#ARGV < 0) { + print STDERR "$progname: no kits specified.\n"; + &usage; +} else { + local($s) = $#ARGV ? 's' : ''; + print "$progname: posting $package $baserev kit$s $argv to $ngroups...\n" + if $ngroups; + print "$progname: mailing $package $baserev kit$s $argv to $dest...\n" + if $dest; +} + +$desc = "$opt_D, " if $opt_D; + +fork && exit; + +# Compute a suitable root message ID that all parts will reference, so that +# threaded news readers will correctly process them. +# Unfortunately, this works only when all kits are sent. +($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = + localtime(time); +$mon++; +$rootmid = "$year$mon$mday$hour$min$sec.AA$$"; +$first = $maxnum >= 10 ? "01" : "1"; +$rootmsgid = "<$rootmid.P$first.$maintloc>"; + +until ($#ARGV < 0) { + $kitnum = shift; + $kitnum = "0$kitnum" if $kitnum < 10 && $maxnum >= 10; + open(FILE, "$package.kit$kitnum") || + die "$progname: can't open $package.kit$kitnum: $!\n"; + if ($ngroups) { + open(INEWS,"|$inews -h") || die "$progname: can't fork $inews: $!\n"; + } + if ($dest) { + $opt = '-odq' if $mailer =~ /sendmail/; + $dest =~ s/,/ /g; + ($to = $dest) =~ s/\s+/, /g; + open(MAILER,"|$mailer $opt $dest") || + die "$progname: can't fork $mailer: $!\n"; + } + + $msg_id = "<$rootmid.P$kitnum.$maintloc>"; + $msg_id = $rootmsgid if $kitnum == 1; + $msg_id .= "\nReferences: $rootmsgid" if $kitnum != 1; + + print INEWS "Newsgroups: $ngroups\n"; + print MAILER "To: $to\n"; +$head = <<EOH; +Subject: $package $baserev - ${desc}part$kitnum/$maxnum$repost +Message-ID: $msg_id +Organization: $orgname + +Submitted-by: $maintname <$maintloc> +Archive-name: $package-$baserev/part$kitnum +Environment: UNIX + +EOH + print INEWS $head; + print MAILER $head; + + if ($kitnum == 1 && $opt_H) { + open(HEAD, $opt_H) || warn "$progname: can't open $opt_H: $!\n"; + while (<HEAD>) { + print INEWS; + print MAILER; + } + close HEAD; + } + + while (<FILE>) { + print INEWS; + print MAILER; + } + close FILE; + close INEWS; + die "$progname: could not post part$kitnum.\n" if $ngroups && $?; + close MAILER; + die "$progname: could not send part$kitnum.\n" if $dest && $?; +} + +sub usage { + print STDERR <<EOM; +Usage: $progname [-hrV] [-H file] [-D desc] [-m dest1,dest2] [kits] [newsgroups] + -h : print this message and exit + -m : set-up recipients for (additional) mailing + -r : signals a repost + -D : specify description string for subject line + -H : specify file to be used as header for first part + -V : print version number and exit +EOM + exit 1; +} + +sub rangeargs { + local($result) = ''; + local($min,$max,$_); + while ($#_ >= 0) { + $_ = shift(@_); + while (/^\s*\d/) { + s/^\s*(\d+)//; + $min = $1; + if (s/^,//) { + $max = $min; + } + elsif (s/^-(\d*)//) { + $max = $1; + if ($max == 0 && $maxnum) { + $max = $maxnum; + } + s/^[^,],?//; + } + else { + $max = $min; + } + for ($i = $min; $i <= $max; ++$i) { + $result .= $i . ' '; + } + } + } + $result; +} + +!NO!SUBS! +$grep -v '^;#' ../pl/package.pl >>kitpost +$grep -v '^;#' ../pl/tilde.pl >>kitpost +$grep -v '^;#' ../pl/profile.pl >>kitpost +chmod +x kitpost +$eunicefix kitpost diff --git a/kit/kitpost.man b/kit/kitpost.man new file mode 100644 index 0000000..4e87a03 --- /dev/null +++ b/kit/kitpost.man @@ -0,0 +1,89 @@ +''' $Id: kitpost.man,v 3.0.1.2 1995/05/12 11:58:09 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: kitpost.man,v $ +''' Revision 3.0.1.2 1995/05/12 11:58:09 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0.1.1 1994/05/06 13:55:01 ram +''' patch23: created +''' +.TH KITSEND 1 ram +.SH NAME +kitpost \- posts distribution kits +.SH SYNOPSIS +.B kitpost +[ +.B \-hrV +] [ +.B -H +.I file +] [ +.B -D +.I desc +] [ +.B -m +.I dest1,dest2 +] [ +.I kits +] [ +.I newsgroups +] +.SH DESCRIPTION +.I Kitpost +posts distribution kits made by \fImakedist\fR to some (source) newsgroups +specified on the command line. If you do not specify any kit list, then all the +kits are sent. Otherwise, only the specified kits will be (re)sent. +.PP +A kit list may include ranges, \fI1-10\fR specifying kits 1 through 10, +and \fI5-\fR meaning kits 5 up to the last one. You may also specify kit +numbers by separating them with commas or spaces, and even mix with ranges, +such as: \fI1 3 5-7 9\fR. +.PP +.I Kitpost +ensures correct \fIReferences:\fR lines are inserted in your postings so that +all parts but the first point to the root article. Threaded newsreaders and +end-users traditionally appreciate that. +.SH OPTIONS +The following options are recognized by \fIkitpost\fR: +.TP 10 +.B \-h +Print help message and exit. +.TP +\fB\-m\fI dest1,destn\fR +Sends kits by e-mail to the specified recipients. This option may be used in +conjunction with newsgroup posting. It is mainly intended for sites where +direct posting to a moderated newsgroup is not allowed by \fIinews\fR. You may +thus send your kits to the newsgroup moderator in a form that will ease the +whole posting process. +.TP +.B \-r +Signals a repost. +.TP +\fB\-D\fI description\fR +Specify a description string that will be added to the subject line. Usually +a brief sentence (less than, say, 40 characters). +.TP +\fB\-H\fI file\fR +Specify a file to be used as header introduction in the first part of your +posting. Usually the root README file. +.TP +.B \-V +Print version number and exit. +.SH BUGS +Article cross-referencing is properly set-up only when the whole package is +(re)posted in one batch. +.PP +It is not currently possible to set-up the article headers manually or +better, interactively. +.SH AUTHOR +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH "SEE ALSO" +makedist(1), kitsend(1). diff --git a/kit/kitsend.SH b/kit/kitsend.SH new file mode 100755 index 0000000..30b1d62 --- /dev/null +++ b/kit/kitsend.SH @@ -0,0 +1,192 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting kit/kitsend (with variable substitutions)" +cat >kitsend <<!GROK!THIS! +$startperl + eval 'exec perl -S \$0 "\$@"' + if \$running_under_some_shell; + +# $Id: kitsend.SH,v 3.0.1.2 1994/05/06 13:59:57 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# Original Author: Harlan Stenn <harlan@mumps.pfcs.com> +# +# $Log: kitsend.SH,v $ +# Revision 3.0.1.2 1994/05/06 13:59:57 ram +# patch23: random code cleanup to follow pat tools style +# patch23: made configurable from dist profile +# patch23: now understands -V and -h options +# patch23: mails now flagged with a bulk precedence +# patch23: added X-Mailer header and now calls mailer via open() +# +# Revision 3.0.1.1 1993/08/19 06:42:15 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:25 ram +# Baseline for dist 3.0 netwide release. +# + +\$orgname='$orgname'; +\$mailer='$mailer'; +\$version = '$VERSION'; +\$patchlevel = '$PATCHLEVEL'; +!GROK!THIS! +cat >>kitsend <<'!NO!SUBS!' + +$progname = &profile; # Read ~/.dist_profile +require 'getopts.pl'; +&usage unless &Getopts('hV'); + +if ($opt_V) { + print STDERR "$progname $version PL$patchlevel\n"; + exit 0; +} elsif ($opt_h) { + &usage; +} + +$orgname = &tilda_expand($orgname); +chop($orgname = `cat $orgname`) if $orgname =~ m|^/|; + +&readpackage; + +while ($_ = shift) { + if (/^(kit)?[1-9][\d,-]*$/) { + s/^kit//; + push(@argv, $_); + } + else { + push(@dest, $_); + } +} +$dest = join(' ',@dest); +&usage unless $dest; + +@ARGV = @argv; + +if (-f "$package.kit10") { + @filelist = <$package.kit[0-9][0-9]>; +} +else { + @filelist = <$package.kit[0-9]>; +} +pop(@filelist) =~ /(\d+)$/ && ($maxnum = $1 + 0); + +if ($#ARGV < 0) { + $argv = "1-$maxnum"; + @ARGV = $argv; +} +$argv = &rangeargs(@ARGV); +@ARGV = split(' ', $argv); + +$argv =~ s/ $//; + +if ($#ARGV < 0) { + die "$progname: no kits specified.\n"; +} elsif ($#ARGV) { + print "$progname: sending $package $baserev kits $argv to $dest...\n"; +} else { + print "$progname: sending $package $baserev kit $argv to $dest...\n"; +} + +fork && exit; + +$opt = '-odq' if $mailer =~ /sendmail/; + +until ($#ARGV < 0) { + $kitnum = shift; + + # Provision for broken mailers... + @dest = split(' ', $dest); + while (@smalldest = splice(@dest, 0, 50)) { + $to = join(', ', @smalldest); # Sensible To: for sendmail + $smalldest = join(' ', @smalldest); + + open(MAILER, "|$mailer $opt $smalldest") || + die "$progname: can't fork $mailer: $!\n"; + print MAILER +"To: $to +Subject: $package $baserev kit #$kitnum +Precedence: bulk +X-Mailer: dist [version $version PL$patchlevel] +Organization: $orgname + +[There are $maxnum kits for $package version $baserev.] + +"; + $kitnum = "0$kitnum" if $kitnum < 10 && $maxnum >= 10; + open(FILE,"$package.kit$kitnum") || + die "$progname: can't open $package.kit$kitnum: $!\n"; + while (<FILE>) { + print MAILER; + } + close FILE; + close MAILER; + warn "$progname: ERROR mailing of $package.kit$kitnum to $dest\n" if $?; + } +} + +sub usage { + print STDERR <<EOM; +Usage: $progname [-hV] [kits] dest + -h : print this message and exit + -V : print version number and exit +EOM + exit 1; +} + +sub rangeargs { + local($result) = ''; + local($min,$max,$_); + while ($#_ >= 0) { + $_ = shift(@_); + while (/^\s*\d/) { + s/^\s*(\d+)//; + $min = $1; + if (s/^,//) { + $max = $min; + } + elsif (s/^-(\d*)//) { + $max = $1; + if ($max == 0 && $maxnum) { + $max = $maxnum; + } + s/^[^,],?//; + } + else { + $max = $min; + } + for ($i = $min; $i <= $max; ++$i) { + $result .= $i . ' '; + } + } + } + $result; +} + +!NO!SUBS! +$grep -v '^;#' ../pl/package.pl >>kitsend +$grep -v '^;#' ../pl/tilde.pl >>kitsend +$grep -v '^;#' ../pl/profile.pl >>kitsend +chmod +x kitsend +$eunicefix kitsend diff --git a/kit/kitsend.man b/kit/kitsend.man new file mode 100644 index 0000000..751835b --- /dev/null +++ b/kit/kitsend.man @@ -0,0 +1,42 @@ +''' $Id: kitsend.man,v 3.0.1.1 1994/05/06 14:00:11 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: kitsend.man,v $ +''' Revision 3.0.1.1 1994/05/06 14:00:11 ram +''' patch23: documented new -V and -h options +''' +''' Revision 3.0 1993/08/18 12:04:26 ram +''' Baseline for dist 3.0 netwide release. +''' +.TH KITSEND 1 ram +.SH NAME +kitsend \- sends distribution kits +.SH SYNOPSIS +.B kitsend +[ +.B \-hV +] [ \fIkits\fR ] \fIrecipients\fR +.SH DESCRIPTION +.I Kitsend +sends distribution kits made by \fImakedist\fR to some recipients specified +on the command line. If you do not specify any kit list, then all the +kits are sent. Otherwise, only the specified kits will be (re)sent. +.PP +A kit list may include ranges, \fI1-10\fR specifying kits 1 through 10, +and \fI5-\fR meaning kits 5 up to the last one. You may also specify kit +numbers by separating them with commas or spaces, and even mix with ranges, +such as: \fI1 3 5-7 9\fR. +.PP +The \fB\-h\fR switch will print out the usage and \fB-V\fR will print +the version number. +.SH AUTHOR +Harlan Stenn <harlan@mumps.pfcs.com> +.SH "SEE ALSO" +makedist(1), kitpost(1). diff --git a/kit/makeSH b/kit/makeSH new file mode 100644 index 0000000..cdaade1 --- /dev/null +++ b/kit/makeSH @@ -0,0 +1,76 @@ +#!/bin/sh + +# $Id: makeSH,v 3.0.1.1 1993/08/19 06:42:16 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# Original Author: Larry Wall <lwall@netlabs.com> +# +# $Log: makeSH,v $ +# Revision 3.0.1.1 1993/08/19 06:42:16 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:26 ram +# Baseline for dist 3.0 netwide release. +# + +for file do + if test -f $file.SH; then + mv $file.SH $file.SH.old + echo "makeSH: renaming $file.SH as $file.SH.old." + fi + base=`basename $file` + + cat >$file.SH <<BLURFL +case \$CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . \$TOP/config.sh + ;; +esac +: This forces SH files to create target in same directory as SH file. +: This is so that make depend always knows where to find SH derivatives. +case "\$0" in +*/*) cd \`expr X\$0 : 'X\(.*\)/'\` ;; +esac +echo "Extracting $file (with variable substitutions)" +: This section of the file will have variable substitutions done on it. +: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. +: Protect any dollar signs and backticks that you do not want interpreted +: by putting a backslash in front. You may delete these comments. +\$spitshell >$base <<!GROK!THIS! +BLURFL + + case `head -1 $file` in + */bin/sh) echo '$startsh' >>$file.SH ;; + esac + + cat >>$file.SH <<BLURFL +!GROK!THIS! + +: In the following dollars and backticks do not need the extra backslash. +\$spitshell >>$base <<'!NO!SUBS!' +BLURFL + + sed -e '1{' -e '/#!.*\/bin\/sh$/d' -e '}' $file >>$file.SH + + cat >>$file.SH <<BLURFL +!NO!SUBS! +chmod 755 $base +\$eunicefix $base +BLURFL + chmod 755 $file.SH +done diff --git a/kit/makeSH.man b/kit/makeSH.man new file mode 100644 index 0000000..434648a --- /dev/null +++ b/kit/makeSH.man @@ -0,0 +1,46 @@ +''' $Id: makeSH.man,v 3.0 1993/08/18 12:04:27 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: makeSH.man,v $ +''' Revision 3.0 1993/08/18 12:04:27 ram +''' Baseline for dist 3.0 netwide release. +''' +''' +.TH MAKESH 1 LOCAL +.SH NAME +makeSH \- a .SH script maker +.SH SYNOPSIS +.B makeSH +.I files +.SH DESCRIPTION +.I MakeSH +examines one or more scripts and produces a .SH file that, when run under sh, +will produce the original script. +The .SH script so produced has two sections containing code destined for +the output. +The first section has variable substitutions performed on it (taking values +from config.sh), while the second section does not. +MakeSH does not know which variables you want to have substituted, so it puts +the whole script into the second section. +It's up to you to insert any variable substitutions in the first section +for any values you want from config.sh. +.PP +You should run +.I makeSH +from within your top-level directory and use the relative path to the file +as an argument, so that the "Extracting ..." line printed while running +the produced .SH file later on will give that same path. +.SH AUTHOR +Larry Wall <lwall@netlabs.com> +.SH SEE ALSO +pat(1), metaconfig(1), makedist(1). +.SH BUGS +It could assume that variables from metaconfig's Glossary need to be +initialized in the first section, but I'm too lazy to make it do that. diff --git a/kit/makedist.SH b/kit/makedist.SH new file mode 100644 index 0000000..9e61076 --- /dev/null +++ b/kit/makedist.SH @@ -0,0 +1,460 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +echo "Extracting kit/makedist (with variable substitutions)" +cat >makedist <<!GROK!THIS! +$startperl + eval "exec perl -S \$0 \$*" + if \$running_under_some_shell; + +# $Id: makedist.SH,v 3.0.1.2 1994/01/24 13:58:20 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: makedist.SH,v $ +# Revision 3.0.1.2 1994/01/24 13:58:20 ram +# patch16: modified call to manifake to trap exceptions manually +# patch16: removed final sed post-processing to allow 'make depend' target +# patch16: added ~/.dist_profile awareness +# +# Revision 3.0.1.1 1993/08/19 06:42:17 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:28 ram +# Baseline for dist 3.0 netwide release. +# + +\$version = '$VERSION'; +\$patchlevel = '$PATCHLEVEL'; +!GROK!THIS! +$spitshell >>makedist <<'!NO!SUBS!' + +&profile; # Read ~/.dist_profile +require 'getopts.pl'; +&usage unless &Getopts('c:f:dhvqs:V'); + +$ENV{'DIST'} = '/dev/null'; # Disable ~/.dist_profile + +if ($opt_V) { + print STDERR "makedist $version PL$patchlevel\n"; + exit 0; +} elsif ($opt_h) { + &usage; +} + +$MAXKITSIZE = 50000 unless $MAXKITSIZE = $opt_s; +$KITOVERHEAD = 1800; +$FILEOVERHEAD = 90; +$CHOPSIZE = $MAXKITSIZE - $KITOVERHEAD - $FILEOVERHEAD; + +$NEWMANI = 'MANIFEST.new' unless $NEWMANI = $opt_f; +$MANI = 'MANIFEST' unless $opt_f; +$PACKLIST = 'PACKLIST'; +$PACKNOTES = 'PACKNOTES'; + +$tmpdir = "/tmp/MKst$$"; # Where to copy distribution +$tmpdir = '.' if $opt_q; # Quick mode: no need to copy distribution + +&set_sig('aborted'); # Make sure we clean up in case of emergency + +&readpackage; +&get_patchlevel; + +eval '&manifake'; # Want to trap possible die and redirect to fatal +if ($@ ne '') { + chop($@); + &fatal($@); +} + +if ($opt_c) { # Copy distribution only, no shell archive + &distcopy; + exit 0; +} + +&distfake; +©right'init($copyright) if -f $copyright; + +unlink <$package.kit? $package.kit??>; +chop($curdir = `pwd`); +chdir $tmpdir || die "Can't chdir to $tmpdir.\n"; + +&maniread; +&kitlists; +&manimake; +&kitbuild; +&cleanup; +exit 0; + +# Physically build the kits +sub kitbuild { + $numkits = $#list; + if ($numkits > 9) { + $sp = '%02d'; + } else { + $sp = '%d'; + } + + for ($kitnum = 1; $kitnum <= $numkits; $kitnum++) { + $list = $list[$kitnum]; + $kit = sprintf("$package.kit" . $sp,$kitnum); + print "*** Making $kit ***\n"; + open(KIT,">$curdir/$kit") || do fatal("Can't create $curdir/$kit: $!"); + + &kitleader; + + @files = split(' ',$list); + reset 'X'; + for $file (@files) { + $_ = $file; + while (s|^(.*)/.*$|$1|) { + push(@Xdirs,$_) unless $Xseen{$_}++; + } + } + print KIT "mkdir ",join(' ', sort @Xdirs)," 2>/dev/null\n"; + + foreach $file (@files) { + print "\t",$file,"\n" if $opt_v; + print KIT "echo Extracting $file\n"; + print KIT "sed >$file <<'!STUFFY!FUNK!' -e 's/X//'\n"; + open(FILE, $file); + ©right'reset; # Reset copyright for new file + while (<FILE>) { + # Use Lock[e]r as a pattern in case it is applied on ourselves + s|Lock[e]r:.*\$|\$|; # Remove locker mark + print KIT ©right'filter($_, 'X'); + } + close FILE; + print KIT "!STUFFY!FUNK!\n"; + -x "$file" && (print KIT "chmod +x $file\n"); + } + &kittrailer; + chmod 0755, $kit; + } +} + +sub kitlists { + for $filename (keys %comment) { + next if $filename =~ m|/$|; # Skip directories + next if -d $filename; # Better safe than sorry + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, + $blksize,$blocks) = stat($filename); + + # Make sure file is not larger than the CHOPSIZE limit. If it is, + # a split is attempted. + if ($size > $CHOPSIZE) { + print "Splitting $filename...\n" if $opt_v; + $file_comment = $comment{$filename}; + open(FILE, $filename) || die "Can't open $filename: $!\n"; + $piece = 'AA'; + ($dir, $name) = ('.', $filename) + unless ($dir, $name) = ($filename =~ m|(.*)/(.*)|); + $chopped = $dir . '/' . substr($name, 0, 11); + $chopped =~ s|^\./||; + &fatal("There is already a split file named $chopped") + if defined $Chopped{$chopped}; + $Chopped{$chopped} = $filename; # Association split <-> real file + $size = 0; + open(CURPIECE, ">$chopped:$piece") || + &fatal("Can't create $chopped:$piece: $!"); + while (<FILE>) { + if ($size + length($_) > $CHOPSIZE) { + close CURPIECE; + $size{"$chopped:$piece"} = $size; + $comment{"$chopped:$piece"} = "$file_comment (part $piece)"; + push(@files, "$chopped:$piece"); + print "\t$chopped:$piece ($size bytes)\n" if $opt_v; + $size = 0; + $piece++; # AA -> AB, etc... + open(CURPIECE, ">$chopped:$piece") || + &fatal("Can't create $chopped:$piece: $!"); + } + print CURPIECE $_; + $size += length($_); + } + close FILE; + close CURPIECE; + $size{"$chopped:$piece"} = $size; + $comment{"$chopped:$piece"} = "$file_comment (part $piece)"; + push(@files, "$chopped:$piece"); + print "\t$chopped:$piece ($size bytes)\n" if $opt_v; + delete $comment{$filename}; # File split, not in PACKLIST + } else { + $size += 1000000 if $filename =~ /README/; + $size{$filename} = $size; + push(@files, "$filename"); + } + } + + # Build a file PACKNOTES to reconstruct split files + if (defined %Chopped) { + open(PACKNOTES, ">$PACKNOTES") || &fatal("Can't create PACKNOTES: $!"); + foreach (keys %Chopped) { + print PACKNOTES <<EOC; +echo 'Building $Chopped{$_}...' +cat $_:[A-Z][A-Z] > $Chopped{$_} +rm -f $_:[A-Z][A-Z] +EOC + } + close PACKNOTES; + push(@files, $PACKNOTES); + $comment{$PACKNOTES} = 'Script to reconstruct split files'; + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, + $blksize,$blocks) = stat($PACKNOTES); + $size{$PACKNOTES} = $size; + } + + # Currently, file PACKLIST does not exist, so its size is unknown and + # it cannot be correctly put in one archive. Therefore, we take the + # size of MANIFEST.new, which will give us a good estimation. + push(@files, 'PACKLIST'); + + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, + $blksize,$blocks) = stat($NEWMANI); + $size{$PACKLIST} = $size; + + sub revnum { $size{$a} < $size{$b} ? 1 : $size{$a} > $size{$b} ? -1 : 0; } + @files = sort revnum @files; + + for (@files) { + $size = $size{$_}; + $size -= 1000000 if /README/; + $i=1; + while (($newtot = int($tot[$i] + $size + $size/40 + $FILEOVERHEAD)) > + $MAXKITSIZE-$KITOVERHEAD && $tot[$i]) { + $i++; + } + $tot[$i] = $newtot; + print "Adding $_ to kit $i giving $newtot bytes\n" if $opt_d; + $kit{$_} = $i; + $list[$i] .= " $_"; + } +} + +# Read manifest file and initialize the %comment array. +sub maniread { + do fatal("You don't have a $NEWMANI file. Run manifake") + unless -f "$NEWMANI"; + open(NEWMANI,$NEWMANI) || do fatal("Can't read $NEWMANI: $!"); + while (<NEWMANI>) { + ($key,$val) = split(' ',$_,1) unless ($key,$val) = /^(\S+)\s+(.*)/; + $comment{$key} = $val; + } + close NEWMANI; +} + +# MANIFEST and MANIFEST.new must say the same thing. Create the +# PACKLIST file (thus avoiding kit numbers in MANIFEST, which causes big +# patches when only re-ordering occurred). Note that PACKLIST should +# not appear in MANIFEST.new (the user may remove it). +sub manimake { + # Add built packlist + $comment{$PACKLIST} = 'Which files came with which kits'; + + open(PACKLIST, ">$PACKLIST") || do fatal("Can't create $PACKLIST: $!"); + print PACKLIST +"After all the $package kits are run you should have the following files: + +Filename Kit Description +-------- --- ----------- +"; + for (sort keys(comment)) { + printf PACKLIST "%-27s %2s %.47s\n", $_, $kit{$_}, $comment{$_}; + } + close PACKLIST; +} + +sub kitleader { + local($plevel); + $plevel = " at patchlevel $patch_level" if $patch_level ne ''; + print KIT <<EOH; +#! /bin/sh +# +# This is $package version $baserev$plevel. +# Make a new directory for the $package sources, cd to it, and run kits 1 up +# to $numkits through sh. When all $numkits kits have been run, read README. +# +echo " " +cat <<EOM +This is $package $baserev$plevel, kit $kitnum (of $numkits): +If this shell archive is complete, the line "End of kit $kitnum (of $numkits)" +will echo at the end. +EOM +export PATH || (echo "Please use sh to unpack this archive." ; kill \$\$) +EOH +} + +sub kittrailer { + $rangelist = ''; + for ($i = 1; $i <= $numkits; $i++) { + $rangelist .= ' ' . $i; + } + print KIT <<EOM; +echo \"End of kit $kitnum (of $numkits)\" +echo \" \" +cat /dev/null >kit${kitnum}isdone +run='' +config='' +for iskit in$rangelist; do + if test -f kit\${iskit}isdone; then + run=\"\$run \$iskit\" + else + todo=\"\$todo \$iskit\" + fi +done +case \$todo in + '') + echo \"You have run all your kits.\" +EOM + if (defined %Chopped) { # Some splitting occurred + print KIT <<EOM; + if test -f $PACKNOTES; then + sh $PACKNOTES + else + echo \"You have to rebuild split files by hand (see $PACKLIST).\" + fi +EOM + } + if (-f "README" && -f "Configure") { + print KIT +" echo \"Please read README and then type Configure.\" + chmod 755 Configure\n"; + } elsif (-f "README") { + print KIT +" echo \"Please read README first.\"\n"; + } elsif (-f "Configure") { + print KIT +" echo \"Please run Configure first.\" + chmod 755 Configure\n"; + } + print KIT <<EOM; + rm -f kit*isdone + ;; + *) echo \"You have run\$run.\" + echo \"You still need to run\$todo.\" + ;; +esac +: Someone might mail this, so exit before signature... +exit 0 +EOM +} + +sub get_patchlevel { + $patch_level = ''; + if (-f 'patchlevel.h') { + open(PL, 'patchlevel.h'); + while (<PL>) { + /^#define\s+PATCHLEVEL\s+(\w+)/ && ($patch_level = $1); + } + close PL; + } +} + +sub distfake { + return if $opt_q; + local($sw); + $sw = 's' unless $opt_v; + mkdir($tmpdir, 0700) || die "Can't create directory $tmpdir.\n"; + print "Building a copy of distribution in $tmpdir...\n" if $opt_v; + system 'perl', '-S', 'patcol', "-a$sw", '-f', $NEWMANI, '-d', $tmpdir; + system 'cp', $NEWMANI, "$tmpdir/$NEWMANI" + unless -f "$tmpdir/$NEWMANI" && !$opt_f; +} + +sub distcopy { + local($sw); # Switch to force patcol to copy checked out files + &makedir($opt_c); + print "Building a copy of distribution in $opt_c...\n" if $opt_v; + $sw = 'c' if $opt_q; + $sw .= 's' unless $opt_v; + system 'perl', '-S', 'patcol', "-aRC$sw", '-f', $NEWMANI, '-d', $opt_c; +} + +sub distrm { + return if $opt_q; + print "Removing distribution in $tmpdir...\n" if $opt_v; + chdir "/"; # Do not stay in removed directory... + system '/bin/rm', '-rf', "$tmpdir"; +} + +sub splitrm { + foreach $base (keys %Chopped) { + print "Removing split files for $base:\n" if $opt_v; + $piece = 'AA'; + while (-f "$base:$piece") { + print "\t$base:$piece\n" if $opt_v; + unlink "$base:$piece"; + $piece++; # AA -> AB, etc... + } + } +} + +sub cleanup { + &distrm if -d $tmpdir; + if ($opt_q) { + &splitrm; # Remove in-place split files + unlink $PACKLIST, $PACKNOTES; + } +} + +sub fatal { + local($reason) = shift(@_); + &cleanup; + die "$reason\n"; +} + +sub set_sig { + local($handler) = @_; + $SIG{'HUP'} = $handler; + $SIG{'INT'} = $handler; + $SIG{'QUIT'} = $handler; + $SIG{'TERM'} = $handler; +} + +sub aborted { + &set_sig('IGNORE'); + $opt_v = 1; # Force verbose message in distrm + &cleanup; + print "Aborted.\n"; + exit 1; +} + +sub usage { + print STDERR <<EOM; +Usage: makedist [-dhqvV] [-c dir] [-s size] [-f manifest] + -c : copy files in dir, do not build any shell archive. + -d : debug mode. + -f : use this file as manifest. + -h : print this help message and exits. + -q : quick mode: use checked-out files. + -s : set maximum pack size. + -v : verbose mode. + -V : print version number and exits. +EOM + exit 1; +} + +!NO!SUBS! +$grep -v '^;#' ../pl/package.pl >>makedist +$grep -v '^;#' ../pl/manifake.pl >>makedist +$grep -v '^;#' ../pl/copyright.pl >>makedist +$grep -v '^;#' ../pl/makedir.pl >>makedist +$grep -v '^;#' ../pl/tilde.pl >>makedist +$grep -v '^;#' ../pl/profile.pl >>makedist +chmod +x makedist +$eunicefix makedist diff --git a/kit/makedist.man b/kit/makedist.man new file mode 100644 index 0000000..432c59d --- /dev/null +++ b/kit/makedist.man @@ -0,0 +1,147 @@ +.rn '' }` +''' $Id: makedist.man,v 3.0.1.2 1995/05/12 11:58:16 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: makedist.man,v $ +''' Revision 3.0.1.2 1995/05/12 11:58:16 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0.1.1 1994/05/06 14:00:50 ram +''' patch23: now mentions kitpost and kitsend +''' +''' Revision 3.0 1993/08/18 12:04:31 ram +''' Baseline for dist 3.0 netwide release. +''' +''' +.de Sh +.br +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp +.if t .sp .5v +.if n .sp +.. +''' +''' Set up \*(-- to give an unbreakable dash; +''' string Tr holds user defined translation string. +''' Bell System Logo is used as a dummy character. +''' +.ie n \{\ +.tr \(*W-\*(Tr +.ds -- \(*W- +.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +.ds L" "" +.ds R" "" +.ds L' ' +.ds R' ' +'br\} +.el\{\ +.ds -- \(em\| +.tr \*(Tr +.ds L" `` +.ds R" '' +.ds L' ` +.ds R' ' +'br\} +.TH MAKEDIST 1 LOCAL +.SH NAME +makedist \- a distribution kit maker +.SH SYNOPSIS +.B makedist +[ \fB\-dhqvV\fR ] [ \fB\-c\fI dir\fR ] +[ \fB\-s\fI size\fR ] [\fB\-f \fImanifest\fR ] +.SH DESCRIPTION +.I Makedist +is a rather simpleminded shar program that knows how to pack files +into multiple kits of approximately 50000 bytes each. +The shar scripts produced assume very little about the target machine; +there is correspondingly little error checking done compared to other +shar programs. Alternatively, with the \fB\-c\fR option, you can +create a directory containing the whole source tree, and then pack it +up using your own shell archiver. +.PP +If you are using the copyright expansion feature (as determined by +\fIpackinit\fR), then you have to pack your distribution using this +program to ensure the copyright is correctly set. +.PP +In order to run \fImakedist\fR you have to do two things: +.IP 1) 4 +Create a .package file in the package's top-level directory by running +\fIpackinit\fR. +This program will ask you about your package and remember what you tell +it so that all the \fIdist\fR programs can be smart. +.IP 2) 4 +Create a MANIFEST.new file in your top-level directory that lists all the +files in your package. +The filename should be the first field on each line. +After some whitespace you can add a comment describing your file (briefly). +.PP +After running \fImakedist\fR, +you will have a set of kits in your top-level directory. +If your package name is "foo", they will be named foo.kit1, foo.kit2, etc. +The file created PACKLIST file is automatically added to the distribution and +tells which files come with which kits. +If you used the \fB\-c\fR option, you will end-up with a single directory +instead, containing the whole distribution, ready to be sent to the end-user. +.PP +If a file is too large to be packed as-is in one archive, it will be +automatically split in smaller parts. Only the first 11 characters of the file +will be kept though, and \fImakedist\fR will abort if two distinct files are +to be split and have the same 11 first characters in their names. The split +files will automatically be reconstructed at the end of the archive extraction +by runnning a script generated in PACKNOTES. +.PP +You may then mail your kits via \fIkitsend\fR or post them with \fIkitpost\fR. +.SH OPTIONS +The following options are handled by \fImakedist\fR: +.TP 10 +.B \-c \fIdir\fR +Tell \fImakedist\fR that the distribution should be copied (mirrored) in +the specified directory, instead of producing shell archives. Compatible with +the \fB\-q\fR option. +.TP +.B \-d +Turn on debug mode. Probably not useful. +.TP +\fB-f\fI file\fR +Use \fIfile\fR as manifest. By default, MANIFEST.new is used. +.TP +.B \-h +Print help message and exit. +.TP +.B \-q +Quick production of the kits: the checked-out version of the files is used, +instead of using the RCS file to actually get the latest checked-in version. +This will save some considerable time, but you have to be sure the checked-out +version is up-to-date or you might end up with an inconsistent package. +.TP +\fB\-s\fI size\fR +Set maximum kit size to \fIsize\fR bytes. +.TP +.B \-v +Verbose mode: trace kit building process or tree mirroring. +.TP +.B \-V +Print version number and exit. +.SH AUTHORS +Larry Wall <lwall@netlabs.com> (version 2.0) +.br +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH FILES +Creates ./$package.kit* unless \fB\-c\fR option is used. +.br +PACKLIST and PACKNOTES are also temporarily created. +.SH "SEE ALSO" +kitsend(1), kitpost(1), metaconfig(1), patcol(1) +.rn }` '' diff --git a/kit/manifake.SH b/kit/manifake.SH new file mode 100755 index 0000000..a18e779 --- /dev/null +++ b/kit/manifake.SH @@ -0,0 +1,51 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting kit/manifake (with variable substitutions)" +$spitshell >manifake <<!GROK!THIS! +$startperl + eval "exec perl -i~ -S \$0 \$*" + if \$running_under_some_shell; + +# $Id: manifake.SH,v 3.0.1.1 1993/08/19 06:42:18 ram Exp $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $Log: manifake.SH,v $ +# Revision 3.0.1.1 1993/08/19 06:42:18 ram +# patch1: leading config.sh searching was not aborting properly +# +# Revision 3.0 1993/08/18 12:04:32 ram +# Baseline for dist 3.0 netwide release. +# + +!GROK!THIS! +$spitshell >>manifake <<'!NO!SUBS!' +$NEWMANI = 'MANIFEST.new'; +$MANI = 'MANIFEST'; + +&manifake; + +!NO!SUBS! +chmod 755 manifake +$grep -v '^;#' ../pl/manifake.pl >> manifake +$eunicefix manifake diff --git a/kit/manifake.man b/kit/manifake.man new file mode 100644 index 0000000..c44e6d7 --- /dev/null +++ b/kit/manifake.man @@ -0,0 +1,46 @@ +''' $Id: manifake.man,v 3.0.1.1 1995/05/12 11:58:21 ram Exp $ +''' +''' Copyright (c) 1991-1993, Raphael Manfredi +''' +''' You may redistribute only under the terms of the Artistic Licence, +''' as specified in the README file that comes with the distribution. +''' You may reuse parts of this distribution only within the terms of +''' that same Artistic Licence; a copy of which may be found at the root +''' of the source tree for dist 3.0. +''' +''' $Log: manifake.man,v $ +''' Revision 3.0.1.1 1995/05/12 11:58:21 ram +''' patch54: updated my e-mail address +''' +''' Revision 3.0 1993/08/18 12:04:33 ram +''' Baseline for dist 3.0 netwide release. +''' +.TH MANIFAKE 1 ram +.SH NAME +manifake \- creates a MANIFEST.new out of a MANIFEST file +.SH SYNOPSIS +.B manifake +.SH DESCRIPTION +.I Manifake +is a real simpleminded program that takes a MANIFEST file, such as one +produced by a shar program, and creates a MANIFEST.new file ready to be +used by all the dist programs. What it does is that all archive numbers +are removed and the optional leading comments up to a dashed-line are +thrown away. +.PP +.I Manifake +will typically be used when converting an existing package +to use \fImetaconfig\fR or any other dist utility. +.SH AUTHOR +Raphael Manfredi <ram@hptnos02.grenoble.hp.com> +.SH FILES +.PD 0 +.TP 20 +MANIFEST +Original manifest produced by some shar program +.TP +MANIFEST.new +Faked manifest file, suitable for use by any dist programs. +.PD +.SH "SEE ALSO" +makedist(1), metaconfig(1), pat(1). diff --git a/lib/C/Jmakefile b/lib/C/Jmakefile new file mode 100644 index 0000000..ac58b46 --- /dev/null +++ b/lib/C/Jmakefile @@ -0,0 +1,20 @@ +/* + * Jmakefile for C subdirectory. + */ + +;# $Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:38 ram Exp $ +;# +;# Copyright (c) 1991-1993, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 3.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.1 1994/01/24 13:43:38 ram +;# patch16: created +;# + +SetSubdirs(fake) diff --git a/lib/C/Makefile.SH b/lib/C/Makefile.SH new file mode 100644 index 0000000..13286b2 --- /dev/null +++ b/lib/C/Makefile.SH @@ -0,0 +1,188 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44] +: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=lib/C +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +DATE=`date` + +$spitshell >Makefile <<!GROK!THIS! +######################################################################## +# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = ../.. +CURRENT = $CURRENT +DIR = $DIR + +######################################################################## +# Parameters set by Configure -- edit config.sh if changes are needed + +CTAGS = ctags +MAKE = make +MV = $mv +RM = $rm -f + +######################################################################## +# Automatically generated parameters -- do not edit + +SUBDIRS = fake + +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $ + +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:38 ram Exp ram $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.1 1994/01/24 13:43:38 ram +# patch16: created +# + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: sub_clean local_clean +realclean: sub_realclean local_realclean +clobber: sub_clobber local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + +local_clobber:: local_realclean + $(RM) Makefile config.sh + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; exit 0; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Rules for building in sub-directories -- do not edit + +subdirs: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo $(VERB) "in $(DIR)$$i..."; \ + $(MAKE) $(MFLAGS) $(FLAGS) $(TARGET)); \ + done + +install:: + @$(MAKE) subdirs TARGET=install VERB="Installing" FLAGS= + +deinstall:: + @$(MAKE) subdirs TARGET=deinstall VERB="Deinstalling" FLAGS= + +install.man:: + @$(MAKE) subdirs TARGET=install.man VERB="Installing man pages" FLAGS= + +deinstall.man:: + @$(MAKE) subdirs TARGET=deinstall.man VERB="Deinstalling man pages" FLAGS= + +sub_clean:: + @$(MAKE) subdirs TARGET=clean VERB="Cleaning" FLAGS= + @echo "Back to $(CURRENT) for "clean... + +sub_realclean:: + @$(MAKE) subdirs TARGET=realclean VERB="Real cleaning" FLAGS= + @echo "Back to $(CURRENT) for "realclean... + +sub_clobber:: + @$(MAKE) subdirs TARGET=clobber VERB="Clobbering" FLAGS= + @echo "Back to $(CURRENT) for "clobber... + +tag:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS) ;\ + do \ + (cd $$i ; echo "Tagging" "in $(DIR)$$i..."; \ + $(MAKE) $(MFLAGS) tag); \ + done + +Makefiles:: + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS);\ + do \ + echo "Making "Makefiles" in $(DIR)$$i..."; \ + (cd $$i || exit 1; \ + if test ! -f Makefile; then /bin/sh Makefile.SH; fi; \ + $(MAKE) $(MFLAGS) Makefiles) \ + done + +Makefiles.SH:: Makefile.SH + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ + for i in $(SUBDIRS);\ + do \ + case "$(DIR)$$i/" in \ + */*/*/*/) newtop=../../../..;; \ + */*/*/) newtop=../../..;; \ + */*/) newtop=../..;; \ + */) newtop=..;; \ + esac; \ + case "$(TOP)" in \ + /*) newtop="$(TOP)" ;; \ + esac; \ + echo "Making Makefiles.SH in $(DIR)$$i..."; \ + (cd $$i || exit 1; $(MAKE) $(MFLAGS) -f ../Makefile \ + Makefile TOP=$$newtop CURRENT=$(DIR)$$i;\ + $(MAKE) $(MFLAGS) Makefiles.SH) \ + done + +all:: + @$(MAKE) subdirs TARGET=all VERB="Making all" FLAGS= + +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/lib/C/fake/Jmakefile b/lib/C/fake/Jmakefile new file mode 100644 index 0000000..379744c --- /dev/null +++ b/lib/C/fake/Jmakefile @@ -0,0 +1,29 @@ +/* + * Jmakefile for C/fake subdirectory. + */ + +;# $Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:44 ram Exp $ +;# +;# Copyright (c) 1991-1993, Raphael Manfredi +;# +;# You may redistribute only under the terms of the Artistic Licence, +;# as specified in the README file that comes with the distribution. +;# You may reuse parts of this distribution only within the terms of +;# that same Artistic Licence; a copy of which may be found at the root +;# of the source tree for dist 3.0. +;# +;# $Log: Jmakefile,v $ +;# Revision 3.0.1.1 1994/01/24 13:43:44 ram +;# patch16: created +;# + +FILES = dup2.C getopt.C rename.C scandir.C setsid.C + +INSTALLFLAGS = -m 444 + +all:: /* So that default make does not default to install */ + +>PRIVLIB /* Grrr.. Have to let jmake know I need this */ + +MakeDirectories(install,$(PRIVLIB)/lib/C/fake) +InstallMultiple($(FILES),$(PRIVLIB)/lib/C/fake) diff --git a/lib/C/fake/Makefile.SH b/lib/C/fake/Makefile.SH new file mode 100644 index 0000000..a5eb2db --- /dev/null +++ b/lib/C/fake/Makefile.SH @@ -0,0 +1,156 @@ +: Makefile.SH generated from Jmake.tmpl and Jmakefile [jmake 3.0 PL44] +: $X-Id: Jmake.tmpl,v 3.0.1.1 1993/08/20 07:36:36 ram Exp ram $ + +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +CURRENT=lib/C/fake +DIR=`echo $CURRENT/ | sed -e 's/\.\///g'` +echo "Extracting ${DIR}Makefile (with variable substitutions)" + +INSTALL=`echo $install | sed -e 's,\./i,\$(TOP)/i,'` +INSTALLDIR=`echo $installdir | sed -e 's,\./i,\$(TOP)/i,'` +DATE=`date` + +$spitshell >Makefile <<!GROK!THIS! +######################################################################## +# Makefile generated from Makefile.SH on $DATE + +SHELL = /bin/sh +JMAKE = jmake +TOP = ../../.. +CURRENT = $CURRENT +DIR = $DIR +INSTALL = $INSTALL +INSTALLDIR = $INSTALLDIR + +######################################################################## +# Parameters set by Configure -- edit config.sh if changes are needed + +CTAGS = ctags +MAKE = make +MV = $mv +PRIVLIB = $installprivlib +RM = $rm -f + +!GROK!THIS! +$spitshell >>Makefile <<'!NO!SUBS!' +######################################################################## +# Jmake rules for building libraries, programs, scripts, and data files +# $X-Id: Jmake.rules,v 3.0.1.1 1994/10/29 15:46:30 ram Exp ram $ + +######################################################################## +# Start of Jmakefile + +# $X-Id: Jmakefile,v 3.0.1.1 1994/01/24 13:43:44 ram Exp ram $ +# +# Copyright (c) 1991-1993, Raphael Manfredi +# +# You may redistribute only under the terms of the Artistic Licence, +# as specified in the README file that comes with the distribution. +# You may reuse parts of this distribution only within the terms of +# that same Artistic Licence; a copy of which may be found at the root +# of the source tree for dist 3.0. +# +# $X-Log: Jmakefile,v $ +# Revision 3.0.1.1 1994/01/24 13:43:44 ram +# patch16: created +# + +FILES = dup2.C getopt.C rename.C scandir.C setsid.C + +INSTALLFLAGS = -m 444 + +all:: + +install:: + @for dir in $(PRIVLIB)/lib/C/fake; do \ + case '${MFLAGS}' in *[i]*) set +e;; esac; \ + (set -x; test -d $$dir || $(INSTALLDIR) $$dir); \ + done + +install:: $(FILES) + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for i in $(FILES); do \ + (set -x; $(INSTALL) -c $(INSTALLFLAGS) $$i $(PRIVLIB)/lib/C/fake); \ + done + +deinstall:: + @case '${MFLAGS}' in *[i]*) set +e;; esac; \ + for i in $(FILES); do \ + (set -x; $(RM) $(PRIVLIB)/lib/C/fake/$$i); \ + done + +######################################################################## +# Common rules for all Makefiles -- do not edit + +emptyrule:: + +clean: local_clean +realclean: local_realclean +clobber: local_clobber + +local_clean:: + $(RM) core *~ *.o + +local_realclean:: local_clean + +local_clobber:: local_realclean + $(RM) Makefile config.sh + +Makefile.SH: Jmakefile + -@if test -f $(TOP)/.package; then \ + if test -f Makefile.SH; then \ + echo " $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~"; \ + $(RM) Makefile.SH~; $(MV) Makefile.SH Makefile.SH~; \ + fi; \ + echo " $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT)" ; \ + $(JMAKE) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT) ; \ + else touch $@; exit 0; fi + +Makefile: Makefile.SH + /bin/sh Makefile.SH + +tags:: + $(CTAGS) -w *.[ch] + $(CTAGS) -xw *.[ch] > tags + +local_clobber:: + $(RM) tags + +######################################################################## +# Empty rules for directories with no sub-directories -- do not edit + +install:: + @echo "install in $(CURRENT) done." + +deinstall:: + @echo "deinstall in $(CURRENT) done." + +install.man:: + @echo "install.man in $(CURRENT) done." + +deinstall.man:: + @echo "deinstall.man in $(CURRENT) done." + +Makefiles:: + +Makefiles.SH:: + +!NO!SUBS! +chmod 644 Makefile +$eunicefix Makefile + diff --git a/lib/C/fake/dup2.C b/lib/C/fake/dup2.C new file mode 100644 index 0000000..27c3c48 --- /dev/null +++ b/lib/C/fake/dup2.C @@ -0,0 +1,78 @@ +/* + * dup2.C -- A dup2 emulation. + */ + +/* + * $Id: dup2.C,v 3.0.1.1 1994/01/24 13:58:37 ram Exp $ + * + * Copyright (c) 1991-1993, Raphael Manfredi + * + * You may redistribute only under the terms of the Artistic Licence, + * as specified in the README file that comes with the distribution. + * You may reuse parts of this distribution only within the terms of + * that same Artistic Licence; a copy of which may be found at the root + * of the source tree for dist 3.0. + * + * Original Author: Larry Wall <lwall@netlabs.com> + * + * $Log: dup2.C,v $ + * Revision 3.0.1.1 1994/01/24 13:58:37 ram |