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