191231.1 · 34777658b47166cef0894f38bc992ccd63b22cb1
released 1.6.11 - added predefined patterns for C#, Perl, Rust, Scala, Swift
reading declarations
@@ -238,6 +238,7 @@ offering high performance that is competitive or beats the fastest grep tools. Test | Command | Description ---- | ---------------------------------------------------------------- | -----------------------------------------------------+T0 | `GREP -c serialize big.cpp` | count matches of "serialize" in a 35MB C++ source code file T1 | `GREP -cw -e char -e int -e long -e size_t -e void big.cpp` | count 5 short words in a 35MB C++ source code file T2 | `GREP -Eon 'serialize_[a-zA-Z0-9_]+Type' big.cpp` | search and display C++ serialization functions in a 35MB source code file T3 | `GREP -Fon -f words1+1000 enwik8` | search 1000 words of length 1 or longer in a 100MB Wikipedia file@@ -266,17 +267,16 @@ Results are shown in real time (wall clock time) seconds elapsed. Best times are shown in boldface, *n/a* means that the running time exceeded 1 minute or option `-z` (decompress) is not supported. -GREP | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10 |---------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |-BSD grep | 1.85 | 0.83 | *n/a* | *n/a* | *n/a* | *n/a* | *n/a* | 3.35 | 3.35 | 0.60 |-GNU grep | 0.18 | 0.16 | 2.70 | 2.64 | 2.54 | 2.42 | 2.26 | 0.26 | 0.26 | *n/a* |-silver searcher | 0.16 | 0.21 | *n/a* | *n/a* | *n/a* | *n/a* | *n/a* | 0.46 | 0.46 | *n/a* |-ripgep | 0.19 | 0.06 | 2.20 | 2.07 | 2.00 | 2.01 | 2.14 | 0.12 | 0.36 | 0.03 |-ugrep | **0.09** | **0.05** | **1.06** | **1.04** | **0.93** | **0.95** | **0.33** | **0.10** | **0.20** | **0.02** |+GREP | T0 | T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10 |+--------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |+BSD grep 2.5.1 | 0.67 | 1.85 | 0.83 | *n/a* | *n/a* | *n/a* | *n/a* | *n/a* | 3.35 | 3.35 | 0.60 |+GNU grep 3.3 | 0.06 | 0.18 | 0.16 | 2.70 | 2.64 | 2.54 | 2.42 | 2.26 | 0.26 | 0.26 | *n/a* |+silver searcher | 0.05 | 0.16 | 0.21 | *n/a* | *n/a* | *n/a* | *n/a* | *n/a* | 0.46 | 0.46 | *n/a* |+ripgep | 0.03 | 0.19 | 0.06 | 2.20 | 2.07 | 2.00 | 2.01 | 2.14 | 0.12 | 0.36 | 0.03 |+ugrep | **0.02** | **0.09** | **0.05** | **1.06** | **1.04** | **0.93** | **0.95** | **0.33** | **0.10** | **0.20** | **0.02** | Option `-z` of **ugrep** uses task parallelism to optimize file reading,-decompression, and searching. This also may speed up searching a single large-file, even beating the performance of `mmap`, depending on the machine.+decompression, and searching. In some cases we decided in favor of features and safety over performance. For example, **ugrep** considers files binary when containing invalid UTF encodings@@ -483,7 +483,7 @@ not support Unicode!): Option `-J1` specifies one thread of execution to produce the exact same output ordering as GNU/BSD grep at the cost of lower performance and `-Y` enables-empty matches for GNU/BSD compatibility, see details further below.+empty matches for GNU/BSD compatibility, see [further below](#improvements). <a name="aliases"/> @@ -510,10 +510,21 @@ empty matches for GNU/BSD compatibility, see details further below. ### Notable improvements over other greps -- **ugrep** matches Unicode by default (disabled with option `-U`). - **ugrep** matches patterns across multiple lines.+- **ugrep** regular expression patterns are more expressive than GNU grep and+ BSD grep POSIX ERE and support Unicode pattern matching and most of the PCRE+ syntax. Extended regular expression (ERE) syntax is the default (i.e.+ option `-E`, as egrep).+- **ugrep** matches Unicode by default (disabled with option `-U`). - **ugrep** spawns threads to search files concurrently to improve search speed (disabled with option `-J1`).+- **ugrep** option `-Y` enables matching empty patterns. Grepping with+ empty-matching patterns is weird and gives different results with GNU grep+ versus BSD grep. Empty matches are not output by **ugrep** by default, which+ avoids making mistakes that may produce "random" results. For example, with+ GNU/BSD grep, pattern `a*` matches every line in the input, and actually+ matches `xyz` three times (the empty transitions before and between the `x`,+ `y`, and `z`). Allowing empty matches requires **ugrep** option `-Y`. - **ugrep** offers *negative patterns* `-N PATTERN`, which are patterns of the form `(?^X)` to skip input that matches `X`. Negative patterns can be used to skip strings and comments when searching for identifiers in source code@@ -524,43 +535,33 @@ empty matches for GNU/BSD compatibility, see details further below. matches output as usual) and `-X` (output all matches in hex). - **ugreo** searches compressed files with option `-z`. - **ugreo** searches cpio, tar, pax, and zip archives with option `-z`.-- **ugrep** regular expression patterns are more expressive than GNU grep and- BSD grep POSIX ERE and support Unicode pattern matching and most of the PCRE- syntax. Extended regular expression (ERE) syntax is the default (i.e.- option `-E`, as egrep).-- Options `-O`, `-M`, and `-t` specify file extensions, file signature magic- byte patterns, and predefined file types, respectively. This allows- searching for certain types of files in directory trees, for example with- recursive search options `-R` and `-r`. Options `-O`, `-M`, and `-t` also- applies to archived files in cpio, tar, pax, and zip files.-- Option `-k`, `--column-number` to display the column number, taking tab- spacing into account by expanding tabs, as specified by option `--tabs`.-- Option `-f` uses `GREP_PATH` environment variable or the predefined patterns- installed in `/usr/local/share/ugrep/patterns`. If `-f` is specified and- also one or more `-e` patterns are specified, then options `-F`, `-x`, and- `-w` do not apply to `-f` patterns. This is to avoid confusion when `-f` is- used with predefined patterns that may no longer work properly with these- options.-- Option `-P` (Perl regular expressions) supports backreferences (with- `--format`) and lookbehinds, which uses the Boost.Regex library for fast Perl- regex matching with a PCRE-like syntax.-- When option `-b` is used with option `-o` or with option `-u`, **ugrep**+- **ugrep** options `-O`, `-M`, and `-t` specify file extensions, file+ signature magic byte patterns, and predefined file types, respectively. This+ allows searching for certain types of files in directory trees, for example+ with recursive search options `-R` and `-r`. Options `-O`, `-M`, and `-t`+ also applies to archived files in cpio, tar, pax, and zip files.+- **ugrep** option `-k`, `--column-number` to display the column number, taking+ tab spacing into account by expanding tabs, as specified by option `--tabs`.+- **ugrep** option `-f` uses `GREP_PATH` environment variable or the predefined+ patterns installed in `/usr/local/share/ugrep/patterns`. If `-f` is+ specified and also one or more `-e` patterns are specified, then options+ `-F`, `-x`, and `-w` do not apply to `-f` patterns. This is to avoid+ confusion when `-f` is used with predefined patterns that may no longer work+ properly with these options.+- **ugrep** option `-P` (Perl regular expressions) supports backreferences+ (with `--format`) and lookbehinds, which uses the Boost.Regex library for+ fast Perl regex matching with a PCRE-like syntax.+- **ugrep** option `-b` with option `-o` or with option `-u`, **ugrep** displays the exact byte offset of the pattern match instead of the byte offset of the start of the matched line reported by GNU/BSD grep.-- Option `-Y` enables matching empty patterns. Grepping with empty-matching- patterns is weird and gives different results with GNU grep versus BSD grep.- Empty matches are not output by **ugrep** by default, which avoids making- mistakes that may produce "random" results. For example, with GNU/BSD grep,- pattern `a*` matches every line in the input, and actually matches `xyz`- three times (the empty transitions before and between the `x`, `y`, and `z`).- Allowing empty matches requires **ugrep** option `-Y`.-- Option `-u`, `--ungroup` to not group matches per line. This option- displays a matched input line again for each additional pattern match. This- option is particularly useful with option `-c` to report the total number of- pattern matches per file instead of the number of lines matched per file.-- Option `-D, --devices=ACTION` is `skip` by default, instead of `read`. This- prevents unexpectedly hanging on named pipes in directories that are- recursively searched, as may happen with GNU/BSD grep that `read`+- **ugrep** option `-u`, `--ungroup` to not group matches per line. This+ option displays a matched input line again for each additional pattern match+ on the line. This option is particularly useful with option `-c` to report+ the total number of pattern matches per file instead of the number of lines+ matched per file.+- **ugrep** option `-D, --devices=ACTION` is `skip` by default, instead of+ `read`. This prevents unexpectedly hanging on named pipes in directories+ that are recursively searched, as may happen with GNU/BSD grep that `read` devices by default. - **ugrep** always assumes UTF-8 locale to support Unicode, e.g. `LANG=en_US.UTF-8`, whereas grep is locale-sensitive.@@ -577,10 +578,6 @@ are considering: - The speed of matching multiple words is faster than GNU grep (ugrep uses Bitap and hashing), but Hyperscan may be slightly faster as it uses SIMD/AVX so it makes sense to look into that.-- Smart enabling of `mmap`, since `mmap` does not appear to improve performance- on machines with fast file read performance, where `mmap` even slows down.- RE/flex buffering is very efficient and has better spatial locality. Memory- maps are turned off with `--no-mmap`. <a name="tutorial"/> @@ -1662,7 +1659,7 @@ field | output `%w` | the width of the match, counting (wide) characters `%d` | the size of the match, counting bytes `%e` | the ending byte offset of the match-`%u` | select uniquely matched lines only unless option -u is used+`%u` | select unique lines only unless option -u is used `%,` | if not the first match: a comma, same as `%[,]>` `%:` | if not the first match: a colon, same as `%[:]>` `%;` | if not the first match: a semicolon, same as `%[;]>`@@ -1684,8 +1681,9 @@ Note: `--separator`. - Formatted output is written for each matching pattern, which means that a line may be output multiple times when patterns match more than once on the- same line. Use format field `%u` to output matching lines only once unless- option `-u`, `--ungroup` is used or when a newline is matched.+ same line. When field `%u` is found anywhere in the specified format+ string, matching lines are output only once unless option `-u`, `--ungroup`+ is used or when a newline is matched. To output matching lines faster by omitting the header output and binary match checks, using `--format` with field `%O` (output matching line as is) and field@@ -1697,10 +1695,15 @@ Same, but also displaying the line and column numbers: ugrep --format='%n%k: %O%~' 'href=' index.html -To string together the line numbers of matches, separated by commas with field-`%,`:+Same, but display a line at most once when matching multiple patterns, unless+option `-u` is used:++ ugrep --format='%u%n%k: %O%~' 'href=' index.html++To string together a list of unique line numbers of matches, separated by+commas with field `%,`: - ugrep --format='%,%n' 'href=' index.html+ ugrep --format='%u%,%n' 'href=' index.html To output the matching part of a line only with field `%o` (or option `-o` with field `%O`):@@ -1715,7 +1718,7 @@ separated by commas with field `%,`: To output matches in CSV (comma-separated values), the same as option `--csv` (works with options `-H`, `-n`, `-k`, `-b` to add CSV values): - ugrep --format='"%[,]$%H%N%K%B%V%~"' 'href=' index.html+ ugrep --format='"%[,]$%H%N%K%B%V%~%u"' 'href=' index.html To output matches in JSON, using formatting options that produce the same output as `--json` (works with options `-H`, `-n`, `-k`, `-b` to add JSON@@ -1723,7 +1726,7 @@ properties): ugrep --format-begin='[' \ --format-open='%,%~ {%~ %[,%~ ]$%["file": ]H"matches": [' \- --format='%,%~ { %[, ]$%["line": ]N%["column": ]K%["offset": ]B"match": %J }' \+ --format='%,%~ { %[, ]$%["line": ]N%["column": ]K%["offset": ]B"match": %J }%u' \ --format-close='%~ ]%~ }' \ --format-end='%~]%~' \ 'href=' index.html@@ -2025,24 +2028,24 @@ in markdown: ugrep -- universal file pattern searcher SYNOPSIS- ugrep [OPTIONS] [-A NUM] [-B NUM] [-C[NUM]] [PATTERN] [-f FILE]- [-e PATTERN] [-t TYPES] [-Q ENCODING] [-J [NUM]]+ ugrep [OPTIONS] [-A NUM] [-B NUM] [-C[NUM]] [PATTERN] [-e PATTERN]+ [-N PATTERN] [-f FILE] [-t TYPES] [-Q ENCODING] [-J [NUM]] [--color[=WHEN]|--colour[=WHEN]] [--pager[=COMMAND]] [FILE ...] DESCRIPTION The ugrep utility searches any given input files, selecting lines that match one or more patterns. By default, a pattern matches an input line if the regular expression (RE) in the pattern matches the input- line without its trailing newline. An empty expression matches every- line. Each input line that matches at least one of the patterns is- written to the standard output.+ line without its trailing newline. A pattern matches multiple input+ lines if the RE in the pattern matches one or more newlines in the+ input. An empty RE matches every line. Each input line that matches+ at least one of the patterns is written to the standard output. - The ugrep utility normalizes and decodes encoded input to search for- the specified ASCII/Unicode patterns. If the input contains a UTF BOM- indicating UTF-8, UTF-16, or UTF-32 input, then ugrep normalizes the- input to UTF-8. If no UTF BOM is present, then ugrep assumes the input- is ASCII, UTF-8, or raw binary. To explicitly specify an input encod-- ing to decode, use option -Q, --encoding.+ The ugrep utility accepts input of various encoding formats and normal-+ izes the input to UTF-8. When a UTF BOM is present in the input, the+ input is automatically normalized. Otherwise, ugrep assumes the input+ is ASCII, UTF-8, or raw binary. To specify the input encoding format,+ use option -Q, --encoding. The following options are available: @@ -2174,11 +2177,12 @@ in markdown: exist, the GREP_PATH environment variable is used as the path to FILE. If that fails, looks for FILE in /usr/local/share/ugrep/patterns. When FILE is a `-', standard- input is read. This option may be repeated.+ input is read. Empty files contain no patterns, thus nothing is+ matched. This option may be repeated. --format=FORMAT Output FORMAT-formatted matches. See `man ugrep' section FORMAT- for the `%' fields. Options -A, -B, -C, -y, and -v are dis-+ for the `%' fields. Options -A, -B, -C, -y, and -v are dis- abled. --free-space@@ -2189,66 +2193,66 @@ in markdown: behave as traditional grep. -g GLOB, --glob=GLOB- Search only files whose name matches GLOB, same as- --include=GLOB. If GLOB is preceded by a `!', skip files whose+ Search only files whose name matches GLOB, same as+ --include=GLOB. If GLOB is preceded by a `!', skip files whose name matches GLOB, same as --exclude=GLOB. - --group-separator=SEP+ --group-separator[=SEP] Use SEP as a group separator for context options -A, -B, and -C.- By default SEP is a double hyphen (`--').+ The default is a double hyphen (`--'). -H, --with-filename- Always print the filename with output lines. This is the+ Always print the filename with output lines. This is the default when there is more than one file to search. -h, --no-filename- Never print filenames with output lines. This is the default- when there is only one file (or only standard input) to search.+ Never print filenames with output lines. This is the default+ when there is only one file (or only standard input) to search. --help Print a help message. - -I Ignore matches in binary files. This option is equivalent to+ -I Ignore matches in binary files. This option is equivalent to the --binary-files=without-match option. -i, --ignore-case- Perform case insensitive matching. By default, ugrep is case+ Perform case insensitive matching. By default, ugrep is case sensitive. This option applies to ASCII letters only. --ignore-files[=FILE]- Ignore files and directories specified in a FILE when encoun-- tered in recursive searches. The default is `.gitignore'.- Files and directories matching the globs in FILE are ignored in+ Ignore files and directories specified in a FILE when encoun-+ tered in recursive searches. The default is `.gitignore'.+ Files and directories matching the globs in FILE are ignored in the directory tree rooted at each FILE's location by temporarily- overriding --exclude and --exclude-dir globs. This option may+ overriding --exclude and --exclude-dir globs. This option may be repeated. --include=GLOB- Search only files whose name matches GLOB using wildcard match-+ Search only files whose name matches GLOB using wildcard match- ing, same as -g GLOB. GLOB can use **, *, ?, and [...] as wild-- cards, and \ to quote a wildcard or backslash character liter-- ally. If GLOB contains /, file pathnames are matched. Other-- wise file basenames are matched. Note that --exclude patterns- take priority over --include patterns. This option may be+ cards, and \ to quote a wildcard or backslash character liter-+ ally. If GLOB contains /, file pathnames are matched. Other-+ wise file basenames are matched. Note that --exclude patterns+ take priority over --include patterns. This option may be repeated. --include-dir=GLOB- Only directories whose name matches GLOB are included in recur-- sive searches. If GLOB contains /, full pathnames are matched.- Otherwise basenames are matched. Note that --exclude-dir pat-- terns take priority over --include-dir patterns. This option+ Only directories whose name matches GLOB are included in recur-+ sive searches. If GLOB contains /, full pathnames are matched.+ Otherwise basenames are matched. Note that --exclude-dir pat-+ terns take priority over --include-dir patterns. This option may be repeated. --include-from=FILE- Read the globs from FILE and search only files and directories- whose name matches one or more globs (as if specified by- --include and --include-dir). Lines starting with a `#' and- empty lines in FILE are ignored. When FILE is a `-', standard+ Read the globs from FILE and search only files and directories+ whose name matches one or more globs (as if specified by+ --include and --include-dir). Lines starting with a `#' and+ empty lines in FILE are ignored. When FILE is a `-', standard input is read. This option may be repeated. -J NUM, --jobs=NUM- Specifies the number of threads spawned to search files. By+ Specifies the number of threads spawned to search files. By default, an optimum number of threads is spawned to search files- simultaneously. -J1 disables threading: files are searched in+ simultaneously. -J1 disables threading: files are searched in the same order as specified. -j, --smart-case@@ -2256,190 +2260,190 @@ in markdown: ital letter. Case insensitive matching applies to ASCII letters only. - --json Output file matches in JSON. Use options -H, -n, -k, and -b to+ --json Output file matches in JSON. Use options -H, -n, -k, and -b to specify JSON properties to output. See also option --format. -K NUM1[,NUM2], --range=NUM1[,NUM2]- Start searching at line NUM1 and end at line NUM2 when speci-+ Start searching at line NUM1 and end at line NUM2 when speci- fied. -k, --column-number- The column number of a matched pattern is displayed in front of- the respective matched line, starting at column 1. Tabs are+ The column number of a matched pattern is displayed in front of+ the respective matched line, starting at column 1. Tabs are expanded when columns are counted, see option --tabs. -L, --files-without-match- Only the names of files not containing selected lines are writ-- ten to standard output. Pathnames are listed once per file+ Only the names of files not containing selected lines are writ-+ ten to standard output. Pathnames are listed once per file searched. If the standard input is searched, the string ``(standard input)'' is written. -l, --files-with-matches Only the names of files containing selected lines are written to- standard output. ugrep will only search a file until a match- has been found, making searches potentially less expensive.- Pathnames are listed once per file searched. If the standard+ standard output. ugrep will only search a file until a match+ has been found, making searches potentially less expensive.+ Pathnames are listed once per file searched. If the standard input is searched, the string ``(standard input)'' is written. --label[=LABEL]- Displays the LABEL value when input is read from standard input+ Displays the LABEL value when input is read from standard input where a file name would normally be printed in the output. This option applies to options -H, -L, and -l. --line-buffered- Force output to be line buffered. By default, output is line- buffered when standard output is a terminal and block buffered+ Force output to be line buffered. By default, output is line+ buffered when standard output is a terminal and block buffered otherwise. -M MAGIC, --file-magic=MAGIC- Only files matching the signature pattern MAGIC are searched.- The signature "magic bytes" at the start of a file are compared- to the `MAGIC' regex pattern. When matching, the file will be- searched. This option may be repeated and may be combined with- options -O and -t to expand the search. This option is rela-- tively slow as every file on the search path is read to compare+ Only files matching the signature pattern MAGIC are searched.+ The signature "magic bytes" at the start of a file are compared+ to the `MAGIC' regex pattern. When matching, the file will be+ searched. This option may be repeated and may be combined with+ options -O and -t to expand the search. This option is rela-+ tively slow as every file on the search path is read to compare MAGIC. -m NUM, --max-count=NUM- Stop reading the input after NUM matches for each file pro-+ Stop reading the input after NUM matches for each file pro- cessed. --match Match all input. Same as specifying an empty pattern to search. --max-depth=NUM- Restrict recursive search to NUM (NUM > 0) directories deep,+ Restrict recursive search to NUM (NUM > 0) directories deep, where --max-depth=1 searches the specified path without visiting- sub-directories. By comparison, -dskip skips all directories+ sub-directories. By comparison, -dskip skips all directories even when they are on the command line. --max-files=NUM- If -R or -r is specified, restrict the number of files matched- to NUM. Specify -J1 to produce replicable results by ensuring+ If -R or -r is specified, restrict the number of files matched+ to NUM. Specify -J1 to produce replicable results by ensuring that files are searched in the same order as specified. -N PATTERN, --not-regexp=PATTERN- Specify a negative PATTERN used during the search of the input:- an input line is selected only if it matches any of the speci-- fied patterns when PATTERN does not match. Same as -e (?^PAT-- TERN) Negative PATTERN matches are removed before any other- specified patterns are matched. Note that longer patterns take- precedence over shorter patterns. This option may be repeated.+ Specify a negative PATTERN used during the search of the input:+ an input line is selected only if it matches any of the speci-+ fied patterns when PATTERN does not match. Same as -e (?^PAT-+ TERN) Negative PATTERN matches are removed before any other+ specified patterns are matched. Note that longer patterns take+ precedence over shorter patterns. This option may be repeated. -n, --line-number- Each output line is preceded by its relative line number in the- file, starting at line 1. The line number counter is reset for+ Each output line is preceded by its relative line number in the+ file, starting at line 1. The line number counter is reset for each file processed. --no-group-separator- Removes the group separator line from the output for context+ Removes the group separator line from the output for context options -A, -B, and -C. - --no-hidden- Do not search hidden files and directories.+ --[no-]hidden+ Do (not) search hidden files and directories. - --no-mmap- Do not use memory maps to search files. By default, memory maps- are used under certain conditions to improve performance.+ --[no-]mmap+ Do (not) use memory maps to search files. By default, memory+ maps are used under certain conditions to improve performance. -O EXTENSIONS, --file-extensions=EXTENSIONS Search only files whose file name extensions match the specified- comma-separated list of file name EXTENSIONS. This option is+ comma-separated list of file name EXTENSIONS. This option is the same as specifying --include='*.ext' for each extension name- `ext' in the EXTENSIONS list. This option may be repeated and+ `ext' in the EXTENSIONS list. This option may be repeated and may be combined with options -M and -t to expand the search. -o, --only-matching- Prints only the matching part of lines. When multiple lines- match, the line numbers with option -n are displayed using `|'- as the field separator for each additional line matched by the- pattern. This option cannot be combined with options -A, -B,+ Prints only the matching part of lines. When multiple lines+ match, the line numbers with option -n are displayed using `|'+ as the field separator for each additional line matched by the+ pattern. This option cannot be combined with options -A, -B, -C, -v, and -y. --only-line-number The line number of the matching line in the file is output with-- out displaying the match. The line number counter is reset for+ out displaying the match. The line number counter is reset for each file processed. -P, --perl-regexp Interpret PATTERN as a Perl regular expression. -p, --no-dereference- If -R or -r is specified, no symbolic links are followed, even+ If -R or -r is specified, no symbolic links are followed, even when they are specified on the command line. --pager[=COMMAND]- When output is sent to the terminal, uses COMMAND to page- through the output. The default COMMAND is `less -R'. This- option makes --color=auto behave as --color=always. Enables+ When output is sent to the terminal, uses COMMAND to page+ through the output. The default COMMAND is `less -R'. This+ option makes --color=auto behave as --color=always. Enables --break and --line-buffered. -Q ENCODING, --encoding=ENCODING- The input file encoding. The possible values of ENCODING can- be: `binary', `ISO-8859-1', `ASCII', `EBCDIC', `UTF-8',- `UTF-16', `UTF-16BE', `UTF-16LE', `UTF-32', `UTF-32BE',- `UTF-32LE', `CP437', `CP850', `CP858', `CP1250', `CP1251',+ The input file encoding. The possible values of ENCODING can+ be: `binary', `ISO-8859-1', `ASCII', `EBCDIC', `UTF-8',+ `UTF-16', `UTF-16BE', `UTF-16LE', `UTF-32', `UTF-32BE',+ `UTF-32LE', `CP437', `CP850', `CP858', `CP1250', `CP1251', `CP1252', `CP1253', `CP1254', `CP1255', `CP1256', `CP1257', `CP1258' -q, --quiet, --silent- Quiet mode: suppress normal output. ugrep will only search- until a match has been found, making searches potentially less+ Quiet mode: suppress normal output. ugrep will only search+ until a match has been found, making searches potentially less expensive. -R, --dereference-recursive- Recursively read all files under each directory. Follow all- symbolic links, unlike -r. If -J1 is specified, files are+ Recursively read all files under each directory. Follow all+ symbolic links, unlike -r. If -J1 is specified, files are searched in the same order as specified. -r, --recursive- Recursively read all files under each directory, following sym-- bolic links only if they are on the command line. If -J1 is+ Recursively read all files under each directory, following sym-+ bolic links only if they are on the command line. If -J1 is specified, files are searched in the same order as specified. -S, --dereference- If -r is specified, all symbolic links are followed, like -R.+ If -r is specified, all symbolic links are followed, like -R. The default is not to follow symbolic links. -s, --no-messages- Silent mode: nonexistent and unreadable files are ignored, i.e.+ Silent mode: nonexistent and unreadable files are ignored, i.e. their error messages are suppressed. - --separator=SEP- Use SEP as field separator between file name, line number, col-+ --separator[=SEP]+ Use SEP as field separator between file name, line number, col- umn number, byte offset, and the matched line. The default is a colon (`:'). --stats- Display statistics on the number of files and directories- searched. Display MAGIC and GLOB selections applied to recur-+ Display statistics on the number of files and directories+ searched. Display MAGIC and GLOB selections applied to recur- sive searches. -T, --initial-tab- Add a tab space to separate the file name, line number, column+ Add a tab space to separate the file name, line number, column number, and byte offset with the matched line. -t TYPES, --file-type=TYPES- Search only files associated with TYPES, a comma-separated list+ Search only files associated with TYPES, a comma-separated list of file types. Each file type corresponds to a set of file name extensions passed to option -O. For capitalized file types, the- search is expanded to include files found on the search path- with matching file signature magic bytes passed to option -M.- This option may be repeated. The possible values of TYPES can+ search is expanded to include files found on the search path+ with matching file signature magic bytes passed to option -M.+ This option may be repeated. The possible values of TYPES can be (use option -tlist to display a more detailed list): `action-- script', `ada', `asm', `asp', `aspx', `autoconf', `automake',- `awk', `Awk', `basic', `batch', `bison', `c', `c++', `clojure',+ script', `ada', `asm', `asp', `aspx', `autoconf', `automake',+ `awk', `Awk', `basic', `batch', `bison', `c', `c++', `clojure', `csharp', `css', `csv', `dart', `Dart', `delphi', `elisp',- `elixir', `erlang', `fortran', `gif', `Gif', `go', `groovy',- `gsp', `haskell', `html', `jade', `java', `jpeg', `Jpeg', `js',- `json', `jsp', `julia', `kotlin', `less', `lex', `lisp', `lua',- `m4', `make', `markdown', `matlab', `node', `Node', `objc',- `objc++', `ocaml', `parrot', `pascal', `pdf', `Pdf', `perl',- `Perl', `php', `Php', `png', `Png', `prolog', `python',+ `elixir', `erlang', `fortran', `gif', `Gif', `go', `groovy',+ `gsp', `haskell', `html', `jade', `java', `jpeg', `Jpeg', `js',+ `json', `jsp', `julia', `kotlin', `less', `lex', `lisp', `lua',+ `m4', `make', `markdown', `matlab', `node', `Node', `objc',+ `objc++', `ocaml', `parrot', `pascal', `pdf', `Pdf', `perl',+ `Perl', `php', `Php', `png', `Png', `prolog', `python', `Python', `r', `rpm', `Rpm', `rst', `rtf', `Rtf', `ruby',- `Ruby', `rust', `scala', `scheme', `shell', `Shell',- `smalltalk', `sql', `svg', `swift', `tcl', `tex', `text',- `tiff', `Tiff', `tt', `typescript', `verilog', `vhdl', `vim',+ `Ruby', `rust', `scala', `scheme', `shell', `Shell',+ `smalltalk', `sql', `svg', `swift', `tcl', `tex', `text',+ `tiff', `Tiff', `tt', `typescript', `verilog', `vhdl', `vim', `xml', `Xml', `yacc', `yaml' --tabs=NUM@@ -2448,12 +2452,12 @@ in markdown: -U, --binary Disables Unicode matching for binary file matching, forcing PAT-- TERN to match bytes, not Unicode characters. For example, -U- '\xa3' matches byte A3 (hex) instead of the Unicode code point+ TERN to match bytes, not Unicode characters. For example, -U+ '\xa3' matches byte A3 (hex) instead of the Unicode code point U+00A3 represented by the two-byte UTF-8 sequence C2 A3. -u, --ungroup- Do not group multiple pattern matches on the same matched line.+ Do not group multiple pattern matches on the same matched line. Output the matched line again for each additional pattern match, using `+' as the field separator. @@ -2461,17 +2465,17 @@ in markdown: Display version information and exit. -v, --invert-match- Selected lines are those not matching any of the specified pat-+ Selected lines are those not matching any of the specified pat- terns. -W, --with-hex- Output binary matches in hexadecimal, leaving text matches+ Output binary matches in hexadecimal, leaving text matches alone. This option is equivalent to the --binary-files=with-hex option. -w, --word-regexp- The PATTERN or -e PATTERN is searched for as a word (as if sur-- rounded by \< and \>). If PATTERN or -e PATTERN is also speci-+ The PATTERN or -e PATTERN is searched for as a word (as if sur-+ rounded by \< and \>). If PATTERN or -e PATTERN is also speci- fied, then this option does not apply to -f FILE patterns. -X, --hex@@ -2479,57 +2483,57 @@ in markdown: --binary-files=hex option. -x, --line-regexp- Only input lines selected against the entire PATTERN or -e PAT-- TERN is considered to be matching lines (as if surrounded by ^- and $). If PATTERN or -e PATTERN is also specified, then this+ Only input lines selected against the entire PATTERN or -e PAT-+ TERN is considered to be matching lines (as if surrounded by ^+ and $). If PATTERN or -e PATTERN is also specified, then this option does not apply to -f FILE patterns. - --xml Output file matches in XML. Use options -H, -n, -k, and -b to+ --xml Output file matches in XML. Use options -H, -n, -k, and -b to specify XML attributes to output. See also option --format. -Y, --empty- Permits empty matches, such as `^\h*$' to match blank lines.+ Permits empty matches, such as `^\h*$' to match blank lines. Empty matches are disabled by default. Note that empty-matching- patterns, such as x? and x*, match all input with -Y, not only+ patterns, such as x? and x*, match all input with -Y, not only lines with `x'. -y, --any-line Any matching or non-matching line is output. Non-matching lines- are output with the `-' separator as context of the matching+ are output with the `-' separator as context of the matching lines. See also the -A, -B, and -C options. -Z, --null Prints a zero-byte after the file name. -z, --decompress- Decompress files to search, when compressed. Archives (.cpio,+ Decompress files to search, when compressed. Archives (.cpio, pathnames of files in archives are output in braces. If -g, -O,- -M, or -t is specified, searches files within archives whose- name matches globs, matches file name extensions, matches file- signature magic bytes, or matches file types, respectively.- Supported compression formats: gzip (default, optional suffix- .gz), compress (requires suffix .Z), zip (requires suffix .zip- or .ZIP), lzma (requires suffix .lzma), xz (requires suffix- .xz), bzip2 (requires suffix .bz, .bz2, or .bzip2).+ -M, or -t is specified, searches files within archives whose+ name matches globs, matches file name extensions, matches file+ signature magic bytes, or matches file types, respectively.+ Supported compression formats: gzip (default, optional suffix+ .gz), compress (requires suffix .Z), zip (requires suffix .zip+ or .ZIP), bzip2 (requires suffix .bz, .bz2, or .bzip2), lzma+ (requires suffix .lzma), and xz (requires suffix .xz). If no FILE arguments are specified, or if a `-' is specified, the stan- dard input is used, unless recursive searches are specified which exam- ine the working directory. - If no FILE arguments are specified and one of the options -g, -O, -M,+ If no FILE arguments are specified and one of the options -g, -O, -M, -t, --include, --include-dir, --exclude, or --exclude-dir is specified, recursive searches are enabled, same as -r. Use `--' before the FILE arguments to allow file and directory names to start with a `-'. - The regular expression pattern syntax is an extended form of the POSIX+ The regular expression pattern syntax is an extended form of the POSIX ERE syntax. For an overview of the syntax see README.md or visit: https://github.com/Genivia/ugrep - Note that `.' matches any non-newline character. Pattern `\n' matches- a newline and multiple lines may be matched, unless one or more of the+ Note that `.' matches any non-newline character. Pattern `\n' matches+ a newline and multiple lines may be matched, unless one or more of the context options -A, -B, -C or -y is used, or option -v. EXIT STATUS@@ -2541,18 +2545,18 @@ in markdown: >1 An error occurred. - If -q or --quiet or --silent is used and a line is selected, the exit+ If -q or --quiet or --silent is used and a line is selected, the exit status is 0 even if an error occurred. GLOBBING- Globbing is used by options -g, --include, --include-dir, --include-- from, --exclude, --exclude-dir, --exclude-from to match pathnames and- basenames in recursive searches. Globbing supports gitignore syntax+ Globbing is used by options -g, --include, --include-dir, --include-+ from, --exclude, --exclude-dir, --exclude-from to match pathnames and+ basenames in recursive searches. Globbing supports gitignore syntax and the corresponding matching rules. When a glob contains a path sep-- arator `/', the pathname is matched. Otherwise the basename of a file+ arator `/', the pathname is matched. Otherwise the basename of a file or directory is matched. For example, *.h matches foo.h and bar/foo.h.- bar/*.h matches bar/foo.h but not foo.h and not bar/bar/foo.h. Use a- leading `/' to force /*.h to match foo.h but not bar/foo.h. A glob+ bar/*.h matches bar/foo.h but not foo.h and not bar/bar/foo.h. Use a+ leading `/' to force /*.h to match foo.h but not bar/foo.h. A glob starting with a `!' is negated, i.e. does not match. Glob Syntax and Conventions@@ -2567,7 +2571,7 @@ in markdown: [!a-z] Matches one character not in the selected range of characters. - / When used at the begin of a glob, matches if pathname has no /.+ / When used at the begin of a glob, matches if pathname has no /. **/ Matches zero or more directories. @@ -2608,27 +2612,27 @@ in markdown: a\?b Matches a?b, but not a, b, ab, axb, a/b - Lines in the --exclude-from and --include-from files are ignored when- empty or start with a `#'. The prefix `!' to a glob in such a file- negates the pattern match, i.e. matching files are excluded except- files matching the globs prefixed with `!' in the --exclude-from file.+ Lines in the --exclude-from and --include-from files are ignored when+ empty or start with a `#'. The prefix `!' to a glob in such a file+ negates the pattern match, i.e. matching files are excluded except+ files matching the globs prefixed with `!' in the --exclude-from file. ENVIRONMENT GREP_PATH- May be used to specify a file path to pattern files. The file- path is used by option -f to open a pattern file, when the file+ May be used to specify a file path to pattern files. The file+ path is used by option -f to open a pattern file, when the file cannot be opened. GREP_COLOR- May be used to specify ANSI SGR parameters to highlight matches- when option --color is used, e.g. 1;35;40 shows pattern matches+ May be used to specify ANSI SGR parameters to highlight matches+ when option --color is used, e.g. 1;35;40 shows pattern matches in bold magenta text on a black background. GREP_COLORS- May be used to specify ANSI SGR parameters to highlight matches- and other attributes when option --color is used. Its value is- a colon-separated list of ANSI SGR parameters that defaults to- cx=2:mt=1;31:fn=35:ln=32:cn=32:bn=32:se=36. The mt=, ms=, and+ May be used to specify ANSI SGR parameters to highlight matches+ and other attributes when option --color is used. Its value is+ a colon-separated list of ANSI SGR parameters that defaults to+ cx=33:mt=1;31:fn=35:ln=32:cn=32:bn=32:se=36. The mt=, ms=, and mc= capabilities of GREP_COLORS have priority over GREP_COLOR. GREP_COLORS@@ -2640,10 +2644,10 @@ in markdown: mt= SGR substring for matching text in any matching line. - ms= SGR substring for matching text in a selected line. The sub-+ ms= SGR substring for matching text in a selected line. The sub- string mt= by default. - mc= SGR substring for matching text in a context line. The sub-+ mc= SGR substring for matching text in a context line. The sub- string mt= by default. fn= SGR substring for file names.@@ -2657,8 +2661,8 @@ in markdown: se= SGR substring for separators. FORMAT- Option --format=FORMAT specifies an output format for file matches.- Fields may be used in FORMAT which expand into the following values:+ Option --format=FORMAT specifies an output format for file matches.+ Fields may be used in FORMAT, which expand into the following values: %[ARG]F if option -H is used: ARG, the file pathname, and separator.@@ -2740,6 +2744,8 @@ in markdown: %e the ending byte offset of the match. + %u select unique lines only unless option -u is used.+ %, if not the first match: a comma, same as %[,]>. %: if not the first match: a colon, same as %[:]>.@@ -2750,18 +2756,29 @@ in markdown: %% the percentage sign. - %1 the first regex group capture of the match, and so on up to+ %1 the first regex group capture of the match, and so on up to group %9, same as %[1]#, requires option -P Perl matching. %[NUM]#- the regex group capture NUM, requires option -P Perl matching.+ the regex group capture NUM, requires option -P. - The [ARG] part of a field is optional and may be omitted.+ The [ARG] part of a field is optional and may be omitted. When+ present, the argument must be placed in [] brackets, for example %[,]F+ to output a comma, the pathname, and a separator.++ Fields %[SEP]$ and %u are switches and do not write anything to the+ output. The separator used by %P, %H, %N, %K, %B, and %S may be changed by pre-- ceeding the field with a %[SEP]$. When [SEP] is not provided as in %$,- reverses the separator to the default separator or the separator speci-- fied by --separator.+ ceeding the field with a %[SEP]$. When [SEP] is not provided, reverses+ the separator to the default separator or the separator specified by+ --separator.++ Formatted output is written for each matching pattern, which means that+ a line may be output multiple times when patterns match more than once+ on the same line. When field %u is found anywhere in the specified+ format string, matching lines are output only once unless option -u,+ --ungroup is used or when a newline is matched. Additional formatting options: @@ -2870,7 +2887,7 @@ in markdown: - ugrep 1.6.8 December 24, 2019 UGREP(1)+ ugrep 1.6.11 December 31, 2019 UGREP(1) <a name="patterns"/>
bin/linux/ugrep
bin/macosx/ugrep
@@ -9,7 +9,7 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. #-# Copyright (C) 2019-2019 Robert van Engelen, Genivia Inc.+# Copyright (C) 2019-2020 Robert van Engelen, Genivia Inc. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ##@@ -584,6 +584,7 @@ PACKAGE_STRING='ugrep 1.6' PACKAGE_BUGREPORT='' PACKAGE_URL='' +ac_header_list= # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h>@@ -620,7 +621,6 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS@@ -629,6 +629,8 @@ PTHREAD_LIBS PTHREAD_CFLAGS AM_CXXFLAGS HAVE_CXX11+EXTRA_CFLAGS+GREP_PATH PLATFORM host_os host_vendor@@ -641,17 +643,15 @@ build RANLIB ac_ct_AR AR-EXTRA_CFLAGS-GREP_PATH-EGREP-GREP-CPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX+EGREP+GREP+CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE@@ -738,8 +738,8 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules-with_boost_regex enable_dependency_tracking+with_boost_regex with_zlib with_bzlib with_lzma@@ -758,10 +758,10 @@ CFLAGS LDFLAGS LIBS CPPFLAGS+CPP CXX CXXFLAGS-CCC-CPP'+CCC' # Initialize some variables set by options.@@ -1392,8 +1392,8 @@ Optional Features: --pager --disable-hidden disable searching hidden files and directories unless explicitly enabled with --hidden- --disable-mmap disable mmap file reading unless explicitly enabled- with --mmap+ --disable-mmap disable memory mapped files unless explicitly+ enabled with --mmap Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]@@ -1426,9 +1426,9 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir>+ CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags- 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.@@ -1503,7 +1503,7 @@ Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. -Copyright (C) 2019-2019 Robert van Engelen, Genivia Inc.+Copyright (C) 2019-2020 Robert van Engelen, Genivia Inc. _ACEOF exit fi@@ -1550,44 +1550,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_cxx_try_compile LINENO-# -----------------------------# Try to compile conftest.$ac_ext, and return whether this succeeded.-ac_fn_cxx_try_compile ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- rm -f conftest.$ac_objext- if { { ac_try="$ac_compile"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_compile") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- grep -v '^ *+' conftest.err >conftest.er1- cat conftest.er1 >&5- mv -f conftest.er1 conftest.err- fi- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; } && {- test -z "$ac_cxx_werror_flag" ||- test ! -s conftest.err- } && test -s conftest.$ac_objext; then :- ac_retval=0-else- $as_echo "$as_me: failed program was:" >&5-sed 's/^/| /' conftest.$ac_ext >&5-- ac_retval=1-fi- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno- as_fn_set_status $ac_retval--} # ac_fn_cxx_try_compile- # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded.@@ -1634,6 +1596,94 @@ fi } # ac_fn_c_try_link +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES+# ----------------------------------------------------+# Tries to find if the field MEMBER exists in type AGGR, after including+# INCLUDES, setting cache variable VAR accordingly.+ac_fn_c_check_member ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5+$as_echo_n "checking for $2.$3... " >&6; }+if eval \${$4+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$5+int+main ()+{+static $2 ac_aggr;+if (ac_aggr.$3)+return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ eval "$4=yes"+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$5+int+main ()+{+static $2 ac_aggr;+if (sizeof ac_aggr.$3)+return 0;+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ eval "$4=yes"+else+ eval "$4=no"+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+eval ac_res=\$$4+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_member++# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES+# -------------------------------------------------------+# Tests whether HEADER exists and can be compiled using the include files in+# INCLUDES, setting the cache variable VAR accordingly.+ac_fn_c_check_header_compile ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+$as_echo_n "checking for $2... " >&6; }+if eval \${$3+:} false; then :+ $as_echo_n "(cached) " >&6+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+#include <$2>+_ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ eval "$3=yes"+else+ eval "$3=no"+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+fi+eval ac_res=\$$3+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_header_compile+ # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded.@@ -1671,93 +1721,6 @@ fi } # ac_fn_c_try_cpp -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES-# --------------------------------------------------------# Tests whether HEADER exists, giving a warning if it cannot be compiled using-# the include files in INCLUDES and setting the cache variable VAR-# accordingly.-ac_fn_c_check_header_mongrel ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- if eval \${$3+:} false; then :- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }-else- # Is the header compilable?-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5-$as_echo_n "checking $2 usability... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$4-#include <$2>-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- ac_header_compiler=yes-else- ac_header_compiler=no-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5-$as_echo "$ac_header_compiler" >&6; }--# Is the header present?-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5-$as_echo_n "checking $2 presence... " >&6; }-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <$2>-_ACEOF-if ac_fn_c_try_cpp "$LINENO"; then :- ac_header_preproc=yes-else- ac_header_preproc=no-fi-rm -f conftest.err conftest.i conftest.$ac_ext-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5-$as_echo "$ac_header_preproc" >&6; }--# So? What about this header?-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((- yes:no: )- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}- ;;- no:yes:* )- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}- ;;-esac- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-else- eval "$3=\$ac_header_compiler"-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }-fi- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_header_mongrel- # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes@@ -1800,11 +1763,10 @@ fi } # ac_fn_c_try_run -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES-# --------------------------------------------------------# Tests whether HEADER exists and can be compiled using the include files in-# INCLUDES, setting the cache variable VAR accordingly.-ac_fn_c_check_header_compile ()+# ac_fn_c_check_func LINENO FUNC VAR+# ----------------------------------+# Tests whether FUNC exists, setting the cache variable VAR accordingly+ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5@@ -1814,96 +1776,9 @@ if eval \${$3+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */-$4-#include <$2>-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$3=yes"-else- eval "$3=no"-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-eval ac_res=\$$3- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_header_compile--# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES-# -----------------------------------------------------# Tries to find if the field MEMBER exists in type AGGR, after including-# INCLUDES, setting cache variable VAR accordingly.-ac_fn_c_check_member ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5-$as_echo_n "checking for $2.$3... " >&6; }-if eval \${$4+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$5-int-main ()-{-static $2 ac_aggr;-if (ac_aggr.$3)-return 0;- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$4=yes"-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$5-int-main ()-{-static $2 ac_aggr;-if (sizeof ac_aggr.$3)-return 0;- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$4=yes"-else- eval "$4=no"-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-eval ac_res=\$$4- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno--} # ac_fn_c_check_member--# ac_fn_c_check_func LINENO FUNC VAR-# -----------------------------------# Tests whether FUNC exists, setting the cache variable VAR accordingly-ac_fn_c_check_func ()-{- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5-$as_echo_n "checking for $2... " >&6; }-if eval \${$3+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.- For example, HP-UX 11i <limits.h> declares gettimeofday. */-#define $2 innocuous_$2+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.+ For example, HP-UX 11i <limits.h> declares gettimeofday. */+#define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below.@@ -2008,6 +1883,131 @@ $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type++# ac_fn_cxx_try_compile LINENO+# ----------------------------+# Try to compile conftest.$ac_ext, and return whether this succeeded.+ac_fn_cxx_try_compile ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ rm -f conftest.$ac_objext+ if { { ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_compile") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ grep -v '^ *+' conftest.err >conftest.er1+ cat conftest.er1 >&5+ mv -f conftest.er1 conftest.err+ fi+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; } && {+ test -z "$ac_cxx_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then :+ ac_retval=0+else+ $as_echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5++ ac_retval=1+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno+ as_fn_set_status $ac_retval++} # ac_fn_cxx_try_compile++# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES+# -------------------------------------------------------+# Tests whether HEADER exists, giving a warning if it cannot be compiled using+# the include files in INCLUDES and setting the cache variable VAR+# accordingly.+ac_fn_c_check_header_mongrel ()+{+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack+ if eval \${$3+:} false; then :+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+$as_echo_n "checking for $2... " >&6; }+if eval \${$3+:} false; then :+ $as_echo_n "(cached) " >&6+fi+eval ac_res=\$$3+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+else+ # Is the header compilable?+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5+$as_echo_n "checking $2 usability... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+$4+#include <$2>+_ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ ac_header_compiler=yes+else+ ac_header_compiler=no+fi+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5+$as_echo "$ac_header_compiler" >&6; }++# Is the header present?+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5+$as_echo_n "checking $2 presence... " >&6; }+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <$2>+_ACEOF+if ac_fn_c_try_cpp "$LINENO"; then :+ ac_header_preproc=yes+else+ ac_header_preproc=no+fi+rm -f conftest.err conftest.i conftest.$ac_ext+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5+$as_echo "$ac_header_preproc" >&6; }++# So? What about this header?+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((+ yes:no: )+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}+ ;;+ no:yes:* )+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}+ ;;+esac+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5+$as_echo_n "checking for $2... " >&6; }+if eval \${$3+:} false; then :+ $as_echo_n "(cached) " >&6+else+ eval "$3=\$ac_header_compiler"+fi+eval ac_res=\$$3+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+fi+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno++} # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake.@@ -4016,465 +4016,223 @@ else fi -ac_ext=cpp-ac_cpp='$CXXCPP $CPPFLAGS'-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu-if test -z "$CXX"; then- if test -n "$CCC"; then- CXX=$CCC- else- if test -n "$ac_tool_prefix"; then- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC- 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-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_CXX+:} false; then :++ac_header_dirent=no+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do+ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }+if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else- if test -n "$CXX"; then- ac_cv_prog_CXX="$CXX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-CXX=$ac_cv_prog_CXX-if test -n "$CXX"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5-$as_echo "$CXX" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--- test -n "$CXX" && break- done-fi-if test -z "$CXX"; then- ac_ct_CXX=$CXX- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC-do- # Extract the first word of "$ac_prog", so it can be a program name with args.-set dummy $ac_prog; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_ac_ct_CXX+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$ac_ct_CXX"; then- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_ac_ct_CXX="$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi-fi-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX-if test -n "$ac_ct_CXX"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5-$as_echo "$ac_ct_CXX" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi--- test -n "$ac_ct_CXX" && break-done-- if test "x$ac_ct_CXX" = x; then- CXX="g++"- else- case $cross_compiling:$ac_tool_warned in-yes:)-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}-ac_tool_warned=yes ;;-esac- CXX=$ac_ct_CXX- fi-fi-- fi-fi-# Provide some information about the compiler.-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5-set X $ac_compile-ac_compiler=$2-for ac_option in --version -v -V -qversion; do- { { ac_try="$ac_compiler $ac_option >&5"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_compiler $ac_option >&5") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- sed '10a\-... rest of stderr output deleted ...- 10q' conftest.err >conftest.er1- cat conftest.er1 >&5- fi- rm -f conftest.er1 conftest.err- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }-done--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5-$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }-if ${ac_cv_cxx_compiler_gnu+:} false; then :- $as_echo_n "(cached) " >&6-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+#include <sys/types.h>+#include <$ac_hdr> int main () {-#ifndef __GNUC__- choke me-#endif-+if ((DIR *) 0)+return 0; ; return 0; } _ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :- ac_compiler_gnu=yes+if ac_fn_c_try_compile "$LINENO"; then :+ eval "$as_ac_Header=yes" else- ac_compiler_gnu=no+ eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu- fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5-$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }-if test $ac_compiler_gnu = yes; then- GXX=yes-else- GXX=+eval ac_res=\$$as_ac_Header+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5+$as_echo "$ac_res" >&6; }+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :+ cat >>confdefs.h <<_ACEOF+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1+_ACEOF++ac_header_dirent=$ac_hdr; break fi-ac_test_CXXFLAGS=${CXXFLAGS+set}-ac_save_CXXFLAGS=$CXXFLAGS-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5-$as_echo_n "checking whether $CXX accepts -g... " >&6; }-if ${ac_cv_prog_cxx_g+:} false; then :++done+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.+if test $ac_header_dirent = dirent.h; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5+$as_echo_n "checking for library containing opendir... " >&6; }+if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else- ac_save_cxx_werror_flag=$ac_cxx_werror_flag- ac_cxx_werror_flag=yes- ac_cv_prog_cxx_g=no- CXXFLAGS="-g"- cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char opendir (); int main () {-+return opendir (); ; return 0; } _ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :- ac_cv_prog_cxx_g=yes-else- CXXFLAGS=""- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */+for ac_lib in '' dir; do+ if test -z "$ac_lib"; then+ ac_res="none required"+ else+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"+ fi+ if ac_fn_c_try_link "$LINENO"; then :+ ac_cv_search_opendir=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext+ if ${ac_cv_search_opendir+:} false; then :+ break+fi+done+if ${ac_cv_search_opendir+:} false; then : -int-main ()-{+else+ ac_cv_search_opendir=no+fi+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5+$as_echo "$ac_cv_search_opendir" >&6; }+ac_res=$ac_cv_search_opendir+if test "$ac_res" != no; then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - ;- return 0;-}-_ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :+fi else- ac_cxx_werror_flag=$ac_save_cxx_werror_flag- CXXFLAGS="-g"- cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5+$as_echo_n "checking for library containing opendir... " >&6; }+if ${ac_cv_search_opendir+:} false; then :+ $as_echo_n "(cached) " >&6+else+ ac_func_search_save_LIBS=$LIBS+cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char opendir (); int main () {-+return opendir (); ; return 0; } _ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :- ac_cv_prog_cxx_g=yes-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- ac_cxx_werror_flag=$ac_save_cxx_werror_flag-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5-$as_echo "$ac_cv_prog_cxx_g" >&6; }-if test "$ac_test_CXXFLAGS" = set; then- CXXFLAGS=$ac_save_CXXFLAGS-elif test $ac_cv_prog_cxx_g = yes; then- if test "$GXX" = yes; then- CXXFLAGS="-g -O2"+for ac_lib in '' x; do+ if test -z "$ac_lib"; then+ ac_res="none required" else- CXXFLAGS="-g"+ ac_res=-l$ac_lib+ LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi+ if ac_fn_c_try_link "$LINENO"; then :+ ac_cv_search_opendir=$ac_res+fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext+ if ${ac_cv_search_opendir+:} false; then :+ break+fi+done+if ${ac_cv_search_opendir+:} false; then :+ else- if test "$GXX" = yes; then- CXXFLAGS="-O2"- else- CXXFLAGS=- fi+ ac_cv_search_opendir=no fi-ac_ext=cpp-ac_cpp='$CXXCPP $CPPFLAGS'-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu--depcc="$CXX" am_compiler_list=--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5-$as_echo_n "checking dependency style of $depcc... " >&6; }-if ${am_cv_CXX_dependencies_compiler_type+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then- # We make a subdir and do the tests there. Otherwise we can end up- # making bogus files that we don't know about and never remove. For- # instance it was reported that on HP-UX the gcc test will end up- # making a dummy file named 'D' -- because '-MD' means "put the output- # in D".- rm -rf conftest.dir- mkdir conftest.dir- # Copy depcomp to subdir because otherwise we won't find it if we're- # using a relative directory.- cp "$am_depcomp" conftest.dir- cd conftest.dir- # We will build objects and dependencies in a subdirectory because- # it helps to detect inapplicable dependency modes. For instance- # both Tru64's cc and ICC support -MD to output dependencies as a- # side effect of compilation, but ICC will put the dependencies in- # the current directory while Tru64 will put them in the object- # directory.- mkdir sub-- am_cv_CXX_dependencies_compiler_type=none- if test "$am_compiler_list" = ""; then- am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`- fi- am__universal=false- case " $depcc " in #(- *\ -arch\ *\ -arch\ *) am__universal=true ;;- esac-- for depmode in $am_compiler_list; do- # Setup a source with many dependencies, because some compilers- # like to wrap large dependency lists on column 80 (with \), and- # we should not choose a depcomp mode which is confused by this.- #- # We need to recreate these files for each test, as the compiler may- # overwrite some of them when testing with obscure command lines.- # This happens at least with the AIX C compiler.- : > sub/conftest.c- for i in 1 2 3 4 5 6; do- echo '#include "conftst'$i'.h"' >> sub/conftest.c- # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with- # Solaris 10 /bin/sh.- echo '/* dummy */' > sub/conftst$i.h- done- echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf-- # We check with '-c' and '-o' for the sake of the "dashmstdout"- # mode. It turns out that the SunPro C++ compiler does not properly- # handle '-M -o', and we need to detect this. Also, some Intel- # versions had trouble with output in subdirs.- am__obj=sub/conftest.${OBJEXT-o}- am__minus_obj="-o $am__obj"- case $depmode in- gcc)- # This depmode causes a compiler race in universal mode.- test "$am__universal" = false || continue- ;;- nosideeffect)- # After this tag, mechanisms are not by side-effect, so they'll- # only be used when explicitly requested.- if test "x$enable_dependency_tracking" = xyes; then- continue- else- break- fi- ;;- msvc7 | msvc7msys | msvisualcpp | msvcmsys)- # This compiler won't grok '-c -o', but also, the minuso test has- # not run yet. These depmodes are late enough in the game, and- # so weak that their functioning should not be impacted.- am__obj=conftest.${OBJEXT-o}- am__minus_obj=- ;;- none) break ;;- esac- if depmode=$depmode \- source=sub/conftest.c object=$am__obj \- depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \- $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \- >/dev/null 2>conftest.err &&- grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&- grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&- grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then- # icc doesn't choke on unknown options, it will just issue warnings- # or remarks (even with -Werror). So we grep stderr for any message- # that says an option was ignored or not supported.- # When given -MP, icc 7.0 and 7.1 complain thusly:- # icc: Command line warning: ignoring option '-M'; no argument required- # The diagnosis changed in icc 8.0:- # icc: Command line remark: option '-MP' not supported- if (grep 'ignoring option' conftest.err ||- grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else- am_cv_CXX_dependencies_compiler_type=$depmode- break- fi- fi- done-- cd ..- rm -rf conftest.dir-else- am_cv_CXX_dependencies_compiler_type=none+rm conftest.$ac_ext+LIBS=$ac_func_search_save_LIBS fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5+$as_echo "$ac_cv_search_opendir" >&6; }+ac_res=$ac_cv_search_opendir+if test "$ac_res" != no; then :+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5-$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }-CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - if- test "x$enable_dependency_tracking" != xno \- && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then- am__fastdepCXX_TRUE=- am__fastdepCXX_FALSE='#'-else- am__fastdepCXX_TRUE='#'- am__fastdepCXX_FALSE= fi + ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" "+#include <sys/types.h>+#ifdef HAVE_DIRENT_H+# include <dirent.h>+#else+# define dirent direct+# ifdef HAVE_SYS_NDIR_H+# include <sys/ndir.h>+# endif+# ifdef HAVE_SYS_DIR_H+# include <sys/dir.h>+# endif+# ifdef HAVE_NDIR_H+# include <ndir.h>+# endif+#endif +"+if test "x$ac_cv_member_struct_dirent_d_ino" = xyes; then : -# Check whether --with-boost-regex was given.-if test "${with_boost_regex+set}" = set; then :- withval=$with_boost_regex;- if test "$withval" = "no"; then- want_boost="no"- elif test "$withval" = "yes"; then- want_boost="yes"- ax_boost_regex_lib="-lboost_regex"- else- want_boost="yes"- ax_boost_regex_lib="$withval"- fi--else-- want_boost="yes"- ax_boost_regex_lib="-lboost_regex"+cat >>confdefs.h <<_ACEOF+#define HAVE_STRUCT_DIRENT_D_INO 1+_ACEOF fi - if test "x$want_boost" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Regex library is available" >&5-$as_echo_n "checking whether the Boost::Regex library is available... " >&6; }-if ${ax_cv_boost_regex+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_ext=cpp-ac_cpp='$CXXCPP $CPPFLAGS'-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu+ ac_fn_c_check_member "$LINENO" "struct dirent" "d_type" "ac_cv_member_struct_dirent_d_type" "+#include <sys/types.h>+#ifdef HAVE_DIRENT_H+# include <dirent.h>+#else+# define dirent direct+# ifdef HAVE_SYS_NDIR_H+# include <sys/ndir.h>+# endif+# ifdef HAVE_SYS_DIR_H+# include <sys/dir.h>+# endif+# ifdef HAVE_NDIR_H+# include <ndir.h>+# endif+#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <boost/regex.hpp>+"+if test "x$ac_cv_member_struct_dirent_d_type" = xyes; then : -int-main ()-{-boost::regex r(); return 0;- ;- return 0;-}+cat >>confdefs.h <<_ACEOF+#define HAVE_STRUCT_DIRENT_D_TYPE 1 _ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :- ax_cv_boost_regex=yes-else- ax_cv_boost_regex=no-fi-rm -f core 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 fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_regex" >&5-$as_echo "$ax_cv_boost_regex" >&6; }- if test "x$ax_cv_boost_regex" = "xyes"; then--$as_echo "#define HAVE_BOOST_REGEX 1" >>confdefs.h-- LIBS="$LIBS $ax_boost_regex_lib"- fi- fi @@ -4875,984 +4633,837 @@ fi done -#-# Handle user hints-#-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if zlib is wanted" >&5-$as_echo_n "checking if zlib is wanted... " >&6; }-zlib_places="/usr/local /usr /opt/local /sw" -# Check whether --with-zlib was given.-if test "${with_zlib+set}" = set; then :- withval=$with_zlib; if test "$withval" != no ; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- if test -d "$withval"- then- zlib_places="$withval $zlib_places"- else- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5-$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}- fi-else- zlib_places=- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }+++ for ac_header in $ac_header_list+do :+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default+"+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :+ cat >>confdefs.h <<_ACEOF+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1+_ACEOF+ fi +done -#-# Locate zlib, if wanted-#-if test -n "${zlib_places}"-then- # check the user supplied or any other more or less 'standard' place:- # Most UNIX systems : /usr/local and /usr- # MacPorts / Fink on OSX : /opt/local respectively /sw- for ZLIB_HOME in ${zlib_places} ; do- if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi- ZLIB_HOME=""- done - ZLIB_OLD_LDFLAGS=$LDFLAGS- ZLIB_OLD_CPPFLAGS=$CPPFLAGS- if test -n "${ZLIB_HOME}"; then- LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"- CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"- 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5-$as_echo_n "checking for inflateEnd in -lz... " >&6; }-if ${ac_cv_lib_z_inflateEnd+:} false; then :++++++for ac_func in getpagesize+do :+ ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"+if test "x$ac_cv_func_getpagesize" = xyes; then :+ cat >>confdefs.h <<_ACEOF+#define HAVE_GETPAGESIZE 1+_ACEOF++fi+done++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5+$as_echo_n "checking for working mmap... " >&6; }+if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else- ac_check_lib_save_LIBS=$LIBS-LIBS="-lz $LIBS"-cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ if test "$cross_compiling" = yes; then :+ ac_cv_func_mmap_fixed_mapped=no+else+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */+$ac_includes_default+/* malloc might have been renamed as rpl_malloc. */+#undef malloc -/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"+/* Thanks to Mike Haertel and Jim Avera for this test.+ Here is a matrix of mmap possibilities:+ mmap private not fixed+ mmap private fixed at somewhere currently unmapped+ mmap private fixed at somewhere already mapped+ mmap shared not fixed+ mmap shared fixed at somewhere currently unmapped+ mmap shared fixed at somewhere already mapped+ For private mappings, we should verify that changes cannot be read()+ back from the file, nor mmap's back from the file at a different+ address. (There have been systems where private was not correctly+ implemented like the infamous i386 svr4.0, and systems where the+ VM page cache was not coherent with the file system buffer cache+ like early versions of FreeBSD and possibly contemporary NetBSD.)+ For shared mappings, we should conversely verify that changes get+ propagated back to all the places they're supposed to be.++ Grep wants private fixed already mapped.+ The main things grep needs to know about mmap are:+ * does it exist and is it safe to write into the mmap'd area+ * how to use it (BSD variants) */++#include <fcntl.h>+#include <sys/mman.h>++#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H+char *malloc (); #endif-char inflateEnd ();++/* This mess was copied from the GNU getpagesize.h. */+#ifndef HAVE_GETPAGESIZE+# ifdef _SC_PAGESIZE+# define getpagesize() sysconf(_SC_PAGESIZE)+# else /* no _SC_PAGESIZE */+# ifdef HAVE_SYS_PARAM_H+# include <sys/param.h>+# ifdef EXEC_PAGESIZE+# define getpagesize() EXEC_PAGESIZE+# else /* no EXEC_PAGESIZE */+# ifdef NBPG+# define getpagesize() NBPG * CLSIZE+# ifndef CLSIZE+# define CLSIZE 1+# endif /* no CLSIZE */+# else /* no NBPG */+# ifdef NBPC+# define getpagesize() NBPC+# else /* no NBPC */+# ifdef PAGESIZE+# define getpagesize() PAGESIZE+# endif /* PAGESIZE */+# endif /* no NBPC */+# endif /* no NBPG */+# endif /* no EXEC_PAGESIZE */+# else /* no HAVE_SYS_PARAM_H */+# define getpagesize() 8192 /* punt totally */+# endif /* no HAVE_SYS_PARAM_H */+# endif /* no _SC_PAGESIZE */++#endif /* no HAVE_GETPAGESIZE */+ int main () {-return inflateEnd ();- ;+ char *data, *data2, *data3;+ const char *cdata2;+ int i, pagesize;+ int fd, fd2;++ pagesize = getpagesize ();++ /* First, make a file with some known garbage in it. */+ data = (char *) malloc (pagesize);+ if (!data)+ return 1;+ for (i = 0; i < pagesize; ++i)+ *(data + i) = rand ();+ umask (0);+ fd = creat ("conftest.mmap", 0600);+ if (fd < 0)+ return 2;+ if (write (fd, data, pagesize) != pagesize)+ return 3;+ close (fd);++ /* Next, check that the tail of a page is zero-filled. File must have+ non-zero length, otherwise we risk SIGBUS for entire page. */+ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);+ if (fd2 < 0)+ return 4;+ cdata2 = "";+ if (write (fd2, cdata2, 1) != 1)+ return 5;+ data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);+ if (data2 == MAP_FAILED)+ return 6;+ for (i = 0; i < pagesize; ++i)+ if (*(data2 + i))+ return 7;+ close (fd2);+ if (munmap (data2, pagesize))+ return 8;++ /* Next, try to mmap the file at a fixed address which already has+ something else allocated at it. If we can, also make sure that+ we see the same garbage. */+ fd = open ("conftest.mmap", O_RDWR);+ if (fd < 0)+ return 9;+ if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,+ MAP_PRIVATE | MAP_FIXED, fd, 0L))+ return 10;+ for (i = 0; i < pagesize; ++i)+ if (*(data + i) != *(data2 + i))+ return 11;++ /* Finally, make sure that changes to the mapped area do not+ percolate back to the file as seen by read(). (This is a bug on+ some variants of i386 svr4.0.) */+ for (i = 0; i < pagesize; ++i)+ *(data2 + i) = *(data2 + i) + 1;+ data3 = (char *) malloc (pagesize);+ if (!data3)+ return 12;+ if (read (fd, data3, pagesize) != pagesize)+ return 13;+ for (i = 0; i < pagesize; ++i)+ if (*(data + i) != *(data3 + i))+ return 14;+ close (fd); return 0; } _ACEOF-if ac_fn_c_try_link "$LINENO"; then :- ac_cv_lib_z_inflateEnd=yes+if ac_fn_c_try_run "$LINENO"; then :+ ac_cv_func_mmap_fixed_mapped=yes else- ac_cv_lib_z_inflateEnd=no-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS+ ac_cv_func_mmap_fixed_mapped=no fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5-$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }-if test "x$ac_cv_lib_z_inflateEnd" = xyes; then :- zlib_cv_libz=yes-else- zlib_cv_libz=no+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \+ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"-if test "x$ac_cv_header_zlib_h" = xyes; then :- zlib_cv_zlib_h=yes-else- zlib_cv_zlib_h=no fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }+if test $ac_cv_func_mmap_fixed_mapped = yes; then +$as_echo "#define HAVE_MMAP 1" >>confdefs.h - 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+fi+rm -f conftest.mmap conftest.txt - if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"- then- #- # If both library and header were found, action-if-found- # - CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"- LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"- LIBS="-lz $LIBS"+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"+if test "x$ac_cv_type_size_t" = xyes; then : -$as_echo "#define HAVE_LIBZ 1" >>confdefs.h+else +cat >>confdefs.h <<_ACEOF+#define size_t unsigned int+_ACEOF - else- #- # If either header or library was not found, action-if-not-found- #- echo "libz not found: option -z disabled"- fi fi +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"+if test "x$ac_cv_type_ssize_t" = xyes; then : -#-# Handle user hints-#-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if bzlib is wanted" >&5-$as_echo_n "checking if bzlib is wanted... " >&6; }-bzlib_places="/usr/local /usr /opt/local /sw"+else -# Check whether --with-bzlib was given.-if test "${with_bzlib+set}" = set; then :- withval=$with_bzlib; if test "$withval" != no ; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- if test -d "$withval"- then- bzlib_places="$withval $bzlib_places"+cat >>confdefs.h <<_ACEOF+#define ssize_t int+_ACEOF++fi+++ac_ext=cpp+ac_cpp='$CXXCPP $CPPFLAGS'+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu+if test -z "$CXX"; then+ if test -n "$CCC"; then+ CXX=$CCC else- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5-$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}+ if test -n "$ac_tool_prefix"; then+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC+ 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+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_CXX+:} false; then :+ $as_echo_n "(cached) " >&6+else+ if test -n "$CXX"; then+ ac_cv_prog_CXX="$CXX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2 fi+done+ done+IFS=$as_save_IFS++fi+fi+CXX=$ac_cv_prog_CXX+if test -n "$CXX"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5+$as_echo "$CXX" >&6; } else- bzlib_places= { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi+++ test -n "$CXX" && break+ done+fi+if test -z "$CXX"; then+ ac_ct_CXX=$CXX+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC+do+ # Extract the first word of "$ac_prog", so it can be a program name with args.+set dummy $ac_prog; ac_word=$2+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_ac_ct_CXX+:} false; then :+ $as_echo_n "(cached) " >&6 else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }+ if test -n "$ac_ct_CXX"; then+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_CXX="$ac_prog"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS++fi+fi+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX+if test -n "$ac_ct_CXX"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5+$as_echo "$ac_ct_CXX" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; } fi -#-# Locate bzlib, if wanted-#-if test -n "${bzlib_places}"-then- # check the user supplied or any other more or less 'standard' place:- # Most UNIX systems : /usr/local and /usr- # MacPorts / Fink on OSX : /opt/local respectively /sw- for BZLIB_HOME in ${bzlib_places} ; do- if test -f "${BZLIB_HOME}/include/bzlib.h"; then break; fi- BZLIB_HOME=""- done+ test -n "$ac_ct_CXX" && break+done - BZLIB_OLD_LDFLAGS=$LDFLAGS- BZLIB_OLD_CPPFLAGS=$CPPFLAGS- if test -n "${BZLIB_HOME}"; then- LDFLAGS="$LDFLAGS -L${BZLIB_HOME}/lib"- CPPFLAGS="$CPPFLAGS -I${BZLIB_HOME}/include"+ if test "x$ac_ct_CXX" = x; then+ CXX="g++"+ else+ case $cross_compiling:$ac_tool_warned in+yes:)+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ CXX=$ac_ct_CXX 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+fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzRead in -lbz2" >&5-$as_echo_n "checking for BZ2_bzRead in -lbz2... " >&6; }-if ${ac_cv_lib_bz2_BZ2_bzRead+:} false; then :+ fi+fi+# Provide some information about the compiler.+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5+set X $ac_compile+ac_compiler=$2+for ac_option in --version -v -V -qversion; do+ { { ac_try="$ac_compiler $ac_option >&5"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""+$as_echo "$ac_try_echo"; } >&5+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err+ ac_status=$?+ if test -s conftest.err; then+ sed '10a\+... rest of stderr output deleted ...+ 10q' conftest.err >conftest.er1+ cat conftest.er1 >&5+ fi+ rm -f conftest.er1 conftest.err+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+done++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }+if ${ac_cv_cxx_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else- ac_check_lib_save_LIBS=$LIBS-LIBS="-lbz2 $LIBS"-cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char BZ2_bzRead (); int main () {-return BZ2_bzRead ();+#ifndef __GNUC__+ choke me+#endif+ ; return 0; } _ACEOF-if ac_fn_c_try_link "$LINENO"; then :- ac_cv_lib_bz2_BZ2_bzRead=yes+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_compiler_gnu=yes else- ac_cv_lib_bz2_BZ2_bzRead=no+ ac_compiler_gnu=no fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu+ fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzRead" >&5-$as_echo "$ac_cv_lib_bz2_BZ2_bzRead" >&6; }-if test "x$ac_cv_lib_bz2_BZ2_bzRead" = xyes; then :- bzlib_cv_libbz2=yes+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }+if test $ac_compiler_gnu = yes; then+ GXX=yes else- bzlib_cv_libbz2=no+ GXX= fi+ac_test_CXXFLAGS=${CXXFLAGS+set}+ac_save_CXXFLAGS=$CXXFLAGS+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5+$as_echo_n "checking whether $CXX accepts -g... " >&6; }+if ${ac_cv_prog_cxx_g+:} false; then :+ $as_echo_n "(cached) " >&6+else+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag+ ac_cxx_werror_flag=yes+ ac_cv_prog_cxx_g=no+ CXXFLAGS="-g"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */ - ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"-if test "x$ac_cv_header_bzlib_h" = xyes; then :- bzlib_cv_bzlib_h=yes+int+main ()+{++ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_cv_prog_cxx_g=yes else- bzlib_cv_bzlib_h=no-fi+ CXXFLAGS=""+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */ +int+main ()+{ - 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 "$bzlib_cv_libbz2" = "yes" && test "$bzlib_cv_bzlib_h" = "yes"- then- #- # If both library and header were found, action-if-found- #-- CPPFLAGS="$CPPFLAGS -I${BZLIB_HOME}/include"- LDFLAGS="$LDFLAGS -L${BZLIB_HOME}/lib"- LIBS="-lbz2 $LIBS"--$as_echo "#define HAVE_LIBBZ2 1" >>confdefs.h--- else- #- # If either header or library was not found, action-if-not-found- #- echo "libbz2 not found: option -z won't decompress .bz and .bz2 files"- fi-fi---#-# Handle user hints-#-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lzma is wanted" >&5-$as_echo_n "checking if lzma is wanted... " >&6; }-lzma_places="/usr/local /usr /opt/local /sw"--# Check whether --with-lzma was given.-if test "${with_lzma+set}" = set; then :- withval=$with_lzma; if test "$withval" != no ; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- if test -d "$withval"- then- lzma_places="$withval $lzma_places"- else- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5-$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}- fi-else- lzma_places=- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }-fi---#-# Locate lzma, if wanted-#-if test -n "${lzma_places}"-then- # check the user supplied or any other more or less 'standard' place:- # Most UNIX systems : /usr/local and /usr- # MacPorts / Fink on OSX : /opt/local respectively /sw- for LZMA_HOME in ${lzma_places} ; do- if test -f "${LZMA_HOME}/include/lzma.h"; then break; fi- LZMA_HOME=""- done-- LZMA_OLD_LDFLAGS=$LDFLAGS- LZMA_OLD_CPPFLAGS=$CPPFLAGS- if test -n "${LZMA_HOME}"; then- LDFLAGS="$LDFLAGS -L${LZMA_HOME}/lib"- CPPFLAGS="$CPPFLAGS -I${LZMA_HOME}/include"- 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+ ;+ return 0;+}+_ACEOF+if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_code in -llzma" >&5-$as_echo_n "checking for lzma_code in -llzma... " >&6; }-if ${ac_cv_lib_lzma_lzma_code+:} false; then :- $as_echo_n "(cached) " >&6 else- ac_check_lib_save_LIBS=$LIBS-LIBS="-llzma $LIBS"-cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag+ CXXFLAGS="-g"+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char lzma_code (); int main () {-return lzma_code ();+ ; return 0; } _ACEOF-if ac_fn_c_try_link "$LINENO"; then :- ac_cv_lib_lzma_lzma_code=yes-else- ac_cv_lib_lzma_lzma_code=no+if ac_fn_cxx_try_compile "$LINENO"; then :+ ac_cv_prog_cxx_g=yes fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext conftest.$ac_ext-LIBS=$ac_check_lib_save_LIBS+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_code" >&5-$as_echo "$ac_cv_lib_lzma_lzma_code" >&6; }-if test "x$ac_cv_lib_lzma_lzma_code" = xyes; then :- lzma_cv_liblzma=yes-else- lzma_cv_liblzma=no+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi-- ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"-if test "x$ac_cv_header_lzma_h" = xyes; then :- lzma_cv_lzma_h=yes+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5+$as_echo "$ac_cv_prog_cxx_g" >&6; }+if test "$ac_test_CXXFLAGS" = set; then+ CXXFLAGS=$ac_save_CXXFLAGS+elif test $ac_cv_prog_cxx_g = yes; then+ if test "$GXX" = yes; then+ CXXFLAGS="-g -O2"+ else+ CXXFLAGS="-g"+ fi else- lzma_cv_lzma_h=no+ if test "$GXX" = yes; then+ CXXFLAGS="-O2"+ else+ CXXFLAGS=+ fi fi--- ac_ext=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 - if test "$lzma_cv_liblzma" = "yes" && test "$lzma_cv_lzma_h" = "yes"- then- #- # If both library and header were found, action-if-found- #-- CPPFLAGS="$CPPFLAGS -I${LZMA_HOME}/include"- LDFLAGS="$LDFLAGS -L${LZMA_HOME}/lib"- LIBS="-llzma $LIBS"--$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h--- else- #- # If either header or library was not found, action-if-not-found- #- echo "liblzma not found: option -z won't decompress .lzma and .xz files"- fi-fi----# Check whether --with-grep-path was given.-if test "${with_grep_path+set}" = set; then :- withval=$with_grep_path; with_grep_path="$withval"-else- with_grep_path=""-fi+depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-grep-path" >&5-$as_echo_n "checking for --with-grep-path... " >&6; }-if test "x$with_grep_path" != "x"; then- GREP_PATH="$with_grep_path"- { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$with_grep_path\"" >&5-$as_echo "\"$with_grep_path\"" >&6; }+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5+$as_echo_n "checking dependency style of $depcc... " >&6; }+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :+ $as_echo_n "(cached) " >&6 else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5-$as_echo "" >&6; }- GREP_PATH="${datadir}/ugrep/patterns"-fi--+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then+ # We make a subdir and do the tests there. Otherwise we can end up+ # making bogus files that we don't know about and never remove. For+ # instance it was reported that on HP-UX the gcc test will end up+ # making a dummy file named 'D' -- because '-MD' means "put the output+ # in D".+ rm -rf conftest.dir+ mkdir conftest.dir+ # Copy depcomp to subdir because otherwise we won't find it if we're+ # using a relative directory.+ cp "$am_depcomp" conftest.dir+ cd conftest.dir+ # We will build objects and dependencies in a subdirectory because+ # it helps to detect inapplicable dependency modes. For instance+ # both Tru64's cc and ICC support -MD to output dependencies as a+ # side effect of compilation, but ICC will put the dependencies in+ # the current directory while Tru64 will put them in the object+ # directory.+ mkdir sub -# Check whether --with-grep-colors was given.-if test "${with_grep_colors+set}" = set; then :- withval=$with_grep_colors; with_grep_colors="$withval"-else- with_grep_colors=""-fi+ am_cv_CXX_dependencies_compiler_type=none+ if test "$am_compiler_list" = ""; then+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`+ fi+ am__universal=false+ case " $depcc " in #(+ *\ -arch\ *\ -arch\ *) am__universal=true ;;+ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-grep-colors" >&5-$as_echo_n "checking for --with-grep-colors... " >&6; }-if test "x$with_grep_colors" != "x"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$with_grep_colors\"" >&5-$as_echo "\"$with_grep_colors\"" >&6; }- EXTRA_CFLAGS="-DDEFAULT_GREP_COLORS=\"\\\"$with_grep_colors\\\"\" ${EXTRA_FLAGS}"-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5-$as_echo "" >&6; }-fi+ for depmode in $am_compiler_list; do+ # Setup a source with many dependencies, because some compilers+ # like to wrap large dependency lists on column 80 (with \), and+ # we should not choose a depcomp mode which is confused by this.+ #+ # We need to recreate these files for each test, as the compiler may+ # overwrite some of them when testing with obscure command lines.+ # This happens at least with the AIX C compiler.+ : > sub/conftest.c+ for i in 1 2 3 4 5 6; do+ echo '#include "conftst'$i'.h"' >> sub/conftest.c+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with+ # Solaris 10 /bin/sh.+ echo '/* dummy */' > sub/conftst$i.h+ done+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf -# Check whether --enable-color was given.-if test "${enable_color+set}" = set; then :- enableval=$enable_color; with_color="$enable_color"-else- with_color="no"-fi+ # We check with '-c' and '-o' for the sake of the "dashmstdout"+ # mode. It turns out that the SunPro C++ compiler does not properly+ # handle '-M -o', and we need to detect this. Also, some Intel+ # versions had trouble with output in subdirs.+ am__obj=sub/conftest.${OBJEXT-o}+ am__minus_obj="-o $am__obj"+ case $depmode in+ gcc)+ # This depmode causes a compiler race in universal mode.+ test "$am__universal" = false || continue+ ;;+ nosideeffect)+ # After this tag, mechanisms are not by side-effect, so they'll+ # only be used when explicitly requested.+ if test "x$enable_dependency_tracking" = xyes; then+ continue+ else+ break+ fi+ ;;+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)+ # This compiler won't grok '-c -o', but also, the minuso test has+ # not run yet. These depmodes are late enough in the game, and+ # so weak that their functioning should not be impacted.+ am__obj=conftest.${OBJEXT-o}+ am__minus_obj=+ ;;+ none) break ;;+ esac+ if depmode=$depmode \+ source=sub/conftest.c object=$am__obj \+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \+ >/dev/null 2>conftest.err &&+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then+ # icc doesn't choke on unknown options, it will just issue warnings+ # or remarks (even with -Werror). So we grep stderr for any message+ # that says an option was ignored or not supported.+ # When given -MP, icc 7.0 and 7.1 complain thusly:+ # icc: Command line warning: ignoring option '-M'; no argument required+ # The diagnosis changed in icc 8.0:+ # icc: Command line remark: option '-MP' not supported+ if (grep 'ignoring option' conftest.err ||+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else+ am_cv_CXX_dependencies_compiler_type=$depmode+ break+ fi+ fi+ done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-color" >&5-$as_echo_n "checking for --enable-color... " >&6; }-if test "x$with_color" = "xyes"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- EXTRA_CFLAGS="-DWITH_COLOR ${EXTRA_CFLAGS}"+ cd ..+ rm -rf conftest.dir else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }+ am_cv_CXX_dependencies_compiler_type=none fi -# Check whether --enable-pager was given.-if test "${enable_pager+set}" = set; then :- enableval=$enable_pager; with_pager="$enable_pager"-else- with_pager="no" fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-pager" >&5-$as_echo_n "checking for --enable-pager... " >&6; }-if test "x$with_pager" = "xyes"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- EXTRA_CFLAGS="-DWITH_PAGER ${EXTRA_CFLAGS}"+ if+ test "x$enable_dependency_tracking" != xno \+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then+ am__fastdepCXX_TRUE=+ am__fastdepCXX_FALSE='#' else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }+ am__fastdepCXX_TRUE='#'+ am__fastdepCXX_FALSE= fi -# Check whether --enable-hidden was given.-if test "${enable_hidden+set}" = set; then :- enableval=$enable_hidden; with_no_hidden="yes"-else- with_no_hidden="no"-fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-hidden" >&5-$as_echo_n "checking for --disable-hidden... " >&6; }-if test "x$with_no_hidden" = "xno"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }+if test -n "$ac_tool_prefix"; then+ for ac_prog in ar lib "link -lib"+ 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+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_AR+:} false; then :+ $as_echo_n "(cached) " >&6 else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- EXTRA_CFLAGS="-DWITH_NO_HIDDEN ${EXTRA_CFLAGS}"-fi--# Check whether --enable-mmap was given.-if test "${enable_mmap+set}" = set; then :- enableval=$enable_mmap; with_no_mmap="yes"+ if test -n "$AR"; then+ ac_cv_prog_AR="$AR" # Let the user override the test. else- with_no_mmap="no"-fi+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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-mmap" >&5-$as_echo_n "checking for --disable-mmap... " >&6; }-if test "x$with_no_mmap" = "xno"; then+fi+fi+AR=$ac_cv_prog_AR+if test -n "$AR"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5+$as_echo "$AR" >&6; }+else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5-$as_echo "yes" >&6; }- EXTRA_CFLAGS="-DWITH_NO_MMAP ${EXTRA_CFLAGS}" fi --ac_header_dirent=no-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do- as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5-$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }-if eval \${$as_ac_Header+:} false; then :+ test -n "$AR" && break+ done+fi+if test -z "$AR"; then+ ac_ct_AR=$AR+ for ac_prog in ar lib "link -lib"+do+ # Extract the first word of "$ac_prog", so it can be a program name with args.+set dummy $ac_prog; ac_word=$2+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-#include <sys/types.h>-#include <$ac_hdr>--int-main ()-{-if ((DIR *) 0)-return 0;- ;- return 0;-}-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- eval "$as_ac_Header=yes"+ if test -n "$ac_ct_AR"; then+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else- eval "$as_ac_Header=no"-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-fi-eval ac_res=\$$as_ac_Header- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5-$as_echo "$ac_res" >&6; }-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1-_ACEOF--ac_header_dirent=$ac_hdr; break-fi-+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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_ac_ct_AR="$ac_prog"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi done-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.-if test $ac_header_dirent = dirent.h; then- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5-$as_echo_n "checking for library containing opendir... " >&6; }-if ${ac_cv_search_opendir+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_func_search_save_LIBS=$LIBS-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */+ done+IFS=$as_save_IFS -/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char opendir ();-int-main ()-{-return opendir ();- ;- return 0;-}-_ACEOF-for ac_lib in '' dir; do- if test -z "$ac_lib"; then- ac_res="none required"- else- ac_res=-l$ac_lib- LIBS="-l$ac_lib $ac_func_search_save_LIBS"- fi- if ac_fn_c_try_link "$LINENO"; then :- ac_cv_search_opendir=$ac_res fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext- if ${ac_cv_search_opendir+:} false; then :- break fi-done-if ${ac_cv_search_opendir+:} false; then :--else- ac_cv_search_opendir=no-fi-rm conftest.$ac_ext-LIBS=$ac_func_search_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5-$as_echo "$ac_cv_search_opendir" >&6; }-ac_res=$ac_cv_search_opendir-if test "$ac_res" != no; then :- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"--fi--else- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5-$as_echo_n "checking for library containing opendir... " >&6; }-if ${ac_cv_search_opendir+:} false; then :- $as_echo_n "(cached) " >&6-else- ac_func_search_save_LIBS=$LIBS-cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--/* Override any GCC internal prototype to avoid an error.- Use char because int might match the return type of a GCC- builtin and then its argument prototype would still apply. */-#ifdef __cplusplus-extern "C"-#endif-char opendir ();-int-main ()-{-return opendir ();- ;- return 0;-}-_ACEOF-for ac_lib in '' x; do- if test -z "$ac_lib"; then- ac_res="none required"- else- ac_res=-l$ac_lib- LIBS="-l$ac_lib $ac_func_search_save_LIBS"- fi- if ac_fn_c_try_link "$LINENO"; then :- ac_cv_search_opendir=$ac_res-fi-rm -f core conftest.err conftest.$ac_objext \- conftest$ac_exeext- if ${ac_cv_search_opendir+:} false; then :- break-fi-done-if ${ac_cv_search_opendir+:} false; then :--else- ac_cv_search_opendir=no-fi-rm conftest.$ac_ext-LIBS=$ac_func_search_save_LIBS-fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5-$as_echo "$ac_cv_search_opendir" >&6; }-ac_res=$ac_cv_search_opendir-if test "$ac_res" != no; then :- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"--fi--fi---- ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" "-#include <sys/types.h>-#ifdef HAVE_DIRENT_H-# include <dirent.h>-#else-# define dirent direct-# ifdef HAVE_SYS_NDIR_H-# include <sys/ndir.h>-# endif-# ifdef HAVE_SYS_DIR_H-# include <sys/dir.h>-# endif-# ifdef HAVE_NDIR_H-# include <ndir.h>-# endif-#endif--"-if test "x$ac_cv_member_struct_dirent_d_ino" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_DIRENT_D_INO 1-_ACEOF---fi----- ac_fn_c_check_member "$LINENO" "struct dirent" "d_type" "ac_cv_member_struct_dirent_d_type" "-#include <sys/types.h>-#ifdef HAVE_DIRENT_H-# include <dirent.h>-#else-# define dirent direct-# ifdef HAVE_SYS_NDIR_H-# include <sys/ndir.h>-# endif-# ifdef HAVE_SYS_DIR_H-# include <sys/dir.h>-# endif-# ifdef HAVE_NDIR_H-# include <ndir.h>-# endif-#endif--"-if test "x$ac_cv_member_struct_dirent_d_type" = xyes; then :--cat >>confdefs.h <<_ACEOF-#define HAVE_STRUCT_DIRENT_D_TYPE 1-_ACEOF---fi------- for ac_header in $ac_header_list-do :- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default-"-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :- cat >>confdefs.h <<_ACEOF-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1-_ACEOF--fi--done---------for ac_func in getpagesize-do :- ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"-if test "x$ac_cv_func_getpagesize" = xyes; then :- cat >>confdefs.h <<_ACEOF-#define HAVE_GETPAGESIZE 1-_ACEOF--fi-done--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5-$as_echo_n "checking for working mmap... " >&6; }-if ${ac_cv_func_mmap_fixed_mapped+:} false; then :- $as_echo_n "(cached) " >&6-else- if test "$cross_compiling" = yes; then :- ac_cv_func_mmap_fixed_mapped=no-else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-$ac_includes_default-/* malloc might have been renamed as rpl_malloc. */-#undef malloc--/* Thanks to Mike Haertel and Jim Avera for this test.- Here is a matrix of mmap possibilities:- mmap private not fixed- mmap private fixed at somewhere currently unmapped- mmap private fixed at somewhere already mapped- mmap shared not fixed- mmap shared fixed at somewhere currently unmapped- mmap shared fixed at somewhere already mapped- For private mappings, we should verify that changes cannot be read()- back from the file, nor mmap's back from the file at a different- address. (There have been systems where private was not correctly- implemented like the infamous i386 svr4.0, and systems where the- VM page cache was not coherent with the file system buffer cache- like early versions of FreeBSD and possibly contemporary NetBSD.)- For shared mappings, we should conversely verify that changes get- propagated back to all the places they're supposed to be.-- Grep wants private fixed already mapped.- The main things grep needs to know about mmap are:- * does it exist and is it safe to write into the mmap'd area- * how to use it (BSD variants) */--#include <fcntl.h>-#include <sys/mman.h>--#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H-char *malloc ();-#endif--/* This mess was copied from the GNU getpagesize.h. */-#ifndef HAVE_GETPAGESIZE-# ifdef _SC_PAGESIZE-# define getpagesize() sysconf(_SC_PAGESIZE)-# else /* no _SC_PAGESIZE */-# ifdef HAVE_SYS_PARAM_H-# include <sys/param.h>-# ifdef EXEC_PAGESIZE-# define getpagesize() EXEC_PAGESIZE-# else /* no EXEC_PAGESIZE */-# ifdef NBPG-# define getpagesize() NBPG * CLSIZE-# ifndef CLSIZE-# define CLSIZE 1-# endif /* no CLSIZE */-# else /* no NBPG */-# ifdef NBPC-# define getpagesize() NBPC-# else /* no NBPC */-# ifdef PAGESIZE-# define getpagesize() PAGESIZE-# endif /* PAGESIZE */-# endif /* no NBPC */-# endif /* no NBPG */-# endif /* no EXEC_PAGESIZE */-# else /* no HAVE_SYS_PARAM_H */-# define getpagesize() 8192 /* punt totally */-# endif /* no HAVE_SYS_PARAM_H */-# endif /* no _SC_PAGESIZE */--#endif /* no HAVE_GETPAGESIZE */--int-main ()-{- char *data, *data2, *data3;- const char *cdata2;- int i, pagesize;- int fd, fd2;-- pagesize = getpagesize ();-- /* First, make a file with some known garbage in it. */- data = (char *) malloc (pagesize);- if (!data)- return 1;- for (i = 0; i < pagesize; ++i)- *(data + i) = rand ();- umask (0);- fd = creat ("conftest.mmap", 0600);- if (fd < 0)- return 2;- if (write (fd, data, pagesize) != pagesize)- return 3;- close (fd);-- /* Next, check that the tail of a page is zero-filled. File must have- non-zero length, otherwise we risk SIGBUS for entire page. */- fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);- if (fd2 < 0)- return 4;- cdata2 = "";- if (write (fd2, cdata2, 1) != 1)- return 5;- data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);- if (data2 == MAP_FAILED)- return 6;- for (i = 0; i < pagesize; ++i)- if (*(data2 + i))- return 7;- close (fd2);- if (munmap (data2, pagesize))- return 8;-- /* Next, try to mmap the file at a fixed address which already has- something else allocated at it. If we can, also make sure that- we see the same garbage. */- fd = open ("conftest.mmap", O_RDWR);- if (fd < 0)- return 9;- if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,- MAP_PRIVATE | MAP_FIXED, fd, 0L))- return 10;- for (i = 0; i < pagesize; ++i)- if (*(data + i) != *(data2 + i))- return 11;-- /* Finally, make sure that changes to the mapped area do not- percolate back to the file as seen by read(). (This is a bug on- some variants of i386 svr4.0.) */- for (i = 0; i < pagesize; ++i)- *(data2 + i) = *(data2 + i) + 1;- data3 = (char *) malloc (pagesize);- if (!data3)- return 12;- if (read (fd, data3, pagesize) != pagesize)- return 13;- for (i = 0; i < pagesize; ++i)- if (*(data + i) != *(data3 + i))- return 14;- close (fd);- return 0;-}-_ACEOF-if ac_fn_c_try_run "$LINENO"; then :- ac_cv_func_mmap_fixed_mapped=yes+ac_ct_AR=$ac_cv_prog_ac_ct_AR+if test -n "$ac_ct_AR"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5+$as_echo "$ac_ct_AR" >&6; } else- ac_cv_func_mmap_fixed_mapped=no-fi-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \- conftest.$ac_objext conftest.beam conftest.$ac_ext+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; } fi -fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5-$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }-if test $ac_cv_func_mmap_fixed_mapped = yes; then -$as_echo "#define HAVE_MMAP 1" >>confdefs.h+ test -n "$ac_ct_AR" && break+done + if test "x$ac_ct_AR" = x; then+ AR="false"+ else+ case $cross_compiling:$ac_tool_warned in+yes:)+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ AR=$ac_ct_AR+ fi fi-rm -f conftest.mmap conftest.txt +: ${AR=ar} -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"-if test "x$ac_cv_type_size_t" = xyes; then :-+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5+$as_echo_n "checking the archiver ($AR) interface... " >&6; }+if ${am_cv_ar_interface+:} false; then :+ $as_echo_n "(cached) " >&6 else+ 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 -cat >>confdefs.h <<_ACEOF-#define size_t unsigned int+ am_cv_ar_interface=ar+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */+int some_variable = 0; _ACEOF+if ac_fn_c_try_compile "$LINENO"; then :+ am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5'+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5+ (eval $am_ar_try) 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+ if test "$ac_status" -eq 0; then+ am_cv_ar_interface=ar+ else+ am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5'+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5+ (eval $am_ar_try) 2>&5+ ac_status=$?+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5+ test $ac_status = 0; }+ if test "$ac_status" -eq 0; then+ am_cv_ar_interface=lib+ else+ am_cv_ar_interface=unknown+ fi+ fi+ rm -f conftest.lib libconftest.a++fi+rm -f core 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 fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5+$as_echo "$am_cv_ar_interface" >&6; } -ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"-if test "x$ac_cv_type_ssize_t" = xyes; then :+case $am_cv_ar_interface in+ar)+ ;;+lib)+ # Microsoft lib, so override with the ar-lib wrapper script.+ # FIXME: It is wrong to rewrite AR.+ # But if we don't then we get into trouble of one sort or another.+ # A longer-term fix would be to have automake use am__AR in this case,+ # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something+ # similar.+ AR="$am_aux_dir/ar-lib $AR"+ ;;+unknown)+ as_fn_error $? "could not determine $AR interface" "$LINENO" 5+ ;;+esac +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+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5+$as_echo_n "checking for $ac_word... " >&6; }+if ${ac_cv_prog_RANLIB+:} false; then :+ $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5+ break 2+ fi+done+ done+IFS=$as_save_IFS -cat >>confdefs.h <<_ACEOF-#define ssize_t int-_ACEOF-+fi+fi+RANLIB=$ac_cv_prog_RANLIB+if test -n "$RANLIB"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5+$as_echo "$RANLIB" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; } fi -ac_ext=cpp-ac_cpp='$CXXCPP $CPPFLAGS'-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu-if test -z "$CXX"; then- if test -n "$CCC"; then- CXX=$CCC- else- if test -n "$ac_tool_prefix"; then- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC- 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+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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_CXX+:} false; then :+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else- if test -n "$CXX"; then- ac_cv_prog_CXX="$CXX" # Let the user override the test.+ 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@@ -5861,7 +5472,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"+ ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi@@ -5869,692 +5480,702 @@ done done IFS=$as_save_IFS -fi-fi-CXX=$ac_cv_prog_CXX-if test -n "$CXX"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5-$as_echo "$CXX" >&6; }-else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi+fi+fi+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB+if test -n "$ac_ct_RANLIB"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5+$as_echo "$ac_ct_RANLIB" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; }+fi++ if test "x$ac_ct_RANLIB" = x; then+ RANLIB=":"+ else+ case $cross_compiling:$ac_tool_warned in+yes:)+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}+ac_tool_warned=yes ;;+esac+ RANLIB=$ac_ct_RANLIB+ fi+else+ RANLIB="$ac_cv_prog_RANLIB"+fi++++# Make sure we can run config.sub.+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5+$as_echo_n "checking build system type... " >&6; }+if ${ac_cv_build+:} false; then :+ $as_echo_n "(cached) " >&6+else+ ac_build_alias=$build_alias+test "x$ac_build_alias" = x &&+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`+test "x$ac_build_alias" = x &&+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5++fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5+$as_echo "$ac_cv_build" >&6; }+case $ac_cv_build in+*-*-*) ;;+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;+esac+build=$ac_cv_build+ac_save_IFS=$IFS; IFS='-'+set x $ac_cv_build+shift+build_cpu=$1+build_vendor=$2+shift; shift+# Remember, the first character of IFS is used to create $*,+# except with old shells:+build_os=$*+IFS=$ac_save_IFS+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac+++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5+$as_echo_n "checking host system type... " >&6; }+if ${ac_cv_host+:} false; then :+ $as_echo_n "(cached) " >&6+else+ if test "x$host_alias" = x; then+ ac_cv_host=$ac_cv_build+else+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5+fi++fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5+$as_echo "$ac_cv_host" >&6; }+case $ac_cv_host in+*-*-*) ;;+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;+esac+host=$ac_cv_host+ac_save_IFS=$IFS; IFS='-'+set x $ac_cv_host+shift+host_cpu=$1+host_vendor=$2+shift; shift+# Remember, the first character of IFS is used to create $*,+# except with old shells:+host_os=$*+IFS=$ac_save_IFS+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac++++PLATFORM=${host}+ +# Mac OS X has slow memory mapped files so we're disabling mmap+case "$PLATFORM" in+ *-apple-*) EXTRA_CFLAGS="-DWITH_NO_MMAP ${EXTRA_CFLAGS}"+ ;;+esac - test -n "$CXX" && break- done-fi-if test -z "$CXX"; then- ac_ct_CXX=$CXX- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC-do- # Extract the first word of "$ac_prog", so it can be a program name with args.-set dummy $ac_prog; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_ac_ct_CXX+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$ac_ct_CXX"; then- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_ac_ct_CXX="$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS -fi-fi-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX-if test -n "$ac_ct_CXX"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5-$as_echo "$ac_ct_CXX" >&6; }+++# Check whether --with-boost-regex was given.+if test "${with_boost_regex+set}" = set; then :+ withval=$with_boost_regex;+ if test "$withval" = "no"; then+ want_boost="no"+ elif test "$withval" = "yes"; then+ want_boost="yes"+ ax_boost_regex_lib="-lboost_regex"+ else+ want_boost="yes"+ ax_boost_regex_lib="$withval"+ fi+ else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }-fi + want_boost="yes"+ ax_boost_regex_lib="-lboost_regex" - test -n "$ac_ct_CXX" && break-done - if test "x$ac_ct_CXX" = x; then- CXX="g++"- else- case $cross_compiling:$ac_tool_warned in-yes:)-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}-ac_tool_warned=yes ;;-esac- CXX=$ac_ct_CXX- fi fi - fi-fi-# Provide some information about the compiler.-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5-set X $ac_compile-ac_compiler=$2-for ac_option in --version -v -V -qversion; do- { { ac_try="$ac_compiler $ac_option >&5"-case "(($ac_try" in- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;- *) ac_try_echo=$ac_try;;-esac-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""-$as_echo "$ac_try_echo"; } >&5- (eval "$ac_compiler $ac_option >&5") 2>conftest.err- ac_status=$?- if test -s conftest.err; then- sed '10a\-... rest of stderr output deleted ...- 10q' conftest.err >conftest.er1- cat conftest.er1 >&5- fi- rm -f conftest.er1 conftest.err- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }-done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5-$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }-if ${ac_cv_cxx_compiler_gnu+:} false; then :+ if test "x$want_boost" = "xyes"; then+++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Regex library is available" >&5+$as_echo_n "checking whether the Boost::Regex library is available... " >&6; }+if ${ax_cv_boost_regex+:} false; then : $as_echo_n "(cached) " >&6 else- cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ ac_ext=cpp+ac_cpp='$CXXCPP $CPPFLAGS'+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */+#include <boost/regex.hpp> int main () {-#ifndef __GNUC__- choke me-#endif-+boost::regex r(); return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then :- ac_compiler_gnu=yes+ ax_cv_boost_regex=yes else- ac_compiler_gnu=no+ ax_cv_boost_regex=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext-ac_cv_cxx_compiler_gnu=$ac_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+ fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5-$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }-if test $ac_compiler_gnu = yes; then- GXX=yes+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_regex" >&5+$as_echo "$ax_cv_boost_regex" >&6; }+ if test "x$ax_cv_boost_regex" = "xyes"; then++$as_echo "#define HAVE_BOOST_REGEX 1" >>confdefs.h++ LIBS="$LIBS $ax_boost_regex_lib"+ fi+ fi+++#+# Handle user hints+#+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if zlib is wanted" >&5+$as_echo_n "checking if zlib is wanted... " >&6; }+zlib_places="/usr/local /usr /opt/local /sw"++# Check whether --with-zlib was given.+if test "${with_zlib+set}" = set; then :+ withval=$with_zlib; if test "$withval" != no ; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ if test -d "$withval"+ then+ zlib_places="$withval $zlib_places"+ else+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5+$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}+ fi else- GXX=+ zlib_places=+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; } fi-ac_test_CXXFLAGS=${CXXFLAGS+set}-ac_save_CXXFLAGS=$CXXFLAGS-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5-$as_echo_n "checking whether $CXX accepts -g... " >&6; }-if ${ac_cv_prog_cxx_g+:} false; then :- $as_echo_n "(cached) " >&6 else- ac_save_cxx_werror_flag=$ac_cxx_werror_flag- ac_cxx_werror_flag=yes- ac_cv_prog_cxx_g=no- CXXFLAGS="-g"- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */--int-main ()-{+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+fi - ;- return 0;-}-_ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :- ac_cv_prog_cxx_g=yes-else- CXXFLAGS=""- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */ -int-main ()-{+#+# Locate zlib, if wanted+#+if test -n "${zlib_places}"+then+ # check the user supplied or any other more or less 'standard' place:+ # Most UNIX systems : /usr/local and /usr+ # MacPorts / Fink on OSX : /opt/local respectively /sw+ for ZLIB_HOME in ${zlib_places} ; do+ if test -f "${ZLIB_HOME}/include/zlib.h"; then break; fi+ ZLIB_HOME=""+ done - ;- return 0;-}-_ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :+ ZLIB_OLD_LDFLAGS=$LDFLAGS+ ZLIB_OLD_CPPFLAGS=$CPPFLAGS+ if test -n "${ZLIB_HOME}"; then+ LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"+ CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"+ 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflateEnd in -lz" >&5+$as_echo_n "checking for inflateEnd in -lz... " >&6; }+if ${ac_cv_lib_z_inflateEnd+:} false; then :+ $as_echo_n "(cached) " >&6 else- ac_cxx_werror_flag=$ac_save_cxx_werror_flag- CXXFLAGS="-g"- cat confdefs.h - <<_ACEOF >conftest.$ac_ext+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lz $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char inflateEnd (); int main () {-+return inflateEnd (); ; return 0; } _ACEOF-if ac_fn_cxx_try_compile "$LINENO"; then :- ac_cv_prog_cxx_g=yes-fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+if ac_fn_c_try_link "$LINENO"; then :+ ac_cv_lib_z_inflateEnd=yes+else+ ac_cv_lib_z_inflateEnd=no fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS fi-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext- ac_cxx_werror_flag=$ac_save_cxx_werror_flag+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflateEnd" >&5+$as_echo "$ac_cv_lib_z_inflateEnd" >&6; }+if test "x$ac_cv_lib_z_inflateEnd" = xyes; then :+ zlib_cv_libz=yes+else+ zlib_cv_libz=no fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5-$as_echo "$ac_cv_prog_cxx_g" >&6; }-if test "$ac_test_CXXFLAGS" = set; then- CXXFLAGS=$ac_save_CXXFLAGS-elif test $ac_cv_prog_cxx_g = yes; then- if test "$GXX" = yes; then- CXXFLAGS="-g -O2"- else- CXXFLAGS="-g"- fi++ ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"+if test "x$ac_cv_header_zlib_h" = xyes; then :+ zlib_cv_zlib_h=yes else- if test "$GXX" = yes; then- CXXFLAGS="-O2"- else- CXXFLAGS=- fi+ zlib_cv_zlib_h=no fi-ac_ext=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 -depcc="$CXX" am_compiler_list=+ if test "$zlib_cv_libz" = "yes" && test "$zlib_cv_zlib_h" = "yes"+ then+ #+ # If both library and header were found, action-if-found+ # -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5-$as_echo_n "checking dependency style of $depcc... " >&6; }-if ${am_cv_CXX_dependencies_compiler_type+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then- # We make a subdir and do the tests there. Otherwise we can end up- # making bogus files that we don't know about and never remove. For- # instance it was reported that on HP-UX the gcc test will end up- # making a dummy file named 'D' -- because '-MD' means "put the output- # in D".- rm -rf conftest.dir- mkdir conftest.dir- # Copy depcomp to subdir because otherwise we won't find it if we're- # using a relative directory.- cp "$am_depcomp" conftest.dir- cd conftest.dir- # We will build objects and dependencies in a subdirectory because- # it helps to detect inapplicable dependency modes. For instance- # both Tru64's cc and ICC support -MD to output dependencies as a- # side effect of compilation, but ICC will put the dependencies in- # the current directory while Tru64 will put them in the object- # directory.- mkdir sub+ CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"+ LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"+ LIBS="-lz $LIBS" - am_cv_CXX_dependencies_compiler_type=none- if test "$am_compiler_list" = ""; then- am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`- fi- am__universal=false- case " $depcc " in #(- *\ -arch\ *\ -arch\ *) am__universal=true ;;- esac+$as_echo "#define HAVE_LIBZ 1" >>confdefs.h - for depmode in $am_compiler_list; do- # Setup a source with many dependencies, because some compilers- # like to wrap large dependency lists on column 80 (with \), and- # we should not choose a depcomp mode which is confused by this.++ else #- # We need to recreate these files for each test, as the compiler may- # overwrite some of them when testing with obscure command lines.- # This happens at least with the AIX C compiler.- : > sub/conftest.c- for i in 1 2 3 4 5 6; do- echo '#include "conftst'$i'.h"' >> sub/conftest.c- # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with- # Solaris 10 /bin/sh.- echo '/* dummy */' > sub/conftst$i.h- done- echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf+ # If either header or library was not found, action-if-not-found+ #+ echo "zlib not found: option -z disabled"+ fi+fi - # We check with '-c' and '-o' for the sake of the "dashmstdout"- # mode. It turns out that the SunPro C++ compiler does not properly- # handle '-M -o', and we need to detect this. Also, some Intel- # versions had trouble with output in subdirs.- am__obj=sub/conftest.${OBJEXT-o}- am__minus_obj="-o $am__obj"- case $depmode in- gcc)- # This depmode causes a compiler race in universal mode.- test "$am__universal" = false || continue- ;;- nosideeffect)- # After this tag, mechanisms are not by side-effect, so they'll- # only be used when explicitly requested.- if test "x$enable_dependency_tracking" = xyes; then- continue- else- break- fi- ;;- msvc7 | msvc7msys | msvisualcpp | msvcmsys)- # This compiler won't grok '-c -o', but also, the minuso test has- # not run yet. These depmodes are late enough in the game, and- # so weak that their functioning should not be impacted.- am__obj=conftest.${OBJEXT-o}- am__minus_obj=- ;;- none) break ;;- esac- if depmode=$depmode \- source=sub/conftest.c object=$am__obj \- depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \- $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \- >/dev/null 2>conftest.err &&- grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&- grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&- grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&- ${MAKE-make} -s -f confmf > /dev/null 2>&1; then- # icc doesn't choke on unknown options, it will just issue warnings- # or remarks (even with -Werror). So we grep stderr for any message- # that says an option was ignored or not supported.- # When given -MP, icc 7.0 and 7.1 complain thusly:- # icc: Command line warning: ignoring option '-M'; no argument required- # The diagnosis changed in icc 8.0:- # icc: Command line remark: option '-MP' not supported- if (grep 'ignoring option' conftest.err ||- grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else- am_cv_CXX_dependencies_compiler_type=$depmode- break- fi- fi- done - cd ..- rm -rf conftest.dir+#+# Handle user hints+#+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if bzlib is wanted" >&5+$as_echo_n "checking if bzlib is wanted... " >&6; }+bzlib_places="/usr/local /usr /opt/local /sw"++# Check whether --with-bzlib was given.+if test "${with_bzlib+set}" = set; then :+ withval=$with_bzlib; if test "$withval" != no ; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ if test -d "$withval"+ then+ bzlib_places="$withval $bzlib_places"+ else+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5+$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}+ fi else- am_cv_CXX_dependencies_compiler_type=none+ bzlib_places=+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; }+fi+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; } fi ++#+# Locate bzlib, if wanted+#+if test -n "${bzlib_places}"+then+ # check the user supplied or any other more or less 'standard' place:+ # Most UNIX systems : /usr/local and /usr+ # MacPorts / Fink on OSX : /opt/local respectively /sw+ for BZLIB_HOME in ${bzlib_places} ; do+ if test -f "${BZLIB_HOME}/include/bzlib.h"; then break; fi+ BZLIB_HOME=""+ done++ BZLIB_OLD_LDFLAGS=$LDFLAGS+ BZLIB_OLD_CPPFLAGS=$CPPFLAGS+ if test -n "${BZLIB_HOME}"; then+ LDFLAGS="$LDFLAGS -L${BZLIB_HOME}/lib"+ CPPFLAGS="$CPPFLAGS -I${BZLIB_HOME}/include"+ 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++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzRead in -lbz2" >&5+$as_echo_n "checking for BZ2_bzRead in -lbz2... " >&6; }+if ${ac_cv_lib_bz2_BZ2_bzRead+:} false; then :+ $as_echo_n "(cached) " >&6+else+ ac_check_lib_save_LIBS=$LIBS+LIBS="-lbz2 $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */++/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char BZ2_bzRead ();+int+main ()+{+return BZ2_bzRead ();+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_link "$LINENO"; then :+ ac_cv_lib_bz2_BZ2_bzRead=yes+else+ ac_cv_lib_bz2_BZ2_bzRead=no+fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS+fi+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzRead" >&5+$as_echo "$ac_cv_lib_bz2_BZ2_bzRead" >&6; }+if test "x$ac_cv_lib_bz2_BZ2_bzRead" = xyes; then :+ bzlib_cv_libbz2=yes+else+ bzlib_cv_libbz2=no fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5-$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }-CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type - if- test "x$enable_dependency_tracking" != xno \- && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then- am__fastdepCXX_TRUE=- am__fastdepCXX_FALSE='#'+ ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"+if test "x$ac_cv_header_bzlib_h" = xyes; then :+ bzlib_cv_bzlib_h=yes else- am__fastdepCXX_TRUE='#'- am__fastdepCXX_FALSE=+ bzlib_cv_bzlib_h=no fi -if test -n "$ac_tool_prefix"; then- for ac_prog in ar lib "link -lib"- 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-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_AR+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$AR"; then- ac_cv_prog_AR="$AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_AR="$ac_tool_prefix$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS+ 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 "$bzlib_cv_libbz2" = "yes" && test "$bzlib_cv_bzlib_h" = "yes"+ then+ #+ # If both library and header were found, action-if-found+ #++ CPPFLAGS="$CPPFLAGS -I${BZLIB_HOME}/include"+ LDFLAGS="$LDFLAGS -L${BZLIB_HOME}/lib"+ LIBS="-lbz2 $LIBS"++$as_echo "#define HAVE_LIBBZ2 1" >>confdefs.h+++ else+ #+ # If either header or library was not found, action-if-not-found+ #+ echo "libbz2 not found: option -z won't decompress .bz and .bz2 files"+ fi fi-fi-AR=$ac_cv_prog_AR-if test -n "$AR"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5-$as_echo "$AR" >&6; }+++#+# Handle user hints+#+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if lzma is wanted" >&5+$as_echo_n "checking if lzma is wanted... " >&6; }+lzma_places="/usr/local /usr /opt/local /sw"++# Check whether --with-lzma was given.+if test "${with_lzma+set}" = set; then :+ withval=$with_lzma; if test "$withval" != no ; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ if test -d "$withval"+ then+ lzma_places="$withval $lzma_places"+ else+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5+$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}+ fi else+ lzma_places= { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+fi - test -n "$AR" && break- done-fi-if test -z "$AR"; then- ac_ct_AR=$AR- for ac_prog in ar lib "link -lib"-do- # Extract the first word of "$ac_prog", so it can be a program name with args.-set dummy $ac_prog; ac_word=$2-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_ac_ct_AR+:} false; then :+#+# Locate lzma, if wanted+#+if test -n "${lzma_places}"+then+ # check the user supplied or any other more or less 'standard' place:+ # Most UNIX systems : /usr/local and /usr+ # MacPorts / Fink on OSX : /opt/local respectively /sw+ for LZMA_HOME in ${lzma_places} ; do+ if test -f "${LZMA_HOME}/include/lzma.h"; then break; fi+ LZMA_HOME=""+ done++ LZMA_OLD_LDFLAGS=$LDFLAGS+ LZMA_OLD_CPPFLAGS=$CPPFLAGS+ if test -n "${LZMA_HOME}"; then+ LDFLAGS="$LDFLAGS -L${LZMA_HOME}/lib"+ CPPFLAGS="$CPPFLAGS -I${LZMA_HOME}/include"+ 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++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_code in -llzma" >&5+$as_echo_n "checking for lzma_code in -llzma... " >&6; }+if ${ac_cv_lib_lzma_lzma_code+:} false; then : $as_echo_n "(cached) " >&6 else- if test -n "$ac_ct_AR"; then- ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_ac_ct_AR="$ac_prog"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS+ ac_check_lib_save_LIBS=$LIBS+LIBS="-llzma $LIBS"+cat confdefs.h - <<_ACEOF >conftest.$ac_ext+/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error.+ Use char because int might match the return type of a GCC+ builtin and then its argument prototype would still apply. */+#ifdef __cplusplus+extern "C"+#endif+char lzma_code ();+int+main ()+{+return lzma_code ();+ ;+ return 0;+}+_ACEOF+if ac_fn_c_try_link "$LINENO"; then :+ ac_cv_lib_lzma_lzma_code=yes+else+ ac_cv_lib_lzma_lzma_code=no fi+rm -f core conftest.err conftest.$ac_objext \+ conftest$ac_exeext conftest.$ac_ext+LIBS=$ac_check_lib_save_LIBS fi-ac_ct_AR=$ac_cv_prog_ac_ct_AR-if test -n "$ac_ct_AR"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5-$as_echo "$ac_ct_AR" >&6; }+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_code" >&5+$as_echo "$ac_cv_lib_lzma_lzma_code" >&6; }+if test "x$ac_cv_lib_lzma_lzma_code" = xyes; then :+ lzma_cv_liblzma=yes else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }+ lzma_cv_liblzma=no fi -- test -n "$ac_ct_AR" && break-done-- if test "x$ac_ct_AR" = x; then- AR="false"- else- case $cross_compiling:$ac_tool_warned in-yes:)-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}-ac_tool_warned=yes ;;-esac- AR=$ac_ct_AR- fi+ ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"+if test "x$ac_cv_header_lzma_h" = xyes; then :+ lzma_cv_lzma_h=yes+else+ lzma_cv_lzma_h=no fi -: ${AR=ar} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5-$as_echo_n "checking the archiver ($AR) interface... " >&6; }-if ${am_cv_ar_interface+:} false; then :- $as_echo_n "(cached) " >&6-else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - am_cv_ar_interface=ar- cat confdefs.h - <<_ACEOF >conftest.$ac_ext-/* end confdefs.h. */-int some_variable = 0;-_ACEOF-if ac_fn_c_try_compile "$LINENO"; then :- am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5'- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5- (eval $am_ar_try) 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }- if test "$ac_status" -eq 0; then- am_cv_ar_interface=ar- else- am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5'- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5- (eval $am_ar_try) 2>&5- ac_status=$?- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5- test $ac_status = 0; }- if test "$ac_status" -eq 0; then- am_cv_ar_interface=lib- else- am_cv_ar_interface=unknown- fi- fi- rm -f conftest.lib libconftest.a+ if test "$lzma_cv_liblzma" = "yes" && test "$lzma_cv_lzma_h" = "yes"+ then+ #+ # If both library and header were found, action-if-found+ #++ CPPFLAGS="$CPPFLAGS -I${LZMA_HOME}/include"+ LDFLAGS="$LDFLAGS -L${LZMA_HOME}/lib"+ LIBS="-llzma $LIBS"++$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h+ + else+ #+ # If either header or library was not found, action-if-not-found+ #+ echo "liblzma not found: option -z won't decompress .lzma and .xz files"+ fi fi-rm -f core 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 -fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5-$as_echo "$am_cv_ar_interface" >&6; } -case $am_cv_ar_interface in-ar)- ;;-lib)- # Microsoft lib, so override with the ar-lib wrapper script.- # FIXME: It is wrong to rewrite AR.- # But if we don't then we get into trouble of one sort or another.- # A longer-term fix would be to have automake use am__AR in this case,- # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something- # similar.- AR="$am_aux_dir/ar-lib $AR"- ;;-unknown)- as_fn_error $? "could not determine $AR interface" "$LINENO" 5- ;;-esac -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-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_RANLIB+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$RANLIB"; then- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.+# Check whether --with-grep-path was given.+if test "${with_grep_path+set}" = set; then :+ withval=$with_grep_path; with_grep_path="$withval" 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS--fi+ with_grep_path="" fi-RANLIB=$ac_cv_prog_RANLIB-if test -n "$RANLIB"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5-$as_echo "$RANLIB" >&6; }++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-grep-path" >&5+$as_echo_n "checking for --with-grep-path... " >&6; }+if test "x$with_grep_path" != "x"; then+ GREP_PATH="$with_grep_path"+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$with_grep_path\"" >&5+$as_echo "\"$with_grep_path\"" >&6; } else- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5-$as_echo "no" >&6; }+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5+$as_echo "" >&6; }+ GREP_PATH="${datadir}/ugrep/patterns" 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-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5-$as_echo_n "checking for $ac_word... " >&6; }-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :- $as_echo_n "(cached) " >&6-else- if test -n "$ac_ct_RANLIB"; then- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.++# Check whether --with-grep-colors was given.+if test "${with_grep_colors+set}" = set; then :+ withval=$with_grep_colors; with_grep_colors="$withval" 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then- ac_cv_prog_ac_ct_RANLIB="ranlib"- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5- break 2- fi-done- done-IFS=$as_save_IFS+ with_grep_colors=""+fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-grep-colors" >&5+$as_echo_n "checking for --with-grep-colors... " >&6; }+if test "x$with_grep_colors" != "x"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$with_grep_colors\"" >&5+$as_echo "\"$with_grep_colors\"" >&6; }+ EXTRA_CFLAGS="-DDEFAULT_GREP_COLORS=\"\\\"$with_grep_colors\\\"\" ${EXTRA_CFLAGS}"+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5+$as_echo "" >&6; } fi++# Check whether --enable-color was given.+if test "${enable_color+set}" = set; then :+ enableval=$enable_color; with_color="$enable_color"+else+ with_color="no" fi-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB-if test -n "$ac_ct_RANLIB"; then- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5-$as_echo "$ac_ct_RANLIB" >&6; }++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-color" >&5+$as_echo_n "checking for --enable-color... " >&6; }+if test "x$with_color" = "xyes"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ EXTRA_CFLAGS="-DWITH_COLOR ${EXTRA_CFLAGS}" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_RANLIB" = x; then- RANLIB=":"- else- case $cross_compiling:$ac_tool_warned in-yes:)-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}-ac_tool_warned=yes ;;-esac- RANLIB=$ac_ct_RANLIB- fi+# Check whether --enable-pager was given.+if test "${enable_pager+set}" = set; then :+ enableval=$enable_pager; with_pager="$enable_pager" else- RANLIB="$ac_cv_prog_RANLIB"+ with_pager="no" fi ---# Make sure we can run config.sub.-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||- as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5--{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5-$as_echo_n "checking build system type... " >&6; }-if ${ac_cv_build+:} false; then :- $as_echo_n "(cached) " >&6+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-pager" >&5+$as_echo_n "checking for --enable-pager... " >&6; }+if test "x$with_pager" = "xyes"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ EXTRA_CFLAGS="-DWITH_PAGER ${EXTRA_CFLAGS}" else- ac_build_alias=$build_alias-test "x$ac_build_alias" = x &&- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`-test "x$ac_build_alias" = x &&- as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; } fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5-$as_echo "$ac_cv_build" >&6; }-case $ac_cv_build in-*-*-*) ;;-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;-esac-build=$ac_cv_build-ac_save_IFS=$IFS; IFS='-'-set x $ac_cv_build-shift-build_cpu=$1-build_vendor=$2-shift; shift-# Remember, the first character of IFS is used to create $*,-# except with old shells:-build_os=$*-IFS=$ac_save_IFS-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5-$as_echo_n "checking host system type... " >&6; }-if ${ac_cv_host+:} false; then :- $as_echo_n "(cached) " >&6-else- if test "x$host_alias" = x; then- ac_cv_host=$ac_cv_build+# Check whether --enable-hidden was given.+if test "${enable_hidden+set}" = set; then :+ enableval=$enable_hidden; with_no_hidden="yes" else- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5+ with_no_hidden="no" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-hidden" >&5+$as_echo_n "checking for --disable-hidden... " >&6; }+if test "x$with_no_hidden" = "xno"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ EXTRA_CFLAGS="-DWITH_NO_HIDDEN ${EXTRA_CFLAGS}" fi-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5-$as_echo "$ac_cv_host" >&6; }-case $ac_cv_host in-*-*-*) ;;-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;-esac-host=$ac_cv_host-ac_save_IFS=$IFS; IFS='-'-set x $ac_cv_host-shift-host_cpu=$1-host_vendor=$2-shift; shift-# Remember, the first character of IFS is used to create $*,-# except with old shells:-host_os=$*-IFS=$ac_save_IFS-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac +# Check whether --enable-mmap was given.+if test "${enable_mmap+set}" = set; then :+ enableval=$enable_mmap; with_no_mmap="yes"+else+ with_no_mmap="no"+fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --disable-mmap" >&5+$as_echo_n "checking for --disable-mmap... " >&6; }+if test "x$with_no_mmap" = "xno"; then+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5+$as_echo "no" >&6; }+else+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5+$as_echo "yes" >&6; }+ EXTRA_CFLAGS="-DWITH_NO_MMAP ${EXTRA_CFLAGS}"+fi -PLATFORM=${host} ac_ext=cpp@@ -7066,10 +6687,6 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi-if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then- as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.-Usually this means the macro was only invoked conditionally." "$LINENO" 5-fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0
@@ -1,13 +1,38 @@ AC_INIT(ugrep,1.6) AM_INIT_AUTOMAKE([foreign]) AM_CONFIG_HEADER(config.h)-AC_COPYRIGHT([Copyright (C) 2019-2019 Robert van Engelen, Genivia Inc.])+AC_COPYRIGHT([Copyright (C) 2019-2020 Robert van Engelen, Genivia Inc.]) AC_CONFIG_MACRO_DIR([m4]) +AC_HEADER_DIRENT+AC_STRUCT_DIRENT_D_INO+AC_STRUCT_DIRENT_D_TYPE++AC_FUNC_MMAP++AC_TYPE_SIZE_T+AC_TYPE_SSIZE_T++AC_PROG_CXX+AM_PROG_AR+AC_PROG_RANLIB+AC_PROG_INSTALL++AC_CANONICAL_HOST++PLATFORM=${host}+AC_SUBST(PLATFORM)++# Mac OS X has slow memory mapped files so we're disabling mmap+case "$PLATFORM" in+ *-apple-*) EXTRA_CFLAGS="-DWITH_NO_MMAP ${EXTRA_CFLAGS}"+ ;;+esac+ AX_BOOST_REGEX -AX_CHECK_ZLIB([], [echo "libz not found: option -z disabled"])+AX_CHECK_ZLIB([], [echo "zlib not found: option -z disabled"]) AX_CHECK_BZLIB([], [echo "libbz2 not found: option -z won't decompress .bz and .bz2 files"]) @@ -36,7 +61,7 @@ AC_ARG_WITH(grep-colors, AC_MSG_CHECKING(for --with-grep-colors) if test "x$with_grep_colors" != "x"; then AC_MSG_RESULT("$with_grep_colors")- EXTRA_CFLAGS="-DDEFAULT_GREP_COLORS=\"\\\"$with_grep_colors\\\"\" ${EXTRA_FLAGS}"+ EXTRA_CFLAGS="-DDEFAULT_GREP_COLORS=\"\\\"$with_grep_colors\\\"\" ${EXTRA_CFLAGS}" else AC_MSG_RESULT() fi@@ -82,7 +107,7 @@ fi AC_ARG_ENABLE(mmap, [AC_HELP_STRING([--disable-mmap],- [disable mmap file reading unless explicitly enabled with --mmap])],+ [disable memory mapped files unless explicitly enabled with --mmap])], [with_no_mmap="yes"], [with_no_mmap="no"]) AC_MSG_CHECKING(for --disable-mmap)@@ -95,25 +120,6 @@ fi AC_SUBST(EXTRA_CFLAGS) -AC_HEADER_DIRENT-AC_STRUCT_DIRENT_D_INO-AC_STRUCT_DIRENT_D_TYPE--AC_FUNC_MMAP--AC_TYPE_SIZE_T-AC_TYPE_SSIZE_T--AC_PROG_CXX-AM_PROG_AR-AC_PROG_RANLIB-AC_PROG_INSTALL--AC_CANONICAL_HOST--PLATFORM=${host}-AC_SUBST(PLATFORM)- AC_LANG([C++]) AX_CXX_COMPILE_STDCXX_11([ext], [mandatory]) AC_SUBST([AM_CXXFLAGS], ["-Wall -Wunused -Wextra"])
@@ -273,7 +273,7 @@ the size of the match, counting bytes. .IP \fB%e\fR the ending byte offset of the match. .IP \fB%u\fR-select uniquely matched lines only unless option \fB-u\fR is used.+select unique lines only unless option \fB-u\fR is used. .IP \fB%,\fR if not the first match: a comma, same as \fB%[,]>\fR. .IP \fB%:\fR@@ -305,8 +305,9 @@ reverses the separator to the default separator or the separator specified by .PP Formatted output is written for each matching pattern, which means that a line may be output multiple times when patterns match more than once on the same-line. Use format field \fB%u\fR to output matching lines only once unless-option \fB-u\fR, \fB--ungroup\fR is used or when a newline is matched.+line. When field \fB%u\fR is found anywhere in the specified format string,+matching lines are output only once unless option \fB-u\fR, \fB--ungroup\fR is+used or when a newline is matched. .PP Additional formatting options: .IP \fB--format-begin\fR=\fIFORMAT\fR
@@ -1,4 +1,4 @@-.TH UGREP "1" "December 29, 2019" "ugrep 1.6.10" "User Commands"+.TH UGREP "1" "December 31, 2019" "ugrep 1.6.11" "User Commands" .SH NAME \fBugrep\fR -- universal file pattern searcher .SH SYNOPSIS@@ -694,7 +694,7 @@ the size of the match, counting bytes. .IP \fB%e\fR the ending byte offset of the match. .IP \fB%u\fR-select uniquely matched lines only unless option \fB-u\fR is used.+select unique lines only unless option \fB-u\fR is used. .IP \fB%,\fR if not the first match: a comma, same as \fB%[,]>\fR. .IP \fB%:\fR@@ -726,8 +726,9 @@ reverses the separator to the default separator or the separator specified by .PP Formatted output is written for each matching pattern, which means that a line may be output multiple times when patterns match more than once on the same-line. Use format field \fB%u\fR to output matching lines only once unless-option \fB-u\fR, \fB--ungroup\fR is used or when a newline is matched.+line. When field \fB%u\fR is found anywhere in the specified format string,+matching lines are output only once unless option \fB-u\fR, \fB--ungroup\fR is+used or when a newline is matched. .PP Additional formatting options: .IP \fB--format-begin\fR=\fIFORMAT\fR
@@ -18,9 +18,15 @@ skipping all matches of identifiers in comments and strings: Pattern files contain one or more regex patters, one pattern per line. Empty lines and lines starting with a `#` are ignored in pattern files. A starting-line with `###-o` auto-enables option `-o` for all patterns matched.+line with `###-o` auto-enables option `-o` for all patterns matched. Use `\#`+to define a pattern that starts with a `#` on a line. Patterns that requiring Unicode matching should be placed in Unicode mode with `(?u:X)`, just in case to prevent ugrep option `-U` from disabling them. +Some programming languages permit nested comments, e.g. rust, scala, and swift.+Comments with nested comments are truncated at the first nested `*/` when+matched with a regex pattern, because of the fundamental limitations of regular+expression matching.+ We love to receive your contributions to this effort! ❤️
@@ -3,8 +3,8 @@ C patterns Traditional C with non-Unicode identifiers. -- `comments` matches comment--u `defines` matches `#define` lines+- `comments` matches comments+- `defines` matches `#define` lines - `directives` matches #-directives - `doc_comments` matches Doxygen comments - `enums` matches enumerations
@@ -0,0 +1,21 @@+C++ patterns+============++C++ with Unicode identifiers.++- `classes` matches class definitions+- `comments` matches comments+- `defines` matches `#define` lines+- `directives` matches #-directives+- `doc_comments` matches Doxygen comments+- `enums` matches enumerations+- `functions` matches function definitions+- `includes` matches `#include` lines+- `names` matches identifiers (and keywords)+- `strings` matches strings+- `structs` matches struct definitions+- `typedefs` matches `typedef` lines+- `zap_commands` removes command keywords from matches+- `zap_comments` removes comments from matches+- `zap_directives` removes #-directive lines from matches+- `zap_strings` removes strings from matches
@@ -0,0 +1 @@+\<class\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1,2 @@+//.*+/\*([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1 @@+^\h*#\h*define\h+(.|\\\n)*
@@ -0,0 +1 @@+^\h*#\h*[[:word:]]+(.|\\\n)*
@@ -0,0 +1,2 @@+//[/!].*+/\*[*!]([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1 @@+\<enum\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1,2 @@+^(\h*[\w:*&]+)+\h+\w+\h*\([^)\n]*\)\h*(\{.*|[^{;\w\n]*)$+(?^^\h+(else|if|return|throw)\h+.*$)
@@ -0,0 +1,2 @@+^\h*#\h*include\h+(.|\\\n)*+
@@ -0,0 +1 @@+(?u:\p{UnicodeIdentifierStart}\p{UnicodeIdentifierPart}*)
@@ -0,0 +1,2 @@+"(\\.|\\\r?\n|[^\\\n"])*"+'(\\.|[^\\\n'])*'
@@ -0,0 +1 @@+\<struct\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<typedef\h+.*
@@ -0,0 +1 @@+(?^^.*[^[:word:]](asm|break|case|catch|continue|default|delete|do|else|for|goto|if|namespace|new|return|switch|throw|while)[^[:word:]].*$)
@@ -0,0 +1,2 @@+(?^//.*)+(?^/\*([^*]|(\*+[^*/]))*\*+\/)
@@ -0,0 +1 @@+(?^^\h*#\h*[[:word:]]+(.|\\\n)*)
@@ -0,0 +1,2 @@+(?^"(\\.|\\\r?\n|[^\\\n"])*")+(?^'(\\.|[^\\\n'])*')
@@ -0,0 +1,11 @@+C# patterns+===========++- `classes` matches class definitions+- `comments` matches comments+- `enums` matches enumerations+- `functions` matches function definitions+- `names` matches identifiers (and keywords)+- `strings` matches strings+- `zap_comments` removes comments from matches+- `zap_strings` removes strings from matches
@@ -0,0 +1 @@+\<class\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1,2 @@+//.*+/\*([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1,2 @@+//[/!].*+/\*[*!]([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1 @@+\<enum\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1,2 @@+^(\h*[\w:]+)+\h+\w+\h*\([^)\n]*\)\h*(\{.*|[^{;\w\n]*)$+(?^^\h+(else|if|return|throw)\h+.*$)
@@ -0,0 +1 @@+(?u:\p{JavaIdentifierStart}\p{JavaIdentifierPart}*)
@@ -0,0 +1,2 @@+"(\\.|\\\r?\n|[^\\\n"])*"+'(\\.|[^\\\n'])*'
@@ -0,0 +1,2 @@+(?^//.*)+(?^/\*([^*]|(\*+[^*/]))*\*+\/)
@@ -0,0 +1,2 @@+(?^"(\\.|\\\r?\n|[^\\\n"])*")+(?^'(\\.|[^\\\n'])*')
@@ -0,0 +1,11 @@+Perl patterns+=============++- `comments` matches comments+- `formats` matches format blocks+- `names` matches identifiers+- `strings` matches strings+- `subs` matches subroutine definitions+- `zap_comments` removes comments from matches+- `zap_formats` removes format blocks from matches+- `zap_strings` removes strings from matches
@@ -0,0 +1,2 @@+\#.*+^=[[:word:]](.|\n[^=]|\n=c[^u]|\n=cu[^t])*\n=cut
@@ -0,0 +1 @@+\<format\h+[[:word:]]+\h*=([^\n]|\n\h*[^.])*(\n\h*\.)
@@ -0,0 +1 @@+[$@%][[:word:]]*
@@ -0,0 +1,3 @@+"(\\.|[^\\"])*"+'(\\.|[^\\'])*'+\<v\d+(\.\d+)*
@@ -0,0 +1 @@+\<sub\h+[[:word:]]+
@@ -0,0 +1,2 @@+(?^\#.*)+(?^^=[[:word:]](.|\n[^=]|\n=c[^u]|\n=cu[^t])*\n=cut)
@@ -0,0 +1 @@+(?^\<format\h+[[:word:]]+\h*=([^\n]|\n\h*[^.])*(\n\h*\.))
@@ -0,0 +1,3 @@+(?^"(\\.|[^\\"])*")+(?^'(\\.|[^\\'])*')+(?^\<v\d+(\.\d+)*)
@@ -1 +1 @@-#.*+\#.*
@@ -1,2 +1,2 @@-#.*+\#.* ^=begin(.|\n[^=]|\n=e[^n]|\n=en[^d])*\n=end
@@ -0,0 +1,18 @@+Rust patterns+=============++- `comments` matches comments+- `crates` matches crate lines+- `enums` matches enum definitions+- `fns` matches function definitions+- `impls` matches implementation definitions+- `macros` matches `macro_rules!` definitions+- `mods` matches module definitions+- `names` matches identifiers (and keywords)+- `strings` matches strings+- `structs` matches struct definitions+- `traits` matches trait definitions+- `unions` matches union definitions+- `uses` matches use lines+- `zap_comments` removes comments from matches+- `zap_strings` removes strings from matches
@@ -0,0 +1,2 @@+//.*+/\*([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1 @@+\<crate\h+.*
@@ -0,0 +1 @@+\<enum\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<fn\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<impl\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<macro_rules!\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<mod\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+[[:alpha:]_][[:word:]]+
@@ -0,0 +1,2 @@+"(\\.|\\\r?\n|[^\\\n"])*"+'(\\.|[^\\\n'])*'
@@ -0,0 +1 @@+\<struct\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<trait\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<union\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<use\h+.*
@@ -0,0 +1,2 @@+(?^//.*)+(?^/\*([^*]|(\*+[^*/]))*\*+\/)
@@ -0,0 +1,2 @@+(?^"(\\.|\\\r?\n|[^\\\n"])*")+(?^'(\\.|[^\\\n'])*')
@@ -0,0 +1,13 @@+Scala patterns+==============++- `classes` matches class definitions+- `comments` matches comments+- `defs` matches functions+- `import` matches import lines+- `names` matches identifiers (and keywords)+- `objects` matches object definitions+- `packages` matches package lines+- `string` matches strings+- `zap_comments` removes comments from matches+- `zap_strings` removes strings from matches
@@ -0,0 +1 @@+\<class\h+[[:alpha:]_|[:word:]]+(_[-+*/%^<=>!&|?:~#]+)?
@@ -0,0 +1,2 @@+//.*+/\*([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1 @@+\<def\h+[[:alpha:]_|[:word:]]+(_[-+*/%^<=>!&|?:~#]+)?
@@ -0,0 +1 @@+\<import\h+.*
@@ -0,0 +1 @@+[[:alpha:]_|[:word:]]+(_[-+*/%^<=>!&|?:~#]+)?
@@ -0,0 +1 @@+\<object\h+[[:alpha:]_|[:word:]]+(_[-+*/%^<=>!&|?:~#]+)?
@@ -0,0 +1 @@+\<package\h+.*
@@ -0,0 +1,2 @@+"(\\.|\\\r?\n|[^\\\n"])*"+'(\\.|[^\\\n'])*'
@@ -0,0 +1,2 @@+(?^//.*)+(?^/\*([^*]|(\*+[^*/]))*\*+\/)
@@ -0,0 +1,2 @@+(?^"(\\.|\\\r?\n|[^\\\n"])*")+(?^'(\\.|[^\\\n'])*')
@@ -0,0 +1,13 @@+Swift patterns+==============++- `classes` matches class definitions+- `comments` matches comments+- `enums` matches enum definitions+- `funcs` matches func definitions+- `imports` matches import lines+- `names` matches identifiers (and keywords)+- `strings` matches strings+- `structs` matches struct definitions+- `zap_comments` removes comments from matches+- `zap_strings` removes strings from matches
@@ -0,0 +1 @@+\<class\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1,2 @@+//.*+/\*([^*]|(\*+[^*/]))*\*+\/
@@ -0,0 +1 @@+\<enum\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<func\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1 @@+\<import\h+.*
@@ -0,0 +1 @@+[[:alpha:]_][[:word:]]+
@@ -0,0 +1 @@+"(\\.|\\\r?\n|[^\\\n"])*"
@@ -0,0 +1 @@+\<struct\h+[^{\n]*(?=\{|\n\h*\{)
@@ -0,0 +1,2 @@+(?^//.*)+(?^/\*([^*]|(\*+[^*/]))*\*+\/)
@@ -0,0 +1 @@+(?^"(\\.|\\\r?\n|[^\\\n"])*")
@@ -74,7 +74,7 @@ Prebuilt executables are located in ugrep/bin. */ // ugrep version-#define UGREP_VERSION "1.6.10"+#define UGREP_VERSION "1.6.11" #include <reflex/input.h> #include <reflex/matcher.h>@@ -82,6 +82,7 @@ Prebuilt executables are located in ugrep/bin. #include <cctype> #include <cstring> #include <cerrno>+#include <limits> #include <algorithm> #include <functional> #include <list>@@ -93,29 +94,31 @@ Prebuilt executables are located in ugrep/bin. #include <mutex> #include <condition_variable> -// check if we are compiling for a windows OS+// check if we are compiling for a windows OS, but not Cygwin or MinGW #if (defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__BORLANDC__)) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) # define OS_WIN #endif +// compiling for a windows OS, except Cygwin and MinGW+ #ifdef OS_WIN // optionally enable --color=auto by default // #define WITH_COLOR -// optionally enable Boost.Regex+// optionally enable Boost.Regex for -P // #define HAVE_BOOST_REGEX -// optionally enable zlib+// optionally enable zlib for -z // #define HAVE_LIBZ -// optionally enable libbz2+// optionally enable libbz2 for -z // #define HAVE_LIBBZ2 -// optionally enable liblzma+// optionally enable liblzma for -z // #define HAVE_LIBLZMA -// because colors are dim in the Windows command window, use bold & bright except for context and separators+// because colors are dim in the Windows command window, use bold & bright except for context lines and separators #define DEFAULT_GREP_COLORS "sl=1;37:cx=33:mt=1;31:fn=1;35:ln=1;32:cn=1;32:bn=1;32:se=36" // disable min/max macros to use std::min and std::max@@ -153,6 +156,8 @@ int pipe(int fd[2]) #else +// not compiling for a windows OS+ #include <dirent.h> #include <stdio.h> #include <signal.h>@@ -172,22 +177,34 @@ int pipe(int fd[2]) #endif +// platform -- see configure.ac+#if !defined(PLATFORM)+# if defined(OS_WIN)+# if defined(_WIN32)+# define PLATFORM "WIN32"+# elif defined(_WIN64)+# define PLATFORM "WIN64"+# else+# define PLATFORM "WIN"+# endif+# else+# define PLATFORM ""+# endif+#endif++// fast gitignore-style glob matching #include "glob.hpp" +// use Boost.Regex for option -P #ifdef HAVE_BOOST_REGEX #include <reflex/boostmatcher.h> #endif +// use zlib, libbz2, liblzma for option -z #ifdef HAVE_LIBZ #include "zstream.hpp" #endif -#ifdef WITH_COLOR-#define FLAG_COLOR "auto"-#else-#define FLAG_COLOR NULL-#endif- // use a task-parallel thread to decompress the stream into a pipe to search, increases speed on most systems #define WITH_DECOMPRESSION_THREAD @@ -210,6 +227,13 @@ int pipe(int fd[2]) #define DEFAULT_IGNORE_FILE ".gitignore" #endif +// color is disabled by default, unless enabled with WITH_COLOR+#ifdef WITH_COLOR+#define FLAG_COLOR "auto"+#else+#define FLAG_COLOR NULL+#endif+ // pager is disabled by default, unless enabled with WITH_PAGER #ifdef WITH_PAGER #define FLAG_PAGER DEFAULT_PAGER@@ -217,21 +241,6 @@ int pipe(int fd[2]) #define FLAG_PAGER NULL #endif -// ugrep platform -- see configure.ac-#if !defined(PLATFORM)-# if defined(OS_WIN)-# if defined(_WIN32)-# define PLATFORM "WIN32"-# elif defined(_WIN64)-# define PLATFORM "WIN64"-# else-# define PLATFORM "WIN"-# endif-# else-# define PLATFORM ""-# endif-#endif- // ugrep exit codes #define EXIT_OK 0 // One or more lines were selected #define EXIT_FAIL 1 // No lines were selected@@ -255,7 +264,7 @@ int pipe(int fd[2]) // --min-mmap and --max-mmap file size to allocate with mmap(), not greater than 4294967295LL, max 0 disables mmap() #ifndef MIN_MMAP_SIZE-#define MIN_MMAP_SIZE 16384+#define MIN_MMAP_SIZE 16384LL #endif #ifndef MAX_MMAP_SIZE #define MAX_MMAP_SIZE 2147483648LL@@ -768,24 +777,19 @@ bool MMap::file(reflex::Input& input, const char*& base, size_t& size) // is this a regular file that is not too large (for size_t)? int fd = fileno(file); struct stat buf;- if (fstat(fd, &buf) != 0 || !S_ISREG(buf.st_mode) || buf.st_size > MAX_MMAP_SIZE)+ if (fstat(fd, &buf) != 0 || !S_ISREG(buf.st_mode) || static_cast<unsigned long long>(buf.st_size) > static_cast<unsigned long long>(std::numeric_limits<size_t>::max())) return false; - // is this file not too small or too large?+ // is this file not too small or too large? if -P is used, try to mmap a large file without imposing a max size = static_cast<size_t>(buf.st_size);- if (size < flag_min_mmap || size > flag_max_mmap)+ if (size < flag_min_mmap || (size > flag_max_mmap && !flag_perl_regexp)) return false; - // mmap the file+ // mmap the file and round requested size up to 4K (typical page size) if (mmap_base == NULL || mmap_size < size)- {- mmap_size = (size + 0xfff) & ~0xfffUL; // round up to 4K page size- base = static_cast<const char*>(mmap_base = mmap(mmap_base, mmap_size, PROT_READ, MAP_PRIVATE, fd, 0));- }- else- {- base = static_cast<const char*>(mmap_base = mmap(mmap_base, mmap_size, PROT_READ, MAP_FIXED | MAP_PRIVATE, fd, 0));- }+ mmap_size = (size + 0xfff) & ~0xfffUL;++ base = static_cast<const char*>(mmap_base = mmap(mmap_base, mmap_size, PROT_READ, MAP_PRIVATE, fd, 0)); // mmap OK? if (mmap_base != MAP_FAILED)@@ -2864,11 +2868,9 @@ struct Grep { { matcher->input(input); -#ifdef HAVE_BOOST_REGEX- // buffer all input to work around Boost.Regex bug+ // buffer all input to work around Boost.Regex bug, this may throw std::bad_alloc if the file is too large if (flag_perl_regexp) matcher->buffer();-#endif } // -K=NUM1[,NUM2]: start searching at line NUM1@@ -4216,19 +4218,19 @@ int main(int argc, char **argv) { flag_format_begin = "const struct grep {\n const char *file;\n size_t line;\n size_t column;\n size_t offset;\n const char *match;\n} matches[] = {\n"; flag_format_open = " // %f\n";- flag_format = " { %h, %n, %k, %b, %C },\n";+ flag_format = " { %h, %n, %k, %b, %C },\n%u"; flag_format_close = " \n"; flag_format_end = " { NULL, 0, 0, 0, NULL }\n};\n"; } else if (flag_csv) {- flag_format = "%[,]$%H%N%K%B%V\n";+ flag_format = "%[,]$%H%N%K%B%V\n%u"; } else if (flag_json) { flag_format_begin = "["; flag_format_open = "%,\n {\n %[,\n ]$%[\"file\": ]H\"matches\": [";- flag_format = "%,\n { %[, ]$%[\"line\": ]N%[\"column\": ]K%[\"offset\": ]B\"match\": %J }";+ flag_format = "%,\n { %[, ]$%[\"line\": ]N%[\"column\": ]K%[\"offset\": ]B\"match\": %J }%u"; flag_format_close = "\n ]\n }"; flag_format_end = "\n]\n"; }@@ -4236,7 +4238,7 @@ int main(int argc, char **argv) { flag_format_begin = "<grep>\n"; flag_format_open = " <file%[]$%[ name=]H>\n";- flag_format = " <match%[\"]$%[ line=\"]N%[ column=\"]K%[ offset=\"]B>%X</match>\n";+ flag_format = " <match%[\"]$%[ line=\"]N%[ column=\"]K%[ offset=\"]B>%X</match>\n%u"; flag_format_close = " </file>\n"; flag_format_end = "</grep>\n"; }@@ -5425,44 +5427,135 @@ void Grep::search(const char *pathname) // -z: loop over extracted archive parts, when applicable do {- size_t matches = 0;-- if (flag_quiet || flag_files_with_match)+ try {- // -q, -l, or -L: report if a single pattern match was found in the input+ size_t matches = 0;++ if (flag_quiet || flag_files_with_match)+ {+ // -q, -l, or -L: report if a single pattern match was found in the input++ read_file();++ matches = matcher->find() != 0; - read_file();+ // -K: max line exceeded?+ if (flag_max_line > 0 && matcher->lineno() > flag_max_line)+ matches = 0; - matches = matcher->find() != 0;+ if (flag_invert_match)+ matches = !matches; - // -K: max line exceeded?- if (flag_max_line > 0 && matcher->lineno() > flag_max_line)- matches = 0;+ if (matches > 0)+ {+ // --format-open or format-close: acquire lock early before stats.found()+ if (flag_files_with_match && (flag_format_open != NULL || flag_format_close != NULL))+ out.acquire(); - if (flag_invert_match)- matches = !matches;+ if (!stats.found())+ goto exit_search; - if (matches > 0)+ // -l or -L+ if (flag_files_with_match)+ {+ if (flag_format != NULL)+ {+ if (flag_format_open != NULL)+ out.format(flag_format_open, pathname, partname, stats.found_files(), matcher);+ out.format(flag_format, pathname, partname, 1, matcher);+ if (flag_format_close != NULL)+ out.format(flag_format_close, pathname, partname, stats.found_files(), matcher);+ }+ else+ {+ out.str(color_fn);+ out.str(pathname);+ if (!partname.empty())+ {+ out.chr('{');+ out.str(partname);+ out.chr('}');+ }+ out.str(color_off);+ out.chr(flag_null ? '\0' : '\n');+ }+ }+ }+ }+ else if (flag_count) {- // --format-open or format-close: acquire lock early before stats.found()- if (flag_files_with_match && (flag_format_open != NULL || flag_format_close != NULL))- out.acquire();+ // -c: count the number of lines/patterns matched++ if (flag_ungroup || flag_only_matching)+ {+ // -co or -cu: count the number of patterns matched in the file++ read_file(); - if (!stats.found())- goto exit_search;+ while (matcher->find() != 0)+ {+ // -K: max line exceeded?+ if (flag_max_line > 0 && matcher->lineno() > flag_max_line)+ break;++ ++matches; - // -l or -L- if (flag_files_with_match)+ // -m: max number of matches reached?+ if (flag_max_count > 0 && matches >= flag_max_count)+ break;+ }+ }+ else {- if (flag_format != NULL)+ // -c without -o/-u: count the number of matching lines++ size_t lineno = 0;++ read_file();++ while (matcher->find()) {- if (flag_format_open != NULL)- out.format(flag_format_open, pathname, partname, stats.found_files(), matcher);- out.format(flag_format, pathname, partname, 1, matcher);- if (flag_format_close != NULL)- out.format(flag_format_close, pathname, partname, stats.found_files(), matcher);+ size_t current_lineno = matcher->lineno();++ if (lineno != current_lineno)+ {+ // -K: max line exceeded?+ if (flag_max_line > 0 && current_lineno > flag_max_line)+ break;++ ++matches;++ // -m: max number of matches reached?+ if (flag_max_count > 0 && matches >= flag_max_count)+ break;++ lineno = current_lineno;+ } }- else++ if (flag_invert_match)+ matches = matcher->lineno() - matches - 1;+ }++ // --format: acquire lock early before stats.found()+ if (flag_format_open != NULL || flag_format_close != NULL)+ out.acquire();++ if (matches > 0 || flag_format_open != NULL || flag_format_close != NULL)+ if (!stats.found())+ goto exit_search;++ if (flag_format != NULL)+ {+ if (flag_format_open != NULL)+ out.format(flag_format_open, pathname, partname, stats.found_files(), matcher);+ out.format(flag_format, pathname, partname, matches, matcher);+ if (flag_format_close != NULL)+ out.format(flag_format_close, pathname, partname, stats.found_files(), matcher);+ }+ else+ {+ if (flag_with_filename || !partname.empty()) { out.str(color_fn); out.str(pathname);@@ -5473,39 +5566,71 @@ void Grep::search(const char *pathname) out.chr('}'); } out.str(color_off);- out.chr(flag_null ? '\0' : '\n');++ if (flag_null)+ {+ out.chr('\0');+ }+ else+ {+ out.str(color_se);+ out.str(flag_separator);+ out.str(color_off);+ } }+ out.num(matches);+ out.chr('\n'); } }- }- else if (flag_count)- {- // -c: count the number of lines/patterns matched-- if (flag_ungroup || flag_only_matching)+ else if (flag_format != NULL) {- // -co or -cu: count the number of patterns matched in the file+ // --format read_file(); - while (matcher->find() != 0)+ while (matcher->find()) { // -K: max line exceeded? if (flag_max_line > 0 && matcher->lineno() > flag_max_line) break; + // output --format-open+ if (matches == 0)+ {+ // --format-open or --format-close: acquire lock early before stats.found()+ if (flag_format_open != NULL || flag_format_close != NULL)+ out.acquire();++ if (!stats.found())+ goto exit_search;++ if (flag_format_open != NULL)+ out.format(flag_format_open, pathname, partname, stats.found_files(), matcher);+ }+ ++matches; + // output --format+ out.format(flag_format, pathname, partname, matches, matcher);+ // -m: max number of matches reached? if (flag_max_count > 0 && matches >= flag_max_count) break;++ if (flag_line_buffered)+ out.flush(); }++ // output --format-close+ if (matches > 0 && flag_format_close != NULL)+ out.format(flag_format_close, pathname, partname, stats.found_files(), matcher); }- else+ else if (flag_only_line_number) {- // -c without -o/-u: count the number of matching lines+ // --only-line-number size_t lineno = 0;+ const char *separator = flag_separator; read_file(); @@ -5513,398 +5638,342 @@ void Grep::search(const char *pathname) { size_t current_lineno = matcher->lineno(); - if (lineno != current_lineno)+ separator = lineno != current_lineno ? flag_separator : "+";++ if (lineno != current_lineno || flag_ungroup) { // -K: max line exceeded? if (flag_max_line > 0 && current_lineno > flag_max_line) break; + if (matches == 0)+ if (!stats.found())+ goto exit_search;+ ++matches; + out.header(pathname, partname, current_lineno, matcher, matcher->first(), separator, true);+ // -m: max number of matches reached? if (flag_max_count > 0 && matches >= flag_max_count) break; + // output blocked?+ if (out.eof)+ goto exit_search;+ lineno = current_lineno; } }-- if (flag_invert_match)- matches = matcher->lineno() - matches - 1;- }-- // --format: acquire lock early before stats.found()- if (flag_format_open != NULL || flag_format_close != NULL)- out.acquire();-- if (matches > 0 || flag_format_open != NULL || flag_format_close != NULL)- if (!stats.found())- goto exit_search;-- if (flag_format != NULL)- {- if (flag_format_open != NULL)- out.format(flag_format_open, pathname, partname, stats.found_files(), matcher);- out.format(flag_format, pathname, partname, matches, matcher);- if (flag_format_close != NULL)- out.format(flag_format_close, pathname, partname, stats.found_files(), matcher); }- else+ else if (flag_only_matching) {- if (flag_with_filename || !partname.empty())- {- out.str(color_fn);- out.str(pathname);- if (!partname.empty())- {- out.chr('{');- out.str(partname);- out.chr('}');- }- out.str(color_off);-- if (flag_null)- {- out.chr('\0');- }- else- {- out.str(color_se);- out.str(flag_separator);- out.str(color_off);- }- }- out.num(matches);- out.chr('\n');- }- }- else if (flag_format != NULL)- {- // --format+ // -o - read_file();+ bool hex = false;+ size_t lineno = 0; - while (matcher->find())- {- // -K: max line exceeded?- if (flag_max_line > 0 && matcher->lineno() > flag_max_line)- break;+ read_file(); - // output --format-open- if (matches == 0)+ while (matcher->find()) {- // --format-open or --format-close: acquire lock early before stats.found()- if (flag_format_open != NULL || flag_format_close != NULL)- out.acquire();+ const char *begin = matcher->begin();+ size_t size = matcher->size(); - if (!stats.found())- goto exit_search;+ bool binary = flag_hex || (!flag_text && is_binary(begin, size)); - if (flag_format_open != NULL)- out.format(flag_format_open, pathname, partname, stats.found_files(), matcher);- }+ size_t current_lineno = matcher->lineno(); - ++matches;+ if (lineno != current_lineno || flag_ungroup)+ {+ // -K: max line exceeded?+ if (flag_max_line > 0 && current_lineno > flag_max_line)+ break; - // output --format- out.format(flag_format, pathname, partname, matches, matcher);+ if (matches == 0)+ if (!stats.found())+ goto exit_search; - // -m: max number of matches reached?- if (flag_max_count > 0 && matches >= flag_max_count)- break;+ // -m: max number of matches reached?+ if (flag_max_count > 0 && matches >= flag_max_count)+ break; - if (flag_line_buffered)- out.flush();- }+ // output blocked?+ if (out.eof)+ goto exit_search; - // output --format-close- if (matches > 0 && flag_format_close != NULL)- out.format(flag_format_close, pathname, partname, stats.found_files(), matcher);- }- else if (flag_only_line_number)- {- // --only-line-number+ ++matches; - size_t lineno = 0;- const char *separator = flag_separator;+ if (binary && !flag_hex && !flag_with_hex)+ {+ if (flag_binary_without_matches)+ {+ matches = 0;+ }+ else+ {+ out.binary_file_matches(pathname, partname);+ matches = 1;+ } - read_file();+ goto done_search;+ } - while (matcher->find())- {- size_t current_lineno = matcher->lineno();+ if (!flag_no_header)+ {+ if (hex && out.dump.offset < matcher->first())+ out.dump.done(flag_separator);+ hex = false; - separator = lineno != current_lineno ? flag_separator : "+";+ const char *separator = lineno != current_lineno ? flag_separator : "+"; - if (lineno != current_lineno || flag_ungroup)- {- // -K: max line exceeded?- if (flag_max_line > 0 && current_lineno > flag_max_line)- break;+ out.header(pathname, partname, current_lineno, matcher, matcher->first(), separator, binary);+ } - if (matches == 0)- if (!stats.found())- goto exit_search;+ lineno = current_lineno;+ } - ++matches;+ if (binary)+ {+ if (flag_hex || flag_with_hex)+ {+ if (hex)+ out.dump.next(matcher->first(), flag_separator); - out.header(pathname, partname, current_lineno, matcher, matcher->first(), separator, true);+ out.dump.hex(Output::Dump::HEX_MATCH, matcher->first(), begin, size, flag_separator);+ hex = true;+ }+ else+ {+ if (flag_binary_without_matches)+ {+ matches = 0;+ }+ else+ {+ out.binary_file_matches(pathname, partname);+ matches = 1;+ } - // -m: max number of matches reached?- if (flag_max_count > 0 && matches >= flag_max_count)- break;-- // output blocked?- if (out.eof)- goto exit_search;-- lineno = current_lineno;- }- }- }- else if (flag_only_matching)- {- // -o-- bool hex = false;- size_t lineno = 0;-- read_file();-- while (matcher->find())- {- const char *begin = matcher->begin();- size_t size = matcher->size();-- bool binary = flag_hex || (!flag_text && is_binary(begin, size));-- size_t current_lineno = matcher->lineno();-- if (lineno != current_lineno || flag_ungroup)- {- // -K: max line exceeded?- if (flag_max_line > 0 && current_lineno > flag_max_line)- break;-- if (matches == 0)- if (!stats.found())- goto exit_search;-- // -m: max number of matches reached?- if (flag_max_count > 0 && matches >= flag_max_count)- break;-- // output blocked?- if (out.eof)- goto exit_search;-- ++matches;-- if (binary && !flag_hex && !flag_with_hex)- {- if (flag_binary_without_matches)- {- matches = 0;- }- else- {- out.binary_file_matches(pathname, partname);- matches = 1;+ goto done_search; }-- goto done_search; }-- if (!flag_no_header)+ else { if (hex && out.dump.offset < matcher->first()) out.dump.done(flag_separator); hex = false; - const char *separator = lineno != current_lineno ? flag_separator : "+";-- out.header(pathname, partname, current_lineno, matcher, matcher->first(), separator, binary);- }-- lineno = current_lineno;- }-- if (binary)- {- if (flag_hex || flag_with_hex)- {- if (hex)- out.dump.next(matcher->first(), flag_separator);-- out.dump.hex(Output::Dump::HEX_MATCH, matcher->first(), begin, size, flag_separator);- hex = true;- }- else- {- if (flag_binary_without_matches)- {- matches = 0;- }- else+ if (!flag_no_header) {- out.binary_file_matches(pathname, partname);- matches = 1;- }+ // -o with -n: echo multi-line matches line-by-line - goto done_search;- }- }- else- {- if (hex && out.dump.offset < matcher->first())- out.dump.done(flag_separator);- hex = false;-- if (!flag_no_header)- {- // -o with -n: echo multi-line matches line-by-line+ const char *from = begin;+ const char *to; - const char *from = begin;- const char *to;+ while ((to = static_cast<const char*>(memchr(from, '\n', size - (from - begin)))) != NULL)+ {+ out.str(color_ms);+ out.str(from, to - from + 1);+ out.str(color_off); - while ((to = static_cast<const char*>(memchr(from, '\n', size - (from - begin)))) != NULL)- {- out.str(color_ms);- out.str(from, to - from + 1);- out.str(color_off);+ if (to + 1 <= begin + size)+ out.header(pathname, partname, ++lineno, NULL, matcher->first() + (to - begin) + 1, "|", false); - if (to + 1 <= begin + size)- out.header(pathname, partname, ++lineno, NULL, matcher->first() + (to - begin) + 1, "|", false);+ from = to + 1;+ } - from = to + 1;+ size -= from - begin;+ begin = from; } - size -= from - begin;- begin = from;- }+ out.str(color_ms);+ out.str(begin, size);+ out.str(color_off); - out.str(color_ms);- out.str(begin, size);- out.str(color_off);+ if (size == 0 || begin[size - 1] != '\n')+ out.chr('\n');+ } - if (size == 0 || begin[size - 1] != '\n')- out.chr('\n');+ if (flag_line_buffered)+ out.flush(); } - if (flag_line_buffered)- out.flush();+ if (hex)+ out.dump.done(flag_separator); }+ else if (flag_before_context == 0 && flag_after_context == 0 && !flag_any_line && !flag_invert_match)+ {+ // options -A, -B, -C, -y, -v are not specified - if (hex)- out.dump.done(flag_separator);- }- else if (flag_before_context == 0 && flag_after_context == 0 && !flag_any_line && !flag_invert_match)- {- // options -A, -B, -C, -y, -v are not specified-- bool binary = false;- std::string rest_line;- const char *rest_line_data = NULL;- size_t rest_line_size = 0;- size_t rest_line_last = 0;- size_t lineno = 0;-- read_file();+ bool binary = false;+ std::string rest_line;+ const char *rest_line_data = NULL;+ size_t rest_line_size = 0;+ size_t rest_line_last = 0;+ size_t lineno = 0; - while (matcher->find())- {- size_t current_lineno = matcher->lineno();+ read_file(); - if (lineno != current_lineno || flag_ungroup)+ while (matcher->find()) {- if (rest_line_data != NULL)+ size_t current_lineno = matcher->lineno();++ if (lineno != current_lineno || flag_ungroup) {- if (binary)+ if (rest_line_data != NULL) {- out.dump.hex(Output::Dump::HEX_LINE, rest_line_last, rest_line_data, rest_line_size, flag_separator);- out.dump.done(flag_separator);- }- else- {- if (rest_line_size > 0)+ if (binary) {- out.str(color_sl);- if (rest_line_data[rest_line_size - 1] == '\n')- out.str(rest_line_data, rest_line_size - 1);- else- out.str(rest_line_data, rest_line_size);- out.str(color_off);- out.nl();+ out.dump.hex(Output::Dump::HEX_LINE, rest_line_last, rest_line_data, rest_line_size, flag_separator);+ out.dump.done(flag_separator);+ }+ else+ {+ if (rest_line_size > 0)+ {+ out.str(color_sl);+ if (rest_line_data[rest_line_size - 1] == '\n')+ out.str(rest_line_data, rest_line_size - 1);+ else+ out.str(rest_line_data, rest_line_size);+ out.str(color_off);+ out.nl();+ } }++ rest_line_data = NULL; } - rest_line_data = NULL;- }+ // -K: max line exceeded?+ if (flag_max_line > 0 && current_lineno > flag_max_line)+ break; - // -K: max line exceeded?- if (flag_max_line > 0 && current_lineno > flag_max_line)- break;+ if (matches == 0)+ if (!stats.found())+ goto exit_search; - if (matches == 0)- if (!stats.found())+ // -m: max number of matches reached?+ if (flag_max_count > 0 && matches >= flag_max_count)+ break;++ // output blocked?+ if (out.eof) goto exit_search; - // -m: max number of matches reached?- if (flag_max_count > 0 && matches >= flag_max_count)- break;+ const char *eol = matcher->eol(true); // warning: call eol() before bol()+ const char *bol = matcher->bol(); - // output blocked?- if (out.eof)- goto exit_search;+ binary = flag_hex || (!flag_text && is_binary(bol, eol - bol)); - const char *eol = matcher->eol(true); // warning: call eol() before bol()- const char *bol = matcher->bol();+ ++matches; - binary = flag_hex || (!flag_text && is_binary(bol, eol - bol));+ if (binary && !flag_hex && !flag_with_hex)+ {+ if (flag_binary_without_matches)+ {+ matches = 0;+ }+ else+ {+ out.binary_file_matches(pathname, partname);+ matches = 1;+ } - ++matches;+ goto done_search;+ } - if (binary && !flag_hex && !flag_with_hex)- {- if (flag_binary_without_matches)+ if (!flag_no_header) {- matches = 0;+ const char *separator = lineno != current_lineno ? flag_separator : "+";++ out.header(pathname, partname, current_lineno, matcher, matcher->first(), separator, binary); }- else++ lineno = current_lineno;++ size_t border = matcher->border();+ size_t first = matcher->first();+ const char *begin = matcher->begin();+ const char *end = matcher->end();+ size_t size = matcher->size();++ if (binary) {- out.binary_file_matches(pathname, partname);- matches = 1;+ if (flag_hex || flag_with_hex)+ {+ out.dump.hex(Output::Dump::HEX_LINE, first - border, bol, border, flag_separator);+ out.dump.hex(Output::Dump::HEX_MATCH, first, begin, size, flag_separator);++ if (flag_ungroup)+ {+ out.dump.hex(Output::Dump::HEX_LINE, matcher->last(), end, eol - end, flag_separator);+ out.dump.done(flag_separator);+ }+ else+ {+ rest_line.assign(end, eol - end);+ rest_line_data = rest_line.c_str();+ rest_line_size = rest_line.size();+ rest_line_last = matcher->last();+ }+ } }+ else+ {+ out.str(color_sl);+ out.str(bol, border);+ out.str(color_off); - goto done_search;- }+ if (!flag_no_header)+ {+ // -n: echo multi-line matches line-by-line - if (!flag_no_header)- {- const char *separator = lineno != current_lineno ? flag_separator : "+";+ const char *from = begin;+ const char *to;+ size_t num = 1; - out.header(pathname, partname, current_lineno, matcher, matcher->first(), separator, binary);- }+ while ((to = static_cast<const char*>(memchr(from, '\n', size - (from - begin)))) != NULL)+ {+ out.str(color_ms);+ out.str(from, to - from + 1);+ out.str(color_off); - lineno = current_lineno;+ if (to + 1 <= begin + size)+ out.header(pathname, partname, lineno + num, NULL, first + (to - begin) + 1, "|", false); - size_t border = matcher->border();- size_t first = matcher->first();- const char *begin = matcher->begin();- const char *end = matcher->end();- size_t size = matcher->size();+ from = to + 1;+ ++num;+ } - if (binary)- {- if (flag_hex || flag_with_hex)- {- out.dump.hex(Output::Dump::HEX_LINE, first - border, bol, border, flag_separator);- out.dump.hex(Output::Dump::HEX_MATCH, first, begin, size, flag_separator);+ size -= from - begin;+ begin = from;+ }++ out.str(color_ms);+ out.str(begin, size);+ out.str(color_off); if (flag_ungroup) {- out.dump.hex(Output::Dump::HEX_LINE, matcher->last(), end, eol - end, flag_separator);- out.dump.done(flag_separator);+ if (eol > end)+ {+ out.str(color_sl);+ if (end[eol - end - 1] == '\n')+ out.str(end, eol - end - 1);+ else+ out.str(end, eol - end);+ out.str(color_off);+ out.nl();+ }+ else if (matcher->hit_end())+ {+ out.nl();+ }+ else if (flag_line_buffered)+ {+ out.flush();+ } } else {@@ -5914,828 +5983,715 @@ void Grep::search(const char *pathname) rest_line_last = matcher->last(); } }++ lineno += matcher->lines() - 1; } else {- out.str(color_sl);- out.str(bol, border);- out.str(color_off);+ size_t size = matcher->size(); - if (!flag_no_header)+ if (size > 0) {- // -n: echo multi-line matches line-by-line-- const char *from = begin;- const char *to;- size_t num = 1;+ size_t lines = matcher->lines(); - while ((to = static_cast<const char*>(memchr(from, '\n', size - (from - begin)))) != NULL)+ if (lines > 1 || flag_color) {- out.str(color_ms);- out.str(from, to - from + 1);- out.str(color_off);-- if (to + 1 <= begin + size)- out.header(pathname, partname, lineno + num, NULL, first + (to - begin) + 1, "|", false);-- from = to + 1;- ++num;- }-- size -= from - begin;- begin = from;- }+ size_t first = matcher->first();+ size_t last = matcher->last();+ const char *begin = matcher->begin(); - out.str(color_ms);- out.str(begin, size);- out.str(color_off);-- if (flag_ungroup)- {- if (eol > end)- {- out.str(color_sl);- if (end[eol - end - 1] == '\n')- out.str(end, eol - end - 1);+ if (binary)+ {+ out.dump.hex(Output::Dump::HEX_LINE, rest_line_last, rest_line_data, first - rest_line_last, flag_separator);+ out.dump.hex(Output::Dump::HEX_MATCH, first, begin, size, flag_separator);+ } else- out.str(end, eol - end);- out.str(color_off);- out.nl();- }- else if (matcher->hit_end())- {- out.nl();- }- else if (flag_line_buffered)- {- out.flush();- }- }- else- {- rest_line.assign(end, eol - end);- rest_line_data = rest_line.c_str();- rest_line_size = rest_line.size();- rest_line_last = matcher->last();- }- }-- lineno += matcher->lines() - 1;- }- else- {- size_t size = matcher->size();-- if (size > 0)- {- size_t lines = matcher->lines();-- if (lines > 1 || flag_color)- {- size_t first = matcher->first();- size_t last = matcher->last();- const char *begin = matcher->begin();-- if (binary)- {- out.dump.hex(Output::Dump::HEX_LINE, rest_line_last, rest_line_data, first - rest_line_last, flag_separator);- out.dump.hex(Output::Dump::HEX_MATCH, first, begin, size, flag_separator);- }- else- {- out.str(color_sl);- out.str(rest_line_data, first - rest_line_last);- out.str(color_off);-- if (lines > 1 && !flag_no_header) {- // -n: echo multi-line matches line-by-line-- const char *from = begin;- const char *to;- size_t num = 1;+ out.str(color_sl);+ out.str(rest_line_data, first - rest_line_last);+ out.str(color_off); - while ((to = static_cast<const char*>(memchr(from, '\n', size - (from - begin)))) != NULL)+ if (lines > 1 && !flag_no_header) {- out.str(color_ms);- out.str(from, to - from + 1);- out.str(color_off);+ // -n: echo multi-line matches line-by-line - if (to + 1 <= begin + size)- out.header(pathname, partname, lineno + num, NULL, first + (to - begin) + 1, "|", false);+ const char *from = begin;+ const char *to;+ size_t num = 1; - from = to + 1;- ++num;- }+ while ((to = static_cast<const char*>(memchr(from, '\n', size - (from - begin)))) != NULL)+ {+ out.str(color_ms);+ out.str(from, to - from + 1);+ out.str(color_off); - size -= from - begin;- begin = from;- }+ if (to + 1 <= begin + size)+ out.header(pathname, partname, lineno + num, NULL, first + (to - begin) + 1, "|", false); - out.str(color_ms);- out.str(begin, size);- out.str(color_off);- }+ from = to + 1;+ ++num;+ } - if (lines == 1)- {- rest_line_data += last - rest_line_last;- rest_line_size -= last - rest_line_last;- rest_line_last = last;- }- else- {- const char *eol = matcher->eol(true); // warning: call eol() before bol()- const char *end = matcher->end();+ size -= from - begin;+ begin = from;+ } - bool rest_binary = flag_hex || (!flag_text && is_binary(end, eol - end));+ out.str(color_ms);+ out.str(begin, size);+ out.str(color_off);+ } - if (binary && !rest_binary)+ if (lines == 1) {- out.dump.done(flag_separator);- out.header(pathname, partname, lineno + lines - 1, matcher, last, flag_separator, false);+ rest_line_data += last - rest_line_last;+ rest_line_size -= last - rest_line_last;+ rest_line_last = last; }- else if (!binary && rest_binary)+ else {- out.nl();- out.header(pathname, partname, lineno + lines - 1, matcher, last, flag_separator, true);- }+ const char *eol = matcher->eol(true); // warning: call eol() before bol()+ const char *end = matcher->end(); - binary = rest_binary;+ bool rest_binary = flag_hex || (!flag_text && is_binary(end, eol - end)); - if (flag_ungroup)- {- if (binary)+ if (binary && !rest_binary) {- out.dump.hex(Output::Dump::HEX_LINE, matcher->last(), end, eol - end, flag_separator); out.dump.done(flag_separator);+ out.header(pathname, partname, lineno + lines - 1, matcher, last, flag_separator, false); }- else+ else if (!binary && rest_binary) {- if (eol > end)- {- out.str(color_sl);- if (end[eol - end - 1] == '\n')- out.str(end, eol - end - 1);- else- out.str(end, eol - end);- out.str(color_off);- out.nl();- }- else if (matcher->hit_end())+ out.nl();+ out.header(pathname, partname, lineno + lines - 1, matcher, last, flag_separator, true);+ }++ binary = rest_binary;++ if (flag_ungroup)+ {+ if (binary) {- out.nl();+ out.dump.hex(Output::Dump::HEX_LINE, matcher->last(), end, eol - end, flag_separator);+ out.dump.done(flag_separator); }- else if (flag_line_buffered)+ else {- out.flush();+ if (eol > end)+ {+ out.str(color_sl);+ if (end[eol - end - 1] == '\n')+ out.str(end, eol - end - 1);+ else+ out.str(end, eol - end);+ out.str(color_off);+ out.nl();+ }+ else if (matcher->hit_end())+ {+ out.nl();+ }+ else if (flag_line_buffered)+ {+ out.flush();+ } } }- }- else- {- rest_line.assign(end, eol - end);- rest_line_data = rest_line.c_str();- rest_line_size = rest_line.size();- rest_line_last = last;- }+ else+ {+ rest_line.assign(end, eol - end);+ rest_line_data = rest_line.c_str();+ rest_line_size = rest_line.size();+ rest_line_last = last;+ } - lineno += lines - 1;+ lineno += lines - 1;+ } } } } }- }-- if (rest_line_data != NULL)- {- if (binary)- {- out.dump.hex(Output::Dump::HEX_LINE, rest_line_last, rest_line_data, rest_line_size, flag_separator);- }- else- {- if (rest_line_size > 0)- {- out.str(color_sl);- if (rest_line_data[rest_line_size - 1] == '\n')- out.str(rest_line_data, rest_line_size - 1);- else- out.str(rest_line_data, rest_line_size);- out.str(color_off);- }- out.chr('\n');- }- }-- if (binary)- out.dump.done(flag_separator);- }- else- {- // read input line-by-line and display lines that match the pattern with context lines-- // mmap base and size, set with mmap.file()- const char *base = NULL;- size_t size = 0;-- reflex::BufferedInput buffered_input;-- if (!mmap.file(input, base, size))- buffered_input = input;-- const char *here = base;- size_t left = size;-- size_t byte_offset = 0;- size_t lineno = 1;- size_t before = 0;- size_t after = 0;-- const char *hex = NULL;-- // -K=NUM1[,NUM2]: start searching at line NUM1- if (flag_min_line > 0)- {- std::string line; - for (size_t i = flag_min_line; i > 1; --i)+ if (rest_line_data != NULL) {- // read the next line from mmap, buffered input, or unbuffered input- if (getline(here, left, buffered_input, input, line))- goto exit_search;+ if (binary)+ {+ out.dump.hex(Output::Dump::HEX_LINE, rest_line_last, rest_line_data, rest_line_size, flag_separator);+ }+ else+ {+ if (rest_line_size > 0)+ {+ out.str(color_sl);+ if (rest_line_data[rest_line_size - 1] == '\n')+ out.str(rest_line_data, rest_line_size - 1);+ else+ out.str(rest_line_data, rest_line_size);+ out.str(color_off);+ }+ out.chr('\n');+ } } - lineno = flag_min_line;- }-- std::vector<bool> binary;- std::vector<size_t> byte_offsets;- std::vector<std::string> lines;-- binary.reserve(flag_before_context + 1);- byte_offsets.reserve(flag_before_context + 1);- lines.reserve(flag_before_context + 1);-- for (size_t i = 0; i <= flag_before_context; ++i)- {- binary[i] = false;- byte_offsets.emplace_back(0);- lines.emplace_back("");+ if (binary)+ out.dump.done(flag_separator); }-- while (true)+ else {- // -K: max line exceeded?- if (flag_max_line > 0 && lineno > flag_max_line)- break;+ // read input line-by-line and display lines that match the pattern with context lines - size_t current = lineno % (flag_before_context + 1);+ // mmap base and size, set with mmap.file()+ const char *base = NULL;+ size_t size = 0; - binary[current] = flag_hex;- byte_offsets[current] = byte_offset;+ reflex::BufferedInput buffered_input; - // read the next line from mmap, buffered input, or unbuffered input- if (getline(here, left, buffered_input, input, lines[current]))- break;+ if (!mmap.file(input, base, size))+ buffered_input = input; - bool before_context = flag_before_context > 0;- bool after_context = flag_after_context > 0;+ const char *here = base;+ size_t left = size; - size_t last = UNDEFINED;+ size_t byte_offset = 0;+ size_t lineno = 1;+ size_t before = 0;+ size_t after = 0; - // the current input line to match- read_line(matcher, lines[current]);+ const char *hex = NULL; - if (!flag_text && !flag_hex && is_binary(lines[current].c_str(), lines[current].size()))+ // -K=NUM1[,NUM2]: start searching at line NUM1+ if (flag_min_line > 0) {- if (flag_binary_without_matches)- {- matches = 0;+ std::string line; - break;+ for (size_t i = flag_min_line; i > 1; --i)+ {+ // read the next line from mmap, buffered input, or unbuffered input+ if (getline(here, left, buffered_input, input, line))+ goto exit_search; } - binary[current] = true;+ lineno = flag_min_line; } - if (flag_invert_match)- {- // -v: select non-matching line-- bool found = false;-- while (matcher->find())- {- if (flag_any_line || (after > 0 && after + flag_after_context >= lineno))- {- // -A NUM: show context after matched lines, simulates BSD grep -A-- if (last == UNDEFINED)- {- if (matches == 0)- if (!stats.found())- goto exit_search;+ std::vector<bool> binary;+ std::vector<size_t> byte_offsets;+ std::vector<std::string> lines; - if (!flag_no_header)- {- if (hex != NULL && !binary[current])- {- out.dump.done(hex);- hex = NULL;- }+ binary.reserve(flag_before_context + 1);+ byte_offsets.reserve(flag_before_context + 1);+ lines.reserve(flag_before_context + 1); - if (!binary[current] || flag_hex || flag_with_hex)- out.header(pathname, partname, lineno, matcher, byte_offset, "-", binary[current]);- }+ for (size_t i = 0; i <= flag_before_context; ++i)+ {+ binary[i] = false;+ byte_offsets.emplace_back(0);+ lines.emplace_back("");+ } - last = 0;- }+ while (true)+ {+ // -K: max line exceeded?+ if (flag_max_line > 0 && lineno > flag_max_line)+ break; - if (binary[current])- {- out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[current] + last, lines[current].c_str() + last, matcher->first() - last, "-");- }- else- {- if (hex != NULL)- {- out.dump.done(hex);- hex = NULL;- }+ size_t current = lineno % (flag_before_context + 1); - out.str(color_cx);- out.str(lines[current].c_str() + last, matcher->first() - last);- out.str(color_off);- }+ binary[current] = flag_hex;+ byte_offsets[current] = byte_offset; - last = matcher->last();+ // read the next line from mmap, buffered input, or unbuffered input+ if (getline(here, left, buffered_input, input, lines[current]))+ break; - // skip any further empty pattern matches- if (last == 0)- break;+ bool before_context = flag_before_context > 0;+ bool after_context = flag_after_context > 0; - if (binary[current])- {- out.dump.hex(Output::Dump::HEX_CONTEXT_MATCH, byte_offsets[current] + matcher->first(), matcher->begin(), matcher->size(), "-");- }- else- {- out.str(color_mc);- out.str(matcher->begin(), matcher->size());- out.str(color_off);- }- }- else- {- found = true;+ size_t last = UNDEFINED; - break;- }- }+ // the current input line to match+ read_line(matcher, lines[current]); - if (last != UNDEFINED)+ if (!flag_text && !flag_hex && is_binary(lines[current].c_str(), lines[current].size())) {- if (binary[current])+ if (flag_binary_without_matches) {- if (flag_hex || flag_with_hex)- {- out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[current] + last, lines[current].c_str() + last, lines[current].size() - last, "-");+ matches = 0; - if (flag_any_line)- hex = "-";- else- out.dump.done("-");- }+ break; }- else- {- if (hex != NULL)- {- out.dump.done(hex);- hex = NULL;- }-- size_t size = lines[current].size(); - if (size > last)- {- if (lines[current][size - 1] == '\n')- --size;- out.str(color_cx);- out.str(lines[current].c_str() + last, size - last);- out.str(color_off);- out.nl();- }- }+ binary[current] = true; }- else if (!found)- {- if (matches == 0)- if (!stats.found())- goto exit_search; - if (binary[current] && !flag_hex && !flag_with_hex)- {- out.binary_file_matches(pathname, partname);- matches = 1;+ if (flag_invert_match)+ {+ // -v: select non-matching line - goto done_search;- }+ bool found = false; - if (after_context)+ while (matcher->find()) {- // -A NUM: show context after matched lines, simulates BSD grep -A-- // indicate the end of the group of after lines of the previous matched line- if (after + flag_after_context < lineno && matches > 0 && flag_group_separator != NULL)+ if (flag_any_line || (after > 0 && after + flag_after_context >= lineno)) {- out.str(color_se);- out.str(flag_group_separator);- out.str(color_off);- out.nl();- }-- // remember the matched line- after = lineno;- }-- if (before_context)- {- // -B NUM: show context before matched lines, simulates BSD grep -B+ // -A NUM: show context after matched lines, simulates BSD grep -A - size_t begin = before + 1;-- if (lineno > flag_before_context && begin < lineno - flag_before_context)- begin = lineno - flag_before_context;-- // indicate the begin of the group of before lines- if (begin < lineno && matches > 0 && flag_group_separator != NULL)- {- out.str(color_se);- out.str(flag_group_separator);- out.str(color_off);- out.nl();- }+ if (last == UNDEFINED)+ {+ if (matches == 0)+ if (!stats.found())+ goto exit_search; - // display lines before the matched line- while (begin < lineno)- {- size_t begin_context = begin % (flag_before_context + 1);+ if (!flag_no_header)+ {+ if (hex != NULL && !binary[current])+ {+ out.dump.done(hex);+ hex = NULL;+ } - last = UNDEFINED;+ if (!binary[current] || flag_hex || flag_with_hex)+ out.header(pathname, partname, lineno, matcher, byte_offset, "-", binary[current]);+ } - read_line(matcher, lines[begin_context]);+ last = 0;+ } - while (matcher->find())+ if (binary[current]) {- if (last == UNDEFINED)+ out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[current] + last, lines[current].c_str() + last, matcher->first() - last, "-");+ }+ else+ {+ if (hex != NULL) {- if (!flag_no_header)- out.header(pathname, partname, begin, matcher, byte_offsets[begin_context], "-", binary[begin_context]);-- last = 0;+ out.dump.done(hex);+ hex = NULL; } - if (binary[begin_context])- {- out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[begin_context] + last, lines[begin_context].c_str() + last, matcher->first() - last, "-");- }- else- {- out.str(color_cx);- out.str(lines[begin_context].c_str() + last, matcher->first() - last);- out.str(color_off);- }+ out.str(color_cx);+ out.str(lines[current].c_str() + last, matcher->first() - last);+ out.str(color_off);+ } - last = matcher->last();+ last = matcher->last(); - // skip any further empty pattern matches- if (last == 0)- break;+ // skip any further empty pattern matches+ if (last == 0)+ break; - if (binary[begin_context])- {- out.dump.hex(Output::Dump::HEX_CONTEXT_MATCH, byte_offsets[begin_context] + matcher->first(), matcher->begin(), matcher->size(), "-");- }- else- {- out.str(color_mc);- out.str(matcher->begin(), matcher->size());- out.str(color_off);- }+ if (binary[current])+ {+ out.dump.hex(Output::Dump::HEX_CONTEXT_MATCH, byte_offsets[current] + matcher->first(), matcher->begin(), matcher->size(), "-"); }-- if (last != UNDEFINED)+ else {- if (binary[begin % (flag_before_context + 1)])- {- out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[begin_context] + last, lines[begin_context].c_str() + last, lines[begin_context].size() - last, "-");- out.dump.done("-");- }- else- {- size_t size = lines[begin_context].size();-- if (size > last)- {- if (lines[begin_context][size - 1] == '\n')- --size;- out.str(color_cx);- out.str(lines[begin_context].c_str() + last, size - last);- out.str(color_off);- out.nl();- }- }+ out.str(color_mc);+ out.str(matcher->begin(), matcher->size());+ out.str(color_off); }-- ++begin; }+ else+ {+ found = true; - // remember the matched line- before = lineno;+ break;+ } } - if (!flag_no_header)+ if (last != UNDEFINED) {- if (hex != NULL && !binary[current])+ if (binary[current]) {- out.dump.done(hex);- hex = NULL;- }+ if (flag_hex || flag_with_hex)+ {+ out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[current] + last, lines[current].c_str() + last, lines[current].size() - last, "-"); - out.header(pathname, partname, lineno, NULL, byte_offsets[current], flag_separator, binary[current]);- }+ if (flag_any_line)+ hex = "-";+ else+ out.dump.done("-");+ }+ }+ else+ {+ if (hex != NULL)+ {+ out.dump.done(hex);+ hex = NULL;+ } - if (binary[current])- {- out.dump.hex(Output::Dump::HEX_LINE, byte_offsets[current], lines[current].c_str(), lines[current].size(), flag_separator);+ size_t size = lines[current].size(); - if (flag_any_line)- hex = flag_separator;- else- out.dump.done(flag_separator);+ if (size > last)+ {+ if (lines[current][size - 1] == '\n')+ --size;+ out.str(color_cx);+ out.str(lines[current].c_str() + last, size - last);+ out.str(color_off);+ out.nl();+ }+ } }- else+ else if (!found) {- if (hex != NULL)- {- out.dump.done(hex);- hex = NULL;- }-- size_t size = lines[current].size();+ if (matches == 0)+ if (!stats.found())+ goto exit_search; - if (size > 0)+ if (binary[current] && !flag_hex && !flag_with_hex) {- if (lines[current][size - 1] == '\n')- --size;- out.str(color_sl);- out.str(lines[current].c_str(), size);- out.str(color_off);- out.nl();+ out.binary_file_matches(pathname, partname);+ matches = 1;++ goto done_search; }- } - ++matches;+ if (after_context)+ {+ // -A NUM: show context after matched lines, simulates BSD grep -A - // -m: max number of matches reached?- if (flag_max_count > 0 && matches >= flag_max_count)- break;+ // indicate the end of the group of after lines of the previous matched line+ if (after + flag_after_context < lineno && matches > 0 && flag_group_separator != NULL)+ {+ out.str(color_se);+ out.str(flag_group_separator);+ out.str(color_off);+ out.nl();+ } - // output blocked?- if (out.eof)- goto exit_search;- }- }- else- {- // search the line for pattern matches+ // remember the matched line+ after = lineno;+ } - while (matcher->find())- {- if (matches == 0)- if (!stats.found())- goto exit_search;+ if (before_context)+ {+ // -B NUM: show context before matched lines, simulates BSD grep -B - if (last == UNDEFINED && !flag_hex && !flag_with_hex && binary[current])- {- out.binary_file_matches(pathname, partname);- matches = 1;+ size_t begin = before + 1; - goto done_search;- }+ if (lineno > flag_before_context && begin < lineno - flag_before_context)+ begin = lineno - flag_before_context; - if (after_context)- {- // -A NUM: show context after matched lines, simulates BSD grep -A+ // indicate the begin of the group of before lines+ if (begin < lineno && matches > 0 && flag_group_separator != NULL)+ {+ out.str(color_se);+ out.str(flag_group_separator);+ out.str(color_off);+ out.nl();+ } - // indicate the end of the group of after lines of the previous matched line- if (after + flag_after_context < lineno && matches > 0 && flag_group_separator != NULL)- {- out.str(color_se);- out.str(flag_group_separator);- out.str(color_off);- out.nl();- }+ // display lines before the matched line+ while (begin < lineno)+ {+ size_t begin_context = begin % (flag_before_context + 1); - // remember the matched line and we're done with the after context- after = lineno;- after_context = false;- }+ last = UNDEFINED; - if (before_context)- {- // -B NUM: show context before matched lines, simulates BSD grep -B+ read_line(matcher, lines[begin_context]); - size_t begin = before + 1;+ while (matcher->find())+ {+ if (last == UNDEFINED)+ {+ if (!flag_no_header)+ out.header(pathname, partname, begin, matcher, byte_offsets[begin_context], "-", binary[begin_context]); - if (lineno > flag_before_context && begin < lineno - flag_before_context)- begin = lineno - flag_before_context;+ last = 0;+ } - // indicate the begin of the group of before lines- if (begin < lineno && matches > 0 && flag_group_separator != NULL)- {- out.str(color_se);- out.str(flag_group_separator);- out.str(color_off);- out.nl();- }+ if (binary[begin_context])+ {+ out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[begin_context] + last, lines[begin_context].c_str() + last, matcher->first() - last, "-");+ }+ else+ {+ out.str(color_cx);+ out.str(lines[begin_context].c_str() + last, matcher->first() - last);+ out.str(color_off);+ } - // display lines before the matched line- while (begin < lineno)- {- size_t begin_context = begin % (flag_before_context + 1);+ last = matcher->last(); - if (!flag_no_header)- out.header(pathname, partname, begin, NULL, byte_offsets[begin_context], "-", binary[begin_context]);+ // skip any further empty pattern matches+ if (last == 0)+ break; - if (binary[begin_context])- {- out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[begin_context], lines[begin_context].c_str(), lines[begin_context].size(), "-");- out.dump.done("-");- }- else- {- size_t size = lines[begin_context].size();+ if (binary[begin_context])+ {+ out.dump.hex(Output::Dump::HEX_CONTEXT_MATCH, byte_offsets[begin_context] + matcher->first(), matcher->begin(), matcher->size(), "-");+ }+ else+ {+ out.str(color_mc);+ out.str(matcher->begin(), matcher->size());+ out.str(color_off);+ }+ } - if (size > 0)+ if (last != UNDEFINED) {- if (lines[begin_context][size - 1] == '\n')- --size;- out.str(color_cx);- out.str(lines[begin_context].c_str(), size);- out.str(color_off);- out.nl();+ if (binary[begin % (flag_before_context + 1)])+ {+ out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[begin_context] + last, lines[begin_context].c_str() + last, lines[begin_context].size() - last, "-");+ out.dump.done("-");+ }+ else+ {+ size_t size = lines[begin_context].size();++ if (size > last)+ {+ if (lines[begin_context][size - 1] == '\n')+ --size;+ out.str(color_cx);+ out.str(lines[begin_context].c_str() + last, size - last);+ out.str(color_off);+ out.nl();+ }+ } }++ ++begin; } - ++begin;+ // remember the matched line+ before = lineno; } - // remember the matched line and we're done with the before context- before = lineno;- before_context = false;- }+ if (!flag_no_header)+ {+ if (hex != NULL && !binary[current])+ {+ out.dump.done(hex);+ hex = NULL;+ } - if (flag_ungroup && !binary[current])- {- // -u: do not group matches on a single line but on multiple lines, counting each match separately+ out.header(pathname, partname, lineno, NULL, byte_offsets[current], flag_separator, binary[current]);+ } - const char *separator = last == UNDEFINED ? flag_separator : "+";+ if (binary[current])+ {+ out.dump.hex(Output::Dump::HEX_LINE, byte_offsets[current], lines[current].c_str(), lines[current].size(), flag_separator); - if (!flag_no_header)- out.header(pathname, partname, lineno, matcher, byte_offset + matcher->first(), separator, binary[current]);+ if (flag_any_line)+ hex = flag_separator;+ else+ out.dump.done(flag_separator);+ }+ else+ {+ if (hex != NULL)+ {+ out.dump.done(hex);+ hex = NULL;+ } - out.str(color_sl);- out.str(lines[current].c_str(), matcher->first());- out.str(color_off);- out.str(color_ms);- out.str(matcher->begin(), matcher->size());- out.str(color_off);- out.str(color_sl);- out.str(lines[current].c_str() + matcher->last(), lines[current].size() - matcher->last());- out.str(color_off);+ size_t size = lines[current].size();++ if (size > 0)+ {+ if (lines[current][size - 1] == '\n')+ --size;+ out.str(color_sl);+ out.str(lines[current].c_str(), size);+ out.str(color_off);+ out.nl();+ }+ } ++matches; // -m: max number of matches reached? if (flag_max_count > 0 && matches >= flag_max_count)- goto done_search;+ break; // output blocked? if (out.eof) goto exit_search; }- else+ }+ else+ {+ // search the line for pattern matches++ while (matcher->find()) {- if (last == UNDEFINED)+ if (matches == 0)+ if (!stats.found())+ goto exit_search;++ if (last == UNDEFINED && !flag_hex && !flag_with_hex && binary[current]) {- if (!flag_no_header)+ out.binary_file_matches(pathname, partname);+ matches = 1;++ goto done_search;+ }++ if (after_context)+ {+ // -A NUM: show context after matched lines, simulates BSD grep -A++ // indicate the end of the group of after lines of the previous matched line+ if (after + flag_after_context < lineno && matches > 0 && flag_group_separator != NULL) {- if (hex != NULL && !binary[current])+ out.str(color_se);+ out.str(flag_group_separator);+ out.str(color_off);+ out.nl();+ }++ // remember the matched line and we're done with the after context+ after = lineno;+ after_context = false;+ }++ if (before_context)+ {+ // -B NUM: show context before matched lines, simulates BSD grep -B++ size_t begin = before + 1;++ if (lineno > flag_before_context && begin < lineno - flag_before_context)+ begin = lineno - flag_before_context;++ // indicate the begin of the group of before lines+ if (begin < lineno && matches > 0 && flag_group_separator != NULL)+ {+ out.str(color_se);+ out.str(flag_group_separator);+ out.str(color_off);+ out.nl();+ }++ // display lines before the matched line+ while (begin < lineno)+ {+ size_t begin_context = begin % (flag_before_context + 1);++ if (!flag_no_header)+ out.header(pathname, partname, begin, NULL, byte_offsets[begin_context], "-", binary[begin_context]);++ if (binary[begin_context]) {- out.dump.done(hex);- hex = NULL;+ out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[begin_context], lines[begin_context].c_str(), lines[begin_context].size(), "-");+ out.dump.done("-"); }+ else+ {+ size_t size = lines[begin_context].size(); - out.header(pathname, partname, lineno, matcher, byte_offset, flag_separator, binary[current]);- }+ if (size > 0)+ {+ if (lines[begin_context][size - 1] == '\n')+ --size;+ out.str(color_cx);+ out.str(lines[begin_context].c_str(), size);+ out.str(color_off);+ out.nl();+ }+ } - ++matches;+ ++begin;+ } - last = 0;+ // remember the matched line and we're done with the before context+ before = lineno;+ before_context = false; } - if (binary[current])- {- out.dump.hex(Output::Dump::HEX_LINE, byte_offsets[current] + last, lines[current].c_str() + last, matcher->first() - last, flag_separator);- out.dump.hex(Output::Dump::HEX_MATCH, byte_offsets[current] + matcher->first(), matcher->begin(), matcher->size(), flag_separator);- }- else+ if (flag_ungroup && !binary[current]) {- if (hex != NULL)- {- out.dump.done(hex);- hex = NULL;- }+ // -u: do not group matches on a single line but on multiple lines, counting each match separately++ const char *separator = last == UNDEFINED ? flag_separator : "+";++ if (!flag_no_header)+ out.header(pathname, partname, lineno, matcher, byte_offset + matcher->first(), separator, binary[current]); out.str(color_sl);- out.str(lines[current].c_str() + last, matcher->first() - last);+ out.str(lines[current].c_str(), matcher->first()); out.str(color_off); out.str(color_ms); out.str(matcher->begin(), matcher->size()); out.str(color_off);- }- }-- last = matcher->last();+ out.str(color_sl);+ out.str(lines[current].c_str() + matcher->last(), lines[current].size() - matcher->last());+ out.str(color_off); - // skip any further empty pattern matches- if (last == 0)- break;- }+ ++matches; - if (last != UNDEFINED)- {- if (binary[current])- {- out.dump.hex(Output::Dump::HEX_LINE, byte_offsets[current] + last, lines[current].c_str() + last, lines[current].size() - last, flag_separator);+ // -m: max number of matches reached?+ if (flag_max_count > 0 && matches >= flag_max_count)+ goto done_search; - if (flag_any_line)- hex = flag_separator;+ // output blocked?+ if (out.eof)+ goto exit_search;+ } else- out.dump.done(flag_separator);- }- else if (!flag_ungroup)- {- if (hex != NULL) {- out.dump.done(hex);- hex = NULL;- }+ if (last == UNDEFINED)+ {+ if (!flag_no_header)+ {+ if (hex != NULL && !binary[current])+ {+ out.dump.done(hex);+ hex = NULL;+ }++ out.header(pathname, partname, lineno, matcher, byte_offset, flag_separator, binary[current]);+ } - size_t size = lines[current].size();+ ++matches; - if (size > last)- {- if (lines[current][size - 1] == '\n')- --size;- out.str(color_sl);- out.str(lines[current].c_str() + last, size - last);- out.str(color_off);- out.nl();- }- }- }- else if (flag_any_line || (after > 0 && after + flag_after_context >= lineno))- {- // -A NUM: show context after matched lines, simulates BSD grep -A+ last = 0;+ } - if (!binary[current] || flag_hex || flag_with_hex)- {- // display line as part of the after context of the matched line- if (!flag_no_header)- {- if (hex != NULL && !binary[current])+ if (binary[current]) {- out.dump.done(hex);- hex = NULL;+ out.dump.hex(Output::Dump::HEX_LINE, byte_offsets[current] + last, lines[current].c_str() + last, matcher->first() - last, flag_separator);+ out.dump.hex(Output::Dump::HEX_MATCH, byte_offsets[current] + matcher->first(), matcher->begin(), matcher->size(), flag_separator); }+ else+ {+ if (hex != NULL)+ {+ out.dump.done(hex);+ hex = NULL;+ } - out.header(pathname, partname, lineno, NULL, byte_offsets[current], "-", binary[current]);+ out.str(color_sl);+ out.str(lines[current].c_str() + last, matcher->first() - last);+ out.str(color_off);+ out.str(color_ms);+ out.str(matcher->begin(), matcher->size());+ out.str(color_off);+ } } + last = matcher->last();++ // skip any further empty pattern matches+ if (last == 0)+ break;+ }++ if (last != UNDEFINED)+ { if (binary[current]) {- out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[current], lines[current].c_str(), lines[current].size(), "-");+ out.dump.hex(Output::Dump::HEX_LINE, byte_offsets[current] + last, lines[current].c_str() + last, lines[current].size() - last, flag_separator); if (flag_any_line)- hex = "-";+ hex = flag_separator; else- out.dump.done("-");+ out.dump.done(flag_separator); }- else+ else if (!flag_ungroup) { if (hex != NULL) {@@ -6745,39 +6701,94 @@ void Grep::search(const char *pathname) size_t size = lines[current].size(); - if (size > 0)+ if (size > last) { if (lines[current][size - 1] == '\n') --size;- out.str(color_cx);- out.str(lines[current].c_str(), size);+ out.str(color_sl);+ out.str(lines[current].c_str() + last, size - last); out.str(color_off); out.nl(); } } }- }+ else if (flag_any_line || (after > 0 && after + flag_after_context >= lineno))+ {+ // -A NUM: show context after matched lines, simulates BSD grep -A - // -m: max number of matches reached?- if (flag_max_count > 0 && matches >= flag_max_count)- break;+ if (!binary[current] || flag_hex || flag_with_hex)+ {+ // display line as part of the after context of the matched line+ if (!flag_no_header)+ {+ if (hex != NULL && !binary[current])+ {+ out.dump.done(hex);+ hex = NULL;+ } - // output blocked?- if (out.eof)- goto exit_search;- }+ out.header(pathname, partname, lineno, NULL, byte_offsets[current], "-", binary[current]);+ } - // update byte offset and line number- byte_offset += lines[current].size();- ++lineno;+ if (binary[current])+ {+ out.dump.hex(Output::Dump::HEX_CONTEXT_LINE, byte_offsets[current], lines[current].c_str(), lines[current].size(), "-");++ if (flag_any_line)+ hex = "-";+ else+ out.dump.done("-");+ }+ else+ {+ if (hex != NULL)+ {+ out.dump.done(hex);+ hex = NULL;+ }++ size_t size = lines[current].size();++ if (size > 0)+ {+ if (lines[current][size - 1] == '\n')+ --size;+ out.str(color_cx);+ out.str(lines[current].c_str(), size);+ out.str(color_off);+ out.nl();+ }+ }+ }+ }++ // -m: max number of matches reached?+ if (flag_max_count > 0 && matches >= flag_max_count)+ break;++ // output blocked?+ if (out.eof)+ goto exit_search;+ }++ // update byte offset and line number+ byte_offset += lines[current].size();+ ++lineno;+ } }- } done_search: - // --break: add a line break when applicable- if (flag_break && flag_format == NULL && (matches > 0 || flag_count || flag_any_line))- out.chr('\n');+ // --break: add a line break when applicable+ if (flag_break && flag_format == NULL && (matches > 0 || flag_count || flag_any_line))+ out.chr('\n');++ }++ catch (...)+ {+ warning("exception while searching", pathname);+ } exit_search: @@ -7429,7 +7440,7 @@ void version() std::cout << "ugrep " UGREP_VERSION " " PLATFORM << "\n" "Copyright (c) Genivia Inc.\n" "License BSD-3-Clause: <https://opensource.org/licenses/BSD-3-Clause>\n"- "Written by Robert van Engelen: <https://github.com/Genivia/ugrep>\n";+ "Written by Robert van Engelen and others: <https://github.com/Genivia/ugrep>" << std::endl; exit(EXIT_OK); }