s3: Fix a long-standing problem with recycled PIDs
[Samba/nascimento.git] / source4 / heimdal_build / et_compile_wrapper.sh
blobec3b39ff560c2fe530c31ca786b924221450b398
1 #!/bin/sh
4 SELF=$0
5 SELFDIR=`dirname ${SELF}`
7 BUILDDIR=$1
8 DESTDIR=$2
10 CMD=$3
11 FILE=$4
12 SOURCE=$5
13 shift 5
15 test -z "${BUILDDIR}" && {
16 echo "${SELF}:BUILDDIR: '${BUILDDIR}'" >&2;
17 exit 1;
20 test -z "${DESTDIR}" && {
21 echo "${SELF}:DESTDIR: '${DESTDIR}'" >&2;
22 exit 1;
25 test -z "${CMD}" && {
26 echo "${SELF}:CMD: '${CMD}'" >&2;
27 exit 1;
30 test -z "${FILE}" && {
31 echo "${SELF}:FILE: '${FILE}'" >&2;
32 exit 1;
35 test -z "${SOURCE}" && {
36 echo "${SELF}:SOURCE: '${SOURCE}'" >&2;
37 exit 1;
40 CURDIR=`pwd`
42 cd ${BUILDDIR} && {
43 ABS_BUILDDIR=`pwd`
44 cd ${CURDIR}
45 } || {
46 echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2;
47 exit 1;
50 cd ${DESTDIR} && {
51 ${ABS_BUILDDIR}/${CMD} ${FILE} >&2 || exit 1;
52 cd ${CURDIR}
53 TMP="${SOURCE}.$$"
54 mv ${SOURCE} ${TMP} && {
55 echo "#include \"config.h\"" > ${SOURCE} && {
56 cat ${TMP} >> ${SOURCE}
59 rm ${TMP}
60 } || {
61 echo "${SELF}:cannot cd into '${BUILDDIR}'" >&2;
62 exit 1;
65 exit 0;