#!/bin/sh - # # $Id$ # # Check to make sure the auto-generated utility code in the VxWorks build # directory compiles. d=../.. [ -f $d/LICENSE ] || { echo 'FAIL: Test must be run from scr directory.' exit 1 } b=./tmp_build/ s=$d/src progname=MAIN.c mkdir -p $b opts="--disable-shared" echo "Building DB library, this can take a while." (cd $b && ../../configure $opts > /dev/null && make libdb.a > /dev/null) || { echo 'FAIL: unable to build libdb.a' exit 1 } F="$d/src/clib/getopt.c $d/src/common/util_arg.c $d/src/common/util_cache.c $d/src/common/util_log.c $d/src/common/util_sig.c $d/src/*/*_autop.c" # Added the following lines to enable compiling on Linux Blade server. L=" -D_GNU_SOURCE -lpthread" header() { echo "int $1(int, char *[]);" echo "int" echo "main(int argc, char *argv[])" echo "{return ($1(argc, argv));}" } LIST="\ dbdemo \ test/micro \ util" SYMBOL_LIST=`echo $LIST | sed -e 's,/,_,g' -e 's,util,db_archive,'` # Build each program individually. for i in $LIST; do echo " compiling Vxworks version of $i" header `echo $i | sed -e 's,/,_,g' -e 's,util,db_archive,'` > $progname if cc -Wall -I$b -I$s -I$d/build_vxworks/$i $L \ $d/build_vxworks/$i/*.c $progname $F $b/libdb.a -o t; then : else echo "FAIL: unable to compile VxWorks version of $i" exit 1 fi done # Build all of the programs as one big binary. inc=`echo $LIST | sed 's/[^ ][^ ]*/-I$d\/build_vxworks\/&/g'` src=`echo $LIST | sed 's/[^ ][^ ]*/$d\/build_vxworks\/&\/*.c/g'` ( for i in $SYMBOL_LIST; do echo "int ${i}_main(int, char *[]);" done echo "int" echo "main(int argc, char *argv[])" echo "{" echo "int r;" for i in $SYMBOL_LIST; do echo "r += ${i}_main(argc, argv);" done echo "return (r);" echo "}" ) > $progname echo " compiling VxWorks utility composite" if cc -Wall -I$b -I$s $inc $L `eval ls $src` $progname $F $b/libdb.a -o t; then : else echo 'FAIL: unable to compile VxWorks utility composite' exit 1 fi rm -rf ./t $b $progname exit 0