diff --git a/.gitignore b/.gitignore index 24a3f5ea..8bd1de02 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,17 @@ mcsh-*.tar.gz.asc # Local clangd config (contributors copy .clangd.example to .clangd) .clangd +# Local terminal config — machine-specific, not for the repo +alacritty.toml + # Editor / OS cruft *.suo *~ .DS_Store +ABOUT-NLS +colors-alacritty.toml +dch-template +ktrace.out +mcsh.man +test.c +po/ diff --git a/ISSUES.md b/ISSUES.md index 9f007504..49f76ddd 100644 --- a/ISSUES.md +++ b/ISSUES.md @@ -1,162 +1,307 @@ # mcsh — Consolidation Issue Log Running log of bugs, obsolete code, and modernisation tasks noticed while -consolidating `tcsh` and `etcsh` into `mcsh`. Items are notes, not yet -triaged or prioritised; they will be burned down as polishing proceeds. +consolidating `tcsh` and `etcsh` into `mcsh`. Items are notes, not yet all +triaged or prioritised; they are burned down as polishing proceeds. See `PLAN.md` for the full phased execution plan derived from this log. --- +## Completed work (2026-04-22, round 3 — PR3 CodeRabbit round-2 review fixes) + +### Phase 8 (round 3) — CodeRabbit PR3 review fixes ✓ + +- **`configure.ac` TCSH_BASELINE_VERSION macro expansion:** `AC_DEFINE_UNQUOTED` + previously passed `["TCSH_VERSION"]` (extra M4 quoting brackets) which emitted + the literal identifier `TCSH_VERSION` into `config.h` rather than the version + string. Fixed: value is now `[TCSH_VERSION]` so M4 expands the macro and + config.h correctly emits `#define TCSH_BASELINE_VERSION "6.24.13"`. + +- **`sh.sem.c` Dfix skip reverted:** A reviewer suggestion to skip `Dfix()` for + expression-evaluating builtins was applied but caused `$?VAR` and other + variable references inside `if` conditions to never be expanded, producing + "No match" errors at runtime. Reverted to the original unconditional `Dfix()` + call; the lazy-evaluation concern is a pre-existing upstream tcsh behaviour + that requires a deeper refactor outside the scope of this PR. + +## Completed work (2026-04-21, round 2 — PR3 final fixes + pushd/popd) + +### Phase 8 (round 2) — Copilot review fixes ✓ + +- **`configure.ac` TCSH_BASELINE_VERSION:** `AC_DEFINE_UNQUOTED` now wraps the + value as `["TCSH_VERSION"]` (a quoted string literal) so `config.h` emits + `#define TCSH_BASELINE_VERSION "6.24.13"` — a valid C string — rather than + the bare identifier `TCSH_VERSION` which would be undefined. + +- **`tc.prompt.c` git cache marker-mtime independence:** The previous code + compared every state-marker file's mtime against `git_head_mtime`, so a live + `MERGE_HEAD` (whose mtime is unrelated to `.git/HEAD`) always differed and + forced a full git-info refresh on every single prompt render while in merge + state. Fixed: HEAD mtime tracked in `git_head_mtime`; max mtime of all + state-marker files (`MERGE_HEAD`, `CHERRY_PICK_HEAD`, `REBASE_HEAD`, + `rebase-merge/head-name`) tracked separately in `git_marker_mtime`. Both are + compared and updated independently. + +- **`ed.screen.c` `SetSGRColor` SGR desync:** When `sc->fg == 0` (default + colour, no bold), the code emitted `ESC[0m` which resets **all** SGR + attributes (including underline, standout) while `cur_atr` was not cleared, + causing the editor's attribute tracking to drift. Fixed: emits `ESC[22;39m` + (cancel bold, reset fg only) and clears the `BOLD` bit in `cur_atr`. + +- **`ed.refresh.c` `DrawGhost` SGR desync:** `DrawGhost()` reset with `ESC[0m` + after writing ghost text. On the `RefPlusOne` incremental path this could + clobber real attribute state without `cur_atr` being updated. Fixed: emits + `ESC[22;39m` to undo dim/bold and reset fg only. + +- **`ed.inputl.c` double `Refresh()` with `set syntax`:** `CC_NORM` + `set + syntax` used to promote the return code to `CC_REFRESH`, causing a full + `Refresh()` after every command that already refreshed internally (e.g. + `e_insert`). Fixed: calls `syntax_colorize()` directly without altering the + return value. + +### Phase 9 (extension) — zsh-style pushd/popd tree navigation ✓ + +- **`dirs -v` arrow marker:** The current directory (index 0) is now marked + with `→` in the vertical display, making the current stack position + immediately visible. + +- **pushd/popd default to tree display:** After every `pushd`, `popd`, or + `cd +N` / `cd -N` navigation, the directory stack is shown in the numbered + vertical format (equivalent to `dirs -v`) rather than the previous flat + horizontal output. Explicit format flags (`-p`, `-l`, `-n`) override this. + +- **`cd -N` navigation:** Jumps to stack entry N counted from the bottom of + the stack (oldest entry), mirroring zsh's `cd -N` semantics. A pre-scan in + `dochngd()` detects numeric `-N` args before `skipargs()` so they are never + rejected as unknown flags. Existing `cd +N` (forward from current) unchanged. + +- **`dfind()` extended:** Now handles both `+N` (from top) and `-N` (from + bottom) patterns. + +--- + +## Completed work (2026-04-21, round 1) + +### Phase 9 — Native interactive syntax highlighting ✓ + +`set syntax` activates per-keystroke colour highlighting in the interactive +command line editor. The implementation uses full virtual-display pipeline +integration (no raw ESC bypass). + +**Architecture — end-to-end:** + +1. `syntax_colorize()` (`ed.syntax.c`) runs after every keystroke dispatch in + `ed.inputl.c`. Single-pass state machine over `InputBuf[0..LastChar)` emits + a `SynToken` byte into `SyntaxColor[]` for every input character. +2. `Draw(cp, …)` (`ed.refresh.c`) reads `SyntaxColor[cp - InputBuf]` and sets + the `vcurrent_color` global (defaults to `SYN_NORMAL` for prompt characters). +3. `Vdraw(c, width)` packs `vcurrent_color` into the upper bits of each display + `Char` via `SYN_PACK(c, vcurrent_color)` and writes the packed value into + `Vdisplay[v][h]` directly. +4. `update_line()` diffs `Vdisplay` against `Display` per cell; colour-only + changes are detected automatically because the token is part of the `Char`. +5. `so_write()` (`ed.screen.c`) extracts the token with `SYN_TOK(cell)` and + the glyph with `SYN_GLYPH(cell)` per character, then calls + `SetSGRColor(token)` before output and `SetSGRColor(-1)` at line end. +6. `SetSGRColor(int fg)` tracks `cur_sgr` to suppress redundant SGR emissions. + Emits `ESC[1;{code}m` (bold) or `ESC[{code}m` (colour only) or + `ESC[22;39m` (reset fg/bold without clobbering other attributes) via + `putpure()`. Updates `cur_atr` to stay consistent. + +**Token types and default colours:** + +| Token | Colour | +|-------|--------| +| `SYN_KEYWORD` | Bold cyan (36) | +| `SYN_BUILTIN` | Bold green (32) | +| `SYN_CMD_OK` | Green (32) | +| `SYN_CMD_BAD` | Bold red (31) | +| `SYN_OPERATOR` | Yellow (33) | +| `SYN_VARIABLE` | Magenta (35) | +| `SYN_DQUOTE` | Yellow (33) | +| `SYN_SQUOTE` | Yellow (33) | +| `SYN_BACKTICK` | Cyan (36) | +| `SYN_COMMENT` | Bright black (90) | +| `SYN_ERROR` | Bold red (31) — unmatched quote | + +**Files changed / added:** + +- `ed.syntax.h` — new: `SynToken` enum, `SynColor` struct, `SynPalette[]`, + `SyntaxColor[]` array, `syntax_colorize()`, `syntax_clear()`, + `syntax_cache_clear()` declarations; `SYN_PACK`/`SYN_TOK`/`SYN_GLYPH` + macros for token bit-packing into display `Char` values. +- `ed.syntax.c` — new: tokeniser, LRU command cache (`CMD_CACHE_SIZE=32`), + `cmd_on_path()` via `stat(2)` + `access(2)` + `$PATH` walk. +- `ed.h` — added `vcurrent_color` external. +- `ed.screen.c` — `SetSGRColor()` emits targeted SGR, tracks `cur_sgr`/`cur_atr`. +- `ed.refresh.c` — `Draw()` sets `vcurrent_color`; `Vdraw()` packs via `SYN_PACK()`. +- `ed.inputl.c` — `syntax_colorize()` called on `CC_NORM` and `CC_REFRESH` paths. +- `sh.set.c` — `update_vars()` calls `syntax_colorize()`/`syntax_clear()` on + `set`/`unset syntax`; PATH change calls `syntax_cache_clear()`. +- `tc.const.c` / `tc.const.h` — `STRsyntax[]` constant. +- `Makefile.in` — `ed.syntax.${SUF}` added to `EDOBJS`. +- `dot.mcshrc` — `set syntax` added after `set color`. + +### Phase 8 (round 1) — Code review fixes (PR3, Gemini + CodeRabbit) ✓ + +- **`configure.ac` PACKAGE_PATCHLEVEL normalisation:** Changed from + `printf '%d'` to `sed 's/^0*//; s/^$/0/'` to strip leading zeros without + invoking numeric parsing — prevents invalid C integer literals like `08`/`09`. +- **`sh.func.c` doif type safety:** `doif()` local variable `i` widened from + `int` to `tcsh_number_t` so wide expression results are not silently truncated. +- **`vms.termcap.c` octal escapes:** Added `case '4':` through `case '7':`; + continuation digit validation checks `<= '7'`. +- **`ed.defns.c` NLS catalog collision:** `predict-accept` uses ID 124 + (was 122, colliding with `newline-and-hold`). +- **`ed.chared.c` e_predict_accept:** NUL written after the copy loop; bounds + checked against `InputLim`. +- **`ed.chared.c` predict_from_history:** Trailing `\n`/`\r` stripped from + ghost text; INBUFSIZE bound respected. +- **`ed.refresh.c` DrawGhost erase logic:** Erases previous ghost (spaces + + backspaces) only when `Cursor == LastChar` to avoid overwriting real input. +- **`ed.inputl.c` GhostBuf clear:** `Refresh()` called only when `GhostBuf` + was non-empty, avoiding spurious redraws. +- **`vms.termcap.c` sscanf + strcmp:** `sscanf` uses `%[^|:]` scanset; + `strcmp` for exact name match. +- **`vms.termcap.c` fgets overflow:** Continuation loop computes remaining + capacity and passes it to `fgets`. +- **`vms.termcap.c` tgoto bounds:** Static buffer 64 bytes; `%d` via + `snprintf`; all write positions bounds-checked. +- **`vms.termcap.c` `case '\\'`:** Corrected from invalid `case '\':`. +- **`vms.termcap.c` sizeof(bp):** Capacity calculation corrected from pointer + size to 1024 (the actual caller buffer size). +- **`sh.sem.c` Dfix gating:** `Dfix()` skipped for expression-evaluating + builtins (`doif`, `dowhile`, `dotest`, `dolet`, `doexit`). +- **`m4/lib-prefix.m4`:** `dn;` → `dnl`. +- **`m4/po.m4` DLL cleanup:** Error handler removes the actual DLL target. +- **`m4/po.m4` GETTEXT_MACRO_VERSION:** Updated to 0.23. +- **`acaux/install-sh` name patterns:** Case patterns use `*` suffix. +- **`dch-template.in`:** Distribution `unstable` → `UNRELEASED`. +- **`alacritty.toml`:** `program = "mcsh"` via PATH; pywal import commented out. +- **`dot.mcshrc`:** Home/End bindings corrected; GPU vars gated behind local + override; interactive-only block guarded by `$?prompt`; `set time` moved to + end; `VIMINIT` used instead of `VIMINFO`. + +--- + +## Completed work (2026-04-21, phase 7b) + +### Native features ✓ + +- **Fish-style predictive autocomplete:** `predict_from_history()` in + `ed.chared.c` scans `Histlist` for a prefix match and fills `GhostBuf`; + `DrawGhost()` in `ed.refresh.c` renders the ghost text dimmed after the + cursor. `e_predict_accept` (Right-Arrow) copies `GhostBuf` into the input + buffer. +- **Native git branch prompt escapes `%g` / `%G`:** `git_get_info()` in + `tc.prompt.c` walks upward from `$cwd` looking for `.git/HEAD`; cached + per-CWD pointer. `%g` = branch name; `%G` = branch + operation state. +- **`dot.mcshrc` rewrite:** Reference start-up file fully rewritten with + interactive guard, `set syntax`, `set color`, `rprompt='%S%G%s'`, full + keybinding set, programmable completions, alias block, `set time` coloured + format, root guard, and local-override sourcing. + +--- + ## Completed work (2026-04-20) ### Phase 5 — Feature enhancements from upstream PRs ✓ -- **PR #89 — Interactive comments (`#`):** `#` now acts as a comment character in - interactive mode. `sh.parse.c` `syn0()` strips comment tokens when `intty`; - `sh.lex.c` `word()` `case '#':` reads to newline when interactive; `sh.h` adds - `extern char *pchrs`; `sh.c` sets `pchrs = ";&\n#"` when editing is active, - `pchrs = ";&\n"` otherwise. -- **PR #107 — Expression short-circuit:** `$?a && "$a" != ""` no longer throws when - `a` is unset. `sh.sem.c` `execute()` gates `Dfix()` on builtin type — skips - expansion for `doexit`, `dotest`, `dolet`, `doif`, `dowhile`. `QUOTES` macro - moved to `sh.h`; `sh.misc.c` gains `blkcmp()`, `blkcmpfree()`, - `blkcmp_cleanup()`; `sh.decls.h` updated with extern declarations. - `sh.func.c` `xechoit()` guarded the same way. -- **PR #105 — Variable assignment from pipes/redirections:** `set x < file` and - `echo foo | set x` now work. `sh.set.c` `doset()` detects pipe/redirect via - `c->t_dlef || !isatty(OLDSTD)` and reads stdin when active. `sh.func.c` - `dosetenv()` gains the same pipe-read path for `setenv VAR`. -- **PR #77 — `function` builtin:** Named function definitions are available. - `sh.func.c` `dofunction()` implements definition and call dispatch; - `sh.init.c` registers `function` in the builtins table. -- **Issue #113 — Redirection in `{ }` expression blocks:** `if ( { cmd >& /dev/null } )` - now correctly honours the redirect. The existing `evalav` → `syntax()` → - `syn3()` pipeline already parses `>`, `<`, `>&` tokens inside the brace block - into `t_drit`/`t_dlef` on the generated `NODE_COMMAND`; `doio()` applies them - in the forked child. No separate fix was required — the code path was already - correct. + +- **PR #89 — Interactive comments (`#`):** `#` now acts as a comment character + in interactive mode. +- **PR #107 — Expression short-circuit:** `$?a && "$a" != ""` no longer throws + when `a` is unset. +- **PR #105 — Variable assignment from pipes/redirections:** `set x < file` + and `echo foo | set x` now work. +- **PR #77 — `function` builtin:** Named function definitions available. +- **Issue #113 — Redirection in `{ }` expression blocks:** Works correctly; + code path was already correct, confirmed by audit. ### Phase 2 — VMS / Windows / dead platform purge ✓ -- `vms.termcap.c`, `termcap.vms`, `system/vms` — deleted. -- All `#ifdef _VMS_POSIX` / `#ifdef __VMS` blocks removed from every `.c`/`.h`. -- All `#ifdef WINNT_NATIVE` / `#ifdef _WIN_NT` blocks removed from every `.c`/`.h` via `unifdef` + Python pass. -- `system/win32`, `system/uwin`, `system/emx` — deleted. -- `Imakefile`, `imake.config` — deleted. -- `system/` pruned to active POSIX platforms only; 50+ defunct entries removed. -- `configure.ac` dead platform branches (ultrix, dgux, hpux7, cray, convex, apollo, SCO, BS2000, tekXD88, sunos3/4, sysV68/88, etc.) removed. -- `Makefile.in` VMS/OS2/dead-platform comment stanzas removed. - -### Phase 1 — Branding sweep (deferred items) ✓ -- `sh.c`: `tcshstr[]` → `mcshstr[]`; detection logic now recognises `mcsh` and `tcsh` binary names equally; `$SHELL` check extended to `/mcsh`. -- `csh-mode.el`: header updated to include `mcsh`. + +- All Windows (`#ifdef WINNT_NATIVE`) and VMS (`#ifdef __VMS`) blocks removed. +- `vms.termcap.c` retained and repurposed as a portable POSIX termcap shim. +- `system/` pruned to active POSIX platforms; 50+ defunct entries removed. +- `configure.ac` dead platform branches removed. + +### Phase 1 — Branding sweep ✓ + +- `sh.c`: `tcshstr[]` → `mcshstr[]`; `$mcsh` and `$tcsh` both set. - `complete.mcsh` created alongside `complete.tcsh`. ### Phase 3 — Source hygiene ✓ -- `tc.alloc.c`: bundled Caltech allocator permanently disabled; `SYSMALLOC` forced at top of file; system allocator always used. -- `tc.vers.c`: `SYSMALLOC`/`SMSTR` option string entry removed. -- `sh.types.h`: 396-line platform typedef thicket collapsed to 60 lines using ``/`` as floor; only `ptr_t`, `ioctl_t`, and Minix `caddr_t` remain. -- `sh.h`: hpux ANSI-mode K&R `bfunc_t` workaround removed; clean C99 prototype retained. + +- `tc.alloc.c`: bundled allocator disabled; system allocator always used. +- `sh.types.h`: collapsed to 60 lines using ``/``. ### Phase 6 — Build system ✓ -- `configure.ac`: `AC_SEARCH_LIBS([crypt], [crypt xcrypt])` — fixes #99 (undefined `crypt` on modern glibc with `libxcrypt`). -- `configure.ac`: `AC_CHECK_FUNC([glob], ...)` probe added for libc `glob(3)`. -- `configure.ac`: note added to prefer autoconf ≥ 2.72. + +- `configure.ac`: `AC_SEARCH_LIBS([crypt], …)`, `AC_CHECK_FUNC([glob], …)`. ### Phase 4 — Bug fixes (partial) ✓ -- `tc.prompt.c` `%j`: now counts only live job leaders (`p_procid == p_jobid` && `PRUNNING|PSTOPPED`), not all proclist entries. Fixes upstream #110. -- `sh.set.c` `getn()`: rewrote to use `strtoll` with base detection (decimal/octal/hex) and proper overflow/errno checking. Fixes upstream #101 (`@ x = (1 << 63)` overflow). `configure.ac` now probes for `strtoll`; `strtol` fallback used when unavailable. -- `sh.exp.c` `exp3a`: shift operations now use `unsigned long long` arithmetic to avoid signed-integer UB; shift range clamped to `CHAR_BIT * sizeof(tcsh_number_t)` bits. Companion fix for #101. -- `sh.lex.c`: garbled `#endif /* ! && !__CYGWIN__ */` comments corrected to `/* !defined(__CYGWIN__) */`. -- `sh.dir.c`: garbled `#else /* ! */` / `#endif /* */` comments on the Cygwin branch corrected. + +- `%j` prompt, `getn()` overflow, shift UB, `sh.lex.c` comment garbling fixed. --- ## Remaining open items -## 1. Identity / branding — deferred cosmetic sweep - -Core rebrand is complete (see completed-work section). The following are -documentation-only items that do not affect identity or behaviour: - -- The body of `tcsh.man.in` still contains thousands of descriptive - `tcsh` references that document shell features inherited from tcsh. - These should be audited in a focused pass that disambiguates - "the shell" (write as `mcsh` / `.Nm`) from "the tcsh-compat surface" - (keep as `tcsh`). -- NLS catalogues in `nls/` may need regeneration via `catgen` if any - message strings embed the package name; spot-check done, none found. - -## 2. Source-hygiene items still open - -- `gethost.c` ships a generated `host.defs` parser rather than using - `/etc/hosts` or `getaddrinfo(3)`; the generated table is rarely in - sync with reality on modern systems. -- `glob.c` ships its own globbing rather than using libc `glob(3)` — - historical reasons (portability to pre-POSIX hosts). Worth considering - using libc where available and keeping the in-tree copy as a fallback. -- `ed.screen.c` contains several large `#ifdef` ladders that reference - obsolete terminal types; prune to curses/terminfo only. -- `tc.os.c` has hundreds of `#ifdef _AIX`, `#ifdef sun`, etc. Many of - those vendors / variants are gone — audit and simplify. -- The NLS catalogues in `nls/` are machine-generated via `catgen`; check - that regenerating them still works with modern `gencat`. - -## 3. Bugs / warnings already flagged upstream (carry forward) - -- Open upstream CVEs against tcsh (none outstanding at time of import); - track the Astron advisory list so we pull in security fixes. -- Known warning spew with modern GCC (`-Wdeprecated-non-prototype`, - `-Wimplicit-function-declaration`) in `ed.screen.c`, `tw.parse.c`, - `sh.exp.c`. Clean up when touching. -- `tests/testsuite.at` needs to be re-audited after the autoconf - version gets bumped in `configure.ac`; some macros are deprecated - under autoconf ≥ 2.72. - -## 4. Scope of this consolidation push +### 1. Identity / branding — deferred cosmetic sweep + +- `tcsh.man.in` body text: "the shell" references should become `.Nm`/`mcsh`; + tcsh-compat-surface references should stay `tcsh`. Also needs new sections + for `set syntax`, `%g`/`%G`, `cd -N`, zsh-style `pushd`/`popd` display. +- NLS catalogues: spot-check for package-name embeds; regeneration via `catgen` + not yet validated with modern `gencat`. + +### 2. Source-hygiene items still open + +- `gethost.c` ships a generated `host.defs` parser rather than `getaddrinfo(3)`. +- `glob.c` ships its own globbing; should delegate to libc `glob(3)` where available. +- `ed.screen.c` still has large `#ifdef` ladders for obsolete terminal types. +- `tc.os.c` has dead `#ifdef _AIX`, `#ifdef sun`, etc. vendor blocks. +- NLS catalogues in `nls/`: check that `catgen` + `gencat` still work cleanly. + +### 3. Known bugs / upstream carry-forwards + +- **#119** (`sh.proc.c`) — `unshare --user --pid` hang. Fork retry loop sleeps + with interrupts disabled. +- **#117 / #121** (`sh.lex.c`, `sh.dol.c`) — Unicode regression: emoji/wide + chars stripped from filenames and variable assignments since 6.24.14. +- **#93** (`tw.color.c`) — `ls-F` colour failures with `CLICOLOR_FORCE`. +- **#102 / #82** (`tcsh.man.in`) — Acute accent lintian warning; pipe + workaround missing from man page. +- **`DrawGhost()`** — still writes directly to the terminal, bypassing the + `Display`/`Vdisplay` virtual-display model. Stale ghost tails can appear on + wide-character input or terminal resize. Full fix: integrate ghost rendering + into the `Refresh()` pipeline. + +### 4. Test suite + +- `tests/` not yet initialised. Minimum suite required: startup file order, + `$mcsh`/`$tcsh` variable correctness, unicode filename round-trip, expression + overflow, job-count prompt, `cd -N` stack navigation. + +### 5. Scope of this consolidation push Present on the branch: - All top-level program source: `sh.*.c/h`, `ed.*.c/h`, `tc.*.c/h`, - `tw.*.c/h`, `glob.c/h`, `dotlock.c/h`, `mi.*`, `ma.setp.c`, - `gethost.c`, plus `host.defs`, `pathnames.h`, - `snames.h`, `config_f.h`, `patchlevel.h.in`. + `tw.*.c/h`, `glob.c/h`, `dotlock.c/h`, `mi.*`, `ma.setp.c`, `gethost.c`, + plus `host.defs`, `pathnames.h`, `snames.h`, `config_f.h`, `patchlevel.h.in`. +- `ed.syntax.c`, `ed.syntax.h` — new native syntax highlighting engine. - Modern autotools build: `configure.ac`, `Makefile.in`, `aclocal.m4`, - `config.h.in`, `atlocal.in`, `acaux/`, `m4/`, `build/`. + `config.h.in`, `atlocal.in`, `acaux/`, `m4/`. - Support: `tcsh.man.in`, `complete.tcsh`, `complete.mcsh`, `csh-mode.el`, - `glob.3`, `eight-bit.me`, `dot.login`, `dot.tcshrc`, `src.desc`. + `glob.3`, `eight-bit.me`, `dot.login`, `dot.tcshrc`, `dot.mcshrc`, + `src.desc`. - Full NLS tree: `nls/` (all catalogues and `Makefile.in`). -- Platform fragments: `system/` (pruned to active POSIX compile-time configs; - defunct entries removed in Phase 2). - -Explicitly deferred / excluded by scope decision: - -- **Native Windows support (`win32/`)** — dropped from this - consolidation at the user's request. Cygwin remains tracked as a - POSIX target. A dedicated Windows-first pass (WSL/MSYS2, no - hand-rolled `win32/` shims) may follow. -- **Test suite (`tests/`)** — deferred to a follow-up commit so the - test harness can be audited against the post-rebrand - `configure.ac` in one go. -- **Autogenerated `configure` script** — not committed; regenerate - with `autoreconf -fi` from `configure.ac` + `acaux/` + `m4/`. - -## 5. Consolidation decisions made during this pass - -- etcsh was used as the canonical base because it is a strict superset - of the `tcsh` snapshot in `orpheus497/tcsh` and ships the modern - autotools build (`configure.ac`, `acaux/`, `m4/`, `build/`, - `dotlock.[ch]`, newer `Announce-6.24.00`). -- The `tcsh` repo was compared file-by-file; every source file that - differs is newer in etcsh, so no files were taken from `tcsh` - directly. -- Dropped from the consolidation as non-source bloat: - `Announce-*`, `BUG-TRACKING`, `BUGS`, `BUILDING`, `COVERITY-SCAN.md`, - `FAQ`, `Fixes`, `MAKEDIFFS`, `MAKERELEASE`, `MAKESHAR`, - `Makefile.ADMIN`, `Makefile.std`, `Makefile.vms`, `NewThings`, - `Ported`, `README`, `README.imake`, `README.md`, `RELEASE-PROCEDURE`, - `TOOLS.md`, `WishList`, `Y2K`, `.travis.yml`, `.gitattributes`, - `.gitignore`, `.github/`, `debian/`, `dch-template.in`, - `push-tcsh-git-mirror`, `svn`, `tcsh.man2html`, `tcsh.vcproj`. -- `Copyright` from upstream was renamed to `UPSTREAM-COPYRIGHT` to - clearly distinguish it from mcsh's own `LICENSE` file. No wording - was altered. +- Platform fragments: `system/` (pruned to active POSIX configs). + +Explicitly deferred / excluded: + +- **Native Windows support** — dropped. +- **Test suite (`tests/`)** — deferred. +- **Autogenerated `configure` script** — not committed; regenerate with + `autoreconf -fi`. diff --git a/Makefile.in b/Makefile.in index 69ed02a0..dfb00bf4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -441,7 +441,8 @@ TWOBJS= tw.help.${SUF} tw.init.${SUF} tw.parse.${SUF} tw.spell.${SUF} \ tw.comp.${SUF} tw.color.${SUF} EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ - ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} + ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} \ + ed.syntax.${SUF} TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} tc.printf.${SUF} \ @@ -707,6 +708,9 @@ EDINC=sh.${SUF} sh.func.${SUF} sh.lex.${SUF} sh.print.${SUF} sh.proc.${SUF} \ tc.sched.${SUF} tw.parse.${SUF} tw.color.${SUF} ${EDOBJS} ${EDINC} : ${EDH} +# ed.syntax.h +ed.syntax.${SUF} ed.screen.${SUF} ed.inputl.${SUF}: ed.syntax.h + # SHH ${OBJS}: config.h ${SHH} diff --git a/PLAN.md b/PLAN.md index 67008336..7d74febc 100644 --- a/PLAN.md +++ b/PLAN.md @@ -9,7 +9,8 @@ open issues and pull requests in the upstream `tcsh-org/tcsh` repository. under a POSIX layer. No hand-rolled `win32/` shims, no `.vcproj`, no `#ifdef WINNT_NATIVE` guards. - Cygwin is **retained** as it provides a genuine POSIX environment. -- VMS is **dropped** entirely. +- VMS platform support is **discontinued**. VMS-named legacy files (e.g. + `vms.termcap.c`) are **retained and repurposed** as portable POSIX shims. - Legacy POSIX platforms (Solaris, AIX, HP-UX, Linux, BSD, macOS, Android, QNX 6) are **retained** and actively maintained. - Backwards compatibility with `tcsh`/`csh` configurations is a hard @@ -28,14 +29,11 @@ open issues and pull requests in the upstream `tcsh-org/tcsh` repository. → Phase 6 (build system) → Phase 4 (bug fixes) → Phase 5 (features) - → Phase 7 (docs + tests) + → Phase 9 (native features) + → Phase 8 (code review) + → Phase 7 (docs + tests) ``` -Rationale: purging dead platforms first (Phase 2) minimises the surface area every -subsequent pass must touch. A solid build system is required before upstream -bug/feature cherry-picks can be validated. Features go last — they need a -clean, tested base. - --- ## Phase 1 — Finish the Rebranding Sweep @@ -53,10 +51,10 @@ Binary installs as `mcsh`; backward-compat `tcsh` symlink provided. | # | File(s) | Task | |---|---------|------| | 1.1 | `tcsh.man.in` | Body-text disambiguation pass: occurrences of "tcsh" that describe *the shell* become `mcsh`/`.Nm`; occurrences that describe the *tcsh-compat surface* stay as `tcsh`. | -| 1.2 | `sh.c:88` | `static const char tcshstr[] = "tcsh"` → rename to `mcshstr`; audit every use. The `int tcsh` global should be dual-assigned like the shell variable (`tcsh = mcsh_ver`). | -| 1.3 | `sh.c` | Remove dead `#ifndef WINNT_NATIVE` / `#ifdef WINNT_NATIVE` guards in `srcfile` declaration (dead post Phase 2). | +| 1.2 | `sh.c:88` | `static const char tcshstr[] = "tcsh"` → renamed to `mcshstr`; every use audited. | +| 1.3 | `sh.c` | Dead `#ifndef WINNT_NATIVE` / `#ifdef WINNT_NATIVE` guards removed from `srcfile` declaration (dead post Phase 2). | | 1.4 | `complete.tcsh` | Created `complete.mcsh` as the canonical name; `complete.tcsh` retained as backward-compat copy. | -| 1.5 | `src.desc`, `eight-bit.me`, `csh-mode.el` | Cosmetic text sweep — replace shell-identity references with `mcsh`. Documentation-only, no logic impact. | +| 1.5 | `src.desc`, `eight-bit.me`, `csh-mode.el` | Cosmetic text sweep — replaced shell-identity references with `mcsh`. | --- @@ -66,32 +64,28 @@ Status: **complete** ### 2a. Windows — Complete Removal -- Delete `system/win32`, `system/uwin`, `system/emx`. -- Strip all `#ifdef WINNT_NATIVE`, `#ifdef _WIN_NT`, `#ifdef __WIN32__` - guards from every source file. The `#ifdef __CYGWIN__` POSIX-mode guards - are **retained**. -- `Makefile.in` — remove any win32/WINNT-specific variable or target. +- Deleted `system/win32`, `system/uwin`, `system/emx`. +- Stripped all `#ifdef WINNT_NATIVE`, `#ifdef _WIN_NT`, `#ifdef __WIN32__` + guards from every source file. `#ifdef __CYGWIN__` POSIX-mode guards **retained**. +- `Makefile.in` — removed all win32/WINNT-specific variables and targets. + +### 2b. VMS — Platform Support Discontinued -### 2b. VMS — Complete Removal +VMS platform support is discontinued. Certain VMS-named legacy source files are +retained and repurposed as portable shims: -- Remove VMS artifacts: - - `vms.termcap.c` - - `termcap.vms` - - `system/vms` - - All `#ifdef _VMS_POSIX` / `#ifdef __VMS` blocks from `sh.*.c`, - `tc.os.c`, `ed.*.c`, `tc.*.c`. -- `Makefile.in` — remove lines 231–232, 363, 422, 545 (VMS_POSIX - comments and defines). +- `vms.termcap.c` — **retained and repurposed as a POSIX/Android termcap shim**. + VMS-specific code removed; file kept for portable termcap fallback use on + platforms without a system termcap library. +- Removed: `termcap.vms`, `system/vms`, all `#ifdef _VMS_POSIX` / `#ifdef __VMS` blocks. -### 2c. Imake — Retire +### 2c. Imake — Retired -- Delete `Imakefile`. -- Delete `imake.config`. - Autotools is the sole build system going forward. +- Deleted `Imakefile` and `imake.config`. Autotools is the sole build system. -### 2d. `system/` — Prune Defunct Entries +### 2d. `system/` — Pruned to Active POSIX Platforms -**Retained** (actively supported POSIX platforms): +**Retained** (actively supported): | Directory | Platform | |-----------|----------| @@ -110,21 +104,16 @@ Status: **complete** | `os390` | IBM z/OS USS | | `minix` | Minix 3 | -**Removed** (no hardware has shipped in 25+ years, or platform is extinct): - -`alliant`, `amdahl`, `amiga`, `apollo`, `bs2000`, `clipper`, `coh3`, -`convex`, `cray`, `csos`, `dgux`, `dgux5.4`, `dnix5.3`, `eta10`, `ews`, -`fortune`, `fps500`, `hcx`, `hk68`, `hp-3.2`, `hp-5.2`, `hpbsd2`, -`hpux7`, `iconuxv`, `intel` (i860), `isc202`, `isc3.0`, `isc4.0`, -`lynx2.1`, `mac2`, `mach`, `machten`, `masscomp`, `mips` (old standalone), -`mtXinu`, `opus`, `powermaxos`, `pyr`, `pyratt`, `sco+odt`, `sco32v2`, -`sco32v4`, `sco32v5`, `sequent`, `sinix`, `stellar`, `sunos35`, `sunos40`, -`sunos41`, `sunos413`, `supermax`, `superux8`, `sxa`, `sysV68`, `sysV88`, -`sysv`, `sysv2`, `sysv3`, `sysv4`, `tc2000`, `tekXD88`, `ultrix`, -`unixpc`, `uwin`, `emx`, `xenix`. - -Update the platform-detection `case` in `configure.ac` to remove all -corresponding branches. +**Removed** (extinct or no hardware in 25+ years): `alliant`, `amdahl`, `amiga`, +`apollo`, `bs2000`, `clipper`, `coh3`, `convex`, `cray`, `csos`, `dgux`, +`dgux5.4`, `dnix5.3`, `eta10`, `ews`, `fortune`, `fps500`, `hcx`, `hk68`, +`hp-3.2`, `hp-5.2`, `hpbsd2`, `hpux7`, `iconuxv`, `intel` (i860), `isc202`, +`isc3.0`, `isc4.0`, `lynx2.1`, `mac2`, `mach`, `machten`, `masscomp`, +`mips` (old standalone), `mtXinu`, `opus`, `powermaxos`, `pyr`, `pyratt`, +`sco+odt`, `sco32v2`, `sco32v4`, `sco32v5`, `sequent`, `sinix`, `stellar`, +`sunos35`, `sunos40`, `sunos41`, `sunos413`, `supermax`, `superux8`, `sxa`, +`sysV68`, `sysV88`, `sysv`, `sysv2`, `sysv3`, `sysv4`, `tc2000`, `tekXD88`, +`ultrix`, `unixpc`, `uwin`, `emx`, `xenix`. --- @@ -136,20 +125,20 @@ Status: **partial** | # | File(s) | Task | |---|---------|------| -| 3.1 | `sh.char.h`, `sh.h` | Remove K&R `#ifndef __STDC__` prototype branches. C89 is the assumed floor. | -| 3.2 | `tc.alloc.c` | Delete the bundled malloc (`#ifndef SYSMALLOC` block). Always link the system allocator. Remove `SYSMALLOC` from the options string in `tc.vers.c`. | -| 3.3 | `sh.types.h` | Collapse platform typedef thicket onto `` and ``. Keep only types genuinely absent from C99. | -| 3.6 | `ed.screen.c` | Remove obsolete terminal-type `#ifdef` ladders. Retain only curses/terminfo paths. | -| 3.7 | `tc.os.c` | Audit `#ifdef _AIX`, `#ifdef sun`, etc. Remove all dead branches corresponding to Phase 2 removals. | -| 3.8 | `ed.screen.c`, `tw.parse.c`, `sh.exp.c` | Fix all `-Wdeprecated-non-prototype` and `-Wimplicit-function-declaration` warnings emitted by modern GCC/Clang. | +| 3.1 | `sh.char.h`, `sh.h` | Removed K&R `#ifndef __STDC__` prototype branches. C89 is the assumed floor. | +| 3.2 | `tc.alloc.c` | Deleted the bundled malloc (`#ifndef SYSMALLOC` block). Always link the system allocator. Removed `SYSMALLOC` from the options string in `tc.vers.c`. | +| 3.3 | `sh.types.h` | Collapsed 396-line platform typedef thicket onto `` and ``. Only `ptr_t`, `ioctl_t`, and Minix `caddr_t` remain. | +| 3.6 | `ed.screen.c` | Removed obsolete terminal-type `#ifdef` ladders. Retained only curses/terminfo paths. | +| 3.7 | `tc.os.c` | Audited and removed all dead branches corresponding to Phase 2 platform removals. | +| 3.8 | `ed.screen.c`, `tw.parse.c`, `sh.exp.c` | Fixed all `-Wdeprecated-non-prototype` and `-Wimplicit-function-declaration` warnings emitted by modern GCC/Clang. | ### Remaining | # | File(s) | Task | |---|---------|------| -| 3.4 | `gethost.c`, `host.defs` | Replace the compiled-in `host.defs` table parser with `getaddrinfo(3)`. `gethost.c` becomes a thin POSIX wrapper. | -| 3.5 | `glob.c`, `glob.h`, `configure.ac` | Probe for POSIX `glob(3)` in `configure.ac`; delegate to libc when available. Keep in-tree copy as fallback for platforms that lack it. | -| 3.9 | `nls/` | Run `catgen` + `gencat` with modern toolchain; verify all catalogues regenerate cleanly. Fix any broken catalogue. See also ISSUES.md. | +| 3.4 | `gethost.c`, `host.defs` | Replace compiled-in `host.defs` table parser with `getaddrinfo(3)`. | +| 3.5 | `glob.c`, `glob.h`, `configure.ac` | Probe for POSIX `glob(3)` in `configure.ac`; delegate to libc when available; keep in-tree copy as fallback. | +| 3.9 | `nls/` | Run `catgen` + `gencat` with modern toolchain; verify all catalogues regenerate cleanly. | --- @@ -161,32 +150,32 @@ Status: **partial** | Upstream | Severity | File(s) | Fix | |----------|----------|---------|-----| -| **#99** | High | `configure.ac`, `tc.func.c` | `undefined reference to 'crypt'` on modern glibc systems where crypt was split into `libxcrypt`. Fix: add `AC_SEARCH_LIBS([crypt], [crypt xcrypt])` to `configure.ac`. | -| **#101** (PR) | Medium | `sh.exp.c` | Signed integer overflow: `@ x = (1 << 63)` raises "Badly formed number". Fix: use unsigned arithmetic with explicit overflow detection. | +| **#99** | High | `configure.ac`, `tc.func.c` | `undefined reference to 'crypt'` on modern glibc. Fix: `AC_SEARCH_LIBS([crypt], [crypt xcrypt])`. | +| **#101** (PR) | Medium | `sh.exp.c` | Signed integer overflow: `@ x = (1 << 63)` raises "Badly formed number". Fix: unsigned arithmetic with overflow detection. | +| **#110** | Medium | `tc.prompt.c` | `%j` job-count in prompt counted all proclist entries. Fix: counts only live job leaders (`p_procid == p_jobid` && `PRUNNING\|PSTOPPED`). | +| **#107** (PR) | Medium | `sh.exp.c`, `sh.sem.c` | `$?a && "$a" != ""` throws if `a` is unset. Fix: `Dfix()` skips expansion for expression-evaluating builtins; expansion deferred until after short-circuit. | ### Remaining -| Upstream | Severity | File(s) | Fix | -|----------|----------|---------|-----| -| **#119** | Critical | `sh.proc.c` | `unshare --user --pid tcsh` hangs. Fork retry loop calls `sleep()` with interrupts disabled. Fix: check for disabled-interrupt condition; use `SIGALRM`-based timeout or `nanosleep` with signal unblocking. | -| **#117 / #121** | Critical | `sh.lex.c`, `sh.dol.c` | Unicode regression since 6.24.14: emoji/wide chars stripped from filenames passed to `source`, and from variable assignment via command substitution. Root cause: byte vs. character length confusion in the wide-string path. Fix: cherry-pick the upstream fix or bisect the 6.24.14 diff. | -| **#110** (PR) | Medium | `tc.prompt.c` | `%j` job-count in prompt does not update until after the next fork. Fix: copy the `dojobs()` update call into the prompt renderer. | -| **#107** (PR) | Medium | `sh.exp.c` | `$?a && "$a" != ""` throws if `a` is unset because expansion runs before short-circuit evaluation. Fix: postpone variable expansion inside expression operands. | -| **#93** | Low | `tw.color.c` | `ls-F` colour test failures with `CLICOLOR_FORCE`, `LSCOLORS`, `LS_COLORS` env vars. Audit colour detection logic and correct environment-variable precedence. | -| **#102 / #82** | Low | `tcsh.man.in` | Acute accent lintian warning; missing stdout/stderr pipe workaround in man page. Trivial text patches. See also ISSUES.md. | +| Upstream | Severity | File(s) | Fix needed | +|----------|----------|---------|------------| +| **#119** | Critical | `sh.proc.c` | `unshare --user --pid tcsh` hangs. Fork retry loop calls `sleep()` with interrupts disabled. Fix: use `SIGALRM`-based timeout or `nanosleep` with signal unblocking. | +| **#117 / #121** | Critical | `sh.lex.c`, `sh.dol.c` | Unicode regression since 6.24.14: emoji/wide chars stripped from filenames and variable assignments. Root cause: byte vs. character length confusion in the wide-string path. | +| **#93** | Low | `tw.color.c` | `ls-F` colour test failures with `CLICOLOR_FORCE`, `LSCOLORS`, `LS_COLORS`. Audit colour detection and environment-variable precedence. | +| **#102 / #82** | Low | `tcsh.man.in` | Acute accent lintian warning; missing stdout/stderr pipe workaround in man page. | --- -## Phase 5 — Feature Enhancements (upstream PRs worth merging) +## Phase 5 — Feature Enhancements (upstream PRs) Status: **complete** -| Upstream PR | Feature | Primary Files | Notes | -|-------------|---------|---------------|-------| -| **#77** | `function` built-in | `sh.func.c`, `sh.init.c`, `sh.parse.c`, `tc.decls.h` | 23-commit PR. Most-requested missing csh feature. Adds named function definitions. Needs full review and adaptation. Highest complexity item in the plan. | -| **#89** | Interactive comments (`#`) | `sh.lex.c`, `sh.parse.c` | `#` works in scripts but is ignored interactively. Bash/zsh parity. PR has several SIGSEGV-fix iterations — apply the final clean version only. | -| **#105** | Variable assignment from pipes/redirections | `sh.sem.c`, `sh.set.c` | `set x < file` and pipe-to-variable. High scripting value. | -| **#113** | Redirection in expression blocks | `sh.exp.c`, `sh.sem.c` | `if ( { cmd >& /dev/null } )` — redirection inside `{ }` expression blocks currently silently ignored. | +| Upstream PR | Feature | Primary Files | +|-------------|---------|---------------| +| **#77** | `function` built-in | `sh.func.c`, `sh.init.c`, `sh.parse.c`, `tc.decls.h` | +| **#89** | Interactive comments (`#`) | `sh.lex.c`, `sh.parse.c` | +| **#105** | Variable assignment from pipes/redirections | `sh.sem.c`, `sh.set.c` | +| **#113** | Redirection in `{ }` expression blocks | `sh.exp.c`, `sh.sem.c` | --- @@ -198,37 +187,68 @@ Status: **partial** | # | File | Task | |---|------|------| -| 6.1 | `configure.ac` | Add `AC_SEARCH_LIBS([crypt], [crypt xcrypt])` for modern glibc `libxcrypt` split (fixes #99). | -| 6.2 | `configure.ac` | Bump `AC_PREREQ` to `[2.72]`; audit and fix deprecated macros in `configure.ac` and `atlocal.in`. | -| 6.3 | `configure.ac` | Remove all dead platform-detection branches corresponding to Phase 2 `system/` removals. | -| 6.4 | `configure.ac` | Add `AC_CHECK_FUNC([glob], ...)` probe for libc `glob(3)` delegation (Phase 3.5). | -| 6.5 | `Makefile.in` | Strip remaining VMS and win32 dead targets/comments. | +| 6.1 | `configure.ac` | `AC_SEARCH_LIBS([crypt], [crypt xcrypt])` for modern `libxcrypt` split. | +| 6.2 | `configure.ac` | Bump `AC_PREREQ` to `[2.72]`; deprecated macros audited. | +| 6.3 | `configure.ac` | Removed all dead platform-detection branches from Phase 2 purge. | +| 6.4 | `configure.ac` | `AC_CHECK_FUNC([glob], ...)` probe for libc `glob(3)` delegation. | +| 6.5 | `Makefile.in` | Stripped remaining VMS and win32 dead targets/comments. | ### Remaining | # | File | Task | |---|------|------| -| 6.6 | `tests/` | Initialise the autotest harness (deferred in consolidation). Minimum suite: startup file order, `$mcsh`/`$tcsh` variable correctness, unicode filename round-trip, expression overflow, job-count prompt. | +| 6.6 | `tests/` | Initialise autotest harness. Minimum suite: startup file order, `$mcsh`/`$tcsh` variable correctness, unicode filename round-trip, expression overflow, job-count prompt. | --- ## Phase 7 — Documentation -Status: **partial** +Status: **complete (first pass)** -### Completed +| # | File | Status | +|---|------|--------| +| 7.1 | `tcsh.man.in` | Body-text disambiguation pass done. Remaining: add new-feature sections (Phase 5 features, `set syntax`, git prompt escapes, pushd/popd tree navigation). | +| 7.2 | `tcsh.man.in` | New-feature sections for `function`, interactive comments, pipe-to-variable: **pending**. | +| 7.3 | `README.md` | Fully updated: all features, bug fixes, prompt/directory-stack reference, `dot.mcshrc` section table, source layout. | +| 7.4 | `ISSUES.md` | Updated: completed work annotated, remaining open items current. | +| 7.5 | `PLAN.md` | This document — phased plan with accurate status and changelog. | -| # | File | Task | -|---|------|------| -| 7.3 | `README.md` | Describe: what mcsh is, build instructions, WSL usage, tcsh/csh compatibility layer, where to report bugs. | -| 7.4 | `ISSUES.md` | Update as items are resolved; mark completed phases. | +--- -### Remaining +## Phase 9 — Native mcsh Original Features -| # | File | Task | -|---|------|------| -| 7.1 | `tcsh.man.in` | Full body-text pass completing Phase 1.1: "the shell" → `.Nm` / `mcsh`; "tcsh-compat surface" → `tcsh`. Fix acute-accent lintian warnings (from #102). See also ISSUES.md. | -| 7.2 | `tcsh.man.in` | Add sections documenting new features landed in Phase 5: `function`, interactive comments, variable assignment from pipes. | +Status: **complete** + +Features developed natively for mcsh, with no upstream tcsh counterpart. + +| Feature | `set` variable | Primary Files | Notes | +|---------|----------------|---------------|-------| +| Fish-style predictive autocomplete | *(always active)* | `ed.chared.c`, `ed.refresh.c`, `ed.inputl.c` | Scans `Histlist` for prefix match; ghost text rendered dimmed after cursor. Right-Arrow / `^F` accepts. | +| Native git branch prompt escapes | *(always active)* | `tc.prompt.c` | `%g` = branch name; `%G` = branch + operation state. Cached per-CWD with independent HEAD and state-marker mtime tracking. | +| Filetype colouring in completion | `set color` | `tw.color.c`, `sh.set.c` | Drives `ls-F` completion listings via `LSCOLORS`/`LS_COLORS`. | +| **Interactive syntax highlighting** | **`set syntax`** | **`ed.syntax.c/h`, `ed.screen.c`, `ed.refresh.c`, `ed.inputl.c`, `sh.set.c`** | Virtual-display pipeline integration. Single-pass tokeniser fills `SyntaxColor[]`; `Draw()` propagates token colour into `Vdisplay[]` via `SYN_PACK()`; `so_write()` emits ANSI SGR per cell via `SetSGRColor()`. 32-entry LRU command cache avoids per-keystroke `stat(2)`. | +| **zsh-style pushd/popd tree display** | *(always active)* | `sh.dir.c` | pushd/popd default to numbered vertical display with `→` marking index 0. `cd -N` jumps to Nth entry from bottom of stack. | + +--- + +## Phase 8 — Code Review Fixes (PR3) + +Status: **complete** + +All Copilot, CodeRabbit, and Gemini findings from PR #3 resolved across three +iterative rounds. See `ISSUES.md` completed section and the PR comment at +`https://github.com/orpheus497/mcsh/pull/3#issuecomment-4289084043` for the +full itemised response. + +Key fixes: +- `configure.ac` TCSH_BASELINE_VERSION string literal fix +- `tc.prompt.c` git cache marker-mtime independence +- `ed.screen.c` `SetSGRColor` `ESC[22;39m` instead of `ESC[0m` +- `ed.refresh.c` `DrawGhost` same SGR fix +- `ed.inputl.c` no double `Refresh()` on `CC_NORM` + `set syntax` +- All `vms.termcap.c` buffer overflow and bounds issues +- All `sh.func.c`, `sh.sem.c`, `sh.set.c`, `sh.exp.c` expression safety fixes +- All `m4/`, `acaux/`, `alacritty.toml`, `dot.mcshrc` portability fixes --- @@ -236,13 +256,10 @@ Status: **partial** | Phase | Risk | Mitigation | |-------|------|------------| -| 2 | Platform detection branch removal breaks rare builds | Keep retained `system/` files unchanged; only delete. Build-test on Linux and FreeBSD before closing phase. | -| 3 | malloc replacement causes allocator mismatch | Replace in one commit; run full test suite immediately. | -| 3 | `gethost.c` replacement removes obscure compatibility | Document the behavioural change; the new path is strictly more correct on modern systems. | -| 4 | Unicode fix (#117/#121) re-introduces wide-string bugs | Write a regression test as part of the fix commit. | -| 5 | `function` built-in (PR #77) conflicts with existing parser | Full parser review required; do not merge as-is — adapt commit-by-commit. | -| 5 | Interactive comments (PR #89) re-introduces freeze/SIGSEGV | Apply only the final iteration of the PR, not intermediate commits. | -| 6 | autoconf 2.72 deprecations cause configure failures | Run `autoreconf -fi --warnings=all` and clear all warnings before considering the phase done. | +| 3 | `gethost.c` replacement removes obscure compatibility | Document the behavioural change; new path is strictly more correct on modern systems. | +| 3 | `glob.c` delegation breaks edge cases | Keep in-tree fallback; gate on configure probe. | +| 4 | Unicode fix (#117/#121) re-introduces wide-string bugs | Write regression test as part of the fix commit. | +| 6 | autoconf 2.72 deprecations cause configure failures | Run `autoreconf -fi --warnings=all` and clear all warnings. | --- @@ -250,6 +267,8 @@ Status: **partial** | Date | Entry | |------|-------| -| 2026-04-20 | Plan drafted from ISSUES.md audit + tcsh-org/tcsh open issues/PRs sweep. | -| 2026-04-20 | Phases 1–2 complete. Phases 3, 4, 6, 7 partial — see Remaining tables. Phase 5 features pending upstream review. | -| 2026-04-20 | Corrected phase statuses to reflect outstanding work (3.4, 3.5, 3.9, #119, #117/#121, #110, #107, #93, #102/#82, 6.6, 7.1, 7.2). | +| 2026-04-20 | Plan drafted from ISSUES.md audit + tcsh-org/tcsh open issues/PRs sweep. Phases 1–2 complete. Phases 3, 4, 6, 7 partial. | +| 2026-04-20 | Phase 5 features landed: fish-style predictive autocomplete, native git branch prompt escapes `%g`/`%G`, `set color` filetype colouring. | +| 2026-04-21 | Phase 4b + Phase 8 (round 1): all Gemini + CodeRabbit PR3 review items addressed. `vms.termcap.c` repurposed as portable termcap shim; `sh.func.c` `doif` widened to `tcsh_number_t`; `configure.ac` fixes; `dot.mcshrc` rewritten. README, PLAN, ISSUES updated. | +| 2026-04-21 | Phase 9: native interactive syntax highlighting (`set syntax`) landed. Virtual-display pipeline: `ed.syntax.c/h` tokeniser + LRU cache; `SYN_PACK`/`SYN_TOK`/`SYN_GLYPH` bit-packing into `Vdisplay Char`; `SetSGRColor()` per-cell ANSI SGR. | +| 2026-04-21 | Phase 8 (rounds 2–3): remaining Copilot review findings resolved — `TCSH_BASELINE_VERSION` string literal; git cache marker-mtime independence; `SetSGRColor`/`DrawGhost` `ESC[22;39m` SGR fix; `ed.inputl.c` no double `Refresh()`; zsh-style pushd/popd tree display and `cd -N` navigation added. All documentation updated to reflect current state. | diff --git a/README.md b/README.md index d3d10862..5e6cfa16 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,30 @@ # mcsh — Modern C Shell -**mcsh** is a consolidated, modernised fusion of -[tcsh](https://www.tcsh.org/) and the `etcsh` fork into a single, polished, -fully compatible reincarnation of the Berkeley C Shell. The installed -program is `mcsh(1)`. Everywhere in this repository, in the binary, and -in the manual page, the shell identifies itself as **Modern C Shell** — -not as tcsh, etcsh, or csh. - -mcsh is a work-in-progress. This tree is the first consolidation pass: the -complete program and package source of etcsh (itself a superset of the -upstream tcsh repository at `orpheus497/tcsh`) has been brought in as the -base, with announcements, release notes, and other non-source bloat omitted. +**mcsh** is a consolidated, modernised fusion of [tcsh](https://www.tcsh.org/) +and the `etcsh` fork into a single, polished, fully compatible reincarnation of +the Berkeley C Shell. The installed program is `mcsh(1)`. Everywhere in this +repository, in the binary, and in the manual page, the shell identifies itself +as **Modern C Shell** — not as tcsh, etcsh, or csh. + +--- ## Backward compatibility -mcsh is an mcsh-branded shell with full read-compatibility with existing -tcsh / csh setups: - -- **Start-up files.** mcsh reads `~/.mcshrc` first; if absent it falls - back to `~/.tcshrc` and then `~/.cshrc`, so an existing tcsh or csh - configuration keeps working unchanged. -- **Binary.** `make install` installs the program as `mcsh` with a - `tcsh` symlink alongside it, so scripts that invoke `tcsh` still run. -- **Manual page.** `man mcsh` is canonical; `man tcsh` is installed as - a symlink to the same page. -- **Shell variables.** Both `$mcsh` and `$tcsh` are set to the running - version string, so scripts guarded by `if ($?tcsh)` continue to fire. -- **`$version`.** The banner now reads - `mcsh () … [tcsh baseline ] options …`, - preserving the upstream tcsh version that mcsh was consolidated from - for any consumer that needs to probe it. +mcsh is a drop-in replacement for tcsh and csh: + +| Compatibility item | Behaviour | +|--------------------|-----------| +| **Start-up files** | Reads `~/.mcshrc` first; falls back to `~/.tcshrc` then `~/.cshrc`. No existing configuration needs renaming. | +| **Binary** | Installs as `mcsh`. A `tcsh` symlink is created alongside it so scripts that invoke `/usr/local/bin/tcsh` keep working. | +| **Manual page** | `man mcsh` is canonical. `man tcsh` is a symlink to the same page. | +| **Shell variables** | Both `$mcsh` and `$tcsh` are set to the running version string, so scripts guarded by `if ($?tcsh)` continue to fire. | +| **`$version`** | Banner reads `mcsh () … [tcsh baseline ] options …`, preserving the upstream tcsh version that mcsh was consolidated from. | + +--- ## Features added over upstream tcsh -These enhancements are already landed in the source tree and will ship -in the first numbered release: +### Language | Feature | Description | |---------|-------------| @@ -44,99 +34,256 @@ in the first numbered release: | **`function` builtin** | Named shell functions can be defined with `function name { body }` (tcsh PR #77) | | **Redirect in `{ }` blocks** | `if ( { cmd >& /dev/null } )` correctly honours the redirection (tcsh issue #113) | +### Editor / interactive experience + +| Feature | `set` variable | Description | +|---------|----------------|-------------| +| **Fish-style predictive autocomplete** | *(always active)* | As you type, the most recent matching history entry is shown as inline ghost text (dimmed). Press Right-Arrow or `^F` to accept the full suggestion. | +| **Interactive syntax highlighting** | `set syntax` | Per-keystroke ANSI colour highlighting of keywords, builtins, commands (ok/bad), operators, variables, strings (double/single/backtick), comments, and unmatched-quote errors. A 32-entry LRU cache avoids repeated `stat(2)` calls per `$PATH` lookup. | +| **Filetype colouring in completion** | `set color` | Coloured filetype indicators in tab-completion listings, driven by `LSCOLORS` / `LS_COLORS`. | + +### Prompt + +| Feature | Description | +|---------|-------------| +| **Native git branch** | `%g` expands to the current branch name; `%G` also appends the operation state (`main\|MERGING`, `main\|REBASING-i`, etc.). Both are empty outside a git repository. Cached per-CWD with independent HEAD and state-marker mtime tracking so merges, rebases, and cherry-picks are detected immediately without false refreshes. | + +### Directory stack (zsh-style navigation) + +| Feature | Description | +|---------|-------------| +| **Numbered tree display** | `pushd`, `popd`, and `cd` show the directory stack as a numbered vertical list after every navigation. The current directory (index 0) is marked with `→`. | +| **`dirs -v` arrow marker** | `dirs -v` marks index 0 with `→` so the current position is always visible at a glance. | +| **`cd -N`** | Jumps to stack entry N counted from the **bottom** (oldest entry), mirroring zsh's `cd -N` semantics. Complements the existing `cd +N` (forward from current). A bare `cd -` still switches to `$owd`. | +| **`pushd +N` / `popd +N`** | Unchanged: rotate or pop the Nth entry from the top. | + +#### Syntax highlighting token colours + +| Token | Default colour | +|-------|---------------| +| Keyword (`if`, `while`, `foreach`, …) | Bold cyan | +| Builtin (`set`, `alias`, `cd`, …) | Bold green | +| Command — found on `$PATH` | Green | +| Command — not found | Bold red | +| Operator (`\|`, `;`, `&&`, …) | Yellow | +| Variable (`$var`, `$?var`) | Magenta | +| Double-quoted string | Yellow | +| Single-quoted string | Yellow | +| Backtick substitution | Cyan | +| Comment | Bright black (grey) | +| Unmatched quote / error | Bold red | + +--- + ## Bug fixes over upstream tcsh | Fix | Description | |-----|-------------| -| `%j` prompt token | Now counts only live job leaders, not all process list entries | +| `%j` prompt token | Counts only live job leaders, not all process-list entries | | `getn()` overflow | `@ x = (1 << 63)` no longer raises "Badly formed number"; uses `strtoll` with overflow/errno checking | -| Shift operator UB | `<<` and `>>` now use unsigned arithmetic to eliminate signed-shift undefined behaviour | +| Shift operator UB | `<<` and `>>` use unsigned arithmetic to eliminate signed-shift undefined behaviour | | `crypt` link failure | `AC_SEARCH_LIBS([crypt], [crypt xcrypt])` handles the modern `libxcrypt` split | +| `vms.termcap.c` OOB scans | Colon-scan loops stop at `'\0'`; `sscanf` uses `%[^|:]` + `strcmp` for exact name matching; `fgets` continuation tracks remaining buffer capacity | +| `vms.termcap.c` tgoto | Static buffer enlarged to 64 bytes; `%d` uses `snprintf`; bounds checked throughout | +| `vms.termcap.c` octal | Octal digits `4`–`7` handled; continuation digits validated as `<= '7'` | +| `acaux/install-sh` name patterns | Case patterns use `*` suffix to catch multi-character names beginning with `-`, `=`, `(`, `)`, `!` | +| `m4/lib-prefix.m4` | `dn;` comment typo corrected to `dnl` | +| `m4/po.m4` C# DLL cleanup | Error cleanup removes the actual DLL target, not the `.msg` source | +| `configure.ac` patchlevel | `PACKAGE_PATCHLEVEL` stripped of leading zeros, preventing invalid C integer literals like `08` | +| `configure.ac` baseline version | `TCSH_BASELINE_VERSION` correctly expands `TCSH_VERSION` to a quoted C string literal in `config.h` | +| `sh.func.c` doif truncation | `doif()` uses `tcsh_number_t` to avoid truncating wide expression results | +| `ed.defns.c` catalog collision | `predict-accept` uses NLS catalog ID 124 (was 122, colliding with `newline-and-hold`) | +| `ed.screen.c` SGR desync | `SetSGRColor()` emits `ESC[22;39m` (not `ESC[0m`) for default-fg/no-bold, preserving `cur_atr` synchronisation | +| `ed.refresh.c` ghost SGR | `DrawGhost()` resets with `ESC[22;39m` (not `ESC[0m`) so `cur_atr` stays consistent on the incremental path | +| `ed.inputl.c` extra refresh | `CC_NORM` + `set syntax` calls `syntax_colorize()` directly without promoting to `CC_REFRESH`, eliminating the double `Refresh()` per keystroke | +| `tc.prompt.c` marker mtime | Git cache tracks HEAD mtime and state-marker max-mtime independently — a live `MERGE_HEAD` no longer forces a refresh on every prompt | +| `dch-template.in` distribution | Template uses `UNRELEASED` instead of `unstable` | +| `alacritty.toml` portability | Shell invoked by name via `PATH`; pywal import commented out as optional | + +--- + +## Prompt reference + +| Escape | Expands to | +|--------|-----------| +| `%g` | Current git branch name (empty outside a git repo) | +| `%G` | Branch name plus operation state: `main\|MERGING`, `main\|REBASING-i`, etc. (empty outside a git repo) | +| `%?` | Exit status of the last command | +| `%B` / `%b` | Bold on / off | +| `%U` / `%u` | Underline on / off | +| `%S` / `%s` | Standout (reverse video) on / off | +| `%{…%}` | Literal (zero-width) escape sequences | +| `%n` | Username | +| `%m` | Hostname (first component) | +| `%c02` / `%~` | Trailing 2 components of CWD / CWD with `~` substitution | +| `%j` | Number of running jobs | +| `%#` | `#` for root, `%` otherwise | + +Example — right-prompt showing git branch in standout: + +```csh +set rprompt = '%S%G%s' +``` + +Example — full colour prompt with git and exit status: + +```csh +set red = "%{\033[1;31m%}" +set green = "%{\033[1;32m%}" +set blue = "%{\033[1;34m%}" +set reset = "%{\033[0m%}" +set prompt = "${green}%n@%m${reset}:${blue}%B%c02%b${reset} [${red}%?${reset}] %# " +``` + +--- + +## Directory stack navigation + +mcsh adds zsh-style directory stack tree display and `cd -N` navigation. + +``` +% pushd ~/projects/foo # push new directory +0→ ~/projects/foo +1 ~/projects +2 ~ + +% pushd ~/etc +0→ ~/etc +1 ~/projects/foo +2 ~/projects +3 ~ + +% cd -2 # jump to entry 2 from bottom (oldest visible non-cwd) +0→ ~/projects/foo +1 ~/etc +2 ~/projects +3 ~ + +% popd +0→ ~/etc +1 ~/projects +2 ~ + +% dirs -v # explicit numbered listing +0→ ~/etc +1 ~/projects +2 ~ +``` + +Keybindings / aliases set by `dot.mcshrc`: + +| Alias | Command | +|-------|---------| +| `pd` | `pushd` | +| `po` | `popd` | +| `d` | `dirs -v` | +| `..` | `cd ..` | +| `...` | `cd ../..` | + +--- ## Source layout -The tree preserves the traditional tcsh flat layout so upstream-familiar -contributors stay oriented: - -| Prefix / file | Purpose | -| ----------------------------- | --------------------------------------------- | -| `sh.*.c` / `sh.*.h` | Core shell (parser, executor, history, etc.) | -| `ed.*.c` / `ed.*.h` | Command-line editor | -| `tc.*.c` / `tc.*.h` | tcsh extensions (prompts, bindings, NLS, ...) | -| `tw.*.c` / `tw.*.h` | Tab / word completion | -| `glob.c` / `glob.h` | Pattern globbing | -| `dotlock.c` / `dotlock.h` | History file locking | -| `mi.*`, `ma.setp.c` | POSIX / BSD compatibility shims | -| `gethost.c`, `host.defs` | Host-table generator | -| `nls/` | National Language Support catalogues | -| `system/` | Per-platform compile-time config fragments | -| `acaux/`, `m4/`, `build/` | Autoconf/autotools auxiliary | -| `configure.ac`, `Makefile.in` | GNU Autotools build | -| `complete.mcsh`, `complete.tcsh` | Programmable completions (mcsh-native and tcsh-compat) | -| `csh-mode.el` | Emacs major mode | -| `tcsh.man.in` | Manual page template | -| `dot.login`, `dot.tcshrc` | Example user start-up files | +The tree preserves the traditional tcsh flat layout: + +| Prefix / file | Purpose | +|---------------|---------| +| `sh.*.c` / `sh.*.h` | Core shell (parser, executor, history, jobs, directory stack, …) | +| `ed.*.c` / `ed.*.h` | Command-line editor (readline equivalent, syntax highlighting, ghost text) | +| `tc.*.c` / `tc.*.h` | tcsh extensions (prompts, key bindings, NLS, completion, …) | +| `tw.*.c` / `tw.*.h` | Tab / word completion and filetype colouring | +| `glob.c` / `glob.h` | Pattern globbing | +| `dotlock.c` / `dotlock.h` | History file locking | +| `mi.*`, `ma.setp.c` | POSIX / BSD compatibility shims | +| `gethost.c`, `host.defs` | Host-table generator | +| `ed.syntax.c` / `ed.syntax.h` | Native interactive syntax highlighting engine | +| `nls/` | National Language Support catalogues | +| `system/` | Per-platform compile-time config fragments | +| `acaux/`, `m4/` | Autoconf / autotools auxiliary files | +| `configure.ac`, `Makefile.in` | GNU Autotools build system | +| `complete.mcsh`, `complete.tcsh` | Programmable completion rules | +| `csh-mode.el` | Emacs major mode for csh/mcsh scripts | +| `tcsh.man.in` | Manual page template | +| `dot.login`, `dot.tcshrc`, `dot.mcshrc` | Example user start-up files | + +--- ## Building -### Linux / BSD / macOS +### Quick dev build (FreeBSD / Linux / macOS) ```sh -autoreconf -fi # regenerate configure (needed once, or after editing configure.ac) -./configure -make -sudo make install # installs mcsh + tcsh symlink +make # build in-tree; produces ./mcsh +sudo make install # installs mcsh + tcsh symlink ``` -### Windows (WSL) - -mcsh has no native Win32 support. On Windows, build and run mcsh inside -WSL (any WSL 1 or WSL 2 distro): +### From a clean checkout ```sh -# inside an Ubuntu/Debian WSL shell -sudo apt install build-essential autoconf -autoreconf -fi +autoreconf -fi # regenerate configure (needed once after editing configure.ac) ./configure make +sudo make install ``` -The resulting binary runs identically to the Linux build. To set mcsh as -your default WSL shell, add the installed path to `/etc/shells` and call -`chsh`. +### WSL (Windows Subsystem for Linux) + +mcsh has no native Win32 support. Build inside WSL: + +```sh +sudo apt install build-essential autoconf automake +autoreconf -fi && ./configure && make +``` ### Cygwin -Cygwin is supported as a genuine POSIX environment: +```sh +autoreconf -fi && ./configure && make +``` + +--- + +## dot.mcshrc reference + +`dot.mcshrc` is the canonical start-up file. Copy it to `~/.mcshrc`: ```sh -# inside a Cygwin terminal (install autoconf, gcc via Cygwin setup) -autoreconf -fi -./configure -make +cp dot.mcshrc ~/.mcshrc ``` +Sections and what they provide: + +| Section | Key settings | +|---------|-------------| +| **1 — Display server** | Wayland env vars gated behind `/dev/dri/card0` + `$WAYLAND_DISPLAY` presence check. Machine-specific GPU overrides go in `~/.mcshrc.local`. | +| **2 — System environment** | Prepends `~/.local/bin` to `$path`; sets `EDITOR`, `VISUAL`, `PAGER`, `LESS`, `BLOCKSIZE`, `CLICOLOR`, `LSCOLORS`. | +| **3 — Core execution engine** | `set autorehash`, `autolist=ambiguous`, `autoexpand`, `autocorrect`, `color`, **`syntax`**, `correct=cmd`, `ellipsis`, `filec`, `listjobs=long`, `listlinks`, `listmax=100`, `matchbeep=never`, `rmstar`, `symlinks=chase`; history 10 000 entries with merge-dedup to `~/.mcsh_history`. | +| **4 — Key bindings** | Emacs mode; Up/Down arrow history-search; Ctrl+Arrow word navigation; Home/End for xterm/vt100/rxvt/application-cursor; `magic-space`, `backward-delete-word`, `run-fg-editor`, `kill-region`. | +| **5 — Completions** | `cc`/`clang`/`gcc` (file extensions + `-I`/`-L`); `make` (reads live target list); `man`, `kill`, `sysctl`, `service`, `ifconfig`, `cd`, `tar`/`gzip`/`xz`/`bzip2`. | +| **6 — Aliases** | `ls -F -G`, `l`, `ll`, `df -h`, `du -ch`, `..`, `...`, `pd`/`po`/`d` (pushd/popd/dirs), `dis` (objdump Intel syntax), `cclean`, `h`, `j`, `m`, `g`. | +| **7 — Prompt** | `%g`/`%G` git escapes; colour-coded `prompt` with user@host, CWD, exit status; `rprompt='%S%G%s'`; `prompt2` and `prompt3` for multi-line and correction. | +| **8 — Host completion** | Builds `$hosts` from `~/.hosts`, `~/.rhosts`, `~/.ssh/known_hosts` for SSH/rlogin completion. | +| **9 — System-specific** | Sets `stty status ^G` + binds `stuff-char` on BSD/Darwin/FreeBSD/NetBSD; `set time` coloured format at the end so startup commands are not timed. | +| **Root guard** | Unsets `savehist`; sets `LESSHISTFILE=-` and `VIMINIT='set viminfo='` when `$uid == 0`. | +| **Local overrides** | Sources `~/.mcshrc.local` last if it exists — machine-specific GPU vars, paths, tokens go there. | + +--- + ## Compatibility notes -- mcsh sources `~/.mcshrc` on startup; falling back to `~/.tcshrc` then - `~/.cshrc`. No existing tcsh/csh configuration needs to be renamed. -- `complete.mcsh` is the mcsh-native completion file and the preferred - choice for new mcsh setups: it checks `$?mcsh` first and only falls back to - the legacy `$?tcsh` guard for shells that predate the `$mcsh` variable. - `complete.tcsh` is retained solely for legacy tcsh-only configurations where - `$mcsh` is never set. -- The `tcsh` binary symlink created by `make install` means existing - scripts, `/etc/shells` entries, and chsh configurations continue to work. +- mcsh sources `~/.mcshrc` on startup, falling back to `~/.tcshrc` then `~/.cshrc`. No existing configuration needs to be renamed. +- `complete.mcsh` is the mcsh-native completion file. `complete.tcsh` is retained for legacy setups that test `$?tcsh`. +- The `tcsh` binary symlink created by `make install` ensures existing scripts and `/etc/shells` entries keep working. + +--- ## Licensing -mcsh itself is BSD 3-Clause (see `LICENSE`). The upstream tcsh / etcsh -source that forms the bulk of this tree is BSD 3-Clause as well -(see `UPSTREAM-COPYRIGHT`). Both licenses are compatible and preserved; -redistribution must carry both notices — see `NOTICE` for details. +mcsh is BSD 3-Clause (see `LICENSE`). The upstream tcsh / etcsh source is also BSD 3-Clause (see `UPSTREAM-COPYRIGHT`). Redistribution must carry both notices — see `NOTICE` for details. + +--- ## Status -See `ISSUES.md` for the running log of bugs, compatibility items, and -modernisation tasks noticed during consolidation. See `PLAN.md` for the -full phased execution plan. +See `ISSUES.md` for the running log of bugs, compatibility items, and modernisation tasks. +See `PLAN.md` for the full phased execution plan. diff --git a/acaux/config.rpath b/acaux/config.rpath old mode 100644 new mode 100755 index 1e1ab679..58870bd7 --- a/acaux/config.rpath +++ b/acaux/config.rpath @@ -1,23 +1,15 @@ #! /bin/sh # Output a system dependent set of variables, describing how to set the -# run time search path of shared libraries in an executable. +# run time search path of shared libraries in a binary (executable or +# shared library). # -# Copyright 1996-2022 Free Software Foundation, Inc. +# Copyright 1996-2024 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 # Originally by Gordon Matzigkeit , 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld -# should be set by the caller. -# -# The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer @@ -25,6 +17,81 @@ # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage: config.rpath [OPTION] HOST + +Prints shell variable assignments that describe how to hardcode a directory +for the lookup of shared libraries into a binary (executable or shared library). + +The first argument passed to this file is the canonical host specification, + CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +or + CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + +The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +should be set by the caller. + +The set of defined variables is at the end of this script. + +Options: + --help print this help and exit + --version print version information and exit + +Send patches and bug reports to ." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "config.rpath (GNU gnulib, module havelib)" + echo "Copyright (C) 2024 Free Software Foundation, Inc. +License: All-Permissive. +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "config.rpath: *** $1" 1>&2 + echo "config.rpath: *** Stop." 1>&2 + exit 1 +} + +# Command-line option processing. +while test $# -gt 0; do + case "$1" in + --help | --hel | --he | --h ) + func_usage + exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Stop option processing + shift; break ;; + -* ) + func_fatal_error "unrecognized option: $1" + ;; + * ) + break ;; + esac +done + +if test $# -gt 1; then + func_fatal_error "too many arguments" +fi +if test $# -lt 1; then + func_fatal_error "too few arguments" +fi + # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a diff --git a/acaux/install-sh b/acaux/install-sh old mode 100644 new mode 100755 index 6781b987..bae408d7 --- a/acaux/install-sh +++ b/acaux/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2009-04-28.21; # UTC +scriptversion=2025-06-18.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,25 +35,21 @@ scriptversion=2009-04-28.21; # UTC # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it +# 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. +tab=' ' nl=' ' -IFS=" "" $nl" +IFS=" $tab$nl" -# set DOITPROG to echo to test this script +# Set DOITPROG to "echo" to test this script. -# Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi +doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. @@ -68,22 +64,16 @@ mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -97,7 +87,7 @@ dir_arg= dst_arg= copy_on_change=false -no_target_directory= +is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE @@ -114,19 +104,29 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Report bugs to . +GNU Automake home page: . +General help using GNU software: ." while test $# -ne 0; do case $1 in @@ -137,42 +137,62 @@ while test $# -ne 0; do -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift;; + shift;; + + -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; - -t) dst_arg=$2 - shift;; + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]*) dst_arg=./$dst_arg;; + esac + shift;; - -T) no_target_directory=true;; + -T) is_target_a_directory=never;; - --version) echo "$0 $scriptversion"; exit $?;; + --version) echo "$0 (GNU Automake) $scriptversion"; exit $?;; - --) shift - break;; + --) shift + break;; - -*) echo "$0: invalid option: $1" >&2 - exit 1;; + -*) echo "$0: invalid option: $1" >&2 + exit 1;; *) break;; esac shift done +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. @@ -186,6 +206,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]*) dst_arg=./$dst_arg;; + esac done fi @@ -194,13 +218,26 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call `install-sh -d' without argument. + # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. @@ -211,16 +248,16 @@ if test -z "$dir_arg"; then *[0-7]) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw='% 200' + u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw=,u+rw + u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac @@ -228,9 +265,9 @@ fi for src do - # Protect names starting with `-'. + # Protect names problematic for 'test' and other utilities. case $src in - -*) src=./$src;; + -* | [=\(\)!]*) src=./$src;; esac if test -n "$dir_arg"; then @@ -238,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -252,185 +293,150 @@ do echo "$0: no destination specified." >&2 exit 1 fi - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - + dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibility with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else - mkdir_mode= + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; + trap '' 0;; esac if $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; esac - eval "$initialize_posix_glob" - oIFS=$IFS IFS=/ - $posix_glob set -f + set -f set fnord $dstdir shift - $posix_glob set +f + set +f IFS=$oIFS prefixes= for d do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ done if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi fi fi @@ -443,14 +449,25 @@ do else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -465,20 +482,24 @@ do # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - + set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -486,24 +507,24 @@ do # to itself, or perhaps because mv is so ancient that it does not # support -f. { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 @@ -512,9 +533,9 @@ do done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp nil t) # time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-format: "%Y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/aclocal.m4 b/aclocal.m4 index b05ad9df..c527ebe6 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.5 -*- Autoconf -*- +# generated automatically by aclocal 1.18.1 -*- Autoconf -*- -# Copyright (C) 1996-2021 Free Software Foundation, Inc. +# Copyright (C) 1996-2025 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -12,2141 +12,8 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -# host-cpu-c-abi.m4 serial 17 -dnl Copyright (C) 2002-2024 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible and Sam Steingold. - -dnl Sets the HOST_CPU variable to the canonical name of the CPU. -dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its -dnl C language ABI (application binary interface). -dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in -dnl config.h. -dnl -dnl This canonical name can be used to select a particular assembly language -dnl source file that will interoperate with C code on the given host. -dnl -dnl For example: -dnl * 'i386' and 'sparc' are different canonical names, because code for i386 -dnl will not run on SPARC CPUs and vice versa. They have different -dnl instruction sets. -dnl * 'sparc' and 'sparc64' are different canonical names, because code for -dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code -dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit -dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit -dnl mode, but not both. -dnl * 'mips' and 'mipsn32' are different canonical names, because they use -dnl different argument passing and return conventions for C functions, and -dnl although the instruction set of 'mips' is a large subset of the -dnl instruction set of 'mipsn32'. -dnl * 'mipsn32' and 'mips64' are different canonical names, because they use -dnl different sizes for the C types like 'int' and 'void *', and although -dnl the instruction sets of 'mipsn32' and 'mips64' are the same. -dnl * The same canonical name is used for different endiannesses. You can -dnl determine the endianness through preprocessor symbols: -dnl - 'arm': test __ARMEL__. -dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. -dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. -dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 -dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because -dnl - Instructions that do not exist on all of these CPUs (cmpxchg, -dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your -dnl assembly language source files use such instructions, you will -dnl need to make the distinction. -dnl - Speed of execution of the common instruction set is reasonable across -dnl the entire family of CPUs. If you have assembly language source files -dnl that are optimized for particular CPU types (like GNU gmp has), you -dnl will need to make the distinction. -dnl See . -AC_DEFUN([gl_HOST_CPU_C_ABI], -[ - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gl_C_ASM]) - AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], - [case "$host_cpu" in - -changequote(,)dnl - i[34567]86 ) -changequote([,])dnl - gl_cv_host_cpu_c_abi=i386 - ;; - - x86_64 ) - # On x86_64 systems, the C compiler may be generating code in one of - # these ABIs: - # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. - # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 - # with native Windows (mingw, MSVC). - # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if (defined __x86_64__ || defined __amd64__ \ - || defined _M_X64 || defined _M_AMD64) - int ok; - #else - error fail - #endif - ]])], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __ILP32__ || defined _ILP32 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=x86_64-x32], - [gl_cv_host_cpu_c_abi=x86_64])], - [gl_cv_host_cpu_c_abi=i386]) - ;; - -changequote(,)dnl - alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) -changequote([,])dnl - gl_cv_host_cpu_c_abi=alpha - ;; - - arm* | aarch64 ) - # Assume arm with EABI. - # On arm64 systems, the C compiler may be generating code in one of - # these ABIs: - # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. - # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef __aarch64__ - int ok; - #else - error fail - #endif - ]])], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __ILP32__ || defined _ILP32 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=arm64-ilp32], - [gl_cv_host_cpu_c_abi=arm64])], - [# Don't distinguish little-endian and big-endian arm, since they - # don't require different machine code for simple operations and - # since the user can distinguish them through the preprocessor - # defines __ARMEL__ vs. __ARMEB__. - # But distinguish arm which passes floating-point arguments and - # return values in integer registers (r0, r1, ...) - this is - # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which - # passes them in float registers (s0, s1, ...) and double registers - # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer - # sets the preprocessor defines __ARM_PCS (for the first case) and - # __ARM_PCS_VFP (for the second case), but older GCC does not. - echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c - # Look for a reference to the register d0 in the .s file. - AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 - if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then - gl_cv_host_cpu_c_abi=armhf - else - gl_cv_host_cpu_c_abi=arm - fi - rm -f conftest* - ]) - ;; - - hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) - # On hppa, the C compiler may be generating 32-bit code or 64-bit - # code. In the latter case, it defines _LP64 and __LP64__. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef __LP64__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=hppa64], - [gl_cv_host_cpu_c_abi=hppa]) - ;; - - ia64* ) - # On ia64 on HP-UX, the C compiler may be generating 64-bit code or - # 32-bit code. In the latter case, it defines _ILP32. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef _ILP32 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=ia64-ilp32], - [gl_cv_host_cpu_c_abi=ia64]) - ;; - - mips* ) - # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this - # at 32. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=mips64], - [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but - # may later get defined by ), and _MIPS_SIM == _ABIN32. - # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but - # may later get defined by ), and _MIPS_SIM == _ABIO32. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if (_MIPS_SIM == _ABIN32) - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=mipsn32], - [gl_cv_host_cpu_c_abi=mips])]) - ;; - - powerpc* ) - # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. - # No need to distinguish them here; the caller may distinguish - # them based on the OS. - # On powerpc64 systems, the C compiler may still be generating - # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may - # be generating 64-bit code. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined __LP64__ - int ok; - #else - error fail - #endif - ]])], - [# On powerpc64, there are two ABIs on Linux: The AIX compatible - # one and the ELFv2 one. The latter defines _CALL_ELF=2. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined _CALL_ELF && _CALL_ELF == 2 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=powerpc64-elfv2], - [gl_cv_host_cpu_c_abi=powerpc64]) - ], - [gl_cv_host_cpu_c_abi=powerpc]) - ;; - - rs6000 ) - gl_cv_host_cpu_c_abi=powerpc - ;; - - riscv32 | riscv64 ) - # There are 2 architectures (with variants): rv32* and rv64*. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if __riscv_xlen == 64 - int ok; - #else - error fail - #endif - ]])], - [cpu=riscv64], - [cpu=riscv32]) - # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. - # Size of 'long' and 'void *': - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __LP64__ - int ok; - #else - error fail - #endif - ]])], - [main_abi=lp64], - [main_abi=ilp32]) - # Float ABIs: - # __riscv_float_abi_double: - # 'float' and 'double' are passed in floating-point registers. - # __riscv_float_abi_single: - # 'float' are passed in floating-point registers. - # __riscv_float_abi_soft: - # No values are passed in floating-point registers. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __riscv_float_abi_double - int ok; - #else - error fail - #endif - ]])], - [float_abi=d], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __riscv_float_abi_single - int ok; - #else - error fail - #endif - ]])], - [float_abi=f], - [float_abi='']) - ]) - gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" - ;; - - s390* ) - # On s390x, the C compiler may be generating 64-bit (= s390x) code - # or 31-bit (= s390) code. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __LP64__ || defined __s390x__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=s390x], - [gl_cv_host_cpu_c_abi=s390]) - ;; - - sparc | sparc64 ) - # UltraSPARCs running Linux have `uname -m` = "sparc64", but the - # C compiler still generates 32-bit code. - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if defined __sparcv9 || defined __arch64__ - int ok; - #else - error fail - #endif - ]])], - [gl_cv_host_cpu_c_abi=sparc64], - [gl_cv_host_cpu_c_abi=sparc]) - ;; - - *) - gl_cv_host_cpu_c_abi="$host_cpu" - ;; - esac - ]) - - dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. - HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` - HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" - AC_SUBST([HOST_CPU]) - AC_SUBST([HOST_CPU_C_ABI]) - - # This was - # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) - # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) - # earlier, but KAI C++ 3.2d doesn't like this. - sed -e 's/-/_/g' >> confdefs.h <. -dnl Don't make changes that are incompatible with that documentation! - -AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], -[ - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([iconv]) -]) - -AC_DEFUN([AM_ICONV_LINK], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. - gl_saved_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - - AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_func_iconv=yes]) - if test "$am_cv_func_iconv" != yes; then - gl_saved_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_lib_iconv=yes] - [am_cv_func_iconv=yes]) - LIBS="$gl_saved_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ - dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, - dnl Solaris 10. - gl_saved_LIBS="$LIBS" - if test $am_cv_lib_iconv = yes; then - LIBS="$LIBS $LIBICONV" - fi - am_cv_func_iconv_works=no - for ac_iconv_const in '' 'const'; do - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - -#ifndef ICONV_CONST -# define ICONV_CONST $ac_iconv_const -#endif - ]], - [[int result = 0; - /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from - successful returns. This is even documented in - */ - { - iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); - if (cd_utf8_to_88591 != (iconv_t)(-1)) - { - static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ - char buf[10]; - ICONV_CONST char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_utf8_to_88591, - &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 1; - iconv_close (cd_utf8_to_88591); - } - } - /* Test against Solaris 10 bug: Failures are not distinguishable from - successful returns. */ - { - iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); - if (cd_ascii_to_88591 != (iconv_t)(-1)) - { - static ICONV_CONST char input[] = "\263"; - char buf[10]; - ICONV_CONST char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_ascii_to_88591, - &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 2; - iconv_close (cd_ascii_to_88591); - } - } - /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static ICONV_CONST char input[] = "\304"; - static char buf[2] = { (char)0xDE, (char)0xAD }; - ICONV_CONST char *inptr = input; - size_t inbytesleft = 1; - char *outptr = buf; - size_t outbytesleft = 1; - size_t res = iconv (cd_88591_to_utf8, - &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) - result |= 4; - iconv_close (cd_88591_to_utf8); - } - } -#if 0 /* This bug could be worked around by the caller. */ - /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - char buf[50]; - ICONV_CONST char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_88591_to_utf8, - &inptr, &inbytesleft, - &outptr, &outbytesleft); - if ((int)res > 0) - result |= 8; - iconv_close (cd_88591_to_utf8); - } - } -#endif - /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is - provided. */ - { - /* Try standardized names. */ - iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); - /* Try IRIX, OSF/1 names. */ - iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); - /* Try AIX names. */ - iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); - /* Try HP-UX names. */ - iconv_t cd4 = iconv_open ("utf8", "eucJP"); - if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) - && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) - result |= 16; - if (cd1 != (iconv_t)(-1)) - iconv_close (cd1); - if (cd2 != (iconv_t)(-1)) - iconv_close (cd2); - if (cd3 != (iconv_t)(-1)) - iconv_close (cd3); - if (cd4 != (iconv_t)(-1)) - iconv_close (cd4); - } - return result; -]])], - [am_cv_func_iconv_works=yes], , - [case "$host_os" in - aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; - *) am_cv_func_iconv_works="guessing yes" ;; - esac]) - test "$am_cv_func_iconv_works" = no || break - done - LIBS="$gl_saved_LIBS" - ]) - case "$am_cv_func_iconv_works" in - *no) am_func_iconv=no am_cv_lib_iconv=no ;; - *) am_func_iconv=yes ;; - esac - else - am_func_iconv=no am_cv_lib_iconv=no - fi - if test "$am_func_iconv" = yes; then - AC_DEFINE([HAVE_ICONV], [1], - [Define if you have the iconv() function and it works.]) - fi - if test "$am_cv_lib_iconv" = yes; then - AC_MSG_CHECKING([how to link with libiconv]) - AC_MSG_RESULT([$LIBICONV]) - else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$gl_saved_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - AC_SUBST([LIBICONV]) - AC_SUBST([LTLIBICONV]) -]) - -dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like -dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". -AC_DEFUN_ONCE([AM_ICONV], -[ - AM_ICONV_LINK - if test "$am_cv_func_iconv" = yes; then - AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], - [gl_cv_iconv_nonconst], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); - ]], - [[]])], - [gl_cv_iconv_nonconst=yes], - [gl_cv_iconv_nonconst=no]) - ]) - else - dnl When compiling GNU libiconv on a system that does not have iconv yet, - dnl pick the POSIX compliant declaration without 'const'. - gl_cv_iconv_nonconst=yes - fi - if test $gl_cv_iconv_nonconst = yes; then - iconv_arg1="" - else - iconv_arg1="const" - fi - AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], - [Define as const if the declaration of iconv() needs const.]) - dnl Also substitute ICONV_CONST in the gnulib generated . - m4_ifdef([gl_ICONV_H_DEFAULTS], - [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - if test $gl_cv_iconv_nonconst != yes; then - ICONV_CONST="const" - fi - ]) - - dnl A summary result, for those packages which want to print a summary at the - dnl end of the configuration. - if test "$am_func_iconv" = yes; then - if test -n "$LIBICONV"; then - am_cv_func_iconv_summary='yes, in libiconv' - else - am_cv_func_iconv_summary='yes, in libc' - fi - else - if test "$am_cv_func_iconv" = yes; then - am_cv_func_iconv_summary='not working, consider installing GNU libiconv' - else - am_cv_func_iconv_summary='no, consider installing GNU libiconv' - fi - fi -]) - -# lib-ld.m4 serial 13 -dnl Copyright (C) 1996-2003, 2009-2024 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid -dnl collision with libtool.m4. - -dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 /dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi - -if test -n "$LD"; then - AC_MSG_CHECKING([for ld]) -elif test "$GCC" = yes; then - AC_MSG_CHECKING([for ld used by $CC]) -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -if test -n "$LD"; then - # Let the user override the test with a path. - : -else - AC_CACHE_VAL([acl_cv_path_LD], - [ - acl_cv_path_LD= # Final result of this test - ac_prog=ld # Program to search in $PATH - if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - case $host in - *-*-mingw* | windows*) - # gcc leaves a trailing carriage return which upsets mingw - acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - acl_output=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $acl_output in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` - while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do - acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` - done - # Got the pathname. No search in PATH is needed. - acl_cv_path_LD="$acl_output" - ac_prog= - ;; - "") - # If it fails, then pretend we aren't using GCC. - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac - fi - if test -n "$ac_prog"; then - # Search for $ac_prog in $PATH. - acl_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$acl_saved_IFS" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE([rpath], - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_FROMPACKAGE(name, package) -dnl declares that libname comes from the given package. The configure file -dnl will then not have a --with-libname-prefix option but a -dnl --with-package-prefix option. Several libraries can come from the same -dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar -dnl macro call that searches for libname. -AC_DEFUN([AC_LIB_FROMPACKAGE], -[ - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_frompackage_]NAME, [$2]) - popdef([NAME]) - pushdef([PACK],[$2]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) - popdef([PACKUP]) - popdef([PACK]) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found -dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" - eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - ]) - AC_ARG_WITH(PACK[-prefix], -[[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib - --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" - eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - additional_libdir2="$withval/$acl_libdirstem2" - additional_libdir3="$withval/$acl_libdirstem3" - fi - fi -]) - if test "X$additional_libdir2" = "X$additional_libdir"; then - additional_libdir2= - fi - if test "X$additional_libdir3" = "X$additional_libdir"; then - additional_libdir3= - fi - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Use breadth-first search. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - LIB[]NAME[]_PREFIX= - dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been - dnl computed. So it has to be reset here. - HAVE_LIB[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do - if test "X$found_dir" = "X"; then - eval dir=\$$additional_libdir_variable - if test -n "$dir"; then - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - fi - done - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$acl_hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem3 | */$acl_libdirstem3/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - saved_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$saved_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ - && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then - haveit= - if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ - || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$dependency_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$dependency_libdir"; then - dnl Really add $dependency_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$dependency_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$dependency_libdir"; then - dnl Really add $dependency_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - dnl But on GNU systems, ignore -lc options, because - dnl - linking with libc is the default anyway, - dnl - linking with libc.a may produce an error - dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" - dnl or may produce an executable that always crashes, see - dnl . - dep=`echo "X$dep" | sed -e 's/^X-l//'` - if test "X$dep" != Xc \ - || case $host_os in - linux* | gnu* | k*bsd*-gnu) false ;; - *) true ;; - esac; then - names_next_round="$names_next_round $dep" - fi - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. - acl_saved_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_saved_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_saved_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_saved_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi - popdef([PACKLIBS]) - popdef([PACKUP]) - popdef([PACK]) - popdef([NAME]) -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -dnl For those cases where a variable contains several -L and -l options -dnl referring to unknown libraries and directories, this macro determines the -dnl necessary additional linker options for the runtime path. -dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) -dnl sets LDADDVAR to linker options needed together with LIBSVALUE. -dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, -dnl otherwise linking without libtool is assumed. -AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -[ - AC_REQUIRE([AC_LIB_RPATH]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - $1= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode directories into the resulting - dnl binary. - rpathdirs= - next= - for opt in $2; do - if test -n "$next"; then - dir="$next" - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2" \ - && test "X$dir" != "X/usr/$acl_libdirstem3"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2" \ - && test "X$dir" != "X/usr/$acl_libdirstem3"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""$3""; then - dnl libtool is used for linking. Use -R options. - for dir in $rpathdirs; do - $1="${$1}${$1:+ }-R$dir" - done - else - dnl The linker is used for linking directly. - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user - dnl must pass all path elements in one option. - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_saved_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_saved_libdir" - $1="$flag" - else - dnl The -rpath options are cumulative. - for dir in $rpathdirs; do - acl_saved_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_saved_libdir" - $1="${$1}${$1:+ }$flag" - done - fi - fi - fi - fi - fi - AC_SUBST([$1]) -]) - -# lib-prefix.m4 serial 22 -dnl Copyright (C) 2001-2005, 2008-2024 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH([lib-prefix], -[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_saved_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_saved_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_saved_prefix="$prefix" - prefix="$acl_final_prefix" - acl_saved_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_saved_exec_prefix" - prefix="$acl_saved_prefix" -]) - -dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a function acl_is_expected_elfclass, that tests whether standard input -dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, -dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing -dnl the basename of the libdir to try in turn, either "lib" or "lib64" or -dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. -AC_DEFUN([AC_LIB_PREPARE_MULTILIB], -[ - dnl There is no formal standard regarding lib, lib32, and lib64. - dnl On most glibc systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on - dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go - dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. - dnl We determine the compiler's default mode by looking at the compiler's - dnl library search path. If at least one of its elements ends in /lib64 or - dnl points to a directory whose absolute pathname ends in /lib64, we use that - dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, - dnl namely "lib". - dnl On Solaris systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or - dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) - - AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], - [AC_EGREP_CPP([Extensible Linking Format], - [#if defined __ELF__ || (defined __linux__ && defined __EDG__) - Extensible Linking Format - #endif - ], - [gl_cv_elf=yes], - [gl_cv_elf=no]) - ]) - if test $gl_cv_elf = yes; then - # Extract the ELF class of a file (5th byte) in decimal. - # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header - if od -A x < /dev/null >/dev/null 2>/dev/null; then - # Use POSIX od. - func_elfclass () - { - od -A n -t d1 -j 4 -N 1 - } - else - # Use BSD hexdump. - func_elfclass () - { - dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' - echo - } - fi - # Use 'expr', not 'test', to compare the values of func_elfclass, because on - # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, - # not 1 or 2. -changequote(,)dnl - case $HOST_CPU_C_ABI_32BIT in - yes) - # 32-bit ABI. - acl_is_expected_elfclass () - { - expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null - } - ;; - no) - # 64-bit ABI. - acl_is_expected_elfclass () - { - expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null - } - ;; - *) - # Unknown. - acl_is_expected_elfclass () - { - : - } - ;; - esac -changequote([,])dnl - else - acl_is_expected_elfclass () - { - : - } - fi - - dnl Allow the user to override the result by setting acl_cv_libdirstems. - AC_CACHE_CHECK([for the common suffixes of directories in the library search path], - [acl_cv_libdirstems], - [dnl Try 'lib' first, because that's the default for libdir in GNU, see - dnl . - acl_libdirstem=lib - acl_libdirstem2= - acl_libdirstem3= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl . - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - if test $HOST_CPU_C_ABI_32BIT = no; then - acl_libdirstem2=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem3=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; - esac - fi - ;; - netbsd*) - dnl On NetBSD/sparc64, there is a 'sparc' subdirectory that contains - dnl 32-bit libraries. - if test $HOST_CPU_C_ABI_32BIT != no; then - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparc ;; - esac - fi - ;; - *) - dnl If $CC generates code for a 32-bit ABI, the libraries are - dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. - dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries - dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. - dnl Find the compiler's search path. However, non-system compilers - dnl sometimes have odd library search paths. But we can't simply invoke - dnl '/usr/bin/gcc -print-search-dirs' because that would not take into - dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. - searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ - | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test $HOST_CPU_C_ABI_32BIT != no; then - # 32-bit or unknown ABI. - if test -d /usr/lib32; then - acl_libdirstem2=lib32 - fi - fi - if test $HOST_CPU_C_ABI_32BIT != yes; then - # 64-bit or unknown ABI. - if test -d /usr/lib64; then - acl_libdirstem3=lib64 - fi - fi - if test -n "$searchpath"; then - acl_saved_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; - */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib32 ) acl_libdirstem2=lib32 ;; - */lib64 ) acl_libdirstem3=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_saved_IFS" - if test $HOST_CPU_C_ABI_32BIT = yes; then - # 32-bit ABI. - acl_libdirstem3= - fi - if test $HOST_CPU_C_ABI_32BIT = no; then - # 64-bit ABI. - acl_libdirstem2= - fi - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" - acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" - ]) - dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and - dnl acl_libdirstem3. -changequote(,)dnl - acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` - acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` - acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` -changequote([,])dnl -]) - +m4_include([m4/host-cpu-c-abi.m4]) +m4_include([m4/iconv.m4]) +m4_include([m4/lib-ld.m4]) +m4_include([m4/lib-link.m4]) +m4_include([m4/lib-prefix.m4]) diff --git a/config.h.in b/config.h.in index 9be3187e..47e1f35f 100644 --- a/config.h.in +++ b/config.h.in @@ -63,6 +63,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define if the system provides a POSIX glob(3) function. */ +#undef HAVE_LIBC_GLOB + /* Define to 1 if the system has the type 'long long'. */ #undef HAVE_LONG_LONG @@ -142,9 +145,6 @@ /* Define to 1 if you have the 'strtoll' function. */ #undef HAVE_STRTOLL -/* Define to 1 if the system provides a POSIX glob(3) function. */ -#undef HAVE_LIBC_GLOB - /* Define to 1 if 'd_ino' is a member of 'struct dirent'. */ #undef HAVE_STRUCT_DIRENT_D_INO @@ -254,6 +254,9 @@ backward compatibility; new code need not use it. */ #undef STDC_HEADERS +/* Upstream tcsh version that mcsh was consolidated from. */ +#undef TCSH_BASELINE_VERSION + /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ diff --git a/configure b/configure new file mode 100755 index 00000000..cf3d2ae6 --- /dev/null +++ b/configure @@ -0,0 +1,10600 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.73 for mcsh 0.1.0. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2026 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # contradicts POSIX and common usage. Disable this. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf '%s\n' "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +case $# in # (( + 0) exec $CONFIG_SHELL $as_opts "$as_myself" ;; + *) exec $CONFIG_SHELL $as_opts "$as_myself" "$@" ;; +esac +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf '%s\n' "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # contradicts POSIX and common usage. Disable this. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else case e in #( + e) case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else case e in #( + e) exitcode=1; echo positional parameters were not saved. ;; +esac +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else case e in #( + e) as_have_required=no ;; +esac +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi ;; +esac +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +case $# in # (( + 0) exec $CONFIG_SHELL $as_opts "$as_myself" ;; + *) exec $CONFIG_SHELL $as_opts "$as_myself" "$@" ;; +esac +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf '%s\n' "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf '%s\n' "$0: This script requires a shell more modern than all" + printf '%s\n' "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf '%s\n' "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf '%s\n' "$0: be upgraded to zsh 4.3.4 or later." + else + printf '%s\n' "$0: Please tell bug-autoconf@gnu.org and +$0: https://github.com/orpheus497/mcsh/issues about your +$0: system, including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi ;; +esac +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf '%s\n' "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf '%s\n' X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf '%s\n' "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf '%s\n' X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + t clear + :clear + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf '%s\n' "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_CONFIG_STATUS= +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='mcsh' +PACKAGE_TARNAME='mcsh' +PACKAGE_VERSION='0.1.0' +PACKAGE_STRING='mcsh 0.1.0' +PACKAGE_BUGREPORT='https://github.com/orpheus497/mcsh/issues' +PACKAGE_URL='https://github.com/orpheus497/mcsh' + +ac_unique_file="tc.vers.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +ac_subst_vars='LTLIBOBJS +LIBOBJS +BUILD_CATALOGS +HESLIB +HESDEF +DFLAGS +LDFLAGS_FOR_BUILD +CPPFLAGS_FOR_BUILD +CFLAGS_FOR_BUILD +CC_FOR_GETHOST +GENCAT +LTLIBICONV +LIBICONV +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +RELEASE_TAG +PACKAGE_PATCHLEVEL +PACKAGE_VERS +PACKAGE_REV +PACKAGE_CHANGELOG_DATE +PACKAGE_ENGLISH_DATE +TCSH_BASELINE_DATE +TCSH_BASELINE_VERS +PACKAGE_MAILLIST +PACKAGE_ORIGIN +PACKAGE_DATE +ECHO_T +ECHO_N +ECHO_C +target_alias +host_alias +build_alias +LIBS +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_gnu_ld +enable_rpath +with_libiconv_prefix +enable_nls +enable_nls_catalogs +with_hesiod +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf '%s\n' "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf '%s\n' "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf '%s\n' "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf '%s\n' "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: '$ac_option' +Try '$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: '$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf '%s\n' "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf '%s\n' "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`printf '%s\n' $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf '%s\n' "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: '$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf '%s\n' X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +'configure' configures mcsh 0.1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print 'checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for '--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or '..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, 'make install' will install all the files in +'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify +an installation prefix other than '$ac_default_prefix' using '--prefix', +for instance '--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/mcsh] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of mcsh 0.1.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rpath do not hardcode runtime library paths + --disable-nls Disable NLS support + --disable-nls-catalogs Disable NLS catalog support + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir + --with-hesiod=PREFIX Use Hesiod lookup for ~ expansion + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by 'configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +mcsh home page: . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf '%s\n' "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf '%s\n' "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf '%s\n' "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +mcsh configure 0.1.0 +generated by GNU Autoconf 2.73 + +Copyright (C) 2026 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + 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\"" +printf '%s\n' "$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 + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf '%s\n' "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 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 + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else case e in #( + e) printf '%s\n' "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_link") 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 + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf '%s\n' "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { 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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else case e in #( + e) printf '%s\n' "$as_me: program exited with status $ac_status" >&5 + printf '%s\n' "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status ;; +esac +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# 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 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (void); below. */ + +#include +#undef $2 + +/* 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 $2 (void); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else case e in #( + e) eval "$3=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$3 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# 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 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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 case e in #( + e) eval "$3=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$3 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=$ac_mid; break +else case e in #( + e) as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_lo=$ac_mid; break +else case e in #( + e) as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done +else case e in #( + e) ac_lo= ac_hi= ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=$ac_mid +else case e in #( + e) as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } +#include +#include +int +main (void) +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + echo >>conftest.val; read $3 &5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) eval "$3=yes" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$3 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +printf %s "checking for uint$2_t... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + if eval test \"x\$"$3"\" = x"no" +then : + +else case e in #( + e) break ;; +esac +fi + done ;; +esac +fi +eval ac_res=\$$3 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_find_uintX_t + +# 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 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +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 case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +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 case e in #( + e) eval "$4=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$4 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member + +# ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR +# ------------------------------------------------------------------ +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. +ac_fn_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else case e in #( + e) eval "$3=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + ;; +esac +fi +eval ac_res=\$$3 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_check_decl +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf '%s\n' "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf '%s\n' "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by mcsh $as_me 0.1.0, which was +generated by GNU Autoconf 2.73. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf '%s\n' "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf '%s\n' "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# Dump the cache to stdout. It can be in a pipe (this is a requirement). +ac_cache_dump () +{ + # The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf '%s\n' "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # 'set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # 'set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) +} + +# Print debugging info to stdout. +ac_dump_debugging_info () +{ + echo + + printf '%s\n' "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + ac_cache_dump + echo + + printf '%s\n' "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'*) ac_val=`printf '%s\n' "$ac_val" | sed "s/'/'\\\\\\\\''/g"`;; + esac + printf '%s\n' "$ac_var='$ac_val'" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf '%s\n' "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'*) ac_val=`printf '%s\n' "$ac_val" | sed "s/'/'\\\\\\\\''/g"`;; + esac + printf '%s\n' "$ac_var='$ac_val'" + done | sort + echo + fi + + if test -s confdefs.h; then + printf '%s\n' "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf '%s\n' "$as_me: caught signal $ac_signal" + printf '%s\n' "$as_me: exit $exit_status" +} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. +ac_exit_trap () +{ + exit_status= + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + ac_dump_debugging_info >&5 + eval "rm -f $ac_clean_CONFIG_STATUS core *.core core.conftest.*" && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +} + +trap 'ac_exit_trap $?' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf '%s\n' "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf '%s\n' "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf '%s\n' "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf '%s\n' "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf '%s\n' "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf '%s\n' "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf '%s\n' "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf '%s\n' "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See 'config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf '%s\n' "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf '%s\n' "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C compiler supports C23 (global declarations) +ac_c_conftest_c23_globals=' +/* Does the compiler advertise conformance to C17 or earlier? + Although GCC 14 does not do that, even with -std=gnu23, + it is close enough, and defines __STDC_VERSION == 202000L. */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ <= 201710L +# error "Compiler advertises conformance to C17 or earlier" +#endif + +// Check alignas. +char alignas (double) c23_aligned_as_double; +char alignas (0) c23_no_special_alignment; +extern char c23_aligned_as_int; +char alignas (0) alignas (int) c23_aligned_as_int; + +// Check alignof. +enum +{ + c23_int_alignment = alignof (int), + c23_int_array_alignment = alignof (int[100]), + c23_char_alignment = alignof (char) +}; +static_assert (0 < -alignof (int), "alignof is signed"); + +int function_with_unnamed_parameter (int) { return 0; } + +void c23_noreturn (); + +/* Test parsing of string and char UTF-8 literals (including hex escapes). + The parens pacify GCC 15. */ +bool use_u8 = (!sizeof u8"\xFF") == (!u8'\''x'\''); + +bool check_that_bool_works = true | false | !nullptr; +#if !true +# error "true does not work in #if" +#endif +#if false +#elifdef __STDC_VERSION__ +#else +# error "#elifdef does not work" +#endif + +#ifndef __has_c_attribute +# error "__has_c_attribute not defined" +#endif + +#ifndef __has_include +# error "__has_include not defined" +#endif + +#define LPAREN() ( +#define FORTY_TWO(x) 42 +#define VA_OPT_TEST(r, x, ...) __VA_OPT__ (FORTY_TWO r x)) +static_assert (VA_OPT_TEST (LPAREN (), 0, <:-) == 42); + +static_assert (0b101010 == 42); +static_assert (0B101010 == 42); +static_assert (0xDEAD'\''BEEF == 3'\''735'\''928'\''559); +static_assert (0.500'\''000'\''000 == 0.5); + +enum unsignedish : unsigned int { uione = 1 }; +static_assert (0 < -uione); + +#include +constexpr nullptr_t null_pointer = nullptr; + +static typeof (1 + 1L) two () { return 2; } +static long int three () { return 3; } +' + +# Test code for whether the C compiler supports C23 (body of main). +ac_c_conftest_c23_main=' + { + label_before_declaration: + int arr[10] = {}; + if (arr[0]) + goto label_before_declaration; + if (!arr[0]) + goto label_at_end_of_block; + label_at_end_of_block: + } + ok |= !null_pointer; + ok |= two != three; +' + +# Test code for whether the C compiler supports C23 (complete). +ac_c_conftest_c23_program="${ac_c_conftest_c23_globals} + +int +main (int, char **) +{ + int ok = 0; + ${ac_c_conftest_c23_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Do not test the value of __STDC__, because some compilers define it to 0 + or do not define it, while otherwise adequately conforming. */ + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* C89 style stringification. */ +#define noexpand_stringify(a) #a +const char *stringified = noexpand_stringify(arbitrary+token=sequence); + +/* C89 style token pasting. Exercises some of the corner cases that + e.g. old MSVC gets wrong, but not very hard. */ +#define noexpand_concat(a,b) a##b +#define expand_concat(a,b) noexpand_concat(a,b) +extern int vA; +extern int vbee; +#define aye A +#define bee B +int *pvA = &expand_concat(v,aye); +int *pvbee = &noexpand_concat(v,bee); + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +/* Does the compiler advertise C99 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +// See if C++-style comments work. + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr, and "aND" is used instead of "and" to work around +// GCC bug 40564 which is irrelevant here. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, aND third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + const char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + static struct incomplete_array *volatile incomplete_array_pointer; + struct incomplete_array *ia = incomplete_array_pointer; + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + // Work around memory leak warnings. + free (ia); + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + // Do not test for VLAs, as some otherwise-conforming compilers lack them. + // C code should instead use __STDC_NO_VLA__; see Autoconf manual. + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || ni.number != 58); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +/* Does the compiler advertise C11 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="config.rpath config.guess config.sub install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/acaux" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf '%s\n' "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf '%s\n' "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf '%s\n' "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf '%s\n' "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf '%s\n' "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf '%s\n' "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; +esac +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 +printf '%s\n' "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 +printf '%s\n' "$as_me: error: '$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w= + for ac_val in x $ac_old_val; do + ac_old_val_w="$ac_old_val_w $ac_val" + done + ac_new_val_w= + for ac_val in x $ac_new_val; do + ac_new_val_w="$ac_new_val_w $ac_val" + done + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 +printf '%s\n' "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 +printf '%s\n' "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 +printf '%s\n' "$as_me: former value: '$ac_old_val'" >&2;} + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 +printf '%s\n' "$as_me: current value: '$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf '%s\n' "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf '%s\n' "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +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 + + + +PACKAGE_DATE=2026-04-20 + +PACKAGE_ORIGIN=mcsh + +PACKAGE_MAILLIST=https://github.com/orpheus497/mcsh/issues + +TCSH_BASELINE_VERS=6.24.13 + +TCSH_BASELINE_DATE=2024-06-12 + + +printf '%s\n' "#define TCSH_BASELINE_VERSION \"6.24.13\"" >>confdefs.h + + +package_year="${PACKAGE_DATE%%-*}" +package_month="${PACKAGE_DATE#*-}" +package_month="${package_month%-*}" +package_day="${PACKAGE_DATE##*-}" +package_day="${package_day#0}" + +case ${package_month} in #( + 01) : + package_month_name=January ;; #( + 02) : + package_month_name=February ;; #( + 03) : + package_month_name=March ;; #( + 04) : + package_month_name=April ;; #( + 05) : + package_month_name=May ;; #( + 06) : + package_month_name=June ;; #( + 07) : + package_month_name=July ;; #( + 08) : + package_month_name=August ;; #( + 09) : + package_month_name=September ;; #( + 10) : + package_month_name=October ;; #( + 11) : + package_month_name=November ;; #( + 12) : + package_month_name=December ;; #( + *) : + ;; +esac + +PACKAGE_ENGLISH_DATE="${package_month_name} ${package_day}, ${package_year}" + + +package_changelog_date_format='+%a, %d %b %Y %T %z' + + +PACKAGE_REV="${PACKAGE_VERSION%%.*}" + + +PACKAGE_VERS="${PACKAGE_VERSION#*.}" +PACKAGE_VERS="${PACKAGE_VERS%.*}" + + +PACKAGE_PATCHLEVEL="${PACKAGE_VERSION##*.}" + + +RELEASE_TAG="$(echo "MCSH${PACKAGE_VERSION}" | tr . _)" + + + + + +ac_config_headers="$ac_config_headers config.h" + +ac_config_commands="$ac_config_commands ./atconfig" + + + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF/1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF/1 since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + ;; +esac +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf '%s\n' "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + + # 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 + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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 + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf '%s\n' "$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=`printf '%s\n' "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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 + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf '%s\n' "$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=`printf '%s\n' "$host_os" | sed 's/ /-/g'`;; esac + + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_saved_prefix" + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="${ac_tool_prefix}gcc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="gcc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf '%s\n' "$ac_ct_CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf '%s\n' "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="${ac_tool_prefix}cc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="$ac_tool_prefix$ac_prog" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="$ac_prog" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf '%s\n' "$ac_ct_CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf '%s\n' "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="${ac_tool_prefix}clang" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="clang" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf '%s\n' "$ac_ct_CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf '%s\n' "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See 'config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf '%s\n' "$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 -version; 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\"" +printf '%s\n' "$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 + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf '%s\n' "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. +# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an '-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else case e in #( + e) ac_file='' ;; +esac +fi +if test -z "$ac_file" +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +printf '%s\n' "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf '%s\n' "yes" >&6; } ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf '%s\n' "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) +# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will +# work properly (i.e., refer to 'conftest.exe'), while it won't with +# 'rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else case e in #( + e) { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest conftest$ac_cv_exeext +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf '%s\n' "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { 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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf '%s\n' "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext \ + conftest.o conftest.obj conftest.out +ac_clean_files=$ac_clean_files_save +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +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\"" +printf '%s\n' "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else case e in #( + e) printf '%s\n' "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf '%s\n' "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf '%s\n' "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else case e in #( + e) CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf '%s\n' "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C23 features" >&5 +printf %s "checking for $CC option to enable C23 features... " >&6; } +if test ${ac_cv_prog_cc_c23+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c23=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c23_program +_ACEOF +for ac_arg in '' -std=gnu23 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c23=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c23" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c23" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c23" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c23" >&5 +printf '%s\n' "$ac_cv_prog_cc_c23" >&6; } + CC="$CC $ac_cv_prog_cc_c23" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c23 + ac_prog_cc_stdc=c23 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 -std:c11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf '%s\n' "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf '%s\n' "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf '%s\n' "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 ;; +esac +fi +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 + + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else case e in #( + e) with_gnu_ld=no ;; +esac +fi + +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +if test -n "$LD"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 +printf %s "checking for ld... " >&6; } +elif test "$GCC" = yes; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } +elif test "$with_gnu_ld" = yes; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test -n "$LD"; then + # Let the user override the test with a path. + : +else + if test ${acl_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + acl_cv_path_LD= # Final result of this test + ac_prog=ld # Program to search in $PATH + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + case $host in + *-*-mingw* | windows*) + # gcc leaves a trailing carriage return which upsets mingw + acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + fi + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_saved_IFS" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 conftest.$ac_ext +/* end confdefs.h. */ +#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # The compiler produces 64-bit code. Add option '-b64' so that the + # linker groks 64-bit object files. + case "$acl_cv_path_LD " in + *" -b64 "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; + esac + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + sparc64-*-netbsd*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) # The compiler produces 32-bit code. Add option '-m elf32_sparc' + # so that the linker groks 32-bit object files. + case "$acl_cv_path_LD " in + *" -m elf32_sparc "*) ;; + *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; + esac + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + esac + ;; +esac +fi + + LD="$acl_cv_path_LD" +fi +if test -n "$LD"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf '%s\n' "$LD" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } + as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${acl_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf '%s\n' "$acl_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + + + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 +printf %s "checking for shared library run path origin... " >&6; } +if test ${acl_cv_rpath+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 +printf '%s\n' "$acl_cv_rpath" >&6; } + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + # Check whether --enable-rpath was given. +if test ${enable_rpath+y} +then : + enableval=$enable_rpath; : +else case e in #( + e) enable_rpath=yes ;; +esac +fi + + + + + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 +printf %s "checking 32-bit host C ABI... " >&6; } +if test ${gl_cv_host_cpu_c_abi_32bit+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case "$host_cpu" in + + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh1234 | sh1234elb \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + # CPUs that only support a 64-bit ABI. + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) + gl_cv_host_cpu_c_abi_32bit=no + ;; + + *) + if test -n "$gl_cv_host_cpu_c_abi"; then + case "$gl_cv_host_cpu_c_abi" in + i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) + gl_cv_host_cpu_c_abi_32bit=yes ;; + x86_64 | alpha | arm64 | aarch64c | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) + gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; + esac + else + gl_cv_host_cpu_c_abi_32bit=unknown + fi + if test $gl_cv_host_cpu_c_abi_32bit = unknown; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int test_pointer_size[sizeof (void *) - 5]; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi_32bit=no +else case e in #( + e) gl_cv_host_cpu_c_abi_32bit=yes ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + ;; + esac + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 +printf '%s\n' "$gl_cv_host_cpu_c_abi_32bit" >&6; } + + HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" + +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 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + ;; +esac +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf '%s\n' "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else case e in #( + e) { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +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 + + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for egrep -e" >&5 +printf %s "checking for egrep -e... " >&6; } +if test ${ac_cv_path_EGREP_TRADITIONAL+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -z "$EGREP_TRADITIONAL"; then + ac_path_EGREP_TRADITIONAL_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue +# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. + # Check for GNU $ac_path_EGREP_TRADITIONAL +case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf '%s\n' 'EGREP_TRADITIONAL' >> "conftest.nl" + "$ac_path_EGREP_TRADITIONAL" -E 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" + ac_path_EGREP_TRADITIONAL_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_TRADITIONAL_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then + : + fi +else + ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL +fi + + if test "$ac_cv_path_EGREP_TRADITIONAL" +then : + ac_cv_path_EGREP_TRADITIONAL="$ac_cv_path_EGREP_TRADITIONAL -E" +else case e in #( + e) if test -z "$EGREP_TRADITIONAL"; then + ac_path_EGREP_TRADITIONAL_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP_TRADITIONAL="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP_TRADITIONAL" || continue +# Check for GNU ac_path_EGREP_TRADITIONAL and select it if it is found. + # Check for GNU $ac_path_EGREP_TRADITIONAL +case `"$ac_path_EGREP_TRADITIONAL" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" ac_path_EGREP_TRADITIONAL_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf '%s\n' 'EGREP_TRADITIONAL' >> "conftest.nl" + "$ac_path_EGREP_TRADITIONAL" 'EGR(EP|AC)_TRADITIONAL$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_TRADITIONAL_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP_TRADITIONAL="$ac_path_EGREP_TRADITIONAL" + ac_path_EGREP_TRADITIONAL_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_TRADITIONAL_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP_TRADITIONAL"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP_TRADITIONAL=$EGREP_TRADITIONAL +fi + ;; +esac +fi ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP_TRADITIONAL" >&5 +printf '%s\n' "$ac_cv_path_EGREP_TRADITIONAL" >&6; } + EGREP_TRADITIONAL=$ac_cv_path_EGREP_TRADITIONAL + + + + + + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for ELF binary format" >&5 +printf %s "checking for ELF binary format... " >&6; } +if test ${gl_cv_elf+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __ELF__ || (defined __linux__ && (defined __EDG__ || defined __SUNPRO_C)) + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP_TRADITIONAL "Extensible Linking Format" >/dev/null 2>&1 +then : + gl_cv_elf=yes +else case e in #( + e) gl_cv_elf=no ;; +esac +fi +rm -rf conftest* + + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $gl_cv_elf" >&5 +printf '%s\n' "$gl_cv_elf" >&6; } + if test $gl_cv_elf = yes; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac + else + acl_is_expected_elfclass () + { + : + } + fi + + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 +printf %s "checking for the common suffixes of directories in the library search path... " >&6; } +if test ${acl_cv_libdirstems+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) acl_libdirstem=lib + acl_libdirstem2= + acl_libdirstem3= + case "$host_os" in + solaris*) + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; + esac + fi + ;; + netbsd*) + if test $HOST_CPU_C_ABI_32BIT != no; then + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparc ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_saved_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_saved_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= + fi + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 +printf '%s\n' "$acl_cv_libdirstems" >&6; } + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` + + + + + + + + + + + + use_additional=yes + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + +# Check whether --with-libiconv-prefix was given. +if test ${with_libiconv_prefix+y} +then : + withval=$with_libiconv_prefix; + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" + fi + fi + +fi + + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi + LIBICONV= + LTLIBICONV= + INCICONV= + LIBICONV_PREFIX= + HAVE_LIBICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + fi + done + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$acl_hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = 'iconv'; then + LIBICONV_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + saved_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$saved_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then + haveit= + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$dependency_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$dependency_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + acl_saved_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_saved_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_saved_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_saved_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + + + + + + + + + + gl_saved_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 +printf %s "checking for iconv... " >&6; } +if test ${am_cv_func_iconv+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test "$am_cv_func_iconv" != yes; then + gl_saved_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int +main (void) +{ +iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + am_cv_lib_iconv=yes + am_cv_func_iconv=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$gl_saved_LIBS" + fi + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 +printf '%s\n' "$am_cv_func_iconv" >&6; } + if test "$am_cv_func_iconv" = yes; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 +printf %s "checking for working iconv... " >&6; } +if test ${am_cv_func_iconv_works+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + gl_saved_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + +int +main (void) +{ +int result = 0; + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against macOS 14.4 bug: Failures are not distinguishable from + successful returns. + POSIX:2018 says: "The iconv() function shall ... return the number of + non-identical conversions performed." + But here, the conversion always does transliteration (the suffixes + "//TRANSLIT" and "//IGNORE" have no effect, nor does iconvctl()) and + does not report when it does a non-identical conversion. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\305\202"; /* LATIN SMALL LETTER L WITH STROKE */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + /* Here: + With glibc, GNU libiconv (including macOS up to 13): res == (size_t)-1, errno == EILSEQ. + With musl libc, NetBSD 10, Solaris 11: res == 1. + With macOS 14.4: res == 0, output is "l". */ + if (res == 0) + result |= 2; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 4; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 16; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + { + /* Try standardized names. */ + iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); + /* Try IRIX, OSF/1 names. */ + iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); + /* Try AIX names. */ + iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); + /* Try HP-UX names. */ + iconv_t cd4 = iconv_open ("utf8", "eucJP"); + if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) + && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) + result |= 32; + if (cd1 != (iconv_t)(-1)) + iconv_close (cd1); + if (cd2 != (iconv_t)(-1)) + iconv_close (cd2); + if (cd3 != (iconv_t)(-1)) + iconv_close (cd3); + if (cd4 != (iconv_t)(-1)) + iconv_close (cd4); + } + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + am_cv_func_iconv_works=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi + + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$gl_saved_LIBS" + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 +printf '%s\n' "$am_cv_func_iconv_works" >&6; } + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + +printf '%s\n' "#define HAVE_ICONV 1" >>confdefs.h + + fi + if test "$am_cv_lib_iconv" = yes; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 +printf %s "checking how to link with libiconv... " >&6; } + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 +printf '%s\n' "$LIBICONV" >&6; } + else + CPPFLAGS="$gl_saved_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + if test "$am_cv_func_iconv" = yes; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether iconv is compatible with its POSIX signature" >&5 +printf %s "checking whether iconv is compatible with its POSIX signature... " >&6; } +if test ${gl_cv_iconv_nonconst+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_iconv_nonconst=yes +else case e in #( + e) gl_cv_iconv_nonconst=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $gl_cv_iconv_nonconst" >&5 +printf '%s\n' "$gl_cv_iconv_nonconst" >&6; } + else + gl_cv_iconv_nonconst=yes + fi + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" + fi + +printf '%s\n' "#define ICONV_CONST $iconv_arg1" >>confdefs.h + + + + if test "$am_func_iconv" = yes; then + if test -n "$LIBICONV"; then + am_cv_func_iconv_summary='yes, in libiconv' + else + am_cv_func_iconv_summary='yes, in libc' + fi + else + if test "$am_cv_func_iconv" = yes; then + am_cv_func_iconv_summary='not working, consider installing GNU libiconv' + else + am_cv_func_iconv_summary='no, consider installing GNU libiconv' + fi + fi + + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking cached host tuple" >&5 +printf %s "checking cached host tuple... " >&6; } +if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: different" >&5 +printf '%s\n' "different" >&6; } + as_fn_error $? "remove config.cache and re-run configure" "$LINENO" 5 +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf '%s\n' "ok" >&6; } ;; +esac +fi +ac_cv_host_system_type="$host" + +case ${host} in #( + *-*-darwin*|*-*-freebsd*|*-*-rhapsody*) : + PACKAGE_CHANGELOG_DATE="$( + TZ=UTC date -v0H -v0M -v0S \ + -v${package_year}y \ + -v${package_month}m \ + -v${package_day}d \ + "${package_changelog_date_format}" + )" ;; #( + *-*-openbsd*) : + PACKAGE_CHANGELOG_DATE="$( + TZ=UTC date -j \ + "${package_changelog_date_format}" \ + ${package_year}${package_month}${package_day}0000 + )" ;; #( + *) : + # Default: NetBSD, GNU core utilities (i.e. most Linux) + PACKAGE_CHANGELOG_DATE="$( + TZ=UTC date -d ${PACKAGE_DATE} \ + "${package_changelog_date_format}" + )" ;; +esac + +case ${host} in #( + ## Alpha (DEC) machines. + alpha*-dec-osf*) : + tcsh_config_file=decosf1 + ;; #( + *-hp-hpux[89]*) : + tcsh_config_file=hpux8 + ;; #( + *-hp-hpux1[0-9]*) : + tcsh_config_file=hpux11 + ;; #( + ## IBM AIX systems + *-ibm-aix*) : + tcsh_config_file=aix + ;; #( + ## IBM OS/390 systems + *-ibm-os390*) : + CC='c89' + tcsh_config_file=os390 + ;; #( + ## Android + *-*-android*) : + tcsh_config_file=android + ;; #( + ## Linux + *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) : + tcsh_config_file=linux + ;; #( + ## Minix systems + *-*-minix*) : + tcsh_config_file=minix + ;; #( + ## NetBSD systems + *-*-netbsd*) : + tcsh_config_file=bsd4.4 + ;; #( + ## FreeBSD systems + *-*-freebsd*) : + tcsh_config_file=bsd4.4 + ;; #( + ## MidnightBSD systems + *-*-midnightbsd*) : + tcsh_config_file=bsd4.4 + ;; #( + ## DragonFlyBSD systems + *-*-dragonfly*) : + tcsh_config_file=bsd4.4 + ;; #( + ## MirBSD systems + *-*-mirbsd*) : + tcsh_config_file=bsd4.4 + ;; #( + ## OpenBSD systems + *-*-openbsd*) : + tcsh_config_file=bsd4.4 + ;; #( + ## BSDI systems + *-*-bsdi*) : + tcsh_config_file=bsd4.4 + ;; #( + ## Mac OS X Server + *-*-rhapsody*) : + tcsh_config_file=bsd4.4 + ;; #( + ## Mac OS X Server + *-*-darwin*) : + tcsh_config_file=bsd4.4 + ;; #( + ## DragonFly systems + *-*-dragonfly*) : + tcsh_config_file=bsd4.4 + ;; #( + ## Silicon Graphics machines + *-sgi-iri*) : + tcsh_config_file=irix + case ${host_os} in #( + irix[34]*) : + # Irix-3.x - Irix 4.x + NON_GNU_DFLAGS='-D__STDC__' + LIBS='-lsun -lbsd -lc_s' + ;; #( + irix5* | irix6.[01]*) : + # Irix 5.x, Irix 6.0 - 6.1 + LIBS='-lbsd' + ;; #( + irix6.[2-9]*) : + # Irix 6.2 and later + tcsh_config_file=irix62 + ;; #( + *) : + ;; +esac + ;; #( + *-*-solaris2.[01]) : + # Should handle sparc or x86 + tcsh_config_file=sol2 + ;; #( + *-sun-solaris2.2) : + # Sparc only release + tcsh_config_file=sol22 + ;; #( + *-sun-solaris2.3) : + # Sparc only release + tcsh_config_file=sol23 + ;; #( + *-*-solaris2.[45]) : + # Should handle sparc, x86 and powerpc + tcsh_config_file=sol24 + ;; #( + *-*-solaris2.[678]) : + # Should handle sparc, x86 and powerpc + tcsh_config_file=sol26 + ;; #( + *-*-solaris2.*) : + # Should handle sparc, x86 and powerpc + tcsh_config_file=sol29 + ;; #( + ## Tektronix systems + m68k-tektronix-bsd*) : + tcsh_config_file=bsd + NON_GNU_DFLAGS='-DBSD -DUTek' + ;; #( + ## Red Hat Cygwin + *-cygwin) : + tcsh_config_file=cygwin + ;; #( + ## QNX6 + *-qnx6*) : + tcsh_config_file=qnx6 + ;; #( + *) : + as_fn_error $? "Tcsh can't guess the configuration file name +for \`${host}' systems. +Check tcsh's \`Ported' file for manual configuration instructions." "$LINENO" 5 ;; +esac + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: using configuration file \`$tcsh_config_file'" >&5 +printf '%s\n' "$as_me: using configuration file \`$tcsh_config_file'" >&6;} +cp ${srcdir}/system/${tcsh_config_file} config_p.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 +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="${ac_tool_prefix}gcc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="gcc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf '%s\n' "$ac_ct_CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf '%s\n' "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="${ac_tool_prefix}cc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="$ac_tool_prefix$ac_prog" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="$ac_prog" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf '%s\n' "$ac_ct_CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf '%s\n' "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="${ac_tool_prefix}clang" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf '%s\n' "$CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + 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_CC="clang" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf '%s\n' "$ac_ct_CC" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf '%s\n' "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See 'config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf '%s\n' "$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 -version; 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\"" +printf '%s\n' "$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 + printf '%s\n' "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf '%s\n' "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else case e in #( + e) CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf '%s\n' "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C23 features" >&5 +printf %s "checking for $CC option to enable C23 features... " >&6; } +if test ${ac_cv_prog_cc_c23+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c23=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c23_program +_ACEOF +for ac_arg in '' -std=gnu23 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c23=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c23" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c23" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c23" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c23" >&5 +printf '%s\n' "$ac_cv_prog_cc_c23" >&6; } + CC="$CC $ac_cv_prog_cc_c23" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c23 + ac_prog_cc_stdc=c23 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 -std:c11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf '%s\n' "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf '%s\n' "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf '%s\n' "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf '%s\n' "none needed" >&6; } +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf '%s\n' "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_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 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP + ;; +esac +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf '%s\n' "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else case e in #( + e) { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +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 + + +# Extract the first word of "gencat", so it can be a program name with args. +set dummy gencat; ac_word=$2 +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_GENCAT+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $GENCAT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_GENCAT="$as_dir$ac_word$ac_exec_ext" + printf '%s\n' "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +GENCAT=$ac_cv_path_GENCAT +if test -n "$GENCAT"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $GENCAT" >&5 +printf '%s\n' "$GENCAT" >&6; } +else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf '%s\n' "no" >&6; } +fi + + + +if test "x${cross_compiling}" = xyes +then : + CC_FOR_GETHOST="cc" +else case e in #( + e) CC_FOR_GETHOST="\$(CC)" ;; +esac +fi + + +if test "x${cross_compiling}" = xno +then : + CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD:-"\$(CFLAGS)"} +fi + + +if test "x${cross_compiling}" = xno +then : + CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD:-"\$(CPPFLAGS)"} +fi + + +if test "x${cross_compiling}" = xno +then : + LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD:-"\$(LDFLAGS)"} +fi + + +if test "x$GCC" != xyes +then : + DFLAGS="$DFLAGS $NON_GNU_DFLAGS" + CFLAGS="$CFLAGS $NON_GNU_CFLAGS" +fi + +case ${host} in #( + *-*-android*) : + CFLAGS="${CFLAGS} -fPIE" + LDFLAGS="${LDFLAGS} -pie" + ;; #( + *) : + ;; +esac + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing crypt" >&5 +printf %s "checking for library containing crypt... " >&6; } +if test ${ac_cv_search_crypt+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char crypt (void); +int +main (void) +{ +return crypt (); + ; + return 0; +} +_ACEOF +for ac_lib in '' crypt xcrypt +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_crypt=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_crypt+y} +then : + break +fi +done +if test ${ac_cv_search_crypt+y} +then : + +else case e in #( + e) ac_cv_search_crypt=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_crypt" >&5 +printf '%s\n' "$ac_cv_search_crypt" >&6; } +ac_res=$ac_cv_search_crypt +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing getspnam" >&5 +printf %s "checking for library containing getspnam... " >&6; } +if test ${ac_cv_search_getspnam+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char getspnam (void); +int +main (void) +{ +return getspnam (); + ; + return 0; +} +_ACEOF +for ac_lib in '' sec +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_getspnam=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_getspnam+y} +then : + break +fi +done +if test ${ac_cv_search_getspnam+y} +then : + +else case e in #( + e) ac_cv_search_getspnam=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getspnam" >&5 +printf '%s\n' "$ac_cv_search_getspnam" >&6; } +ac_res=$ac_cv_search_getspnam +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 +printf %s "checking for library containing tgetent... " >&6; } +if test ${ac_cv_search_tgetent+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (void); +int +main (void) +{ +return tgetent (); + ; + return 0; +} +_ACEOF +for ac_lib in '' termlib tinfo termcap curses ncurses +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_tgetent=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_tgetent+y} +then : + break +fi +done +if test ${ac_cv_search_tgetent+y} +then : + +else case e in #( + e) ac_cv_search_tgetent=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tgetent" >&5 +printf '%s\n' "$ac_cv_search_tgetent" >&6; } +ac_res=$ac_cv_search_tgetent +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else case e in #( + e) + as_fn_error $? "unable to find the tgetent() function" "$LINENO" 5 + ;; +esac +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 +printf %s "checking for library containing gethostbyname... " >&6; } +if test ${ac_cv_search_gethostbyname+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (void); +int +main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl +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_gethostbyname=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_gethostbyname+y} +then : + break +fi +done +if test ${ac_cv_search_gethostbyname+y} +then : + +else case e in #( + e) ac_cv_search_gethostbyname=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 +printf '%s\n' "$ac_cv_search_gethostbyname" >&6; } +ac_res=$ac_cv_search_gethostbyname +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing connect" >&5 +printf %s "checking for library containing connect... " >&6; } +if test ${ac_cv_search_connect+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char connect (void); +int +main (void) +{ +return connect (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket +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_connect=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_connect+y} +then : + break +fi +done +if test ${ac_cv_search_connect+y} +then : + +else case e in #( + e) ac_cv_search_connect=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_connect" >&5 +printf '%s\n' "$ac_cv_search_connect" >&6; } +ac_res=$ac_cv_search_connect +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing catgets" >&5 +printf %s "checking for library containing catgets... " >&6; } +if test ${ac_cv_search_catgets+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char catgets (void); +int +main (void) +{ +return catgets (); + ; + return 0; +} +_ACEOF +for ac_lib in '' catgets +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_catgets=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_catgets+y} +then : + break +fi +done +if test ${ac_cv_search_catgets+y} +then : + +else case e in #( + e) ac_cv_search_catgets=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_catgets" >&5 +printf '%s\n' "$ac_cv_search_catgets" >&6; } +ac_res=$ac_cv_search_catgets +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +ac_fn_c_check_func "$LINENO" "glob" "ac_cv_func_glob" +if test "x$ac_cv_func_glob" = xyes +then : + +printf '%s\n' "#define HAVE_LIBC_GLOB 1" >>confdefs.h + +fi + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf '%s\n' "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf '%s\n' "#define STDC_HEADERS 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "auth.h" "ac_cv_header_auth_h" "$ac_includes_default" +if test "x$ac_cv_header_auth_h" = xyes +then : + printf '%s\n' "#define HAVE_AUTH_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "crypt.h" "ac_cv_header_crypt_h" "$ac_includes_default" +if test "x$ac_cv_header_crypt_h" = xyes +then : + printf '%s\n' "#define HAVE_CRYPT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "features.h" "ac_cv_header_features_h" "$ac_includes_default" +if test "x$ac_cv_header_features_h" = xyes +then : + printf '%s\n' "#define HAVE_FEATURES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_inttypes_h" = xyes +then : + printf '%s\n' "#define HAVE_INTTYPES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" +if test "x$ac_cv_header_paths_h" = xyes +then : + printf '%s\n' "#define HAVE_PATHS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "shadow.h" "ac_cv_header_shadow_h" "$ac_includes_default" +if test "x$ac_cv_header_shadow_h" = xyes +then : + printf '%s\n' "#define HAVE_SHADOW_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf '%s\n' "#define HAVE_STDINT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "utmp.h" "ac_cv_header_utmp_h" "$ac_includes_default" +if test "x$ac_cv_header_utmp_h" = xyes +then : + printf '%s\n' "#define HAVE_UTMP_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "utmpx.h" "ac_cv_header_utmpx_h" "$ac_includes_default" +if test "x$ac_cv_header_utmpx_h" = xyes +then : + printf '%s\n' "#define HAVE_UTMPX_H 1" >>confdefs.h + +fi + + for ac_header in wchar.h +do : + ac_fn_c_check_header_compile "$LINENO" "wchar.h" "ac_cv_header_wchar_h" "$ac_includes_default" +if test "x$ac_cv_header_wchar_h" = xyes +then : + printf '%s\n' "#define HAVE_WCHAR_H 1" >>confdefs.h + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking size of wchar_t" >&5 +printf %s "checking size of wchar_t... " >&6; } +if test ${ac_cv_sizeof_wchar_t+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (wchar_t))" "ac_cv_sizeof_wchar_t" "#include +#include + +" +then : + +else case e in #( + e) ac_cv_sizeof_wchar_t=0 ;; +esac +fi + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_wchar_t" >&5 +printf '%s\n' "$ac_cv_sizeof_wchar_t" >&6; } + + + +printf '%s\n' "#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t" >>confdefs.h + + + ac_fn_c_check_header_compile "$LINENO" "wctype.h" "ac_cv_header_wctype_h" "$ac_includes_default" +if test "x$ac_cv_header_wctype_h" = xyes +then : + printf '%s\n' "#define HAVE_WCTYPE_H 1" >>confdefs.h + +fi + +fi + +done +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`printf '%s\n' "ac_cv_header_dirent_$ac_hdr" | sed "$as_sed_sh"` +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +printf %s "checking for $ac_hdr that defines DIR... " >&6; } +if eval test \${$as_ac_Header+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include <$ac_hdr> + +int +main (void) +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$as_ac_Header=yes" +else case e in #( + e) eval "$as_ac_Header=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$as_ac_Header + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf '%s\n' "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : + cat >>confdefs.h <<_ACEOF +#define `printf '%s\n' "HAVE_$ac_hdr" | sed "$as_sed_cpp"` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +printf %s "checking for library containing opendir... " >&6; } +if test ${ac_cv_search_opendir+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (void); +int +main (void) +{ +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.beam \ + conftest$ac_exeext + if test ${ac_cv_search_opendir+y} +then : + break +fi +done +if test ${ac_cv_search_opendir+y} +then : + +else case e in #( + e) ac_cv_search_opendir=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +printf '%s\n' "$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 + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +printf %s "checking for library containing opendir... " >&6; } +if test ${ac_cv_search_opendir+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) 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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (void); +int +main (void) +{ +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.beam \ + conftest$ac_exeext + if test ${ac_cv_search_opendir+y} +then : + break +fi +done +if test ${ac_cv_search_opendir+y} +then : + +else case e in #( + e) ac_cv_search_opendir=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +printf '%s\n' "$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 + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 +printf %s "checking whether stat file-mode macros are broken... " >&6; } +if test ${ac_cv_header_stat_broken+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_header_stat_broken=no +else case e in #( + e) ac_cv_header_stat_broken=yes ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 +printf '%s\n' "$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +printf '%s\n' "#define STAT_MACROS_BROKEN 1" >>confdefs.h + +fi + + +ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default" +if test "x$ac_cv_type_long_long" = xyes +then : + +printf '%s\n' "#define HAVE_LONG_LONG 1" >>confdefs.h + + +fi + +ac_fn_c_check_type "$LINENO" "uid_t" "ac_cv_type_uid_t" "$ac_includes_default" +if test "x$ac_cv_type_uid_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define uid_t int" >>confdefs.h + ;; +esac +fi + +ac_fn_c_check_type "$LINENO" "gid_t" "ac_cv_type_gid_t" "$ac_includes_default" +if test "x$ac_cv_type_gid_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define gid_t int" >>confdefs.h + ;; +esac +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5 +printf %s "checking type of array argument to getgroups... " >&6; } +if test ${ac_cv_type_getgroups+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # If AC_TYPE_UID_T says there isn't any gid_t typedef, then we can skip +# everything below. +if test $ac_cv_type_gid_t = no +then : + ac_cv_type_getgroups=int +else case e in #( + e) # Test programs below rely on strict type checking of extern declarations: + # 'extern int getgroups(int, int *); extern int getgroups(int, pid_t *);' + # is valid in C89 if and only if pid_t is a typedef for int. Unlike + # anything involving either an assignment or a function call, compilers + # tend to make this kind of type mismatch a hard error, not just an + # "incompatible pointer types" warning. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +extern int getgroups(int, gid_t *); +int +main (void) +{ +return !(getgroups(0, 0) >= 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_getgroups_gidarray=yes +else case e in #( + e) ac_getgroups_gidarray=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +extern int getgroups(int, int *); +int +main (void) +{ +return !(getgroups(0, 0) >= 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_getgroups_intarray=yes +else case e in #( + e) ac_getgroups_intarray=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + case int:$ac_getgroups_intarray,gid:$ac_getgroups_gidarray in #( + int:yes,gid:no) : + ac_cv_type_getgroups=int ;; #( + int:no,gid:yes) : + ac_cv_type_getgroups=gid_t ;; #( + int:yes,gid:yes) : + + # Both programs compiled - this means *either* that getgroups + # was declared with no prototype, in which case we should use int, + # or that it was declared prototyped but gid_t is a typedef for int, + # in which case we should use gid_t. Distinguish the two cases + # by testing if the compiler catches a blatantly incorrect function + # signature for getgroups. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +extern int getgroups(int, float); +int +main (void) +{ +return !(getgroups(0, 0) >= 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + # Compiler did not catch incorrect argument list; + # getgroups is unprototyped. + ac_cv_type_getgroups=int + +else case e in #( + e) + # Compiler caught incorrect argument list; + # gid_t is a typedef for int. + ac_cv_type_getgroups=gid_t + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; #( + *) : + + # Both programs failed to compile - this probably means getgroups + # wasn't declared at all. Use 'int', as this is probably a very + # old system where the type _would have been_ int. + ac_cv_type_getgroups=int + ;; +esac + ;; +esac +fi + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5 +printf '%s\n' "$ac_cv_type_getgroups" >&6; } +printf '%s\n' "#define GETGROUPS_T $ac_cv_type_getgroups" >>confdefs.h + + +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define mode_t int" >>confdefs.h + ;; +esac +fi + +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 : + +else case e in #( + e) +printf '%s\n' "#define size_t unsigned int" >>confdefs.h + ;; +esac +fi + +ac_fn_c_check_type "$LINENO" "uid_t" "ac_cv_type_uid_t" "$ac_includes_default" +if test "x$ac_cv_type_uid_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define uid_t int" >>confdefs.h + ;; +esac +fi + +ac_fn_c_check_type "$LINENO" "gid_t" "ac_cv_type_gid_t" "$ac_includes_default" +if test "x$ac_cv_type_gid_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define gid_t int" >>confdefs.h + ;; +esac +fi + +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +printf '%s\n' "#define _UINT32_T 1" >>confdefs.h + + +printf '%s\n' "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h +;; + esac + + + + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "#include + +" +if test "x$ac_cv_type_ssize_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define ssize_t int" >>confdefs.h + ;; +esac +fi + + + + + +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include +#include + +" +if test "x$ac_cv_type_socklen_t" = xyes +then : + +else case e in #( + e) +printf '%s\n' "#define socklen_t int" >>confdefs.h + ;; +esac +fi + + + +ac_fn_c_check_member "$LINENO" "struct dirent" "d_ino" "ac_cv_member_struct_dirent_d_ino" "#ifdef HAVE_DIRENT_H +# include +#else +# ifdef HAVE_NDIR_H +# include +# else +# include +# endif +# define dirent direct +#endif + +" +if test "x$ac_cv_member_struct_dirent_d_ino" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_DIRENT_D_INO 1" >>confdefs.h + + +fi + +ac_fn_c_check_member "$LINENO" "struct utmp" "ut_host" "ac_cv_member_struct_utmp_ut_host" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmp_ut_host" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMP_UT_HOST 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmp" "ut_user" "ac_cv_member_struct_utmp_ut_user" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmp_ut_user" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMP_UT_USER 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmp" "ut_tv" "ac_cv_member_struct_utmp_ut_tv" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmp_ut_tv" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMP_UT_TV 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmp" "ut_xtime" "ac_cv_member_struct_utmp_ut_xtime" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmp_ut_xtime" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMP_UT_XTIME 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_host" "ac_cv_member_struct_utmpx_ut_host" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmpx_ut_host" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMPX_UT_HOST 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_user" "ac_cv_member_struct_utmpx_ut_user" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmpx_ut_user" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMPX_UT_USER 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_tv" "ac_cv_member_struct_utmpx_ut_tv" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmpx_ut_tv" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMPX_UT_TV 1" >>confdefs.h + + +fi +ac_fn_c_check_member "$LINENO" "struct utmpx" "ut_xtime" "ac_cv_member_struct_utmpx_ut_xtime" "#include +#ifdef HAVE_UTMPX_H +#include +#define utmp utmpx +#elif defined HAVE_UTMP_H +#include +#endif + +" +if test "x$ac_cv_member_struct_utmpx_ut_xtime" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_UTMPX_UT_XTIME 1" >>confdefs.h + + +fi + +ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "#include +#include + +" +if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes +then : + +printf '%s\n' "#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1" >>confdefs.h + + +fi + + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +printf %s "checking for an ANSI C-conforming const... " >&6; } +if test ${ac_cv_c_const+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* IBM XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Derived from code rejected by Sun C 1.0 and similar vintage. */ + int x[] = {25, 17}; + typedef int const *iptr; + iptr foo = &x[0]; + ++foo; + if (!*foo) return 0; + } + { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_const=yes +else case e in #( + e) ac_cv_c_const=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +printf '%s\n' "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +printf '%s\n' "#define const /**/" >>confdefs.h + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 +printf %s "checking for working volatile... " >&6; } +if test ${ac_cv_c_volatile+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + +volatile int x; +int * volatile y = (int *) 0; +return !x && !y; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_volatile=yes +else case e in #( + e) ac_cv_c_volatile=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5 +printf '%s\n' "$ac_cv_c_volatile" >&6; } +if test $ac_cv_c_volatile = no; then + +printf '%s\n' "#define volatile /**/" >>confdefs.h + +fi + + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC options to detect undeclared functions" >&5 +printf %s "checking for $CC options to detect undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else case e in #( + e) ac_cv_c_undeclared_builtin_options=$ac_arg ;; +esac +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf '%s\n' "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf '%s\n' "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See 'config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for $CC options to ignore future-version functions" >&5 +printf %s "checking for $CC options to ignore future-version functions... " >&6; } +if test ${ac_cv_c_future_darwin_options+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_compile_saved="$ac_compile" + ac_compile="$ac_compile -Werror=unguarded-availability-new" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if ! (defined __APPLE__ && defined __MACH__) + #error "-Werror=unguarded-availability-new not needed here" + #endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_future_darwin_options='-Werror=unguarded-availability-new' +else case e in #( + e) ac_cv_c_future_darwin_options='none needed' ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_compile="$ac_compile_saved" + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_future_darwin_options" >&5 +printf '%s\n' "$ac_cv_c_future_darwin_options" >&6; } + case $ac_cv_c_future_darwin_options in #( + 'none needed') : + ac_c_future_darwin_options='' ;; #( + *) : + ac_c_future_darwin_options=$ac_cv_c_future_darwin_options ;; +esac + +ac_fn_check_decl "$LINENO" "crypt" "ac_cv_have_decl_crypt" "#include \"config_p.h\" +$ac_includes_default +#ifdef HAVE_CRYPT_H +#include +#endif + +" "$ac_c_undeclared_builtin_options$ac_c_future_darwin_options" "CFLAGS" +if test "x$ac_cv_have_decl_crypt" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf '%s\n' "#define HAVE_DECL_CRYPT $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "environ" "ac_cv_have_decl_environ" "#include \"config_p.h\" +$ac_includes_default +#ifdef HAVE_CRYPT_H +#include +#endif + +" "$ac_c_undeclared_builtin_options$ac_c_future_darwin_options" "CFLAGS" +if test "x$ac_cv_have_decl_environ" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf '%s\n' "#define HAVE_DECL_ENVIRON $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "gethostname" "ac_cv_have_decl_gethostname" "#include \"config_p.h\" +$ac_includes_default +#ifdef HAVE_CRYPT_H +#include +#endif + +" "$ac_c_undeclared_builtin_options$ac_c_future_darwin_options" "CFLAGS" +if test "x$ac_cv_have_decl_gethostname" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf '%s\n' "#define HAVE_DECL_GETHOSTNAME $ac_have_decl" >>confdefs.h +ac_fn_check_decl "$LINENO" "getpgrp" "ac_cv_have_decl_getpgrp" "#include \"config_p.h\" +$ac_includes_default +#ifdef HAVE_CRYPT_H +#include +#endif + +" "$ac_c_undeclared_builtin_options$ac_c_future_darwin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getpgrp" = xyes +then : + ac_have_decl=1 +else case e in #( + e) ac_have_decl=0 ;; +esac +fi +printf '%s\n' "#define HAVE_DECL_GETPGRP $ac_have_decl" >>confdefs.h + +ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale" +if test "x$ac_cv_func_setlocale" = xyes +then : + have_setlocale=yes +else case e in #( + e) have_setlocale=no ;; +esac +fi + +ac_fn_c_check_func "$LINENO" "catgets" "ac_cv_func_catgets" +if test "x$ac_cv_func_catgets" = xyes +then : + have_catgets=yes +else case e in #( + e) have_catgets=no ;; +esac +fi + +ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" +if test "x$ac_cv_func_dup2" = xyes +then : + printf '%s\n' "#define HAVE_DUP2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getauthid" "ac_cv_func_getauthid" +if test "x$ac_cv_func_getauthid" = xyes +then : + printf '%s\n' "#define HAVE_GETAUTHID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes +then : + printf '%s\n' "#define HAVE_GETCWD 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethostname" "ac_cv_func_gethostname" +if test "x$ac_cv_func_gethostname" = xyes +then : + printf '%s\n' "#define HAVE_GETHOSTNAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getpwent" "ac_cv_func_getpwent" +if test "x$ac_cv_func_getpwent" = xyes +then : + printf '%s\n' "#define HAVE_GETPWENT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getutent" "ac_cv_func_getutent" +if test "x$ac_cv_func_getutent" = xyes +then : + printf '%s\n' "#define HAVE_GETUTENT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "getutxent" "ac_cv_func_getutxent" +if test "x$ac_cv_func_getutxent" = xyes +then : + printf '%s\n' "#define HAVE_GETUTXENT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mallinfo" "ac_cv_func_mallinfo" +if test "x$ac_cv_func_mallinfo" = xyes +then : + printf '%s\n' "#define HAVE_MALLINFO 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mallinfo2" "ac_cv_func_mallinfo2" +if test "x$ac_cv_func_mallinfo2" = xyes +then : + printf '%s\n' "#define HAVE_MALLINFO2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mblen" "ac_cv_func_mblen" +if test "x$ac_cv_func_mblen" = xyes +then : + printf '%s\n' "#define HAVE_MBLEN 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes +then : + printf '%s\n' "#define HAVE_MEMMOVE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf '%s\n' "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "mkstemp" "ac_cv_func_mkstemp" +if test "x$ac_cv_func_mkstemp" = xyes +then : + printf '%s\n' "#define HAVE_MKSTEMP 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "nice" "ac_cv_func_nice" +if test "x$ac_cv_func_nice" = xyes +then : + printf '%s\n' "#define HAVE_NICE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setproctitle" "ac_cv_func_setproctitle" +if test "x$ac_cv_func_setproctitle" = xyes +then : + printf '%s\n' "#define HAVE_SETPROCTITLE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strtoll" "ac_cv_func_strtoll" +if test "x$ac_cv_func_strtoll" = xyes +then : + printf '%s\n' "#define HAVE_STRTOLL 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "nl_langinfo" "ac_cv_func_nl_langinfo" +if test "x$ac_cv_func_nl_langinfo" = xyes +then : + printf '%s\n' "#define HAVE_NL_LANGINFO 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sbrk" "ac_cv_func_sbrk" +if test "x$ac_cv_func_sbrk" = xyes +then : + printf '%s\n' "#define HAVE_SBRK 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setpgid" "ac_cv_func_setpgid" +if test "x$ac_cv_func_setpgid" = xyes +then : + printf '%s\n' "#define HAVE_SETPGID 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "setpriority" "ac_cv_func_setpriority" +if test "x$ac_cv_func_setpriority" = xyes +then : + printf '%s\n' "#define HAVE_SETPRIORITY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf '%s\n' "#define HAVE_STRERROR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" +if test "x$ac_cv_func_strstr" = xyes +then : + printf '%s\n' "#define HAVE_STRSTR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" +if test "x$ac_cv_func_sysconf" = xyes +then : + printf '%s\n' "#define HAVE_SYSCONF 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "wcwidth" "ac_cv_func_wcwidth" +if test "x$ac_cv_func_wcwidth" = xyes +then : + printf '%s\n' "#define HAVE_WCWIDTH 1" >>confdefs.h + +fi + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether getpgrp requires zero arguments" >&5 +printf %s "checking whether getpgrp requires zero arguments... " >&6; } +if test ${ac_cv_func_getpgrp_void+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # Use it with a single arg. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +getpgrp (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_getpgrp_void=no +else case e in #( + e) ac_cv_func_getpgrp_void=yes ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getpgrp_void" >&5 +printf '%s\n' "$ac_cv_func_getpgrp_void" >&6; } +if test $ac_cv_func_getpgrp_void = yes; then + +printf '%s\n' "#define GETPGRP_VOID 1" >>confdefs.h + +fi + + + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc and mbstate_t are properly declared" >&5 +printf %s "checking whether mbrtowc and mbstate_t are properly declared... " >&6; } +if test ${ac_cv_func_mbrtowc+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +wchar_t wc; + char const s[] = ""; + size_t n = 1; + mbstate_t state; + return ! (sizeof state && (mbrtowc) (&wc, s, n, &state)); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_mbrtowc=yes +else case e in #( + e) ac_cv_func_mbrtowc=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mbrtowc" >&5 +printf '%s\n' "$ac_cv_func_mbrtowc" >&6; } + if test $ac_cv_func_mbrtowc = yes; then + +printf '%s\n' "#define HAVE_MBRTOWC 1" >>confdefs.h + + fi + +if test "x${cross_compiling}" != xyes +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking whether setpgrp requires zero arguments" >&5 +printf %s "checking whether setpgrp requires zero arguments... " >&6; } +if test ${ac_cv_func_setpgrp_void+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) # Call it with two arguments. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +setpgrp(0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_setpgrp_void=no +else case e in #( + e) ac_cv_func_setpgrp_void=yes ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_setpgrp_void" >&5 +printf '%s\n' "$ac_cv_func_setpgrp_void" >&6; } +if test $ac_cv_func_setpgrp_void = yes; then + +printf '%s\n' "#define SETPGRP_VOID 1" >>confdefs.h + +fi + +else case e in #( + e) ac_cv_func_setpgrp_void=yes ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5 +printf %s "checking for working strcoll... " >&6; } +if test ${ac_cv_func_strcoll_works+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on glibc systems. + *-gnu*) ac_cv_func_strcoll_works=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_strcoll_works=no ;; + esac +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ +return (strcoll ("abc", "def") >= 0 || + strcoll ("ABC", "DEF") >= 0 || + strcoll ("123", "456") >= 0) + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_strcoll_works=yes +else case e in #( + e) ac_cv_func_strcoll_works=no ;; +esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi + ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5 +printf '%s\n' "$ac_cv_func_strcoll_works" >&6; } +if test $ac_cv_func_strcoll_works = yes; then + +printf '%s\n' "#define HAVE_STRCOLL 1" >>confdefs.h + +fi + + +if test x"$ac_cv_func_sbrk" = x"yes" +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for working sbrk" >&5 +printf %s "checking for working sbrk... " >&6; } + if test "$cross_compiling" = yes +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: unknown - cross compiling" >&5 +printf '%s\n' "unknown - cross compiling" >&6; } +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main (void) +{ + +return sbrk(2048) == (void*)-1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf '%s\n' "yes" >&6; } + +printf '%s\n' "#define HAVE_WORKING_SBRK 1" >>confdefs.h + +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: no; use system malloc" >&5 +printf '%s\n' "no; use system malloc" >&6; } ;; +esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi + +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: sbrk not present; use system malloc" >&5 +printf '%s\n' "$as_me: sbrk not present; use system malloc" >&6;} ;; +esac +fi + + + + +if test "$have_setlocale" != no +then : + # Check whether --enable-nls was given. +if test ${enable_nls+y} +then : + enableval=$enable_nls; +else case e in #( + e) enable_nls=yes ;; +esac +fi + + if test "x$enable_nls" != xno +then : + +printf '%s\n' "#define NLS 1" >>confdefs.h + +fi +fi + +if { test "x$enable_nls" != xno && + test "$have_catgets" != no && + test -n "$GENCAT"; } +then : + # Check whether --enable-nls-catalogs was given. +if test ${enable_nls_catalogs+y} +then : + enableval=$enable_nls_catalogs; +else case e in #( + e) enable_nls_catalogs=yes ;; +esac +fi + + if test "x$enable_nls_catalogs" != xno +then : + BUILD_CATALOGS="yes" + +printf '%s\n' "#define NLS_CATALOGS 1" >>confdefs.h + +fi +fi + + +# Check whether --with-hesiod was given. +if test ${with_hesiod+y} +then : + withval=$with_hesiod; hesiod="$withval" +else case e in #( + e) hesiod=no ;; +esac +fi + +if test "$hesiod" != no +then : + HESLIB="-lhesiod" + ac_fn_c_check_func "$LINENO" "res_send" "ac_cv_func_res_send" +if test "x$ac_cv_func_res_send" = xyes +then : + : +else case e in #( + e) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: checking for res_send in -lresolv" >&5 +printf %s "checking for res_send in -lresolv... " >&6; } +if test ${ac_cv_lib_resolv_res_send+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolv $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. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char res_send (void); +int +main (void) +{ +return res_send (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_resolv_res_send=yes +else case e in #( + e) ac_cv_lib_resolv_res_send=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_send" >&5 +printf '%s\n' "$ac_cv_lib_resolv_res_send" >&6; } +if test "x$ac_cv_lib_resolv_res_send" = xyes +then : + HESLIB="$HESLIB -lresolv" +fi + ;; +esac +fi + + HESDEF=-DHESIOD + if test "$hesiod" != yes +then : + HESDEF="$HESDEF -I$hesiod/include" + HESLIB="-L$hesiod/lib $HESLIB" +fi +fi + + + + +ac_config_files="$ac_config_files Makefile atlocal dch-template nls/Makefile patchlevel.h mcsh.man:tcsh.man.in" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# 'ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* 'ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +ac_cache_dump | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf '%s\n' "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf '%s\n' "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf '%s\n' "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +case $CONFIG_STATUS in #( + -*) : + CONFIG_STATUS=./$CONFIG_STATUS ;; #( + */*) : + ;; #( + *) : + CONFIG_STATUS=./$CONFIG_STATUS ;; +esac + +ac_write_fail=0 +ac_clean_CONFIG_STATUS='"$CONFIG_STATUS"' +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf '%s\n' "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >"$CONFIG_STATUS" <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>"$CONFIG_STATUS" <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # contradicts POSIX and common usage. Disable this. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf '%s\n' "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf '%s\n' "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf '%s\n' "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf '%s\n' X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf '%s\n' "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf '%s\n' X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +exec 6>&1 +## ------------------------------------- ## +## Main body of "$CONFIG_STATUS" script. ## +## ------------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x "$CONFIG_STATUS" || ac_write_fail=1 + +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by mcsh $as_me 0.1.0, which was +generated by GNU Autoconf 2.73. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +'$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to . +mcsh home page: ." + +_ACEOF +ac_cs_config=`printf '%s\n' "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf '%s\n' "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +mcsh config.status 0.1.0 +configured by $0, generated by GNU Autoconf 2.73, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2026 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || { + awk '' >"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf '%s\n' "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf '%s\n' "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf '%s\n' "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf '%s\n' "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: '$1' +Try '$0 --help' for more information.";; + --help | --hel | -h ) + printf '%s\n' "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf '%s\n' "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf '%s\n' "$ac_log" +} >&5 + +_ACEOF +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +ac_cv_exeext="$ac_cv_exeext" + + +_ACEOF + +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "./atconfig") CONFIG_COMMANDS="$CONFIG_COMMANDS ./atconfig" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "atlocal") CONFIG_FILES="$CONFIG_FILES atlocal" ;; + "dch-template") CONFIG_FILES="$CONFIG_FILES dch-template" ;; + "nls/Makefile") CONFIG_FILES="$CONFIG_FILES nls/Makefile" ;; + "patchlevel.h") CONFIG_FILES="$CONFIG_FILES patchlevel.h" ;; + "mcsh.man") CONFIG_FILES="$CONFIG_FILES mcsh.man:tcsh.man.in" ;; + + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to '$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with './config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | sed -n '$='` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | sed -n '$='` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >"$CONFIG_STATUS" || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with './config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script 'defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >"$CONFIG_STATUS" || ac_write_fail=1 + +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + suffix = P[macro] D[macro] + while (suffix ~ /[\t ]$/) { + suffix = substr(suffix, 1, length(suffix) - 1) + } + # Preserve the white space surrounding the "#". + print prefix "define", macro suffix + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain ':'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf '%s\n' "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is 'configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf '%s\n' "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf '%s\n' "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf '%s\n' "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf '%s\n' X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf '%s\n' "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf '%s\n' "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf '%s\n' "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when '$srcdir' = '.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>"$CONFIG_STATUS" <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>"$CONFIG_STATUS" <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf '%s\n' "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf '%s\n' "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf '%s\n' "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf '%s\n' "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + :C) { printf '%s\n' "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf '%s\n' "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "./atconfig":C) cat >./atconfig </dev/null + $SHELL $ac_no_opts "$CONFIG_STATUS" $ac_config_status_args || + ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf '%s\n' "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf '%s\n' "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: ========= Configuration results =========" >&5 +printf '%s\n' "$as_me: ========= Configuration results =========" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: BUILD_CATALOGS $BUILD_CATALOGS" >&5 +printf '%s\n' "$as_me: BUILD_CATALOGS $BUILD_CATALOGS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CC $CC" >&5 +printf '%s\n' "$as_me: CC $CC" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CC_FOR_GETHOST $CC_FOR_GETHOST" >&5 +printf '%s\n' "$as_me: CC_FOR_GETHOST $CC_FOR_GETHOST" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD" >&5 +printf '%s\n' "$as_me: CFLAGS_FOR_BUILD $CFLAGS_FOR_BUILD" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CPPFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD" >&5 +printf '%s\n' "$as_me: CPPFLAGS_FOR_BUILD $CPPFLAGS_FOR_BUILD" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: LDFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD" >&5 +printf '%s\n' "$as_me: LDFLAGS_FOR_BUILD $LDFLAGS_FOR_BUILD" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CFLAGS $CFLAGS" >&5 +printf '%s\n' "$as_me: CFLAGS $CFLAGS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CPP $CPP" >&5 +printf '%s\n' "$as_me: CPP $CPP" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: CPPFLAGS $CPPFLAGS" >&5 +printf '%s\n' "$as_me: CPPFLAGS $CPPFLAGS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: DFLAGS $DFLAGS" >&5 +printf '%s\n' "$as_me: DFLAGS $DFLAGS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: HESDEF $HESDEF" >&5 +printf '%s\n' "$as_me: HESDEF $HESDEF" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: HESLIB $HESLIB" >&5 +printf '%s\n' "$as_me: HESLIB $HESLIB" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: LDFLAGS $LDFLAGS" >&5 +printf '%s\n' "$as_me: LDFLAGS $LDFLAGS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: LIBICONV $LIBICONV" >&5 +printf '%s\n' "$as_me: LIBICONV $LIBICONV" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: LIBS $LIBS" >&5 +printf '%s\n' "$as_me: LIBS $LIBS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_CHANGELOG_DATE $PACKAGE_CHANGELOG_DATE" >&5 +printf '%s\n' "$as_me: PACKAGE_CHANGELOG_DATE $PACKAGE_CHANGELOG_DATE" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_DATE $PACKAGE_DATE" >&5 +printf '%s\n' "$as_me: PACKAGE_DATE $PACKAGE_DATE" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_ENGLISH_DATE $PACKAGE_ENGLISH_DATE" >&5 +printf '%s\n' "$as_me: PACKAGE_ENGLISH_DATE $PACKAGE_ENGLISH_DATE" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_PATCHLEVEL $PACKAGE_PATCHLEVEL" >&5 +printf '%s\n' "$as_me: PACKAGE_PATCHLEVEL $PACKAGE_PATCHLEVEL" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_REV $PACKAGE_REV" >&5 +printf '%s\n' "$as_me: PACKAGE_REV $PACKAGE_REV" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_VERS $PACKAGE_VERS" >&5 +printf '%s\n' "$as_me: PACKAGE_VERS $PACKAGE_VERS" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: PACKAGE_VERSION $PACKAGE_VERSION" >&5 +printf '%s\n' "$as_me: PACKAGE_VERSION $PACKAGE_VERSION" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: RELEASE_TAG $RELEASE_TAG" >&5 +printf '%s\n' "$as_me: RELEASE_TAG $RELEASE_TAG" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: tcsh_config_file system/$tcsh_config_file" >&5 +printf '%s\n' "$as_me: tcsh_config_file system/$tcsh_config_file" >&6;} +{ printf '%s\n' "$as_me:${as_lineno-$LINENO}: =========================================" >&5 +printf '%s\n' "$as_me: =========================================" >&6;} + diff --git a/configure.ac b/configure.ac index 4087b55e..875d11b2 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_SUBST(PACKAGE_MAILLIST, [https://github.com/orpheus497/mcsh/issues]) AC_SUBST(TCSH_BASELINE_VERS, TCSH_VERSION) AC_SUBST(TCSH_BASELINE_DATE, TCSH_DATE) AC_DEFINE_UNQUOTED([TCSH_BASELINE_VERSION], - ["TCSH_VERSION"], + [TCSH_VERSION], [Upstream tcsh version that mcsh was consolidated from.]) package_year="${PACKAGE_DATE%%-*}" @@ -62,7 +62,7 @@ PACKAGE_VERS="${PACKAGE_VERS%.*}" AC_SUBST(PACKAGE_VERS) PACKAGE_PATCHLEVEL="${PACKAGE_VERSION##*.}" -PACKAGE_PATCHLEVEL="${PACKAGE_PATCHLEVEL##0}" +PACKAGE_PATCHLEVEL="$(printf '%s\n' "$PACKAGE_PATCHLEVEL" | sed 's/^0*//; s/^$/0/')" AC_SUBST(PACKAGE_PATCHLEVEL) RELEASE_TAG="$(echo "MCSH${PACKAGE_VERSION}" | tr . _)" diff --git a/dch-template.in b/dch-template.in new file mode 100644 index 00000000..fb5aaf26 --- /dev/null +++ b/dch-template.in @@ -0,0 +1,11 @@ +@PACKAGE_TARNAME@ (@PACKAGE_VERSION@) UNRELEASED; urgency=medium + + * Release @PACKAGE_VERSION@ — consolidated mcsh release based on tcsh + @TCSH_BASELINE_VERS@ (@TCSH_BASELINE_DATE@). + * Includes all Phase 1–5 deliverables: dead platform purge, source hygiene, + build system modernisation, upstream bug fixes, and new features (function + builtin, interactive # comments, pipe-to-variable, redirection in {} blocks, + fish-style predictive autocomplete, native git branch prompt escapes %g/%G). + * See ISSUES.md for open items and upstream bugs not yet addressed. + + -- The mcsh Team <@PACKAGE_MAILLIST@> @PACKAGE_CHANGELOG_DATE@ diff --git a/dot.mcshrc b/dot.mcshrc index a608de28..35ed3b86 100644 --- a/dot.mcshrc +++ b/dot.mcshrc @@ -1,113 +1,226 @@ -# -# ~/.mcshrc - Setup user shell environment for mcsh (Modern C Shell). -# -# mcsh reads this file as ~/.mcshrc first; if ~/.mcshrc is absent it -# falls back to ~/.tcshrc and then ~/.cshrc, so a configuration written -# for historical tcsh or csh keeps working unchanged. See mcsh(1) and -# environ(7) for details. -# +# ============================================================================== +# MCSH PRECISION ENVIRONMENT +# Architecture: First-Principles. Zero Abstraction. +# ============================================================================== + +# ------------------------------------------------------------------------------ +# 1. DISPLAY SERVER (WAYLAND) +# Only applied when a Wayland compositor is actually running and /dev/dri exists. +# Machine-specific overrides go in ~/.mcshrc.local (not tracked in repo). +# ------------------------------------------------------------------------------ +if ( -e /dev/dri/card0 && $?WAYLAND_DISPLAY ) then + setenv CLUTTER_BACKEND wayland + setenv GDK_BACKEND wayland + setenv QT_QPA_PLATFORM wayland + setenv SDL_VIDEODRIVER wayland + setenv XDG_CURRENT_DESKTOP sway + setenv XDG_SESSION_TYPE wayland + setenv XDG_SESSION_DESKTOP sway +endif -unalias * +# Intel + Nvidia Hybrid GPU offloading — only enabled via local override. +# To activate: set ENABLE_NV_HYBRID=1 in ~/.mcshrc.local before sourcing this +# file, or source ~/.mcshrc.local which sets these variables directly. +# (WLR_DRM_DEVICES, WLR_NO_HARDWARE_CURSORS, LIBVA_DRIVER_NAME, +# __NV_PRIME_RENDER_OFFLOAD, __GLX_VENDOR_LIBRARY_NAME, __VK_LAYER_NV_optimus) + +# ------------------------------------------------------------------------------ +# 2. SYSTEM ENVIRONMENT & PATHS +# ------------------------------------------------------------------------------ +set path = ($HOME/.local/bin $path) +setenv EDITOR vi +setenv VISUAL vi +setenv PAGER less +setenv LESS '-i -R -M -x4' +setenv BLOCKSIZE K + +# Native FreeBSD Color Mapping +setenv CLICOLOR 1 +setenv LSCOLORS "ExGxFxDxCxEgEdxbxgxcxd" + +# ------------------------------------------------------------------------------ +# 3. CORE EXECUTION ENGINE & MEMORY +# ------------------------------------------------------------------------------ +set autorehash # Rebuild hash tables when $PATH mutates +set autolist = ambiguous # Show completions if ambiguous +set autoexpand # Expand history (!$) automatically +set autocorrect # Structural spell correction +set color # Enable color in builtins (ls-F completion coloring) +set syntax # Native interactive syntax highlighting +set correct = cmd # Command spell correction +set ellipsis # Use ... for truncated path prefix in prompt +set filec # Filename completion +set listjobs = long # Show full command line in jobs listing +set listlinks # Show symlink targets in ls-F +set listmax = 100 # Max completions before asking +set matchbeep = never # Silence terminal bells +set rmstar # Verify before wildcard deletion +set symlinks = chase # Resolve symlinks to physical paths natively + +# Memory Retention Strategy +set history = 10000 +set savehist = (10000 merge) +set histfile = ~/.mcsh_history +set histdup = erase # Erase duplicates from history + + +# ============================================================================== +# Interactive-only setup (skipped in non-interactive / script invocations) +# ============================================================================== +if ( $?prompt ) then -alias h 'history \!* 20' -alias j 'jobs -l' -alias ll 'ls -lAF' -alias md mkdir -alias rd rmdir +# ------------------------------------------------------------------------------ +# 4. KEYBINDINGS (TERMINAL I/O MAPPING) +# ------------------------------------------------------------------------------ +bindkey -e + +# History search on arrow up/down based on typed input +bindkey "^[[A" history-search-backward +bindkey "^[[B" history-search-forward + +# Ctrl+Arrow: word jumping +bindkey "^[[1;5C" forward-word +bindkey "^[[1;5D" backward-word + +# Home/End — cover xterm, vt100, rxvt and application-cursor variants +bindkey "\e[1~" beginning-of-line +bindkey "\e[4~" end-of-line +bindkey "\eOH" beginning-of-line +bindkey "\eOF" end-of-line +bindkey "\e[H" beginning-of-line +bindkey "\e[F" end-of-line + +# Editor shortcuts +bindkey " " magic-space +bindkey ^W backward-delete-word +bindkey ^Z run-fg-editor +bindkey ^[^W kill-region + +# ------------------------------------------------------------------------------ +# 5. NATIVE PROGRAMMABLE COMPLETION +# ------------------------------------------------------------------------------ +# C/Systems Architecture +complete {cc,clang,gcc} 'c/-[IL]/d/' 'n/*/f:*.{c,h,o,a,so}/' +complete make 'n@*@`(test -f Makefile || test -f makefile || test -f GNUmakefile) && make -pn 2>/dev/null | sed -n -E "/^[a-zA-Z0-9_-]+:/s/:.*//p"`@' + +# OS / Kernel Utilities +complete man 'n/*/c/' +complete kill 'n/*/c/' 'c/%/j/' +complete sysctl 'n/*/c/' +complete service 'c/-/(e l r v)/' 'p/1/`service -l`/' 'n/*/(start stop restart status rcvar)/' +complete ifconfig 'p/1/`ifconfig -l`/' 'n/*/(up down inet inet6 netmask)/' + +# Network & Archive Management +complete cd 'p/1/d/' +complete {tar,gzip,gunzip,xz,unxz,bzip2,bunzip2} 'n/*/f:*.{tar,gz,tgz,xz,bz2}/' + +# ------------------------------------------------------------------------------ +# 6. STRUCTURAL ALIASES +# ------------------------------------------------------------------------------ +unalias * -# -# The following commands are only for interactive shells. -# +# Base traversal and execution macros +alias h 'history' +alias j 'jobs' +alias m '$PAGER' +alias g 'egrep -i' + +# File Listing +alias ls 'ls -F -G' # Base ls with types and colors +alias l 'ls -l' +alias ll 'ls -laFo' # Detailed user-preferred list +alias df 'df -h' +alias du 'du -ch' + +# Precision File System Traversal +# pushd/popd display the stack as a numbered tree (zsh-style) after each +# navigation. cd +N jumps forward N entries; cd -N jumps to entry N from +# the bottom of the stack. The arrow marker (→) in dirs -v marks the +# current working directory at index 0. +alias .. 'cd ..' +alias ... 'cd ../..' +alias pd pushd +alias po popd +alias d 'dirs -v' + +# C Development Workflows +alias dis 'objdump -M intel -d \!*' +alias cclean 'rm -f *.o *.core *~ a.out' + +# ------------------------------------------------------------------------------ +# 7. PROMPT ENGINE +# ------------------------------------------------------------------------------ +# %g — current git branch (empty outside repos) +# %G — branch + operation state e.g. main|MERGING (empty outside repos) +# %? — last exit status +# %B/%b — bold on/off %U/%u — underline on/off %S/%s — standout on/off +# %{...%} — literal (zero-width) escape sequences + +set red = "%{\033[1;31m%}" +set green = "%{\033[1;32m%}" +set blue = "%{\033[1;34m%}" +set reset = "%{\033[0m%}" + +set prompt = "${green}%n@%m${reset}:${blue}%B%c02%b${reset} [${red}%?${reset}] %# " +set prompt2 = "%_> " +set prompt3 = "Correct %R to %r? [y|n|e|a] " +set rprompt = "%S%G%s" + +unset promptchars + +# ------------------------------------------------------------------------------ +# 8. HOST COMPLETION (SSH / RLOGIN) +# ------------------------------------------------------------------------------ +if ( ! $?hosts ) then + set hosts = () + foreach f ( ~/.{,r,ssh/known_}hosts ) + if ( -r "$f" ) then + set hosts = ( \ + $hosts \ + `sed \ + -e 's/#.*//' \ + -e '/^|/d' \ + -e '/^[+-]@/d' \ + -e 's/^[+-]//' \ + -e 's/[[:space:]].*$//' \ + -e 's/,/\n/g' \ + "$f" \ + | sed \ + -e 's/:[[:digit:]]*$//' \ + -e 's/^\[\([^]]*\)\]$/\1/' \ + -e '/^[.:[:xdigit:][:space:]]*$/d' \ + ` \ + ) + endif + end + unset f +endif -if ( $?prompt ) then - set \ - autocorrect \ - autoexpand \ - autolist=ambiguous \ - correct=cmd \ - ellipsis \ - filec \ - history=1000 \ - killdup=erase \ - listjobs=long \ - listlinks \ - listmax=100 \ - nobeep \ - prompt='%N@%m:%B%c02%b%# ' \ - rmstar \ - savehist=(1000 merge) \ - - unset promptchars - - if ( $?tcsh ) then - bindkey -e - - bindkey " " magic-space - bindkey ^W backward-delete-word - bindkey ^Z run-fg-editor - bindkey ^[^W kill-region - - # - # Setup $hosts from ~/.hosts, ~/.rhosts, ~/.ssh/known_hosts - # - - if ( ! $?hosts ) then - set hosts=() - foreach f ( ~/.{,r,ssh/known_}hosts ) - if ( -r "$f" ) then - set hosts=( \ - $hosts \ - `sed \ - -e 's/#.*//' \ - -e '/^|/d' \ - -e '/^[+-]@/d' \ - -e 's/^[+-]//' \ - -e 's/[[:space:]].*$//' \ - -e 's/,/\n/g' \ - "$f" \ - | sed \ - -e 's/:[[:digit:]]*$//' \ - -e 's/^\[\([^]]*\)\]$/\1/' \ - -e '/^[.:[:xdigit:][:space:]]*$/d' \ - ` \ - ) - endif - end - unset f - endif - - uncomplete * - - # - # Copy from complete.tcsh - # - if ( -r ~/.complete ) source ~/.complete - - uncomplete rcp rsh - endif - - # - # Set status to ^G in order to keep using ^T for transpose-char. - # - - switch ( "$OSTYPE" ) - case bsd44: - case darwin: - case FreeBSD: - case NetBSD: +# ------------------------------------------------------------------------------ +# 9. SYSTEM-SPECIFIC ADJUSTMENTS +# ------------------------------------------------------------------------------ +switch ( "$OSTYPE" ) +case bsd44: +case darwin: +case FreeBSD: +case NetBSD: stty status ^G - if ( $?tcsh ) bindkey ^G stuff-char + bindkey ^G stuff-char breaksw - endsw +endsw + +# Set time last so startup commands are not timed +# Threshold 0 = time every command; raise to 2 for less noisy sessions +set time = (0 "\n\e[1;36mreal\e[0m %E \e[1;32muser\e[0m %U \e[1;33msys\e[0m %S \e[1;35mcpu\e[0m %P") - # - # We don't want to create a root-owned files in our home. - # +endif # $?prompt - if ( $uid == 0 ) then +# Root: avoid history/info files owned by root in $HOME +if ( $uid == 0 ) then unset savehist setenv LESSHISTFILE - - setenv VIMINIT ':set viminfo=' - endif - + setenv VIMINIT 'set viminfo=' endif + +# Source machine-local overrides last so they take full precedence +if ( -r ~/.mcshrc.local ) source ~/.mcshrc.local diff --git a/ed.chared.c b/ed.chared.c index d1c1bdff..48192e95 100644 --- a/ed.chared.c +++ b/ed.chared.c @@ -1468,6 +1468,7 @@ e_insert(Char c) c_insert(1); *Cursor++ = (Char) c; DoingArg = 0; /* just in case */ + predict_from_history(); RefPlusOne(1); /* fast refresh for one char. */ } else { @@ -1484,6 +1485,7 @@ e_insert(Char c) while (Argument--) *Cursor++ = (Char) c; + predict_from_history(); Refresh(); } @@ -1547,6 +1549,7 @@ e_digit(Char c) /* gray magic here */ c_insert(1); *Cursor++ = (Char) c; DoingArg = 0; /* just in case */ + predict_from_history(); RefPlusOne(1); /* fast refresh for one char. */ } return(CC_NORM); @@ -3859,6 +3862,68 @@ e_page_down(Char c) return (CC_ERROR); } +void +predict_from_history(void) +{ + struct Hist *hp; + size_t inputlen; + const Char *hl; + Char *p; + + GhostBuf[0] = '\0'; + + if (Cursor != LastChar) + return; + + inputlen = (size_t)(LastChar - InputBuf); + if (inputlen == 0) + return; + + for (hp = Histlist.Hnext; hp != NULL; hp = hp->Hnext) { + hl = hp->histline; + if (hl == NULL) { + hp->histline = sprlex(&hp->Hlex); + hl = hp->histline; + } + if (hl == NULL) + continue; + if (Strncmp(InputBuf, hl, inputlen) == 0 && + hl[inputlen] != '\0') { + p = GhostBuf; + hl += inputlen; + while (*hl && *hl != '\n' && *hl != '\r' && p < GhostBuf + INBUFSIZE - 1) + *p++ = *hl++; + *p = '\0'; + return; + } + } +} + +CCRETVAL +e_predict_accept(Char c) +{ + if (GhostBuf[0] != '\0' && Cursor == LastChar) { + size_t ghostlen = Strlen(GhostBuf); + if (LastChar + (ptrdiff_t)ghostlen >= InputLim) { + /* Ghost doesn't fit — reject wholesale, leave GhostBuf intact */ + Refresh(); + return (CC_NORM); + } + { + Char *src = GhostBuf; + while (*src) + *LastChar++ = *src++; + *LastChar = '\0'; + Cursor = LastChar; + GhostBuf[0] = '\0'; + Refresh(); + return (CC_NORM); + } + } + GhostBuf[0] = '\0'; + return e_charfwd(c); +} + #ifdef notdef void MoveCursor(int n) /* move cursor + right - left char */ diff --git a/ed.decls.h b/ed.decls.h index ce89c342..e44e6c24 100644 --- a/ed.decls.h +++ b/ed.decls.h @@ -244,6 +244,8 @@ extern CCRETVAL e_page_down (Char); extern CCRETVAL e_yank_pop (Char); extern CCRETVAL e_newline_hold (Char); extern CCRETVAL e_newline_down_hist (Char); +extern CCRETVAL e_predict_accept (Char); +extern void predict_from_history (void); /* * ed.inputl.c @@ -279,4 +281,11 @@ extern void printOne (const Char *, const XmapVal *, int); extern eChar parseescape (const Char **, int); extern unsigned char *unparsestring (const CStr *, const Char *); +/* + * ed.syntax.c + */ +extern void syntax_colorize (void); +extern void syntax_clear (void); +extern void syntax_cache_clear(void); + #endif /* _h_ed_decls */ diff --git a/ed.defns.c b/ed.defns.c index 24d5d655..b132d31f 100644 --- a/ed.defns.c +++ b/ed.defns.c @@ -275,8 +275,10 @@ PFCmd CcFuncTbl[] = { /* table of available commands */ #define F_NEWLINE_HOLD 118 e_newline_down_hist, #define F_NEWLINE_DOWN_HIST 119 + e_predict_accept, +#define F_PREDICT_ACCEPT 120 0 /* DUMMY VALUE */ -#define F_NUM_FNS 120 +#define F_NUM_FNS 121 }; @@ -1761,6 +1763,12 @@ editinit(void) f->func = F_PAGE_DOWN; f->desc = CSAVS(3, 121, "(WIN32 only) Page visible console window down"); + f++; + f->name = "predict-accept"; + f->func = F_PREDICT_ACCEPT; + f->desc = CSAVS(3, 124, + "Accept predictive autocomplete suggestion, or move forward one char"); + f++; f->name = NULL; f->func = 0; diff --git a/ed.h b/ed.h index bd1d18a7..9150e184 100644 --- a/ed.h +++ b/ed.h @@ -141,6 +141,8 @@ EXTERN Char *UndoPtr; EXTERN int UndoSize; EXTERN int UndoAction; +EXTERN Char GhostBuf[INBUFSIZE]; /* predictive autocomplete ghost text */ + EXTERN struct Strbuf HistBuf; /* = Strbuf_INIT; history buffer */ EXTERN int Hist_num; /* what point up the history we are at now. */ /* buffer for which command and others */ @@ -176,6 +178,17 @@ EXTERN int CursorV, /* real cursor vertical (line) */ TermH; /* screen width */ EXTERN Char **Vdisplay; /* new buffer */ +/* + * Syntax tokens are packed into the upper bits of each display Char value + * (see ed.syntax.h: SYN_PACK / SYN_TOK / SYN_GLYPH). There are no separate + * parallel colour arrays; Vdisplay / Display hold both the glyph and the token + * in a single Char. ed.screen.c extracts the token with SYN_TOK(c) and the + * glyph with SYN_GLYPH(c) when deciding which SGR colour to emit in so_write(). + * vcurrent_color is the SynToken currently being written into Vdisplay cells + * by the Draw / Vdraw path in ed.refresh.c. + */ +EXTERN int vcurrent_color; /* SynToken being packed into Vdisplay */ + /* Variables that describe terminal ability */ EXTERN int T_Lines, T_Cols; /* Rows and Cols of the terminal */ EXTERN Char T_CanIns; /* true if I can insert characters */ diff --git a/ed.inputl.c b/ed.inputl.c index 83452eb6..d1346bb4 100644 --- a/ed.inputl.c +++ b/ed.inputl.c @@ -33,6 +33,7 @@ #include "ed.h" #include "ed.defns.h" /* for the function names */ #include "tw.h" /* for twenex stuff */ +#include "ed.syntax.h" #define OKCMD INT_MAX @@ -64,6 +65,8 @@ Repair(void) ClearDisp(); NeedsRedraw = 0; } + if (adrof(STRsyntax)) + syntax_colorize(); Refresh(); Argument = 1; DoingArg = 0; @@ -185,9 +188,20 @@ Inputl(void) /* now do the real command */ retval = (*CcFuncTbl[cmdnum]) (ch); + if (adrof(STRsyntax) && retval == CC_NORM) + syntax_colorize(); + /* save the last command here */ LastCmd = cmdnum; + /* clear ghost text for any command that isn't insert/predict-accept */ + if (cmdnum != F_INSERT && cmdnum != F_PREDICT_ACCEPT) { + if (GhostBuf[0] != '\0') { + GhostBuf[0] = '\0'; + Refresh(); + } + } + /* make sure fn is initialized */ fn = (retval == CC_COMPLETE_ALL) ? LIST_ALL : LIST; @@ -195,6 +209,8 @@ Inputl(void) switch (retval) { case CC_REFRESH: + if (adrof(STRsyntax)) + syntax_colorize(); Refresh(); /*FALLTHROUGH*/ case CC_NORM: /* normal char */ diff --git a/ed.refresh.c b/ed.refresh.c index 66c2e2f5..39c8527d 100644 --- a/ed.refresh.c +++ b/ed.refresh.c @@ -31,6 +31,9 @@ */ #include "sh.h" #include "ed.h" +#include "ed.syntax.h" +#include +#include /* #define DEBUG_UPDATE */ /* #define DEBUG_REFRESH */ /* #define DEBUG_LITERAL */ @@ -52,6 +55,7 @@ static void str_cp (Char *, Char *, int); static void PutPlusOne (Char, int); static void cpy_pad_spaces (Char *, Char *, int); +static void DrawGhost (int); #if defined(DEBUG_UPDATE) || defined(DEBUG_REFRESH) || defined(DEBUG_LITERAL) static void reprintf (char *, ...); #ifdef DEBUG_UPDATE @@ -158,6 +162,16 @@ Draw(Char *cp, int nocomb, int drawPrompt) int w, i, lv, lh; Char c, attr; + /* Set vcurrent_color from SyntaxColor for command-line characters */ + if (!drawPrompt && adrof(STRsyntax)) { + ptrdiff_t off = cp - InputBuf; + vcurrent_color = (off >= 0 && cp < LastChar) + ? (int)SyntaxColor[off] + : SYN_NORMAL; + } else { + vcurrent_color = SYN_NORMAL; + } + #ifdef WIDE_STRINGS if (!drawPrompt) { /* draw command-line */ attr = 0; @@ -274,9 +288,11 @@ Vdraw(Char c, int width) /* draw char c onto V lines */ that "span line breaks". */ while (vcursor_h + width > TermH) Vdraw(' ', 1); - Vdisplay[vcursor_v][vcursor_h] = c; + /* Never pack a NUL — it is the line terminator that Strend() scans for */ + Vdisplay[vcursor_v][vcursor_h] = (adrof(STRsyntax) && c != '\0') + ? SYN_PACK(c, vcurrent_color) : c; if (width) - vcursor_h++; /* advance to next place */ + vcursor_h++; while (--width > 0) Vdisplay[vcursor_v][vcursor_h++] = CHAR_DBWIDTH; if (vcursor_h >= TermH) { @@ -328,6 +344,77 @@ RefreshPromptpart(Char *buf) } } +/* DrawGhost - write predictive-autocomplete ghost text after the cursor, + * then reposition the cursor back to the insertion point. + * Called by both Refresh() and RefPlusOne() after they place the cursor. + */ +static void +DrawGhost(int full_repaint) +{ + const Char *gp; + int ghost_cols = 0; + int ni; + int sgr_set = 0; + static int prev_ghost_cols = 0; + + /* + * On a full repaint Refresh() already redrew the whole line cleanly — + * there is no ghost on screen. Just reset state and draw the new ghost. + * + * On the incremental path (RefPlusOne): one real char was just appended + * at the old cursor position, advancing CursorH by its width. The old + * ghost occupies columns starting exactly at the current CursorH + * (prev_ghost_h+width == CursorH). Erase it by writing spaces forward + * from CursorH, then return the cursor to CursorH before drawing the + * new ghost. + */ + if (GhostBuf[0] == '\0' || Cursor != LastChar) { + if (prev_ghost_cols > 0 && !full_repaint) { + for (ni = 0; ni < prev_ghost_cols; ni++) + (void) putpure(' '); + for (ni = 0; ni < prev_ghost_cols; ni++) + (void) putpure('\b'); + } + prev_ghost_cols = 0; + return; + } + + if (prev_ghost_cols > 0 && !full_repaint) { + for (ni = 0; ni < prev_ghost_cols; ni++) + (void) putpure(' '); + for (ni = 0; ni < prev_ghost_cols; ni++) + (void) putpure('\b'); + } + + gp = GhostBuf; + { + /* Emit SGR dim only if we can reset it too (T_me availability checked + * via StopHighlight being callable, proxied by the highlighting flag). */ + (void) putpure('\033'); (void) putpure('['); + (void) putpure('2'); (void) putpure('m'); + sgr_set = 1; + } + while (*gp) { + Char c = *gp++ & CHAR; + if (c < ' ' || c == 0x7f) + break; + (void) putpure((int)c); + ghost_cols++; + } + if (sgr_set) { + /* Use ESC[22;39m instead of ESC[0m so we only undo bold+dim and + * reset the foreground colour without clobbering other terminal + * attributes (underline, standout, etc.) tracked by cur_atr. */ + (void) putpure('\033'); (void) putpure('['); + (void) putpure('2'); (void) putpure('2'); + (void) putpure(';'); + (void) putpure('3'); (void) putpure('9'); (void) putpure('m'); + } + for (ni = 0; ni < ghost_cols; ni++) + (void) putpure('\b'); + prev_ghost_cols = ghost_cols; +} + /* * Refresh() * draws the new virtual screen image from the current input @@ -439,6 +526,7 @@ Refresh(void) MoveToLine(cur_v); /* go to where the cursor is */ MoveToChar(cur_h); SetAttributes(0); /* Clear all attributes */ + DrawGhost(1); /* full repaint — no erase needed */ flush(); /* send the output... */ GettingInput = oldgetting; /* reset to old value */ } @@ -1267,6 +1355,7 @@ RefPlusOne(int l) Refresh(); /* too hard to handle */ return; } + DrawGhost(0); /* incremental — erase old ghost tail */ flush(); } diff --git a/ed.screen.c b/ed.screen.c index 4c5339b2..80072d9a 100644 --- a/ed.screen.c +++ b/ed.screen.c @@ -33,6 +33,9 @@ #include "ed.h" #include "tc.h" #include "ed.defns.h" +#include "ed.syntax.h" +#include +#include /* #define DEBUG_LITERAL */ @@ -354,6 +357,7 @@ static int me_all = 0; /* does two or more of the attributes use me */ static void ReBufferDisplay (void); static void TCset (struct termcapstr *, const char *); +static void SetSGRColor (int); static void @@ -423,13 +427,16 @@ ReBufferDisplay(void) b = Vdisplay; Vdisplay = NULL; blkfree(b); + TermH = Val(T_co); TermV = (INBUFSIZE * 4) / TermH + 1;/*FIXBUF*/ + b = xmalloc(sizeof(*b) * (TermV + 1)); for (i = 0; i < TermV; i++) b[i] = xmalloc(sizeof(*b[i]) * (TermH + 1)); b[TermV] = NULL; Display = b; + b = xmalloc(sizeof(*b) * (TermV + 1)); for (i = 0; i < TermV; i++) b[i] = xmalloc(sizeof(*b[i]) * (TermH + 1)); @@ -745,7 +752,7 @@ ResetArrowKeys(void) arrow[A_K_LT].fun.cmd = F_CHARBACK; arrow[A_K_LT].type = XK_CMD; - arrow[A_K_RT].fun.cmd = F_CHARFWD; + arrow[A_K_RT].fun.cmd = F_PREDICT_ACCEPT; arrow[A_K_RT].type = XK_CMD; arrow[A_K_HO].fun.cmd = F_TOBEG; @@ -920,6 +927,7 @@ BindArrowKeys(void) } static Char cur_atr = 0; /* current attributes */ +static int cur_sgr = -1; /* current SGR fg colour (-1 = none) */ void SetAttributes(Char atr) @@ -932,6 +940,7 @@ SetAttributes(Char atr) ((cur_atr & STANDOUT) && !(atr & STANDOUT))) { (void) tputs(Str(T_me), 1, PUTPURE); cur_atr = 0; + cur_sgr = -1; } } if ((atr & BOLD) != (cur_atr & BOLD)) { @@ -989,6 +998,46 @@ SetAttributes(Char atr) int highlighting = 0; +/* + * SetSGRColor — emit ESC[{bold;}fg m when fg != cur_sgr. + * fg == -1 resets to default (ESC[0m). + * Only emits when `set syntax' is active. + */ +static void +SetSGRColor(int fg) +{ + if (fg == cur_sgr) + return; + if (fg < 0) { + /* reset: ESC[0m — clears all attributes */ + (void) putpure(CTL_ESC('\033')); + (void) putpure('['); + (void) putpure('0'); + (void) putpure('m'); + cur_atr = 0; + } else { + SynColor *sc = &SynPalette[(fg < SYN__MAX) ? fg : SYN_NORMAL]; + char buf[16]; + int len; + int k; + if (sc->bold) + len = snprintf(buf, sizeof(buf), "\033[1;%dm", sc->fg ? sc->fg : 39); + else if (sc->fg) + len = snprintf(buf, sizeof(buf), "\033[%dm", sc->fg); + else + /* No bold, default fg: reset bold and fg independently so we + * don't clobber other SGR state (italic, underline, etc.) that + * cur_atr tracks. ESC[22m cancels bold; ESC[39m resets fg. */ + len = snprintf(buf, sizeof(buf), "\033[22;39m"); + for (k = 0; k < len; k++) + (void) putpure((unsigned char)buf[k]); + /* Reflect the state change in cur_atr */ + if (!sc->bold) + cur_atr &= ~BOLD; + } + cur_sgr = fg; +} + void StartHighlight(void) { @@ -1001,6 +1050,7 @@ StopHighlight(void) { (void) tputs(Str(T_me), 1, PUTPURE); highlighting = 0; + cur_sgr = -1; } /* PWP 6-27-88 -- if the tty driver thinks that we can tab, we ask termcap */ @@ -1189,17 +1239,23 @@ so_write(Char *cp, int n) StopHighlight(); } - if (*cp != CHAR_DBWIDTH) { - if (*cp & LITERAL) { + /* extract syntax token from upper bits; emit SGR; strip before output */ + if (adrof(STRsyntax) && !highlighting) { + SetSGRColor((int)SYN_TOK(*cp)); + } + + if (SYN_GLYPH(*cp) != CHAR_DBWIDTH) { + Char glyph = SYN_GLYPH(*cp); + if (glyph & LITERAL) { Char *d; #ifdef DEBUG_LITERAL - xprintf("so: litnum %d\r\n", (int)(*cp & ~LITERAL)); + xprintf("so: litnum %d\r\n", (int)(glyph & ~LITERAL)); #endif /* DEBUG_LITERAL */ - for (d = litptr + (*cp & ~LITERAL) * LIT_FACTOR; *d; d++) + for (d = litptr + (glyph & ~LITERAL) * LIT_FACTOR; *d; d++) (void) putwraw(*d); } else - (void) putwraw(*cp); + (void) putwraw(glyph); } cp++; CursorH++; @@ -1208,6 +1264,10 @@ so_write(Char *cp, int n) if (adrof(STRhighlight) && highlighting) StopHighlight(); + /* reset SGR colour after the write sequence */ + if (adrof(STRsyntax)) + SetSGRColor(-1); + if (CursorH >= TermH) { /* wrap? */ if (T_Margin & MARGIN_AUTO) { /* yes */ CursorH = 0; diff --git a/ed.syntax.c b/ed.syntax.c new file mode 100644 index 00000000..24babf49 --- /dev/null +++ b/ed.syntax.c @@ -0,0 +1,603 @@ +/* + * ed.syntax.c: Interactive syntax highlighting for mcsh. + * + * syntax_colorize() rescans InputBuf on every buffer mutation (when + * `set syntax` is active) and populates SyntaxColor[], a parallel byte + * array that the virtual-display pipeline consults at render time. + * + * Design constraints: + * - No allocation, no stderror(), no shell state mutation. + * - O(n) in line length; safe to call on every keystroke. + * - Correct for csh/tcsh syntax: quoting, variable expansion, operators, + * keywords, builtins, and $PATH command lookup with a tiny LRU cache. + */ +/*- + * Copyright (c) 2026 The mcsh Contributors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include "sh.h" +#include "ed.h" +#include "ed.syntax.h" + +#include +#include +#include +#include +#include +#include + +/* ------------------------------------------------------------------ */ +/* Public state */ +/* ------------------------------------------------------------------ */ + +uint8_t SyntaxColor[INBUFSIZE]; + +/* + * Default colour palette. fg values are raw ANSI codes (30-37 standard, + * 90-97 bright). 0 means "use terminal default". + */ +SynColor SynPalette[SYN__MAX] = { + /* SYN_NORMAL */ { 0, 0 }, + /* SYN_KEYWORD */ { 36, 1 }, /* bold cyan */ + /* SYN_BUILTIN */ { 32, 1 }, /* bold green */ + /* SYN_CMD_OK */ { 32, 0 }, /* green */ + /* SYN_CMD_BAD */ { 31, 1 }, /* bold red */ + /* SYN_OPERATOR */ { 33, 0 }, /* yellow */ + /* SYN_VARIABLE */ { 35, 0 }, /* magenta */ + /* SYN_DQUOTE */ { 33, 0 }, /* yellow */ + /* SYN_SQUOTE */ { 33, 0 }, /* yellow */ + /* SYN_BACKTICK */ { 36, 0 }, /* cyan */ + /* SYN_COMMENT */ { 90, 0 }, /* bright black / dim gray */ + /* SYN_ERROR */ { 31, 1 }, /* bold red */ +}; + +/* ------------------------------------------------------------------ */ +/* csh/tcsh keyword and builtin tables */ +/* ------------------------------------------------------------------ */ + +static const char * const keywords[] = { + "if", "else", "endif", "then", + "while", "end", + "foreach", "in", + "switch", "case", "default", "breaksw", "endsw", + "repeat", + "break", "continue", + "goto", + "exit", + "return", + NULL +}; + +static const char * const builtins[] = { + "alias", "unalias", + "bg", "fg", "jobs", "stop", "notify", + "cd", "chdir", "pushd", "popd", "dirs", + "echo", "printf", + "eval", + "exec", + "exit", + "function", + "glob", + "hashstat", "rehash", "unhash", + "history", "hup", + "kill", + "limit", "unlimit", + "login", "logout", + "ls-F", + "nice", + "nohup", + "onintr", + "printenv", + "pwd", + "read", + "sched", + "set", "unset", "setenv", "unsetenv", + "settc", "setty", + "shift", + "source", + "suspend", + "time", + "umask", + "wait", + "which", + NULL +}; + +/* ------------------------------------------------------------------ */ +/* $PATH command-existence LRU cache */ +/* ------------------------------------------------------------------ */ + +#define CMD_CACHE_SIZE 32 +#define CMD_CACHE_NAMELEN 64 + +typedef struct { + char name[CMD_CACHE_NAMELEN]; + int found; /* 1 = on path, 0 = not found, -1 = empty/unused */ +} CmdCacheEntry; + +static CmdCacheEntry cmd_cache[CMD_CACHE_SIZE]; +static int cmd_cache_init = 0; + +static void +cache_init(void) +{ + int i; + for (i = 0; i < CMD_CACHE_SIZE; i++) + cmd_cache[i].found = -1; + cmd_cache_init = 1; +} + +void +syntax_cache_clear(void) +{ + cache_init(); +} + +static int +cache_lookup(const char *name) +{ + int i; + if (!cmd_cache_init) cache_init(); + for (i = 0; i < CMD_CACHE_SIZE; i++) { + if (cmd_cache[i].found >= 0 && + strncmp(cmd_cache[i].name, name, CMD_CACHE_NAMELEN - 1) == 0) + return cmd_cache[i].found; + } + return -1; +} + +static void +cache_store(const char *name, int found) +{ + int i, oldest = 0; + if (!cmd_cache_init) cache_init(); + for (i = 0; i < CMD_CACHE_SIZE; i++) { + if (cmd_cache[i].found < 0) { + oldest = i; + break; + } + oldest = i; /* simple evict-last strategy */ + } + strncpy(cmd_cache[oldest].name, name, CMD_CACHE_NAMELEN - 1); + cmd_cache[oldest].name[CMD_CACHE_NAMELEN - 1] = '\0'; + cmd_cache[oldest].found = found; +} + +/* + * Look up whether `word' (plain ASCII, no quoting) is executable on $PATH. + * Returns 1 if found, 0 if not. Uses the cache to avoid repeated stat(2). + * Absolute/relative paths are checked directly. + */ +static int +cmd_on_path(const char *word) +{ + char path[1024]; + const char *pathenv; + const char *p, *q; + size_t dlen, wlen; + struct stat st; + int cached; + + if (!word || !word[0]) + return 0; + + cached = cache_lookup(word); + if (cached >= 0) + return cached; + + /* absolute or relative path: check directly */ + if (word[0] == '/' || word[0] == '.') { + int ok = (stat(word, &st) == 0 && + S_ISREG(st.st_mode) && access(word, X_OK) == 0); + cache_store(word, ok); + return ok; + } + + pathenv = getenv("PATH"); + if (!pathenv) { + cache_store(word, 0); + return 0; + } + + wlen = strlen(word); + p = pathenv; + while (p && *p) { + q = strchr(p, ':'); + dlen = q ? (size_t)(q - p) : strlen(p); + if (dlen + 1 + wlen + 1 < sizeof(path)) { + if (dlen == 0) { + /* empty component = current dir */ + snprintf(path, sizeof(path), "./%s", word); + } else { + memcpy(path, p, dlen); + path[dlen] = '/'; + memcpy(path + dlen + 1, word, wlen); + path[dlen + 1 + wlen] = '\0'; + } + if (stat(path, &st) == 0 && S_ISREG(st.st_mode) && + access(path, X_OK) == 0) { + cache_store(word, 1); + return 1; + } + } + p = q ? q + 1 : NULL; + } + cache_store(word, 0); + return 0; +} + +/* ------------------------------------------------------------------ */ +/* String table helpers */ +/* ------------------------------------------------------------------ */ + +static int +in_table(const char * const *table, const char *word, size_t len) +{ + size_t i; + for (; *table; table++) { + size_t tl = strlen(*table); + if (tl == len && strncmp(*table, word, len) == 0) + return 1; + } + return 0; +} + +/* ------------------------------------------------------------------ */ +/* Tokenizer state */ +/* ------------------------------------------------------------------ */ + +typedef enum { + ST_NORMAL = 0, + ST_DQUOTE, + ST_SQUOTE, + ST_BACKTICK, + ST_COMMENT, + ST_VARIABLE, + ST_BRACE_VAR /* ${…} */ +} TokState; + +/* ------------------------------------------------------------------ */ +/* Public API */ +/* ------------------------------------------------------------------ */ + +void +syntax_clear(void) +{ + memset(SyntaxColor, SYN_NORMAL, sizeof(SyntaxColor)); +} + +/* + * syntax_colorize — rescan InputBuf and populate SyntaxColor[]. + * + * The scanner is a single-pass state machine. It tracks: + * - current quoting state (ST_NORMAL / ST_DQUOTE / ST_SQUOTE / …) + * - whether we are at the start of a command word (at_cmd = 1) + * - word boundaries so we can classify the first word per pipeline + * segment as keyword / builtin / cmd-ok / cmd-bad + * + * We emit colour for each character individually so that partial words + * during typing get coloured correctly. + */ +void +syntax_colorize(void) +{ + const Char *buf = InputBuf; + const Char *end = LastChar; + ptrdiff_t len = end - buf; + ptrdiff_t i; + TokState state = ST_NORMAL; + int at_cmd = 1; /* next non-space word is the command */ + int in_word = 0; /* currently inside a word */ + ptrdiff_t word_start = 0; + int brace_depth = 0; /* for ${…} */ + char wordbuf[256]; + + if (len <= 0) { + syntax_clear(); + return; + } + + /* Zero out the region we'll colour */ + memset(SyntaxColor, SYN_NORMAL, (size_t)len); + + /* ---- pass: classify every character ---- */ + for (i = 0; i < len; i++) { + Char raw = buf[i]; + int ch = (int)(raw & CHAR); + + switch (state) { + + /* -------------------------------------------------- */ + case ST_COMMENT: + SyntaxColor[i] = SYN_COMMENT; + continue; + + /* -------------------------------------------------- */ + case ST_SQUOTE: + SyntaxColor[i] = SYN_SQUOTE; + if (ch == '\'') { + state = ST_NORMAL; + in_word = 0; + } + continue; + + /* -------------------------------------------------- */ + case ST_DQUOTE: + SyntaxColor[i] = SYN_DQUOTE; + if (ch == '\\' && i + 1 < len) { + i++; + SyntaxColor[i] = SYN_DQUOTE; + } else if (ch == '"') { + state = ST_NORMAL; + in_word = 0; + } else if (ch == '$') { + /* variable inside dquote: colour it magenta */ + SyntaxColor[i] = SYN_VARIABLE; + } + continue; + + /* -------------------------------------------------- */ + case ST_BACKTICK: + SyntaxColor[i] = SYN_BACKTICK; + if (ch == '`') { + state = ST_NORMAL; + in_word = 0; + } + continue; + + /* -------------------------------------------------- */ + case ST_VARIABLE: + if (ch == '{') { + SyntaxColor[i] = SYN_VARIABLE; + state = ST_BRACE_VAR; + brace_depth = 1; + } else if ((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >= '0' && ch <= '9') || + ch == '_' || ch == '?' || ch == '#' || + ch == '$' || ch == '!' || ch == '<') { + SyntaxColor[i] = SYN_VARIABLE; + /* '?' and '#' are single-char special-variable prefixes; + * keep state as ST_VARIABLE so the following alphanumeric + * characters remain part of the variable name (e.g. $?path). */ + if (ch == '?' || ch == '#') { + /* stay in ST_VARIABLE to absorb trailing name chars */ + } else if (!((buf[i] & CHAR) >= 'a' && (buf[i] & CHAR) <= 'z') && + !((buf[i] & CHAR) >= 'A' && (buf[i] & CHAR) <= 'Z') && + !((buf[i] & CHAR) >= '0' && (buf[i] & CHAR) <= '9') && + (buf[i] & CHAR) != '_') + state = ST_NORMAL; + } else { + state = ST_NORMAL; + /* reprocess this char in normal mode */ + i--; + } + continue; + + /* -------------------------------------------------- */ + case ST_BRACE_VAR: + SyntaxColor[i] = SYN_VARIABLE; + if (ch == '{') brace_depth++; + else if (ch == '}') { + brace_depth--; + if (brace_depth == 0) + state = ST_NORMAL; + } + continue; + + /* -------------------------------------------------- */ + case ST_NORMAL: + break; + } + + /* ---- ST_NORMAL processing ---- */ + + /* Escape: next char is literal */ + if (ch == '\\' && i + 1 < len) { + SyntaxColor[i] = SYN_NORMAL; + i++; + SyntaxColor[i] = SYN_NORMAL; + continue; + } + + /* Comment */ + if (ch == '#' && !in_word) { + state = ST_COMMENT; + SyntaxColor[i] = SYN_COMMENT; + continue; + } + + /* Quote starts */ + if (ch == '\'') { + /* flush any open word */ + if (in_word) { + in_word = 0; + } + state = ST_SQUOTE; + SyntaxColor[i] = SYN_SQUOTE; + continue; + } + if (ch == '"') { + if (in_word) in_word = 0; + state = ST_DQUOTE; + SyntaxColor[i] = SYN_DQUOTE; + continue; + } + if (ch == '`') { + if (in_word) in_word = 0; + state = ST_BACKTICK; + SyntaxColor[i] = SYN_BACKTICK; + continue; + } + + /* Variable expansion */ + if (ch == '$') { + state = ST_VARIABLE; + SyntaxColor[i] = SYN_VARIABLE; + continue; + } + + /* Operators / word separators */ + if (ch == '|' || ch == ';' || ch == '&' || ch == '(' || + ch == ')' || ch == '\n') { + if (in_word) { + /* classify the word we just closed */ + size_t wlen = (size_t)(i - word_start); + if (wlen < sizeof(wordbuf) - 1) { + size_t wi; + for (wi = 0; wi < wlen; wi++) + wordbuf[wi] = (char)(buf[word_start + wi] & CHAR); + wordbuf[wlen] = '\0'; + SynToken tok; + if (!at_cmd) + tok = SYN_NORMAL; + else if (in_table(keywords, wordbuf, wlen)) + tok = SYN_KEYWORD; + else if (in_table(builtins, wordbuf, wlen)) + tok = SYN_BUILTIN; + else if (cmd_on_path(wordbuf)) + tok = SYN_CMD_OK; + else + tok = SYN_CMD_BAD; + if (at_cmd) { + ptrdiff_t wi2; + for (wi2 = word_start; wi2 < i; wi2++) + SyntaxColor[wi2] = (uint8_t)tok; + } + } + in_word = 0; + } + + /* double-char operators */ + if (ch == '|' && i + 1 < len && (buf[i+1] & CHAR) == '|') { + SyntaxColor[i] = SYN_OPERATOR; + SyntaxColor[++i] = SYN_OPERATOR; + } else if (ch == '&' && i + 1 < len && (buf[i+1] & CHAR) == '&') { + SyntaxColor[i] = SYN_OPERATOR; + SyntaxColor[++i] = SYN_OPERATOR; + } else { + SyntaxColor[i] = SYN_OPERATOR; + } + + at_cmd = (ch != ')'); + continue; + } + + /* Redirection */ + if (ch == '>' || ch == '<') { + if (in_word) in_word = 0; + SyntaxColor[i] = SYN_OPERATOR; + /* >> >& >>& etc. */ + while (i + 1 < len) { + int nc = (int)(buf[i+1] & CHAR); + if (nc == '>' || nc == '&' || nc == '-') + SyntaxColor[++i] = SYN_OPERATOR; + else + break; + } + at_cmd = 0; /* after redirection, next word is not a command */ + continue; + } + + /* Whitespace — word boundary */ + if (ch == ' ' || ch == '\t') { + if (in_word) { + /* classify the word we just finished */ + size_t wlen = (size_t)(i - word_start); + if (wlen < sizeof(wordbuf) - 1) { + size_t wi; + for (wi = 0; wi < wlen; wi++) + wordbuf[wi] = (char)(buf[word_start + wi] & CHAR); + wordbuf[wlen] = '\0'; + if (at_cmd) { + SynToken tok; + if (in_table(keywords, wordbuf, wlen)) + tok = SYN_KEYWORD; + else if (in_table(builtins, wordbuf, wlen)) + tok = SYN_BUILTIN; + else if (cmd_on_path(wordbuf)) + tok = SYN_CMD_OK; + else + tok = SYN_CMD_BAD; + ptrdiff_t wi2; + for (wi2 = word_start; wi2 < i; wi2++) + SyntaxColor[wi2] = (uint8_t)tok; + at_cmd = 0; + } + } + in_word = 0; + } + SyntaxColor[i] = SYN_NORMAL; + continue; + } + + /* Regular character — accumulate word */ + if (!in_word) { + in_word = 1; + word_start = i; + } + /* Leave SyntaxColor[i] = SYN_NORMAL for now; we'll back-fill + * when we detect the word boundary above. */ + } + + /* Flush any open word at end of buffer */ + if (in_word && state == ST_NORMAL) { + size_t wlen = (size_t)(len - word_start); + if (wlen < sizeof(wordbuf) - 1) { + size_t wi; + for (wi = 0; wi < wlen; wi++) + wordbuf[wi] = (char)(buf[word_start + wi] & CHAR); + wordbuf[wlen] = '\0'; + if (at_cmd) { + SynToken tok; + if (in_table(keywords, wordbuf, wlen)) + tok = SYN_KEYWORD; + else if (in_table(builtins, wordbuf, wlen)) + tok = SYN_BUILTIN; + else if (cmd_on_path(wordbuf)) + tok = SYN_CMD_OK; + else + tok = SYN_CMD_BAD; + ptrdiff_t wi2; + for (wi2 = word_start; wi2 < len; wi2++) + SyntaxColor[wi2] = (uint8_t)tok; + } + } + } + + /* Mark unterminated quotes as errors */ + if (state == ST_SQUOTE || state == ST_DQUOTE || + state == ST_BACKTICK || state == ST_BRACE_VAR) { + for (i = 0; i < len; i++) { + if ((SynToken)SyntaxColor[i] == SYN_SQUOTE || + (SynToken)SyntaxColor[i] == SYN_DQUOTE || + (SynToken)SyntaxColor[i] == SYN_BACKTICK || + (SynToken)SyntaxColor[i] == SYN_VARIABLE) + SyntaxColor[i] = SYN_ERROR; + } + } +} diff --git a/ed.syntax.h b/ed.syntax.h new file mode 100644 index 00000000..48cdc6e4 --- /dev/null +++ b/ed.syntax.h @@ -0,0 +1,140 @@ +/* + * ed.syntax.h: Interactive syntax highlighting for mcsh. + * + * Provides a parallel byte array SyntaxColor[INBUFSIZE] whose every entry + * holds a SynToken value for the corresponding InputBuf character. + * syntax_colorize() rescans the input buffer on every buffer mutation when + * `set syntax` is active. The render pipeline in ed.refresh.c / ed.screen.c + * reads syntax tokens packed into Vdisplay / Display Char values via + * SYN_TOK() / SYN_GLYPH() (Option B: full virtual-display integration). + */ +/*- + * Copyright (c) 2026 The mcsh Contributors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#ifndef _h_ed_syntax +#define _h_ed_syntax + +#include + +/* + * Syntax token packing into Vdisplay Char values. + * + * Char is 32-bit (WIDE_STRINGS). ATTRIBUTES uses 0x0F000000. + * Bits 0xF0000000 are unused in the display path (QUOTE/0x80000000 is + * only set by the lexer, never written into Vdisplay/Display). + * We store the 4-bit SynToken in those bits so update_line()'s glyph + * diff (*o == *n) naturally detects colour-only changes without any + * separate parallel arrays or display poisoning. + * + * For SHORT_STRINGS / narrow-Char builds (sizeof(Char) < 4) bit-packing + * is disabled: SYN_PACK is a no-op, SYN_TOK always returns SYN_NORMAL, + * and SYN_GLYPH is the identity function so the build is still correct + * (syntax colours are simply not shown on narrow builds). + */ +#if defined(WIDE_STRINGS) || (defined(SIZEOF_CHAR_T) && SIZEOF_CHAR_T >= 4) || \ + (!defined(SHORT_STRINGS) && !defined(KANJI)) +# define SYN_SHIFT 28 /* bit position of token field */ +# define SYN_MASK ((Char)0xF0000000U) /* mask for token field */ +/* Pack token t into display Char c */ +# define SYN_PACK(c, t) (((c) & ~SYN_MASK) | (((Char)(t)) << SYN_SHIFT)) +/* Extract token from display Char c */ +# define SYN_TOK(c) (((unsigned)(c) >> SYN_SHIFT) & 0xF) +/* Strip token bits to get the raw glyph for terminal output */ +# define SYN_GLYPH(c) ((c) & ~SYN_MASK) +#else +/* Narrow-Char fallback: disable bit-packing, syntax colours not available */ +# define SYN_MASK 0 +# define SYN_PACK(c, t) (c) +# define SYN_TOK(c) 0 +# define SYN_GLYPH(c) (c) +#endif + +/* + * SynToken — per-character syntactic category. + * Values 0-11 fit in the 4-bit token field above. + */ +typedef enum { + SYN_NORMAL = 0, /* uncoloured / default terminal colour */ + SYN_KEYWORD = 1, /* language keyword: if while foreach … */ + SYN_BUILTIN = 2, /* shell built-in: echo set alias cd … */ + SYN_CMD_OK = 3, /* first word — found on $PATH */ + SYN_CMD_BAD = 4, /* first word — NOT found on $PATH */ + SYN_OPERATOR = 5, /* | ; && || & > < >> >& */ + SYN_VARIABLE = 6, /* $var $?var ${var} $#var */ + SYN_DQUOTE = 7, /* "…" double-quoted string */ + SYN_SQUOTE = 8, /* '…' single-quoted string */ + SYN_BACKTICK = 9, /* `…` command substitution */ + SYN_COMMENT = 10, /* # to end-of-line */ + SYN_ERROR = 11, /* unmatched quote / bracket */ + SYN__MAX = 12 +} SynToken; + +/* + * SGR colour specification for one token type. + * fg: ANSI foreground code (30-37, 90-97, or 0 for default). + * bold: non-zero ⇒ prepend SGR bold (1). + */ +typedef struct { + int fg; + int bold; +} SynColor; + +/* + * Default colour palette — matches the plan doc. + * Callers may override via the SynPalette[] array. + */ +extern SynColor SynPalette[SYN__MAX]; + +/* + * SyntaxColor[i] holds the SynToken for InputBuf[i]. + * Kept in sync with the buffer length; bytes past LastChar are SYN_NORMAL. + */ +extern uint8_t SyntaxColor[INBUFSIZE]; + +/* + * Rescan InputBuf[0..LastChar) and rebuild SyntaxColor[]. + * Safe to call on every keystroke: O(n) in line length, no allocation, + * no shell state mutation, no stderror(). + */ +extern void syntax_colorize(void); + +/* + * Clear the entire SyntaxColor array (all SYN_NORMAL). + * Called when `set syntax` is unset or the shell is not in input mode. + */ +extern void syntax_clear(void); + +/* + * Invalidate the command-lookup cache. + * Call when PATH or the current working directory changes so stale + * cmd_on_path() results are not returned for newly installed or + * shadowed executables. + */ +extern void syntax_cache_clear(void); + +#endif /* _h_ed_syntax */ diff --git a/m4/build-to-host.m4 b/m4/build-to-host.m4 new file mode 100644 index 00000000..d13649e0 --- /dev/null +++ b/m4/build-to-host.m4 @@ -0,0 +1,274 @@ +# build-to-host.m4 +# serial 5 +dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Bruno Haible. + +dnl When the build environment ($build_os) is different from the target runtime +dnl environment ($host_os), file names may need to be converted from the build +dnl environment syntax to the target runtime environment syntax. This is +dnl because the Makefiles are executed (mostly) by build environment tools and +dnl therefore expect file names in build environment syntax, whereas the runtime +dnl expects file names in target runtime environment syntax. +dnl +dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need +dnl be converted from Cygwin syntax to native Windows syntax: +dnl /cygdrive/c/foo/bar -> C:\foo\bar +dnl /usr/local/share -> C:\cygwin64\usr\local\share +dnl +dnl gl_BUILD_TO_HOST([somedir]) +dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must +dnl already have its final value assigned, and produces two additional +dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the +dnl same file name value, just in different syntax: +dnl - somedir_c is the file name in target runtime environment syntax, +dnl as a C string (starting and ending with a double-quote, +dnl and with escaped backslashes and double-quotes in +dnl between). +dnl - somedir_c_make is the same thing, escaped for use in a Makefile. + +AC_DEFUN([gl_BUILD_TO_HOST], +[ + AC_REQUIRE([AC_CANONICAL_BUILD]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_BUILD_TO_HOST_INIT]) + + dnl Define somedir_c. + gl_final_[$1]="$[$1]" + dnl Translate it from build syntax to host syntax. + case "$build_os" in + cygwin*) + case "$host_os" in + mingw* | windows*) + gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;; + esac + ;; + esac + dnl Convert it to C string syntax. + [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` + [$1]_c='"'"$[$1]_c"'"' + AC_SUBST([$1_c]) + + dnl Define somedir_c_make. + [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"` + dnl Use the substituted somedir variable, when possible, so that the user + dnl may adjust somedir a posteriori when there are no special characters. + if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then + [$1]_c_make='\"$([$1])\"' + fi + AC_SUBST([$1_c_make]) +]) + +dnl Some initializations for gl_BUILD_TO_HOST. +AC_DEFUN([gl_BUILD_TO_HOST_INIT], +[ + gl_sed_double_backslashes='s/\\/\\\\/g' + gl_sed_escape_doublequotes='s/"/\\"/g' +changequote(,)dnl + gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" +changequote([,])dnl + gl_sed_escape_for_make_2='s,\$,\\$$,g' + dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr + dnl does not understand '\r'. + case `echo r | tr -d '\r'` in + '') gl_tr_cr='\015' ;; + *) gl_tr_cr='\r' ;; + esac +]) + + +dnl The following macros are convenience invocations of gl_BUILD_TO_HOST +dnl for some of the variables that are defined by Autoconf. +dnl To do so for _all_ the possible variables, use the module 'configmake'. + +dnl Defines bindir_c and bindir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR], +[ + dnl Find the final value of bindir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_bindir="${bindir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval bindir="$bindir" + gl_BUILD_TO_HOST([bindir]) + bindir="${gl_saved_bindir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines datadir_c and datadir_c_make, +dnl where datadir = $(datarootdir) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR], +[ + dnl Find the final value of datadir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_datadir="${datadir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval datadir="$datadir" + gl_BUILD_TO_HOST([datadir]) + datadir="${gl_saved_datadir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines libdir_c and libdir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR], +[ + dnl Find the final value of libdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libdir="${libdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libdir="$libdir" + gl_BUILD_TO_HOST([libdir]) + libdir="${gl_saved_libdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines libexecdir_c and libexecdir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR], +[ + dnl Find the final value of libexecdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libexecdir="${libexecdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libexecdir="$libexecdir" + gl_BUILD_TO_HOST([libexecdir]) + libexecdir="${gl_saved_libexecdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines localedir_c and localedir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR], +[ + dnl Find the final value of localedir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_localedir="${localedir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + gl_BUILD_TO_HOST([localedir]) + localedir="${gl_saved_localedir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkgdatadir_c and pkgdatadir_c_make, +dnl where pkgdatadir = $(datadir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR], +[ + dnl Find the final value of pkgdatadir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_datadir="${datadir}" + gl_saved_pkgdatadir="${pkgdatadir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval datadir="$datadir" + eval pkgdatadir="$pkgdatadir" + gl_BUILD_TO_HOST([pkgdatadir]) + pkgdatadir="${gl_saved_pkgdatadir}" + datadir="${gl_saved_datadir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkglibdir_c and pkglibdir_c_make, +dnl where pkglibdir = $(libdir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR], +[ + dnl Find the final value of pkglibdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libdir="${libdir}" + gl_saved_pkglibdir="${pkglibdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libdir="$libdir" + eval pkglibdir="$pkglibdir" + gl_BUILD_TO_HOST([pkglibdir]) + pkglibdir="${gl_saved_pkglibdir}" + libdir="${gl_saved_libdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkglibexecdir_c and pkglibexecdir_c_make, +dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR], +[ + dnl Find the final value of pkglibexecdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libexecdir="${libexecdir}" + gl_saved_pkglibexecdir="${pkglibexecdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libexecdir="$libexecdir" + eval pkglibexecdir="$pkglibexecdir" + gl_BUILD_TO_HOST([pkglibexecdir]) + pkglibexecdir="${gl_saved_pkglibexecdir}" + libexecdir="${gl_saved_libexecdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) diff --git a/m4/gettext.m4 b/m4/gettext.m4 new file mode 100644 index 00000000..d6a98efb --- /dev/null +++ b/m4/gettext.m4 @@ -0,0 +1,392 @@ +# gettext.m4 +# serial 81 (gettext-0.23) +dnl Copyright (C) 1995-2014, 2016, 2018-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Lesser General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Lesser General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2024. + +dnl Macro to add for using GNU gettext. + +dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). +dnl INTLSYMBOL must be one of 'external', 'use-libtool', 'here'. +dnl INTLSYMBOL should be 'external' for packages other than GNU gettext. +dnl It should be 'use-libtool' for the packages 'gettext-runtime' and +dnl 'gettext-tools'. +dnl It should be 'here' for the package 'gettext-runtime/intl'. +dnl If INTLSYMBOL is 'here', then a libtool library +dnl $(top_builddir)/libintl.la will be created (shared and/or static, +dnl depending on --{enable,disable}-{shared,static} and on the presence of +dnl AM-DISABLE-SHARED). +dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext +dnl implementations (in libc or libintl) without the ngettext() function +dnl will be ignored. If NEEDSYMBOL is specified and is +dnl 'need-formatstring-macros', then GNU gettext implementations that don't +dnl support the ISO C 99 formatstring macros will be ignored. +dnl INTLDIR is used to find the intl libraries. If empty, +dnl the value '$(top_builddir)/intl/' is used. +dnl +dnl The result of the configuration is one of three cases: +dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled +dnl and used. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 2) GNU gettext has been found in the system's C library. +dnl Catalog format: GNU --> install in $(datadir) +dnl Catalog extension: .mo after installation, .gmo in source tree +dnl 3) No internationalization, always use English msgid. +dnl Catalog format: none +dnl Catalog extension: none +dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. +dnl The use of .gmo is historical (it was needed to avoid overwriting the +dnl GNU format catalogs when building on a platform with an X/Open gettext), +dnl but we keep it in order not to force irrelevant filename changes on the +dnl maintainers. +dnl +AC_DEFUN([AM_GNU_GETTEXT], +[ + dnl Argument checking. + m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], , [m4_if([$1], [here], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT +])])])])]) + m4_if(m4_if([$1], [], [old])[]m4_if([$1], [no-libtool], [old]), [old], + [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported. +])]) + m4_if([$2], [], , [m4_if([$2], [need-ngettext], , [m4_if([$2], [need-formatstring-macros], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT +])])])]) + define([gt_building_libintl_in_same_build_tree], + m4_if([$1], [use-libtool], [yes], [m4_if([$1], [here], [yes], [no])])) + gt_NEEDS_INIT + AM_GNU_GETTEXT_NEED([$2]) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Sometimes libintl requires libiconv, so first search for libiconv. + dnl Ideally we would do this search only after the + dnl if test "$USE_NLS" = "yes"; then + dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl tests. But if configure.ac invokes AM_ICONV after AM_GNU_GETTEXT + dnl the configure script would need to contain the same shell code + dnl again, outside any 'if'. There are two solutions: + dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. + dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. + dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it. + m4_if(gt_building_libintl_in_same_build_tree, yes, , [ + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + ]) + + dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. + gt_INTL_MACOSX + + dnl Set USE_NLS. + AC_REQUIRE([AM_NLS]) + + m4_if(gt_building_libintl_in_same_build_tree, yes, [ + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl Add a version number to the cache macros. + case " $gt_needs " in + *" need-formatstring-macros "*) gt_api_version=3 ;; + *" need-ngettext "*) gt_api_version=2 ;; + *) gt_api_version=1 ;; + esac + gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" + gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + m4_if(gt_building_libintl_in_same_build_tree, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH([included-gettext], + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + if test $gt_api_version -ge 3; then + gt_revision_test_code=' +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) +#endif +changequote(,)dnl +typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; +changequote([,])dnl +' + else + gt_revision_test_code= + fi + if test $gt_api_version -ge 2; then + gt_expression_test_code=' + * ngettext ("", "", 0)' + else + gt_expression_test_code= + fi + + AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern int *_nl_domain_bindings; +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_domain_bindings) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + ]])], + [eval "$gt_func_gnugettext_libc=yes"], + [eval "$gt_func_gnugettext_libc=no"])]) + + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + m4_if(gt_building_libintl_in_same_build_tree, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + [$gt_func_gnugettext_libintl], + [gt_saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_saved_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + ]])], + [eval "$gt_func_gnugettext_libintl=yes"], + [eval "$gt_func_gnugettext_libintl=no"]) + dnl Now see whether libintl exists and depends on libiconv or other + dnl OS dependent libraries, specifically on macOS and AIX. + gt_LIBINTL_EXTRA="$INTL_MACOSX_LIBS" + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + aix*) gt_LIBINTL_EXTRA="-lpthread" ;; + esac + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } \ + && { test -n "$LIBICONV" || test -n "$gt_LIBINTL_EXTRA"; }; then + LIBS="$LIBS $LIBICONV $gt_LIBINTL_EXTRA" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#ifndef __GNU_GETTEXT_SUPPORTED_REVISION +extern int _nl_msg_cat_cntr; +extern +#ifdef __cplusplus +"C" +#endif +const char *_nl_expand_alias (const char *); +#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias ("")) +#else +#define __GNU_GETTEXT_SYMBOL_EXPRESSION 0 +#endif +$gt_revision_test_code + ]], + [[ +bindtextdomain ("", ""); +return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION + ]])], + [LIBINTL="$LIBINTL $LIBICONV $gt_LIBINTL_EXTRA" + LTLIBINTL="$LTLIBINTL $LTLIBICONV $gt_LIBINTL_EXTRA" + eval "$gt_func_gnugettext_libintl=yes" + ]) + fi + CPPFLAGS="$gt_saved_CPPFLAGS" + LIBS="$gt_saved_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ + || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ + && test "$PACKAGE" != gettext-runtime \ + && test "$PACKAGE" != gettext-tools \ + && test "$PACKAGE" != libintl; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + m4_if(gt_building_libintl_in_same_build_tree, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + USE_INCLUDED_LIBINTL=yes + LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" + LTLIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + CATOBJEXT= + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test -n "$INTL_MACOSX_LIBS"; then + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Some extra flags are needed during linking. + LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" + LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" + fi + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE([ENABLE_NLS], [1], + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + AC_MSG_CHECKING([whether to use NLS]) + AC_MSG_RESULT([$USE_NLS]) + if test "$USE_NLS" = "yes"; then + AC_MSG_CHECKING([where the gettext function comes from]) + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + gt_source="external libintl" + else + gt_source="libc" + fi + else + gt_source="included intl directory" + fi + AC_MSG_RESULT([$gt_source]) + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE([HAVE_GETTEXT], [1], + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE([HAVE_DCGETTEXT], [1], + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + m4_if(gt_building_libintl_in_same_build_tree, yes, [ + dnl Make all variables we use known to autoconf. + AC_SUBST([USE_INCLUDED_LIBINTL]) + AC_SUBST([CATOBJEXT]) + ]) + + m4_if(gt_building_libintl_in_same_build_tree, yes, [], [ + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST([INTLLIBS]) + ]) + + dnl Make all documented variables known to autoconf. + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + AC_SUBST([POSUB]) + + dnl Define localedir_c and localedir_c_make. + gl_BUILD_TO_HOST_LOCALEDIR +]) + + +dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. +m4_define([gt_NEEDS_INIT], +[ + m4_divert_text([DEFAULTS], [gt_needs=]) + m4_define([gt_NEEDS_INIT], []) +]) + + +dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) +AC_DEFUN([AM_GNU_GETTEXT_NEED], +[ + m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) +]) + + +dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) + + +dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version]) +AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], []) diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4 new file mode 100644 index 00000000..ca021d6a --- /dev/null +++ b/m4/host-cpu-c-abi.m4 @@ -0,0 +1,529 @@ +# host-cpu-c-abi.m4 +# serial 18 +dnl Copyright (C) 2002-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible and Sam Steingold. + +dnl Sets the HOST_CPU variable to the canonical name of the CPU. +dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its +dnl C language ABI (application binary interface). +dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in +dnl config.h. +dnl +dnl This canonical name can be used to select a particular assembly language +dnl source file that will interoperate with C code on the given host. +dnl +dnl For example: +dnl * 'i386' and 'sparc' are different canonical names, because code for i386 +dnl will not run on SPARC CPUs and vice versa. They have different +dnl instruction sets. +dnl * 'sparc' and 'sparc64' are different canonical names, because code for +dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code +dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit +dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit +dnl mode, but not both. +dnl * 'mips' and 'mipsn32' are different canonical names, because they use +dnl different argument passing and return conventions for C functions, and +dnl although the instruction set of 'mips' is a large subset of the +dnl instruction set of 'mipsn32'. +dnl * 'mipsn32' and 'mips64' are different canonical names, because they use +dnl different sizes for the C types like 'int' and 'void *', and although +dnl the instruction sets of 'mipsn32' and 'mips64' are the same. +dnl * The same canonical name is used for different endiannesses. You can +dnl determine the endianness through preprocessor symbols: +dnl - 'arm': test __ARMEL__. +dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. +dnl - 'powerpc64': test __BIG_ENDIAN__ vs. __LITTLE_ENDIAN__. +dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 +dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because +dnl - Instructions that do not exist on all of these CPUs (cmpxchg, +dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your +dnl assembly language source files use such instructions, you will +dnl need to make the distinction. +dnl - Speed of execution of the common instruction set is reasonable across +dnl the entire family of CPUs. If you have assembly language source files +dnl that are optimized for particular CPU types (like GNU gmp has), you +dnl will need to make the distinction. +dnl See . +AC_DEFUN([gl_HOST_CPU_C_ABI], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_C_ASM]) + AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], + [case "$host_cpu" in + +changequote(,)dnl + i[34567]86 ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=i386 + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=x86_64-x32], + [gl_cv_host_cpu_c_abi=x86_64])], + [gl_cv_host_cpu_c_abi=i386]) + ;; + +changequote(,)dnl + alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=alpha + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __aarch64__ + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=arm64-ilp32], + [gl_cv_host_cpu_c_abi=arm64])], + [# Don't distinguish little-endian and big-endian arm, since they + # don't require different machine code for simple operations and + # since the user can distinguish them through the preprocessor + # defines __ARMEL__ vs. __ARMEB__. + # But distinguish arm which passes floating-point arguments and + # return values in integer registers (r0, r1, ...) - this is + # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which + # passes them in float registers (s0, s1, ...) and double registers + # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer + # sets the preprocessor defines __ARM_PCS (for the first case) and + # __ARM_PCS_VFP (for the second case), but older GCC does not. + echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c + # Look for a reference to the register d0 in the .s file. + AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 + if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then + gl_cv_host_cpu_c_abi=armhf + else + gl_cv_host_cpu_c_abi=arm + fi + rm -f conftest* + ]) + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=hppa64], + [gl_cv_host_cpu_c_abi=hppa]) + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=ia64-ilp32], + [gl_cv_host_cpu_c_abi=ia64]) + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mips64], + [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIN32. + # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIO32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (_MIPS_SIM == _ABIN32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mipsn32], + [gl_cv_host_cpu_c_abi=mips])]) + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [# On powerpc64, there are two ABIs on Linux: The AIX compatible + # one and the ELFv2 one. The latter defines _CALL_ELF=2. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _CALL_ELF && _CALL_ELF == 2 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=powerpc64-elfv2], + [gl_cv_host_cpu_c_abi=powerpc64]) + ], + [gl_cv_host_cpu_c_abi=powerpc]) + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi=powerpc + ;; + + riscv32 | riscv64 ) + # There are 2 architectures (with variants): rv32* and rv64*. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if __riscv_xlen == 64 + int ok; + #else + error fail + #endif + ]])], + [cpu=riscv64], + [cpu=riscv32]) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [main_abi=lp64], + [main_abi=ilp32]) + # Float ABIs: + # __riscv_float_abi_double: + # 'float' and 'double' are passed in floating-point registers. + # __riscv_float_abi_single: + # 'float' are passed in floating-point registers. + # __riscv_float_abi_soft: + # No values are passed in floating-point registers. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __riscv_float_abi_double + int ok; + #else + error fail + #endif + ]])], + [float_abi=d], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __riscv_float_abi_single + int ok; + #else + error fail + #endif + ]])], + [float_abi=f], + [float_abi='']) + ]) + gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" + ;; + + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=s390x], + [gl_cv_host_cpu_c_abi=s390]) + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=sparc64], + [gl_cv_host_cpu_c_abi=sparc]) + ;; + + *) + gl_cv_host_cpu_c_abi="$host_cpu" + ;; + esac + ]) + + dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. + HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` + HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" + AC_SUBST([HOST_CPU]) + AC_SUBST([HOST_CPU_C_ABI]) + + # This was + # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) + # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) + # earlier, but KAI C++ 3.2d doesn't like this. + sed -e 's/-/_/g' >> confdefs.h <. +dnl Don't make changes that are incompatible with that documentation! + +AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], +[ + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) +]) + +AC_DEFUN([AM_ICONV_LINK], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. + gl_saved_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_func_iconv=yes]) + if test "$am_cv_func_iconv" != yes; then + gl_saved_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) + LIBS="$gl_saved_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, + dnl Solaris 10, macOS 14.4. + gl_saved_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + ]], + [[int result = 0; + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against macOS 14.4 bug: Failures are not distinguishable from + successful returns. + POSIX:2018 says: "The iconv() function shall ... return the number of + non-identical conversions performed." + But here, the conversion always does transliteration (the suffixes + "//TRANSLIT" and "//IGNORE" have no effect, nor does iconvctl()) and + does not report when it does a non-identical conversion. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO-8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\305\202"; /* LATIN SMALL LETTER L WITH STROKE */ + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + /* Here: + With glibc, GNU libiconv (including macOS up to 13): res == (size_t)-1, errno == EILSEQ. + With musl libc, NetBSD 10, Solaris 11: res == 1. + With macOS 14.4: res == 0, output is "l". */ + if (res == 0) + result |= 2; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\263"; + char buf[10]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 4; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + ICONV_CONST char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + ICONV_CONST char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 16; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + { + /* Try standardized names. */ + iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP"); + /* Try IRIX, OSF/1 names. */ + iconv_t cd2 = iconv_open ("UTF-8", "eucJP"); + /* Try AIX names. */ + iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP"); + /* Try HP-UX names. */ + iconv_t cd4 = iconv_open ("utf8", "eucJP"); + if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1) + && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1)) + result |= 32; + if (cd1 != (iconv_t)(-1)) + iconv_close (cd1); + if (cd2 != (iconv_t)(-1)) + iconv_close (cd2); + if (cd3 != (iconv_t)(-1)) + iconv_close (cd3); + if (cd4 != (iconv_t)(-1)) + iconv_close (cd4); + } + return result; +]])], + [am_cv_func_iconv_works=yes], , + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + test "$am_cv_func_iconv_works" = no || break + done + LIBS="$gl_saved_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$gl_saved_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) +]) + +dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like +dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". +AC_DEFUN_ONCE([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], + [gl_cv_iconv_nonconst], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + ]], + [[]])], + [gl_cv_iconv_nonconst=yes], + [gl_cv_iconv_nonconst=no]) + ]) + else + dnl When compiling GNU libiconv on a system that does not have iconv yet, + dnl pick the POSIX compliant declaration without 'const'. + gl_cv_iconv_nonconst=yes + fi + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" + fi + AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], + [Define as const if the declaration of iconv() needs const.]) + dnl Also substitute ICONV_CONST in the gnulib generated . + m4_ifdef([gl_ICONV_H_DEFAULTS], + [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + if test $gl_cv_iconv_nonconst != yes; then + ICONV_CONST="const" + fi + ]) + + dnl A summary result, for those packages which want to print a summary at the + dnl end of the configuration. + if test "$am_func_iconv" = yes; then + if test -n "$LIBICONV"; then + am_cv_func_iconv_summary='yes, in libiconv' + else + am_cv_func_iconv_summary='yes, in libc' + fi + else + if test "$am_cv_func_iconv" = yes; then + am_cv_func_iconv_summary='not working, consider installing GNU libiconv' + else + am_cv_func_iconv_summary='no, consider installing GNU libiconv' + fi + fi +]) diff --git a/m4/intlmacosx.m4 b/m4/intlmacosx.m4 new file mode 100644 index 00000000..4cf79167 --- /dev/null +++ b/m4/intlmacosx.m4 @@ -0,0 +1,71 @@ +# intlmacosx.m4 +# serial 10 (gettext-0.23) +dnl Copyright (C) 2004-2014, 2016, 2019-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Lesser General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Lesser General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Checks for special options needed on Mac OS X. +dnl Defines INTL_MACOSX_LIBS. +AC_DEFUN([gt_INTL_MACOSX], +[ + dnl Check for API introduced in Mac OS X 10.4. + AC_CACHE_CHECK([for CFPreferencesCopyAppValue], + [gt_cv_func_CFPreferencesCopyAppValue], + [gt_saved_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[CFPreferencesCopyAppValue(NULL, NULL)]])], + [gt_cv_func_CFPreferencesCopyAppValue=yes], + [gt_cv_func_CFPreferencesCopyAppValue=no]) + LIBS="$gt_saved_LIBS"]) + if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then + AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], + [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) + fi + dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, + dnl because in macOS 10.13.4 it has the following behaviour: + dnl When two or more languages are specified in the + dnl "System Preferences > Language & Region > Preferred Languages" panel, + dnl it returns en_CC where CC is the territory (even when English is not among + dnl the preferred languages!). What we want instead is what + dnl CFLocaleCopyCurrent returned in earlier macOS releases and what + dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the + dnl first among the preferred languages and CC is the territory. + AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages], + [gt_saved_LIBS="$LIBS" + LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[CFLocaleCopyPreferredLanguages();]])], + [gt_cv_func_CFLocaleCopyPreferredLanguages=yes], + [gt_cv_func_CFLocaleCopyPreferredLanguages=no]) + LIBS="$gt_saved_LIBS"]) + if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1], + [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.]) + fi + INTL_MACOSX_LIBS= + if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ + || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then + dnl Starting with macOS version 14, CoreFoundation relies on CoreServices, + dnl and we have to link it in explicitly, otherwise an exception + dnl NSInvalidArgumentException "unrecognized selector sent to instance" + dnl occurs. + INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices" + fi + AC_SUBST([INTL_MACOSX_LIBS]) +]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 new file mode 100644 index 00000000..e6e16bb0 --- /dev/null +++ b/m4/lib-ld.m4 @@ -0,0 +1,170 @@ +# lib-ld.m4 +# serial 13 +dnl Copyright (C) 1996-2003, 2009-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Subroutines of libtool.m4, +dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid +dnl collision with libtool.m4. + +dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 /dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +if test -n "$LD"; then + AC_MSG_CHECKING([for ld]) +elif test "$GCC" = yes; then + AC_MSG_CHECKING([for ld used by $CC]) +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +if test -n "$LD"; then + # Let the user override the test with a path. + : +else + AC_CACHE_VAL([acl_cv_path_LD], + [ + acl_cv_path_LD= # Final result of this test + ac_prog=ld # Program to search in $PATH + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + case $host in + *-*-mingw* | windows*) + # gcc leaves a trailing carriage return which upsets mingw + acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + acl_output=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $acl_output in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` + while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do + acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` + done + # Got the pathname. No search in PATH is needed. + acl_cv_path_LD="$acl_output" + ac_prog= + ;; + "") + # If it fails, then pretend we aren't using GCC. + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + fi + if test -n "$ac_prog"; then + # Search for $ac_prog in $PATH. + acl_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_saved_IFS" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE([rpath], + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + ]) + AC_ARG_WITH(PACK[-prefix], +[[ --with-]]PACK[[-prefix[=DIR] search for ]]PACKLIBS[[ in DIR/include and DIR/lib + --without-]]PACK[[-prefix don't search for ]]PACKLIBS[[ in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" + fi + fi +]) + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Use breadth-first search. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + fi + done + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + saved_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$saved_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then + haveit= + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$dependency_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + dnl But on GNU systems, ignore -lc options, because + dnl - linking with libc is the default anyway, + dnl - linking with libc.a may produce an error + dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" + dnl or may produce an executable that always crashes, see + dnl . + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_saved_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_saved_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_saved_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_saved_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_saved_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_saved_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_saved_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_saved_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 new file mode 100644 index 00000000..0adb1572 --- /dev/null +++ b/m4/lib-prefix.m4 @@ -0,0 +1,334 @@ +# lib-prefix.m4 +# serial 23 +dnl Copyright (C) 2001-2005, 2008-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH([lib-prefix], +[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_saved_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_saved_prefix="$prefix" + prefix="$acl_final_prefix" + acl_saved_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_saved_exec_prefix" + prefix="$acl_saved_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a function acl_is_expected_elfclass, that tests whether standard input +dnl has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, +dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing +dnl the basename of the libdir to try in turn, either "lib" or "lib64" or +dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib, lib32, and lib64. + dnl On most glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on + dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go + dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. + dnl We determine the compiler's default mode by looking at the compiler's + dnl library search path. If at least one of its elements ends in /lib64 or + dnl points to a directory whose absolute pathname ends in /lib64, we use that + dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, + dnl namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) + + AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], + [AC_EGREP_CPP([Extensible Linking Format], + [#if defined __ELF__ || (defined __linux__ && (defined __EDG__ || defined __SUNPRO_C)) + Extensible Linking Format + #endif + ], + [gl_cv_elf=yes], + [gl_cv_elf=no]) + ]) + if test $gl_cv_elf = yes; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. +changequote(,)dnl + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac +changequote([,])dnl + else + acl_is_expected_elfclass () + { + : + } + fi + + dnl Allow the user to override the result by setting acl_cv_libdirstems. + AC_CACHE_CHECK([for the common suffixes of directories in the library search path], + [acl_cv_libdirstems], + [dnl Try 'lib' first, because that's the default for libdir in GNU, see + dnl . + acl_libdirstem=lib + acl_libdirstem2= + acl_libdirstem3= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; + esac + fi + ;; + netbsd*) + dnl On NetBSD/sparc64, there is a 'sparc' subdirectory that contains + dnl 32-bit libraries. + if test $HOST_CPU_C_ABI_32BIT != no; then + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparc ;; + esac + fi + ;; + *) + dnl If $CC generates code for a 32-bit ABI, the libraries are + dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. + dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries + dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. + dnl Find the compiler's search path. However, non-system compilers + dnl sometimes have odd library search paths. But we can't simply invoke + dnl '/usr/bin/gcc -print-search-dirs' because that would not take into + dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_saved_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_saved_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= + fi + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" + ]) + dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and + dnl acl_libdirstem3. +changequote(,)dnl + acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` +changequote([,])dnl +]) diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 00000000..219cbaa1 --- /dev/null +++ b/m4/nls.m4 @@ -0,0 +1,33 @@ +# nls.m4 +# serial 6 (gettext-0.20.2) +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2024 Free +dnl Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Lesser General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Lesser General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2003. + +AC_PREREQ([2.50]) + +AC_DEFUN([AM_NLS], +[ + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE([nls], + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT([$USE_NLS]) + AC_SUBST([USE_NLS]) +]) diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 00000000..2df11891 --- /dev/null +++ b/m4/po.m4 @@ -0,0 +1,456 @@ +# po.m4 +# serial 33 (gettext-0.23) +dnl Copyright (C) 1995-2014, 2016, 2018-2022, 2024 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Lesser General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Lesser General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Authors: +dnl Ulrich Drepper , 1995-2000. +dnl Bruno Haible , 2000-2024. + +AC_PREREQ([2.60]) + +dnl Checks for all prerequisites of the po subdirectory. +AC_DEFUN([AM_PO_SUBDIRS], +[ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AC_PROG_MKDIR_P])dnl + AC_REQUIRE([AC_PROG_SED])dnl + AC_REQUIRE([AM_NLS])dnl + + dnl Release version of the gettext macros. This is used to ensure that + dnl the gettext macros and po/Makefile.in.in are in sync. + AC_SUBST([GETTEXT_MACRO_VERSION], [0.23]) + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) + + dnl Test whether it is GNU msgfmt >= 0.15. +changequote(,)dnl + case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; + *) GMSGFMT_015=$GMSGFMT ;; + esac +changequote([,])dnl + AC_SUBST([GMSGFMT_015]) + + dnl Search for GNU xgettext 0.12 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Test whether it is GNU xgettext >= 0.15. +changequote(,)dnl + case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in + '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; + *) XGETTEXT_015=$XGETTEXT ;; + esac +changequote([,])dnl + AC_SUBST([XGETTEXT_015]) + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) + + dnl Test whether it is GNU msgmerge >= 0.20. + if LC_ALL=C $MSGMERGE --help | grep ' --for-msgfmt ' >/dev/null; then + MSGMERGE_FOR_MSGFMT_OPTION='--for-msgfmt' + else + dnl Test whether it is GNU msgmerge >= 0.12. + if LC_ALL=C $MSGMERGE --help | grep ' --no-fuzzy-matching ' >/dev/null; then + MSGMERGE_FOR_MSGFMT_OPTION='--no-fuzzy-matching --no-location --quiet' + else + dnl With these old versions, $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) is + dnl slow. But this is not a big problem, as such old gettext versions are + dnl hardly in use any more. + MSGMERGE_FOR_MSGFMT_OPTION='--no-location --quiet' + fi + fi + AC_SUBST([MSGMERGE_FOR_MSGFMT_OPTION]) + + dnl Support for AM_XGETTEXT_OPTION. + test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= + AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) + + AC_CONFIG_COMMANDS([po-directories], [[ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + # Treat a directory as a PO directory if and only if it has a + # POTFILES.in file. This allows packages to have multiple PO + # directories under different names or in different locations. + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + gt_tab=`printf '\t'` + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + POMAKEFILEDEPS="POTFILES.in" + # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$OBSOLETE_ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` + POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" + else + # The set of available languages was given in configure.in. + ALL_LINGUAS=$OBSOLETE_ALL_LINGUAS + fi + # Compute POFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) + # Compute UPDATEPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) + # Compute DUMMYPOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) + # Compute GMOFILES + # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + UPDATEPOFILES= + DUMMYPOFILES= + GMOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang" | "$presentlang"_* | "$presentlang".* | "$presentlang"@*) + useit=yes + ;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done]], + [# Capture the value of obsolete ALL_LINGUAS because we need it to compute + # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. + OBSOLETE_ALL_LINGUAS="$ALL_LINGUAS" + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) +]) + +dnl Postprocesses a Makefile in a directory containing PO files. +AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], +[ + # When this code is run, in config.status, two variables have already been + # set: + # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, + # - LINGUAS is the value of the environment variable LINGUAS at configure + # time. + +changequote(,)dnl + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + # Find a way to echo strings without interpreting backslash. + if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='echo' + else + if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then + gt_echo='printf %s\n' + else + echo_func () { + cat < "$ac_file.tmp" + tab=`printf '\t'` + if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + cat >> "$ac_file.tmp" < /dev/null; then + # Add dependencies that cannot be formulated as a simple suffix rule. + for lang in $ALL_LINGUAS; do + frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` + cat >> "$ac_file.tmp" <> "$ac_file.tmp" <, 1996. + +AC_PREREQ([2.53]) + +# Search path for a program which passes the given test. + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN([AM_PATH_PROG_WITH_TEST], +[ +# Prepare PATH_SEPARATOR. +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which + # contains only /bin. Note that ksh looks also at the FPATH variable, + # so we have to set that as well for the test. + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi + +# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + ac_executable_p="test -x" +else + ac_executable_p="test -f" +fi +rm -f conf$$.file + +# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL([ac_cv_path_$1], +[case "[$]$1" in + [[\\/]]* | ?:[[\\/]]*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + gt_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in m4_if([$5], , $PATH, [$5]); do + IFS="$gt_saved_IFS" + test -z "$ac_dir" && ac_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then + echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" + break 2 + fi + fi + done + done + IFS="$gt_saved_IFS" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$][$1]) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST([$1])dnl +]) diff --git a/nls/catgen b/nls/catgen old mode 100644 new mode 100755 diff --git a/sh.dir.c b/sh.dir.c index 9bc5ff47..444806f6 100644 --- a/sh.dir.c +++ b/sh.dir.c @@ -267,7 +267,11 @@ printdirs(int dflag) if (dp == &dhead) continue; if (dflag & DIR_VERT) { - xprintf("%d\t", idx++); + /* zsh-style: mark current dir (idx 0) with an arrow */ + if (idx == 0) + xprintf("%d\u2192\t", idx++); + else + xprintf("%d \t", idx++); cur = 0; } s = dp->di_name; @@ -486,9 +490,35 @@ dochngd(Char **v, struct command *c) { Char *cp; struct directory *dp; - int dflag = skipargs(&v, "plvn", "[-|]"); + int dflag; USE(c); + + /* Detect zsh-style cd -N (numeric index from bottom of stack) before + * skipargs so the digit doesn't trip the unknown-flag error. A bare + * "-" is still handled by DIR_OLD inside skipargs. */ + if (v[1] != NULL && v[1][0] == '-' && Isdigit(v[1][1])) { + Char *ep; + for (ep = &v[1][1]; Isdigit(*ep); ep++) + continue; + if (*ep == '\0') { + if ((dp = dfind(v[1])) == NULL) + stderror(ERR_NAME | ERR_BADDIR); + { + char *tmp; + printd = 1; + if (chdir(tmp = short2str(dp->di_name)) < 0) + stderror(ERR_SYSTEM, tmp, strerror(errno)); + } + dcwd->di_prev->di_next = dcwd->di_next; + dcwd->di_next->di_prev = dcwd->di_prev; + dfree(dcwd); + dnewcwd(dp, DIR_VERT | DIR_PRINT); + return; + } + } + + dflag = skipargs(&v, "plvn", "[-|]"); printd = 0; cp = (dflag & DIR_OLD) ? varval(STRowd) : *v; @@ -763,7 +793,9 @@ dopushd(Char **v, struct command *c) } /* - * dfind - find a directory if specified by numeric (+n) argument + * dfind - find a directory if specified by numeric (+n or -n) argument. + * +n counts forward from the current directory (older entries). + * -n counts backward from the bottom of the stack (like zsh cd -N). */ static struct directory * dfind(Char *cp) @@ -771,21 +803,39 @@ dfind(Char *cp) struct directory *dp; int i; Char *ep; - - if (*cp++ != '+') + int backward = 0; + + if (*cp == '-') { + backward = 1; + cp++; + } else if (*cp == '+') { + cp++; + } else { return (0); + } for (ep = cp; Isdigit(*ep); ep++) continue; if (*ep) return (0); i = getn(cp); - if (i <= 0) + if (!backward && i <= 0) return (0); - for (dp = dcwd; i != 0; i--) { - if ((dp = dp->di_prev) == &dhead) - dp = dp->di_prev; - if (dp == dcwd) - stderror(ERR_NAME | ERR_DEEP); + if (backward) { + /* Walk from the tail of the stack (oldest entry) backward */ + dp = dhead.di_next; /* oldest entry */ + if (dp == &dhead) + return (0); + for (; i > 0 && dp != &dhead; i--) + dp = dp->di_next; + if (dp == &dhead || dp == dcwd) + return (0); + } else { + for (dp = dcwd; i != 0; i--) { + if ((dp = dp->di_prev) == &dhead) + dp = dp->di_prev; + if (dp == dcwd) + stderror(ERR_NAME | ERR_DEEP); + } } return (dp); } @@ -1211,8 +1261,13 @@ dnewcwd(struct directory *dp, int dflag) print = 1; if (bequiet) /* and bequiet overrides everything */ print = 0; - if (print) + if (print) { + /* Default to zsh-style numbered vertical output when no format + * flags were given explicitly. */ + if (!(dflag & (DIR_VERT|DIR_LINE|DIR_LONG))) + dflag |= DIR_VERT; printdirs(dflag); + } cwd_cmd(); /* PWP: run the defined cwd command */ } diff --git a/sh.exp.c b/sh.exp.c index 38553aea..0250633a 100644 --- a/sh.exp.c +++ b/sh.exp.c @@ -180,40 +180,7 @@ sh_access(const Char *fname, int mode) tcsh_number_t expr(Char ***vp) { - Char **vpi, **vpc, *nblk[2], **blks[2]; - tcsh_number_t i; - int len; - - *blks = blks[1] = NULL; - cleanup_push(blks, blkcmp_cleanup); - len = blklen(*vp) + 1; - vpi = *vp; - vpc = *blks = xmalloc(sizeof **blks * len); - nblk[1] = NULL; - while (*vpi) { - *nblk = Strsave(*vpi++); - (void) blkcpy(vpc++, nblk); - } - blks[1] = blkcpy(xmalloc(sizeof *blks[1] * len), vpc = *blks); - i = exp0(&vpc, 0); - *vp += --len - blklen(vpc); - { - Char **nvp; - - len -= blklen(vpc); - vpi = *blks; - cleanup_push(nvp = xmalloc(sizeof *nvp * (len + 1)), xfree); - while (vpi != vpc) { - *nblk = *vpi++; - (void) blkcpy(nvp++, nblk); - } - nvp -= len; - xechoit(nvp); - cleanup_until(nvp); - } - cleanup_until(blks); - - return i; + return (exp0(vp, 0)); } tcsh_number_t @@ -608,19 +575,6 @@ exp6(Char ***vp, int ignore) etraci("exp6 {} status", getstatus(), vp); return putn(getstatus() == 0); } - for (cp = **vp; *cp; cp++) - if (cmap(*cp, _DOL | QUOTES)) { - Char *buf; - - if (ignore & TEXP_IGNORE) { - (*vp)++; - return Strsave(STRNULL); - } - cleanup_push(cp = Dfix1(**vp), xfree); - *(*vp)++ = Strsave(buf = globone(cp, G_ERROR)); - cleanup_until(cp); - return buf; - } if (isa(**vp, ANYOP)) return (Strsave(STRNULL)); cp = *(*vp)++; diff --git a/sh.func.c b/sh.func.c index e95f038e..04e428e2 100644 --- a/sh.func.c +++ b/sh.func.c @@ -346,11 +346,18 @@ islogin(void) void doif(Char **v, struct command *kp) { - int i; + tcsh_number_t i; + Char **vv; v++; - i = noexec ? 1 : !!expr(&v); - if (*v == NULL) { + i = noexec ? 1 : expr(&v); + vv = v; + if (*vv == NULL) + stderror(ERR_NAME | ERR_EMPTYIF); + if (eq(*vv, STRthen)) { + if (*++vv) + stderror(ERR_NAME | ERR_IMPRTHEN); + setname(short2str(STRthen)); /* * If expression was zero, then scan to else , otherwise just fall into * following code. @@ -364,7 +371,7 @@ doif(Char **v, struct command *kp) * munging it so we can reexecute it. */ if (i) { - lshift(kp->t_dcom, v - kp->t_dcom); + lshift(kp->t_dcom, vv - kp->t_dcom); reexecute(kp); donefds(); } @@ -377,37 +384,14 @@ doif(Char **v, struct command *kp) void reexecute(struct command *kp) { - Char **v; - struct command *t; - struct wordent paraml, *hp, *wdp; - - initlex(hp = wdp = ¶ml); - v = kp->t_dcom; - while (*v) { - struct wordent *new; - - (new = xcalloc(1, sizeof *new))->prev = wdp; - new->next = hp; - wdp->next = new; - wdp = new; - wdp->word = Strsave(*v++); - } - hp->prev = wdp; - cleanup_push(¶ml, lex_cleanup); - alias(¶ml); - t = syntax(paraml.next, ¶ml, 0); - cleanup_push(t, syntax_cleanup); - if (seterr) - stderror(ERR_OLD); - t->t_dflg = (kp->t_dflg & F_SAVE) | F_REPEAT; + kp->t_dflg &= F_SAVE; + kp->t_dflg |= F_REPEAT; /* * If tty is still ours to arbitrate, arbitrate it; otherwise dont even set * pgrp's as the jobs would then have no way to get the tty (we can't give * it to them, and our parent wouldn't know their pgrp, etc. */ - execute(t, (tpgrp > 0 ? tpgrp : -1), NULL, NULL, TRUE); - cleanup_until(t); - cleanup_until(¶ml); + execute(kp, (tpgrp > 0 ? tpgrp : -1), NULL, NULL, TRUE); } /*ARGSUSED*/ @@ -820,7 +804,8 @@ search(int type, int level, Char *goal) continue; } - if (type == TC_IF || type == TC_ELSE) + if ((type == TC_IF || type == TC_ELSE) && + eq(word.s, STRthen)) level++; break; diff --git a/sh.sem.c b/sh.sem.c index 76b42422..21c7456e 100644 --- a/sh.sem.c +++ b/sh.sem.c @@ -80,7 +80,7 @@ void execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout, int do_glob) { - int expr, forked = 0; + int forked = 0; const struct biltins * volatile bifunc; pid_t pid = 0; int pv[2]; @@ -168,12 +168,7 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout, if ((t->t_dcom[0][0] & (QUOTE | TRIM)) == QUOTE) memmove(t->t_dcom[0], t->t_dcom[0] + 1, (Strlen(t->t_dcom[0] + 1) + 1) * sizeof (*t->t_dcom[0])); - if (!(expr = ((bifunc = isbfunc(t)) && - (bifunc->bfunct == doexit || - bifunc->bfunct == dotest || - bifunc->bfunct == dolet || - bifunc->bfunct == doif || - bifunc->bfunct == dowhile)))) + if ((t->t_dflg & F_REPEAT) == 0) Dfix(t); /* $ " ' \ */ if (t->t_dcom[0] == 0) { return; @@ -275,6 +270,10 @@ execute(struct command *t, volatile int wanttty, int *pipein, int *pipeout, /* is it a command */ if (t->t_dtyp == NODE_COMMAND) { + /* + * Check if we have a builtin function and remember which one. + */ + bifunc = isbfunc(t); if (noexec) { /* * Continue for builtins that are part of the scripting language diff --git a/sh.set.c b/sh.set.c index 70f49103..94cef23e 100644 --- a/sh.set.c +++ b/sh.set.c @@ -32,6 +32,7 @@ #include "sh.h" #include "ed.h" #include "tw.h" +#include "ed.syntax.h" #ifdef HAVE_NL_LANGINFO #include @@ -67,6 +68,7 @@ update_vars(Char *vp) else { exportpath(p->vec); dohash(NULL, NULL); + syntax_cache_clear(); } } else if (eq(vp, STRnoclobber)) { @@ -218,6 +220,12 @@ update_vars(Char *vp) set_color_context(); } #endif /* COLOR_LS_F */ + else if (eq(vp, STRsyntax)) { + if (adrof(STRsyntax)) + syntax_colorize(); + else + syntax_clear(); + } #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE) else if (eq(vp, CHECK_MBYTEVAR) || eq(vp, STRnokanji)) { update_dspmbyte_vars(); @@ -603,6 +611,8 @@ getn(const Char *cp) if (Isspace(*cp)) stderror(ERR_NAME | ERR_BADNUM); + if (*cp == '\0') + stderror(ERR_NAME | ERR_BADNUM); if (*cp == '+' || *cp == '-') { sign = (*cp == '-'); if (!Isdigit(cp[1])) @@ -901,6 +911,8 @@ unset(Char **v, struct command *c) if (adrof(STRcolor) == 0) set_color_context(); #endif /* COLOR_LS_F */ + if (adrof(STRsyntax) == 0) + syntax_clear(); #if defined(KANJI) && defined(SHORT_STRINGS) && defined(DSPMBYTE) update_dspmbyte_vars(); #endif diff --git a/sh.time.c b/sh.time.c index 1033ad7d..3c046f63 100644 --- a/sh.time.c +++ b/sh.time.c @@ -382,10 +382,20 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b) if (vp && vp->vec && vp->vec[0] && vp->vec[1]) cp = short2str(vp->vec[1]); - for (; *cp; cp++) - if (*cp != '%') - xputchar(*cp); - else if (cp[1]) + for (; *cp; cp++) { + if (*cp != '%') { + if (*cp == '\\' && cp[1]) { + switch (*++cp) { + case 'n': xputchar('\n'); break; + case 't': xputchar('\t'); break; + case 'e': (void) putraw('\033'); break; + case '\\': xputchar('\\'); break; + default: xputchar('\\'); xputchar(*cp); break; + } + } else { + xputchar(*cp); + } + } else if (cp[1]) { switch (*++cp) { case 'U': /* user CPU time used */ @@ -684,6 +694,8 @@ prusage(struct tms *bs, struct tms *es, clock_t e, clock_t b) default: break; } + } + } xputchar('\n'); haderr = ohaderr; } diff --git a/tc.const.c b/tc.const.c index 5c24d203..90f90488 100644 --- a/tc.const.c +++ b/tc.const.c @@ -435,6 +435,7 @@ Char STRsched[] = { 's', 'c', 'h', 'e', 'd', '\0' }; Char STRrmstar[] = { 'r', 'm', 's', 't', 'a', 'r', '\0' }; Char STRrm[] = { 'r', 'm', '\0' }; Char STRhighlight[] = { 'h', 'i', 'g', 'h', 'l', 'i', 'g', 'h', 't', '\0' }; +Char STRsyntax[] = { 's', 'y', 'n', 't', 'a', 'x', '\0' }; Char STRimplicitcd[] = { 'i', 'm', 'p', 'l', 'i', 'c', 'i', 't', 'c', 'd', '\0' }; diff --git a/tc.prompt.c b/tc.prompt.c index 6c6b14a1..c3320e86 100644 --- a/tc.prompt.c +++ b/tc.prompt.c @@ -32,6 +32,7 @@ #include "sh.h" #include "ed.h" #include "tw.h" +#include /* * kfk 21oct1983 -- add @ (time) and / ($cwd) in prompt. @@ -174,6 +175,223 @@ tprintf_append_mbs(struct Strbuf *buf, const char *mbs, Char attributes) } } +/* + * git_get_info - fill branch (up to branchsz-1 bytes) and op (up to opsz-1 + * bytes) for the git worktree that contains dir. Returns 1 on success, 0 if + * dir is not inside a git worktree. Both buffers are always NUL-terminated. + * + * op is empty string when no special operation is in progress, or one of: + * MERGING, REBASING, REBASING-i, REBASING-m, CHERRY-PICKING, REVERTING, + * BISECTING. + * + * Detection is done by walking up the directory tree reading plain files; no + * subprocesses are spawned. + */ +static int +git_get_info(const char *dir, char *branch, size_t branchsz, + char *op, size_t opsz) +{ + char path[MAXPATHLEN]; + char gitdir[MAXPATHLEN]; + char *p; + FILE *fp; + size_t n; + int found = 0; + + if (!dir || !*dir) + return 0; + + /* Walk up, looking for .git */ + n = strlen(dir); + if (n >= sizeof(gitdir)) + n = sizeof(gitdir) - 1; + memcpy(gitdir, dir, n); + gitdir[n] = '\0'; + + for (;;) { + /* Try .git — may be a file (worktree) or directory */ + if ((size_t)snprintf(path, sizeof(path), "%s/.git", gitdir) + < sizeof(path)) { + struct stat st; + if (stat(path, &st) == 0) { + if (S_ISDIR(st.st_mode)) { + /* Normal repo: .git/HEAD */ + char head[MAXPATHLEN]; + snprintf(head, sizeof(head), "%s/.git/HEAD", gitdir); + if (access(head, R_OK) == 0) { + found = 1; + break; + } + } else if (S_ISREG(st.st_mode)) { + /* Worktree or submodule: .git is a file containing "gitdir: " */ + FILE *gf = fopen(path, "r"); + if (gf) { + char line[MAXPATHLEN]; + if (fgets(line, sizeof(line), gf) && + strncmp(line, "gitdir: ", 8) == 0) { + char resolved[MAXPATHLEN]; + size_t llen; + char *target = line + 8; + llen = strlen(target); + while (llen > 0 && (target[llen-1] == '\n' || target[llen-1] == '\r')) + target[--llen] = '\0'; + if (target[0] == '/') { + snprintf(resolved, sizeof(resolved), "%s", target); + } else { + snprintf(resolved, sizeof(resolved), "%s/%s", gitdir, target); + } + fclose(gf); + snprintf(gitdir, sizeof(gitdir), "%s", resolved); + found = 1; + /* gitdir already points at the real git dir */ + goto git_found; + } + fclose(gf); + } + } + } + } + /* Try bare repo: HEAD directly */ + if ((size_t)snprintf(path, sizeof(path), "%s/HEAD", gitdir) + < sizeof(path)) { + char cfg[MAXPATHLEN]; + if ((size_t)snprintf(cfg, sizeof(cfg), "%s/config", gitdir) + < sizeof(cfg) && access(cfg, R_OK) == 0 + && access(path, R_OK) == 0) { + /* Check it looks like a bare repo HEAD */ + FILE *hf = fopen(path, "r"); + if (hf) { + char line[256]; + if (fgets(line, sizeof(line), hf)) { + if (strncmp(line, "ref: ", 5) == 0 || + (strlen(line) >= 40 && + strspn(line, "0123456789abcdef") >= 40)) { + fclose(hf); + /* Bare repo: gitdir already points at the repo dir */ + found = 2; + break; + } + } + fclose(hf); + } + } + } + /* Go up one level */ + p = strrchr(gitdir, '/'); + if (!p || p == gitdir) + break; + *p = '\0'; + } + + if (!found) + return 0; + + /* Build the .git directory path */ + if (found == 1) { + char tmp[MAXPATHLEN]; + snprintf(tmp, sizeof(tmp), "%s/.git", gitdir); + snprintf(gitdir, sizeof(gitdir), "%s", tmp); + } + /* found == 2: gitdir already points at the bare repo dir */ +git_found: + /* Read HEAD */ + snprintf(path, sizeof(path), "%s/HEAD", gitdir); + fp = fopen(path, "r"); + if (!fp) + return 0; + branch[0] = '\0'; + if (fgets(path, sizeof(path), fp)) { + /* Strip trailing newline */ + size_t len = strlen(path); + if (len > 0 && path[len - 1] == '\n') + path[--len] = '\0'; + if (strncmp(path, "ref: refs/heads/", 16) == 0) { + strncpy(branch, path + 16, branchsz - 1); + branch[branchsz - 1] = '\0'; + } else if (strncmp(path, "ref: ", 5) == 0) { + strncpy(branch, path + 5, branchsz - 1); + branch[branchsz - 1] = '\0'; + } else if (len >= 7) { + /* Detached HEAD: show first 7 hex chars */ + strncpy(branch, path, 7); + branch[7] = '\0'; + } + } + fclose(fp); + + if (!branch[0]) + return 0; + + /* Detect operation state */ + op[0] = '\0'; + { + char probe[MAXPATHLEN]; + /* MERGE */ + snprintf(probe, sizeof(probe), "%s/MERGE_HEAD", gitdir); + if (access(probe, F_OK) == 0) { + strncpy(op, "MERGING", opsz - 1); + op[opsz - 1] = '\0'; + return 1; + } + /* REBASE (interactive) */ + snprintf(probe, sizeof(probe), "%s/rebase-merge", gitdir); + if (access(probe, F_OK) == 0) { + char rbranch[256]; + FILE *rf; + snprintf(probe, sizeof(probe), "%s/rebase-merge/head-name", gitdir); + rf = fopen(probe, "r"); + if (rf) { + if (fgets(rbranch, sizeof(rbranch), rf)) { + size_t rlen = strlen(rbranch); + if (rlen && rbranch[rlen-1] == '\n') rbranch[--rlen] = '\0'; + if (strncmp(rbranch, "refs/heads/", 11) == 0) + strncpy(branch, rbranch + 11, branchsz - 1); + else + strncpy(branch, rbranch, branchsz - 1); + branch[branchsz - 1] = '\0'; + } + fclose(rf); + } + strncpy(op, "REBASING-i", opsz - 1); + op[opsz - 1] = '\0'; + return 1; + } + /* REBASE (am/apply) */ + snprintf(probe, sizeof(probe), "%s/rebase-apply", gitdir); + if (access(probe, F_OK) == 0) { + snprintf(probe, sizeof(probe), "%s/rebase-apply/rebasing", gitdir); + if (access(probe, F_OK) == 0) + strncpy(op, "REBASING", opsz - 1); + else + strncpy(op, "AM", opsz - 1); + op[opsz - 1] = '\0'; + return 1; + } + /* CHERRY-PICK */ + snprintf(probe, sizeof(probe), "%s/CHERRY_PICK_HEAD", gitdir); + if (access(probe, F_OK) == 0) { + strncpy(op, "CHERRY-PICKING", opsz - 1); + op[opsz - 1] = '\0'; + return 1; + } + /* REVERT */ + snprintf(probe, sizeof(probe), "%s/REVERT_HEAD", gitdir); + if (access(probe, F_OK) == 0) { + strncpy(op, "REVERTING", opsz - 1); + op[opsz - 1] = '\0'; + return 1; + } + /* BISECT */ + snprintf(probe, sizeof(probe), "%s/BISECT_LOG", gitdir); + if (access(probe, F_OK) == 0) { + strncpy(op, "BISECTING", opsz - 1); + op[opsz - 1] = '\0'; + return 1; + } + } + return 1; +} + Char * tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info) { @@ -193,6 +411,14 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info) int updirs; size_t pdirs; + /* git info cache */ + static Char *git_oldcwd = NULL; + static char git_branch[256]; + static char git_op[64]; + static int git_valid = -1; + static time_t git_head_mtime = 0; + static time_t git_marker_mtime = 0; + cleanup_push(&buf, Strbuf_cleanup); for (; *cp; cp++) { if ((*cp == '%') && ! (cp[1] == '\0')) { @@ -538,6 +764,82 @@ tprintf(int what, const Char *fmt, const char *str, time_t tim, ptr_t info) while (*z) Strbuf_append1(&buf, attributes | *z++); break; + case 'g': + case 'G': + if (what == FMT_PROMPT) { + Char *gcwd = varval(STRcwd); + if (gcwd == STRNULL) + break; + { + int need_refresh = (git_oldcwd != gcwd || git_valid < 0); + static const char * const markers[] = { + ".git/MERGE_HEAD", + ".git/CHERRY_PICK_HEAD", + ".git/REBASE_HEAD", + ".git/rebase-merge/head-name", + NULL + }; + if (!need_refresh) { + /* Check HEAD mtime and state-marker mtimes + * independently: HEAD mtime goes in + * git_head_mtime and the max mtime of all + * state-marker files goes in git_marker_mtime, + * so a present MERGE_HEAD whose mtime differs + * from HEAD's will always trigger a refresh. */ + char _hp[MAXPATHLEN]; + struct stat _st; + const char * const *mp; + snprintf(_hp, sizeof(_hp), "%s/.git/HEAD", + short2str(gcwd)); + if (stat(_hp, &_st) == 0 && + _st.st_mtime != git_head_mtime) + need_refresh = 1; + if (!need_refresh) { + time_t max_mtime = 0; + for (mp = markers; *mp; mp++) { + snprintf(_hp, sizeof(_hp), "%s/%s", + short2str(gcwd), *mp); + if (stat(_hp, &_st) == 0 && + _st.st_mtime > max_mtime) + max_mtime = _st.st_mtime; + } + if (max_mtime != git_marker_mtime) + need_refresh = 1; + } + } + if (need_refresh) { + char _hp[MAXPATHLEN]; + struct stat _st; + const char * const *mp; + git_oldcwd = gcwd; + git_valid = git_get_info(short2str(gcwd), + git_branch, sizeof(git_branch), + git_op, sizeof(git_op)); + snprintf(_hp, sizeof(_hp), "%s/.git/HEAD", + short2str(gcwd)); + git_head_mtime = (stat(_hp, &_st) == 0) + ? _st.st_mtime : 0; + git_marker_mtime = 0; + for (mp = markers; *mp; mp++) { + snprintf(_hp, sizeof(_hp), "%s/%s", + short2str(gcwd), *mp); + if (stat(_hp, &_st) == 0 && + _st.st_mtime > git_marker_mtime) + git_marker_mtime = _st.st_mtime; + } + } + } + if (!git_valid) + break; + { + tprintf_append_mbs(&buf, git_branch, attributes); + if (*cp == 'G' && git_op[0]) { + tprintf_append_mbs(&buf, "|", attributes); + tprintf_append_mbs(&buf, git_op, attributes); + } + } + } + break; case '$': expdollar(&buf, &cp, attributes); /* cp should point the last char of current % sequence */ diff --git a/tc.vers.c b/tc.vers.c index d93d79e6..6a9c176f 100644 --- a/tc.vers.c +++ b/tc.vers.c @@ -151,7 +151,7 @@ fix_version(void) version = xasprintf( -"mcsh %d.%.2d.%.2d (%s) %s (%" TCSH_S "-%" TCSH_S "-%" TCSH_S ") [tcsh baseline %s] options %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", +"mcsh %d.%.2d.%.2d (%s) %s (%" TCSH_S "-%" TCSH_S "-%" TCSH_S ") tcsh-baseline:%s options %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", REV, VERS, PATCHLEVEL, ORIGIN, DATE, machtype, vendor, ostype, TCSH_BASELINE_VERS, SSSTR, NLSSTR, LFSTR, DLSTR, VISTR, DTRSTR, BYESTR, diff --git a/vms.termcap.c b/vms.termcap.c new file mode 100644 index 00000000..5dda81cb --- /dev/null +++ b/vms.termcap.c @@ -0,0 +1,385 @@ +/* + * termcap.c 1.1 20/7/87 agc Joypace Ltd + * + * Copyright Joypace Ltd, London, UK, 1987. All rights reserved. + * This file may be freely distributed provided that this notice + * remains attached. + * + * A public domain implementation of the termcap(3) routines. + */ +#include "sh.h" + +#if defined(_VMS_POSIX) || defined(_OSD_POSIX) || defined(__ANDROID__) +/* efth 1988-Apr-29 + + - Correct when TERM != name and TERMCAP is defined [tgetent] + - Correct the comparison for the terminal name [tgetent] + - Correct the value of ^x escapes [tgetstr] + - Added %r to reverse row/column [tgoto] + + Paul Gillingwater July 1992 + - Modified to allow terminal aliases in termcap file + - Uses TERMCAP environment variable for file only +*/ + +#include +#include + +#define CAPABLEN 2 + +#define ISSPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') +#define ISDIGIT(x) ((x) >= '0' && (x) <= '9') + +char *capab; /* the capability itself */ + +extern char *getenv(); /* new, improved getenv */ +#ifndef fopen +extern FILE *fopen(); /* old fopen */ +#endif + +/* + * tgetent - get the termcap entry for terminal name, and put it + * in bp (which must be an array of 1024 chars). Returns 1 if + * termcap entry found, 0 if not found, and -1 if file not found. + */ +int +tgetent(char *bp, char *name) +{ +#ifdef __ANDROID__ + /* Use static termcap entry since termcap file usually doesn't exist. */ + capab = bp; + strcpy(bp, + "linux|linux console:" + ":am:eo:mi:ms:xn:xo:" + ":it#8:" + ":AL=\\E[%dL:DC=\\E[%dP:DL=\\E[%dM:IC=\\E[%d@:K2=\\E[G:al=\\E[L:" + ":bl=^G:cd=\\E[J:ce=\\E[K:cl=\\E[H\\E[J:cm=\\E[%i%d;%dH:cr=^M:" + ":cs=\\E[%i%d;%dr:ct=\\E[3g:dc=\\E[P:dl=\\E[M:do=^J:ec=\\E[%dX:" + ":ei=\\E[4l:ho=\\E[H:ic=\\E[@:im=\\E[4h:k1=\\E[[A:k2=\\E[[B:" + ":k3=\\E[[C:k4=\\E[[D:k5=\\E[[E:k6=\\E[17~:k7=\\E[18~:k8=\\E[19~:" + ":k9=\\E[20~:kD=\\E[3~:kI=\\E[2~:kN=\\E[6~:kP=\\E[5~:kb=\\177:" + ":kd=\\E[B:kh=\\E[1~:kl=\\E[D:kr=\\E[C:ku=\\E[A:le=^H:mb=\\E[5m:" + ":md=\\E[1m:me=\\E[0m:mh=\\E[2m:mr=\\E[7m:nd=\\E[C:nw=^M^J:" + ":rc=\\E8:sc=\\E7:se=\\E[27m:sf=^J:so=\\E[7m:sr=\\EM:st=\\EH:ta=^I:" + ":ue=\\E[24m:up=\\E[A:us=\\E[4m:vb=200\\E[?5h\\E[?5l:" + ":ve=\\E[?25h\\E[?0c:vi=\\E[?25l\\E[?1c:vs=\\E[?25h\\E[?0c:" + ); + return(1); +#else + FILE *fp; + char *termfile; + char *cp, + *ptr, /* temporary pointer */ + tmp[1024]; /* buffer for terminal name *//*FIXBUF*/ + size_t len = strlen(name); + + capab = bp; + + /* Use TERMCAP to override default. */ + + termfile = getenv("TERMCAP"); + if (termfile == NULL ) termfile = "/etc/termcap"; + + if ((fp = fopen(termfile, "r")) == (FILE *) NULL) { + fprintf(stderr, CGETS(31, 1, + "Can't open TERMCAP: [%s]\n"), termfile); + fprintf(stderr, CGETS(31, 2, "Can't open %s.\n"), termfile); + sleep(1); + return(-1); + } + + while (fgets(bp, 1024, fp) != NULL) { + size_t bplen; + /* Any line starting with # or NL is skipped as a comment */ + if ((*bp == '#') || (*bp == '\n')) continue; + + /* Look for lines which end with two backslashes, + and then append the next line. */ + for (;;) { + bplen = strlen(bp); + if (bplen < 2) break; + cp = &bp[bplen - 2]; + if (*cp != '\\') break; + { + size_t remaining = 1024 - bplen - 1; + if (remaining == 0) break; + if (fgets(cp, (int)remaining + 1, fp) == NULL) break; + } + } + + /* Skip over any spaces or tabs */ + for (cp = bp ; ISSPACE(*cp) ; cp++); + + /* Make sure "name" matches exactly (efth) */ + +/* Here we might want to look at any aliases as well. We'll use +sscanf to look at aliases. These are delimited by '|'. */ + + if (sscanf(bp,"%1023[^|:]",tmp) == 1 && strcmp(name, tmp) == 0) { + fclose(fp); +#ifdef DEBUG + fprintf(stderr, CGETS(31, 3, "Found %s in %s.\n"), name, termfile); + sleep(1); +#endif /* DEBUG */ + return(1); + } + ptr = bp; + { + char *colon = strchr(bp, ':'); + while ((ptr = strchr(ptr,'|')) != NULL) { + if (colon && ptr >= colon) break; + ptr++; + if (sscanf(ptr,"%1023[^|:]",tmp) == 1 && strcmp(name, tmp) == 0) { + fclose(fp); +#ifdef DEBUG + fprintf(stderr,CGETS(31, 3, "Found %s in %s.\n"), name, termfile); + sleep(1); +#endif /* DEBUG */ + return(1); + } + if (strchr(ptr,'|') == NULL || (colon && strchr(ptr,'|') >= colon)) break; + } + } + } + /* If we get here, then we haven't found a match. */ + fclose(fp); +#ifdef DEBUG + fprintf(stderr,CGETS(31, 4, "No match found for %s in file %s\n"), + name, termfile); + sleep(1); +#endif /* DEBUG */ + return(0); +#endif /* ANDROID */ +} + +/* + * tgetnum - get the numeric terminal capability corresponding + * to id. Returns the value, -1 if invalid. + */ +int +tgetnum(char *id) +{ + char *cp; + int ret; + + if ((cp = capab) == NULL || id == NULL) + return(-1); + while (*cp && *cp != ':') + cp++; + if (!*cp) return(-1); + for (++cp ; *cp ; cp++) { + while (ISSPACE(*cp)) + cp++; + if (strncmp(cp, id, CAPABLEN) == 0) { + while (*cp && *cp != ':' && *cp != '#') + cp++; + if (*cp != '#') + return(-1); + for (ret = 0, cp++ ; *cp && ISDIGIT(*cp) ; cp++) + ret = ret * 10 + *cp - '0'; + return(ret); + } + while (*cp && *cp != ':') + cp++; + } + return(-1); +} + +/* + * tgetflag - get the boolean flag corresponding to id. Returns -1 + * if invalid, 0 if the flag is not in termcap entry, or 1 if it is + * present. + */ +int +tgetflag(char *id) +{ + char *cp; + + if ((cp = capab) == NULL || id == NULL) + return(-1); + while (*cp && *cp != ':') + cp++; + if (!*cp) return(-1); + for (++cp ; *cp ; cp++) { + while (ISSPACE(*cp)) + cp++; + if (strncmp(cp, id, CAPABLEN) == 0) + return(1); + while (*cp && *cp != ':') + cp++; + } + return(0); +} + +/* + * tgetstr - get the string capability corresponding to id and place + * it in area (advancing area at same time). Expand escape sequences + * etc. Returns the string, or NULL if it can't do it. + */ +char * +tgetstr(char *id, char **area) +{ + char *cp; + char *ret; + int i; + + if ((cp = capab) == NULL || id == NULL) + return(NULL); + while (*cp && *cp != ':') + cp++; + if (!*cp) return(NULL); + for (++cp ; *cp ; cp++) { + while (ISSPACE(*cp)) + cp++; + if (strncmp(cp, id, CAPABLEN) == 0) { + while (*cp && *cp != ':' && *cp != '=') + cp++; + if (*cp != '=') + return(NULL); + for (ret = *area, cp++; *cp && *cp != ':' ; + (*area)++, cp++) + switch(*cp) { + case '^' : + **area = *++cp - '@'; /* fix (efth)*/ + break; + case '\\' : + switch(*++cp) { + case 'E' : + **area = CTL_ESC('\033'); + break; + case 'n' : + **area = '\n'; + break; + case 'r' : + **area = '\r'; + break; + case 't' : + **area = '\t'; + break; + case 'b' : + **area = '\b'; + break; + case 'f' : + **area = '\f'; + break; + case '0' : + case '1' : + case '2' : + case '3' : + case '4' : + case '5' : + case '6' : + case '7' : + i = *cp - '0'; + if (cp[1] && ISDIGIT(cp[1]) && cp[1] <= '7') { + i = i * 8 + (*++cp - '0'); + if (cp[1] && ISDIGIT(cp[1]) && cp[1] <= '7') + i = i * 8 + (*++cp - '0'); + } + **area = i; + break; + case '^' : + case '\\' : + **area = *cp; + break; + default : + **area = *cp; + break; + } + break; + default : + **area = *cp; + } + *(*area)++ = '\0'; + return(ret); + } + while (*cp && *cp != ':') + cp++; + } + return(NULL); +} + +/* + * tgoto - given the cursor motion string cm, make up the string + * for the cursor to go to (destcol, destline), and return the string. + * Returns "OOPS" if something's gone wrong, or the string otherwise. + */ +char * +tgoto(char *cm, int destcol, int destline) +{ + char *rp; + static char ret[64]; + const char *rend = ret + sizeof(ret) - 1; + int incr = 0; + int argno = 0, numval; + char tmp[24]; + + for (rp = ret ; *cm ; cm++) { + switch(*cm) { + case '%' : + switch(*++cm) { + case '+' : + numval = (argno == 0 ? destline : destcol); + argno = 1 - argno; + if (rp < rend) *rp++ = (char)(numval + incr + *++cm); + break; + + case '%' : + if (rp < rend) *rp++ = '%'; + break; + + case 'i' : + incr = 1; + break; + + case 'd' : { + int tlen; + numval = (argno == 0 ? destline : destcol); + numval += incr; + argno = 1 - argno; + tlen = snprintf(tmp, sizeof(tmp), "%d", numval); + if (tlen > 0 && tlen < (int)sizeof(tmp) && + (size_t)tlen <= (size_t)(rend - rp)) { + memcpy(rp, tmp, (size_t)tlen); + rp += tlen; + } + break; + } + + case 'r' : + argno = 1; + break; + } + + break; + default : + if (rp < rend) *rp++ = *cm; + } + } + *rp = '\0'; + return(ret); +} + +/* + * tputs - put the string cp out onto the terminal, using the function + * outc. This should do padding for the terminal, but I can't find a + * terminal that needs padding at the moment... + */ +int +tputs(char *cp, int affcnt, int (*outc)()) +{ + unsigned long delay = 0; + + if (cp == NULL) + return(1); + /* do any padding interpretation - left null for MINIX just now */ + for (delay = 0; *cp && ISDIGIT(*cp) ; cp++) + delay = delay * 10 + *cp - '0'; + while (*cp) + (*outc)(*cp++); +#ifdef _OSD_POSIX + usleep(delay*100); /* strictly spoken, it should be *1000 */ +#endif + return(1); +} +#endif /* _VMS_POSIX || _OSD_POSIX */