diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..a01d0fd --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Rocky Bernstein + +# $Id: AUTHORS,v 1.3 2008/12/17 20:08:43 rockyb Exp $ diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..c4ac587 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..f4f40f1 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,851 @@ +## +## autogenerated ChangeLog -- don't edit +## + +2008-12-25 Thursday 17:01 Rocky Bernstein + + * Makefile.am, samples/root-procs.ini: Add sample code using + perl-action. + +2008-12-25 Thursday 16:42 Rocky Bernstein + + * configure.ac, tests/paction.cnf: More Darwin9 fixes: tty can be + many token so put at end of parsing. + +2008-12-25 Thursday 16:39 Rocky Bernstein + + * Makefile.am, NEWS, configure.ac: Get ready for 1.07 release + +2008-12-23 Tuesday 11:09 Rocky Bernstein + + * ps-watcher.in.in: Typo: svz -> vsz. Thanks to Oliver Guerrier for + pointing out. + +2008-12-18 Thursday 01:07 Rocky Bernstein + + * ps-watcher.in.in: Bug in duplicating log + +2008-12-17 Wednesday 20:08 Rocky Bernstein + + * ANNOUNCE, AUTHORS, configure.ac: test cygwin and NetBSD and + update contact info + +2008-12-17 Wednesday 19:28 Rocky Bernstein + + * post-configure.in: Tolerate older Perl's enough to warn that we + can't use them. + +2008-12-17 Wednesday 18:31 Rocky Bernstein + + * configure.ac: Linux newline nuke fixes along the lines of the + Darwin code + +2008-12-17 Wednesday 17:06 Rocky Bernstein + + * configure.ac, ps-watcher.in.in: Better about dealing with + unwritable log file + +2008-12-17 Wednesday 16:31 Rocky Bernstein + + * configure.ac: In 1.07 now + +2008-12-17 Wednesday 16:27 Rocky Bernstein + + * configure.ac: Changes for Darwin9 + +2006-11-17 Friday 14:02 Rocky Bernstein + + * ps-watcher.in.in, home-page/index.html: Small typos. + +2006-09-21 Thursday 23:07 Rocky Bernstein + + * home-page/index.html: Correct for new sf link + +2006-03-11 Saturday 03:16 Rocky Bernstein + + * ps-watcher.in.in: More doc changes + +2006-03-10 Friday 19:33 Rocky Bernstein + + * NEWS: Last change before release + +2006-03-10 Friday 19:07 Rocky Bernstein + + * configure.ac, post-configure.in, ps-watcher.in.in, + tests/basic.t.in: Deal with time on netbsdelf and regression + tests. basic.t.in: generalize time handling - not just cygwin. + post-configure.in configure.ac: clean up a little. + +2006-03-10 Friday 13:12 Rocky Bernstein + + * tests/: args.t.in, basic.t.in, count.t.in, full.t.in: Run + ps-watcher in tests with configured Perl location. + +2006-03-10 Friday 12:47 Rocky Bernstein + + * tests/: full.cnf, full.t.in: Add a test and adjust for cygwin. + +2006-03-10 Friday 12:26 Rocky Bernstein + + * configure.ac, post-configure.in, ps-watcher.in.in, + tests/basic.t.in: Changes to make this work on more + architectures. configure.ac, post-configure.in: another attempt + to get invocation work eveywhere basic.t.in: test for cputime; + forgot ! + +2006-03-10 Friday 04:51 Rocky Bernstein + + * configure.ac: Darwin 8 is okay + +2006-03-10 Friday 04:50 Rocky Bernstein + + * configure.ac: Bug in running right Perl in post-configure + +2006-03-10 Friday 03:49 Rocky Bernstein + + * configure.ac, post-configure.in: Use PERL value specified more. + +2006-03-10 Friday 03:39 Rocky Bernstein + + * NEWS, configure.ac: Add configure option to specify Perl location + +2006-03-10 Friday 03:24 Rocky Bernstein + + * tests/args.t.in: typo: it's ok not okay. + +2006-03-10 Friday 03:21 Rocky Bernstein + + * configure.ac, ps-watcher.in.in, tests/args.t.in, + tests/basic.t.in, tests/full.t.in, tests/paction.t: Add minimal + cygwin support + +2006-03-09 Thursday 17:37 Rocky Bernstein + + * configure.ac, post-configure.in, tests/01.pod.t.in, + tests/Makefile.am: 01.pod.t.in: add POD testing routine + configure.ac: do chmod +x on perl-substituted files. + +2006-03-09 Thursday 16:46 Rocky Bernstein + + * NEWS, ps-watcher.in.in: Document security better. + +2006-03-08 Wednesday 22:52 Rocky Bernstein + + * configure.ac, ps-watcher.in.in, home-page/index.html: Get ready + for 1.06 release. + +2006-03-08 Wednesday 22:24 Rocky Bernstein + + * ps-watcher.in.in: Correction in getting signal name. + +2006-03-08 Wednesday 19:21 Rocky Bernstein + + * touch.pl: Reinstate since Makefile.am uses. + +2006-03-08 Wednesday 19:15 Rocky Bernstein + + * AUTHORS, Makefile.am, cvs2cl_usermap, post-configure.in, + ps-watcher.in.in, touch.pl: ps-watcher.in.in: Wasn't terminating + properly. Thanks to David G. Humes for noticing and fixing. + Modernize code a little bit + + *: rocky@panix.com -> rocky@cpan.org touch.pl: now handled inside + post-configure by Perl + +2006-02-03 Friday 02:23 Rocky Bernstein + + * ps-watcher.in.in: One more small typo. + +2006-02-03 Friday 02:15 Rocky Bernstein + + * post-configure.in, ps-watcher.in.in, home-page/index.html: Mostly + small changes: + + ps-watcher.in.in options are now stored in %opts. Some perlpod + grammar fixes. + + post-configure.in: Suggest "make && make check" (and not with + semicolon) + + home-page/index.html: Probably remove a W3C error. + +2006-01-17 Tuesday 10:00 Rocky Bernstein + + * home-page/index.html: Make valid HTML as per W3C. + +2005-10-12 Wednesday 01:14 Rocky Bernstein + + * ps-watcher.in.in, NEWS: Add BUGS section to manual to describe + common problems. + +2005-09-12 Monday 17:03 Rocky Bernstein + + * configure.ac: Now in 1.06cvs territory + +2005-09-12 Monday 17:03 Rocky Bernstein + + * ps-watcher.in.in: Guard against uninitialized variables + +2005-06-22 Wednesday 01:59 Rocky Bernstein + + * home-page/index.html: instead of ? + +2005-06-22 Wednesday 01:57 Rocky Bernstein + + * home-page/index.html: Correct grammar courtesy of Sir Monitor + Lizard, Ph. Mad. + +2005-05-17 Tuesday 22:00 Rocky Bernstein + + * NEWS: What's new. + +2005-05-17 Tuesday 09:56 Rocky Bernstein + + * configure.ac: NetBSD works like FreeBSD + +2005-05-17 Tuesday 09:52 Rocky Bernstein + + * COPYING, Makefile.am, NEWS, config.guess, config.sub, + configure.ac, missing, post-configure.in, docs/Makefile.am, + tests/Makefile.am: configure.ac: Darwin 7 is like Darwin5 & 6. + configure.ac, post-configure.in: check for at least perl 5.6 + + GPL address change. + +2005-04-09 Saturday 18:06 Rocky Bernstein + + * ps-watcher.in.in: Like this a tad better. + +2005-04-04 Monday 23:58 Rocky Bernstein + + * NEWS, ps-watcher.in.in: Note recent change. + +2005-04-04 Monday 23:53 Rocky Bernstein + + * THANKS: Add thanks to Iñaki Sánchez. + +2005-04-04 Monday 23:50 Rocky Bernstein + + * ps-watcher.in.in, tests/basic.cnf.in: Allow $ps_pat to be used in + action. Patch courtesy of Iñaki Sánchez. (i s a n c h e z at + unav dot es) + +2004-09-11 Saturday 13:29 Rocky Bernstein + + * docs/.cvsignore: More pod2htm stuff. + +2004-09-09 Thursday 10:58 Rocky Bernstein + + * NEWS, cvs2cl_header, cvs2cl_usermap: ChangeLog-creation + improvements. + +2004-09-07 Tuesday 13:51 Rocky Bernstein + + * Makefile.am, ps-watcher.in.in, docs/Makefile.am, + samples/port-watch.ini: Make distcheck works. Show how to use + $PROLOG to do a no-ps like thing such as watching a port (via + lsof). + +2004-05-26 Wednesday 13:46 Rocky Bernstein + + * ps-watcher.in.in: Small change. + +2004-05-26 Wednesday 13:42 Rocky Bernstein + + * Makefile.am, configure.ac, ps-watcher.in.in, docs/Makefile.am: + ps-watcher.in.in: smallish changes - call closelog on + termination, add prototype for pod_this(). + + docs/Makefile.am: ignore errors in building manual/html pages + + Makefile.am: target to create ChangeLog when building + distribution + + configure.ac: now in version 1.05 now. Allow maintainer mode (to + create ChangeLog) + +2004-02-15 Sunday 12:03 Rocky Bernstein + + * docs/Makefile.am: Set title to name without the .in. + +2004-01-18 Sunday 12:20 Rocky Bernstein + + * ps-watcher.in.in: Update copyright. + +2004-01-18 Sunday 11:49 Rocky Bernstein + + * ps-watcher.in.in: Improve documentation with respect to + perl-action. + +2004-01-15 Thursday 03:23 Rocky Bernstein + + * ps-watcher.in.in: perldoc fix. + +2004-01-15 Thursday 03:02 Rocky Bernstein + + * tests/paction.t: Regression test for $PROLOG, $EPILOG and + perl-action. + +2004-01-15 Thursday 03:00 Rocky Bernstein + + * configure.ac, ps-watcher.in.in, tests/Makefile.am, + tests/paction.cnf: Add $PROLOG, $EPILOG and perl-action sections. + Allows one to accumulate information over all processes and take + action on that. + +2004-01-10 Saturday 04:39 Rocky Bernstein + + * ps-watcher.in.in: Documentation enhancement, I think. + +2003-11-22 Saturday 12:31 Rocky Bernstein + + * ps-watcher.in.in: And another formatting change... + +2003-11-22 Saturday 12:27 Rocky Bernstein + + * ps-watcher.in.in: One more trivial typo.... + +2003-11-22 Saturday 12:26 Rocky Bernstein + + * ps-watcher.in.in: Documentation typo. + +2003-11-22 Saturday 12:01 Rocky Bernstein + + * NEWS, configure.ac: Get ready for new (minor) release. + +2003-11-21 Friday 02:36 Rocky Bernstein + + * ps-watcher.in.in, tests/basic.cnf.in, tests/basic.t.in: Add + first-trigger feature. + +2003-09-11 Thursday 03:17 Rocky Bernstein + + * NEWS: Get ready for a release. + +2003-09-10 Wednesday 07:30 Rocky Bernstein + + * ps-watcher.in.in: Fix example configuration as suggested in bug + #776229. + +2003-09-05 Friday 00:23 Rocky Bernstein + + * ps-watcher.in.in: More complicated trigger example suggested by + jason + +2003-09-03 Wednesday 02:04 Rocky Bernstein + + * ps-watcher.in.in: Add troubleshooting section + +2003-09-03 Wednesday 01:42 Rocky Bernstein + + * configure.ac, ps-watcher.in.in: Fixes for FreeBSD + +2003-08-31 Sunday 21:22 Rocky Bernstein + + * tests/basic.cnf.in: perhaps some processes use so little CPU that + the elapsed time will round to zero. Deal with it. + +2003-08-30 Saturday 20:49 Rocky Bernstein + + * ps-watcher.in.in: Update date. + +2003-08-29 Friday 10:49 Rocky Bernstein + + * configure.ac: Get ready for another release. + +2003-08-29 Friday 10:48 Rocky Bernstein + + * tests/: args.t.in, basic.t.in, count.t.in, full.t.in: Regression + tests need to deal with timestamped output. + +2003-08-29 Friday 10:47 Rocky Bernstein + + * ps-watcher.in.in: Add syslog-like timestamp to logfile output. + Problems with getting ps-output now appears only on debug output. + +2003-08-29 Friday 10:45 Rocky Bernstein + + * post-configure.in: Use -w (warning) on perl invocation + +2003-08-13 Wednesday 02:33 Rocky Bernstein + + * configure.ac: PS_CAN_RETURN_MULTIPLE_LINES not set on AIX which + broke it. + +2003-07-11 Friday 05:56 Rocky Bernstein + + * Makefile.am: Add sample files + +2003-07-11 Friday 05:47 Rocky Bernstein + + * configure.ac: typo + +2003-07-11 Friday 05:46 Rocky Bernstein + + * configure.ac: Get ready for 1.0 release. + +2003-07-11 Friday 05:43 Rocky Bernstein + + * Makefile.am, tests/Makefile.am, tests/args.t.in, + tests/count.t.in, tests/full.t.in: Make "make distcheck" work. + +2003-07-11 Friday 05:42 Rocky Bernstein + + * THANKS: Update as appropriate. + +2003-07-10 Thursday 12:20 Rocky Bernstein + + * configure.ac, post-configure.in: A tad better for making "make + distcheck" work: Use $srcdir in post-configure and arrange for + srcdir to be passed in. + +2003-07-10 Thursday 11:50 Rocky Bernstein + + * THANKS, TODO, config.cache, configure.ac, ps-watcher.in.in: Deal + with ps (e.g. Solaris's) which return more than one line for a + single pid. + +2003-07-10 Thursday 11:42 Rocky Bernstein + + * ps-watcher.in.in: Stupid mistake - comments are # not /* */. + +2003-05-19 Monday 16:33 Rocky Bernstein + + * configure.ac: Accomodate darwin6 + +2003-05-19 Monday 16:33 Rocky Bernstein + + * tests/args.t.in: Add one test of --nosyslog + +2003-05-19 Monday 15:58 Rocky Bernstein + + * configure.ac: Add AIX support. + +2003-05-16 Friday 00:12 Rocky Bernstein + + * README: IniConf is now called Config::IniFiles + +2003-03-06 Thursday 05:57 Rocky Bernstein + + * configure.ac: Failed full test. Need to add -x. + +2003-03-06 Thursday 05:48 Rocky Bernstein + + * tests/full.cnf: Don't assume first is pid 1! + +2003-03-06 Thursday 05:37 Rocky Bernstein + + * configure.ac, tests/Makefile.am, tests/.cvsignore, + tests/full.cnf, tests/full.t.in: Add test that we can trigger on + watching processes other than the ones under our account. + +2003-03-06 Thursday 03:54 Rocky Bernstein + + * Makefile.am, NEWS, config.guess, configure.ac, docs/Makefile.am, + tests/Makefile.am: Changes for Mac OS/X + +2003-03-04 Tuesday 18:01 Rocky Bernstein + + * aclocal.m4, docs/Makefile.am, tests/Makefile.in: Add more + automake conversion idioms + +2003-03-04 Tuesday 14:14 Rocky Bernstein + + * autogen.sh: Omitted running aclocal, autoconf, automake... + +2003-03-04 Tuesday 14:08 Rocky Bernstein + + * docs/: Makefile.am, Makefile.in: More automake conversion pains. + +2003-03-04 Tuesday 14:05 Rocky Bernstein + + * .cvsignore, MANIFEST: MANIFEST: not used in automake + +2003-03-04 Tuesday 14:03 Rocky Bernstein + + * NEWS, autogen.sh: autogen.sh: useful for CVS NEWS: what's been + happening? + +2003-03-04 Tuesday 13:59 Rocky Bernstein + + * Makefile.am, Makefile.in: More automake conversion work. + Makefile.am: forgot to add Makefile.PL. Makefile.in: superceded + by Makfile.am + +2003-03-04 Tuesday 13:55 Rocky Bernstein + + * AUTHORS, Makefile.am, Makefile.in, NEWS, aclocal.m4, version, + docs/Makefile.am, docs/Makefile.in, tests/Makefile.am, + tests/Makefile.in: Convert to use Makefile.am + +2003-03-04 Tuesday 02:53 Rocky Bernstein + + * configure.ac, ps-watcher.in.in, version, samples/sample.ini, + tests/args.cnf: Changes for BSD/OS. Also potentially a bug in + FreeBSD. + +2003-03-02 Sunday 16:35 Rocky Bernstein + + * ps-watcher.in.in: More small document changes. Make HTML come out + a tad better. + +2003-03-02 Sunday 15:28 Rocky Bernstein + + * ps-watcher.in.in: Update link for netwinder location! + +2003-03-01 Saturday 21:38 Rocky Bernstein + + * MANIFEST: Typo. + +2003-03-01 Saturday 21:37 Rocky Bernstein + + * NEWS: What's up. + +2003-03-01 Saturday 21:35 Rocky Bernstein + + * MANIFEST: Add Changelog + +2003-03-01 Saturday 21:23 Rocky Bernstein + + * samples/sample.ini: Add $args example. + +2003-03-01 Saturday 21:12 Rocky Bernstein + + * MANIFEST, configure.ac, ps-watcher.in.in: Add variables to + control what ps can do, e.g. can nuke header line, has custom + title (for nuking header line), what time variable we can test + on. + +2003-03-01 Saturday 21:09 Rocky Bernstein + + * tests/: .cvsignore, args.t.in, basic.cnf, basic.cnf.in: Don't + assume etime is a ps-variable. Thanks, FreeBSD. + +2003-03-01 Saturday 21:08 Rocky Bernstein + + * docs/Makefile.in: Cater to brain-dead make on FreeBSD. + +2003-02-28 Friday 16:45 Rocky Bernstein + + * MANIFEST, configure.ac: configure.ac: add freebsd4 check + MANIFEST: add args test files + +2003-02-28 Friday 13:37 Rocky Bernstein + + * config.sub: Update with more recent version of this. + +2003-02-28 Friday 12:34 Rocky Bernstein + + * tests/: .cvsignore, args.cnf, args.t.in: Add args regression + test. + +2003-02-28 Friday 12:33 Rocky Bernstein + + * configure.ac, ps-watcher.in.in, tests/Makefile.in, + tests/basic.cnf, tests/basic.t.in, tests/count.t.in: Add args + documentation and regression tests. count.t.in, basic.t.in: set + perl mode for emacs + +2003-02-27 Thursday 23:46 Rocky Bernstein + + * configure.ac, ps-watcher.in.in, version: Add $args variable to + test on entire command. Perpare to make into another version. + +2003-02-27 Thursday 21:21 Rocky Bernstein + + * configure.ac: Add args to the list of variables that are + accepted. + +2003-01-27 Monday 22:41 Rocky Bernstein + + * MANIFEST, configure.stamp, version: MANIFEST: configre.in -> + configure.ac Other files not sure about, but we'll try + initially... + +2003-01-27 Monday 22:37 Rocky Bernstein + + * configure.ac: Remove touch of stamp file. Dunno... + +2003-01-27 Monday 22:35 Rocky Bernstein + + * configure.ac: Bump version number. + +2003-01-27 Monday 22:34 Rocky Bernstein + + * Makefile.in, NEWS, configure.ac, configure.in, ps-watcher.in.in, + samples/sample.ini: Bug in running make dist. + + Small documentation bug in manual and HTML. Had @PROGRAM@ rather + than @PACKAGE@ so name of package was not in man/html. + + Give example where you want to match all processes except one. + + Print out errors in configuration file + + configure.in -> configure.ac (thanks, autoconf) + + Config::IniConf now gives a syntax error for empty section: []. + Change that. + +2002-10-03 Thursday 14:55 rocky + + * .cvsignore: Seems to be a new thing with autoconf. + +2002-10-03 Thursday 14:55 rocky + + * home-page/index.html: Changes to move to sourceforge project: + download/manpage locations changed. Add link to CVS! And add + sourceforge logo. + +2002-09-24 Tuesday 11:21 rocky + + * NEWS: Update as appropriate. + +2002-09-24 Tuesday 11:20 rocky + + * Makefile.in: Bug in running post-configure when doing a "make + dist". Add "perl" to command. + +2002-09-24 Tuesday 11:18 rocky + + * ps-watcher.in.in: Add example which shows excluding a process + from consideration. + +2002-09-24 Tuesday 11:00 rocky + + * .cvsignore: post-configure is derived. + +2002-09-24 Tuesday 10:59 rocky + + * post-configure.in: Things that need to be done after running + configure. In particular, rewrinte #!/bin/perl lines. + +2002-09-24 Tuesday 10:56 rocky + + * NEWS: Document small doc bug. Version is now 0.96 + +2002-09-24 Tuesday 10:54 rocky + + * ps-watcher.in.in: Document typo. Was using @PROGRAM@ instead of + @PACKAGE@. + +2002-02-06 Wednesday 04:55 rocky + + * MANIFEST: Now derived from post-configure.in + +2002-02-06 Wednesday 04:54 rocky + + * configure.in: Remove bsdstart -- space in it mess things up. + +2002-02-06 Wednesday 04:13 rocky + + * tests/basic.t.in: Turn into a derived file. + +2002-02-06 Wednesday 04:13 rocky + + * tests/: .cvsignore, count.t.in: .cvsignore: ignore derived tests + basic.t: is now derived count.t.in: new test + +2002-02-06 Wednesday 04:10 rocky + + * tests/count.cnf: count.cnf: test "none" and $count > 1 basic.cnf: + minor changes like cvs id line. + +2002-02-06 Wednesday 04:10 rocky + + * docs/Makefile.in: Makefile.in: migrating more to automake: use + @PACKAGE@ now. + +2002-02-06 Wednesday 04:09 rocky + + * Makefile.in, aclocal.m4, configure.in, missing, ps-watcher.in.in: + aclocal.m4 missing, Makefile: New files migrating more to + automake. ps-watcher.in.in: fix bug in "once" and "count > 1" + +2001-11-24 Saturday 19:03 rocky + + * home-page/index.html: Update location. + +2001-06-25 Monday 00:23 rocky + + * ps-watcher.in.in: Another example with count != 1 (syslogd) + changed to count > 4 (httpd). count != 1 may be confusing since + when count == 0 we don't trigger. + +2001-06-25 Monday 00:22 rocky + + * samples/sample.ini: Update to show occurs = none. syslogd + example was incorrect. Change to httpd. + +2001-06-25 Monday 00:20 rocky + + * tests/basic.cnf: Add test for when no matching process exists. + +2001-06-25 Monday 00:17 rocky + + * MANIFEST: Add NEWS + +2001-06-25 Monday 00:16 rocky + + * ps-watcher.in.in: Allow "occurs = none" to fire if no processes + exist. Update Copyright too. + +2001-05-31 Thursday 16:24 rocky + + * tests/basic.cnf: looks like [] is no longer valid. + +2000-09-02 Saturday 18:51 rocky + + * ps-watcher.in.in: Comment backtick problem + +2000-09-02 Saturday 18:43 rocky + + * ps-watcher.in.in: Hopefully this time we've fixed the backtick + problem in a process name. + + Improve description section of doc. + +2000-09-02 Saturday 04:07 rocky + + * ps-watcher.in.in: Add --doc option to print text documentation. + Escape backticks in process names + +2000-04-10 Monday 12:17 rocky + + * home-page/index.html: Initial cut. + +2000-04-09 Sunday 22:43 rocky + + * THANKS: Out of babblefish. + +2000-04-09 Sunday 22:25 rocky + + * THANKS: Correct from pecarry-speak. + +2000-04-09 Sunday 22:06 rocky + + * README: This time for sure? + +2000-04-09 Sunday 22:02 rocky + + * ps-watcher.in.in: Add blank line after =pod for brain-dead + Red-Hat 6.1's brain-deat pod2man program. + +2000-04-09 Sunday 21:58 rocky + + * README: Change invocation example. + +2000-04-09 Sunday 20:40 rocky + + * samples/README: Correct file names. Add Id line. + +2000-04-09 Sunday 20:39 rocky + + * samples/sample.ini: Add Id line. + +2000-04-09 Sunday 20:37 rocky + + * samples/README: Document what each sample does. + +2000-04-09 Sunday 20:37 rocky + + * docs/Makefile.in: Makefile.in: add uninstall. + +2000-04-09 Sunday 20:36 rocky + + * Makefile.in, ps-watcher.in.in: Makefile.in: add uninstall. + post-configure: remove Open3 module check ps-watcher.in.in: Lots + of doc changes. Usage on finding no config file. + +2000-04-09 Sunday 20:25 rocky + + * README: Add quick instructions. Correct mistakes. + +2000-04-09 Sunday 20:13 rocky + + * MANIFEST: Add samples readme. + +2000-03-27 Monday 01:54 rocky + + * tests/.cvsignore: Guess we gotta add this one too. + +2000-03-27 Monday 01:53 rocky + + * tests/: Makefile.in, basic.cnf, driver: Now have some basic + tests. + +2000-03-27 Monday 01:51 rocky + + * .cvsignore, MANIFEST, Makefile.in, ps-watcher.in.in: MANIFEST: + it's a Perl thing. But probably a good idea Makefile.in now uses + it ps-watcher.in.in: remove uninitialized variables in + elapsed2secs + +2000-03-22 Wednesday 07:11 rocky + + * samples/sample.ini: Simple first. + +2000-03-22 Wednesday 07:09 rocky + + * samples/sample.ini: Show off more features. + +2000-03-22 Wednesday 07:08 rocky + + * Makefile.in, TODO, configure.in, ps-watcher.in.in: Makefile.in: + Deal with .in.in TODO: remove done things. Add others + (regresssion tests) ps-watcher.in.in: Add signal handling and + stating configuration file As is usual lots of doc changes. + +2000-03-21 Tuesday 03:20 rocky + + * Makefile.PL: To aid perl to GNU factions. + +2000-03-21 Tuesday 03:17 rocky + + * samples/: sample2.ini, solaris.ini: sampl2.ini: change for Linux. + +2000-03-21 Tuesday 03:16 rocky + + * docs/Makefile.in: Don't need L<> warning any more. + +2000-03-21 Tuesday 03:15 rocky + + * TODO, config.cache, configure.in, ps-watcher.in.in: + post-configure with IniConf version 0.97. ps-watcher.in.in - + many small changes for Linux ps output one token max (no + command) if no ps output skip to next line (ignore terminated + processes) + +2000-03-21 Tuesday 02:23 rocky + + * Makefile.in: Make dist works. Get config.guess, config.sub and + @PROGRAM@.in.in + +2000-03-20 Monday 16:14 rocky + + * configure.in: Add Linux stuff and tests/Makefile + +2000-03-20 Monday 16:12 rocky + + * ps-watcher.in.in: Doc changes. + +2000-03-20 Monday 15:43 rocky + + * configure.in: Substitute in PROGRAM. + +2000-03-20 Monday 09:58 root + + * Makefile.in, README, configure.in, ANNOUNCE, COPYING, INSTALL, + THANKS, TODO, config.cache, config.guess, config.sub, install-sh, + mkinstalldirs, ps-watcher.in.in, touch.pl, docs/Makefile.in, + samples/sample.ini, samples/sample2.ini, samples/solaris.ini: + Imported sources + +2000-03-20 Monday 09:58 root + + * Makefile.in, README, configure.in, ANNOUNCE, COPYING, INSTALL, + THANKS, TODO, config.cache, config.guess, config.sub, install-sh, + mkinstalldirs, ps-watcher.in.in, touch.pl, docs/Makefile.in, + samples/sample.ini, samples/sample2.ini, samples/solaris.ini: + Initial revision + diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..b42a17a --- /dev/null +++ b/INSTALL @@ -0,0 +1,182 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. diff --git a/Makefile.PL b/Makefile.PL new file mode 100755 index 0000000..a71d15e --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,4 @@ +#/usr/bin/perl +print "Got'cha! This program uses ./configure.\n"; +print "Just a moment while I transfer your call...\n"; +exec "./configure"; diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..58a9937 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,67 @@ +############################################################################## +# $Id: Makefile.am,v 1.14 2008/12/25 17:01:50 rockyb Exp $ +# Copyright (C) 2003, 2004, 2006, 2008 Rocky Bernstein +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +############################################################################## + +AUTOMAKE_OPTIONS = dist-bzip2 +SUBDIRS = docs tests +noinst_SCRIPTS = post-configure.in touch.pl +EXTRA_DIST = post-configure.in ps-watcher.in.in ps-watcher \ + touch.pl Makefile.PL \ + samples/README \ + samples/sample.ini \ + samples/sample2.ini \ + samples/port-watch.ini \ + samples/root-procs.ini \ + samples/solaris.ini +bin_SCRIPTS = ps-watcher +PERL = @PERL@ + +DISTCLEANFILES = ps-watcher ps-watcher.stamp + + +# The keeps automake from substituting PS_VARS +PS_VARS = '' + +# Build all forms of documentation: manual-pages and HTML +test: + echo "Checking that things work.."; \ + (cd tests && $(PERL) ./driver) + +# A timestamp file is used to record whether or not we've created +# $(PROGRAM) from $(PROGRAM).in. During debugging if is often more +# convenient to modify $(PROGRAM) rather than $(PROGRAM).in. +$(PACKAGE).stamp: $(PACKAGE) + @cp -p $(PACKAGE) $(PACKAGE).in ; \ + $(srcdir)/touch.pl $@ + +# cvs2cl +MAINTAINERCLEANFILES = ChangeLog + +if MAINTAINER_MODE + +.PHONY: ChangeLog +ChangeLog: + $(CVS2CL) -W 450 --header $(srcdir)/cvs2cl_header --utc -w -I ChangeLog --usermap $(srcdir)/cvs2cl_usermap -P + +ACLOCAL_AMFLAGS=-I . + +endif + + + + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..7a1298e --- /dev/null +++ b/Makefile.in @@ -0,0 +1,676 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +############################################################################## +# $Id: Makefile.am,v 1.14 2008/12/25 17:01:50 rockyb Exp $ +# Copyright (C) 2003, 2004, 2006, 2008 Rocky Bernstein +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +############################################################################## + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/post-configure.in \ + $(srcdir)/ps-watcher.in.in $(top_srcdir)/configure AUTHORS \ + COPYING ChangeLog INSTALL NEWS THANKS TODO config.guess \ + config.sub install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = post-configure ps-watcher.in ps-watcher +am__installdirs = "$(DESTDIR)$(bindir)" +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) $(noinst_SCRIPTS) +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CVS2CL = @CVS2CL@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PS = @PS@ +PS_ARGS = @PS_ARGS@ +PS_ARGS_FMT = @PS_ARGS_FMT@ +PS_CAN_RETURN_MULTIPLE_LINES = @PS_CAN_RETURN_MULTIPLE_LINES@ +PS_CUSTOM_HEADER = @PS_CUSTOM_HEADER@ +PS_FULLCMD_FMT = @PS_FULLCMD_FMT@ +PS_NO_NULL_HEADER = @PS_NO_NULL_HEADER@ +PS_PID_OPTS = @PS_PID_OPTS@ +PS_TIME_VAR = @PS_TIME_VAR@ + +# The keeps automake from substituting PS_VARS +PS_VARS = '' +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = dist-bzip2 +SUBDIRS = docs tests +noinst_SCRIPTS = post-configure.in touch.pl +EXTRA_DIST = post-configure.in ps-watcher.in.in ps-watcher \ + touch.pl Makefile.PL \ + samples/README \ + samples/sample.ini \ + samples/sample2.ini \ + samples/port-watch.ini \ + samples/root-procs.ini \ + samples/solaris.ini + +bin_SCRIPTS = ps-watcher +DISTCLEANFILES = ps-watcher ps-watcher.stamp + +# cvs2cl +MAINTAINERCLEANFILES = ChangeLog +@MAINTAINER_MODE_TRUE@ACLOCAL_AMFLAGS = -I . +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +post-configure: $(top_builddir)/config.status $(srcdir)/post-configure.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +ps-watcher.in: $(top_builddir)/config.status $(srcdir)/ps-watcher.in.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +ps-watcher: $(top_builddir)/config.status ps-watcher.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: install-binSCRIPTS + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binSCRIPTS + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-binSCRIPTS + + +# Build all forms of documentation: manual-pages and HTML +test: + echo "Checking that things work.."; \ + (cd tests && $(PERL) ./driver) + +# A timestamp file is used to record whether or not we've created +# $(PROGRAM) from $(PROGRAM).in. During debugging if is often more +# convenient to modify $(PROGRAM) rather than $(PROGRAM).in. +$(PACKAGE).stamp: $(PACKAGE) + @cp -p $(PACKAGE) $(PACKAGE).in ; \ + $(srcdir)/touch.pl $@ + +@MAINTAINER_MODE_TRUE@.PHONY: ChangeLog +@MAINTAINER_MODE_TRUE@ChangeLog: +@MAINTAINER_MODE_TRUE@ $(CVS2CL) -W 450 --header $(srcdir)/cvs2cl_header --utc -w -I ChangeLog --usermap $(srcdir)/cvs2cl_usermap -P +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0f3aabc --- /dev/null +++ b/NEWS @@ -0,0 +1,96 @@ +Changes from 1.06 to 1.07 (December 25, 2008) +- Changed to include and tested on Darwin9 + +- A small number of bug fixes + +Changes from 1.05 to 1.06 (March 10, 2006) + +- Add minimal cygwin support; go over NetBSD and OpenBSD support + +- Add --path option to specify path used in running commands + +- ps-watcher wasn't terminating properly when given a signal. Thanks + to David G. Humes for noticing and fixing. + +- Modernize code a little bit. + +- Guard against unintialized variable conf_time + +- Add BUGS section to manual to describe common problems. + +- Add configure option to specify Perl location + + +Changes from 1.04 to 1.05 (May 18, 2005) + +- Allow $ps_pat to be used in an action. +- Show how to use PROLOG to do non-ps-like things such as watching a + port (via lsof). +- OS tweeks: NetBSD works like FreeBSD, Darwin 7 works. + +Changes from 1.03 to 1.04 (Jan 18, 2004) + +- Add $PROLOG, $EPILOG and perl-action sections. Allows one to + accumulate information over all processes and take action on that. + +- ps-variable order in GNU/Linux was changed to ensure that single-token + attributes don't get messed up by multiple-token attributes. + +Changes from 1.02 to 1.03 (Nov 22, 2003) + +- Add occurs=first-trigger to stop after first trigger rather than first + pattern match. + +Changes from 1.01 to 1.02 (Sept 10, 2003) + Small bug fixes/feature enhancements and documentation fixes. + +Changes from 1.0 to 1.01 (Aug 21, 2003) + +- Log output (not syslog) now contains timestamp, program and process name + +- Errors concerning getting ps information logged only at debug levels + +- Add -w to perl invocation. + +Changes from 0.99 to 1.0 (Jul 10, 2003) + Provision for ps returning multiple lines of output. (Solaris does this for + LWP processes) + make "make distcheck" work. + +Changes from 0.98 to 0.99: (May 19, 2003) + Add AIX support, accomodate Darwin6. + +Changes from 0.97 to 0.98: (Mar 5, 2003) + Works now on BSD/OS and Mac OS/X + Bug fix for FreeBSD. + Convert to use automake + +Changes from 0.96 to 0.97: (Mar 1, 2003) + Portablity fixes - Now runs on FreeBSD. + Tested on the sourceforge compile farm. + Add $args variable to be able to use full ps command. Useful for working + with scripts that list the interpreter rather than the script name. + +Changes from 0.95 to 0.96: + Bug in running make dist. + + Small documentation bug in manual and HTML. Had @PROGRAM@ rather than + @PACKAGE@ so name of package was not in man/html. + + Give example where you want to match all processes except one. + + Print out errors in configuration file + + configure.in -> configure.ac (thanks, autoconf) + + Config::IniConf now gives a syntax error for empty section: []. + Change that. + + +Changes 0.93 - 0.95 + +Make "occurs = none" mean to run if there are no matching ps processes. + +ps-watcher 0.93 -- first general release. + +$Id: NEWS,v 1.28 2008/12/25 16:39:17 rockyb Exp $ diff --git a/README b/README new file mode 100644 index 0000000..ddcecb9 --- /dev/null +++ b/README @@ -0,0 +1,41 @@ +This directory holds the distribution for ps-watcher, a program for +montoring a system via ps-like commands. + +Short instructions. Type: + cd ps-watcher-* + make + +If make fails you probably need to get IniConf. It it works then... + + ./ps-watcher --nosyslog --log --config ./samples/sample.ini + +Read the documentation to understand what you did. + +---- + +Documentation is in docs directory. + +All of the source code is covered by the GNU GENERAL PUBLIC +LICENSE. See COPYING for details on this. + +To use the program you will need Perl version 5.003 or greater +installed and the following modules: + + Sys::Syslog + File::Basename + Config::IniFiles + Getopt::Long + +The only one of these that is not part of the core Perl distribution +is Config::IniFiles which can be found at: + +http://www.cpan.org/modules/by-module/Config/ + +In order to run the program you'll need a configuration file to +use. Some samples configuration files can be found in the samples +directory. See the README in that directory for a description of +what the configuration files do. + +See INSTALL for generic GNU configure instructions. + +$Id: README,v 1.7 2003/05/16 00:12:59 rockyb Exp $ diff --git a/THANKS b/THANKS new file mode 100644 index 0000000..3243bdf --- /dev/null +++ b/THANKS @@ -0,0 +1,29 @@ +Thanks to various people I worked with at the Associated Press who +have made suggestions. + +This program uses Config::IniFiles (originally called IniConf). Thus +thanks are due to Scott Hutton. Rich Bowen (rbowen@rcbowen.com) now +maintains Config::IniFiles and incorporated my changes to the program that +allow regular expressions to be specified in "section" heads. + +Dave Humes - reporting regression between 1.04 and 1.05 in termination +code and why. + +James R Grinter suggested and provided code to allow the +program to fire when no matching processes (e.g. when a process that +should be running has died). + +Thanks to Jason Welsh for helping to track down +a Solaris problem where ps returned multiple lines of output. + +Thanks to Iñaki Sánchez for the patch that allows one to use $ps_pat in +the action statement. + +Musicological supervision by Stuart Frankel , +cutrate Ph.D. + +$Id: THANKS,v 1.8 2006/03/08 19:17:33 rockyb Exp $ + + + + diff --git a/TODO b/TODO new file mode 100644 index 0000000..6e5268b --- /dev/null +++ b/TODO @@ -0,0 +1,12 @@ +AIX and Linux ps allow custom output lines which means we can enclose +fields in quotes and thus allow variables which have embedded +blanks. Should make use of that. + +For now we only can handle one configuration file. Should allow many. + +Use IPC::Open3? -- it preserves STDERR and STDOUT. Backtick (`cmd`) +doesn't seem to. + +Add more regression tests. + +$Id: TODO,v 1.7 2003/07/10 11:50:21 rockyb Exp $ diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..c9daa48 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,618 @@ +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.10' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.10.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 13 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.60])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..ba058df --- /dev/null +++ b/config.guess @@ -0,0 +1,1354 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-07-23' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $files ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; +unset files' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; + esac + fi + rm -f $dummy.s $dummy && rmdir $tmpdir + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy && rmdir $tmpdir + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..de1aaee --- /dev/null +++ b/config.sub @@ -0,0 +1,1410 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-08-13' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ + | mipsle-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..0eecd2a --- /dev/null +++ b/configure @@ -0,0 +1,3758 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.61. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="ps-watcher.in.in" +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +am__isrc +CYGPATH_W +PACKAGE +VERSION +ACLOCAL +AUTOCONF +AUTOMAKE +AUTOHEADER +MAKEINFO +install_sh +STRIP +INSTALL_STRIP_PROGRAM +mkdir_p +AWK +SET_MAKE +am__leading_dot +AMTAR +am__tar +am__untar +CVS2CL +MAINTAINER_MODE_TRUE +MAINTAINER_MODE_FALSE +MAINT +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +LN_S +PERL +PS +PS_ARGS +PS_ARGS_FMT +PS_FULLCMD_FMT +PS_NO_NULL_HEADER +PS_CAN_RETURN_MULTIPLE_LINES +PS_CUSTOM_HEADER +PS_PID_OPTS +PS_TIME_VAR +PS_VARS +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-perl set path to Perl + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.61 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.61. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +am__api_version='1.10' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm -f conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 +echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } +if test -z "$MKDIR_P"; then + if test "${ac_cv_path_mkdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done +done +IFS=$as_save_IFS + +fi + + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version + MKDIR_P="$ac_install_sh -d" + fi +fi +{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5 +echo "${ECHO_T}$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=ps-watcher + VERSION=1.07 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + + +CVS2CL=${CVS2CL-"${am_missing_run}cvs2cl"} + +{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } + +{ echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6; } +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6; } +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } +fi + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + { echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6; } +fi + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + + +# Check whether --with-perl was given. +if test "${with_perl+set}" = set; then + withval=$with_perl; PERL=$withval +fi + + +## We use a path for perl so the #! line in autoscan will work. +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no" + ;; +esac +fi +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { echo "$as_me:$LINENO: result: $PERL" >&5 +echo "${ECHO_T}$PERL" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +if test "$PERL" = no; then + { { echo "$as_me:$LINENO: error: Pssst... you need perl in order to use this program.\ + Install it or put it in your path and try again." >&5 +echo "$as_me: error: Pssst... you need perl in order to use this program.\ + Install it or put it in your path and try again." >&2;} + { (exit 1); exit 1; }; } +fi + + +# Extract the first word of "ps", so it can be a program name with args. +set dummy ps; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PS in + [\\/]* | ?:[\\/]*) + ac_cv_path_PS="$PS" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PS="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PS" && ac_cv_path_PS="no" + ;; +esac +fi +PS=$ac_cv_path_PS +if test -n "$PS"; then + { echo "$as_me:$LINENO: result: $PS" >&5 +echo "${ECHO_T}$PS" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +## PS_ARGS gives how we get the command line for a given PID. Also see +## description for PS_VARS. + + + + + +## PS_NO_NULL_HEADER indicates that we can't get rid of the PS header line + + +## PS_CAN_RETURN_MULTIPLE_LINES indicates the ps on this OS can return +## multiple lines for a process. Solaris's ps does this for processes +## which have many lwp (light-weight processes). + + +## PS_CUSTOM_HEADER specifies whether we can put an = after the argument +## name to remove the header for that variable + + +## PS_PID_OPTS gives how to get the pid and command name needed for +##l first-level breakout. + + +## PS_TIME_VAR gives a variable that we can test time on + + +## PS_VAR gives a list of the PS variables we can query. +## However we must use only those variables that give output as a single +## token since these are parsed one token per variable. For example +## the arguments (args, or comm, or command) shouldn't be listed here. + + +## ======================================================================== +## Need a better way to figure out ps options and to know +## which ones don't have embeded blanks or to parse ps output. +## ======================================================================== +PS_ARGS_FMT='' +PS_FULLCMD_FMT='' +PS_TIME_VAR='' + +case "$host_os" in + aix* ) + PS_ARGS='-o args=' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=1 + PS_NO_NULL_HEADER=0 + PS_PID_OPTS='-e -o pid= -o comm=' + PS_TIME_VAR='etime' + PS_VARS='user ruser group rgroup uid ruid gid rgid ppid +pgid pri cpu pcpu pmem vsz nice class scount thcount tid time +etime tty wchan bnd' + ;; + cygwin* ) + PS_ARGS='-l | cut -c 2-10,56-120' + PS_ARGS_FMT='$opts{ps_prog} -l |cut -c 2-10,56-120|egrep \"^[ \\t]*%d\"' + PS_FULLCMD_FMT='$opts{ps_prog} -l|cut -c 2-47,56-120|egrep \"^[ \\t]*%d\"' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-l | cut -c 2-10,56-120' + PS_VARS='pid ppid pgid winpid tty uid' + ;; + solaris* ) + PS_ARGS='-o args=' + PS_CAN_RETURN_MULTIPLE_LINES=1 + PS_CUSTOM_HEADER=1 + PS_NO_NULL_HEADER=0 + PS_PID_OPTS='-e -o pid= -o comm=' + PS_TIME_VAR='etime' + PS_VARS='user ruser group rgroup uid ruid gid rgid ppid +pgid sid pri pcpu pmem vsz rss osz nice class time +etime stime f s lwp nlwp psr tty addr wchan fname' + ;; + linux* ) + PS_ARGS='-www -o args=' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=1 + PS_NO_NULL_HEADER=0 + PS_PID_OPTS='-e -o pid= -o cmd=' + # Make sure we put known single tokens at the beginning like uid. + PS_VARS='uid euid ruid gid egid rgid alarm blocked bsdtime c caught +cputime drs dsiz egroup eip esp etime euser f fgid +fgroup flag flags fname fsgid fsgroup fsuid fsuser fuid fuser +group ignored intpri lim longtname m_drs m_trs maj_flt majflt +min_flt minflt ni nice nwchan opri pagein pcpu pending pgid pgrp +pmem ppid pri rgroup rss rssize rsz ruser s sess session +sgi_p sgi_rss sgid sgroup sid sig sig_block sig_catch sig_ignore +sig_pend sigcatch sigignore sigmask stackp start start_stack start_time +stat state stime suid suser svgid svgroup svuid svuser sz time timeout +tmout tname tpgid trs trss tsiz tt tty tty4 tty8 uid_hack uname +user vsize vsz wchan' + PS_TIME_VAR='etime' + ;; + netbsdelf2* | openbsd* ) + PS_ARGS='-o args' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-a -x -o pid= -o ucomm=' + PS_VARS='acflag cpu f \ +inblk jobc ktrace ktracep lim login majflt minflt msgrcv +msgsnd nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pagein pid ppid pri re rgid rlink rss rsz +ruid ruser sess sig sigcatch sigignore sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user vsz +wchan xstat' + PS_TIME_VAR='cpu' + ;; + netbsd* | freebsd4* ) + PS_ARGS='-O command' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-a -x -o pid= -o ucomm=' + PS_VARS='acflag cpu cputime f +inblk jobc ktrace ktracep lim login majflt minflt msgrcv +msgsnd nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pagein pid ppid pri re rgid rlink rss rsz +ruid ruser sess sig sigcatch sigignore sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user vsz +wchan xstat' + PS_TIME_VAR='cputime' + ;; + bsdi4* ) + PS_ARGS='-www -o command' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-a -x -o pid= -o ucomm=' + PS_TIME_VAR='cputime' + PS_VARS='acflag cpu cputime f \ +inblk jobc ktrace ktracep lim login +nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pagein pid ppid pri re rgid rlink rss rsz +ruid ruser sess sig sigcatch sigignore sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user vsz +wchan xstat' + ;; + darwin5* | darwin6* | darwin7* | darwin8* | darwin9* ) + PS_PID_OPTS='-a -x -o pid= -o ucomm' + PS_VARS='acflag cpu cputime f +inblk jobc ktrace ktracep lim login uid upr user vsz +nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pcpu pagein pid ppid pri re rgid rss rsz +ruid ruser sess sig sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm +wchan xstat' + PS_TIME_VAR='cputime' + PS_ARGS='-www -o command' + PS_NO_NULL_HEADER=1 + PS_CUSTOM_HEADER=0 + PS_CAN_RETURN_MULTIPLE_LINES=0 + ;; + * ) + echo "Don't know $host_os. Winging it." + PS_ARGS='' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-e -o pid= -o comm=' + PS_VARS='user ruser group rgroup uid ruid gid rgid ppid \ +pgid sid pri pcpu pmem vsz rss osz nice class time \ +etime stime tty addr wchan fname' + PS_TIME_VAR='etime' +esac + +ac_config_files="$ac_config_files post-configure" + +ac_config_files="$ac_config_files tests/01.pod.t" + +ac_config_files="$ac_config_files tests/args.t" + +ac_config_files="$ac_config_files tests/basic.t" + +ac_config_files="$ac_config_files tests/count.t" + +ac_config_files="$ac_config_files tests/full.t" + +ac_config_files="$ac_config_files ps-watcher.in" + +ac_config_files="$ac_config_files ps-watcher" + + +ac_config_files="$ac_config_files Makefile docs/Makefile tests/basic.cnf tests/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.61. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "post-configure") CONFIG_FILES="$CONFIG_FILES post-configure" ;; + "tests/01.pod.t") CONFIG_FILES="$CONFIG_FILES tests/01.pod.t" ;; + "tests/args.t") CONFIG_FILES="$CONFIG_FILES tests/args.t" ;; + "tests/basic.t") CONFIG_FILES="$CONFIG_FILES tests/basic.t" ;; + "tests/count.t") CONFIG_FILES="$CONFIG_FILES tests/count.t" ;; + "tests/full.t") CONFIG_FILES="$CONFIG_FILES tests/full.t" ;; + "ps-watcher.in") CONFIG_FILES="$CONFIG_FILES ps-watcher.in" ;; + "ps-watcher") CONFIG_FILES="$CONFIG_FILES ps-watcher" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; + "tests/basic.cnf") CONFIG_FILES="$CONFIG_FILES tests/basic.cnf" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +am__isrc!$am__isrc$ac_delim +CYGPATH_W!$CYGPATH_W$ac_delim +PACKAGE!$PACKAGE$ac_delim +VERSION!$VERSION$ac_delim +ACLOCAL!$ACLOCAL$ac_delim +AUTOCONF!$AUTOCONF$ac_delim +AUTOMAKE!$AUTOMAKE$ac_delim +AUTOHEADER!$AUTOHEADER$ac_delim +MAKEINFO!$MAKEINFO$ac_delim +install_sh!$install_sh$ac_delim +STRIP!$STRIP$ac_delim +INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim +mkdir_p!$mkdir_p$ac_delim +AWK!$AWK$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +am__leading_dot!$am__leading_dot$ac_delim +AMTAR!$AMTAR$ac_delim +am__tar!$am__tar$ac_delim +am__untar!$am__untar$ac_delim +CVS2CL!$CVS2CL$ac_delim +MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim +MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim +MAINT!$MAINT$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +LN_S!$LN_S$ac_delim +PERL!$PERL$ac_delim +PS!$PS$ac_delim +PS_ARGS!$PS_ARGS$ac_delim +PS_ARGS_FMT!$PS_ARGS_FMT$ac_delim +PS_FULLCMD_FMT!$PS_FULLCMD_FMT$ac_delim +PS_NO_NULL_HEADER!$PS_NO_NULL_HEADER$ac_delim +PS_CAN_RETURN_MULTIPLE_LINES!$PS_CAN_RETURN_MULTIPLE_LINES$ac_delim +PS_CUSTOM_HEADER!$PS_CUSTOM_HEADER$ac_delim +PS_PID_OPTS!$PS_PID_OPTS$ac_delim +PS_TIME_VAR!$PS_TIME_VAR$ac_delim +PS_VARS!$PS_VARS$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 85; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + + + case $ac_file$ac_mode in + "post-configure":F) chmod +x post-configure ;; + "tests/01.pod.t":F) chmod +x tests/01.pod.t ;; + "tests/args.t":F) chmod +x tests/args.t ;; + "tests/basic.t":F) chmod +x tests/basic.t ;; + "tests/count.t":F) chmod +x tests/count.t ;; + "tests/full.t":F) chmod +x tests/full.t ;; + "ps-watcher":F) ./post-configure $srcdir || exit 3 ;; + + esac +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..7827f85 --- /dev/null +++ b/configure.ac @@ -0,0 +1,236 @@ +dnl +dnl Require autoconf version 2.50 or greater +dnl +dnl Copyright (C) 2004, 2006, 2008 Rocky Bernstein +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +dnl 02110-1301 USA. + +dnl $Id: configure.ac,v 1.43 2008/12/25 16:42:49 rockyb Exp $ +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(ps-watcher.in.in) +AM_INIT_AUTOMAKE(ps-watcher,1.07) + +AM_MISSING_PROG(CVS2CL, cvs2cl, $missing_dir) +AM_MAINTAINER_MODE +AC_CANONICAL_HOST + +AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. + +dnl ============================= +dnl Checks for programs. +dnl ============================= +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET + +AC_ARG_WITH(perl, AC_HELP_STRING([--with-perl], + [set path to Perl]), PERL=$withval) + +## We use a path for perl so the #! line in autoscan will work. +AC_PATH_PROG(PERL, perl, no) + +if test "$PERL" = no; then + AC_MSG_ERROR(Pssst... you need perl in order to use this program.\ + Install it or put it in your path and try again.) +fi + +AC_SUBST(PERL)dnl + +AC_PATH_PROG(PS, ps, no) +AC_SUBST(PS)dnl + +## PS_ARGS gives how we get the command line for a given PID. Also see +## description for PS_VARS. +AC_SUBST(PS_ARGS) + +AC_SUBST(PS_ARGS_FMT) +AC_SUBST(PS_FULLCMD_FMT) + +## PS_NO_NULL_HEADER indicates that we can't get rid of the PS header line +AC_SUBST(PS_NO_NULL_HEADER) + +## PS_CAN_RETURN_MULTIPLE_LINES indicates the ps on this OS can return +## multiple lines for a process. Solaris's ps does this for processes +## which have many lwp (light-weight processes). +AC_SUBST(PS_CAN_RETURN_MULTIPLE_LINES) + +## PS_CUSTOM_HEADER specifies whether we can put an = after the argument +## name to remove the header for that variable +AC_SUBST(PS_CUSTOM_HEADER) + +## PS_PID_OPTS gives how to get the pid and command name needed for +##l first-level breakout. +AC_SUBST(PS_PID_OPTS) + +## PS_TIME_VAR gives a variable that we can test time on +AC_SUBST(PS_TIME_VAR) + +## PS_VAR gives a list of the PS variables we can query. +## However we must use only those variables that give output as a single +## token since these are parsed one token per variable. For example +## the arguments (args, or comm, or command) shouldn't be listed here. +AC_SUBST(PS_VARS) + +## ======================================================================== +## Need a better way to figure out ps options and to know +## which ones don't have embeded blanks or to parse ps output. +## ======================================================================== +PS_ARGS_FMT='' +PS_FULLCMD_FMT='' +PS_TIME_VAR='' + +case "$host_os" in + aix* ) + PS_ARGS='-o args=' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=1 + PS_NO_NULL_HEADER=0 + PS_PID_OPTS='-e -o pid= -o comm=' + PS_TIME_VAR='etime' + PS_VARS='user ruser group rgroup uid ruid gid rgid ppid +pgid pri cpu pcpu pmem vsz nice class scount thcount tid time +etime tty wchan bnd' + ;; + cygwin* ) + PS_ARGS='-l | cut -c 2-10,56-120' + PS_ARGS_FMT=['$opts{ps_prog} -l |cut -c 2-10,56-120|egrep \"^[ \\t]*%d\"'] + PS_FULLCMD_FMT=['$opts{ps_prog} -l|cut -c 2-47,56-120|egrep \"^[ \\t]*%d\"'] + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-l | cut -c 2-10,56-120' + PS_VARS='pid ppid pgid winpid tty uid' + ;; + solaris* ) + PS_ARGS='-o args=' + PS_CAN_RETURN_MULTIPLE_LINES=1 + PS_CUSTOM_HEADER=1 + PS_NO_NULL_HEADER=0 + PS_PID_OPTS='-e -o pid= -o comm=' + PS_TIME_VAR='etime' + PS_VARS='user ruser group rgroup uid ruid gid rgid ppid +pgid sid pri pcpu pmem vsz rss osz nice class time +etime stime f s lwp nlwp psr tty addr wchan fname' + ;; + linux* ) + PS_ARGS='-www -o args=' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=1 + PS_NO_NULL_HEADER=0 + PS_PID_OPTS='-e -o pid= -o cmd=' + # Make sure we put known single tokens at the beginning like uid. + PS_VARS='uid euid ruid gid egid rgid alarm blocked bsdtime c caught +cputime drs dsiz egroup eip esp etime euser f fgid +fgroup flag flags fname fsgid fsgroup fsuid fsuser fuid fuser +group ignored intpri lim longtname m_drs m_trs maj_flt majflt +min_flt minflt ni nice nwchan opri pagein pcpu pending pgid pgrp +pmem ppid pri rgroup rss rssize rsz ruser s sess session +sgi_p sgi_rss sgid sgroup sid sig sig_block sig_catch sig_ignore +sig_pend sigcatch sigignore sigmask stackp start start_stack start_time +stat state stime suid suser svgid svgroup svuid svuser sz time timeout +tmout tname tpgid trs trss tsiz tt tty tty4 tty8 uid_hack uname +user vsize vsz wchan' + PS_TIME_VAR='etime' + ;; + netbsdelf2* | openbsd* ) + PS_ARGS='-o args' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-a -x -o pid= -o ucomm=' + PS_VARS='acflag cpu f \ +inblk jobc ktrace ktracep lim login majflt minflt msgrcv +msgsnd nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pagein pid ppid pri re rgid rlink rss rsz +ruid ruser sess sig sigcatch sigignore sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user vsz +wchan xstat' + PS_TIME_VAR='cpu' + ;; + netbsd* | freebsd4* ) + PS_ARGS='-O command' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-a -x -o pid= -o ucomm=' + PS_VARS='acflag cpu cputime f +inblk jobc ktrace ktracep lim login majflt minflt msgrcv +msgsnd nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pagein pid ppid pri re rgid rlink rss rsz +ruid ruser sess sig sigcatch sigignore sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user vsz +wchan xstat' + PS_TIME_VAR='cputime' + ;; + bsdi4* ) + PS_ARGS='-www -o command' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-a -x -o pid= -o ucomm=' + PS_TIME_VAR='cputime' + PS_VARS='acflag cpu cputime f \ +inblk jobc ktrace ktracep lim login +nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pagein pid ppid pri re rgid rlink rss rsz +ruid ruser sess sig sigcatch sigignore sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user vsz +wchan xstat' + ;; + darwin5* | darwin6* | darwin7* | darwin8* | darwin9* ) + PS_PID_OPTS='-a -x -o pid= -o ucomm' + PS_VARS='acflag cpu cputime f +inblk jobc ktrace ktracep lim login uid upr user vsz +nice nivcsw nsigs nswap nvcsw nwchan oublk p_ru +paddr pcpu pagein pid ppid pri re rgid rss rsz +ruid ruser sess sig sigmask sl start state +svgid svuid tdev time tpgid tsess tsiz tt tty ucomm +wchan xstat' + PS_TIME_VAR='cputime' + PS_ARGS='-www -o command' + PS_NO_NULL_HEADER=1 + PS_CUSTOM_HEADER=0 + PS_CAN_RETURN_MULTIPLE_LINES=0 + ;; + * ) + echo "Don't know $host_os. Winging it." + PS_ARGS='' + PS_CAN_RETURN_MULTIPLE_LINES=0 + PS_CUSTOM_HEADER=0 + PS_NO_NULL_HEADER=1 + PS_PID_OPTS='-e -o pid= -o comm=' + PS_VARS='user ruser group rgroup uid ruid gid rgid ppid \ +pgid sid pri pcpu pmem vsz rss osz nice class time \ +etime stime tty addr wchan fname' + PS_TIME_VAR='etime' +esac + +AC_CONFIG_FILES([post-configure], [chmod +x post-configure]) +AC_CONFIG_FILES([tests/01.pod.t], [chmod +x tests/01.pod.t]) +AC_CONFIG_FILES([tests/args.t], [chmod +x tests/args.t]) +AC_CONFIG_FILES([tests/basic.t], [chmod +x tests/basic.t]) +AC_CONFIG_FILES([tests/count.t], [chmod +x tests/count.t]) +AC_CONFIG_FILES([tests/full.t], [chmod +x tests/full.t]) +AC_CONFIG_FILES([ps-watcher.in]) +AC_CONFIG_FILES([ps-watcher], [./post-configure $srcdir || exit 3]) + +AC_OUTPUT([ + Makefile \ + docs/Makefile \ + tests/basic.cnf \ + tests/Makefile \ +]) diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000..8ea8713 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,40 @@ +############################################################################## +# $Id: Makefile.am,v 1.8 2005/05/17 09:53:00 rockyb Exp $ +# Copyright (C) 2003, 2004 Rocky Bernstein +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################## + +# Section 8 is system administration +EXT=8 +man8_MANS = $(PACKAGE).$(EXT) + +MOSTLYCLEANFILES = *~ $(man8_MANS) $(PACKAGE).html +EXTRA_DIST = $(man8_MANS) $(PACKAGE).html +DISTCLEANFILES = pod2htmi.tmp pod2htmd.tmp + +# The keeps automake from substituting PS_VARS +PS_VARS = '' + +# Files making up the documentation part of this package +DOCS = $(man_MANS) $(PACKAGE).html + +# THIS SHOULD BE THE FIRST TARGET! +all: $(DOCS) Makefile + +$(PACKAGE).html: ../$(PACKAGE).in + -pod2html --infile=../$(PACKAGE).in --outfile=$@ + +$(man8_MANS): ../$(PACKAGE).in + -pod2man --section=$(EXT) --name=$(PACKAGE) ../$(PACKAGE).in >$@ diff --git a/docs/Makefile.in b/docs/Makefile.in new file mode 100644 index 0000000..b37963b --- /dev/null +++ b/docs/Makefile.in @@ -0,0 +1,394 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +############################################################################## +# $Id: Makefile.am,v 1.8 2005/05/17 09:53:00 rockyb Exp $ +# Copyright (C) 2003, 2004 Rocky Bernstein +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################## +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = docs +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +man8dir = $(mandir)/man8 +am__installdirs = "$(DESTDIR)$(man8dir)" +NROFF = nroff +MANS = $(man8_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CVS2CL = @CVS2CL@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PS = @PS@ +PS_ARGS = @PS_ARGS@ +PS_ARGS_FMT = @PS_ARGS_FMT@ +PS_CAN_RETURN_MULTIPLE_LINES = @PS_CAN_RETURN_MULTIPLE_LINES@ +PS_CUSTOM_HEADER = @PS_CUSTOM_HEADER@ +PS_FULLCMD_FMT = @PS_FULLCMD_FMT@ +PS_NO_NULL_HEADER = @PS_NO_NULL_HEADER@ +PS_PID_OPTS = @PS_PID_OPTS@ +PS_TIME_VAR = @PS_TIME_VAR@ + +# The keeps automake from substituting PS_VARS +PS_VARS = '' +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ + +# Section 8 is system administration +EXT = 8 +man8_MANS = $(PACKAGE).$(EXT) +MOSTLYCLEANFILES = *~ $(man8_MANS) $(PACKAGE).html +EXTRA_DIST = $(man8_MANS) $(PACKAGE).html +DISTCLEANFILES = pod2htmi.tmp pod2htmd.tmp + +# Files making up the documentation part of this package +DOCS = $(man_MANS) $(PACKAGE).html +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu docs/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-man8: $(man8_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \ + done +uninstall-man8: + @$(NORMAL_UNINSTALL) + @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 8*) ;; \ + *) ext='8' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man8dir)/$$inst"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man8dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: install-man8 + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man8 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-man8 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-man uninstall-man8 + + +# THIS SHOULD BE THE FIRST TARGET! +all: $(DOCS) Makefile + +$(PACKAGE).html: ../$(PACKAGE).in + -pod2html --infile=../$(PACKAGE).in --outfile=$@ + +$(man8_MANS): ../$(PACKAGE).in + -pod2man --section=$(EXT) --name=$(PACKAGE) ../$(PACKAGE).in >$@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/docs/ps-watcher.8 b/docs/ps-watcher.8 new file mode 100644 index 0000000..d5aff24 --- /dev/null +++ b/docs/ps-watcher.8 @@ -0,0 +1,740 @@ +.\" Automatically generated by Pod::Man 2.17 (Pod::Simple 3.07) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\&\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "ps-watcher 8" +.TH ps-watcher 8 "2008-12-25" "perl v5.8.8" "User Contributed Perl Documentation" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +ps\-watcher \- monitors various processes based on ps\-like information. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fBps-watcher\fR [\fIoptions\fR...] + [\f(CW\*(C`\-\-config\*(C'\fR] \fIconfig-file\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +Periodically a list of processes obtained via \f(CW\*(C`ps\*(C'\fR. More precisely +each item in the list contains the process name (just what's listed in +the \*(L"cmd\*(R" field, not the full command and arguments) and its process +id (pid). A configuration file specifies a list of Perl +regular-expression patterns to match the processes against. For each +match, a Perl expression specified for that pattern is evaluated. The +evaluated expression can refer to variables which are set by ps and +pertain to the matched process(es), for example the amount memory +consumed by the process, or the total elapsed time. Some other +variables are set by the program, such as the number of times the +process is running. If the Perl expression for a matched pattern +evaluates true, then an action can be run such as killing the program, +restarting it, or mailing an alert, or running some arbitrary Perl +code. +.PP +Some things you might want to watch a daemon or process for: +.IP "\(bu" 2 +check that it is running (hasn't died) +.IP "\(bu" 2 +ensure it is not running too many times +.IP "\(bu" 2 +isn't consuming too much memory (perhaps a memory leak), or I/O +.PP +Some actions you might want to take: +.IP "\(bu" 2 +restart a process +.IP "\(bu" 2 +kill off rampant processes +.IP "\(bu" 2 +send an alert about any of the conditions listed above +.PP +Depending on options specfied, this program can be run as a daemon, +run once (which is suitable as a \f(CW\*(C`cron\*(C'\fR job), or run not as a daemon +but still continuously (which may be handy in testing the program or +your configuration). +.Sh "\s-1OPTIONS\s0" +.IX Subsection "OPTIONS" +.IP "\-\-help" 4 +.IX Item "--help" +Print a usage message on standard error and exit with a return code +of 100. +.Sp + +.IP "\-\-doc" 4 +.IX Item "--doc" +Extact the full documentation that you are reading now, print it and +exit with a return code of 101. +.Sp + +.IP "\-\-version" 4 +.IX Item "--version" +Print the version release on standard output and exit with a return +code of 10. +.Sp + +.IP "\-\-debug \fInumber\fR" 4 +.IX Item "--debug number" +Give debugging output. The higher the number, the more the output. The +default is 0 = none. 2 is the most debugging output. +.IP "[\-\-config] \fIconfiguration file\fR" 4 +.IX Item "[--config] configuration file" +Specify configuration file. . +.Sp +See \*(L"\s-1CONFIGURATION\s0 \s-1FILE\s0 \s-1FORMAT\s0\*(R" below for information on the format +of the configuration file and \*(L"\s-1EXAMPLE\s0 \s-1CONFIGURATION\s0\*(R" for a complete +example of a configuration file. +.Sp + +.IP "\-\-log [\fIlog file\fR]" 4 +.IX Item "--log [log file]" +Send or don't send error and debugging output to a log file. If option +is given but no logfile is specified, then use \s-1STDERR\s0. The default is +no error log file. See also \-\-syslog below. +.Sp + +.IP "\-\-syslog | \-\-nosyslog" 4 +.IX Item "--syslog | --nosyslog" +Send or don't send error and debugging output to syslog. The default +is to syslog error and debug output. +.Sp + +.IP "\-\-daemon | \-\-nodaemon" 4 +.IX Item "--daemon | --nodaemon" +Run or don't as a daemon. +.Sp + +.IP "\-\-path \fIsearch-path\fR" 4 +.IX Item "--path search-path" +Specify the executable search path used in running commands. +.IP "\-\-ps\-prog \fIprogram\fR" 4 +.IX Item "--ps-prog program" +One can specify the command that gives ps information. By default, the +command is \fI/bin/ps\fR. +.Sp + +.IP "\-\-run | \-\-norun" 4 +.IX Item "--run | --norun" +do/don't run actions go through the motions as though we were going +to. This may be useful in debugging. +.Sp + +.IP "\-\-sleep \fIinterval in seconds\fR" 4 +.IX Item "--sleep interval in seconds" +It is expected that one might want to run ps-watcher over and over +again. In such instances one can specify the amount of time between +iterations with this option. +.Sp +If a negative number is specified the program is run only once. +.Sp + +.Sh "\s-1CONFIGURATION\s0 \s-1FILE\s0 \s-1MODIFICATION\s0 \s-1AND\s0 \s-1SIGNAL\s0 \s-1HANDLING\s0" +.IX Subsection "CONFIGURATION FILE MODIFICATION AND SIGNAL HANDLING" +Periodically ps-watcher checks to see if the configuration file +that it was run against has changed. If so, the program rereads the +configuration file. +.PP +More precisely, the checks are done after waking up from a slumber. +If the sleep interval is long (or if you are impatient), you can +probably force the program to wake up using a \s-1HUP\s0 signal. +.PP +At any time you can increase the level of debug output by sending a +\&\s-1USR1\s0 signal to the ps-watcher process. Similarly you can decrease the +level of debug output by sending the process a \s-1USR2\s0 signal. +.PP +It is recommended that you terminate ps-watcher via an \s-1INT\s0, \s-1TERM\s0, or \s-1QUIT\s0 +signal. +.SH "CONFIGURATION FILE FORMAT" +.IX Header "CONFIGURATION FILE FORMAT" +The format of a configuration file is a series of fully qualified +filenames enclosed in square brackets followed by a number of +parameter lines. Each parameter line has a parameter name followed by +an \*(L"equal\*(R" sign and finally value. That is: +.PP +.Vb 5 +\& # This is a comment line +\& ; So is this. +\& [process\-pattern1] +\& parameter1 = value1 +\& parameter2 = value2 +\& +\& [process\-pattern2] +\& parameter1 = value3 +\& parameter2 = value4 +.Ve +.PP +Comments start with # or ; and take effect to the end of the line. +.PP +This should be familiar to those who have worked with text-readible +Microsoft \f(CW\*(C`.INI\*(C'\fR files. +.PP +Note process patterns, (\fIprocess\-pattern1\fR and \fIprocess\-pattern2\fR +above) must be unique. If there are times when you may want to +refer to the same process, one can be creative to make these unique. +e.g. \fIcron\fR and \fI[c]ron\fR which refer to the same process even +though they \fIappear\fR to be different. +.PP +As quoted directly from the Config::IniFiles documentation: +.PP +Multiline or multivalued fields may also be defined ala \s-1UNIX\s0 +\&\*(L"here document\*(R" syntax: +.PP +.Vb 4 +\& Parameter=< 1000 +\& occurs = every +\& action = echo "Large program $command matches $ps_pat: $vsz KB" +\& +\& # Fire if /usr/sbin/syslogd is not running. +\& # Since the program matches against the command names, not commands and +\& # arguments, something like: +\& # ps \-ef | grep /usr/sbin/syslogd +\& # won\*(Aqt match the below. +\& [(/usr/sbin/)?syslogd] +\& occurs = none +\& action = /etc/init.d/syslogd start +.Ve +.IP "action" 4 +.IX Item "action" +This specifies the action, a command that gets run by the system +shell, when the trigger condition is evaluated to be true. +.Sp +Example: +.Sp +.Vb 1 +\& action = /etc/init.d/market_loader.init restart +.Ve +.IP "perl-action" 4 +.IX Item "perl-action" +This specifies Perl statements to be eval'd. This can be especially +useful in conjunction with \f(CW$PROLOG\fR and \f(CW$EPILOG\fR sections to make tests +across collections of process and do things which ps-watcher +would otherwise not be able to do. +.Sp +Example: +.Sp +.Vb 5 +\& # A Perl variable initialization. +\& # Since ps\-watcher runs as a daemon it\*(Aqs a good idea +\& # to (re)initialize variables before each run. +\& [$PROLOG] +\& perl\-action = $root_procs=0; +\& +\& # Keep track of how many root processes we are running +\& [.*] +\& perl\-action = $root_procs++ if $uid == 0 +\& occurs = every +\& +\& # Show this count. +\& [$EPILOG] +\& action = echo "I counted $root_procs root processes" +.Ve +.Sh "\s-1EXPANDED\s0 \s-1VARIABLES\s0 \s-1IN\s0 \s-1TRIGGER/ACTION\s0 \s-1CLAUSES\s0" +.IX Subsection "EXPANDED VARIABLES IN TRIGGER/ACTION CLAUSES" +Any variables defined in the program can be used in pattern or +action parameters. For example, \f(CW$program\fR can be used to refer to +the name of this program ps-watcher. +.PP +The following variables can be used in either the pattern or action +fields. +.ie n .IP "$action" 4 +.el .IP "\f(CW$action\fR" 4 +.IX Item "$action" +A string containing the text of the action to run. +.Sp + +.ie n .IP "$perl_action" 4 +.el .IP "\f(CW$perl_action\fR" 4 +.IX Item "$perl_action" +A string containing the text of the perl_action to run. +.Sp + +.ie n .IP "$ps_pat" 4 +.el .IP "\f(CW$ps_pat\fR" 4 +.IX Item "$ps_pat" +The Perl regular expression specified in the beginning of the section. +.Sp + +.ie n .IP "$command" 4 +.el .IP "\f(CW$command\fR" 4 +.IX Item "$command" +The command that matched \f(CW$ps_pat\fR. +.Sp +The Perl regular expression specified in the beginning of the section. +Normally processes will not have funny characters in them. Just in +case, backticks in \f(CW$command\fR are escaped. +.Sp +Example: +.Sp +.Vb 2 +\& # List processes other than emacs (which is a known pig) that use lots +\& # of virtual memory +\& +\& [.*] +\& trigger = $command !~ /emacs$/ && $vsz > 10 +\& action = echo \e"Looks like you have a big \e$command program: \e$vsz KB\e" +.Ve +.Sp + +.ie n .IP "$count" 4 +.el .IP "\f(CW$count\fR" 4 +.IX Item "$count" +The number of times the pattern matched. Presumably the number of +processes of this class running. +.Sp + +.ie n .IP "$trigger" 4 +.el .IP "\f(CW$trigger\fR" 4 +.IX Item "$trigger" +A string containing the text of the trigger. +.PP +A list of variables specific to this program or fields commonly found in +\&\f(CW\*(C`ps\*(C'\fR output is listed below followed by a description of the more +common ones. See also \f(CW\*(C`ps\*(C'\fR for a more complete +description of the meaning of the field. +.PP +.Vb 11 +\& uid euid ruid gid egid rgid alarm blocked bsdtime c caught +\&cputime drs dsiz egroup eip esp etime euser f fgid +\&fgroup flag flags fname fsgid fsgroup fsuid fsuser fuid fuser +\&group ignored intpri lim longtname m_drs m_trs maj_flt majflt +\&min_flt minflt ni nice nwchan opri pagein pcpu pending pgid pgrp +\&pmem ppid pri rgroup rss rssize rsz ruser s sess session +\&sgi_p sgi_rss sgid sgroup sid sig sig_block sig_catch sig_ignore +\&sig_pend sigcatch sigignore sigmask stackp start start_stack start_time +\&stat state stime suid suser svgid svgroup svuid svuser sz time timeout +\&tmout tname tpgid trs trss tsiz tt tty tty4 tty8 uid_hack uname +\&user vsize vsz wchan +.Ve +.PP +Beware though, in some situations ps can return multiple lines for a +single process and we will use just one of these in the trigger. In +particular, Solaris's \f(CW\*(C`ps\*(C'\fR will return a line for each \s-1LWP\s0 (light-weight +process). So on Solaris, if a trigger uses variable lwp, it may or may +not match depending on which single line of the multiple \f(CW\*(C`ps\*(C'\fR lines is +used. +.PP + +.ie n .IP "$args" 4 +.el .IP "\f(CW$args\fR" 4 +.IX Item "$args" +The command along with its command arguments. It is possible that this +is might get truncated at certain length (if ps does likewise as is +the case on Solaris). +.Sp + +.ie n .IP "$ppid" 4 +.el .IP "\f(CW$ppid\fR" 4 +.IX Item "$ppid" +The parent process id. +.Sp + +.ie n .IP "$stime" 4 +.el .IP "\f(CW$stime\fR" 4 +.IX Item "$stime" +The start time of the process. +.Sp + +.ie n .IP "$etime" 4 +.el .IP "\f(CW$etime\fR" 4 +.IX Item "$etime" +The end time of the process. +.Sp + +.ie n .IP "$pmem" 4 +.el .IP "\f(CW$pmem\fR" 4 +.IX Item "$pmem" +The process memory. +.Sp + +.ie n .IP "$pcpu" 4 +.el .IP "\f(CW$pcpu\fR" 4 +.IX Item "$pcpu" +The percent \s-1CPU\s0 utilization. +.Sp + +.ie n .IP "$tty" 4 +.el .IP "\f(CW$tty\fR" 4 +.IX Item "$tty" +The controlling tty. +.Sp + +.ie n .IP "$vsz" 4 +.el .IP "\f(CW$vsz\fR" 4 +.IX Item "$vsz" +Virtual memory size of the process +.Sh "\s-1OTHER\s0 \s-1THINGS\s0 \s-1IN\s0 \s-1TRIGGER\s0 \s-1CLAUSES\s0" +.IX Subsection "OTHER THINGS IN TRIGGER CLAUSES" +To make testing against elapsed time easier, a function \f(CW\*(C`elapse2sec()\*(C'\fR +has been written to parse and convert elapsed time strings in the +format \f(CW\*(C`dd\-hh:mm:ss\*(C'\fR and a number of seconds. +.PP +Some constants for the number of seconds in a minute, hour, or day +have also been defined. These are referred to as \f(CW\*(C`MINS\*(C'\fR, \f(CW\*(C`HOURS\*(C'\fR, +and \f(CW\*(C`DAYS\*(C'\fR respectively and they have the expected definitions: +.PP +.Vb 3 +\& use constant MINS => 60; +\& use constant HOURS => 60*60; +\& use constant DAYS => HOURS * 24; +.Ve +.PP +Here is an example of the use of \f(CW\*(C`elapsed2sec()\*(C'\fR: +.PP +.Vb 7 +\& # Which processes have been running for more than 3 hours? +\& # Also note use of builtin\-function elapsed2secs, variable $etime +\& # and builtin\-function HOURS +\& [.] +\& trigger = elapsed2secs(\*(Aq$etime\*(Aq) > 1*DAYS +\& action = echo "$command has been running more than 1 day ($etime)" +\& occurs = every +.Ve +.PP +Please note the quotes around '$etime'. +.SH "EXAMPLE CONFIGURATION" +.IX Header "EXAMPLE CONFIGURATION" +.Vb 1 +\& # Comments start with # or ; and go to the end of the line. +\& +\& # The format for each entry is in Microsoft .INI form: +\& # [process\-pattern] +\& # trigger = perl\-expression +\& # action = program\-and\-arguments\-to\-run +\& +\& [httpd$] +\& trigger = $count < 4 +\& action = echo "$trigger fired \-\- You have $count httpd sessions." +\& +\& [.] +\& trigger = $vsz > 10 +\& action = echo "Looks like you have a big $command program: $vsz KB" +\& +\& # Unfortunately we have use a different pattern below. (Here we use +\& # ".?" instead of ".".) In effect the the two patterns mean +\& # test every process. +\& [.?] +\& trigger = elapsed2secs(\*(Aq$etime\*(Aq) > 2*MINS && $pcpu > 40 +\& occurs = every +\& action = </dev/null 2>&1\`; \e$? >> 8 } +\& action = < and it download via + +.SH "AUTHOR" +.IX Header "AUTHOR" +Rocky Bernstein (rocky@gnu.org) +.SH "COPYRIGHT" +.IX Header "COPYRIGHT" +.Vb 6 +\& Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2008 +\& Rocky Bernstein, email: rocky@gnu.org. +\& This program is free software; you can redistribute it and/or modify +\& it under the terms of the GNU General Public License as published by +\& the Free Software Foundation; either version 2 of the License, or +\& (at your option) any later version. +\& +\& This program is distributed in the hope that it will be useful, +\& but WITHOUT ANY WARRANTY; without even the implied warranty of +\& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +\& GNU General Public License for more details. +\& +\& You should have received a copy of the GNU General Public License +\& along with this program; if not, write to the Free Software +\& Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +.Ve diff --git a/docs/ps-watcher.html b/docs/ps-watcher.html new file mode 100644 index 0000000..15e83d6 --- /dev/null +++ b/docs/ps-watcher.html @@ -0,0 +1,644 @@ + + + + +ps-watcher - monitors various processes based on ps-like information. + + + + + + +

+ + + + + +
+

+

+

NAME

+

ps-watcher - monitors various processes based on ps-like information.

+

+

+
+

SYNOPSIS

+

ps-watcher [options...] + [--config] config-file

+

+

+
+

DESCRIPTION

+

Periodically a list of processes obtained via ps. More precisely +each item in the list contains the process name (just what's listed in +the ``cmd'' field, not the full command and arguments) and its process +id (pid). A configuration file specifies a list of Perl +regular-expression patterns to match the processes against. For each +match, a Perl expression specified for that pattern is evaluated. The +evaluated expression can refer to variables which are set by ps and +pertain to the matched process(es), for example the amount memory +consumed by the process, or the total elapsed time. Some other +variables are set by the program, such as the number of times the +process is running. If the Perl expression for a matched pattern +evaluates true, then an action can be run such as killing the program, +restarting it, or mailing an alert, or running some arbitrary Perl +code.

+

Some things you might want to watch a daemon or process for:

+
    +
  • +

    check that it is running (hasn't died)

    +
  • +
  • +

    ensure it is not running too many times

    +
  • +
  • +

    isn't consuming too much memory (perhaps a memory leak), or I/O

    +
  • +
+

Some actions you might want to take:

+
    +
  • +

    restart a process

    +
  • +
  • +

    kill off rampant processes

    +
  • +
  • +

    send an alert about any of the conditions listed above

    +
  • +
+

Depending on options specfied, this program can be run as a daemon, +run once (which is suitable as a cron job), or run not as a daemon +but still continuously (which may be handy in testing the program or +your configuration).

+

+

+

OPTIONS

+
+
--help
+ +
+

Print a usage message on standard error and exit with a return code +of 100.

+

+
+
--doc
+ +
+

Extact the full documentation that you are reading now, print it and +exit with a return code of 101.

+

+
+
--version
+ +
+

Print the version release on standard output and exit with a return +code of 10.

+

+
+
--debug number
+ +
+

Give debugging output. The higher the number, the more the output. The +default is 0 = none. 2 is the most debugging output.

+
+
[--config] configuration file
+ +
+

Specify configuration file. .

+

See CONFIGURATION FILE FORMAT below for information on the format +of the configuration file and EXAMPLE CONFIGURATION for a complete +example of a configuration file.

+

+
+
--log [log file]
+ +
+

Send or don't send error and debugging output to a log file. If option +is given but no logfile is specified, then use STDERR. The default is +no error log file. See also --syslog below.

+

+
+
--syslog | --nosyslog
+ +
+

Send or don't send error and debugging output to syslog. The default +is to syslog error and debug output.

+

+
+
--daemon | --nodaemon
+ +
+

Run or don't as a daemon.

+

+
+
--path search-path
+ +
+

Specify the executable search path used in running commands.

+
+
--ps-prog program
+ +
+

One can specify the command that gives ps information. By default, the +command is /bin/ps.

+

+
+
--run | --norun
+ +
+

do/don't run actions go through the motions as though we were going +to. This may be useful in debugging.

+

+
+
--sleep interval in seconds
+ +
+

It is expected that one might want to run ps-watcher over and over +again. In such instances one can specify the amount of time between +iterations with this option.

+

If a negative number is specified the program is run only once.

+

+
+
+

+

+

CONFIGURATION FILE MODIFICATION AND SIGNAL HANDLING

+

Periodically ps-watcher checks to see if the configuration file +that it was run against has changed. If so, the program rereads the +configuration file.

+

More precisely, the checks are done after waking up from a slumber. +If the sleep interval is long (or if you are impatient), you can +probably force the program to wake up using a HUP signal.

+

At any time you can increase the level of debug output by sending a +USR1 signal to the ps-watcher process. Similarly you can decrease the +level of debug output by sending the process a USR2 signal.

+

It is recommended that you terminate ps-watcher via an INT, TERM, or QUIT +signal.

+

+

+
+

CONFIGURATION FILE FORMAT

+

The format of a configuration file is a series of fully qualified +filenames enclosed in square brackets followed by a number of +parameter lines. Each parameter line has a parameter name followed by +an ``equal'' sign and finally value. That is:

+
+ # This is a comment line
+ ; So is this.
+ [process-pattern1]
+  parameter1 = value1
+  parameter2 = value2
+
+ [process-pattern2]
+  parameter1 = value3
+  parameter2 = value4
+

Comments start with # or ; and take effect to the end of the line.

+

This should be familiar to those who have worked with text-readible +Microsoft .INI files.

+

Note process patterns, (process-pattern1 and process-pattern2 +above) must be unique. If there are times when you may want to +refer to the same process, one can be creative to make these unique. +e.g. cron and [c]ron which refer to the same process even +though they appear to be different.

+

As quoted directly from the Config::IniFiles documentation:

+

Multiline or multivalued fields may also be defined ala UNIX +``here document'' syntax:

+
+  Parameter=<<EOT
+  value/line 1
+  value/line 2
+  EOT
+

You may use any string you want in place of ``EOT''. Note +that what follows the ``<<'' and what appears at the end of +the text must match exactly, including any trailing +whitespace.

+

There are two special ``process patterns'': $PROLOG and $EPILOG, the +former should appear first and the latter last.

+

You can put perl code to initialize variables here and do cleanup +actions in these sections using ``perl-action.''

+

A description of parameters names, their meanings and potential values +follows.

+
+
trigger
+ +
+

This parameter specifies the condition on which a process action is +fired. The condition is evaluated with Perl eval() and should +therefore return something which is equivalent to ``true'' in a Perl +expression.

+

If no trigger is given in a section, true or 1 is assumed and +the action is unconditionally triggered.

+

Example:

+
+  # Match if httpd has not spawned enough (<4) times. NFS and databases
+  # daemons typically spawn child processes.  Since the program
+  # matches against the command names, not commands and arguments,
+  # something like: ps -ef | grep httpd won't match the below.
+  # If you want to match against the command with arguments, see
+  # the example with $args below.
+  [httpd$]
+  trigger = $count <= 4
+
+
occurs
+ +
+

This parameter specifies how many times an action should be performed +on processes matching the section trigger. Acceptable values are +``every'', ``first'', ``first-trigger'', and ``none''.

+

Setting the occurs value to ``none'' causes the the trigger to be +evaluated when there are no matching processes. Although one might +think ``$count == 0'' in the action expression would do the same thing, +currently as coded this does not work.

+

Setting the occurs value to ``first'' causes the process-pattern rule to +be finished after handling the first rule that matches, whether or not the +trigger evaluated to true.

+

Setting the occurs value to ``first-trigger'' causes the process-pattern +rule to be finished after handling the first rule that matches and +the trigger evaluates to true.

+

If the item parameter is not specified, ``first'' is assumed.

+

Examples:

+
+  [.]
+  occurs = first
+  action = echo "You have $count processes running"
+
+  # Note in the above since there is no trigger specified,
+  #   occurs = first
+  # is the same thing as 
+  #   occurs = first-trigger
+
+  [.?]
+  trigger = $vsz > 1000
+  occurs  = every
+  action  = echo "Large program $command matches $ps_pat: $vsz KB"
+
+  # Fire if /usr/sbin/syslogd is not running.
+  # Since the program matches against the command names, not commands and
+  # arguments, something like: 
+  #   ps -ef | grep /usr/sbin/syslogd
+  # won't match the below.
+  [(/usr/sbin/)?syslogd]
+  occurs = none
+  action = /etc/init.d/syslogd start
+
+
action
+ +
+

This specifies the action, a command that gets run by the system +shell, when the trigger condition is evaluated to be true.

+

Example:

+
+ action = /etc/init.d/market_loader.init restart
+
+
perl-action
+ +
+

This specifies Perl statements to be eval'd. This can be especially +useful in conjunction with $PROLOG and $EPILOG sections to make tests +across collections of process and do things which ps-watcher +would otherwise not be able to do.

+

Example:

+
+  # A Perl variable initialization.
+  # Since ps-watcher runs as a daemon it's a good idea
+  # to (re)initialize variables before each run.
+  [$PROLOG]
+    perl-action = $root_procs=0;
+
+  # Keep track of how many root processes we are running
+  [.*]
+    perl-action = $root_procs++ if $uid == 0
+    occurs  = every
+
+  # Show this count.
+  [$EPILOG]
+    action  = echo "I counted $root_procs root processes"
+
+
+

+

+

EXPANDED VARIABLES IN TRIGGER/ACTION CLAUSES

+

Any variables defined in the program can be used in pattern or +action parameters. For example, $program can be used to refer to +the name of this program ps-watcher.

+

The following variables can be used in either the pattern or action +fields.

+
+
$action
+ +
+

A string containing the text of the action to run.

+

+
+
$perl_action
+ +
+

A string containing the text of the perl_action to run.

+

+
+
$ps_pat
+ +
+

The Perl regular expression specified in the beginning of the section.

+

+
+
$command
+ +
+

The command that matched $ps_pat.

+

The Perl regular expression specified in the beginning of the section. +Normally processes will not have funny characters in them. Just in +case, backticks in $command are escaped.

+

Example:

+
+  # List processes other than emacs (which is a known pig) that use lots
+  # of virtual memory
+
+  [.*]
+  trigger = $command !~ /emacs$/ && $vsz > 10
+  action  = echo \"Looks like you have a big \$command program: \$vsz KB\"
+

+
+
$count
+ +
+

The number of times the pattern matched. Presumably the number of +processes of this class running.

+

+
+
$trigger
+ +
+

A string containing the text of the trigger.

+
+
+

A list of variables specific to this program or fields commonly found in +ps output is listed below followed by a description of the more +common ones. See also ps for a more complete +description of the meaning of the field.

+
+ uid euid ruid gid egid rgid alarm blocked bsdtime c caught
+cputime drs dsiz egroup eip esp etime euser f fgid
+fgroup flag flags fname fsgid fsgroup fsuid fsuser fuid fuser
+group ignored intpri lim longtname m_drs m_trs maj_flt majflt
+min_flt  minflt ni nice nwchan opri pagein pcpu pending pgid pgrp
+pmem ppid pri rgroup rss rssize rsz ruser s sess session
+sgi_p sgi_rss sgid sgroup sid sig sig_block sig_catch sig_ignore
+sig_pend sigcatch sigignore sigmask stackp start start_stack start_time
+stat state stime suid suser svgid svgroup svuid svuser sz time timeout
+tmout tname tpgid trs trss tsiz tt tty tty4 tty8 uid_hack uname
+user vsize vsz wchan
+

Beware though, in some situations ps can return multiple lines for a +single process and we will use just one of these in the trigger. In +particular, Solaris's ps will return a line for each LWP (light-weight +process). So on Solaris, if a trigger uses variable lwp, it may or may +not match depending on which single line of the multiple ps lines is +used.

+

+
+
$args
+ +
+

The command along with its command arguments. It is possible that this +is might get truncated at certain length (if ps does likewise as is +the case on Solaris).

+

+
+
$ppid
+ +
+

The parent process id.

+

+
+
$stime
+ +
+

The start time of the process.

+

+
+
$etime
+ +
+

The end time of the process.

+

+
+
$pmem
+ +
+

The process memory.

+

+
+
$pcpu
+ +
+

The percent CPU utilization.

+

+
+
$tty
+ +
+

The controlling tty.

+

+
+
$vsz
+ +
+

Virtual memory size of the process

+
+
+

+

+

OTHER THINGS IN TRIGGER CLAUSES

+

To make testing against elapsed time easier, a function elapse2sec() +has been written to parse and convert elapsed time strings in the +format dd-hh:mm:ss and a number of seconds.

+

Some constants for the number of seconds in a minute, hour, or day +have also been defined. These are referred to as MINS, HOURS, +and DAYS respectively and they have the expected definitions:

+
+  use constant MINS   => 60;
+  use constant HOURS  => 60*60;
+  use constant DAYS   => HOURS * 24;
+

Here is an example of the use of elapsed2sec():

+
+  # Which processes have been running for more than 3 hours?
+  # Also note use of builtin-function elapsed2secs, variable $etime
+  # and builtin-function HOURS
+  [.]
+    trigger = elapsed2secs('$etime') > 1*DAYS
+    action  = echo "$command has been running more than 1 day ($etime)"
+    occurs  = every
+

Please note the quotes around '$etime'.

+

+

+
+

EXAMPLE CONFIGURATION

+
+  # Comments start with # or ; and go to the end of the line.
+
+  # The format for each entry is in Microsoft .INI form:
+  # [process-pattern]
+  # trigger = perl-expression
+  # action  = program-and-arguments-to-run
+
+  [httpd$]
+    trigger = $count < 4
+    action  = echo "$trigger fired -- You have $count httpd sessions."
+
+  [.]
+  trigger = $vsz > 10
+  action  = echo "Looks like you have a big $command program: $vsz KB"
+
+  # Unfortunately we have use a different pattern below. (Here we use
+  # ".?" instead of ".".) In effect the the two patterns mean
+  # test every process.
+  [.?]
+    trigger = elapsed2secs('$etime') > 2*MINS && $pcpu > 40
+    occurs  = every
+    action  = <<EOT
+     echo "$command used $pcpu% CPU for the last $etime seconds" | /bin/mail root
+     kill -TERM $pid
+  EOT
+
+  # Scripts don't show as the script name as the command name on some
+  # operating systems.  Rather the name of the interpreter is listed
+  # (e.g. bash or perl) Here's how you can match against a script.
+  # BSD/OS is an exception: it does give the script name rather than
+  # the interpreter name.
+  [/usr/bin/perl]
+    trigger = \$args !~ /ps-watcher/
+    occurs  = every
+    action  = echo "***found perl program ${pid}:\n $args"
+

+

+
+

Using $PROLOG for getting non-ps information

+

Here is an example to show how to use ps-watcher to do something not +really possible from ps: check to see if a port is active. We make +use of lsof to check port 3333 and the $PROLOG make sure it runs.

+
+  [$PROLOG]
+    occurs  = first
+    trigger = { \$x=`lsof -i :3333 >/dev/null 2>&1`; \$? >> 8 }
+    action  = <<EOT
+    put-your-favorite-command-here arg1 arg2 ...
+  EOT
+

+

+
+

SECURITY CONSIDERATIONS

+

Any daemon such as this one which is sufficiently flexible is a +security risk. The configuration file allows arbitrary commands to be +run. In particular if this daemon is run as root and the configuration +file is not protected so that it can't be modified, a bad person could +have their programs run as root.

+

There's nothing in the ps command or ps-watcher, that requires one to +run this daemon as root.

+

So as with all daemons, one needs to take usual security precautions +that a careful sysadmin/maintainer of a computer would. If you can run +any daemon as an unprivileged user (or with no privileges), do it! If +not, set the permissions on the configuration file and the directory +it lives in.

+

This program can also run chrooted and there is a --path option +that is available which can be used to set the executable search path. +All commands used by ps-watcher are fully qualified, and I generally +give a full execution path in my configuration file, so consider using +the option --path=''.

+

Commands that need to be run as root you can run via sudo. I often +run process accounting which tracks all commands run. Tripwire may be +useful to track changed configuration files.

+

+

+
+

TROUBLESHOOTING

+

To debug a configuration file the following options are useful:

+
+   ps-watcher --log --nodaemon --sleep -1 --debug 2 *config-file*
+

For even more information and control try running the above under the +perl debugger, e.g.

+
+   perl -d ps-watcher --log --nodaemon --sleep -1 --debug 2 *config-file*
+

+

+
+

BUGS

+

Well, some of these are not so much a bug in ps-watcher so much as a +challenge to getting ps-watcher to do what you want it to do.

+

One common problem people run in into is understanding exactly what +the process variables mean. The manual page ps(1) should be of +help, but I've found some of the descriptions either a bit vague or +just plain lacking.

+

Sometimes one will see this error message when debug tracing is turned on:

+
+  ** debug ** Something wrong getting ps variables
+

This just means that the process died between the time ps-watcher first +saw the existence of the process and the time that it queried +variables.

+

+

+
+

SEE ALSO

+

See also ps(1) and syslogd(8).

+

Another cool program doing ps-like things is xps. Well okay, it's +another program I distributed. It shows the process tree dynamically +updated using X Motif and tries to display the output ``attractively'' +but fast. You can the find the homepage at +http://motif-pstree.sourceforge.net and it download via +http://prdownloads.sourceforge.net/motif-pstree

+

+

+
+

AUTHOR

+

Rocky Bernstein (rocky@gnu.org)

+

+

+
+

COPYRIGHT

+
+  Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2008
+  Rocky Bernstein, email: rocky@gnu.org.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ + + + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..ebc6691 --- /dev/null +++ b/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/missing b/missing new file mode 100755 index 0000000..c72c059 --- /dev/null +++ b/missing @@ -0,0 +1,283 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.3 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..3889669 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1.1.1 2000/03/20 09:58:55 root Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/post-configure.in b/post-configure.in new file mode 100755 index 0000000..583f3cb --- /dev/null +++ b/post-configure.in @@ -0,0 +1,80 @@ +#!@PERL@ -w +# -*- Perl -*- +# $Id: post-configure.in,v 1.11 2008/12/17 19:28:14 rockyb Exp $ +require 5.006; +sub touch_file($); + +$program='@PACKAGE@'; +# +# Do we have a version of perl that we can work with? +# +printf "You have of Perl %s\n", $]; + +# +# Do we have all the packages we need? +# +print "Checking to see that you have all library modules installed...\n"; +@needed_packages = ('Sys::Syslog', + # 'IPC::Open3', # -- to simultate `cmd` better + 'File::Basename', + 'Config::IniFiles', + 'Getopt::Long', + 'Pod::Text' + ); +foreach $package (@needed_packages) { + unless (eval "require $package") { + die "Need package \"$package\": $@"; + } + print " $package is installed\n"; +} + +# +# +# +print "Checking what to put after #! at the top of $program..."; +$startperl = `@PERL@ -V:startperl`; +if ($startperl =~ /^startperl=\'#!(.*)\'\;$/) { + $perlpath = $1; + print "$perlpath\n"; +} else { + $perlpath = ''; + print STDERR "\nCan't determine what to put after #! in $program\n"; + print STDERR "Change the top of the program or arrange for perl to\n"; + print STDERR "execute it.\n"; +} + +print "Rewriting $program.in into $program..."; +die "Cannot read $program.in: $!" if !open(INPUT, "<$program.in"); +die "Cannot write $program: $!" if !open(OUTPUT, ">$program"); +if (!$perlpath) { + print OUTPUT "# Customize this line, for example:\n#!/usr/bin/perl -w\n"; +} else { + print OUTPUT "#!$perlpath -w\n"; +} +@OUTPUT = ; +shift @OUTPUT; # Remove old 1st line. +print OUTPUT @OUTPUT; +print "\n"; +close(OUTPUT); +chmod 0755, $program; + +# Touch a timestamp to record that we've created this $program +# from $program.in. If we later modify $program (which is convenient +# during debugging), we will know to copy that back to $program.in, +# the version that get's checked into CVS. +touch_file("./${program}.stamp"); +exit; + +sub touch_file($) { + my $file_name = $_[0]; + if (-e $file_name) { + my $now = time(); + my $count = utime $now, $now, $file_name; + exit ($count != 1); + } else { + open(FILE, ">${file_name}") || die "Can't open $file_name: $!"; + close(FILE); + exit $?; + } +} + diff --git a/ps-watcher b/ps-watcher new file mode 100755 index 0000000..98a508e --- /dev/null +++ b/ps-watcher @@ -0,0 +1,1300 @@ +#!/usr/bin/perl -w +# -*- Perl -*- +use diagnostics; +my $vcid='$Id: ps-watcher.in.in,v 1.62 2008/12/23 11:09:24 rockyb Exp $ '; +# See usage subroutine or perlpod documentation below. + +# Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2008 +# Rocky Bernstein, email: rocky@gnu.org +# +# This program is free software; you can +# redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +use vars qw($program $ps_cmd $ps_cmdfull $ps_fullcmd_fmt @ps_vars $ps_dvars + $0 $logopened $ps_args_fmt $args + $count $pid $command $ps_arg_opts $DEVNULL %opts + ); +use strict; +BEGIN { require 5.00503 } + +sub usage($) { + my ($full_help) = @_; + + print " +usage: + + $program [OPTIONS..] + +$program can be used to monitor various processes based on ps-like +information. + +options: + --help -- print this help and exit + --doc -- extract and print complete documentation and exit + --version -- show a CVS version string and exit + --debug *n* -- give debugging output. The higher the + number, the more the output + --run | --norun -- do/don't run actions + go through the motions as though we were going to + --log [*logfile*] -- Set a log file for this program. If option given + but no logfile, then use STDERR. Default is + no error log file. + --syslog | --nosyslog + -- send or don't send error output to syslog + Default is to send to syslog. + --config *cnf file* -- specify configuration file. + + --daemon | --nodaemon + -- do or don't become a daemon. Default daemonize. + --sleep *time* -- sleep interval between iterations. The default is + $opts{sleep_interval} seconds. + --path path -- executable search path to use in running commands + + --ps-prog *program* -- command that gets ps information. The default is: + $opts{ps_prog} + --ps-pids-opt *ps opts* + -- ps options that lists pids and commands. The + default is: $opts{ps_pid_opts} +"; + + if ($full_help) { + print " +General operation: + +Periodically a list of processes obtained via ps. More precisely +each item in the list contains the process name (just what's listed in +the \"command\" field, not the full command and arguments) and its +process id (pid). A configuration file specifies a list of Perl +regular-expression patterns to match the process names against. For +each match, a Perl expression specified for that pattern is +evaluated. The evaluated expression can refer to variables which are +set by ps and pertain to the matched process(es), for example the +amount memory consumed by the process, or the total elapsed time. Some +other variables are set by the program, such as the number of times +the process is running. If the Perl expression for a matched pattern +evaluates true, then an action can be run such as killing the program, +restarting it, or mailing an alert. + +This program can be used to ensure a daemon hasn't died or ensure it +is not running too many times. It might be used to determine when a +process has consumed too many resources (for example due to a memory +leak). + +The following variables can be used in patterns or actions: +\t". '$' . join("\n\t\$", @ps_vars) . +" + The following is a sample config file: + +# Comments start with # or ; and go to the end of the line. + +# The format for each entry is in Microsoft .INI form: +# [process-pattern] +# trigger = perl-expression +# action = program-and-arguments-to-run + +[httpd\$] + trigger = \$count < 4 + action = echo \"\$trigger fired -- You have \$count \$command sessions.\" + +[em?cs] +trigger = \$vsz > 10 +action = echo \"Looks like you have a big \$command program: \$vsz KB\" + +"; + } + exit 100; +} + +sub init(); +sub podthis(); +sub process_options(); +sub show_version(); +sub daemonize(); +sub eval_trigger_action($$$); +sub make_the_rounds($); +sub elapsed2secs($); +sub logger($); +sub debug_log($$); +sub gather_psinfo(); +sub read_config($); +sub check_config_file($); +sub run_trigger($$$); + +init(); +process_options(); + +# Unfurl the banner... +logger("Starting: $vcid"); + +my $cfg=read_config($opts{conf_file}); + +if (!defined($cfg)) { + for my $line (@Config::IniFiles::errors) { + logger($line); + } + exit 2; +} + +if ($opts{daemon}) { + daemonize(); +} + +install_handlers(); + +do { + make_the_rounds($cfg); + sleep $opts{sleep_interval} if $opts{sleep_interval} > 0; + check_config_file($opts{conf_file}); +} until ($opts{sleep_interval} < 0) ; +if ($opts{syslog}) { + use Sys::Syslog; + closelog; +} +exit 0; + +# Evaluates the trigger and if that's true also performs +# an action. 1 is returned if the action was performed, +# zero otherwise. +sub eval_trigger_action($$$) { + my ($trigger,$action,$perl_action) = @_; + my $etrigger=$trigger; + # It is a pain to predeclare all of the variables assigned + # by ps which is OS and ps specific. So we'll allow anything. + # Likewise, we'll allow it occur in $action. + no strict; + if ($trigger ne '1') { + $etrigger =~ s/"/\\"/g; + debug_log("trigger before substitution: $etrigger", 2); + $etrigger = eval qq/"$trigger"/; + } + debug_log("trigger after substitution: $etrigger", 2); + if (eval ($etrigger)) { + if (defined($perl_action)) { + debug_log("running Perl_action: $perl_action", 2); + eval($perl_action) if $opts{run}; + } + if (defined($action)) { + debug_log("action before substitution: $action", 2); + my $eaction=$action; + $eaction =~ s/"/\\"/g; + $eaction = eval qq/"$eaction"/; + debug_log("action after substitution: $eaction", 2); + my $output=`$eaction` if $opts{run}; + chomp($output); + logger($output) if $output; + } + return 1; + } + return 0; +} + +# Perform a round over the process_patterns comparing against the +# process info to see if anything's stirring. +sub make_the_rounds($) { + my $cfg = $_[0]; + my @ps_info=gather_psinfo(); + foreach our $ps_pat ($cfg->Sections()) { + debug_log("process pattern: /$ps_pat/", 1); + my @selected_ps; + my $in_prolog_epilog=0; + my $trigger = $cfg->val($ps_pat, 'trigger') || '1'; + my $action = $cfg->val($ps_pat, 'action'); + my $perl_action = $cfg->val($ps_pat, 'perl-action'); + my $occurs = $cfg->val($ps_pat, 'occurs') || "first"; + local $count; + if ($ps_pat =~ /^\$PROLOG/ || $ps_pat =~ /\$EPILOG/) { + # Set to run trigger below. + $count = @ps_info; + $in_prolog_epilog=1; + } else { + @selected_ps = grep(/$ps_pat/, @ps_info); + $count = @selected_ps; + debug_log("count for /$ps_pat/: $count", 2); + } + if ($in_prolog_epilog) { + # execute trigger + eval_trigger_action($trigger, $action, $perl_action); + } elsif ($occurs =~ /none/i) { + if ($count eq 0) { + # execute the trigger anyway + eval_trigger_action($trigger, $action, $perl_action); + } + } elsif ($count gt 0) { + TRIGGER: + foreach (@selected_ps) { + next if !/\s*(\d+)\s+(\S+)/; + local($pid, $command) = /\s*(\d+)\s+(\S+)/; + if ($pid !~ /\d+/) { + logger("Something wrong with ps format:\n$_"); + next; + } + + my $ps_fullcmd = sprintf $ps_fullcmd_fmt, $pid; + my @output = `$ps_fullcmd`; + my $output=''; + if (@output == 1) { + # Got one line of output - good. + $output=$output[0]; + # Make sure though we don't just have a title line. + # One of the fields should be just digits, e.g. ppid, uid, gud... + next if $output !~ m{\s+\d+\s+}; + } elsif (@output == 2 && 0) { + # Got two lines of output - we are running a ps where + # we can't remove the title line? + $output=$output[1]; + } elsif (@output > 1 && 0) { + # Got multiple lines of output - we are running a ps which can + # do so. For example Solaris does this for a process that has many + # LWPs (light-weight processes). + $output=$output[0]; + } else { + debug_log("Something wrong getting ps variables", 1); + next; + } + + local $args = ''; + if ($ps_arg_opts) { + my $ps_argscmd = sprintf $ps_args_fmt, $pid; + my @output = `$ps_argscmd`; + if (@output == 1) { + $args=$output[0]; + } elsif (@output == 2 && 0) { + $args=$output[1]; + } else { + debug_log("Something wrong with getting command arguments", 1); + } + } + + # Process may have disappeared. In this case we'll get no + # output. + next if !$output; + + # Add ' ' so split will junk first ps_dvars $junk. + $output = ' ' . $output; + my $perl_ps_assign = "$ps_dvars = split(/\\s+/, \$output)"; + { + # It is a pain to predeclare all of the variables assigned + # by ps which is OS and ps specific. So we'll allow anything. + # Likewise, we'll allow it occur in $action. + no strict; + + # Escape backticks so that we don't inadvertently run + # the program. For example there could be a process named + # `/tmp/evilcommand` (with backticks). Thanks to Randal + # Schwartz for noticing the problem. + # Not sure if there are other things to watch out for. + # Although the Perl Cookbook suggests how to make system, + # safe, it is silent about making eval safe. + $command =~ s/`/\\`/g; + + if (eval ($perl_ps_assign)) { + my $evaled = eval_trigger_action($trigger, $action, + $perl_action); + last TRIGGER if $evaled && $occurs eq 'first-trigger'; + last TRIGGER if $occurs eq 'first'; + } else { + logger("Something wrong with perl assignment: $perl_ps_assign"); + last TRIGGER; + } + } # no strict + } # foreach + } # if $count + } +} + +# Initailize various variables variously. +sub init() { + + use File::Basename; + $program = basename($0); # Who am I today, anyway? + + $DEVNULL = '/dev/null'; # And what do we do about non Unix? + + use constant MINS => 60; + use constant HOURS => 60*60; + use constant DAYS => HOURS * 24; + + $opts{debug} = 0; # no debugging + $opts{run} = 1; # run actions + $opts{syslog} = 1; # Log errors to syslog + $opts{logfile} = $DEVNULL; + $opts{daemon} = 1; # Run as daemon; + $opts{ps_prog} = '/bin/ps'; # Where is ps? + $opts{ps_pid_opts} = '-e -o pid= -o cmd='; # How do I get pids and commands? + + $ps_arg_opts = '-www -o args='; # How do I get full process command? + + # List of all the fields from ps we will be able to use. Don't need + # to list variables listed above. + @ps_vars = qw ( uid euid ruid gid egid rgid alarm blocked bsdtime c caught +cputime drs dsiz egroup eip esp etime euser f fgid +fgroup flag flags fname fsgid fsgroup fsuid fsuser fuid fuser +group ignored intpri lim longtname m_drs m_trs maj_flt majflt +min_flt minflt ni nice nwchan opri pagein pcpu pending pgid pgrp +pmem ppid pri rgroup rss rssize rsz ruser s sess session +sgi_p sgi_rss sgid sgroup sid sig sig_block sig_catch sig_ignore +sig_pend sigcatch sigignore sigmask stackp start start_stack start_time +stat state stime suid suser svgid svgroup svuid svuser sz time timeout +tmout tname tpgid trs trss tsiz tt tty tty4 tty8 uid_hack uname +user vsize vsz wchan +); + + # Convert the above into an argument list like + # ($junk, $user, ... ) + # The first argument ($junk) will be null and thrown out. + $ps_dvars = '($junk,$' . join(',$', @ps_vars) . ')'; + + $opts{sleep_interval} = 300; + +} + +# The bane of programming. +sub process_options() { + use Getopt::Long; + my(@opt_cf); + $Getopt::Long::autoabbrev = 1; + my($newstyle_config); + + my ($help, $long_help, $show_version); + + my $result = &GetOptions + ( + 'help' => \$help, + 'doc' => \$long_help, + 'version' => \$show_version, + 'config=s' => \$opts{conf_file}, + 'debug=i' => \$opts{debug}, + 'path=s' => \$ENV{PATH}, + 'ps-pid-opts=s'=> \$opts{ps_pid_opts}, + 'ps-prog=s' => \$opts{ps_prog}, + 'sleep=i' => \$opts{sleep_interval}, + 'log:s' => \$opts{logfile}, + 'syslog!' => \$opts{syslog}, + 'run!' => \$opts{run}, + 'daemon!' => \$opts{daemon}, + ); + + show_version() if $show_version; + usage(1) if $help; + podthis() if $long_help; + + # However specifying a configuration file is not. + # Nor can we deal with multiple configuration files or tolerate + # option-processing errors. + usage(0) if !$result; + + # The option-specifier "--config" is optional... + if (@ARGV && !defined($opts{conf_file})) { + $opts{conf_file} = shift(@ARGV); + } + + # However we do have to give exactly one configurtion file. + if (!defined($opts{conf_file}) || @ARGV != 0) { + print STDERR "$program: Please specify exactly one configuration file.\n"; + usage(0); + } + + $ps_cmd = "$opts{ps_prog} $opts{ps_pid_opts}"; + my $ps_vars; + if (1) { + $ps_vars = join('= -o ', @ps_vars) . '='; + } else { + $ps_vars = join(' -o ', @ps_vars); + } + + if ('') { + $ps_fullcmd_fmt = ""; + } else { + $ps_fullcmd_fmt = "$opts{ps_prog} -p %d -o $ps_vars"; + } + if ('') { + $ps_args_fmt = ""; + } else { + $ps_args_fmt = "$opts{ps_prog} -p %d $ps_arg_opts"; + } + + open STDIN, $DEVNULL or die "Can't read $DEVNULL: $!"; + if ($opts{logfile} ne '') { + open STDOUT, ">>$opts{logfile}" or + die "Can't write STDOUT to $opts{logfile}: $!"; + open STDERR, ">>&STDOUT" or + die "Can't write STDERR to $opts{logfile}: $!"; + } +} + +# Signal handling.. +sub install_handlers { + $SIG{'QUIT'} = \&terminate; + $SIG{'TERM'} = \&terminate; + $SIG{'INT'} = \&terminate; + $SIG{'HUP'} = \&null_handler; + $SIG{'USR1'} = \&debug_up_handler; + $SIG{'USR2'} = \&debug_down_handler; +} + +# Used perhaps to break out of a deep sleep. +sub null_handler { + my($signo) = @_; + logger("Received signal: ${signo}"); +} + +# Increase verbosity of debugging. +sub debug_up_handler { + my($signo) = @_; + $opts{debug}++; + logger("Received signal: ${signo}. Increasing debugging to $opts{debug}."); +} + +# Decrease verbosity of debugging. +sub debug_down_handler { + my($signo) = @_; + $opts{debug}--; + logger("Received signal: ${signo}. Decreasing debugging to $opts{debug}."); +} + +# Signal handler to go down recording the signal. +sub terminate { + my($signo) = @_; + use Config; + if (defined $Config{sig_name}) { + my $i = 0; + my @signame; + my %sig; + foreach my $name (split(' ', $Config{sig_name})) { + $signame[$i] = $name; + $sig{$name} = $i; + $i++; + } + $signo = $sig{$signo} if exists($sig{$signo}); + if ($signo =~ m{\A\d+\Z} ) { + logger("Going down on $signame[$signo] (${signo}) signal. " . + "Have a nice day!"); + } + } else { + logger("Going down on signal ${signo}). Have a nice day!"); + } + + $signo = 15 if $signo !~ m{\A\d+\Z}; + if ($opts{syslog}) { + use Sys::Syslog; + closelog; + } + exit $signo; +}; + +# Utility function for parsing/converting elapsed time into seconds. +sub elapsed2secs($) { + $_ = $_[0]; + + # Handle formats like: + # 1-08:34:37 -- One day, 8 hours, 34 minutes, 37 seconds + # 20:40:34 -- 20 hours, 40 minutes, 34 seconds + # 0:00 -- 0 seconds. + + # 1-08:34.37 -- One day, 8 hours, 34 minutes, 37 seconds + # 20:40.34 -- 20 hours, 40 minutes, 34 seconds + # 5.03 -- 5 minutes, 3 seconds. + # 5 -- 5 seconds. + + # Some easy cases. + return -1 if !defined($_) || m{\A\s*\Z}; + return $_ if m{\A\d+\Z}; + + # Originally had as one pattern and optional + # arguments but i got compaints about using + # uninitialized variables even with "no diagonstics". Would rather + # switch than fight. + my $min_secs_pat = '(\d{1,2})[:.](\d\d)'; + if (m{ + (\d{1,2})- # The number of days. e.g. 1- or 19- or blank + (\d{1,2})[:.] # The number of hrs. e.g. 01: or 23: or blank + $min_secs_pat + }x) { + my ($days, $hours, $minutes, $secs) = ($1, $2, $3, $4); + return ($days*DAYS + $hours*HOURS + $minutes*MINS + $secs); + } elsif (m{ + (\d{1,2})[:.] # The number of hrs. e.g. 01: or 23: or blank + $min_secs_pat + }x) { + my ($hours, $minutes, $secs) = ($1, $2, $3); + return ($hours*HOURS + $minutes*MINS + $secs); + } elsif (m{$min_secs_pat}) { + my ($minutes, $secs) = ($1, $2); + return ($minutes*MINS + $secs); + } else { + logger("Error in converting $_ to seconds"); + return -1; + } +} + +# Return time and PID as string in a common format +sub timestring() { + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + localtime(time); + $mon++; + return sprintf( "%.2d/%.2d/%.2d %.2d:%.2d:%.2d %s[$$]", + $mon, $mday, $year%100, $hour, $min, $sec, $program); +} + +# log error to syslog and print to STDERR. +sub logger($) { + my($msg) = shift; + + if ($opts{syslog}) { + if (!$logopened) { + use Sys::Syslog; + $logopened++; + openlog($program,'cons,pid', 'err'); + } + syslog('info', $msg); + } + if (defined($opts{logfile}) && $opts{logfile} ne $DEVNULL) { + my $ts=timestring(); + print STDERR "$ts: $msg\n"; + } +} + +sub debug_log($$) { + my($msg, $level) = @_; + logger("** debug ** $msg") if $opts{debug} >= $level; +} + +sub gather_psinfo() { + my @output=`$ps_cmd`; + return @output; +} + +# Show the CVS version id string and quit. +sub show_version() { + print "$vcid +Copyright (C) 2000, 2002, 2003, 2004, 2006, 2008 Rocky Bernstein. +This is free software; see the source for copying conditions. +There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. +"; + exit 10; +} + + +sub daemonize() { + chdir '/' or die "Can't chdir to /: $!"; + defined(my $pid = fork) or die "Can't fork: $!"; + exit 0 if $pid; + use POSIX qw(setsid); + setsid() or die "Can't start a new session: $!"; + umask 0; +} + +# Time configuration file was last read. +my $conf_time; + +# Read a configuration file. +sub read_config($) { + use Config::IniFiles; + my($cf)=@_; + if (!-f $cf || !-r _ || -z _ || !-T _) { + logger("Unusable config file: <$cf>"); + return undef; + } + + # Save time we read the configuration file so we can check back + # later to see if it changed. + + my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime) = stat $cf; + $conf_time = $mtime; + + return new Config::IniFiles( -file => $cf ); +} + +# Check to see if any configuration file has changed +# since the last time this routime was called. +# Updates global $conf_time. +sub check_config_file($) { + my ($conf_file) = @_; + my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime) = stat $opts{conf_file}; + if ( defined($conf_time) && defined($mtime) && $conf_time < $mtime ) { + logger("Configuration file $conf_file modified; re-reading..."); + $cfg = read_config($conf_file); + } +} + +sub run_trigger($$$) { + my($trigger, $action, $count) = @_; + my $etrigger=$trigger; + if ($trigger ne '1') { + $etrigger =~ s/"/\\"/g; + debug_log("trigger before substitution: $etrigger", 2); + $etrigger = eval qq/"$trigger"/; + } + debug_log("trigger after substitution: $etrigger", 2); + if (eval ($etrigger)) { + debug_log("action before substitution: $action", 2); + my $eaction=$action; + $eaction =~ s/"/\\"/g; + $eaction = eval qq/"$eaction"/; + debug_log("action after substitution: $eaction", 2); + my $output=`$eaction` if $opts{run}; + chomp($output); + logger($output) if $output; + } +} + +sub podthis() { + use Pod::Text; + $^W = 0; + pod2text $0; + exit 101; +} + +#-------------------------------------------------- +=pod + +=head1 NAME + +ps-watcher - monitors various processes based on ps-like information. + + +=head1 SYNOPSIS + +B [I...] + [C<--config>] I + +=head1 DESCRIPTION + +Periodically a list of processes obtained via C. More precisely +each item in the list contains the process name (just what's listed in +the "cmd" field, not the full command and arguments) and its process +id (pid). A configuration file specifies a list of Perl +regular-expression patterns to match the processes against. For each +match, a Perl expression specified for that pattern is evaluated. The +evaluated expression can refer to variables which are set by ps and +pertain to the matched process(es), for example the amount memory +consumed by the process, or the total elapsed time. Some other +variables are set by the program, such as the number of times the +process is running. If the Perl expression for a matched pattern +evaluates true, then an action can be run such as killing the program, +restarting it, or mailing an alert, or running some arbitrary Perl +code. + +Some things you might want to watch a daemon or process for: + +=over 2 + +=item * + +check that it is running (hasn't died) + +=item * + +ensure it is not running too many times + +=item * + +isn't consuming too much memory (perhaps a memory leak), or I/O + +=back + +Some actions you might want to take: + +=over 2 + +=item * + +restart a process + +=item * + +kill off rampant processes + +=item * + +send an alert about any of the conditions listed above + +=back + +Depending on options specfied, this program can be run as a daemon, +run once (which is suitable as a C job), or run not as a daemon +but still continuously (which may be handy in testing the program or +your configuration). + +=head2 OPTIONS + +=over 4 + +=item --help + +Print a usage message on standard error and exit with a return code +of 100. + +Z<> + +=item --doc + +Extact the full documentation that you are reading now, print it and +exit with a return code of 101. + +Z<> + +=item --version + +Print the version release on standard output and exit with a return +code of 10. + +Z<> + +=item --debug I + +Give debugging output. The higher the number, the more the output. The +default is 0 = none. 2 is the most debugging output. + +=item [--config] I + +Specify configuration file. . + +See L below for information on the format +of the configuration file and L for a complete +example of a configuration file. + +Z<> + +=item --log [I] + +Send or don't send error and debugging output to a log file. If option +is given but no logfile is specified, then use STDERR. The default is +no error log file. See also --syslog below. + +Z<> + +=item --syslog | --nosyslog + +Send or don't send error and debugging output to syslog. The default +is to syslog error and debug output. + +Z<> + +=item --daemon | --nodaemon + +Run or don't as a daemon. + +Z<> + +=item --path I + +Specify the executable search path used in running commands. + +=item --ps-prog I + +One can specify the command that gives ps information. By default, the +command is F. + +Z<> + +=item --run | --norun + +do/don't run actions go through the motions as though we were going +to. This may be useful in debugging. + +Z<> + +=item --sleep I + +It is expected that one might want to run ps-watcher over and over +again. In such instances one can specify the amount of time between +iterations with this option. + +If a negative number is specified the program is run only once. + +Z<> + +=back + +=head2 CONFIGURATION FILE MODIFICATION AND SIGNAL HANDLING + +Periodically ps-watcher checks to see if the configuration file +that it was run against has changed. If so, the program rereads the +configuration file. + +More precisely, the checks are done after waking up from a slumber. +If the sleep interval is long (or if you are impatient), you can +probably force the program to wake up using a HUP signal. + +At any time you can increase the level of debug output by sending a +USR1 signal to the ps-watcher process. Similarly you can decrease the +level of debug output by sending the process a USR2 signal. + +It is recommended that you terminate ps-watcher via an INT, TERM, or QUIT +signal. + +=head1 CONFIGURATION FILE FORMAT + +The format of a configuration file is a series of fully qualified +filenames enclosed in square brackets followed by a number of +parameter lines. Each parameter line has a parameter name followed by +an "equal" sign and finally value. That is: + + # This is a comment line + ; So is this. + [process-pattern1] + parameter1 = value1 + parameter2 = value2 + + [process-pattern2] + parameter1 = value3 + parameter2 = value4 + +Comments start with # or ; and take effect to the end of the line. + +This should be familiar to those who have worked with text-readible +Microsoft C<.INI> files. + +Note process patterns, (F and F +above) must be unique. If there are times when you may want to +refer to the same process, one can be creative to make these unique. +e.g. F and F<[c]ron> which refer to the same process even +though they I to be different. + +As quoted directly from the Config::IniFiles documentation: + +Multiline or multivalued fields may also be defined ala UNIX +"here document" syntax: + + Parameter=< match exactly, including any trailing +whitespace. + +There are two special "process patterns": $PROLOG and $EPILOG, the +former should appear first and the latter last. + +You can put perl code to initialize variables here and do cleanup +actions in these sections using "perl-action." + +A description of parameters names, their meanings and potential values +follows. + +=over + +=item trigger + +This parameter specifies the condition on which a process action is +fired. The condition is evaluated with Perl eval() and should +therefore return something which is equivalent to "true" in a Perl +expression. + +If no trigger is given in a section, true or 1 is assumed and +the action is unconditionally triggered. + +Example: + + # Match if httpd has not spawned enough (<4) times. NFS and databases + # daemons typically spawn child processes. Since the program + # matches against the command names, not commands and arguments, + # something like: ps -ef | grep httpd won't match the below. + # If you want to match against the command with arguments, see + # the example with $args below. + [httpd$] + trigger = $count <= 4 + +=item occurs + +This parameter specifies how many times an action should be performed +on processes matching the section trigger. Acceptable values are +"every", "first", "first-trigger", and "none". + +Setting the occurs value to "none" causes the the trigger to be +evaluated when there are no matching processes. Although one might +think "$count == 0" in the action expression would do the same thing, +currently as coded this does not work. + +Setting the occurs value to "first" causes the process-pattern rule to +be finished after handling the first rule that matches, whether or not the +trigger evaluated to true. + +Setting the occurs value to "first-trigger" causes the process-pattern +rule to be finished after handling the first rule that matches I +the trigger evaluates to true. + +If the item parameter is not specified, "first" is assumed. + +Examples: + + [.] + occurs = first + action = echo "You have $count processes running" + + # Note in the above since there is no trigger specified, + # occurs = first + # is the same thing as + # occurs = first-trigger + + [.?] + trigger = $vsz > 1000 + occurs = every + action = echo "Large program $command matches $ps_pat: $vsz KB" + + # Fire if /usr/sbin/syslogd is not running. + # Since the program matches against the command names, not commands and + # arguments, something like: + # ps -ef | grep /usr/sbin/syslogd + # won't match the below. + [(/usr/sbin/)?syslogd] + occurs = none + action = /etc/init.d/syslogd start + +=item action + +This specifies the action, a command that gets run by the system +shell, when the trigger condition is evaluated to be true. + +Example: + + action = /etc/init.d/market_loader.init restart + +=item perl-action + +This specifies Perl statements to be eval'd. This can be especially +useful in conjunction with $PROLOG and $EPILOG sections to make tests +across collections of process and do things which ps-watcher +would otherwise not be able to do. + +Example: + + # A Perl variable initialization. + # Since ps-watcher runs as a daemon it's a good idea + # to (re)initialize variables before each run. + [$PROLOG] + perl-action = $root_procs=0; + + # Keep track of how many root processes we are running + [.*] + perl-action = $root_procs++ if $uid == 0 + occurs = every + + # Show this count. + [$EPILOG] + action = echo "I counted $root_procs root processes" + +=back + +=head2 EXPANDED VARIABLES IN TRIGGER/ACTION CLAUSES + +Any variables defined in the program can be used in pattern or +action parameters. For example, C<$program> can be used to refer to +the name of this program ps-watcher. + +The following variables can be used in either the pattern or action +fields. + +=over + +=item $action + +A string containing the text of the action to run. + +Z<> + +=item $perl_action + +A string containing the text of the perl_action to run. + +Z<> + +=item $ps_pat + +The Perl regular expression specified in the beginning of the section. + +Z<> + +=item $command + +The command that matched $ps_pat. + +The Perl regular expression specified in the beginning of the section. +Normally processes will not have funny characters in them. Just in +case, backticks in $command are escaped. + +Example: + + # List processes other than emacs (which is a known pig) that use lots + # of virtual memory + + [.*] + trigger = $command !~ /emacs$/ && $vsz > 10 + action = echo \"Looks like you have a big \$command program: \$vsz KB\" + +Z<> + +=item $count + +The number of times the pattern matched. Presumably the number of +processes of this class running. + +Z<> + +=item $trigger + +A string containing the text of the trigger. + +=back + +A list of variables specific to this program or fields commonly found in +C output is listed below followed by a description of the more +common ones. See also C for a more complete +description of the meaning of the field. + + uid euid ruid gid egid rgid alarm blocked bsdtime c caught +cputime drs dsiz egroup eip esp etime euser f fgid +fgroup flag flags fname fsgid fsgroup fsuid fsuser fuid fuser +group ignored intpri lim longtname m_drs m_trs maj_flt majflt +min_flt minflt ni nice nwchan opri pagein pcpu pending pgid pgrp +pmem ppid pri rgroup rss rssize rsz ruser s sess session +sgi_p sgi_rss sgid sgroup sid sig sig_block sig_catch sig_ignore +sig_pend sigcatch sigignore sigmask stackp start start_stack start_time +stat state stime suid suser svgid svgroup svuid svuser sz time timeout +tmout tname tpgid trs trss tsiz tt tty tty4 tty8 uid_hack uname +user vsize vsz wchan + +Beware though, in some situations ps can return multiple lines for a +single process and we will use just one of these in the trigger. In +particular, Solaris's C will return a line for each LWP (light-weight +process). So on Solaris, if a trigger uses variable lwp, it may or may +not match depending on which single line of the multiple C lines is +used. + +Z<> + +=over + +=item $args + +The command along with its command arguments. It is possible that this +is might get truncated at certain length (if ps does likewise as is +the case on Solaris). + +Z<> + +=item $ppid + +The parent process id. + +Z<> + +=item $stime + +The start time of the process. + +Z<> + +=item $etime + +The end time of the process. + +Z<> + +=item $pmem + +The process memory. + +Z<> + +=item $pcpu + +The percent CPU utilization. + +Z<> + +=item $tty + +The controlling tty. + +Z<> + +=item $vsz + +Virtual memory size of the process + +=back + +=head2 OTHER THINGS IN TRIGGER CLAUSES + +To make testing against elapsed time easier, a function C +has been written to parse and convert elapsed time strings in the +format C and a number of seconds. + +Some constants for the number of seconds in a minute, hour, or day +have also been defined. These are referred to as C, C, +and C respectively and they have the expected definitions: + + use constant MINS => 60; + use constant HOURS => 60*60; + use constant DAYS => HOURS * 24; + +Here is an example of the use of C: + + # Which processes have been running for more than 3 hours? + # Also note use of builtin-function elapsed2secs, variable $etime + # and builtin-function HOURS + [.] + trigger = elapsed2secs('$etime') > 1*DAYS + action = echo "$command has been running more than 1 day ($etime)" + occurs = every + +Please note the quotes around '$etime'. + +=head1 EXAMPLE CONFIGURATION + + # Comments start with # or ; and go to the end of the line. + + # The format for each entry is in Microsoft .INI form: + # [process-pattern] + # trigger = perl-expression + # action = program-and-arguments-to-run + + [httpd$] + trigger = $count < 4 + action = echo "$trigger fired -- You have $count httpd sessions." + + [.] + trigger = $vsz > 10 + action = echo "Looks like you have a big $command program: $vsz KB" + + # Unfortunately we have use a different pattern below. (Here we use + # ".?" instead of ".".) In effect the the two patterns mean + # test every process. + [.?] + trigger = elapsed2secs('$etime') > 2*MINS && $pcpu > 40 + occurs = every + action = < is active. We make +use of lsof to check port 3333 and the $PROLOG make sure it runs. + + [$PROLOG] + occurs = first + trigger = { \$x=`lsof -i :3333 >/dev/null 2>&1`; \$? >> 8 } + action = < option +that is available which can be used to set the executable search path. +All commands used by ps-watcher are fully qualified, and I generally +give a full execution path in my configuration file, so consider using +the option C<--path=''>. + +Commands that need to be run as root you can run via C. I often +run process accounting which tracks all commands run. Tripwire may be +useful to track changed configuration files. + +=head1 TROUBLESHOOTING + +To debug a configuration file the following options are useful: + + ps-watcher --log --nodaemon --sleep -1 --debug 2 *config-file* + +For even more information and control try running the above under the +perl debugger, e.g. + + perl -d ps-watcher --log --nodaemon --sleep -1 --debug 2 *config-file* + +=head1 BUGS + +Well, some of these are not so much a bug in ps-watcher so much as a +challenge to getting ps-watcher to do what you want it to do. + +One common problem people run in into is understanding exactly what +the process variables mean. The manual page L should be of +help, but I've found some of the descriptions either a bit vague or +just plain lacking. + +Sometimes one will see this error message when debug tracing is turned on: + + ** debug ** Something wrong getting ps variables + +This just means that the process died between the time ps-watcher first +saw the existence of the process and the time that it queried +variables. + +=head1 SEE ALSO + +See also L and L. + +Another cool program doing ps-like things is C. Well okay, it's +another program I distributed. It shows the process tree dynamically +updated using X Motif and tries to display the output "attractively" +but fast. You can the find the homepage at +L and it download via +L + +=head1 AUTHOR + +Rocky Bernstein (rocky@gnu.org) + +=head1 COPYRIGHT + + Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2008 + Rocky Bernstein, email: rocky@gnu.org. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/ps-watcher.in.in b/ps-watcher.in.in new file mode 100755 index 0000000..e285184 --- /dev/null +++ b/ps-watcher.in.in @@ -0,0 +1,1280 @@ +#!@PERL@ -w +# -*- Perl -*- +use diagnostics; +my $vcid='$Id: ps-watcher.in.in,v 1.62 2008/12/23 11:09:24 rockyb Exp $ '; +# See usage subroutine or perlpod documentation below. + +# Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2008 +# Rocky Bernstein, email: rocky@gnu.org +# +# This program is free software; you can +# redistribute it and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +use vars qw($program $ps_cmd $ps_cmdfull $ps_fullcmd_fmt @ps_vars $ps_dvars + $0 $logopened $ps_args_fmt $args + $count $pid $command $ps_arg_opts $DEVNULL %opts + ); +use strict; +BEGIN { require 5.00503 } + +sub usage($) { + my ($full_help) = @_; + + print " +usage: + + $program [OPTIONS..] + +$program can be used to monitor various processes based on ps-like +information. + +options: + --help -- print this help and exit + --doc -- extract and print complete documentation and exit + --version -- show a CVS version string and exit + --debug *n* -- give debugging output. The higher the + number, the more the output + --run | --norun -- do/don't run actions + go through the motions as though we were going to + --log [*logfile*] -- Set a log file for this program. If option given + but no logfile, then use STDERR. Default is + no error log file. + --syslog | --nosyslog + -- send or don't send error output to syslog + Default is to send to syslog. + --config *cnf file* -- specify configuration file. + + --daemon | --nodaemon + -- do or don't become a daemon. Default daemonize. + --sleep *time* -- sleep interval between iterations. The default is + $opts{sleep_interval} seconds. + --path path -- executable search path to use in running commands + + --ps-prog *program* -- command that gets ps information. The default is: + $opts{ps_prog} + --ps-pids-opt *ps opts* + -- ps options that lists pids and commands. The + default is: $opts{ps_pid_opts} +"; + + if ($full_help) { + print " +General operation: + +Periodically a list of processes obtained via ps. More precisely +each item in the list contains the process name (just what's listed in +the \"command\" field, not the full command and arguments) and its +process id (pid). A configuration file specifies a list of Perl +regular-expression patterns to match the process names against. For +each match, a Perl expression specified for that pattern is +evaluated. The evaluated expression can refer to variables which are +set by ps and pertain to the matched process(es), for example the +amount memory consumed by the process, or the total elapsed time. Some +other variables are set by the program, such as the number of times +the process is running. If the Perl expression for a matched pattern +evaluates true, then an action can be run such as killing the program, +restarting it, or mailing an alert. + +This program can be used to ensure a daemon hasn't died or ensure it +is not running too many times. It might be used to determine when a +process has consumed too many resources (for example due to a memory +leak). + +The following variables can be used in patterns or actions: +\t". '$' . join("\n\t\$", @ps_vars) . +" + The following is a sample config file: + +# Comments start with # or ; and go to the end of the line. + +# The format for each entry is in Microsoft .INI form: +# [process-pattern] +# trigger = perl-expression +# action = program-and-arguments-to-run + +[httpd\$] + trigger = \$count < 4 + action = echo \"\$trigger fired -- You have \$count \$command sessions.\" + +[em?cs] +trigger = \$vsz > 10 +action = echo \"Looks like you have a big \$command program: \$vsz KB\" + +"; + } + exit 100; +} + +sub init(); +sub podthis(); +sub process_options(); +sub show_version(); +sub daemonize(); +sub eval_trigger_action($$$); +sub make_the_rounds($); +sub elapsed2secs($); +sub logger($); +sub debug_log($$); +sub gather_psinfo(); +sub read_config($); +sub check_config_file($); +sub run_trigger($$$); + +init(); +process_options(); + +# Unfurl the banner... +logger("Starting: $vcid"); + +my $cfg=read_config($opts{conf_file}); + +if (!defined($cfg)) { + for my $line (@Config::IniFiles::errors) { + logger($line); + } + exit 2; +} + +if ($opts{daemon}) { + daemonize(); +} + +install_handlers(); + +do { + make_the_rounds($cfg); + sleep $opts{sleep_interval} if $opts{sleep_interval} > 0; + check_config_file($opts{conf_file}); +} until ($opts{sleep_interval} < 0) ; +if ($opts{syslog}) { + use Sys::Syslog; + closelog; +} +exit 0; + +# Evaluates the trigger and if that's true also performs +# an action. 1 is returned if the action was performed, +# zero otherwise. +sub eval_trigger_action($$$) { + my ($trigger,$action,$perl_action) = @_; + my $etrigger=$trigger; + # It is a pain to predeclare all of the variables assigned + # by ps which is OS and ps specific. So we'll allow anything. + # Likewise, we'll allow it occur in $action. + no strict; + if ($trigger ne '1') { + $etrigger =~ s/"/\\"/g; + debug_log("trigger before substitution: $etrigger", 2); + $etrigger = eval qq/"$trigger"/; + } + debug_log("trigger after substitution: $etrigger", 2); + if (eval ($etrigger)) { + if (defined($perl_action)) { + debug_log("running Perl_action: $perl_action", 2); + eval($perl_action) if $opts{run}; + } + if (defined($action)) { + debug_log("action before substitution: $action", 2); + my $eaction=$action; + $eaction =~ s/"/\\"/g; + $eaction = eval qq/"$eaction"/; + debug_log("action after substitution: $eaction", 2); + my $output=`$eaction` if $opts{run}; + chomp($output); + logger($output) if $output; + } + return 1; + } + return 0; +} + +# Perform a round over the process_patterns comparing against the +# process info to see if anything's stirring. +sub make_the_rounds($) { + my $cfg = $_[0]; + my @ps_info=gather_psinfo(); + foreach our $ps_pat ($cfg->Sections()) { + debug_log("process pattern: /$ps_pat/", 1); + my @selected_ps; + my $in_prolog_epilog=0; + my $trigger = $cfg->val($ps_pat, 'trigger') || '1'; + my $action = $cfg->val($ps_pat, 'action'); + my $perl_action = $cfg->val($ps_pat, 'perl-action'); + my $occurs = $cfg->val($ps_pat, 'occurs') || "first"; + local $count; + if ($ps_pat =~ /^\$PROLOG/ || $ps_pat =~ /\$EPILOG/) { + # Set to run trigger below. + $count = @ps_info; + $in_prolog_epilog=1; + } else { + @selected_ps = grep(/$ps_pat/, @ps_info); + $count = @selected_ps; + debug_log("count for /$ps_pat/: $count", 2); + } + if ($in_prolog_epilog) { + # execute trigger + eval_trigger_action($trigger, $action, $perl_action); + } elsif ($occurs =~ /none/i) { + if ($count eq 0) { + # execute the trigger anyway + eval_trigger_action($trigger, $action, $perl_action); + } + } elsif ($count gt 0) { + TRIGGER: + foreach (@selected_ps) { + next if !/\s*(\d+)\s+(\S+)/; + local($pid, $command) = /\s*(\d+)\s+(\S+)/; + if ($pid !~ /\d+/) { + logger("Something wrong with ps format:\n$_"); + next; + } + + my $ps_fullcmd = sprintf $ps_fullcmd_fmt, $pid; + my @output = `$ps_fullcmd`; + my $output=''; + if (@output == 1) { + # Got one line of output - good. + $output=$output[0]; + # Make sure though we don't just have a title line. + # One of the fields should be just digits, e.g. ppid, uid, gud... + next if $output !~ m{\s+\d+\s+}; + } elsif (@output == 2 && @PS_NO_NULL_HEADER@) { + # Got two lines of output - we are running a ps where + # we can't remove the title line? + $output=$output[1]; + } elsif (@output > 1 && @PS_CAN_RETURN_MULTIPLE_LINES@) { + # Got multiple lines of output - we are running a ps which can + # do so. For example Solaris does this for a process that has many + # LWPs (light-weight processes). + $output=$output[0]; + } else { + debug_log("Something wrong getting ps variables", 1); + next; + } + + local $args = ''; + if ($ps_arg_opts) { + my $ps_argscmd = sprintf $ps_args_fmt, $pid; + my @output = `$ps_argscmd`; + if (@output == 1) { + $args=$output[0]; + } elsif (@output == 2 && @PS_NO_NULL_HEADER@) { + $args=$output[1]; + } else { + debug_log("Something wrong with getting command arguments", 1); + } + } + + # Process may have disappeared. In this case we'll get no + # output. + next if !$output; + + # Add ' ' so split will junk first ps_dvars $junk. + $output = ' ' . $output; + my $perl_ps_assign = "$ps_dvars = split(/\\s+/, \$output)"; + { + # It is a pain to predeclare all of the variables assigned + # by ps which is OS and ps specific. So we'll allow anything. + # Likewise, we'll allow it occur in $action. + no strict; + + # Escape backticks so that we don't inadvertently run + # the program. For example there could be a process named + # `/tmp/evilcommand` (with backticks). Thanks to Randal + # Schwartz for noticing the problem. + # Not sure if there are other things to watch out for. + # Although the Perl Cookbook suggests how to make system, + # safe, it is silent about making eval safe. + $command =~ s/`/\\`/g; + + if (eval ($perl_ps_assign)) { + my $evaled = eval_trigger_action($trigger, $action, + $perl_action); + last TRIGGER if $evaled && $occurs eq 'first-trigger'; + last TRIGGER if $occurs eq 'first'; + } else { + logger("Something wrong with perl assignment: $perl_ps_assign"); + last TRIGGER; + } + } # no strict + } # foreach + } # if $count + } +} + +# Initailize various variables variously. +sub init() { + + use File::Basename; + $program = basename($0); # Who am I today, anyway? + + $DEVNULL = '/dev/null'; # And what do we do about non Unix? + + use constant MINS => 60; + use constant HOURS => 60*60; + use constant DAYS => HOURS * 24; + + $opts{debug} = 0; # no debugging + $opts{run} = 1; # run actions + $opts{syslog} = 1; # Log errors to syslog + $opts{logfile} = $DEVNULL; + $opts{daemon} = 1; # Run as daemon; + $opts{ps_prog} = '@PS@'; # Where is ps? + $opts{ps_pid_opts} = '@PS_PID_OPTS@'; # How do I get pids and commands? + + $ps_arg_opts = '@PS_ARGS@'; # How do I get full process command? + + # List of all the fields from ps we will be able to use. Don't need + # to list variables listed above. + @ps_vars = qw ( @PS_VARS@ +); + + # Convert the above into an argument list like + # ($junk, $user, ... ) + # The first argument ($junk) will be null and thrown out. + $ps_dvars = '($junk,$' . join(',$', @ps_vars) . ')'; + + $opts{sleep_interval} = 300; + +} + +# The bane of programming. +sub process_options() { + use Getopt::Long; + my(@opt_cf); + $Getopt::Long::autoabbrev = 1; + my($newstyle_config); + + my ($help, $long_help, $show_version); + + my $result = &GetOptions + ( + 'help' => \$help, + 'doc' => \$long_help, + 'version' => \$show_version, + 'config=s' => \$opts{conf_file}, + 'debug=i' => \$opts{debug}, + 'path=s' => \$ENV{PATH}, + 'ps-pid-opts=s'=> \$opts{ps_pid_opts}, + 'ps-prog=s' => \$opts{ps_prog}, + 'sleep=i' => \$opts{sleep_interval}, + 'log:s' => \$opts{logfile}, + 'syslog!' => \$opts{syslog}, + 'run!' => \$opts{run}, + 'daemon!' => \$opts{daemon}, + ); + + show_version() if $show_version; + usage(1) if $help; + podthis() if $long_help; + + # However specifying a configuration file is not. + # Nor can we deal with multiple configuration files or tolerate + # option-processing errors. + usage(0) if !$result; + + # The option-specifier "--config" is optional... + if (@ARGV && !defined($opts{conf_file})) { + $opts{conf_file} = shift(@ARGV); + } + + # However we do have to give exactly one configurtion file. + if (!defined($opts{conf_file}) || @ARGV != 0) { + print STDERR "$program: Please specify exactly one configuration file.\n"; + usage(0); + } + + $ps_cmd = "$opts{ps_prog} $opts{ps_pid_opts}"; + my $ps_vars; + if (@PS_CUSTOM_HEADER@) { + $ps_vars = join('= -o ', @ps_vars) . '='; + } else { + $ps_vars = join(' -o ', @ps_vars); + } + + if ('@PS_FULLCMD_FMT@') { + $ps_fullcmd_fmt = "@PS_FULLCMD_FMT@"; + } else { + $ps_fullcmd_fmt = "$opts{ps_prog} -p %d -o $ps_vars"; + } + if ('@PS_ARGS_FMT@') { + $ps_args_fmt = "@PS_ARGS_FMT@"; + } else { + $ps_args_fmt = "$opts{ps_prog} -p %d $ps_arg_opts"; + } + + open STDIN, $DEVNULL or die "Can't read $DEVNULL: $!"; + if ($opts{logfile} ne '') { + open STDOUT, ">>$opts{logfile}" or + die "Can't write STDOUT to $opts{logfile}: $!"; + open STDERR, ">>&STDOUT" or + die "Can't write STDERR to $opts{logfile}: $!"; + } +} + +# Signal handling.. +sub install_handlers { + $SIG{'QUIT'} = \&terminate; + $SIG{'TERM'} = \&terminate; + $SIG{'INT'} = \&terminate; + $SIG{'HUP'} = \&null_handler; + $SIG{'USR1'} = \&debug_up_handler; + $SIG{'USR2'} = \&debug_down_handler; +} + +# Used perhaps to break out of a deep sleep. +sub null_handler { + my($signo) = @_; + logger("Received signal: ${signo}"); +} + +# Increase verbosity of debugging. +sub debug_up_handler { + my($signo) = @_; + $opts{debug}++; + logger("Received signal: ${signo}. Increasing debugging to $opts{debug}."); +} + +# Decrease verbosity of debugging. +sub debug_down_handler { + my($signo) = @_; + $opts{debug}--; + logger("Received signal: ${signo}. Decreasing debugging to $opts{debug}."); +} + +# Signal handler to go down recording the signal. +sub terminate { + my($signo) = @_; + use Config; + if (defined $Config{sig_name}) { + my $i = 0; + my @signame; + my %sig; + foreach my $name (split(' ', $Config{sig_name})) { + $signame[$i] = $name; + $sig{$name} = $i; + $i++; + } + $signo = $sig{$signo} if exists($sig{$signo}); + if ($signo =~ m{\A\d+\Z} ) { + logger("Going down on $signame[$signo] (${signo}) signal. " . + "Have a nice day!"); + } + } else { + logger("Going down on signal ${signo}). Have a nice day!"); + } + + $signo = 15 if $signo !~ m{\A\d+\Z}; + if ($opts{syslog}) { + use Sys::Syslog; + closelog; + } + exit $signo; +}; + +# Utility function for parsing/converting elapsed time into seconds. +sub elapsed2secs($) { + $_ = $_[0]; + + # Handle formats like: + # 1-08:34:37 -- One day, 8 hours, 34 minutes, 37 seconds + # 20:40:34 -- 20 hours, 40 minutes, 34 seconds + # 0:00 -- 0 seconds. + + # 1-08:34.37 -- One day, 8 hours, 34 minutes, 37 seconds + # 20:40.34 -- 20 hours, 40 minutes, 34 seconds + # 5.03 -- 5 minutes, 3 seconds. + # 5 -- 5 seconds. + + # Some easy cases. + return -1 if !defined($_) || m{\A\s*\Z}; + return $_ if m{\A\d+\Z}; + + # Originally had as one pattern and optional + # arguments but i got compaints about using + # uninitialized variables even with "no diagonstics". Would rather + # switch than fight. + my $min_secs_pat = '(\d{1,2})[:.](\d\d)'; + if (m{ + (\d{1,2})- # The number of days. e.g. 1- or 19- or blank + (\d{1,2})[:.] # The number of hrs. e.g. 01: or 23: or blank + $min_secs_pat + }x) { + my ($days, $hours, $minutes, $secs) = ($1, $2, $3, $4); + return ($days*DAYS + $hours*HOURS + $minutes*MINS + $secs); + } elsif (m{ + (\d{1,2})[:.] # The number of hrs. e.g. 01: or 23: or blank + $min_secs_pat + }x) { + my ($hours, $minutes, $secs) = ($1, $2, $3); + return ($hours*HOURS + $minutes*MINS + $secs); + } elsif (m{$min_secs_pat}) { + my ($minutes, $secs) = ($1, $2); + return ($minutes*MINS + $secs); + } else { + logger("Error in converting $_ to seconds"); + return -1; + } +} + +# Return time and PID as string in a common format +sub timestring() { + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = + localtime(time); + $mon++; + return sprintf( "%.2d/%.2d/%.2d %.2d:%.2d:%.2d %s[$$]", + $mon, $mday, $year%100, $hour, $min, $sec, $program); +} + +# log error to syslog and print to STDERR. +sub logger($) { + my($msg) = shift; + + if ($opts{syslog}) { + if (!$logopened) { + use Sys::Syslog; + $logopened++; + openlog($program,'cons,pid', 'err'); + } + syslog('info', $msg); + } + if (defined($opts{logfile}) && $opts{logfile} ne $DEVNULL) { + my $ts=timestring(); + print STDERR "$ts: $msg\n"; + } +} + +sub debug_log($$) { + my($msg, $level) = @_; + logger("** debug ** $msg") if $opts{debug} >= $level; +} + +sub gather_psinfo() { + my @output=`$ps_cmd`; + return @output; +} + +# Show the CVS version id string and quit. +sub show_version() { + print "$vcid +Copyright (C) 2000, 2002, 2003, 2004, 2006, 2008 Rocky Bernstein. +This is free software; see the source for copying conditions. +There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. +"; + exit 10; +} + + +sub daemonize() { + chdir '/' or die "Can't chdir to /: $!"; + defined(my $pid = fork) or die "Can't fork: $!"; + exit 0 if $pid; + use POSIX qw(setsid); + setsid() or die "Can't start a new session: $!"; + umask 0; +} + +# Time configuration file was last read. +my $conf_time; + +# Read a configuration file. +sub read_config($) { + use Config::IniFiles; + my($cf)=@_; + if (!-f $cf || !-r _ || -z _ || !-T _) { + logger("Unusable config file: <$cf>"); + return undef; + } + + # Save time we read the configuration file so we can check back + # later to see if it changed. + + my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime) = stat $cf; + $conf_time = $mtime; + + return new Config::IniFiles( -file => $cf ); +} + +# Check to see if any configuration file has changed +# since the last time this routime was called. +# Updates global $conf_time. +sub check_config_file($) { + my ($conf_file) = @_; + my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime) = stat $opts{conf_file}; + if ( defined($conf_time) && defined($mtime) && $conf_time < $mtime ) { + logger("Configuration file $conf_file modified; re-reading..."); + $cfg = read_config($conf_file); + } +} + +sub run_trigger($$$) { + my($trigger, $action, $count) = @_; + my $etrigger=$trigger; + if ($trigger ne '1') { + $etrigger =~ s/"/\\"/g; + debug_log("trigger before substitution: $etrigger", 2); + $etrigger = eval qq/"$trigger"/; + } + debug_log("trigger after substitution: $etrigger", 2); + if (eval ($etrigger)) { + debug_log("action before substitution: $action", 2); + my $eaction=$action; + $eaction =~ s/"/\\"/g; + $eaction = eval qq/"$eaction"/; + debug_log("action after substitution: $eaction", 2); + my $output=`$eaction` if $opts{run}; + chomp($output); + logger($output) if $output; + } +} + +sub podthis() { + use Pod::Text; + $^W = 0; + pod2text $0; + exit 101; +} + +#-------------------------------------------------- +=pod + +=head1 NAME + +@PACKAGE@ - monitors various processes based on ps-like information. + + +=head1 SYNOPSIS + +B<@PACKAGE@> [I...] + [C<--config>] I + +=head1 DESCRIPTION + +Periodically a list of processes obtained via C. More precisely +each item in the list contains the process name (just what's listed in +the "cmd" field, not the full command and arguments) and its process +id (pid). A configuration file specifies a list of Perl +regular-expression patterns to match the processes against. For each +match, a Perl expression specified for that pattern is evaluated. The +evaluated expression can refer to variables which are set by ps and +pertain to the matched process(es), for example the amount memory +consumed by the process, or the total elapsed time. Some other +variables are set by the program, such as the number of times the +process is running. If the Perl expression for a matched pattern +evaluates true, then an action can be run such as killing the program, +restarting it, or mailing an alert, or running some arbitrary Perl +code. + +Some things you might want to watch a daemon or process for: + +=over 2 + +=item * + +check that it is running (hasn't died) + +=item * + +ensure it is not running too many times + +=item * + +isn't consuming too much memory (perhaps a memory leak), or I/O + +=back + +Some actions you might want to take: + +=over 2 + +=item * + +restart a process + +=item * + +kill off rampant processes + +=item * + +send an alert about any of the conditions listed above + +=back + +Depending on options specfied, this program can be run as a daemon, +run once (which is suitable as a C job), or run not as a daemon +but still continuously (which may be handy in testing the program or +your configuration). + +=head2 OPTIONS + +=over 4 + +=item --help + +Print a usage message on standard error and exit with a return code +of 100. + +Z<> + +=item --doc + +Extact the full documentation that you are reading now, print it and +exit with a return code of 101. + +Z<> + +=item --version + +Print the version release on standard output and exit with a return +code of 10. + +Z<> + +=item --debug I + +Give debugging output. The higher the number, the more the output. The +default is 0 = none. 2 is the most debugging output. + +=item [--config] I + +Specify configuration file. . + +See L below for information on the format +of the configuration file and L for a complete +example of a configuration file. + +Z<> + +=item --log [I] + +Send or don't send error and debugging output to a log file. If option +is given but no logfile is specified, then use STDERR. The default is +no error log file. See also --syslog below. + +Z<> + +=item --syslog | --nosyslog + +Send or don't send error and debugging output to syslog. The default +is to syslog error and debug output. + +Z<> + +=item --daemon | --nodaemon + +Run or don't as a daemon. + +Z<> + +=item --path I + +Specify the executable search path used in running commands. + +=item --ps-prog I + +One can specify the command that gives ps information. By default, the +command is F<@PS@>. + +Z<> + +=item --run | --norun + +do/don't run actions go through the motions as though we were going +to. This may be useful in debugging. + +Z<> + +=item --sleep I + +It is expected that one might want to run @PACKAGE@ over and over +again. In such instances one can specify the amount of time between +iterations with this option. + +If a negative number is specified the program is run only once. + +Z<> + +=back + +=head2 CONFIGURATION FILE MODIFICATION AND SIGNAL HANDLING + +Periodically @PACKAGE@ checks to see if the configuration file +that it was run against has changed. If so, the program rereads the +configuration file. + +More precisely, the checks are done after waking up from a slumber. +If the sleep interval is long (or if you are impatient), you can +probably force the program to wake up using a HUP signal. + +At any time you can increase the level of debug output by sending a +USR1 signal to the @PACKAGE@ process. Similarly you can decrease the +level of debug output by sending the process a USR2 signal. + +It is recommended that you terminate @PACKAGE@ via an INT, TERM, or QUIT +signal. + +=head1 CONFIGURATION FILE FORMAT + +The format of a configuration file is a series of fully qualified +filenames enclosed in square brackets followed by a number of +parameter lines. Each parameter line has a parameter name followed by +an "equal" sign and finally value. That is: + + # This is a comment line + ; So is this. + [process-pattern1] + parameter1 = value1 + parameter2 = value2 + + [process-pattern2] + parameter1 = value3 + parameter2 = value4 + +Comments start with # or ; and take effect to the end of the line. + +This should be familiar to those who have worked with text-readible +Microsoft C<.INI> files. + +Note process patterns, (F and F +above) must be unique. If there are times when you may want to +refer to the same process, one can be creative to make these unique. +e.g. F and F<[c]ron> which refer to the same process even +though they I to be different. + +As quoted directly from the Config::IniFiles documentation: + +Multiline or multivalued fields may also be defined ala UNIX +"here document" syntax: + + Parameter=< match exactly, including any trailing +whitespace. + +There are two special "process patterns": $PROLOG and $EPILOG, the +former should appear first and the latter last. + +You can put perl code to initialize variables here and do cleanup +actions in these sections using "perl-action." + +A description of parameters names, their meanings and potential values +follows. + +=over + +=item trigger + +This parameter specifies the condition on which a process action is +fired. The condition is evaluated with Perl eval() and should +therefore return something which is equivalent to "true" in a Perl +expression. + +If no trigger is given in a section, true or 1 is assumed and +the action is unconditionally triggered. + +Example: + + # Match if httpd has not spawned enough (<4) times. NFS and databases + # daemons typically spawn child processes. Since the program + # matches against the command names, not commands and arguments, + # something like: ps -ef | grep httpd won't match the below. + # If you want to match against the command with arguments, see + # the example with $args below. + [httpd$] + trigger = $count <= 4 + +=item occurs + +This parameter specifies how many times an action should be performed +on processes matching the section trigger. Acceptable values are +"every", "first", "first-trigger", and "none". + +Setting the occurs value to "none" causes the the trigger to be +evaluated when there are no matching processes. Although one might +think "$count == 0" in the action expression would do the same thing, +currently as coded this does not work. + +Setting the occurs value to "first" causes the process-pattern rule to +be finished after handling the first rule that matches, whether or not the +trigger evaluated to true. + +Setting the occurs value to "first-trigger" causes the process-pattern +rule to be finished after handling the first rule that matches I +the trigger evaluates to true. + +If the item parameter is not specified, "first" is assumed. + +Examples: + + [.] + occurs = first + action = echo "You have $count processes running" + + # Note in the above since there is no trigger specified, + # occurs = first + # is the same thing as + # occurs = first-trigger + + [.?] + trigger = $vsz > 1000 + occurs = every + action = echo "Large program $command matches $ps_pat: $vsz KB" + + # Fire if /usr/sbin/syslogd is not running. + # Since the program matches against the command names, not commands and + # arguments, something like: + # ps -ef | grep /usr/sbin/syslogd + # won't match the below. + [(/usr/sbin/)?syslogd] + occurs = none + action = /etc/init.d/syslogd start + +=item action + +This specifies the action, a command that gets run by the system +shell, when the trigger condition is evaluated to be true. + +Example: + + action = /etc/init.d/market_loader.init restart + +=item perl-action + +This specifies Perl statements to be eval'd. This can be especially +useful in conjunction with $PROLOG and $EPILOG sections to make tests +across collections of process and do things which @PACKAGE@ +would otherwise not be able to do. + +Example: + + # A Perl variable initialization. + # Since @PACKAGE@ runs as a daemon it's a good idea + # to (re)initialize variables before each run. + [$PROLOG] + perl-action = $root_procs=0; + + # Keep track of how many root processes we are running + [.*] + perl-action = $root_procs++ if $uid == 0 + occurs = every + + # Show this count. + [$EPILOG] + action = echo "I counted $root_procs root processes" + +=back + +=head2 EXPANDED VARIABLES IN TRIGGER/ACTION CLAUSES + +Any variables defined in the program can be used in pattern or +action parameters. For example, C<$program> can be used to refer to +the name of this program @PACKAGE@. + +The following variables can be used in either the pattern or action +fields. + +=over + +=item $action + +A string containing the text of the action to run. + +Z<> + +=item $perl_action + +A string containing the text of the perl_action to run. + +Z<> + +=item $ps_pat + +The Perl regular expression specified in the beginning of the section. + +Z<> + +=item $command + +The command that matched $ps_pat. + +The Perl regular expression specified in the beginning of the section. +Normally processes will not have funny characters in them. Just in +case, backticks in $command are escaped. + +Example: + + # List processes other than emacs (which is a known pig) that use lots + # of virtual memory + + [.*] + trigger = $command !~ /emacs$/ && $vsz > 10 + action = echo \"Looks like you have a big \$command program: \$vsz KB\" + +Z<> + +=item $count + +The number of times the pattern matched. Presumably the number of +processes of this class running. + +Z<> + +=item $trigger + +A string containing the text of the trigger. + +=back + +A list of variables specific to this program or fields commonly found in +C output is listed below followed by a description of the more +common ones. See also C for a more complete +description of the meaning of the field. + + @PS_VARS@ + +Beware though, in some situations ps can return multiple lines for a +single process and we will use just one of these in the trigger. In +particular, Solaris's C will return a line for each LWP (light-weight +process). So on Solaris, if a trigger uses variable lwp, it may or may +not match depending on which single line of the multiple C lines is +used. + +Z<> + +=over + +=item $args + +The command along with its command arguments. It is possible that this +is might get truncated at certain length (if ps does likewise as is +the case on Solaris). + +Z<> + +=item $ppid + +The parent process id. + +Z<> + +=item $stime + +The start time of the process. + +Z<> + +=item $etime + +The end time of the process. + +Z<> + +=item $pmem + +The process memory. + +Z<> + +=item $pcpu + +The percent CPU utilization. + +Z<> + +=item $tty + +The controlling tty. + +Z<> + +=item $vsz + +Virtual memory size of the process + +=back + +=head2 OTHER THINGS IN TRIGGER CLAUSES + +To make testing against elapsed time easier, a function C +has been written to parse and convert elapsed time strings in the +format C and a number of seconds. + +Some constants for the number of seconds in a minute, hour, or day +have also been defined. These are referred to as C, C, +and C respectively and they have the expected definitions: + + use constant MINS => 60; + use constant HOURS => 60*60; + use constant DAYS => HOURS * 24; + +Here is an example of the use of C: + + # Which processes have been running for more than 3 hours? + # Also note use of builtin-function elapsed2secs, variable $etime + # and builtin-function HOURS + [.] + trigger = elapsed2secs('$etime') > 1*DAYS + action = echo "$command has been running more than 1 day ($etime)" + occurs = every + +Please note the quotes around '$etime'. + +=head1 EXAMPLE CONFIGURATION + + # Comments start with # or ; and go to the end of the line. + + # The format for each entry is in Microsoft .INI form: + # [process-pattern] + # trigger = perl-expression + # action = program-and-arguments-to-run + + [httpd$] + trigger = $count < 4 + action = echo "$trigger fired -- You have $count httpd sessions." + + [.] + trigger = $vsz > 10 + action = echo "Looks like you have a big $command program: $vsz KB" + + # Unfortunately we have use a different pattern below. (Here we use + # ".?" instead of ".".) In effect the the two patterns mean + # test every process. + [.?] + trigger = elapsed2secs('$etime') > 2*MINS && $pcpu > 40 + occurs = every + action = < is active. We make +use of lsof to check port 3333 and the $PROLOG make sure it runs. + + [$PROLOG] + occurs = first + trigger = { \$x=`lsof -i :3333 >/dev/null 2>&1`; \$? >> 8 } + action = < option +that is available which can be used to set the executable search path. +All commands used by @PACKAGE@ are fully qualified, and I generally +give a full execution path in my configuration file, so consider using +the option C<--path=''>. + +Commands that need to be run as root you can run via C. I often +run process accounting which tracks all commands run. Tripwire may be +useful to track changed configuration files. + +=head1 TROUBLESHOOTING + +To debug a configuration file the following options are useful: + + @PACKAGE@ --log --nodaemon --sleep -1 --debug 2 *config-file* + +For even more information and control try running the above under the +perl debugger, e.g. + + perl -d @PACKAGE@ --log --nodaemon --sleep -1 --debug 2 *config-file* + +=head1 BUGS + +Well, some of these are not so much a bug in @PACKAGE@ so much as a +challenge to getting @PACKAGE@ to do what you want it to do. + +One common problem people run in into is understanding exactly what +the process variables mean. The manual page L should be of +help, but I've found some of the descriptions either a bit vague or +just plain lacking. + +Sometimes one will see this error message when debug tracing is turned on: + + ** debug ** Something wrong getting ps variables + +This just means that the process died between the time @PACKAGE@ first +saw the existence of the process and the time that it queried +variables. + +=head1 SEE ALSO + +See also L and L. + +Another cool program doing ps-like things is C. Well okay, it's +another program I distributed. It shows the process tree dynamically +updated using X Motif and tries to display the output "attractively" +but fast. You can the find the homepage at +L and it download via +L + +=head1 AUTHOR + +Rocky Bernstein (rocky@gnu.org) + +=head1 COPYRIGHT + + Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2008 + Rocky Bernstein, email: rocky@gnu.org. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/samples/README b/samples/README new file mode 100644 index 0000000..839bcb4 --- /dev/null +++ b/samples/README @@ -0,0 +1,10 @@ +sample.ini - you can use this as a template to make other configuration + files. It has lots of comments at the beginning to remind + you of what's allowed +sample2.ini - sample configuration file to alert when more than 10% + of a processes is in use. +solaris.ini - System processes that you might want to check on, customized + for Solaris. Checks that cron and syslogd are running, + and that no process uses more than 70% of the available CPU. + +$Id: README,v 1.2 2000/04/09 20:40:43 rocky Exp $ \ No newline at end of file diff --git a/samples/port-watch.ini b/samples/port-watch.ini new file mode 100644 index 0000000..7517ecb --- /dev/null +++ b/samples/port-watch.ini @@ -0,0 +1,13 @@ +# $Id: port-watch.ini,v 1.1 2004/09/07 13:51:08 rockyb Exp $ + +# Here is an example to show how to use ps-watcher to do something +# not really possible from ps: check to see if a *port* is active. +# We make use of lsof to check port 3333 and the $PROLOG make +# sure it runs. + +[$PROLOG] + occurs = first + trigger = { \$x=`lsof -i :3333 >/dev/null 2>&1`; \$? >> 8 } + action = < 1*DAYS + action = echo "$command has been running more than 1 day ($etime)" + occurs = every + +[^] + trigger = $vsz > 8000 + occurs = every + action = echo "Large program $command (pid $pid) matches /$ps_pat/: $vsz KB" + +# Scripts don't show as the script name as the command name on some +# operating systems. Rather the name of the interpreter is listed +# (e.g. bash or perl) Here's how you can match against a script. Note +# escaping $ in the trigger but not the action. + +# Note: BSD/OS on the other hand give the script name rather than the +# interpreter name. + +[/usr/bin/perl] + trigger = \$args !~ /ps-watcher/ + occurs = every + action = echo "***found perl program ${pid}:\n $args" + diff --git a/samples/sample2.ini b/samples/sample2.ini new file mode 100644 index 0000000..7725155 --- /dev/null +++ b/samples/sample2.ini @@ -0,0 +1,4 @@ +[.] + trigger = $pcpu > 10 + action = echo "$command using $pcpu% CPU" | /bin/mail root + diff --git a/samples/solaris.ini b/samples/solaris.ini new file mode 100644 index 0000000..9ddc74a --- /dev/null +++ b/samples/solaris.ini @@ -0,0 +1,18 @@ +# $Id: solaris.ini,v 1.3 2000/04/09 20:40:21 rocky Exp $ +# Processes one might want to monitor under Solaris + +[(/usr/sbin/)?cron] + trigger = $count=1 + action = echo "$command not running" | /usr/ucb/mail -s "$command down" root + +[(/usr/sbin/)?sylogd] + trigger = $count=1 + action = echo "$command not running" | /usr/ucb/mail -s "$command down" root + +[.] + trigger = $pcpu > 70 + occurs = every + action = < "Test::Pod 1.14 required for testing POD" if $@; +all_pod_files_ok(catfile($top_builddir, "ps-watcher")); diff --git a/tests/01.pod.t.in b/tests/01.pod.t.in new file mode 100644 index 0000000..b288d82 --- /dev/null +++ b/tests/01.pod.t.in @@ -0,0 +1,9 @@ +#!@PERL@ -w -T -*- Perl -*- +# $Id: 01.pod.t.in,v 1.1 2006/03/09 17:37:31 rockyb Exp $ +my $top_builddir = $ENV{top_builddir} ? $ENV{top_builddir} : '..'; + +use Test::More; +use File::Spec::Functions; +eval "use Test::Pod 1.14"; +plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; +all_pod_files_ok(catfile($top_builddir, "@PACKAGE@")); diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..e84499e --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,38 @@ +############################################################################## +# $Id: Makefile.am,v 1.9 2006/03/09 17:37:31 rockyb Exp $ +# Copyright (C) 2003, 2004, 2006 Rocky Bernstein +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################## + +MOSTLYCLEANFILES = *~ + +# The keeps automake from substituting PS_VARS +PS_VARS = '' + +check_SCRIPTS = 01.pod.t args.t basic.t count.t full.t paction.t + +check_DATA = args.cnf basic.cnf \ + count.cnf full.cnf paction.cnf + +EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ + 01.pod.t.in args.t.in basic.cnf.in count.t.in driver + +all: + +check: test + +test: + srcdir=$(srcdir); export srcdir; \ + $(PERL) $(srcdir)/driver diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..4dffd85 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,351 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +############################################################################## +# $Id: Makefile.am,v 1.9 2006/03/09 17:37:31 rockyb Exp $ +# Copyright (C) 2003, 2004, 2006 Rocky Bernstein +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################## +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = tests +DIST_COMMON = $(srcdir)/01.pod.t.in $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/args.t.in \ + $(srcdir)/basic.cnf.in $(srcdir)/basic.t.in \ + $(srcdir)/count.t.in $(srcdir)/full.t.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = 01.pod.t args.t basic.t count.t full.t basic.cnf +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CVS2CL = @CVS2CL@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PERL = @PERL@ +PS = @PS@ +PS_ARGS = @PS_ARGS@ +PS_ARGS_FMT = @PS_ARGS_FMT@ +PS_CAN_RETURN_MULTIPLE_LINES = @PS_CAN_RETURN_MULTIPLE_LINES@ +PS_CUSTOM_HEADER = @PS_CUSTOM_HEADER@ +PS_FULLCMD_FMT = @PS_FULLCMD_FMT@ +PS_NO_NULL_HEADER = @PS_NO_NULL_HEADER@ +PS_PID_OPTS = @PS_PID_OPTS@ +PS_TIME_VAR = @PS_TIME_VAR@ + +# The keeps automake from substituting PS_VARS +PS_VARS = '' +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +MOSTLYCLEANFILES = *~ +check_SCRIPTS = 01.pod.t args.t basic.t count.t full.t paction.t +check_DATA = args.cnf basic.cnf \ + count.cnf full.cnf paction.cnf + +EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ + 01.pod.t.in args.t.in basic.cnf.in count.t.in driver + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +01.pod.t: $(top_builddir)/config.status $(srcdir)/01.pod.t.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +args.t: $(top_builddir)/config.status $(srcdir)/args.t.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +basic.t: $(top_builddir)/config.status $(srcdir)/basic.t.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +count.t: $(top_builddir)/config.status $(srcdir)/count.t.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +full.t: $(top_builddir)/config.status $(srcdir)/full.t.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +basic.cnf: $(top_builddir)/config.status $(srcdir)/basic.cnf.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) $(check_DATA) +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am + + +all: + +check: test + +test: + srcdir=$(srcdir); export srcdir; \ + $(PERL) $(srcdir)/driver +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/args.cnf b/tests/args.cnf new file mode 100644 index 0000000..2836a33 --- /dev/null +++ b/tests/args.cnf @@ -0,0 +1,13 @@ +# Scripts on some OS's don't show as the script name as the command name. +# Rather the name of the interpreter is listed (e.g. bash or perl) +# Here's how you can match against a script. +# Look for my processes: ps-watcher. +[perl] + trigger = \$args =~ /ps-watcher --log/ + action = echo "ok 1" + occurs = every +# On BSD/OS the name of the script rather than the interpreter is show. +[ps-watcher] + trigger = \$args =~ /ps-watcher --log/ + action = echo "ok 1" + occurs = every diff --git a/tests/args.t b/tests/args.t new file mode 100755 index 0000000..411ee8c --- /dev/null +++ b/tests/args.t @@ -0,0 +1,38 @@ +#!/usr/bin/perl -w +# $Id: args.t.in,v 1.8 2006/03/10 13:12:36 rockyb Exp $ +# Arg checks +use strict; +use Test::More; +use Config; + +if ('cygwin' eq $Config{osname}) { + plan( skip_all => "cygwin's ps is not powerful enough this test"); + exit 0; +} + +plan( tests => 2); + +my $test='args'; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my $cmd = "/usr/bin/perl ../ps-watcher --log --nosyslog --nodaemon " + . " --sleep -1 --config ${srcdir}/$test.cnf"; +my @output = `$cmd 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $count=0; +foreach (@output) { + if (/^.+:\s+.*ok/) { + s/.+:\s+//; + ok(1, "Saw first matching process"); + $count++; + last; + } +} +ok($count>0, "Saw more than one matching process"); + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/args.t.in b/tests/args.t.in new file mode 100644 index 0000000..ecfb7f7 --- /dev/null +++ b/tests/args.t.in @@ -0,0 +1,38 @@ +#!@PERL@ -w +# $Id: args.t.in,v 1.8 2006/03/10 13:12:36 rockyb Exp $ +# Arg checks +use strict; +use Test::More; +use Config; + +if ('cygwin' eq $Config{osname}) { + plan( skip_all => "cygwin's ps is not powerful enough this test"); + exit 0; +} + +plan( tests => 2); + +my $test='args'; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my $cmd = "@PERL@ ../ps-watcher --log --nosyslog --nodaemon " + . " --sleep -1 --config ${srcdir}/$test.cnf"; +my @output = `$cmd 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $count=0; +foreach (@output) { + if (/^.+:\s+.*ok/) { + s/.+:\s+//; + ok(1, "Saw first matching process"); + $count++; + last; + } +} +ok($count>0, "Saw more than one matching process"); + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/basic.cnf b/tests/basic.cnf new file mode 100644 index 0000000..ff0282d --- /dev/null +++ b/tests/basic.cnf @@ -0,0 +1,27 @@ +# $Id: basic.cnf.in,v 1.4 2005/04/04 23:50:58 rockyb Exp $ +# We gotta have at least two processes running. Like the OS +# and the ps-watcher program +[.] + trigger = $count > 1 + action = echo "ok 1" + occurs = first + +# Look for my processes +[perl] + action = echo "ok 2" || echo "$ps_pat" + +[.?] + trigger = elapsed2secs('$etime') >= 0 + action = echo "ok 3" + occurs = first + +# I'm assuming there is no process with just a single space. +[^ $] + action = echo "ok 4" + occurs = none + +# Test to see if first-trigger works. +[.*] + trigger = $pid == $$ + action = echo "ok 5" + occurs = first-trigger diff --git a/tests/basic.cnf.in b/tests/basic.cnf.in new file mode 100644 index 0000000..7ae0d2a --- /dev/null +++ b/tests/basic.cnf.in @@ -0,0 +1,27 @@ +# $Id: basic.cnf.in,v 1.4 2005/04/04 23:50:58 rockyb Exp $ +# We gotta have at least two processes running. Like the OS +# and the ps-watcher program +[.] + trigger = $count > 1 + action = echo "ok 1" + occurs = first + +# Look for my processes +[perl] + action = echo "ok 2" || echo "$ps_pat" + +[.?] + trigger = elapsed2secs('$@PS_TIME_VAR@') >= 0 + action = echo "ok 3" + occurs = first + +# I'm assuming there is no process with just a single space. +[^ $] + action = echo "ok 4" + occurs = none + +# Test to see if first-trigger works. +[.*] + trigger = $pid == $$ + action = echo "ok 5" + occurs = first-trigger diff --git a/tests/basic.t b/tests/basic.t new file mode 100755 index 0000000..52977bb --- /dev/null +++ b/tests/basic.t @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w +# $Id: basic.t.in,v 1.8 2006/03/10 19:07:06 rockyb Exp $ +# Some basic checks +use strict; +use Test::More; + +if ( 'etime' ) { + plan( tests => 5); +} else { + plan( tests => 4 ); +} + +my $test='basic'; +my $cmd = "/usr/bin/perl ../ps-watcher --log --nosyslog --nodaemon " + . "--sleep -1 --config $test.cnf"; +my @output = `$cmd 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $i=1; +foreach (@output) { + s/.+:\s+//; + $i++ if (!'etime' && $i==3); + my $result = sprintf "ok %d", $i; + $i++; + ok($_ =~ m{$result}); +} + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/basic.t.in b/tests/basic.t.in new file mode 100755 index 0000000..0f34386 --- /dev/null +++ b/tests/basic.t.in @@ -0,0 +1,32 @@ +#!@PERL@ -w +# $Id: basic.t.in,v 1.8 2006/03/10 19:07:06 rockyb Exp $ +# Some basic checks +use strict; +use Test::More; + +if ( '@PS_TIME_VAR@' ) { + plan( tests => 5); +} else { + plan( tests => 4 ); +} + +my $test='basic'; +my $cmd = "@PERL@ ../ps-watcher --log --nosyslog --nodaemon " + . "--sleep -1 --config $test.cnf"; +my @output = `$cmd 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $i=1; +foreach (@output) { + s/.+:\s+//; + $i++ if (!'@PS_TIME_VAR@' && $i==3); + my $result = sprintf "ok %d", $i; + $i++; + ok($_ =~ m{$result}); +} + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/count.cnf b/tests/count.cnf new file mode 100644 index 0000000..4f09c64 --- /dev/null +++ b/tests/count.cnf @@ -0,0 +1,12 @@ +# $Id: count.cnf,v 1.1 2002/02/06 04:10:54 rocky Exp $ +# Test of count and none parameters + +# I'm assuming there can't be a processes with $ in the name +[fuxaduxa$] + occurs = none + action = echo "ok 1" + +# Look for my processes so there should be at least one. +[perl] + occurs = none + action = echo "not ok 2" diff --git a/tests/count.t b/tests/count.t new file mode 100755 index 0000000..f669bb7 --- /dev/null +++ b/tests/count.t @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w +# $Id: count.t.in,v 1.5 2006/03/10 13:12:36 rockyb Exp $ +# Some count checks +use strict; + +my $test='count'; +print "1..2\n"; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my @output = `/usr/bin/perl ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $count = @output; +foreach (@output) { + s/.+:\s+//; + print $_; +} +print "ok 2\n" unless $count == 2; + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/count.t.in b/tests/count.t.in new file mode 100644 index 0000000..34897fd --- /dev/null +++ b/tests/count.t.in @@ -0,0 +1,24 @@ +#!@PERL@ -w +# $Id: count.t.in,v 1.5 2006/03/10 13:12:36 rockyb Exp $ +# Some count checks +use strict; + +my $test='count'; +print "1..2\n"; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my @output = `@PERL@ ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $count = @output; +foreach (@output) { + s/.+:\s+//; + print $_; +} +print "ok 2\n" unless $count == 2; + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/driver b/tests/driver new file mode 100755 index 0000000..45f7783 --- /dev/null +++ b/tests/driver @@ -0,0 +1,48 @@ +#!/usr/bin/perl -w +#$Id: driver,v 1.1 2000/03/27 01:53:24 rocky Exp $ +use strict; + +use File::Basename; +my $program = basename($0); # Who am I today, anyway? + +sub usage { + print " +usage: + + $program [test1 ... ] + $program --help + +Runs regresion tests (via Test::Harness). + +If no tests are specified all tests that match *.t in the +test directory are run. + +$program --help prints this help. +"; + + exit 100; +} + +use Test::Harness qw(&runtests $verbose); + +my $setup = 0; +process_options(); + +@ARGV = glob("*.t") if !@ARGV; +runtests @ARGV; +exit 0; + +# The bane of programming. +sub process_options { + use Getopt::Long; + $Getopt::Long::autoabbrev = 1; + my $help = 0; + + my $result = &GetOptions + ( + 'help' => \$help, + ); + usage unless $result; + usage if $help; +} + diff --git a/tests/full.cnf b/tests/full.cnf new file mode 100644 index 0000000..010abbc --- /dev/null +++ b/tests/full.cnf @@ -0,0 +1,15 @@ +# $Id: full.cnf,v 1.3 2006/03/10 12:47:37 rockyb Exp $ +# Test to see we can match on all of the processes, not +# just the ones for our account. + +# On a Unix-like system where there always is a pid 1 - init. +# On there is a ppid of 1. +[.] + occurs = first-trigger + trigger = $ppid == 1 + action = echo "ok 1" + +[.?] + occurs = every + trigger = $pid == 1 + action = echo "ok 2" diff --git a/tests/full.t b/tests/full.t new file mode 100755 index 0000000..fef2a32 --- /dev/null +++ b/tests/full.t @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w +# $Id: full.t.in,v 1.6 2006/03/10 13:12:36 rockyb Exp $ +# Some count checks +use strict; +use Test::More; +use Config; + +if ('cygwin' eq $Config{osname}) { + plan( tests => 1); +} else { + plan( tests => 2); +} + +my $test='full'; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my @output = `/usr/bin/perl ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $i=1; +foreach (@output) { + if (/^.+:\s+.*ok/) { + s/.+:\s+//; + my $result = sprintf "ok %d", $i; + $i++; + ok($_ =~ m{$result}); + } +} + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/full.t.in b/tests/full.t.in new file mode 100644 index 0000000..8ad1c32 --- /dev/null +++ b/tests/full.t.in @@ -0,0 +1,34 @@ +#!@PERL@ -w +# $Id: full.t.in,v 1.6 2006/03/10 13:12:36 rockyb Exp $ +# Some count checks +use strict; +use Test::More; +use Config; + +if ('cygwin' eq $Config{osname}) { + plan( tests => 1); +} else { + plan( tests => 2); +} + +my $test='full'; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my @output = `@PERL@ ../ps-watcher --log --sleep -1 --nodaemon --config ${srcdir}/$test.cnf 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $i=1; +foreach (@output) { + if (/^.+:\s+.*ok/) { + s/.+:\s+//; + my $result = sprintf "ok %d", $i; + $i++; + ok($_ =~ m{$result}); + } +} + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/tests/paction.cnf b/tests/paction.cnf new file mode 100644 index 0000000..91cf95e --- /dev/null +++ b/tests/paction.cnf @@ -0,0 +1,21 @@ +# $Id: paction.cnf,v 1.2 2008/12/25 16:42:49 rockyb Exp $ +# Test perl-action, prolog and epilog +# Rather the name of the interpreter is listed (e.g. bash or perl) +# Here's how you can match against a script. +# Look for my processes: ps-watcher. +[$PROLOG] + perl-action = $my_count=0; $root_procs=0; +[.*] + perl-action = < 0 && $my_count < $count && + $root_procs > 0 && $my_count >= $root_procs +EOT + action = echo "ok 1" + diff --git a/tests/paction.t b/tests/paction.t new file mode 100644 index 0000000..096ccf9 --- /dev/null +++ b/tests/paction.t @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +# $Id: paction.t,v 1.2 2006/03/10 03:21:12 rockyb Exp $ +# Arg paction-statement +use strict; +use Test::More; +use Config; + +if ('cygwin' eq $Config{osname}) { + plan( skip_all => "cygwin's ps is not powerful enough this test"); + exit 0; +} + +my $test='paction'; +print "1..2\n"; + +my $srcdir = $ENV{srcdir} ? $ENV{srcdir} : '.'; +my $cmd = "../ps-watcher --log --nosyslog --nodaemon " + . " --sleep -1 --config ${srcdir}/$test.cnf"; +my @output = `$cmd 2>&1`; + +# First line is Id line. This doesn't count in testing. +shift @output; + +my $count=0; +foreach (@output) { + if (/^.+:\s+.*ok/) { + s/.+:\s+//; + print $_; + $count++; + last; + } +} +print "ok 2\n" if $count>0; + +#;;; Local Variables: *** +#;;; mode:perl *** +#;;; End: *** diff --git a/touch.pl b/touch.pl new file mode 100755 index 0000000..b341830 --- /dev/null +++ b/touch.pl @@ -0,0 +1,42 @@ +#!/usr/bin/perl -w +my $vcid='$Id: touch.pl,v 1.4 2006/03/08 19:22:41 rockyb Exp $ '; +# Copyright (C) 1997-2006 R. Bernstein email: rocky@cpan.org +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +use strict; +use File::Basename; +my $program = basename($0); # Who am I today, anyway? + +if (@ARGV != 1) { + print " +usage: + $program *file* + + A perl implimentation of a minimal Unix touch command: creates file *file* + if it does not exist. In either case, the file is given a creation + time of the current time. +"; + exit 100; +} + +print "$ARGV[0]\n"; +if (-e $ARGV[0]) { + my $now = time(); + my $count = utime $now, $now, $ARGV[0]; + exit ($count != 1); +} else { + open(FILE, ">$ARGV[0]") || die "Can't open $ARGV[0]: $!"; + close(FILE); + exit $?; +}