etc/services - sync with NetBSD-8
[minix.git] / external / bsd / libevent / dist / test / rpcgen_wrapper.sh
blobd2101b05c1d0bfe81e836fe588ba978056db6ce0
1 #!/bin/sh
2 # libevent rpcgen_wrapper.sh
3 # Transforms event_rpcgen.py failure into success for make, only if
4 # regress.gen.c and regress.gen.h already exist in $srcdir. This
5 # is needed for "make distcheck" to pass the read-only $srcdir build,
6 # as with read-only sources fresh from tarball, regress.gen.[ch] will
7 # be correct in $srcdir but unwritable. This previously triggered
8 # Makefile.am to create stub regress.gen.c and regress.gen.h in the
9 # distcheck _build directory, which were then detected as leftover
10 # files in the build tree after distclean, breaking distcheck.
11 # Note that regress.gen.[ch] are not in fresh git clones, making
12 # working Python a requirement for make distcheck of a git tree.
14 exit_updated() {
15 echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h"
16 exit 0
19 exit_reuse() {
20 echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2
21 exit 0
24 exit_failed() {
25 echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2
26 exit 1
29 if [ -x /usr/bin/python2 ] ; then
30 PYTHON2=/usr/bin/python2
31 elif [ "x`which python2`" != x ] ; then
32 PYTHON2=python2
33 else
34 PYTHON2=python
37 srcdir=$1
38 srcdir=${srcdir:-.}
39 ${PYTHON2} ${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc
40 case "$?" in
42 exit_updated
45 test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \
46 exit_reuse
47 exit_failed
49 esac