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