diff --git a/configure b/configure index 08078d29d5c..759f317d0cb 100755 --- a/configure +++ b/configure @@ -365,17 +365,64 @@ fi # OpenCL configuration if [ "$TF_NEED_OPENCL" == "1" ]; then + +# Determine which C++ compiler should be used as the host compiler +while true; do + fromuser="" + if [ -z "$HOST_CXX_COMPILER" ]; then + default_cxx_host_compiler=$(which g++|| true) + read -p "Please specify which C++ compiler should be used as the host C++ compiler. [Default is $default_cxx_host_compiler]: " HOST_CXX_COMPILER + fromuser="1" + if [ -z "$HOST_CXX_COMPILER" ]; then + HOST_CXX_COMPILER=$default_cxx_host_compiler + fi + fi + if [ -e "$HOST_CXX_COMPILER" ]; then + export HOST_CXX_COMPILER + break + fi + echo "Invalid C++ compiler path. ${HOST_CXX_COMPILER} cannot be found" 1>&2 + if [ -z "$fromuser" ]; then + exit 1 + fi + HOST_CXX_COMPILER="" + # Retry +done + +# Determine which C compiler should be used as the host compiler +while true; do + fromuser="" + if [ -z "$HOST_C_COMPILER" ]; then + default_c_host_compiler=$(which gcc|| true) + read -p "Please specify which C compiler should be used as the host C compiler. [Default is $default_c_host_compiler]: " HOST_C_COMPILER + fromuser="1" + if [ -z "$HOST_C_COMPILER" ]; then + HOST_C_COMPILER=$default_c_host_compiler + fi + fi + if [ -e "$HOST_C_COMPILER" ]; then + export HOST_C_COMPILER + break + fi + echo "Invalid C compiler path. ${HOST_C_COMPILER} cannot be found" 1>&2 + if [ -z "$fromuser" ]; then + exit 1 + fi + HOST_C_COMPILER="" + # Retry +done + while true; do # Configure the OPENCL version to use. TF_OPENCL_VERSION="1.2" - # Point to ComputeCPP root - if [ -z "$COMPUTECPP_PATH" ]; then - default_computecpp_path=/usr/local/computecpp - read -p "Please specify the location where ComputeCPP $TF_OPENCL_VERSION is installed. Refer to README.md for more details. [Default is $default_computecpp_path]: " COMPUTECPP_PATH + # Point to ComputeCpp root + if [ -z "$COMPUTECPP_TOOLKIT_PATH" ]; then + default_computecpp_toolkit_path=/usr/local/computecpp + read -p "Please specify the location where ComputeCpp $TF_OPENCL_VERSION is installed. Refer to README.md for more details. [Default is $default_computecpp_toolkit_path]: " COMPUTECPP_TOOLKIT_PATH fromuser="1" - if [ -z "$COMPUTECPP_PATH" ]; then - COMPUTECPP_PATH=$default_computecpp_path + if [ -z "$COMPUTECPP_TOOLKIT_PATH" ]; then + COMPUTECPP_TOOLKIT_PATH=$default_computecpp_toolkit_path fi fi @@ -383,38 +430,20 @@ while true; do SYCL_RT_LIB_PATH="lib/libComputeCpp.so" fi - if [ -e "${COMPUTECPP_PATH}/${SYCL_RT_LIB_PATH}" ]; then + if [ -e "${COMPUTECPP_TOOLKIT_PATH}/${SYCL_RT_LIB_PATH}" ]; then + export COMPUTECPP_TOOLKIT_PATH break fi - echo "Invalid path to SYCL $TF_OPENCL_VERSION library. ${COMPUTECPP_PATH}/${SYCL_RT_LIB_PATH} cannot be found" + echo "Invalid SYCL $TF_OPENCL_VERSION library path. ${COMPUTECPP_TOOLKIT_PATH}/${SYCL_RT_LIB_PATH} cannot be found" if [ -z "$fromuser" ]; then exit 1 fi # Retry TF_OPENCL_VERSION="" - COMPUTECPP_PATH="" + COMPUTECPP_TOOLKIT_PATH="" done -cat > third_party/sycl/sycl.config <