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