configure.tokutek 1.33 KB
Newer Older
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
#!/bin/bash

# create the Makefile from the Makefile.tokutek template and some
# command line parameters

tokudb=/usr/local/tokudb
mysql=/usr/local/mysql
libdir=/usr/local/mysql/lib

while [ $# -gt 0 ] ; do
    arg=$1; shift
    if [[ $arg =~ "--with-tokudb=(.*)" ]] ; then
	tokudb=${BASH_REMATCH[1]}
    fi
    if [[ $arg =~ "--with-mysql=(.*)" ]] ; then
        mysql=${BASH_REMATCH[1]}
    fi
    if [[ $arg =~ "--libdir=(.*)" ]] ; then
        libdir=${BASH_REMATCH[1]}
    fi
done

error=0
if [ ! -d $tokudb ] ; then
    echo $tokudb missing
    # error=1
fi
if [ ! -d $mysql ] ; then
    echo $mysql missing
    error=1
fi
if [ ! -d $libdir ] ; then
    echo $libdir missing
    error=1
fi
if [ $error -ne 0 ] ; then exit 1 ; fi

38
tokudb_version=`basename $tokudb`
39 40 41 42 43 44 45 46 47 48 49
# escape the path names so that the sed works
# note: i was not smart enough to get this right without a sequence of experiments
tokudb=`echo $tokudb | sed -e s/\\\//\\\\\\\\\\\//g`
# echo $tokudb
mysql=`echo $mysql | sed -e s/\\\//\\\\\\\\\\\//g`
# echo $mysql
libdir=`echo $libdir | sed -e s/\\\//\\\\\\\\\\\//g`
# echo $libdir

sed -e "s/^TOKUDB =\(.*\)$/TOKUDB = $tokudb/" \
    -e "s/^MYSQL_SRC = \(.*\)/MYSQL_SRC = $mysql/" \
50 51
    -e "s/^MYSQL_LIBDIR = \(.*\)/MYSQL_LIBDIR = $libdir/" \
    -e "s/^TOKUDB_VERSION =\(.*\)/TOKUDB_VERSION = \"$tokudb_version\"/" <Makefile.tokutek >Makefile