annotate src/libvorbis-1.3.3/compile @ 1:05aa0afa9217

Bring in flac, ogg, vorbis
author Chris Cannam
date Tue, 19 Mar 2013 17:37:49 +0000
parents
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=2005-05-14.22
Chris@1 5
Chris@1 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
Chris@1 7 # Written by Tom Tromey <tromey@cygnus.com>.
Chris@1 8 #
Chris@1 9 # This program is free software; you can redistribute it and/or modify
Chris@1 10 # it under the terms of the GNU General Public License as published by
Chris@1 11 # the Free Software Foundation; either version 2, or (at your option)
Chris@1 12 # any later version.
Chris@1 13 #
Chris@1 14 # This program is distributed in the hope that it will be useful,
Chris@1 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@1 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@1 17 # GNU General Public License for more details.
Chris@1 18 #
Chris@1 19 # You should have received a copy of the GNU General Public License
Chris@1 20 # along with this program; if not, write to the Free Software
Chris@1 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 -e 's|^.*/||' -e '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 mv "$cofile" "$ofile"
Chris@1 128 elif test -f "${cofile}bj"; then
Chris@1 129 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-end: "$"
Chris@1 142 # End: