missing 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. #! /bin/sh
  2. # Common stub for a few missing GNU programs while installing.
  3. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
  4. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. # 02111-1307, USA.
  17. # As a special exception to the GNU General Public License, if you
  18. # distribute this file as part of a program that contains a
  19. # configuration script generated by Autoconf, you may include it under
  20. # the same distribution terms that you use for the rest of that program.
  21. if test $# -eq 0; then
  22. echo 1>&2 "Try \`$0 --help' for more information"
  23. exit 1
  24. fi
  25. run=:
  26. # In the cases where this matters, `missing' is being run in the
  27. # srcdir already.
  28. if test -f configure.ac; then
  29. configure_ac=configure.ac
  30. else
  31. configure_ac=configure.in
  32. fi
  33. case "$1" in
  34. --run)
  35. # Try to run requested program, and just exit if it succeeds.
  36. run=
  37. shift
  38. "$@" && exit 0
  39. ;;
  40. esac
  41. # If it does not exist, or fails to run (possibly an outdated version),
  42. # try to emulate it.
  43. case "$1" in
  44. -h|--h|--he|--hel|--help)
  45. echo "\
  46. $0 [OPTION]... PROGRAM [ARGUMENT]...
  47. Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
  48. error status if there is no known handling for PROGRAM.
  49. Options:
  50. -h, --help display this help and exit
  51. -v, --version output version information and exit
  52. --run try to run the given command, and emulate it if it fails
  53. Supported PROGRAM values:
  54. aclocal touch file \`aclocal.m4'
  55. autoconf touch file \`configure'
  56. autoheader touch file \`config.h.in'
  57. automake touch all \`Makefile.in' files
  58. bison create \`y.tab.[ch]', if possible, from existing .[ch]
  59. flex create \`lex.yy.c', if possible, from existing .c
  60. help2man touch the output file
  61. lex create \`lex.yy.c', if possible, from existing .c
  62. makeinfo touch the output file
  63. tar try tar, gnutar, gtar, then tar without non-portable flags
  64. yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
  65. ;;
  66. -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
  67. echo "missing 0.3 - GNU automake"
  68. ;;
  69. -*)
  70. echo 1>&2 "$0: Unknown \`$1' option"
  71. echo 1>&2 "Try \`$0 --help' for more information"
  72. exit 1
  73. ;;
  74. aclocal)
  75. echo 1>&2 "\
  76. WARNING: \`$1' is missing on your system. You should only need it if
  77. you modified \`acinclude.m4' or \`${configure_ac}'. You might want
  78. to install the \`Automake' and \`Perl' packages. Grab them from
  79. any GNU archive site."
  80. touch aclocal.m4
  81. ;;
  82. autoconf)
  83. echo 1>&2 "\
  84. WARNING: \`$1' is missing on your system. You should only need it if
  85. you modified \`${configure_ac}'. You might want to install the
  86. \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
  87. archive site."
  88. touch configure
  89. ;;
  90. autoheader)
  91. echo 1>&2 "\
  92. WARNING: \`$1' is missing on your system. You should only need it if
  93. you modified \`acconfig.h' or \`${configure_ac}'. You might want
  94. to install the \`Autoconf' and \`GNU m4' packages. Grab them
  95. from any GNU archive site."
  96. files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
  97. test -z "$files" && files="config.h"
  98. touch_files=
  99. for f in $files; do
  100. case "$f" in
  101. *:*) touch_files="$touch_files "`echo "$f" |
  102. sed -e 's/^[^:]*://' -e 's/:.*//'`;;
  103. *) touch_files="$touch_files $f.in";;
  104. esac
  105. done
  106. touch $touch_files
  107. ;;
  108. automake)
  109. echo 1>&2 "\
  110. WARNING: \`$1' is missing on your system. You should only need it if
  111. you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
  112. You might want to install the \`Automake' and \`Perl' packages.
  113. Grab them from any GNU archive site."
  114. find . -type f -name Makefile.am -print |
  115. sed 's/\.am$/.in/' |
  116. while read f; do touch "$f"; done
  117. ;;
  118. bison|yacc)
  119. echo 1>&2 "\
  120. WARNING: \`$1' is missing on your system. You should only need it if
  121. you modified a \`.y' file. You may need the \`Bison' package
  122. in order for those modifications to take effect. You can get
  123. \`Bison' from any GNU archive site."
  124. rm -f y.tab.c y.tab.h
  125. if [ $# -ne 1 ]; then
  126. eval LASTARG="\${$#}"
  127. case "$LASTARG" in
  128. *.y)
  129. SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
  130. if [ -f "$SRCFILE" ]; then
  131. cp "$SRCFILE" y.tab.c
  132. fi
  133. SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
  134. if [ -f "$SRCFILE" ]; then
  135. cp "$SRCFILE" y.tab.h
  136. fi
  137. ;;
  138. esac
  139. fi
  140. if [ ! -f y.tab.h ]; then
  141. echo >y.tab.h
  142. fi
  143. if [ ! -f y.tab.c ]; then
  144. echo 'main() { return 0; }' >y.tab.c
  145. fi
  146. ;;
  147. lex|flex)
  148. echo 1>&2 "\
  149. WARNING: \`$1' is missing on your system. You should only need it if
  150. you modified a \`.l' file. You may need the \`Flex' package
  151. in order for those modifications to take effect. You can get
  152. \`Flex' from any GNU archive site."
  153. rm -f lex.yy.c
  154. if [ $# -ne 1 ]; then
  155. eval LASTARG="\${$#}"
  156. case "$LASTARG" in
  157. *.l)
  158. SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
  159. if [ -f "$SRCFILE" ]; then
  160. cp "$SRCFILE" lex.yy.c
  161. fi
  162. ;;
  163. esac
  164. fi
  165. if [ ! -f lex.yy.c ]; then
  166. echo 'main() { return 0; }' >lex.yy.c
  167. fi
  168. ;;
  169. help2man)
  170. echo 1>&2 "\
  171. WARNING: \`$1' is missing on your system. You should only need it if
  172. you modified a dependency of a manual page. You may need the
  173. \`Help2man' package in order for those modifications to take
  174. effect. You can get \`Help2man' from any GNU archive site."
  175. file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
  176. if test -z "$file"; then
  177. file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
  178. fi
  179. if [ -f "$file" ]; then
  180. touch $file
  181. else
  182. test -z "$file" || exec >$file
  183. echo ".ab help2man is required to generate this page"
  184. exit 1
  185. fi
  186. ;;
  187. makeinfo)
  188. if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
  189. # We have makeinfo, but it failed.
  190. exit 1
  191. fi
  192. echo 1>&2 "\
  193. WARNING: \`$1' is missing on your system. You should only need it if
  194. you modified a \`.texi' or \`.texinfo' file, or any other file
  195. indirectly affecting the aspect of the manual. The spurious
  196. call might also be the consequence of using a buggy \`make' (AIX,
  197. DU, IRIX). You might want to install the \`Texinfo' package or
  198. the \`GNU make' package. Grab either from any GNU archive site."
  199. file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
  200. if test -z "$file"; then
  201. file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
  202. file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
  203. fi
  204. touch $file
  205. ;;
  206. tar)
  207. shift
  208. if test -n "$run"; then
  209. echo 1>&2 "ERROR: \`tar' requires --run"
  210. exit 1
  211. fi
  212. # We have already tried tar in the generic part.
  213. # Look for gnutar/gtar before invocation to avoid ugly error
  214. # messages.
  215. if (gnutar --version > /dev/null 2>&1); then
  216. gnutar ${1+"$@"} && exit 0
  217. fi
  218. if (gtar --version > /dev/null 2>&1); then
  219. gtar ${1+"$@"} && exit 0
  220. fi
  221. firstarg="$1"
  222. if shift; then
  223. case "$firstarg" in
  224. *o*)
  225. firstarg=`echo "$firstarg" | sed s/o//`
  226. tar "$firstarg" ${1+"$@"} && exit 0
  227. ;;
  228. esac
  229. case "$firstarg" in
  230. *h*)
  231. firstarg=`echo "$firstarg" | sed s/h//`
  232. tar "$firstarg" ${1+"$@"} && exit 0
  233. ;;
  234. esac
  235. fi
  236. echo 1>&2 "\
  237. WARNING: I can't seem to be able to run \`tar' with the given arguments.
  238. You may want to install GNU tar or Free paxutils, or check the
  239. command line arguments."
  240. exit 1
  241. ;;
  242. *)
  243. echo 1>&2 "\
  244. WARNING: \`$1' is needed, and you do not seem to have it handy on your
  245. system. You might have modified some files without having the
  246. proper tools for further handling them. Check the \`README' file,
  247. it often tells you about the needed prerequirements for installing
  248. this package. You may also peek at any GNU archive site, in case
  249. some other package would contain this missing \`$1' program."
  250. exit 1
  251. ;;
  252. esac
  253. exit 0