annotate src/liblo-0.26/compile @ 150:0a1a4a299a5d

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