changeset 2544:995e4986ff30 draft

Test that the CC command works and makes an exectuable rather than using the type command. Thanks to Thomas De Schampheleire.
author Roy Marples <roy@marples.name>
date Sat, 21 Jun 2014 15:46:31 +0000
parents 8255dad7230c
children 7cb89ed1d31e
files configure
diffstat 1 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sat Jun 21 12:45:55 2014 +0000
+++ b/configure	Sat Jun 21 15:46:31 2014 +0000
@@ -272,8 +272,20 @@
 fi
 
 echo "Using compiler .. $CC"
-if ! type "$CC" >/dev/null 2>&1; then
-	echo "$CC is not an executable"
+cat <<EOF >_test.c
+int main(void) {
+	return 0;
+}
+EOF
+_CC=true
+if $CC _test.c -o _test >/dev/null 2>&1; then
+	[ -x _test ] || _CC=false
+else
+	_CC=false
+fi
+rm -f _test.c _test
+if ! $_CC; then
+	echo "$CC does not create executables"
 	exit 1
 fi
 [ "$CC" != cc ] && echo "CC=	$CC" >>$CONFIG_MK