Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision 9ce911d717fa4cfa748c77718570983b7da7db3a)
+++ tools/autotool.py	(revision a0a273e83bf1cedff09f94c8181d7f89a6c637a6)
@@ -210,5 +210,4 @@
 	target = None
 	gnu_target = None
-	clang_target = None
 	helenos_target = None
 	cc_args = []
@@ -220,10 +219,8 @@
 		if (config['CROSS_TARGET'] == "arm32"):
 			gnu_target = "arm-linux-gnueabi"
-			clang_target = "arm-unknown-none"
 			helenos_target = "arm-helenos-gnueabi"
 		
 		if (config['CROSS_TARGET'] == "ia32"):
 			gnu_target = "i686-pc-linux-gnu"
-			clang_target = "i686-unknown-none"
 			helenos_target = "i686-pc-helenos"
 		
@@ -231,5 +228,4 @@
 			cc_args.append("-mabi=32")
 			gnu_target = "mipsel-linux-gnu"
-			clang_target = "mipsel-unknown-none"
 			helenos_target = "mipsel-helenos"
 	
@@ -237,5 +233,4 @@
 		target = config['PLATFORM']
 		gnu_target = "amd64-linux-gnu"
-		clang_target = "x86_64-unknown-none"
 		helenos_target = "amd64-helenos"
 	
@@ -243,5 +238,4 @@
 		target = config['PLATFORM']
 		gnu_target = "arm-linux-gnueabi"
-		clang_target = "arm-unknown-none-eabi"
 		helenos_target = "arm-helenos-gnueabi"
 	
@@ -249,5 +243,4 @@
 		target = config['PLATFORM']
 		gnu_target = "i686-pc-linux-gnu"
-		clang_target = "i686-unknown-none"
 		helenos_target = "i686-pc-helenos"
 	
@@ -264,5 +257,4 @@
 			target = config['PLATFORM']
 			gnu_target = "mipsel-linux-gnu"
-			clang_target = "mipsel-unknown-none"
 			helenos_target = "mipsel-helenos"
 		
@@ -270,5 +262,4 @@
 			target = "mips32eb"
 			gnu_target = "mips-linux-gnu"
-			clang_target = "mips-unknown-none"
 			helenos_target = "mips-helenos"
 	
@@ -280,5 +271,4 @@
 			target = config['PLATFORM']
 			gnu_target = "mips64el-linux-gnu"
-			clang_target = "mips64el-unknown-none"
 			helenos_target = "mips64el-helenos"
 	
@@ -286,5 +276,4 @@
 		target = config['PLATFORM']
 		gnu_target = "ppc-linux-gnu"
-		clang_target = "ppc-unknown-none"
 		helenos_target = "ppc-helenos"
 	
@@ -292,5 +281,4 @@
 		target = config['PLATFORM']
 		gnu_target = "riscv64-unknown-linux-gnu"
-		clang_target = "riscv-unknown-none"
 		helenos_target = "riscv64-helenos"
 	
@@ -298,8 +286,7 @@
 		target = config['PLATFORM']
 		gnu_target = "sparc64-linux-gnu"
-		clang_target = "sparc-unknown-none"
 		helenos_target = "sparc64-helenos"
 	
-	return (target, cc_args, gnu_target, clang_target, helenos_target)
+	return (target, cc_args, gnu_target, helenos_target)
 
 def check_app(args, name, details):
@@ -351,4 +338,14 @@
 	return found
 
+def check_clang(path, prefix, common, details):
+	"Check for clang"
+	
+	common['CLANG'] = "%sclang" % prefix
+	
+	if (not path is None):
+		common['CLANG'] = "%s/%s" % (path, common['CLANG'])
+	
+	check_app([common['CLANG'], "--version"], "clang", details)
+
 def check_gcc(path, prefix, common, details):
 	"Check for GCC"
@@ -427,6 +424,5 @@
 	outf.close()
 	
-	args = [common['CC']]
-	args.extend(common['CC_ARGS'])
+	args = common['CC_AUTOGEN'].split(' ')
 	args.extend(["-S", "-o", PROBE_OUTPUT, PROBE_SOURCE])
 	
@@ -547,6 +543,5 @@
 	outf.close()
 	
-	args = [common['CC']]
-	args.extend(common['CC_ARGS'])
+	args = common['CC_AUTOGEN'].split(' ')
 	args.extend(["-S", "-o", PROBE_INT128_OUTPUT, PROBE_INT128_SOURCE])
 	
@@ -852,7 +847,6 @@
 		
 		# Compiler
-		common['CC_ARGS'] = []
 		if (config['COMPILER'] == "gcc_cross"):
-			target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
+			target, cc_args, gnu_target, helenos_target = get_target(config)
 			
 			if (target is None) or (gnu_target is None):
@@ -867,9 +861,9 @@
 			
 			check_common(common, "GCC")
-			common['CC'] = common['GCC']
-			common['CC_ARGS'].extend(cc_args)
+			common['CC'] = " ".join([common['GCC']] + cc_args)
+			common['CC_AUTOGEN'] = common['CC']
 		
 		if (config['COMPILER'] == "gcc_helenos"):
-			target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
+			target, cc_args, gnu_target, helenos_target = get_target(config)
 			
 			if (target is None) or (helenos_target is None):
@@ -884,6 +878,6 @@
 			
 			check_common(common, "GCC")
-			common['CC'] = common['GCC']
-			common['CC_ARGS'].extend(cc_args)
+			common['CC'] = " ".join([common['GCC']] + cc_args)
+			common['CC_AUTOGEN'] = common['CC']
 		
 		if (config['COMPILER'] == "gcc_native"):
@@ -893,4 +887,5 @@
 			check_common(common, "GCC")
 			common['CC'] = common['GCC']
+			common['CC_AUTOGEN'] = common['CC']
 		
 		if (config['COMPILER'] == "icc"):
@@ -900,10 +895,11 @@
 			
 			common['CC'] = "icc"
+			common['CC_AUTOGEN'] = common['CC']
 		
 		if (config['COMPILER'] == "clang"):
-			target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
-			
-			if (target is None) or (gnu_target is None) or (clang_target is None):
-				print_error(["Unsupported compiler target for clang.",
+			target, cc_args, gnu_target, helenos_target = get_target(config)
+			
+			if (target is None) or (gnu_target is None):
+				print_error(["Unsupported compiler target.",
 				             "Please contact the developers of HelenOS."])
 			
@@ -911,14 +907,18 @@
 			prefix = "%s-" % gnu_target
 			
-			check_app(["clang", "--version"], "clang compiler", "preferably version 1.0 or newer")
+			check_clang(path, prefix, common, "")
 			check_gcc(path, prefix, common, PACKAGE_GCC)
 			check_binutils(path, prefix, common, PACKAGE_BINUTILS)
 			
 			check_common(common, "GCC")
-			common['CC'] = "clang"
-			common['CC_ARGS'].extend(cc_args)
-			common['CC_ARGS'].append("-target")
-			common['CC_ARGS'].append(clang_target)
-			common['CLANG_TARGET'] = clang_target
+			check_common(common, "CLANG")
+			common['CC'] = " ".join([common['CLANG']] + cc_args)
+			common['CC_AUTOGEN'] = common['CC'] + " -no-integrated-as"
+			
+			if (config['INTEGRATED_AS'] == "yes"):
+				common['CC'] += " -integrated-as"
+			
+			if (config['INTEGRATED_AS'] == "no"):
+				common['CC'] += " -no-integrated-as"
 		
 		check_python()
