shush-1.2.3/0000755000241700024170000000000011230727466013103 5ustar taranisotaranisoshush-1.2.3/shush.10000644000241700024170000004517210764616742014335 0ustar taranisotaraniso.TH SHUSH 1 "$Date: 2007-09-30 23:38:23 $" .DA December 29, 2006 .SH NAME shush - Run a command and optionally report its output by mail .SH SYNOPSIS .B shush [ .B -h | .B -V ] .B shush [ .B -c \fIdir\fP ] [ .B -S | .B -s \fIfacility\fP ] [ .B -vfmk ] \fIname\fP [ \fIID\fP ] .B shush [ .B -c \fIdir\fP ] [ .B -H \fIto\fP ] [ .B -R \fIto\fP ] [ .B -T \fIto\fP ] -C \fIname\fP [ \fIstdout\fP [ \fIstderr\fP ] ] .B shush [ .B -i | .B -u | .B -r ] [ .B -c \fIdir\fP ] .SH DESCRIPTION \fBshush\fP runs a command and optionally reports its output by mail. It is a useful wrapper around cron jobs. By default, \fBshush\fP will not produce any output when running as everything (if anything) is reported by mail. However, configuration as well as critical errors will be reported on the standard error and (optionally) syslog. Because interrupting \fBshush\fP has dire consequences including the likely loss of any output from the command, the following commonly used signals are ignored by \fBshush\fP: SIGHUP, SIGINT, SIGQUIT and SIGTERM. If one really wants to kill a running instance of \fBshush\fP rather than killing the running managed command, SIGKILL may be used and shall serve as a reminder of how inappropriate such action typically is. For a command to be run using \fBshush\fP, a configuration file \fIname\fP must exist in the configuration directory (\fI$HOME/.shush\fP by default). This file defines how the command should be run as well when to send reports by mail. For details on available configuration parameters, see the \fICONFIGURATION\fP section below. Two additional configuration files may exist: \fIname.stdout\fP and \fIname.stderr\fP (by default). These files are used to look at the standard output and standard error (respectively) produced by the command. For details on how to use these, see the \fICOMMAND OUTPUT\fP section below. When the \fI-C\fP option is specified, \fBshush\fP will only load the configuration, optionally analyze the standard output and standard error from the specified files and finally produce sample reports if desired. This may also be used to produce reports if \fBshush\fP failed to properly terminate when running a command. (The standard output and error from the command are normally found in files located under /tmp.) \fBshush\fP is able to manage \fIcrontab(5)\fP entries based on configurations defined by the user. This may be done in one of two ways. If a file named "\fIschedule\fP" exists in the configuration directory, then it is read for scheduling information. Each line should contain a single entry containing three fields separated by whitespace(s). The fields are (in order) the hostname for which the entry applies or the character "*" to include all hosts, the configuration \fIname\fP, and finally, the scheduling information in the same format as is used by the \fIschedule\fP parameter (see below). To specify an \fIID\fP, use \fIname\fP:\fIID\fP as the second field. If there is no file named "\fIschedule\fP", then \fBshush\fP checks the configuration directory for configuration files and adds them to the current user's \fIcrontab(5)\fP file as specified by the included \fIschedule\fP parameter (see below). Files whose names start with the character "#" or end with the character "~" are ignored. .SH OPTIONS .IP "\fB-h\fP" Display a brief help message. .IP "\fB-V\fP" Display the version information. Prefix with \fB-v\fP to display compile time defaults. .IP "\fB-c \fIdir\fP" Specify the directory where configurations are stored. .IP "\fB-s \fIfacility\fP" Defines the syslog facility to use for logging. .IP "\fB-S\fP" Disable syslog logging. .IP "\fB-v\fP" Copy information log messages to the standard output. .IP "\fB-f\fP" Fast mode: Any configured \fIrandomdelay\fP is ignored. .IP "\fB-m\fP" Monitor and display the command's standard output and error in real time. .IP "\fB-k\fP" Keep the command's output log files instead of deleting them upon completion. .IP "\fB-C\fP" Check the configuration without running any command. .IP "\fB-H \fIto\fP" Send a sample HTML report to the specified recipient(s). .IP "\fB-R \fIto\fP" Send a sample enriched report to the specified recipient(s). .IP "\fB-T \fIto\fP" Send a sample text report to the specified recipient(s). .IP "\fB-i\fP" Use \fIcrontab(1)\fP to install a new \fIcrontab(5)\fP file for the current user. The user must not already have a \fIcrontab(5)\fP file. .IP "\fB-u\fP" Use \fIcrontab(1)\fP to update the current user's \fIcrontab(5)\fP file, which must already exist. .IP "\fB-r\fP" Remove any entry added by the \fB-u\fP option from the current user's \fIcrontab(5)\fP. .SH CONFIGURATION \fBshush\fP configuration files consist of a main section, report section(s) and parameters. The main section defines global parameters as well as defaults for reports. Each report section begins with the name of the report between brackets. Lines beginning with the character "#" are ignored. Parameters should be specified only once. If specified multiple times, all but the last occurrence will be ignored, unless noted otherwise. Parameters are defined using the following syntax: .RS .IP \fIname\fP=\fIvalue\fP .LP .RE or: .RS .IP \fIname\fP@\fIhostname\fP=\fIvalue\fP .LP .RE or: .RS .IP \fIname\fP%\fIID\fP=\fIvalue\fP .LP .RE or finally: .RS .IP \fIname\fP@\fIhostname\fP%\fIID\fP=\fIvalue\fP .LP .RE The second and fourth formats will be ignored unless \fBshush\fP is running on the specified hostname. The third and fourth formats allow defining multiple instances of a single configuration file. Such configuration files require an instance \fIID\fP to be specified in order to run. Any configuration line using the third or fourth formats will be ignored if the \fIID\fP found on that line does not match the instance \fIID\fP used to run \fBshush\fP. The following parameters may appear in the main section: .IP "\fBcommand\fP" The actual command to run. \fBshush\fP sets two environment variables before running the command: \fISHUSH_NAME\fP is set to \fIname\fP, and \fISHUSH_ID\fP is set to \fIID\fP. .IP "\fBconfig\fP" This defaults to the full path of the main configuration file. The other two configuration file names are obtained by appending the ".stdout" and ".stderr" suffixes to the value of this parameter. .IP "\fBlock\fP" If set, this parameter instructs \fBshush\fP to obtain a lock file before running the \fIcommand\fP, and defines the actions to take in case the \fIlockfile\fP is held by another process. The format is a comma separated list of actions. Valid actions are: a time duration (during which \fBshush\fP should simply wait and keep trying to obtain the \fIlockfile\fP), the string "abort" (indicating that \fBshush\fP should terminate immediately if the \fIlockfile\fP already exists), the string "ignore" (indicating that \fBshush\fP should ignore an existing \fIlockfile\fP), the string "loop" (to mark where to start again from when all actions have been executed) and the string "notify=" followed by mail addresses to which a notification mail should be sent. Actions are executed in the order they are provided, and \fBshush\fP will wait forever trying to obtain the \fIlockfile\fP once all the actions have been executed, unless the string "loop" is one of defined actions. Time durations may be specified in units of w(eeks), d(ays), h(ours), m(inutes) or s(econds). If no unit is specified, it is assumed to be minutes. .IP "\fBlockfile\fP" By default, \fBshush\fP will use a file located in the same directory as the configuration file, and named after the configuration and host names. An alternate filename may be specified using this parameter. .IP "\fBlockmsg\fP" If set, this string will be used as subject for lock notification(s) mail messages. The default is "[%u@%h] **PENDING** %N [%t]". See the \fIMAIL SUBJECT\fP section for details on the format. .IP "\fBpath\fP" \fBshush\fP does not modify the environment, except to set the \fBPATH\fP variable if the \fIpath\fP parameter is set. .IP "\fBrandomdelay\fP" If this parameter is set, \fBshush\fP will wait up to the specified amount of time before starting the command unless invoked with the \fB-f\fP. Valid time units are: s(econds), m(inutes), h(ours), d(ays), w(eeks). If no unit is specified, it is assumed to be minutes. .IP "\fBschedule\fP" This defines when to run this command as a cron job, in a \fIcrontab\fP(5) compatible format. Multiple entries may be specified using the character ";" as separator. Entries prefixed by the character "#" will be skipped. This parameter is not directly used by \fBshush\fP to run the command, but used by the \fB-i\fP and \fB-u\fP options. .IP "\fBsendmail\fP" This may be used to override the command used to send mail. .IP "\fBshell\fP" By default, the Bourne shell \fIsh(1)\fP is used to run the \fIcommand\fP, allowing any shell syntax to be used. An alternate shell may be defined using this parameter. .IP "\fBstatedir\fP" This defines the directory where the status of \fBshush\fP is saved and defaults to the ".state" directory under where the configuration is located. An error is generated if the directory does not exist unless this option was not set. Setting this option to an empty string will prevent \fBshush\fP from saving its status. \fIshlast(1)\fP uses these state files to report on running instances of \fBshush\fP as well as previous runs. .IP "\fBsyslog\fP" This parameter is \fBonly\fP used by the \fB-i\fP and \fB-u\fP options and has no other effect on \fBshush\fP. It allows overriding the default syslog facility used for logging and defined at compile time. If left blank, this suppresses the use of syslog. .IP "\fBtimeout\fP" This parameter allows one to control how long the \fIcommand\fP may run. It should be a comma separated list of actions. Valid actions are: a time duration (during which \fBshush\fP should simply wait for the \fIcommand\fP to terminate), a signal (either "SIGNAME" or "-SIGNUMBER") that should be sent to the \fIcommand\fP's process group, a signal (either "=SIGNAME" or "=SIGNUMBER") that should be sent to the \fIshell\fP used to spawn the \fIcommand\fP, the string "loop" (to mark where to start again from when all actions have been executed) and the string "notify=" followed by mail addresses to which a notification mail should be sent. Actions are executed in the order they are provided, and \fBshush\fP will wait forever if the \fIcommand\fP is still running once all the actions have been executed unless the string "loop" is one of defined actions. Time durations may be specified in units of w(eeks), d(ays), h(ours), m(inutes) or s(econds). If no unit is specified, it is assumed to be minutes. .IP "\fBtimeoutmsg\fP" If set, this string will be used as subject for timeout notification(s) mail messages. The default is "[%u@%h] **TIMEOUT** %N [%t]". See the \fIMAIL SUBJECT\fP section for details on the format. .LP The following parameters may appear anywhere in the configuration. If specified in the main section, they define defaults settings that will apply to any report for which the same parameter has not been defined. .IP "\fBto\fP, \fBcc\fP, \fBbcc\fP" Where to send the mail report. .IP "\fBsubject\fP" Subject of the mail report. See the \fIMAIL SUBJECT\fP section for details on the format. .IP "\fBheader\fP" Additional mail header(s). Note that this parameter may be repeated to specify multiple headers. However, only headers from the report (if specified) or from the main section will be used for a given report. .IP "\fBhostprefix\fP" By default, specified subjects are prefixed with the host name between brackets. This parameter allows one to customize this prefix. A positive integer indicates how many components of the fully qualified hostname should be shown. A negative integer indicates how many trailing components of the fully qualified hostname should be trimmed. The integer zero indicates that the prefix should be omitted. This parameter is ignored if the "\fBsubject\fP" contains any "%" character. .IP "\fBuserprefix\fP" By default, specified subjects are prefixed with the username between brackets. This parameter allows to disable this prefix. Any non zero value indicates that the username should be shown while zero causes the prefix to be omitted. This parameter is ignored if the "\fBsubject\fP" contains any "%" character. .IP "\fBoutput\fP" (previously "\fBstderr\fB") This defines how the command's standard output and standard error are captured and reported to the user: "errfirst", "mixed", "outfirst". When using "mixed", the \fIname.stderr\fP configuration file is ignored. When using "errfirst" or "outfirst", individual reports may use one of the following two additional options "outonly" and "erronly". .IP "\fBformat\fP" Mail messages sending the output of the \fIcommand\fP may be sent in three different formats: "text" (the default), "enriched" text or "html". .IP "\fBsizelimit\fP" By default, the entire output of the \fIcommand\fP is sent in mail reports. This parameter may be used to limit the size of the output included in a report. Note that the total size of mail sent will be greater as this limit has no effect upon mail headers. The size can be specified in units of m, k, b, c (MB, KB, Bytes). If no unit is specified, it is assumed to be KB. A limit of zero indicates that the output should not be truncated. .IP "\fBif\fP" A report is only sent if no \fIif\fP condition is specified or if the specified \fIif\fP condition is true. The condition syntax allows for the usual logical operators ("||", "&&", "!"), comparison operators ("==", "!=", "<", "<=", ">", ">=") and basic arithmetic operators ("+", "-"). Aside from counters defined by the configuration (see the \fICOMMAND OUTPUT\fP section below), the following variables may be used: .RS .IP "\fB$exit\fP" If the command terminated normally, this is its exit code. Otherwise, it is negative and indicates the signal number having caused the command to terminate (e.g. -1 indicates signal number 1 caused the command to terminate). .IP "\fB$size\fP" output size (in bytes), same as "$outsize + $errsize" .IP "\fB$outsize\fP" size (in bytes) of standard output .IP "\fB$errsize\fP" size (in bytes) of standard error .IP "\fB$lines\fP" number of lines output .IP "\fB$outlines\fP" number of standard output lines .IP "\fB$errlines\fP" number of standard error lines .IP "\fB$runtime\fP" \fIcommand\fP run time (in seconds) .IP "\fB$utime\fP" user time used by the \fIcommand\fP .IP "\fB$stime\fP" system time used by the \fIcommand\fP .IP "\fB$tty\fP" 1 if \fBshush\fP is run from a terminal (e.g. interactively), 0 otherwise. .SH MAIL SUBJECTS The "\fBlockmsg\fP", "\fBtimeoutmsg\fP" and "\fBsubject\fP" parameters may contain the following tokens which are expanded as described below: .RS .IP "\fB%%\fP" The "%" character .IP "\fB%h\fP" The hostname .IP "\fB%\fP" or "\fB%-\FP" A partial hostname: A positive digit indicates how many components of the fully qualified hostname to keep; a negative digit indicates how many trailing components of the fully qualified hostname to trim. .IP "\fB%i\fP" The instance \fIID\fP .IP "\fB%n\fP" The configuration \fIname\fP .IP "\fB%N\fP" The configuration \fIname\fP and instance \fIID\fP .IP "\fB%r\fP" The report name .IP "\fB%t\fP" The elapsed time. .IP "\fB%u\fP" The username. .IP "\fB%U\fP" The userid. If the "%" character is found in the "\fBsubject\fP" parameter, then the "\fBhostprefix\fP" and "\fBuserprefix\fP" parameters are ignored. .SH COMMAND OUTPUT After the \fIcommand\fP terminates, \fBshush\fP will use the contents of the \fIname.stdout\fP and \fIname.stderr\fP files (if they exist) to look at the output produced by the \fIcommand\fP. These files follow a simple format. Each line is composed of a single character (the counter name) followed by a regular expression. All counters are initialized to 0 (zero). Each line of output is matched against these regular expressions until a match is found. If a match is found, the associated counter is incremented by one. These counters may then be used as part of the main configuration, in an "\fBif\fP" configuration parameter, allowing the decision to send a mail report to be based on how many times certain regular expressions have been matched. Finally, regular expressions may define sub-expressions which will be rendered in bold in mail reports. Lines starting with the character "#" are considered to be comments and are ignored. By default, standard regular expressions are used, unless the first line is "#pcre" in which case Perl compatible regular expressions are used. .SH ENVIRONMENT VARIABLES .IP HOME If the \fB-c\fP option is not used, \fBshush\fP will look for configuration files in \fI$HOME/.shush\fP. .IP SHUSH_SENDMAIL If defined, this should point to the \fIsendmail\fP(1) binary. This variable overrides the "\fBsendmail\fP" configuration setting and should be used with care. .IP TMPDIR Directory where temporary files are created. .SH EXAMPLE The following configuration runs "shush -c /etc/shush -u" daily at 9:00, updating the user (root) crontab: .RS .nf command=shush -c /etc/shush -u schedule=0 9 * * * lock=notify=root root-logs,abort timeout=5m,loop,notify=root root-logs,15m stderr=first format=text Subject=Crontab Daily Update [logs] to=root-logs [readers] if=$exit != 0 || $outlines != 1 || $errsize > 0 || U to=root format=rich .fi .RE The associated configuration for standard output is: .RS .nf Oshush: crontab updated\\.$ U^.+$ .fi .RE and for standard error: .RS U^(.+)$ .RE A lock will be set while running the command, and mail sent to "root" and "root-logs" if the lock is held by another process when \fBshush\fP starts, in which case \fBshush\fP will abort. A mail will also be sent to "root" and "root-logs" if "shush -c /etc/shush -u" runs for more than 5 minutes, and for every 15 minutes following the first 5 minutes. Upon completion, the output will always be sent to "root-logs". Additionally, the output will be sent to "root" if the condition "$exit != 0 || $outlines != 1 || $errsize > 0 || U" is true. For this condition to be true, one of the following must be true: the exit code is non zero, the command standard output was not a single line, there was output on standard error or finally, the counter "U" is non zero. For the counter "U" to be non zero, there must be output on standard output other than the line "shush: crontab updated.". Finally, any line of output produced on the standard error will be displayed in bold in mails sent to "root". .SH SEE ALSO .IR crontab (1), .IR pcre (3), .IR regex (3), .IR sendmail (1), .IR sh (1). .SH AVAILABILITY The latest official release of \fBshush\fP is available on the web. The home page is http://web.taranis.org/shush/ .SH AUTHOR Christophe Kalt .SH BUGS The \fB-C\fP option does not allow specifying an \fIID\fP. For other bugs, send reports to `shush-bugs@taranis.org'. shush-1.2.3/LICENSE0000644000241700024170000000303610063717357014113 0ustar taranisotaranisoCopyright (C) 2003, 2004 Christophe Kalt Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by Christophe Kalt. 4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. shush-1.2.3/Makefile.in0000644000241700024170000000125310764620172015146 0ustar taranisotaraniso# # Copyright (C) 2003, 2004 Christophe Kalt # # This file is part of shush, # see the LICENSE file for details on your rights. # # $Id: Makefile.in 1404 2008-03-08 23:25:46Z kalt $ # INSTALL = @INSTALL@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ shush: @(cd src && $(MAKE) shush) install: shush $(INSTALL) -d -m 0755 $(bindir) $(INSTALL) -m 755 src/shush $(bindir) $(INSTALL) -d -m 0755 $(mandir)/man1 $(INSTALL) -m 644 shush.1 $(mandir)/man1 @echo ; echo "Done!" clean: @(cd src && $(MAKE) clean) distclean: @(cd src && $(MAKE) distclean) /bin/rm -f Makefile config.cache config.log configure.lineno /bin/rm -rf autom4te.cache shush-1.2.3/CHANGES0000644000241700024170000000307710764620172014102 0ustar taranisotaraniso$Id: CHANGES 1404 2008-03-08 23:25:46Z kalt $ Changes since 1.1.1 [2007/05/02]: - Renamed "stderr" configuration parameter to "output", and extended it (suggested by Aleksandra Portnova). Changes since 1.1 [2006/12/29]: - fixed two embarassing ABW bugs. Changes since 1.0.2 [2006/11/05]: - "lockmsg", "timeoutmsg" and "subject" configuration parameters now allow the use of variables. - new defaults for "lockmsg" and "timeoutmsg" configuration parameters. - added concept of configuration instances. - added "config" configuration parameter (suggested by Alex Halimou). Changes since 1.0.1 [2006/01/25]: - updated acx_pthread.m4. - "path" configuration parameter had no effect. - fixed parsing bugs resulting in a crash. Changes since 1.0 [2005/06/16]: - -fno-builtin-log is needed for newer versions of the GNU compiler. - implemented "sendmail" configuration parameter as documented by manual page. - updated acx_pthread.m4. Changes since 1.0b5 [2005/04/17]: - silenced compiler warning. - fixed incomplete log message. Changes since 1.0b4 [2004/11/10]: - fixed new file descriptor leak when dealing with empty lock files. - fixed crash when no argument was passed to -C (reported by Alex Halimou). Changes since 1.0b3 [2004/09/27]: - fixed crash when dealing with empty lock files. Changes since 1.0b2 [2004/07/08]: - updated acx_pthread.m4, config.guess and config.sub. - better time string formatting. - fixed file descriptor leak when dealing with empty lock files. Changes since 1.0b1 [2004/06/15]: - fixed stale lock logic flaw. - reworded parts of the manual page. shush-1.2.3/src/0000755000241700024170000000000011230727466013672 5ustar taranisotaranisoshush-1.2.3/src/shush.c0000644000241700024170000001422410764620172015170 0ustar taranisotaraniso/* ** Copyright (C) 2003-2006 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #if defined(HAVE_PCRE_H) # include #endif #include "version.h" #include "debug.h" #include "check.h" #include "crontab.h" #include "run.h" static char const rcsid[] = "@(#)$Id: shush.c 1404 2008-03-08 23:25:46Z kalt $"; extern char *optarg; extern int optind, opterr; char *myname; static void usage(int); static void usage(detailed) int detailed; { fprintf(stderr, "Usage: %s [ -h | [ -v ] -V ]\n", myname); fprintf(stderr, "Usage: %s [ -c ] [ -s | -S ] [ -vfmk ] [ ]\n", myname); fprintf(stderr, "Usage: %s [ -c ] [ -H ] [ -R ] [ -T ] -C [ [ ] ]\n", myname); fprintf(stderr, "Usage: %s [ -c ] [ -i | -u | -r ]\n", myname); if (detailed == 0) exit(0); fprintf(stderr, " -h Print this message.\n"); fprintf(stderr, " -V Output version info.\n"); fprintf(stderr, "\n"); fprintf(stderr, " -c Specify configuration directory.\n"); fprintf(stderr, " -d Enable debugging.\n"); fprintf(stderr, "\n"); fprintf(stderr, " -s Use specified syslog facility.\n"); #if defined(SYSLOG) fprintf(stderr, " -S Disable use of syslog.\n"); #endif fprintf(stderr, " -v Copy syslog messages to the standard output.\n"); fprintf(stderr, " -f Run the command without any (random) delay.\n"); #if defined(HAVE_PTHREAD) fprintf(stderr, " -m Monitor the command output while it is running.\n"); #endif fprintf(stderr, " -k Keep the command output log files.\n"); fprintf(stderr, "\n"); fprintf(stderr, " -C Configuration check.\n"); fprintf(stderr, " -H HTML report recipient(s).\n"); fprintf(stderr, " -R Enriched report recipient(s).\n"); fprintf(stderr, " -T Text report recipient(s).\n"); fprintf(stderr, "\n"); fprintf(stderr, " -i Install crontab.\n"); fprintf(stderr, " -u Update crontab.\n"); fprintf(stderr, " -r Remove any entry from crontab.\n"); exit(1); } int main(int argc, char **argv, char *envp[]) { int badopt, check, ctab, runopts; char cfdir[PATH_MAX+1], *slfac, *to[3]; myname = basename(argv[0]); check = ctab = runopts = 0; cfdir[1] = '\0'; slfac = SYSLOG; to[0] = to[1] = to[2] = NULL; badopt = 0; while (1) { int c; c = getopt(argc, argv, "c:Cd:fhH:ikmrR:s:ST:vVu"); /* Detect the end of the options. */ if (c == -1) break; switch (c) { case 'c': cfdir[0] = '1'; strlcpy(cfdir+1, optarg, PATH_MAX); break; case 'C': check = 1; break; case 'd': debug_init(atoi(optarg)); break; case 'f': runopts |= RUN_FAST; break; case 'h': usage(1); case 'H': to[0] = optarg; break; case 'i': ctab = CRONTAB_SETNEW; break; case 'k': runopts |= RUN_NODEL; break; case 'm': #if defined(HAVE_PTHREAD) runopts |= RUN_TAIL; break; #else fprintf(stderr, "%s: -m option is not supported in this system\n", myname); exit(1); #endif case 'r': ctab = CRONTAB_REMOVE; break; case 'R': to[1] = optarg; break; case 's': slfac = optarg; break; case 'S': slfac = ""; break; case 'T': to[2] = optarg; break; case 'v': runopts |= RUN_VERBOSE; break; case 'V': #if !defined(HAVE_PCRE_H) printf("%s version %s\n", myname, SHUSH_VERSION); #else printf("%s version %s (PCRE version %s)\n", myname, SHUSH_VERSION, pcre_version()); #endif if ((runopts & RUN_VERBOSE) != 0) { printf("\tDefault \"syslog\" : %s\n", SYSLOG); printf("\tDefault \"sizelimit\": %s\n", MAXSZ); } exit(0); case 'u': ctab = CRONTAB_UPDATE; break; case '?': badopt += 1; break; default: abort(); } } /* Check that the options given make sense */ if (((ctab | check) == 0 && (optind == argc /* One or Two arguments */ || optind < argc - 2)) || (check != 0 && ((ctab | runopts) != 0 /* One of three modes only! */ || optind >= argc /* Need at least one argument */ || optind < argc - 3)) /* And no more than 3 */ || (ctab != 0 && ((check | runopts) != 0 /* One of three modes only! */ || optind != argc)) /* No extra arguments */ || badopt > 0) { usage(0); exit(1); } if (cfdir[1] == '\0') { /* -c not explicitely specified, use default: "$HOME/.shush" */ if (getenv("HOME") == NULL) { fprintf(stderr, "%s: HOME is not set, you must use -c!\n", myname); exit(1); } cfdir[0] = 0; snprintf(cfdir+1, PATH_MAX, "%s/.shush", getenv("HOME")); } if ((check | ctab) == 0) { /* Let's run! */ char *job, *id; if (to[0] != NULL || to[1] != NULL || to[2] != NULL) { usage(0); exit(1); } job = argv[optind]; if (optind == argc-1) id = ""; else id = argv[argc-1]; error_init(((runopts & RUN_VERBOSE) != 0) ? NULL : job, id, slfac[0] != '\0'); run(cfdir+1, job, id, slfac, runopts, envp); } else if (check != 0) { /* Configuration check mode */ char *job, *outlog, *errlog; job = argv[optind]; outlog = (optind < argc - 1) ? argv[optind + 1] : NULL; errlog = (optind < argc - 2) ? argv[optind + 2] : NULL; error_init(NULL, NULL, 0); checkrun(cfdir+1, job, outlog, errlog, to, envp); } else if (ctab != 0) { /* Crontab update mode */ if (to[0] != NULL || to[1] != NULL || to[2] != NULL) { usage(0); exit(1); } error_init(NULL, NULL, 0); if (strcasecmp(slfac, SYSLOG) != 0) error("-%c argument ignored.", (slfac != NULL) ? 's' : 'S'); crontab(argv[0], cfdir, ctab); } exit(0); } shush-1.2.3/src/version.h0000644000241700024170000000003410254417561015522 0ustar taranisotaraniso#define SHUSH_VERSION "1.0" shush-1.2.3/src/error.c0000644000241700024170000000404210764620172015164 0ustar taranisotaraniso/* ** Copyright (C) 2003-2006 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #include "error.h" #include "gethostname.h" #ifndef lint static char const rcsid[] = "@(#)$Id: error.c 1404 2008-03-08 23:25:46Z kalt $"; #endif static int prefix, tosyslog; static char *task, *id; /* ** error_init ** Whether or not to write a header prior to any error message */ void error_init(char *name, char *jid, int copytosyslog) { task = name; id = jid; if (name == NULL) prefix = 1; else prefix = 0; tosyslog = copytosyslog; } /* ** error ** output a message optionally preceeded by a header */ void error(char *format, ...) { va_list va; if (task != NULL) { if (*id != '\0') fprintf(stderr, "%s[%s] encountered the following error(s) while running \"%s\" on host %s:\n\n", myname, task, id, get_hostname(0)); else fprintf(stderr, "%s encountered the following error(s) while running \"%s\" on host %s:\n\n", myname, task, get_hostname(0)); task = NULL; } if (prefix) fprintf(stderr, "%s: ", myname); va_start(va, format); vfprintf(stderr, format, va); fprintf(stderr, "\n"); fflush(stderr); if (tosyslog) vsyslog(LOG_ERR, format, va); va_end(va); } #undef abort /* ** myassert ** _assert() replacement */ void myassert(char *assertion, char *file, char *function, int line) { if (function != NULL) error("Assertion failed: %s, file %s, function %s, line %d", assertion, file, function, line); else error("Assertion failed: %s, file %s, line %d", assertion, file, line); abort(); } /* ** myabort() ** abort() replacement */ void myabort(char *file, char *function, int line) { if (function != NULL) error("The impossible just happened: line %d in function \"%s\" in file %s was reached!", line, function, file); else error("The impossible just happened: line %d in file %s was reached!", line, file); abort(); } shush-1.2.3/src/ifparser.y0000644000241700024170000000262507673467556015725 0ustar taranisotaraniso%{ /* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include "ifparser.h" #include "byteset.h" #include "variable.h" static char const rcsid[] = "@(#)$Id: ifparser.y,v 1.5 2003-06-17 01:30:20 kalt Exp $"; int ifparser_result; const char *ifparser_errmsg; %} %union { long integer; char * string; } %token NUMBER UVARNAME EQ NE LE GE %token IVARNAME %type condition expr %left '&' '|' %left EQ NE '<' LE '>' GE %left '+' '-' %right NOT MINUS DOLLAR %% condition: expr { ifparser_result = $$; } expr : expr '+' expr { $$ = $1 + $3; } | expr '-' expr { $$ = $1 - $3; } | expr EQ expr { $$ = $1 == $3; } | expr NE expr { $$ = $1 != $3; } | expr '<' expr { $$ = $1 < $3; } | expr LE expr { $$ = $1 <= $3; } | expr '>' expr { $$ = $1 > $3; } | expr GE expr { $$ = $1 >= $3; } | expr '&' expr { $$ = $1 && $3; } | expr '|' expr { $$ = $1 || $3; } | '(' expr ')' { $$ = $2; } | '-' expr { $$ = - $2; } %prec MINUS | '!' expr { $$ = ! $2; } %prec NOT | NUMBER { $$ = $1; } | UVARNAME { $$ = byteset_get($1); } | IVARNAME { if (variable_get($1, &$$) != 0) { yyerror("Unknown variable used"); YYERROR; } } ; %% static int yyerror(const char *msg) { ifparser_errmsg = msg; return 0; } shush-1.2.3/src/config.h.in0000644000241700024170000000462710022751412015710 0ustar taranisotaraniso/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Path to crontab program */ #undef CRONTAB /* Define to 1 if you have the declaration of `sys_signame', and to 0 if you don't. */ #undef HAVE_DECL_SYS_SIGNAME /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `MD5Data' function. */ #undef HAVE_MD5DATA /* Define to 1 if you have the `md5_calc' function. */ #undef HAVE_MD5_CALC /* Define to 1 if you have the header file. */ #undef HAVE_MD5_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H /* Define to 1 if you have the header file. */ #undef HAVE_PCRE_H /* Define if you have POSIX threads libraries and header files. */ #undef HAVE_PTHREAD /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Default MAXSZ value */ #undef MAXSZ /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE /* Path to sendmail program */ #undef SENDMAIL /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to a syslog facility to enable logging via syslog by default */ #undef SYSLOG /* Define to `int' if does not define. */ #undef pid_t shush-1.2.3/src/check.h0000644000241700024170000000046210764620172015117 0ustar taranisotaraniso/* ** Copyright (C) 2003, 2004 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: check.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_CHECK_H_) # define _CHECK_H_ void checkrun(char *, char *, char *, char *, char **, char **); #endif shush-1.2.3/src/error.h0000644000241700024170000000200110764620172015162 0ustar taranisotaraniso/* ** Copyright (C) 2003-2006 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: error.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_ERROR_H_) # define _ERROR_H_ #define ERRSTR strerror(errno) void error_init(char *, char *, int); void error(char *, ...) #if ( __GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) || __GNUC__ >= 3 __attribute__((__format__(__printf__, 1, 2))) #endif ; void myassert(char *, char *, char *, int) #if ( __GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) || __GNUC__ >= 3 __attribute__((__noreturn__)) #endif ; #if !defined(__func__) # define __func__ NULL #endif #if defined(__STDC__) # define assert(x) if (!(x)) myassert(#x, __FILE__, __func__, __LINE__) #else # define assert(x) if (!(x)) myassert("x", __FILE__, __func__, __LINE__) #endif void myabort(char *, char *, int) #if ( __GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) || __GNUC__ >= 3 __attribute__((__noreturn__)) #endif ; #define abort() myabort(__FILE__, __func__, __LINE__) #endif shush-1.2.3/src/gethostname.c0000644000241700024170000000170110764620172016350 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include "gethostname.h" static char const rcsid[] = "@(#)$Id: gethostname.c 1404 2008-03-08 23:25:46Z kalt $"; char * get_hostname(int dots) { static char hostname[MAXHOSTNAMELEN+1]; char *dot; if (gethostname(hostname, MAXHOSTNAMELEN) != 0) { error("gethostname() failed: %s", ERRSTR); return ""; } hostname[MAXHOSTNAMELEN] = '\0'; if (dots > 0) { dot = hostname; while (*dot != '\0' && dots > 0) { if (*dot == '.') dots -= 1; dot += 1; } if (dots == 0) *(dot - 1) = '\0'; } else if (dots < 0) { dot = hostname + strlen(hostname) - 1; while (dot != hostname && dots < 0) { if (*dot == '.') dots += 1; dot -= 1; } if (dots == 0) *(dot + 1) = '\0'; } return hostname; } shush-1.2.3/src/cf.c0000644000241700024170000005466410764620172014442 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #if defined(HAVE_MD5_H) # include #endif #include "cf.h" #include "byteset.h" #include "gethostname.h" #include "ifparser.h" #include "mmap.h" #include "siglist.h" #include "units.h" static char const rcsid[] = "@(#)$Id: cf.c 1404 2008-03-08 23:25:46Z kalt $"; #define CFN 0 /* long */ #define CFS 1 /* string */ #define CFSL 2 /* list of strings */ time_t cf_timestamp; size_t cf_size; char cf_md5[33]; typedef void * any; typedef struct list_ list; struct list_ { any value; list *nextl; }; /* Conversion and validation routines */ static void *str2format(char *); static void *str2lock(char *); static void *str2size(char *); static void *str2stderr(char *); static void *str2sysfac(char *); static void *str2time(char *); static void *str2timeout(char *); static void *str2header(char *); /* Main configuration options */ struct cfelmt { int code; char *name; char type; void *(* valid)(char *); any value; }; static struct cfelmt globalconfig[] = { { CF_CONFIG, "config", CFS, NULL, NULL }, /* must be first */ { CF_CMD, "command", CFS, NULL, NULL }, { CF_LOCK, "lock", CFS, str2lock, NULL }, { CF_LOCKFILE, "lockfile", CFS, NULL, NULL }, { CF_LOCKSUBJECT, "lockmsg", CFS, NULL, NULL }, { CF_PATH, "path", CFS, NULL, NULL }, { CF_RANDOMDELAY, "randomdelay", CFN, str2time, NULL }, { CF_SCHEDULE, "schedule", CFS, NULL, NULL }, { CF_SENDMAIL, "sendmail", CFS, NULL, NULL }, { CF_SHELL, "shell", CFS, NULL, NULL }, #if defined(HAVE_PTHREAD) { CF_STATEDIR, "statedir", CFS, NULL, NULL }, #endif { CF_SYSLOG, "syslog", CFS, str2sysfac, NULL }, { CF_TIMEOUT, "timeout", CFS, str2timeout, NULL }, { CF_TIMEOUTSUBJECT,"timeoutmsg", CFS, NULL, NULL }, { 0, NULL, CFS, NULL, NULL } }; /* Report configuration */ struct rptdef { char *name; char type; void *(* valid)(char *); }; static const struct rptdef reportconfig[CF_RPT_MAX+1] = { /* order of these MATTERS */ { "name", CFS, NULL }, { "to", CFS, NULL }, { "cc", CFS, NULL }, { "bcc", CFS, NULL }, { "subject", CFS, NULL }, { "userprefix", CFN, NULL }, { "hostprefix", CFN, NULL }, { "sizelimit", CFN, str2size }, { "if", CFS, NULL }, { "format", CFN, str2format }, { "stderr", CFN, str2stderr }, { "header", CFSL, str2header }, { NULL, CFS, NULL } }; static any *reports = NULL; static int reportssz; static char **idlist = NULL; static int idlistsz; /* ** str2format ** format option validation routine */ static void * str2format(char *str) { static long value; value = CF_FORMAT_TEXT; if (strcasecmp(str, "text") == 0) value = CF_FORMAT_TEXT; else if (strcasecmp(str, "rich") == 0) value = CF_FORMAT_RICH; else if (strcasecmp(str, "html") == 0) value = CF_FORMAT_HTML; else error("Invalid \"format\" setting: %s", str); return (void *) &value; } /* ** str2lock ** string to lock validation routine */ static void * str2lock(char *str) { char *str2, *tmp, *last; int endless, silent, loop; str2 = strdup(str); if (str2 == NULL) { error("strdup(%s) failed: %s", str, ERRSTR); exit(1); } endless = 1; silent = 1; loop = 0; tmp = strtok_r(str2, ",", &last); while (tmp != NULL) { if (isdigit((int) tmp[0])) { if (loop == 1) loop = 2; unit_time(tmp); } else if (strcasecmp(tmp, "abort") == 0) endless = 0; else if (strcasecmp(tmp, "ignore") == 0) endless = 0; else if (strncmp(tmp, "notify=", 7) == 0) silent = 0; else if (strcmp(tmp, "loop") == 0) { if (loop > 0) error("Only one `loop' supported in locking strategy!"); silent = 1; loop = 1; } else error("Invalid \"lock\" action: %s", tmp); tmp = strtok_r(NULL, ",", &last); } free(str2); if (endless == 1 && silent == 1) error("Defined locking strategy (\"%s\") may result in a silent endless wait!", str); if (loop == 1) { error("Defined locking strategy (\"%s\") contains an invalid loop!", str); exit(1); } return (void *) str; } /* ** str2size ** string to size conversion routine */ static void * str2size(char *str) { static long value; value = unit_size(str); return (void *) &value; } /* ** str2stderr ** stderr option validation routine */ static void * str2stderr(char *str) { static long value; value = CF_STDERR_FIRST; if (strcasecmp(str, "errfirst") == 0 || strcasecmp(str, "first") == 0 || strcasecmp(str, "outlast") == 0) value = CF_STDERR_FIRST; else if (strcasecmp(str, "errlast") == 0 || strcasecmp(str, "last") == 0 || strcasecmp(str, "outfirst") == 0) value = CF_STDERR_LAST; else if (strcasecmp(str, "mixed") == 0) value = CF_STDERR_MIXED; else if (strcasecmp(str, "outonly") == 0) value = CF_STDERR_OUT; else if (strcasecmp(str, "erronly") == 0) value = CF_STDERR_ERR; else error("Invalid \"stderr\" setting: %s", str); return (void *) &value; } /* ** str2sysfac ** syslog option validation routine */ static void * str2sysfac(char *str) { if (str[0] != '\0') syslog_facility(str); return (void *) str; } /* ** str2time ** string to time conversion routine */ static void * str2time(char *str) { static long value; value = unit_time(str); return (void *) &value; } /* ** str2timeout ** string to timeout validation routine */ static void * str2timeout(char *str) { char *str2, *tmp, *last; int useful, loop; str2 = strdup(str); if (str2 == NULL) { error("strdup(%s) failed: %s", str, ERRSTR); exit(1); } tmp = strtok_r(str2, ",", &last); unit_time(tmp); useful = 0; loop = 0; while ((tmp = strtok_r(NULL, ",", &last)) != NULL) { if (isdigit((int) tmp[0])) { if (loop == 1) loop = 2; unit_time(tmp); } else if (tmp[0] == '-' && isdigit((int) tmp[1])) useful = 1; else if (strncmp(tmp, "SIG", 3) == 0) { if (getsignumbyname(tmp + 3) < 0) error("Invalid \"timeout\" signal: %s", tmp); useful = 1; } else if (tmp[0] == '=' && isdigit((int) tmp[1])) useful = 1; else if (strncmp(tmp, "=SIG", 4) == 0) { if (getsignumbyname(tmp + 4) < 0) error("Invalid \"timeout\" signal: %s", tmp); useful = 1; } else if (strncmp(tmp, "notify=", 7) == 0) useful = 1; else if (strcmp(tmp, "loop") == 0) { if (loop > 0) error("Only one `loop' supported in \"timeout\" action!"); loop = 1; } else error("Invalid \"timeout\" action: %s", tmp); } free(str2); if (useful == 0) error("Defined \"timeout\" action (\"%s\") has no effect.", str); if (loop == 1) { error("Defined \"timeout\" action (\"%s\") contains an invalid loop!", str); exit(1); } return (void *) str; } /* ** str2header ** string to header validation routine */ static void * str2header(char *str) { char *tmp; tmp = str; while (*tmp != '\0') { if (*tmp == ':') break; if (*tmp < 33 || *tmp > 126) break; tmp += 1; } if (*tmp != ':') error("Defined \"header\" (\"%s\") is NOT RFC2822 compliant.", str); return (void *) str; } /* ** myldup ** Allocate a long and assign it */ static void myldup(long **var, long val) { if (*var != NULL) free(*var); *var = (long *) malloc(sizeof(long)); if (*var == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } **var = val; } /* ** mystrdup ** Allocate a copy of a string, and assign it */ static void mystrdup(char **var, char *str) { if (*var != NULL) free(*var); *var = strdup(str); if (*var == NULL) { error("strdup(%s) failed: %s", str, ERRSTR); exit(1); } } /* ** cf_load ** Parse a configuration file */ char * cf_load(char *fname, char *instance) { char *conf, *ln, *lndup, *nl; int lncnt, idl, rpt, std; size_t cflen; assert( reports == NULL ); cf_timestamp = 0; /* Map the configuration file to memory so it can be parsed */ switch (mapfile(fname, -1, (void **)&conf, &cflen)) { case 0: /* OK! */ cf_timestamp = mapstat()->st_mtime; if (mapstat()->st_uid != geteuid()) error("someone else owns %s!", fname); else if ((mapstat()->st_mode & (S_IWGRP|S_IWOTH)) != 0) error("%s must not be group or world writable!", fname); else break; exit(1); case 1: error("Configuration file \"%s\" does not exist.", fname); /* FALLTHRU */ default: exit(1); } /* Uhoh, it's empty */ if (cflen == 0) { error("Configuration file (%s) is empty!", fname); exit(1); } cf_size = cflen; MD5((unsigned char *) conf, cflen, cf_md5); /* Initialize "config" -- Assumes CF_CONFIG is the first array element */ mystrdup((char **) &globalconfig[0].value, fname); /* Initialize the idlist array */ idlistsz = 5; idlist = (char **) malloc(idlistsz * sizeof(char **)); if (idlist == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } idlist[0] = NULL; idl = -1; /* Initialize the reports array */ reportssz = 5; reports = (any *) malloc(reportssz * CF_RPT_MAX * sizeof(any)); if (reports == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } rpt = 0; reports[CF_RPTNAME] = NULL; mystrdup((char **) &reports[CF_RPTNAME], ""); reports[CF_RPTTO] = reports[CF_RPTCC] = reports[CF_RPTBCC] = NULL; reports[CF_RPTSUBJECT] = NULL; reports[CF_RPTUSER] = NULL; reports[CF_RPTHOST] = NULL; myldup((long **) &reports[CF_RPTUSER], 1); myldup((long **) &reports[CF_RPTHOST], 255); reports[CF_RPTMAXSZ] = NULL; if (MAXSZ == NULL) myldup((long **) &reports[CF_RPTMAXSZ], -1); else myldup((long **) &reports[CF_RPTMAXSZ], unit_size(MAXSZ)); reports[CF_RPTIF] = NULL; reports[CF_RPTFORMAT] = NULL; myldup((long **) &reports[CF_RPTFORMAT], CF_FORMAT_RICH); reports[CF_RPTSTDERR] = NULL; myldup((long **) &reports[CF_RPTSTDERR], CF_STDERR_FIRST); reports[CF_RPTHEADER] = NULL; /* Go crazy, parse the damn thing */ ln = conf; lncnt = 1; lndup = NULL; do { nl = ln; while ((nl - conf) < cflen && *nl != '\n' && *nl != '\0') nl += 1; if ((nl - conf) == cflen) { if (*(nl - 1) != '\0') { assert( lndup == NULL ); lndup = (char *) malloc(cflen - (ln - conf) + 1); if (lndup == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } memcpy(lndup, ln, cflen - (ln - conf)); lndup[cflen - (ln - conf)] = '\0'; ln = lndup; } } else *nl = '\0'; if (*ln == '#' || *ln == '\0') ; else if (*ln == '[' && ln[strlen(ln) - 1] == ']') { int i; /* New report section */ ln[strlen(ln) - 1] = '\0'; ln += 1; rpt += CF_RPT_MAX; if (rpt == reportssz * CF_RPT_MAX) { /* The array is full already, expand it */ reportssz *= 2; reports = (any *) realloc(reports, reportssz * CF_RPT_MAX * sizeof(any)); if (reports == NULL) { error("realloc() failed: %s", ERRSTR); exit(1); } } i = rpt; while (i < rpt + CF_RPT_MAX ) reports[i++] = NULL; mystrdup((char **) &reports[rpt + CF_RPTNAME], ln); } else { int i; char *val, *at, *pc; /* Separate option name from its value */ val = strchr(ln, '='); if (val == NULL) { error("Invalid option in %s, line %d: %s", fname, lncnt, ln); exit(1); } *val = '\0'; val += 1; /* Check for @hostname and %ID components */ pc = strchr(ln, '%'); if (pc != NULL) *pc++ = '\0'; at = strchr(ln, '@'); if (at != NULL) { *at++ = '\0'; if (strcasecmp(get_hostname(0), at) != 0) /* Wrong host */ goto next; } if (pc != NULL) { i = 0; while (idlist[i] != NULL && strcasecmp(pc, idlist[i]) != 0) i += 1; if (idlist[i] == NULL) { idlist[i] = strdup(pc); if (idlist[i] == NULL) { error("strdup(%s) failed: %s", pc, ERRSTR); exit(1); } if (instance == NULL || strcasecmp(instance, idlist[i]) == 0) idl = i; i += 1; if (i == idlistsz) { /* The array is full already, expand it */ idlistsz *= 2; idlist = (char **) realloc(idlist, idlistsz * sizeof(char **)); if (idlist == NULL) { error("realloc() failed: %s", ERRSTR); exit(1); } } idlist[i] = NULL; } if (instance == NULL) instance = idlist[i-1]; if (*instance == '\0') { error("Configuration requires the use of an instance ID."); exit(1); } if (strcasecmp(instance, pc) != 0) /* wrong ID */ goto next; } i = 0; if (rpt == 0) { /* Global configuration options */ while (globalconfig[i].name != NULL) { if (strcasecmp(globalconfig[i].name, ln) == 0) { switch (globalconfig[i].type) { case CFN: if (globalconfig[i].valid == NULL) myldup((long **) &globalconfig[i].value, atol(val)); else myldup((long **) &globalconfig[i].value, * (long *) globalconfig[i].valid(val)); break; case CFS: if (globalconfig[i].valid == NULL) mystrdup((char **) &globalconfig[i].value, val); else mystrdup((char **) &globalconfig[i].value, (char *) globalconfig[i].valid(val)); break; default: abort(); } val = NULL; break; } i += 1; } } i = 0; if (val != NULL) { /* Report configuration options, including defaults */ if (strcasecmp("output", ln) == 0) ln = "stderr"; /* Ugh! */ while (reportconfig[i].name != NULL) { if (strcasecmp(reportconfig[i].name, ln) == 0) { list **alist; switch (reportconfig[i].type) { case CFN: if (reportconfig[i].valid == NULL) myldup((long **) &reports[rpt+i], atol(val)); else myldup((long **) &reports[rpt+i], * (long *) reportconfig[i].valid(val)); break; case CFS: if (reportconfig[i].valid == NULL) mystrdup((char **) &reports[rpt+i], val); else mystrdup((char **) &reports[rpt+i], (char *) reportconfig[i].valid(val)); break; case CFSL: alist = (list **) &(reports[rpt+i]); while (*alist != NULL) alist = &((*alist)->nextl); *alist = malloc(sizeof(list)); if (*alist == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } (*alist)->nextl = NULL; if (reportconfig[i].valid == NULL) (*alist)->value = strdup(val); else (*alist)->value = strdup((char *) reportconfig[i].valid(val)); if ((*alist)->value == NULL) { error("strdup() failed: %s", ERRSTR); exit(1); } break; default: abort(); } val = NULL; break; } i += 1; } } if (val != NULL) error("Invalid option \"%s\" in %s, line %d", ln, fname, lncnt); } next: ln = nl + 1; lncnt += 1; } while (ln - conf < cflen); if (lndup != NULL) free(lndup); reports[rpt+CF_RPT_MAX] = NULL; /* Mark the end of the list */ std = (int) *((long *) reports[CF_RPTSTDERR]); if (std == CF_STDERR_OUT || std == CF_STDERR_ERR) { error("Invalid default output: \"%s\"!", (std == CF_STDERR_OUT) ? "outonly" : "erronly"); exit(1); } while (rpt > 0) { assert( reports[rpt+CF_RPTNAME] != NULL ); if (reports[CF_RPTTO] == NULL && reports[CF_RPTCC] == NULL && reports[CF_RPTBCC] == NULL && reports[rpt+CF_RPTTO] == NULL && reports[rpt+CF_RPTCC] == NULL && reports[rpt+CF_RPTBCC] == NULL) { error("No recipient specified for report \"%s\"!", (char *) reports[rpt+CF_RPTNAME]); exit(1); } /* ** Could be done before rather than here until ifparser is enhanced ** to support referring to other reports. */ if (reports[rpt+CF_RPTIF] != NULL) { ifparser_init(reports[rpt+CF_RPTIF]); if (reports[rpt+CF_RPTIF] != NULL && ifparser_parse() != 0) { error("%s in if clause for report \"%s\"!", ifparser_errmsg, (char *) reports[rpt+CF_RPTNAME]); exit(1); } } if ((std == CF_STDERR_MIXED && reports[rpt+CF_RPTSTDERR] != NULL && *((long *) reports[rpt+CF_RPTSTDERR]) != std) || (std != CF_STDERR_MIXED && reports[rpt+CF_RPTSTDERR] != NULL && *((long *) reports[rpt+CF_RPTSTDERR]) == CF_STDERR_MIXED)) { error("Invalid output option for report \"%s\"!", (char *) reports[rpt+CF_RPTNAME]); exit(1); } rpt -= CF_RPT_MAX; } if (idlist[0] == NULL && instance == NULL) return ""; if (instance != NULL && *instance != '\0' && idl == -1) { error("Instance ID \"%s\" not found in configuration!", instance); exit(1); } assert( instance != NULL ); return instance; } /* ** cf_nextid ** Returns the next ID defined/seen in the configuration */ char * cf_nextid(char *id) { int i = 0; assert( idlist != NULL); while (idlist[i] != NULL && strcasecmp(id, idlist[i]) != 0) i += 1; if (idlist[i] == NULL) return NULL; else return idlist[i+1]; } /* ** cf_unload ** Reverse actions taken by cf_load() */ void cf_unload(void) { int i; for (i = 0; globalconfig[i].name != NULL; i += 1) { if (globalconfig[i].value != NULL) { free(globalconfig[i].value); globalconfig[i].value = NULL; } } if (reports != NULL) { for (i = 0; reports[i] != NULL || (i % CF_RPT_MAX) != 0; i+= 1) if (reports[i] != NULL) free(reports[i]); free(reports); reports = NULL; } if (idlist != NULL) { for (i = 0; idlist[i] != NULL; i+= 1) free(idlist[i]); free(idlist); idlist = NULL; } } /* ** cf_getstr ** Return a string configuration option */ char * cf_getstr(int code) { int i; assert( code > CF_RPT_MAX && code < CF_MAX ); i = 0; while (globalconfig[i].name != NULL) if (globalconfig[i].code == code) break; else i += 1; assert( i < CF_MAX ); assert( globalconfig[i].type == CFS ); /* This is ugly, there should be a generic way of setting defaults. */ if (code == CF_LOCKSUBJECT && globalconfig[i].value == NULL) return "[%u@%h] **PENDING** %N [%t]"; if (code == CF_SENDMAIL) { if (getenv("SHUSH_SENDMAIL") != NULL) return getenv("SHUSH_SENDMAIL"); else if (globalconfig[i].value == NULL) return SENDMAIL; } if (code == CF_SHELL && globalconfig[i].value == NULL) return "/bin/sh"; if (code == CF_TIMEOUTSUBJECT && globalconfig[i].value == NULL) return "[%u@%h] **TIMEOUT** %N [%t]"; return (char *) globalconfig[i].value; } /* ** cf_getnum ** Return a number configuration option */ long cf_getnum(int code) { int i; assert( code > CF_RPT_MAX && code < CF_MAX ); i = 0; while (globalconfig[i].name != NULL) if (globalconfig[i].code == code) break; else i += 1; assert( i < CF_MAX ); assert( globalconfig[i].type == CFN ); if (globalconfig[i].value != NULL) return *((long *) globalconfig[i].value); else return -1; } /* ** cf_getrptcnt ** Return the number of defined reports */ int cf_getrptcnt(void) { static int i = -1; if (i == -1) { i = 0; while (reports[i * CF_RPT_MAX] != NULL) i += 1; } else assert( reports[i * CF_RPT_MAX] == NULL ); return i; } /* ** cf_getrptstr ** Return a report string configuration option */ char * cf_getrptstr(int report, int code) { assert( report < cf_getrptcnt() ); assert( code < CF_RPT_MAX && reportconfig[code].type == CFS ); if (reports[report * CF_RPT_MAX + code] != NULL) return (char *) reports[report * CF_RPT_MAX + code]; else return (char *) reports[code]; } /* ** cf_getrptstrlist ** Return a report string list configuration option */ char * cf_getrptstrlist(int report, int code) { static int which; int i; list *alist; assert( report < cf_getrptcnt() ); assert( code < CF_RPT_MAX && reportconfig[code].type == CFSL ); if (report < 0) { which = 0; return NULL; } if (reports[report * CF_RPT_MAX + code] != NULL) alist = (list *) reports[report * CF_RPT_MAX + code]; else alist = (list *) reports[code]; i = 0; while (i++ < which && alist != NULL) alist = alist->nextl; which += 1; if (alist != NULL) return (char *) alist->value; return NULL; } /* ** cf_getrptnum ** Return a report number configuration option */ long cf_getrptnum(int report, int code) { assert( report < cf_getrptcnt() ); assert( code < CF_RPT_MAX && reportconfig && reportconfig[code].type == CFN ); if (reports[report * CF_RPT_MAX + code] != NULL) return *((long *) reports[report * CF_RPT_MAX + code]); else if (reports[code] != NULL) return *((long *) reports[code]); else return -1; } shush-1.2.3/src/crontab.c0000644000241700024170000002607510764620172015475 0ustar taranisotaraniso/* ** Copyright (C) 2003-2006 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #if defined(HAVE_PATHS_H) # include #else # define _PATH_TMP "/tmp" #endif #include #include #include #include #include "crontab.h" #include "cf.h" #include "exec.h" #include "gethostname.h" #include "mmap.h" #include "version.h" static char const rcsid[] = "@(#)$Id: crontab.c 1404 2008-03-08 23:25:46Z kalt $"; #define TAG "# DO NOT MODIFY THIS LINE -- shush depends on it!" static int getnext(char *cfdname, char **schedule, char **job, char **id) { static DIR *cfdir = NULL; static char *calendar = NULL, *last, *lastid; struct dirent *entry; static int lineno; static size_t clen; static char cfname[PATH_MAX]; if (calendar == NULL && cfdir == NULL) { struct stat sb; if (stat(cfdname, &sb) != 0) { error("stat(%s) failed: %s", cfdname, ERRSTR); exit(1); } if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) { error("%s must not be group or world writable!", cfdname); exit(1); } if (sb.st_uid != geteuid()) { error("someone else owns %s!", cfdname); exit(1); } snprintf(cfname, PATH_MAX, "%s/schedule", cfdname); switch (mapfile(cfname, -1, (void **) &calendar, &clen)) { case 0: case 1: break; default: exit(1); } lineno = 0; if (calendar == NULL) { cfdir = opendir(cfdname); if (cfdir == NULL) { error("opendir(%s) failed: %s", cfdname, ERRSTR); exit(1); } } else printf("%s: Using schedule found in %s.\n", myname, cfdname); last = NULL; lastid = NULL; } if (last != NULL) { *schedule = strtok_r(NULL, ";", &last); if (*schedule != NULL) return 0; } if (lastid != NULL && (lastid = cf_nextid(lastid)) != NULL) { *id = strdup(lastid); if (*id == NULL) { error("strdup(%s) failed: %s", lastid, ERRSTR); exit(1); } cf_unload(); lastid = cf_load(cfname, *id); free(*id); *id = lastid; *schedule = cf_getstr(CF_SCHEDULE); } else if (calendar != NULL) { static char *ln = NULL, *lndup = NULL; char *token, *jid, *nl, *tmp; if (ln == NULL) ln = calendar; else if (ln - calendar >= clen) { if (lndup != NULL) free(lndup); if (unmapfile(cfdname, (void *) calendar, clen) != 0) exit(1); return -1; } nl = ln; while ((nl - calendar) < clen && *nl != '\n' && *nl != '\0') nl += 1; if ((nl - calendar) == clen) { if (*(nl - 1) != '\0') { assert( lndup == NULL ); lndup = (char *) malloc(clen - (ln - calendar) + 1); if (lndup == NULL) { fprintf(stderr, "%s: malloc() failed: %s", myname, ERRSTR); exit(1); } memcpy(lndup, ln, clen - (ln - calendar)); lndup[clen - (ln - calendar)] = '\0'; ln = lndup; } } else *nl = '\0'; lineno += 1; if (ln[0] == '#' || ln[0] == '\0') { ln = nl + 1; return getnext(cfdname, schedule, job, id); } token = strtok_r(ln, " \t", &tmp); ln = nl + 1; if (strcmp(token, "*") != 0 && strcasecmp(token, get_hostname(0)) != 0) return getnext(cfdname, schedule, job, id); token = strtok_r(NULL, " \t", &tmp); if (token == NULL) { error("Invalid syntax on line %d in schedule file", lineno); exit(1); } jid = strchr(token, ':'); if (jid == NULL) jid = ""; else *jid++ = '\0'; snprintf(cfname, PATH_MAX, "%s/%s", cfdname, token); cf_unload(); cf_load(cfname, jid); *job = token; *id = jid; *schedule = strtok_r(NULL, "", &tmp); if (*schedule == NULL) { error("Invalid syntax on line %d in schedule file", lineno); exit(1); } while (**schedule == ' ' || **schedule == '\t') *schedule += 1; } else if (cfdir != NULL) { struct stat sb; entry = readdir(cfdir); if (entry == NULL) { if (closedir(cfdir) != 0) error("closedir(%s) failed: %s", cfdname, ERRSTR); return -1; } snprintf(cfname, PATH_MAX, "%s/%s", cfdname, entry->d_name); if (stat(cfname, &sb) != 0) { error("stat(%s) failed: %s", cfname, ERRSTR); exit(1); } if (!S_ISREG(sb.st_mode)) /* We're only interested in regular files */ return getnext(cfdname, schedule, job, id); if (entry->d_name[0] == '.' || entry->d_name[0] == '#' || entry->d_name[strlen(entry->d_name) - 1] == '~') /* Typical backup file names */ return getnext(cfdname, schedule, job, id); if (strlen(entry->d_name) > 7 && (strcmp(entry->d_name + strlen(entry->d_name) - 7, ".stdout") == 0 || strcmp(entry->d_name + strlen(entry->d_name) - 7, ".stderr") == 0)) /* shush configuration file names */ return getnext(cfdname, schedule, job, id); cf_unload(); lastid = cf_load(cfname, NULL); *job = entry->d_name; *id = lastid; *schedule = cf_getstr(CF_SCHEDULE); } else abort(); if (*schedule == NULL || **schedule == '#' || **schedule == '\0') return getnext(cfdname, schedule, job, id); *schedule = strtok_r(*schedule, ";", &last); return 0; } void crontab(char *mypath, char *cfdir, int action) { char tag[PATH_MAX+80], *oldtab, *mytab, newtab[PATH_MAX]; char *schedule, *job, *jid; char *argv[3]; size_t oldlen, len; int status, newfd; FILE *old, *new; pid_t child; struct stat sb; /* What tag should be used? */ if (cfdir[0] == 0) strcpy(tag, TAG); else sprintf(tag, "%s [%s]", TAG, cfdir+1); strcat(tag, "\n"); /* Setup needed temporary files */ old = tmpfile(); if (old == NULL) { error("Failed to create temporary file: %s", ERRSTR); exit(1); } snprintf(newtab, PATH_MAX, "%s/%s-crontab.XXXXXX", (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, myname); newfd = mkstemp(newtab); if (newfd < 0) { error("Failed to create temporary file: %s", ERRSTR); exit(1); } new = fdopen(newfd, "w"); if (new == NULL) { error("Failed to create temporary file: %s", ERRSTR); exit(1); } /* Retrieve current crontab */ argv[0] = CRONTAB; argv[1] = "-l"; argv[2] = NULL; child = exec(-1, fileno(old), 2, 0, argv); if (child < 0) exit(1); if (waitpid(child, &status, 0) == -1) { error("waitpid(%d) failed: %s", child, ERRSTR); exit(1); } /* Append a final NUL character to keep code below simple */ if (write(fileno(old), "\0", 1) != 1) { error("write() failed: %s", ERRSTR); exit(1); } /* ** Complain about failures, unless setting up a new crontab since ** crontab(1) will "fail" if there is no crontba. */ if (action != CRONTAB_SETNEW) { if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { error("\"crontab -l\" failed with error code %d)", WEXITSTATUS(status)); exit(1); } else if (WIFSIGNALED(status) || WIFSTOPPED(status)) { error("\"crontab -l\" terminated or stopped abnormally (%s)", strsignal(WIFSIGNALED(status) ? WTERMSIG(status) : WSTOPSIG(status))); exit(1); } } if (mapfile("tmpfile", fileno(old), (void **)&oldtab, &oldlen) != 0) exit(1); /* Anything in there yet? */ if (oldlen > 1) mytab = strstr(oldtab, tag); else mytab = NULL; /* Check whether there is anything to be done. */ if (action == CRONTAB_SETNEW || action == CRONTAB_UPDATE) { if (getnext(cfdir+1, &schedule, &job, &jid) != 0) { if (mytab == NULL) { printf("%s: Nothing to do.\n", myname); exit(0); } else { assert( action == CRONTAB_UPDATE ); action = CRONTAB_REMOVE; } } if (action == CRONTAB_SETNEW && oldlen > 1) { error("ERROR: You already have a crontab!"); exit(1); } } else if (action == CRONTAB_REMOVE) { if (mytab == NULL) { printf("%s: Nothing to do.\n", myname); exit(0); } } else abort(); /* Copy the beginning of the existing crontab */ if (mytab != NULL) len = mytab - oldtab; else len = oldlen - 1; if (fwrite((void *) oldtab, sizeof(char), len, new) != len) { error("fwrite(%s) failed: %s", newtab, ERRSTR); exit(1); } if (action == CRONTAB_UPDATE || action == CRONTAB_SETNEW) { /* Install necessary crontab entries */ int r; if (fprintf(new, "%s", tag) < 0) { error("fprintf(%s) failed: %s", newtab, ERRSTR); exit(1); } do { char *slfac; r = fprintf(new, "%s %s ", schedule, mypath); if (r > 0 && cfdir[0] != 0) r = fprintf(new, "-c \"%s\" ", cfdir+1); slfac = cf_getstr(CF_SYSLOG); if (slfac != NULL) { if (r > 0 && strcasecmp(slfac, SYSLOG) != 0) { if (slfac[0] != '\0') r = fprintf(new, "-s %s ", slfac); else r = fprintf(new, "-S "); } } if (r > 0) r = fprintf(new, "\"%s\" %s\n", job, jid); } while (r > 0 && getnext(cfdir+1, &schedule, &job, &jid) == 0); if (r > 0) r = fprintf(new, "%s", tag); if (r <= 0) { error("fprintf(%s) failed: %s", newtab, ERRSTR); exit(1); } } /* Copy the end of the existing crontab */ if (mytab != NULL) { mytab = strstr(mytab + 1, tag); if (mytab == NULL) { error("Current crontab seems to be corrupted."); if (unlink(newtab) != 0) error("Failed to remove temporary file \"%s\": %s", newtab, ERRSTR); exit(1); } mytab += strlen(tag); if (*mytab != '\0' && fwrite((void *) mytab, sizeof(char), strlen(mytab), new) != strlen(mytab)) { error("fwrite(%s) failed: %s", newtab, ERRSTR); exit(1); } } if (fflush(new) != 0) { error("fflush(%s) failed: %s", newtab, ERRSTR); exit(1); } if (fstat(newfd, &sb) != 0) { error("fstat(%s) failed: %s", newtab, ERRSTR); exit(1); } /* Install new or remove crontab */ if (sb.st_size > 0) argv[1] = newtab; else argv[1] = "-r"; child = exec(fileno(new), 1, 2, 0, argv); if (child < 0) exit(1); if (waitpid(child, &status, 0) == -1) { error("waitpid(%d) failed: %s", child, ERRSTR); exit(1); } if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { if (sb.st_size > 0) printf("%s: crontab updated.\n", myname); else printf("%s: crontab removed.\n", myname); if (unlink(newtab) == 0) exit(0); error("Failed to remove temporary file \"%s\": %s", newtab, ERRSTR); exit(1); } if (sb.st_size > 0) error("Something went wrong while trying to save new crontab!"); else error("Something went wrong while trying to remove crontab!"); if (WIFEXITED(status) && WEXITSTATUS(status) != 0) error("\"crontab %s\" returned %d?!", argv[1], WEXITSTATUS(status)); else if (WIFSIGNALED(status) || WIFSTOPPED(status)) error("\"crontab %s\" terminated or stopped abnormally.", argv[1]); exit(1); } shush-1.2.3/src/ifparser.tab.h0000644000241700024170000000041407673467556016443 0ustar taranisotaraniso#define NUMBER 257 #define UVARNAME 258 #define EQ 259 #define NE 260 #define LE 261 #define GE 262 #define IVARNAME 263 #define NOT 264 #define MINUS 265 #define DOLLAR 266 typedef union { long integer; char * string; } YYSTYPE; extern YYSTYPE ifparser_lval; shush-1.2.3/src/os.h0000644000241700024170000000172210764620172014463 0ustar taranisotaraniso/* ** Copyright (C) 2003-2007 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: os.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_OS_H_) # define _OS_H_ /* get some help from autoconf, it's an evil world out there. */ #include "config.h" /* include directives common to most source files */ #include #include #include #include #include #include #include #if !defined(HAVE_STRLCPY) # define strlcpy(x, y, z) strcpy(x, y) #endif #if defined(HAVE_MD5DATA) # define MD5(x, y, z) MD5Data(x, y, z); #else # if defined(HAVE_MD5_CALC) # define MD5(x, y, z) md5_calc(z+16, x, y); \ { \ int i; \ for(i = 0 ; i<16 ; i++) \ sprintf(z + i*2, "%.2x", (unsigned char) z[i+16]); \ } \ z[32] = '\0'; # else # undef HAVE_MD5_H # define MD5(x, y, z) z[0] = '\0'; # endif #endif #include "error.h" extern char *myname; #endif shush-1.2.3/src/ifparser.h0000644000241700024170000000060310764620172015652 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: ifparser.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_IFPARSER_H_) # define _IFPARSER_H_ void ifparser_init(char *); int ifparser_lex(void); int ifparser_parse(void); extern int ifparser_result; extern const char *ifparser_errmsg; #endif shush-1.2.3/src/mmap.h0000644000241700024170000000060610764620172014774 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: mmap.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_MMAP_H_) # define _MMAP_H_ #include #include int mapfile(char *, int, void **, size_t *); struct stat *mapstat(void); int unmapfile(char *, void *, size_t); #endif shush-1.2.3/src/debug.c0000644000241700024170000000127210764620172015123 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include "debug.h" #ifndef lint static char const rcsid[] = "@(#)$Id: debug.c 1404 2008-03-08 23:25:46Z kalt $"; #endif static int debug_level; /* ** debug_init ** sets up our logging facility */ void debug_init(int level) { debug_level = level; } /* ** debug ** output a message if applicable */ void debug(int level, char *format, ...) { va_list va; if (level > debug_level) return; va_start(va, format); vfprintf(stderr, format, va); va_end(va); fprintf(stderr, "\n"); fflush(stderr); } shush-1.2.3/src/Makefile.in0000644000241700024170000000277310764620172015745 0ustar taranisotaraniso# # Copyright (C) 2003, 2004, 2005 Christophe Kalt # # This file is part of shush, # see the LICENSE file for details on your rights. # # $Id: Makefile.in 1404 2008-03-08 23:25:46Z kalt $ # SHELL = /bin/sh CC = @CC@ CPPFLAGS= @CPPFLAGS@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ FLEX = flex #-d YACC = yacc -t #-v OBJS = analyzer.o byteset.o cf.o check.o crontab.o debug.o error.o exec.o gethostname.o ifparser.tab.o ifparser.lex.o mmap.o run.o siglist.o shush.o state.o units.o variable.o SRCS = $(OBJS:%.o=%.c) shush : $(OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o shush pure : $(OBJS) purify $(CC) $(CPPFLAGS) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -o shush.pure ifparser_test: byteset.o ifparser_test.o ifparser.tab.o ifparser.lex.o $(CC) $(CPPFLAGS) $(CFLAGS) byteset.o ifparser_test.o ifparser.tab.o ifparser.lex.o -o ifparser_test depend : $(SRCS) @rm -f Makefile.deps $(CC) $(CPPFLAGS) -MM $(SRCS) \ | sed 's/\([^\\]\)$$/\1 Makefile/' > Makefile.deps clean : /bin/rm -f *.o core *.core distclean: clean /bin/rm -f Makefile config.h shush ifparser.tab.c ifparser.tab.h: ifparser.y $(YACC) -b ifparser -p ifparser_ -d ifparser.y ifparser.lex.c: ifparser.l $(FLEX) -s -Pifparser_ -oifparser.lex.c ifparser.l signals.h: signals.awk Makefile @rm -f signals.h cat /usr/include/signal.h /usr/include/sys/signal.h \ /usr/include/sys/iso/signal_iso.h \ /usr/include/bits/signum.h 2> /dev/null | \ awk -f signals.awk > signals.h @chmod 644 signals.h include Makefile.deps shush-1.2.3/src/siglist.c0000644000241700024170000000170410764620172015513 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #if defined(HAVE_DECL_SYS_SIGNAME) # include #endif #include "siglist.h" #include "signals.h" static char const rcsid[] = "@(#)$Id: siglist.c 1404 2008-03-08 23:25:46Z kalt $"; int getsignumbyname(char *name) { int i; i = 0; #if defined(HAVE_SYS_SIGNAME) while (i < NSIG) { if (strcmp(sys_signame[i], name) == 0) return i; #else while (signame[i].name != NULL) { if (strcmp(signame[i].name, name) == 0) return signame[i].num; #endif i += 1; } return -1; } char * getsignamebynum(int num) { int i; i = 0; #if defined(HAVE_SYS_SIGNAME) assert( num < NSIG ); return sys_signame[num]; #else while (signame[i].name != NULL) { if (signame[i].num == num) return signame[i].name; i += 1; } #endif return "???"; } shush-1.2.3/src/ifparser.lex.c0000644000241700024170000011402010764620172016433 0ustar taranisotaraniso#define yy_create_buffer ifparser__create_buffer #define yy_delete_buffer ifparser__delete_buffer #define yy_scan_buffer ifparser__scan_buffer #define yy_scan_string ifparser__scan_string #define yy_scan_bytes ifparser__scan_bytes #define yy_flex_debug ifparser__flex_debug #define yy_init_buffer ifparser__init_buffer #define yy_flush_buffer ifparser__flush_buffer #define yy_load_buffer_state ifparser__load_buffer_state #define yy_switch_to_buffer ifparser__switch_to_buffer #define yyin ifparser_in #define yyleng ifparser_leng #define yylex ifparser_lex #define yyout ifparser_out #define yyrestart ifparser_restart #define yytext ifparser_text #line 19 "ifparser.lex.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) #define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 11 #define YY_END_OF_BUFFER 12 static yyconst short int yy_accept[25] = { 0, 0, 0, 12, 10, 1, 8, 10, 10, 8, 10, 2, 8, 10, 8, 10, 1, 5, 9, 3, 2, 6, 4, 7, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 5, 1, 6, 6, 6, 6, 1, 7, 1, 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 1, 1, 9, 10, 11, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 1, 1, 1, 1, 1, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[14] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst short int yy_base[25] = { 0, 0, 0, 27, 28, 24, 15, 12, 18, 28, 14, 13, 10, 9, 8, 4, 14, 28, 3, 28, 6, 28, 28, 28, 28 } ; static yyconst short int yy_def[25] = { 0, 24, 1, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0 } ; static yyconst short int yy_nxt[42] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 4, 15, 20, 18, 16, 19, 23, 22, 21, 20, 20, 19, 18, 17, 16, 24, 3, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 } ; static yyconst short int yy_chk[42] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 18, 16, 15, 14, 13, 12, 11, 10, 8, 7, 6, 5, 3, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "ifparser.l" #define INITIAL 0 #line 2 "ifparser.l" /* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include "ifparser.h" #include "ifparser.tab.h" static char const rcsid[] = "@(#)$Id: ifparser.lex.c 1404 2008-03-08 23:25:46Z kalt $"; static char *inputstr; static int inputstrcur, inputstrlen; static int ifparser_input(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r = ifparser_input(b, ms)) #line 422 "ifparser.lex.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 28 "ifparser.l" #line 576 "ifparser.lex.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 25 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 28 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 30 "ifparser.l" ; /* Eat white spaces */ YY_BREAK case 2: YY_RULE_SETUP #line 32 "ifparser.l" { ifparser_lval.integer = atoi(ifparser_text); return NUMBER; } YY_BREAK case 3: YY_RULE_SETUP #line 34 "ifparser.l" { return ifparser_text[0]; } YY_BREAK case 4: YY_RULE_SETUP #line 35 "ifparser.l" { return EQ; } YY_BREAK case 5: YY_RULE_SETUP #line 36 "ifparser.l" { return NE; } YY_BREAK case 6: YY_RULE_SETUP #line 37 "ifparser.l" { return LE; } YY_BREAK case 7: YY_RULE_SETUP #line 38 "ifparser.l" { return GE; } YY_BREAK case 8: YY_RULE_SETUP #line 39 "ifparser.l" { return ifparser_text[0]; } YY_BREAK case 9: YY_RULE_SETUP #line 41 "ifparser.l" { ifparser_lval.string = ifparser_text + 1; return IVARNAME; } YY_BREAK case 10: YY_RULE_SETUP #line 42 "ifparser.l" { ifparser_lval.integer = ifparser_text[0]; return UVARNAME; } YY_BREAK case 11: YY_RULE_SETUP #line 44 "ifparser.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 714 "ifparser.lex.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 25 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 25 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 24); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 44 "ifparser.l" void ifparser_init(char *str) { inputstr = str; inputstrcur = 0; inputstrlen = strlen(str); } static int ifparser_input(char *buf, int max_size) { int count; count = inputstrlen - inputstrcur; if (count > max_size) count = max_size; if (count == 0) return YY_NULL; memcpy((void *)buf, (void *)(inputstr + inputstrcur), count); inputstrcur += count; return count; } shush-1.2.3/src/analyzer.h0000644000241700024170000000101610764620172015663 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: analyzer.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_ANALYZER_H_) # define _ANALYZER_H_ extern time_t out_timestamp, err_timestamp; extern size_t out_size, err_size; extern char out_md5[], err_md5[]; int analyzer_init(char *, char *); int analyzer_run(char *, size_t, char *, size_t); int analyzer_output(FILE *, int, int, size_t, char *, size_t, char *, size_t); #endif shush-1.2.3/src/crontab.h0000644000241700024170000000054010764620172015467 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: crontab.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_CRONTAB_H_) # define _CRONTAB_H_ #define CRONTAB_SETNEW 1 #define CRONTAB_UPDATE 2 #define CRONTAB_REMOVE 3 void crontab(char *, char *, int); #endif shush-1.2.3/src/analyzer.c0000644000241700024170000004526010764620172015667 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #if defined(HAVE_MD5_H) # include #endif #include #include #include #include #if defined(HAVE_PCRE_H) # include #endif #include "analyzer.h" #include "byteset.h" #include "cf.h" #include "debug.h" #include "mmap.h" #include "variable.h" static char const rcsid[] = "@(#)$Id: analyzer.c 1404 2008-03-08 23:25:46Z kalt $"; time_t out_timestamp, err_timestamp; size_t out_size, err_size; char out_md5[33], err_md5[33]; struct condition { int code; char *expression; union { regex_t re; #if defined(HAVE_PCRE_H) pcre *pcre; #endif } val; }; struct marker { size_t offset; char type; }; #define NONE 0 #define LT 0x01 /* Lower Than character may need to be escaped */ #define GT 0x02 /* Grater Than character may need to be escaped */ #define AMP 0x04 /* Lower Than character may need to be escaped */ #define TOGGLE 0x10 /* Toggle rendering */ #define NL 0x40 /* End of line */ #define RE 1 #define PCRE 2 static int outtype, errtype; static struct condition *out, *err; static struct marker *outmarks, *errmarks; /* ** compile_re ** Regular expression (regex_t) initialization */ static int compile_re(void *reptr, char *str) { regex_t *re; int errcode; re = reptr; errcode = regcomp(re, str, REG_EXTENDED); if (errcode != 0) { char buf[1024]; if (regerror(errcode, re, buf, 1024) != 0) error("Bad regular expression: %s", buf); else error("Failed to compile regular expression and to obtain error code: %s", str); return -1; } return 0; } #if defined(HAVE_PCRE_H) /* ** compile_pcre ** Perl Compatible Regular Expression (pcre) initialization */ static int compile_pcre(void *pcreptr, char *str) { pcre **re; const char *errmsg; int erroffset; re = pcreptr; *re = pcre_compile(str, 0, &errmsg, &erroffset, NULL); if (*re == NULL) { error("Bad PCRE (offset %d): %s", erroffset, errmsg); return -1; } return 0; } #endif /* ** loadfile ** Read a list of one line conditions from a file */ static int loadfile(int *type, char *file, struct condition **list) { int lineno, cond, max; size_t len; char *str, *ln, *lndup, *nl; assert( *list == NULL ); *type = RE; /* Allocate a list of conditions */ max = 10; *list = (struct condition *) malloc(max * sizeof(struct condition)); if (*list == NULL) { error("malloc() failed: %s", ERRSTR); return -1; } cond = 0; (*list)[cond].code = -1; err_timestamp = 0; /* Map the configuration file to memory so it can be parsed */ switch (mapfile(file, -1, (void **)&str, &len)) { case 0: /* OK! */ err_timestamp = mapstat()->st_mtime; break; case 1: /* ENOENT */ return 0; default: /* Failure */ return -1; } if (len == 0) return 0; err_size = len; MD5((unsigned char *) str, len, err_md5); ln = str; nl = str; lineno = 1; lndup = NULL; while (ln - str < len) { /* Parse the file line by line */ while (nl - str < len && *nl != '\n') nl += 1; if ((nl - str) == len) { if (*(nl - 1) != '\0') { assert( lndup == NULL ); lndup = (char *) malloc(len - (ln - str) + 1); if (lndup == NULL) { error("malloc() failed: %s", ERRSTR); return -1; } memcpy(lndup, ln, len - (ln - str)); lndup[len - (ln - str)] = '\0'; ln = lndup; } } else *nl = '\0'; if (*ln == '#') { /* Parse configuration directives */ if (strcasecmp(ln, "#pcre") == 0) { if (cond != 0) { error("\"#pcre\" directive must be specified before any condition."); if (lndup != NULL) free(lndup); return -1; } else { #if defined(HAVE_PCRE_H) *type = PCRE; #else error("This binary was built without PCRE support."); if (lndup != NULL) free(lndup); return -1; #endif } } } else { /* Make sure the list structure is big enough */ if (cond == max-2) { max *= 2; *list = (struct condition *) realloc(*list, max * sizeof(struct condition)); if (*list == NULL) /* leakage */ { error("realloc() failed: %s", ERRSTR); if (lndup != NULL) free(lndup); return -1; } } /* Finally, compile the expression */ if (*ln != '\0') { (*list)[cond].code = *ln; (*list)[cond].expression = strdup(ln + 1); if ((*list)[cond].expression == NULL) { error("strdup() failed: %s", ERRSTR); if (lndup != NULL) free(lndup); return -1; } if (*type == RE) { if (compile_re((void *) &((*list)[cond].val.re), ln + 1) != 0) { if (lndup != NULL) free(lndup); return -1; } } else if (*type == PCRE) { #if defined(HAVE_PCRE_H) if (compile_pcre((void *) &((*list)[cond].val.pcre), ln + 1) != 0) { if (lndup != NULL) free(lndup); return -1; } #else error("This binary was built without PCRE support."); if (lndup != NULL) free(lndup); return -1; #endif } else abort(); cond += 1; } } ln = nl + 1; lineno += 1; } if (lndup != NULL) free(lndup); (*list)[cond].code = -1; /* Mark the end of the list */ if (unmapfile(file, str, len) != 0) return -1; return 0; } /* ** analyzer_init ** Initialization for the analyzer. */ int analyzer_init(char *outdef, char *errdef) { assert( outdef != NULL && errdef != NULL ); outmarks = errmarks = NULL; if (loadfile(&outtype, outdef, &out) != 0) return -1; out_timestamp = err_timestamp; err_timestamp = 0; out_size = err_size; strcpy(out_md5, err_md5); if (cf_getrptnum(0, CF_RPTSTDERR) != CF_STDERR_MIXED) return loadfile(&errtype, errdef, &err); else return 0; } /* ** grow_marks ** Grow a list of marker */ static void grow_marks(struct marker **marks, int *max) { struct marker *new; *max *= 2; new = (struct marker *) realloc(*marks, *max * sizeof(struct marker)); if (new == NULL) { error("realloc() failed: %s", ERRSTR); free(*marks); *marks = NULL; } else *marks = new; } /* ** set_mark ** Set 1 mark */ static void set_mark(struct marker **marks, int *mark, int *max, size_t offset, int type) { int i; i = *mark - 1; while (i >= 0 && (*marks)[i].offset > offset) i -= 1; if (i >= 0 && (*marks)[i].offset == offset) (*marks)[i].type |= type; else { int j; if (*mark == *max-2) grow_marks(marks, max); j = *mark; while (j > i) { (*marks)[j+1].offset = (*marks)[j].offset; (*marks)[j+1].type = (*marks)[j].type; j -= 1; } (*marks)[i+1].type = type; (*marks)[i+1].offset = offset; *mark += 1; } } /* ** analyze_file ** Analyze a file according to user specified regular expressions. */ static int analyze_file(char *str, size_t len, int type, struct condition *list, struct marker **marks) { char *ln, *lndup, *nl; int max, mark, lineno, condno; assert( type == RE || type == PCRE ); assert( list != NULL ); assert( *marks == NULL ); if (len == 0) return 0; assert( str != NULL ); /* Allocate the marks array */ max = 10; *marks = (struct marker *) malloc(max * sizeof(struct marker)); if (*marks == NULL) { error("malloc() failed: %s", ERRSTR); return -1; } mark = 0; (*marks)[mark].type = NONE; ln = str; nl = str; lineno = 0; lndup = NULL; while (ln - str < len) { /* Parse the file line by line */ while (nl - str < len && *nl != '\n' && *nl != '\0') { if (*marks != NULL) { if (*nl == '<') set_mark(marks, &mark, &max, nl - str, LT); else if (*nl == '>') set_mark(marks, &mark, &max, nl - str, GT); else if (*nl == '&') set_mark(marks, &mark, &max, nl - str, AMP); } nl += 1; } if (*nl == '\0') break; if (*nl == '\n') { set_mark(marks, &mark, &max, nl-str, NL); *nl = '\0'; } lineno += 1; if (*nl != '\0' && (nl - str) == len) { assert( lndup == NULL ); lndup = (char *) malloc(nl - str + 1); if (lndup == NULL) { error("malloc() failed: %s", ERRSTR); return -1; } memcpy(lndup, ln, nl - str); lndup[nl - str] = '\0'; ln = lndup; } debug(DDATA, "Data line: [%s]", ln); condno = 0; while (list[condno].code != -1) { int r; if (type == RE) { regmatch_t pmatch[1024]; r = regexec(&(list[condno].val.re), ln, 1024, pmatch, 0); if (r != 0 && r != REG_NOMATCH) { /* Something bad happened */ char buf[1024]; if (regerror(r, &(list[condno].val.re), buf, 1024) != 0) error("Fatal error during output analysis: regexec() failed: %s", buf); else error("Fatal error during output analysis: regexec() failed with code %d", r); error("Regular expression used was: %s", list[condno].expression); error("Trying to match the following line of data: %s", buf); if (lndup != NULL) free(lndup); else *nl = '\n'; return -1; } else { if (r == 0) { /* Matched */ debug(DDATA, "Matched: #%d %d[%c] (REG_NOMATCH=%d)", condno+1, r, list[condno].code, REG_NOMATCH); byteset_set(list[condno].code, 1 + byteset_get(list[condno].code)); /* Check for substrings */ r = 1; while (r < 1024) { if (pmatch[r].rm_so == -1) break; set_mark(marks, &mark, &max, ln - str + pmatch[r].rm_so, TOGGLE); set_mark(marks, &mark, &max, ln - str + pmatch[r].rm_eo, TOGGLE); r += 1; } break; } else debug(DVDATA, "Failed: #%d %d[%c] (REG_NOMATCH=%d)", condno+1, r, list[condno].code, REG_NOMATCH); } } #if defined(HAVE_PCRE_H) else if (type == PCRE) { int ovector[3072]; r = pcre_exec(list[condno].val.pcre, NULL, ln, (lndup != NULL) ? strlen(lndup) : nl - ln, 0, 0, ovector, 3072); if (r < 0 && r != PCRE_ERROR_NOMATCH) { /* Something bad happened */ error("Fatal error during output analysis: pcre_exec() failed with code %d", r); error("Regular expression used was: %s", list[condno].expression); error("Trying to match the following line of data: %s", ln); if (lndup != NULL) free(lndup); else *nl = '\n'; return -1; } else { if (r >= 0) { int i; /* Matched */ debug(DDATA, "Matched: #%d %d[%c] (PCRE_ERROR_NOMATCH=%d)", condno+1, r, list[condno].code, PCRE_ERROR_NOMATCH); byteset_set(list[condno].code, 1); /* Check for substrings */ i = 1; while (i < r) { if (ovector[i*2] < 0 || ovector[i*2+1] < 0) continue; set_mark(marks, &mark, &max, ln - str + ovector[i*2], TOGGLE); set_mark(marks, &mark, &max, ln - str + ovector[i*2+1], TOGGLE); i += 1; } break; } else debug(DVDATA, "Failed: #%d %d[%c] (PCRE_ERROR_NOMATCH=%d)", condno+1, r, list[condno].code, PCRE_ERROR_NOMATCH); } } #endif else abort(); condno += 1; } if (list[condno].code == -1) debug(DDATA, "No match!"); if (lndup == NULL) *nl = '\n'; ln = ++nl; } if (lndup != NULL) free(lndup); return lineno; } /* ** analyzer_run ** Analyze the given files according to user specified regular expressions. */ int analyzer_run(char *ostr, size_t olen, char *estr, size_t elen) { int o, e; o = analyze_file(ostr, olen, outtype, out, &outmarks); if (estr != NULL) e = analyze_file(estr, elen, errtype, err, &errmarks); else e = 0; variable_set(V_LINES, o + e); variable_set(V_OUTLINES, o); variable_set(V_ERRLINES, e); if (o < 0 || e < 0) return -1; return 0; } /* ** output_file ** Output a single file */ static int output_file(FILE *mail, char *name, int format, size_t limit, char *str, size_t len, struct marker *marks) { size_t ptr; char toggle, trunc; if (name != NULL) { if (format == CF_FORMAT_RICH) toggle = fprintf(mail, "
----- Command standard %s follows -----
", name); else if (format == CF_FORMAT_HTML) toggle = fprintf(mail, "

----- Command standard %s follows -----

", name); else toggle = 1; if (toggle <= 0) { error("fprintf() failed: %s", ERRSTR); return -1; } } if (format == CF_FORMAT_RICH && fprintf(mail, "") != 8) { error("fprintf() failed: %s", ERRSTR); return -1; } if (format == CF_FORMAT_HTML && fprintf(mail, "
") != 5)
      {
	error("fprintf() failed: %s", ERRSTR);
	return -1;
      }
    ptr = 0;
    toggle = 0; trunc = 0;
    while (marks->type != NONE)
      {
	if (marks->offset - ptr > 0)
	  {
	    if (fwrite(str + ptr, marks->offset - ptr, 1, mail) != 1)
	      {
		error("fwrite() failed: %s", ERRSTR);
		return -1;
	      }
	    ptr = marks->offset;
	  }

	if (format != CF_FORMAT_TEXT && (marks->type & TOGGLE) == TOGGLE)
	  {
	    char *tag;

	    if (toggle == 0)
		tag = (format == CF_FORMAT_RICH) ? "" : "";
	    else
		tag = (format == CF_FORMAT_RICH) ? "" : "";

	    if (fprintf(mail, tag) != strlen(tag))
	      {
		error("fprintf() failed: %s", ERRSTR);
		return -1;
	      }
	    toggle = 1 - toggle;
	  }

	if (format == CF_FORMAT_HTML && (marks->type & (LT|GT|AMP)) != 0)
	  {
	    char *esc;

	    if ((marks->type & LT) == LT)
		esc = "<";
	    else if ((marks->type & GT) == GT)
		esc = ">";
	    else if ((marks->type & AMP) == AMP)
		esc = "&";
	    else
		abort();

	    if (fprintf(mail, esc) != strlen(esc))
	      {
		error("fprintf() failed: %s", ERRSTR);
		return -1;
	      }

	    /* Skip the character, it was escaped! */
	    ptr += 1;
	  }

	if (format == CF_FORMAT_RICH && (marks->type & LT) == LT
	    && fprintf(mail, "<") != 1)
	  {
	    error("fprintf() failed: %s", ERRSTR);
	    return -1;
	  }

	if (trunc == 0 && (marks->type & NL) == NL)
	  {
	    if (len > limit && marks->offset > limit / 2)
	      {
		struct marker *hole;
		u_long lines;

		lines = 0;
		hole = marks;
		while ((marks->type & NL) != NL
		       || hole->offset + len - marks->offset > limit)
		  {
		    if ((marks->type & NL) == NL)
			lines += 1;
		    marks += 1;
		  }

		if (format == CF_FORMAT_TEXT
		    && fprintf(mail, "\n[... %lu lines (%ld bytes) of output truncated ...]\n", lines, marks->offset - hole->offset) <=0 )
		  {
		    error("fprintf() failed: %s", ERRSTR);
		    return -1;
		  }		
		if (format == CF_FORMAT_RICH
		    && fprintf(mail, "
----- %lu lines (%ld bytes) of output truncated -----
", lines, marks->offset - hole->offset) <= 0) { error("fprintf() failed: %s", ERRSTR); return -1; } if (format == CF_FORMAT_HTML && fprintf(mail, "

----- %lu lines (%ld bytes) of output truncated -----

", lines, marks->offset - hole->offset) <= 0)
		  {
		    error("fprintf() failed: %s", ERRSTR);
		    return -1;
		  }		

		ptr = marks->offset + 1;
		trunc = 1;
	      }
	  }

	marks += 1;
      }

    if (ptr < len && fwrite(str + ptr, len - ptr, 1, mail) != 1)
      {
	error("fwrite() failed: %s", ERRSTR);
	return -1;
      }
    if (str[len - 1] != '\n' && fprintf(mail, "\n") != 1)
      {
	error("fprintf() failed: %s", ERRSTR);
	return -1;
      }

    if (format == CF_FORMAT_RICH && fprintf(mail, "") != 9)
      {
	error("fprintf() failed: %s", ERRSTR);
	return -1;
      }
    if (format == CF_FORMAT_HTML && fprintf(mail, "
") != 6) { error("fprintf() failed: %s", ERRSTR); return -1; } return 0; } /* ** analyzer_output ** Output the result of an analysis */ int analyzer_output(FILE *mail, int format, int output, size_t limit, char *ostr, size_t olen, char *estr, size_t elen) { size_t olimit, elimit; int o, e, over; over = 0; if (limit <= 0) olimit = elimit = olen + elen; else if (output == CF_STDERR_OUT) { olimit = elimit = limit; if (olen > limit) over = 1; } else if (output == CF_STDERR_ERR) { olimit = elimit = limit; if (elen > limit) over = 1; } else { if (output == CF_STDERR_MIXED) olimit = limit; else { olimit = elimit = limit / 2; if (olen < olimit) elimit = limit - olen; if (elen < elimit) olimit = limit - elen; } if (olen + elen > limit) over = 1; } if (over == 1) { if (format == CF_FORMAT_TEXT && fprintf(mail, "WARNING: The following output is truncated!\n (Total of %ld bytes is over the limit of %ld)\n\n", olen + elen, limit) <= 0) { error("fprintf() failed: %s", ERRSTR); return -1; } if (format == CF_FORMAT_RICH && fprintf(mail, "WARNING: The following output is truncated!\n (Total of %ld bytes is over the limit of %ld)\n\n", olen + elen, limit) <= 0) { error("fprintf() failed: %s", ERRSTR); return -1; } if (format == CF_FORMAT_HTML && fprintf(mail, "

WARNING: The following output is truncated! (Total of %ld bytes is over the limit of %ld)

", olen + elen, limit) <= 0) { error("fprintf() failed: %s", ERRSTR); return -1; } } o = e = 0; if (output == CF_STDERR_ERR) { if (elen > 0) e = output_file(mail, "error ", format, elimit, estr, elen, errmarks); } else if (output == CF_STDERR_OUT) { if (olen > 0) o = output_file(mail, "output ", format, olimit, ostr, olen, outmarks); } else { if (elen > 0 && output == CF_STDERR_FIRST) e = output_file(mail, (olen > 0) ? "error " : NULL, format, elimit, estr, elen, errmarks); if (olen > 0) o = output_file(mail, (output != CF_STDERR_MIXED && elen > 0) ? "output" : NULL, format, olimit, ostr, olen, outmarks); if (elen > 0 && output == CF_STDERR_LAST) e = output_file(mail, (olen > 0) ? "error " : NULL, format, elimit, estr, elen, errmarks); } if (o != 0 || e != 0) return -1; return 0; } shush-1.2.3/src/siglist.h0000644000241700024170000000045110764620172015516 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush ** see the LICENSE file for details on your rights. ** ** $Id: siglist.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_SIGLIST_H_) # define _SIGLIST_H_ int getsignumbyname(char *); char *getsignamebynum(int); #endif shush-1.2.3/src/variable.c0000644000241700024170000000236610764620172015627 0ustar taranisotaraniso/* ** Copyright (C) 2003, 2004 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include "variable.h" static char const rcsid[] = "@(#)$Id: variable.c 1404 2008-03-08 23:25:46Z kalt $"; struct variable { char *name; long value; }; static struct variable variables[] = { { V_EXIT, 0 }, { V_SIZE, 0 }, { V_OUTSIZE, 0 }, { V_ERRSIZE, 0 }, { V_LINES, 0 }, { V_OUTLINES, 0 }, { V_ERRLINES, 0 }, { V_RUNTIME, 0 }, { V_UTIME, 0 }, { V_STIME, 0 }, { V_TTY, 0 }, { NULL, -1 } }; /* ** variable_set ** Sets the value of a byte in a particular set */ void variable_set(char *name, long value) { int i; i = 0; while (variables[i].name != NULL) { if (strcasecmp(variables[i].name, name) == 0) { variables[i].value = value; return; } i += 1; } abort(); } /* ** variable_get ** Return the value of a byte in a particular set */ int variable_get(char *name, long *value) { int i; i = 0; while (variables[i].name != NULL) { if (strcasecmp(variables[i].name, name) == 0) { *value = variables[i].value; return 0; } i += 1; } return -1; } shush-1.2.3/src/state.c0000644000241700024170000001100110764620172015144 0ustar taranisotaraniso/* ** Copyright (C) 2005, 2006 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #if defined(HAVE_PTHREAD_H) # include #endif #include "state.h" #include "cf.h" #include "debug.h" #include "gethostname.h" #include "units.h" #include "version.h" static char const rcsid[] = "@(#)$Id: state.c 1404 2008-03-08 23:25:46Z kalt $"; static char statepath[PATH_MAX]; static int fd = -1; struct { time_t last; /* last time state was saved */ time_t start; /* shush start time */ time_t delay; /* random delay */ time_t run; /* command run start time */ time_t timeout; /* first timeout action time */ time_t end; /* command end time */ int locked; /* lock: (1) used (2) ignored (3) aborted */ int killed; /* whether command was sent signals */ /* need exit status info? */ char *msg; /* human readable message */ } state; #if defined(HAVE_PTHREAD) static void * state_save(void *null) { char str[1024], lock; int len; fd = open(statepath, O_RDWR|O_CREAT|O_EXCL, 0644); if (fd == -1) { if (errno != ENOENT || cf_getstr(CF_STATEDIR) != NULL) error("open(%s) failed: %s", statepath, ERRSTR); pthread_exit(NULL); } while (1) { if (time(NULL) - state.last < 30) { sleep(1); continue; } if (lseek(fd, SEEK_SET, 0) != 0) { error("lseek(%s, SEEK_SET, 0) failed, state lost: %s", statepath, ERRSTR); close(fd); fd = -1; pthread_exit(NULL); } if (state.end == 0 && state.msg == NULL) /* Better update twice than miss an update */ state.last = time(NULL); else /* final update */ state.last = 0; if (state.locked == STATE_LCKOK) lock = 'L'; else if (state.locked == STATE_LCKIGN) lock = 'I'; else if (state.locked == STATE_LCKFAIL) lock = 'F'; else lock = '-'; len = snprintf(str, 1024, "%lu %lu %lu %lu %lu %lu %c %u %.80s\n", state.last, state.start, state.delay, state.run, state.timeout, state.end, lock, state.killed,state.msg); if (write(fd, str, len) != len) { error("write(%s) failed, state lost: %s", statepath, ERRSTR); close(fd); fd = -1; pthread_exit(NULL); } if (ftruncate(fd, len) != 0) { error("ftruncate(%s, %d) failed, state lost: %s", statepath, len, ERRSTR); close(fd); fd = -1; pthread_exit(NULL); } if (state.last == 0) { close(fd); fd = -1; pthread_exit(NULL); } } } #endif void state_init(char *cfdir, char *job) { #if defined(HAVE_PTHREAD_H) pthread_t save; #endif char *sdir; int status; state.start = time(NULL); state.last = 0; state.delay = 0; state.run = 0; state.timeout = 0; state.end = 0; state.locked = 0; state.killed = 0; state.msg = ""; sdir = cf_getstr(CF_STATEDIR); if (sdir == NULL) snprintf(statepath, PATH_MAX, "%s/.state/shtate-%lu-%s-%s-%u", cfdir, state.start, job, get_hostname(0), getpid()); else if (sdir[0] == '\0') return; else snprintf(statepath, PATH_MAX, "%s/shtate-%lu-%s-%s-%u", sdir, state.start, job, get_hostname(0), getpid()); #if defined(HAVE_PTHREAD) status = pthread_create(&save, NULL, state_save, NULL); if (status != 0) error("pthread_create(state_save) failed: %s", strerror(status)); #endif } void state_delay(time_t delay) { assert( state.delay == 0 ); state.delay = delay; state.last = 1; } void state_run() { assert( state.run == 0 ); state.run = time(NULL); state.last = 1; } void state_timeout() { if (state.timeout == 0) { state.timeout = time(NULL); state.last = 1; } } void state_locked(int status) { state.locked = status; state.last = 1; } void state_killed() { state.killed += 1; state.last = 1; } void state_close(char *msg) { int max; if (msg == NULL) state.end = time(NULL); else state.msg = msg; state.last = 1; max = 15; while (max-- > 0 && fd >= 0) sleep(1); } shush-1.2.3/src/ifparser.tab.c0000644000241700024170000004007710764620172016423 0ustar taranisotaraniso#include #ifndef lint #if 0 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #else #if defined(__NetBSD__) && defined(__IDSTRING) __IDSTRING(yyrcsid, "$NetBSD: skeleton.c,v 1.23 2002/01/31 21:01:15 tv Exp $"); #endif /* __NetBSD__ && __IDSTRING */ #endif /* 0 */ #endif /* lint */ #ifndef __P #ifdef __STDC__ #define __P(x) x #else #define __P(x) () #endif #endif #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define YYLEX yylex() #define YYEMPTY -1 #define yyclearin (yychar=(YYEMPTY)) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define yyparse ifparser_parse #define yylex ifparser_lex #define yyerror ifparser_error #define yychar ifparser_char #define yyval ifparser_val #define yylval ifparser_lval #define yydebug ifparser_debug #define yynerrs ifparser_nerrs #define yyerrflag ifparser_errflag #define yyss ifparser_ss #define yysslim ifparser_sslim #define yyssp ifparser_ssp #define yyvs ifparser_vs #define yyvsp ifparser_vsp #define yystacksize ifparser_stacksize #define yylhs ifparser_lhs #define yylen ifparser_len #define yydefred ifparser_defred #define yydgoto ifparser_dgoto #define yysindex ifparser_sindex #define yyrindex ifparser_rindex #define yygindex ifparser_gindex #define yytable ifparser_table #define yycheck ifparser_check #define yyname ifparser_name #define yyrule ifparser_rule #define YYPREFIX "ifparser_" #line 2 "ifparser.y" /* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include "ifparser.h" #include "byteset.h" #include "variable.h" static char const rcsid[] = "@(#)$Id: ifparser.tab.c 1404 2008-03-08 23:25:46Z kalt $"; int ifparser_result; const char *ifparser_errmsg; #line 22 "ifparser.y" typedef union { long integer; char * string; } YYSTYPE; #line 79 "ifparser.tab.c" #define NUMBER 257 #define UVARNAME 258 #define EQ 259 #define NE 260 #define LE 261 #define GE 262 #define IVARNAME 263 #define NOT 264 #define MINUS 265 #define DOLLAR 266 #define YYERRCODE 256 const short ifparser_lhs[] = { -1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; const short ifparser_len[] = { 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, }; const short ifparser_defred[] = { 0, 15, 16, 17, 0, 0, 0, 0, 0, 13, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, }; const short ifparser_dgoto[] = { 7, 8, }; const short ifparser_sindex[] = { -33, 0, 0, 0, -33, -33, -33, 0, 42, 0, -27, 0, -33, -33, -33, -33, -33, -33, -33, -33, -33, -33, 0, -41, -41, -41, -41, 29, 29, -41, -41, 0, 0, }; const short ifparser_rindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 9, 13, 3, 15, 17, 21, 0, 0, }; const short ifparser_gindex[] = { 0, 94, }; #define YYTABLESIZE 304 const short ifparser_table[] = { 6, 4, 20, 10, 21, 5, 1, 5, 0, 7, 0, 16, 4, 9, 22, 11, 20, 6, 21, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 19, 0, 0, 0, 4, 0, 10, 4, 5, 10, 0, 5, 7, 0, 0, 7, 9, 0, 11, 9, 6, 11, 0, 6, 8, 0, 4, 8, 4, 0, 5, 0, 5, 0, 7, 0, 7, 20, 9, 21, 9, 0, 6, 0, 6, 16, 8, 0, 8, 0, 20, 0, 21, 0, 18, 0, 19, 0, 0, 0, 0, 0, 17, 9, 10, 11, 0, 18, 0, 19, 0, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 10, 0, 5, 0, 0, 0, 7, 0, 0, 0, 9, 0, 11, 0, 6, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 3, 0, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 5, 5, 5, 5, 7, 7, 7, 7, 9, 9, 9, 9, 6, 6, 6, 6, 8, 8, 8, 8, 0, 0, 0, 0, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 15, }; const short ifparser_check[] = { 33, 0, 43, 0, 45, 0, 0, 40, -1, 0, -1, 38, 45, 0, 41, 0, 43, 0, 45, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, 38, -1, 38, 41, 38, 41, -1, 41, 38, -1, -1, 41, 38, -1, 38, 41, 38, 41, -1, 41, 38, -1, 60, 41, 62, -1, 60, -1, 62, -1, 60, -1, 62, 43, 60, 45, 62, -1, 60, -1, 62, 38, 60, -1, 62, -1, 43, -1, 45, -1, 60, -1, 62, -1, -1, -1, -1, -1, 124, 4, 5, 6, -1, 60, -1, 62, -1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, 124, -1, 124, -1, -1, -1, 124, -1, -1, -1, 124, -1, 124, -1, 124, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, 258, -1, -1, -1, -1, 263, -1, 259, 260, 261, 262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 259, 260, 261, 262, 259, 260, 261, 262, 259, 260, 261, 262, 259, 260, 261, 262, 259, 260, 261, 262, 259, 260, 261, 262, -1, -1, -1, -1, 259, 260, 261, 262, -1, -1, -1, -1, -1, -1, -1, -1, -1, 259, 260, 261, 262, }; #define YYFINAL 7 #ifndef YYDEBUG #define YYDEBUG 1 #endif #define YYMAXTOKEN 266 #if YYDEBUG const char * const ifparser_name[] = { "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, "'!'",0,0,0,0,"'&'",0,"'('","')'",0,"'+'",0,"'-'",0,0,0,0,0,0,0,0,0,0,0,0,0,0, "'<'",0,"'>'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,"NUMBER","UVARNAME","EQ","NE","LE","GE","IVARNAME","NOT","MINUS","DOLLAR", }; const char * const ifparser_rule[] = { "$accept : condition", "condition : expr", "expr : expr '+' expr", "expr : expr '-' expr", "expr : expr EQ expr", "expr : expr NE expr", "expr : expr '<' expr", "expr : expr LE expr", "expr : expr '>' expr", "expr : expr GE expr", "expr : expr '&' expr", "expr : expr '|' expr", "expr : '(' expr ')'", "expr : '-' expr", "expr : '!' expr", "expr : NUMBER", "expr : UVARNAME", "expr : IVARNAME", }; #endif #ifdef YYSTACKSIZE #undef YYMAXDEPTH #define YYMAXDEPTH YYSTACKSIZE #else #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else #define YYSTACKSIZE 10000 #define YYMAXDEPTH 10000 #endif #endif #define YYINITSTACKSIZE 200 int yydebug; int yynerrs; int yyerrflag; int yychar; short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; short *yyss; short *yysslim; YYSTYPE *yyvs; int yystacksize; int yyparse __P((void)); #line 67 "ifparser.y" static int yyerror(const char *msg) { ifparser_errmsg = msg; return 0; } #line 260 "ifparser.tab.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ static int yygrowstack __P((void)); static int yygrowstack __P((void)) { int newsize, i; short *newss; YYSTYPE *newvs; if ((newsize = yystacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = yyssp - yyss; if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL) return -1; yyss = newss; yyssp = newss + i; if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL) return -1; yyvs = newvs; yyvsp = newvs + i; yystacksize = newsize; yysslim = yyss + newsize - 1; return 0; } #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int yyparse __P((void)) { int yym, yyn, yystate; #if YYDEBUG const char *yys; if ((yys = getenv("YYDEBUG")) != NULL) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0'; } #endif yynerrs = 0; yyerrflag = 0; yychar = (-1); if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; *yyssp = yystate = 0; yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif } if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; yychar = (-1); if (yyerrflag > 0) --yyerrflag; goto yyloop; } if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery; goto yynewerror; yynewerror: yyerror("syntax error"); goto yyerrlab; yyerrlab: ++yynerrs; yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } else { #if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", YYPREFIX, *yyssp); #endif if (yyssp <= yyss) goto yyabort; --yyssp; --yyvsp; } } } else { if (yychar == 0) goto yyabort; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif yychar = (-1); goto yyloop; } yyreduce: #if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; switch (yyn) { case 1: #line 40 "ifparser.y" { ifparser_result = yyval.integer; } break; case 2: #line 41 "ifparser.y" { yyval.integer = yyvsp[-2].integer + yyvsp[0].integer; } break; case 3: #line 42 "ifparser.y" { yyval.integer = yyvsp[-2].integer - yyvsp[0].integer; } break; case 4: #line 43 "ifparser.y" { yyval.integer = yyvsp[-2].integer == yyvsp[0].integer; } break; case 5: #line 44 "ifparser.y" { yyval.integer = yyvsp[-2].integer != yyvsp[0].integer; } break; case 6: #line 45 "ifparser.y" { yyval.integer = yyvsp[-2].integer < yyvsp[0].integer; } break; case 7: #line 46 "ifparser.y" { yyval.integer = yyvsp[-2].integer <= yyvsp[0].integer; } break; case 8: #line 47 "ifparser.y" { yyval.integer = yyvsp[-2].integer > yyvsp[0].integer; } break; case 9: #line 48 "ifparser.y" { yyval.integer = yyvsp[-2].integer >= yyvsp[0].integer; } break; case 10: #line 49 "ifparser.y" { yyval.integer = yyvsp[-2].integer && yyvsp[0].integer; } break; case 11: #line 50 "ifparser.y" { yyval.integer = yyvsp[-2].integer || yyvsp[0].integer; } break; case 12: #line 51 "ifparser.y" { yyval.integer = yyvsp[-1].integer; } break; case 13: #line 52 "ifparser.y" { yyval.integer = - yyvsp[0].integer; } break; case 14: #line 54 "ifparser.y" { yyval.integer = ! yyvsp[0].integer; } break; case 15: #line 56 "ifparser.y" { yyval.integer = yyvsp[0].integer; } break; case 16: #line 57 "ifparser.y" { yyval.integer = byteset_get(yyvsp[0].integer); } break; case 17: #line 58 "ifparser.y" { if (variable_get(yyvsp[0].string, &yyval.integer) != 0) { yyerror("Unknown variable used"); YYERROR; } } break; #line 498 "ifparser.tab.c" } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) { #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; *++yyssp = YYFINAL; *++yyvsp = yyval; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } #endif } if (yychar == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yyssp, yystate); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate; *++yyvsp = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: return (1); yyaccept: return (0); } shush-1.2.3/src/ifparser.l0000644000241700024170000000245107673467556015705 0ustar taranisotaraniso%{ /* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include "ifparser.h" #include "ifparser.tab.h" static char const rcsid[] = "@(#)$Id: ifparser.l,v 1.5 2003-06-17 01:30:20 kalt Exp $"; static char *inputstr; static int inputstrcur, inputstrlen; static int ifparser_input(char *, int); #undef YY_INPUT #define YY_INPUT(b, r, ms) (r = ifparser_input(b, ms)) %} %option noyywrap %% [ \t]+ ; /* Eat white spaces */ -?[0-9]+ { ifparser_lval.integer = atoi(ifparser_text); return NUMBER; } &&|\|\| { return ifparser_text[0]; } == { return EQ; } != { return NE; } \<= { return LE; } >= { return GE; } [!()-+<>] { return ifparser_text[0]; } \$[a-zA-Z]+ { ifparser_lval.string = ifparser_text + 1; return IVARNAME; } [^!()-+<>] { ifparser_lval.integer = ifparser_text[0]; return UVARNAME; } %% void ifparser_init(char *str) { inputstr = str; inputstrcur = 0; inputstrlen = strlen(str); } static int ifparser_input(char *buf, int max_size) { int count; count = inputstrlen - inputstrcur; if (count > max_size) count = max_size; if (count == 0) return YY_NULL; memcpy((void *)buf, (void *)(inputstr + inputstrcur), count); inputstrcur += count; return count; } shush-1.2.3/src/exec.c0000644000241700024170000000673710764620172014774 0ustar taranisotaraniso/* ** Copyright (C) 2002, 2003, 2004 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #if defined(HAVE_PATHS_H) # include #else # define _PATH_DEVNULL "/dev/null" #endif #include #include #include /* FreeBSD wants this for the next one.. */ #include #include #include #include #include "exec.h" static char const rcsid[] = "@(#)$Id: exec.c 1404 2008-03-08 23:25:46Z kalt $"; static void fatal(int, char *, ...) #if ( __GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) || __GNUC__ >= 3 __attribute__((__noreturn__)) #endif ; /* ** fatal ** Output the fatal error message and commit SIGTERM suicide to try and ** make sure this doesn't go unnoticed. */ static void fatal(int fd, char *format, ...) { char msg[1024]; va_list va; va_start(va, format); vsprintf(msg, format, va); va_end(va); write(fd, msg, strlen(msg)+1); kill(SIGKILL, getpid()); sleep(5); /* Just in case.. */ abort(); } /* ** exec ** fork()/execl() wrapper. */ pid_t exec(int fd0, int fd1, int fd2, int newgrp, char *cmd[]) { struct rlimit fdlimit; pid_t child; assert( fd0 == -1 || fd0 > 2 ); assert( fd1 >= 1 ); assert( fd2 >= 2 ); assert( cmd != NULL ); /* ** Get the maximum number of open files for this process so we can ** cleanup things properly in the child. The only reason this is ** done before forking is to be able to whine if the call fails. */ if (getrlimit(RLIMIT_NOFILE, &fdlimit) == -1) { error("getrlimit(RLIMIT_NOFILE): %s", ERRSTR); fdlimit.rlim_cur = 1024; } /* fork() */ child = fork(); if (child == -1) { /* Nope.. */ error("fork(): %s", ERRSTR); return -1; } /* Let each process go its own way */ if (child > 0) { if (fd0 >= 0) close(fd0); return child; } else { int fd; struct sigaction sa; char *command; /* Close all open filedescriptors */ fd = 0; while (fd <= fdlimit.rlim_cur) { if (fd != fd0 && fd != fd1 && fd != fd2) close(fd); fd += 1; } if (fd0 < 0) { fd0 = open(_PATH_DEVNULL, O_RDONLY, 0); if (fd0 == -1) fatal(fd2, "%s: open(%s): %s\n", myname, _PATH_DEVNULL, ERRSTR); if (fd0 != 0) fatal(fd2, "%s: open(%s) returned %d (should have been 0!)\n", myname, _PATH_DEVNULL, fd); } else if (dup(fd0) != 0) fatal(fd2, "%s: dup(in) failed: %s\n", myname, ERRSTR); if (fd1 != 1 && dup(fd1) != 1) fatal(fd2, "%s: dup(out) failed: %s\n", myname, ERRSTR); if (fd2 != 2 && dup(fd2) != 2) fatal(fd2, "%s: dup(out) failed: %s\n", myname, ERRSTR); if (fd1 > 2 && close(fd1) == -1) fatal(2, "%s: close(out) failed: %s\n", myname, ERRSTR); if (fd2 > 2 && fd2 != fd1 && close(fd2) == -1) fatal(2, "%s: close(err) failed: %s\n", myname, ERRSTR); /* Reset SIGPIPE handler */ sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = SIG_DFL; if (sigaction(SIGPIPE, &sa, NULL) != 0) fatal(2, "sigaction(SIGPIPE, SIG_DFL, NULL) failed: %s", myname, ERRSTR); /* If requested, start a new process group */ if (newgrp != 0 && setpgid(getpid(), getpid()) != 0) fatal(2, "%s: setpgid() failed: %s\n", myname, ERRSTR); /* Finally, execl() */ command = cmd[0]; cmd[0] = basename(command); execv(command, cmd); /* Uhoh */ fatal(2, "%s: execv(%s): %s\n", myname, command, ERRSTR); } /* NOTREACHED */ } shush-1.2.3/src/exec.h0000644000241700024170000000043510764620172014766 0ustar taranisotaraniso/* ** Copyright (C) 2002, 2003, 2004 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: exec.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_EXEC_H_) # define _EXEC_H_ pid_t exec(int, int, int, int, char **); #endif shush-1.2.3/src/check.c0000644000241700024170000001414510764620172015115 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #if defined(HAVE_PATHS_H) # include #else # define _PATH_TMP "/tmp" #endif #include #include #include #include "check.h" #include "analyzer.h" #include "cf.h" #include "debug.h" #include "exec.h" #include "mmap.h" #include "variable.h" #include "version.h" static char const rcsid[] = "@(#)$Id: check.c 1404 2008-03-08 23:25:46Z kalt $"; static char * mystrftime(char *format, time_t when) { struct tm *tm; static char timestr[256]; tm = localtime(&when); if (strftime(timestr, 256, format, tm) == 0) timestr[255] = '\0'; return timestr; } void checkrun(char *cfdir, char *job, char *outlog, char *errlog, char *to[], char *envp[]) { char fname[PATH_MAX], outre[PATH_MAX], errre[PATH_MAX], *outstr, *errstr; size_t outlen, errlen; int rpt; struct passwd *pw; assert( cfdir != NULL ); assert( job != NULL ); assert( outlog != NULL || errlog == NULL ); pw = getpwuid(getuid()); /* Load the configuration */ snprintf(fname, PATH_MAX, "%s/%s", cfdir, job); cf_load(fname, ""); assert( cf_timestamp != 0 ); printf("%s: %s %ld %s\n", job, mystrftime("%Y/%m/%d %H:%M:%S", cf_timestamp), cf_size, cf_md5); snprintf(outre, PATH_MAX, "%s.stdout", cf_getstr(CF_CONFIG)); snprintf(errre, PATH_MAX, "%s.stderr", cf_getstr(CF_CONFIG)); if (analyzer_init(outre, errre) == -1) exit(1); if (out_timestamp != 0) printf("%s: stdout %s %ld %s\n", job, mystrftime("%Y/%m/%d %H:%M:%S", out_timestamp), out_size, out_md5); if (err_timestamp != 0) printf("%s: stderr %s %ld %s\n", job, mystrftime("%Y/%m/%d %H:%M:%S", err_timestamp), err_size, err_md5); if (outlog == NULL && errlog == NULL) return; /* Map outputs to memory */ if (mapfile(outlog, -1, (void **)&outstr, &outlen) != 0) exit(1); if (errlog == NULL) { errstr = NULL; errlen = 0; } else if (mapfile(errlog, -1, (void **)&errstr, &errlen) != 0) exit(1); /* Analyze outputs */ if (analyzer_run(outstr, outlen, errstr, errlen) != 0) exit(1); debug(DINFO, "Done with analysis."); /* Produce reports */ rpt = 0; while (rpt < 3) { int mail[2], smstatus, err, env; FILE *sm; char *format, *argv[4]; pid_t child; /* Check whether report should be sent */ if (to[rpt] == NULL) { rpt += 1; continue; } format = (rpt == 0) ? "HTML" : (rpt == 1) ? "Enriched" : "Text"; debug(DINFO, "Generating %s report to \"%s\"...", format, to[rpt]); /* Create pipe to sendmail */ if (pipe(mail) != 0) { error("pipe() failed for %s report: %s", format, ERRSTR); continue; } sm = fdopen(mail[1], "w"); if (sm == NULL) { error("fdopen() failed for %s report: %s", format, ERRSTR); close(mail[0]); close(mail[1]); continue; } /* Spawn sendmail process */ argv[0] = cf_getstr(CF_SENDMAIL); argv[1] = "-t"; argv[2] = "-i"; argv[3] = NULL; child = exec(mail[0], 1, 2, 0, argv); if (child < 0) { error("Failed to send %s report", format); fclose(sm); continue; } /* Fill in headers */ err = 1; err = fprintf(sm, "To: %s\n", to[rpt]); if (err > 0) err = fprintf(sm, "Subject: %s report sample for %s\n", format, job); if (err > 0) err = fprintf(sm, "X-Shush-Version: %s\n", SHUSH_VERSION); env = 0; while (err > 0 && envp[env] != NULL) err = fprintf(sm, "X-Shush-Env: <%s>\n", envp[env++]); if (err > 0) err = fprintf(sm, "X-Shush-Name: %s %s %ld %s\n", job, mystrftime("%Y/%m/%d %H:%M:%S", cf_timestamp), cf_size, cf_md5); if (err > 0 && out_timestamp != 0) err = fprintf(sm, "X-Shush-Stdout: %s %ld %s\n", mystrftime("%Y/%m/%d %H:%M:%S", out_timestamp), out_size, out_md5); if (err > 0 && err_timestamp != 0) err = fprintf(sm, "X-Shush-Stderr: %s %ld %s\n", mystrftime("%Y/%m/%d %H:%M:%S", err_timestamp), err_size, err_md5); if (err > 0) err = fprintf(sm, "X-Shush-User: %s [%u]\n", (pw != NULL && pw->pw_name != NULL) ? pw->pw_name:"?", getuid()); if (err > 0) err = fprintf(sm, "X-Shush-Command: %s\n", cf_getstr(CF_CMD)); if (err > 0) { long lines; if (variable_get(V_OUTLINES, &lines) != 0) abort(); err = fprintf(sm, "X-Shush-Stdout-Size: %ld lines, %ld Bytes\n", lines, outlen); } if (err > 0) { long lines; if (variable_get(V_ERRLINES, &lines) != 0) abort(); err = fprintf(sm, "X-Shush-Stderr-Size: %ld lines, %ld Bytes\n", lines, errlen); } if (err > 0 && rpt == 0) err = fprintf(sm, "Content-Type: text/html\n"); if (err > 0 && rpt == 1) err = fprintf(sm, "Content-Type: text/enriched\n"); if (err > 0) err = fprintf(sm, "\n"); if (err <= 0) { error("Error while writing mail headers for %s report: %s", format, ERRSTR); err = -1; } else if (analyzer_output(sm, (rpt == 0) ? CF_FORMAT_HTML : (rpt == 1) ? CF_FORMAT_RICH : CF_FORMAT_TEXT, cf_getrptnum(rpt, CF_RPTSTDERR), cf_getrptnum(rpt, CF_RPTMAXSZ), outstr, outlen, errstr, errlen) != 0) error("Errors while sending output for %s report.", format); if (fclose(sm) != 0 && err == 0) error("Errors while sending %s report: %s", format, ERRSTR); /* Wait for sendmail child to complete */ while (1) { err = waitpid(child, &smstatus, 0); if (err == child && (WIFEXITED(smstatus) || WIFSIGNALED(smstatus))) break; if (err == -1) { if (errno == EINTR) debug(DINFO, "waitpid(%d): %s", child, ERRSTR); else error("waitpid(%d[sendmail for %s report]) failed: %s", child, format, ERRSTR); } sleep(1); } /* Child is done */ /* Check termination type */ if (WIFEXITED(smstatus) && WEXITSTATUS(smstatus) != 0) error("sendmail for %s report returned: %d", format, WEXITSTATUS(smstatus)); if (WIFSIGNALED(smstatus)) error("sendmail for %s report died from %s", format, strsignal(WTERMSIG(smstatus))); rpt += 1; } } shush-1.2.3/src/debug.h0000644000241700024170000000112310764620172015123 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: debug.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_DEBUG_H_) #define _DEBUG_H_ void debug_init(int); void debug(int, char *, ...) #if ( __GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) || __GNUC__ >= 3 __attribute__((__format__(__printf__, 2, 3))) #endif ; #define DINFO 1 /* Useless informative messages */ #define DCF 2 /* Configuration parser */ #define DDATA 3 /* Output data details */ #define DVDATA 4 /* VERBOSE Output data details */ #endif shush-1.2.3/src/units.c0000644000241700024170000000632710764620172015205 0ustar taranisotaraniso/* ** Copyright (C) 2002, 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #include "units.h" static char const rcsid[] = "@(#)$Id: units.c 1404 2008-03-08 23:25:46Z kalt $"; u_int unit_time(timestr) char *timestr; { char *unit; unit = timestr; while (*unit != '\0' && isdigit((int) *unit) != 0) unit += 1; switch (*unit) { case 'W': case 'w': return 7*24*60*60 * atoi(timestr); case 'D': case 'd': return 24*60*60 * atoi(timestr); case 'H': case 'h': return 60*60 * atoi(timestr); case '\0': case 'M': case 'm': return 60 * atoi(timestr); case 'S': case 's': return atoi(timestr); default: error("Invalid time unit: %c", *unit); exit(1); } } char * unit_rtime(u_int timeval) { static char timestr[80]; int width; if (timeval == 0) return "0s"; timestr[0] = '\0'; if (timeval > 7*24*60*60) { sprintf(timestr + strlen(timestr), "%uw", (u_int) (timeval / (7*24*60*60))); width = 2; } else width = 1; timeval %= 7*24*60*60; if (timeval > 24*60*60) { sprintf(timestr + strlen(timestr), "%ud", (u_int) (timeval / (24*60*60))); width = 2; } timeval %= 24*60*60; if (timeval > 60*60) { sprintf(timestr + strlen(timestr), "%.*uh", width, (u_int) (timeval / (60*60))); width = 2; } timeval %= 60*60; if (timeval > 60) { sprintf(timestr + strlen(timestr), "%.*um", width, (u_int) (timeval / 60)); width = 2; } timeval %= 60; if (timeval > 0) sprintf(timestr + strlen(timestr), "%.*us", width, timeval); return timestr; } u_int unit_size(sizestr) char *sizestr; { char *unit; unit = sizestr; while (*unit != '\0' && isdigit((int) *unit) != 0) unit += 1; switch (*unit) { case 'G': case 'g': return 1024*1024*1024 * atoi(sizestr); case 'M': case 'm': return 1024*1024 * atoi(sizestr); case '\0': case 'K': case 'k': return 1024 * atoi(sizestr); case 'B': case 'b': case 'C': case 'c': return atoi(sizestr); default: error("Invalid size unit: %c", *unit); exit(1); } } struct codestr { char *name; int code; }; static struct codestr sysfac[] = { {"kern", LOG_KERN}, {"user", LOG_USER}, {"mail", LOG_MAIL}, {"daemon", LOG_DAEMON}, {"auth", LOG_AUTH}, {"security", LOG_AUTH}, {"syslog", LOG_SYSLOG}, {"lpr", LOG_LPR}, {"news", LOG_NEWS}, {"uucp", LOG_UUCP}, {"cron", LOG_CRON}, {"local0", LOG_LOCAL0}, {"local1", LOG_LOCAL1}, {"local2", LOG_LOCAL2}, {"local3", LOG_LOCAL3}, {"local4", LOG_LOCAL4}, {"local5", LOG_LOCAL5}, {"local6", LOG_LOCAL6}, {"local7", LOG_LOCAL7}, {NULL, -1} }; int syslog_facility(char *name) { int i; i = 0; while (sysfac[i].name != NULL) { if (strcasecmp(sysfac[i].name, name) == 0) return sysfac[i].code; i += 1; } error("Invalid syslog facility: %s", name); exit(1); } shush-1.2.3/src/mmap.c0000644000241700024170000000334610764620172014773 0ustar taranisotaraniso/* ** Copyright (C) 2003, 2004 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #include #include "mmap.h" static char const rcsid[] = "@(#)$Id: mmap.c 1404 2008-03-08 23:25:46Z kalt $"; static struct stat sb; /* ** mapfile ** Given a file name, mmap() the corresponding (regular) file */ int mapfile(char *name, int fd, void **mm, size_t *len) { *mm = NULL; if (fd < 0) { fd = open(name, O_RDONLY, 0); if (fd < 0) { if (errno == ENOENT) return 1; else { error("open(%s) failed: %s", name, ERRSTR); return -1; } } fd *= -1; } if (fstat(abs(fd), &sb) == -1) { /* Can this fail at all? */ error("fstat(%s) failed: %s", name, ERRSTR); return -1; } *len = sb.st_size; if (*len == 0) { if (fd < 0) close(abs(fd)); return 0; } *mm = mmap(NULL, *len, PROT_READ|PROT_WRITE, MAP_PRIVATE #if defined(MAP_FILE) |MAP_FILE #endif #if defined(MAP_COPY) |MAP_COPY #endif , abs(fd), 0); if (*mm == MAP_FAILED) { /* Can this fail at all? */ error("mmap(%s) failed: %s", name, ERRSTR); if (fd < 0) close(abs(fd)); return -1; } if (fd < 0) close(abs(fd)); return 0; } /* ** mapstat ** returns 'struct stat' of the previously mapped file. */ struct stat * mapstat(void) { return &sb; } /* ** unmapfile ** munmap() a previously mapped file */ int unmapfile(char *name, void *mm, size_t len) { assert( mm != NULL ); assert( len > 0 ); if (munmap(mm, len) == -1) { error("munmap(%s) failed: %s", name, ERRSTR); return -1; } else return 0; } shush-1.2.3/src/run.h0000644000241700024170000000057710764620172014655 0ustar taranisotaraniso/* ** Copyright (C) 2003-2006 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: run.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_RUN_H_) # define _RUN_H_ #define RUN_FAST 0x01 #define RUN_TAIL 0x02 #define RUN_VERBOSE 0x04 #define RUN_NODEL 0x08 void run(char *, char *, char *, char *, int, char **); #endif shush-1.2.3/src/Makefile.deps0000644000241700024170000000304110255411641016251 0ustar taranisotaranisoanalyzer.o: analyzer.c os.h config.h error.h analyzer.h byteset.h cf.h \ debug.h mmap.h variable.h Makefile byteset.o: byteset.c os.h config.h error.h byteset.h Makefile cf.o: cf.c os.h config.h error.h cf.h byteset.h gethostname.h ifparser.h \ mmap.h siglist.h units.h Makefile check.o: check.c os.h config.h error.h check.h analyzer.h cf.h debug.h \ exec.h mmap.h variable.h version.h Makefile crontab.o: crontab.c os.h config.h error.h crontab.h cf.h exec.h \ gethostname.h mmap.h version.h Makefile debug.o: debug.c os.h config.h error.h debug.h Makefile error.o: error.c os.h config.h error.h gethostname.h Makefile exec.o: exec.c os.h config.h error.h exec.h Makefile gethostname.o: gethostname.c os.h config.h error.h gethostname.h Makefile ifparser.tab.o: ifparser.tab.c os.h config.h error.h ifparser.h byteset.h \ variable.h Makefile ifparser.lex.o: ifparser.lex.c os.h config.h error.h ifparser.h \ ifparser.tab.h Makefile mmap.o: mmap.c os.h config.h error.h mmap.h Makefile run.o: run.c os.h config.h error.h run.h analyzer.h byteset.h cf.h \ debug.h exec.h gethostname.h ifparser.h mmap.h siglist.h state.h \ units.h variable.h version.h Makefile siglist.o: siglist.c os.h config.h error.h siglist.h signals.h Makefile shush.o: shush.c os.h config.h error.h version.h debug.h check.h \ crontab.h run.h Makefile state.o: state.c os.h config.h error.h state.h cf.h debug.h gethostname.h \ units.h version.h Makefile units.o: units.c os.h config.h error.h units.h Makefile variable.o: variable.c os.h config.h error.h variable.h Makefile shush-1.2.3/src/cf.h0000644000241700024170000000241010764620172014425 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: cf.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_CF_H_) # define _CF_H_ enum { CF_RPTNAME = 0, CF_RPTTO, CF_RPTCC, CF_RPTBCC, CF_RPTSUBJECT, CF_RPTUSER, CF_RPTHOST, CF_RPTMAXSZ, CF_RPTIF, CF_RPTFORMAT, CF_RPTSTDERR, CF_RPTHEADER, CF_RPT_MAX, /* order of the above enums MATTERS */ CF_CMD, CF_CONFIG, CF_LOCK, CF_LOCKFILE, CF_LOCKSUBJECT, CF_PATH, CF_RANDOMDELAY, CF_SCHEDULE, CF_SENDMAIL, CF_SHELL, #if defined(HAVE_PTHREAD) CF_STATEDIR, #endif CF_SYSLOG, CF_TIMEOUT, CF_TIMEOUTSUBJECT, CF_MAX }; #define CF_STDERR_MIXED 1 #define CF_STDERR_FIRST 2 #define CF_STDERR_LAST 3 #define CF_STDERR_OUT 4 #define CF_STDERR_ERR 5 #define CF_FORMAT_TEXT 1 #define CF_FORMAT_RICH 2 #define CF_FORMAT_HTML 3 extern time_t cf_timestamp; extern size_t cf_size; extern char cf_md5[]; char *cf_load(char *, char *); char *cf_nextid(char *); void cf_unload(void); char *cf_getstr(int); long cf_getnum(int); int cf_getrptcnt(void); char *cf_getrptstr(int, int); char *cf_getrptstrlist(int, int); long cf_getrptnum(int, int); #endif shush-1.2.3/src/gethostname.h0000644000241700024170000000042610764620172016360 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: gethostname.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_GETHOSTNAME_H_) # define _GETHOSTNAME_H_ char *get_hostname(int); #endif shush-1.2.3/src/ifparser_test.c0000644000241700024170000000067207667757115016732 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include "ifparser.tab.h" extern int ifparser_result; char *myname; char *tests[] = { }; int main(int argc, char **argv) { myname = basename(argv[0]); ifparser_init("30+2+4+ 99 && a"); printf("= %d (%d)\n", ifparser_result, ifparser_parse()); exit(0); } shush-1.2.3/src/state.h0000644000241700024170000000075410764620172015166 0ustar taranisotaraniso/* ** Copyright (C) 2005 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: state.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_STATE_H_) # define _STATE_H_ void state_init(char *, char *); void state_delay(time_t); void state_run(void); void state_timeout(void); #define STATE_LCKOK 1 #define STATE_LCKIGN 2 #define STATE_LCKFAIL 3 void state_locked(int); void state_killed(void); void state_close(char *msg); #endif shush-1.2.3/src/byteset.c0000644000241700024170000000302410764620172015511 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include "byteset.h" static char const rcsid[] = "@(#)$Id: byteset.c 1404 2008-03-08 23:25:46Z kalt $"; static long set[256]; static int once = 1; /* ** byteset_init ** Initialize set[] from a range definition string */ void byteset_init(char *definition, int value) { char *str, *tok, *dash; int i, j; assert( definition != NULL ); if (once == 1) { once = 0; i = 0; while (i < 256) set[i++] = 0; } str = strdup(definition); tok = strtok(str, ","); while (tok != NULL) { if (tok[0] == '-') i = 0; else if (isdigit((int) tok[0]) != 0) i = atoi(tok); else i = -1; j = i; dash = index(tok, '-'); if (dash != NULL) { if (*(dash + 1) != '\0') { if (isdigit((int) *(dash + 1)) != 0) j = atoi(dash + 1); else j = -1; } else j = 255; } if (i < 0 || i > 255 || j < 0 || j > 255 || j < i) { error("Invalid range: %s", tok); exit(1); } while (i <= j) set[i++] = value; tok = strtok(NULL, ","); } free(str); } /* ** byteset_set ** Sets the value of a byte in the set */ void byteset_set(int byte, int value) { assert( byte >= 0 && byte <= 255 ); set[byte] = value; } /* ** byteset_get ** Return the value of a byte in the set */ int byteset_get(int byte) { assert( byte >= 0 && byte <= 255 ); return set[byte]; } shush-1.2.3/src/byteset.h0000644000241700024170000000050410764620172015516 0ustar taranisotaraniso/* ** Copyright (C) 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: byteset.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_BYTESET_H_) # define _BYTESET_H_ void byteset_init(char *, int); void byteset_set(int, int); int byteset_get(int); #endif shush-1.2.3/src/variable.h0000644000241700024170000000112710764620172015626 0ustar taranisotaraniso/* ** Copyright (C) 2003, 2004 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: variable.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_VARIABLE_H_) # define _VARIABLE_H_ #define V_EXIT "exit" #define V_SIZE "size" #define V_OUTSIZE "outsize" #define V_ERRSIZE "errsize" #define V_LINES "lines" #define V_OUTLINES "outlines" #define V_ERRLINES "errlines" #define V_RUNTIME "runtime" #define V_UTIME "utime" #define V_STIME "stime" #define V_TTY "tty" void variable_set(char *, long); int variable_get(char *, long *); #endif shush-1.2.3/src/units.h0000644000241700024170000000053110764620172015201 0ustar taranisotaraniso/* ** Copyright (C) 2002, 2003 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. ** ** $Id: units.h 1404 2008-03-08 23:25:46Z kalt $ */ #if !defined(_UNITS_H_) # define _UNITS_H_ u_int unit_time(char *); char *unit_rtime(u_int); u_int unit_size(char *); int syslog_facility(char *); #endif shush-1.2.3/src/run.c0000644000241700024170000011010110764620172014631 0ustar taranisotaraniso/* ** Copyright (C) 2003-2008 Christophe Kalt ** ** This file is part of shush, ** see the LICENSE file for details on your rights. */ #include "os.h" #include #include #if defined(HAVE_PATHS_H) # include #else # define _PATH_TMP "/tmp" #endif #if defined(HAVE_PTHREAD_H) # include #endif #include #include #include #include #include #include #include #include #include "run.h" #include "analyzer.h" #include "byteset.h" #include "cf.h" #include "debug.h" #include "exec.h" #include "gethostname.h" #include "ifparser.h" #include "mmap.h" #include "siglist.h" #include "state.h" #include "units.h" #include "variable.h" #include "version.h" static char const rcsid[] = "@(#)$Id: run.c 1404 2008-03-08 23:25:46Z kalt $"; static char *mylock, *job, *id, *jid; static time_t start; static struct passwd *pw; static void remove_lock(void) { if (mylock != NULL) { if (unlink(mylock) != 0) error("Failed to remove lock file (%s): %s", mylock, ERRSTR); free(mylock); mylock = NULL; } } static int copyslog, copyout; static void log(int, char *, ...) #if ( __GNUC__ == 2 && __GNUC_MINOR__ >= 5 ) || __GNUC__ >= 3 __attribute__((__format__(__printf__, 2, 3))) #endif ; static void log(int level, char *format, ...) { va_list va; va_start(va, format); if (copyslog) vsyslog(level, format, va); if (copyout) vfprintf(stdout, format, va); va_end(va); if (copyout) fprintf(stdout, "\n"); } static void sighandler(int sig) { log(LOG_INFO, "%s: Caught SIG%s (%d)", jid, getsignamebynum(sig), sig); } static char * mystrftime(char *format, time_t when) { struct tm *tm; static char timestr[256]; tm = localtime(&when); if (strftime(timestr, 256, format, tm) == 0) timestr[255] = '\0'; return timestr; } static void myputenv(char *var, char *val) { char *tmp; tmp = (char *) malloc(strlen(var) + strlen(val) + 2); if (tmp == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } sprintf(tmp, "%s=%s", var, val); if (putenv(tmp) != 0) { error("putenv(%s) failed: %s", tmp, ERRSTR); exit(1); } } static int mailsubject(FILE *stream, int cf) { char *format; int err = 1; assert( stream != NULL ); assert( cf == CF_TIMEOUTSUBJECT || cf == CF_LOCKSUBJECT || cf < 0 ); if ( cf < 0 ) { /* Report */ format = cf_getrptstr(-cf, CF_RPTSUBJECT); if (format == NULL) return err; if (strchr(format, '%') == NULL) { /* userprefix & hostprefix apply */ err = fprintf(stream, "Subject: %s", (cf_getrptnum(-cf, CF_RPTHOST) != 0 || cf_getrptnum(-cf, CF_RPTUSER) != 0) ? "[" : ""); if (err > 0 && cf_getrptnum(-cf, CF_RPTUSER) != 0) err = fprintf(stream, "%s%s", (pw != NULL && pw->pw_name != NULL) ? pw->pw_name : "?", (cf_getrptnum(-cf, CF_RPTHOST) != 0) ? "@" : ""); if (err > 0 && cf_getrptnum(-cf, CF_RPTHOST) != 0) err = fprintf(stream, "%s", get_hostname(cf_getrptnum(-cf, CF_RPTHOST))); if (err > 0) err = fprintf(stream, "%s%s\n", (cf_getrptnum(-cf, CF_RPTHOST) != 0 || cf_getrptnum(-cf, CF_RPTUSER) != 0) ?"] ":"", format); return err; } } else format = cf_getstr(cf); assert( format != NULL ); err = fprintf(stream, "Subject: "); while (err > 0 && *format != '\0') { if (*format != '%') err = fprintf(stream, "%c", *format); else { format += 1; switch (*format) { case '%': err = fprintf(stream, "%%"); break; case '\0': return err; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': err = fprintf(stream, "%s", get_hostname(*format - 48)); break; case 'h': err = fprintf(stream, "%s", get_hostname(0)); break; case 'i': if (*id != '\0') err = fprintf(stream, "%s", id); break; case 'n': err = fprintf(stream, "%s", job); break; case 'N': err = fprintf(stream, "%s", jid); break; case 'r': if (cf >= 0) break; err = fprintf(stream, "%s", cf_getrptstr(-cf, CF_RPTNAME)); break; case 't': err = fprintf(stream, "%s", unit_rtime((u_int) (time(NULL) - start))); break; case 'u': err = fprintf(stream, "%s", (pw != NULL && pw->pw_name != NULL) ? pw->pw_name : "?"); break; case 'U': err = fprintf(stream, "%u", getuid()); break; case '-': if (*(format+1) != '\0' && isdigit(*(format+1))) { err = fprintf(stream, "%s", get_hostname(48 - *(format+1))); format += 1; break; } /* FALLTHRU */ default: err = fprintf(stream, "%c", *format); break; } } format += 1; } if (err > 0) fprintf(stream, "\n"); return err; } static int tails[6]; #if defined(HAVE_PTHREAD) static void * tail(void *fdarray) { int *fd, nl, ptr, len; char buffer[16384]; time_t stop; fd = (int *) fdarray; ptr = 0; stop = 0; while (stop == 0 || (ptr < fd[2] && time(NULL) < stop)) { len = pread(fd[0], buffer, 16384, ptr); if (len < 0) { error("tail pread() failed: %s", ERRSTR); pthread_exit(NULL); } nl = len; while (nl > 0) { if (buffer[nl - 1] == '\n') break; nl -= 1; } ptr += nl; if (nl >= 0 && write(fd[1], buffer, nl) != nl) { error("tail write(%d) failed: %s", fd[1], ERRSTR); pthread_exit(NULL); } else sleep(1); if (fd[2] >= 0 && stop == 0) stop = time(NULL) + 5; } if (ptr < fd[2]) fprintf(stderr, "%s: Standard %s truncated (%d bytes out of %d).\n", jid, (fd[1] == fileno(stdout)) ? "output":"error", ptr, fd[2]); pthread_exit(NULL); } #endif #define SM_TIMEOUT 1 #define SM_LOCK 2 static void send_notification(int type, char *to, pid_t pid, int ptr) { int mail[2], err, smstatus; FILE *sm; char *smv[4]; pid_t sendmail; assert( type == SM_TIMEOUT || type == SM_LOCK ); /* Create pipe to sendmail */ if (pipe(mail) != 0) { error("pipe() failed for %s notification to %s: %s", (type == SM_TIMEOUT) ? "timeout" : "lock", to, ERRSTR); return; } sm = fdopen(mail[1], "w"); if (sm == NULL) { error("fdopen() failed for %s notification to %s: %s", (type == SM_TIMEOUT) ? "timeout" : "lock", to, ERRSTR); close(mail[0]); close(mail[1]); return; } /* Spawn sendmail process */ smv[0] = cf_getstr(CF_SENDMAIL); smv[1] = "-t"; smv[2] = "-i"; smv[3] = NULL; sendmail = exec(mail[0], 1, 2, 0, smv); if (sendmail < 0) { error("Failed to send %s notification to %s", (type == SM_TIMEOUT) ? "timeout" : "lock", to); fclose(sm); return; } /* Write the mail */ err = fprintf(sm, "To: %s\n", to); if (type == SM_TIMEOUT) { if (err > 0) mailsubject(sm, CF_TIMEOUTSUBJECT); if (err > 0) err = fprintf(sm, "\n\"%s\" has timed out while running on host \"%s\".\nProcess %d has been running for %s.\n\nDefined timeout actions are: %s\nPending timeout actions are: %*s\n", jid, get_hostname(0), pid, unit_rtime((u_int) (time(NULL) - start)), cf_getstr(CF_TIMEOUT), strlen(cf_getstr(CF_TIMEOUT)), cf_getstr(CF_TIMEOUT) + ptr); } else if (type == SM_LOCK) { if (err > 0) mailsubject(sm, CF_LOCKSUBJECT); if (err > 0) err = fprintf(sm, "\n\"%s\" has been trying to obtain its lock for %s while running on host \"%s\" (process id %d).\n\nDefined lock actions are: %s\nPending lock actions are: %*s\n", jid, unit_rtime((u_int) (time(NULL) - start)), get_hostname(0), pid, cf_getstr(CF_LOCK), strlen(cf_getstr(CF_LOCK)), cf_getstr(CF_LOCK) + ptr); } if (err > 0) err = fflush(sm); if (err == -1) error("Error while writing mail for %s notification to \"%s\": %s", (type == SM_TIMEOUT) ? "timeout" : "lock", to, ERRSTR); if (fclose(sm) != 0 && err > 0) error("fclose([sendmail for %s notification]) failed: %s", (type == SM_TIMEOUT) ? "timeout" : "lock", ERRSTR); /* ** This will probably always return 0 and should be left for later ** but this requires more work than i am ready to do right now. ** The main benefit would be to avoid zombie processes. */ err = waitpid(sendmail, &smstatus, WNOHANG); if (err == -1) error("waitpid(%d[sendmail for %s notification]) failed: %s", sendmail, (type == SM_TIMEOUT) ? "timeout" : "lock", ERRSTR); if (err == sendmail) { /* Check termination type */ if (WIFEXITED(smstatus) && WEXITSTATUS(smstatus) != 0) error("sendmail for %s notification returned: %d", (type == SM_TIMEOUT) ? "timeout" : "lock", WEXITSTATUS(smstatus)); if (WIFSIGNALED(smstatus)) error("sendmail for %s notification died: %s", (type == SM_TIMEOUT) ? "timeout" : "lock", strsignal(WTERMSIG(smstatus))); } } void run(char *cfdir, char *myjob, char *myid, char *slfac, int options, char *envp[]) { struct sigaction sa; char fname[PATH_MAX], outlog[PATH_MAX], errlog[PATH_MAX], *outstr, *errstr; char *action, *tmpstr, *last, *loop; char *argv[4]; int outfd, errfd, err, status, rpt; #if defined(HAVE_PTHREAD) pthread_t outthd, errthd; #endif size_t outlen, errlen; time_t delay, end; char *utimestr, *stimestr; pid_t child; struct rusage ru; assert( cfdir != NULL ); assert( myjob != NULL ); assert( myid != NULL ); assert( slfac != NULL ); pw = getpwuid(getuid()); /* Setup syslog logging */ copyout = (options & RUN_VERBOSE) != 0; job = myjob; id = myid; jid = (char *) malloc(strlen(job) + strlen(myid) + 2); if (jid == NULL) { error("malloc() failed: %s", ERRSTR); exit(1); } if (myid[0] != '\0') sprintf(jid, "%s[%s]", job, myid); else strcpy(jid, job); if (slfac[0] != '\0') { openlog(myname, LOG_PID, syslog_facility(slfac)); copyslog = 1; if (ttyname(fileno(stdin)) != NULL) { log(LOG_INFO, "Running \"%s\" as %s [%u] on %s (version %s)", jid, (pw != NULL && pw->pw_name != NULL) ? pw->pw_name : "?", getuid(), ttyname(fileno(stdin)), SHUSH_VERSION); variable_set(V_TTY, 1); } else { log(LOG_INFO, "Running \"%s\" as %s [%u] (version %s)", jid, (pw != NULL && pw->pw_name != NULL) ? pw->pw_name : "?", getuid(), SHUSH_VERSION); variable_set(V_TTY, 0); } } /* Setup SIGPIPE handler */ sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = SIG_IGN; if (sigaction(SIGPIPE, &sa, NULL) != 0) error("sigaction(SIGPIPE, SIG_IGN, NULL) failed: %s", ERRSTR); /* Load the configuration */ snprintf(fname, PATH_MAX, "%s/%s", cfdir, job); cf_load(fname, myid); assert( cf_timestamp != 0 ); log(LOG_INFO, "%s: %s %ld %s", jid, mystrftime("%Y/%m/%d %H:%M:%S", cf_timestamp), cf_size, cf_md5); if ((cf_getstr(CF_SYSLOG) == NULL && strcasecmp(slfac, SYSLOG) != 0) || (cf_getstr(CF_SYSLOG) != NULL && strcasecmp(slfac, cf_getstr(CF_SYSLOG)) != 0)) error("Current and configuration syslog setting mismatch"); snprintf(outlog, PATH_MAX, "%s.stdout", cf_getstr(CF_CONFIG)); snprintf(errlog, PATH_MAX, "%s.stderr", cf_getstr(CF_CONFIG)); if (analyzer_init(outlog, errlog) == -1) exit(1); if (out_timestamp != 0) log(LOG_INFO, "%s: stdout %s %ld %s", jid, mystrftime("%Y/%m/%d %H:%M:%S", out_timestamp), out_size, out_md5); if (err_timestamp != 0) log(LOG_INFO, "%s: stderr %s %ld %s", jid, mystrftime("%Y/%m/%d %H:%M:%S", err_timestamp), err_size, err_md5); /* Successful startup, initialize state recording */ state_init(cfdir, job); /* Randomly delay start */ if (cf_getnum(CF_RANDOMDELAY) > 0) { if ((options & RUN_FAST) == 0) { srandom(getpid()); delay = random() % cf_getnum(CF_RANDOMDELAY); debug(DINFO, "Sleeping %lu (< %lu) seconds before starting...", delay, cf_getnum(CF_RANDOMDELAY)); state_delay(delay); log(LOG_INFO, "%s: Delaying start by %s", jid, unit_rtime(delay)); /* Catch typical user generated signals to allow clean abort */ sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = sighandler; if (sigaction(SIGHUP, &sa, NULL) != 0) error("sigaction(SIGHUP, handler, NULL) failed: %s", ERRSTR); if (sigaction(SIGINT, &sa, NULL) != 0) error("sigaction(SIGINT, handler, NULL) failed: %s", ERRSTR); if (sigaction(SIGQUIT, &sa, NULL) != 0) error("sigaction(SIGQUIT, handler, NULL) failed: %s", ERRSTR); if (sigaction(SIGTERM, &sa, NULL) != 0) error("sigaction(SIGTERM, handler, NULL) failed: %s", ERRSTR); if (sleep(delay) != 0) { debug(DINFO, "Sleep interrupted, aborting."); log(LOG_INFO, "%s: Sleep interrupted, aborting", jid); state_close("Aborted: sleep interrupted"); exit(0); } } else { debug(DINFO, "\"randomdelay\" option disabled by user"); log(LOG_INFO, "%s: \"randomdelay\" option disabled by user", jid); } } /* Catch typical user generated signals so they can be ignored */ sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; sa.sa_handler = sighandler; if (sigaction(SIGHUP, &sa, NULL) != 0) error("sigaction(SIGHUP, SA_RESTART, NULL) failed: %s", ERRSTR); if (sigaction(SIGINT, &sa, NULL) != 0) error("sigaction(SIGINT, SA_RESTART, NULL) failed: %s", ERRSTR); if (sigaction(SIGQUIT, &sa, NULL) != 0) error("sigaction(SIGQUIT, SA_RESTART, NULL) failed: %s", ERRSTR); if (sigaction(SIGTERM, &sa, NULL) != 0) error("sigaction(SIGTERM, SA_RESTART, NULL) failed: %s", ERRSTR); /* Optionally obtain lock */ tmpstr = cf_getstr(CF_LOCK); if (tmpstr != NULL) { int lockfd; tmpstr = strdup(tmpstr); if (tmpstr == NULL) { error("strdup(%s) failed: %s", cf_getstr(CF_LOCK), ERRSTR); exit(1); } action = strtok_r(tmpstr, ",", &last); loop = NULL; if (cf_getstr(CF_LOCKFILE) == NULL) snprintf(fname, PATH_MAX, "%s/.%s-%s", cfdir, jid, get_hostname(0)); else strcpy(fname, cf_getstr(CF_LOCKFILE)); start = time(NULL); end = 0; while ((lockfd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0444)) < 0) { static pid_t lockedby = 0; if (errno != EEXIST) { error("Failed to create lock file (%s): %s", fname, ERRSTR); state_close("Aborted: fatal lock creation failure"); exit(1); } /* Lock already exists, check if it's stale. */ lockfd = open(fname, O_RDONLY, 0); if (lockfd >= 0) { char *locked; size_t lockedlen; if (mapfile(fname, lockfd, (void **) &locked, &lockedlen) != 0) { state_close("Aborted: fatal lock access failure"); exit(1); } if (lockedlen > 0) locked[lockedlen-1] = '\0'; if (lockedlen == 0 || atol(locked) == 0) { static time_t when = 0; if (time(NULL) > when) { log(LOG_WARNING, "%s: lock file %s exists but contains no PID.", jid, fname); when = time(NULL) + 300; } if (lockedlen > 0) if (unmapfile(fname, (void *) locked, lockedlen) != 0) { state_close("Aborted: fatal lock access failure"); exit(1); } close(lockfd); } else { if (lockedby == 0) log(LOG_INFO, "%s: lock is held by process id %ld", jid, (long) atol(locked)); else if (lockedby != atol(locked)) log(LOG_INFO, "%s: lock is now held by process id %ld (was %ld)", jid, (long) atol(locked), (long) lockedby); lockedby = atol(locked); if (unmapfile(fname, (void *) locked, lockedlen) != 0) { state_close("Aborted: fatal lock access failure"); exit(1); } close(lockfd); if (kill(lockedby, 0) == -1) { if (errno == ESRCH) { static time_t when = 0; log(LOG_WARNING, "%s: Breaking apparently stale lock (%s) left by process id %ld", jid, fname, (long) lockedby); if (unlink(fname) == 0) continue; if (time(NULL) > when) { error("Failed to break stale lock (%s): %s", fname, ERRSTR); when = time(NULL) + 300; } } else { error("kill(%ld, 0) failed: %s", (long) lockedby, ERRSTR); state_close("Aborted: fatal lock check failure"); exit(1); } } } } if (time(NULL) > end && action != NULL) { /* Time to take the next action */ if (isdigit((int) action[0])) { end = time(NULL) + unit_time(action); log(LOG_INFO, "%s: Will wait up to %s for lock", jid, action); } else if (strcasecmp(action, "abort") == 0) { log(LOG_INFO, "%s: Giving up.", jid); state_locked(STATE_LCKFAIL); state_close(""); exit(0); } else if (strcasecmp(action, "ignore") == 0) { log(LOG_WARNING, "%s: Ignoring lock!", jid); state_locked(STATE_LCKIGN); break; } else if (strncmp(action, "notify=", 7) == 0) send_notification(SM_LOCK, action + 7, getpid(), action - tmpstr); else if (strcmp(action, "loop") == 0) loop = last; else error("Invalid \"lock\" action: %s", action); action = strtok_r(NULL, ",", &last); if (action == NULL) { if (loop == NULL) log(LOG_INFO, "%s: Will keeping waiting for lock", jid); else { strcpy(tmpstr, cf_getstr(CF_LOCK)); last = loop; action = strtok_r(NULL, ",", &last); } } } else sleep(1); } if (lockfd >= 0) { char mypid[16]; state_locked(STATE_LCKOK); sprintf(mypid, "%ld\n", (long) getpid()); if (write(lockfd, mypid, strlen(mypid) + 1) != strlen(mypid) + 1) { error("Failed to write process id in new lock file (%s): %s", fname, ERRSTR); } else log(LOG_INFO, "%s: Created lock file (%s) after %s", jid, fname, unit_rtime(time(NULL) - start)); close(lockfd); mylock = strdup(fname); if (mylock == NULL) { error("strdup(%s) failed: %s", fname, ERRSTR); if (unlink(fname) != 0) error("Failed to remove lock file: %s", ERRSTR); exit(1); } atexit(remove_lock); } } free(tmpstr); /* Setup temporary files */ snprintf(outlog, PATH_MAX, "%s/%s-%s.stdout.XXXXXX", (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, myname, job); outfd = mkstemp(outlog); if (outfd < 0) { error("Failed to create temporary file: %s", ERRSTR); state_close("Aborted: temporary file failure"); exit(1); } #if defined(HAVE_PTHREAD) else if ((options & RUN_TAIL) != 0) { tails[0] = outfd; tails[1] = fileno(stdout); tails[2] = -1; status = pthread_create(&outthd, NULL, tail, (void *) &tails[0]); if (status != 0) error("Failed to create thread to tail standard output: %s", strerror(status)); } #endif if (cf_getrptnum(0, CF_RPTSTDERR) != CF_STDERR_MIXED) { snprintf(errlog, PATH_MAX, "%s/%s-%s.stderr.XXXXXX", (getenv("TMPDIR") != NULL) ? getenv("TMPDIR") : _PATH_TMP, myname, job); errfd = mkstemp(errlog); if (errfd < 0) { error("Failed to create temporary file: %s", ERRSTR); state_close("Aborted: temporary file failure"); exit(1); } #if defined(HAVE_PTHREAD) else if ((options & RUN_TAIL) != 0) { tails[3] = errfd; tails[4] = fileno(stderr); tails[5] = -1; status = pthread_create(&errthd, NULL, tail, (void *) &tails[3]); if (status != 0) error("Failed to create thread to tail standard error: %s", strerror(status)); } #endif } else errfd = outfd; /* Setup environment */ if (cf_getstr(CF_PATH) != NULL) myputenv("PATH", cf_getstr(CF_PATH)); myputenv("SHUSH_NAME", job); myputenv("SHUSH_ID", myid); /* Initialize timeout */ start = time(NULL); tmpstr = cf_getstr(CF_TIMEOUT); last = NULL; loop = NULL; if (tmpstr != NULL) { tmpstr = strdup(tmpstr); if (tmpstr == NULL) { error("strdup(%s) failed: %s", cf_getstr(CF_TIMEOUT), ERRSTR); exit(1); } debug(DINFO, "Initialized timeout: %s", tmpstr); action = strtok_r(tmpstr, ",", &last); end = start + unit_time(action); } else end = 0; /* Spawn child process */ argv[0] = cf_getstr(CF_SHELL); argv[1] = "-c"; argv[2] = cf_getstr(CF_CMD); argv[3] = NULL; child = exec(-1, outfd, errfd, 1, argv); if (child < 0) { state_close("Aborted: spawn failed"); exit(1); } debug(DINFO, "Spawned child process (pid %d), waiting..", child); state_run(); /* Wait for child to complete or timeout */ while (1) { err = wait4(child, &status, WNOHANG, &ru); if (err == child && (WIFEXITED(status) || WIFSIGNALED(status))) break; if (err == -1) { if (errno == EINTR) debug(DINFO, "wait4(%d): %s", child, ERRSTR); else { error("wait4(%d) failed: %s", child, ERRSTR); state_close("Aborted: fatal wait4() failure"); exit(1); } } if (end != 0 && time(NULL) > end) { state_timeout(); /* Timeout reached, what now? */ debug(DINFO, "Timeout expired, job has been running for %s", unit_rtime(time(NULL) - start)); action = strtok_r(NULL, ",", &last); if (action == NULL && loop == NULL) end = 0; else { if (action == NULL) { strcpy(tmpstr, cf_getstr(CF_TIMEOUT)); last = loop; action = strtok_r(NULL, ",", &last); } if (isdigit((int) action[0])) { end = time(NULL) + unit_time(action); debug(DINFO, "Armed new timeout: %s", action); } else if (action[0] == '-' && isdigit((int) action[1])) { debug(DINFO, "Sending signal %d to child process group", atoi(action+1)); state_killed(); if (kill(child * -1, atoi(action+1)) == 0) log(LOG_INFO, "%s: Sent signal %d to child process group", jid, atoi(action+1)); else log(LOG_WARNING, "%s: Failed to send signal %d to child process group: %s", jid, atoi(action+1), ERRSTR); } else if (strncmp(action, "SIG", 3) == 0) { debug(DINFO, "Sending signal %s to child process group", action); state_killed(); if (kill(child * -1, getsignumbyname(action + 3)) == 0) log(LOG_INFO, "%s: Sent signal %s to child process group", jid, action); else log(LOG_WARNING, "%s: Failed to send signal %s to child process group: %s", jid, action, ERRSTR); } else if (action[0] == '=' && isdigit((int) action[1])) { debug(DINFO, "Sending signal %d to child", atoi(action+1)); state_killed(); if (kill(child, atoi(action+1)) == 0) log(LOG_INFO, "%s: Sent signal %d to child", jid, atoi(action+1)); else log(LOG_WARNING, "%s: Failed to send signal %d to child: %s", jid, atoi(action+1), ERRSTR); } else if (strncmp(action, "=SIG", 4) == 0) { debug(DINFO, "Sending signal %s to child", action); state_killed(); if (kill(child, getsignumbyname(action + 4)) == 0) log(LOG_INFO, "%s: Sent signal %s to child", jid, action); else log(LOG_WARNING, "%s: Failed to send signal %s to child: %s", jid, action, ERRSTR); } else if (strncmp(action, "notify=", 7) == 0) { debug(DINFO, "Sending timeout notification to %s", action + 7); log(LOG_INFO, "%s: Sending timeout notification to %s", jid, action + 7); send_notification(SM_TIMEOUT, action + 7, child, action - tmpstr); } else if (strcmp(action, "loop") == 0) loop = last; else error("Invalid \"timeout\" action: %s", action); } } else sleep(1); } end = time(NULL); state_close(NULL); free(tmpstr); /* Child is done */ remove_lock(); utimestr = strdup(unit_rtime(ru.ru_utime.tv_sec)); if (utimestr == NULL) { error("strdup(%s) failed: %s", unit_rtime(ru.ru_utime.tv_sec), ERRSTR); utimestr = "??"; } stimestr = strdup(unit_rtime(ru.ru_stime.tv_sec)); if (stimestr == NULL) { error("strdup(%s) failed: %s", unit_rtime(ru.ru_stime.tv_sec), ERRSTR); stimestr = "??"; } /* Check termination type */ if (WIFEXITED(status)) { debug(DINFO, "Normal termination, returned %d", WEXITSTATUS(status)); log(LOG_INFO, "%s: Command returned %d after %s (%s user, %s sys)", jid, WEXITSTATUS(status), unit_rtime(end - start), utimestr, stimestr); variable_set(V_EXIT, WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { debug(DINFO, "Child died from a signal: %s", strsignal(WTERMSIG(status))); log(LOG_WARNING, "%s: Command died form a signal (%s) after %s (%s user, %s sys)", jid, strsignal(WTERMSIG(status)), unit_rtime(end - start), utimestr, stimestr); variable_set(V_EXIT, -1 * WTERMSIG(status)); } else abort(); /* Map outputs to memory */ if (mapfile(outlog, outfd, (void **)&outstr, &outlen) != 0) exit(1); if (errfd == outfd) { errstr = NULL; errlen = 0; } else if (mapfile(errlog, errfd, (void **)&errstr, &errlen) != 0) exit(1); /* Put an end to any active tail thread */ tails[2] = outlen; tails[5] = errlen; /* Set a few variables */ variable_set(V_SIZE, outlen + errlen); variable_set(V_OUTSIZE, outlen); variable_set(V_ERRSIZE, errlen); variable_set(V_RUNTIME, end - start); variable_set(V_UTIME, ru.ru_utime.tv_sec); variable_set(V_STIME, ru.ru_stime.tv_sec); /* Analyze outputs */ if (analyzer_run(outstr, outlen, errstr, errlen) != 0) exit(1); else { long outlines, errlines; if (variable_get(V_OUTLINES, &outlines) != 0) abort(); if (variable_get(V_ERRLINES, &errlines) != 0) abort(); log(LOG_INFO, "%s: Command produced %ld lines (%ld Bytes) on stdout and %ld lines (%ld Bytes) on stderr", jid, outlines, outlen, errlines, errlen); } debug(DINFO, "Done with analysis."); /* Produce reports */ rpt = 0; while (rpt+1 < cf_getrptcnt()) { int mail[2], smstatus, env; FILE *sm; char *header; rpt += 1; /* Check whether report should be sent */ if (cf_getrptstr(rpt, CF_RPTIF) != NULL) { ifparser_init(cf_getrptstr(rpt, CF_RPTIF)); err = ifparser_parse(); if (err != 0) error("%s while evaluating \"%s\" for report \"%s\"", ifparser_errmsg, cf_getrptstr(rpt, CF_RPTIF), cf_getrptstr(rpt, CF_RPTNAME)); if (err == 0 && !ifparser_result) { debug(DINFO, "Skipping report \"%s\"", cf_getrptstr(rpt, CF_RPTNAME)); continue; } } log(LOG_INFO, "%s: Sending \"%s\" report", jid, cf_getrptstr(rpt, CF_RPTNAME)); debug(DINFO, "Generating \"%s\" report...", cf_getrptstr(rpt, CF_RPTNAME)); /* Create pipe to sendmail */ if (pipe(mail) != 0) { error("pipe() failed for report \"%s\": %s", cf_getrptstr(rpt, CF_RPTNAME), ERRSTR); continue; } sm = fdopen(mail[1], "w"); if (sm == NULL) { error("fdopen() failed for report \"%s\": %s", cf_getrptstr(rpt, CF_RPTNAME), ERRSTR); close(mail[0]); close(mail[1]); continue; } /* Spawn sendmail process */ argv[0] = cf_getstr(CF_SENDMAIL); argv[1] = "-t"; argv[2] = "-i"; argv[3] = NULL; child = exec(mail[0], 1, 2, 0, argv); if (child < 0) { error("Failed to send report \"%s\"", cf_getrptstr(rpt, CF_RPTNAME)); fclose(sm); continue; } /* Fill in headers */ err = 1; if (cf_getrptstr(rpt, CF_RPTTO) != NULL) { err = fprintf(sm, "To: %s\n", cf_getrptstr(rpt, CF_RPTTO)); debug(DINFO, "-> To: %s", cf_getrptstr(rpt, CF_RPTTO)); } if (err > 0 && cf_getrptstr(rpt, CF_RPTCC) != NULL) { err = fprintf(sm, "Cc: %s\n", cf_getrptstr(rpt, CF_RPTCC)); debug(DINFO, "-> Cc: %s", cf_getrptstr(rpt, CF_RPTCC)); } if (err > 0 && cf_getrptstr(rpt, CF_RPTBCC) != NULL) { err = fprintf(sm, "Bcc: %s\n", cf_getrptstr(rpt, CF_RPTBCC)); debug(DINFO, "-> Bcc: %s", cf_getrptstr(rpt, CF_RPTBCC)); } if (err > 0 && cf_getrptstr(rpt, CF_RPTSUBJECT) != NULL) { err = mailsubject(sm, -rpt); debug(DINFO, "-> Subject: %s", cf_getrptstr(rpt, CF_RPTSUBJECT)); } if (err > 0) err = fprintf(sm, "X-Shush-Version: %s\n", SHUSH_VERSION); env = 0; while (err > 0 && envp[env] != NULL) err = fprintf(sm, "X-Shush-Env: <%s>\n", envp[env++]); if (err > 0) err = fprintf(sm, "X-Shush-Host-Name: %s\n", get_hostname(0)); if (err > 0) err = fprintf(sm, "X-Shush-Name: %s %s %ld %s\n", jid, mystrftime("%Y/%m/%d %H:%M:%S", cf_timestamp), cf_size, cf_md5); if (err > 0 && out_timestamp != 0) err = fprintf(sm, "X-Shush-Stdout: %s %ld %s\n", mystrftime("%Y/%m/%d %H:%M:%S", out_timestamp), out_size, out_md5); if (err > 0 && err_timestamp != 0) err = fprintf(sm, "X-Shush-Stderr: %s %ld %s\n", mystrftime("%Y/%m/%d %H:%M:%S", err_timestamp), err_size, err_md5); if (err > 0) err = fprintf(sm, "X-Shush-User: %s [%u]\n", (pw != NULL && pw->pw_name != NULL) ? pw->pw_name:"?", getuid()); if (err > 0) err = fprintf(sm, "X-Shush-Report-Name: %s\n", cf_getrptstr(rpt, CF_RPTNAME)); if (err > 0) err = fprintf(sm, "X-Shush-Command: %s\n", cf_getstr(CF_CMD)); if (err> 0) { if (WIFEXITED(status)) err = fprintf(sm, "X-Shush-Exit-Status: %d\n", WEXITSTATUS(status)); else { assert( WIFSIGNALED(status) ); err = fprintf(sm, "X-Shush-Exit-Status: %s\n", strsignal(WTERMSIG(status))); } } if (err > 0) { long lines; if (variable_get(V_OUTLINES, &lines) != 0) abort(); err = fprintf(sm, "X-Shush-Stdout-Size: %ld lines, %ld Bytes\n", lines, outlen); } if (err > 0) { long lines; if (variable_get(V_ERRLINES, &lines) != 0) abort(); err = fprintf(sm, "X-Shush-Stderr-Size: %ld lines, %ld Bytes\n", lines, errlen); } if (err > 0) err = fprintf(sm, "X-Shush-Rusage: %s (%s user, %s sys)\n", unit_rtime(end - start), utimestr, stimestr); cf_getrptstrlist(-1, CF_RPTHEADER); while (err > 0 && (header = cf_getrptstrlist(rpt, CF_RPTHEADER)) != NULL) err = fprintf(sm, "%s\n", header); if (err > 0 && cf_getrptnum(rpt, CF_RPTFORMAT) == CF_FORMAT_RICH) err = fprintf(sm, "Content-Type: text/enriched\n"); if (err > 0 && cf_getrptnum(rpt, CF_RPTFORMAT) == CF_FORMAT_HTML) err = fprintf(sm, "Content-Type: text/html\n"); if (err > 0) err = fprintf(sm, "\n"); if (err <= 0) { error("Error while writing mail headers for report \"%s\": %s", cf_getrptstr(rpt, CF_RPTNAME), ERRSTR); err = -1; } else if (analyzer_output(sm, cf_getrptnum(rpt, CF_RPTFORMAT), cf_getrptnum(rpt, CF_RPTSTDERR), cf_getrptnum(rpt, CF_RPTMAXSZ), outstr, outlen, errstr, errlen) != 0) error("Errors while sending output for report \"%s\".", cf_getrptstr(rpt, CF_RPTNAME)); if (fclose(sm) != 0 && err == 0) error("Errors while sending report \"%s\": %s", cf_getrptstr(rpt, CF_RPTNAME), ERRSTR); /* Wait for sendmail child to complete */ while (1) { err = waitpid(child, &smstatus, 0); if (err == child && (WIFEXITED(smstatus) || WIFSIGNALED(smstatus))) break; if (err == -1) { if (errno == EINTR) debug(DINFO, "waitpid(%d): %s", child, ERRSTR); else error("waitpid(%d[sendmail for report \"%s\"]) failed: %s", child, cf_getrptstr(rpt, CF_RPTNAME), ERRSTR); } sleep(1); } /* Child is done */ /* Check termination type */ if (WIFEXITED(smstatus) && WEXITSTATUS(smstatus) != 0) error("sendmail for report \"%s\" returned: %d", cf_getrptstr(rpt, CF_RPTNAME), WEXITSTATUS(smstatus)); if (WIFSIGNALED(smstatus)) error("sendmail for report \"%s\" died from %s", cf_getrptstr(rpt, CF_RPTNAME), strsignal(WTERMSIG(smstatus))); } if ((options & RUN_NODEL) == 0) { if (unlink(outlog) != 0) error("Failed to remove \"%s\": %s", outlog, ERRSTR); if (cf_getrptnum(0, CF_RPTSTDERR) != CF_STDERR_MIXED && unlink(errlog) != 0) error("Failed to remove \"%s\": %s", errlog, ERRSTR); } else { log(LOG_INFO, "Standard output file: %s", outlog); log(LOG_INFO, "Standard error file: %s", errlog); } #if defined(HAVE_PTHREAD) if ((options & RUN_TAIL) != 0) { err = pthread_join(outthd, NULL); if (err != 0 && err != ESRCH) error("pthread_join() failed unexpectedly: %s", strerror(err)); err = pthread_join(errthd, NULL); if (err != 0 && err != ESRCH) error("pthread_join() failed unexpectedly: %s", strerror(err)); } #endif log(LOG_INFO, "%s: Done.", jid); } shush-1.2.3/src/signals.awk0000644000241700024170000000157210764620172016040 0ustar taranisotaranisoBEGIN { print "/*"; print "** Copyright (C) 2003 Christophe Kalt"; print "**"; print "** This file is part of shush,"; print "** see the LICENSE file for details on your rights."; print "**"; print "** This file was automatically generated by siglist.awk using awk."; print "**"; print "** $Id: signals.awk 1404 2008-03-08 23:25:46Z kalt $"; print "*/"; print ""; print "struct signame {"; print " char *name;"; print " int num;"; print "};"; print ""; print "struct signame signame[] = {"; max = 0; } /^#define[ \t][ \t]*SIG[A-Z1-9][A-Z1-9]*[ \t][ \t]*[0-9][0-9]*/ { if ($3 > max) max = $3; siglist[$3] = sprintf("{ \"%s\",\t%2d },", substr($2, 4), $3); } END { for (i = 1; i <= max; i++) if (siglist[i] != "") printf(" %s\n", siglist[i]); print " { NULL,\t 0 }"; print "};"; } shush-1.2.3/acx_pthread.m40000644000241700024170000002536610523515446015640 0ustar taranisotaraniso##### http://autoconf-archive.cryp.to/acx_pthread.html # # SYNOPSIS # # ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. # It sets the PTHREAD_LIBS output variable to the threads library and # linker flags, and the PTHREAD_CFLAGS output variable to any special # C compiler flags that are needed. (The user can also force certain # compiler flags/libs to be tested by setting these environment # variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). # (This is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these # flags, but also link it with them as well. e.g. you should link # with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS # $LIBS # # If you are only building threads programs, you may wish to use # these variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute # constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # ACTION-IF-FOUND is a list of shell commands to run if a threads # library is found, and ACTION-IF-NOT-FOUND is a list of commands to # run it if it is not found. If ACTION-IF-FOUND is not specified, the # default action will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or # if you have any other suggestions or comments. This macro was based # on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) # (with help from M. Frigo), as well as ac_pthread and hb_pthread # macros posted by Alejandro Forero Cuervo to the autoconf macro # repository. We are also grateful for the helpful feedback of # numerous users. # # LAST MODIFICATION # # 2006-05-29 # # COPYLEFT # # Copyright (c) 2006 Steven G. Johnson # # 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # # As a special exception, the respective Autoconf Macro's copyright # owner gives unlimited permission to copy, distribute and modify the # configure scripts that are the output of Autoconf when processing # the Macro. You need not follow the terms of the GNU General Public # License when using or distributing such scripts, even though # portions of the text of the Macro appear in them. The GNU General # Public License (GPL) does govern all other use of the material that # constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the # Autoconf Macro released by the Autoconf Macro Archive. When you # make and distribute a modified version of the Autoconf Macro, you # may extend this special exception to the GPL to apply to your # modified version as well. AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_TRY_LINK([#include ], [int attr=$attr; return attr;], [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD shush-1.2.3/configure.ac0000644000241700024170000000573710764620172015402 0ustar taranisotaraniso# # $Id: configure.ac 1404 2008-03-08 23:25:46Z kalt $ # AC_PREREQ(2.59) AC_INIT([Shush], [], [shush-bugs@taranis.org], [shush]) AC_REVISION([$Id: configure.ac 1404 2008-03-08 23:25:46Z kalt $]) AC_CONFIG_SRCDIR([src/os.h]) AC_CONFIG_HEADER([src/config.h]) # Checks for programs. AC_PROG_CC test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -fno-builtin-log" AC_PROG_INSTALL AC_PATH_PROG([SENDMAIL], [sendmail], [NOSENDMAIL], [/usr/lib:/usr/sbin:$PATH]) AC_DEFINE_UNQUOTED([SENDMAIL], ["$SENDMAIL"], [Path to sendmail program]) AC_PATH_PROG([CRONTAB], [crontab], [NOCRONTAB]) AC_DEFINE_UNQUOTED([CRONTAB], ["$CRONTAB"], [Path to crontab program]) # Pthreads, please.. sinclude(acx_pthread.m4) ACX_PTHREAD([AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC"]) # Custom arguments AC_ARG_WITH([pcre], AC_HELP_STRING([--with-pcre=DIR], [Support Perl Compatible Regular Expressions (default)])) AC_ARG_WITH([pcre], AC_HELP_STRING([--without-pcre], [Do not support Perl Compatible Regular Expressions])) if test "x$with_pcre" != "xno"; then if test "x$with_pcre" != "xyes" -a "x$with_pcre" != "x"; then if test ! -d "$with_pcre"; then AC_MSG_ERROR([Invalid path for pcre: $with_pcre]) fi CPPFLAGS="$CPPFLAGS -I$with_pcre/include" LDFLAGS="$LDFLAGS -L$with_pcre/lib" fi fi AC_ARG_WITH([syslog], AC_HELP_STRING([--with-syslog=FACILITY], [Define the default syslog facility used])) AC_ARG_WITH([syslog], AC_HELP_STRING([--without-syslog], [Disable default use of syslog])) if test "x$with_syslog" != "xno"; then if test "x$with_syslog" != "xyes" -a "x$with_syslog" != "x"; then AC_DEFINE_UNQUOTED([SYSLOG], "$with_syslog", [Define to a syslog facility to enable logging via syslog by default]) else AC_DEFINE([SYSLOG], "cron") fi else AC_DEFINE([SYSLOG], "") fi AC_ARG_WITH([sizelimit], AC_HELP_STRING([--with-sizelimit=SIZE], [Define the default output size limit for reports])) if test "x$with_sizelimit" = "xyes"; then AC_MSG_ERROR([A size limit MUST be specified to set default!]) elif test "x$with_sizelimit" != "xno" -a "x$with_sizelimit" != "x"; then AC_DEFINE_UNQUOTED([MAXSZ], "$with_sizelimit", [Default MAXSZ value]) else AC_DEFINE([MAXSZ], "1000k") fi # Checks for libraries. AC_SEARCH_LIBS([basename], [gen]) if test "x$with_pcre" != "xno"; then AC_SEARCH_LIBS([pcre_compile], [pcre], , AC_MSG_WARN([Perl Compatible Regular Expressions library is missing.]) with_pcre="no") fi AC_SEARCH_LIBS([MD5Data], [md]) AC_SEARCH_LIBS([md5_calc], [md5]) # Checks for header files. AC_CHECK_HEADERS([md5.h paths.h pthread.h]) if test "x$with_pcre" != "xno"; then AC_CHECK_HEADERS([pcre.h]) fi # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_CHECK_DECLS([sys_signame], , , [#include ]) # Checks for library functions. AC_CHECK_FUNCS([strlcpy MD5Data md5_calc]) AC_CONFIG_FILES([src/Makefile Makefile]) AC_OUTPUT shush-1.2.3/install-sh0000755000241700024170000001267107664503555015125 0ustar taranisotaraniso#!/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 : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog 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 : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : 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 : 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 : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; 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 : 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 :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 shush-1.2.3/config.sub0000755000241700024170000007467010102315606015066 0ustar taranisotaraniso#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-03-12' # 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 02111-1307, 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 . Submit a context # diff and a properly formatted ChangeLog entry. # # 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* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) 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] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | 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]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | msp430-* \ | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | 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 ;; abacus) basic_machine=abacus-unknown ;; 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 ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; 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 ;; c90) basic_machine=c90-cray os=-unicos ;; 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 | j90) basic_machine=j90-cray os=-unicos ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; 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 ;; 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 ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; 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 ;; nv1) basic_machine=nv1-cray os=-unicosmp ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; 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 | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`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 ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-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=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; 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 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; 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 ;; 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 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | 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 ;; *-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* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -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* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|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-dietlibc) os=-linux-dietlibc ;; -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 ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -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 ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -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 ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. 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 ;; or32-*) os=-coff ;; *-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 ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) 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: shush-1.2.3/configure0000755000241700024170000052252310523515446015020 0ustar taranisotaraniso#! /bin/sh # From configure.ac Id: configure.ac,v 1.13 2006/03/06 02:25:47 kalt Exp . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 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 Bourne compatible 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+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH 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 fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; 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'` # PATH needs CR, and LINENO needs CR and PATH. # 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 as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; 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_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') 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=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # 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 before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, 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 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi 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$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # 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` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Shush" ac_unique_file="src/os.h" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" 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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SENDMAIL CRONTAB build build_cpu build_vendor build_os host host_cpu host_vendor host_os acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS CPP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # 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. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= 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 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -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 | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$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" ;; -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'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac 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 ;; -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 ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) 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 ;; -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'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac 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; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` 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 paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac 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 # 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 its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $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 if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # 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 \`..'] _ACEOF cat <<_ACEOF 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] --datadir=DIR read-only architecture-independent data [PREFIX/share] --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] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF 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 Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pcre=DIR Support Perl Compatible Regular Expressions (default) --without-pcre Do not support Perl Compatible Regular Expressions --with-syslog=FACILITY Define the default syslog facility used --without-syslog Disable default use of syslog --with-sizelimit=SIZE Define the default output size limit for reports Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style 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 elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 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 0 fi exec 5>config.log cat >&5 <<_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.59. Invocation command line was $ $0 $@ _ACEOF { 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` hostinfo = `(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 } >&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_sep= 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_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; 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: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. 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, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf 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 -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >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 -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; 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 `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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 ac_config_headers="$ac_config_headers src/config.h" # Checks for programs. 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 if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl 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_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext 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 test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -fno-builtin-log" 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 ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # 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 $as_executable_p "$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 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. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. 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' # Extract the first word of "sendmail", so it can be a program name with args. set dummy sendmail; 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_SENDMAIL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SENDMAIL in [\\/]* | ?:[\\/]*) ac_cv_path_SENDMAIL="$SENDMAIL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_dummy="/usr/lib:/usr/sbin:$PATH" for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_SENDMAIL="$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 test -z "$ac_cv_path_SENDMAIL" && ac_cv_path_SENDMAIL="NOSENDMAIL" ;; esac fi SENDMAIL=$ac_cv_path_SENDMAIL if test -n "$SENDMAIL"; then echo "$as_me:$LINENO: result: $SENDMAIL" >&5 echo "${ECHO_T}$SENDMAIL" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi cat >>confdefs.h <<_ACEOF #define SENDMAIL "$SENDMAIL" _ACEOF # Extract the first word of "crontab", so it can be a program name with args. set dummy crontab; 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_CRONTAB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CRONTAB in [\\/]* | ?:[\\/]*) ac_cv_path_CRONTAB="$CRONTAB" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_CRONTAB="$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 test -z "$ac_cv_path_CRONTAB" && ac_cv_path_CRONTAB="NOCRONTAB" ;; esac fi CRONTAB=$ac_cv_path_CRONTAB if test -n "$CRONTAB"; then echo "$as_me:$LINENO: result: $CRONTAB" >&5 echo "${ECHO_T}$CRONTAB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi cat >>confdefs.h <<_ACEOF #define CRONTAB "$CRONTAB" _ACEOF # Pthreads, please.. ##### http://autoconf-archive.cryp.to/acx_pthread.html # # SYNOPSIS # # ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) # # DESCRIPTION # # This macro figures out how to build C programs using POSIX threads. # It sets the PTHREAD_LIBS output variable to the threads library and # linker flags, and the PTHREAD_CFLAGS output variable to any special # C compiler flags that are needed. (The user can also force certain # compiler flags/libs to be tested by setting these environment # variables.) # # Also sets PTHREAD_CC to any special C compiler that is needed for # multi-threaded programs (defaults to the value of CC otherwise). # (This is necessary on AIX to use the special cc_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these # flags, but also link it with them as well. e.g. you should link # with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS # $LIBS # # If you are only building threads programs, you may wish to use # these variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute # constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to # that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # ACTION-IF-FOUND is a list of shell commands to run if a threads # library is found, and ACTION-IF-NOT-FOUND is a list of commands to # run it if it is not found. If ACTION-IF-FOUND is not specified, the # default action will define HAVE_PTHREAD. # # Please let the authors know if this macro fails on any platform, or # if you have any other suggestions or comments. This macro was based # on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) # (with help from M. Frigo), as well as ac_pthread and hb_pthread # macros posted by Alejandro Forero Cuervo to the autoconf macro # repository. We are also grateful for the helpful feedback of # numerous users. # # LAST MODIFICATION # # 2006-05-29 # # COPYLEFT # # Copyright (c) 2006 Steven G. Johnson # # 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., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # # As a special exception, the respective Autoconf Macro's copyright # owner gives unlimited permission to copy, distribute and modify the # configure scripts that are the output of Autoconf when processing # the Macro. You need not follow the terms of the GNU General Public # License when using or distributing such scripts, even though # portions of the text of the Macro appear in them. The GNU General # Public License (GPL) does govern all other use of the material that # constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the # Autoconf Macro released by the Autoconf Macro Archive. When you # make and distribute a modified version of the Autoconf Macro, you # may extend this special exception to the GPL to apply to your # modified version as well. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_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_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { 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=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_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 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 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 ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 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 acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pthread_join (); int main () { pthread_join (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then acx_pthread_ok=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 echo "${ECHO_T}$acx_pthread_ok" >&6 if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5 echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6 ;; -*) echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5 echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6 PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; 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_acx_pthread_config+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$acx_pthread_config"; then ac_cv_prog_acx_pthread_config="$acx_pthread_config" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_acx_pthread_config="yes" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no" fi fi acx_pthread_config=$ac_cv_prog_acx_pthread_config if test -n "$acx_pthread_config"; then echo "$as_me:$LINENO: result: $acx_pthread_config" >&5 echo "${ECHO_T}$acx_pthread_config" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5 echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6 PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then acx_pthread_ok=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5 echo "${ECHO_T}$acx_pthread_ok" >&6 if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5 echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6 attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { int attr=$attr; return attr; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then attr_name=$attr; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done echo "$as_me:$LINENO: result: $attr_name" >&5 echo "${ECHO_T}$attr_name" >&6 if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5 echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6 flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac echo "$as_me:$LINENO: result: ${flag}" >&5 echo "${ECHO_T}${flag}" >&6 if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then for ac_prog in xlc_r cc_r 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_PTHREAD_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5 echo "${ECHO_T}$PTHREAD_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}" else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then cat >>confdefs.h <<\_ACEOF #define HAVE_PTHREAD 1 _ACEOF LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" : else acx_pthread_ok=no 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 # Custom arguments # Check whether --with-pcre or --without-pcre was given. if test "${with_pcre+set}" = set; then withval="$with_pcre" fi; # Check whether --with-pcre or --without-pcre was given. if test "${with_pcre+set}" = set; then withval="$with_pcre" fi; if test "x$with_pcre" != "xno"; then if test "x$with_pcre" != "xyes" -a "x$with_pcre" != "x"; then if test ! -d "$with_pcre"; then { { echo "$as_me:$LINENO: error: Invalid path for pcre: $with_pcre" >&5 echo "$as_me: error: Invalid path for pcre: $with_pcre" >&2;} { (exit 1); exit 1; }; } fi CPPFLAGS="$CPPFLAGS -I$with_pcre/include" LDFLAGS="$LDFLAGS -L$with_pcre/lib" fi fi # Check whether --with-syslog or --without-syslog was given. if test "${with_syslog+set}" = set; then withval="$with_syslog" fi; # Check whether --with-syslog or --without-syslog was given. if test "${with_syslog+set}" = set; then withval="$with_syslog" fi; if test "x$with_syslog" != "xno"; then if test "x$with_syslog" != "xyes" -a "x$with_syslog" != "x"; then cat >>confdefs.h <<_ACEOF #define SYSLOG "$with_syslog" _ACEOF else cat >>confdefs.h <<\_ACEOF #define SYSLOG "cron" _ACEOF fi else cat >>confdefs.h <<\_ACEOF #define SYSLOG "" _ACEOF fi # Check whether --with-sizelimit or --without-sizelimit was given. if test "${with_sizelimit+set}" = set; then withval="$with_sizelimit" fi; if test "x$with_sizelimit" = "xyes"; then { { echo "$as_me:$LINENO: error: A size limit MUST be specified to set default!" >&5 echo "$as_me: error: A size limit MUST be specified to set default!" >&2;} { (exit 1); exit 1; }; } elif test "x$with_sizelimit" != "xno" -a "x$with_sizelimit" != "x"; then cat >>confdefs.h <<_ACEOF #define MAXSZ "$with_sizelimit" _ACEOF else cat >>confdefs.h <<\_ACEOF #define MAXSZ "1000k" _ACEOF fi # Checks for libraries. echo "$as_me:$LINENO: checking for library containing basename" >&5 echo $ECHO_N "checking for library containing basename... $ECHO_C" >&6 if test "${ac_cv_search_basename+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_basename=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char basename (); int main () { basename (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_basename="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_basename" = no; then for ac_lib in gen; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char basename (); int main () { basename (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_basename="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_basename" >&5 echo "${ECHO_T}$ac_cv_search_basename" >&6 if test "$ac_cv_search_basename" != no; then test "$ac_cv_search_basename" = "none required" || LIBS="$ac_cv_search_basename $LIBS" fi if test "x$with_pcre" != "xno"; then echo "$as_me:$LINENO: checking for library containing pcre_compile" >&5 echo $ECHO_N "checking for library containing pcre_compile... $ECHO_C" >&6 if test "${ac_cv_search_pcre_compile+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_pcre_compile=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pcre_compile (); int main () { pcre_compile (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_pcre_compile="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_pcre_compile" = no; then for ac_lib in pcre; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char pcre_compile (); int main () { pcre_compile (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_pcre_compile="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_pcre_compile" >&5 echo "${ECHO_T}$ac_cv_search_pcre_compile" >&6 if test "$ac_cv_search_pcre_compile" != no; then test "$ac_cv_search_pcre_compile" = "none required" || LIBS="$ac_cv_search_pcre_compile $LIBS" else { echo "$as_me:$LINENO: WARNING: Perl Compatible Regular Expressions library is missing." >&5 echo "$as_me: WARNING: Perl Compatible Regular Expressions library is missing." >&2;} with_pcre="no" fi fi echo "$as_me:$LINENO: checking for library containing MD5Data" >&5 echo $ECHO_N "checking for library containing MD5Data... $ECHO_C" >&6 if test "${ac_cv_search_MD5Data+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_MD5Data=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char MD5Data (); int main () { MD5Data (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_MD5Data="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_MD5Data" = no; then for ac_lib in md; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char MD5Data (); int main () { MD5Data (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_MD5Data="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_MD5Data" >&5 echo "${ECHO_T}$ac_cv_search_MD5Data" >&6 if test "$ac_cv_search_MD5Data" != no; then test "$ac_cv_search_MD5Data" = "none required" || LIBS="$ac_cv_search_MD5Data $LIBS" fi echo "$as_me:$LINENO: checking for library containing md5_calc" >&5 echo $ECHO_N "checking for library containing md5_calc... $ECHO_C" >&6 if test "${ac_cv_search_md5_calc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS ac_cv_search_md5_calc=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char md5_calc (); int main () { md5_calc (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_md5_calc="none required" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_md5_calc" = no; then for ac_lib in md5; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char md5_calc (); int main () { md5_calc (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_search_md5_calc="-l$ac_lib" break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext done fi LIBS=$ac_func_search_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_search_md5_calc" >&5 echo "${ECHO_T}$ac_cv_search_md5_calc" >&6 if test "$ac_cv_search_md5_calc" != no; then test "$ac_cv_search_md5_calc" = "none required" || LIBS="$ac_cv_search_md5_calc $LIBS" fi # Checks for header files. 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 echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&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 echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in md5.h paths.h pthread.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "x$with_pcre" != "xno"; then for ac_header in pcre.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <$ac_header> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done fi # Checks for typedefs, structures, and compiler characteristics. echo "$as_me:$LINENO: checking for pid_t" >&5 echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 if test "${ac_cv_type_pid_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default int main () { if ((pid_t *) 0) return 0; if (sizeof (pid_t)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_pid_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_pid_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 echo "${ECHO_T}$ac_cv_type_pid_t" >&6 if test $ac_cv_type_pid_t = yes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi echo "$as_me:$LINENO: checking whether sys_signame is declared" >&5 echo $ECHO_N "checking whether sys_signame is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_sys_signame+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #ifndef sys_signame char *p = (char *) sys_signame; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_have_decl_sys_signame=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_sys_signame=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_signame" >&5 echo "${ECHO_T}$ac_cv_have_decl_sys_signame" >&6 if test $ac_cv_have_decl_sys_signame = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_SYS_SIGNAME 1 _ACEOF else cat >>confdefs.h <<_ACEOF #define HAVE_DECL_SYS_SIGNAME 0 _ACEOF fi # Checks for library functions. for ac_func in strlcpy MD5Data md5_calc do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done ac_config_files="$ac_config_files src/Makefile 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, don't put newlines in cache variables' values. # 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. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *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 \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!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 "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" 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}' # 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 DEFS=-DHAVE_CONFIG_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_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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 Bourne compatible 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+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH 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 fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; 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'` # PATH needs CR, and LINENO needs CR and PATH. # 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 as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; 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_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') 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=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # 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 before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, 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 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi 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$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # 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'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi 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, 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 --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _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 ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 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" ;; 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 $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; *) { { 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 test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # 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 # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@SENDMAIL@,$SENDMAIL,;t t s,@CRONTAB@,$CRONTAB,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@acx_pthread_config@,$acx_pthread_config,;t t s,@PTHREAD_CC@,$PTHREAD_CC,;t t s,@PTHREAD_LIBS@,$PTHREAD_LIBS,;t t s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $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'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $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'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # 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. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF 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,@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,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # 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. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $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'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $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'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (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 shush-1.2.3/INSTALL0000644000241700024170000000326310764620172014135 0ustar taranisotaraniso-- shush dependencies If you want Perl Compatible Regular Expression support, you'll need the PCRE library: + pcre: http://www.pcre.org/ Although this package uses autoconf, there is no real attempt to make sure it works on older UNIX systems as it relies on a number of somewhat modern system calls. -- shush installation notes (1) ./configure The following options are of interest: --with-pcre Where to find the PCRE lib if you want PCRE support. --with-syslog Default syslog facility to use. (Default: cron) --with-sizelimit Default output size limit for mail. (Default: 1000k) The latter should be set accordingly with your site's MTA configuration. (2) make (3) make install -- shush contact If you want to be informed about important news about shush, such as new releases, subscribe to the shush-announce mailing list, either by sending a mail including the "subscribe" keyword to shush-announce-request@taranis.org, or simply visit the following web page: http://web.taranis.org/mailman/listinfo/shush-announce Send bug reports to `shush-bugs@taranis.org'. A bug report is an adequate description of the environment (versions of this package, the OS) and of the problem: your input, what you expected, what you got, and why you believe it to be wrong. Diffs are welcome, but they only describe a solution, from which the problem might be difficult to infer. Your feedback will help to make a better and more portable package. Consider documentation errors as bugs, and report them as such. If you develop anything pertaining to `shush' or have suggestions, share your findings by writing to `shush@taranis.org'. -- $Id: INSTALL 1404 2008-03-08 23:25:46Z kalt $ shush-1.2.3/config.guess0000755000241700024170000012513310102315606015412 0ustar taranisotaraniso#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003 Free Software Foundation, Inc. timestamp='2004-06-11' # 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 02111-1307, 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. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; 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 ;' # 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 # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # 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 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; luna88k:OpenBSD:*:*) echo m88k-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 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit 0 ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # 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. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha*:OpenVMS:*:*) echo alpha-hp-vms 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 ;; *:OS400:*:*) echo powerpc-ibm-os400 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:4.0:6*) echo sparc-icl-nx6 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 ;; m68k:machten:*:*) echo m68k-apple-machten${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 -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy: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 -o $dummy $dummy.c && $dummy && exit 0 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 -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi 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 -o $dummy $dummy.c && $dummy && exit 0 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*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 ;; *:UNICOS/mp:*:*) echo nv1-cray-unicosmp${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 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-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=` # GNU/KFreeBSD systems have a "k" prefix to indicate we are using # FreeBSD's kernel, but not the complete OS. case ${LIBC} in gnu) kernel_only='k' ;; esac echo ${UNAME_MACHINE}-unknown-${kernel_only}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*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks 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 i586-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:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*: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=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-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 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu 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 #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` 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:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp 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 ;; 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 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*: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 | SDS2:*:4.0:3.0 | SHG2:*: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 ;; 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 ;; SX-6:SUPER-UX:*:*) echo sx6-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:*:*) case `uname -p` in *86) UNAME_PROCESSOR=i686 ;; powerpc) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-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-?: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 ;; *: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 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` 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 -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # 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: