| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
# SCRIPT: maketest
|
| 4 |
# Builds the test program for the hashing routines
|
| 5 |
# Usage: maketest
|
| 6 |
|
| 7 |
# Set DB2PATH to where DB2 will be accessed.
|
| 8 |
# The default is the standard instance path.
|
| 9 |
# Set APRPATH to where apr-1-config and apu-1-config are located
|
| 10 |
|
| 11 |
OS=`uname`
|
| 12 |
|
| 13 |
#Default paths for Linux, AIX and Darwin
|
| 14 |
|
| 15 |
if [ "$OS" == "AIX" -o "$OS" == "Linux" ]
|
| 16 |
then
|
| 17 |
DB2PATH=/home/db2inst1/sqllib
|
| 18 |
APRPATH=/usr/local/apache/bin
|
| 19 |
APUPATH=$APRPATH
|
| 20 |
elif [ "$OS" == "Darwin" ]
|
| 21 |
then
|
| 22 |
DB2PATH=/Users/db2inst1/sqllib
|
| 23 |
APRPATH=/usr/bin
|
| 24 |
APUPATH=/usr/bin
|
| 25 |
fi
|
| 26 |
|
| 27 |
# Uncomment the next 3 lines, if you set the paths manually
|
| 28 |
#DB2PATH=
|
| 29 |
#APRPATH=
|
| 30 |
#APUPATH=
|
| 31 |
|
| 32 |
APR_FLAGS="`$APRPATH/apr-1-config --cppflags --includes --libs --link-ld`"
|
| 33 |
APU_FLAGS="`$APUPATH/apu-1-config --link-ld --libs`"
|
| 34 |
|
| 35 |
# Set the runtime path since routines run as setuid.
|
| 36 |
if [ "`uname`" = "AIX" ]
|
| 37 |
then
|
| 38 |
EXTRA_LFLAG="-Wl,-G,-blibpath:$DB2PATH/lib"
|
| 39 |
else
|
| 40 |
EXTRA_LFLAG="-Wl,-rpath,$DB2PATH/lib"
|
| 41 |
fi
|
| 42 |
|
| 43 |
# additional flags for Darwin
|
| 44 |
if [ "$OS" == "Darwin" ]
|
| 45 |
then
|
| 46 |
D_C_FLAGS="-arch x86_64"
|
| 47 |
D_L_FLAGS="-arch x86_64 -dynamiclib"
|
| 48 |
fi
|
| 49 |
|
| 50 |
# Compile the program.
|
| 51 |
gcc -o test_hash test_hash.c -L$DB2PATH/lib -ldb2 $APR_FLAGS $APU_FLAGS $D_C_FLAGS
|