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