masqmail

view depcomp @ 421:f37384470855

Changed lockdir to /var/lock/masqmail; Create lockdir and piddir on startup. Moved the lockdir out of the spool dir. (When /var/lock is a ramdisk we do well to have the lock files there.) Added the new configure option --with-lockdir to change that location. Nontheless, if we run_as_user, then lock files are always stored in the spool dir directly. Instead of installing the lockdir and piddir at installation time, we create them on startup time now if they are missing. This is necessary if lockdir or piddir are a tmpfs.
author markus schnalke <meillo@marmaro.de>
date Wed, 30 May 2012 09:38:38 +0200
parents
children
line source
1 #! /bin/sh
3 # depcomp - compile a program generating dependencies as side-effects
4 # Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
28 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
29 echo "depcomp: Variables source, object and depmode must be set" 1>&2
30 exit 1
31 fi
32 # `libtool' can also be set to `yes' or `no'.
34 if test -z "$depfile"; then
35 base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
36 dir=`echo "$object" | sed 's,/.*$,/,'`
37 if test "$dir" = "$object"; then
38 dir=
39 fi
40 # FIXME: should be _deps on DOS.
41 depfile="$dir.deps/$base"
42 fi
44 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
46 rm -f "$tmpdepfile"
48 # Some modes work just like other modes, but use different flags. We
49 # parameterize here, but still list the modes in the big case below,
50 # to make depend.m4 easier to write. Note that we *cannot* use a case
51 # here, because this file can only contain one case statement.
52 if test "$depmode" = hp; then
53 # HP compiler uses -M and no extra arg.
54 gccflag=-M
55 depmode=gcc
56 fi
58 if test "$depmode" = dashXmstdout; then
59 # This is just like dashmstdout with a different argument.
60 dashmflag=-xM
61 depmode=dashmstdout
62 fi
64 case "$depmode" in
65 gcc3)
66 ## gcc 3 implements dependency tracking that does exactly what
67 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
68 ## it if -MD -MP comes after the -MF stuff. Hmm.
69 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
70 stat=$?
71 if test $stat -eq 0; then :
72 else
73 rm -f "$tmpdepfile"
74 exit $stat
75 fi
76 mv "$tmpdepfile" "$depfile"
77 ;;
79 gcc)
80 ## There are various ways to get dependency output from gcc. Here's
81 ## why we pick this rather obscure method:
82 ## - Don't want to use -MD because we'd like the dependencies to end
83 ## up in a subdir. Having to rename by hand is ugly.
84 ## (We might end up doing this anyway to support other compilers.)
85 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
86 ## -MM, not -M (despite what the docs say).
87 ## - Using -M directly means running the compiler twice (even worse
88 ## than renaming).
89 if test -z "$gccflag"; then
90 gccflag=-MD,
91 fi
92 "$@" -Wp,"$gccflag$tmpdepfile"
93 stat=$?
94 if test $stat -eq 0; then :
95 else
96 rm -f "$tmpdepfile"
97 exit $stat
98 fi
99 rm -f "$depfile"
100 echo "$object : \\" > "$depfile"
101 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
102 ## The second -e expression handles DOS-style file names with drive letters.
103 sed -e 's/^[^:]*: / /' \
104 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
105 ## This next piece of magic avoids the `deleted header file' problem.
106 ## The problem is that when a header file which appears in a .P file
107 ## is deleted, the dependency causes make to die (because there is
108 ## typically no way to rebuild the header). We avoid this by adding
109 ## dummy dependencies for each header file. Too bad gcc doesn't do
110 ## this for us directly.
111 tr ' ' '
112 ' < "$tmpdepfile" |
113 ## Some versions of gcc put a space before the `:'. On the theory
114 ## that the space means something, we add a space to the output as
115 ## well.
116 ## Some versions of the HPUX 10.20 sed can't process this invocation
117 ## correctly. Breaking it into two sed invocations is a workaround.
118 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
119 rm -f "$tmpdepfile"
120 ;;
122 hp)
123 # This case exists only to let depend.m4 do its work. It works by
124 # looking at the text of this script. This case will never be run,
125 # since it is checked for above.
126 exit 1
127 ;;
129 sgi)
130 if test "$libtool" = yes; then
131 "$@" "-Wp,-MDupdate,$tmpdepfile"
132 else
133 "$@" -MDupdate "$tmpdepfile"
134 fi
135 stat=$?
136 if test $stat -eq 0; then :
137 else
138 rm -f "$tmpdepfile"
139 exit $stat
140 fi
141 rm -f "$depfile"
143 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
144 echo "$object : \\" > "$depfile"
146 # Clip off the initial element (the dependent). Don't try to be
147 # clever and replace this with sed code, as IRIX sed won't handle
148 # lines with more than a fixed number of characters (4096 in
149 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
150 # the IRIX cc adds comments like `#:fec' to the end of the
151 # dependency line.
152 tr ' ' '
153 ' < "$tmpdepfile" \
154 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
155 tr '
156 ' ' ' >> $depfile
157 echo >> $depfile
159 # The second pass generates a dummy entry for each header file.
160 tr ' ' '
161 ' < "$tmpdepfile" \
162 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
163 >> $depfile
164 else
165 # The sourcefile does not contain any dependencies, so just
166 # store a dummy comment line, to avoid errors with the Makefile
167 # "include basename.Plo" scheme.
168 echo "#dummy" > "$depfile"
169 fi
170 rm -f "$tmpdepfile"
171 ;;
173 aix)
174 # The C for AIX Compiler uses -M and outputs the dependencies
175 # in a .u file. In older versions, this file always lives in the
176 # current directory. Also, the AIX compiler puts `$object:' at the
177 # start of each line; $object doesn't have directory information.
178 # Version 6 uses the directory in both cases.
179 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
180 tmpdepfile="$stripped.u"
181 if test "$libtool" = yes; then
182 "$@" -Wc,-M
183 else
184 "$@" -M
185 fi
186 stat=$?
188 if test -f "$tmpdepfile"; then :
189 else
190 stripped=`echo "$stripped" | sed 's,^.*/,,'`
191 tmpdepfile="$stripped.u"
192 fi
194 if test $stat -eq 0; then :
195 else
196 rm -f "$tmpdepfile"
197 exit $stat
198 fi
200 if test -f "$tmpdepfile"; then
201 outname="$stripped.o"
202 # Each line is of the form `foo.o: dependent.h'.
203 # Do two passes, one to just change these to
204 # `$object: dependent.h' and one to simply `dependent.h:'.
205 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
206 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
207 else
208 # The sourcefile does not contain any dependencies, so just
209 # store a dummy comment line, to avoid errors with the Makefile
210 # "include basename.Plo" scheme.
211 echo "#dummy" > "$depfile"
212 fi
213 rm -f "$tmpdepfile"
214 ;;
216 icc)
217 # Intel's C compiler understands `-MD -MF file'. However on
218 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
219 # ICC 7.0 will fill foo.d with something like
220 # foo.o: sub/foo.c
221 # foo.o: sub/foo.h
222 # which is wrong. We want:
223 # sub/foo.o: sub/foo.c
224 # sub/foo.o: sub/foo.h
225 # sub/foo.c:
226 # sub/foo.h:
227 # ICC 7.1 will output
228 # foo.o: sub/foo.c sub/foo.h
229 # and will wrap long lines using \ :
230 # foo.o: sub/foo.c ... \
231 # sub/foo.h ... \
232 # ...
234 "$@" -MD -MF "$tmpdepfile"
235 stat=$?
236 if test $stat -eq 0; then :
237 else
238 rm -f "$tmpdepfile"
239 exit $stat
240 fi
241 rm -f "$depfile"
242 # Each line is of the form `foo.o: dependent.h',
243 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
244 # Do two passes, one to just change these to
245 # `$object: dependent.h' and one to simply `dependent.h:'.
246 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
247 # Some versions of the HPUX 10.20 sed can't process this invocation
248 # correctly. Breaking it into two sed invocations is a workaround.
249 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
250 sed -e 's/$/ :/' >> "$depfile"
251 rm -f "$tmpdepfile"
252 ;;
254 tru64)
255 # The Tru64 compiler uses -MD to generate dependencies as a side
256 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
257 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
258 # dependencies in `foo.d' instead, so we check for that too.
259 # Subdirectories are respected.
260 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
261 test "x$dir" = "x$object" && dir=
262 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
264 if test "$libtool" = yes; then
265 tmpdepfile1="$dir.libs/$base.lo.d"
266 tmpdepfile2="$dir.libs/$base.d"
267 "$@" -Wc,-MD
268 else
269 tmpdepfile1="$dir$base.o.d"
270 tmpdepfile2="$dir$base.d"
271 "$@" -MD
272 fi
274 stat=$?
275 if test $stat -eq 0; then :
276 else
277 rm -f "$tmpdepfile1" "$tmpdepfile2"
278 exit $stat
279 fi
281 if test -f "$tmpdepfile1"; then
282 tmpdepfile="$tmpdepfile1"
283 else
284 tmpdepfile="$tmpdepfile2"
285 fi
286 if test -f "$tmpdepfile"; then
287 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
288 # That's a tab and a space in the [].
289 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
290 else
291 echo "#dummy" > "$depfile"
292 fi
293 rm -f "$tmpdepfile"
294 ;;
296 #nosideeffect)
297 # This comment above is used by automake to tell side-effect
298 # dependency tracking mechanisms from slower ones.
300 dashmstdout)
301 # Important note: in order to support this mode, a compiler *must*
302 # always write the preprocessed file to stdout, regardless of -o.
303 "$@" || exit $?
305 # Remove the call to Libtool.
306 if test "$libtool" = yes; then
307 while test $1 != '--mode=compile'; do
308 shift
309 done
310 shift
311 fi
313 # Remove `-o $object'.
314 IFS=" "
315 for arg
316 do
317 case $arg in
318 -o)
319 shift
320 ;;
321 $object)
322 shift
323 ;;
324 *)
325 set fnord "$@" "$arg"
326 shift # fnord
327 shift # $arg
328 ;;
329 esac
330 done
332 test -z "$dashmflag" && dashmflag=-M
333 # Require at least two characters before searching for `:'
334 # in the target name. This is to cope with DOS-style filenames:
335 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
336 "$@" $dashmflag |
337 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
338 rm -f "$depfile"
339 cat < "$tmpdepfile" > "$depfile"
340 tr ' ' '
341 ' < "$tmpdepfile" | \
342 ## Some versions of the HPUX 10.20 sed can't process this invocation
343 ## correctly. Breaking it into two sed invocations is a workaround.
344 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
345 rm -f "$tmpdepfile"
346 ;;
348 dashXmstdout)
349 # This case only exists to satisfy depend.m4. It is never actually
350 # run, as this mode is specially recognized in the preamble.
351 exit 1
352 ;;
354 makedepend)
355 "$@" || exit $?
356 # Remove any Libtool call
357 if test "$libtool" = yes; then
358 while test $1 != '--mode=compile'; do
359 shift
360 done
361 shift
362 fi
363 # X makedepend
364 shift
365 cleared=no
366 for arg in "$@"; do
367 case $cleared in
368 no)
369 set ""; shift
370 cleared=yes ;;
371 esac
372 case "$arg" in
373 -D*|-I*)
374 set fnord "$@" "$arg"; shift ;;
375 # Strip any option that makedepend may not understand. Remove
376 # the object too, otherwise makedepend will parse it as a source file.
377 -*|$object)
378 ;;
379 *)
380 set fnord "$@" "$arg"; shift ;;
381 esac
382 done
383 obj_suffix="`echo $object | sed 's/^.*\././'`"
384 touch "$tmpdepfile"
385 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
386 rm -f "$depfile"
387 cat < "$tmpdepfile" > "$depfile"
388 sed '1,2d' "$tmpdepfile" | tr ' ' '
389 ' | \
390 ## Some versions of the HPUX 10.20 sed can't process this invocation
391 ## correctly. Breaking it into two sed invocations is a workaround.
392 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
393 rm -f "$tmpdepfile" "$tmpdepfile".bak
394 ;;
396 cpp)
397 # Important note: in order to support this mode, a compiler *must*
398 # always write the preprocessed file to stdout.
399 "$@" || exit $?
401 # Remove the call to Libtool.
402 if test "$libtool" = yes; then
403 while test $1 != '--mode=compile'; do
404 shift
405 done
406 shift
407 fi
409 # Remove `-o $object'.
410 IFS=" "
411 for arg
412 do
413 case $arg in
414 -o)
415 shift
416 ;;
417 $object)
418 shift
419 ;;
420 *)
421 set fnord "$@" "$arg"
422 shift # fnord
423 shift # $arg
424 ;;
425 esac
426 done
428 "$@" -E |
429 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
430 sed '$ s: \\$::' > "$tmpdepfile"
431 rm -f "$depfile"
432 echo "$object : \\" > "$depfile"
433 cat < "$tmpdepfile" >> "$depfile"
434 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
435 rm -f "$tmpdepfile"
436 ;;
438 msvisualcpp)
439 # Important note: in order to support this mode, a compiler *must*
440 # always write the preprocessed file to stdout, regardless of -o,
441 # because we must use -o when running libtool.
442 "$@" || exit $?
443 IFS=" "
444 for arg
445 do
446 case "$arg" in
447 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
448 set fnord "$@"
449 shift
450 shift
451 ;;
452 *)
453 set fnord "$@" "$arg"
454 shift
455 shift
456 ;;
457 esac
458 done
459 "$@" -E |
460 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
461 rm -f "$depfile"
462 echo "$object : \\" > "$depfile"
463 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
464 echo " " >> "$depfile"
465 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
466 rm -f "$tmpdepfile"
467 ;;
469 none)
470 exec "$@"
471 ;;
473 *)
474 echo "Unknown depmode $depmode" 1>&2
475 exit 1
476 ;;
477 esac
479 exit 0