pax_global_header00006660000000000000000000000064136436271160014523gustar00rootroot0000000000000052 comment=9a14a1512556db68543bfeebac2138ce1be0b0fd mailagen-3.1.106/000077500000000000000000000000001364362711600134505ustar00rootroot00000000000000mailagen-3.1.106/.gitignore000066400000000000000000000012631364362711600154420ustar00rootroot00000000000000.package .config/ *.bak *.o *.1 Makefile Wanted agent/edusers agent/files/help/addauth agent/files/help/approve agent/files/help/delpower agent/files/help/end agent/files/help/getauth agent/files/help/help agent/files/help/newpower agent/files/help/passwd agent/files/help/password agent/files/help/power agent/files/help/release agent/files/help/remauth agent/files/help/set agent/files/help/setauth agent/files/help/user agent/filter/filter agent/magent agent/mailagent agent/maildist agent/mailhelp agent/maillist agent/mailpatch agent/package agent/pl/termios/termios.pl agent/pl/termios/termios_ph agent/pl/utmp/utmp.pl agent/pl/utmp/utmp_ph config.h config.sh install mkdep revision.h mailagen-3.1.106/Artistic000066400000000000000000000140741364362711600151630ustar00rootroot00000000000000 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 mailagen-3.1.106/ChangeLog000066400000000000000000002115001364362711600152210ustar00rootroot00000000000000Sat Mar 17 19:29:59 MET 2001 Raphael Manfredi . Description: Added credits for Manoj Srivastava, the Debian packager, for his wonderful work. Added two variables: domain and hidenet, in order to address the Debian bug #72737. The values hardwired at Configure time in mailagent are now used only up to the moment where we have parsed the user configuration. Forgot to increment buf in pool_read(), in the C filter. This was an important bug, which had never hit me however. I noticed it by looking a the Debian patches. Use the "email" config var verbatim in FORWARD. It used to determine the Resent-From: by constructing a full email address, but this is wrong. We should use whatever the user said, and it is up to MTAs to fix the address should it be unqualified. Removed unused var in POST. Fixed longstanding lie in man; "To: gue@eiffel.fr" now works as advertised in the man page. It also means you can write: To Cc: user@example.com instead of the heavier: To Cc: /^user@example\.com$/ However, if you wish to use more complex patterns, you still have to use the /^/ anchored form. Create a new filter/address test to test various matching patterns on address selectors. Try to run tests as nobody when super-user -- from Debian. Fixed test rules for UNIQUE, removing spurious REJECT -f. The error present in the man page had also propagated to the test cases. . Files changed: * agent/files/setup.cf, agent/files/mailagent.cf: Added two variables: domain and hidenet. * agent/filter/io.c: Forgot to increment buf in pool_read() -- from Debian. * agent/magent.sh: Mydomain and hiddennet now superseded by config vars. Changed email_addr() and domain_addr() to honour new config vars. * agent/man/mailagent.SH: Documented new config vars: domain and hidenet. Various fixes from bug reports on Debian. * agent/pl/actions.pl: Use the "email" config var verbatim in FORWARD. Removed unused var in POST. * agent/pl/builtins.pl: Hostname computed via domain_addr() to honour hidenet. * agent/pl/matching.pl: Fixed longstanding lie in man; "To: gue@eiffel.fr" now works. * agent/pl/parse.pl: Use the "domain" config var instead of mydomain. * agent/pl/read_conf.pl: Computes suitable defaults for new "domain" and "hidenet". * agent/pl/rfc822.pl: Use "domain" config var instead of mydomain. * agent/test/TEST: Try to run tests as nobody when super-user -- from Debian. * agent/test/actions: Fixed test rules for UNIQUE, removing spurious REJECT -f. * agent/test/filter/address.t: Created. * agent/test/filter/list.t: Unlink files we expect to be created before running command. * agent/test/rules: Added new filter/address tests. Tue Mar 13 14:27:14 MET 2001 Raphael Manfredi . Description: Made fixup of header fields in POST be a warning in the logs, instead of a mere notice. Added fix for broken continuations in parse_mail(). I have started receiving messages with invalid header continuations, and this led to failure in POST: the remote news server is much more strict on headers than mail agents. Fixed RESYNC, copied continuation fix from parse_mail(). Added support for SUBST/TR on mail headers: it is now possible to say something like: SUBST Subject: /foo/bar/g; to alter header field in place. See the updated manual page for details. Added rule to suppress () and {} in message ids, since again it led to failures when using POST. Added test cases for SUBST/TR on header fields. The newsgate program now computes the In-Reply-To field via a regexp instead of a split on References to cope with bad References line that dont have a space between message ids. . Files changed: * agent/man/mailagent.SH: Documented SUBST/TR on header fields. * agent/pl/actions.pl: Made fixup of header fields in POST be a warning. Fixed RESYNC, copied continuation fix from parse_mail(). Added support for SUBST/TR on mail headers. * agent/pl/filter.pl: Changed SUBST/TR parameter parsing to support header fields. * agent/pl/header.pl: Added rule to suppress () and {} in message ids. * agent/pl/history.pl: Message ids are now cleaned-up via msgid_cleanup(). * agent/pl/parse.pl: Added fix for broken continuations in parse_mail(). * agent/test/actions: Added test cases for SUBST/TR on header fields. * agent/test/cmd/subst.t: Added test cases for SUBST on header fields. * agent/test/cmd/tr.t: Added test cases for TR on header fields. * misc/news/ml.map: Typo fixes in leading comment. * misc/news/newsgate: The in-reply-to field is now computed via a regexp. Wed Jan 10 18:10:29 MET 2001 Raphael Manfredi . Description: Updated date in README and my e-mail address. Documented my CPAN directory URL in agent/README. Compilation bug fixes in filter: . switched to dynamic init of standard file array for GNU libc . fixed incorrect selection of sys_errlist[] Changed semantics of "tome": the '.' and '_' in names is no longer stripped. If your full name was, say, raphael_manfredi, then you could set "tome: manfredi" and it worked. The heuristics were bad, and it prevented doing useful things. Let's drop support for that and see if anyone complains. ;-) Updated POST to current practices. In particular, it has been tested to establish a mail -> news gateway with INN 1.7.2. POST also support a new "-b" switch to cause article biffing, just like saving in a folder triggers mail biffing. The following new features are available in POST: . fix lines like From: A.B into From: "A.B" . remove duplicate Content-Transfer-Encoding and other MIME headers . generate proper References: line and fixes bad Message-ID lines. . fix date if too old or too far in the future In the new misc/news directory, you'll find a program and instruction to setup a news -> mail gateway (tested with INN 1.7.2), thereby making it possible to build a bi-directional mail <=> news gateway with mailagent. Fixed wrong lexical attribute synthesis for numbers during date parsing, which cause 08 and 09 to not parse at all. Fixed sed command that produced bad dependencies on linux in the agent/pl/utmp directory. Fixed dates for the SELECT test to avoid failures past year 2001. . Files changed: * agent/filter/io.c: Switched to dynamic init of standard file array for GNU libc. * agent/filter/logfile.c: Fixed incorrect selection of sys_errlist[]. * agent/man/mailagent.SH: Changed semantics of "tome". Updated POST to current practices. Documented biffing macros for news article. * agent/pl/actions.pl: Replaced calls to fake_date() by mta_date(). Rewrote the POST command, and added the -b switch. * agent/pl/biff.pl: Added support for news article biffing. * agent/pl/getdate.pl: Fixed wrong lexical attribute synthesis for numbers. * agent/pl/header.pl: New mta_date() routine replaces old fake_date(). Added msgid_cleanup() and parsedate() routines. * agent/pl/parse.pl: Allow direct IP numbers in Received fields. * agent/pl/period.pl: Added relative_age(). * agent/pl/rfc822.pl: Dropped support of '_' and '.' stripping in last_name(). Added gen_message_id(). * agent/pl/runcmd.pl: New -b switch for POST to request biffing. * agent/test/actions: Fixed dates for the SELECT test to avoid failures past 2001. * agent/test/cmd/vacation.t: Changed "tome" settings due to dropping of dot stripping. * misc/news/newsgate, misc/news/ml.map: Created. Mon Jul 12 16:05:35 METDST 1999 Raphael Manfredi . Description: Regenerated Configure with newest metaconfig: no longer ask to send mail to the author Updated my e-mail address and copyright line. Will now install examples as well. Added the UNLOCKED pattern to chkagent.sh Was missing a trailing colon in getopt() declaration. Variables are now propagated back and forth through APPLY Use servshell instead of /bin/sh for commands Make sure that we do not get an empty header when filtering Fixed Y2K bugs Added one extra char for filename in queue listings. Added ~ substitution in locate_program(). Specialized <3> to mean <3,3> in mrange() Fixed wrong semantics for <3>, and rewrote tests accordingly Weird Received: logging moved to higher levels Queue renaming logs now include filenames in 'quotes' Added tests for variable propagation in APPLY Added test for variable propagation Added new test cases Updated getcost documentation and added switches -a and -c Two new files (makefiles) . Files changed: * agent/Jmakefile: Will now install examples as well. * agent/examples/Jmakefile: Created. * agent/files/chkagent.sh: Added the UNLOCKED pattern. * agent/filter/getopt.c: Was missing a trailing colon in getopt() declaration. * agent/filter/io.c: Renamed metaconfig obsolete symbol. Now uses say() when mail is DUMPED. * agent/man/edusers.SH, agent/man/package.SH, agent/man/mailhelp.SH: Updated my e-mail address. * agent/man/mailagent.SH: Variables are now propagated back and forth through APPLY. Updated my e-mail address. * agent/pl/actions.pl: Use servshell instead of /bin/sh for commands. Make sure that we do not get an empty header when filtering. * agent/pl/analyze.pl: Moved localization of the %Variable hash for APPLY. * agent/pl/cmdserv.pl: Factorized servshell handling in function. * agent/pl/getdate.pl: Fixed Y2K bug. * agent/pl/listqueue.pl: Added one extra char for filename in queue listings. * agent/pl/locate.pl: Added ~ substitution in locate_program(). * agent/pl/matching.pl: Specialized <3> to mean <3,3> in mrange(). * agent/pl/parse.pl: Weird Received: logging moved to higher levels. * agent/pl/queue_mail.pl: Logs now include filenames in 'quotes'. * agent/test/actions: Added tests for variable propagation in APPLY. * agent/test/cmd/apply.t: Added test for variable propagation. * agent/test/filter/list.t: Added new test cases. * agent/test/rules: Fixed wrong semantics for <2>, and rewrote tests accordingly. * misc/mime/unmime: Added processing for ligatured "oe". Wed Jan 13 19:24:56 MET 1999 Raphael Manfredi . Description: The agent.wait file is now stored in the spool rather than in the queue. Fixed wrong localization of variables in unique_filename() which could cause filter to lock up. Thanks to Gerhard den Hollander for spotting it! Additions to agent.wait are more robust and use locking to guard against concurrent accesses, rather than counting on proper O_APPEND semantics and praying nobody (mailagent) renames the file whilst generated ;-) Only use last two digits from year in logfiles. I choose to see "00/01/01" on Jan 1st 2000 in the logs. Added tag-checking heuristic to say() in C filter to avoid extra pre-pending of ERROR tags. New %Y macro for 4-digit year, %y being year modulo 100 Resync of agent.wait now more robust and uses locking. There may be empty lines in the agent.wait file, to reserve space in the filesystem (minimal size is therefore 1 byte). Test suite: Test for non-writable agent.wait file and cleanup agent.wait file since now always produced. Documented the -k option for getcost in misc/getcost. . Files changed: * agent/files/filter.sh: Agent.wait is now stored in the spool rather than in queue. * agent/filter/io.c: Fixed wrong localization of variables in unique_filename(). Additions to agent.wait are more robust and use locking. * agent/pl/actions.pl, agent/filter/logfile.c, agent/pl/add_log.pl: Only use last two digits from year in logfiles. * agent/filter/msg.c: Added tag-checking heuristic to say(). * agent/magent.sh: Changed agent_wait to AGENT_WAIT, now holding full path. * agent/man/mailagent.SH: Added %Y macro for 4-digit year output. Agent.wait file moved from Queue to Spool. * agent/pl/emergency.pl: Only use last two digits from year in logfiles. Resync of agent.wait now more robust and uses locking. * agent/pl/pqueue.pl, agent/pl/listqueue.pl: There may be empty lines in the agent.wait file. * agent/pl/macros.pl: New %Y macro for 4-digit year, %y being year modulo 100. * agent/pl/queue_mail.pl: Writing to agent.wait is now more robust and uses locking. * agent/test/basic/config.t: Test for non-writable agent.wait file. * agent/test/basic/filter.t: Agent.wait file moved from queue to spool dir. * agent/test/pl/init.pl: Cleanup agent.wait file since now always produced. Tue Jul 28 19:33:00 METDST 1998 Raphael Manfredi . Description: unique_filename() could loop forever, abort if no locking . Files changed: * agent/filter/io.c: unique_filename() could loop forever, abort if no locking. Tue Jul 28 19:13:31 METDST 1998 Raphael Manfredi . Description: Added new "servshell" configuration variable. Probably only useful if your are running HP-UX 10.x and later. Added setup information for the "hash" config variable (for the purpose of mailagent -I) and fixed wrong (prefix) indication from setup.cf. Fixed race condition whilst electing queue filename that could cause a total loss of mail when the mailagent queue was accessed via NFS from within the C filter. Fixed typo on .so line in maildist.1 Skip blank lines in included file (i.e. "file" in rules). Become even more knowledgeable about Received lines. RFC-822 address matcher now uses non-greedy pattern match to avoid extra spaces at the end of the name. Now explicitely log when too many symlink levels are found during "secure" checks. . Files changed: * agent/files/mailagent.cf: Added servshell variable. * agent/files/setup.cf: Added setup information for the "hash" config variable. * agent/filter/io.c: Fixed race condition whilst electing queue filename. * agent/man/mailagent.SH: Documented new "servshell" variable. * agent/man/maildist.SH: Fixed typo on .so line. * agent/pl/cmdserv.pl: Shell used is now customized by the "servshell" variable. * agent/pl/include.pl: Skip blank lines in included file. * agent/pl/install.pl: Was not processing (prefix) indication from setup.cf. * agent/pl/parse.pl: Become even more knowledgeable about Received lines. * agent/pl/rfc822.pl: Use non-greedy pattern match to avoid extra spaces. * agent/pl/secure.pl: Now explicitely log when too many symlink levels are found. Tue Mar 31 17:48:35 METDST 1998 Raphael Manfredi . Description: New configuration parameters "vacfixed" and "tofake". The first one prevents any vacation message change through usage of the VACATION directive, the other one prevents the faking of a To: header line (for filtering purposes) when such a line is missing from the message. New ON command to issue commands on certain days only. When combined with SELECT, this makes a powerful time-based rule selection. For instance: ON (Mon Tue Wed Thu) SELECT (18:30 .. 23:59) BOUNCE ram@home; would bounce to my home e-mail address the message if received past 6.30 pm on weekdays (but Fridays) and before midnight. Two NEW interesting directories under misc/: . fakesend, showing an implementation of the FAKESEND command I use to reply to messages bounced to my home e-mail address while pretending I replied from work. . getcost: my contribution (with the help of a fellow from HP) to fighting SPAM with mailagent. This is a temporary solution, until I come up with a decent SCORE commandi, but it has helped me tremendously for the past 10 months. The RFC822 parser now allows no space between address and comment. I've not checked to see whether this is legal because it does not hurt and improves robustness anyway. Allow ~name expansion when specifying alternate rule files, via the APPLY command. The SERVER "set" command can now list defined variables when invoked without any argument. Allow for missing "host1" in the Received: line parsing, which attempts to compute the chain of relaying hosts. The misc/mime/unmime program has evolved: new -x and -X options to cope with accentuated letters, and removal of ugly ?iso-8859-1?Q escapes in subject lines that the HP router unfortunately adds each time there is an accentuated letter in the Subject line! (and From:, To: lines as well, although that's not frequent enough for me to tackle yet). There are 9 new files in the distribution. . Files changed: * agent/files/help/release.SH: Fixed typos. * agent/files/help/set.SH: Without parameters, list all the defined variables. * agent/files/mailagent.cf: Added "vacfixed" and "tofake" configuration parameters. * agent/man/mailagent.SH: Added "vacfixed" and "tofake" configuration parameters. New ON command to issue commands on certain days only. The SERVER "set" command can now list defined variables. Added an example of alternate VACATION message selection. * agent/pl/cmdserv.pl: Changed "set" to dump variables when not given any argument. * agent/pl/filter.pl: When "vacfixed" is on, forbid any change of vacation message. New ON command to process commands on certain days only. * agent/pl/include.pl: Typo fix in comment. * agent/pl/interface.pl: Added hook for the new ON command. * agent/pl/parse.pl: When "tofake" is turned off, disable faking of To:. Allow for missing "host1" in the Received: line parsing. * agent/pl/rfc822.pl: Parser now allows no space between address and comment. * agent/pl/rules.pl: Allow ~name expansion when specifying alternate rule files. * agent/pl/runcmd.pl: Declared the new "ON" command. * agent/test/actions: Added regression tests for new "ON" command. * misc/getcost/spamconfig, agent/test/cmd/on.t, misc/fakesend/mh_profile: Created. * misc/mime/unmime: New -x and -X options to cope with accentuated letters. Added removal of ugly ?iso-8859-1?Q escapes in subject. Mon Sep 15 17:31:05 METDST 1997 Raphael Manfredi . Description: Internal changes to the C filter program, mainly for future extensions I plan to add someday. Mail messages in the queue are now *locked* before being processed, thereby avoiding duplicate processing in some weird race conditions. The 'mailagent -q' command now reports locked messages with a '*'. Fixed typo in -r usage summary. New -t and -f options for BEGIN and NOP: BEGIN -f only occurs if the last command status is false. BEGIN -t only occurs if the last command status is true. NOP -f forces a false command status (i.e. a failure). NOP -t forces a true command status (i.e. a success). As a consequence NOP now returns a status or propagates the existing one. All command options should now be output in bold in the man page. Documented _CALLOUT_ working state for callout queue triggers. Annotation was not performed for value "0". The use of an if $value; instead of if defined $value; was the cause. The $lastcmd variabe is now global from analyze_mail() for BACK processing. It was otherwise impossible to have success/failure conditions propagate outside of the BACK execution environment. Improved Received: line parsing logic. Indication of relaying hosts (RELAYED log) now selectively emitted only when the first relaying host is apparently not related to that of the sended. Fixed ASSGINED -> ASSIGNED typo in log message Insert user e-mail address if no address is given for NOTIFY. Some small fixes in the regression test suite. PATBOUNCE can now handle bounced output from @SH package commands. File misc/pbounce/rules now shows how I use PATBOUNCE in my own ~/.rules. . Files changed: * agent/filter/io.c: Factorized code to derive a unique filename. * agent/filter/lock.c: Added more generic file_lock() and file_unlock() routines. * agent/filter/lock.h: New generic file_lock() and file_unlock() routines. * agent/filter/misc.c: Cosmetic change. * agent/filter/parser.c: Changed ordering of include files. * agent/magent.sh: Call new pmail() routine to process main message. Fixed typo in -r usage. * agent/man/mailagent.SH: New -t and -f options for BEGIN and NOP. All command options should now be output in bold. Documented _CALLOUT_ working state for callout queue. * agent/pl/acs_rqst.pl: Code factorized within acs_lock(). * agent/pl/actions.pl: Don't blindly chop command error message, remove trailing \n. Annotation was not performed for value "0". * agent/pl/analyze.pl: $lastcmd now global from analyze_mail() for BACK processing. Indication of relaying hosts now selectively emitted. * agent/pl/filter.pl: Fixed ASSGINED -> ASSIGNED typo in log message. Implemented new -t and -f flags for BEGIN and NOP. Insert user e-mail address if no address for NOTIFY. * agent/pl/listqueue.pl: Now clearly spot locked files in queue with a '*'. * agent/pl/parse.pl: Improved Received: line parsing logic. * agent/pl/pqueue.pl: Messages in the queue are now locked before processing. New pmail() routine to factorize locking/processing code. * agent/pl/runcmd.pl: NOP now returns a status. Added -t and -f switches for BEGIN and NOP. $lastcmd now global from analyze_mail(). * agent/test/cmd/split.t: Fixed overzealous unlinks. * agent/test/option/c.t: Uses an empty file instead of /dev/null. * agent/test/pl/mail.pl: Forgot to unlink mail.lock in cp_mail(). * misc/pbounce/patbounce.pl: Also handle bounced output from @SH package. Thu Feb 20 12:55:50 MET 1997 Raphael Manfredi . Description: Regenerated Configure for getopt() and dup2() checking. Updated copyright notice to include year 1997. New groupsafe, execskip and lockwarn variables. See the manual page entries for a description. Roughly speaking, they resepectively control group-writable secure checks, exec-safe secure checks and locking warnings when too much time is spent waiting for a lock. New -o switch for the C filter to redirect output directly from the .forward in case shell redirection is not available there... See the man page for details. The C filter now prefer open(O_APPEND) to fopen("a") for stdio append bugs (reported on SUN platforms). Made it explicit in the man page that /pattern/i is legal to perform a case-insensitive match, as in Perl. Made mailagent 'perl -cw' clean and fixed a couple of typos. Improved Received: header parsing to avoid warnings. The 'unmime -e' un-escape was overzealous for uuencoded parts... Made unmime die if an error occurs to prevent feedback from occurring in mailagent. . Files changed: * agent/files/mailagent.cf: New groupsafe, execskip and lockwarn variables. * agent/filter/Jmakefile: Added getopt.c and dup2.c files. * agent/filter/getopt.c, agent/filter/dup2.c: Created. * agent/filter/io.c: New io_redirect() routine to handle the -o switch. * agent/filter/io.h: Declared io_redirect(). * agent/filter/logfile.c: Prefer open(O_APPEND) to fopen("a") for stdio append bugs. * agent/filter/main.c: Now uses getopt() to parse command line switches. New -o switch to redirect output. * agent/filter/parser.c: Skip group-writable and exec-safe checks if told to. * agent/magent.sh: Used $* variable for no purpose. * agent/man/mailagent.SH: Documents new execsafe, groupsafe and lockwarn variables. The C filter can now redirect output via -o. Made it explicit that /pattern/i is legal. * agent/pl/acs_rqst.pl: Now supports the lockwarn variable. * agent/pl/actions.pl: Made 'perl -cw' clean and fixed a couple of typos. * agent/pl/callout.pl: Ensure %Header and $wmode are localized in the main package. * agent/pl/cmdserv.pl: Made 'perl -cw' clean. * agent/pl/context.pl: Removed the 'do' workaround for perl5.001. * agent/pl/hook.pl: Used $wmode and $loglvl from the wrong package. * agent/pl/install.pl: Missed a '$' in front of a variable in create(). * agent/pl/interface.pl: Made use of local $lastcmd instead of main's. * agent/pl/parse.pl: Improved Received: header parsing. * agent/pl/secure.pl: Now honours groupsafe and execsafe configuration variables. * agent/pl/stats.pl: Typo fixes and print() call cleanup to avoid run-time warnings. * agent/test/basic/config.t: Avoid exec-safe checks and group-writable directories. * misc/mime/unmime: The -e un-escape was overzealous for uuencoded parts... Made the filter die if an error occurs to prevent feedback. Fri Jan 31 19:11:21 MET 1997 Raphael Manfredi . Description: Filter also trap fatal SIGSEGV and SIGBUS signals in C filter. Forgot one more get_confval vs get_confstr translation in filter. This caused dreadful core dumps, a sure sign being the regression test suite mysteriously failing... Esacape metacharacter '{' in regexps for perl5.003_20. This subversion has been really nitty picky on un-escaped '{' without a '}' counterpart. Further subversions have backed-out this strict checking however, but the deed is done and I have escaped all the culprits! . Files changed: * agent/filter/main.c: Also trap fatal SIGSEGV and SIGBUS signals. * agent/filter/parser.c: Forgot one more get_confval vs get_confstr translation. * agent/pl/stats.pl, agent/pl/lexical.pl, agent/pl/rules.pl, agent/pl/analyze.pl: Esacape metacharacter '{' in regexps for perl5.003_20. Wed Jan 8 09:43:56 MET 1997 Raphael Manfredi . Description: Must use get_confstr() to get at the execsafe variable. Otherwise, the string value is converted into an integer (0) and the following strcasecmp() core dumps. It did not happen on my HP-UX machine because dereferencing NULL is not a segfault unless some special compiler flag is given!! . Files changed: * agent/filter/parser.c: Must use get_confstr() to get at the execsafe variable. Tue Jan 7 19:42:56 MET 1997 Raphael Manfredi . Description: New execsafe configuration variable to disable extended exec() checks when OFF. Regenerated agent/filter/Makefile.SH with newer jmake. The "no change" optimization was overzealous in package, when dealing with 'badaddress' requests (via the new patbounce action). Allow for @SH help to be understood, whatever the case. Slight mis-parsing of user names with '-' in them could cause 'package' to not send correct closest addresses. Now pre-extend memory in mailagent for large messages to avoid many realloc() from stealing all the core! Patch contributed by Thomas Richter . Thanks! Enhanced Received: lines parsing to be less strict on the first line (inserted locally). Strip out trailing > on addresses, since matching is greedy. Patbounce would fail when dealing with since the pattern used was matching the trailing '>'. . Files changed: * agent/files/mailagent.cf: New execsafe configuration variable. * agent/filter/main.c: Don't use my_exit() when printing version number. * agent/filter/parser.c: Don't perform extended exec() checks when execsafe is OFF. * agent/filter/parser.h: New get_confstr() and get_confstr_opt(). * agent/man/mailagent.SH: Documented new execsafe configuration variable. * agent/package.SH: The "no change" optimization was overzealous. * agent/pl/actions.pl: Allow for @SH help to be understood, whatever the case. * agent/pl/addr.pl: Slight mis-parsing of user names with '-' in them. * agent/pl/emergency.pl: Now pre-extend memory by using existing message size. * agent/pl/parse.pl: Now pre-extend memory by using existing message size. Enhanced Received: lines parsing. * agent/pl/read_conf.pl: New execsafe variable defaults to OFF when missing. * agent/pl/secure.pl: Now only perform extended exec() checks iff execsafe is ON. * agent/test/basic/config.t: Force execsafe to OFF when running tests. * misc/pbounce/patbounce.pl: Strip out trailing > on addresses, since matching is greedy. Thu Dec 26 11:52:50 MET 1996 Raphael Manfredi . Description: Filter now includes for R_OK and defines fallbacks in case those constants are missing. Declared strsave() in case it's not done in . Fixed an incredible typo while declaring progpath[]. What's almost incredible is that my compiler never spotted this one, and that the program ran fine with a critical mis-declaration. Added undocumented 'badaddress' request for PATBOUNCE support in the package command. New misc/pbounce directory, containing the PATBOUNCE plug-in. This command can be used to automatically remove from the users distribution list all the addresses that bounce. You cannot imagine how many bounces I've got whith my last patch issue. Sure they were deleted, but it's pointless to send big messages to people that cannot receive them. Five new files (PATBOUNCE command). . Files changed: * agent/filter/io.c: Include for R_OK and define fallbacks. Declared strsave() in case it's not done in . Fixed an incredible typo while declaring progpath[]. * agent/filter/parser.c: Include for X_OK and define fallbacks. * agent/package.SH: Added undocumented 'badaddress' request for PATBOUNCE. * misc/pbounce/patbounce.pl: Created. Tue Dec 24 16:34:55 MET 1996 Raphael Manfredi . Description: This patch is my Christmas gift to you all, agent-users. I took some time to collect, apply, checkin and put together all the changes I have been making for more than a year (since last patch). I hope this will not introduce any problems and it will probably be the last set of patches (modulo possible emergency bug fixes following this patch set) before the mailagent-4.0 rewrite, which will be runnable only by perl5. I don't think I broke perl4 compatibility at this point, though I don't know for sure, as I've been using perl version 5 for a long time now. Okay. Here is the list of changes: Important grammatical fix in the Artistic License (thanks Tom Christiansen). Configure regenerated with newer metaconfig and updated my e-mail address Filter now read incoming messages in a pool, instead of one big chunk. This avoids many realloc() that could get exponentially big with large messages. Attempt to locate mailagent and perl from the C filter, and croak if we cannot find them anywhere in the configured PATH. Mailagent and filter now perform basic security checks on exec()ed programs. This includes server commands and all the programs launched via RUN and friends. Filter will log onto stderr if logfile not opened correctly. Use more portable real uid/gid setting, i.e. select one of the setuid() and setruid() routine, as appropriate. The _ character was not correctly parsed in variables, which could lead to problem when using $ substitution on them. Rule file path is now absolute, so rule caching can be safe, even when the same basename is used from two distinct directories. This was specially tricky when the '-r rulefile' option was used! Changed queue processing/sleeping logic for better interactivity, as discussed on the agent-users list, and following an interesting e-mail exchange between Randal L. Schwartz and myself. Maildist commands and friends now silently discard hostile return addresses. Added command forwarding support, which allows a package maintainer to auto-forward mailagent Command messages to some third party, when maintainance of a package is transferred. New Relayed: and Envelope: pseudo header computations. The Relayed: header is a list of all the mail gateways, as gathered from the Received: lines, whilst Envelope refers to the message envelope address (first From line). Documented the %-H biffing macro with more details. Don't use expanded manpath in .so directives. I used to do so, but it lead to problems on some platforms. Since that was more than a year ago, maybe all the vendors fixed this, hence we revert to the initial settings... All power-sensitive actions from the server can now be logged separately to a file (powerlog in ~/.mailagent). Launch sendmail only when the server session is done to avoid timeouts on the down side of the pipe! Don't dataload the emergency routine to avoid malloc problems (since we're probably in a signal handler) and log signal trapping even when invoked manually. Now correctly initializes @cc to be the Cc: field in for mail hooks. Also added @relayed, $lines and $length variables. Protect all un-escaped @ in patterns, for perl5. Processing of MH profile is now case-insensitive, by popular request. Allow '-' in package names, distributed through mailagent. Default for locksafe is now OFF. Fixed some regression tests for perl5 or fast CPUs and added new tests for Relayed processing. Added the misc/mime subdirectory, containing a set of rules and a perl program to un-MIME all those nasty little messages carrying MIME attributes where they shouldn't or needn't... Four new files, if I trust the MANIFEST :-) . Files changed: * agent/files/setup.cf: Can now say that a file is expected under some directory. Applied that to mailbox, which is a file expected under maildrop. * agent/filter/environ.c: New get_env() routine, plus typo fixes. Make sure new environment lines are smaller than MAX_STRING. * agent/filter/environ.h: Declared get_env(). * agent/filter/io.c: Message is now read in a pool, instead of one big chunk. Attempt to locate mailagent and perl. Perform basic security checks on exec()ed programs. * agent/filter/logfile.c: Log onto stderr if logfile not opened correctly. * agent/filter/main.c: Use more portable real uid/gid setting. * agent/filter/misc.c: New my_exit() to allow exit code tracing for debugging. * agent/filter/msg.c: Call my_exit() instead of exit(). * agent/filter/parser.c: Enhanced security checks performed on files. The _ character was not correctly parsed in variables. * agent/filter/parser.h: Declared exec_secure(). * agent/magent.sh: Rule file path is now absolute, so caching can be safe. Changed queue processing/sleeping logic for better interactivity. New stat constants, and updated usage line. * agent/mailpatch.SH, agent/maildist.SH: Silently discard hostile addresses. Added command forwarding support. * agent/mailhelp.SH: Silently discard hostile addresses. * agent/maillist.SH: Silently discard hostile addresses. Knows about command forwarding. * agent/man/edusers.SH: Examples are now shown in constant-width font if possible. * agent/man/mailagent.SH: Examples are now shown in constant-width font if possible. Big emphasis about security issues, for RUN commands & filter. New Relayed: pseudo header computations. Documented the %-H biffing macro with more details. Updated my e-mail address. * agent/man/mailpatch.SH, agent/man/maildist.SH, agent/man/maillist.SH: Don't use expanded manpath in .so directives. * agent/man/mailhelp.SH: Documented command forwarding. * agent/man/package.SH: Examples are now shown in constant-width font if possible. Mentions command forwarding. * agent/package.SH: Added command forwarding support. * agent/pl/actions.pl: Now reads 'help' as 'mailhelp' in command messages. Locate and perform security checks on launched executables. * agent/pl/analyze.pl: Forgot to return 0 at the end of special_user(). * agent/pl/biff.pl: Long header lines are now trimmed to 79 chars max. * agent/pl/cmdserv.pl: All power-sensitive actions can now be logged separately. Launch sendmail only when session is done to avoid timeouts. Perform security checks on all server commands. * agent/pl/emergency.pl: Don't dataload the emergency routine to avoid malloc problems. Now log the signal trapping even when invoked manually. * agent/pl/filter.pl: Added initial logging of the SELECT command. * agent/pl/forward.pl, misc/mime/unmime: Created. * agent/pl/hook.pl: Perform security checks on hook programs. * agent/pl/install.pl: New prefix() routine. * agent/pl/locate.pl: New locate_program() routine. * agent/pl/mailhook.pl: Correctly initializes @cc to be the Cc: field. Added @relayed and $lines, $length. * agent/pl/matching.pl: New Envelope and Relayed selectors. Protect all un-escaped @ in patterns, for perl5. * agent/pl/mh.pl: Processing of MH profile is now case-insensitive. * agent/pl/parse.pl: New relay_list() routine to parse Received lines. Now creates two pseudo headers: Envelope and Relayed. * agent/pl/unpack.pl, agent/pl/plsave.pl: Allow '-' in package names. * agent/pl/queue_mail.pl: Add as many trailing 'x' as necessary for unique queue file. * agent/pl/read_conf.pl: Default for locksafe is now OFF. * agent/pl/rules.pl: Forgot to unlock rulecache on errors. Don't dataload hashkey(), used as a sort routine. * agent/pl/secure.pl: Extended security checks and created exec_secure(). * agent/test/basic/config.t: Added locksafe, set to OFF. * agent/test/basic/mailagent.t: Ensure we quote upper path properly, in case @ is there!. * agent/test/cmd/umask.t: Fixed test for perl5. * agent/test/filter/list.t: Added new tests for Relayed processing. * agent/test/filter/pattern.t: Added Relayed to the list of returned headers. * agent/test/option/I.t: Fixed test for fast CPUs. * agent/test/rules: Added test cases for new Relayed selector. Fri Sep 15 16:17:30 METDST 1995 Raphael Manfredi . Description: The email address listed in the README was wrong. Folder compression can now deal with various compressors. You may now compress folders using gzip if you want, or any other performant compression tool. This is configured via a compressors file listing the available compression tools, which are referred to by tags. You may choose the default tag to be used when compression a new folder. See the man page... Thanks to Kevin Johnson for contributing this code. Now escapes shell metacharacters for popen() on FORWARD and BOUNCE. This bug was reported by Larry W. Virden. It is now possible to force a strict locking procedure on folders by setting locksafe to ON. Mailagent will not attempt to deliver to a folder when it cannot grab the lock after the amount of retries you have configured. Alternatively, if you do both .lock and flock() locking, you can set locksafe to PARTIAL to let it go if at least one lock has been taken. Feature suggested by Larry W. Virden. New locksafe, compspecs and comptag config variables. Mailagent will now warn if it has been configured to do flock() but can't actually perform the operation because the system call is missing. Likewise, it will now make a note in the log when delivering to an unlocked folder, provided you have allowed it. Many typo fixes in the mailagent manual page, another contribution from Larry W. Virden. The &main'internet_info routine now assumes local user when facing a single login in the address. Otherwise, %A, %I and %O macros would not expand properly. Another set of thanks to Larry W. Virden for reporting this bug. One new file (compressors) installed in mailagent's private lib. . Files changed: * agent/files/Jmakefile: New compressors file installed in the private library. * agent/files/compressors: Created. * agent/files/mailagent.cf: Added locksafe, compspecs and comptag config variables. New "folder compression" section. * agent/files/setup.cf: Maildrop now defaults to the configured value at first install. New compspecs optional file in configuration. * agent/magent.sh: Rewrote mbox_lock routine to deal with new locksafe variable. Will now warn if configured to do flock() but can't actually. Can now be configured to do safe or allow partial mbox locking. * agent/man/mailagent.SH: Folder compression can now deal with various compressors. Added locksafe, compspecs and comptag config variables. Many typo fixes. * agent/pl/actions.pl: Now escapes shell metacharacters for popen() on FORWARD and BOUNCE. Will now make a note when delivering to an unlocked folder. Saving will fail if mbox_lock returns an undefined value. * agent/pl/compress.pl: Can now handle compression with various compressors. (code contributed by Kevin Johnson ). * agent/pl/read_conf.pl: Added suitable defaults for compspec, comptag and locksafe. * agent/pl/rfc822.pl: Internet_info now assumes local user when facing a single login. Thu Aug 31 18:35:41 METDST 1995 Raphael Manfredi . Description: Fixed a nasty hole in the error recovery C filter program. Thanks to Rosina Bignall for having spotted it out. When facing an incorrect configuration causing the C filter to exit on a fatal error, the emergency saving routine was unable to save the message since it had not been read at that point. So we explicitely read the message now if it has not been done yet at that point! Following that fix, I have also arranged for the C filter output into .bak to be prefixed with the filter pid number, so that we can figure out where the message came from. Lastly, if the emergency saving is impossible, the message will be dumped on stdout. This was done in the shell filter, but not in the C filter. Hopefully, something catches the output from filter, if you set up your .forward according to the documentation. Internal C filter changes: . new routine write_fd() to write mail onto an opened file . write_file() now relies on new write_fd() to do its main job . read_stdin() was made a once routine . emergency_save() now attempts to read mail if not done already . emergency_save() will dump message on stdout as a fall back . now uses say() to print messages onto stderr . all messages on stderr now also include the filter pid . fatal() now prefixes its supplied reason with FATAL Forced numeric value when reading the Length header or mailagent could print an empty string instead of '0' when fed with an empty mail message (such as /dev/null). Escaped various dollars to avoid shell substitution in the mailagent.SH manual page. For those worried about that, mailagent-4.0 will probably have its documentation PODified, so this will become useless, hopefully. . Files changed: * agent/filter/io.c: New routine write_fd() to write mail onto an opened file. write_file() now relies on new write_fd() to do its main job. read_stdin() was made a once routine. emergency_save() now attempts to read mail if not done already. emergency_save() will dump message on stdout as a fall back. * agent/filter/main.c: Now uses say() to print messages onto stderr. * agent/filter/msg.c: New routine say() to print messages onto stderr. All messages on stderr now also include the filter pid. Fatal() now prefixes its supplied reason with FATAL. * agent/filter/msg.h: Added declaration for new say() routine. * agent/filter/parser.c: Now uses say() to print messages on stderr. * agent/magent.sh: Forced numeric value when reading the Length header. * agent/man/mailagent.SH: Escaped various dollars to avoid shell substitution, grrr... Mon Aug 7 19:24:41 METDST 1995 Raphael Manfredi . Description: Forgot to return value in agent_lockfile(). Since the returned value is grabbed from whatever there is on the C stack at that point, you may get into trouble or go through this unharmed (which is what happened for me!). . Files changed: * agent/filter/io.c: Forgot to return value in agent_lockfile(). Mon Aug 7 18:46:14 METDST 1995 Raphael Manfredi . Description: Regenerated Configure with metaconfig 3.0 PL58. Updated my e-mail address in various manual patches, since it still pointed to my previous workplace. Signal that perl5.001m is known to work with that version of mailagent. Added support for locking on filesystems with short filenames. On flexible filesystems, locking is done with the standard .lock extension. On others, it is done by appending a '!'. Updating of .mh_sequences also knows about this limitation when constructing the new file. Avoid forking of a new mailagent if one is sitting in background. This is a trial fix for a seldom problem, which should not impact anyone. If you run many Command mail processing, this might improve things a little bit, on the occasion... Now remove mailagent's lock as soon as possible before exiting, to limit possible race conditions due to the above optimization. Note that a race condition did exist in previous versions, although it was very unlikely to occur in real life! New biffing configuration variables and new biffing features: It is now possible to remove leading comments in the body to only present new material, and also to perform a compaction on the body to present more of it in a limited space, sacrifying the original indentation of the message. New BIFF filtering command to dynamically configure biffing. Code fixes in the C filter: . Removed useless local variable declaration in C code. . Exported check_lock() for external mailagent lock checks in io.c . Commented and re-organized fatal code for emergency saving Forgot to define phostname, needed for NFS-secure locks in two mailagent utilities. Fixed syntax error when restoring previous option values. This should prevent the usual set of .bak errors that occurred only when perl5 was used. **NOTE**: This was fixed by an unofficial patch on the agent-users list. If you applied that patch, don't forget to restore the original file(s) before applying this official patch! Skip possible spaces before trailing command ';' terminator. This avoids syntax errors or problems when writing things like: SOME_COMMAND "argument" ; i.e. when there are spaces after the final argument. New BIFF and BEEP regression testing One new file. . Files changed: * agent/man/package.SH, agent/man/mailhelp.SH, agent/man/edusers.SH, FAQ: Updated my e-mail address. * agent/test/basic/filter.t, agent/test/option/s.t, agent/test/basic/mailagent.t, agent/edusers.SH, agent/test/TEST, agent/test/pl/init.pl: Added support for locking on filesystems with short filenames. * agent/files/filter.sh: Avoid forking of a new mailagent if one is sitting in background. * agent/files/mailagent.cf: New biffing configuration variables. * agent/filter/environ.c, agent/filter/parser.c: Removed useless local variable declaration. * agent/filter/io.c: Avoid forking of a new mailagent if one is sitting in background. Added support for locking on filesystems with short filenames. * agent/filter/lock.c: Exported check_lock() for external mailagent lock checks in io.c. Added support for locking on filesystems with short filenames. * agent/filter/lock.h: Exported check_lock() for external mailagent lock checks in io.c. * agent/filter/msg.c: Commented and re-organized fatal code for emergency saving. * agent/magent.sh: Now remove mailagent's lock as soon as possible before exiting. Added support for locking on filesystems with short filenames. * agent/maillist.SH: Forgot to define phostname, needed for NFS-secure locks. * agent/man/mailagent.SH: New biffing features and configuration variables. New BIFF filtering command to dynamically configure biffing. * agent/man/mailpatch.SH, agent/man/maildist.SH, agent/man/maillist.SH: Use mansrcexp on the .so line to get full expanded path. * agent/package.SH: Added support for locking on filesystems with short filenames. Forgot to define phostname, needed for NFS-secure locks. * agent/pl/actions.pl: Now use env::biff instead of cf:biff for dynamic configuration. Added protection around &interface::reset calls for perl5. * agent/pl/biff.pl: Added support for biffing regression testing. New biffing features for compact biff messages and trimming. * agent/pl/cmdserv.pl: Fixed symbol table lookups for perl5 support. * agent/pl/context.pl: Fixed parsing bug in perl5.001. * agent/pl/filter.pl, agent/pl/runcmd.pl: New BIFF command. * agent/pl/interface.pl: New BIFF command interface routine for PERL hooks. Fixed symbol table lookups for perl5 support. * agent/pl/mh.pl: Now beware of filesystems with limited filename lengths. * agent/pl/options.pl: Fixed syntax error when restoring previous option values. * agent/pl/read_conf.pl: Added comment explaining why mailboxes are locked with a .lock. * agent/pl/rulenv.pl: New support for biff and biffmsg variable environment. Fixed environment setup code. * agent/pl/rules.pl: Skip possible spaces before trailing command ';' terminator. * agent/test/actions: New BIFF regression testing. * agent/test/cmd/beep.t: Added regression testing for BEEP. * agent/test/cmd/biff.t: Created. * agent/test/pl/logfile.pl: Simplified matching by removing spurious eval. Tue Mar 21 14:08:38 MET 1995 Raphael Manfredi . Description: Regenerated Configure to reflect my email address change. I moved from ACRI to HP, and my email is now: . The "critical" nature of this patch is due to that mere fix. Configure can now handle HP-UX broken WIFEXITED() macros. Indeed, on HP-UX, WIFEXITED(status) tries to cast the 'union wait status' into an int, which fails miserably. The new metaconfig symbol USE_WIFSTAT is now being used to avoid that. The README now reports that perl 5.0 PL1 does not work with mailagent, at least on my machine. For those adventurous enough to try it. Beware!! Added a Precedence: header to the sample vacation message. Mailagent does not add that to the header by default, since it is not mandatory at all. However, it is better to include one to avoid cascade of automatic replies after a vacation. Now creates the private library directory before installing, so that filter can be properly installed. Now allows spaces between header field name and the ':' delimiter. Strict RFC-822 does not forbid people from writing things like: From : ram To : ram Subject: test and therefore mailagent allows them and parses these fields correctly. Symbolic directories are now correctly followed. The new agent/pl/cdir.pl file is now used to derive relative paths from the symbolic directory location to follow links correctly. Previous versions were not following relative symbolic links, hence forcing people to have 'linkdirs: OFF' in their config. Fixed rename() syntax for perl 4.0 in the cmd/save.t test. One new file. . Files changed: * agent/mailpatch.SH, agent/maildist.SH, agent/maillist.SH, agent/package.SH, agent/mailhelp.SH, agent/magent.sh, agent/edusers.SH: Added pl/cdir.pl to the list of appended files. * agent/filter/Jmakefile: Now creates the private library directory before installing. * agent/filter/io.c: Now relies on USE_WIFSTAT to use WIFEXITED() and friends. * agent/man/mailagent.SH: Sample vacation message now contains a Precedence: header. * agent/pl/cdir.pl: Created. * agent/pl/parse.pl: Now allows spaces between header field name and the ':' delimiter. * agent/pl/secure.pl: Symbolic directories are now correctly followed. * agent/test/cmd/save.t: Fixed rename() syntax for perl 4.0. Thu Feb 16 15:56:50 MET 1995 Raphael Manfredi . Description: Added new file setup.cf for initial configuration setup, via the -I switch. That new option greatly simplifies the initial configuration setup. If you run 'mailagent -I' with an existing ~/.mailagent, it will be "merged" with the current set of configuration variables (that is, new variables that were added after you initially configured mailagent, in subsequent patches). Your configuration is also checked for, to avoid nasty surprises at run-time... Forgot to add interfaces for BEEP and PROTECT, hence making it impossible to invoke those commands from a perl escape. Can now fake a missing From: line in header, unless prevented to do so by the new 'fromfake' config variable. That way, messages can be saved in MH folders even if the (local) sendmail did not bother adding a From: header, relying on the leading From envelope to identify the sender... Was not properly propagating rule-file variable definitions. Variables defined in rule files are dynamically scoped, as stated by the new paragraph in the manual page. New regression tests: . added test for the new -I switch . one more test for SAVE to check new fromfake feature . added checks for new fromfake config variable Regenerated Configure and config_h.SH with metaconfig 3.0 PL51. Three new files. . Files changed: * agent/files/Jmakefile: Added new file setup.cf for initial configuration setup. * agent/pl/actions.pl: Now uses new header_append and header_prepend routines. * agent/pl/add_log.pl: New routine stdout_log for -I switch usage. * agent/test/option/I.t, agent/pl/install.pl: Created. * agent/pl/interface.pl: Forgot to add interfaces for BEEP and PROTECT. * agent/pl/parse.pl: New routines header_prepend and header_append. Can now fake a missing From: line in header. * agent/pl/rules.pl: Was not properly propagating rule-file variable definitions. * agent/pl/sendfile.pl: Indentation fix. * agent/test/actions: One more test for SAVE to check new fromfake feature. * agent/test/cmd/save.t: Added checks for new fromfake config variable. Fri Feb 3 19:16:07 MET 1995 Raphael Manfredi . Description: Detab-ed the FAQ file for easier reading on terminals. I have resent a new version of it to Nancy for inclusion in her FAQ. Minor changes in FAQ wording. I added the Star Trek example to help understanding how filtering with regexps works. The C filter now avoids closing stdio files when they are not connected to a tty but rather redirected to a file. Otherwise, perl warnings and errors could never make it to the ~/.bak file, or whatever file you are redirecting errors to in ~/.forward. Mailagent was wrongly biffing when delivering to a mail hook. Avoid perl core dumps in &perl by localizing @_ on entry. When using the PERL command, I used to undef the @_ variable to ensure the perl script would get no garbage from there. However, Brian Dickson has found out that was a case of variable suicide, causing core dumps on SUNs. He proposed using local() to avoid the nasty side effect. Ensure domain name matches are made after the '@' delimiter when looking for "close" addresses. It used to think that addresses like ram@soft.user.acri.fr and ram@soft.user.acri where equivalent, because the match was not anchored to '@'. Order of arguments was wrong when calling &spawn, to run the callout queue. Also, it could loop forever in &run when flushing the whole queue and the value of first_callout time was not set right the first time a callout is queued. All those bugs nailed down thanks to a bug report from Randal L. Schwartz on agent-users. Rule parsing could end-up prematurely when facing hook files, because the parser was testing for an empty string instead of undefinedness, which would abruptly end the parsing when facing a blank line in a hook since final \n are chopped off. Avoid blank printing when the default rule was never applied in mailagent stastistics summary printing. Fixed regexp bug that could lead the UMASK test to fail when the word 'mail' was appearing in the path leading to the place where mailagent sources are stored! Again, thanks to Brian Dickson and Eric M. Carroll for reporting it and nailing it down, at last! . Files changed: * FAQ: Detab-ed the FAQ file for easier reading on terminals. Minor changes in wording and added the Star Trek example. * agent/filter/io.c: Avoid closing stdio files if not connected to a tty. * agent/filter/parser.c: Moved definition of S_IWOTH and S_IWGRP to the top. * agent/magent.sh: Also select hot piping on stderr to avoid problems on fork. * agent/pl/actions.pl: Was wrongly biffing when delivering to a mail hook. Avoid perl core dumps in &perl by localizing @_ on entry. * agent/pl/addr.pl: Ensure domain name matches are made after the '@' delimiter. * agent/pl/callout.pl: Order of arguments was wrong when calling &spawn. Could loop forever in &run when flushing the whole queue. Value of first_callout time was not set right the first time. Added more debugging information. * agent/pl/lexical.pl: Rule parsing could end-up prematurely when facing hook files. * agent/pl/rules.pl: Added tracing of alternate rules to help debug their parsing. * agent/pl/stats.pl: Avoid blank printing when the default rule was never applied. * agent/test/cmd/umask.t: Fixed regexp bug that could lead the test to fail. Wed Jan 25 16:44:40 MET 1995 Raphael Manfredi . Description: Regenerated Configure with metaconfig 3.0 PL48 for install binary lookup. Regenerated most Makefile.SH files with jmake 3.0 PL48 to benefit from the install lookup. Extended copyright notice to include year 1995. Mailagent now works with perl 5.0. It has been fully tested on my DEC OSF/1 3.0 machine and passes all its regression tests. However, this perl 5.0 is a version patched with early patches from the perl5-porters list. See the README file for instructions about how to get those patches. New option letter 't' for mailagent -s. The 'mailagent -surat' command will only deliver statistics for the top-level rule file. Indeed, each time your rule file changes, mailagent normally starts a new set of statistics on top of older ones. New commands BEEP and PROTECT. The BEEP command controls the new %a macro for biffing message, which is expanded into the matching amount of ^G characters. The PROTECT commands lets you define file protections for newly created folders. I also added support for the Msg-Protect MH profile component when saving into an MH folder, at Eric M. Carroll's request. However, the new PROTECT command can override the default Msg-Protect specification from your ~/.mh_profile. Added support for NFS bug on remote read-only folders. Indeed, SUN's NFS running on SUN 4.1.2 was allowing a remote write to a read-only folder lying on my DEC OSF/1 3.0 machine... Destination address for PROCESS is now parsed correctly, by using the RFC822 parser instead of a local hacked parsing. Ported many files to perl 5.0 PL0. This included workarounds for perl 5.0 bugs, and lots of @ escaping in strings and patterns, mainly in the regression test suite. Avoid problems on slow machines in test mode for queue timestamps. Some slow machines were reported to fail some tests in option/l. I made sure those will not occur any more by twiddling with the queue output string in test mode. UNSEEN mark in log has the home directory stripped via &tilda. Two new files. . Files changed: * agent/man/mailagent.SH: New option letter 't' for mailagent -s. New commands BEEP and PROTECT. New macro %a for biff messages. * agent/pl/actions.pl: Added support for NFS bug on remote read-only folders. Destination address for PROCESS is now parsed correctly. Added support for folder mode change, as defined by PROTECT. * agent/pl/biff.pl: New macro %a for variable bells, under the control of BEEP. * agent/pl/filter.pl: New commands BEEP and PROTECT. * agent/pl/getdate.pl: Fixed a typo in &yyerror and various code clean-up. Ported to perl 5.0 PL0. * agent/pl/lexical.pl: Added automatic @ escape in patterns for perl 5.0. * agent/pl/listqueue.pl: Avoid problems on slow machines in test mode for queue timestamps. * agent/test/cmd/vacation.t, agent/test/cmd/notify.t, agent/pl/parse.pl, agent/pl/queue_mail.pl, agent/test/misc/compress.t, , agent/test/cmd/message.t, agent/pl/macros.pl: Ported to perl 5.0 PL0. * agent/pl/mh.pl: Added support for the Msg-Protect MH profile component. Allows new PROTECT command to override default Msg-Protect. UNSEEN mark in log has the home directory stripped via &tilda. * agent/pl/mmdf.pl: New routine &chmod for folder permission settting. * agent/pl/read_conf.pl: Escape all @ in config file for perl 5.0. * agent/pl/rulenv.pl: New routines &unset and &undef. Added default values for PROTECT and BEEP. Added logs in case of eval errors for perl 5.0. * agent/pl/runcmd.pl: New commands PROTECT and BEEP. * agent/pl/signals.pl: Put signal handler names into double quotes for perl 5.0. * agent/pl/stats.pl: Now supports 't' to track only top-most rule file stats. * agent/pl/usrmac.pl: Ported to perl 5.0 PL0. Added eval error tracking for perl 5.0. * agent/test/actions: Extended rules for the PROTECT command tests. * agent/test/basic/config.t: Now sets a default umask in the configuration. * agent/test/cmd/protect.t, agent/test/cmd/beep.t: Created. * agent/test/misc/mh.t: Added checks for Msg-Protect and PROTECT. Tue Jan 03 19:36:49 MET 1995 Raphael Manfredi . Description: Upgraded Configure with metaconfig 3.0 PL44 C filter now correctly includes as a last option only. Added a -V option to filter to print out the version and patchlevel. This is not documented anywhere but in the code. Sorry, but there is no manual page for filter. This is only for the C filter though, the shell filter can be "edited" to get its version number. No longer uses agent/pl/umask.pl. This file is to be removed from your local copy if you still have it around. New -u option for ANNOTATE: the annotation will only be performed if the specified header is not already present in the message. Fixed example on the shell server command: power checking was too restrictive by requiring the user to only hold the 'shell' power where he may hold many others at the same time... Removed quotes for the argument of SERVER -d to accomodate new option parsing. Be careful! You must now say SERVER -d cmd1,cmd2 etc.., with no spaces around the separating commas. Added a -l switch to VACATION and extended its arguments. When -l is used, modification are only made within the scope of the rule. It is also possible to specify an alternate vacation file, and even change the vacation period, locally or for the remaining of the parsing... New section in the man page documenting Rule Environment variables. Removed old broken umask handling (now a part of rule env). The new code should work much better and is more generic. The %=config variables were not properly substituted. They were probably expanded into spaces instead. It is no longer possible to get at the vacation variable from a new user-defined command. You must get at the $env'vacation variable instead (see the Rule Environment section in the manual page). Mailagent no longer tries to read the rule cache when none was configured from ~/.mailagent... Added generic option parsing code for easier extensions. As a matter of fact, the code was simplified internally. Routines implementing actions now have the leading action name chopped of the $cms string, as well as possible options. The action routine also directly get at the resulting argument string, which simplifies processing for most of the commands... This should not impact performances, and may in fact degrade them a little since we now make use of eval() more heavily. Make sure old utmp list is gone when reloading from /etc/utmp. Added new tests for ANNOTATE -u and VACATION -l. Removed agent/pl/umask.pl from distribution, as stated before. Three new files, including an FAQ document, an exerpt of the "Filtering Mail FAQ" posting from Nancy McGough. . Files changed: * FAQ, agent/pl/rulenv.pl, agent/pl/options.pl: Created. * agent/pl/umask.pl: Removed from the distribution. * agent/filter/lock.c: Now correctly includes as a last option only. * agent/filter/main.c: Added a -V option to print out the version and patchlevel. * agent/magent.sh: New library files pl/rulenv.pl and pl/options.pl included. No longer uses pl/umask.pl. * agent/man/mailagent.SH: New -u option for ANNOTATE documented. Fixed example on the shell server command (power checking). Removed quotes for SERVER -d to accomodate new option parsing. Added a -l switch to VACATION and extended its arguments. New section documenting Rule Environment variables. * agent/pl/actions.pl: Removed a here-doc string to workaround a bug in perl 4.0 PL36. Simplified action codes to use new opt'sw_xxx option vars. &execute_command no longer sleeps before resuming parent process. * agent/pl/analyze.pl: Now makes use of rule environment vars from the env package. Removed old broken umask handling (now a part of rule env). * agent/pl/eval.pl: Simplified hash table initialization -- code still unused. * agent/pl/filter.pl: Commands now get a string with the command name chopped off. Modified &alter_execution to accomodate new option parsing. * agent/pl/hook.pl: Routine &perl now calls &main'perl directly to do its job. No longer pre-extend variable when reading top 128 bytes. * agent/pl/macros.pl: The %=config variables were not properly substituted. * agent/pl/newcmd.pl: It is no longer possible to get at the vacation variable. * agent/pl/rules.pl: Don't try to read the rule cache when none was configured. * agent/pl/runcmd.pl: Added generic option parsing code for easier extensions. Chops off the action name and options before calling handler. * agent/pl/utmp/utmp_pl.sh: Make sure old utmp list is gone when reloading from /etc/utmp. * agent/test/actions: Added new tests for ANNOTATE -u and VACATION -l. * agent/test/basic/config.t: Temporary directory is now local, don't clobber /tmp. * agent/test/cmd/annotate.t: Added tests for new -u option. * agent/test/cmd/vacation.t: Added tests for new -l option and extended parameters. * misc/shell/shell: Power checking was not correctly performed (was too restrictive). * misc/unkit/unkit.pl: Now uses cf'email for the notification address. Fixed a typo in sv_kfrom variable spelling. Mon Oct 31 12:20:39 MET 1994 Raphael Manfredi . Description: File magent.sh now replaces magent.SH to avoid auto-extraction by Configure. Indeed, magent.sh relies on the presence of the agent/pl/utmp.pl file, which is not available at Configure time, usually. Since Configure only extacts .SH files automagically, this is a way to ensure the file will be built according to make rules, i.e. only once agent/pl/utmp.pl has been created will we attempt to run /bin/sh magent.sh. . Files changed: * agent/Jmakefile: File magent.sh now replaces magent.SH to avoid auto-extraction. Sat Oct 29 19:35:00 MET 1994 Raphael Manfredi . Description: The shell filter now behaves more like the C filter. It will print roughly the same messages in the log under normal conditions, which includes QUEUED-like messages that did not appear before. [I don't normally use the shell filter on my machine but I did test it for a while to make sure it was not broken. That's why I decided to make its output similar to the C filter to avoid surprises when glancing at the log file]. Added built-in biffing support, by popular demand. Actually, no, it is to please my officemate who wrote a set of scripts to achieve the same thing, only to see that they were failing when he was not logged in. It's really straightforward to set up and to configure. Please refer to the new MAIL BIFFING section on the manual page for details. Notifications sent by the package command are now directed to the user specified on the command, not to the return address since it is not an error, and the two might differ. Internet numbers in message IDs are now allowed. If you don't use UNIQUE nor RECORD commands, then you don't care about that anyway. Added support for local (internal) macro overriding, which is used by the biffing mechanism to override macros like %f or %D. It is possible for the overrider to let the user get to the standard macro set by providing: : \02! at the end of the string passed to ¯o'overload. This will allow %:f to be taken as the "standard" %f macro. Note that this is an internal feature and is not documented in the manual page. I'm merely mentionning it here in case you wish to use that in your own commands. Updated Configure with metaconfig 3.0 PL43, merely to fix a vicious 'tr' bug when attempting to translate case to/from lower to upper on machines with a non-ascii character set. This was reported to me by Andreas Sahlbach . From now on, the ChangeLog file will record changes made to the distribution. The text you are reading now is also part of the ChangeLog file, as well as the list of changed files, with their RCS logs. That should help users track modifications better. 8 new files in the distribution, for utmp.pl support and biffing. . Files changed: * agent/Jmakefile: Directory pl added to subdirs and depend lists. * agent/files/filter.sh: Made it behave more like the C filter. * agent/files/mailagent.cf: Six new configuration variables for biffing support. * agent/magent.SH: Added built-in biffing support. * agent/man/mailagent.SH: Documents the six new config variables for biffing. New section dedicated to built-in mail biffing. * agent/package.SH: Notifications now sent to the user, not the return address. * agent/pl/utmp/Jmakefile, agent/pl/Jmakefile, agent/pl/biff.pl, agent/pl/utmp/utmp_ph.c, agent/pl/utmp/utmp_pl.sh: Created. * agent/pl/actions.pl: Added biffing support in &save. * agent/pl/history.pl: Now supports internet numbers in message IDs. * agent/pl/macros.pl: Now uses ^B! characters in macro substitution for %. Added support for local (internal) macro overriding. mailagen-3.1.106/Changes000066400000000000000000000053151364362711600147470ustar00rootroot00000000000000This file shortly documents the new features appearing in mailagent 3.0 compared to mailagent 2.9 PL19. For more details, please refer to the manual page [yes, it's getting bigger and bigger, sorry]. . Mailhook disappears. Folder hooks are now handled without the need for an extra process. . NOTIFY now takes its FIRST argument to indicate the message file, instead of its LAST as in the 2.9 release. This change in order to make it compatible with MESSAGE. . Mailagent secure configuration checks. Impossible to use mailagent if the ~/.mailagent file or the rule file are not correctly protected. . Dynamic loading interface (dynload.pl) available for perl commands. . Added a generic command server. Mailagent provides the server engine and users write their own commands, with special provision for perl scripts which can be directly loaded and executed within mailagent itself. . User-defined macro support %-(x) and perl interface. . New APPLY, REQUIRE, SERVER, MACRO commands. . Support for rule caching. This avoids recompiling large rule files at every mailagent run, but speed has never never been a main concern in this program anyway. . Negated mode support . Rule is not executed if in the specified negated mode. This supersedes normal modes, i.e. is never executed. . Can now configure sendmail process and inews, with options, from ~/.mailagent. If your sendmail behaves strangely or want to have interactive delivery instead of queuing, this is the place to look at. . New usr_log facility, enabling user-defined logfiles. Available for your own commands and used internally by mailagent. . Saving operations now check on the size of the produced folder for NFS. . Can now access ~/.mailagent config params via %=var . Fixed bug in agent queue parsing. This happened mainly on SUN systems, and was apparently a perl fileglob bug (or is it a /bin/csh bug?). Anyway, I now use readdir() to access the queue, which suppresses forking of an extra process. . Improved RFC822 address parsing. Now understands group names as login names. . Output for mailagent -d formatted differently. . Selector range Body <1,4>: available. This example selects body lines 1 to 4 (inclusive) for matching. . Can now deliver to MH folders (without the need for an extra process). Use 'SAVE +foo' to deliver to the MH folder foo. Unseen sequences specified in your ~/.mh_profile are correctly updated. . Minimal support for directory hooks (only behaves like MH folders currently). . New @SH package command for dist-3.0 MailAuthor.U support. That metaconfig units sends a mail in specific format to record users of some package, and the package command is there to automate the process. mailagen-3.1.106/Configure000077500000000000000000005320331364362711600153250ustar00rootroot00000000000000#! /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 package (which contains metaconfig) is available via git: # git clone git@github.com:rmanfredi/dist.git # $Id$ # # Generated on Tue Jun 5 15:27:29 CEST 2018 [metaconfig 3.5-241] cat >c1$$ <c2$$ </dev/null` test "$me" || me=$0 ;; esac : Proper separator for the PATH environment variable p_=: : On OS/2 this directory should exist if this is not floppy only system ":-]" if test -d c:/. ; then if test -n "$OS2_SHELL"; then p_=\; PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` elif test -n "$DJGPP"; then case "X${MACHTYPE:-nonesuchmach}" in *cygwin|*msys) ;; *) p_=\; ;; esac fi 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" paths="$paths /system/gnu_library/bin" 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 if test -f /osf_boot -a -f /usr/sbin/setld; then if test X`/usr/bin/uname -s` = XOSF1; then avoidksh="to avoid Digital UNIX' ksh" newsh=/bin/sh unset BIN_SH fi fi case "$inksh/$needksh" in /[a-z]*) 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 </dev/null` : Private path used by Configure to find libraries. Its value : is prepended to libpth. This variable takes care of special : machines, like the mips. Usually, it should be empty. plibpth='' : default library list libswanted='' : should be set by hint files if needed libscheck='' usesocks='' : full support for void wanted by default defvoidused=15 : private initializations libswanted='' : 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$_exe" break elif test -f "$xxx.exe"; then sh="$xxx.exe" break fi done fi ;; esac case "$sh" in '') cat >&2 </dev/null 2>&1`; then shsharp=true spitshell=cat xcat=/bin/cat test -f $xcat$_exe || xcat=/usr/bin/cat if test ! -f $xcat$_exe; then for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do if test -f $p/cat$_exe; then xcat=$p/cat break fi done if test ! -f $xcat$_exe; then echo "Can't find cat anywhere!" exit 1 fi fi echo "#!$xcat" >sharp $eunicefix sharp chmod +x sharp ./sharp > today 2>/dev/null if test -s today; then sharpbang='#!' else echo "#! $xcat" > sharp $eunicefix sharp chmod +x sharp ./sharp > today 2>/dev/null 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 sharp today : figure out how to guarantee sh startup case "$startsh" in '') startsh=${sharpbang}${sh} ;; *) esac cat >sharp < cmdline.opt <>cmdline.opt < cmdl.opt $arg EOC arg_exp=`cat cmdl.opt` args_exp="$args_exp$args_sep'$arg_exp'" argn=`expr $argn + 1` args_sep=' ' done rm -f cmdl.opt : produce awk script to parse command line options cat >options.awk <<'EOF' BEGIN { optstr = "A: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 posthint.sh cat >optdef.sh <&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 ;; -A) shift xxx='' yyy="$1" zzz='' uuu=undef case "$yyy" in *=*) zzz=`echo "$yyy"|sed 's!=.*!!'` case "$zzz" in *:*) zzz='' ;; *) xxx=append zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` yyy=`echo "$yyy"|sed 's!=.*!!'` ;; esac ;; esac case "$xxx" in '') case "$yyy" in *:*) xxx=`echo "$yyy"|sed 's!:.*!!'` yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` zzz=`echo "$yyy"|sed 's!^[^=]*=!!'` yyy=`echo "$yyy"|sed 's!=.*!!'` ;; *) xxx=`echo "$yyy"|sed 's!:.*!!'` yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;; esac ;; esac case "$xxx" in append) echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;; clear) echo "$yyy=''" >> posthint.sh ;; define) case "$zzz" in '') zzz=define ;; esac echo "$yyy='$zzz'" >> posthint.sh ;; eval) echo "eval \"$yyy=$zzz\"" >> posthint.sh ;; prepend) echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;; undef) case "$zzz" in '') zzz="$uuu" ;; esac echo "$yyy=$zzz" >> posthint.sh ;; *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;; esac shift ;; -V) echo "$me generated by metaconfig 3.5-241." >&2 exit 0;; --) break;; -*) echo "$me: unknown option $1" >&2; shift; error=true;; *) break;; esac done case "$error" in true) cat >&2 <&1 case "$silent" in true) exec 1>/dev/null;; esac touch optdef.sh if grep -q '\\' optdef.sh >/dev/null 2>&1; then echo "Configure does not support \\ in -D or -U arguments" >&2 exit 1 fi : run the defines and the undefines, if any, but leave the file out there... . ./optdef.sh : create the posthint manipulation script and leave the file out there... touch posthint.sh : set package name package='mailagent' 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 : script used to emulate mkdir -p cat >mkdirp <>mkdirp <<'EOS' 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 EOS chmod +x mkdirp $eunicefix mkdirp : 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 : Find the path to the source tree case "$src" in '') case "$0" in */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'` case "$src" in /*) ;; .) ;; *) src=`cd ../$src && pwd` ;; esac ;; *) src='.';; esac;; 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 '') cat <&4 Sorry, I can't seem to locate the source dir for $package. Please start Configure with an explicit path -- i.e. /some/path/Configure. EOM exit 1 ;; ../.) rsrc='..';; *) echo " " echo "Sources for $package found in \"$src\"." >&4 ;; esac : script used to extract .SH files with variable substitutions cat >extract </dev/null` EOS cat >>extract <<'EOS' 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 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.*/\(.*\)'` ./mkdirp $dir sh <"$SRC/$dir/$file" ;; *) sh <"$SRC/$file" ;; esac ;; esac done if test -f "$SRC/config_h.SH"; then if test ! -f config.h; then sh <"$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';; esac echo " " echo "Fetching answers from $config_sh..." cd .. . $config_sh test "$override" && . ./optdef.sh echo " " . UU/extract rm -rf UU echo "Extraction 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 : 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 : 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 -l 50 2>/dev/null || 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@pobox.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?? : Find the appropriate value for a newline for tr if test -n "$DJGPP"; then trnl='\012' fi if test X"$trnl" = X; then case "`echo foo | tr '\n' x 2>/dev/null`" in foox) trnl='\n' ;; esac fi if test X"$trnl" = X; then case "`echo foo | tr '\012' x 2>/dev/null`" in foox) trnl='\012' ;; esac fi if test X"$trnl" = X; then case "`echo foo | tr '\r\n' xy 2>/dev/null`" in fooxy) trnl='\n\r' ;; esac fi if test X"$trnl" = X; then cat <&2 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'. EOM exit 1 fi : 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 <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 '$trnl' ' '\` 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 : create .config dir to save info across Configure sessions test -d ../.config || mkdir ../.config cat >../.config/README </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 <>../.config/instruct;; esac fi : script used to emit important warnings cat >warn <msg else cat >msg fi echo "*** WARNING:" >&4 sed -e 's/^/*** /' &4 echo "*** " >&4 cat msg >>config.msg echo " " >>config.msg rm -f msg EOS chmod +x warn $eunicefix warn : find out where common programs are echo " " echo "Locating common programs..." >&4 cat <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 \$thisthing$_exe; then echo \$thisthing exit 0 elif test -f \$dir/\$thing.exe; then if test -n "$DJGPP"; then echo \$dir/\$thing.exe else : on Eunice apparently echo \$dir/\$thing fi exit 0 fi ;; esac done echo \$dflt exit 1 EOSC chmod +x loc $eunicefix loc loclist=" awk cat chgrp chmod chown comm cp echo expr grep make mkdir mv rm sed sleep sort touch tr uniq " trylist=" ar cpp date egrep inews line ln mail nm nroff perl rmail sendmail smail test uname vi wc zcat " pth=`echo $PATH | sed -e "s/$p_/ /g"` pth="$pth /sbin /usr/sbin /lib /usr/lib /etc" for file in $loclist; do eval xxx=\$$file case "$xxx" in /*|?:[\\/]*) if test -f "$xxx"; then : ok else ./warn "no $xxx -- ignoring your setting for $file." 4>&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!" >&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 ./warn "no $xxx -- ignoring your setting for $file." 4>&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$_exe|egrep) echo "Substituting grep for egrep." egrep=$grep _egrep=$_grep ;; esac case "$ln" in ln$_exe|ln) echo "Substituting cp for ln." ln=$cp _ln=$_cp ;; esac case "$make" in make$_exe|make) case "$gmake" in gmake) echo "I can't find make or gmake, and my life depends on it." >&4 echo "Go find a public domain implementation or fix your PATH setting!" >&4 exit 1 ;; esac ;; esac case "$gmake" in gmake$_exe|gmake) ;; *) if test -f "/system/gnu_library/bin/ar.pm"; then : Stratus VOS echo "Substituting gmake for make." make=$gmake _make=$_gmake fi ;; esac case "$test" in test|test$_exe) echo "Hopefully test is built into your sh." test=test ;; *) 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$_exe) echo "Hopefully echo is built into your sh." echo=echo ;; '') ;; *) 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 <$c" $echo "*" fi $rm -f foo1 foo2 ;; esac : generate the trygcc script for later perusal cat <trygcc $startsh EOS cat <<'EOSC' >>trygcc case "$cc" in '') ;; *) $rm -f try try.* $cat >try.c <&4 despair=yes trygcc=yes case "$cc" in *gcc*) trygcc=no ;; esac case "`$cc -v -c try.c 2>&1`" in *gcc*) trygcc=no ;; esac if $test X"$trygcc" = Xyes; then if gcc -o try -c try.c; then echo " " echo "You seem to have a working gcc, though." >&4 rp="Would you like to use it?" dflt=y if $test -f myread; then . ./myread else if $test -f UU/myread; then . ./UU/myread else echo "Cannot find myread, sorry. Aborting." >&2 exit 1 fi fi case "$ans" in [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no; $cat *.cbu >checktmp 2>/dev/null if $contains ccflags checktmp >/dev/null; then ./warn 4>&4 <checkcc $startsh EOS cat <<'EOSC' >>checkcc case "$cc" in '') ;; *) $rm -f try try.* $cat >try.c <&4 fi $cat >&4 < /dev/null 2>&1 && $test -f sym; 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 : determine whether symbolic links are supported echo " " case "$lns" in *"ln"*" -s") echo "Checking how to test for symbolic links..." >&4 $lns blurfl sym if $test "X$issymlink" = X; then case "$newsh" in '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;; *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;; esac if test $? = 0; then issymlink="test -h" else echo "Your builtin 'test -h' may be broken." >&4 case "$test" in /*) ;; *) pth=`echo $PATH | sed -e "s/$p_/ /g"` for p in $pth do if test -f "$p/$test"; then test="$p/$test" break fi done ;; esac case "$test" in /*) echo "Trying external '$test -h'." >&4 issymlink="$test -h" if $test ! -h sym >/dev/null 2>&1; then echo "External '$test -h' is broken, too." >&4 issymlink='' fi ;; *) issymlink='' ;; esac fi fi if $test "X$issymlink" = X; then if $test -L sym 2>/dev/null; then issymlink="$test -L" echo "The builtin '$test -L' worked." >&4 fi fi if $test "X$issymlink" != X; then echo "You can test for symbolic links with '$issymlink'." >&4 else echo "I do not know how you can test for symbolic links." >&4 fi $rm -f blurfl sym ;; *) echo "No symbolic links, so not testing for their testing..." >&4 ;; esac : define absolute package source directory case "$src" in /*) pkgsrc=$src;; *) pkgsrc=`cd $rsrc; pwd`;; esac : Duplicate the tree with symbolic links if -Dmksymlinks was supplied case "$mksymlinks" in $define|true|[yY]*) echo " " case "$src" in ''|'.') echo "Cannot create symlinks in the original directory." >&4 exit 1 ;; *) case "$lns:$issymlink" in *"ln"*" -s:"*"test -"?) echo "Creating the symbolic links..." >&4 echo "(First creating the subdirectories...)" >&4 cd .. awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | \ sort -u | while true do read dir test -z "$dir" && break ./UU/mkdirp $dir 2>/dev/null if test -d $dir; then : ok else echo "Failed to create '$dir'. Aborting." >&4 exit 1 fi done echo "(Now creating the symlinks...)" >&4 awk '{print $1}' $src/MANIFEST | while true; do read filename test -z "$filename" && break if test -f $filename; then if $issymlink $filename; then rm -f $filename fi fi if test -f $filename; then echo "$filename already exists, not symlinking." else ln -s $pkgsrc/$filename $filename fi done echo "(Checking current directory...)" >&4 cd UU awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \ (split -l 50 2>/dev/null || split -50) rm -f missing tmppwd=`pwd` for filelist in x??; do (cd ..; ls `cat "$tmppwd/$filelist"` \ >/dev/null 2>>"$tmppwd/missing") done if test -s missing; then echo "Failed duplication of source tree. Aborting." >&4 exit 1 fi ;; *) echo "(I cannot figure out how to do symbolic links, ignoring!)" >&4 ;; esac ;; esac ;; esac : see whether [:lower:] and [:upper:] are supported character classes echo " " case "`echo AbyZ | LC_ALL=C $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in ABYZ) echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 up='[:upper:]' low='[:lower:]' ;; *) # There is a discontinuity in EBCDIC between 'I' and 'J' # (0xc9 and 0xd1), therefore that is a nice testing point. if test "X$up" = X -o "X$low" = X; then case "`echo IJ | LC_ALL=C $tr '[I-J]' '[i-j]' 2>/dev/null`" in ij) up='[A-Z]' low='[a-z]' ;; esac fi if test "X$up" = X -o "X$low" = X; then case "`echo IJ | LC_ALL=C $tr I-J i-j 2>/dev/null`" in ij) up='A-Z' low='a-z' ;; esac fi if test "X$up" = X -o "X$low" = X; then case "`echo IJ | od -x 2>/dev/null`" in *C9D1*|*c9d1*) echo "Hey, this might be EBCDIC." >&4 if test "X$up" = X -o "X$low" = X; then case "`echo IJ | \ LC_ALL=C $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in ij) up='[A-IJ-RS-Z]' low='[a-ij-rs-z]' ;; esac fi if test "X$up" = X -o "X$low" = X; then case "`echo IJ | LC_ALL=C $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in ij) up='A-IJ-RS-Z' low='a-ij-rs-z' ;; esac fi ;; esac fi esac case "`echo IJ | LC_ALL=C $tr \"$up\" \"$low\" 2>/dev/null`" in ij) echo "Using $up and $low to convert case." >&4 ;; *) echo "I don't know how to translate letters from upper to lower case." >&4 echo "Your tr is not acting any way I know of." >&4 exit 1 ;; esac : set up the translation script tr, must be called with ./tr of course cat >tr <&4 exit 1 ;; esac : Determine the name of the machine myuname=`$uname -a 2>/dev/null` $test -z "$myuname" && myuname=`hostname 2>/dev/null` myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` newmyuname="$myuname" has_uname= $test -f "$uname" && has_uname=y : Guessing of the OS name -- half the following guesses are probably wrong... : If you have better tests or hints, please send them to the metaconfig : authors and to Raphael_Manfredi@pobox.com $test -f /irix && osname=irix $test -f /xenix && osname=sco_xenix $test -f /dynix && osname=dynix $test -f /dnix && osname=dnix $test -f /lynx.os && osname=lynxos $test -f /unicos && osname=unicos && osvers=`$uname -r` $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r` $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` $test -f /bin/mips && /bin/mips && osname=mips $test -d /NextApps && set X `hostinfo | $grep 'NeXT Mach.*:' | \ $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 $test -d /usr/apollo/bin && osname=apollo $test -f /etc/saf/_sactab && osname=svr4 $test -d /usr/include/minix && osname=minix $test -f /system/gnu_library/bin/ar.pm && osname=vos if $test -d /MachTen -o -d /MachTen_Folder; then osname=machten if $test -x /sbin/version; then osvers=`/sbin/version | $awk '{print $2}' | $sed -e 's/[A-Za-z]$//'` elif $test -x /usr/etc/version; then osvers=`/usr/etc/version | $awk '{print $2}' | $sed -e 's/[A-Za-z]$//'` else osvers="$2.$3" fi fi $test -f /sys/posix.dll && $test -f /usr/bin/what && set X `/usr/bin/what /sys/posix.dll` && $test "$3" = UWIN && osname=uwin && osvers="$5" if $test "X$has_uname" != X; then set X $myuname shift case "$5" in fps*) osname=fps ;; mips*) case "$4" in umips) osname=umips ;; *) osname=mips ;; esac;; [23]100) osname=mips ;; next*) osname=next ;; i386*) tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'` if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then osname='sco' osvers=$tmp elif $test -f /etc/kconfig; then osname=isc if $test "$lns" = "$ln -s"; then osvers=4 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then osvers=3 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 then osvers=2 fi fi tmp='' ;; pc*) if $test -n "$DJGPP"; then osname=dos osvers=djgpp fi ;; esac case "$1" in aix) osname=aix tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` case "$tmp" in 'not found') osvers="$4"."$3" ;; '<3240'|'<>3240') osvers=3.2.0 ;; '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; '=3250'|'>3250') osvers=3.2.5 ;; *) osvers=$tmp;; esac ;; bsd386) osname=bsd386 osvers=`$uname -r` ;; cygwin*) osname=cygwin osvers=`echo "$3" | sed -e 's/\(.*\)(.*/\1/'` ;; mingw*) osname=mingw osvers=`echo "$3" | sed -e 's/\(.*\)(.*/\1/'` ;; *dc.osx) osname=dcosx osvers="$3" ;; dnix) osname=dnix osvers="$3" ;; domainos) osname=apollo osvers="$3" ;; dgux) osname=dgux osvers="$3" ;; dynixptx*) osname=dynixptx osvers=`echo "$4"|sed 's/^v//'` ;; freebsd) osname=freebsd osvers="$3" ;; genix) osname=genix ;; hp*) osname=hpux osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'` ;; irix*) osname=irix case "$3" in 4*) osvers=4 ;; 5*) osvers=5 ;; *) osvers="$3" ;; esac ;; linux) osname=linux case "$3" in *) osvers="$3" ;; esac ;; MiNT) osname=mint ;; netbsd*) osname=netbsd osvers="$3" ;; news-os) osvers="$3" case "$3" in 4*) osname=newsos4 ;; *) osname=newsos ;; esac ;; next*) osname=next ;; nonstop-ux) osname=nonstopux ;; openbsd) osname=openbsd osvers="$3" ;; POSIX-BC | posix-bc ) osname=posix-bc osvers="$3" ;; powerux | power_ux | powermax_os | powermaxos | \ powerunix | power_unix) osname=powerux osvers="$3" ;; qnx) osname=qnx osvers="$4" ;; solaris) osname=solaris case "$3" in 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; *) osvers="$3" ;; esac ;; sunos) osname=sunos case "$3" in 5*) osname=solaris osvers=`echo $3 | $sed 's/^5/2/g'` ;; *) osvers="$3" ;; esac ;; titanos) osname=titanos case "$3" in 1*) osvers=1 ;; 2*) osvers=2 ;; 3*) osvers=3 ;; 4*) osvers=4 ;; *) osvers="$3" ;; esac ;; ultrix) osname=ultrix osvers="$3" ;; osf1|mls+) case "$5" in alpha) osname=dec_osf osvers=`sizer -v | awk '{print $3}' | \ ./tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'` case "$osvers" in [1-9].[0-9]*) ;; *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;; esac ;; hp*) osname=hp_osf1 ;; mips) osname=mips_osf1 ;; esac ;; unixware) osname=svr5 osvers="$4" ;; uts) osname=uts osvers="$3" ;; vos) osvers="$3" ;; $2) case "$osname" in *isc*) ;; *freebsd*) ;; svr*) : svr4.x or possibly later case "svr$3" in ${osname}*) osname=svr$3 osvers=$4 ;; esac case "$osname" in svr4.0) : Check for ESIX if $test -f /stand/boot ; then eval `$grep '^INITPROG=[a-z/0-9]*$' /stand/boot` if $test -n "$INITPROG" -a -f "$INITPROG"; then isesix=`strings -a $INITPROG | \ $grep 'ESIX SYSTEM V/386 Release 4.0'` if $test -n "$isesix"; then osname=esix4 fi fi fi ;; esac ;; *) if $test -f /etc/systemid; then osname=sco set `echo $3 | $sed 's/\./ /g'` $4 if $test -f $src/hints/sco_$1_$2_$3.sh; then osvers=$1.$2.$3 elif $test -f $src/hints/sco_$1_$2.sh; then osvers=$1.$2 elif $test -f $src/hints/sco_$1.sh; then osvers=$1 fi else case "$osname" in '') : Still unknown. Probably a generic Sys V. osname="sysv" osvers="$3" ;; esac fi ;; esac ;; *) case "$osname" in '') : Still unknown. Probably a generic BSD. osname="$1" osvers="$3" ;; esac ;; esac else if $test -f /vmunix -a -f $src/hints/news_os.sh; then (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1 if $contains news-os UU/kernel.what >/dev/null 2>&1; then osname=news_os fi $rm -f UU/kernel.what elif $test -d c:/.; then set X $myuname osname=os2 osvers="$5" fi fi : Try to determine whether config.sh was made on this system case "$config_sh" in '') 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 saved_osname="$osname" saved_osvers="$osvers" saved_libswanted="$libswanted" tmp_n="$n" tmp_c="$c" tmp_sh="$sh" : Get old answers from config file if it was generated on the same system hint=default 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." mv ../config.sh ../config.sh.old myuname="$newmyuname" ;; *) echo "Fetching default answers from your old config.sh file..." >&4 . ../config.sh cp ../config.sh . hint=previous case "$dflt" in n) echo " " rp="Do you want further invocations to use these defaults?" . ./myread case "$ans" in y*|Y*) myuname="$newmyuname";; esac ;; esac ;; esac fi ;; *) echo " " echo "Fetching default answers from $config_sh..." >&4 cd .. cp $config_sh config.sh 2>/dev/null chmod +w config.sh . ./config.sh cd UU cp ../config.sh . hint=previous ;; esac case "$sh" in '') sh="$tmp_sh" ;; esac $test "$override" && . ./optdef.sh : Restore computed paths for file in $loclist $trylist; do eval $file="\$_$file" done osname="$saved_osname" osvers="$saved_osvers" n="$tmp_n" c="$tmp_c" case "$libswanted" in "$saved_libswanted") ;; *) libs='';; esac libswanted="$saved_libswanted" . ./checkcc case "$targetarch" in '') ;; *) hostarch=$osname osname=`echo $targetarch|sed 's,^[^-]*-,,'` osvers='' ;; esac : Process their -A options . ./posthint.sh : Ask them to confirm the OS name cat << EOM Configure uses the operating system name and version to set some defaults. The default value is probably right if the name rings a bell. Otherwise, since spelling matters for me, either accept the default or answer "none" to leave it blank. EOM case "$osname" in ''|' ') case "$hintfile" in ''|' '|none) dflt=none ;; *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; esac ;; *) dflt="$osname" ;; esac rp="Operating system name?" . ./myread case "$ans" in none) osname='' ;; *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; esac echo " " case "$osvers" in ''|' ') case "$hintfile" in ''|' '|none) dflt=none ;; *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` case "$dflt" in ''|' ') dflt=none ;; esac ;; esac ;; *) dflt="$osvers" ;; esac rp="Operating system version?" . ./myread case "$ans" in none) osvers='' ;; *) osvers="$ans" ;; esac : who configured the system cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1` case "$cf_by" in "") 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 ;; esac : 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. 3) The system name will be determined at run time, if at all possible. 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 <&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 <getfile $startsh EOS cat <<'EOSC' >>getfile tilde='' fullpath='' already='' skip='' none_ok='' exp_file='' nopath_ok='' orig_rp="$rp" orig_dflt="$dflt" case "$gfpth" in '') gfpth='.' ;; esac case "$fn" in *\(*) : getfile will accept an answer from the comma-separated list : enclosed in parentheses even if it does not meet other criteria. expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >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" ;; [a-zA-Z]:/*) value="$ansexp" ;; [a-zA-Z]:\\*) 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) for fp in $gfpth; do if test "X$fp" = X.; then pf="$ansexp" else pf="$fp/$ansexp" fi if test -f "$pf"; then type='' elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1 then echo "($value is not a plain file, but that's ok.)" type='' fi if test X"$type" = X; then value="$pf" break fi done ;; Directory) for fp in $gfpth; do if test "X$fp" = X.; then dir="$ans" direxp="$ansexp" else dir="$fp/$ansexp" direxp="$fp/$ansexp" fi if test -d "$direxp"; then type='' value="$dir" break fi done ;; 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 test "X$gfpthkeep" != Xy && gfpth="" 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 <&4 else echo "AFS does not seem to be running..." >&4 fi : determine where public executables go echo " " set dflt bin bin eval $prefixit fn=d~ rp='Pathname where the public executables will reside?' . ./getfile if $test "X$ansexp" != "X$binexp"; then installbin='' fi bin="$ans" binexp="$ansexp" if $afs; then $cat <&4 else echo "Could not find manual pages in source form." >&4 fi : 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 <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 echo exit 1 >gnu echo exit 1 >linux echo exit 1 >dos echo exit 1 >windows d_bsd="$undef" d_linux="$undef" d_dos="$undef" d_os2="$undef" d_windows="$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 elif $rm --version 2>/dev/null >foo; $contains "Free Software Foundation" foo >/dev/null then xxx=`uname` echo exit 0 >gnu echo "Looks kind of like a GNU/$xxx system, but we'll see..." if $test X$xxx = XLinux; then d_linux="$define" echo exit 0 >linux fi 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 if test -d c:/.; then case "X${MACHTYPE:-nonesuchmach}" in *cygwin) echo " "; echo "Hah!... you're running under Cygwin!";; *msys) echo " "; echo "Hah!... you're running under MinGW!";; esac case "X${MACHTYPE:-nonesuchmach}" in *cygwin|*msys) echo exit 0 >windows d_windows="$define" ;; esac fi case "$p_" in :) ;; *) $cat <<'EOI' I have the feeling something is not exactly right, however...don't tell me... EOI if test -n "$DJGPP"; then echo exit 0 >dos d_dos="$define" else $cat <<'EOI' lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! EOI echo exit 0 >os2 d_os2="$define" fi ;; 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 dos os2 gnu linux windows $eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows $rm -f foo : Check whether they have gcc in any guise. echo " " echo "Checking for GNU cc in disguise and/or its version number..." >&4 $cat >try.c < try 2>&1 then gccversion=`$grep gcc_version_major try | sed 's/^.*gcc_version_major[\t ]*//'` case "$gccversion" in '') echo "You are not using GNU cc." ;; *) echo "You are using GNU cc $gccversion." ccname=gcc ;; esac else gccversion='' fi $rm -f try try.* case "$gccversion" in 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; esac case "$gccversion" in '') gccosandvers='' ;; *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'` gccosandvers=`$cc -v 2>&1 | \ $grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"` gccshortvers='' case "$gccosandvers" in $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr $osname$osvers) ;; # looking good $osname*) cat <&4 *** WHOA THERE!!! *** Your gcc has not been compiled for the exact release of your operating system ($gccosandvers versus $osname$osvers). In general it is a good idea to keep gcc synchronized with the operating system because otherwise serious problems may ensue when trying to compile software, like Perl. I'm trying to be optimistic here, though, and will continue. If later during the configuration and build icky compilation problems appear (headerfile conflicts being the most common manifestation), I suggest reinstalling the gcc to match your operating system release. EOM ;; *) gccosandvers='' ;; # failed to parse, better be silent esac ;; esac case "$ccname" in '') ccname="$cc" ;; esac : gcc 3.1 complains about adding -Idirectories that it already knows about, : so we will take those off from locincpth. case "$gccversion" in 3*) echo "main(){}">try.c for incdir in `$cc -v -c try.c 2>&1 | \ sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do locincpth=`echo $locincpth | sed s!$incdir!!` done $rm -f try try.* esac : What should the include directory be ? echo " " $echo $n "Hmm... $c" incpath='' mips_type='' if $test -f /bin/mips && /bin/mips; then echo "Looks like a MIPS system..." $cat >usr.c <<'EOCP' #ifdef SYSTYPE_BSD43 /bsd43 #endif EOCP if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then dflt='/bsd43/usr/include' incpath='/bsd43' mips_type='BSD 4.3' else mips_type='System V' fi $rm -f usr.c usr.out echo "and you're compiling with the $mips_type compiler and libraries." echo "exit 0" >mips else echo "Doesn't look like a MIPS system." echo "exit 1" >mips fi chmod +x mips $eunicefix mips : What should the include directory be ? echo " " dflt='/usr/include' case "$usrinc" in '') dflt="$incpath/usr/include";; *) dflt="$usrinc";; esac fn=d/ rp='Where are the include files you want to use?' . ./getfile usrinc="$ans" : 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 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*" : 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 .. if $test ! -f cppstdin; then echo "$startsh" >cppstdin if $test "X$osname" = "Xaix" -a "X$gccversion" = X; then echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; \ test -s .$$.u && \ awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; \ rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >> cppstdin else echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >>cppstdin fi; else echo "Keeping your $hint cppstdin wrapper." fi chmod 755 cppstdin $eunicefix cppstdin wrapper=`pwd`/cppstdin ok='false' cd UU if $test "X$cppstdin" != "X" && \ $cppstdin $cppminus 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.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.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.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.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.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.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.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.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.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.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"|'cppstdin') ;; *) $rm -f $wrapper;; esac $rm -f testcpp.c testcpp.out : Set private lib path case "$plibpth" in '') if ./mips; then plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" fi;; esac case "$libpth" in ' ') dlist='';; '') dlist="$loclibpth $plibpth $glibpth";; *) dlist="$libpth";; esac : Now check and see which directories actually exist, avoiding duplicates libpth='' for xxx in $dlist do if $test -d $xxx; then case " $libpth " in *" $xxx "*) ;; *) libpth="$libpth $xxx";; esac fi done $cat <<'EOM' Some systems have incompatible or broken versions of libraries. Among the directories listed in the question below, please remove any you know not to be holding relevant libraries, and add any that are needed. Say "none" for none. EOM case "$libpth" in '') dflt='none';; *) set X $libpth shift dflt=${1+"$@"} ;; esac rp="Directories to use for library searches?" . ./myread case "$ans" in none) libpth=' ';; *) libpth="$ans";; esac : determine optimize, if desired, or use for debug flag also case "$optimize" in ' '|$undef) dflt='none';; '') case "$gccversion" in '') dflt='-O';; *) dflt='-O2 -g';; esac ;; *) dflt="$optimize";; esac case "$gccversion" in '') $cat </dev/null 2>&1 then dflt="$dflt -posix" fi ;; esac case "$gccversion" in 1*|2*) dflt="$dflt -Wall";; *) dflt="$dflt -W -Wall -Wformat=2 -Wshadow";; esac ;; esac case "$mips_type" in *BSD*|'') inclwanted="$locincpth $usrinc";; *) inclwanted="$locincpth $inclwanted $usrinc/bsd";; esac for thisincl in $inclwanted; do if $test -d $thisincl; then if $test x$thisincl != x$usrinc; then case "$dflt" in *$thisincl*);; *) dflt="$dflt -I$thisincl";; esac fi fi done inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then xxx=true; elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then xxx=true; else xxx=false; fi; if $xxx; then case "$dflt" in *$2*);; *) dflt="$dflt -D$2";; esac; fi' if ./osf1; then set signal.h __LANGUAGE_C__; eval $inctest else set signal.h LANGUAGE_C; eval $inctest fi case "$hint" in default|recommended) dflt="$dflt $ccflags" ;; *) dflt="$ccflags";; esac case "$dflt" in ''|' ') dflt=none;; esac $cat <&4 set X $cppflags shift cppflags='' $cat >cpp.c <<'EOM' #define BLURFL foo BLURFL xx LFRULB EOM previous='' for flag in $* do case "$flag" in -*) ftry="$flag";; *) ftry="$previous $flag";; esac if $cppstdin -DLFRULB=bar $ftry $cppminus cpp1.out 2>/dev/null && \ $cpprun -DLFRULB=bar $ftry $cpplast cpp2.out 2>/dev/null && \ $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 then cppflags="$cppflags $ftry" previous='' else previous="$flag" fi done set X $cppflags shift cppflags=${1+"$@"} case "$cppflags" in *-*) echo "They appear to be: $cppflags";; esac $rm -f cpp.c cpp?.out ;; esac : flags used in final linking phase case "$ldflags" in '') if ./venix; then dflt='-i -z' else dflt='' fi case "$ccflags" in *-posix*) dflt="$dflt -posix" ;; esac ;; *) dflt="$ldflags";; esac : Try to guess additional flags to pick up local libraries. for thislibdir in $libpth; do case " $loclibpth " in *" $thislibdir "*) case "$dflt " in *"-L$thislibdir "*) ;; *) dflt="$dflt -L$thislibdir" ;; esac ;; esac done case "$dflt" in '') dflt='none' ;; *) set X $dflt; shift; dflt="$@";; esac $cat <&4 set X $cc $optimize $pthread $ccflags $ldflags -o try try.c shift $cat >try.msg < try.c <<'EOF' int main() { return 0; } EOF dflt=y if sh -c "$cc $optimize $ccflags $ldflags -o try try.c" >>try.msg 2>&1; then if sh -c './try' >>try.msg 2>&1; then dflt=n else echo "The program compiled OK, but exited with status $?." >>try.msg rp="You have a problem. Shall I abort Configure" dflt=y fi else echo "I can't compile the test program." >>try.msg rp="You have a BIG problem. Shall I abort Configure" dflt=y fi case "$dflt" in y) $cat try.msg >&4 case "$knowitall" in '') echo "(The supplied flags might be incorrect with this C compiler.)" ;; *) dflt=n;; esac echo " " . ./myread case "$ans" in n*|N*) ;; *) echo "Ok. Stopping Configure." >&4 exit 1 ;; esac ;; n) echo "OK, that should do.";; esac $rm_try : Initialize h_fcntl h_fcntl=false : Initialize h_sysfile h_sysfile=false : set up the script used to warn in case of inconsistency cat <whoa $startsh EOS cat <<'EOSC' >>whoa dflt=y echo " " echo "*** WHOA THERE!!! ***" >&4 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 rp=" Keep the $hint value?" . ./myread case "$ans" in y) td=$was; tu=$was;; esac EOSC : function used to set '$1' to '$val' setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; case "$val$was" in $define$undef) . ./whoa; eval "$var=\$td";; $undef$define) . ./whoa; eval "$var=\$tu";; *) eval "$var=$val";; esac' : see whether the try.c file compiles and links trylink=' var=$1; shift; val=$undef; file=trylink.log; nparams=$#; case "$cyn" in "") msg="";; *" "*) msg="$cyn"; yes=yes; no=no;; *) case "$var" in d_*) msg="for $cyn()"; yes=found; no=missing;; i_*) msg="for <$cyn>"; yes=found; no=missing;; *) msg="$cyn"; yes=yes; no=no;; esac ;; esac; case "$cyn" in "") echo "--- $var ---" >> "$file";; *) echo " "; $echo $n "Checking $msg...$c" >&4; echo "--- $var --- ($msg)" >>"$file" ;; esac; $cat try.c >> "$file"; while :; do $rm -f try$_exe; if $cc $ccflags -o try try.c $ldflags $1 >> "$file" 2>&1; then case "$nparams" in 0) ;; *) echo "==> OK with \"$1\"" >> "$file";; esac; val=$define; break; fi; if $test $# -lt 1; then break; fi; echo "==> FAILED with \"$1\"" >> "$file"; shift; done; $rm -rf try try.*; echo "==> $var=$val" >> "$file"; case "$cyn" in "") ;; *) case "$val" in "$define") echo " $yes." >&4;; *) echo " $no." >&4;; esac ;; esac; set $var; eval $setvar; cyn="" ' : determine filename position in cpp output echo " " echo "Computing filename position in cpp output for #include directives..." >&4 echo '#include ' > foo.c case "$osname" in vos) testaccess=-e cppfilter="tr '\\\\>' '/' |" ;; *) testaccess=-r cppfilter='' ;; esac $cat >fieldn </dev/null | \ $grep '^[ ]*#.*stdio\.h' | \ while read cline; do pos=1 set \$cline while $test \$# -gt 0; do if $test $testaccess \`echo \$1 | $tr -d '"'\`; then echo "\$pos" exit 0 fi shift pos=\`expr \$pos + 1\` done done EOF chmod +x fieldn fieldn=`./fieldn` $rm -f foo.c fieldn case $fieldn in '') pos='???';; 1) pos=first;; 2) pos=second;; 3) pos=third;; *) pos="${fieldn}th";; esac echo "Your cpp writes the filename in the $pos field of the line." : locate header file $cat >findhdr <" > foo\$\$.c $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ $cppfilter $grep "^[ ]*#.*\$wanted" | \ while read cline; do name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` case "\$name" in *[/\\\\]\$wanted) echo "\$name"; exit 1;; *[\\\\/]\$wanted) echo "\$name"; exit 1;; *) exit 2;; esac done status=\$? $rm -f foo\$\$.c if test \$status -eq 1; then exit 0 fi exit 1 EOF chmod +x findhdr $eunicefix findhdr : define an alternate in-header-list? function inhdr='echo " "; td=$define; tu=$undef; yyy=$@; cont=true; xxf="echo \"<\$1> found.\" >&4"; case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; esac; case $# in 4) instead=instead;; *) instead="at last";; esac; while $test "$cont"; do xxx=`./findhdr $1` var=$2; eval "was=\$$2"; if $test "$xxx" && $test -r "$xxx"; then eval $xxf; eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td"; cont=""; else eval $xxnf; eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi; set $yyy; shift; shift; yyy=$@; case $# in 0) cont="";; 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; xxnf="echo \"and I did not find <\$1> either.\" >&4";; *) xxf="echo \"but I found <\$1\> instead.\" >&4"; xxnf="echo \"there is no <\$1>, ...\" >&4";; esac; done; while $test "$yyy"; do set $yyy; var=$2; eval "was=\$$2"; eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; set $yyy; shift; shift; yyy=$@; done' : see if this is a unistd.h system set unistd.h i_unistd eval $inhdr : access call always available on UNIX $cat >try.c < #endif int main(void) { static int ret; ret |= access("path", 1); return ret ? 0 : 1; } EOC cyn=access set d_access eval $trylink : locate the flags for 'access()' case "$d_access" in "$define") echo " " $cat >access.c <<'EOCP' #include #ifdef I_FCNTL #include #endif #ifdef I_SYS_FILE #include #endif #ifdef I_UNISTD #include #endif int main(void) { static int mode; mode |= R_OK; mode |= W_OK; mode |= X_OK; mode |= F_OK; return mode ? 0 : 1; } EOCP : check sys/file.h first, no particular reason here if $test `./findhdr sys/file.h` && \ $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then h_sysfile=true; echo " defines the *_OK access constants." >&4 elif $test `./findhdr fcntl.h` && \ $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then h_fcntl=true; echo " defines the *_OK access constants." >&4 elif $test `./findhdr unistd.h` && \ $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then echo " defines the *_OK access constants." >&4 else echo "I can't find the four *_OK access constants--I'll use mine." >&4 fi ;; esac $rm -f access* : see if bcopy exists $cat >try.c < static void init_data(char *a, unsigned len) { unsigned i; for (i = 0; i < len; i++) a[i] = i * 2 + 1; } static void recopy_data(char *src, char *dst, unsigned len) { bcopy(&src[3], &dst[0], len - 3); } int main(void) { static char src[20], dst[20]; init_data(src, sizeof src); recopy_data(src, dst, sizeof src); return dst[0] + dst[1]; } EOC cyn=bcopy set d_bcopy eval $trylink : see if setpgrp exists $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static pid_t ret, pid, pgrp; ret |= setpgrp(pid, pgrp); return ret ? 0 : 1; } EOC cyn="whether you have the BSD flavour of setpgrp()" set d_bsdsetpgrp eval $trylink case "$d_bsdsetpgrp" in $define) val="$define" set d_setpgrp eval $setvar ;; *) $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static pid_t ret; ret |= setpgrp(); if (ret) return 1; return 0; } EOC cyn="whether you have the USG flavour of setpgrp() then" set d_setpgrp eval $trylink ;; esac : see if dup2 exists $cat >try.c < #endif int main(void) { static int fd1, fd2, ret; ret |= dup2(fd1, fd2); return ret ? 0 : 1; } EOC cyn=dup2 set d_dup2 eval $trylink : see if this is an fcntl system $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif #include int main(void) { static int fd, ret; ret |= fcntl(fd, F_DUPFD, 1); ret |= fcntl(fd, F_GETFD); ret |= fcntl(fd, F_GETFL); return ret ? 0 : 1; } EOC cyn=fcntl set d_fcntl eval $trylink : see if we can have long filenames echo " " tmpdir="${TMPDIR:-/tmp}" rmlist="$rmlist $tmpdir/cf$$" $test -d "$tmpdir/cf$$" || mkdir "$tmpdir/cf$$" first=123456789abcdef second="$tmpdir/cf$$/$first" $rm -f $first $second if (echo hi >$first) 2>/dev/null; then if $test -f 123456789abcde; then echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 val="$undef" else if (echo hi >$second) 2>/dev/null; then if $test -f "$tmpdir/cf$$/123456789abcde"; then $cat <<'EOM' That's peculiar... You can have filenames longer than 14 characters, but only on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems I shall consider your system cannot support long filenames at all. EOM val="$undef" else echo 'You can have filenames longer than 14 characters.' >&4 val="$define" fi else $cat <<'EOM' How confusing! Some of your filesystems are sane enough to allow filenames longer than 14 characters but some others like /tmp can't even think about them. So, for now on, I shall assume your kernel does not allow them at all. EOM val="$undef" fi fi else $cat <<'EOM' You can't have filenames longer than 14 chars. You can't even think about them! EOM val="$undef" fi set d_flexfnam eval $setvar $rm -rf "$tmpdir/cf$$" 123456789abcde* : see if we have to deal with yellow pages, now NIS. if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/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=':' $test -f /etc/hosts && hostcat='cat /etc/hosts';; esac case "$groupcat" in '') groupcat=':' $test -f /etc/group && groupcat='cat /etc/group';; esac case "$passcat" in '') passcat=':' $test -f /etc/passwd && 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 case "$myhostname" in '') myhostname=noname ;; esac : 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 '') { test "X$hostcat" = "Xypcat hosts" && ypmatch "$myhostname" hosts 2>/dev/null |\ $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \ $test -s hosts } || { $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.) if $test -f /etc/hosts; then echo "(You do not have fully-qualified names in /etc/hosts)" else echo "(I cannot locate a hosts database anywhere)" fi ;; 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$osname" in .os390) file="//'SYS1.TCPPARMS(TCPDATA)'" echo "(Attempting domain name extraction from $file)" dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "$file" 2>/dev/null` ;; esac case "$dflt" in .) echo "(Lost all hope -- silly guess then)" dflt='.nonet' ;; 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 : compute shared library extension case "$so" in '') if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then dflt='sl' else dflt='so' fi ;; *) dflt="$so";; esac $cat <&4 case "$libs" in ' '|'') dflt='';; *) dflt="$libs";; esac case "$libswanted" in '') libswanted='c_s';; esac case "$usesocks" in "$define") libswanted="$libswanted socks5 socks5_sh" ;; esac echo "extern void abort(void); int main(void) { abort(); return 0; }" > lt.c libsfound='' libsfiles='' libsdirs='' libspath='' for thisdir in $libpth $xlibpth; do test -d $thisdir && libspath="$libspath $thisdir" done for thislib in $libswanted; do for thisdir in $libspath; do xxx='' if $test ! -f "$xxx" ; then xxx=`ls $thisdir/lib$thislib.$so.[0-9]* 2>/dev/null | $sed -n '1p'` $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=shared fi if test ! -f "$xxx"; then xxx=$thisdir/lib$thislib.$so $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=shared fi if test ! -f "$xxx"; then xxx=$thisdir/lib$thislib$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static fi if test ! -f "$xxx"; then xxx=$thisdir/$thislib$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static fi if test ! -f "$xxx"; then xxx=$thisdir/lib${thislib}_s$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static $test -f "$xxx" && thislib=${thislib}_s fi if test ! -f "$xxx"; then xxx=$thisdir/Slib$thislib$_a $test -f "$xxx" && eval $libscheck $test -f "$xxx" && libstyle=static fi if $test -f "$xxx"; then if $cc -o lt $ccflags $ldflags lt.c -l$thislib >/dev/null 2>&1; then linkmsg="" else linkmsg=" but I can't link against it" fi case "$libstyle" in shared) echo "Found -l$thislib (shared)$linkmsg." ;; static) echo "Found -l$thislib$linkmsg." ;; *) echo "Found -l$thislib ($libstyle)$linkmsg." ;; esac case " $dflt " in *"-l$thislib "*) ;; *) case "$linkmsg" in '') dflt="$dflt -l$thislib" libsfound="$libsfound $xxx" yyy=`basename $xxx` libsfiles="$libsfiles $yyy" yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"` case " $libsdirs " in *" $yyy "*) ;; *) libsdirs="$libsdirs $yyy" ;; esac ;; esac ;; esac break fi done if $test ! -f "$xxx"; then if $cc -o lt $ccflags $ldflags lt.c -l$thislib >/dev/null 2>&1 then echo "Found -l$thislib (via $cc)." case " $dflt " in *"-l$thislib "*) ;; *) dflt="$dflt -l$thislib";; esac else echo "No -l$thislib." fi fi done set X $dflt shift dflt="$*" case "$libs" in '') dflt="$dflt";; *) dflt="$libs";; esac case "$dflt" in ' '|'') dflt='none';; esac $rm -f lt.c lt $cat <&4 cat >try.c <<'EOCP' /* Find out version of GNU C library. __GLIBC__ and __GLIBC_MINOR__ alone are insufficient to distinguish different versions, such as 2.0.6 and 2.0.7. The function gnu_get_libc_version() appeared in libc version 2.1.0. A. Dougherty, June 3, 2002. */ #include int main(void) { #ifdef __GLIBC__ # ifdef __GLIBC_MINOR__ # if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 # include printf("%s\n", gnu_get_libc_version()); # else printf("%d.%d\n", __GLIBC__, __GLIBC_MINOR__); # endif # else printf("%d\n", __GLIBC__); # endif return 0; #else return 1; #endif } EOCP set try if eval $compile_ok && $run ./try > glibc.ver; then val="$define" gnulibc_version=`$cat glibc.ver` echo "You are using the GNU C Library version $gnulibc_version" else val="$undef" gnulibc_version='' echo "You are not using the GNU C Library" fi $rm_try glibc.ver set d_gnulibc eval $setvar : see if nm is to be used to determine whether a symbol is defined or not case "$usenm" in '') dflt='' case "$d_gnulibc" in "$define") echo " " echo "$nm probably won't work on the GNU C Library." >&4 dflt=n ;; esac case "$dflt" in '') if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then echo " " echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4 echo "'nm' won't be sufficient on this system." >&4 dflt=n fi ;; esac case "$dflt" in '') if ./gnu; then echo " " echo "Hmm... A GNU system without a GNU C Library? Weird..." >&4 dflt=n else dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null` if $test $dflt -gt 20; then dflt=y else dflt=n fi fi ;; esac ;; *) case "$usenm" in true|$define) dflt=y;; *) dflt=n;; esac ;; esac $cat < /dev/null 2>&1; then nm_so_opt='--dynamic' fi ;; esac ;; esac : Figure out where the libc is located case "$runnm" in true) : get list of predefined functions in a handy place echo " " case "$libc" in '') libc=unknown case "$libs" in *-lc_s*) libc=`./loc libc_s$_a $libc $libpth` esac ;; esac case "$libs" in '') ;; *) for thislib in $libs; do case "$thislib" in -lc|-lc_s) : Handle C library specially below. ;; -l*) thislib=`echo $thislib | $sed -e 's/^-l//'` if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then : elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then : elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then : elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then : elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then : elif try=`./loc $thislib X $libpth`; $test -f "$try"; then : elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then : else try='' fi libnames="$libnames $try" ;; *) libnames="$libnames $thislib" ;; esac done ;; esac xxx=normal case "$libc" in unknown) set /lib/libc.$so for xxx in $libpth; do $test -r $1 || set $xxx/libc.$so : The messy sed command sorts on library version numbers. $test -r $1 || \ set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \ tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e ' h s/[0-9][0-9]*/0000&/g s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g G s/\n/ /' | \ $sort | $sed -e 's/^.* //'` eval set \$$# done $test -r $1 || set /usr/ccs/lib/libc.$so $test -r $1 || set /lib/libsys_s$_a ;; *) set blurfl ;; esac if $test -r "$1"; then echo "Your (shared) C library seems to be in $1." libc="$1" elif $test -r /lib/libc && $test -r /lib/clib; then echo "Your C library seems to be in both /lib/clib and /lib/libc." xxx=apollo libc='/lib/clib /lib/libc' if $test -r /lib/syslib; then echo "(Your math library is in /lib/syslib.)" libc="$libc /lib/syslib" fi elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then echo "Your C library seems to be in $libc, as you said before." elif $test -r $incpath/usr/lib/libc$_a; then libc=$incpath/usr/lib/libc$_a; echo "Your C library seems to be in $libc. That's fine." elif $test -r /lib/libc$_a; then libc=/lib/libc$_a; echo "Your C library seems to be in $libc. You're normal." else if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then : elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then libnames="$libnames "`./loc clib blurfl/dyick $libpth` elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then : elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then : elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then : else tans=`./loc Llibc$_a blurfl/dyick $xlibpth` fi if $test -r "$tans"; then echo "Your C library seems to be in $tans, of all places." libc=$tans else libc='blurfl' fi fi if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then dflt="$libc" cat < libpath cat >&4 < libnames set X `cat libnames` shift xxx=files case $# in 1) xxx=file; esac echo "Extracting names from the following $xxx for later perusal:" >&4 echo " " $sed 's/^/ /' libnames >&4 echo " " $echo $n "This may take a while...$c" >&4 for file in $*; do case $file in *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;; *) $nm $nm_opt $file 2>/dev/null;; esac done >libc.tmp $echo $n ".$c" $grep fprintf libc.tmp > libc.ptf xscan='eval "libc.list"; $echo $n ".$c" >&4' xrun='eval "libc.list"; echo "done." >&4' xxx='[ADTSIW]' if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun elif com="sed -n -e 's/^__.*//' -e 's/[ ]*D[ ]*[0-9]*.*//p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun else $nm -p $* 2>/dev/null >libc.tmp $grep fprintf libc.tmp > libc.ptf if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1 then nm_opt='-p' eval $xrun else echo " " echo "$nm didn't seem to work right. Trying $ar instead..." >&4 com='' if $ar t $libc > libc.tmp && \ $contains '^fprintf$' libc.tmp >/dev/null 2>&1 then for thisname in $libnames $libc; do $ar t $thisname >>libc.tmp done $sed -e "s/\\$_o\$//" < libc.tmp > libc.list echo "Ok." >&4 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then for thisname in $libnames $libc; do $ar tv $thisname >>libc.tmp emximp -o tmp.imp $thisname \ 2>/dev/null && \ $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \ < tmp.imp >>libc.tmp $rm -f tmp.imp done $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list echo "Ok." >&4 else echo "$ar didn't seem to work right." >&4 echo "Maybe this is a Cray...trying bld instead..." >&4 if bld t $libc | \ $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list && $test -s libc.list then for thisname in $libnames; do bld t $libnames | \ $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list $ar t $thisname >>libc.tmp done echo "Ok." >&4 else echo "That didn't work either." >&4 echo "No problem, I'll be compiling test programs then..." >&4 runnm=false fi fi fi fi nm_extract="$com" if $test -f /lib/syscalls.exp; then echo " " echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 $sed -n 's/^\([^ ]*\)[ ]*syscall[0-9]*[ ]*$/\1/p' \ /lib/syscalls.exp >>libc.list fi ;; esac $rm -f libnames libpath : is a C symbol defined? csym='tlook=$1; case "$3" in -v) tf=libc.tmp; tc=""; tdc="";; -a) tf=libc.tmp; tc="[0]"; tdc="[]";; *) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";; esac; file=csym.log; tx=yes; case "$reuseval-$4" in true-) ;; true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; esac; case "$tx" in yes) case "$runnm" in true) if $contains $tlook $tf >/dev/null 2>&1; then tval=true; else tval=false; fi;; *) echo "--- $1$tdc ---" >> "$file"; echo "extern char $1$tdc; int main(void) { return (unsigned long) &$1$tc > 2; }" > t.c; $cat t.c >> "$file"; if $cc $ccflags $ldflags -o t t.c $libs >>"$file" 2>&1; then tval=true; else tval=false; fi; $rm -f t t.c;; esac;; *) case "$tval" in $define) tval=true;; *) tval=false;; esac;; esac; echo "==> HAS $1$tdc is $tval ($4)" >>"$file"; eval "$2=$tval"' : see how we will look up host name echo " " if false; then : dummy stub to allow use of elif elif set gethostname val -f d_gethname; eval $csym; $val; then echo 'gethostname() found.' >&4 d_gethname="$define" call=gethostname elif set uname val -f d_uname; eval $csym; $val; then if ./xenix; then $cat <<'EOM' uname() was found, but you're running xenix, and older versions of xenix have a broken uname(). If you don't really know whether your xenix is old enough to have a broken system call, use the default answer. EOM dflt=y case "$d_uname" in "$define") dflt=n;; esac rp='Is your uname() broken?' . ./myread case "$ans" in n*) d_uname="$define"; call=uname;; esac else echo 'uname() found.' >&4 d_uname="$define" call=uname fi fi case "$d_gethname" in '') d_gethname="$undef";; esac case "$d_uname" in '') d_uname="$undef";; esac case "$d_uname$d_gethname" in *define*) dflt=n cat <&4;; esac;; esac case "$d_phostname" in '') d_phostname="$undef";; esac : see if getopt exists $cat >try.c < #endif extern char *optarg; extern int optind, opterr, optopt; int main(int argc, char *argv[]) { static int ret; ret |= getopt(argc, argv, "abc"); return ret ? 0 : 1; } EOC cyn=getopt set d_getopt eval $trylink : index or strchr $cat >try.c < int main(void) { static char ret; static int c; ret |= *strchr("string", c); return ret ? 0 : 1; } EOC cyn=strchr set d_strchr eval $trylink $cat >try.c < int main(void) { static char ret; static int c; ret |= *index("string", c); return ret ? 0 : 1; } EOC cyn=index set d_index eval $trylink : Locate the flags for 'open()' echo " " $cat >open3.c <<'EOCP' #include #ifdef I_FCNTL #include #endif #ifdef I_SYS_FILE #include #endif int main(void) { if(O_RDONLY); #ifdef O_TRUNC return 0; #else return 1; #endif } EOCP : check sys/file.h first to get FREAD on Sun if $test `./findhdr sys/file.h` && \ $cc $cppflags "-DI_SYS_FILE" -o open3 open3.c >/dev/null 2>&1 ; then h_sysfile=true; echo " defines the O_* constants..." >&4 if ./open3; then echo "and you have the 3 argument form of open()." >&4 val="$define" else echo "but not the 3 argument form of open(). Oh, well." >&4 val="$undef" fi elif $test `./findhdr fcntl.h` && \ $cc "-DI_FCNTL" -o open3 open3.c >/dev/null 2>&1 ; then h_fcntl=true; echo " defines the O_* constants..." >&4 if ./open3; then echo "and you have the 3 argument form of open()." >&4 val="$define" else echo "but not the 3 argument form of open(). Oh, well." >&4 val="$undef" fi else val="$undef" ./warn "I can't find the O_* constant definitions! You got problems." 4>&4 fi set d_open3 eval $setvar $rm -f open3* : see if rename exists $cat >try.c < int main(void) { static int ret; ret |= rename("old", "new"); return ret ? 0 : 1; } EOC cyn=rename set d_rename eval $trylink : see if setpgid exists $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static pid_t pid, pgid; static int ret; ret |= setpgid(pid, pgid); return ret ? 0 : 1; } EOC cyn=setpgid set d_setpgid eval $trylink : see if setrgid exists $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static int ret; static gid_t gid; ret |= setrgid(gid); return ret ? 0 : 1; } EOC cyn=setrgid set d_setrgid eval $trylink : see if setruid exists $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static int ret; static uid_t uid; ret |= setruid(uid); return ret ? 0 : 1; } EOC cyn=setruid set d_setruid eval $trylink : see if setsid exists $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static pid_t ret; ret |= setsid(); return ret ? 0 : 1; } EOC cyn=setsid set d_setsid eval $trylink : see if strcasecmp exists $cat >try.c < int main(void) { static int ret; ret |= strcasecmp("xxx", "XXX"); return ret ? 0 : 1; } EOC cyn=strcasecmp set d_strccmp eval $trylink : see if strerror and/or sys_errlist[] exist echo " " if set strerror val -f d_strerror; eval $csym; $val; then echo 'strerror() found.' >&4 d_strerror="$define" d_strerrm='strerror(e)' if set sys_errlist val -a d_syserrlst; eval $csym; $val; then echo "(You also have sys_errlist[], so we could roll our own strerror.)" d_syserrlst="$define" else echo "(Since you don't have sys_errlist[], sterror() is welcome.)" d_syserrlst="$undef" fi elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \ $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then echo 'strerror() found in string header.' >&4 d_strerror="$define" d_strerrm='strerror(e)' if set sys_errlist val -a d_syserrlst; eval $csym; $val; then echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)" d_syserrlst="$define" else echo "(You don't appear to have any sys_errlist[], how can this be?)" d_syserrlst="$undef" fi elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4 d_strerror="$undef" d_syserrlst="$define" d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])' else echo 'strerror() and sys_errlist[] NOT found.' >&4 d_strerror="$undef" d_syserrlst="$undef" d_strerrm='"unknown"' fi if set sys_errnolist val -a d_sysernlst; eval $csym; $val; then echo "(Symbolic error codes can be fetched via the sys_errnolist[] array.)" d_sysernlst="$define" else echo "(However, I can't extract the symbolic error code out of errno.)" d_sysernlst="$undef" fi : see if union wait is available echo " " set X $cppflags shift flags='' also='' for f in $*; do case "$f" in *NO_PROTO*) ;; *) flags="$flags $f";; esac done $cat `./findhdr sys/wait.h` /dev/null | \ $cppstdin $flags $cppminus >wait.out 2>/dev/null if $contains 'union.*wait.*{' wait.out >/dev/null 2>&1 ; then echo "Looks like your knows about 'union wait'..." >&4 val="$define" also='also ' if $contains 'extern.*wait[ ]*([ ]*int' wait.out >/dev/null 2>&1 then echo "But wait() seems to expect an 'int' pointer (POSIX way)." >&4 val="$undef" also='' elif $contains 'extern.*wait[ ]*([ ]*union' wait.out >/dev/null 2>&1 then echo "And indeed wait() expects an 'union wait' pointer (BSD way)." >&4 else echo "So we'll use that for wait()." >&4 fi else echo "No trace of 'union wait' in ..." >&4 val="$undef" echo "Your wait() should be happy with a plain 'int' pointer." >&4 fi set d_uwait eval $setvar $rm -f wait.out : see if there is a vfork $cat >try.c < #$i_unistd I_UNISTD #ifdef I_UNISTD #include #endif int main(void) { static pid_t ret; ret |= vfork(); return ret ? 0 : 1; } EOC cyn=vfork set val eval $trylink : Ok, but do we want to use it. vfork is reportedly unreliable in : perl on Solaris 2.x, and probably elsewhere. case "$val" in $define) echo " " case "$usevfork" in false) dflt='n';; *) dflt='y';; esac rp="Some systems have problems with vfork(). Do you want to use it?" . ./myread case "$ans" in y|Y) ;; *) echo "Ok, we won't use vfork()." val="$undef" ;; esac ;; esac set d_vfork eval $setvar case "$d_vfork" in $define) usevfork='true';; *) usevfork='false';; esac : determine known pre-processor and compiler symbols echo " " $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 $cat <<'EOSH' > Cppsym.know a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi bull c cadmus clipper CMU COFF COMPILER_VERSION concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 hp700 HP700 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG LONGDOUBLE LONGLONG LP64 luna luna88k Lynx M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000 ns32016 ns32332 ns32k nsc32000 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc pc532 pdp11 PGC PIC plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE POSIX_C_SOURCE POSIX_SOURCE POWER PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE sony sony_news sonyrisc sparc sparclite spectrum stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5 sysV68 sysV88 Tek4132 Tek4300 titan TM3200 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700 tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED z8000 EOSH cat <>Cppsym.know $osname EOSH ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b $cat Cppsym.know > Cppsym.c $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know $rm -f Cppsym.a Cppsym.b Cppsym.c cat < Cppsym $startsh if $test \$# -gt 0; then echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got if $test -s Cppsym.got; then $rm -f Cppsym.got exit 0 fi $rm -f Cppsym.got exit 1 else $tr " " "$trnl" | ./Cppsym.try exit 0 fi EOSH chmod +x Cppsym $eunicefix Cppsym cat < Cppsym.try $startsh cat <<'EOCP' > try.c #include int main() { EOCP $awk \\ EOSH cat <<'EOSH' >> Cppsym.try 'length($1) > 0 { printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1 printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1 printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1 printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1 }' >> try.c echo 'return 0;}' >> try.c EOSH cat <> Cppsym.try flags="$ccflags" case "$osname-$gccversion" in irix-) flags="\$flags -woff 1178" ;; os2-*) flags="\$flags -Zlinker /PM:VIO" ;; esac $cc -o try $optimize \$flags $ldflags try.c $libs && $run ./try EOSH chmod +x Cppsym.try $eunicefix Cppsym.try ./Cppsym < Cppsym.know > Cppsym.true : now check the C compiler for additional symbols postprocess_cc_v='' case "$osname" in aix) postprocess_cc_v="|$tr , ' '" ;; esac $cat >ccsym <tmp.c <&1 $postprocess_cc_v\` do case "\$i" in -D*) echo "\$i" | $sed 's/^-D//';; -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';; esac done $rm -f try.c EOS postprocess_cc_v='' chmod +x ccsym $eunicefix ccsym ./ccsym > ccsym1.raw if $test -s ccsym1.raw; then $sort ccsym1.raw | $uniq >ccsym.raw else mv ccsym1.raw ccsym.raw fi $awk '/\=/ { print $0; next } { print $0"=1" }' ccsym.raw >ccsym.list $awk '/\=/ { print $0; next } { print $0"=1" }' Cppsym.true >ccsym.true $comm -13 ccsym.true ccsym.list >ccsym.own $comm -12 ccsym.true ccsym.list >ccsym.com $comm -23 ccsym.true ccsym.list >ccsym.cpp also='' if $test -z ccsym.raw; then echo "Your C compiler doesn't seem to define any symbols!" >&4 echo " " echo "However, your C preprocessor defines the following symbols:" $cat Cppsym.true ccsymbols='' cppsymbols=`$cat Cppsym.true` cppsymbols=`echo $cppsymbols` cppccsymbols="$cppsymbols" else if $test -s ccsym.com; then echo "Your C compiler and pre-processor define these symbols:" $sed -e 's/\(..*\)=.*/\1/' ccsym.com also='also ' symbols='ones' cppccsymbols=`$cat ccsym.com` cppccsymbols=`echo $cppccsymbols` $test "$silent" || sleep 1 fi if $test -s ccsym.cpp; then $test "$also" && echo " " echo "Your C pre-processor ${also}defines the following symbols:" $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp also='further ' cppsymbols=`$cat ccsym.cpp` cppsymbols=`echo $cppsymbols` $test "$silent" || sleep 1 fi if $test -s ccsym.own; then $test "$also" && echo " " echo "Your C compiler ${also}defines the following cpp symbols:" $sed -e 's/\(..*\)=1/\1/' ccsym.own $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true ccsymbols=`$cat ccsym.own` ccsymbols=`echo $ccsymbols` $test "$silent" || sleep 1 fi fi $rm -f Cppsym.know Cppsym.true : see if this is a termio system val="$undef" val2="$undef" val3="$undef" $cat >try.c < int main(void) { static struct termios t; static int ret; ret |= tcsetattr(1, 2, &t); return ret ? 0 : 1; } EOC set i_termios eval $trylink set tcsetattr i_termios val3="$i_termios" echo " " case "$val3" in "$define") echo "You have POSIX termios.h... good!" >&4;; *) if ./Cppsym pyr; then case "`/bin/universe`" in ucb) if $test `./findhdr sgtty.h`; then val2="$define" echo " found." >&4 else echo "System is pyramid with BSD universe." ./warn " not found--you could have problems." 4>&4 fi;; *) if $test `./findhdr termio.h`; then val="$define" echo " found." >&4 else echo "System is pyramid with USG universe." ./warn " not found--you could have problems." 4>&4 fi;; esac elif ./usg; then if $test `./findhdr termio.h`; then echo " found." >&4 val="$define" elif $test `./findhdr sgtty.h`; then echo " found." >&4 val2="$define" else ./warn "Neither nor found--cross fingers!" 4>&4 fi else if $test `./findhdr sgtty.h`; then echo " found." >&4 val2="$define" elif $test `./findhdr termio.h`; then echo " found." >&4 val="$define" else ./warn "Neither nor found--cross fingers!" 4>&4 fi fi;; esac set i_termio; eval $setvar val=$val2; set i_sgtty; eval $setvar val=$val3; set i_termios; eval $setvar : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl set sys/filio.h i_sysfilio eval $inhdr echo " " if $test `./findhdr sys/ioctl.h`; then val="$define" echo ' found.' >&4 else val="$undef" if $test $i_sysfilio = "$define"; then echo ' NOT found.' >&4 else $test $i_sgtty = "$define" && xxx="sgtty.h" $test $i_termio = "$define" && xxx="termio.h" $test $i_termios = "$define" && xxx="termios.h" echo "No found, assuming ioctl args are defined in <$xxx>." >&4 fi fi set i_sysioctl eval $setvar : check how to void tty association echo " " case "$i_sysioctl" in "$define") xxx='sys/ioctl.h';; esac $cat > tcio.c < /* Just in case */ #include <$xxx> int main() { #ifdef TIOCNOTTY exit(0); #else exit(1); #endif } EOM if ($cc -o tcio tcio.c && ./tcio) >/dev/null 2>&1; then val="$define" echo "TIOCNOTTY found in <$xxx>." >&4 echo "Using ioctl() call on /dev/tty to void tty association." >&4 else val="$undef" echo "Closing standard file descriptors should void tty association." >&4 fi set d_voidtty eval $setvar $rm -f tcio tcio.? core : see if we can use WIFxxx macros echo " " case "$d_wifstat" in "$define") echo "As before, you can safely use WIFEXITED and friends!" >&4;; "$undef") echo "You still can't use WIFEXITED and friends!" >&4;; *) echo "Let's see whether you can use the WIFEXITED(status) macro and its" case "$d_uwait" in "$define") type='union wait';; *) type='int';; esac echo "friends with status declared as '$type status'..." $cat >foo.c < #include int main() { $type status; int e = 0; #ifdef WIFEXITED if (WIFEXITED(status)) printf("\n"); exit(0); #else exit(2); #endif } EOCP d_wifstat="$undef" if $cc $ccflags $ldflags -o foo foo.c $libs >/dev/null 2>&1; then if ./foo >/dev/null; then echo "Great! Looks like we can use the WIFxxx macros." >&4 d_wifstat="$define" else echo "You don't seem to have WIFxxx macros, but that's ok." >&4 fi else echo "Apparently you can't use WIFxxx macros properly." >&4 fi $rm -f foo.* foo core ;; esac : preserve RCS keywords in files with variable substitution, grrr Id='$Id' Log='$Log' : how do we catenate cpp tokens here? echo " " echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 cpp_quote='' $cat >cpp_stuff.c <<'EOCP' #define RCAT(a,b)a/**/b #define ACAT(a,b)a ## b RCAT(Rei,ser) ACAT(Cir,cus) EOCP $cppstdin $cppflags $cppminus cpp_stuff.out 2>&1 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then echo "Oh! Smells like ANSI's been here." echo "We can catify or stringify, separately or together!" cpp_stuff=42 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then echo "Ah, yes! The good old days!" cpp_stuff=1 $cat >cpp_stuff.c <<'EOCP' #define SQuoTe(a)"a #define EQuoTe(a)a" #define CAT2(a,b)EQuoTe(SQuoTe(a)b) CAT2(Vic,tory) EOCP $cppstdin $cppflags $cppminus cpp_stuff.out 2>&1 if $contains '"Victory"' cpp_stuff.out >/dev/null 2>&1; then echo "I'll resort to a cute trick to also be able to stringify." cpp_quote='"' else $cat <&4 <try.c < #include int main(void) { static int fd, ret; ret |= flock(fd, LOCK_SH); ret |= flock(fd, LOCK_EX); ret |= flock(fd, LOCK_UN); return ret ? 0 : 1; } EOC cyn=flock set d_flock eval $trylink : see which mailbox locking should be used echo " " lock_by_flock='' flock_only='' case "$d_flock" in "$define") if $contains EWOULDBLOCK $usrinc/errno.h > /dev/null 2>&1; then echo 'EWOULDBLOCK found, will use flock type mailbox locking.' val="$define" elif $contains EWOULDBLOCK $usrinc/sys/errno.h > /dev/null 2>&1; then echo 'EWOULDBLOCK found, will use flock type mailbox locking.' val="$define" else echo 'Will use .lock type mailbox locking.' val="$undef" fi ;; *) echo 'Will use .lock type mailbox locking.' val="$undef" ;; esac set d_lockflock; eval $setvar case "$d_lockflock" in "$define") lock_by_flock='true' case "$d_flockonly" in "$define") dflt=y;; *) dflt=n;; esac $cat <