forked from tgulacsi/goracle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env
executable file
·36 lines (34 loc) · 922 Bytes
/
env
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
#!/bin/sh
cdir=
ldir=
if [ -z "$ORACLE_HOME" ]; then
nm=$(find /usr/lib/oracle /u01/app/oracle/product -name 'oracle_env.sh' \
-type f 2>/dev/null | head -n1)
if [ -n "$nm" ]; then
. $nm
fi
echo "export ORACLE_HOME=$ORACLE_HOME"
fi
if [ -n "$CGO_CFLAGS" ] || [ -n "$CGO_LDFLAGS" ]; then
echo "CGO_CFLAGS and CGO_LDFLAGS already set"
return
fi
for bdn in /usr/include $ORACLE_HOME; do
cdir=$(find $bdn -type f -name oci.h 2>/dev/null | head -n1)
if [ -n "$cdir" ]; then
cdir=$(dirname $cdir)
break
fi
done
for bdn in /usr/lib $ORACLE_HOME; do
ldir=$(find $bdn -type f -name libclntsh.so\* 2>/dev/null | head -n1)
if [ -n "$ldir" ]; then
ldir=$(dirname $ldir)
break
fi
done
echo "cdir=$cdir ldir=$ldir"
export CGO_CFLAGS=-I$cdir
export CGO_LDFLAGS=-L$ldir
echo "export CGO_CFLAGS=$CGO_CFLAGS"
echo "export CGO_LDFLAGS=$CGO_LDFLAGS"