annotate compile @ 112450:16ddab338c43

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