~ubuntu-branches/ubuntu/hardy/xfce-mcs-plugins/hardy

« back to all changes in this revision

Viewing changes to compile

  • Committer: Bazaar Package Importer
  • Author(s): Jani Monoses
  • Date: 2006-04-21 22:54:56 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20060421225456-1ecntyz8xojaxcl7
Tags: 4.3.90.1svn+r21136-0ubuntu1
* Upstream svn snapshot (4.4 beta 1)
* Bump library dependencies to 4.3.90.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
# Wrapper for compilers which do not understand `-c -o'.
3
3
 
4
 
scriptversion=2005-05-14.22
 
4
scriptversion=2003-11-09.00
5
5
 
6
 
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
 
6
# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
7
7
# Written by Tom Tromey <tromey@cygnus.com>.
8
8
#
9
9
# This program is free software; you can redistribute it and/or modify
18
18
#
19
19
# You should have received a copy of the GNU General Public License
20
20
# along with this program; if not, write to the Free Software
21
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
21
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
22
 
23
23
# As a special exception to the GNU General Public License, if you
24
24
# distribute this file as part of a program that contains a
47
47
 
48
48
Report bugs to <bug-automake@gnu.org>.
49
49
EOF
50
 
    exit $?
 
50
    exit 0
51
51
    ;;
52
52
  -v | --v*)
53
53
    echo "compile $scriptversion"
54
 
    exit $?
 
54
    exit 0
55
55
    ;;
56
56
esac
57
57
 
 
58
 
 
59
prog=$1
 
60
shift
 
61
 
58
62
ofile=
59
63
cfile=
60
 
eat=
61
 
 
62
 
for arg
63
 
do
64
 
  if test -n "$eat"; then
65
 
    eat=
66
 
  else
67
 
    case $1 in
68
 
      -o)
69
 
        # configure might choose to run compile as `compile cc -o foo foo.c'.
70
 
        # So we strip `-o arg' only if arg is an object.
71
 
        eat=1
72
 
        case $2 in
73
 
          *.o | *.obj)
74
 
            ofile=$2
75
 
            ;;
76
 
          *)
77
 
            set x "$@" -o "$2"
78
 
            shift
79
 
            ;;
80
 
        esac
81
 
        ;;
82
 
      *.c)
83
 
        cfile=$1
84
 
        set x "$@" "$1"
85
 
        shift
86
 
        ;;
87
 
      *)
88
 
        set x "$@" "$1"
89
 
        shift
90
 
        ;;
91
 
    esac
92
 
  fi
 
64
args=
 
65
while test $# -gt 0; do
 
66
  case "$1" in
 
67
    -o)
 
68
      # configure might choose to run compile as `compile cc -o foo foo.c'.
 
69
      # So we do something ugly here.
 
70
      ofile=$2
 
71
      shift
 
72
      case "$ofile" in
 
73
        *.o | *.obj)
 
74
          ;;
 
75
        *)
 
76
          args="$args -o $ofile"
 
77
          ofile=
 
78
          ;;
 
79
      esac
 
80
       ;;
 
81
    *.c)
 
82
      cfile=$1
 
83
      args="$args $1"
 
84
      ;;
 
85
    *)
 
86
      args="$args $1"
 
87
      ;;
 
88
  esac
93
89
  shift
94
90
done
95
91
 
99
95
  # normal compilation that the losing compiler can handle.  If no
100
96
  # `.c' file was seen then we are probably linking.  That is also
101
97
  # ok.
102
 
  exec "$@"
 
98
  exec "$prog" $args
103
99
fi
104
100
 
105
101
# Name of file we expect compiler to create.
106
 
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
 
102
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
107
103
 
108
104
# Create the lock directory.
109
105
# Note: use `[/.-]' here to ensure that we don't use the same name
110
106
# that we are using for the .o file.  Also, base the name on the expected
111
107
# object file name, since that is what matters with a parallel build.
112
 
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
 
108
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
113
109
while true; do
114
 
  if mkdir "$lockdir" >/dev/null 2>&1; then
 
110
  if mkdir $lockdir > /dev/null 2>&1; then
115
111
    break
116
112
  fi
117
113
  sleep 1
118
114
done
119
115
# FIXME: race condition here if user kills between mkdir and trap.
120
 
trap "rmdir '$lockdir'; exit 1" 1 2 15
 
116
trap "rmdir $lockdir; exit 1" 1 2 15
121
117
 
122
118
# Run the compile.
123
 
"$@"
124
 
ret=$?
 
119
"$prog" $args
 
120
status=$?
125
121
 
126
122
if test -f "$cofile"; then
127
123
  mv "$cofile" "$ofile"
128
 
elif test -f "${cofile}bj"; then
129
 
  mv "${cofile}bj" "$ofile"
130
124
fi
131
125
 
132
 
rmdir "$lockdir"
133
 
exit $ret
 
126
rmdir $lockdir
 
127
exit $status
134
128
 
135
129
# Local Variables:
136
130
# mode: shell-script