]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/openpam/pamgdb.in
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / openpam / pamgdb.in
1 #!/bin/sh
2 #
3 # $Id: pamgdb.in 583 2012-04-07 18:56:13Z des $
4 #
5
6 srcdir="@abs_top_srcdir@"
7 builddir="@abs_top_builddir@"
8
9 # Make sure we get the right version of libpam
10 pam_libdir="${builddir}/lib/.libs"
11 LD_LIBRARY_PATH="${pam_libdir}:${LD_LIBRARY_PATH}"
12 LD_LIBRARY_PATH="${LD_LIBRARY_PATH%:}"
13 export LD_LIBRARY_PATH
14
15 # DWIM, assuming that the first positional argument is the name of the
16 # program to debug rather than a gdb option.
17 prog="$1"
18 if expr "${prog}" : ".*/.*" >/dev/null ; then
19         # The first argument is an absolute or relative path.  There
20         # is a good chance that it points to the wrapper script
21         # generated by libtool rather than the actual binary.
22         altprog="${prog%/*}/.libs/${prog##*/}"
23         if [ -x "${altprog}" ] ; then
24                 shift
25                 set "${altprog}" "$@"
26         fi
27 elif expr "${prog}" : "[a-z.-][a-z.-]*" >/dev/null ; then
28         # The first argument is just the name of the program.  Look for
29         # it in the build directory.
30         for libdir in $(find "${builddir}" -type d -name .libs -print) ; do
31                 altprog="${libdir}/${prog}"
32                 if [ -x "${altprog}" ] ; then
33                         shift
34                         set "${altprog}" "$@"
35                         break
36                 fi
37         done
38 fi
39
40 # Let's go!
41 exec gdb "$@"