darshan-config.in 1.51 KB
Newer Older
Philip Carns's avatar
Philip Carns committed
1
2
3
#!/bin/sh

DARSHAN_LIB_PATH="@darshan_lib_path@"
4
DARSHAN_SHARE_PATH="@darshan_share_path@"
Philip Carns's avatar
Philip Carns committed
5
6
DARSHAN_LD_FLAGS="@LDFLAGS@"

7
# NOTE:
8
9
10
11
12
# - we deliberately list libdarshan twice in the link command when
#   statically linking.  The first sets symbol wrapping options early in the
#   link line. The final one is necessary to give the linker a change to
#   resolve indirect dependencies on PnetCDF and HDF5 symbols (if the
#   app used a library which in turn used one of those HLLs).
13

14
PRE_LD_FLAGS="-L$DARSHAN_LIB_PATH $DARSHAN_LD_FLAGS -ldarshan -lz -Wl,@$DARSHAN_SHARE_PATH/ld-opts/darshan-base-ld-opts"
15
POST_LD_FLAGS="-L$DARSHAN_LIB_PATH -ldarshan -lz -lrt -lpthread"
Philip Carns's avatar
Philip Carns committed
16

17
18
19
20
21
22
# NOTE:
# - when dynamic linking there is no need for wrapping options, we simply
#   need to get the darshan symbol definitions early enough in the link
#   order.  We also set no-as-needed for linkers that may not identify
DYN_LD_FLAGS="-L$DARSHAN_LIB_PATH $DARSHAN_LD_FLAGS -Wl,-rpath=$DARSHAN_LIB_PATH $DARSHAN_LD_FLAGS -Wl,-no-as-needed -ldarshan"

Philip Carns's avatar
Philip Carns committed
23
usage="\
24
Usage: darshan-config [--pre-ld-flags] [--post-ld-flags] [--dyn-ld-flags]"
Philip Carns's avatar
Philip Carns committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

if test $# -eq 0; then
      echo "${usage}" 1>&2
      exit 1
fi

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --pre-ld-flags)
      echo $PRE_LD_FLAGS
      ;;
    --post-ld-flags)
      echo $POST_LD_FLAGS
      ;;
44
45
46
    --dyn-ld-flags)
      echo $DYN_LD_FLAGS
      ;;
Philip Carns's avatar
Philip Carns committed
47
48
49
50
51
52
53
    *)
      echo "${usage}" 1>&2
      exit 1
      ;;
  esac
  shift
done