| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Common wrapper for a few potentially missing GNU and other programs. |
| 3 | |
| 4 | scriptversion=2024-06-07.14; # UTC |
| 5 | |
| 6 | # shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells |
| 7 | |
| 8 | # Copyright (C) 1996-2024 Free Software Foundation, Inc. |
| 9 | # Originally written by Fran,cois Pinard <[email protected]>, 1996. |
| 10 | |
| 11 | # This program is free software; you can redistribute it and/or modify |
| 12 | # it under the terms of the GNU General Public License as published by |
| 13 | # the Free Software Foundation; either version 2, or (at your option) |
| 14 | # any later version. |
| 15 | |
| 16 | # This program is distributed in the hope that it will be useful, |
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | # GNU General Public License for more details. |
| 20 | |
| 21 | # You should have received a copy of the GNU General Public License |
| 22 | # along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 23 | |
| 24 | # As a special exception to the GNU General Public License, if you |
| 25 | # distribute this file as part of a program that contains a |
| 26 | # configuration script generated by Autoconf, you may include it under |
| 27 | # the same distribution terms that you use for the rest of that program. |
| 28 | |
| 29 | if testscip-shell system . . test. $# -eq 0; then |
| 30 | echoscip-shell system . . echo. 1>&2 "Try '$0 --help' for more information" |
| 31 | exit 1 |
| 32 | fi |
| 33 | |
| 34 | case $1 in |
| 35 | |
| 36 | --is-lightweight) |
| 37 | # Used by our autoconf macros to check whether the available missing |
| 38 | # script is modern enough. |
| 39 | exit 0 |
| 40 | ;; |
| 41 | |
| 42 | --run) |
| 43 | # Back-compat with the calling convention used by older automake. |
| 44 | shift |
| 45 | ;; |
| 46 | |
| 47 | -h|--h|--he|--hel|--help) |
| 48 | echoscip-shell system . . echo. "\ |
| 49 | $0 [OPTION]... PROGRAM [ARGUMENT]... |
| 50 | |
| 51 | Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due |
| 52 | to PROGRAM being missing or too old. |
| 53 | |
| 54 | Options: |
| 55 | -h, --help display this help and exit |
| 56 | -v, --version output version information and exit |
| 57 | |
| 58 | Supported PROGRAM values: |
| 59 | aclocal autoconf autogen autoheader autom4te automake autoreconf |
| 60 | bison flex help2man lex makeinfo perl yacc |
| 61 | |
| 62 | Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and |
| 63 | 'g' are ignored when checking the name. |
| 64 | |
| 65 | Report bugs to <[email protected]>. |
| 66 | GNU Automake home page: <https://www.gnu.org/software/automake/>. |
| 67 | General help using GNU software: <https://www.gnu.org/gethelp/>." |
| 68 | exit $? |
| 69 | ;; |
| 70 | |
| 71 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) |
| 72 | echoscip-shell system . . echo. "missing (GNU Automake) $scriptversion" |
| 73 | exit $? |
| 74 | ;; |
| 75 | |
| 76 | -*) |
| 77 | echoscip-shell system . . echo. 1>&2 "$0: unknown '$1' option" |
| 78 | echoscip-shell system . . echo. 1>&2 "Try '$0 --help' for more information" |
| 79 | exit 1 |
| 80 | ;; |
| 81 | |
| 82 | esac |
| 83 | |
| 84 | # Run the given program, remember its exit status. |
| 85 | "$@"; st=$? |
| 86 | |
| 87 | # If it succeeded, we are done. |
| 88 | testscip-shell system . . test. $st -eq 0 && exit 0 |
| 89 | |
| 90 | # Also exit now if we it failed (or wasn't found), and '--version' was |
| 91 | # passed; such an option is passed most likely to detect whether the |
| 92 | # program is present and works. |
| 93 | case $2 in --version|--help) exit $st;; esac |
| 94 | |
| 95 | # Exit code 63 means version mismatch. This often happens when the user |
| 96 | # tries to use an ancient version of a tool on a file that requires a |
| 97 | # minimum version. |
| 98 | if testscip-shell system . . test. $st -eq 63; then |
| 99 | msg="probably too old" |
| 100 | elif testscip-shell system . . test. $st -eq 127; then |
| 101 | # Program was missing. |
| 102 | msg="missing on your system" |
| 103 | else |
| 104 | # Program was found and executed, but failed. Give up. |
| 105 | exit $st |
| 106 | fi |
| 107 | |
| 108 | perl_URL=https://www.perl.org/ |
| 109 | flex_URL=https://github.com/westes/flex |
| 110 | gnu_software_URL=https://www.gnu.org/software |
| 111 | |
| 112 | program_detailsscip-shell shell libxtst 2:1.2.5-1 program_details(). () |
| 113 | { |
| 114 | case $1 in |
| 115 | aclocal|automake|autoreconf) |
| 116 | echoscip-shell system . . echo. "The '$1' program is part of the GNU Automake package:" |
| 117 | echoscip-shell system . . echo. "<$gnu_software_URL/automake>" |
| 118 | echoscip-shell system . . echo. "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" |
| 119 | echoscip-shell system . . echo. "<$gnu_software_URL/autoconf>" |
| 120 | echoscip-shell system . . echo. "<$gnu_software_URL/m4/>" |
| 121 | echoscip-shell system . . echo. "<$perl_URL>" |
| 122 | ;; |
| 123 | autoconf|autom4te|autoheader) |
| 124 | echoscip-shell system . . echo. "The '$1' program is part of the GNU Autoconf package:" |
| 125 | echoscip-shell system . . echo. "<$gnu_software_URL/autoconf/>" |
| 126 | echoscip-shell system . . echo. "It also requires GNU m4 and Perl in order to run:" |
| 127 | echoscip-shell system . . echo. "<$gnu_software_URL/m4/>" |
| 128 | echoscip-shell system . . echo. "<$perl_URL>" |
| 129 | ;; |
| 130 | *) |
| 131 | : |
| 132 | ;; |
| 133 | esac |
| 134 | } |
| 135 | |
| 136 | give_advicescip-shell shell libxtst 2:1.2.5-1 give_advice(). () |
| 137 | { |
| 138 | # Normalize program name to check for. |
| 139 | normalized_program=`echoscip-shell system . . echo. "$1" | sedscip-shell system . . sed. ' |
| 140 | s/^gnu-//; t |
| 141 | s/^gnu//; t |
| 142 | s/^g//; t'` |
| 143 | |
| 144 | printfscip-shell system . . printf. '%s\n' "'$1' is $msg." |
| 145 | |
| 146 | configure_deps="'configure.ac' or m4 files included by 'configure.ac'" |
| 147 | autoheader_deps="'acconfig.h'" |
| 148 | automake_deps="'Makefile.am'" |
| 149 | aclocal_deps="'acinclude.m4'" |
| 150 | case $normalized_program in |
| 151 | aclocal*) |
| 152 | echoscip-shell system . . echo. "You should only need it if you modified $aclocal_deps or" |
| 153 | echoscip-shell system . . echo. "$configure_deps." |
| 154 | ;; |
| 155 | autoconf*) |
| 156 | echoscip-shell system . . echo. "You should only need it if you modified $configure_deps." |
| 157 | ;; |
| 158 | autogen*) |
| 159 | echoscip-shell system . . echo. "You should only need it if you modified a '.def' or '.tpl' file." |
| 160 | echoscip-shell system . . echo. "You may want to install the GNU AutoGen package:" |
| 161 | echoscip-shell system . . echo. "<$gnu_software_URL/autogen/>" |
| 162 | ;; |
| 163 | autoheader*) |
| 164 | echoscip-shell system . . echo. "You should only need it if you modified $autoheader_deps or" |
| 165 | echoscip-shell system . . echo. "$configure_deps." |
| 166 | ;; |
| 167 | automake*) |
| 168 | echoscip-shell system . . echo. "You should only need it if you modified $automake_deps or" |
| 169 | echoscip-shell system . . echo. "$configure_deps." |
| 170 | ;; |
| 171 | autom4te*) |
| 172 | echoscip-shell system . . echo. "You might have modified some maintainer files that require" |
| 173 | echoscip-shell system . . echo. "the 'autom4te' program to be rebuilt." |
| 174 | ;; |
| 175 | autoreconf*) |
| 176 | echoscip-shell system . . echo. "You should only need it if you modified $aclocal_deps or" |
| 177 | echoscip-shell system . . echo. "$automake_deps or $autoheader_deps or $automake_deps or" |
| 178 | echoscip-shell system . . echo. "$configure_deps." |
| 179 | ;; |
| 180 | bison*|yacc*) |
| 181 | echoscip-shell system . . echo. "You should only need it if you modified a '.y' file." |
| 182 | echoscip-shell system . . echo. "You may want to install the GNU Bison package:" |
| 183 | echoscip-shell system . . echo. "<$gnu_software_URL/bison/>" |
| 184 | ;; |
| 185 | help2man*) |
| 186 | echoscip-shell system . . echo. "You should only need it if you modified a dependency" \ |
| 187 | "of a man page." |
| 188 | echoscip-shell system . . echo. "You may want to install the GNU Help2man package:" |
| 189 | echoscip-shell system . . echo. "<$gnu_software_URL/help2man/>" |
| 190 | ;; |
| 191 | lex*|flex*) |
| 192 | echoscip-shell system . . echo. "You should only need it if you modified a '.l' file." |
| 193 | echoscip-shell system . . echo. "You may want to install the Fast Lexical Analyzer package:" |
| 194 | echoscip-shell system . . echo. "<$flex_URL>" |
| 195 | ;; |
| 196 | makeinfo*) |
| 197 | echoscip-shell system . . echo. "You should only need it if you modified a '.texi' file, or" |
| 198 | echoscip-shell system . . echo. "any other file indirectly affecting the aspect of the manual." |
| 199 | echoscip-shell system . . echo. "You might want to install the Texinfo package:" |
| 200 | echoscip-shell system . . echo. "<$gnu_software_URL/texinfo/>" |
| 201 | echoscip-shell system . . echo. "The spurious makeinfo call might also be the consequence of" |
| 202 | echoscip-shell system . . echo. "using a buggy 'make' (AIX, DU, IRIX), in which case you might" |
| 203 | echoscip-shell system . . echo. "want to install GNU make:" |
| 204 | echoscip-shell system . . echo. "<$gnu_software_URL/make/>" |
| 205 | ;; |
| 206 | perl*) |
| 207 | echoscip-shell system . . echo. "You should only need it to run GNU Autoconf, GNU Automake, " |
| 208 | echoscip-shell system . . echo. " assorted other tools, or if you modified a Perl source file." |
| 209 | echoscip-shell system . . echo. "You may want to install the Perl 5 language interpreter:" |
| 210 | echoscip-shell system . . echo. "<$perl_URL>" |
| 211 | ;; |
| 212 | *) |
| 213 | echoscip-shell system . . echo. "You might have modified some files without having the proper" |
| 214 | echoscip-shell system . . echo. "tools for further handling them. Check the 'README' file, it" |
| 215 | echoscip-shell system . . echo. "often tells you about the needed prerequisites for installing" |
| 216 | echoscip-shell system . . echo. "this package. You may also peek at any GNU archive site, in" |
| 217 | echoscip-shell system . . echo. "case some other package contains this missing '$1' program." |
| 218 | ;; |
| 219 | esac |
| 220 | program_detailsscip-shell shell libxtst 2:1.2.5-1 program_details(). "$normalized_program" |
| 221 | } |
| 222 | |
| 223 | give_advicescip-shell shell libxtst 2:1.2.5-1 give_advice(). "$1" | sedscip-shell system . . sed. -e '1s/^/WARNING: /' \ |
| 224 | -e '2,$s/^/ /' >&2 |
| 225 | |
| 226 | # Propagate the correct exit status (expected to be 127 for a program |
| 227 | # not found, 63 for a program that failed due to version mismatch). |
| 228 | exit $st |
| 229 | |
| 230 | # Local variables: |
| 231 | # eval: (add-hook 'before-save-hook 'time-stamp) |
| 232 | # time-stamp-start: "scriptversion=" |
| 233 | # time-stamp-format: "%:y-%02m-%02d.%02H" |
| 234 | # time-stamp-time-zone: "UTC0" |
| 235 | # time-stamp-end: "; # UTC" |
| 236 | # End: |