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