annotate src/libogg-1.3.0/compile @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 05aa0afa9217
children
rev   line source
Chris@1 1 #! /bin/sh
Chris@1 2 # Wrapper for compilers which do not understand `-c -o'.
Chris@1 3
Chris@1 4 scriptversion=2009-10-06.20; # UTC
Chris@1 5
Chris@1 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
Chris@1 7 # Foundation, Inc.
Chris@1 8 # Written by Tom Tromey <tromey@cygnus.com>.
Chris@1 9 #
Chris@1 10 # This program is free software; you can redistribute it and/or modify
Chris@1 11 # it under the terms of the GNU General Public License as published by
Chris@1 12 # the Free Software Foundation; either version 2, or (at your option)
Chris@1 13 # any later version.
Chris@1 14 #
Chris@1 15 # This program is distributed in the hope that it will be useful,
Chris@1 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1 18 # GNU General Public License for more details.
Chris@1 19 #
Chris@1 20 # You should have received a copy of the GNU General Public License
Chris@1 21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
Chris@1 22
Chris@1 23 # As a special exception to the GNU General Public License, if you
Chris@1 24 # distribute this file as part of a program that contains a
Chris@1 25 # configuration script generated by Autoconf, you may include it under
Chris@1 26 # the same distribution terms that you use for the rest of that program.
Chris@1 27
Chris@1 28 # This file is maintained in Automake, please report
Chris@1 29 # bugs to <bug-automake@gnu.org> or send patches to
Chris@1 30 # <automake-patches@gnu.org>.
Chris@1 31
Chris@1 32 case $1 in
Chris@1 33 '')
Chris@1 34 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
Chris@1 35 exit 1;
Chris@1 36 ;;
Chris@1 37 -h | --h*)
Chris@1 38 cat <<\EOF
Chris@1 39 Usage: compile [--help] [--version] PROGRAM [ARGS]
Chris@1 40
Chris@1 41 Wrapper for compilers which do not understand `-c -o'.
Chris@1 42 Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
Chris@1 43 arguments, and rename the output as expected.
Chris@1 44
Chris@1 45 If you are trying to build a whole package this is not the
Chris@1 46 right script to run: please start by reading the file `INSTALL'.
Chris@1 47
Chris@1 48 Report bugs to <bug-automake@gnu.org>.
Chris@1 49 EOF
Chris@1 50 exit $?
Chris@1 51 ;;
Chris@1 52 -v | --v*)
Chris@1 53 echo "compile $scriptversion"
Chris@1 54 exit $?
Chris@1 55 ;;
Chris@1 56 esac
Chris@1 57
Chris@1 58 ofile=
Chris@1 59 cfile=
Chris@1 60 eat=
Chris@1 61
Chris@1 62 for arg
Chris@1 63 do
Chris@1 64 if test -n "$eat"; then
Chris@1 65 eat=
Chris@1 66 else
Chris@1 67 case $1 in
Chris@1 68 -o)
Chris@1 69 # configure might choose to run compile as `compile cc -o foo foo.c'.
Chris@1 70 # So we strip `-o arg' only if arg is an object.
Chris@1 71 eat=1
Chris@1 72 case $2 in
Chris@1 73 *.o | *.obj)
Chris@1 74 ofile=$2
Chris@1 75 ;;
Chris@1 76 *)
Chris@1 77 set x "$@" -o "$2"
Chris@1 78 shift
Chris@1 79 ;;
Chris@1 80 esac
Chris@1 81 ;;
Chris@1 82 *.c)
Chris@1 83 cfile=$1
Chris@1 84 set x "$@" "$1"
Chris@1 85 shift
Chris@1 86 ;;
Chris@1 87 *)
Chris@1 88 set x "$@" "$1"
Chris@1 89 shift
Chris@1 90 ;;
Chris@1 91 esac
Chris@1 92 fi
Chris@1 93 shift
Chris@1 94 done
Chris@1 95
Chris@1 96 if test -z "$ofile" || test -z "$cfile"; then
Chris@1 97 # If no `-o' option was seen then we might have been invoked from a
Chris@1 98 # pattern rule where we don't need one. That is ok -- this is a
Chris@1 99 # normal compilation that the losing compiler can handle. If no
Chris@1 100 # `.c' file was seen then we are probably linking. That is also
Chris@1 101 # ok.
Chris@1 102 exec "$@"
Chris@1 103 fi
Chris@1 104
Chris@1 105 # Name of file we expect compiler to create.
Chris@1 106 cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
Chris@1 107
Chris@1 108 # Create the lock directory.
Chris@1 109 # Note: use `[/\\:.-]' here to ensure that we don't use the same name
Chris@1 110 # that we are using for the .o file. Also, base the name on the expected
Chris@1 111 # object file name, since that is what matters with a parallel build.
Chris@1 112 lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
Chris@1 113 while true; do
Chris@1 114 if mkdir "$lockdir" >/dev/null 2>&1; then
Chris@1 115 break
Chris@1 116 fi
Chris@1 117 sleep 1
Chris@1 118 done
Chris@1 119 # FIXME: race condition here if user kills between mkdir and trap.
Chris@1 120 trap "rmdir '$lockdir'; exit 1" 1 2 15
Chris@1 121
Chris@1 122 # Run the compile.
Chris@1 123 "$@"
Chris@1 124 ret=$?
Chris@1 125
Chris@1 126 if test -f "$cofile"; then
Chris@1 127 test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
Chris@1 128 elif test -f "${cofile}bj"; then
Chris@1 129 test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
Chris@1 130 fi
Chris@1 131
Chris@1 132 rmdir "$lockdir"
Chris@1 133 exit $ret
Chris@1 134
Chris@1 135 # Local Variables:
Chris@1 136 # mode: shell-script
Chris@1 137 # sh-indentation: 2
Chris@1 138 # eval: (add-hook 'write-file-hooks 'time-stamp)
Chris@1 139 # time-stamp-start: "scriptversion="
Chris@1 140 # time-stamp-format: "%:y-%02m-%02d.%02H"
Chris@1 141 # time-stamp-time-zone: "UTC"
Chris@1 142 # time-stamp-end: "; # UTC"
Chris@1 143 # End: