浏览代码

mic-configure: test both gcc and icc compilers

Nathalie Furmento 11 年之前
父节点
当前提交
abf057787c
共有 1 个文件被更改,包括 19 次插入2 次删除
  1. 19 2
      mic-configure

+ 19 - 2
mic-configure

@@ -32,11 +32,23 @@ do
 
 done
 
+# Test gcc compiler
 x=$(type -t ${mic_host}-gcc)
 if [ -z "$x" ]
 then
-    echo "[error] please add path to ${mic_host}-gcc in your PATH"
-    exit 1
+    # Test icc compiler
+    echo "int main(int argc, char **argv) { return 0; }" > /tmp/icc_$USER_$$.c
+    icc -mmic /tmp/icc_$USER_$$.c > /dev/null 2>/tmp/icc_$USER_$$.err
+    l=$(grep -c "invalid argument" /tmp/icc_$USER_$$.err)
+    if [ "$l" != "0" ]
+    then
+        echo "[error] no compiler found. please add path to either ${mic_host}-gcc or to an enabled mic icc compiler in your PATH"
+	exit 1
+    else
+	compiler="icc"
+    fi
+else
+    compiler="gcc"
 fi
 
 for arch in mic host
@@ -49,6 +61,11 @@ do
 		*) command="../${ROOT_DIR}/configure";;
 	esac
 
+	if [ $compiler = "icc" -a "$arch" = "mic" ] ; then
+	    export CC="icc -mmic"
+	    export LD="icc -mmic"
+	fi
+
 	params="--enable-mic --with-coi-dir=$coi_dir --with-scif-dir=$scif_dir --prefix=$prefix/$arch"
 
 	if test x$arch = xmic ; then