  fi
  echo "CONFIGURE_VERSION := $CONFIGURE_VERSION" >> kaldi.mk
 -echo "FSTROOT = $FSTROOT" >> kaldi.mk
-+# echo "FSTROOT = $FSTROOT" >> kaldi.mk
- 
- # Check installed OpenFst version and add C++11 flags if OpenFst >= 1.4
+-
+-# Check installed OpenFst version and add C++11 flags if OpenFst >= 1.4
 -OPENFST_VER="${OPENFST_VER:-`grep 'PACKAGE_VERSION' $FSTROOT/Makefile | sed -e 's:.*= ::'`}"
 -echo "OPENFST_VER = $OPENFST_VER" >> kaldi.mk
 -OPENFST_VER_NUM=`echo $OPENFST_VER | sed 's/\./ /g' | xargs printf "%d%02d%02d"`

 
 ifndef OPENBLASLIBS
 $(error OPENBLASLIBS not defined.)
@@ -20,7 +20,6 @@ CXXFLAGS = -msse -msse2 -Wall -I.. \
       -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self \
       -DHAVE_EXECINFO_H=1 -rdynamic -DHAVE_CXXABI_H \
       -DHAVE_OPENBLAS -I $(OPENBLASROOT)/include \
-      -I $(FSTROOT)/include \
       $(EXTRA_CXXFLAGS) \
       -g # -O0 -DKALDI_PARANOID 
 
@@ -28,8 +27,8 @@ ifeq ($(KALDI_FLAVOR), dynamic)
 CXXFLAGS += -fPIC
 endif
 

 dynamic_kaldi=false
 mkl_threading=sequential
 
@@ -186,11 +181,6 @@ do
   esac
 done
 
-# the idea here is that if you change the configuration options from using
-# CUDA to not using it, or vice versa, we want to recompile all parts of the
-# code that may use a GPU.  Touching this file is a way to force this.
-touch cudamatrix/cu-common.h 2>/dev/null
-
 function failure {
   echo "***configure failed: $* ***" >&2
   if [ -f kaldi.mk ]; then rm kaldi.mk; fi
@@ -235,8 +225,6 @@ function exit_success {
   exit 0;
 }
 
-
-
 function check_library {
   local libpath=$1
   local libname=$2
@@ -247,266 +235,8 @@ function check_library {
   return 1
 }
 
-
-
-#Check if at least one of these variables is set
-#If yes, we want to switch to using the MKL
-is_set $MKLLIBDIR && echo "Force-configuring KALDI to use MKL" && export MATHLIB="MKL"
-is_set $MKLROOT && echo "Force-configuring KALDI to use MKL"&& export MATHLIB="MKL"
-is_set $CLAPACKROOT && echo "Force-configuring KALDI to use CLAPACK"&& export MATHLIB="CLAPACK"
 is_set $OPENBLASROOT && echo "Force-configuring KALDI to use OPENBLAS"&& export MATHLIB="OPENBLAS"
 
-#MKL functions
-function linux_configure_mkllibdir {
-  local mklroot=$1
-
-  if [ -d $mklroot/lib/em64t ]; then
-    echo $mklroot/lib/em64t
-  elif [ -d $mklroot/lib/intel64 ]; then
-    echo $mklroot/lib/intel64
-  else
-    return 1;
-  fi
-}
-
-function linux_configure_mkl_includes {
-  test -d $1/include && echo "$1/include" && return;
-  test -d $2/../../include && echo "$2/../../include" && return;
-  failure "Could not find the MKL include directory"
-}
-
-
-function linux_configure_mkl_libraries {
-  local mkllibdir=$1
-  local static=$2
-  local threaded=$3
-  local mplib=$4
-
-  declare -A mkl_libs
-  mkl_libs=(
-    [sequential]="mkl_intel_lp64 mkl_core mkl_sequential"
-    [gomp]="mkl_intel_lp64 mkl_core mkl_gnu_thread"
-    [iomp]="mkl_intel_lp64 mkl_core mkl_intel_thread "
-    [tbb]="mkl_intel_lp64 mkl_core mkl_tbb_thread "
-  )
-
-  if [ -z "${mkl_libs[$threaded]}" ]; then
-    echo >&2 "Unknown threading mode: $threaded"
-    return 1;
-  fi
-
-  local linkline=""
-  if  ! $static ; then
-    linkline="-L$mkllibdir -Wl,-rpath=$mkllibdir"
-    for file in ${mkl_libs[$threaded]}; do
-      local libfile=$mkllibdir/lib$file.so
-      check_exists $libfile
-      linkline+=" -l$file "
-    done
-  else
-    if [ $threaded == "sequential" ] ; then
-      test -f "$mkllibdir/libmkl_solver_lp64.a" && \
-        linkline="$linkline $mkllibdir/libmkl_solver_lp64.a"
-    else
-      test -f "$mkllibdir/libmkl_solver_lp64_sequential.a" && \
-        linkline="$linkline $mkllibdir/libmkl_solver_lp64_sequential.a"
-    fi
-    linkline="$linkline -Wl,--start-group"
-    for file in ${mkl_libs[$threaded]}; do
-      local libfile=$mkllibdir/lib${file}.a
-      check_exists $libfile
-      linkline="$linkline $libfile"
-    done
-    linkline="$linkline -Wl,--end-group "
-  fi
-  echo "$linkline"
-}
-
-function linux_configure_mkl_extra {
-  local static=$1
-  local threaded=$2
-
-  declare -A extra_libs
-  extra_libs=(
-    [sequential]="-lpthread -lm"
-    [gomp]="-lgomp -ldl -lpthread -lm"
-    [iomp]="-ldl -lpthread -lm"
-    [tbb]=" -ldl -lpthread -lm "
-  )
-  echo "$linkline ${extra_libs[$threaded]}"
-}
-
-function linux_configure_threadinglibdir {
-  local library=$1
-  local mklroot=$2
-  local mkllibdir=$3
-  local libexts=$4
-
-  ##First we try to use the library in the same directory
-  ##where the mkl libraries reside
-  ##Afterwards, just try some possibilities for different MKL layouts
-  for libext in $libexts; do
-    check_library $mkllibdir "lib$library" $libext \
-    && echo `readlink -f $mkllibdir` && return 0
-
-    local testdir=`(cd $mklroot; cd ..; cd lib/intel64;pwd)`
-    test -d $testdir && check_library $testdir "lib$library" $libext && echo `readlink -f $testdir` && return 0;
-    local testdir=`(cd $mklroot; cd ..; cd lib/em64t;pwd)`
-    test -d $testdir && check_library $testdir "lib$library" $libext && echo `readlink -f $testdir` && return 0;
-
-    local testdir=`(cd $mkllibdir; cd ../../..; cd lib/intel64;pwd)`
-    test -d $testdir && check_library $testdir "lib$library" $libext && echo `readlink -f $testdir` && return 0;
-    local testdir=`(cd $mklroot; cd ../../..; cd lib/em64t;pwd)`
-    test -d $testdir && check_library $testdir "lib$library" $libext && echo `readlink -f $testdir` && return 0;
-  done
-
-  #failure "Could not find the library iomp5, use the configure switch --omp-libdir"
-  return 1
-}
-
-function linux_configure_mkl_threading {
-  local mklroot=$1
-  local mkllibdir=$2
-  local static=$3
-  local threading=$4
-
-  declare -A libs
-  libs=(
-    [sequential]=""
-    [gomp]=""
-    [iomp]="iomp5"
-    [tbb]="tbb"
-  )
-
-  echo >&2 "Configuring MKL threading as $threading"
-  library=${libs[$threading]}
-  if [ -z "$library" ]; then
-    return 0
-  fi
-
-  if ! is_set $OMPLIBDIR ; then
-    if  $static ; then
-      OMPLIBDIR=`linux_configure_threadinglibdir $library "$MKLROOT" "$MKLLIBDIR" "a"`
-    else
-      OMPLIBDIR=`linux_configure_threadinglibdir $library "$MKLROOT" "$MKLLIBDIR" "so"`
-    fi
-  fi
-
-  check_library $OMPLIBDIR "lib$library" "a" || \
-  check_library $OMPLIBDIR "lib$library" "so" || \
-  failure "Could not find the $library library, have your tried the --omp-libdir switch?"
-
-  OMP_LINK_LINE=''
-  # TODO(arnab): in the following conditional, the $static_math test is
-  # needed since the OpenMP library is assumed to be dynamic.
-  if [ "$OMPLIBDIR" != "$MKLLIBDIR" ] ; then
-    OMP_LINK_LINE="-L${OMPLIBDIR}"
-  fi
-  #if the libiomp5 library is dynamic, we add the rpath attribute
-  if ! $static_math ; then
-    OMP_LINK_LINE="$OMP_LINK_LINE -Wl,-rpath=$OMPLIBDIR -l$library"
-  else
-    OMP_LINK_LINE="$OMP_LINK_LINE -Wl,-Bstatic -l$library -Wl,-Bdynamic"
-  fi
-  echo "$OMP_LINK_LINE"
-}
-
-##
-## CUDA is used only in selected directories including src/cudamatrix, src/nnet*
-## and src/chain*.  It is used to accelerate the neural network training, the
-## rest of kaldi runs on CPUs.
-##
-function configure_cuda {
-  #check for CUDA toolkit in the system
-  if [ ! -d  "$CUDATKDIR" ]; then
-    for base in /Developer/NVIDIA/CUDA-6.0 /usr/local/share/cuda /usr/local/cuda /pkgs_local/cuda-3.2/ /opt/nvidia_cuda/cuda-6.0/ /usr/; do
-      if [ -f $base/bin/nvcc ]; then
-        CUDATKDIR=$base
-      fi
-    done
-  fi
-
-  if [ -d "$CUDATKDIR" ]; then
-    if [ ! -f $CUDATKDIR/bin/nvcc ]; then
-      failure "Cannnot find nvcc in CUDATKDIR=$CUDATKDIR"
-    fi
-    echo "Using CUDA toolkit $CUDATKDIR (nvcc compiler and runtime libraries)"
-    echo >> kaldi.mk
-    echo "#Next section enables CUDA for compilation" >> kaldi.mk
-    echo CUDA = true >> kaldi.mk
-    echo CUDATKDIR = $CUDATKDIR >> kaldi.mk
-
-    # Determine 'CUDA_ARCH',
-    CUDA_VERSION=$($CUDATKDIR/bin/nvcc -V | tr '.,' '_ ' | awk '/release/{sub(/.*release/,""); print $1;}') # MAJOR_MINOR,
-    if [ -z "$CUDA_VERSION" ] ; then
-      echo "Cannot figure out CUDA_VERSION from the nvcc output. Either your CUDA is too new or too old."
-      exit 1
-    fi
-
-    case $CUDA_VERSION in
-      5_5) CUDA_ARCH="-gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35" ;;
-      6_*) CUDA_ARCH="-gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50" ;;
-      7_*) CUDA_ARCH="-gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53" ;;
-      *) echo "Unsupported CUDA_VERSION (CUDA_VERSION=$CUDA_VERSION), please report it to Kaldi mailing list, together with 'nvcc -h' or 'ptxas -h' which lists allowed -gencode values..."; exit 1 ;;
-    esac
-    echo "CUDA_ARCH = $CUDA_ARCH" >> kaldi.mk
-
-    # 64bit/32bit?
-    if [ "`uname -m`" == "x86_64" ]; then
-      if [ "`uname`" == "Darwin" ]; then
-        sed 's/lib64/lib/g' < makefiles/cuda_64bit.mk >> kaldi.mk
-      else
-        cat makefiles/cuda_64bit.mk >> kaldi.mk
-      fi
-    else
-      cat makefiles/cuda_32bit.mk >> kaldi.mk
-    fi
-
-  else
-    echo "CUDA will not be used! If you have already installed cuda drivers "
-    echo "and cuda toolkit, try using --cudatk-dir=... option.  Note: this is"
-    echo "only relevant for neural net experiments"
-  fi
-}
-
-function linux_configure_speex {
-  #check whether the user has called tools/extras/install_speex.sh or not
-  [ ! -z "$SPEEXROOT" ] || SPEEXROOT=`pwd`/../tools/speex
-  [ ! -z "$SPEEXLIBDIR" ] || SPEEXLIBDIR="$SPEEXROOT"/lib
-  [ ! -z "$SPEEXINCLUDEDIR" ] || SPEEXINCLUDEDIR="$SPEEXROOT"/include
-  static_speex=$1
-  if [ "foo"$static_speex == "foo" ]; then
-    static_speex=false
-  fi
-
-  if $static_speex; then
-    spx_type=a
-  else
-    spx_type=so
-  fi
-  if [ ! -f "$SPEEXLIBDIR/libspeex.${spx_type}" ];then
-    echo "Info: configuring Kaldi not to link with Speex (don't worry, it's only needed if you"
-    echo "intend to use 'compress-uncompress-speex', which is very unlikely)"
-    return
-  fi
-
-  if [ -f $SPEEXINCLUDEDIR/speex/speex.h ]; then
-    echo >> kaldi.mk
-    echo CXXFLAGS += -DHAVE_SPEEX -I${SPEEXINCLUDEDIR} >> kaldi.mk
-
-    if $static_speex; then
-      echo LDLIBS += $SPEEXLIBDIR/libspeex.a
-    else
-      echo LDLIBS += -L${SPEEXLIBDIR} -lspeex >> kaldi.mk
-      echo LDFLAGS += -Wl,-rpath=${SPEEXLIBDIR} >> kaldi.mk
-    fi
-
-    echo "Successfully configured with Speex at $SPEEXROOT, (static=[$static_speex])"
-  else
-    echo "Speex will not be used. If you want to use it, run tools/extras/install_speex.sh first."
-  fi
-}
-
 function fix_cxx_flag {
   CXXCOMPILER=`grep "CXX = " kaldi.mk | awk '{print $3}'`
   if [ $CXXCOMPILER=="g++" ]; then
@@ -516,282 +246,6 @@ function fix_cxx_flag {
   fi
 }
 
-function linux_atlas_failure { # function we use when we couldn't find
-   # ATLAS libs.
-   echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-   echo ATLASLIBS = [somewhere]/liblapack.a [somewhere]/libcblas.a [somewhere]/libatlas.a [somewhere]/libf77blas.a $ATLASLIBDIR >> kaldi.mk
-   cat makefiles/linux_atlas.mk >> kaldi.mk
-   fix_cxx_flag
-   echo "** $* ***"
-   echo "**  ERROR   **"
-   echo "** Configure cannot proceed automatically."
-   echo "**  If you know that you have ATLAS installed somewhere on your machine, you"
-   echo "** may be able to proceed by replacing [somewhere] in kaldi.mk with a directory."
-   echo "**  If you have sudo (root) access you could install the ATLAS package on your"
-   echo "** machine, e.g. 'sudo apt-get install libatlas-dev libatlas-base-dev' or"
-   echo "** 'sudo yum install atlas.x86_64' or 'sudo zypper install libatlas3-devel',"
-   echo "** or on cygwin, install atlas from the installer GUI; and then run ./configure"
-   echo "** again."
-   echo "**"
-   echo "**  Otherwise (or if you prefer OpenBLAS for speed), you could go the OpenBLAS"
-   echo "** route: cd to ../tools, type 'extras/install_openblas.sh', cd back to here,"
-   echo "** and type './configure  --openblas-root=../tools/OpenBLAS/install'"
-   exit 1;
-}
-
-function linux_check_static {
-  # will exit with success if $dir seems to contain ATLAS libraries with
-  # right architecture (compatible with default "nm")
-  echo "int main(void) { return 0; }" > test_linking.cc;
-  if [ -f $dir/libatlas.a ]; then # candidate...
-    # Note: on the next line, the variable assignment
-    # LANG=en_US should apply just to the program called on that line.
-    if LANG=en_US gcc -o test_linking test_linking.cc -u ATL_flushcache $dir/libatlas.a 2>&1 | grep -i "incompatible" >/dev/null; then
-      echo "Directory $dir may contain ATLAS libraries but seems to be wrong architecture";
-      rm test_linking test_linking.cc 2>/dev/null
-      return 1;
-    fi
-    rm test_linking test_linking.cc 2>/dev/null
-    return 0;
-  else
-    rm test_linking.cc
-    return 1;
-  fi
-}
-
-function linux_configure_debian_ubuntu {
-  m=$1
-  ATLASLIBS="/usr/lib$m/atlas-base/libatlas.so.3gf  /usr/lib$m/atlas-base/libf77blas.so.3gf /usr/lib$m/atlas-base/libcblas.so.3gf  /usr/lib$m/atlas-base/liblapack_atlas.so.3gf"
-  for f in $ATLASLIBS; do
-    [ ! -f $f ] && return 1;
-  done
-  lapacklib=$(echo $ATLASLIBS | awk '{print $NF}')
-  if ! nm --dynamic $lapacklib | grep ATL_cgetrf >/dev/null; then
-    exit 1;
-  fi
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS >> kaldi.mk
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  echo "Successfully configured for Debian/Ubuntu Linux [dynamic libraries] with ATLASLIBS =$ATLASLIBS"
-  $use_cuda && configure_cuda
-  linux_configure_speex
-  exit_success;
-}
-
-function linux_configure_debian_ubuntu3 {
-  ATLASLIBS="/usr/lib/libatlas.so.3  /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3  /usr/lib/liblapack_atlas.so.3"
-  for f in $ATLASLIBS; do
-    [ ! -f $f ] && return 1;
-  done
-  lapacklib=$(echo $ATLASLIBS | awk '{print $NF}')
-  if ! nm --dynamic $lapacklib | grep ATL_cgetrf >/dev/null; then
-    exit 1;
-  fi
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS >> kaldi.mk
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  echo "Successfully configured for Debian/Ubuntu Linux [dynamic libraries] with ATLASLIBS =$ATLASLIBS"
-  $use_cuda && configure_cuda
-  linux_configure_speex
-  exit_success;
-}
-
-function linux_configure_debian7 {
-  ATLASLIBS="/usr/lib/atlas-base/libatlas.so.3.0 /usr/lib/atlas-base/libf77blas.so.3.0 /usr/lib/atlas-base/libcblas.so.3 /usr/lib/atlas-base/liblapack_atlas.so.3"
-  for f in $ATLASLIBS; do
-    [ ! -f $f ] && return 1;
-  done
-  lapacklib=$(echo $ATLASLIBS | awk '{print $NF}')
-  if ! nm --dynamic $lapacklib | grep ATL_cgetrf >/dev/null; then
-    exit 1;
-  fi
-  libdir=$(dirname $(echo $ATLASLIBS | awk '{print $1}'))
-  [ -z "$libdir" ] && echo "Error getting libdir in linux_configure_debian7" && exit 1;
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS -Wl,-rpath=$libdir >> kaldi.mk
-  echo
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  echo "Successfully configured for Debian 7 [dynamic libraries] with ATLASLIBS =$ATLASLIBS"
-  $use_cuda && configure_cuda
-  linux_configure_speex
-  exit_success;
-}
-
-function linux_configure_redhat {
-  m=$1  # 64 or empty.
-  ATLASLIBS="/usr/lib$m/atlas/libatlas.so.3 /usr/lib$m/atlas/libf77blas.so.3 /usr/lib$m/atlas/libcblas.so.3 /usr/lib$m/atlas/libclapack.so.3"
-  for f in $ATLASLIBS; do
-    [ ! -f $f ] && return 1;
-  done
-  libdir=$(dirname $(echo $ATLASLIBS | awk '{print $1}'))
-  [ -z "$libdir" ] && echo "Error getting libdir in linux_configure_redhat" && exit 1;
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS -Wl,-rpath=$libdir >> kaldi.mk
-  echo
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  echo "Successfully configured for red hat [dynamic libraries] with ATLASLIBS =$ATLASLIBS"
-  $use_cuda && configure_cuda
-  exit_success;
-}
-
-function linux_configure_redhat_fat {
-  # This is for when only two so-called 'fat' ATLAS libs are provided:
-  # libsatlas.so.3 and libtatlas.so.3.
-  # See http://stackoverflow.com/questions/13439296/build-shared-libraries-in-atlas.
-  m=$1  # 64 or empty.
-  ATLASLIBS="/usr/lib$m/atlas/libsatlas.so.3 /usr/lib$m/atlas/libtatlas.so.3"
-  for f in $ATLASLIBS; do
-    [ ! -f $f ] && return 1;
-  done
-  libdir=$(dirname $(echo $ATLASLIBS | awk '{print $1}'))
-  [ -z "$libdir" ] && echo "Error getting libdir in linux_configure_redhat_fat" && exit 1;
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS -Wl,-rpath=$libdir >> kaldi.mk
-  echo
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  echo "Successfully configured for red hat [dynamic libraries, fat] with ATLASLIBS =$ATLASLIBS"
-  $use_cuda && configure_cuda
-  exit_success;
-}
-
-
-function linux_configure_static {
-  if $threaded_atlas; then pt=pt; else pt=""; fi
-
-  if [ -z $ATLASLIBDIR ]; then # Note: it'll pick up the last one below.
-    for dir in /usr{,/local}/lib{64,}{,/atlas,/atlas-sse2,/atlas-sse3} \
-       /usr/local/atlas/lib{,64} `pwd`/../tools/ATLAS/build/install/lib/ $ATLASROOT/lib; do
-     linux_check_static &&  ATLASLIBDIR=$dir
-    done
-    if [ -z $ATLASLIBDIR ]; then # Note: it'll pick up the last one below.
-      echo "Could not find libatlas.a in any of the generic-Linux places, but we'll try other stuff..."
-      return 1;
-    fi
-  elif [ ! -f $ATLASLIBDIR/libatlas.a ]; then
-    echo "Could not find libatlas.a in '$ATLASLIBDIR'"
-    return 1;
-  fi
-  echo "Validating presence of ATLAS libs in $ATLASLIBDIR"
-  ATLASLIBS=
-  # The Lapack part of ATLAS seems to appear under various different names.. but it
-  # should always have symbols like ATL_cgetrf defined, so we test for this,
-  # for all the names we have encountered.
-  for libname in liblapack liblapack_atlas  libclapack; do
-    if [ -f $ATLASLIBDIR/${libname}.a -a "$ATLASLIBS" == "" ]; then
-      if nm  $ATLASLIBDIR/${libname}.a  | grep ATL_cgetrf >/dev/null; then
-         ATLASLIBS=$ATLASLIBDIR/${libname}.a
-         echo "Using library $ATLASLIBS as ATLAS's CLAPACK library."
-      fi
-    fi
-  done
-  if [ "$ATLASLIBS" == "" ]; then
-    echo Could not find any libraries $ATLASLIBDIR/{liblapack,liblapack_atlas,libclapack} that seem to be an ATLAS CLAPACK library.
-    return ;
-  fi
-
-  for x in lib${pt}cblas.a libatlas.a lib${pt}f77blas.a; do
-    if [ ! -f $ATLASLIBDIR/$x ]; then
-      echo "Configuring static ATLAS libraries failed: Could not find library $x in directory $ATLASLIBDIR"
-      return 1;
-    fi
-    ATLASLIBS="$ATLASLIBS $ATLASLIBDIR/$x"
-  done
-  if $threaded_atlas; then ATLASLIBS="$ATLASLIBS"; fi
-
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS >> kaldi.mk
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  $use_cuda && configure_cuda
-  linux_configure_speex
-  echo "Successfully configured for Linux [static libraries] with ATLASLIBS =$ATLASLIBS"
-  exit_success;
-}
-
-function linux_check_dynamic {
-  # will exit with success if $dir seems to contain ATLAS libraries with
-  # right architecture (compatible with default "nm")
-  if $threaded_atlas; then pt=t; else pt=s; fi
-  for atlas_libname in libatlas.so lib${pt}atlas.so; do
-    if [ -f $dir/$atlas_libname ]; then # candidate...
-      if nm --dynamic $dir/$atlas_libname 2>&1 | grep "File format not recognized" >/dev/null; then
-        echo "Directory $dir may contain dynamic ATLAS libraries but seems to be wrong architecture";
-        return 1;
-      fi
-        echo "Atlas found in $dir";
-        return 0;
-      fi
-  done
-  # echo "... no {libatlas,lib${pt}atlas}.so in $dir";
-  return 1;
-}
-
-function linux_configure_dynamic {
-  if $threaded_atlas; then pt=t; else pt=s; fi # relevant to "fat" libraries, will change later for separate ones
-  if [ -z $ATLASLIBDIR ]; then # Note: it'll pick up the last one below.
-    for dir in /usr{,/local}/lib{,64}{,/atlas,/atlas-sse2,/atlas-sse3} \
-      `pwd`/../tools/ATLAS/build/install/lib/ $ATLASROOT/lib; do
-      linux_check_dynamic && ATLASLIBDIR=$dir && ATLASLIBNAME=$atlas_libname
-    done
-    if [ -z $ATLASLIBDIR -o -z $ATLASLIBNAME ]; then
-      echo "Could not find {libatlas,lib${pt}atlas}.so in any of the obvious places, will most likely try static:"
-      return 1;
-    fi
-  fi
-
-  # If using "fat" libraries we only need one file to link against
-  if [ $ATLASLIBNAME != libatlas.so ]; then
-    if [ -f $ATLASLIBDIR/$ATLASLIBNAME ]; then
-      ATLASLIBS="$ATLASLIBDIR/$ATLASLIBNAME"
-    else
-      echo "Configuring dynamic ATLAS library failed: library $ATLASLIBNAME not found in $ATLASLIBDIR"
-      return 1;
-    fi
-  else  # with "thin" libraries, we have several object to link against, and different single/multi-thread names
-    if $threaded_atlas; then pt=pt; else pt=""; fi
-    echo "Validating presence of ATLAS libs in $ATLASLIBDIR"
-    ATLASLIBS=
-    # The Lapack part of ATLAS seems to appear under various different names.. but it
-    # should always have symbols like ATL_cgetrf defined, so we test for this,
-    # for all the names we have encountered.
-    for libname in lapack lapack_atlas  clapack; do
-      if [ -f $ATLASLIBDIR/lib${libname}.so -a "$ATLASLIBS" == "" ]; then
-        if nm  --dynamic $ATLASLIBDIR/lib${libname}.so  | grep ATL_cgetrf >/dev/null; then
-           ATLASLIBS="$ATLASLIBDIR/lib${libname}.so"
-           echo "Using library $ATLASLIBS as ATLAS's CLAPACK library."
-        fi
-      fi
-    done
-    if [ "$ATLASLIBS" == "" ]; then
-      echo Could not find any libraries $ATLASLIBDIR/{liblapack,liblapack_atlas,libclapack} that seem to be an ATLAS CLAPACK library.
-      return 1;
-    fi
-
-    for x in ${pt}cblas atlas ${pt}f77blas; do
-      if [ ! -f $ATLASLIBDIR/lib$x.so ]; then
-        echo "Configuring dynamic ATLAS libraries failed: Could not find library $x in directory $ATLASLIBDIR"
-        return 1;
-      fi
-      ATLASLIBS="$ATLASLIBS $ATLASLIBDIR/lib${x}.so"
-    done
-    if $threaded_atlas; then ATLASLIBS="$ATLASLIBS"; fi
-  fi
-
-  echo ATLASINC = $ATLASROOT/include >> kaldi.mk
-  echo ATLASLIBS = $ATLASLIBS >> kaldi.mk
-  cat makefiles/linux_atlas.mk >> kaldi.mk
-  fix_cxx_flag
-  $use_cuda && configure_cuda
-  linux_configure_speex
-  echo "Successfully configured for Linux [dynamic libraries] with ATLASLIBS =$ATLASLIBS"
-  exit_success;
-}
-
 echo "Configuring ..."
 
 if [ ! -f makefiles/common.mk ]; then
@@ -799,18 +253,18 @@ if [ ! -f makefiles/common.mk ]; then
 fi
 
 
