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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/bin/sh
set -x
dilibd=""
pcarg="di"
if [ $# -gt 0 ]; then
dilibd=$1
if [ -d ${dilibd}/lib ]; then
dilibd=${dilibd}/lib
fi
if [ -d ${dilibd}/lib64 ]; then
dilibd=${dilibd}/lib64
fi
if [ -d ${dilibd}/pkgconfig ]; then
pcpath=${dilibd}/pkgconfig
pcarg=${pcpath}/di.pc
fi
fi
if [ "$CC" = "" ]; then
CC=cc
fi
diinc=`pkg-config --cflags ${pcarg}`
rc=$?
if [ $rc -ne 0 ]; then
exit 2
fi
if [ "$dilibd" = "" ]; then
dilibd=`pkg-config --libs-only-L ${pcarg}`
dilibd=`echo ${dilibd} | sed -e 's,^-L,,'`
fi
dilibs=`pkg-config --libs ${pcarg}`
rc=$?
if [ $rc -ne 0 ]; then
exit 2
fi
systype=`uname -s`
case ${systype} in
SunOS|NetBSD)
libargs="-Wl,-R${dilibd}"
;;
Darwin|Linux)
libargs="-Wl,-rpath,${dilibd}"
;;
esac
${CC} -o diex ${diinc} diex.c ${libargs} ${dilibs}
rc=$?
exit $rc
|