Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 141 lines (125 sloc) 3.438 kb
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
#!/bin/sh

usage() {
prog=$1
cat << _EOF
${prog} [<options>]

<options> can be one of the following:

--prefix=<val> The installation prefix (default: /usr).
--enable-debug Enable debug mode compilation (default: disabled).
--disable-allocator Disable use of internal memory allocator mechanism (default: enabled).
--enable-debug-stats Enable printing of some verbose debug info (default: disabled).
--with-libbsc=<path_to_libbsc_source>
Enable support for libbsc (See: libbsc.com). Full path to the libbsc
source tree must be provided. It links the library statically.
--help Display this help message.

_EOF
}

arg1=$1
debug=0
allocator=1
debug_stats=0
prefix=/usr
libbsc_dir=
libbsc_lib=
libbsclflags=
libbscwrapobj=
libbscgenopt=
libbsccppflags=

while [ "${arg1}" != "" ]
do
case "$arg1" in
--enable-debug) debug=1;;
--disable-allocator) allocator=0;;
--enable-debug-stats) debug_stats=1;;
--prefix=*)
pval=`echo ${arg1} | cut -f2 -d"="`
prefix=$pval
;;
--with-libbsc=*)
path=`echo ${arg1} | cut -f2 -d"="`
if [ -f ${path}/bsc.cpp -a -f ${path}/libbsc/libbsc.h ]
then
libbsc_dir="${path}"
libbsc_lib="${path}/libbsc.a"
libbsclflags='\$\(LIBBSCLFLAGS\)'
libbscwrapobj='\$\(LIBBSCWRAPOBJ\)'
libbscgenopt='\$\(LIBBSCGEN_OPT\)'
libbsccppflags='\$\(LIBBSCCPPFLAGS\)'
else
echo "Libbsc not found in ${path}, not enabling libbsc support.\n"
fi
;;
--help) usage $0;;
*)
echo "Unrecognized option: ${arg1}"
exit 1
;;
esac
shift
arg1=$1
done

if [ $debug -eq 1 ]
then
typ="DEBUG"
else
typ="RELEASE"
fi

OS=$(uname)
skeinblock='\$\(SKEIN_BLOCK_C\)'
if [ "$OS" = "Linux" ]
then
plat=$(uname -r)
elif [ "$OS" = "SunOS" ]
then
plat=$(isainfo -v)
else
echo "Unsupported OS: $OS"
exit 1
fi

echo $plat | egrep 'x86_64|amd64' > /dev/null
if [ $? -eq 0 ]
then
skeinblock='\$\(SKEIN_BLOCK_ASM\)'
fi

linkvar="LINK"
compilevar="COMPILE"
compilecppvar="COMPILE_cpp"
vecflagsvar="VEC_FLAGS"
loopoptflagsvar="LOOP_OPTFLAGS"
cppflagsvar="CPPFLAGS"
genoptvar="GEN_OPT"
rabinoptvar="RABIN_OPT"
noslabcppflagsvar="NO_SLAB_CPPFLAGS"
debugstatscppflagsvar="DEBUG_STATS_CPPFLAGS"
prefixvar="PREFIX"
skeinblockvar="SKEIN_BLOCK"

libbscdirvar="LIBBSCDIR"
libbsclibvar="LIBBSCLIB"
libbsclflagsvar="LIBBSCLFLAGS"
libbscwrapobjvar="LIBBSCWRAPOBJ"
libbscgenoptvar="LIBBSCGEN_OPT"
libbsccppflagsvar="LIBBSCCPPFLAGS"

noslabcppflagsval=
debugstatscppflagsval=

[ $allocator -eq 0 ] && noslabcppflagsval='\$\(NO_SLAB_CPPFLAGS\)'
[ $debug_stats -eq 1 ] && debugstatscppflagsval='\$\(DEBUG_STATS_CPPFLAGS\)'

cat Makefile.in | sed "
s#@${linkvar}@#\\\$\\(${typ}_${linkvar}\\)#g
s#@${compilevar}@#\\\$\\(${typ}_${compilevar}\\)#g
s#@${compilecppvar}@#\\\$\\(${typ}_${compilecppvar}\\)#g
s#@${vecflagsvar}@#\\\$\\(${typ}_${vecflagsvar}\\)#g
s#@${loopoptflagsvar}@#\\\$\\(${typ}_${loopoptflagsvar}\\)#g
s#@${cppflagsvar}@#\\\$\\(${typ}_${cppflagsvar}\\)#g
s#@${genoptvar}@#\\\$\\(${typ}_${genoptvar}\\)#g
s#@${rabinoptvar}@#\\\$\\(${typ}_${rabinoptvar}\\)#g
s#@${noslabcppflagsvar}@#${noslabcppflagsval}#g
s#@${debugstatscppflagsvar}@#${debugstatscppflagsval}#g
s#@${prefixvar}@#${prefix}#g
s#@${libbscdirvar}@#${libbsc_dir}#g
s#@${libbsclibvar}@#${libbsc_lib}#g
s#@${libbsclflagsvar}@#${libbsclflags}#g
s#@${libbscwrapobjvar}@#${libbscwrapobj}#g
s#@${libbscgenoptvar}@#${libbscgenopt}#g
s#@${libbsccppflagsvar}@#${libbsccppflags}#g
s#@${skeinblockvar}@#${skeinblock}#g
" > Makefile

Something went wrong with that request. Please try again.