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