Skip to content

Commit 3464e90

Browse files
committed
Reduce duplicated code
1 parent 89b2990 commit 3464e90

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/configure

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# ./configure --use-cuda=no # disable CUDA detection (will build cpu-only
2424
# # version of kaldi even on CUDA-enabled machine
2525
# ./configure --use-cuda --cudatk-dir=/usr/local/cuda/ --cuda-arch=-arch=sm_70
26-
# # Use cuda in /usr/local/cuda and set the arch to -sm_70
26+
# # Use cuda in /usr/local/cuda and set the arch to sm_70
2727
# ./configure --static --fst-root=/opt/cross/armv8hf \
2828
# --atlas-root=/opt/cross/armv8hf --host=armv8-rpi3-linux-gnueabihf
2929
# # Cross compile for armv8hf, this assumes that you have openfst built
@@ -117,18 +117,18 @@ function rel2abs {
117117
fi
118118
}
119119

120+
function read_value {
121+
local val=`expr "X$1" : '[^=]*=\(.*\)'`;
122+
echo $val
123+
}
124+
120125
function read_dirname {
121-
local dir_name=`expr "X$1" : '[^=]*=\(.*\)'`;
126+
local dir_name=`read_value $1`
122127
local retval=`rel2abs $dir_name`
123128
[ -z $retval ] && echo "Bad option '$1': no such directory" && exit 1;
124129
echo $retval
125130
}
126131

127-
function read_value {
128-
local val=`expr "X$1" : '[^=]*=\(.*\)'`;
129-
echo $val
130-
}
131-
132132
function is_set {
133133
local myvar=${1:-notset}
134134
if [ "$myvar" == "notset" ]; then
@@ -949,7 +949,7 @@ do
949949
mkl_threading=sequential;
950950
shift ;;
951951
--mkl-threading=*)
952-
mkl_threading=`expr "X$1" : '[^=]*=\(.*\)'`;
952+
mkl_threading=`read_value $1`;
953953
threaded_atlas=true;
954954
shift ;;
955955
--fst-root=*)
@@ -980,7 +980,7 @@ do
980980
OMPLIBDIR=`read_dirname $1`;
981981
shift ;;
982982
--mathlib=*)
983-
MATHLIB=`expr "X$1" : '[^=]*=\(.*\)'`;
983+
MATHLIB=`read_value $1`;
984984
shift ;;
985985
--cudatk-dir=*)
986986
CUDATKDIR=`read_dirname $1`;
@@ -989,13 +989,13 @@ do
989989
CUDA_ARCH=`read_value $1`;
990990
shift;;
991991
--fst-version=*)
992-
OPENFST_VER=`expr "X$1" : '[^=]*=\(.*\)'`;
992+
OPENFST_VER=`read_value $1`;
993993
shift;;
994994
--host=*)
995995
# The type of system where built programs and libraries will run.
996996
# It should be in the format cpu-vendor-os. If specified, this script
997997
# will infer the target architecture from the specified host triple.
998-
HOST=`expr "X$1" : '[^=]*=\(.*\)'`;
998+
HOST=`read_value $1`;
999999
shift ;;
10001000
--android-incdir=*)
10011001
android=true;

0 commit comments

Comments
 (0)