annotate src/liblo-0.26/compile @ 4:e13257ea84a4

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