summaryrefslogtreecommitdiffstats
path: root/run-stap.in
blob: 8b150ececf3ee09f9975ee8b2f9b412de1175007 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

srcdir='@abs_top_srcdir@'
builddir='@abs_top_builddir@'

rundir="${0%/*}"
[ "$rundir" == "$0" ] || builddir="$rundir"

# Absolutify the paths.
case "$srcdir" in
/*) ;;
*) srcdir=`cd "$srcdir" && pwd` || exit ;;
esac
case "$builddir" in
/*) ;;
*) builddir=`cd "$builddir" && pwd` || exit ;;
esac

# Set all the variables to find the source and build trees.
SYSTEMTAP_TAPSET="${srcdir}/tapset"
SYSTEMTAP_RUNTIME="${srcdir}/runtime"
SYSTEMTAP_STAPRUN="${builddir}/run-staprun"
export SYSTEMTAP_TAPSET SYSTEMTAP_RUNTIME SYSTEMTAP_STAPRUN

# If there were private elfutils libs built, use them.
if [ -d "$rundir/lib-elfutils" ]; then
  lib_elfutils="$rundir/lib-elfutils"
  elfutils_path="${lib_elfutils}:${lib_elfutils}/systemtap"
  LD_LIBRARY_PATH="${elfutils_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
  export LD_LIBRARY_PATH
fi

exec "${builddir}/stap" ${1+"$@"}