ifile-1.3.9/0000775000175000017500000000000011306214407011622 5ustar jasonjasonifile-1.3.9/lex-simple.c0000644000175000017500000003013011306214407014040 0ustar jasonjason/* Implementation of some simple, context-free lexers. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include #include /* for isalpha() */ #define NO 0 #define YES 1 #define SELF ((ifile_lexer_simple*)self) /* This function is defined in scan.c */ extern int ifile_scan_fp_for_string (FILE *fp, const char *string, int oneline); extern arguments args; /* Create and return a IFILE_LEX, filling the document buffer from characters in FP, starting after the START_PATTERN, and ending with the END_PATTERN. */ ifile_lex * ifile_lexer_simple_open_text_fp (ifile_lexer *self, FILE *fp) { int document_size = 2048; /* the initial size of the document buffer */ int len; /* an index into RET->DOCUMENT */ ifile_lex *ret; /* the IFILE_LEX we will return. */ const char *end_pattern_ptr; int byte; /* a character read from FP */ if (feof (fp)) return NULL; /* Create space for the document buffer. */ ret = ifile_malloc (self->sizeof_lex); ret->document = ifile_malloc (document_size); /* Make sure DOCUMENT_START_PATTERN is not NULL; this would cause it to scan forward to EOF. */ assert (self->document_start_pattern); /* Scan forward in the file until we find the start pattern. */ ifile_scan_fp_for_string (fp, self->document_start_pattern, 0); /* Make sure the DOCUMENT_END_PATTERN isn't the empty string; this would cause it to match and finish filling immediately. */ assert (!self->document_end_pattern || self->document_end_pattern[0]); /* Fill the document buffer until we get EOF, or until we get to the DOCUMENT_END_PATTERN. */ for (len = 0, end_pattern_ptr = self->document_end_pattern; /* We got EOF */ (((byte = fgetc (fp)) != EOF) /* We found the DOCUMENT_END_PATTERN */ && !(end_pattern_ptr && *end_pattern_ptr == byte && *(end_pattern_ptr+1) == '\0')); len++) { if (len >= document_size-1) { /* The RET->DOCUMENT buffer must grow to accommodate more chars. */ /* We need `DOCUMENT_SIZE-1' in the above test, because we must have room for the terminating '\0'! */ document_size *= 2; ret->document = ifile_realloc (ret->document, document_size); } /* Put the byte in the document buffer. */ ret->document[len] = byte; /* If the byte matches the next character of the DOCUMENT_END_PATTERN then prepare to match the next character of the pattern, otherwise reset to the beginning of the pattern. */ if (end_pattern_ptr) { if (byte == *end_pattern_ptr) end_pattern_ptr++; else if (byte == self->document_end_pattern[0]) end_pattern_ptr = self->document_end_pattern+1; else end_pattern_ptr = self->document_end_pattern; } } if (len == 0) { ifile_free (ret->document); ifile_free (ret); return NULL; } #if 0 /* If we found the DOCUMENT_END_PATTERN, push it back into the input stream, so we'll see it next time we read from this file. */ /* xxx Will this work for stdin? */ if (byte != EOF) { int end_pattern_len = (self->document_end_pattern ? strlen (self->document_end_pattern) : 0); if (end_pattern_len && fseek (fp, -end_pattern_len, SEEK_CUR) != 0) perror (__PRETTY_FUNCTION__); len -= end_pattern_len; } #endif /* Remember, it may be the case that LEN is zero. */ ret->document_position = 0; ret->document_length = len; if (args.max_length != 0 && args.max_length < ret->document_length) ret->document_length = args.max_length; assert (ret->document_length < document_size); ((char*)ret->document)[ret->document_length] = '\0'; return ret; } /* Close the LEX buffer, freeing the memory held by it. */ void ifile_lexer_simple_close (ifile_lexer *self, ifile_lex *lex) { ifile_free (lex->document); ifile_free (lex); } /* Get the raw token from the document buffer by scanning forward until we get a start character, and filling the buffer until we get an ending character. The resulting token in the buffer is NULL-terminated. Return the length of the token. */ int ifile_lexer_simple_get_raw_word (ifile_lexer_simple *self, ifile_lex *lex, char *buf, int buflen) { int byte; /* characters read from the FP */ int wordlen; /* number of characters in the word so far */ /* Ignore characters until we get a beginning character. */ do { byte = lex->document[lex->document_position++]; if (byte == 0) return 0; } while (! self->true_to_start (byte)); /* Add the first alphabetic character to the word. */ buf[0] = (self->case_sensitive) ? byte : tolower (byte); /* Add all the following satisfying characters to the word. */ for (wordlen = 1; wordlen < buflen; wordlen++) { byte = lex->document[lex->document_position++];; if (byte == 0) break; if (! self->false_to_end (byte)) break; buf[wordlen] = tolower (byte); } if (wordlen >= buflen) ifile_error ("Encountered word longer than buffer length=%d", buflen); /* Back up to point at the character that caused the end of the word. */ lex->document_position--; /* Terminate it. */ buf[wordlen] = '\0'; return wordlen; } /* Perform all the necessary postprocessing after the initial token boundaries have been found: strip non-alphas from end, toss words containing non-alphas, toss words containing certaing many digits, toss words appearing in the stop list, stem the word, check the stoplist again, toss words of length one. If the word is tossed, return zero, otherwise return the length of the word. */ int ifile_lexer_simple_postprocess_word (ifile_lexer_simple *self, ifile_lex *lex, char *buf, int buflen) { int wordlen = strlen (buf); /* Toss words that are longer than SELF->TOSS_WORDS_LONGER_THAN */ if (self->toss_words_longer_than) { if (wordlen > self->toss_words_longer_than) return 0; } if (self->strip_non_alphas_from_end) { /* Strip any non-alphabetic characters off the end of the word */ while (wordlen && !isalpha(buf[wordlen-1])) wordlen--; /* Terminate it. */ buf[wordlen] = '\0'; if (wordlen == 0) return 0; } if (self->toss_words_containing_non_alphas) { /* If the word contains any non-alphabetic characters, get another word instead. */ { char *bufp; for (bufp = buf; *bufp; bufp++) { if (!isalpha (*bufp)) return 0; } } } /* If the word contain TOSS_WORDS_CONTAINING_THIS_MANY_DIGITS number of digits, get another word instead. (Here the variable BYTE holds the count of the number of digits.) */ if (self->toss_words_containing_this_many_digits) { int byte; char *bufp; for (bufp = buf, byte = 0; *bufp; bufp++) { if (isdigit (*bufp)) if (++byte > self->toss_words_containing_this_many_digits) return 0; } } if (self->stoplist_func && self->stoplist_func (buf)) return 0; /* Apply the stemming algorithm to the word. */ if (self->stem_func) self->stem_func (buf); /* If the result of stemming is on the stoplist, go back and start again. */ if (self->stoplist_func && self->stoplist_func (buf)) return 0; /* If the result of stemming is only one letter long, go back and start again. */ if (buf[1] == '\0') return 0; /* Return the length of the word we found. */ return strlen (buf); } /* Scan a single token from the LEX buffer, placing it in BUF, and returning the length of the token. BUFLEN is the maximum number of characters that will fit in BUF. If the token won't fit in BUF, an error is raised. */ int ifile_lexer_simple_get_word (ifile_lexer *self, ifile_lex *lex, char *buf, int buflen) { int wordlen; /* number of characters in the word so far */ do { wordlen = ifile_lexer_simple_get_raw_word ((ifile_lexer_simple*)self, lex, buf, buflen); if (wordlen == 0) return 0; } while ((wordlen = ifile_lexer_simple_postprocess_word ((ifile_lexer_simple*)self, lex, buf, buflen)) == 0); return wordlen; } /* The end of the ifile_lex_simple_ functions. */ #undef SELF /* A function wrapper around POSIX's `isalpha' macro. */ int ifile_isalpha (int character) { return isalpha (character); } /* A function wrapper around POSIX's `isgraph' macro. */ int ifile_isgraph (int character) { return isgraph (character); } /* A lexer that keeps all alphabetic strings, delimited by non-alphabetic characters. For example, the string `http://www.cs.cmu.edu' will result in the tokens `http', `www', `cs', `cmu', `edu'. */ const ifile_lexer_simple _ifile_alpha_lexer = { { sizeof (ifile_lex), ifile_lexer_simple_open_text_fp, ifile_lexer_simple_get_word, ifile_lexer_simple_close, "", /* document start pattern begins right away */ NULL /* document end pattern goes to end */ }, ifile_isalpha, /* begin words with an alphabetic char */ ifile_isalpha, /* end words with any non-alphabetic char */ ifile_stoplist_present, /* use the default stoplist */ 0, /* don't use the Porter stemming algorithm */ NO, /* be case-INsensitive */ NO, /* don't strip non-alphas from end */ NO, /* don't toss words w/ non-alphas */ 0, /* don't toss words with digits */ 59 /* toss words longer than 59 chars, uuenc=60 */ }; const ifile_lexer_simple *ifile_alpha_lexer = &_ifile_alpha_lexer; /* A lexer that throws out all space-delimited strings that have any non-alphabetical characters. For example, the string `obtained from http://www.cs.cmu.edu' will result in the tokens `obtained' and `from', but the URL will be skipped. */ const ifile_lexer_simple _ifile_alpha_only_lexer = { { sizeof (ifile_lex), ifile_lexer_simple_open_text_fp, ifile_lexer_simple_get_word, ifile_lexer_simple_close, "", /* document start pattern begins right away */ NULL /* document end pattern goes to end */ }, ifile_isalpha, /* begin words with an alphabetic char */ ifile_isgraph, /* end words with space */ ifile_stoplist_present, /* use the default stoplist */ 0, /* don't use the Porter stemming algorithm */ NO, /* be case-INsensitive */ YES, /* strip non-alphas from end */ YES, /* toss words w/ non-alphas */ 3, /* toss words with 3 digits */ 59 /* toss words longer than 59 chars, uuenc=60 */ }; const ifile_lexer_simple *ifile_alpha_only_lexer = &_ifile_alpha_only_lexer; /* A lexer that keeps all strings that begin and end with alphabetic characters, delimited by white-space. For example, the string `http://www.cs.cmu.edu' will be a single token. */ const ifile_lexer_simple _ifile_white_lexer = { { sizeof (ifile_lex), ifile_lexer_simple_open_text_fp, ifile_lexer_simple_get_word, ifile_lexer_simple_close, "", /* document start pattern begins right away */ NULL /* document end pattern goes to end */ }, ifile_isalpha, /* begin words with an alphabetic char */ ifile_isgraph, /* end words with any non-alphabetic char */ ifile_stoplist_present, /* use the default stoplist */ 0, /* don't use the Porter stemming algorithm */ NO, /* be case-INsensitive */ YES, /* strip non-alphas from end */ NO, /* don't toss words w/ non-alphas */ 4, /* toss words with 4 digits */ 59 /* toss words longer than 59 chars, uuenc=60 */ }; const ifile_lexer_simple *ifile_white_lexer = &_ifile_white_lexer; ifile-1.3.9/lex-indirect.c0000644000175000017500000000244311306214407014356 0ustar jasonjason/* Implementation of helping functions for lexers that use a nested, underlying lexer. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include #define SELF ((ifile_lexer_indirect*)self) /* Open the underlying lexer. */ ifile_lex * ifile_lexer_indirect_open_text_fp (ifile_lexer *self, FILE *fp) { return SELF->underlying_lexer->open_text_fp (self, fp); } /* Close the underlying lexer. */ void ifile_lexer_indirect_close (ifile_lexer *self, ifile_lex *lex) { SELF->underlying_lexer->close (self, lex); } ifile-1.3.9/stoplist.c0000644000175000017500000000461011306214407013646 0ustar jasonjason/* Determine if a word is on the stoplist or not. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include #include /* for isupper */ static ifile_int4str *stopword_map; /* This is defined in stopwords.c */ extern char *_ifile_builtin_stopwords[]; static void init_stopwords () { char **word_ptr; stopword_map = ifile_int4str_new (0); #if 0 return; /* xxx temporary for missy-demo data! */ #endif for (word_ptr = _ifile_builtin_stopwords; *word_ptr; word_ptr++) { ifile_str2int (stopword_map, *word_ptr); } } /* Add to the stoplist the white-space delineated words from FILENAME. Return the number of words added. If the file could not be opened, return -1. */ int ifile_stoplist_add_from_file (const char *filename) { FILE *fp; char word[IFILE_MAX_WORD_LENGTH]; int count = 0; if ((fp = fopen (filename, "r")) == NULL) return -1; if (!stopword_map) init_stopwords (); while (fscanf (fp, "%s", word) == 1) { ifile_str2int (stopword_map, word); count++; ifile_verbosify (ifile_debug, "Added to stoplist: `%s'\n", word); } ifile_verbosify (ifile_verbose, "Added %d words from `./.bow-stopwords'\n", count); fclose(fp); return count; } void ifile_stoplist_add_word (const char *word) { ifile_str2int (stopword_map, word); ifile_verbosify (ifile_debug, "Added to stoplist: `%s'\n", word); } int ifile_stoplist_present (const char *word) { if (!stopword_map) init_stopwords (); return ((ifile_str2int_no_add (stopword_map, word) == -1) ? 0 : 1); } void ifile_stoplist_free() { ifile_int4str_free(stopword_map); } ifile-1.3.9/stopwords.c0000644000175000017500000001530211306214407014031 0ustar jasonjason/* Builtin stoplist words (from SMART) */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include char *_ifile_builtin_stopwords[] = { "a", "able", "about", "above", "according", "accordingly", "across", "actually", "after", "afterwards", "again", "against", "all", "allow", "allows", "almost", "alone", "along", "already", "also", "although", "always", "am", "among", "amongst", "an", "and", "another", "any", "anybody", "anyhow", "anyone", "anything", "anyway", "anyways", "anywhere", "apart", "appear", "appreciate", "appropriate", "are", "around", "as", "aside", "ask", "asking", "associated", "at", "available", "away", "awfully", "b", "be", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "believe", "below", "beside", "besides", "best", "better", "between", "beyond", "both", "brief", "but", "by", "c", "came", "can", "cannot", "cant", "cause", "causes", "certain", "certainly", "changes", "clearly", "co", "com", "come", "comes", "concerning", "consequently", "consider", "considering", "contain", "containing", "contains", "corresponding", "could", "course", "currently", "d", "definitely", "described", "despite", "did", "different", "do", "does", "doing", "done", "down", "downwards", "during", "e", "each", "edu", "eg", "eight", "either", "else", "elsewhere", "enough", "entirely", "especially", "et", "etc", "even", "ever", "every", "everybody", "everyone", "everything", "everywhere", "ex", "exactly", "example", "except", "f", "far", "few", "fifth", "first", "five", "followed", "following", "follows", "for", "former", "formerly", "forth", "four", "from", "further", "furthermore", "g", "get", "gets", "getting", "given", "gives", "go", "goes", "going", "gone", "got", "gotten", "greetings", "h", "had", "happens", "hardly", "has", "have", "having", "he", "hello", "help", "hence", "her", "here", "hereafter", "hereby", "herein", "hereupon", "hers", "herself", "hi", "him", "himself", "his", "hither", "hopefully", "how", "howbeit", "however", "i", "ie", "if", "ignored", "immediate", "in", "inasmuch", "inc", "indeed", "indicate", "indicated", "indicates", "inner", "insofar", "instead", "into", "inward", "is", "it", "its", "itself", "j", "just", "k", "keep", "keeps", "kept", "know", "knows", "known", "l", "last", "lately", "later", "latter", "latterly", "least", "less", "lest", "let", "like", "liked", "likely", "little", "look", "looking", "looks", "ltd", "m", "mainly", "many", "may", "maybe", "me", "mean", "meanwhile", "merely", "might", "more", "moreover", "most", "mostly", "much", "must", "my", "myself", "n", "name", "namely", "nd", "near", "nearly", "necessary", "need", "needs", "neither", "never", "nevertheless", "new", "next", "nine", "no", "nobody", "non", "none", "noone", "nor", "normally", "not", "nothing", "novel", "now", "nowhere", "o", "obviously", "of", "off", "often", "oh", "ok", "okay", "old", "on", "once", "one", "ones", "only", "onto", "or", "other", "others", "otherwise", "ought", "our", "ours", "ourselves", "out", "outside", "over", "overall", "own", "p", "particular", "particularly", "per", "perhaps", "placed", "please", "plus", "possible", "presumably", "probably", "provides", "q", "que", "quite", "qv", "r", "rather", "rd", "re", "really", "reasonably", "regarding", "regardless", "regards", "relatively", "respectively", "right", "s", "said", "same", "saw", "say", "saying", "says", "second", "secondly", "see", "seeing", "seem", "seemed", "seeming", "seems", "seen", "self", "selves", "sensible", "sent", "serious", "seriously", "seven", "several", "shall", "she", "should", "since", "six", "so", "some", "somebody", "somehow", "someone", "something", "sometime", "sometimes", "somewhat", "somewhere", "soon", "sorry", "specified", "specify", "specifying", "still", "sub", "such", "sup", "sure", "t", "take", "taken", "tell", "tends", "th", "than", "thank", "thanks", "thanx", "that", "thats", "the", "their", "theirs", "them", "themselves", "then", "thence", "there", "thereafter", "thereby", "therefore", "therein", "theres", "thereupon", "these", "they", "think", "third", "this", "thorough", "thoroughly", "those", "though", "three", "through", "throughout", "thru", "thus", "to", "together", "too", "took", "toward", "towards", "tried", "tries", "truly", "try", "trying", "twice", "two", "u", "un", "under", "unfortunately", "unless", "unlikely", "until", "unto", "up", "upon", "us", "use", "used", "useful", "uses", "using", "usually", "uucp", "v", "value", "various", "very", "via", "viz", "vs", "w", "want", "wants", "was", "way", "we", "welcome", "well", "went", "were", "what", "whatever", "when", "whence", "whenever", "where", "whereafter", "whereas", "whereby", "wherein", "whereupon", "wherever", "whether", "which", "while", "whither", "who", "whoever", "whole", "whom", "whose", "why", "will", "willing", "wish", "with", "within", "without", "wonder", "would", "would", "x", "y", "yes", "yet", "you", "your", "yours", "yourself", "yourselves", "z", "zero", NULL }; ifile-1.3.9/ChangeLog0000644000175000017500000011301411306214407013372 0ustar jasonjason2009-12-04 Jason Rennie * release 1.3.9 * opts.c: set argp_program_bug_address to NULL * argp/pargp-fs-xinl.c: comment-out __OPTIMIZE__ redef * argp/argp-xinl.c: comment-out __OPTIMIZE__ redef * ifile.1: incorporate Debian fixes to man page 2006-09-12 Jason Rennie * README: remove mailing list URL, update web page 2006-05-17 Jason Rennie * release 1.3.8 * debian: delete directory; don't want to step on Jens Peter Secher toes (official Debian ifile maintainer); wait for guidance * opts.c (parse_opt): allow use of concise option with loocv_folder 2006-05-17 Paolo * util.c, ifile.c: fix LOOCV query (as I got it): if folder's not already there, don't create it really, not even temp for next query. * Makefile.in: add STRIP 2006-05-16 Paolo * release 1.3.7 * Makefile.in: add DESTDIR * argp/Makefile.in: add DESTDIR * debian: new directory w/ Debian-related files 2006-05-14 Paolo * release 1.3.6 * util.c (ifile_print_ratings, ifile_concise_ratings): fix segv if no folders in DB or #folders less than 2 and -T is set 2004-12-12 Jason Rennie * release 1.3.5 2004-12-11 Derek Peschel * configure.ac: Check type of ssize_t which database.c uses. 2004-05-01 Jason Rennie * update 1.3.4 2004-05-01 Paolo * ifile.1: update for threshold option * opts.c (-T): update --help documentation 2004-04-30 Jason Rennie * release 1.3.4 2004-04-30 Paolo * ifile.c: add args.thresh to ratings calls * include/ifile.h: add int thresh to arguments * opts.c (options, parse_opt): add threshold option * util.c (ifile_print_ratings, ifile_concise_ratings): print threshold info 2003-07-28 Jason Rennie * release 1.3.3 2003-07-25 Jason Rennie * BUGS: removed * configure: recompile (Re: Lubomir's patch) * argp/configure: recompile (Re: Lubomir's patch) 2003-07-25 Lubomir Sedlacik * configure.ac: don't use __attributes__ for non-GCC compilers * argp/configure.in: don't use __attributes__ for non-GCC compilers 2003-06-10 Jason Rennie * release 1.3.2 2003-05-26 Michael Hohmuth * ifile.c: add setlocale command; fixes bug 1500. 2003-05-22 Jason Rennie * opts.c: Change // comment to /**/ (use C style comments) 2003-04-16 Jason Rennie * release 1.3.1 * opts.c: update mailing list address 2003-04-11 Jason Rennie * database.c: make error messages refer to temp_data_file; free temp_data_file 2003-03-30 Jason Rennie * database.c (ifile_write_db): check for errors while writing database. Fixes bug 2955. 2003-02-13 Dave Marquardt * Fixed problems in configure and autoconf scripts for the case of selecting non-gcc C compiler. Fixes bug 2535. 2003-02-07 Jason Rennie * release 1.3.0 * configure.ac: new file (rename from "configure.in") * Makefile.in (DIST_FILES): remove configure.in 2003-02-11 Dave Marquardt * include/extendable_array.h: Fixed bug in EXT_ARRAY_INIT_N_SET() macro. Fixes bug 2516, where new folders caused the database to be garbled. 2003-01-29 Dave Marquardt * Performance improvements: On a Sun SPARC-based system running Solaris 10, with a database of about 16500 words, got a 40% improvement in words processed per second when reading the database, using the changes listed here. * include/ifile.h: Changed prototypes for readline(), ifile_read_header() and ifile_read_word_frequencies() to reflect new calling conventions. * include/extendable_array.h: New macro EXT_ARRAY_INIT_N_SET() combines the effects of EXT_ARRAY_INIT() and multiple calls to EXT_ARRAY_SET() in a smarter way, saving many realloc() calls and many manipulations of the array metadata. * utils.c: Rewrote readline to take a char** bufp and use the data within *bufp to parse a line, and update *bufp to point beyond the first line. This avoids at least one copy of the data. * primes.c: Cast values returned by ifile_realloc() correctly. * int4str.c: Cast argument to free() to void * in ifile_int4str_free_contents(), to fix compiler complaints. * hash.c: Added an include of to fix compiler complaints. * database.c: Made ifile_read_db() read the whole database in one fell swoop and modified callers of readline() to just pass in a pointer to the buffered database. Also made ifile_read_word_entry() call a new macro EXT_ARRAY_INIT_N_SET() in place of EXT_ARRAY_INIT() and multiple calls to EXT_ARRAY_SET(), saving many calls to realloc() and many manipulations of the extendable array metadata. 2002-11-25 Jason Rennie * release 1.2.1 * ifile.c: don't dump core if database doesn't exist and user gives one of these options: -q, -Q, -l, -u * Makefile.in: make "dist" upload to Savannah file area 2002-10-31 Jason Rennie * release 1.2.0 * ifile.tcl, user.tcl, ifilter.mh.pl, irefile.mh.pl, knowledge_base.mh.pl, news2mail.pl: removed (added to new mh-ifile package) * FAQ: removed (converted to html, posted on web page) * various: update mailing list web page & e-mail address * Makefile.in: remove all references to removed files * INSTALL: delete mh-specific instructions (moved to mh-ifile) * experiment.mh.pl: removed (unnecessary) 2002-10-26 Jason Rennie * ifile.c: error if -u folder doesn't exist 2002-10-16 Jason Rennie * release 1.1.5 2002-09-27 Jason Rennie * release 1.1.4 * ifile.1: add reference to FAQ file for database format 2002-09-26 Andreas Piesk * ifile.c (main): check that message isn't NULL before freeing it 2002-09-19 Camillo Särs * Makefile.in (install): mode 0755 for MAIN_EXECUTABLES and PERL_RUNNABLE_FILES * Makefile.in (include/ifile.h): add "-f" to mv; make target $(srcdir)/include/ifile.h (instead of $@) 2002-09-11 Jason Rennie * release 1.1.3 * INSTALL: update * argp: add ldmalloc stuff 2002-09-10 Jason Rennie * release 1.1.2 * opts.c: remove -h from --concise option * ifile.c (main): move ifile_age_words out of message reading loops; make individual message print ifile_verbose; time reading all messages rather than individual messages * Makefile.in (DIST_FILES): add configure.in 2002-09-10 Aaron M. Ucko * configure.in: add --with-dmalloc option 2002-09-10 Nathan * Makefile.in: use $(srcdir) to specify location of man pages 2002-09-10 Jason Rennie * release 1.1.1 * opts.c: remove -h from --concise option 2002-09-09 Jeremy Brown * release 1.1.0 * util.c: htable_put calls should no longer use strdup (ifile_free): does this function do anything useful? * stoplist.c (ifile_stoplist_free): free the stoplist data structure on exit (used only when debugging memory leaks.) * int4str.c (ifile_int4str_free_contents): free contained strings too. * ifile.c: Completely restructured main loop: read one message, process it, free the memory it consumed; iterate. Save database only after all messages processed. If using dmalloc debugging malloc library, free main datastructures at the end, otherwise just exit fast and dirty. * hash_table.c: hash tables create their own internal copies of key strings (except when resizing, of course); htable_put calls should never bother to strdup the key. TODO: hashtables are currently hardwired to use strings as keys/indices, but there are partial facilities for generalization; make it all general. (htable_free_guts): free key, value, etc. of a hashtable with user-provided functions. (htable_free): use htable_free_guts, then free the actual structure too. * include/hash_table.h: added/modified prototypes * database.c: copy a string for each data structure it's stored in to avoid having to reference-count for strings. Don't use strdup when calling htable_put. (wentry_free, ifile_db_free, ifile_free_categories): new functions that free major data-structures. TODO: name these things consistently. * include/ifile.h: added/modified prototypes. Also added dmalloc.h hook for use with the dmalloc debugging malloc library. 2002-09-03 Jeremy Brown * release 1.0.11 * istext.c: make NUM_TEST_CHARS more constant 2002-09-03 Steve Price * ifile.c: in loocv, skip message if NULL 2002-08-28 Matt Kraai * release 1.0.10 * database.c (ifile_read_header, ifile_read_word_frequencies): make ifile die more reasonably when given a bad .idata file to read * util.c (readline): return NULL if read fails * release 1.0.9 * util.c (readline): make work properly if fgets returns an error 2002-08-28 Jason Rennie * release 1.0.8 * Makefile.in: clean up, install man page; make install directories work like they should * ifile.1: new file * test.sh: new file 2002-08-19 Jason Rennie * release 1.0.7 * opts.c (argp_program_bug_address): Change to mailing list * opts.c (parse_opt): eliminate query flags from case 'c'; error if -c option not used with -q or -Q 2002-07-24 Karl Vogel * release 1.0.6 * ifile.c, include/ifile.h, util.c: print file names for new '-c' option 2002-07-15 Jason Rennie * configure.in: new file * configure: generate with autoconf 2002-07-15 Jason Rennie * release 1.0.5 * Makefile.in: Don't install libifile.a 2002-07-15 Karl Vogel * ifile.c (main): use args.concise, ifile_concise_ratings * opts.c: new option, "concise" * util.c: abort() if malloc returns null * util.c (ifile_concise_ratings): new function 2002-01-20 Jason Rennie * ifile v1.0.4 released * ifile.c (main): check for MSG != NULL (fixes segfault) 2001-11-22 Jason Rennie * ifile v1.0.3 released * database.c (ifile_add_db): add 'create' parameter; use it * ifile.c (main): update uses of ifile_add_db * opts.c (update): add new option * opts.c (ifile_init_args): set default value of create_folder * ifile.h (arguments): add create_folder * ifile.h (ifile_add_db): add 'create' parameter 2001-02-09 Caleb Crome * news2mail.pl: Change #! line to /usr/bin/perl 2000-03-14 William O. Ferry * irefile.mh.pl: use `pick' to expand message wildcards (e.g. 100-200, cur) 2000-01-18 Jason Rennie * COPYING: Latest GPL formatting (http://www.gnu.org/copyleft/gpl.txt) * README, INSTALL: minor changes * Makefile.in (DIST_FILES): add COPYING 1999-10-27 Jason Rennie * NOTES: update for 1.0.0 * INSTALL: updates for ifile.tcl->user.tcl/ifile.tcl code split; other minor changes * ifile.tcl: move User_* functions to user.tcl * README: removed text that was copied in other text files; updated version * FAQ: move "does ifile actually work" to FAQ * FAQ: update FAQ to reflect CMU->MIT/AI Lab move Fri Apr 23 17:55:47 1999 Jason Daniel Rennie * INSTALL: update EXMH install to reflect ifile.tcl fix; mention EXMH "custom" inc method * ifile.tcl: Recent fix to EXMH makes it possible to redefine Mh_Refile without any tricks--any function that runs via the background process must be defined in User_Layout Thu Apr 22 22:48:16 1999 Jason Daniel Rennie * INSTALL: automatic filter when EXMH incorporates mail is no longer an option (without an external filter such as slocal); update text to indicate so * ifile.tcl: remove most incorporate code; keep Inc_Init, but make it the same as EXMH 2.0.2 Thu Feb 19 12:07:38 EST 1998 Jason Daniel Rennie consider making optional argument to --log-file consider having ~/.ifile directory store idata, accuracy, log files Thu Dec 3 12:55:51 EST 1998 Jason Daniel Rennie * ifilter.mh.pl: Add X-filter: header at end of header section; rename old x-filter headers ifile-981203 released Wed Dec 2 18:20:36 EST 1998 Jason Daniel Rennie * README, Version: bump version number to v0.7.3 * database.c (ifile_write_db): clean up tmp file name code * ifile.c, opts.c: add print-tokens option * lex-simple.c, opts.c: add max-length option * util.c (ifile_print_message): fix * include/ifile.h: add max_length and print_tokens to argument type * Makefile.in: make snapshot work ifile-981202 released Tue Apr 7 20:43:11 EDT 1998 "Harry G. McGavran Jr." * database.c: ifile_write_db(): Fix for a pointer bug which would cause a segfault on many occasions. Mon Apr 6 17:18:00 EDT 1998 Jason Daniel Rennie ifile v0.7.1 released Mon Apr 6 12:57:53 EDT 1998 Jason Daniel Rennie * database.c: Modified ifile_write_db() so that database is first written to a file which is user/host specific. Once database writing is done, file is renamed to real file name. Fri Apr 3 12:36:02 EST 1998 Jason Daniel Rennie * ifilter.mh.pl: changed removal of temporary file to use unlink() (previously used "system \"rm $tmp_file\"") Made temporary file read/writable only to user. Tue Mar 31 13:38:56 EST 1998 Jason Daniel Rennie * Makefile.in: added $(srcdir) in copy of argp.h to include dir. Tue Mar 31 02:21:00 EST 1998 Jason Daniel Rennie ifile v0.7.0 released Tue Mar 31 00:15:17 EST 1998 Jason Daniel Rennie * error.c, opts.c: debugging/log information now stored in ~/.ifile.log (previously /tmp/ifile.log.[userid])a * ifilter.mh.pl: debugging/log info now stored in ~/.ifilter.log * irefile.mh.pl: debugging/log info now stored in ~/.irefile.log Mon Mar 30 03:16:29 EST 1998 Jason Daniel Rennie * ifilter.mh.pl: check to make sure we have write permissions before deciding on the folder to filter to. * experiment.mh.pl/knowldege_base.mh.pl: only accumuate info on mailboxes which we have write permissions to. Mon Mar 30 01:33:22 EST 1998 "Harry G. McGavran Jr." * ifile.c: semaphore code to keep two ifile processes from messing with the data file at the same time. Thu Mar 5 03:15:00 EST 1998 Jason Daniel Rennie * ifile.c: changed cmp() function so that it returns 0 when given two floats which are equal. Previously, would return 1 - this seems to have caused mass hysteria when passed to qsort. Thu Mar 5 01:13:35 EST 1998 Jason Daniel Rennie * knowledge_base.mh.pl: No longer uses wildcard when choosing files from a directory. Now only takes files with names completely composed of digits. Changed file names which are passed to ifile binary - now uses relative (instead of absolute) path names. * experiment.mh.pl: Changed file names which are passed to ifile binary - now uses relative (instead of absolute) path names. This reduces the length of the command line call. Wed Feb 25 13:05:40 EST 1998 Jason Daniel Rennie * Makefile.in: added $(srcdir)/ to ifile.h locations in include/ifile.h make Sun Feb 22 11:25:07 EST 1998 Jason Daniel Rennie * experiment.mh.pl: changed $data_file to absolute path Thu Feb 19 01:40:37 EST 1998 Jason Daniel Rennie ifile v0.6.6 released Thu Feb 19 00:46:09 EST 1998 Jason Daniel Rennie * hash_table.c, scan.c, istext.c: accounted for minor C library inconsistencies on SunOS 4.1.3_U1 Wed Feb 18 17:10:27 EST 1998 Valdis Kletnieks * Makefile.in: removed "-include Makefile" from bottom of file. * istext.c: AIX compiler doesn't like const static int = declaration. Inserted #defines instead. * lex-email.c, primes.c: AIX needs "#pragma alloca" to be able to properly use alloca() Wed Feb 18 01:50:51 EST 1998 Jason Daniel Rennie * Makefile.in: removed dependencies on configure (in both main and argp directories), removed configure from maintainer-clean build * configure.in: removed file from distribution * ifilter.mh.pl: added '-g' option to output /tmp/.log. with 0600 permissions. * irefile.mh.pl: added '-g' option to output /tmp/.log. with 0600 permissions. * irefile.mh.pl: do not pass '-g' option to refile executable * ifile.c, error.c: added '-g' option to output /tmp/.log. file. Added chmod() in error.c to set permissions of file to 0600. * include/ifile.h, opts.c: added -g option, added tmp_file to arguments struct. * error.c: fixed ifile_strip_path() - previously was putting extra '/' at beginning of returned string. * opts.c: added cases to parse_opt() so that it will only return error when it is supposed to. * FAQ: added info about configure --srcdir option Thu Feb 12 23:24:39 EST 1998 Jason Daniel Rennie * Makefile: removed experiment.mh.pl from list of PERL_FILES ifile v0.6.5 released Thu Feb 12 04:02:30 EST 1998 Jason Daniel Rennie ifile v0.6.4 released Thu Feb 12 03:32:21 EST 1998 Jason Daniel Rennie * ifile.c: previously checked for word aging only in the case of --insert without --delete. With new --query-insert option, this old style of --insert w/o --delete is never used. Changed condition so that it checks for --query-insert option. Tue Feb 10 10:53:53 EST 1998 Jason Daniel Rennie * opts.c: Added db-file command line option. * ifile.c: Changed all instances of IFILE_DATA so that it would use arg.db_file for location of db storage Mon Feb 2 22:35:00 EST 1998 Jason Daniel Rennie ifile v0.6.3 released Mon Feb 2 21:32:45 EST 1998 Jason Daniel Rennie * error.c: changed ifile_open_log so that it will overwrite the old log file. changed ifile_strip_path so that it doesn't skip first character in executable name. Mon Feb 2 00:28:06 EST 1998 Jason Daniel Rennie * ifilter.mh, irefile.mh: added checks for executability of MH programs Fri Jan 30 03:07:19 EST 1998 Jason Daniel Rennie * UPGRADE, INSTALL: Added information about the necessity to have MH binaries in a directory which is part of the user's path. * ifilter.mh, irefile.mh: Added code which will cause each to die miserably if MH binaries are not runnable (either because full path is not specified or because PATH does not include MH dirs) Thu Jan 29 03:04:00 EST 1998 Jason Daniel Rennie ifile v0.6.2 released Thu Jan 29 00:47:50 EST 1998 Jason Daniel Rennie * database.c, hash_table.c: changed a number of (int) casts to (long int) casts. On Alphas and other 64-bit machines, casting from a pointer to int would cause a compiler warning. Casting to (long int) eliminates those warnings. Thu Jan 22 01:32:29 EST 1998 Jason Daniel Rennie * ifile.tcl: Added. Created a new Mh_Refile function to cause EXMH to call irefile.mh when it would normally call MH refile. * irefile.mh.pl: Fixed some bugs, caused it to output debugging information to /tmp/irefile.info. Bugs included .mh_profile parsing and variable name misstypings. Thu Jan 15 00:08:22 EST 1998 Jason Daniel Rennie * changed all instances of "ifile.h" to * Makefile.in: modified installation section so that files are passed to installation program one at a time (some installation programs cannot handle multiple files). Wed Dec 24 23:23:00 EST 1997 Jason Daniel Rennie * irefile.mh.pl: various minor changes to eliminate bugs & to get it to work properly Wed Dec 24 13:19:41 EST 1997 Jason Daniel Rennie * ifile.c, ifile.h, opts.c: minor modifications to the way query-insert option is dealt with. Wed Dec 24 04:46:46 EST 1997 Jason Daniel Rennie * database.c, ifile.c: modified aging calling so that it is called from ifile.c and only called if there is insertion without deletion. Wed Dec 24 03:49:28 EST 1997 Jason Daniel Rennie * ifilter.mh.pl, irefile.mh.pl: added usage information * irefile.mh.pl: added code to find out current folder if no source folder is given. Also, if irefile.mh is given absolute folder names, it will attempt to extract the folder names by searching for and removing the mail path ($mail_path). Tue Dec 23 20:10:51 EST 1997 Jason Daniel Rennie * irefile.mh.pl: modified building of ifile command line to check for .skip_me files in source and destination folders * opts.c, ifile.c: added "--query-insert" option Tue Dec 23 16:56:48 EST 1997 Jason Daniel Rennie * ifile.c: any newly created .idata file will now have 0600 permissions Tue Dec 23 16:36:56 EST 1997 Jason Daniel Rennie * lex-email.c: ifile_lexer_email_prelex_header(): modified code so that it would not seg fault if a give e-mail message does not contain a body. Tue Dec 23 15:57:22 EST 1997 Jason Daniel Rennie * Makefile.in: Minor modifications to file names * news2mail.pl: Minor modifications * extendable_array.h: EXT_ARRAY_SET() now sets all new values of array to 0. Mon Dec 22 20:29:41 EST 1997 Jason Daniel Rennie * database.c: ifile_write_db(): fixed process by which infrequent words are tossed. Folder frequencies are now properly updated. Mon Dec 22 17:23:19 EST 1997 Jason Daniel Rennie * extendable_array.h: EXT_ARRAY_GET() now returns 0 when asked for a value which is out of the range of the currently allocated array. Mon Dec 22 14:36:21 EST 1997 Jason Daniel Rennie * database.c: ifile_del_db() was broken. Now it's fixed. Need to create a function for removing infrequent words. Currently, the folder frequencies are not being updated (not a good thing). Mon Dec 22 14:15:06 EST 1997 Jason Daniel Rennie * ifile.c, util.c: fixed message reading timing output. Mon Dec 22 05:54:34 EST 1997 Jason Daniel Rennie * util.c: added an fclose() call to ifile_read_message() * knowledge_base.pl: completely rewritten in order to make use of ifile * opts.c, ifile.h, ifile.c: added a new command line option, one to reset the database (currently implemented by removing .idata) * opts.c, ifile.h, ifile.c: added state variables to indicate whether messages should be read, database should be read/written Mon Dec 22 04:49:06 EST 1997 Jason Daniel Rennie * util.c: modified ifile_read_message to check the return value of the opening of the message. Opening an empty message results in a (ifile_lex *) NULL return value. Mon Dec 22 02:55:17 EST 1997 Jason Daniel Rennie * lex-email.c: apparently works, does a nice job of dicing up the headers when requested to do so. Sun Dec 21 17:26:19 EST 1997 Jason Daniel Rennie * lex-define.c, ifile.h: integrated the gram lexer into the email lexer so that ifile_email_lexer is the only non-simple lexer. * lex-email.c: rewritten using lex-gram.c as a base. * ifile.h, lex-simple.c, lex-email.c: to this point, ifile_lexer.sizeof_lex has been used as though it should be the size of the lexer. After some inspection, it appears that it should be the size of the lex. Changes have been made accordingly. * lex-gram.c: removed from the distribution. Thu Dec 18 19:44:56 EST 1997 Jason Daniel Rennie * lex-define.c, ifile.h: added a layer between the e-mail lexer and an indirect lexer. Also created a specialized LEX for email. * lex-email.c: very broken at this point. Needs to be fixed. Thu Dec 18 16:53:20 EST 1997 Jason Daniel Rennie * lex-define.c: fixed lexer initialization code. * lex-email.c: fixed header checking code so that it mostly works. It still needs fixing, though. Currently, it dumps core on an empty input file. Tue Dec 9 08:03:35 EST 1997 Jason Daniel Rennie * ifile crashes on ifile_read_message. My guess is that the lexer code is broken. Mon Dec 8 23:40:16 EST 1997 Jason Daniel Rennie * Added hack to irefile.mh.pl to allow refiles of the form "irefile # +src +dest" (sometimes used by xmh) * Finished writing irefile.mh.pl Sat Nov 1 02:24:16 EST 1997 Jason Daniel Rennie * Began writing irefile.mh Sat Oct 18 01:54:39 EDT 1997 Jason Daniel Rennie * Makefile: modified snapshot, diff to use "cp" instead of "ln". Consumes more diskspace, but is more likely to work on AFS. Sat Oct 18 01:43:47 EDT 1997 Jason Daniel Rennie * opts.c: fixed argument parsing so that it properly parses file names * database.c: fixed writing so that it would only write folder-word frequency entries which are non-zero Tue Oct 14 16:50:20 EDT 1997 Jason Daniel Rennie * ifilter.mh: changed to use a temp file so that it doesn't have to load libraries to do 2-way piping. Also, changed to print folder to which message is filtered (this should NOT be printed to STDERR) Sun Oct 12 09:22:13 EDT 1997 Jason Daniel Rennie * temporary happiness achieved :) it looks like the C code for the 72nd "complete & total rewrite of ifile" is complete. Sun Oct 12 09:19:27 EDT 1997 Jason Daniel Rennie * database.c: changed "args.folder_calcs" to "folder", fixing a segmentation violation bug Sun Oct 12 04:52:25 EDT 1997 Jason Daniel Rennie * database.c: fixed some technical proclems with the ifile_add_db function. Made minor revisions to reading/writing functions Fri Oct 10 22:25:48 EDT 1997 Jason Daniel Rennie * opts.c: added all sorts of neat command line options. * lex-default.c: set up lexing options so that effects take place in the correct order * ifile.c: added capabilities for updating DB, writing it to disk. * database.c: wrote functions for updating DB, writing it to disk. Fri Oct 10 05:44:47 EDT 1997 Jason Daniel Rennie * ifile.c: converted querying, verbosity to work with new style of command line parsing Fri Oct 10 04:47:10 EDT 1997 Jason Daniel Rennie * Makefile.in: configured to work with ifile * ifile.c: now the main exectuable file * util.c: new file - some utility functions from ifile.c * database.c: new file - database opteration functions Fri Oct 10 02:37:02 EDT 1997 Jason Daniel Rennie * ifile_query.c: fixed minor bugs, added GNU command line argument system * argp/*: GNU command-line argument handling system - added to main executable(s) * hash_table.c: fixed final bugs (hopefully :) * ifile.c: fixed final bugs in db reading functions, rating functions. * Makefile.in: new file * configure.in: new file * configure: new file * Version: new file * opts.c: new file - configuration of argp Thu Oct 9 02:06:49 EDT 1997 Jason Daniel Rennie * ifile_query.c: complete rewrite. Stripped out all unnecessary functions - make code totally reliant on new data structures. * hash_table.c: eliminted syntax errors, minor bugs. Improved prime-finding algorithm * ifile.c: eliminated syntax errors, minor bugs Wed Oct 8 10:17:54 EDT 1997 Jason Daniel Rennie * ifile.c: ripped out any functions which were MH-specific. Modified remaining functions to use new ifile_db and hash_table types. Still have to fix write_db functions. * ifile.h: added ifile_db, db_word_entry, removed anything MH-specific. * ifile_db.c: began to remove MH-specific functions Wed Oct 8 07:16:01 EDT 1997 Jason Daniel Rennie * hash_table.c: new file - implements general array-based (no linked lists) autoextendable hash table * hash_table.h: new file Wed Oct 8 04:05:44 EDT 1997 Jason Daniel Rennie * ifile.c: fixed minor bug in idata writing code. Previously, blank lines would be added to .idata file. Sat Oct 4 02:48:43 EDT 1997 Carl Staelin * ifile.c: rewrote ifile_write_word_frequencies() in order to speed things up a bit. * assoc_array_int: rewrote some of the structures, wrote a slicker hash() function, changed hash table sizes Sat Sep 13 03:35:17 EDT 1997 Jason Daniel Rennie * ifilter.c: renamed to ifile_query.c * irefile.c: renamed to ifile_db.c * ifilter.c: made code MH-independant. No longer filters mail to a folder, but rather prints out folder names and cooresponding metric values. * ifile.c: added ifile_print_ratings, modified ifile_rate_categories so that it would return an array of category names and ratings Sat Sep 13 02:27:54 EDT 1997 Jason Daniel Rennie * Makefile: rewritten to allow more compact representation * lex-define.c: new file - defines and initializes default lexers * deflexer.c: removed (replaced with lex-define.c) * ifilter.c: added lexer initialization call * irefile.c: added lexer initialization call Sat Sep 13 00:32:35 EDT 1997 Jason Daniel Rennie ifile 0.4.5 released Mon Sep 8 00:46:40 EDT 1997 Jason Daniel Rennie * ifile_read_profile: fixed possibility of blank line in .mh_profile causing executables to dump core. Changed tokenizing to allow for ':' as a token separator. Sun Aug 31 22:50:51 EDT 1997 Jason Daniel Rennie ifile v0.4.4 released Tue Aug 26 00:02:25 EDT 1997 Ben Byer * irefile.c/main: fixed the location to check for .skip_me file. irefile previously checked in improper location. Wed Aug 13 01:15:35 EDT 1997 Jason Daniel Rennie * ifile_verbosify: removed commands which allowed indenting of messages according to priority level. ifile_free() call was somehow being called ad infinitum and causing a seg fault. * ifile.h: "#define ifile_free(x) free(x)" statement was causing neverending recursion of free() calls. #define removed. *** these changes not included in 0.4.x releases Wed Aug 13 00:44:44 EDT 1997 Jason Daniel Rennie * ifile_rate_categories: no longer use document frequencies in best category calculations * deflexer.c: new file - defines and sets the default lexer * ifile.h: now contains all header file information for all ifile C files (except for assoc_array_int.c and extendable_array.c) * int4str.c: implementation of 1-1 string->int and int->string mapping * istext.c: new file - determines whether a file is text or binary * lex-email.c: new file - lexes e-mail, removing certain headers * lex-gram.c: new file - lexes words into groups (multi-word tokens) * lex-html.c: new file - html lexer * lex-indirect.c: new file - lexer stuff * lex-simple.c: new file - simple lexers * primes.c: new file - prime number generation functions * scan.c: new file - file scanning functions * stem.c: new file - implementation of Porter stemming algorithm * stoplist.c: new file - implementation of stoplist function * stopwords.c: new file - default stoplist * stuff.c: new file - file for testing new lexing code *** these changes not included in 0.4.x releases NOTE: deflexer.c, int4str.c, istext.c, lex-*.c, scan.c, stoplist.c and stopwords.c were originally part of the libbow package and were originally written by Andrew McCallum. stem.c was originally part of the libbow package and was written by various authors (see code for credits). Fri Aug 8 22:30:18 EDT 1997 Jason Daniel Rennie ifile v0.4.3 released Tue Jul 22 00:28:13 EDT 1997 Jason Daniel Rennie * ifile_rate_categories: if list of categories is empty, sets first category as "inbox" and selects inbox (1) as best category. Eliminates seg faults in ifile_verbosify() call. v0.4.3 - knowledge_base.perl: keep separate nuking counts for entire run and each aging call - .idata file is now explicitly closed - fclose() call did not exist in earlier versions - minor changes to extendable array code - ifile_rate_categories now adds "inbox" to the mailbox listing of the mailbox listing is empty (leaving it empty would cause a seg fault in some cases) - Makefile now contains explicit linking commands (some 'make' programs will not link executables without explicit commands) - added to distribution descriptions of how to better integrate ifile into EXMH (see exmh_integration, exmh_integration2 and filter_button) v0.4.2 - minor changes to install.perl script - news2mail.perl added to distribution (search for 'news2mail' in README file for some explaination) - .idata file locking introduced into system. ifile programs are synched via lock files so that none will ever read or write a corrupted .idata file (not implemented in all executables yet) - new version of "knowledge_base.perl". Does age updates periodically to lessen processor overhead. Includes commented out lines for attaching associative arrays to disk (primarily useful if you have a very large corpus of e-mail and a large number of mailbox folders). - irefile no longer learns on messages which are refiled to folders which contain a .skip_me file (synchronizes behavior with knowledge_base.perl) - primitive code aiming toward alternate style refile included in distribution. Search for 'irefile queue' in README file for more info. - cutoff frequency for eliminating words from .idata now done using a log scale (previously used a constant). [- modularized idata writing] v0.4.1 - moved opening of log file to top of ifilter.c to prevent seg fault when argc > 1 - previouslly while reading a message, ifile would reset as_nk value of any word/category it came across (essentially drilling holes in the .idata file). This has been fixed. - to allow a smoother transition between lexing styles, each Subject:, From: word is now lexed into two words, one with the prefix and one without. (the duplication will be eliminated in the near future) v0.4.0 - removed 'make clean' command from install.perl so that the user can make his/her own executables and then use install.perl to install them - fixed problem with opening of log file. Program previously tried to use entire argv[0] as part of the log file path. Now uses only executable name. - because a portion of argv[0] is used to name the .info files, the irefile .info file will most likely appear as "/tmp/refile.info" - renaming of some variables - main ifilter program modularized. - corresponding parts of irefile modularized. - ifilter now only reads sections of .idata which it needs to classify the message it is given (greatly increases efficiency) ^^^ Good stuff - ifilter is quite a bit faster and less of a memory hog :) - invariants removed from "category rating" loop to promote efficiency - the UPGRADE file has been removed from distribution (due to lack of utility) - the convert.perl file has been removed from the distribution (you should instead use knowledge_base.perl to recreate your .idata file) - message headers, "From:" and "Subject:", are now treated specially during lexing. [- machine names and e-mail addresses are now lexed as one word and are no longer broken to pieces.] v0.3.3 - loop variable initialization bugfixes - rewrite of mh_refile function (hopefully eliminating strange string bugs/random seg faults) --> thanks to Colin McCormack for the suggestion! - fixed logical AND (&&) to bitwise AND (&) in refile_exe function (doh!) - some clean-up of code - code is more modular - added ifile_sprintf() and ifile_cats() to aid in string handling Any programmers who have deal with strings in C should love these :) - added error.c for message printing and error handling - modularized printing of progress and error messages - added ifile.c to hold library of ifile functions - converted readline() to a function (from a #define) and in doing so introduced (but shortly thereafter fixed) a bug - ifile now adds a header to filtered messages "X-filter: ifile v0.3.3" v0.3.2 - included errno.h in irefile.c (required by SunOS v5.5.1/gcc-2.7.2) - eliminated strerror() function from code. Function is unnecessary and SunOS 4.1.3/gcc-2.7.2 produces undefined references to 'strerror' during compilation. This seemed to be the only easy fix. - eliminated problem with 'make' putting -lm (math library) option at the beginning of the line v0.3.1 - install.perl links to 'irefile' instead of 'refile', like it should v0.3.0 - C implementation of ifilter. Incredible speed improvements (see chart below) - C implementation of irefile. Significant increase in speed (see chart below). Not quite as extreme as ifilter. irefile heavily depends on (slow) associative arrays for writing the .idata file - Both programs are much more memory conscious (see chart below). - Full support for all MH refile options. I think I finally have full support for all the options. Please tell me if I don't! - irefile will use 'cur' message and current folder if no message/source folder is given - message headers (subject, from) NOT given extra weight (this will probably be reversed in the future) - install program does not affect location of ifilter entry in .maildelivery filter, simply changes ifilter path My own experiences on my i586 100Mhz Linux box (48 megs ram) 202k .idata file, 39 folders, 5061 words time/memory comsumption to filter/refile a single 2k message processor time memory usage perl irefile 20 sec 5.1 Meg C irefile 7.5 sec 2.2 Meg perl ifilter 10 sec 4.7 Meg C ifilter 1.5 sec 2.0 Meg v0.2.5 - ifile now properly addresses the '-file' option [mostly] - knowledge_base.perl is more memory conscious - resets .idata_accuracy file if accuracy goes negative - irefile would previously refile all messages after it read in the first of any batch. It now waits to refile after all messages are read in. - uses context file to get the current-folder when no source file is indicated in the calling of irefile [this is actually incorrect] - ifilter will not filter messages into a folder with a .skip_me file - finding PWD was made slightly more robust v0.2.4 - irefile no longer mistakes MH refile options for file names - allows for more flexibility in reading of .mh_profile - passing '-help' to ifilter or irefile will print usage v0.2.3 - script included to create knowledge database according to where mail is currently located (knowledge_base.perl). - message headers (subject, from) given extra weight v0.2.2 - if original MH refile program is available as refile.bak, ifile will use MH refile program to move the message (increases compatibility) - keeps track of number of filters and number of refilings for approximate - /tmp/ifilter.info now contains lots of info about ifile's filtering decisions v0.2.1 - handling of multi-level folders (sub-folders) - refiled messages no longer appear as new messages - refiling to folder which message comes from does not destroy message - protections set up to restore original message if refile is not performed correctly v0.2.0 - fixes problems concerning strange folder names - more concise data file - provides quicker filtering and refiling - keeps track of number of messages filtered and number of messages refiled - looks at .folders to determine folder names, rather than directory structure - keeps data file streamlined by eliminating infrequent words - records 'words' of length 3 (previously required length of 4 or greater) v0.1.2 - Fixed problem of not allowing user to indicate directory of the rmm binary - Installation program changed to search for binaries in common directories before asking user (provides easier installation) v0.1.1 - Coordinated naming of main data file - '.idata' - Installation program allows customization of binary directories (previously, program made assumptions as to locations of mh binaries) $Id: ChangeLog,v 1.24 2004/12/12 19:10:46 jrennie Exp $ ifile-1.3.9/test.sh0000755000175000017500000000160311306214407013136 0ustar jasonjason#!/bin/sh ./configure --prefix=/tmp &> /dev/null make &> /dev/null make install &> /dev/null if [ -f /tmp/man/man1/ifile.1 ]; then echo ok 1; else echo not ok 1; fi ./configure --prefix=/tmp --exec-prefix=/tmp/linux &> /dev/null make &> /dev/null make install &> /dev/null if [ -f /tmp/linux/bin/ifile ]; then echo ok 2; else echo not ok 2; fi ./configure --bindir=/tmp/foobin --mandir=/tmp/fooman &> /dev/null make &> /dev/null make install &> /dev/null if [ -f /tmp/foobin/ifile ]; then echo ok 3; else echo not ok 3; fi if [ -f /tmp/foobin/ifilter.mh ]; then echo ok 4; else echo not ok 4; fi if [ -f /tmp/foobin/irefile.mh ]; then echo ok 5; else echo not ok 5; fi if [ -f /tmp/foobin/knowledge_base.mh ]; then echo ok 6; else echo not ok 6; fi if [ -f /tmp/foobin/news2mail ]; then echo ok 7; else echo not ok 7; fi if [ -f /tmp/fooman/man1/ifile.1 ]; then echo ok 8; else echo not ok 8; fi ifile-1.3.9/README0000644000175000017500000000246511306214407012507 0ustar jasonjason fffff lll fff ff lll iii fff fff iii lll iii fff iii lll fffffff lll eeeeee iiii fff iiii lll eee ee iii fff iii lll eeeeeeee iii fff iii lll eee iiiii fffff iiiii lllll eeeeee ifile is Copyright (C) 1996-2002 Jason D. M. Rennie Copying information: read the COPYING file. Installation information: read the INSTALL file. History information: read the ChangeLog and NOTES files. Web site: http://people.csail.mit.edu/jrennie/ifile/ The web site contans information on how to adapt ifile to many different e-mail clients. ifile is a general mail filtering system which uses a modern-day text learning algorithm to intelligently filter mail according to the way the user tends to organize mail. ifile is different from other mail filtering programs in three major ways: 1. ifile does not require the user to generate a set of rules in order to successfully filter mail 2. ifile uses the entire content of messages for filtering purposes 3. ifile learns as the user moves incorrectly filtered messages to new mailboxes ifile is not dependent upon any specific mail system and should be adaptable to any system which allows an outside program to perform mail filtering. $Id: README,v 1.4 2002/11/07 11:46:52 jrennie Exp $ ifile-1.3.9/install-sh0000755000175000017500000000421211306214407013623 0ustar jasonjason#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5; it is not part of GNU. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # This script is compatible with the BSD install script, but was written # from scratch. # # 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}" instcmd="$cpprog" chmodcmd="" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" 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;; *) if [ x"$src" = x ] then src=$1 else dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 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` fi # Make a temp file name in the proper directory. dstdir=`dirname $dst` dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp # and set any options; do chmod last to preserve setuid bits if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi # Now rename the file to the real destination. $doit $rmcmd $dst $doit $mvcmd $dsttmp $dst exit 0 ifile-1.3.9/INSTALL0000644000175000017500000000142211306214407012650 0ustar jasonjasonTo install the ifile executables and the ifile man page in the default place, run: ./configure gmake install If your "make" executable is GNU make, you should substitute "make" for "gmake". The configure script takes a number of options. Run "./configure --help" to see a list. A popular option is --prefix=/install/path which allows you to specify where you would like ifile to be installed (default is /usr/local). After installation, "ifile --version" should report the version of ifile that you just installed. This package installs two files: ifile - the main executable ifile.1 - the manual page Read the tutorial, http://people.csail.mit.edu/jrennie/ifile/tutorial.html for an introduction to using ifile. $Id: INSTALL,v 1.3 2002/11/02 21:10:54 jrennie Exp $ ifile-1.3.9/argp/0000775000175000017500000000000011306214407012553 5ustar jasonjasonifile-1.3.9/argp/argp-fmtstream.c0000644000175000017500000002513411306214407015653 0ustar jasonjason/* Word-wrapping and line-truncating streams Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This package emulates glibc `line_wrap_stream' semantics for systems that don't have that. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include "argp-fmtstream.h" #include "argp-namefrob.h" #if !HAVE_MEMMOVE void bcopy(); #define memmove(dest,src,n) bcopy(src,dest,n) #endif #ifndef ARGP_FMTSTREAM_USE_LINEWRAP #ifndef isblank #define isblank(ch) ((ch)==' ' || (ch)=='\t') #endif #define INIT_BUF_SIZE 200 #if HAVE_VSNPRINTF #define PRINTF_SIZE_GUESS 150 #else #define PRINTF_SIZE_GUESS 2048 #endif /* HAVE_VSNPRINTF */ /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines written on it with LMARGIN spaces and limits them to RMARGIN columns total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by replacing the whitespace before them with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are simply dropped until a newline. Returns NULL if there was an error. */ argp_fmtstream_t __argp_make_fmtstream (FILE *stream, size_t lmargin, size_t rmargin, ssize_t wmargin) { argp_fmtstream_t fs = malloc (sizeof (struct argp_fmtstream)); if (fs) { fs->stream = stream; fs->lmargin = lmargin; fs->rmargin = rmargin; fs->wmargin = wmargin; fs->point_col = 0; fs->point_offs = 0; fs->buf = malloc (INIT_BUF_SIZE); if (! fs->buf) { free (fs); fs = 0; } else { fs->p = fs->buf; fs->end = fs->buf + INIT_BUF_SIZE; } } return fs; } #ifdef weak_alias weak_alias (__argp_make_fmtstream, argp_make_fmtstream) #endif /* Flush FS to its stream, and free it (but don't close the stream). */ void __argp_fmtstream_free (argp_fmtstream_t fs) { __argp_fmtstream_update (fs); if (fs->p > fs->buf) fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream); free (fs->buf); free (fs); } #ifdef weak_alias weak_alias (__argp_fmtstream_free, argp_fmtstream_free) #endif /* Process FS's buffer so that line wrapping is done from POINT_OFFS to the end of its buffer. This code is mostly from glibc stdio/linewrap.c. */ void __argp_fmtstream_update (argp_fmtstream_t fs) { char *buf, *nl; size_t len; /* Scan the buffer for newlines. */ buf = fs->buf + fs->point_offs; while (buf < fs->p) { size_t r; if (fs->point_col == 0 && fs->lmargin != 0) { /* We are starting a new line. Print spaces to the left margin. */ const size_t pad = fs->lmargin; if (fs->p + pad < fs->end) { /* We can fit in them in the buffer by moving the buffer text up and filling in the beginning. */ memmove (buf + pad, buf, fs->p - buf); fs->p += pad; /* Compensate for bigger buffer. */ memset (buf, ' ', pad); /* Fill in the spaces. */ buf += pad; /* Don't bother searching them. */ } else { /* No buffer space for spaces. Must flush. */ size_t i; for (i = 0; i < pad; i++) putc (' ', fs->stream); } fs->point_col = pad; } len = fs->p - buf; nl = memchr (buf, '\n', len); if (fs->point_col < 0) fs->point_col = 0; if (!nl) { /* The buffer ends in a partial line. */ if (fs->point_col + len < fs->rmargin) { /* The remaining buffer text is a partial line and fits within the maximum line width. Advance point for the characters to be written and stop scanning. */ fs->point_col += len; break; } else /* Set the end-of-line pointer for the code below to the end of the buffer. */ nl = fs->p; } else if (fs->point_col + (nl - buf) < fs->rmargin) { /* The buffer contains a full line that fits within the maximum line width. Reset point and scan the next line. */ fs->point_col = 0; buf = nl + 1; continue; } /* This line is too long. */ r = fs->rmargin - 1; if (fs->wmargin < 0) { /* Truncate the line by overwriting the excess with the newline and anything after it in the buffer. */ if (nl < fs->p) { memmove (buf + (r - fs->point_col), nl, fs->p - nl); fs->p -= buf + (r - fs->point_col) - nl; /* Reset point for the next line and start scanning it. */ fs->point_col = 0; buf += r + 1; /* Skip full line plus \n. */ } else { /* The buffer ends with a partial line that is beyond the maximum line width. Advance point for the characters written, and discard those past the max from the buffer. */ fs->point_col += len; fs->p -= fs->point_col - r; break; } } else { /* Do word wrap. Go to the column just past the maximum line width and scan back for the beginning of the word there. Then insert a line break. */ char *p, *nextline; int i; p = buf + (r + 1 - fs->point_col); while (p >= buf && !isblank (*p)) --p; nextline = p + 1; /* This will begin the next line. */ if (nextline > buf) { /* Swallow separating blanks. */ if (p > buf) do --p; while (p > buf && isblank (*p)); nl = p + 1; /* The newline will replace the first blank. */ } else { /* A single word that is greater than the maximum line width. Oh well. Put it on an overlong line by itself. */ p = buf + (r + 1 - fs->point_col); /* Find the end of the long word. */ do ++p; while (p < nl && !isblank (*p)); if (p == nl) { /* It already ends a line. No fussing required. */ fs->point_col = 0; buf = nl + 1; continue; } /* We will move the newline to replace the first blank. */ nl = p; /* Swallow separating blanks. */ do ++p; while (isblank (*p)); /* The next line will start here. */ nextline = p; } /* Note: There are a bunch of tests below for NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall at the end of the buffer, and NEXTLINE is in fact empty (and so we need not be careful to maintain its contents). */ if (nextline == buf + len + 1 ? fs->end - nl < fs->wmargin + 1 : nextline - (nl + 1) < fs->wmargin) /* The margin needs more blanks than we removed. */ if (fs->end - fs->p > fs->wmargin + 1) /* Make some space for them. */ { size_t mv = fs->p - nextline; memmove (nl + 1 + fs->wmargin, nextline, mv); nextline = nl + 1 + fs->wmargin; len = nextline + mv - buf; *nl++ = '\n'; } else /* Output the first line so we can use the space. */ { if (nl > fs->buf) fwrite (fs->buf, 1, nl - fs->buf, fs->stream); putc ('\n', fs->stream); len += buf - fs->buf; nl = buf = fs->buf; } else /* We can fit the newline and blanks in before the next word. */ *nl++ = '\n'; if (nextline - nl >= fs->wmargin || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin)) /* Add blanks up to the wrap margin column. */ for (i = 0; i < fs->wmargin; ++i) *nl++ = ' '; else for (i = 0; i < fs->wmargin; ++i) putc (' ', fs->stream); /* Copy the tail of the original buffer into the current buffer position. */ if (nl < nextline) memmove (nl, nextline, buf + len - nextline); len -= nextline - buf; /* Continue the scan on the remaining lines in the buffer. */ buf = nl; /* Restore bufp to include all the remaining text. */ fs->p = nl + len; /* Reset the counter of what has been output this line. If wmargin is 0, we want to avoid the lmargin getting added, so we set point_col to a magic value of -1 in that case. */ fs->point_col = fs->wmargin ? fs->wmargin : -1; } } /* Remember that we've scanned as far as the end of the buffer. */ fs->point_offs = fs->p - fs->buf; } /* Ensure that FS has space for AMOUNT more bytes in its buffer, either by growing the buffer, or by flushing it. True is returned iff we succeed. */ int __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount) { if (fs->end - fs->p < amount) { ssize_t wrote; /* Flush FS's buffer. */ __argp_fmtstream_update (fs); wrote = fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream); if (wrote == fs->p - fs->buf) { fs->p = fs->buf; fs->point_offs = 0; } else { fs->p -= wrote; fs->point_offs -= wrote; memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf); return 0; } if (fs->end - fs->buf < amount) /* Gotta grow the buffer. */ { size_t new_size = fs->end - fs->buf + amount; char *new_buf = realloc (fs->buf, new_size); if (! new_buf) { __set_errno (ENOMEM); return 0; } fs->buf = new_buf; fs->end = new_buf + new_size; fs->p = fs->buf; } } return 1; } ssize_t __argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...) { size_t out; size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */ do { va_list args; if (! __argp_fmtstream_ensure (fs, size_guess)) return -1; size_guess += size_guess; va_start (args, fmt); #if HAVE_VSNPRINTF out = __vsnprintf (fs->p, fs->end - fs->p, fmt, args); #else #if VSPRINTF_RETURNS_INT out = vsprintf (fs->p, fmt, args); #else { char *s = (char*) vsprintf (fs->p, fmt, args); out = strlen (s); } #endif /* VSPRINTF_RETURNS_INT */ assert (out < fs->end - fs->p); #endif /* HAVE_VSNPRINTF */ va_end (args); } while (out == -1); fs->p += out; return out; } #ifdef weak_alias weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf) #endif #endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */ ifile-1.3.9/argp/ChangeLog0000644000175000017500000001430111306214407014322 0ustar jasonjason2004-12-11 Derek Peschel * configure.in: Handle systems (like NetBSD 1.5) with getopt_long, without getopt_long_only. 2002-10-16 Jason Rennie * argp-help.c, strndup.c: remove #include 2002-09-11 Jason Rennie * configure.in: new file * configure.in: add --with-dmalloc option, check for dmalloc lib * Makefile.in (DIST_FILES): add configure.in Wed Dec 2 19:06:38 EST 1998 Jason Daniel Rennie * Makefile.in: make snap work Tue Mar 31 13:38:56 EST 1998 Jason Daniel Rennie * Makefile.in: added $(srcdir) in copy of argp.h to include dir. Wed Feb 18 17:10:27 EST 1998 Valdis Kletnieks * argp.h, argp-fmtstream.h, getopt.c: added #ifndefs to check for CONSTRUCTOR_FAILS definition * argp-help.c, argp-parse.c: Added "#pragma alloca" for AIX systems. Required to get alloca() to work right on AIX systems. * argp-help.c: AIX doesn't allow initializing a struc from the parameter list, struct pentry_State pest definition/assignment modified. * argp-parse.c: Added casts to parser_init code Wed Feb 18 01:50:51 EST 1998 Jason Daniel Rennie * Makefile.in: removed dependencies on configure, removed configure from maintainer-clean build. configure.in removed from distribution. Tue Apr 29 12:58:05 1997 Andrew McCallum * Makefile.in (DIST_FILES): Add $(ARGP_GETOPT_C_FILES) and $(ARGP_CHECK_C_FILES). Wed Apr 9 11:31:49 1997 Andrew McCallum * configure.in: Add -O to the default CFLAGS. Tue Apr 8 13:14:55 1997 Andrew McCallum * Makefile.in (DIST_FILES): Add argp-fmtstream.h and argp-namefrob.h. Mon Mar 31 12:03:57 1997 Andrew McCallum * Makefile.in (configure, config.status): Sprinkle with $(srcdir). * configure.in: Move the setting of CFLAGS above AC_PROC_CC, so that it will have an effect. * configure.in: Do AC_SUBST() for CPPFLAGS and CFLAGS. * Makefile.in (CFLAGS): Set it in configure. (CPPFLAGS): Likewise, and don't put $(DEFS) here; its already in ALL_CPPFLAGS. Tue Mar 25 13:10:59 1997 Andrew McCallum * configure.in: Fix typo. * argp-parse.c (__argp_parse): Set PROGRAM_INVOCATION_NAME and PROGRAM_INVOCATION_SHORT_NAME if the system doesn't. * argp.h: Include . (__option_is_short): Make sure __KEY is less than UCHAR_MAX before passing it to ISPRINT(). On SunOS ISPRINT() uses a lookup-table of limited size. * argp-ex4.c: Don't include ; it doesn't appear on my RedHat system. (main): Use fprintf() and abort() instead of error(). * getopt.c: Include (for strncmp()). * configure.in: Check for the `ssize_t' type. Tue Mar 25 15:15:53 1997 Andrew McCallum * configure.in: Check for memmove, vsnprintf, sterror, . If we don't have vsnprintf(), check to see if vsprintf() returns an int or a char*. * argp-help.c: Include if we have it. strcasecmp() is defined there on SunOS. (canon_doc_option): As ISSPACE(**NAME), not ISSPACE(*NAME). Likewise with ISALNUM(). (__argp_failure): Use work around if we don'thave STRERROR(). * argp-fmtstream.c: Include . Define memmove() with bcopy() if we don't have memmove(). Define PRINTF_SIZE_GUESS to be larger if we don't have vsnprintf(). (__argp_fmtstream_printf): Implement vsnprintf() in terms of vsprintf() if we don't have vsnprintf(). Fri Mar 14 10:15:00 1997 Andrew McCallum * Makefile.in (snap): New target. * Makefile.in (ARGP_C_FILES): Add new files from argp-x10. (ARGP_CHECK_C_FILES): New variable. (ARGP_CHECK_O_FILES): New variable. (ARGP_CHECK_PROGRAMS): New variable. (ALL_CPPFLAGS, ALL_CFLAGS): New variables. (.c.o): New pattern rule, using above two variables. (checks, $(ARGP_CHECK_PROGRAMS)): New targets. * argp.h: Declare extern program_invocation_name and program_invocation_short_name if configure didn't find them. * configure.in: Check for strndup and program_invocation_name. * pin.c: New file. * All files updated from Miles Bader's argp-x10 release from ftp://alpha.gnu.ai.mit.edu/gnu/. Tue Feb 4 13:14:01 1997 Andrew McCallum * Makefile.in (scmdir): Variable removed. Mon Feb 3 14:03:56 1997 Andrew McCallum * argp1.h: Include both and , even though they may conflict on some systems. Resolve issues of alternate string functions, like rindex(). * configure.in: Check for ANSI/non-ANSI string functions. * Makefile.in (DIST_FILES): Add argp1.h. * argp-help.c: Include "argp1.h". (argp_failure): Deal if we don't HAVE_STRERROR. * argp-parse.c: Include "argp1.h". * configure.in: Look for strerror(). Provide getopt_long() if the host system doesn't have it. * Makefile.in (CPPFLAGS): Add $(DEFS). (ARGP_GETOPT_C_FILES, ARGP_GETOPT_O_FILES): New variables. (libargp.a): Depend on @ARGP_GETOPT_O_FILES@, which is set by configure if getopt_long isn't found. (DIST_FILES): Add getopt.h. (clean): Also remove tester. (tester): Depend on libargp.a. * argp.h: Include "getopt.h" if we don't HAVE_GETOPT_H. * configure.in: Look for getopt_long, and cause libargp to include it if it isn't found. * getopt.c, getopt1.c, getopt.h: New files. * tester.c: Remove some unused variables, and prevent other warnings. Thu Jan 30 10:26:34 1997 Andrew McCallum * argp.h: Include . * argp-parse.c: Don't include . * argp-help.c: Don't use //-style comments. * argp.h: Only include if we have it. * configure.in: Check for getopt.h. * argp-help.c (hol_entry_help): Since the DOC string doesn't properly start on the same line as the options, and doesn't indent properly, indent it by 3 spaces here. * argp-help.c (make_hol): Set HOL->CLUSTERS and HOL->SHORT_OPTIONS to zero, so we don't crash when the program is given no command-line arguments. Wed Jan 29 14:21:52 1997 Andrew McCallum Comment-out and massage many sections that use the `linewrap' functions (which are only found in GNU libc). Remove other dependancies on GNU libc. ifile-1.3.9/argp/README0000644000175000017500000000076111306214407013435 0ustar jasonjasonThis is Andrew McCallum's modification of Miles Bader's `argp' functions. `argp' is a collection of functions in GNU libc 2.x that provides powerful command-line argument processing and automated usage message printing. Andrew McCallum modified it by pulling it out into a separate library, and removing its dependancies on GNU libc. The result doesn't produce usage messages that are nearly as pretty, but at least it compiles on SunOS and other OS's with inferior libc's. ifile-1.3.9/argp/install-sh0000755000175000017500000000421211306214407014554 0ustar jasonjason#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5; it is not part of GNU. # # $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ # # This script is compatible with the BSD install script, but was written # from scratch. # # 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}" instcmd="$cpprog" chmodcmd="" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" 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;; *) if [ x"$src" = x ] then src=$1 else dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 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` fi # Make a temp file name in the proper directory. dstdir=`dirname $dst` dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp # and set any options; do chmod last to preserve setuid bits if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi # Now rename the file to the real destination. $doit $rmcmd $dst $doit $mvcmd $dsttmp $dst exit 0 ifile-1.3.9/argp/getopt.c0000644000175000017500000007014511306214407014226 0ustar jasonjason/* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #ifdef HAVE_CONFIG_H #include #endif #if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 1 #if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #include #endif /* GNU C library. */ #ifdef VMS #include #if HAVE_STRING_H - 0 #include #endif #endif #if defined (WIN32) && !defined (__CYGWIN32__) /* It's not Unix, really. See? Capital letters. */ #include #define getpid() GetCurrentProcessId() #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ #ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) #else # define _(msgid) (msgid) #endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return EOF with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #else /* Avoid depending on library functions or files whose names are inconsistent. */ char *getenv (); static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ #if !defined (__STDC__) || !__STDC__ /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); #endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ static const char *nonoption_flags; static int nonoption_flags_len; static int original_argc; static char *const *original_argv; /* Make sure the environment variable bash 2.0 puts in the environment is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ #ifndef CONSTRUCTOR_FAILS static void store_args (int argc, char *const *argv) __attribute__ ((unused)); #endif static void store_args (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ original_argc = argc; original_argv = argv; } text_set_element (__libc_subinit, store_args); #endif /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined (__STDC__) && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined (__STDC__) && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind = 1; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #ifdef _LIBC if (posixly_correct == NULL && argc == original_argc && argv == original_argv) { /* Bash 2.0 puts a special variable in the environment for each command it runs, specifying which ARGV elements are the results of file name wildcard expansion and therefore should not be considered as options. */ char var[100]; sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); nonoption_flags = getenv (var); if (nonoption_flags == NULL) nonoption_flags_len = 0; else nonoption_flags_len = strlen (nonoption_flags); } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns `EOF'. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (!__getopt_initialized || optind == 0) { optstring = _getopt_initialize (argc, argv, optstring); optind = 1; /* Don't scan ARGV[0], the program name. */ __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && nonoption_flags[optind] == '1')) #else #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return EOF; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return EOF; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == EOF) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ ifile-1.3.9/argp/INSTALL0000644000175000017500000000012611306214407013601 0ustar jasonjasonThis should do the trick: ./configure --prefix=/usr/local make make install ifile-1.3.9/argp/pin.c0000644000175000017500000000045311306214407013505 0ustar jasonjason/* Declaration of program_invocation_name and program_invocation_short_name for those libc's that don't already have it. These variable are needed by the argp_ functions. */ #if !HAVE_PROGRAM_INVOCATION_NAME char *program_invocation_short_name = 0; char *program_invocation_name = 0; #endif ifile-1.3.9/argp/getopt.h0000644000175000017500000001112711306214407014226 0ustar jasonjason/* Declarations for getopt. Copyright (C) 1989, 90, 91, 92, 93, 94, 96 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 #ifdef __cplusplus extern "C" { #endif /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ extern char *optarg; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ extern int optind; /* Callers store zero here to inhibit the error message `getopt' prints for unrecognized options. */ extern int opterr; /* Set to an option character which was unrecognized. */ extern int optopt; /* Describe the long-named options requested by the application. The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero. The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument. If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found. To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ struct option { #if defined (__STDC__) && __STDC__ const char *name; #else char *name; #endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; int *flag; int val; }; /* Names for the values of the `has_arg' field of `struct option'. */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 #if defined (__STDC__) && __STDC__ #ifdef __GNU_LIBRARY__ /* Many other libraries have conflicting prototypes for getopt, with differences in the consts, in stdlib.h. To avoid compilation errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *shortopts); #else /* not __GNU_LIBRARY__ */ extern int getopt (); #endif /* __GNU_LIBRARY__ */ extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); /* Internal only. Users should not call this directly. */ extern int _getopt_internal (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind, int long_only); #else /* not __STDC__ */ extern int getopt (); extern int getopt_long (); extern int getopt_long_only (); extern int _getopt_internal (); #endif /* __STDC__ */ #ifdef __cplusplus } #endif #endif /* _GETOPT_H */ ifile-1.3.9/argp/argp-test.c0000644000175000017500000001276311306214407014634 0ustar jasonjason/* Test program for argp argument parser Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include const char *argp_program_version = "argp-test 1.0"; struct argp_option sub_options[] = { {"subopt1", 's', 0, 0, "Nested option 1"}, {"subopt2", 'S', 0, 0, "Nested option 2"}, { 0, 0, 0, 0, "Some more nested options:", 10}, {"subopt3", 'p', 0, 0, "Nested option 3"}, {"subopt4", 'q', 0, 0, "Nested option 4", 1}, {0} }; static const char sub_args_doc[] = "STRING...\n-"; static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser."; static error_t sub_parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case ARGP_KEY_NO_ARGS: printf ("NO SUB ARGS\n"); break; case ARGP_KEY_ARG: printf ("SUB ARG: %s\n", arg); break; case 's' : case 'S': case 'p': case 'q': printf ("SUB KEY %c\n", key); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static char * sub_help_filter (int key, const char *text, void *input) { if (key == ARGP_KEY_HELP_EXTRA) return strdup ("This is some extra text from the sub parser (note that it \ is preceded by a blank line)."); else return (char *)text; } static struct argp sub_argp = { sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter }; /* Structure used to communicate with the parsing functions. */ struct params { unsigned foonly; /* Value parsed for foonly. */ unsigned foonly_default; /* Default value for it. */ }; #define OPT_PGRP 1 #define OPT_SESS 2 struct argp_option options[] = { {"pid", 'p', "PID", 0, "List the process PID"}, {"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"}, {"no-parent", 'P', 0, 0, "Include processes without parents"}, {0, 'x', 0, OPTION_ALIAS}, {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" " if there's some reason ps can't" " print a field for any process, it's" " removed from the output entirely)" }, {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, {"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL, "Add the processes from the session" " SID (which defaults to the sid of" " the current process)" }, {0,0,0,0, "Here are some more options:"}, {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"}, {"zaza", 'z', 0, 0, "Snit a zar"}, {0} }; static const char args_doc[] = "STRING"; static const char doc[] = "Test program for argp." "\vThis doc string comes after the options." "\nHey! Some manual formatting!" "\nThe current time is: %s"; static void popt (int key, char *arg) { char buf[10]; if (isprint (key)) sprintf (buf, "%c", key); else sprintf (buf, "%d", key); if (arg) printf ("KEY %s: %s\n", buf, arg); else printf ("KEY %s\n", buf); } static error_t parse_opt (int key, char *arg, struct argp_state *state) { struct params *params = state->input; switch (key) { case ARGP_KEY_NO_ARGS: printf ("NO ARGS\n"); break; case ARGP_KEY_ARG: if (state->arg_num > 0) return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */ printf ("ARG: %s\n", arg); break; case 'f': if (arg) params->foonly = atoi (arg); else params->foonly = params->foonly_default; popt (key, arg); break; case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q': case 'r': case OPT_SESS: case 'z': popt (key, arg); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static char * help_filter (int key, const char *text, void *input) { char *new_text; struct params *params = input; if (key == ARGP_KEY_HELP_POST_DOC && text) { time_t now = time (0); asprintf (&new_text, text, ctime (&now)); } else if (key == 'f') /* Show the default for the --foonly option. */ asprintf (&new_text, "%s (ZOT defaults to %x)", text, params->foonly_default); else new_text = (char *)text; return new_text; } static struct argp_child argp_children[] = { { &sub_argp }, { 0 } }; static struct argp argp = { options, parse_opt, args_doc, doc, argp_children, help_filter }; int main (int argc, char **argv) { struct params params; params.foonly = 0; params.foonly_default = random (); argp_parse (&argp, argc, argv, 0, 0, ¶ms); printf ("After parsing: foonly = %x\n", params.foonly); return 0; } ifile-1.3.9/argp/argp-fmtstream.h0000644000175000017500000002452011306214407015656 0ustar jasonjason/* Word-wrapping and line-truncating streams. Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This package emulates glibc `line_wrap_stream' semantics for systems that don't have that. If the system does have it, it is just a wrapper for that. This header file is only used internally while compiling argp, and shouldn't be installed. */ #ifndef __ARGP_FMTSTREAM_H__ #define __ARGP_FMTSTREAM_H__ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \ || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H)) /* line_wrap_stream is available, so use that. */ #define ARGP_FMTSTREAM_USE_LINEWRAP #endif #ifdef ARGP_FMTSTREAM_USE_LINEWRAP /* Just be a simple wrapper for line_wrap_stream; the semantics are *slightly* different, as line_wrap_stream doesn't actually make a new object, it just modifies the given stream (reversibly) to do line-wrapping. Since we control who uses this code, it doesn't matter. */ #include typedef FILE *argp_fmtstream_t; #define argp_make_fmtstream line_wrap_stream #define __argp_make_fmtstream line_wrap_stream #define argp_fmtstream_free line_unwrap_stream #define __argp_fmtstream_free line_unwrap_stream #define __argp_fmtstream_putc(fs,ch) putc(ch,fs) #define argp_fmtstream_putc(fs,ch) putc(ch,fs) #define __argp_fmtstream_puts(fs,str) fputs(str,fs) #define argp_fmtstream_puts(fs,str) fputs(str,fs) #define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) #define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs) #define __argp_fmtstream_printf fprintf #define argp_fmtstream_printf fprintf #define __argp_fmtstream_lmargin line_wrap_lmargin #define argp_fmtstream_lmargin line_wrap_lmargin #define __argp_fmtstream_set_lmargin line_wrap_set_lmargin #define argp_fmtstream_set_lmargin line_wrap_set_lmargin #define __argp_fmtstream_rmargin line_wrap_rmargin #define argp_fmtstream_rmargin line_wrap_rmargin #define __argp_fmtstream_set_rmargin line_wrap_set_rmargin #define argp_fmtstream_set_rmargin line_wrap_set_rmargin #define __argp_fmtstream_wmargin line_wrap_wmargin #define argp_fmtstream_wmargin line_wrap_wmargin #define __argp_fmtstream_set_wmargin line_wrap_set_wmargin #define argp_fmtstream_set_wmargin line_wrap_set_wmargin #define __argp_fmtstream_point line_wrap_point #define argp_fmtstream_point line_wrap_point #else /* !ARGP_FMTSTREAM_USE_LINEWRAP */ /* Guess we have to define our own version. */ #ifndef __const #define __const const #endif struct argp_fmtstream { FILE *stream; /* The stream we're outputting to. */ size_t lmargin, rmargin; /* Left and right margins. */ ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */ /* Point in buffer to which we've processed for wrapping, but not output. */ size_t point_offs; /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */ ssize_t point_col; char *buf; /* Output buffer. */ char *p; /* Current end of text in BUF. */ char *end; /* Absolute end of BUF. */ }; typedef struct argp_fmtstream *argp_fmtstream_t; /* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines written on it with LMARGIN spaces and limits them to RMARGIN columns total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by replacing the whitespace before them with a newline and WMARGIN spaces. Otherwise, chars beyond RMARGIN are simply dropped until a newline. Returns NULL if there was an error. */ extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream, size_t __lmargin, size_t __rmargin, ssize_t __wmargin); extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream, size_t __lmargin, size_t __rmargin, ssize_t __wmargin); /* Flush __FS to its stream, and free it (but don't close the stream). */ extern void __argp_fmtstream_free (argp_fmtstream_t __fs); extern void argp_fmtstream_free (argp_fmtstream_t __fs); extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs, __const char *__fmt, ...) #ifndef CONSTRUCTOR_FAILS __attribute__ ((__format__ (printf, 2, 3))); #else ; #endif extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs, __const char *__fmt, ...) #ifndef CONSTRUCTOR_FAILS __attribute__ ((__format__ (printf, 2, 3))); #else ; #endif extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch); extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str); extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs, __const char *__str, size_t __len); extern size_t argp_fmtstream_write (argp_fmtstream_t __fs, __const char *__str, size_t __len); /* Access macros for various bits of state. */ #define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin) #define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin) #define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin) #define __argp_fmtstream_lmargin argp_fmtstream_lmargin #define __argp_fmtstream_rmargin argp_fmtstream_rmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin /* Set __FS's left margin to LMARGIN and return the old value. */ extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin); extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin); /* Set __FS's right margin to __RMARGIN and return the old value. */ extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin); extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin); /* Set __FS's wrap margin to __WMARGIN and return the old value. */ extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin); extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin); /* Return the column number of the current output point in __FS. */ extern size_t argp_fmtstream_point (argp_fmtstream_t __fs); extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs); /* Internal routines. */ extern void _argp_fmtstream_update (argp_fmtstream_t __fs); extern void __argp_fmtstream_update (argp_fmtstream_t __fs); extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount); #ifdef __OPTIMIZE__ /* Inline versions of above routines. */ #if !_LIBC #define __argp_fmtstream_putc argp_fmtstream_putc #define __argp_fmtstream_puts argp_fmtstream_puts #define __argp_fmtstream_write argp_fmtstream_write #define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin #define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin #define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin #define __argp_fmtstream_point argp_fmtstream_point #define __argp_fmtstream_update _argp_fmtstream_update #define __argp_fmtstream_ensure _argp_fmtstream_ensure #endif #ifndef ARGP_FS_EI #define ARGP_FS_EI extern inline #endif ARGP_FS_EI size_t __argp_fmtstream_write (argp_fmtstream_t __fs, __const char *__str, size_t __len) { if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len)) { memcpy (__fs->p, __str, __len); __fs->p += __len; return __len; } else return 0; } ARGP_FS_EI int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str) { size_t __len = strlen (__str); if (__len) { size_t __wrote = __argp_fmtstream_write (__fs, __str, __len); return __wrote == __len ? 0 : -1; } else return 0; } ARGP_FS_EI int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch) { if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1)) return *__fs->p++ = __ch; else return EOF; } /* Set __FS's left margin to __LMARGIN and return the old value. */ ARGP_FS_EI size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin) { size_t __old; if (__fs->p - __fs->buf > __fs->point_offs) __argp_fmtstream_update (__fs); __old = __fs->lmargin; __fs->lmargin = __lmargin; return __old; } /* Set __FS's right margin to __RMARGIN and return the old value. */ ARGP_FS_EI size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin) { size_t __old; if (__fs->p - __fs->buf > __fs->point_offs) __argp_fmtstream_update (__fs); __old = __fs->rmargin; __fs->rmargin = __rmargin; return __old; } /* Set FS's wrap margin to __WMARGIN and return the old value. */ ARGP_FS_EI size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin) { size_t __old; if (__fs->p - __fs->buf > __fs->point_offs) __argp_fmtstream_update (__fs); __old = __fs->wmargin; __fs->wmargin = __wmargin; return __old; } /* Return the column number of the current output point in __FS. */ ARGP_FS_EI size_t __argp_fmtstream_point (argp_fmtstream_t __fs) { if (__fs->p - __fs->buf > __fs->point_offs) __argp_fmtstream_update (__fs); return __fs->point_col >= 0 ? __fs->point_col : 0; } #if !_LIBC #undef __argp_fmtstream_putc #undef __argp_fmtstream_puts #undef __argp_fmtstream_write #undef __argp_fmtstream_set_lmargin #undef __argp_fmtstream_set_rmargin #undef __argp_fmtstream_set_wmargin #undef __argp_fmtstream_point #undef __argp_fmtstream_update #undef __argp_fmtstream_ensure #endif #endif /* __OPTIMIZE__ */ #endif /* ARGP_FMTSTREAM_USE_LINEWRAP */ #endif /* __ARGP_FMTSTREAM_H__ */ ifile-1.3.9/argp/argp1.h0000644000175000017500000000120311306214407013730 0ustar jasonjason/* Internal definitions for libargp.h */ #if STDC_HEADERS || HAVE_STRING_H #include /* An ANSI string.h and pre-ANSI memory.h might conflict. */ #if !STDC_HEADERS && HAVE_MEMORY_H #include #include #endif /* not STDC_HEADERS and HAVE_MEMORY_H */ #define rindex strrchr #define index strchr #define bcopy(s, d, n) memcpy ((d), (s), (n)) #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) #define bzero(s, n) memset ((s), 0, (n)) #else /* not STDC_HEADERS and not HAVE_STRING_H */ #include /* memory.h and strings.h conflict on some systems. */ #endif /* not STDC_HEADERS and not HAVE_STRING_H */ ifile-1.3.9/argp/argp-pv.c0000644000175000017500000000244311306214407014274 0ustar jasonjason/* Default definition for ARGP_PROGRAM_VERSION. Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* If set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which will print this this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ const char *argp_program_version = 0; ifile-1.3.9/argp/argp-fs-xinl.c0000644000175000017500000000323511306214407015227 0ustar jasonjason/* Real definitions for extern inline functions in argp-fmtstream.h Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #define ARGP_FS_EI //#undef __OPTIMIZE__ //#define __OPTIMIZE__ #include "argp-fmtstream.h" /* Add weak aliases. */ #if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias) weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc) weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts) weak_alias (__argp_fmtstream_write, argp_fmtstream_write) weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin) weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin) weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin) weak_alias (__argp_fmtstream_point, argp_fmtstream_point) #endif ifile-1.3.9/argp/argp-xinl.c0000644000175000017500000000245211306214407014621 0ustar jasonjason/* Real definitions for extern inline functions in argp.h Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #define ARGP_EI //#undef __OPTIMIZE__ //#define __OPTIMIZE__ #include "argp.h" /* Add weak aliases. */ #if _LIBC - 0 && defined (weak_alias) weak_alias (__argp_usage, argp_usage) weak_alias (__option_is_short, _option_is_short) weak_alias (__option_is_end, _option_is_end) #endif ifile-1.3.9/argp/Makefile.in0000644000175000017500000001011611306214407014615 0ustar jasonjason# @configure_input@ # # Makefile for the command-line-argument-processing library, libargp # Written by: Miles Bader SHELL = /bin/sh #### Start of system configuration section. #### default: libargp.a srcdir = @srcdir@ VPATH = @srcdir@ RANLIB = @RANLIB@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ CC = @CC@ DEFS = @DEFS@ LIBS = @LIBS@ # All these are optional. You can redifine CFLAGS, CPPFLAGS, # INCLUDEFLAGS and LDFLAGS on the command line however you like. CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ INCLUDEFLAGS = LDFLAGS = prefix = @prefix@ exec_prefix = @exec_prefix@ # Installation locations bindir = $(exec_prefix)/bin libdir = $(exec_prefix)/lib includedir = $(prefix)/include infodir = $(prefix)/info #### End of system configuration section. #### ARGP_VERSION = 0.1 ARGP_H_FILES = \ argp.h ARGP_C_FILES = \ argp-ba.c \ argp-fmtstream.c \ argp-fs-xinl.c \ argp-help.c \ argp-parse.c \ argp-pv.c \ argp-pvh.c \ argp-xinl.c \ argp.c \ pin.c \ strndup.c ARGP_O_FILES = $(ARGP_C_FILES:.c=.o) ARGP_GETOPT_C_FILES = \ getopt.c \ getopt1.c ARGP_GETOPT_O_FILES = $(ARGP_GETOPT_C_FILES:.c=.o) ARGP_CHECK_C_FILES = \ argp-ex1.c \ argp-ex2.c \ argp-ex3.c \ argp-ex4.c \ argp-test.c \ tester.c ARGP_CHECK_O_FILES = $(ARGP_CHECK_C_FILES:.c=.o) ARGP_CHECK_PROGRAMS = $(ARGP_CHECK_C_FILES:.c=) DIST_FILES = \ $(ARGP_C_FILES) \ $(ARGP_H_FILES) \ $(ARGP_GETOPT_C_FILES) \ $(ARGP_CHECK_C_FILES) \ ChangeLog \ INSTALL \ Makefile.in \ README \ configure \ configure.in \ install-sh \ mkinstalldirs \ getopt.h \ argp1.h \ argp-fmtstream.h \ argp-namefrob.h # Rules # Pattern rule ALL_CPPFLAGS = $(CPPFLAGS) -I$(srcdir) $(INCLUDEFLAGS) $(DEFS) ALL_CFLAGS = $(CFLAGS) .c.o: $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $< all: libargp.a # Compiling code libargp.a: $(ARGP_O_FILES) @ARGP_GETOPT_O_FILES@ $(AR) rc $@ $^ $(RANLIB) $@ argp.h: cp $(srcdir)/argp.h argp.h # Compiling the Makefile Makefile: Makefile.in config.status $(SHELL) config.status config.status: $(srcdir)/configure $(SHELL) $(srcdir)/configure --no-create # Installing installdirs: $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) \ $(DESTDIR)$(includedir) $(DESTDIR)$(libdir) INSTALL_FILES = libargp.a argp.h install: $(INSTALL_FILES) installdirs rm -f $(libdir)/libargp.a cp libargp.a $(libdir) $(RANLIB) $(libdir)/libargp.a rm -f $(includedir)/argp.h cp $(srcdir)/argp.h $(includedir) # Compiling examples and test programs $(ARGP_CHECK_PROGRAMS): libargp.a $(CC) -I. $@.c -L. -largp -o $@ checks: $(ARGP_CHECK_PROGRAMS) # Cleaning mostlyclean: rm -f core *~ clean: mostlyclean rm -f *.o libargp.a *.info *.dvi tester maintainer-clean: clean rm -f config.log config.cache config.status Makefile # Making a distribution .tar.gz file # Copy all the dist files into the directory named by $(SNAP) snap: $(DIST_FILES) for file in $(DIST_FILES); do \ cp $(srcdir)/$$file $(SNAP)/$$file ; \ done dist: $(DIST_FILES) cvs rtag -F release-`tr . - $(ARGP_VERSION)` argp echo argp-$(ARGP_VERSION) > .fname rm -rf `cat .fname` mkdir `cat .fname` for file in $(DIST_FILES); do \ cp $$file `cat .fname`/$$file ; \ done tar -chvf `cat .fname`.tar `cat .fname` rm -f `cat .fname`.tar.gz gzip -9 `cat .fname`.tar rm -rf `cat .fname` .fname snapshot: $(DIST_FILES) echo argp-`date +%y%m%d` > .fname cvs rtag -F snapshot-`cat .fname` argp rm -rf `cat .fname` mkdir `cat .fname` for file in $(DIST_FILES); do \ cp $$file $(SNAP)/$$file ; \ done tar -chvf `cat .fname`.tar `cat .fname` rm -f `cat .fname`.tar.gz gzip -9 `cat .fname`.tar rm -rf `cat .fname` .fname diff: $(DIST_FILES) @if [ ! $(OLD) ] ; then \ echo You must set OLD to the version number against which to diff ; \ exit -1 ; \ fi @if [ ! $(NEW) ] ; then \ echo You must set NEW to the version number with which to diff ; \ exit -1 ; \ fi gunzip -c argp-$(NEW).tar.gz | (cd /tmp ; tar -xf -) gunzip -c argp-$(OLD).tar.gz | (cd /tmp ; tar -xf -) rm -f argp-$(OLD)-$(NEW).diff -diff -u -r /tmp/argp-$(OLD) /tmp/argp-$(NEW) > argp-$(OLD)-$(NEW).diff rm -rf /tmp/argp-$(NEW) rm -rf /tmp/argp-$(OLD) ifile-1.3.9/argp/argp-ex3.c0000644000175000017500000001154111306214407014345 0ustar jasonjason/* Argp example #3 -- a program with options and arguments using argp */ /* This program uses the same features as example 2, and uses options and arguments. We now use the first four fields in ARGP, so here's a description of them: OPTIONS -- A pointer to a vector of struct argp_option (see below) PARSER -- A function to parse a single option, called by argp ARGS_DOC -- A string describing how the non-option arguments should look DOC -- A descriptive string about this program; if it contains a vertical tab character (\v), the part after it will be printed *following* the options The function PARSER takes the following arguments: KEY -- An integer specifying which option this is (taken from the KEY field in each struct argp_option), or a special key specifying something else; the only special keys we use here are ARGP_KEY_ARG, meaning a non-option argument, and ARGP_KEY_END, meaning that all argumens have been parsed ARG -- For an option KEY, the string value of its argument, or NULL if it has none STATE-- A pointer to a struct argp_state, containing various useful information about the parsing state; used here are the INPUT field, which reflects the INPUT argument to argp_parse, and the ARG_NUM field, which is the number of the current non-option argument being parsed It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the given KEY wasn't recognized, or an errno value indicating some other error. Note that in this example, main uses a structure to communicate with the parse_opt function, a pointer to which it passes in the INPUT argument to argp_parse. Of course, it's also possible to use global variables instead, but this is somewhat more flexible. The OPTIONS field contains a pointer to a vector of struct argp_option's; that structure has the following fields (if you assign your option structures using array initialization like this example, unspecified fields will be defaulted to 0, and need not be specified): NAME -- The name of this option's long option (may be zero) KEY -- The KEY to pass to the PARSER function when parsing this option, *and* the name of this option's short option, if it is a printable ascii character ARG -- The name of this option's argument, if any FLAGS -- Flags describing this option; some of them are: OPTION_ARG_OPTIONAL -- The argument to this option is optional OPTION_ALIAS -- This option is an alias for the previous option OPTION_HIDDEN -- Don't show this option in --help output DOC -- A documentation string for this option, shown in --help output An options vector should be terminated by an option with all fields zero. */ #include const char *argp_program_version = "argp-ex3 1.0"; const char *argp_program_bug_address = ""; static char doc[] = "Argp example #3 -- a program with options and arguments using argp"; static char args_doc[] = "ARG1 ARG2"; static struct argp_option options[] = { {"verbose", 'v', 0, 0, "Produce verbose output" }, {"quiet", 'q', 0, 0, "Don't produce any output" }, {"silent", 's', 0, OPTION_ALIAS }, {"output", 'o', "FILE", 0, "Output to FILE instead of standard output" }, { 0 } }; /* Used by main to communicate with parse_opt. */ struct arguments { char *args[2]; /* ARG1 & ARG2 */ int silent, verbose; char *output_file; }; static error_t parse_opt (int key, char *arg, struct argp_state *state) { /* Get the INPUT argument from argp_parse, which we know is a pointer to our arguments structure. */ struct arguments *arguments = state->input; switch (key) { case 'q': case 's': arguments->silent = 1; break; case 'v': arguments->verbose = 1; break; case 'o': arguments->output_file = arg; break; case ARGP_KEY_ARG: if (state->arg_num >= 2) /* Too many arguments. */ argp_usage (state); arguments->args[state->arg_num] = arg; break; case ARGP_KEY_END: if (state->arg_num < 2) /* Not enough arguments. */ argp_usage (state); break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp argp = { options, parse_opt, args_doc, doc }; int main (int argc, char **argv) { struct arguments arguments; /* Default values. */ arguments.silent = 0; arguments.verbose = 0; arguments.output_file = "-"; argp_parse (&argp, argc, argv, 0, 0, &arguments); printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n", arguments.args[0], arguments.args[1], arguments.output_file, arguments.verbose ? "yes" : "no", arguments.silent ? "yes" : "no"); exit (0); } ifile-1.3.9/argp/getopt1.c0000644000175000017500000001106411306214407014302 0ustar jasonjason/* getopt_long and getopt_long_only entry points for GNU getopt. Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" #if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 1 #if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL #define NULL 0 #endif int getopt_long (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 0); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. If an option that starts with '-' (not '--') doesn't match a long option, but does match a short option, it is parsed as a short option instead. */ int getopt_long_only (argc, argv, options, long_options, opt_index) int argc; char *const *argv; const char *options; const struct option *long_options; int *opt_index; { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } #endif /* Not ELIDE_CODE. */ #ifdef TEST #include int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; int option_index = 0; static struct option long_options[] = { {"add", 1, 0, 0}, {"append", 0, 0, 0}, {"delete", 1, 0, 0}, {"verbose", 0, 0, 0}, {"create", 0, 0, 0}, {"file", 1, 0, 0}, {0, 0, 0, 0} }; c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); if (c == EOF) break; switch (c) { case 0: printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case 'd': printf ("option d with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ ifile-1.3.9/argp/configure.in0000644000175000017500000000574511306214407015075 0ustar jasonjasonAC_INIT(argp.h) # configure.in for "libargp". # Process this file with autoconf to produce a configure script. # Let the user set CPPFLAGS and CFLAGS on the ./configure command-line AC_SUBST(CPPFLAGS) if test -z "$CFLAGS" ; then if test -z "$CC" ; then CFLAGS="-g -O -Wall" #provide a default for CFLAGS for gcc else CFLAGS="-O" #provide a default for CFLAGS for others fi fi AC_SUBST(CFLAGS) # Find the compiler AC_PROG_CC AC_PROG_CPP # Avoid using GCC __attributes__ for non-GCC compilers if test -z "$GCC" ; then CFLAGS="-DCONSTRUCTOR_FAILS=1 $CFLAGS" fi # Find some installation programs AC_PROG_INSTALL AC_PROG_RANLIB # Find out if we have getopt.h AC_CHECK_HEADERS(getopt.h) # Find out if we have alloca.h AC_CHECK_HEADERS(alloca.h) # Find out if we have the function getopt_long(). If we have it, # then find out if we have getopt_long_only as well. If we have both, # cause libargp to use the system functions. If we don't have one # or both, cause libargp to use the ARGP_GETOPT_O_FILES. # Why not pass a list of functions to AC_CHECK_FUNCS? It calls the "match" # action if any function is found, which isn't what we want. AC_CHECK_FUNCS(getopt_long, [AC_CHECK_FUNCS(getopt_long_only, ARGP_GETOPT_O_FILES='', ARGP_GETOPT_O_FILES='$(ARGP_GETOPT_O_FILES)')], ARGP_GETOPT_O_FILES='$(ARGP_GETOPT_O_FILES)') AC_SUBST(ARGP_GETOPT_O_FILES) # Find out if we have the function strerror() AC_CHECK_FUNCS(strerror) # Needed by argp-help.c AC_CHECK_FUNCS(strndup) # Needed by argp-fmtstream.h AC_CHECK_TYPE(ssize_t, int) # Needed by argp-fmtstream.c AC_CHECK_FUNCS(memmove vsnprintf) # Needed by argp-help.c AC_CHECK_FUNCS(strerror) # strcasecmp() is in /usr/include/strings.h on SunOS. AC_CHECK_HEADERS(strings.h) if test -z "$HAVE_VSNPRINTF" ; then # Find out if vsprintf() returns the number of chars written, or # a pointer to the string AC_MSG_CHECKING(if vsprintf returns int) AC_TRY_RUN(main() { char *buf = malloc(16); if (2 == (int)vsprintf(buf, "12")) exit (0); exit (-1);}, VSPRINTF_RETURNS_INT=1; AC_DEFINE(VSPRINTF_RETURNS_INT) AC_MSG_RESULT(yes), VSPRINTF_RETURNS_INT=0 AC_MSG_RESULT(no), VSPRINTF_RETURNS_INT=0 AC_MSG_RESULT(guessing no)) fi # Find out if the libc has the global variables # program_invocation_short_name,program_invocation_name AC_MSG_CHECKING(program_invocation_name); AC_TRY_LINK(,void foo() {program_invocation_name = "foo";}, HAVE_PROGRAM_INVOCATION_NAME=1,) if test "$HAVE_PROGRAM_INVOCATION_NAME" = 1 ; then AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi # Check for ANSI/non-ANSI string functions AC_HEADER_STDC AC_CHECK_HEADERS(string.h memory.h) # --with-dmalloc option: add dmalloc library AC_ARG_WITH(dmalloc, [ --with-dmalloc build with the dmalloc library]) if test "$with_dmalloc" = yes; then AC_CHECK_LIB(dmalloc, dmalloc_debug, [LIBS="$LIBS -ldmalloc"; CPPFLAGS="$CPPFLAGS -DDMALLOC"]) fi # Write the Makefiles AC_OUTPUT(Makefile) ifile-1.3.9/argp/mkinstalldirs0000755000175000017500000000115311306214407015357 0ustar jasonjason#!/bin/sh # Make directory hierarchy. # Written by Noah Friedman # Public domain. defaultIFS=' ' IFS="${IFS-${defaultIFS}}" errstatus=0 for file in ${1+"$@"} ; do oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' for d in ${1+"$@"} ; do pathcomp="${pathcomp}${d}" if test ! -d "${pathcomp}"; then echo "mkdir $pathcomp" 1>&2 mkdir "${pathcomp}" || errstatus=$? fi pathcomp="${pathcomp}/" done done exit $errstatus # eof ifile-1.3.9/argp/tester.c0000644000175000017500000000651211306214407014227 0ustar jasonjason/* Code snarfed from the GNU Hurd's `settrans.c' in order to test libargp. */ #include "argp.h" #define DEFAULT_TIMEOUT 60 #define _STRINGIFY(arg) #arg #define STRINGIFY(arg) _STRINGIFY (arg) static struct argp_option options[] = { {"active", 'a', 0, 0, "Set NODE's active translator", 1}, {"passive", 'p', 0, 0, "Set NODE's passive translator"}, {"create", 'c', 0, 0, "Create NODE if it doesn't exist"}, {"dereference", 'L', 0, 0, "If a translator exists, put the new one on top"}, {"pause", 'P', 0, 0, "When starting an active translator, prompt and" " wait for a newline on stdin before completing the startup handshake"}, {"timeout", 't',"SEC",0, "Timeout for translator startup, in seconds" " (default " STRINGIFY (DEFAULT_TIMEOUT) "); 0 means no timeout"}, {"exclusive", 'x', 0, 0, "Only set the translator if there is none already"}, {0,0,0,0, "When setting the passive translator, if there's an active translator:"}, {"goaway", 'g', 0, 0, "Make the active translator go away"}, {"keep-active", 'k', 0, 0, "Leave the existing active translator running"}, {0,0,0,0, "When an active translator is told to go away:", 2}, {"recursive", 'R', 0, 0, "Shutdown its children too"}, {"force", 'f', 0, 0, "If it doesn't want to die, force it"}, {"nosync", 'S', 0, 0, "Don't sync it before killing it"}, {0, 0} }; static char *args_doc = "NODE [TRANSLATOR ARG...]"; static char *doc = "Set the passive/active translator on NODE." "\vBy default the passive translator is set."; void main (int argc, char *argv[]) { /* The filesystem node we're putting a translator on. */ char *node_name = 0; /* The translator's arg vector, in '\0' separated format. */ /* The control port for any active translator we start up. */ /* Flags to pass to file_set_translator. */ int lookup_flags = 0; int goaway_flags = 0; /* Various option flags. */ int passive = 0, active = 0, keep_active = 0, pause = 0, kill_active = 0; int excl = 0; int timeout = DEFAULT_TIMEOUT * 1000; /* ms */ /* Parse our options... */ error_t parse_opt (int key, char *arg, struct argp_state *state) { switch (key) { case ARGP_KEY_ARG: if (state->arg_num == 0) node_name = arg; else /* command */ { abort (); #if 0 error_t err = argz_create (state->argv + state->next - 1, &argz, &argz_len); if (err) error(3, err, "Can't create options vector"); state->next = state->argc; /* stop parsing */ #endif } break; case ARGP_KEY_NO_ARGS: argp_usage (state); return EINVAL; case 'a': active = 1; break; case 'p': passive = 1; break; case 'k': keep_active = 1; break; case 'g': kill_active = 1; break; case 'x': excl = 1; break; case 'P': pause = 1; break; case 'c': lookup_flags |= 0; break; case 'L': lookup_flags &= ~0; break; case 'R': goaway_flags |= 0; break; case 'S': goaway_flags |= 0; break; case 'f': goaway_flags |= 0; break; /* Use atof so the user can specifiy fractional timeouts. */ case 't': timeout = 1000.0; break; default: return ARGP_ERR_UNKNOWN; } return 0; } struct argp argp = {options, parse_opt, args_doc, doc}; argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0, 0); exit (0); } /* Local Variables: compile-command: "gcc -g -O tester.c -o tester -L. -largp" End: */ ifile-1.3.9/argp/argp-parse.c0000644000175000017500000006565511306214407014777 0ustar jasonjason/* Hierarchial argument parsing, layered over getopt Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef _AIX #pragma alloca #endif #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #if HAVE_ALLOCA_H #include #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ #ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) #else # define _(msgid) (msgid) # define gettext(msgid) (msgid) #endif #endif #if _LIBC - 0 #include #else #ifdef HAVE_CTHREADS_H #include #endif #endif /* _LIBC */ #include "argp.h" #include "argp-namefrob.h" /* Getopt return values. */ #define KEY_END (-1) /* The end of the options. */ #define KEY_ARG 1 /* A non-option argument. */ #define KEY_ERR '?' /* An error parsing the options. */ /* The meta-argument used to prevent any further arguments being interpreted as options. */ #define QUOTE "--" /* The number of bits we steal in a long-option value for our own use. */ #define GROUP_BITS CHAR_BIT /* The number of bits available for the user value. */ #define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS) #define USER_MASK ((1 << USER_BITS) - 1) /* EZ alias for ARGP_ERR_UNKNOWN. */ #define EBADKEY ARGP_ERR_UNKNOWN /* Default options. */ /* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep for one second intervals, decrementing _ARGP_HANG until it's zero. Thus you can force the program to continue by attaching a debugger and setting it to 0 yourself. */ volatile int _argp_hang = 0; #define OPT_PROGNAME -2 #define OPT_USAGE -3 #define OPT_HANG -4 static const struct argp_option argp_default_options[] = { {"help", '?', 0, 0, "Give this help list", -1}, {"usage", OPT_USAGE, 0, 0, "Give a short usage message"}, {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, "Set the program name"}, {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN, "Hang for SECS seconds (default 3600)"}, {0, 0} }; static error_t argp_default_parser (int key, char *arg, struct argp_state *state) { switch (key) { case '?': __argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP); break; case OPT_USAGE: __argp_state_help (state, state->out_stream, ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK); break; case OPT_PROGNAME: /* Set the program name. */ program_invocation_name = arg; /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined to be that, so we have to be a bit careful here.] */ arg = strrchr (arg, '/'); if (arg) program_invocation_short_name = arg + 1; else program_invocation_short_name = program_invocation_name; /* Update what we use for messages. */ state->name = program_invocation_short_name; if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS)) == ARGP_PARSE_ARGV0) /* Update what getopt uses too. */ state->argv[0] = program_invocation_name; break; case OPT_HANG: _argp_hang = atoi (arg ? arg : "3600"); while (_argp_hang-- > 0) __sleep (1); break; default: return EBADKEY; } return 0; } static const struct argp argp_default_argp = {argp_default_options, &argp_default_parser}; static const struct argp_option argp_version_options[] = { {"version", 'V', 0, 0, "Print program version", -1}, {0, 0} }; static error_t argp_version_parser (int key, char *arg, struct argp_state *state) { switch (key) { case 'V': if (argp_program_version_hook) (*argp_program_version_hook) (state->out_stream, state); else if (argp_program_version) fprintf (state->out_stream, "%s\n", argp_program_version); else __argp_error (state, _("No version known!?")); if (! (state->flags & ARGP_NO_EXIT)) exit (0); break; default: return EBADKEY; } return 0; } static const struct argp argp_version_argp = {argp_version_options, &argp_version_parser}; /* Returns the offset into the getopt long options array LONG_OPTIONS of a long option with called NAME, or -1 if none is found. Passing NULL as NAME will return the number of options. */ static int find_long_option (struct option *long_options, const char *name) { struct option *l = long_options; while (l->name != NULL) if (name != NULL && strcmp (l->name, name) == 0) return l - long_options; else l++; if (name == NULL) return l - long_options; else return -1; } /* If we can, we regulate access to getopt, which is non-reentrant, with a mutex. Since the case we're trying to guard against is two different threads interfering, and it's possible that someone might want to call argp_parse recursively (they're careful), we use a recursive lock if possible. */ #if _LIBC - 0 __libc_lock_define_initialized_recursive (static, getopt_lock) #define LOCK_GETOPT __libc_lock_lock_recursive (getopt_lock) #define UNLOCK_GETOPT __libc_lock_unlock_recursive (getopt_lock) #else /* !_LIBC */ #ifdef HAVE_CTHREADS_H static struct mutex getopt_lock = MUTEX_INITIALIZER; #define LOCK_GETOPT mutex_lock (&getopt_lock) #define UNLOCK_GETOPT mutex_unlock (&getopt_lock) #else /* !HAVE_CTHREADS_H */ #define LOCK_GETOPT (void)0 #define UNLOCK_GETOPT (void)0 #endif /* HAVE_CTHREADS_H */ #endif /* _LIBC */ /* This hack to allow programs that know what's going on to call argp recursively. If someday argp is changed not to use the non-reentrant getopt interface, we can get rid of this shit. XXX */ void _argp_unlock_xxx (void) { UNLOCK_GETOPT; } /* The state of a `group' during parsing. Each group corresponds to a particular argp structure from the tree of such descending from the top level argp passed to argp_parse. */ struct group { /* This group's parsing function. */ argp_parser_t parser; /* Which argp this group is from. */ const struct argp *argp; /* Points to the point in SHORT_OPTS corresponding to the end of the short options for this group. We use it to determine from which group a particular short options is from. */ char *short_end; /* The number of non-option args sucessfully handled by this parser. */ unsigned args_processed; /* This group's parser's parent's group. */ struct group *parent; unsigned parent_index; /* And the our position in the parent. */ /* These fields are swapped into and out of the state structure when calling this group's parser. */ void *input, **child_inputs; void *hook; }; /* Call GROUP's parser with KEY and ARG, swapping any group-specific info from STATE before calling, and back into state afterwards. If GROUP has no parser, EBADKEY is returned. */ static error_t group_parse (struct group *group, struct argp_state *state, int key, char *arg) { if (group->parser) { error_t err; state->hook = group->hook; state->input = group->input; state->child_inputs = group->child_inputs; state->arg_num = group->args_processed; err = (*group->parser)(key, arg, state); group->hook = state->hook; return err; } else return EBADKEY; } struct parser { const struct argp *argp; /* SHORT_OPTS is the getopt short options string for the union of all the groups of options. */ char *short_opts; /* LONG_OPTS is the array of getop long option structures for the union of all the groups of options. */ struct option *long_opts; /* States of the various parsing groups. */ struct group *groups; /* The end of the GROUPS array. */ struct group *egroup; /* An vector containing storage for the CHILD_INPUTS field in all groups. */ void **child_inputs; /* True if we think using getopt is still useful; if false, then remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is cleared whenever getopt returns KEY_END, but may be set again if the user moves the next argument pointer backwards. */ int try_getopt; /* State block supplied to parsing routines. */ struct argp_state state; /* Memory used by this parser. */ void *storage; }; /* The next usable entries in the various parser tables being filled in by convert_options. */ struct parser_convert_state { struct parser *parser; char *short_end; struct option *long_end; void **child_inputs_end; }; /* Converts all options in ARGP (which is put in GROUP) and ancestors into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and CVT->LONG_END are the points at which new options are added. Returns the next unused group entry. CVT holds state used during the conversion. */ static struct group * convert_options (const struct argp *argp, struct group *parent, unsigned parent_index, struct group *group, struct parser_convert_state *cvt) { /* REAL is the most recent non-alias value of OPT. */ const struct argp_option *real = argp->options; const struct argp_child *children = argp->children; if (real || argp->parser) { const struct argp_option *opt; if (real) for (opt = real; !__option_is_end (opt); opt++) { if (! (opt->flags & OPTION_ALIAS)) /* OPT isn't an alias, so we can use values from it. */ real = opt; if (! (real->flags & OPTION_DOC)) /* A real option (not just documentation). */ { if (__option_is_short (opt)) /* OPT can be used as a short option. */ { *cvt->short_end++ = opt->key; if (real->arg) { *cvt->short_end++ = ':'; if (real->flags & OPTION_ARG_OPTIONAL) *cvt->short_end++ = ':'; } *cvt->short_end = '\0'; /* keep 0 terminated */ } if (opt->name && find_long_option (cvt->parser->long_opts, opt->name) < 0) /* OPT can be used as a long option. */ { cvt->long_end->name = opt->name; cvt->long_end->has_arg = (real->arg ? (real->flags & OPTION_ARG_OPTIONAL ? optional_argument : required_argument) : no_argument); cvt->long_end->flag = 0; /* we add a disambiguating code to all the user's values (which is removed before we actually call the function to parse the value); this means that the user loses use of the high 8 bits in all his values (the sign of the lower bits is preserved however)... */ cvt->long_end->val = ((opt->key | real->key) & USER_MASK) + (((group - cvt->parser->groups) + 1) << USER_BITS); /* Keep the LONG_OPTS list terminated. */ (++cvt->long_end)->name = NULL; } } } group->parser = argp->parser; group->argp = argp; group->short_end = cvt->short_end; group->args_processed = 0; group->parent = parent; group->parent_index = parent_index; group->input = 0; group->hook = 0; group->child_inputs = 0; if (children) /* Assign GROUP's CHILD_INPUTS field some space from CVT->child_inputs_end.*/ { unsigned num_children = 0; while (children[num_children].argp) num_children++; group->child_inputs = cvt->child_inputs_end; cvt->child_inputs_end += num_children; } parent = group++; } else parent = 0; if (children) { unsigned index = 0; while (children->argp) group = convert_options (children++->argp, parent, index++, group, cvt); } return group; } /* Find the merged set of getopt options, with keys appropiately prefixed. */ static void parser_convert (struct parser *parser, const struct argp *argp, int flags) { struct parser_convert_state cvt; cvt.parser = parser; cvt.short_end = parser->short_opts; cvt.long_end = parser->long_opts; cvt.child_inputs_end = parser->child_inputs; if (flags & ARGP_IN_ORDER) *cvt.short_end++ = '-'; else if (flags & ARGP_NO_ARGS) *cvt.short_end++ = '+'; *cvt.short_end = '\0'; cvt.long_end->name = NULL; parser->argp = argp; if (argp) parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt); else parser->egroup = parser->groups; /* No parsers at all! */ } /* Lengths of various parser fields which we will allocated. */ struct parser_sizes { size_t short_len; /* Getopt short options string. */ size_t long_len; /* Getopt long options vector. */ size_t num_groups; /* Group structures we allocate. */ size_t num_child_inputs; /* Child input slots. */ }; /* For ARGP, increments the NUM_GROUPS field in SZS by the total number of argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by the maximum lengths of the resulting merged getopt short options string and long-options array, respectively. */ static void calc_sizes (const struct argp *argp, struct parser_sizes *szs) { const struct argp_child *child = argp->children; const struct argp_option *opt = argp->options; if (opt || argp->parser) { szs->num_groups++; if (opt) { int num_opts = 0; while (!__option_is_end (opt++)) num_opts++; szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */ szs->long_len += num_opts; } } if (child) while (child->argp) { calc_sizes ((child++)->argp, szs); szs->num_child_inputs++; } } /* Initializes PARSER to parse ARGP in a manner described by FLAGS. */ static error_t parser_init (struct parser *parser, const struct argp *argp, int argc, char **argv, int flags, void *input) { error_t err = 0; struct group *group; struct parser_sizes szs; szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1; szs.long_len = 0; szs.num_groups = 0; szs.num_child_inputs = 0; if (argp) calc_sizes (argp, &szs); /* Lengths of the various bits of storage used by PARSER. */ #define GLEN (szs.num_groups + 1) * sizeof (struct group) #define CLEN (szs.num_child_inputs * sizeof (void *)) #define LLEN ((szs.long_len + 1) * sizeof (struct option)) #define SLEN (szs.short_len + 1) parser->storage = malloc (GLEN + CLEN + LLEN + SLEN); if (! parser->storage) return ENOMEM; parser->groups = parser->storage; parser->child_inputs = (void **)((unsigned long int) parser->storage + GLEN); parser->long_opts = (struct option*)((unsigned long int) parser->storage + GLEN + CLEN); parser->short_opts = (char *)((unsigned long int) parser->storage + GLEN + CLEN + LLEN); memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *)); parser_convert (parser, argp, flags); memset (&parser->state, 0, sizeof (struct argp_state)); parser->state.argp = parser->argp; parser->state.argc = argc; parser->state.argv = argv; parser->state.flags = flags; parser->state.err_stream = stderr; parser->state.out_stream = stdout; parser->state.next = 0; /* Tell getopt to initialize. */ parser->state.pstate = parser; parser->try_getopt = 1; /* Call each parser for the first time, giving it a chance to propagate values to child parsers. */ if (parser->groups < parser->egroup) parser->groups->input = input; for (group = parser->groups; group < parser->egroup && (!err || err == EBADKEY); group++) { if (group->parent) /* If a child parser, get the initial input value from the parent. */ group->input = group->parent->child_inputs[group->parent_index]; err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0); } if (err == EBADKEY) err = 0; /* Some parser didn't understand. */ if (err) return err; /* Getopt is (currently) non-reentrant. */ LOCK_GETOPT; if (parser->state.flags & ARGP_NO_ERRS) { opterr = 0; if (parser->state.flags & ARGP_PARSE_ARGV0) /* getopt always skips ARGV[0], so we have to fake it out. As long as OPTERR is 0, then it shouldn't actually try to access it. */ parser->state.argv--, parser->state.argc++; } else opterr = 1; /* Print error messages. */ if (parser->state.argv == argv && argv[0]) /* There's an argv[0]; use it for messages. */ { char *short_name = strrchr (argv[0], '/'); parser->state.name = short_name ? short_name + 1 : argv[0]; } else parser->state.name = program_invocation_short_name; return 0; } /* Free any storage consumed by PARSER (but not PARSER itself). */ static error_t parser_finalize (struct parser *parser, error_t err, int arg_ebadkey, int *end_index) { struct group *group; UNLOCK_GETOPT; if (err == EBADKEY && arg_ebadkey) /* Suppress errors generated by unparsed arguments. */ err = 0; if (! err) if (parser->state.next == parser->state.argc) /* We successfully parsed all arguments! Call all the parsers again, just a few more times... */ { for (group = parser->groups; group < parser->egroup && (!err || err==EBADKEY); group++) if (group->args_processed == 0) err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0); for (group = parser->groups; group < parser->egroup && (!err || err==EBADKEY); group++) err = group_parse (group, &parser->state, ARGP_KEY_END, 0); if (err == EBADKEY) err = 0; /* Some parser didn't understand. */ } else if (end_index) /* Return any remaining arguments to the user. */ *end_index = parser->state.next; else /* No way to return the remaining arguments, they must be bogus. */ { if (!(parser->state.flags & ARGP_NO_ERRS) && parser->state.err_stream) fprintf (parser->state.err_stream, _("%s: Too many arguments\n"), parser->state.name); err = EBADKEY; } /* Okay, we're all done, with either an error or success. We only call the parsers once more, to indicate which one. */ if (err) { /* Maybe print an error message. */ if (err == EBADKEY) /* An appropriate message describing what the error was should have been printed earlier. */ __argp_state_help (&parser->state, parser->state.err_stream, ARGP_HELP_STD_ERR); /* Since we didn't exit, give each parser an error indication. */ for (group = parser->groups; group < parser->egroup; group++) group_parse (group, &parser->state, ARGP_KEY_ERROR, 0); } else /* Do final cleanup, including propagating back values from parsers. */ { /* We pass over the groups in reverse order so that child groups are given a chance to do there processing before passing back a value to the parent. */ for (group = parser->egroup - 1 ; group >= parser->groups && (!err || err == EBADKEY) ; group--) err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0); if (err == EBADKEY) err = 0; /* Some parser didn't understand. */ } if (err == EBADKEY) err = EINVAL; free (parser->storage); return err; } /* Call the user parsers to parse the non-option argument VAL, at the current position, returning any error. */ static error_t parser_parse_arg (struct parser *parser, char *val) { int index = parser->state.next; error_t err = EBADKEY; struct group *group; for (group = parser->groups ; group < parser->egroup && err == EBADKEY ; group++) err = group_parse (group, &parser->state, ARGP_KEY_ARG, val); if (!err) if (parser->state.next >= index) /* Remember that we successfully processed a non-option argument -- but only if the user hasn't gotten tricky and set the clock back. */ (--group)->args_processed++; else /* The user wants to reparse some args, give getopt another try. */ parser->try_getopt = 1; return err; } /* Call the user parsers to parse the option OPT, with argument VAL, at the current position, returning any error. */ static error_t parser_parse_opt (struct parser *parser, int opt, char *val) { /* The group key encoded in the high bits; 0 for short opts or group_number + 1 for long opts. */ int group_key = opt >> USER_BITS; if (group_key == 0) /* A short option. By comparing OPT's position in SHORT_OPTS to the various starting positions in each group's SHORT_END field, we can determine which group OPT came from. */ { struct group *group; char *short_index = strchr (parser->short_opts, opt); if (short_index) for (group = parser->groups; group < parser->egroup; group++) if (group->short_end > short_index) return group_parse (group, &parser->state, opt, optarg); return EBADKEY; /* until otherwise asserted */ } else /* A long option. We use shifts instead of masking for extracting the user value in order to preserve the sign. */ return group_parse (&parser->groups[group_key - 1], &parser->state, (opt << GROUP_BITS) >> GROUP_BITS, optarg); } /* Parse the next argument in PARSER (as indicated by PARSER->state.next). Any error from the parsers is returned, and *ARGP_EBADKEY indicates whether a value of EBADKEY is due to an unrecognized argument (which is generally not fatal). */ static error_t parser_parse_next (struct parser *parser, int *arg_ebadkey) { int opt; error_t err = 0; if (parser->state.quoted && parser->state.next < parser->state.quoted) /* The next argument pointer has been moved to before the quoted region, so pretend we never saw the quoting `--', and give getopt another chance. If the user hasn't removed it, getopt will just process it again. */ parser->state.quoted = 0; if (parser->try_getopt && !parser->state.quoted) /* Give getopt a chance to parse this. */ { optind = parser->state.next; /* Put it back in OPTIND for getopt. */ optopt = KEY_END; /* Distinguish KEY_ERR from a real option. */ if (parser->state.flags & ARGP_LONG_ONLY) opt = getopt_long_only (parser->state.argc, parser->state.argv, parser->short_opts, parser->long_opts, 0); else opt = getopt_long (parser->state.argc, parser->state.argv, parser->short_opts, parser->long_opts, 0); parser->state.next = optind; /* And see what getopt did. */ if (opt == KEY_END) /* Getopt says there are no more options, so stop using getopt; we'll continue if necessary on our own. */ { parser->try_getopt = 0; if (parser->state.next > 1 && strcmp (parser->state.argv[parser->state.next - 1], QUOTE) == 0) /* Not only is this the end of the options, but it's a `quoted' region, which may have args that *look* like options, so we definitely shouldn't try to use getopt past here, whatever happens. */ parser->state.quoted = parser->state.next; } else if (opt == KEY_ERR && optopt != KEY_END) /* KEY_ERR can have the same value as a valid user short option, but in the case of a real error, getopt sets OPTOPT to the offending character, which can never be KEY_END. */ { *arg_ebadkey = 0; return EBADKEY; } } else opt = KEY_END; if (opt == KEY_END) /* We're past what getopt considers the options. */ if (parser->state.next >= parser->state.argc || (parser->state.flags & ARGP_NO_ARGS)) /* Indicate that we're done. */ { *arg_ebadkey = 1; return EBADKEY; } else /* A non-option arg. */ err = parser_parse_arg (parser, parser->state.argv[parser->state.next++]); else if (opt == KEY_ARG) /* A non-option argument; try each parser in turn. */ err = parser_parse_arg (parser, optarg); else err = parser_parse_opt (parser, opt, optarg); if (err == EBADKEY) { *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG); parser->state.next--; /* Put back the unused argument. */ } return err; } /* Parse the options strings in ARGC & ARGV according to the argp in ARGP. FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the index in ARGV of the first unparsed option is returned in it. If an unknown option is present, EINVAL is returned; if some parser routine returned a non-zero value, it is returned; otherwise 0 is returned. */ error_t __argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags, int *end_index, void *input) { error_t err; struct parser parser; /* If true, then err == EBADKEY is a result of a non-option argument failing to be parsed (which in some cases isn't actually an error). */ int arg_ebadkey = 0; #if !HAVE_PROGRAM_INVOCATION_NAME /* Set the PROGRAM_INVOCATION_NAME and PROGRAM_INVOCATION_SHORT_NAME if this system doesn't automatically do that. */ { char *s; program_invocation_name = argv[0]; s = strrchr (program_invocation_name, '/'); if (s) program_invocation_short_name = s + 1; else program_invocation_short_name = program_invocation_name; } #endif if (! (flags & ARGP_NO_HELP)) /* Add our own options. */ { struct argp_child *child = alloca (4 * sizeof (struct argp_child)); struct argp *top_argp = alloca (sizeof (struct argp)); /* TOP_ARGP has no options, it just serves to group the user & default argps. */ memset (top_argp, 0, sizeof (*top_argp)); top_argp->children = child; memset (child, 0, 4 * sizeof (struct argp_child)); if (argp) (child++)->argp = argp; (child++)->argp = &argp_default_argp; if (argp_program_version || argp_program_version_hook) (child++)->argp = &argp_version_argp; child->argp = 0; argp = top_argp; } /* Construct a parser for these arguments. */ err = parser_init (&parser, argp, argc, argv, flags, input); if (! err) /* Parse! */ { while (! err) err = parser_parse_next (&parser, &arg_ebadkey); err = parser_finalize (&parser, err, arg_ebadkey, end_index); } return err; } #ifdef weak_alias weak_alias (__argp_parse, argp_parse) #endif /* Return the input field for ARGP in the parser corresponding to STATE; used by the help routines. */ void * __argp_input (const struct argp *argp, const struct argp_state *state) { if (state) { struct group *group; struct parser *parser = state->pstate; for (group = parser->groups; group < parser->egroup; group++) if (group->argp == argp) return group->input; } return 0; } #ifdef weak_alias weak_alias (__argp_input, _argp_input) #endif ifile-1.3.9/argp/argp.h0000644000175000017500000005740011306214407013661 0ustar jasonjason/* Hierarchial argument parsing, layered over getopt. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __ARGP_H__ #define __ARGP_H__ #include #include #include #include #define __need_error_t #include #ifndef __const #define __const const #endif #ifndef __error_t_defined typedef int error_t; #endif #ifndef __P # if (defined (__STDC__) && __STDC__) || defined (__cplusplus) # define __P(args) args # else # define __P(args) () # endif #endif #ifdef __cplusplus extern "C" { #endif /* My libc doesn't have these. -mccallum@jprc.com */ #if !HAVE_PROGRAM_INVOCATION_NAME extern char *program_invocation_short_name; extern char *program_invocation_name; #endif /* A description of a particular option. A pointer to an array of these is passed in the OPTIONS field of an argp structure. Each option entry can correspond to one long option and/or one short option; more names for the same option can be added by following an entry in an option array with options having the OPTION_ALIAS flag set. */ struct argp_option { /* The long option name. For more than one name for the same option, you can use following options with the OPTION_ALIAS flag set. */ __const char *name; /* What key is returned for this option. If > 0 and printable, then it's also accepted as a short option. */ int key; /* If non-NULL, this is the name of the argument associated with this option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */ __const char *arg; /* OPTION_ flags. */ int flags; /* The doc string for this option. If both NAME and KEY are 0, This string will be printed outdented from the normal option column, making it useful as a group header (it will be the first thing printed in its group); in this usage, it's conventional to end the string with a `:'. */ __const char *doc; /* The group this option is in. In a long help message, options are sorted alphabetically within each group, and the groups presented in the order 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with if this field 0 will inherit the group number of the previous entry, or zero if it's the first one, unless its a group header (NAME and KEY both 0), in which case, the previous entry + 1 is the default. Automagic options such as --help are put into group -1. */ int group; }; /* The argument associated with this option is optional. */ #define OPTION_ARG_OPTIONAL 0x1 /* This option isn't displayed in any help messages. */ #define OPTION_HIDDEN 0x2 /* This option is an alias for the closest previous non-alias option. This means that it will be displayed in the same help entry, and will inherit fields other than NAME and KEY from the aliased option. */ #define OPTION_ALIAS 0x4 /* This option isn't actually an option (and so should be ignored by the actual option parser), but rather an arbitrary piece of documentation that should be displayed in much the same manner as the options. If this flag is set, then the option NAME field is displayed unmodified (e.g., no `--' prefix is added) at the left-margin (where a *short* option would normally be displayed), and the documentation string in the normal place. For purposes of sorting, any leading whitespace and puncuation is ignored, except that if the first non-whitespace character is not `-', this entry is displayed after all options (and OPTION_DOC entries with a leading `-') in the same group. */ #define OPTION_DOC 0x8 struct argp; /* fwd declare this type */ struct argp_state; /* " */ struct argp_child; /* " */ /* The type of a pointer to an argp parsing function. */ typedef error_t (*argp_parser_t)(int key, char *arg, struct argp_state *state); /* What to return for unrecognized keys. For special ARGP_KEY_ keys, such returns will simply be ignored. For user keys, this error will be turned into EINVAL (if the call to argp_parse is such that errors are propagated back to the user instead of exiting); returning EINVAL itself would result in an immediate stop to parsing in *all* cases. */ #define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */ /* Special values for the KEY argument to an argument parsing function. ARGP_ERR_UNKNOWN should be returned if they aren't understood. The sequence of keys to a parsing function is either (where each uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key): INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized The third case is where every parser returned ARGP_KEY_UNKNOWN for an argument, in which case parsing stops at that argument (returning the unparsed arguments to the caller of argp_parse if requested, or stopping with an error message if not). If an error occurs (either detected by argp, or because the parsing function returned an error value), then the parser is called with ARGP_KEY_ERROR, and no further calls are made. */ /* This is not an option at all, but rather a command line argument. If a parser receiving this key returns success, the fact is recorded, and the ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the argument, a parser function decrements the NEXT field of the state it's passed, the option won't be considered processed; this is to allow you to actually modify the argument (perhaps into an option), and have it processed again. */ #define ARGP_KEY_ARG 0 /* There are no more command line arguments at all. */ #define ARGP_KEY_END 0x1000001 /* Because it's common to want to do some special processing if there aren't any non-option args, user parsers are called with this key if they didn't successfully process any non-option arguments. Called just before ARGP_KEY_END (where more general validity checks on previously parsed arguments can take place). */ #define ARGP_KEY_NO_ARGS 0x1000002 /* Passed in before any parsing is done. Afterwards, the values of each element of the CHILD_INPUT field, if any, in the state structure is copied to each child's state to be the initial value of the INPUT field. */ #define ARGP_KEY_INIT 0x1000003 /* Passed in when parsing has successfully been completed (even if there are still arguments remaining). */ #define ARGP_KEY_SUCCESS 0x1000004 /* Passed in if an error occurs (in which case a call with ARGP_KEY_SUCCESS is never made, so any cleanup must be done here). */ #define ARGP_KEY_ERROR 0x1000005 /* An argp structure contains a set of options declarations, a function to deal with parsing one, documentation string, a possible vector of child argp's, and perhaps a function to filter help output. When actually parsing options, getopt is called with the union of all the argp structures chained together through their CHILD pointers, with conflicts being resolved in favor of the first occurance in the chain. */ struct argp { /* An array of argp_option structures, terminated by an entry with both NAME and KEY having a value of 0. */ __const struct argp_option *options; /* What to do with an option from this structure. KEY is the key associated with the option, and ARG is any associated argument (NULL if none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then parsing is stopped immediately, and that value is returned from argp_parse(). For special (non-user-supplied) values of KEY, see the ARGP_KEY_ definitions below. */ argp_parser_t parser; /* A string describing what other arguments are wanted by this program. It is only used by argp_usage to print the `Usage:' message. If it contains newlines, the strings separated by them are considered alternative usage patterns, and printed on separate lines (lines after the first are prefix by ` or: ' instead of `Usage:'). */ __const char *args_doc; /* If non-NULL, a string containing extra text to be printed before and after the options in a long help message (separated by a vertical tab `\v' character). */ __const char *doc; /* A vector of argp_children structures, terminated by a member with a 0 argp field, pointing to child argps should be parsed with this one. Any conflicts are resolved in favor of this argp, or early argps in the CHILDREN list. This field is useful if you use libraries that supply their own argp structure, which you want to use in conjunction with your own. */ __const struct argp_child *children; /* If non-zero, this should be a function to filter the output of help messages. KEY is either a key from an option, in which case TEXT is that option's help text, or a special key from the ARGP_KEY_HELP_ defines, below, describing which other help text TEXT is. The function should return either TEXT, if it should be used as-is, a replacement string, which should be malloced, and will be freed by argp, or NULL, meaning `print nothing'. The value for TEXT is *after* any translation has been done, so if any of the replacement text also needs translation, that should be done by the filter function. INPUT is either the input supplied to argp_parse, or NULL, if argp_help was called directly. */ char *(*help_filter)(int __key, __const char *__text, void *__input); }; /* Possible KEY arguments to a help filter function. */ #define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */ #define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */ #define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */ #define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation; TEXT is NULL for this key. */ /* Explanatory note emitted when duplicate option arguments have been suppressed. */ #define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005 /* When an argp has a non-zero CHILDREN field, it should point to a vector of argp_child structures, each of which describes a subsidiary argp. */ struct argp_child { /* The child parser. */ __const struct argp *argp; /* Flags for this child. */ int flags; /* If non-zero, an optional header to be printed in help output before the child options. As a side-effect, a non-zero value forces the child options to be grouped together; to achieve this effect without actually printing a header string, use a value of "". */ __const char *header; /* Where to group the child options relative to the other (`consolidated') options in the parent argp; the values are the same as the GROUP field in argp_option structs, but all child-groupings follow parent options at a particular group level. If both this field and HEADER are zero, then they aren't grouped at all, but rather merged with the parent options (merging the child's grouping levels with the parents). */ int group; }; /* Parsing state. This is provided to parsing functions called by argp, which may examine and, as noted, modify fields. */ struct argp_state { /* The top level ARGP being parsed. */ __const struct argp *argp; /* The argument vector being parsed. May be modified. */ int argc; char **argv; /* The index in ARGV of the next arg that to be parsed. May be modified. */ int next; /* The flags supplied to argp_parse. May be modified. */ unsigned flags; /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the number of the current arg, starting at zero, and incremented after each such call returns. At all other times, this is the number of such arguments that have been processed. */ unsigned arg_num; /* If non-zero, the index in ARGV of the first argument following a special `--' argument (which prevents anything following being interpreted as an option). Only set once argument parsing has proceeded past this point. */ int quoted; /* An arbitrary pointer passed in from the user. */ void *input; /* Values to pass to child parsers. This vector will be the same length as the number of children for the current parser. */ void **child_inputs; /* For the parser's use. Initialized to 0. */ void *hook; /* The name used when printing messages. This is initialized to ARGV[0], or PROGRAM_INVOCATION_NAME if that is unavailable. */ char *name; /* Streams used when argp prints something. */ FILE *err_stream; /* For errors; initialized to stderr. */ FILE *out_stream; /* For information; initialized to stdout. */ void *pstate; /* Private, for use by argp. */ }; /* Flags for argp_parse (note that the defaults are those that are convenient for program command line parsing): */ /* Don't ignore the first element of ARGV. Normally (and always unless ARGP_NO_ERRS is set) the first element of the argument vector is skipped for option parsing purposes, as it corresponds to the program name in a command line. */ #define ARGP_PARSE_ARGV0 0x01 /* Don't print error messages for unknown options to stderr; unless this flag is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program name in the error messages. This flag implies ARGP_NO_EXIT (on the assumption that silent exiting upon errors is bad behaviour). */ #define ARGP_NO_ERRS 0x02 /* Don't parse any non-option args. Normally non-option args are parsed by calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg as the value. Since it's impossible to know which parse function wants to handle it, each one is called in turn, until one returns 0 or an error other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the argp_parse returns prematurely (but with a return value of 0). If all args have been parsed without error, all parsing functions are called one last time with a key of ARGP_KEY_END. This flag needn't normally be set, as the normal behavior is to stop parsing as soon as some argument can't be handled. */ #define ARGP_NO_ARGS 0x04 /* Parse options and arguments in the same order they occur on the command line -- normally they're rearranged so that all options come first. */ #define ARGP_IN_ORDER 0x08 /* Don't provide the standard long option --help, which causes usage and option help information to be output to stdout, and exit (0) called. */ #define ARGP_NO_HELP 0x10 /* Don't exit on errors (they may still result in error messages). */ #define ARGP_NO_EXIT 0x20 /* Use the gnu getopt `long-only' rules for parsing arguments. */ #define ARGP_LONG_ONLY 0x40 /* Turns off any message-printing/exiting options. */ #define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP) /* Parse the options strings in ARGC & ARGV according to the options in ARGP. FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the index in ARGV of the first unparsed option is returned in it. If an unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser routine returned a non-zero value, it is returned; otherwise 0 is returned. This function may also call exit unless the ARGP_NO_HELP flag is set. INPUT is a pointer to a value to be passed in to the parser. */ extern error_t argp_parse __P ((__const struct argp *__argp, int __argc, char **__argv, unsigned __flags, int *__arg_index, void *__input)); extern error_t __argp_parse __P ((__const struct argp *__argp, int __argc, char **__argv, unsigned __flags, int *__arg_index, void *__input)); /* Global variables. */ /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ extern const char *argp_program_version; /* If defined or set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which calls this function with a stream to print the version to and a pointer to the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ extern void (*argp_program_version_hook) __P ((FILE *__stream, struct argp_state *__state)); /* If defined or set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ __const extern char *argp_program_bug_address; /* Flags for argp_help. */ #define ARGP_HELP_USAGE 0x01 /* a Usage: message. */ #define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */ #define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */ #define ARGP_HELP_LONG 0x08 /* a long help message. */ #define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */ #define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */ #define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC) #define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */ #define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to reflect ARGP_LONG_ONLY mode. */ /* These ARGP_HELP flags are only understood by argp_state_help. */ #define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */ #define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */ /* The standard thing to do after a program command line parsing error, if an error message has already been printed. */ #define ARGP_HELP_STD_ERR \ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do after a program command line parsing error, if no more specific error message has been printed. */ #define ARGP_HELP_STD_USAGE \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR) /* The standard thing to do in response to a --help option. */ #define ARGP_HELP_STD_HELP \ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR) /* Output a usage message for ARGP to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_help __P ((__const struct argp *__argp, FILE *__stream, unsigned __flags, char *__name)); extern void __argp_help __P ((__const struct argp *__argp, FILE *__stream, unsigned __flags, char *__name)); /* The following routines are intended to be called from within an argp parsing routine (thus taking an argp_state structure as the first argument). They may or may not print an error message and exit, depending on the flags in STATE -- in any case, the caller should be prepared for them *not* to exit, and should return an appropiate error after calling them. [argp_usage & argp_error should probably be called argp_state_..., but they're used often enough that they should be short] */ /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are from the set ARGP_HELP_*. */ extern void argp_state_help __P ((__const struct argp_state *__state, FILE *__stream, unsigned __flags)); extern void __argp_state_help __P ((__const struct argp_state *__state, FILE *__stream, unsigned __flags)); /* Possibly output the standard usage message for ARGP to stderr and exit. */ extern void argp_usage __P ((__const struct argp_state *__state)); extern void __argp_usage __P ((__const struct argp_state *__state)); /* If appropriate, print the printf string FMT and following args, preceded by the program name and `:', to stderr, and followed by a `Try ... --help' message, then exit (1). */ extern void argp_error __P ((__const struct argp_state *__state, __const char *__fmt, ...)) #ifndef CONSTRUCTOR_FAILS __attribute__ ((__format__ (__printf__, 2, 3))); #else ; #endif extern void __argp_error __P ((__const struct argp_state *__state, __const char *__fmt, ...)) #ifndef CONSTRUCTOR_FAILS __attribute__ ((__format__ (__printf__, 2, 3))); #else ; #endif /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print to STATE->err_stream. This is useful for argument parsing code that is shared between program startup (when exiting is desired) and runtime option parsing (when typically an error code is returned instead). The difference between this function and argp_error is that the latter is for *parsing errors*, and the former is for other problems that occur during parsing but don't reflect a (syntactic) problem with the input. */ extern void argp_failure __P ((__const struct argp_state *__state, int __status, int __errnum, __const char *__fmt, ...)) #ifndef CONSTRUCTOR_FAILS __attribute__ ((__format__ (__printf__, 4, 5))); #else ; #endif extern void __argp_failure __P ((__const struct argp_state *__state, int __status, int __errnum, __const char *__fmt, ...)) #ifndef CONSTRUCTOR_FAILS __attribute__ ((__format__ (__printf__, 4, 5))); #else ; #endif /* Returns true if the option OPT is a valid short option. */ extern int _option_is_short __P ((__const struct argp_option *__opt)); extern int __option_is_short __P ((__const struct argp_option *__opt)); /* Returns true if the option OPT is in fact the last (unused) entry in an options array. */ extern int _option_is_end __P ((__const struct argp_option *__opt)); extern int __option_is_end __P ((__const struct argp_option *__opt)); /* Return the input field for ARGP in the parser corresponding to STATE; used by the help routines. */ extern void *_argp_input __P ((__const struct argp *argp, __const struct argp_state *state)); extern void *__argp_input __P ((__const struct argp *argp, __const struct argp_state *state)); #ifdef __OPTIMIZE__ #if !_LIBC # define __argp_usage argp_usage # define __argp_state_help argp_state_help # define __option_is_short _option_is_short # define __option_is_end _option_is_end #endif #ifndef ARGP_EI # define ARGP_EI extern inline #endif ARGP_EI void __argp_usage (__const struct argp_state *__state) { __argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); } ARGP_EI int __option_is_short (__const struct argp_option *__opt) { if (__opt->flags & OPTION_DOC) return 0; else { int __key = __opt->key; return __key > 0 && __key < UCHAR_MAX && isprint (__key); } } ARGP_EI int __option_is_end (__const struct argp_option *__opt) { return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; } #if !_LIBC # undef __argp_usage # undef __argp_state_help # undef __option_is_short # undef __option_is_end #endif #endif /* __OPTIMIZE__ */ #ifdef __cplusplus } #endif #endif /* __ARGP_H__ */ ifile-1.3.9/argp/configure0000755000175000017500000047555111306214407014501 0ustar jasonjason#! /bin/sh # 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="argp.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 CPPFLAGS CFLAGS CC LDFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB EGREP ARGP_GETOPT_O_FILES 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 _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-dmalloc build with the dmalloc library 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 # configure.in for "libargp". # Process this file with autoconf to produce a configure script. # Let the user set CPPFLAGS and CFLAGS on the ./configure command-line if test -z "$CFLAGS" ; then if test -z "$CC" ; then CFLAGS="-g -O -Wall" #provide a default for CFLAGS for gcc else CFLAGS="-O" #provide a default for CFLAGS for others fi fi # Find the compiler 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 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 # Avoid using GCC __attributes__ for non-GCC compilers if test -z "$GCC" ; then CFLAGS="-DCONSTRUCTOR_FAILS=1 $CFLAGS" fi # Find some installation programs 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' if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; 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_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Find out if we have getopt.h 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 getopt.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 # Find out if we have alloca.h for ac_header in alloca.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 # Find out if we have the function getopt_long(). If we have it, # then find out if we have getopt_long_only as well. If we have both, # cause libargp to use the system functions. If we don't have one # or both, cause libargp to use the ARGP_GETOPT_O_FILES. # Why not pass a list of functions to AC_CHECK_FUNCS? It calls the "match" # action if any function is found, which isn't what we want. for ac_func in getopt_long 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 for ac_func in getopt_long_only 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 ARGP_GETOPT_O_FILES='' else ARGP_GETOPT_O_FILES='$(ARGP_GETOPT_O_FILES)' fi done else ARGP_GETOPT_O_FILES='$(ARGP_GETOPT_O_FILES)' fi done # Find out if we have the function strerror() for ac_func in strerror 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 # Needed by argp-help.c for ac_func in strndup 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 # Needed by argp-fmtstream.h echo "$as_me:$LINENO: checking for ssize_t" >&5 echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 if test "${ac_cv_type_ssize_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 ((ssize_t *) 0) return 0; if (sizeof (ssize_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_ssize_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ssize_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 if test $ac_cv_type_ssize_t = yes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi # Needed by argp-fmtstream.c for ac_func in memmove vsnprintf 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 # Needed by argp-help.c for ac_func in strerror 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 # strcasecmp() is in /usr/include/strings.h on SunOS. for ac_header in strings.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 -z "$HAVE_VSNPRINTF" ; then # Find out if vsprintf() returns the number of chars written, or # a pointer to the string echo "$as_me:$LINENO: checking if vsprintf returns int" >&5 echo $ECHO_N "checking if vsprintf returns int... $ECHO_C" >&6 if test "$cross_compiling" = yes; then VSPRINTF_RETURNS_INT=0 echo "$as_me:$LINENO: result: guessing no" >&5 echo "${ECHO_T}guessing no" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ main() { char *buf = malloc(16); if (2 == (int)vsprintf(buf, "12")) exit (0); exit (-1);} _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 VSPRINTF_RETURNS_INT=1; cat >>confdefs.h <<\_ACEOF #define VSPRINTF_RETURNS_INT 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 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 ) VSPRINTF_RETURNS_INT=0 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi # Find out if the libc has the global variables # program_invocation_short_name,program_invocation_name echo "$as_me:$LINENO: checking program_invocation_name" >&5 echo $ECHO_N "checking program_invocation_name... $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. */ int main () { void foo() {program_invocation_name = "foo";} ; 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 HAVE_PROGRAM_INVOCATION_NAME=1 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 "$HAVE_PROGRAM_INVOCATION_NAME" = 1 ; then cat >>confdefs.h <<\_ACEOF #define HAVE_PROGRAM_INVOCATION_NAME 1 _ACEOF echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Check for ANSI/non-ANSI string functions 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 for ac_header in string.h memory.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 # --with-dmalloc option: add dmalloc library # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" fi; if test "$with_dmalloc" = yes; then echo "$as_me:$LINENO: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $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 dmalloc_debug (); int main () { dmalloc_debug (); ; 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_lib_dmalloc_dmalloc_debug=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dmalloc_dmalloc_debug=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then LIBS="$LIBS -ldmalloc"; CPPFLAGS="$CPPFLAGS -DDMALLOC" fi fi # Write the Makefiles ac_config_files="$ac_config_files 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 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed 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 Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.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. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason 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,@CPPFLAGS@,$CPPFLAGS,;t t s,@CFLAGS@,$CFLAGS,;t t s,@CC@,$CC,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@EGREP@,$EGREP,;t t s,@ARGP_GETOPT_O_FILES@,$ARGP_GETOPT_O_FILES,;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 # 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; } 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 _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 { (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 ifile-1.3.9/argp/argp.c0000644000175000017500000000004211306214407013642 0ustar jasonjason#define ARGP_EI #include "argp.h" ifile-1.3.9/argp/argp-ba.c0000644000175000017500000000250011306214407014223 0ustar jasonjason/* Default definition for ARGP_PROGRAM_BUG_ADDRESS. Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* If set by the user program, it should point to string that is the bug-reporting address for the program. It will be printed by argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ const char *argp_program_bug_address = 0; ifile-1.3.9/argp/argp-ex2.c0000644000175000017500000000245311306214407014346 0ustar jasonjason/* Argp example #2 -- a pretty minimal program using argp */ /* This program doesn't use any options or arguments, but uses argp to be compliant with the GNU standard command line format. In addition to making sure no arguments are given, and implementing a --help option, this example will have a --version option, and will put the given documentation string and bug address in the --help output, as per GNU standards. The variable ARGP contains the argument parser specification; adding fields to this structure is the way most parameters are passed to argp_parse (the first three fields are usually used, but not in this small program). There are also two global variables that argp knows about defined here, ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are global variables becuase they will almost always be constant for a given program, even if it uses different argument parsers for various tasks). */ #include const char *argp_program_version = "argp-ex2 1.0"; const char *argp_program_bug_address = ""; static char doc[] = "Argp example #2 -- a pretty minimal program using argp"; static struct argp argp = { 0, 0, 0, doc }; int main (int argc, char **argv) { argp_parse (&argp, argc, argv, 0, 0, 0); exit (0); } ifile-1.3.9/argp/argp-ex4.c0000644000175000017500000001155511306214407014353 0ustar jasonjason/* Argp example #4 -- a program with somewhat more complicated options */ /* This program uses the same features as example 3, but has more options, and somewhat more structure in the -help output. It also shows how you can `steal' the remainder of the input arguments past a certain point, for programs that accept a list of items. It also shows the special argp KEY value ARGP_KEY_NO_ARGS, which is only given if no non-option arguments were supplied to the program. For structuring the help output, two features are used, *headers* which are entries in the options vector with the first four fields being zero, and a two part documentation string (in the variable DOC), which allows documentation both before and after the options; the two parts of DOC are separated by a vertical-tab character ('\v', or '\013'). By convention, the documentation before the options is just a short string saying what the program does, and that afterwards is longer, describing the behavior in more detail. All documentation strings are automatically filled for output, although newlines may be included to force a line break at a particular point. All documenation strings are also passed to the `gettext' function, for possible translation into the current locale. */ #include /* #include */ #include const char *argp_program_version = "argp-ex4 1.0"; const char *argp_program_bug_address = ""; static char doc[] = "Argp example #4 -- a program with somewhat more complicated options\ \vThis part of the documentation comes *after* the options; note that\ it is automatically filled, but it's possible to force a line-break,\ e.g.\n<-- here."; static char args_doc[] = "ARG1 [STRING...]"; /* Keys for options without short-options. */ #define OPT_ABORT 1 /* --abort */ static struct argp_option options[] = { {"verbose", 'v', 0, 0, "Produce verbose output" }, {"quiet", 'q', 0, 0, "Don't produce any output" }, {"silent", 's', 0, OPTION_ALIAS }, {"output", 'o', "FILE", 0, "Output to FILE instead of standard output" }, {0, 0, 0, 0, "The following options should be grouped together:" }, {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL, "Repeat the output COUNT (default 10) times"}, {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"}, { 0 } }; /* Used by main to communicate with parse_opt. */ struct arguments { char *arg1; /* ARG1 */ char **strings; /* [STRING...] */ int silent, verbose, abort; /* -s, -v, --abort */ char *output_file; /* --output=FILE */ int repeat_count; /* --repeat[=COUNT] */ }; static error_t parse_opt (int key, char *arg, struct argp_state *state) { /* Get the INPUT argument from argp_parse, which we know is a pointer to our arguments structure. */ struct arguments *arguments = state->input; switch (key) { case 'q': case 's': arguments->silent = 1; break; case 'v': arguments->verbose = 1; break; case 'o': arguments->output_file = arg; break; case 'r': arguments->repeat_count = arg ? atoi (arg) : 10; break; case OPT_ABORT: arguments->abort = 1; break; case ARGP_KEY_NO_ARGS: argp_usage (state); case ARGP_KEY_ARG: /* Here we know that STATE->arg_num == 0, since we force argument parsing to end before any more arguments can get here. */ arguments->arg1 = arg; /* Now we consume all the rest of the arguments. STATE->next is the index in STATE->argv of the next argument to be parsed, which is the first STRING we're interested in, so we can just use `&state->argv[state->next]' as the value for arguments->strings. IN ADDITION, by setting STATE->next to the end of the arguments, we can force argp to stop parsing here and return. */ arguments->strings = &state->argv[state->next]; state->next = state->argc; break; default: return ARGP_ERR_UNKNOWN; } return 0; } static struct argp argp = { options, parse_opt, args_doc, doc }; int main (int argc, char **argv) { int i, j; struct arguments arguments; /* Default values. */ arguments.silent = 0; arguments.verbose = 0; arguments.output_file = "-"; arguments.repeat_count = 1; arguments.abort = 0; argp_parse (&argp, argc, argv, 0, 0, &arguments); if (arguments.abort) { fprintf (stderr, "ABORTED"); exit (-1); } for (i = 0; i < arguments.repeat_count; i++) { printf ("ARG1 = %s\n", arguments.arg1); printf ("STRINGS = "); for (j = 0; arguments.strings[j]; j++) printf (j == 0 ? "%s" : ", %s", arguments.strings[j]); printf ("\n"); printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n", arguments.output_file, arguments.verbose ? "yes" : "no", arguments.silent ? "yes" : "no"); } exit (0); } ifile-1.3.9/argp/argp-namefrob.h0000644000175000017500000000643411306214407015451 0ustar jasonjason/* Name frobnication for compiling argp outside of glibc Copyright (C) 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if !_LIBC /* This code is written for inclusion in gnu-libc, and uses names in the namespace reserved for libc. If we're not compiling in libc, define those names to be the normal ones instead. */ /* argp-parse functions */ #undef __argp_parse #define __argp_parse argp_parse #undef __option_is_end #define __option_is_end _option_is_end #undef __option_is_short #define __option_is_short _option_is_short #undef __argp_input #define __argp_input _argp_input /* argp-help functions */ #undef __argp_help #define __argp_help argp_help #undef __argp_error #define __argp_error argp_error #undef __argp_failure #define __argp_failure argp_failure #undef __argp_state_help #define __argp_state_help argp_state_help #undef __argp_usage #define __argp_usage argp_usage /* argp-fmtstream functions */ #undef __argp_make_fmtstream #define __argp_make_fmtstream argp_make_fmtstream #undef __argp_fmtstream_free #define __argp_fmtstream_free argp_fmtstream_free #undef __argp_fmtstream_putc #define __argp_fmtstream_putc argp_fmtstream_putc #undef __argp_fmtstream_puts #define __argp_fmtstream_puts argp_fmtstream_puts #undef __argp_fmtstream_write #define __argp_fmtstream_write argp_fmtstream_write #undef __argp_fmtstream_printf #define __argp_fmtstream_printf argp_fmtstream_printf #undef __argp_fmtstream_set_lmargin #define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin #undef __argp_fmtstream_set_rmargin #define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin #undef __argp_fmtstream_set_wmargin #define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin #undef __argp_fmtstream_point #define __argp_fmtstream_point argp_fmtstream_point #undef __argp_fmtstream_update #define __argp_fmtstream_update _argp_fmtstream_update #undef __argp_fmtstream_ensure #define __argp_fmtstream_ensure _argp_fmtstream_ensure #undef __argp_fmtstream_lmargin #define __argp_fmtstream_lmargin argp_fmtstream_lmargin #undef __argp_fmtstream_rmargin #define __argp_fmtstream_rmargin argp_fmtstream_rmargin #undef __argp_fmtstream_wmargin #define __argp_fmtstream_wmargin argp_fmtstream_wmargin /* normal libc functions we call */ #undef __sleep #define __sleep sleep #undef __strcasecmp #define __strcasecmp strcasecmp #undef __vsnprintf #define __vsnprintf vsnprintf #endif /* !_LIBC */ #ifndef __set_errno #define __set_errno(e) (errno = (e)) #endif ifile-1.3.9/argp/strndup.c0000644000175000017500000000123611306214407014416 0ustar jasonjason/* Implementation of strndup() for libc's that don't have it. */ #if !HAVE_STRNDUP #include #include #include #include /* Find the length of STRING, but scan at most MAXLEN characters. If no '\0' terminator is found in that many characters, return MAXLEN. */ size_t strnlen (const char *string, size_t maxlen) { const char *end = memchr (string, '\0', maxlen); return end ? end - string : maxlen; } char * strndup (const char *s, size_t n) { size_t len = strnlen (s, n); char *new = (char *) malloc (len + 1); if (new == NULL) return NULL; new[len] = '\0'; return memcpy (new, s, len); } #endif ifile-1.3.9/argp/argp-ex1.c0000644000175000017500000000057311306214407014346 0ustar jasonjason/* Argp example #1 -- a minimal program using argp */ /* This is (probably) the smallest possible program that uses argp. It won't do much except give an error messages and exit when there are any arguments, and print a (rather pointless) messages for --help. */ #include int main (int argc, char **argv) { argp_parse (0, argc, argv, 0, 0, 0); exit (0); } ifile-1.3.9/argp/argp-help.c0000644000175000017500000014411011306214407014575 0ustar jasonjason/* Hierarchial argument parsing help output Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef _AIX #pragma alloca #endif #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #if HAVE_ALLOCA_H #include #endif #if HAVE_STRINGS_H #include #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ #ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) #else # define _(msgid) (msgid) # define gettext(msgid) (msgid) #endif #endif #include "argp.h" #include "argp-fmtstream.h" #include "argp-namefrob.h" #if !HAVE_STRNDUP char *strndup (const char *s, size_t n); #endif /* User-selectable (using an environment variable) formatting parameters. These may be specified in an environment variable called `ARGP_HELP_FMT', with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2 Where VALn must be a positive integer. The list of variables is in the UPARAM_NAMES vector, below. */ /* Default parameters. */ #define DUP_ARGS 0 /* True if option argument can be duplicated. */ #define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */ #define SHORT_OPT_COL 2 /* column in which short options start */ #define LONG_OPT_COL 6 /* column in which long options start */ #define DOC_OPT_COL 2 /* column in which doc options start */ #define OPT_DOC_COL 29 /* column in which option text starts */ #define HEADER_COL 1 /* column in which group headers are printed */ #define USAGE_INDENT 12 /* indentation of wrapped usage lines */ #define RMARGIN 79 /* right margin used for wrapping */ /* User-selectable (using an environment variable) formatting parameters. They must all be of type `int' for the parsing code to work. */ struct uparams { /* If true, arguments for an option are shown with both short and long options, even when a given option has both, e.g. `-x ARG, --longx=ARG'. If false, then if an option has both, the argument is only shown with the long one, e.g., `-x, --longx=ARG', and a message indicating that this really means both is printed below the options. */ int dup_args; /* This is true if when DUP_ARGS is false, and some duplicate arguments have been suppressed, an explanatory message should be printed. */ int dup_args_note; /* Various output columns. */ int short_opt_col; int long_opt_col; int doc_opt_col; int opt_doc_col; int header_col; int usage_indent; int rmargin; int valid; /* True when the values in here are valid. */ }; /* This is a global variable, as user options are only ever read once. */ static struct uparams uparams = { DUP_ARGS, DUP_ARGS_NOTE, SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL, USAGE_INDENT, RMARGIN, 0 }; /* A particular uparam, and what the user name is. */ struct uparam_name { const char *name; /* User name. */ int is_bool; /* Whether it's `boolean'. */ size_t uparams_offs; /* Location of the (int) field in UPARAMS. */ }; /* The name-field mappings we know about. */ static const struct uparam_name uparam_names[] = { { "dup-args", 1, offsetof (struct uparams, dup_args) }, { "dup-args-note", 1, offsetof (struct uparams, dup_args_note) }, { "short-opt-col", 0, offsetof (struct uparams, short_opt_col) }, { "long-opt-col", 0, offsetof (struct uparams, long_opt_col) }, { "doc-opt-col", 0, offsetof (struct uparams, doc_opt_col) }, { "opt-doc-col", 0, offsetof (struct uparams, opt_doc_col) }, { "header-col", 0, offsetof (struct uparams, header_col) }, { "usage-indent", 0, offsetof (struct uparams, usage_indent) }, { "rmargin", 0, offsetof (struct uparams, rmargin) }, { 0 } }; /* Read user options from the environment, and fill in UPARAMS appropiately. */ static void fill_in_uparams (const struct argp_state *state) { const char *var = getenv ("ARGP_HELP_FMT"); #define SKIPWS(p) do { while (isspace (*p)) p++; } while (0); if (var) /* Parse var. */ while (*var) { SKIPWS (var); if (isalpha (*var)) { size_t var_len; const struct uparam_name *un; int unspec = 0, val = 0; const char *arg = var; while (isalnum (*arg) || *arg == '-' || *arg == '_') arg++; var_len = arg - var; SKIPWS (arg); if (*arg == '\0' || *arg == ',') unspec = 1; else if (*arg == '=') { arg++; SKIPWS (arg); } if (unspec) if (var[0] == 'n' && var[1] == 'o' && var[2] == '-') { val = 0; var += 3; var_len -= 3; } else val = 1; else if (isdigit (*arg)) { val = atoi (arg); while (isdigit (*arg)) arg++; SKIPWS (arg); } for (un = uparam_names; un->name; un++) if (strlen (un->name) == var_len && strncmp (var, un->name, var_len) == 0) { if (unspec && !un->is_bool) __argp_failure (state, 0, 0, _("%.*s: ARGP_HELP_FMT parameter requires a value"), (int)var_len, var); else *(int *)((char *)&uparams + un->uparams_offs) = val; break; } if (! un->name) __argp_failure (state, 0, 0, _("%.*s: Unknown ARGP_HELP_FMT parameter"), (int)var_len, var); var = arg; if (*var == ',') var++; } else if (*var) { __argp_failure (state, 0, 0, _("Garbage in ARGP_HELP_FMT: %s"), var); break; } } } /* Returns true if OPT hasn't been marked invisible. Visibility only affects whether OPT is displayed or used in sorting, not option shadowing. */ #define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN)) /* Returns true if OPT is an alias for an earlier option. */ #define oalias(opt) ((opt)->flags & OPTION_ALIAS) /* Returns true if OPT is an documentation-only entry. */ #define odoc(opt) ((opt)->flags & OPTION_DOC) /* Returns true if OPT is the end-of-list marker for a list of options. */ #define oend(opt) __option_is_end (opt) /* Returns true if OPT has a short option. */ #define oshort(opt) __option_is_short (opt) /* The help format for a particular option is like: -xARG, -yARG, --long1=ARG, --long2=ARG Documentation... Where ARG will be omitted if there's no argument, for this option, or will be surrounded by "[" and "]" appropiately if the argument is optional. The documentation string is word-wrapped appropiately, and if the list of options is long enough, it will be started on a separate line. If there are no short options for a given option, the first long option is indented slighly in a way that's supposed to make most long options appear to be in a separate column. For example, the following output (from ps): -p PID, --pid=PID List the process PID --pgrp=PGRP List processes in the process group PGRP -P, -x, --no-parent Include processes without parents -Q, --all-fields Don't elide unusable fields (normally if there's some reason ps can't print a field for any process, it's removed from the output entirely) -r, --reverse, --gratuitously-long-reverse-option Reverse the order of any sort --session[=SID] Add the processes from the session SID (which defaults to the sid of the current process) Here are some more options: -f ZOT, --foonly=ZOT Glork a foonly -z, --zaza Snit a zar -?, --help Give this help list --usage Give a short usage message -V, --version Print program version The struct argp_option array for the above could look like: { {"pid", 'p', "PID", 0, "List the process PID"}, {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"}, {"no-parent", 'P', 0, 0, "Include processes without parents"}, {0, 'x', 0, OPTION_ALIAS}, {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" " if there's some reason ps can't" " print a field for any process, it's" " removed from the output entirely)" }, {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL, "Add the processes from the session" " SID (which defaults to the sid of" " the current process)" }, {0,0,0,0, "Here are some more options:"}, {"foonly", 'f', "ZOT", 0, "Glork a foonly"}, {"zaza", 'z', 0, 0, "Snit a zar"}, {0} } Note that the last three options are automatically supplied by argp_parse, unless you tell it not to with ARGP_NO_HELP. */ /* Returns true if CH occurs between BEG and END. */ static int find_char (char ch, char *beg, char *end) { while (beg < end) if (*beg == ch) return 1; else beg++; return 0; } struct hol_cluster; /* fwd decl */ struct hol_entry { /* First option. */ const struct argp_option *opt; /* Number of options (including aliases). */ unsigned num; /* A pointers into the HOL's short_options field, to the first short option letter for this entry. The order of the characters following this point corresponds to the order of options pointed to by OPT, and there are at most NUM. A short option recorded in a option following OPT is only valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's probably been shadowed by some other entry). */ char *short_options; /* Entries are sorted by their group first, in the order: 1, 2, ..., n, 0, -m, ..., -2, -1 and then alphabetically within each group. The default is 0. */ int group; /* The cluster of options this entry belongs to, or 0 if none. */ struct hol_cluster *cluster; /* The argp from which this option came. */ const struct argp *argp; }; /* A cluster of entries to reflect the argp tree structure. */ struct hol_cluster { /* A descriptive header printed before options in this cluster. */ const char *header; /* Used to order clusters within the same group with the same parent, according to the order in which they occured in the parent argp's child list. */ int index; /* How to sort this cluster with respect to options and other clusters at the same depth (clusters always follow options in the same group). */ int group; /* The cluster to which this cluster belongs, or 0 if it's at the base level. */ struct hol_cluster *parent; /* The argp from which this cluster is (eventually) derived. */ const struct argp *argp; /* The distance this cluster is from the root. */ int depth; /* Clusters in a given hol are kept in a linked list, to make freeing them possible. */ struct hol_cluster *next; }; /* A list of options for help. */ struct hol { /* An array of hol_entry's. */ struct hol_entry *entries; /* The number of entries in this hol. If this field is zero, the others are undefined. */ unsigned num_entries; /* A string containing all short options in this HOL. Each entry contains pointers into this string, so the order can't be messed with blindly. */ char *short_options; /* Clusters of entries in this hol. */ struct hol_cluster *clusters; }; /* Create a struct hol from the options in ARGP. CLUSTER is the hol_cluster in which these entries occur, or 0, if at the root. */ static struct hol * make_hol (const struct argp *argp, struct hol_cluster *cluster) { char *so; const struct argp_option *o; const struct argp_option *opts = argp->options; struct hol_entry *entry; unsigned num_short_options = 0; struct hol *hol = malloc (sizeof (struct hol)); assert (hol); hol->num_entries = 0; hol->clusters = 0; if (opts) { int cur_group = 0; /* The first option must not be an alias. */ assert (! oalias (opts)); /* Calculate the space needed. */ for (o = opts; ! oend (o); o++) { if (! oalias (o)) hol->num_entries++; if (oshort (o)) num_short_options++; /* This is an upper bound. */ } hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries); hol->short_options = malloc (num_short_options + 1); assert (hol->entries && hol->short_options); /* Fill in the entries. */ so = hol->short_options; for (o = opts, entry = hol->entries; ! oend (o); entry++) { entry->opt = o; entry->num = 0; entry->short_options = so; entry->group = cur_group = o->group ? o->group : ((!o->name && !o->key) ? cur_group + 1 : cur_group); entry->cluster = cluster; entry->argp = argp; do { entry->num++; if (oshort (o) && ! find_char (o->key, hol->short_options, so)) /* O has a valid short option which hasn't already been used.*/ *so++ = o->key; o++; } while (! oend (o) && oalias (o)); } *so = '\0'; /* null terminated so we can find the length */ } return hol; } /* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the associated argp child list entry), INDEX, and PARENT, and return a pointer to it. ARGP is the argp that this cluster results from. */ static struct hol_cluster * hol_add_cluster (struct hol *hol, int group, const char *header, int index, struct hol_cluster *parent, const struct argp *argp) { struct hol_cluster *cl = malloc (sizeof (struct hol_cluster)); if (cl) { cl->group = group; cl->header = header; cl->index = index; cl->parent = parent; cl->argp = argp; cl->next = hol->clusters; hol->clusters = cl; } return cl; } /* Free HOL and any resources it uses. */ static void hol_free (struct hol *hol) { struct hol_cluster *cl = hol->clusters; while (cl) { struct hol_cluster *next = cl->next; free (cl); cl = next; } if (hol->num_entries > 0) { free (hol->entries); free (hol->short_options); } free (hol); } #ifdef _AIX #define inline #endif static inline int hol_entry_short_iterate (const struct hol_entry *entry, int (*func)(const struct argp_option *opt, const struct argp_option *real, void *cookie), void *cookie) { unsigned nopts; int val = 0; const struct argp_option *opt, *real = entry->opt; char *so = entry->short_options; for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) if (oshort (opt) && *so == opt->key) { if (!oalias (opt)) real = opt; if (ovisible (opt)) val = (*func)(opt, real, cookie); so++; } return val; } static inline int hol_entry_long_iterate (const struct hol_entry *entry, int (*func)(const struct argp_option *opt, const struct argp_option *real, void *cookie), void *cookie) { unsigned nopts; int val = 0; const struct argp_option *opt, *real = entry->opt; for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--) if (opt->name) { if (!oalias (opt)) real = opt; if (ovisible (opt)) val = (*func)(opt, real, cookie); } return val; } /* Iterator that returns true for the first short option. */ static inline int until_short (const struct argp_option *opt, const struct argp_option *real, void *cookie) { return oshort (opt) ? opt->key : 0; } /* Returns the first valid short option in ENTRY, or 0 if there is none. */ static char hol_entry_first_short (const struct hol_entry *entry) { return hol_entry_short_iterate (entry, until_short, 0); } /* Returns the first valid long option in ENTRY, or 0 if there is none. */ static const char * hol_entry_first_long (const struct hol_entry *entry) { const struct argp_option *opt; unsigned num; for (opt = entry->opt, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) return opt->name; return 0; } /* Returns the entry in HOL with the long option name NAME, or 0 if there is none. */ static struct hol_entry * hol_find_entry (struct hol *hol, const char *name) { struct hol_entry *entry = hol->entries; unsigned num_entries = hol->num_entries; while (num_entries-- > 0) { const struct argp_option *opt = entry->opt; unsigned num_opts = entry->num; while (num_opts-- > 0) if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0) return entry; else opt++; entry++; } return 0; } /* If an entry with the long option NAME occurs in HOL, set it's special sort position to GROUP. */ static void hol_set_group (struct hol *hol, const char *name, int group) { struct hol_entry *entry = hol_find_entry (hol, name); if (entry) entry->group = group; } /* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1. EQ is what to return if GROUP1 and GROUP2 are the same. */ static int group_cmp (int group1, int group2, int eq) { if (group1 == group2) return eq; else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0)) return group1 - group2; else return group2 - group1; } /* Compare clusters CL1 & CL2 by the order that they should appear in output. */ static int hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2) { /* If one cluster is deeper than the other, use its ancestor at the same level, so that finding the common ancestor is straightforward. */ while (cl1->depth < cl2->depth) cl1 = cl1->parent; while (cl2->depth < cl1->depth) cl2 = cl2->parent; /* Now reduce both clusters to their ancestors at the point where both have a common parent; these can be directly compared. */ while (cl1->parent != cl2->parent) cl1 = cl1->parent, cl2 = cl2->parent; return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index); } /* Return the ancestor of CL that's just below the root (i.e., has a parent of 0). */ static struct hol_cluster * hol_cluster_base (struct hol_cluster *cl) { while (cl->parent) cl = cl->parent; return cl; } /* Return true if CL1 is a child of CL2. */ static int hol_cluster_is_child (const struct hol_cluster *cl1, const struct hol_cluster *cl2) { while (cl1 && cl1 != cl2) cl1 = cl1->parent; return cl1 == cl2; } /* Given the name of a OPTION_DOC option, modifies NAME to start at the tail that should be used for comparisons, and returns true iff it should be treated as a non-option. */ static int canon_doc_option (const char **name) { int non_opt; /* Skip initial whitespace. */ while (isspace (**name)) (*name)++; /* Decide whether this looks like an option (leading `-') or not. */ non_opt = (**name != '-'); /* Skip until part of name used for sorting. */ while (**name && !isalnum (**name)) (*name)++; return non_opt; } /* Order ENTRY1 & ENTRY2 by the order which they should appear in a help listing. */ static int hol_entry_cmp (const struct hol_entry *entry1, const struct hol_entry *entry2) { /* The group numbers by which the entries should be ordered; if either is in a cluster, then this is just the group within the cluster. */ int group1 = entry1->group, group2 = entry2->group; if (entry1->cluster != entry2->cluster) /* The entries are not within the same cluster, so we can't compare them directly, we have to use the appropiate clustering level too. */ if (! entry1->cluster) /* ENTRY1 is at the `base level', not in a cluster, so we have to compare it's group number with that of the base cluster in which ENTRY2 resides. Note that if they're in the same group, the clustered option always comes laster. */ return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1); else if (! entry2->cluster) /* Likewise, but ENTRY2's not in a cluster. */ return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1); else /* Both entries are in clusters, we can just compare the clusters. */ return hol_cluster_cmp (entry1->cluster, entry2->cluster); else if (group1 == group2) /* The entries are both in the same cluster and group, so compare them alphabetically. */ { int short1 = hol_entry_first_short (entry1); int short2 = hol_entry_first_short (entry2); int doc1 = odoc (entry1->opt); int doc2 = odoc (entry2->opt); const char *long1 = hol_entry_first_long (entry1); const char *long2 = hol_entry_first_long (entry2); if (doc1) doc1 = canon_doc_option (&long1); if (doc2) doc2 = canon_doc_option (&long2); if (doc1 != doc2) /* `documentation' options always follow normal options (or documentation options that *look* like normal options). */ return doc1 - doc2; else if (!short1 && !short2 && long1 && long2) /* Only long options. */ return __strcasecmp (long1, long2); else /* Compare short/short, long/short, short/long, using the first character of long options. Entries without *any* valid options (such as options with OPTION_HIDDEN set) will be put first, but as they're not displayed, it doesn't matter where they are. */ { char first1 = short1 ? short1 : long1 ? *long1 : 0; char first2 = short2 ? short2 : long2 ? *long2 : 0; int lower_cmp = tolower (first1) - tolower (first2); /* Compare ignoring case, except when the options are both the same letter, in which case lower-case always comes first. */ return lower_cmp ? lower_cmp : first2 - first1; } } else /* Within the same cluster, but not the same group, so just compare groups. */ return group_cmp (group1, group2, 0); } /* Version of hol_entry_cmp with correct signature for qsort. */ static int hol_entry_qcmp (const void *entry1_v, const void *entry2_v) { return hol_entry_cmp (entry1_v, entry2_v); } /* Sort HOL by group and alphabetically by option name (with short options taking precedence over long). Since the sorting is for display purposes only, the shadowing of options isn't effected. */ static void hol_sort (struct hol *hol) { if (hol->num_entries > 0) qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry), hol_entry_qcmp); } /* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow any in MORE with the same name. */ static void hol_append (struct hol *hol, struct hol *more) { struct hol_cluster **cl_end = &hol->clusters; /* Steal MORE's cluster list, and add it to the end of HOL's. */ while (*cl_end) cl_end = &(*cl_end)->next; *cl_end = more->clusters; more->clusters = 0; /* Merge entries. */ if (more->num_entries > 0) if (hol->num_entries == 0) { hol->num_entries = more->num_entries; hol->entries = more->entries; hol->short_options = more->short_options; more->num_entries = 0; /* Mark MORE's fields as invalid. */ } else /* append the entries in MORE to those in HOL, taking care to only add non-shadowed SHORT_OPTIONS values. */ { unsigned left; char *so, *more_so; struct hol_entry *e; unsigned num_entries = hol->num_entries + more->num_entries; struct hol_entry *entries = malloc (num_entries * sizeof (struct hol_entry)); unsigned hol_so_len = strlen (hol->short_options); char *short_options = malloc (hol_so_len + strlen (more->short_options) + 1); memcpy (entries, hol->entries, hol->num_entries * sizeof (struct hol_entry)); memcpy (entries + hol->num_entries, more->entries, more->num_entries * sizeof (struct hol_entry)); memcpy (short_options, hol->short_options, hol_so_len); /* Fix up the short options pointers from HOL. */ for (e = entries, left = hol->num_entries; left > 0; e++, left--) e->short_options += (short_options - hol->short_options); /* Now add the short options from MORE, fixing up its entries too. */ so = short_options + hol_so_len; more_so = more->short_options; for (left = more->num_entries; left > 0; e++, left--) { int opts_left; const struct argp_option *opt; e->short_options = so; for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--) { int ch = *more_so; if (oshort (opt) && ch == opt->key) /* The next short option in MORE_SO, CH, is from OPT. */ { if (! find_char (ch, short_options, short_options + hol_so_len)) /* The short option CH isn't shadowed by HOL's options, so add it to the sum. */ *so++ = ch; more_so++; } } } *so = '\0'; free (hol->entries); free (hol->short_options); hol->entries = entries; hol->num_entries = num_entries; hol->short_options = short_options; } hol_free (more); } /* Inserts enough spaces to make sure STREAM is at column COL. */ static void indent_to (argp_fmtstream_t stream, unsigned col) { int needed = col - __argp_fmtstream_point (stream); while (needed-- > 0) __argp_fmtstream_putc (stream, ' '); } /* Output to STREAM either a space, or a newline if there isn't room for at least ENSURE characters before the right margin. */ static void space (argp_fmtstream_t stream, size_t ensure) { if (__argp_fmtstream_point (stream) + ensure >= __argp_fmtstream_rmargin (stream)) __argp_fmtstream_putc (stream, '\n'); else __argp_fmtstream_putc (stream, ' '); } /* If the option REAL has an argument, we print it in using the printf format REQ_FMT or OPT_FMT depending on whether it's a required or optional argument. */ static void arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt, argp_fmtstream_t stream) { if (real->arg) if (real->flags & OPTION_ARG_OPTIONAL) __argp_fmtstream_printf (stream, opt_fmt, gettext (real->arg)); else __argp_fmtstream_printf (stream, req_fmt, gettext (real->arg)); } /* Helper functions for hol_entry_help. */ /* State used during the execution of hol_help. */ struct hol_help_state { /* PREV_ENTRY should contain the last entry printed before this, or null if it's the first, and if an ENTRY is in a different group, and SEP_GROUPS is true, then a blank line will be printed before any output. SEP_GROUPS is also set to true if a user-specified group header is printed. */ struct hol_entry *prev_entry; int sep_groups; /* True if a duplicate option argument was suppressed (only ever set if UPARAMS.dup_args is false). */ int suppressed_dup_arg; }; /* Some state used while printing a help entry (used to communicate with helper functions). See the doc for hol_entry_help for more info, as most of the fields are copied from its arguments. */ struct pentry_state { const struct hol_entry *entry; argp_fmtstream_t stream; struct hol_help_state *hhstate; /* True if nothing's been printed so far. */ int first; /* If non-zero, the state that was used to print this help. */ const struct argp_state *state; }; /* If a user doc filter should be applied to DOC, do so. */ static const char * filter_doc (const char *doc, int key, const struct argp *argp, const struct argp_state *state) { if (argp->help_filter) /* We must apply a user filter to this output. */ { void *input = __argp_input (argp, state); return (*argp->help_filter) (key, doc, input); } else /* No filter. */ return (char *)doc; } /* Prints STR as a header line, with the margin lines set appropiately, and notes the fact that groups should be separated with a blank line. ARGP is the argp that should dictate any user doc filtering to take place. Note that the previous wrap margin isn't restored, but the left margin is reset to 0. */ static void print_header (const char *str, const struct argp *argp, struct pentry_state *pest) { const char *tstr = gettext (str); const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state); if (fstr) { if (*fstr) { if (pest->hhstate->prev_entry) /* Precede with a blank line. */ __argp_fmtstream_putc (pest->stream, '\n'); indent_to (pest->stream, uparams.header_col); __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col); __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col); __argp_fmtstream_puts (pest->stream, fstr); __argp_fmtstream_set_lmargin (pest->stream, 0); __argp_fmtstream_putc (pest->stream, '\n'); } pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */ } if (fstr != tstr) free ((char *) fstr); } /* Inserts a comma if this isn't the first item on the line, and then makes sure we're at least to column COL. If this *is* the first item on a line, prints any pending whitespace/headers that should precede this line. Also clears FIRST. */ static void comma (unsigned col, struct pentry_state *pest) { if (pest->first) { const struct hol_entry *pe = pest->hhstate->prev_entry; const struct hol_cluster *cl = pest->entry->cluster; if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group) __argp_fmtstream_putc (pest->stream, '\n'); if (pe && cl && pe->cluster != cl && cl->header && *cl->header && !hol_cluster_is_child (pe->cluster, cl)) /* If we're changing clusters, then this must be the start of the ENTRY's cluster unless that is an ancestor of the previous one (in which case we had just popped into a sub-cluster for a bit). If so, then print the cluster's header line. */ { int old_wm = __argp_fmtstream_wmargin (pest->stream); print_header (cl->header, cl->argp, pest); __argp_fmtstream_set_wmargin (pest->stream, old_wm); } pest->first = 0; } else __argp_fmtstream_puts (pest->stream, ", "); indent_to (pest->stream, col); } /* Print help for ENTRY to STREAM. */ static void hol_entry_help (struct hol_entry *entry, const struct argp_state *state, argp_fmtstream_t stream, struct hol_help_state *hhstate) { unsigned num; const struct argp_option *real = entry->opt, *opt; char *so = entry->short_options; int have_long_opt = 0; /* We have any long options. */ /* Saved margins. */ int old_lm = __argp_fmtstream_set_lmargin (stream, 0); int old_wm = __argp_fmtstream_wmargin (stream); /* PEST is a state block holding some of our variables that we'd like to share with helper functions. */ #ifndef _AIX struct pentry_state pest = { entry, stream, hhstate, 1, state }; #else struct pentry_state pest; pest.entry = entry; pest.stream = stream; pest.hhstate = hhstate; pest.first = 1; pest.state = state; #endif if (! odoc (real)) for (opt = real, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) { have_long_opt = 1; break; } /* First emit short options. */ __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */ for (opt = real, num = entry->num; num > 0; opt++, num--) if (oshort (opt) && opt->key == *so) /* OPT has a valid (non shadowed) short option. */ { if (ovisible (opt)) { comma (uparams.short_opt_col, &pest); __argp_fmtstream_putc (stream, '-'); __argp_fmtstream_putc (stream, *so); if (!have_long_opt || uparams.dup_args) arg (real, " %s", "[%s]", stream); else if (real->arg) hhstate->suppressed_dup_arg = 1; } so++; } /* Now, long options. */ if (odoc (real)) /* A `documentation' option. */ { __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col); for (opt = real, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) { comma (uparams.doc_opt_col, &pest); /* Calling gettext here isn't quite right, since sorting will have been done on the original; but documentation options should be pretty rare anyway... */ __argp_fmtstream_puts (stream, gettext (opt->name)); } } else /* A real long option. */ { int first_long_opt = 1; __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col); for (opt = real, num = entry->num; num > 0; opt++, num--) if (opt->name && ovisible (opt)) { comma (uparams.long_opt_col, &pest); __argp_fmtstream_printf (stream, "--%s", opt->name); if (first_long_opt || uparams.dup_args) arg (real, "=%s", "[=%s]", stream); else if (real->arg) hhstate->suppressed_dup_arg = 1; } } /* Next, documentation strings. */ __argp_fmtstream_set_lmargin (stream, 0); if (pest.first) /* Didn't print any switches, what's up? */ if (!oshort (real) && !real->name) /* This is a group header, print it nicely. */ print_header (real->doc, entry->argp, &pest); else /* Just a totally shadowed option or null header; print nothing. */ goto cleanup; /* Just return, after cleaning up. */ else { const char *tstr = real->doc ? gettext (real->doc) : 0; const char *fstr = filter_doc (tstr, real->key, entry->argp, state); if (fstr && *fstr) { unsigned col = __argp_fmtstream_point (stream); __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col); __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col); if (col > uparams.opt_doc_col + 3) __argp_fmtstream_putc (stream, '\n'); else if (col >= uparams.opt_doc_col) __argp_fmtstream_puts (stream, " "); else indent_to (stream, uparams.opt_doc_col); __argp_fmtstream_puts (stream, fstr); } if (fstr && fstr != tstr) free ((char *) fstr); /* Reset the left margin. */ __argp_fmtstream_set_lmargin (stream, 0); __argp_fmtstream_putc (stream, '\n'); } hhstate->prev_entry = entry; cleanup: __argp_fmtstream_set_lmargin (stream, old_lm); __argp_fmtstream_set_wmargin (stream, old_wm); } /* Output a long help message about the options in HOL to STREAM. */ static void hol_help (struct hol *hol, const struct argp_state *state, argp_fmtstream_t stream) { unsigned num; struct hol_entry *entry; struct hol_help_state hhstate = { 0, 0, 0 }; for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--) hol_entry_help (entry, state, stream, &hhstate); if (hhstate.suppressed_dup_arg && uparams.dup_args_note) { const char *tstr = _("\ Mandatory or optional arguments to long options are also mandatory or \ optional for any corresponding short options."); const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE, state ? state->argp : 0, state); if (fstr && *fstr) { __argp_fmtstream_putc (stream, '\n'); __argp_fmtstream_puts (stream, fstr); __argp_fmtstream_putc (stream, '\n'); } if (fstr && fstr != tstr) free ((char *) fstr); } } /* Helper functions for hol_usage. */ /* If OPT is a short option without an arg, append its key to the string pointer pointer to by COOKIE, and advance the pointer. */ static int add_argless_short_opt (const struct argp_option *opt, const struct argp_option *real, void *cookie) { char **snao_end = cookie; if (! (opt->arg || real->arg)) *(*snao_end)++ = opt->key; return 0; } /* If OPT is a short option with an arg, output a usage entry for it to the stream pointed at by COOKIE. */ static int usage_argful_short_opt (const struct argp_option *opt, const struct argp_option *real, void *cookie) { argp_fmtstream_t stream = cookie; const char *arg = opt->arg; if (! arg) arg = real->arg; if (arg) { arg = gettext (arg); if ((opt->flags | real->flags) & OPTION_ARG_OPTIONAL) __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg); else { /* Manually do line wrapping so that it (probably) won't get wrapped at the embedded space. */ space (stream, 6 + strlen (arg)); __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg); } } return 0; } /* Output a usage entry for the long option opt to the stream pointed at by COOKIE. */ static int usage_long_opt (const struct argp_option *opt, const struct argp_option *real, void *cookie) { argp_fmtstream_t stream = cookie; const char *arg = opt->arg; if (! arg) arg = real->arg; if (arg) { arg = gettext (arg); if ((opt->flags | real->flags) & OPTION_ARG_OPTIONAL) __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg); else __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg); } else __argp_fmtstream_printf (stream, " [--%s]", opt->name); return 0; } /* Print a short usage description for the arguments in HOL to STREAM. */ static void hol_usage (struct hol *hol, argp_fmtstream_t stream) { if (hol->num_entries > 0) { unsigned nentries; struct hol_entry *entry; char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1); char *snao_end = short_no_arg_opts; /* First we put a list of short options without arguments. */ for (entry = hol->entries, nentries = hol->num_entries ; nentries > 0 ; entry++, nentries--) hol_entry_short_iterate (entry, add_argless_short_opt, &snao_end); if (snao_end > short_no_arg_opts) { *snao_end++ = 0; __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts); } /* Now a list of short options *with* arguments. */ for (entry = hol->entries, nentries = hol->num_entries ; nentries > 0 ; entry++, nentries--) hol_entry_short_iterate (entry, usage_argful_short_opt, stream); /* Finally, a list of long options (whew!). */ for (entry = hol->entries, nentries = hol->num_entries ; nentries > 0 ; entry++, nentries--) hol_entry_long_iterate (entry, usage_long_opt, stream); } } /* Make a HOL containing all levels of options in ARGP. CLUSTER is the cluster in which ARGP's entries should be clustered, or 0. */ static struct hol * argp_hol (const struct argp *argp, struct hol_cluster *cluster) { const struct argp_child *child = argp->children; struct hol *hol = make_hol (argp, cluster); if (child) while (child->argp) { struct hol_cluster *child_cluster = ((child->group || child->header) /* Put CHILD->argp within its own cluster. */ ? hol_add_cluster (hol, child->group, child->header, child - argp->children, cluster, argp) /* Just merge it into the parent's cluster. */ : cluster); hol_append (hol, argp_hol (child->argp, child_cluster)) ; child++; } return hol; } /* Calculate how many different levels with alternative args strings exist in ARGP. */ static size_t argp_args_levels (const struct argp *argp) { size_t levels = 0; const struct argp_child *child = argp->children; if (argp->args_doc && strchr (argp->args_doc, '\n')) levels++; if (child) while (child->argp) levels += argp_args_levels ((child++)->argp); return levels; } /* Print all the non-option args documented in ARGP to STREAM. Any output is preceded by a space. LEVELS is a pointer to a byte vector the length returned by argp_args_levels; it should be initialized to zero, and updated by this routine for the next call if ADVANCE is true. True is returned as long as there are more patterns to output. */ static int argp_args_usage (const struct argp *argp, char **levels, int advance, argp_fmtstream_t stream) { char *our_level = *levels; int multiple = 0; const struct argp_child *child = argp->children; const char *doc = gettext (argp->args_doc), *nl = 0; if (doc) { nl = strchr (doc, '\n'); if (nl) /* This is a `multi-level' args doc; advance to the correct position as determined by our state in LEVELS, and update LEVELS. */ { int i; multiple = 1; for (i = 0; i < *our_level; i++) doc = nl + 1, nl = strchr (doc, '\n'); (*levels)++; } if (! nl) nl = doc + strlen (doc); /* Manually do line wrapping so that it (probably) won't get wrapped at any embedded spaces. */ space (stream, 1 + nl - doc); __argp_fmtstream_write (stream, doc, nl - doc); } if (child) while (child->argp) advance = !argp_args_usage ((child++)->argp, levels, advance, stream); if (advance && multiple) /* Need to increment our level. */ if (*nl) /* There's more we can do here. */ { (*our_level)++; advance = 0; /* Our parent shouldn't advance also. */ } else if (*our_level > 0) /* We had multiple levels, but used them up; reset to zero. */ *our_level = 0; return !advance; } /* Print the documentation for ARGP to STREAM; if POST is false, then everything preceeding a `\v' character in the documentation strings (or the whole string, for those with none) is printed, otherwise, everything following the `\v' character (nothing for strings without). Each separate bit of documentation is separated a blank line, and if PRE_BLANK is true, then the first is as well. If FIRST_ONLY is true, only the first occurance is output. Returns true if anything was output. */ static int argp_doc (const struct argp *argp, const struct argp_state *state, int post, int pre_blank, int first_only, argp_fmtstream_t stream) { const char *text; const char *inp_text; void *input = 0; int anything = 0; size_t inp_text_limit = 0; const char *doc = gettext (argp->doc); const struct argp_child *child = argp->children; if (doc) { char *vt = strchr (doc, '\v'); inp_text = post ? (vt ? vt + 1 : 0) : doc; inp_text_limit = (!post && vt) ? (vt - doc) : 0; } else inp_text = 0; if (argp->help_filter) /* We have to filter the doc strings. */ { if (inp_text_limit) /* Copy INP_TEXT so that it's nul-terminated. */ inp_text = strndup (inp_text, inp_text_limit); input = __argp_input (argp, state); text = (*argp->help_filter) (post ? ARGP_KEY_HELP_POST_DOC : ARGP_KEY_HELP_PRE_DOC, inp_text, input); } else text = (const char *) inp_text; if (text) { if (pre_blank) __argp_fmtstream_putc (stream, '\n'); if (text == inp_text && inp_text_limit) __argp_fmtstream_write (stream, inp_text, inp_text_limit); else __argp_fmtstream_puts (stream, text); if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) __argp_fmtstream_putc (stream, '\n'); anything = 1; } if (text && text != inp_text) free ((char *) text); /* Free TEXT returned from the help filter. */ if (inp_text && inp_text_limit && argp->help_filter) free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */ if (post && argp->help_filter) /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */ { text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input); if (text) { if (anything || pre_blank) __argp_fmtstream_putc (stream, '\n'); __argp_fmtstream_puts (stream, text); free ((char *) text); if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream)) __argp_fmtstream_putc (stream, '\n'); anything = 1; } } if (child) while (child->argp && !(first_only && anything)) anything |= argp_doc ((child++)->argp, state, post, anything || pre_blank, first_only, stream); return anything; } /* Output a usage message for ARGP to STREAM. If called from argp_state_help, STATE is the relevent parsing state. FLAGS are from the set ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ static void _help (const struct argp *argp, const struct argp_state *state, FILE *stream, unsigned flags, char *name) { int anything = 0; /* Whether we've output anything. */ struct hol *hol = 0; argp_fmtstream_t fs; if (! stream) return; if (! uparams.valid) fill_in_uparams (state); fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0); if (! fs) return; if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG)) { hol = argp_hol (argp, 0); /* If present, these options always come last. */ hol_set_group (hol, "help", -1); hol_set_group (hol, "version", -1); hol_sort (hol); } if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE)) /* Print a short `Usage:' message. */ { int first_pattern = 1, more_patterns; size_t num_pattern_levels = argp_args_levels (argp); char *pattern_levels = alloca (num_pattern_levels); memset (pattern_levels, 0, num_pattern_levels); do { int old_lm; int old_wm = __argp_fmtstream_set_wmargin (fs, USAGE_INDENT); char *levels = pattern_levels; __argp_fmtstream_printf (fs, "%s %s", _(first_pattern ? "Usage:" : " or: "), name); /* We set the lmargin as well as the wmargin, because hol_usage manually wraps options with newline to avoid annoying breaks. */ old_lm = __argp_fmtstream_set_lmargin (fs, USAGE_INDENT); if (flags & ARGP_HELP_SHORT_USAGE) /* Just show where the options go. */ { if (hol->num_entries > 0) __argp_fmtstream_puts (fs, _(" [OPTION...]")); } else /* Actually print the options. */ { hol_usage (hol, fs); flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */ } more_patterns = argp_args_usage (argp, &levels, 1, fs); __argp_fmtstream_set_wmargin (fs, old_wm); __argp_fmtstream_set_lmargin (fs, old_lm); __argp_fmtstream_putc (fs, '\n'); anything = 1; first_pattern = 0; } while (more_patterns); } if (flags & ARGP_HELP_PRE_DOC) anything |= argp_doc (argp, state, 0, 0, 1, fs); if (flags & ARGP_HELP_SEE) { __argp_fmtstream_printf (fs, _("\ Try `%s --help' or `%s --usage' for more information.\n"), name, name); anything = 1; } if (flags & ARGP_HELP_LONG) /* Print a long, detailed help message. */ { /* Print info about all the options. */ if (hol->num_entries > 0) { if (anything) __argp_fmtstream_putc (fs, '\n'); hol_help (hol, state, fs); anything = 1; } } if (flags & ARGP_HELP_POST_DOC) /* Print any documentation strings at the end. */ anything |= argp_doc (argp, state, 1, anything, 0, fs); if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address) { if (anything) __argp_fmtstream_putc (fs, '\n'); __argp_fmtstream_printf (fs, _("Report bugs to %s.\n"), argp_program_bug_address); anything = 1; } if (hol) hol_free (hol); __argp_fmtstream_free (fs); } /* Output a usage message for ARGP to STREAM. FLAGS are from the set ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */ void __argp_help (const struct argp *argp, FILE *stream, unsigned flags, char *name) { _help (argp, 0, stream, flags, name); } #ifdef weak_alias weak_alias (__argp_help, argp_help) #endif /* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are from the set ARGP_HELP_*. */ void __argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags) { if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream) { if (state && (state->flags & ARGP_LONG_ONLY)) flags |= ARGP_HELP_LONG_ONLY; _help (state ? state->argp : 0, state, stream, flags, state ? state->name : program_invocation_short_name); if (!state || ! (state->flags & ARGP_NO_EXIT)) { if (flags & ARGP_HELP_EXIT_ERR) exit (1); if (flags & ARGP_HELP_EXIT_OK) exit (0); } } } #ifdef weak_alias weak_alias (__argp_state_help, argp_state_help) #endif /* If appropriate, print the printf string FMT and following args, preceded by the program name and `:', to stderr, and followed by a `Try ... --help' message, then exit (1). */ void __argp_error (const struct argp_state *state, const char *fmt, ...) { if (!state || !(state->flags & ARGP_NO_ERRS)) { FILE *stream = state ? state->err_stream : stderr; if (stream) { va_list ap; fputs (state ? state->name : program_invocation_short_name, stream); putc (':', stream); putc (' ', stream); va_start (ap, fmt); vfprintf (stream, fmt, ap); va_end (ap); putc ('\n', stream); __argp_state_help (state, stream, ARGP_HELP_STD_ERR); } } } #ifdef weak_alias weak_alias (__argp_error, argp_error) #endif /* Similar to the standard gnu error-reporting function error(), but will respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print to STATE->err_stream. This is useful for argument parsing code that is shared between program startup (when exiting is desired) and runtime option parsing (when typically an error code is returned instead). The difference between this function and argp_error is that the latter is for *parsing errors*, and the former is for other problems that occur during parsing but don't reflect a (syntactic) problem with the input. */ void __argp_failure (const struct argp_state *state, int status, int errnum, const char *fmt, ...) { if (!state || !(state->flags & ARGP_NO_ERRS)) { FILE *stream = state ? state->err_stream : stderr; if (stream) { fputs (state ? state->name : program_invocation_short_name, stream); if (fmt) { va_list ap; putc (':', stream); putc (' ', stream); va_start (ap, fmt); vfprintf (stream, fmt, ap); va_end (ap); } if (errnum) { putc (':', stream); putc (' ', stream); #if HAVE_STRERROR fputs (strerror (errnum), stream); #else fprintf (stream, "error %d\n", errnum); #endif } putc ('\n', stream); if (status && (!state || !(state->flags & ARGP_NO_EXIT))) exit (status); } } } #ifdef weak_alias weak_alias (__argp_failure, argp_failure) #endif ifile-1.3.9/argp/argp-pvh.c0000644000175000017500000000274311306214407014447 0ustar jasonjason/* Default definition for ARGP_PROGRAM_VERSION_HOOK. Copyright (C) 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader . The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "argp.h" /* If set by the user program to a non-zero value, then a default option --version is added (unless the ARGP_NO_HELP flag is used), which calls this function with a stream to print the version to and a pointer to the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is used). This variable takes precedent over ARGP_PROGRAM_VERSION. */ void (*argp_program_version_hook) (FILE *stream, struct argp_state *state) = 0; ifile-1.3.9/opts.c0000644000175000017500000002601211306214407012752 0ustar jasonjason/* Command line argument handling code */ /* ifile - intelligent mail filter for EXMH/MH Copyright (C) 1997 Jason Rennie 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 (see file 'COPYING'); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include const char *argp_program_version = IFILE_VERSION; const char *argp_program_bug_address = NULL; static char doc[] = "ifile -- core executable for the ifile mail filtering system"; static char args_doc[] = "[FILES...]"; static struct argp_option options[] = { {"concise", 'c', 0, 0, "Equivalent of \"ifile -v 0 | head -1 | cut -f1 -d' '\". " "Must be used with -q or -Q."}, {"threshold", 'T', "THRESH", 0, "With more than 1 folder, for top 2 folders (f0,f1) with ratings (r0,r1), " " if THRESH > 0 then with -q print also 'diff[f0,f1](%) x.xx' and if " " R=(r0-r1)/(r0+r1), R*1000 < THRESH, then " " with -c -q print 'f0,f1' instead of jusrt 'f0'; disabled if THRESH=0."}, {"query", 'q', 0, 0, "Output rating scores for each of FILES"}, {"query-insert",'Q', 0, 0, "For each of FILES, output rating scores and add statistics for the " "folder with the highest score"}, {"query-loocv", 'l', "FOLDER", 0, "For each of FILES, temporarily removes file from FOLDER, performs " "query and then reinserts file in FOLDER. Database is not modified."}, {"delete", 'd', "FOLDER", 0, "Delete the statistics for each of FILES from the category FOLDER"}, {"insert", 'i', "FOLDER", 0, "Add the statistics for each of FILES to the category FOLDER"}, {"update", 'u', "FOLDER", 0, "Same as 'insert' except only adds stats if FOLDER already exists"}, {"keep-infrequent", 'k', 0, 0, "Leave in the database words that occur infrequently (normally they " "are tossed)"}, {"verbosity", 'v', "LEVEL", 0, "Amount of output while running: 0=silent, 1=quiet, 2=progress, " "3=verbose, 4=debug"}, {"folder-calcs", 'f', "FOLDER", 0, "Show the word-probability calculations for FOLDER"}, {"reset-data", 'r', 0, 0, "Erases all currently stored information"}, {"db-file", 'b', "FILE", 0, "Location to read/store ifile database. Default is ~/.idata"}, {"log-file", 'g', 0, 0, "Create and store debugging information in ~/.ifile_log"}, {"occur", 'o', 0, 0, "Uses document bit-vector representation. Count each word once per " "document."}, {0, 0, 0, 0, "Lexing options:"}, {"stemming", 'S', 0, 0, "Use 'Porter' stemming algorithm when lexing documents"}, {"no-stoplist", 's', 0, 0, "Do not throw out overly frequent (stoplist) words when lexing"}, {"white-lexer", 'w', 0, 0, "Lex words as sequences of space separated characters"}, {"alpha-lexer", 'a', 0, 0, "Lex words as sequences of alphabetic characters (default)"}, {"alpha-only-lexer", 'A', 0, 0, "Only lex space-separated character sequences which are composed " "entirely of alphabetic characters"}, {"strip-header", 'h', 0, 0, "Skip all of the header lines except Subject:, From: and To:"}, {"max-length", 'm', "CHAR", 0, "Ignore portion of message after first CHAR characters. Use entire " "message if CHAR set to 0. Default is 50,000."}, {"print-tokens", 'p', 0, 0, "Just tokenize and print, don't do any other processing. Documents are " "returned as a list of word, frequency pairs."}, /* {"tag-headers", 't', 0, 0, "Mark words in headers as being different from words in body of message (only for use with strip-header)"}, */ {0, 0, 0, 0, "If no files are specified on the command line, ifile will use standard input as its message to process."}, { 0 } }; static error_t parse_opt (int key, char *arg, struct argp_state *state) { /* Get the INPUT argument from argp_parse, which we know is a pointer to our arguments structure. */ arguments *args = state->input; if (arg == NULL) ifile_verbosify(ifile_debug, "parse_opt(key=%c, arg=NULL, state=%p)\n", key, state); else ifile_verbosify(ifile_debug, "parse_opt(key=%c, arg=%s, state=%p)\n", key, arg, state); /* The path to the binary is not interesting to us */ /* if (state->arg_num == 0) return 0; */ switch (key) { case 'c': /* equivalent of "ifile -v 0 | head -1 | cut -f1 -d' '" */ ifile_verbosify(ifile_verbose, "--concise\n"); args->verbosity = 0; args->concise = TRUE; break; case 'q': ifile_verbosify(ifile_verbose, "--query\n"); args->query = TRUE; args->read_message = TRUE; args->read_db = TRUE; break; case 'T': ifile_verbosify(ifile_verbose, "--threshold=%s\n", arg); args->thresh = arg ? atoi(arg) : 0; if (args->thresh < 0 || args->thresh > 200) { ifile_verbosify(ifile_verbose, "Invalid threshold: %d\n", args->thresh); args->thresh = 0; } break; case 'Q': ifile_verbosify(ifile_verbose, "--query-insert\n"); args->query = TRUE; args->query_insert = TRUE; args->read_message = TRUE; args->read_db = TRUE; args->write_db = TRUE; break; case 'l': ifile_verbosify(ifile_verbose, "--query-loocv\n"); if (arg != NULL) args->loocv_folder = arg; else argp_usage (state); args->read_message = TRUE; args->read_db = TRUE; break; case 'd': ifile_verbosify(ifile_verbose, "--delete\n"); if (arg != NULL) args->minus_folder = arg; else argp_usage (state); args->read_message = TRUE; args->read_db = TRUE; args->write_db = TRUE; break; case 'u': ifile_verbosify(ifile_verbose, "--update\n"); args->create_folder = FALSE; if (arg != NULL) args->plus_folder = arg; else argp_usage (state); args->read_message = TRUE; args->read_db = TRUE; args->write_db = TRUE; break; case 'i': ifile_verbosify(ifile_verbose, "--insert\n"); if (arg != NULL) args->plus_folder = arg; else argp_usage (state); args->read_message = TRUE; args->read_db = TRUE; args->write_db = TRUE; break; case 'k': ifile_verbosify(ifile_verbose, "--keep-infrequent\n"); args->keep_infrequent = TRUE; break; case 'v': ifile_verbosify(ifile_verbose, "--verbosity=%s\n", arg); args->verbosity = arg ? atoi(arg) : ifile_quiet; if (args->verbosity < 0 || args->verbosity > 4) { ifile_verbosify(ifile_verbose, "Invalid verbosity level: %d\n", args->verbosity); args->verbosity = ifile_debug; } break; case 'f': ifile_verbosify(ifile_verbose, "--folder-calc\n"); args->folder_calcs = arg; break; case 'r': ifile_verbosify(ifile_verbose, "--reset-data\n"); args->reset_data = TRUE; break; case 'S': ifile_verbosify(ifile_verbose, "--stemming\n"); args->stemming = TRUE; break; case 's': ifile_verbosify(ifile_verbose, "--no-stoplist\n"); args->stoplist = FALSE; break; case 'w': ifile_verbosify(ifile_verbose, "--white-lexer\n"); args->lexer = WHITE_LEXER; break; case 'a': ifile_verbosify(ifile_verbose, "--alpha-lexer\n"); args->lexer = ALPHA_LEXER; break; case 'A': ifile_verbosify(ifile_verbose, "--alpha-only-lexer\n"); args->lexer = ALPHA_ONLY_LEXER; break; case 'h': ifile_verbosify(ifile_verbose, "--strip-header\n"); args->skip_header = TRUE; break; case 'm': ifile_verbosify(ifile_verbose, "--max-length\n"); if (arg) args->max_length = atoi(arg); else ifile_verbosify(ifile_quiet, "NULL string argument to max-length\n"); break; case 'p': ifile_verbosify(ifile_verbose, "--print-tokens\n"); args->print_tokens = TRUE; args->read_message = TRUE; break; case 't': ifile_verbosify(ifile_verbose, "--tag-headers\n"); args->tag_headers = TRUE; break; case 'b': ifile_verbosify(ifile_verbose, "--db-file\n"); args->db_file = arg; break; case 'g': ifile_verbosify(ifile_verbose, "--log-file\n"); args->tmp_file = TRUE; break; case 'o': ifile_verbosify(ifile_verbose, "--occur\n"); args->occur = TRUE; break; case ARGP_KEY_END: ifile_verbosify(ifile_verbose, "ARGP_KEY_END\n"); /* Error if -c used, but not -q or -Q */ if (args->concise && !(args->query || args->loocv_folder)) ifile_error("Concise option '-c' requires query option, '-q' or '-Q'\n"); break; case ARGP_KEY_SUCCESS: ifile_verbosify(ifile_verbose, "ARGP_KEY_SUCCESS\n"); break; case ARGP_KEY_NO_ARGS: /* read file from standard input */ ifile_verbosify(ifile_verbose, "ARGP_KEY_NO_ARGS\n"); break; case ARGP_KEY_ARG: ifile_verbosify(ifile_verbose, "ARGP_KEY_ARG\n"); /* Now we consume all the rest of the arguments. STATE->arg_num is the index in STATE->argv of the current argument to be parsed, which is the first we're interested in, so we can just use `&state->argv[state->next]' as the value for arguments->strings. IN ADDITION, by setting STATE->next to the end of the arguments, we can force argp to stop parsing here and return. */ EXT_ARRAY_SET(args->file, char *, args->num_files, state->argv[(state->next)-1]); args->num_files++; break; default: ifile_verbosify(ifile_verbose, "default\n"); return ARGP_ERR_UNKNOWN; } return 0; } void ifile_init_args (arguments * args) { EXT_ARRAY_INIT(args->file, char *, 10); args->num_files = 0; args->query = FALSE; args->concise = FALSE; args->stemming = FALSE; args->stoplist = TRUE; args->lexer = ALPHA_LEXER; args->skip_header = FALSE; args->max_length = 50000; args->print_tokens = FALSE; args->tag_headers = FALSE; args->folder_calcs = NULL; args->keep_infrequent = FALSE; args->verbosity = ifile_quiet; args->minus_folder = NULL; args->plus_folder = NULL; args->loocv_folder = NULL; args->create_folder = TRUE; args->reset_data = FALSE; args->db_file = NULL; /* uses default DB file */ args->tmp_file = FALSE; /* create a /tmp/ifile.log. file? */ args->occur = FALSE; /* represents document as bit vector if TRUE */ args->read_db = FALSE; args->write_db = FALSE; args->read_message = FALSE; } struct argp argp = { options, parse_opt, args_doc, doc }; ifile-1.3.9/util.c0000644000175000017500000002217111306214407012744 0ustar jasonjason/* ifile - intelligent mail filter for EXMH/MH ifile is Copyright (C) 1997 Jason Rennie 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 (see file 'COPYING'); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include /* main ifile function library */ /* variables for keeping track of time/speed of ifile */ extern clock_t DMZ_start, DMZ_end, DMZ2_start; /* returns a hash value for the string S */ /* written by Jason Rennie */ unsigned long hash (const char * s, long int size) { long int hashval; if (s == NULL) return 0; for(hashval=0; *s!='\0'; s++) hashval = (*s + (hashval << 5) - hashval) % size; return hashval; } /* Given a printf style format string and an arbitrarily long list of * arguments which are in accordance with the format string, ifile_sprintf * will allocate memory for and create a string according to the given * information. */ /* Written by Jason Rennie for ifile. */ char * ifile_sprintf (char * format, ...) { char buf[MAX_STR_LEN] = ""; /* holds string to be returned by function */ va_list ap; char * rtn; va_start(ap, format); assert(vsprintf(buf, format, ap) < MAX_STR_LEN - 1); va_end(ap); rtn = malloc(strlen(buf)+1); if (!rtn) abort(); strcpy(rtn, buf); return rtn; } /* Returns a string which is the concatenation of an arbitrary number * of strings passed as arguments to the function. * First argumet passed to function is the number of strings passed to * the function which are to be concatenated. */ /* written by Jason Rennie for ifile */ char * ifile_cats (long int num_strings, ...) { va_list ap; long int string_size = 0; char * new_string = NULL; long int i = 0; va_start(ap, num_strings); for (i=0; i < num_strings; i++) string_size += strlen(va_arg(ap, char *)); va_end(ap); new_string = malloc(string_size+1); if (!new_string) abort(); new_string[0] = '\0'; va_start(ap, num_strings); for (i=0; i < num_strings; i++) strcat(new_string, va_arg(ap, char *)); va_end(ap); return new_string; } /* Given an integer value, allocates space for and returns a string * representing the integer in character form */ /* Written by Jason Rennie for ifile */ char * itoa (long int number) { linked_list * list = NULL; linked_list * new_digit = NULL; linked_list * list_ptr = NULL, * old_list_ptr = NULL; char buf[MAX_STR_LEN]; long int negative = FALSE; long int i = 0; char * tmp = NULL; if (number == 0) { tmp = malloc(strlen("0") + 1); if (!tmp) abort(); strcpy(tmp, "0"); return tmp; } if (number < 0) { number = abs(number); negative = TRUE; } /* Loads digits into stack-like linked list */ while (number > 0) { new_digit = (linked_list *) malloc(sizeof(linked_list)); if (!new_digit) abort(); new_digit->next = list; new_digit->digit = number - ((number/10)*10); number /= 10; list = new_digit; } /* Removes digits from list, copying them into the string to be returned */ i = 0; if (negative == TRUE) { buf[0] = '-'; i++; } list_ptr = list; for (; i < MAX_STR_LEN - 1; i++) { buf[i] = 48 + list_ptr->digit; old_list_ptr = list_ptr; list_ptr = list_ptr -> next; free(old_list_ptr); if (list_ptr == NULL) break; } buf[i+1] = '\0'; tmp = malloc(strlen(buf) + 1); if (!tmp) abort(); strcpy(tmp, buf); return tmp; } /* * Reads up to and including the next feedline (\n). Returns a pointer to * STRING on success, and NULL on EOF or error. Updates bufp also. */ /* Written by Jason Rennie for ifile */ char * readline (char **bufp) { char *first = *bufp, *last; last = strchr(first, '\n'); if (last == NULL) { return NULL; } *last = '\0'; *bufp = last + 1; return first; } /* Wrapper for standard free() function. Frees memory and then sets * pointer equal to NULL. */ /* Written by Jason Rennie for ifile */ /* This seems like a big noop that's costing us efficiency -- jhbrown */ void ifile_free (void * var) { free(var); var = NULL; } /* Accepts a pointer to a message and prints out all the words of that * message */ void ifile_print_message (htable * message) { hash_elem * elem; for (elem = htable_init_traversal(message); elem != NULL; elem = htable_next_traversal(message, elem)) printf("(%ld,%s) ", (long int) elem->entry, (char *) elem->index); printf("\n"); } /* Accepts a file pointer and reads/lexes text from the associated file. * Returns a hash table which maps words appearing in the message to * their frequency in the message. */ /* The GOOD code! This uses Andrew's cool lexing code :) */ /* Written by Jason Rennie and others for ifile */ htable * ifile_read_message (FILE * FP) { ifile_lex * document; char token[MAX_STR_LEN]; long int token_len; /* length of token */ long int old_freq; /* previous frequency of word */ htable * message = malloc(sizeof(htable)); if (!message) abort(); ifile_verbosify(ifile_verbose, "Reading message...\n"); htable_init(message, 100, (unsigned long (*)(const void *, long int)) hash); DMZ2_start = clock(); document = ifile_default_lexer->open_text_fp (ifile_default_lexer, FP); if (document) { token_len = ifile_default_lexer->get_word (ifile_default_lexer, document, token, MAX_STR_LEN); while (token_len != 0) { ifile_verbosify(ifile_debug, "Read \'%s\'. length=%d\n", token, token_len); /* update arrays which strictly concern message */ old_freq = (long int) htable_lookup(message, (void *) token); htable_put(message, ((char *) token), (void *) (old_freq+1)); token_len = ifile_default_lexer->get_word (ifile_default_lexer, document, token, MAX_STR_LEN); } ifile_default_lexer->close (ifile_default_lexer, document); } else { ifile_verbosify(ifile_quiet, "Unable to read message.\n"); ifile_free(message); return NULL; } ifile_verbosify(ifile_debug, "\n"); DMZ_end = clock(); ifile_verbosify(ifile_verbose, "Finishing reading message. Time used: %.3f sec\n", ((float)(DMZ_end-DMZ2_start))/CLOCKS_PER_SECOND); return message; } /* Given a hash table representing a message, changes all non-zero * frequency values to zero */ void ifile_bitify_document(htable * message) { hash_elem *elem; for (elem = htable_init_traversal(message); elem != NULL; elem = htable_next_traversal(message, elem)) if ((long int) elem->entry > 0) elem->entry = (void *) 1U; } /* Given an array of categories and their respective ratings, prints * the information to the given file */ /* Written by Jason Rennie for ifile */ void ifile_print_ratings (FILE * FP, category_rating * ratings, ifile_db * idata, int thresh) { long int i; for (i = 0; i < idata->num_folders; i++) fprintf(FP, "%s %.8f\n", ratings[i].category, ratings[i].rating); if (thresh != 0 && idata->num_folders > 1 && (ratings[0].rating + ratings[1].rating) != 0) { fprintf(FP, "diff[%s,%s](%%) %.2f\n", ratings[0].category, ratings[1].category, -(ratings[0].rating - ratings[1].rating) / (ratings[0].rating + ratings[1].rating) * 100); } fprintf(FP, "---------\n"); } /* Written by Karl Vogel for ifile */ void ifile_concise_ratings (char * path, FILE * FP, category_rating * ratings, ifile_db * idata, int thresh) { //if (path) fprintf (FP, "%s ", path); float diff=0; diff=thresh+1; if (thresh != 0 && idata->num_folders > 1 && (ratings[0].rating + ratings[1].rating) != 0) { diff = -(ratings[0].rating - ratings[1].rating) / (ratings[0].rating + ratings[1].rating) * 1000; } if (path) fprintf (FP, "%s ", path); if (diff < thresh) fprintf (FP, "%s,%s\n", ratings[0].category, ratings[1].category); else fprintf (FP, "%s\n", ratings[0].category); } /* Returns a pointer to a new string that is an exact duplicate of the * string pointed to by the s1 parameter. The malloc() function is * used to allocate space for the new string. */ /* written by Jason Rennie for ifile */ char * ifile_strdup (const char *s1) { char *s = (char *) malloc(strlen(s1)+1); if (!s) abort(); strcpy(s, s1); return s; } ifile-1.3.9/database.c0000644000175000017500000005324311306214406013536 0ustar jasonjason/* database routines */ /* ifile - intelligent mail filter for EXMH/MH ifile is Copyright (C) 1997 Jason Rennie 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 (see file 'COPYING'); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #include #define LOG_2 0.69314718 extern arguments args; /* info about command line arguments */ extern int msgs_read; /* number of messages actually read in */ /* variables for keeping track of time/speed of ifile -*/ extern clock_t DMZ_start, DMZ_end, DMZ2_start; /* given the age of a word, returns an integer which is the minimum * required frequency for the word to remain in the database */ long int _trim_freq (long int age) { if (age <= 0) return 0; else return (((long int)(log((float) age) / log(2.0))) - 1); } long int _trim_freq0 (long int age) { return 0; } /* Initializes an ifile database */ /* Written by Jason Rennie */ void ifile_db_init(ifile_db * idata) { long int i; idata->num_folders = 0; idata->num_words = 0; idata->total_docs = 0; idata->total_freq = 0; /* words of AGE should be trashed if they have frequency less than returned * by this function */ if (args.keep_infrequent) idata->trim_freq = _trim_freq0; else idata->trim_freq = _trim_freq; EXT_ARRAY_INIT(idata->folder_name, char *, IFILE_INIT_FOLDERS); EXT_ARRAY_INIT(idata->folder_freq, long int, IFILE_INIT_FOLDERS); EXT_ARRAY_INIT(idata->folder_msg, long int, IFILE_INIT_FOLDERS); for (i=0; i < IFILE_INIT_FOLDERS; i++) { /* EXT_ARRAY_SET(idata->folder_freq, int, i, 0); EXT_ARRAY_SET(idata->folder_msg, int, i, 0); printf("folder %d defaults: freq = %d msgs = %d\n", i, EXT_ARRAY_GET(idata->folder_freq, int, i), EXT_ARRAY_GET(idata->folder_msg, int, i)); */ } htable_init(&(idata->data), IFILE_INIT_WORDS, (unsigned long (*)(const void *, long int)) hash); } /* Free a word entry and its contents */ /* Written by Jeremy Brown */ void wentry_free(db_word_entry *wentry) { if (!wentry) return; free(wentry->word); if (wentry->freq) { EXT_ARRAY_FREE((*wentry->freq),long int); free(wentry->freq); } free(wentry); } /* Free all storage allocated by an ifile database */ /* Written by Jeremy Brown */ void ifile_db_free(ifile_db *idata) { EXT_ARRAY_FREE_ELEMS(idata->folder_name, char *); EXT_ARRAY_FREE(idata->folder_name, char *); EXT_ARRAY_FREE(idata->folder_freq,long int); EXT_ARRAY_FREE(idata->folder_msg, long int); htable_free_guts(&idata->data, free, (void(*)(void *)) wentry_free); } /* Initializes a word entry of an ifile_db type. Does NOT allocate memory. */ /* Written by Jason Rennie */ void ifile_db_entry_init (db_word_entry * wentry) { wentry->word = NULL; wentry->age = 0; wentry->tot_freq = 0; wentry->freq = NULL; } /* Expects a valid file pointer which points to the beginning of an * ifile database (idata) file along with an ifile database structure. * Function reads in the header lines of file and stores information in IDATA. * Expects that IDATA is allocated and initialized. DATA will be advanced * to the beginning of the end of the idata header. * Returns number of folders upon success, -1 upon failure. */ /* Written by Jason Rennie */ long int ifile_read_header (ifile_db * idata, char **bufp) { char *line; char *token = NULL; long int i; long int num; if ((line = readline(bufp)) == NULL) return -1; /* read folder names */ token = strtok(line, " \t"); for (i = 0; token != NULL; i++) { EXT_ARRAY_SET(idata->folder_name, char *, i, ifile_strdup(token)); token = strtok(NULL, " \t"); } idata->num_folders = i; if ((line = readline(bufp)) == NULL) return -1; /* read word frequencies */ token = strtok(line, " \t"); for (i = 0; token != NULL; i++) { num = atoi(token); EXT_ARRAY_SET(idata->folder_freq, long int, i, num); idata->total_freq += num; token = strtok(NULL, " \t"); } if (i != idata->num_folders) ifile_verbosify(ifile_quiet, "Bad data file format - line #2\n"); if ((line = readline(bufp)) == NULL) return -1; /* read document frequencies */ token = strtok(line, " \t"); for (i = 0; token != NULL; i++) { num = atoi(token); EXT_ARRAY_SET(idata->folder_msg, long int, i, num); idata->total_docs += num; token = strtok(NULL, " \t"); } if (i != idata->num_folders) ifile_verbosify(ifile_quiet, "Bad data file format - line #3\n"); return idata->num_folders; } /* Expects a valid file pointer which points to the beginning of the word * entry section of an ifile database (idata) file along with an ifile * database structure. Function reads to the end of the file and stores * information in IDATA. Expects that IDATA is allocated and initialized. * DATA will be advanced to the end of the file. * Returns number of word entries upon success, -1 upon failure.*/ /* Written by Jason Rennie */ long int ifile_read_word_frequencies (ifile_db * idata, char **bufp) { char *line; long int i = 1; while ((line = readline(bufp)) != NULL) { if (line == NULL || line[0] == '\0') ifile_verbosify(ifile_quiet, "Line # %d not in proper word entry format\n", (i+3)); else idata->num_words += ifile_read_word_entry(line, idata); i++; } return idata->num_words; } /* Given a character array which contains a single word entry from an idata * file and a pointer to an ifile database, allocates and adds a * DB_WORD_ENTRY to IDATA->DATA. Returns 1 if line contained a word entry, * 0 otherwise. */ /* written by Jason Rennie */ long int ifile_read_word_entry (char * line, ifile_db * idata) { db_word_entry * wentry = malloc(sizeof(db_word_entry)); char *token = NULL; long int folder, freq; long int num_folders = idata->num_folders; extendable_array * freq_array; /* initialize EXT_ARRAY things on the fly - do NOT do initialization * when creating the DB */ wentry->freq = (extendable_array *) malloc(sizeof(extendable_array)); freq_array = wentry->freq; EXT_ARRAY_INIT_N_SET((*freq_array), long int, num_folders, 0); token = strtok(line, " \t"); /* if this is a blank line, don't add anything to IDATA */ if (token == NULL) { free(wentry); free(freq_array); return 0; } /* add word entry to database of word entries */ htable_put(&(idata->data), (void *) (token), (void *) wentry); wentry->word = ifile_strdup(token); /* read the age of the word */ token = strtok(NULL, " \t"); if (token != NULL) wentry->age = atoi(token); else wentry->age = 0; /* read the per folder frequency */ token = strtok(NULL, ":"); while (token != NULL) { folder = atoi(token); token = strtok(NULL, " \t"); if (token != NULL) { freq = atoi(token); wentry->tot_freq += freq; EXT_ARRAY_SET((*freq_array), long int, folder, freq); } token = strtok(NULL, ":"); } return 1; } /* Given the name of an idata file this function parses the entire data file * and stored the read information into IDATA. * Returns 0 upon success, -1 upon failure. */ /* written by Jason Rennie */ long int ifile_read_db (char * data_file, ifile_db * idata) { int DATA; long int folders; long int words; char *buf, *saved_buf; struct stat st; size_t bufsize; ssize_t nread; ssize_t rc; ifile_verbosify(ifile_progress, "Reading %s from disk...\n", data_file); DATA = open(data_file, O_RDONLY, 0); if (DATA == -1) { ifile_verbosify(ifile_quiet, "Not able to open %s for reading!\n", data_file); return -1; } DMZ_start = clock(); /* Allocate buffer. */ if (stat(data_file, &st) == -1) { ifile_verbosify(ifile_quiet, "Not able to stat %s!\n", data_file); return -1; } bufsize = (size_t) st.st_size; if ((saved_buf = buf = malloc(bufsize)) == NULL) { ifile_verbosify(ifile_quiet, "Not able to allocate %d bytes!\n", bufsize); return -1; } /* Read file. */ nread = 0; while (nread < bufsize) { if ((rc = read(DATA, buf + nread, bufsize - nread)) == -1) { ifile_verbosify(ifile_quiet, "Not able to read %s!\n", data_file); return -1; } nread += rc; } /* Close file. */ (void) close(DATA); folders = ifile_read_header (idata, &buf); words = ifile_read_word_frequencies (idata, &buf); free(saved_buf); DMZ_end = clock(); ifile_verbosify(ifile_progress, "Read %d categories, %d words. Time used: %.3f sec\n", folders, words, ((float)(DMZ_end-DMZ_start))/CLOCKS_PER_SECOND); return 0; } /* Given a message to rate and a database to get information from, calculates * a value for each folder which approximates the liklihood that the user * would have placed the message in that folder. Returns an array of * category ratings */ /* written by Jason Rennie */ category_rating * ifile_rate_categories (htable * message, ifile_db * idata) { long int i; float docval, nval, r; char *token = NULL; category_rating * ratings; hash_elem * elem; db_word_entry * wentry; long int print_calc = -1; /* folder of which rating calculations are printed */ float freq; if (args.folder_calcs != NULL) { print_calc = 0; for (i=0; i < idata->num_folders; i++) { if (strcmp(args.folder_calcs, EXT_ARRAY_GET(idata->folder_name, char *, i)) == 0) print_calc = i; } } ratings = malloc(sizeof(category_rating)*idata->num_folders); DMZ_start = clock(); ifile_verbosify(ifile_progress, "Computing category ratings...\n"); docval = (float)(idata->total_docs + idata->num_folders); if (args.folder_calcs) ifile_verbosify(ifile_debug, "Outputting calculations for folder \"%s\"\n", (EXT_ARRAY_GET(idata->folder_name, char *, print_calc))); for (i=0; i < idata->num_folders; i++) { token = EXT_ARRAY_GET(idata->folder_name, char *, i); ratings[i].category = ifile_strdup(token); ratings[i].rating = 0.0; } for (elem = htable_init_traversal(message); elem != NULL; elem = htable_next_traversal(message, elem)) { wentry = htable_lookup(&(idata->data), (char *) elem->index); if (wentry != NULL) { for (i=0; i < idata->num_folders; i++) { nval = (float) (EXT_ARRAY_GET(idata->folder_freq, long int, i) + idata->num_words); freq = (float) EXT_ARRAY_GET((*(wentry->freq)), long int, i); r = log((freq + 1.0) / nval); if (i == print_calc) ifile_verbosify(ifile_quiet, "word = %s msg = %d db = %d +rating = %.5f\n", (char *) elem->index, (long int) elem->entry, wentry->freq[i], r); ratings[i].rating += ((long int) elem->entry) * r; } } else if (print_calc >= 0 && print_calc < idata->num_folders) ifile_verbosify(ifile_quiet, "word = %s msg = %d db = 0\n", (char *) elem->index, (long int) elem->entry); } DMZ_end=clock(); ifile_verbosify(ifile_progress, "Calculated category scores. Time used: %.3f sec\n", ((double)(DMZ_end-DMZ_start))/CLOCKS_PER_SECOND); return ratings; } /* Free a category_ratings and all allocated contents */ /* written by Jeremy Brown */ void ifile_free_categories(category_rating *cr, ifile_db *idata) { int i; for (i = 0; i < idata->num_folders; i++) free(cr[i].category); free(cr); } /* Given the name of an idata file this function writes the information * stored in IDATA to disk. The pre-existence of an .idata file in the * location is not checked for. * Returns 0 upon success, -1 upon failure. */ /* Written by Jason Rennie for ifile */ long int ifile_write_db (char * data_file, ifile_db * idata) { FILE * DATA; long int folders; long int words; char *temp_data_file; char *user; char host[128]; struct passwd *pwd = getpwuid (getuid ()); if (!pwd) user = "unknown"; else user = pwd->pw_name; if (gethostname (host, sizeof (host))) strcpy(host, "unknown"); temp_data_file = ifile_sprintf ("%s.%s.%s", data_file, user, host); ifile_verbosify (ifile_progress, "Writing %s to disk...\n", data_file); DMZ_start = clock (); /* Open temporary data file for writing of database */ DATA = fopen (temp_data_file, "w"); if (DATA == NULL) ifile_error ("Not able to open temporary file for writing: %s\n", temp_data_file); folders = ifile_write_header (DATA, idata); words = ifile_write_word_frequencies (DATA, idata); if (ferror(DATA)) ifile_error ("Error while writing data to temporary file: %s\n", temp_data_file); fclose (DATA); /* Rename file to regular database name */ rename (temp_data_file, data_file); free (temp_data_file); DMZ_end = clock (); ifile_verbosify (ifile_progress, "Wrote %d folders, %d words. Time used: %.3f sec\n", folders, words, ((float)(DMZ_end-DMZ_start))/CLOCKS_PER_SECOND); return 0; } /* Expects a valid file pointer which points to the beginning of an * ifile database (idata) file along with an ifile database structure. * Function reads in the header lines of file and stores information in IDATA. * Expects that IDATA is allocated and initialized. DATA will be advanced * to the beginning of the end of the idata header. * Returns number of folders upon success, -1 upon failure. */ /* Written by Jason Rennie */ long int ifile_write_header (FILE * DATA, ifile_db * idata) { long int i; long int num; for (i=0; i < idata->num_folders; i++) fprintf(DATA, "%s ", EXT_ARRAY_GET(idata->folder_name, char *, i)); putc('\n', DATA); for (i=0; i < idata->num_folders; i++) { num = EXT_ARRAY_GET(idata->folder_freq, long int, i); fprintf(DATA, "%ld ", num); } putc('\n', DATA); for (i=0; i < idata->num_folders; i++) { num = EXT_ARRAY_GET(idata->folder_msg, long int, i); fprintf(DATA, "%ld ", num); } putc('\n', DATA); return idata->num_folders; } /* Expects a valid file pointer which points to the beginning of the word * entry section of an ifile database (idata) file along with an ifile * database structure. Function reads to the end of the file and stores * information in IDATA. Expects that IDATA is allocated and initialized. * DATA will be advanced to the end of the file. * Returns number of word entries upon success, -1 upon failure.*/ /* Written by Jason Rennie */ long int ifile_write_word_frequencies (FILE * DATA, ifile_db * idata) { long int i; hash_elem * elem; db_word_entry * wentry; long int freq; extendable_array * freq_array; long int num_words = 0; for (elem = htable_init_traversal(&(idata->data)); elem != NULL; elem = htable_next_traversal(&(idata->data), elem)) { wentry = (db_word_entry *) elem->entry; freq_array = wentry->freq; if (wentry->tot_freq == 0) continue; num_words++; fprintf(DATA, "%s %ld ", wentry->word, wentry->age); for (i=0; i < idata->num_folders; i++) { freq = EXT_ARRAY_GET((*freq_array), long int, i); if (freq > 0) fprintf(DATA, "%ld:%ld ", i, freq); } putc('\n', DATA); } return num_words; } /* Adds EPOCHS to each word's age and eliminates words from the database which * are overly infrequent Uses IDATA->TRIM_FREQ() to calculate which words * should be tossed. Returns the number of trimmed words. */ long int ifile_age_words (ifile_db * idata, long int epochs) { long int i; hash_elem * elem; db_word_entry * wentry; long int wfreq, ffreq, new_freq; long int trimmed_words = 0; for (elem = htable_init_traversal(&(idata->data)); elem != NULL; elem = htable_next_traversal(&(idata->data), elem)) { wentry = (db_word_entry *) elem->entry; wentry->age += epochs; if (idata->trim_freq(wentry->age) > wentry->tot_freq) { /* update the word frequency values for each folder */ for (i=0; i < idata->num_folders; i++) { wfreq = EXT_ARRAY_GET((*wentry->freq), long int, i); ffreq = EXT_ARRAY_GET(idata->folder_freq, long int, i); new_freq = (ffreq >= wfreq) ? (ffreq - wfreq) : 0; EXT_ARRAY_SET(idata->folder_freq, long int, i, new_freq); EXT_ARRAY_SET((*wentry->freq), long int, i, 0); } wentry->tot_freq = 0; trimmed_words++; } } return trimmed_words; } /* if we wanted to make ifile more efficient, we would allocate our * idata->data->freq arrays so that they are one larger than the number * of folders. This would make it so that we would never have to reallocate * these arrays since it is currently not possible to add messages to more * than one folder (per execution) */ /* Adds the word statistics from MESSAGE to FOLDER in IDATA. If CREATE is set to FALSE, nothing is done if FOLDER does not already exist. */ /* Written by Jason Rennie */ void ifile_add_db (char * folder, htable * message, ifile_db * idata, int create) { hash_elem * elem; db_word_entry * wentry; long int folder_index; long int freq = 0; long int folder_freq = 0; long int i; long int num_msgs; folder_index = -1; for (i=0; i < idata->num_folders; i++) { if (strcmp(folder, EXT_ARRAY_GET(idata->folder_name, char *, i)) == 0) folder_index = i; } if (folder_index == -1) { if (!create) return; EXT_ARRAY_SET(idata->folder_name, char *, idata->num_folders, ifile_strdup(folder)); folder_index = idata->num_folders; idata->num_folders++; } for (elem = htable_init_traversal (message); elem != NULL; elem = htable_next_traversal (message, elem)) { ifile_verbosify(ifile_debug, "adding... %s %d\n", (char *) elem->index, (long int) elem->entry); wentry = htable_lookup (&(idata->data), (char *) elem->index); if (wentry == NULL) { wentry = (db_word_entry *) malloc(sizeof(db_word_entry)); ifile_db_entry_init(wentry); wentry->freq = (extendable_array *) malloc(sizeof(extendable_array)); wentry->word = ifile_strdup((char *) elem->index); wentry->tot_freq = 0; wentry->age = 0; EXT_ARRAY_INIT((*wentry->freq), long int, IFILE_INIT_FOLDERS); freq = 0; htable_put (&(idata->data), ((char *) elem->index), wentry); idata->num_words++; } else freq = EXT_ARRAY_GET((*wentry->freq), long int, folder_index); folder_freq += (long int) elem->entry; freq += (long int) elem->entry; idata->total_freq += (long int) elem->entry; wentry->tot_freq += (long int) elem->entry; EXT_ARRAY_SET((*wentry->freq), long int, folder_index, freq); } /* increase message count by one */ num_msgs = EXT_ARRAY_GET(idata->folder_msg, long int, folder_index); EXT_ARRAY_SET(idata->folder_msg, long int, folder_index, (num_msgs+1)); /* adjust the folder word frequency count */ folder_freq += EXT_ARRAY_GET(idata->folder_freq, long int, folder_index); EXT_ARRAY_SET(idata->folder_freq, long int, folder_index, folder_freq); } /* Removes the word statistics of MESSAGE from FOLDER in IDATA. * if FOLDER does not exist, or any word of MESSAGE has a lower * frequency than in the database, an error message is printed. */ /* Written by Jason Rennie */ void ifile_del_db (char * folder, htable * message, ifile_db * idata) { hash_elem * elem; db_word_entry * wentry; long int folder_index; long int freq; long int i; long int folder_freq = 0; long int num_msgs; folder_index = -1; for (i=0; i < idata->num_folders; i++) { if (strcmp(folder, EXT_ARRAY_GET(idata->folder_name, char *, i)) == 0) folder_index = i; } if (folder_index == -1) { ifile_verbosify(ifile_quiet, "Folder \"%s\" does not appear to exist\n", folder); return; } for (elem = htable_init_traversal (message); elem != NULL; elem = htable_next_traversal (message, elem)) { wentry = htable_lookup (&(idata->data), (char *) elem->index); if (wentry == NULL) { ifile_verbosify(ifile_verbose, "Word \"%s\" does not exist in the database. Skipping.\n", (char *) elem->index); continue; } else freq = EXT_ARRAY_GET((*wentry->freq), long int, folder_index); freq -= (long int) elem->entry; folder_freq -= (long int) elem->entry; if (freq <= 0) { ifile_verbosify(ifile_verbose, "Word \"%s\" has lower frequency in database than in message.\n Setting database frequency to 0\n", (char *) elem->index); freq = 0; } EXT_ARRAY_SET((*wentry->freq), long int, folder_index, freq); } /* update the word frequency count for the folder */ folder_freq += EXT_ARRAY_GET(idata->folder_freq, long int, folder_index); if (folder_freq < 0) folder_freq = 0; EXT_ARRAY_SET(idata->folder_freq, long int, folder_index, folder_freq); /* update the message count for the folder */ num_msgs = EXT_ARRAY_GET(idata->folder_msg, long int, folder_index); num_msgs = (num_msgs >= 1) ? (num_msgs-1) : 0; EXT_ARRAY_SET(idata->folder_msg, long int, folder_index, num_msgs); } ifile-1.3.9/Makefile.in0000644000175000017500000001462011306214407013670 0ustar jasonjason# @configure_input@ # # Makefile for ifile # Copyright (C) 1997 Jason Daniel Rennie # # Written by Jason Rennie # parts taken from libbow Makefile.in, written by Andrew Kachites McCallum # # $Id: Makefile.in,v 1.8 2004/04/30 11:59:57 jrennie Exp $ # # 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. SHELL = /bin/sh #### Start of system configuration section. #### default: srcdir = @srcdir@ VPATH = @srcdir@ RANLIB = @RANLIB@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ PERL = @PERL@ CC = @CC@ DEFS = @DEFS@ LIBS = @LIBS@ # All these are optional. You can redifine CFLAGS, CPPFLAGS, # INCLUDEFLAGS and LDFLAGS on the command line however you like. CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ INCLUDEFLAGS = LDFLAGS = prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ # Installation locations if [ ! $bindir ] ; then bindir = $(exec_prefix)/bin; fi if [ ! $mandir ] ; then mandir = $(prefix)/man; fi #### This is just a test---feel free to delete ### printdirs: echo $(bindir) echo $(mandir) #### End of system configuration section. #### include $(srcdir)/Version MAN_1_PAGES = ifile.1 MAN_PAGES = $(MAN_1_PAGES) LIB_H_FILES = \ include/ifile.h \ include/extendable_array.h \ include/hash_table.h LIB_C_FILES = \ database.c \ error.c \ hash_table.c \ int4str.c \ istext.c \ lex-define.c \ lex-email.c \ lex-indirect.c \ lex-simple.c \ opts.c \ primes.c \ scan.c \ stem.c \ stoplist.c \ stopwords.c \ util.c LIB_O_FILES = $(LIB_C_FILES:.c=.o) MAIN_C_FILES = \ ifile.c MAIN_O_FILES = $(MAIN_C_FILES:.c=.o) MAIN_EXECUTABLES = $(MAIN_O_FILES:.o=) DIST_FILES = \ $(MAN_PAGES) \ $(LIB_C_FILES) \ $(LIB_H_FILES) \ $(MAIN_C_FILES) \ ChangeLog \ COPYING \ INSTALL \ Makefile.in \ NOTES \ Version \ configure \ install-sh \ mkinstalldirs \ test.sh \ README \ INSTALL # Pattern rule ALL_CPPFLAGS = $(CPPFLAGS) $(INCLUDEFLAGS) -I$(srcdir) -I$(srcdir)/include -I$(srcdir)/argp $(DEFS) ALL_CFLAGS = $(CFLAGS) %.o: %.c $(LIB_H_FILES) Makefile $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $< # Rules default: $(MAIN_EXECUTABLES) all: libifile.a $(MAIN_EXECUTABLES) # Compiling code libifile.a: $(LIB_O_FILES) $(AR) rc $@ $^ $(RANLIB) $@ argp/libargp.a: cd argp ; $(MAKE) libargp.a ALL_LIBS = $(LIBS) -L. -lifile -L./argp -largp -lm $(MAIN_EXECUTABLES): %: libifile.a argp/libargp.a %.o $(CC) $(CFLAGS) $@.o -o $@ $(LDFLAGS) $(ALL_LIBS) # ifile.h has macros that indicate ifile's version number; these # must be kept up-to-date. include/ifile.h: Version rm -f $(srcdir)/include/ifile-tmp.h~ mv -f $(srcdir)/include/ifile.h $(srcdir)/include/ifile-tmp.h~ cat $(srcdir)/include/ifile-tmp.h~ | sed -e \ 's/e IFILE_MAJOR_VERSION .*/e IFILE_MAJOR_VERSION $(IFILE_MAJOR_VERSION)/' \ | sed -e \ 's/e IFILE_MINOR_VERSION .*/e IFILE_MINOR_VERSION $(IFILE_MINOR_VERSION)/' \ | sed -e \ 's/e IFILE_TRIFLING_VERSION .*/e IFILE_TRIFLING_VERSION $(IFILE_TRIFLING_VERSION)/' \ | sed -e \ 's/e IFILE_VERSION .*/e IFILE_VERSION \"ifile $(IFILE_VERSION)\"/' \ > $(srcdir)/include/ifile.h # Compiling the Makefile Makefile: Makefile.in config.status $(SHELL) config.status config.status: $(srcdir)/configure $(SHELL) $(srcdir)/configure --no-create # Installing installdirs: $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) $(DESTDIR)$(mandir) \ $(DESTDIR)$(mandir)/man1 BUILD_FILES = $(MAIN_EXECUTABLES) install: $(BUILD_FILES) installdirs #cd argp ; $(MAKE) install cd $(DESTDIR)$(bindir) ; rm -f $(MAIN_EXECUTABLES) for file in $(MAIN_EXECUTABLES); do \ $(INSTALL) $(STRIP) -m 0755 $$file $(DESTDIR)$(bindir) ; \ done cd $(mandir)/man1 ; rm -f $(MAN_1_PAGES) for file in $(MAN_1_PAGES); do \ $(INSTALL) -m 0644 $(srcdir)/$$file $(DESTDIR)$(mandir)/man1; \ done # Cleaning mostlyclean: rm -f core *~ cd argp ; $(MAKE) mostlyclean clean: mostlyclean rm -f *.o libifile.a $(MAIN_EXECUTABLES) cd argp ; $(MAKE) clean maintainer-clean: clean rm -f config.cache config.log config.status Makefile configure cd argp ; $(MAKE) maintainer-clean # Making a distribution .tar.gz file # cvs rtag -F release-`echo $(IFILE_VERSION) | tr . -` ifile dist: ifile-$(IFILE_VERSION).tar.gz ifile-$(IFILE_VERSION).tar.gz: $(DIST_FILES) echo ifile-$(IFILE_VERSION) > .fname rm -rf `cat .fname` mkdir `cat .fname` mkdir `cat .fname`/include for file in $(DIST_FILES); do \ cp $$file `cat .fname`/$$file ; \ done mkdir `cat .fname`/argp cd argp ; SNAP=../`cat ../.fname`/argp $(MAKE) snap tar -chvf `cat .fname`.tar `cat .fname` rm -f `cat .fname`.tar.gz gzip -9 `cat .fname`.tar rm -rf `cat .fname` # rm -rf /tmp/sv_upload # mkdir -p /tmp/sv_upload/default.pkg/$(IFILE_VERSION) && cp `cat .fname`.tar.gz /tmp/sv_upload/default.pkg/$(IFILE_VERSION) # scp -r /tmp/sv_upload/* jrennie@subversions.gnu.org:/upload/ifile rm -f .fname diff: $(DIST_FILES) @if [ ! $(OLD) ] ; then \ echo You must set OLD to the version number against which to diff ; \ exit -1 ; \ fi @if [ ! $(NEW) ] ; then \ echo You must set NEW to the version number with which to diff ; \ exit -1 ; \ fi gunzip -c ifile-$(NEW).tar.gz | (cd /tmp ; tar -xf -) gunzip -c ifile-$(OLD).tar.gz | (cd /tmp ; tar -xf -) rm -f ifile-$(OLD)-$(NEW).diff -diff -u -r /tmp/ifile-$(OLD) /tmp/ifile-$(NEW) > ifile-$(OLD)-$(NEW).diff rm -rf /tmp/ifile-$(NEW) rm -rf /tmp/ifile-$(OLD) snapshot: $(DIST_FILES) echo ifile-`date +%y%m%d` > .fname rm -rf `cat .fname` mkdir `cat .fname` mkdir `cat .fname`/include for file in $(DIST_FILES); do \ cp $(srcdir)/$$file `cat .fname`/$$file ; \ done mkdir `cat .fname`/argp cd argp ; SNAP=`pwd`/../`cat ../.fname`/argp $(MAKE) snap tar -chvf `cat .fname`.tar `cat .fname` rm -f `cat .fname`.tar.gz gzip -9 `cat .fname`.tar rm -rf `cat .fname` cvs rtag -F snapshot-`cat .fname` ifile rm -f .fname ifile-1.3.9/mkinstalldirs0000755000175000017500000000115311306214407014426 0ustar jasonjason#!/bin/sh # Make directory hierarchy. # Written by Noah Friedman # Public domain. defaultIFS=' ' IFS="${IFS-${defaultIFS}}" errstatus=0 for file in ${1+"$@"} ; do oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' for d in ${1+"$@"} ; do pathcomp="${pathcomp}${d}" if test ! -d "${pathcomp}"; then echo "mkdir $pathcomp" 1>&2 mkdir "${pathcomp}" || errstatus=$? fi pathcomp="${pathcomp}/" done done exit $errstatus # eof ifile-1.3.9/scan.c0000644000175000017500000001451411306214407012715 0ustar jasonjason/* Functions for reading FILE*'s up to certain strings or characters. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include #include /* for SunOS 4.1.3_U1 - no SEEK_CUR in stdio.h */ #include #include /* for tolower() */ /* Read characters from the file pointer FP until the string STRING is found or EOF if reached. Return 0 if EOF was reached, 1 otherwise. The search is case-insensitive. If 1 is returned, the file pointer will be at the character after the last character in STRING. If ONELINE is non-zero, insist that the string appear before a newline character. If STRING is NULL or of zero length, scan until EOF. */ int ifile_scan_fp_for_string (FILE *fp, const char *string, int oneline) { int byte; /* character read from the FP */ const char *string_ptr; /* a placeholder into STRING */ /* If STRING is NULL, scan forward to the end of the file. */ if (!string) { while (fgetc (fp) != EOF) ; return 1; } /* If STRING is the empty string, return without scanning forward at all */ if (!string[0]) return 0; /* Read forward until we find the first character of STRING. */ /* Make an initial newline in STRING match the beginning of the file. */ if (!(ftell (fp) == 0 && string[0] == '\n')) { again: do { byte = fgetc (fp); if (byte == EOF || (string[0] != '\n' && oneline && byte == '\n')) return 0; } while (tolower (byte) != tolower (string[0])); } /* Step through the characters in STRING, starting all over again if we encounter a mismatch. */ string_ptr = string+1; while (*string_ptr) { byte = fgetc (fp); if (byte == EOF || (oneline && byte == '\n')) return 0; /* Ignore Carriage-Return characters, so we can match MIME headers like "\r\n\r\n" with a search STRING of "\n\n" */ if (byte == '\r') continue; if (tolower (byte) != tolower (*string_ptr)) /* A mismatch; start the search again. */ goto again; /* Move on to next character in the pattern. */ string_ptr++; } /* Success! We found the string. */ return 1; } /* Read characters from FP into BUF until the character STOPCHAR is reached. On success, returns the number of characters read. If EOF is reached before reading the STOPCHAR, return the negative of the number of characters read. If BUFLEN is reached before reading the STOPCHAR, return 0. If NEGFLAG is 1, the sense of the test is reversed. */ int ifile_scan_fp_into_buffer_until_char (FILE *fp, char *buf, int buflen, char stopchar, int negflag) { int byte; int count = 0; assert (buflen > 0 && buf); while (buflen--) { byte = fgetc (fp); if (byte == EOF) { buf[count] = '\0'; return -count; } if (negflag ? (byte != stopchar) : (byte == stopchar)) { fseek (fp, -1, SEEK_CUR); buf[count] = '\0'; return count; } buf[count++] = byte; } buf[count-1] = '\0'; return 0; } /* Read characters from FP into BUF until any of the characters in the string STOPCHARS is reached. On success, returns the number of characters read. If EOF is reached before reading any of the STOPCHARS, return the negative of the number of characters read. If BUFLEN is reached before reading the STOPCHAR, return 0. If NEGFLAG is 1, the sense of the test is reversed. */ int ifile_scan_fp_into_buffer_until_chars (FILE *fp, char *buf, int buflen, const char *stopchars, int negflag) { int byte; int count = 0; assert (buflen > 0 && buf); while (buflen--) { byte = fgetc (fp); if (byte == EOF) { buf[count] = '\0'; return -count; } if (negflag ? (strchr (stopchars, byte) == 0) : (strchr (stopchars, byte) != 0)) { fseek (fp, -1, SEEK_CUR); buf[count] = '\0'; return count; } buf[count++] = byte; } buf[count-1] = '\0'; return 0; } /* Read characters from FP into BUF until the string STOPSTR is reached. On success, returns the number of characters read. If EOF is reached before reading the STOPSTR, return the negative of the number of characters read. If BUFLEN is reached before reading the STOPCHAR, return 0. */ int ifile_scan_fp_into_buffer_until_string (FILE *fp, char *buf, int buflen, char* stopstr) { int byte; /* character read from the FP */ const char *stopstr_ptr; /* a placeholder into STOPSTR */ char *buf_ptr; /* a placeholder into BUF */ int count; /* the number of characters added to BUF */ if (!stopstr || !stopstr[0]) return 0; count = 0; buf_ptr = buf; again: /* Read forward until we find the first character of STRING. */ do { byte = fgetc (fp); if (byte == EOF) { if (buf) buf[count] = '\0'; return -count; } count++; if (buf) { *buf_ptr++ = byte; if (count >= buflen) { buf[buflen-1] = '\0'; return 0; } } } while (tolower (byte) != tolower (stopstr[0])); /* Step through the characters in STRING, starting all over again if we encounter a mismatch. */ for (stopstr_ptr = stopstr+1; *stopstr_ptr; stopstr_ptr++) { byte = fgetc (fp); if (byte == EOF) { if (buf) buf[count] = '\0'; return -count; } if (buf) *buf_ptr++ = byte; if (++count >= buflen) { if (buf) buf[buflen-1] = '\0'; return 0; } if (tolower (byte) != tolower (*stopstr_ptr)) /* A mismatch; start the search again. */ goto again; } /* Success! We found the stopstr. */ count =- strlen (stopstr); if (buf) buf[count] = '\0'; return count; } ifile-1.3.9/stem.c0000644000175000017500000003342111306214407012737 0ustar jasonjason/* stem.c - the Porter algorithm for standardizing suffixes */ /* The Porter stemming algorithm is documented in: Porter, M.F., "An Algorithm For Suffix Stripping," Program 14 (3), July 1980, pp. 130-137. Author History: B. Frakes and C. Cox, 1986: Original authors. C. Fox, 1990: made measure function a DFA, restructured structs, renamed functions and variables, restricted function and variable scopes. C. Fox, July, 1991: added ANSI C declarations, branch tested to 90% coverage. Andrew McCallum 1996: Changed to conform to GNU coding standards. Rest of history is in GNU-style ChangeLog file in this package. This code will make little sense without the the Porter article. The stemming function converts its input to lower case. */ #include #include #include /* These used as return values. */ #define FALSE 0 #define TRUE 1 /* Used to test for end-of-string. */ #define EOS '\0' /* Returns non-zero if `c' is one of the five vowels. */ #define is_vowel(c) ('a'==(c)||'e'==(c)||'i'==(c)||'o'==(c)||'u'==(c)) /* The Porter stemming rules are stored as arrays of this structure. */ typedef struct { int id; /* returned if rule fired */ char *old_end; /* suffix replaced */ char *new_end; /* suffix replacement */ int old_offset; /* from end of word to start of suffix */ int new_offset; /* from beginning to end of new suffix */ int min_root_size; /* min root word size for replacement */ int (*condition)(); /* the replacement test function */ } rule_list; /* Used when declaring rule_list's. */ static char LAMBDA[] = ""; /* Used to point to the end of the word that is currently being stem()'ed. */ static char *end; /* word_size (word) Returns: int -- a weird count of word size in adjusted syllables Purpose: Count syllables in a special way: count the number vowel-consonant pairs in a word, disregarding initial consonants and final vowels. The letter "y" counts as a consonant at the beginning of a word and when it has a vowel in front of it; otherwise (when it follows a consonant) it is treated as a vowel. For example, the word_size of "cat" is 1, of "any" is 1, of "amount" is 2, of "anything" is 3. Plan: Run a DFA to compute the word size Notes: The easiest and fastest way to compute this funny measure is with a finite state machine. The initial state 0 checks the first letter. If it is a vowel, then the machine changes to state 1, which is the "last letter was a vowel" state. If the first letter is a consonant or y, then it changes to state 2, the "last letter was a consonant state". In state 1, a y is treated as a consonant (since it follows a vowel), but in state 2, y is treated as a vowel (since it follows a consonant. The result counter is incremented on the transition from state 1 to state 2, since this transition only occurs after a vowel-consonant pair, which is what we are counting. */ static int word_size (const char *word) { register int result; /* word_size of the word */ register int state; /* current state in machine */ result = 0; state = 0; /* Run a DFA to compute the word size */ while (EOS != *word) { switch (state) { case 0: state = (is_vowel (*word)) ? 1 : 2; break; case 1: state = (is_vowel (*word)) ? 1 : 2; if (2 == state) result++; break; case 2: state = (is_vowel (*word) || ('y' == *word)) ? 1 : 2; break; } word++; } return (result); } /* contains_vowel (word) Returns: int -- TRUE (1) if the word parameter contains a vowel, FALSE (0) otherwise. Purpose: Some of the rewrite rules apply only to a root containing a vowel, where a vowel is one of "aeiou" or y with a consonant in front of it. Plan: Obviously, under the definition of a vowel, a word contains a vowel iff either its first letter is one of "aeiou", or any of its other letters are "aeiouy". The plan is to test this condition. */ static int contains_vowel (const char *word) { if (EOS == *word) return (FALSE); else return (is_vowel (*word) || (NULL != strpbrk(word+1,"aeiouy"))); } /* ends_with_cvc (word) Returns: int -- TRUE (1) if the current word ends with a consonant-vowel-consonant combination, and the second consonant is not w, x, or y, FALSE (0) otherwise. Purpose: Some of the rewrite rules apply only to a root with this characteristic. Plan: Look at the last three characters. */ static int ends_with_cvc (const char *word) { int length; /* for finding the last three characters */ if ((length = strlen(word)) <= 2) return (FALSE); else { end = (char*) word + length - 1; return ((NULL == strchr("aeiouwxy", *end--)) /* consonant */ && (NULL != strchr("aeiouy", *end--)) /* vowel */ && (NULL == strchr("aeiou", *end )) ); /* consonant */ } } /* add_an_e (word) Returns: int -- TRUE (1) if the current word meets special conditions for adding an e. Purpose: Rule 122 applies only to a root with this characteristic. Plan: Check for size of 1 and a consonant-vowel-consonant ending. */ static int add_an_e (const char *word) { return ((1 == word_size (word)) && ends_with_cvc(word)); } /* remove_an_e (word) Returns: int -- TRUE (1) if the current word meets special conditions for removing an e. Purpose: Rule 502 applies only to a root with this characteristic. Plan: Check for size of 1 and no consonant-vowel-consonant ending. */ static int remove_an_e (const char *word) { return ((1 == word_size (word)) && !ends_with_cvc (word)); } /* replace_end (word, rule) Returns: int -- the id for the rule fired, 0 is none is fired Purpose: Apply a set of rules to replace the suffix of a word Plan: Loop through the rule set until a match meeting all conditions is found. If a rule fires, return its id, otherwise return 0. Connditions on the length of the root are checked as part of this function's processing because this check is so often made. Notes: This is the main routine driving the stemmer. It goes through a set of suffix replacement rules looking for a match on the current suffix. When it finds one, if the root of the word is long enough, and it meets whatever other conditions are required, then the suffix is replaced, and the function returns. */ static int replace_end (char *word, const rule_list *rule) { register char *ending; /* set to start of possible stemmed suffix */ char tmp_ch; /* save replaced character when testing */ while (0 != rule->id) { ending = end - rule->old_offset; if (word <= ending) if (0 == strcmp (ending,rule->old_end)) { tmp_ch = *ending; *ending = EOS; if ((rule->min_root_size < word_size (word)) && (!rule->condition || (*rule->condition)(word))) { strcat (word, rule->new_end); end = ending + rule->new_offset; break; } *ending = tmp_ch; } rule++; } return (rule->id); } /* The Porter stemming rules. */ static rule_list step1a_rules[] = { {101, "sses", "ss", 3, 1, -1, NULL}, {102, "ies", "i", 2, 0, -1, NULL}, {103, "ss", "ss", 1, 1, -1, NULL}, {104, "s", LAMBDA, 0, -1, -1, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step1b_rules[] = { {105, "eed", "ee", 2, 1, 0, NULL}, {106, "ed", LAMBDA, 1, -1, -1, contains_vowel}, {107, "ing", LAMBDA, 2, -1, -1, contains_vowel}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step1b1_rules[] = { {108, "at", "ate", 1, 2, -1, NULL}, {109, "bl", "ble", 1, 2, -1, NULL}, {110, "iz", "ize", 1, 2, -1, NULL}, {111, "bb", "b", 1, 0, -1, NULL}, {112, "dd", "d", 1, 0, -1, NULL}, {113, "ff", "f", 1, 0, -1, NULL}, {114, "gg", "g", 1, 0, -1, NULL}, {115, "mm", "m", 1, 0, -1, NULL}, {116, "nn", "n", 1, 0, -1, NULL}, {117, "pp", "p", 1, 0, -1, NULL}, {118, "rr", "r", 1, 0, -1, NULL}, {119, "tt", "t", 1, 0, -1, NULL}, {120, "ww", "w", 1, 0, -1, NULL}, {121, "xx", "x", 1, 0, -1, NULL}, {122, LAMBDA, "e", -1, 0, -1, add_an_e}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step1c_rules[] = { {123, "y", "i", 0, 0, -1, contains_vowel}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step2_rules[] = { {203, "ational", "ate", 6, 2, 0, NULL}, {204, "tional", "tion", 5, 3, 0, NULL}, {205, "enci", "ence", 3, 3, 0, NULL}, {206, "anci", "ance", 3, 3, 0, NULL}, {207, "izer", "ize", 3, 2, 0, NULL}, {208, "abli", "able", 3, 3, 0, NULL}, {209, "alli", "al", 3, 1, 0, NULL}, {210, "entli", "ent", 4, 2, 0, NULL}, {211, "eli", "e", 2, 0, 0, NULL}, {213, "ousli", "ous", 4, 2, 0, NULL}, {214, "ization", "ize", 6, 2, 0, NULL}, {215, "ation", "ate", 4, 2, 0, NULL}, {216, "ator", "ate", 3, 2, 0, NULL}, {217, "alism", "al", 4, 1, 0, NULL}, {218, "iveness", "ive", 6, 2, 0, NULL}, {219, "fulnes", "ful", 5, 2, 0, NULL}, {220, "ousness", "ous", 6, 2, 0, NULL}, {221, "aliti", "al", 4, 1, 0, NULL}, {222, "iviti", "ive", 4, 2, 0, NULL}, {223, "biliti", "ble", 5, 2, 0, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step3_rules[] = { {301, "icate", "ic", 4, 1, 0, NULL}, {302, "ative", LAMBDA, 4, -1, 0, NULL}, {303, "alize", "al", 4, 1, 0, NULL}, {304, "iciti", "ic", 4, 1, 0, NULL}, {305, "ical", "ic", 3, 1, 0, NULL}, {308, "ful", LAMBDA, 2, -1, 0, NULL}, {309, "ness", LAMBDA, 3, -1, 0, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step4_rules[] = { {401, "al", LAMBDA, 1, -1, 1, NULL}, {402, "ance", LAMBDA, 3, -1, 1, NULL}, {403, "ence", LAMBDA, 3, -1, 1, NULL}, {405, "er", LAMBDA, 1, -1, 1, NULL}, {406, "ic", LAMBDA, 1, -1, 1, NULL}, {407, "able", LAMBDA, 3, -1, 1, NULL}, {408, "ible", LAMBDA, 3, -1, 1, NULL}, {409, "ant", LAMBDA, 2, -1, 1, NULL}, {410, "ement", LAMBDA, 4, -1, 1, NULL}, {411, "ment", LAMBDA, 3, -1, 1, NULL}, {412, "ent", LAMBDA, 2, -1, 1, NULL}, {423, "sion", "s", 3, 0, 1, NULL}, {424, "tion", "t", 3, 0, 1, NULL}, {415, "ou", LAMBDA, 1, -1, 1, NULL}, {416, "ism", LAMBDA, 2, -1, 1, NULL}, {417, "ate", LAMBDA, 2, -1, 1, NULL}, {418, "iti", LAMBDA, 2, -1, 1, NULL}, {419, "ous", LAMBDA, 2, -1, 1, NULL}, {420, "ive", LAMBDA, 2, -1, 1, NULL}, {421, "ize", LAMBDA, 2, -1, 1, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step5a_rules[] = { {501, "e", LAMBDA, 0, -1, 1, NULL}, {502, "e", LAMBDA, 0, -1, -1, remove_an_e}, {000, NULL, NULL, 0, 0, 0, NULL} }; static rule_list step5b_rules[] = { {503, "ll", "l", 1, 0, 1, NULL}, {000, NULL, NULL, 0, 0, 0, NULL} }; /* stem (word) Returns: int -- FALSE (0) if the word contains non-alphabetic characters and hence is not stemmed, TRUE (1) otherwise Purpose: Stem a word Plan: Part 1: Check to ensure the word is all alphabetic Part 2: Run through the Porter algorithm Part 3: Return an indication of successful stemming Notes: This function implements the Porter stemming algorithm, with a few additions here and there. See: Porter, M.F., "An Algorithm For Suffix Stripping," Program 14 (3), July 1980, pp. 130-137. Porter's algorithm is an ad hoc set of rewrite rules with various conditions on rule firing. The terminology of "step 1a" and so on, is taken directly from Porter's article, which unfortunately gives almost no justification for the various steps. Thus this function more or less faithfully refects the opaque presentation in the article. Changes from the article amount to a few additions to the rewrite rules; these are marked in the rule_list data structures with comments. */ int ifile_stem_porter (char *word) { int rule; /* which rule is fired in replacing an end */ /* Part 1: Check to ensure the word is all alphabetic */ for (end = word; *end != EOS; end++) { if (!isalpha(*end)) return (FALSE); else *end = tolower (*end); } end--; /* Part 2: Run through the Porter algorithm */ replace_end (word, step1a_rules); rule = replace_end (word, step1b_rules); if ((106 == rule) || (107 == rule)) replace_end (word, step1b1_rules); replace_end (word, step1c_rules); replace_end (word, step2_rules); replace_end (word, step3_rules); replace_end (word, step4_rules); replace_end (word, step5a_rules); replace_end (word, step5b_rules); /* Part 3: Return an indication of successful stemming */ return (TRUE); } ifile-1.3.9/NOTES0000644000175000017500000002415011306214407012435 0ustar jasonjasonSat Nov 2 16:04:04 EST 2002 ifile-1.2.0.tar.gz 1.2.0 marks the removal of all client-specific information in the ifile package. The mh-specific stuff is now part of the "mh-ifile" package (see the link on the web page). ifile now installs just the main executable and a man page. Client-specific code must be installed separately. Also, two tutorials have been written on ifile usage. See the web page (www.nongnu.org/ifile) for the tutorials & client code. ifile has also been completely transferred to Savannah (savannah.gnu.org). It's much nicer than hosting it on the AI Lab web site. The CVS repository is now publicly readable, we have a real bug database and the mailing list archives don't have tons of advertisements to wade through. It's a big improvement in my view. Anyway, happy ifiling! Wed Oct 27 19:17:39 EDT 1999 ifile-1.0.0.tar.gz Well, I think it's about time to break the 1.0 barrier, so here's my stab at a 'first' version. The major update is instructions on how to get ifile to work with EXMH the right way. Until EXMH 2.1, there was a major bug in the user-defined code, so some people may be surprised that I was able to get ifile to work with EXMH to any degree! Anyway, the interface to EXMH should now work nicely and be relatively straightforward to install. It's all explained in the INSTALL file, so if you have had trouble getting ifile to work with EXMH, run on over there and look for the EXMH section. Note that there are no longer ifile-*@cs.cmu.edu mailing lists. I've decided to move things over to egroups after making my move to the MIT AI Lab. Go to http://www.egroups.com/group/ifile-discuss/info.html for more information. Thu Apr 22 22:34:54 EDT 1999 ifile-0.7.4.tar.gz I've been unsuccessful in trying to get EXMH to incorporate mail via ifile. I have also been told that the redefinition of EXMH incorporation code has caused incompatibilities, so I've removed such code from ifile.tcl. The INSTALL file has been updated accordingly. If you want to have incorporated mail immedately filtered by ifile, you will need to use slocal or some other filtering tool. Of course, it is still possible to filter mail by binding a key to Msg_Filter or creating a button that calls the Msg_Filter procedure. Tue Feb 9 14:29:28 EST 1999 ifile-0.7.3.tar.gz This release includes a few maintenance fixes: - By default, messages with long attachments are now cropped to reduce processing time. - X-filter: header is added at bottom of header section so that messages in maildrop format are not aversely affected Mon Apr 6 17:06:42 EDT 1998 ifile-0.7.1.tar.gz 0.7.0 included semaphore code which allows only one ifile program per machine to read/write the database at any one point in time. This version includes code which has ifile use a temporary file name while writing the database, renaming this to .idata when the writing has completed. These two fixes should significantly reduce (although not eliminate) problems stemming from multiple ifile jobs being run at the same time. When ifilter.mh passes an e-mail message to the ifile executable, it does so by creating a file in /tmp. Code is included in this version which makes use of the perl unlink() call to remove the file and which makes this file readable only by the user (0600 permissions). Previously, a 'system "rm $file"' call was used to remove the file in /tmp and normal (0644 or 0664) permissions were used for the file. Also included in this release is a minor change which allows one to compile ifile for multiple platforms from the same source (see the --srcdir option of configure). Thu Feb 19 00:23:43 EST 1998 ifile-0.6.6.tar.gz Compilation tested on: Sparc Ultra (SunOS 5.5.1 Generic_103640-12 sun4u sparc SUNW,Ultra-1) DEC (Compaq) Alpha (OSF1 V3.2 148 alpha) Intel Linux (Linux 2.0.27 #5 Mon Jun 2 22:37:38 EDT 1997 i586) Sparc 5 (SunOS 4.1.3_U1 2 sun4m) HP-UX (A.09.05 A 9000/777) Includes a command-line option for turning on/off log files, includes platform specific bugfixes for AIX 4.3 and SunOS 4.1.3 and eliminates dependence on autoconf and m4 for installation (configure.in has been removed). Thu Feb 12 23:42:00 EST 1998 ifile-0.6.5.tar.gz Includes added documentation, two database-related bugfixes, an added command-line option and a Makefile fix. If you have found your ~/.idata file growing unusually large, it is most likely the result of a bug in ifile v0.6.3. This bug is fixed in v0.6.5. Thu Jan 29 00:28:14 EST 1998 ifile-0.6.2.tar.gz Compilation tested on: Sparc Ultra (SunOS 5.5.1 Generic_103640-12 sun4u sparc SUNW,Ultra-1) DEC (Compaq) Alpha (OSF1 V3.2 148 alpha) Intel Linux (Linux 2.0.27 #5 Mon Jun 2 22:37:38 EDT 1997 i586) HP-UX (HP-UX unix30 A.09.05 A 9000/777) Wed Dec 24 23:18:22 EST 1997 ifile-971224.tar.gz I've done a lot of reworking of the organization of ifile. I'm hoping that everything is a bit cleaner and more flexible. Anyway, read INSTALL for installation instructions. As the previous developmental relese did, this one follows the installation scheme which a number of other GNU-style packages follow. Installation will place all the ifile binaries in /usr/local/bin unless you tell configure otherwise. Executables should include ifile, ifilter.mh, irefile.mh, knowledge_base.mh and news2mail. ifile is C code which is not mail client specific. It basically acts as a database front end. ifilter.mh and irefile.mh are perl scripts which interface with ifile to do MH-specific mail handling tasks. knowledge_base.mh is an MH-specific perl script which accumulates information on one's entire mail corpus. knowledge_base.mh is basically a wrapper for ifile and should be much more efficient than previous versions. news2mail is a perl script which Chris Browne whipped up a while ago to filter a news spool through ifile. One assumption this release makes which previous releases have not made is that your MH binaries are in directories which are part of your PATH. If they are not part of your path, you will need to edit ifilter.mh and irefile.mh to give full paths for the MH executables. If you have mail folders which you do *not* want mail filtered to, create an empty .skip_me file in the directories cooresponding to those folders. In previous versions of ifile, knowledge_base was conscious of .skip_me files, but irefile and ifilter ignored them. Now, irefile.mh and ifilter.mh are conscious of .skip_me files (i.e. entries will never be added for those folders and mail will never be filtered to those folders) ifile now has a wealth of lexing options. You might want to try executing "ifile --help" to get a list of the possibilites. The perl scripts all call ifile with the --skip-header (-h) option. ifile uses the alpha-lexer as its default lexer. Note that if you do change lexing styles, you will need to rebuild your database for best results. It is not a good idea to mix and match lexing styles. Also, if you receive mail in non-English languages, you might consider using the white-lexer. It will not throw out =xx (where x is 0-F) sequences, whereas the alpha-lexer will. To make this change, you will need to edit the three MH-specific perl scripts and add "-w" to the $ifile_args variable. As always, if you have any problems, feel free to send me mail at jr6b+@andrew.cmu.edu. ifile has two mailing lists which you are invited to join if you end up becoming a user of ifile. The two mailing lists are ifile-announce@cs.cmu.edu and ifile-discuss@cs.cmu.edu. The discuss mailing list receives all of the announce mail, so you only need to subscribe to one of the two. To subscribe, just send mail to me with a subject of "subscribe" followed by the name of the list you wish to join. As of 97.12.24, I handle these by hand, so you're welcome to say "hi" and tell me what you think of ifile in the subscription e-mail. Sat Oct 18 02:03:11 EDT 1997 ifile-971018.tar.gz Well, I've just completed an overhaul of the database routines. The hash tables are MUCH faster now. I get about a five-fold performance increase. I've also put everything into one executable file, ifile. Do a "./ifile --help" (notice the GNU-style command line parameters :) to get info about all the things the executable will do for you. Most of the options you see work. I think the only one which isn't implemented is --skip-header. Installation is significantly different than before. I've changed to the GNU-style of configure, make, make install. Doing this will compile the binaries and then copy all the executables to a binary directory. You can then call ifile executables (which at this point include "ifile" and "ifilter.mh" - "irefile.mh" will be included before I make a real release :) Sat Oct 4 03:03:39 EDT 1997 ifile-971004.tar.gz I'm in the process of changing the ifile C code that it is mail program independent. I changed the executable names to this effect and changed the nature of the ifilter (now ifile_query) program. irefile (now ifile_db) still operates in the same fashion. To get the effect of an ifilter program, you'll need to use the ifilter.mh script included in the distribution. The idea is that this script interfaces with the ifile_query program and then does all the mail program specific actions necessary to proper result. I also made a MAJOR :) change in the way ifile lexes (parses) messages. I brought in code from another package which does a nice job of abstracting message lexing. The way it's set up, it's not very difficult to change between different styles of lexing and it's also quite possible to write new lexers. My ultimiate goal is to do some testing with different lexing styles. The current lexing style chunks together runs of alphabetic characters (just like older version of ifile did). The knowlege_base.perl script is specific to this style of lexing. This package includes some new hash table and idata writing code, courtesy of Carl Staelin. The process of writing the idata file to disk has been sped up quite significantly. Btw, you'll probably have to edit the perl and C code to make sure that the proper paths are set before you will be able to use this code. $Id: NOTES,v 1.3 2002/11/07 11:46:52 jrennie Exp $ ifile-1.3.9/ifile.10000644000175000017500000002132611306214406012775 0ustar jasonjason.\" This is a comment .TH IFILE "1" "November 2004" "ifile 1.3.4" "User Commands" .SH NAME ifile \- core executable for the ifile mail filtering system .SH SYNOPSIS .B ifile [\fB-b \fIfile\fR] [\fB-q\fR|\fB-Q\fR] [\fB-g\fR] [\fB-k\fR] [\fB-o\fR] [\fB-v \fInum\fR] [\fIlexing options\fR] \fIfile \fI... .br .B ifile \fB-c\fR \fB-q\fR|\fB-Q\fR [\fB-T \fIthreshold\fR] [\fB-b \fIfile\fR] [\fB-g\fR] [\fB-k\fR] [\fB-o\fR] [\fIlexing options\fR] \fIfile \fI... .br .B ifile [\fB-b \fIfile\fR] [\fB-d \fIfolder\fR] [\fB-i \fIfolder\fR|\fB-u \fIfolder\fR] [\fB-g\fR] [\fB-k\fR] [\fB-o\fR] [\fB-v \fInum\fR] [\fIlexing options\fR] \fIfile \fI... .br .B ifile \fB-r\fR [\fB-b \fIfile\fR] .SH DESCRIPTION .B ifile is a mail filter client that uses machine learning to classify e-mail into folders/mail boxes. The algorithm that it uses is called Naive Bayes. Basically, naive bayes considers each document an unordered collection of words and classifies by matching the document distribution with the most closely matching folder/mailbox distribution. .SH OPTIONS .TP \fB\-b\fR, \fB\-\-db\-file\fR=\fIfile\fR Location to read/store ifile database. Default is ~/.idata .TP \fB\-c\fR, \fB\-\-concise\fR equivalent of "ifile \fB\-v\fR 0 | head \fB\-1\fR | cut \fB\-f1\fR \fB\-d\fR". Must be used with \fB-q\fR or \fB-Q\fR. .TP \fB\-d\fR, \fB\-\-delete\fR=\fIfolder\fR Delete the statistics for each of \fIfiles\fR from the category \fIfolder\fR .TP \fB\-f\fR, \fB\-\-folder\-calcs\fR=\fIfolder\fR Show the word-probability calculations for \fIfolder\fR .TP \fB\-g\fR, \fB\-\-log\-file\fR Create and store debugging information in ~/.ifile.log .TP \fB\-i\fR, \fB\-\-insert\fR=\fIfolder\fR Add the statistics for each of the files to the category \fIfolder\fR .TP \fB\-k\fR, \fB\-\-keep\-infrequent\fR Leave in the database words that occur infrequently (normally they are tossed) .TP \fB\-l\fR, \fB\-\-query\-loocv\fR=\fIfolder\fR For each of the files, temporarily removes file from \fIfolder\fR, performs query and then reinserts file in \fIfolder\fR. Database is not modified. .TP \fB\-o\fR, \fB\-\-occur\fR Uses document bit-vector representation. Count each word once per document. .TP \fB\-q\fR, \fB\-\-query\fR Output rating scores for each of the files .TP \fB\-Q\fR, \fB\-\-query\-insert\fR For each of the files, output rating scores and add statistics for the folder with the highest score .TP \fB\-T\fR, \fB\-\-threshold\fR=\fIthreshold\fR When used with both \fB-c\fR and \fB-q\fR, output the two highest ranking categories if their score differs by at most \fIthreshold\fR / 1000, which can be used to detect border cases. When used with \fB-q\fR only and any \fIthreshold\fR > 0, output the score difference percentage. For example, .RS .RS \fBifile \-T\fR1 \fB\-q\fR foo.txt .RE might result in .RS .br spam \-15570.48640776 .br non-spam \-18728.00272369 .br diff[spam,non-spam](%) 9.21 .RE If so, then .RS \fBifile \-T\fR93 \fB\-q \-c\fR foo.txt .RE will result in .RS foo.txt spam,non-spam .RE whereas .RS \fBifile \-T\fR92 \fB\-q \-c\fR foo.txt .RE will result in .RS foo.txt spam .RE .RE .TP \fB\-r\fR, \fB\-\-reset\-data\fR Erases all currently stored information .TP \fB\-u\fR, \fB\-\-update\fR=\fIfolder\fR Same as 'insert' except only adds stats if \fIfolder\fR already exists .TP \fB\-v\fR, \fB\-\-verbosity\fR=\fInum\fR Amount of output while running: 0=silent, 1=quiet, 2=progress, 3=verbose, 4=debug .PP Lexing options: .TP \fB\-a\fR, \fB\-\-alpha\-lexer\fR Lex words as sequences of alphabetic characters (default) .TP \fB\-A\fR, \fB\-\-alpha\-only\-lexer\fR Only lex space-separated character sequences which are composed entirely of alphabetic characters .TP \fB\-h\fR, \fB\-\-strip\-header\fR Skip all of the header lines except Subject:, From: and To: .TP \fB\-m\fR, \fB\-\-max\-length\fR=\fIchar\fR Ignore portion of message after first \fIchar\fR characters. Use entire message if \fIchar\fR set to 0. Default is 50,000. .TP \fB\-p\fR, \fB\-\-print\-tokens\fR Just tokenize and print, don't do any other processing. Documents are returned as a list of word, frequency pairs. .TP \fB\-s\fR, \fB\-\-no\-stoplist\fR Do not throw out overly frequent (stoplist) words when lexing .TP \fB\-S\fR, \fB\-\-stemming\fR Use 'Porter' stemming algorithm when lexing documents .TP \fB\-w\fR, \fB\-\-white\-lexer\fR Lex words as sequences of space separated characters .PP If no files are specified on the command line, ifile will use standard input as its message to process. .TP \fB-?\fR, \fB\-\-help\fR Give this help list .TP \fB\-\-usage\fR Give a short usage message .TP \fB\-V\fR, \fB\-\-version\fR Print program version .PP Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. .SH FILES .TP .I ~/.idata ifile database (default location). See \fIFAQ\fR included in ifile package for description of database format. .SH AUTHOR Jason Rennie and many others. See the ChangeLog for the full list. .\".SH "SEE ALSO" .\".BR ifilter_mh (1), .\".BR irefile_mh (1), .\".BR knowledge_base.mh (1), .\".BR news2mail (1). .SH EXAMPLES Before using .BR ifile , you need to train it. Let's say that you have three folders, "spam", "ifile" and "friends", and the following directory structure: .RS /--+--spam----+--1 | +--2 | +--3 | +--ifile---+--1 | +--2 | +--3 | +--friends-+--1 +--2 +--3 .RE The following commands build the ifile database in ~/.idata (use the .B \-d option to specify a different location for the database): .RS .br .BR "ifile \-h \-i" " spam /spam/*" .br .BR "ifile \-h \-i" " ifile /ifile/*" .br .BR "ifile \-h \-i" " friends /friends/*" .RE The .B \-h option strips off headers besides "Subject:", "From:" and "To:". I find that .B \-h improves ifile's performance, but you may find otherwise for your personal collection. Note that we have made the argument to .B \-i the same as the corresponding folder name. This is not necessary. The argument to .B \-i can be any word you want to use to identify a category of e-mails. The argument to .B \-i must not include space characters (including tab, feedline, etc.). At this point, your ~/.idata file should look something like this: .RS .br spam ifile friends .br 662 1020 6451 .br 3 3 3 .br jrennie 9 0:3 1:18 2:16 .br mindspring 6 1:7 2:5 .br make 9 0:5 1:3 .br yahoo 9 0:1 1:22 2:2 .RE The first line is the space-separated list of folders. Their ordering specifies a numbering (spam=0, ifile=1, friends=2). The second line is a token count for each folder (e.g. 662 tokens observed in the three spam messages). The third line is an e-mail count for each folder (e.g. 3 e-mails for each of spam, ifile and friends). Each following line specifies statistics for a word. The format of a line is .RS \fIword age folder\fR:\fIcount\fR [\fIfolder\fR:\fIcount\fR ...] .RE where \fIfolder\fR is the folder number determined by the first line ordering. Folders with a count of zero are not listed. So, the line beginning with "jrennie" indicates that "jrennie" appeared 3 times in "spam" e-mails, 18 times in "ifile" e-mails and 16 times in "friends" e-mails. The \fIage\fR is the number of e-mails that have been processed since the word was added to the database. Very infrequent words are pruned from the database to keep the database size down. Now that you have a database, you might want to filter some e-mails. Say you have the following incoming e-mails: .RS /--inbox--+--1 +--2 +--3 .RE To find out what folders ifile thinks these e-mails belong in, run .RS .br .BR "ifile \-c \-q" " /inbox/1" .br .BR "ifile \-c \-q" " /inbox/2" .br .BR "ifile \-c \-q" " /inbox/3" .RE Let's say that 1 is about ifile, 2 is spam and 3 is from a friend. Assuming ifile does its job correctly, you'll see output like this: .RS .br /inbox/1 ifile .br /inbox/2 spam .br /inbox/3 friends .RE With such little training data, ifile is unlikely to get the labels correct, but you should get the idea :-) Now, if you move the e-mails to the folders suggested by ifile, you'll want to update the database accordingly. You can do this with the .B \-i option, like before. Or, you can simply use .B \-Q in place of .B \-q above. This automatically adds the e-mail to the folder ifile suggests. Now, assume for a moment that e-mail 1 was actually spam. We've added 1 to ifile and put it in the ifile folder. We need to move it to the spam folder and update the ifile database accordingly. We can update the database with the following command: .RS .BR "ifile \-d" " ifile " .BR "-i" " spam /inbox/1" .RE This deletes the e-mail from "ifile" and adds it to "spam". .SH "SEE ALSO" Examples of how to use .B ifile together with .BR procmail (1) and .BR metamail (1) can be found in the directory .B /usr/share/doc/ifile/examples. ifile-1.3.9/include/0000775000175000017500000000000011306214407013245 5ustar jasonjasonifile-1.3.9/include/ifile.h0000664000175000017500000003751511306214407014521 0ustar jasonjason/* This file is ifile.h - main header file containing all global variables, function prototypes and structure declarations */ /* ifile - intelligent mail filter for EXMH/MH Copyright (C) 1997 Jason Daniel Rennie Unless otherwise specified, written by Jason Daniel Rennie 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. */ /* NOTE: some portions taken/adapted from libbow - written by Andrew Kachites * McCallum */ #ifndef __IFILE_H_ #define __IFILE_H_ #include #include #include #include #include "argp/argp.h" #include "extendable_array.h" #include "hash_table.h" #define IFILE_VERSION "ifile 1.3.9" #define IFILE_MAJOR_VERSION 1 #define IFILE_MINOR_VERSION 3 #define IFILE_TRIFLING_VERSION 9 #define FALSE 0 #define TRUE 1 #ifndef MAX_STR_LEN #define MAX_STR_LEN 2048 #endif #ifndef IFILE_INIT_FOLDERS #define IFILE_INIT_FOLDERS 10 #endif #ifndef IFILE_INIT_WORDS #define IFILE_INIT_WORDS 5000 #endif #ifndef IFILE_MAX_WORD_LENGTH #define IFILE_MAX_WORD_LENGTH 2048 #endif #define ifile_malloc(x) malloc(x) #define ifile_realloc(x,y) realloc(x,y) #define ifile_fopen(x,y) fopen(x,y) #ifndef DEFAULT_DB_FILE #define DEFAULT_DB_FILE ".idata" #endif #ifndef CLOCKS_PER_SECOND #ifdef CLOCKS_PER_SEC #define CLOCKS_PER_SECOND CLOCKS_PER_SEC #else #ifdef CLK_TCK #define CLOCKS_PER_SECOND CLK_TCK #else #define CLOCKS_PER_SECOND 100 #endif #endif #endif #define ALPHA_LEXER 1 /* word is a string of alphabetic characters */ #define WHITE_LEXER 2 /* word is a whitespace separated string */ #define ALPHA_ONLY_LEXER 3 /* word is whitespace separated alpha string */ #ifndef ERROR #define ERROR -1 /* standard return value for when something goes wrong */ #endif /* Progress and error reporting. Setting in error.c. */ /* Adapted from libbow - written by Andrew Kachites McCallum */ enum ifile_verbosity_levels { ifile_silent = 0, /* only fatal errors */ ifile_quiet, /* only warnings and errors */ ifile_progress, /* enough lines to show progress */ ifile_verbose, /* lots of status info */ ifile_debug /* everything (and then some) */ }; /* A linked list of digits */ struct linked_list { struct linked_list * next; int digit; }; typedef struct linked_list linked_list; /* struct used when returning categorization of document */ typedef struct _category_rating { double rating; char * category; } category_rating; /* entry for each word of the database */ typedef struct _db_word_entry { char * word; long int age; long int tot_freq; /* int * freq; */ extendable_array *freq; } db_word_entry; /* structure to hold ifile database information */ typedef struct _ifile_db { long int num_folders; long int num_words; long int total_docs; long int total_freq; long int (*trim_freq)(long int); extendable_array folder_name; extendable_array folder_freq; extendable_array folder_msg; htable data; /* index = (char *) entry = (db_word_entry *) */ } ifile_db; /* Used by opts.c to communicate with parse_opt. */ typedef struct _arguments { extendable_array file; /* [FILE...] */ int num_files, thresh; int query, query_insert, concise; int stemming, stoplist, lexer; int skip_header, tag_headers, keep_infrequent, verbosity; int max_length; /* Ignore characters after first MAX_LENGTH characters */ int print_tokens; /* Tokenize and print messages - nothing else */ char *folder_calcs; char *minus_folder, *plus_folder; char *loocv_folder; int create_folder; /* create folder if it does not exist? */ char *db_file; int tmp_file; /* create a /tmp/ifile.log. file? */ int reset_data; int occur; int read_db, write_db, read_message; /* boolean - what do we need to do? */ } arguments; /* initialization functions */ void ifile_db_init (ifile_db * idata); void ifile_db_entry_init (db_word_entry * wentry); void ifile_db_free(ifile_db *idata); /* utility functions */ unsigned long hash(const char * s, long int size); char * ifile_sprintf (char * format, ...); char * ifile_cats (long int num_strings, ...); char * itoa (long int number); char * readline (char ** bufp); void ifile_free (void * var); char * ifile_strdup (const char *s1); void ifile_bitify_document(htable * message); /* rating functions */ category_rating * ifile_rate_categories (htable * message, ifile_db * idata); void ifile_free_categories(category_rating *cr, ifile_db *idata); void ifile_concise_ratings (char * path, FILE * FP, category_rating * ratings, ifile_db * idata, int thresh); void ifile_print_ratings (FILE * FP, category_rating * ratings, ifile_db * idata, int thresh); /* database functions */ void ifile_db_init(ifile_db * idata); htable * ifile_read_message (FILE * FP); void ifile_print_message (htable * message); long int ifile_read_header (ifile_db * idata, char ** bufp); long int ifile_read_word_frequencies (ifile_db * idata, char ** bufp); long int ifile_read_word_entry (char * line, ifile_db * idata); long int ifile_read_db (char * data_file, ifile_db * idata); long int ifile_write_db (char * data_file, ifile_db * idata); long int ifile_write_header (FILE * DATA, ifile_db * idata); long int ifile_write_word_frequencies (FILE * DATA, ifile_db * idata); long int ifile_age_words (ifile_db * idata, long int epochs); void ifile_add_db (char * folder, htable * message, ifile_db * idata, int create); void ifile_del_db (char * folder, htable * message, ifile_db * idata); /* error handling and logging functions */ char * ifile_strip_path(char * full_path); FILE * ifile_open_log (int argc, char ** argv); void ifile_close_log (); int ifile_verbosify (int verbosity_level, const char *format, ...); void ifile_error (const char *format, ...); /* command-line argument functions */ void ifile_init_args (arguments * args); /* * lexing stuff */ /* A structure for maintaining the context of a lexer. (If you need to create a lexer that uses more context than this, define a new structure that includes this structure as its first element; IFILE_LEX_GRAM, defined below is an example of this.) */ /* Adapted from libbow - written by Andrew Kachites McCallum */ typedef struct _ifile_lex { char *document; int document_length; int document_position; } ifile_lex; /* A lexer is represented by a pointer to a structure of this type. */ /* sizeof_lex - size of corresponding _ifile_lex structure * *open_text_fp - function to open the document to be lexed * *get_word - function for getting the next word in the document * *close - function for closing the document * document_start_pattern - string to indicate the beginning of the * document (within the file) * document_end_pattern - string to indicate the end of the document * (within the file) * note: NULL does not scan forward, "" scans forward to EOF */ /* Adapted from libbow - written by Andrew Kachites McCallum */ typedef struct _ifile_lexer { int sizeof_lex; ifile_lex* (*open_text_fp) (struct _ifile_lexer *self, FILE *fp); int (*get_word) (struct _ifile_lexer *self, ifile_lex *lex, char *buf, int buflen); void (*close) (struct _ifile_lexer *self, ifile_lex *lex); const char *document_start_pattern; const char *document_end_pattern; } ifile_lexer; /* This is an augmented version of IFILE_LEXER that works for simple, context-free lexers. */ /* Adapted from libbow - written by Andrew Kachites McCallum */ typedef struct _ifile_lexer_simple { /* The basic lexer. */ ifile_lexer lexer; /* Parameters of the simple, context-free lexing. */ int (*true_to_start)(int character); /* non-zero on char to start */ int (*false_to_end)(int character); /* zero on char to end */ int (*stoplist_func)(const char *); /* one on token in stoplist */ int (*stem_func)(char *); /* modify arg by stemming */ int case_sensitive; /* boolean */ int strip_non_alphas_from_end; /* boolean */ int toss_words_containing_non_alphas; /* boolean */ int toss_words_containing_this_many_digits; int toss_words_longer_than; } ifile_lexer_simple; /* Get the raw token from the document buffer by scanning forward until we get a start character, and filling the buffer until we get an ending character. The resulting token in the buffer is NULL-terminated. Return the length of the token. */ int ifile_lexer_simple_get_raw_word (ifile_lexer_simple *self, ifile_lex *lex, char *buf, int buflen); /* Perform all the necessary postprocessing after the initial token boundaries have been found: strip non-alphas from end, toss words containing non-alphas, toss words containing certaing many digits, toss words appearing in the stop list, stem the word, check the stoplist again, toss words of length one. If the word is tossed, return zero, otherwise return the length of the word. */ int ifile_lexer_simple_postprocess_word (ifile_lexer_simple *self, ifile_lex *lex, char *buf, int buflen); /* Create and return a IFILE_LEX, filling the document buffer from characters in FP, starting after the START_PATTERN, and ending with the END_PATTERN. */ ifile_lex *ifile_lexer_simple_open_text_fp (ifile_lexer *self, FILE *fp); /* Close the LEX buffer, freeing the memory held by it. */ void ifile_lexer_simple_close (ifile_lexer *self, ifile_lex *lex); /* Scan a single token from the LEX buffer, placing it in BUF, and returning the length of the token. BUFLEN is the maximum number of characters that will fit in BUF. If the token won't fit in BUF, an error is raised. */ int ifile_lexer_simple_get_word (ifile_lexer *self, ifile_lex *lex, char *buf, int buflen); /* A lexer that throws out all space-delimited strings that have any non-alphabetical characters. For example, the string `obtained from http://www.cs.cmu.edu' will result in the tokens `obtained' and `from', but the URL will be skipped. */ extern const ifile_lexer_simple *ifile_alpha_only_lexer; /* A lexer that keeps all alphabetic strings, delimited by non-alphabetic characters. For example, the string `http://www.cs.cmu.edu' will result in the tokens `http', `www', `cs', `cmu', `edu'. */ extern const ifile_lexer_simple *ifile_alpha_lexer; /* A lexer that keeps all strings that begin and end with alphabetic characters, delimited by white-space. For example, the string `http://www.cs.cmu.edu' will be a single token. */ extern const ifile_lexer_simple *ifile_white_lexer; /* Some declarations for a generic indirect lexer. See lex-indirect.c */ typedef struct _ifile_lexer_indirect { ifile_lexer lexer; ifile_lexer *underlying_lexer; } ifile_lexer_indirect; /* Open the underlying lexer. */ ifile_lex *ifile_lexer_indirect_open_text_fp (ifile_lexer *self, FILE *fp); /* Close the underlying lexer. */ void ifile_lexer_indirect_close (ifile_lexer *self, ifile_lex *lex); /* Declarations for an e-mail lexer. See lex-email.c */ /* An augmented version of IFILE_LEXER that allows for removal of certain * e-mail headers */ typedef struct _ifile_lexer_email { ifile_lexer_indirect indirect_lexer; char **headers_to_keep; int gram_size; } ifile_lexer_email; /* An augmented version of IFILE_LEX that keeps track of the current * document section */ typedef struct _ifile_lex_email { ifile_lex lex; int gram_size_this_time; } ifile_lex_email; /* A lexer which selectively throws out headers of an e-mail message */ /* NOTE: value of NULL throws out all headers, value of -1 keeps them all */ extern const ifile_lexer_email *ifile_email_lexer; /* Some declarations for a simple N-gram lexer. See lex-gram.c */ /* An augmented version of IFILE_LEXER that provides N-grams */ typedef struct _ifile_lexer_gram { ifile_lexer_indirect indirect_lexer; int gram_size; } ifile_lexer_gram; /* An augmented version of IFILE_LEX that works for N-grams */ typedef struct _ifile_lex_gram { ifile_lex lex; int gram_size_this_time; } ifile_lex_gram; /* A lexer that returns N-gram tokens using IFILE_ALPHA_ONLY_LEXER. It actually returns all 1-grams, 2-grams ... N-grams, where N is specified by GRAM_SIZE. */ extern const ifile_lexer_gram *ifile_gram_lexer; /* The default lexer that will be used by various library functions like IFILE_WV_NEW_FROM_TEXT_FP(). You should set this variable to point at whichever lexer you desire. If you do not set it, it will point at ifile_alpha_lexer. */ extern ifile_lexer *ifile_default_lexer; /* Default instances of the lexers that can be modified by libbow's argp cmdline argument processing. */ extern ifile_lexer_simple *ifile_default_lexer_simple; extern ifile_lexer_email *ifile_default_lexer_email; /* initialize the default lexers */ void ifile_default_lexer_init(); /* Functions that may be useful in writing a lexer. */ /* Apply the Porter stemming algorithm to modify WORD. Return 0 on success. */ int ifile_stem_porter (char *word); /* A function wrapper around POSIX's `isalpha' macro. */ int ifile_isalpha (int character); /* A function wrapper around POSIX's `isgraph' macro. */ int ifile_isgraph (int character); /* Return non-zero if WORD is on the stoplist. */ int ifile_stoplist_present (const char *word); /* Add to the stoplist the white-space delineated words from FILENAME. Return the number of words added. If the file could not be opened, return -1. */ int ifile_stoplist_add_from_file (const char *filename); /* Add WORD to the stop list. */ void ifile_stoplist_add_word (const char *word); /* * other stuff from libbow */ int ifile_fp_is_text (FILE *fp); /* Managing int->string and string->int mappings. */ typedef struct _ifile_int4str { const char **str_array; int str_array_length; int str_array_size; int *str_hash; int str_hash_size; } ifile_int4str; /* Allocate, initialize and return a new int/string mapping structure. The parameter CAPACITY is used as a hint about the number of words to expect; if you don't know or don't care about a CAPACITY value, pass 0, and a default value will be used. */ ifile_int4str *ifile_int4str_new (int capacity); /* Given a integer INDEX, return its corresponding string. */ const char *ifile_int2str (ifile_int4str *map, int index); /* Given the char-pointer STRING, return its integer index. If this is the first time we're seeing STRING, add it to the mapping, assign it a new index, and return the new index. */ int ifile_str2int (ifile_int4str *map, const char *string); /* Given the char-pointer STRING, return its integer index. If STRING is not yet in the mapping, return -1. */ int ifile_str2int_no_add (ifile_int4str *map, const char *string); /* Create a new int-str mapping by lexing words from FILE. */ ifile_int4str *ifile_int4str_new_from_text_file (const char *filename); /* Write the int-str mapping to file-pointer FP. */ void ifile_int4str_write (ifile_int4str *map, FILE *fp); /* Return a new int-str mapping, created by reading file-pointer FP. */ ifile_int4str *ifile_int4str_new_from_fp (FILE *fp); /* Return a new int-str mapping, created by reading FILENAME. */ ifile_int4str *ifile_int4str_new_from_file (const char *filename); /* Free the memory held by the int-word mapping MAP. */ void ifile_int4str_free (ifile_int4str *map); /* Free the memory held by the stoplist */ void ifile_stoplist_free(); #ifdef DMALLOC #include "dmalloc.h" #endif #endif ifile-1.3.9/include/extendable_array.h0000644000175000017500000000565211306214407016735 0ustar jasonjason/* Implementation of arrays that can grow in size. Diego Zamboni, Mar 7, 1997. */ /* Chunk sizes in which the array grows */ #define EXT_ARRAY_CHUNK_SIZE 50 typedef struct ext_array_struct { int size; /* Total number of units which have been allocated for storage of the extendable array */ int elems; /* last_elem+1 */ int last_elem; /* Largest index of all elements which have been set */ void *data; } extendable_array; /* This is all implemented with macros to allow for specification of types. */ /* Inserts an element in the next available free spot in the array */ #define EXT_ARRAY_ADD(var,type,val) \ {\ EXT_ARRAY_SET(var,type,var.elems,val);\ } /* Initialize a variable of type extendable_array */ #define EXT_ARRAY_INIT(var,type,inisize) \ {\ int i;\ var.size=inisize;\ var.elems=0;\ var.last_elem=-1;\ var.data=(type *)malloc(sizeof(type) * inisize);\ for (i=0; i < inisize; i++)\ ((type *)var.data)[i] = 0;\ } /* Set the n-th element of the array to a value, extending the array * if necessary. All elements which are added to the array and not * explicitly set to a value are given the value of 0. */ #define EXT_ARRAY_SET(var,type,n,val) \ {\ int ext_index;\ if(n >= var.size) {\ var.data = (type *)realloc(var.data,\ sizeof(type)*\ (((n/EXT_ARRAY_CHUNK_SIZE)+1)*\ EXT_ARRAY_CHUNK_SIZE));\ var.size = (((n/EXT_ARRAY_CHUNK_SIZE)+1)*\ EXT_ARRAY_CHUNK_SIZE);\ }\ if (n >= var.elems){\ for (ext_index=var.elems; ext_index <= n; ext_index++)\ ((type *) var.data)[ext_index] = 0;\ var.elems = n+1;\ }\ if(n >= var.last_elem) {\ var.last_elem = n;\ }\ ((type *) var.data)[n]=val;\ }\ /* Initialize for n elements and set elements to val. We can save a lot of * manipulations of parts of var until we're finished. */ #define EXT_ARRAY_INIT_N_SET(var,type,inisize,val) \ {\ int i;\ (var).size=(inisize);\ (var).data=(type *)malloc(sizeof(type) * (inisize));\ for (i=0; i < (inisize); i++)\ ((type *)var.data)[i] = (val);\ (var).elems = (inisize);\ (var).last_elem = (inisize);\ } /* Get the value of an element. If index is out of range, returns 0 */ #define EXT_ARRAY_GET(var,type,n) \ ((n < var.elems && n >= 0) ? (((type *)(var.data))[n]) : (type) 0) /* Free memory used by extended array - array must be initialized to become usable again. */ /* written by Jason Rennie for ifile */ #define EXT_ARRAY_FREE(var,type) \ {\ free((type *)var.data);\ var.data = NULL;\ } /* Free memory used by elements of array (elements MUST be pointers) */ /* written by Jason Rennie for ifile */ #define EXT_ARRAY_FREE_ELEMS(var,type) \ {\ int i;\ for (i=0; i < var.elems; i++) \ {\ if (((type *)var.data)[i] != NULL) \ {\ free(((type *)var.data)[i]); \ ((type *)var.data)[i] = NULL; \ }\ }\ var.elems=0;\ var.last_elem=-1;\ } ifile-1.3.9/include/hash_table.h0000644000175000017500000000224411306214407015510 0ustar jasonjason/* header file for self-resizing hash table */ /* written by Jason Rennie */ #define CROWDED_PCT 0.50 typedef struct _hash_elem { void * index; void * entry; } hash_elem; typedef struct _htable { int num_slots; /* size of DATA array */ int num_entries; /* # of slots in DATA array being used */ hash_elem * data; /* array of HASH_ELEMs */ /* S is pointer to index string. SIZE is size of htable */ unsigned long (*hash) (const void * s, long int size); } htable; void htable_init(htable * hash_table, long int num_slots, unsigned long (*hash_fun) (const void *, long int)); void htable_free(htable * hash_table, void (*free_index)(void *), void (*free_entry)(void *)); void htable_put(htable * hash_table, void * index, void * entry); void * htable_lookup(htable * hash_table, void * index); hash_elem * htable_init_traversal(htable * hash_table); hash_elem * htable_next_traversal(htable * hash_table, hash_elem * elem); void htable_resize(htable * hash_table, long int num_slots); void htable_free_guts(htable * hash_table, void (*free_index)(void *), void (*free_entry)(void *)); ifile-1.3.9/Version0000644000175000017500000000023311306214407013166 0ustar jasonjasonIFILE_MAJOR_VERSION=1 IFILE_MINOR_VERSION=3 IFILE_TRIFLING_VERSION=9 IFILE_VERSION=${IFILE_MAJOR_VERSION}.${IFILE_MINOR_VERSION}.${IFILE_TRIFLING_VERSION} ifile-1.3.9/COPYING0000644000175000017500000003536111306214407012663 0ustar jasonjason GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ifile-1.3.9/configure0000755000175000017500000040117311306214407013535 0ustar jasonjason#! /bin/sh # 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="ifile.c" # 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_subdirs_all="$ac_subdirs_all argp" 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 CFLAGS CC LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB CPP EGREP PERL subdirs 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 _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-dmalloc build with the dmalloc library 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 # configure.ac for "ifile". # Process this file with autoconf to produce a configure script. # Let the user set CFLAGS on the ./configure command-line if test -z "$CFLAGS" ; then if test -z "$CC" ; then CFLAGS="-g -O2 -Wall -Wimplicit" #provide a default for CFLAGS for gcc else CFLAGS="-O" #provide a default for CFLAGS for others fi fi # Find the compiler 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 # Avoid using GCC __attributes__ for non-GCC compilers if test -z "$GCC" ; then CFLAGS="-DCONSTRUCTOR_FAILS=1 $CFLAGS" fi # Find some installation programs 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' if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; 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_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Needed by database.c 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 echo "$as_me:$LINENO: checking for ssize_t" >&5 echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 if test "${ac_cv_type_ssize_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 ((ssize_t *) 0) return 0; if (sizeof (ssize_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_ssize_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_ssize_t=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 if test $ac_cv_type_ssize_t = yes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi # Needed in various files for ac_func in strchr 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 # Needed on DEC alpha machines for ac_header in alloca.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 # Find location of the perl interpreter executable if test -z "$PERL" ; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_PERL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then echo "$as_me:$LINENO: result: $PERL" >&5 echo "${ECHO_T}$PERL" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi # Make AC_OUTPUT call configure in these subdirectories subdirs="$subdirs argp" # --with-dmalloc option: add dmalloc library # Check whether --with-dmalloc or --without-dmalloc was given. if test "${with_dmalloc+set}" = set; then withval="$with_dmalloc" fi; if test "$with_dmalloc" = yes; then echo "$as_me:$LINENO: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $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 dmalloc_debug (); int main () { dmalloc_debug (); ; 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_lib_dmalloc_dmalloc_debug=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dmalloc_dmalloc_debug=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then LIBS="$LIBS -ldmalloc"; CPPFLAGS="$CPPFLAGS -DDMALLOC" fi fi # Write the Makefiles ac_config_files="$ac_config_files 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 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. cat >confdef2opt.sed <<\_ACEOF t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote d : quote s,[ `~#$^&*(){}\\|;'"<>?],\\&,g s,\[,\\&,g s,\],\\&,g s,\$,$$,g p _ACEOF # We use echo to avoid assuming a particular line-breaking character. # The extra dot is to prevent the shell from consuming trailing # line-breaks from the sub-command output. A line-break within # single-quotes doesn't work because, if this script is created in a # platform that uses two characters for line-breaks (e.g., DOS), tr # would break. ac_LF_and_DOT=`echo; echo .` DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` rm -f confdef2opt.sed 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 Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.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. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason 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,@CFLAGS@,$CFLAGS,;t t s,@CC@,$CC,;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,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@PERL@,$PERL,;t t s,@subdirs@,$subdirs,;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 # 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; } 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 _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 { (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 # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= for ac_arg in $ac_configure_args; do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -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=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d $srcdir/$ac_dir || continue { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 echo "$as_me: configuring in $ac_dir" >&6;} { 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 cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" elif test -f $ac_srcdir/configure; then ac_sub_configure="$SHELL '$ac_srcdir/configure'" elif test -f $ac_srcdir/configure.in; then ac_sub_configure=$ac_configure else { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative path. ac_sub_cache_file=$ac_top_builddir$cache_file ;; esac { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval $ac_sub_configure $ac_sub_configure_args \ --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} { (exit 1); exit 1; }; } fi cd "$ac_popdir" done fi ifile-1.3.9/hash_table.c0000644000175000017500000001520111306214406014054 0ustar jasonjason/* implementation of auto-resizing hash table */ /* ifile - intelligent mail filter for EXMH/MH ifile is Copyright (C) 1997 Jason Rennie 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 (see file 'COPYING'); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include /* stdlib doesn't have NULL defined on SunOS 4.1.3_U1 */ #include #include #include #include /* Crock: hashtables should create their own copies of string indices, except when they're resizing */ /* Crock added by Jeremy Brown , who isn't proud of it. */ int htable_privatize_indices = 1; char * ifile_strdup (const char *s1); /* Initializes values of hash table, allocates space for DATA array. * HASH_TABLE->DATA *must* be malloced. */ /* written by Jason Rennie */ void htable_init(htable * hash_table, long int num_slots, unsigned long (*hash_fun) (const void *, long int)) { long int i = 0; /* makes the size of the array prime (up to about i=30) */ for (i=7; ((1 << i) - 1) < num_slots; i += 2); num_slots = (1 << i) - 1; hash_table->num_slots = num_slots; hash_table->num_entries = 0; hash_table->data = (hash_elem *) malloc(num_slots*sizeof(hash_elem)); hash_table->hash = hash_fun; for (i=0; i < num_slots; i++) { hash_table->data[i].index = NULL; hash_table->data[i].entry = NULL; } } /* Frees all memory used by HASH TABLE. Uses caller-provided functions to free entry and index; NULL functions mean nothing needs to be done. */ /* written by Jason Rennie */ void htable_free_guts(htable * hash_table, void (*free_index)(void *), void (*free_entry)(void *)) { long int i; long int slots = hash_table->num_slots; hash_elem * data = hash_table->data; if (free_index) for (i=0; i < slots; i++) free_index(data[i].index); if (free_entry) for (i=0; i < slots; i++) free_entry(data[i].entry); free(hash_table->data); } /* See above function */ void htable_free(htable * hash_table, void (*free_index)(void *), void (*free_entry)(void *)) { htable_free_guts(hash_table, free_index, free_entry); free(hash_table); } /* Adds an entry to the hash table, expands the hash table if it is too * crowded. Assumes that INDEX and ENTRY will not be deallocated during * the life of the hash table */ /* written by Jason Rennie */ void htable_put(htable * hash_table, void * index, void * entry) { unsigned long key; long int i; if ((float)(hash_table->num_entries+1) / (float)(hash_table->num_slots) >= CROWDED_PCT) htable_resize(hash_table, hash_table->num_slots*2); key = hash_table->hash(index, hash_table->num_slots); i = key % hash_table->num_slots; assert(i >= 0); /* loop until we find an open slot, or a slot with the same index */ while (hash_table->data[i].entry != NULL && strcmp((char *) index, (char *) (hash_table->data[i].index)) != 0) { key++; i = key % hash_table->num_slots; assert(i >= 0); } if (hash_table->data[i].entry == NULL) { hash_table->data[i].index = htable_privatize_indices? ifile_strdup(index) : index; hash_table->num_entries++; } hash_table->data[i].entry = entry; } /* Returns the ENTRY for a given INDEX. Returns NULL if an ENTRY * for INDEX does not exist in the hash table */ /* written by Jason Rennie */ void * htable_lookup(htable * hash_table, void * index) { unsigned long key; long int i; key = hash_table->hash(index, hash_table->num_slots); i = key % hash_table->num_slots; assert(i >= 0); /* loop until we find an open slot, or a slot with the same index */ while (hash_table->data[i].entry != NULL && strcmp((char *) index, (char *) (hash_table->data[i].index)) != 0) { key++; i = key % hash_table->num_slots; assert(i >= 0); } return hash_table->data[i].entry; } /* Returns first element in hash table. Returns NULL if hash table i * empty. */ /* written by Jason Rennie */ hash_elem * htable_init_traversal(htable * hash_table) { long int slots = hash_table->num_slots; long int slot_size = sizeof(hash_elem); long int elem; long int base = (long int) hash_table->data; long int limit = slots*slot_size + base; for (elem = base; elem < limit && (*(hash_elem *)elem).entry == NULL; elem += slot_size); if (elem >= limit) return NULL; else return (hash_elem *) elem; } /* Returns the next element of the hash table. Sequential calls of * this function traverses all hash table entries. Returns NULL if * ELEM is the last element of the traversal */ /* written by Jason Rennie */ hash_elem * htable_next_traversal(htable * hash_table, hash_elem * elem) { long int slots = hash_table->num_slots; long int slot_size = sizeof(hash_elem); long int base = (long int) hash_table->data; long int limit = slots*slot_size + base; long int elem_ptr; /* takes advantage of the fact that DATA is an array */ for (elem_ptr = (long int) elem + slot_size; elem_ptr < limit && (*(hash_elem *)elem_ptr).entry == NULL; elem_ptr += slot_size); if ((long int) elem_ptr >= limit) return NULL; else return (hash_elem *) elem_ptr; } /* Resizes DATA so that it is capable of containing at least NUM_SLOTS * entries. This function is reliant on the current implementation * of other htable functions. */ /* written by Jason Rennie */ void htable_resize(htable * hash_table, long int num_slots) { htable fake_htable; hash_elem * elem; htable_init(&fake_htable, num_slots, hash_table->hash); htable_privatize_indices = 0; for (elem = htable_init_traversal(hash_table); elem != NULL; elem = htable_next_traversal(hash_table, elem)) htable_put(&fake_htable, (*elem).index, (*elem).entry); htable_privatize_indices = 1; free(hash_table->data); hash_table->data = fake_htable.data; hash_table->num_slots = fake_htable.num_slots; } ifile-1.3.9/lex-email.c0000644000175000017500000002020311306214407013636 0ustar jasonjason/* A simple N-gram lexer. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #ifdef _AIX #pragma alloca #endif #include #if HAVE_ALLOCA_H #include #endif #define SELF ((ifile_lexer_email*)self) #define LEX ((ifile_lex_email*)lex) /* String compare function used to compare headers. Ignores case distinctions 1 => strings don't match. 0 => strings do match. */ int strcmp_ignore_case (char *str1, char *str2) { int pos = 0; assert(str1 != NULL); assert(str2 != NULL); while (tolower(str1[pos]) == tolower(str2[pos])) { if (str1[pos] == '\0') { return 0; } pos++; } return 1; } /* Given a lex which is pointing to the first character of a header line, * determines whether the header should be kept and extracts the portion * which should be kept. Returns NULL if the header should be tossed. * Otherwise, returns a pointer to a newly allocated string which is the * portion of the header which should be kept. Modifies * lex->document_position so that it points at the first character of the line * immediately following the header. */ /* NOTE: function makes some modifications to lex->document */ /* written by Jason Rennie for ifile */ char * ifile_lexer_email_parse_header (ifile_lex *lex, ifile_lexer *self) { int keep_header; /* boolean */ int start_header_name = lex->document_position; int start_header; /* first character after the colon */ char byte, next_byte; char *ret; /* header string to return */ int ret_size; int i; /* char buf[80]; strncpy(buf, &lex->document[lex->document_position], 79); buf[79] = '\0'; printf("ifile_lexer_email_parse_header (lex=%p, self=%p)\n%s\n", lex, self, buf); */ /* find the colon, indicating the end of the header name */ do { byte = lex->document[lex->document_position++]; } while (((byte >= 33 && byte <= 57) || (byte >= 59 && byte <= 126)) && lex->document_position < lex->document_length); start_header = lex->document_position; keep_header = FALSE; /* check to see if we should be keeping this header */ if (byte == 58) { lex->document[lex->document_position-1] = '\0'; ifile_verbosify(ifile_debug, "Checking \"%s\"... ", &lex->document[start_header_name]); for (i = 0; !keep_header && SELF->headers_to_keep[i]; i++) if (strcmp_ignore_case (SELF->headers_to_keep[i], &lex->document[start_header_name]) == 0) { keep_header = TRUE; ifile_verbosify(ifile_debug, "okay.\n"); } } else { /* this doesn't appear to be a header */ ifile_verbosify(ifile_debug, "not a header.\n"); return (char *) ERROR; } /* search forward until the end of the header is reached */ next_byte = lex->document[lex->document_position]; do { byte = next_byte; next_byte = lex->document[++lex->document_position]; } while ((byte != '\n' || next_byte == 32 || next_byte == 9) && byte != '\0' && lex->document_position < lex->document_length); if (keep_header == FALSE) { ifile_verbosify(ifile_debug, "tossed.\n"); return NULL; } /* make a new string out of the portion of the header we want to keep */ ret_size = lex->document_position - start_header; ret = malloc(sizeof(char) * (ret_size+1)); strncpy(ret, &lex->document[start_header], ret_size); ret[ret_size] = '\0'; return ret; } /* Does a pre-lexing of the headers, removing certain headers and eliminating * the tags from others */ /* written by Jason Rennie for ifile */ int ifile_lexer_email_prelex_header (ifile_lex *lex, ifile_lexer *self) { int begin_unfinished; /* first character of the unfinished section */ char *header, *body; int body_size; /* printf("ifile_lexer_email_prelex_header(lex=%p, self=%p)\n", lex, self); */ if (SELF->headers_to_keep == NULL || SELF->headers_to_keep == (char **) -1) return 0; if (lex->document_position != 0) return ERROR; begin_unfinished = 0; /* check each header, removing any unwanted portions from the document */ while (lex->document_position < lex->document_length && lex->document[lex->document_position] != '\n') { if ((header = ifile_lexer_email_parse_header (lex, self))) { if (header == (char *) ERROR) break; strcpy (&lex->document[begin_unfinished], header); begin_unfinished += strlen (header); free (header); } } body_size = lex->document_length - lex->document_position; body = (char *) malloc (sizeof(char) * (body_size + 1)); strncpy (body, &lex->document[lex->document_position], body_size); body[body_size] = '\0'; strcpy (&lex->document[begin_unfinished], body); lex->document_length = begin_unfinished + body_size - 1; lex->document_position = 0; return 0; } ifile_lex * ifile_lexer_email_open_text_fp (ifile_lexer *self, FILE *fp) { ifile_lex *lex; /* to toss all headers, don't begin document until the first blank line */ if (SELF->headers_to_keep == NULL) self->document_start_pattern = "\n\n"; lex = ifile_lexer_indirect_open_text_fp (self, fp); if (lex == NULL) return NULL; LEX->gram_size_this_time = SELF->gram_size; if (ifile_lexer_email_prelex_header (lex, self)) ifile_verbosify(ifile_progress, "Did not pre-lex e-mail headers properly!\n"); return lex; } int ifile_lexer_email_get_word (ifile_lexer *self, ifile_lex *lex, char *buf, int buflen) { int i; char **tokens; int s; int len; tokens = alloca (sizeof (char*) * LEX->gram_size_this_time); for (i = 0; i < LEX->gram_size_this_time; i++) tokens[i] = alloca (IFILE_MAX_WORD_LENGTH); /* Remember where we started. */ s = LEX->lex.document_position; /* Get the first token. */ if (SELF->indirect_lexer.underlying_lexer->get_word (SELF->indirect_lexer.underlying_lexer, lex, tokens[0], IFILE_MAX_WORD_LENGTH) == 0) return 0; /* Get the next n-1 tokens. */ for (i = 1; i < LEX->gram_size_this_time; i++) if (SELF->indirect_lexer.underlying_lexer->get_word (SELF->indirect_lexer.underlying_lexer, lex, tokens[i], IFILE_MAX_WORD_LENGTH) == 0) *(tokens[i]) = '\0'; /* Make sure it will fit. */ for (i = 0, len = 0; i < LEX->gram_size_this_time; i++) len += strlen (tokens[i]) + 1; assert (len < IFILE_MAX_WORD_LENGTH); /* Fill buf with the tokens concatenated. */ strcpy (buf, tokens[0]); for (i = 1; i < LEX->gram_size_this_time; i++) { strcat (buf, ";"); strcat (buf, tokens[i]); } /* Put us back to the second token so we can get it with the next call */ if (LEX->gram_size_this_time > 1) LEX->lex.document_position = s; if (LEX->gram_size_this_time == 1) LEX->gram_size_this_time = SELF->gram_size; else LEX->gram_size_this_time--; return strlen (buf); } /* This is declared in lex-simple.c */ extern ifile_lexer_simple _ifile_alpha_lexer; const ifile_lexer_email _ifile_email_lexer = { { { sizeof (ifile_lex_email), ifile_lexer_email_open_text_fp, ifile_lexer_email_get_word, ifile_lexer_indirect_close, "", /* document start pattern begins right away */ NULL /* document end pattern goes to end */ }, (ifile_lexer*)&_ifile_alpha_lexer, /* default UNDERLYING_LEXER */ }, (char **) -1, /* keep all headers by default */ 1 /* default gram-size is 1 */ }; const ifile_lexer_email *ifile_email_lexer = &_ifile_email_lexer; ifile-1.3.9/primes.c0000644000175000017500000000773611306214407013300 0ustar jasonjason/* Prime number generation Copyright (C) 1994, 1996, 1997 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef _AIX #pragma alloca #endif #include #include #include #include #include #if HAVE_ALLOCA_H #include #endif #define BITS_PER_UNSIGNED (8 * sizeof (unsigned)) #define SQRT_INT_MAX (1 << (BITS_PER_UNSIGNED / 2)) /* Return the next prime greater than or equal to N. */ int _ifile_nextprime (unsigned n) { /* Among other things, We guarantee that, for all i (0 <= i < primes_len), primes[i] is a prime, next_multiple[i] is a multiple of primes[i], next_multiple[i] > primes[primes_len - 1], next_multiple[i] is not a multiple of two unless primes[i] == 2, and next_multiple[i] is the smallest such value. */ static unsigned *primes, *next_multiple; static unsigned primes_len; static unsigned primes_size; static unsigned next_sieve; /* always even */ unsigned max_prime; if (! primes) { primes_size = 128; primes = (unsigned *) ifile_malloc (primes_size * sizeof (*primes)); next_multiple = (unsigned *) ifile_malloc (primes_size * sizeof (*next_multiple)); primes[0] = 2; next_multiple[0] = 6; primes[1] = 3; next_multiple[1] = 9; primes[2] = 5; next_multiple[2] = 15; primes_len = 3; next_sieve = primes[primes_len - 1] + 1; } if (n <= primes[0]) { return primes[0]; } while (n > (max_prime = primes[primes_len - 1])) { /* primes doesn't contain any prime large enough. Sieve from max_prime + 1 to 2 * max_prime, looking for more primes. */ unsigned start = next_sieve; unsigned end = start + max_prime + 1; char *sieve = (char *) alloca ((end - start) * sizeof (*sieve)); unsigned int i; assert (sieve); memset (sieve, (end - start) * sizeof (*sieve), 0); /* Make the sieve indexed by prime number, rather than distance-from-start-to-the-prime-number. When we're done, sieve[P] will be zero iff P is prime. ANSI C doesn't define what this means. Fuck them. */ sieve -= start; /* Set sieve[i] for all composites i, start <= i < end. Ignore multiples of 2. */ for (i = 1; i < primes_len; i++) { unsigned twice_prime = 2 * primes[i]; unsigned multiple; for (multiple = next_multiple[i]; multiple < end; multiple += twice_prime) sieve[multiple] = 1; next_multiple[i] = multiple; } for (i = start + 1; i < end; i += 2) if (! sieve[i]) { if (primes_len >= primes_size) { primes_size *= 2; primes = (unsigned int *) ifile_realloc (primes, primes_size * sizeof (*primes)); next_multiple = (unsigned int *) ifile_realloc (next_multiple, primes_size * sizeof (*next_multiple)); } primes[primes_len] = i; if (i >= SQRT_INT_MAX) next_multiple[primes_len] = INT_MAX; else next_multiple[primes_len] = i * i; primes_len++; } next_sieve = end; } /* Now we have at least one prime >= n. Find the smallest such. */ { int bottom = 0; int top = primes_len; while (bottom < top) { int mid = (bottom + top) / 2; if (primes[mid] < n) bottom = mid + 1; else top = mid; } return primes[top]; } } ifile-1.3.9/istext.c0000644000175000017500000000631211306214407013306 0ustar jasonjason/* istext.c - test if a file contains text or not. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include #include /* for SunOS 4.1.3_U1 - no SEEK_SET in stdio.h */ #include #include /* for isprint(), etc. */ /* The percentage of characters that must be text-like in order for us to say this is a text file. */ #define TEXT_PRINTABLE_PERCENT 95 /* Examine the first NUM_TEST_CHARS characters of `fp', and return a non-zero value iff TEXT_PRINTABLE_PERCENT of them are printable. */ int ifile_fp_is_text (FILE *fp) { #ifdef _AIX #define NUM_TEST_CHARS 4096 #else #define D_NUM_TEST_CHARS 4096 static const int NUM_TEST_CHARS = D_NUM_TEST_CHARS; #endif char buf[NUM_TEST_CHARS]; int num_read; int num_printable = 0; int num_spaces = 0; int fpos; int i; int num_newlines; #ifdef _AIX #define NUM_LINE_LENGTHS NUM_TEST_CHARS #else static const int NUM_LINE_LENGTHS = D_NUM_TEST_CHARS; #endif int line_lengths[NUM_LINE_LENGTHS]; int line_length_histogram[NUM_LINE_LENGTHS]; int max_line_length_histogram_height; fpos = ftell (fp); num_read = fread (buf, sizeof (char), NUM_TEST_CHARS, fp); fseek (fp, fpos, SEEK_SET); for (i = 0; i < num_read; i++) { if (isprint (buf[i]) || isspace (buf[i])) num_printable++; if (isspace (buf[i])) num_spaces++; } if (!(num_read > 0 && (((100 * num_printable) / num_read) > TEXT_PRINTABLE_PERCENT))) return 0; /* Test for uuencoded blocks by seeing if over 1/3 of the lines have identical length. */ for (i = 0, num_newlines = 0, line_lengths[num_newlines] = 0; i < num_read; i++) { if (buf[i] == '\n') { num_newlines++; assert (num_newlines < NUM_LINE_LENGTHS); line_lengths[num_newlines] = 0; } else { line_lengths[num_newlines]++; } } for (i = 0; i < NUM_LINE_LENGTHS; i++) line_length_histogram[i] = 0; for (i = 0; i < num_newlines; i++) line_length_histogram[line_lengths[i]]++; max_line_length_histogram_height = line_length_histogram[0]; for (i = 1; i < NUM_LINE_LENGTHS; i++) if (max_line_length_histogram_height < line_length_histogram[i]) max_line_length_histogram_height = line_length_histogram[i]; /* If over a 1/3 of the lines have the same height, this file probably contains a uuencoded block. */ if (max_line_length_histogram_height > num_newlines / 3 && num_spaces < num_read / 10) return 0; return 1; } ifile-1.3.9/int4str.c0000644000175000017500000002700511306214407013377 0ustar jasonjason/* Implementation of a one-to-one mapping of string->int, and int->string. */ /* Copyright (C) 1997 Andrew McCallum Written by: Andrew Kachites McCallum This file is part of the Bag-Of-Words Library, `libbow'. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation, version 2. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA */ #include #include #include #include /* The magic-string written at the beginning of archive files, so that we can verify we are in the right place for when reading. */ #define HEADER_STRING "ifile_int4str\n" /* The default initial size of map->STR_ARRAY, unless otherwise requested by calling ifile_int4str_initialize */ #define DEFAULT_INITIAL_CAPACITY 1024 /* The value of map->STR_HASH entries that are emtpy. */ #define HASH_EMPTY -1 /* Returns an initial index for ID at which to begin searching for an entry. */ #define HASH(map, id) ((id) % (map)->str_hash_size) /* Returns subsequent indices for ID, given the previous one. */ #define REHASH(map, id, h) (((id) + (h)) % (map)->str_hash_size) /* This function is defined in bow/primes.c. */ extern int _ifile_nextprime (unsigned n); /* Initialize the string->int and int->string map. The parameter CAPACITY is used as a hint about the number of words to expect; if you don't know or don't care about a CAPACITY value, pass 0, and a default value will be used. */ void ifile_int4str_init (ifile_int4str *map, int capacity) { int i; if (capacity == 0) capacity = DEFAULT_INITIAL_CAPACITY; map->str_array_size = capacity; map->str_array = ifile_malloc (map->str_array_size * sizeof (char*)); map->str_array_length = 0; map->str_hash_size = _ifile_nextprime (map->str_array_size * 2); map->str_hash = ifile_malloc (map->str_hash_size * sizeof (int)); for (i = 0; i < map->str_hash_size; i++) map->str_hash[i] = HASH_EMPTY; } /* Allocate, initialize and return a new int/string mapping structure. The parameter CAPACITY is used as a hint about the number of words to expect; if you don't know or don't care about a CAPACITY value, pass 0, and a default value will be used. */ ifile_int4str * ifile_int4str_new (int capacity) { ifile_int4str *ret; ret = ifile_malloc (sizeof (ifile_int4str)); ifile_int4str_init (ret, capacity); return ret; } /* Return the string corresponding to the integer INDEX. */ const char * ifile_int2str (ifile_int4str *map, int index) { assert (index < map->str_array_length); return map->str_array[index]; } /* Extract and return a (non-unique) integer `id' from string S. */ static int _str2id (const char *s) { register int h = 0; register int c = 0; while (*s != '\0') h ^= *(s++) << (c++); h = (h < 0) ? -h : h; /* If return value is too big then REHASH() can make it go negative, so here we use modulo to keep it a little small. */ h = h % (INT_MAX / 4); return (h < 0) ? -h : h; } /* Look up STRING in the MAP->STR_HASH; or, more precisely: Return the index to the location in MAP->STR_HASH that contains the index to the location in MAP->STR_ARRAY that contains a (char*) with contents matching STRING. The second argument ID must be the value returned by _STR2ID(STRING). If the string was found, then the return value will be different from HASH_EMPTY, and *STRDIFF will be zero. */ static int _str_hash_lookup (ifile_int4str *map, const char *string, int id, int *strdiffp) { int h; int firsth = -1; /* the first value of H */ assert (id >= 0); assert (map->str_hash[0] >= -1); assert (id == _str2id (string)); /* Keep looking at STR_HASH locations until we either (1) find the string, or (2) find an empty spot, or (3) "modulo-loop" around to the same spot we began the search. In the third case, we know that we will have to grow the STR_HASH before we can add the string corresponding to ID. */ *strdiffp = 1; for (h = HASH(map, id); h != firsth && map->str_hash[h] != HASH_EMPTY && (*strdiffp = strcmp (string, map->str_array[map->str_hash[h]])); h = REHASH(map, id, h)) { assert (h >= 0); if (firsth == -1) firsth = h; } return h; } /* Given the char-pointer STRING, return its integer index. If STRING is not yet in the mapping, return -1. */ int ifile_str2int_no_add (ifile_int4str *map, const char *string) { int strdiff; int h; h = _str_hash_lookup (map, string, _str2id (string), &strdiff); if (strdiff == 0) return map->str_hash[h]; return -1; } /* Add the char* STRING to the string hash table MAP->STR_HASH. The second argument H must be the value returned by _STR_HASH_LOOKUP(STRING). Don't call this function with a string that has already been added to the hashtable! The duplicate index would get added, and cause many bugs. */ static void _str_hash_add (ifile_int4str *map, const char *string, int id, int h, int str_array_index) { assert (h >= 0); assert (str_array_index >= 0 && str_array_index < map->str_array_length); if (map->str_hash[h] == HASH_EMPTY) { /* str_hash doesn't have to grow; just drop it in place. STR_ARRAY_INDEX is the index at which we can find STRING in the STR_ARRAY. */ map->str_hash[h] = str_array_index; } else { /* str_hash must grow in order to accomodate new entry. */ int sd; int i; int *old_str_hash, *entry; int old_str_hash_size; /* Create a new, empty str_hash. */ old_str_hash = map->str_hash; old_str_hash_size = map->str_hash_size; map->str_hash_size = _ifile_nextprime (2 * old_str_hash_size); map->str_hash = ifile_malloc (map->str_hash_size * sizeof(int)); for (i = map->str_hash_size, entry = map->str_hash; i > 0; i--, entry++) *entry = HASH_EMPTY; /* Fill the new str_hash with the values from the old str_hash. */ { for (i = 0; i < old_str_hash_size; i++) if (old_str_hash[i] != HASH_EMPTY) { const char *old_string = map->str_array[old_str_hash[i]]; int old_id = _str2id (old_string); _str_hash_add (map, old_string, old_id, _str_hash_lookup (map, old_string, old_id, &sd), old_str_hash[i]); assert (sd); /* All these strings should be unique! */ } } /* Free the old hash memory */ ifile_free (old_str_hash); /* Finally, add new string. */ _str_hash_add (map, string, id, _str_hash_lookup (map, string, id, &sd), str_array_index); } } /* Given the char-pointer STRING, return its integer index. If this is the first time we're seeing STRING, add it to the tables, assign it a new index, and return the new index. */ int ifile_str2int (ifile_int4str *map, const char *string) { int id; /* the integer extracted from STRING */ int h; /* ID, truncated to fit in STR_HASH */ int strdiff; /* gets 0 if we found STRING in STR_HASH */ id = _str2id (string); /* Search STR_HASH for the string, or an empty space. */ h = _str_hash_lookup (map, string, id, &strdiff); if (!strdiff) /* Found the string; return its index. */ return map->str_hash[h]; /* Didn't find the string in our mapping, so add it. */ /* Make our own malloc()'ed copy of it. */ string = ifile_strdup (string); if (!string) ifile_error ("Memory exhausted."); /* Add it to str_array. */ if (map->str_array_length > map->str_array_size-2) { /* str_array must grow in order to accomodate new entry. */ map->str_array_size *= 2; map->str_array = ifile_realloc (map->str_array, map->str_array_size * sizeof (char*)); } map->str_array[map->str_array_length] = string; /* The STR_ARRAY has one more element in it now, so increment its length. */ map->str_array_length++; /* Add it to str_hash. */ _str_hash_add (map, string, id, h, (map->str_array_length)-1); /* Return the index at which it was added. */ return (map->str_array_length)-1; } /* Create a new int-str mapping by lexing words from FILE. */ ifile_int4str * ifile_int4str_new_from_text_file (const char *filename) { ifile_int4str *map; FILE *fp; int text_document_count; char word[IFILE_MAX_WORD_LENGTH]; int wi; ifile_lex *lex; map = ifile_int4str_new (0); text_document_count = 0; fp = ifile_fopen (filename, "r"); if (ifile_fp_is_text (fp)) { /* Loop once for each document in this file. */ while ((lex = ifile_default_lexer->open_text_fp (ifile_default_lexer, fp))) { /* Loop once for each lexical token in this document. */ while (ifile_default_lexer->get_word (ifile_default_lexer, lex, word, IFILE_MAX_WORD_LENGTH)) { /* Increment the word's occurrence count. */ wi = ifile_str2int (map, word); if (wi >= 0) { /* Show total word count */ ifile_verbosify (ifile_progress, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" "%6d : %6d", text_document_count, wi); } } ifile_default_lexer->close (ifile_default_lexer, lex); text_document_count++; } } fclose (fp); return map; } /* Write the int-str mapping to file-pointer FP. */ void ifile_int4str_write (ifile_int4str *map, FILE *fp) { int i; fprintf (fp, HEADER_STRING); fprintf (fp, "%d\n", map->str_array_length); for (i = 0; i < map->str_array_length; i++) { if (strchr (map->str_array[i], '\n') != 0) ifile_error ("Not allowed to write string containing a newline"); fprintf (fp, "%s\n", map->str_array[i]); } } ifile_int4str * ifile_int4str_new_from_fp (FILE *fp) { const char *magic = HEADER_STRING; int num_words, i; int len; char buf[IFILE_MAX_WORD_LENGTH]; ifile_int4str *ret; /* Make sure the FP is positioned corrected to read a ifile_int4str. Look for the magic string we are expecting. */ while (*magic) { if (*magic != fgetc (fp)) ifile_error ("Proper header not found in file."); magic++; } /* Get the number of words in the list, and initialize mapping structures large enough. */ fscanf (fp, "%d\n", &num_words); ret = ifile_int4str_new (num_words); for (i = 0; i < num_words; i++) { /* Read the string from the file. */ if (fgets (buf, IFILE_MAX_WORD_LENGTH, fp) == 0) ifile_error ("Error reading data file."); len = strlen (buf); if (buf[len-1] == '\n') buf[len-1] = '\0'; /* Add it to the mappings. */ ifile_str2int (ret, buf); } return ret; } /* Return a new int-str mapping, created by reading FILENAME. */ ifile_int4str * ifile_int4str_new_from_file (const char *filename) { FILE *fp; ifile_int4str *ret; fp = fopen (filename, "r"); if (!fp) ifile_error ("Couldn't open file `%s' for reading\n", filename); ret = ifile_int4str_new_from_fp (fp); fclose (fp); return ret; } void ifile_int4str_free_contents (ifile_int4str *map) { int i; for (i = 0; i < map->str_array_length; i++) free((void *) map->str_array[i]); ifile_free (map->str_array); ifile_free (map->str_hash); } void ifile_int4str_free (ifile_int4str *map) { ifile_int4str_free_contents (map); ifile_free (map); } ifile-1.3.9/ifile.c0000644000175000017500000002120411306214407013053 0ustar jasonjason/* ifile - intelligent mail filter for EXMH/MH ifile is Copyright (C) 1997 Jason Rennie 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 (see file 'COPYING'); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include /* standard ifile library */ #define SEMKEY 10439838 int semid; struct sembuf sops; arguments args; extern struct argp argp; int msgs_read; /* number of messages actually read in */ /* variables for keeping track of time/speed of ifile */ clock_t DMZ_start, DMZ_end, DMZ2_start; /* ifilter specific function prototypes */ int cmp(const void *e1, const void *e2); /* Main program */ /* written by Jason Rennie */ int main (int argc, char **argv) { char *data_file = NULL; /* full path of idata file */ char *home_dir = NULL; /* full path of user's home directory */ FILE *MSG = NULL; /* file pointer for a message */ category_rating * ratings; ifile_db idata; htable *message = NULL; int i; int db_read_result = 0, db_write_result = 0; char *file_name; int trimmed_words; setlocale(LC_ALL, "" ); /* Harry's semaphore stuff to protect two ifile jobs from stepping * on each other */ /* Find the Semaphore id */ if ((semid = semget(SEMKEY, 1, 0666)) < 0) if ((semid = semget(SEMKEY, 1, 0666|IPC_CREAT|IPC_EXCL)) < 0) { perror("semget"); exit (-1); } /* Wait for Semaphore to clear */ sops.sem_num = 0; sops.sem_op = 0; sops.sem_flg = 0; if (semop(semid, &sops, 1)) { perror("semop"); exit (-1); } /* Set the Semaphore to clear on exit */ sops.sem_num = 0; sops.sem_op = 1; sops.sem_flg = SEM_UNDO; if (semop(semid, &sops, 1)) { perror("semop"); exit (-1); } ifile_init_args(&args); argp_parse (&argp, argc, argv, 0, 0, &args); ifile_verbosify(ifile_verbose, "%d file(s) passed\n", args.num_files); for (i=0; i < args.num_files; i++) ifile_verbosify(ifile_verbose, "file #%d: %s\n", i, EXT_ARRAY_GET(args.file, char *, i)); /* Get home directory */ home_dir = getenv("HOME"); if (home_dir == NULL) ifile_error("Fatal: HOME environment variable not defined!\n"); ifile_verbosify(ifile_verbose, "home directory = %s\n", home_dir); /* Get the database file name */ if (args.db_file != NULL) data_file = ifile_strdup (args.db_file); else data_file = ifile_sprintf("%s/%s", home_dir, DEFAULT_DB_FILE); /* remove the .idata file if requested */ if (args.reset_data) { ifile_verbosify(ifile_progress, "Removing %s...\n", data_file); system(ifile_sprintf("rm %s", data_file)); } ifile_db_init(&idata); ifile_open_log(argc, argv); ifile_default_lexer_init(); /* argument variables that still need to be handled: * skip_header, minus_folder, plus_folder */ /* Read the idata database */ if ((args.read_db == TRUE) && (!args.print_tokens)) db_read_result = ifile_read_db(data_file, &idata); /* If doing update, print warning & die if folder doesn't exist */ if (args.plus_folder && !args.create_folder) { int match = FALSE; int i=0; if (!db_read_result) for (; i < idata.num_folders; ++i) if (strcmp(EXT_ARRAY_GET(idata.folder_name,char*,i), args.plus_folder) == 0) match = TRUE; if (!match) ifile_error("Folder does not exist: %s\n", args.plus_folder); } /* read and lex the message(s) */ if (args.read_message != TRUE) exit(0); msgs_read = 0; i = 0; DMZ_start = clock(); do { if (args.num_files != 0) { { ifile_verbosify(ifile_verbose, "Reading message %d...\n",i); file_name = EXT_ARRAY_GET(args.file, char *, i); MSG = fopen(file_name, "r"); if (MSG == NULL) { ifile_verbosify(ifile_quiet, "Not able to open %s! No action taken.\n", file_name); if( message != NULL ) { htable_free(message,free,NULL); message = NULL; } } else { message = ifile_read_message(MSG); if (args.occur == TRUE) ifile_bitify_document(message); if (message != NULL) msgs_read++; } if (MSG && (args.verbosity >= ifile_debug || args.print_tokens)) ifile_print_message(message); if (MSG) fclose(MSG); } } else { ifile_verbosify(ifile_quiet, "Reading message from standard input...\n"); message = ifile_read_message(stdin); msgs_read++; if (args.verbosity >= ifile_debug || args.print_tokens) ifile_print_message(message); } /* Don't do anything else if we are printing tokens */ if (args.print_tokens) continue; if ((args.query == TRUE || args.loocv_folder != NULL) && idata.num_folders < 1) ifile_error( "Not able to perform query: no folders defined in database.\n"); /* Do LOOCV queries if requested */ if (args.loocv_folder != NULL) { if (db_read_result) ifile_error("Not able to perform LOOCV: not able to open database\n"); if (message == NULL) continue; ifile_del_db(args.loocv_folder, message, &idata); ratings = ifile_rate_categories(message, &idata); qsort(ratings, idata.num_folders, sizeof(category_rating), cmp); if (args.concise) { file_name = EXT_ARRAY_GET(args.file, char *, i); ifile_concise_ratings(file_name, stdout, ratings, &idata, args.thresh); } else ifile_print_ratings(stdout, ratings, &idata, args.thresh); ifile_free_categories(ratings,&idata); ifile_add_db(args.loocv_folder, message, &idata, 0); } /* if a query was requested, make the calculations and output the results */ if (args.query == TRUE) { if (db_read_result) ifile_error("Not able to perform query: not able to open database\n"); if (message != NULL) { ratings = ifile_rate_categories(message, &idata); qsort(ratings, idata.num_folders, sizeof(category_rating), cmp); if (args.concise) { file_name = EXT_ARRAY_GET(args.file, char *, i); ifile_concise_ratings(file_name, stdout, ratings, &idata, args.thresh); } else ifile_print_ratings(stdout, ratings, &idata, args.thresh); if (args.query_insert) ifile_add_db(ratings[0].category, message, &idata, args.create_folder); ifile_free_categories(ratings,&idata); } } if (args.write_db == TRUE) { if (args.plus_folder != NULL) if (message != NULL) ifile_add_db(args.plus_folder, message, &idata, args.create_folder); if (args.minus_folder != NULL) if (message != NULL) ifile_del_db(args.minus_folder, message, &idata); } if (message) { htable_free(message, free, NULL); message = NULL; } } while (++i < args.num_files); DMZ_end = clock(); ifile_verbosify(ifile_progress, "Read %d message(s). Time used: %.3f sec\n", msgs_read, ((float)(DMZ_end-DMZ_start))/CLOCKS_PER_SECOND); if (args.write_db == TRUE) { if ((args.plus_folder != NULL || args.query_insert == TRUE) && args.minus_folder == NULL) { trimmed_words = ifile_age_words(&idata, msgs_read); ifile_verbosify(ifile_progress, "Trimmed %d words due to lack of frequency\n", trimmed_words); } db_write_result = ifile_write_db(data_file, &idata); if (db_read_result != 0 && db_write_result == 0) { ifile_verbosify(ifile_quiet, "Created new %s file.\n", data_file); /* set proper permissions */ system(ifile_sprintf("chmod 0600 %s\n", data_file)); } } ifile_close_log(); #ifdef DMALLOC /* if we're debugging, clean up after malloc; if not, don't bother spending the computrons since we're exiting anyhow. */ ifile_stoplist_free(); ifile_db_free(&idata); #endif return 0; } /* a comparison function for sorting */ /* Written by Jason Rennie for ifile */ int cmp (const void *e1, const void *e2) { if (((category_rating *)e1)->rating > (((category_rating *)e2)->rating)) return -1; else if (((category_rating *)e1)->rating < (((category_rating *)e2)->rating)) return 1; else return 0; } ifile-1.3.9/lex-define.c0000644000175000017500000000610211306214407014003 0ustar jasonjason/* this file defines the default lexers and initializes them */ /* ifile - intelligent mail filter for EXMH/MH ifile is Copyright (C) 1997 Jason Rennie 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 (see file 'COPYING'); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include extern arguments args; static ifile_lexer_simple _ifile_default_lexer_simple; static ifile_lexer_email _ifile_default_email_lexer; ifile_lexer_simple *ifile_default_lexer_simple; ifile_lexer_email *ifile_default_email_lexer; char *ifile_email_headers_to_keep[4] = { "subject", "from", "to", NULL }; /* The default lexer used by all library functions. */ /* NOTE: Be sure to set this to a value, otherwise some linkers (like SunOS's) will not actually include this .o file in the executable, and then _ifile_default_lexer() will not get called, and then the lexer's will not get initialized properly. Ug. */ ifile_lexer *ifile_default_lexer = (void*)-1; /* adapted from libbow by Jason Rennie */ void ifile_default_lexer_init () { if (args.lexer == WHITE_LEXER) { _ifile_default_lexer_simple = *ifile_white_lexer; ifile_verbosify(ifile_debug, "Chose white lexer.\n"); } else if (args.lexer == ALPHA_ONLY_LEXER) { _ifile_default_lexer_simple = *ifile_alpha_only_lexer; ifile_verbosify(ifile_debug, "Chose alpha only lexer.\n"); } else /* args.lexer == ALPHA_LEXER */ { _ifile_default_lexer_simple = *ifile_alpha_lexer; ifile_verbosify(ifile_debug, "Chose alpha lexer.\n"); } ifile_default_lexer_simple = &_ifile_default_lexer_simple; /* these need to come AFTER the default lexer is set */ if (args.stemming) ifile_default_lexer_simple->stem_func = ifile_stem_porter; else ifile_default_lexer_simple->stem_func = NULL; if (args.stoplist) ifile_default_lexer_simple->stoplist_func = ifile_stoplist_present; else ifile_default_lexer_simple->stoplist_func = NULL; _ifile_default_email_lexer = *ifile_email_lexer; ifile_default_email_lexer = &_ifile_default_email_lexer; ifile_default_email_lexer->indirect_lexer.underlying_lexer = (ifile_lexer *) ifile_default_lexer_simple; ifile_default_lexer = (ifile_lexer *) ifile_default_email_lexer; if (args.skip_header) ifile_default_email_lexer->headers_to_keep = ifile_email_headers_to_keep; else /* keep all headers */ ifile_default_email_lexer->headers_to_keep = (char **) -1; } ifile-1.3.9/error.c0000644000175000017500000001133111306214406013113 0ustar jasonjason/* This file is error.c - library for message and error reporting */ /* ifile - intelligent mail filter for EXMH/MH Copyright (C) 1997 Jason Rennie 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. */ #include /* va_start(), va_end(), va_list */ #include /* fopen(), fclose() */ #include #include #include /* required by SunOS 5.5.1/gcc-2.7.2 for errno var */ #include /* for srand(time(NULL)) call */ #include /* for chmod() call */ #include extern arguments args; FILE * INFO; /* Returns a newly allocated character array which contains the portion of FULL_PATH postceeding the last '/' in FULL_PATH, or the entire string if FULL_PATH contains no '/' characters */ /* written by Jason Rennie for ifile */ char * ifile_strip_path (char * full_path) { char buf[MAX_STR_LEN]; int buf_index = 0; /* index of last character in BUF */ int full_path_index = 0; /* index of current character in FULL_PATH */ char * executable_name; /* pointer to string to be returned */ while (full_path[full_path_index]) { buf[buf_index++] = full_path[full_path_index++]; if (full_path[full_path_index] == '/') { buf_index = 0; full_path_index++; } } buf[buf_index] = '\0'; executable_name = malloc(strlen(buf)+1); strcpy(executable_name, buf); return executable_name; } /* Opens info log file to report information/errors (if requested) */ /* Written by Jason Rennie for ifile */ FILE * ifile_open_log (int argc, char ** argv) { char *info_file; /* if no temp file is to be created, immediately return */ if (!args.tmp_file) return NULL; srand(time(NULL)); /* Create string with full path for ~/.ifile_log */ info_file = ifile_sprintf("%s/.ifile.log", getenv("HOME")); if ((INFO = fopen(info_file, "w"))) { chmod(info_file, 0600); ifile_verbosify(ifile_progress, "%s called\n", IFILE_VERSION); ifile_verbosify(ifile_verbose, "Successfully opened log file: %s\n", info_file); return INFO; } else { ifile_verbosify(ifile_quiet, "Not able to open log file: %s Error: %d\n", info_file, errno); return NULL; } } /* Closes info log file if necessary */ /* Written by Jason Rennie for ifile */ void ifile_close_log () { if (!args.tmp_file) return; fclose(INFO); ifile_verbosify(ifile_verbose, "Closed log file.\n"); } /* Print the printf-style FORMAT string and arguments on STDERR, only if ARGS->VERBOSITY is equal or greater than the argument VERBOSITY_LEVEL. */ /* Written by Jason Rennie for ifile adapted from bow_verbosify() - written by Andrew Kachites McCallum */ int ifile_verbosify (int verbosity_level, const char *format, ...) { int ret = 0; va_list ap; /* The following few lines makes it possible to see the priority levels of the various lines of output */ if (verbosity_level <= args.verbosity) { va_start (ap, format); ret = vfprintf (stderr, format, ap); va_end (ap); } fflush (stderr); if ((verbosity_level <= args.verbosity) || (verbosity_level <= ifile_progress)) { va_start (ap, format); if (INFO != NULL) vfprintf (INFO, format, ap); va_end (ap); } if (INFO != NULL) fflush (INFO); return ret; } /* Reports an error in printf style format and halts the program */ /* strerror() is currently not used to report errors because Sun machines will not compile the function for some reason */ /* Written by Jason Rennie for ifile adapted from bow_error() - written by Andrew Kachites McCallum */ void ifile_error (const char *format, ...) { va_list ap; va_start (ap, format); if (INFO) vfprintf (INFO, format, ap); va_end (ap); /* fprintf("Error: %s\n", strerror(errno)); */ va_start (ap, format); vfprintf (stderr, format, ap); va_end (ap); /* fprintf(stderr, "Error: %s\n\n", strerror(errno)); */ ifile_close_log(INFO); exit (-1); }