diff options
author | asau <asau@pkgsrc.org> | 2014-03-10 20:50:35 +0000 |
---|---|---|
committer | asau <asau@pkgsrc.org> | 2014-03-10 20:50:35 +0000 |
commit | 641c84cb9fe8e3f67a30146fc5ddd3fae1630b8a (patch) | |
tree | 7aa99af12931e1fb7d664feb9f48682c76504e43 /bootstrap | |
parent | d46fae6ca791001472cf5488ddca91186826ae99 (diff) | |
download | pkgsrc-641c84cb9fe8e3f67a30146fc5ddd3fae1630b8a.tar.gz |
Detect Clang and apply proper compiler settings.
This fixes bootstrapping on FreeBSD 10 where cc is Clang
pretending poorly to be GCC.
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap/bootstrap | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bootstrap/bootstrap b/bootstrap/bootstrap index e6867d1b3cc..ce364d329ac 100755 --- a/bootstrap/bootstrap +++ b/bootstrap/bootstrap @@ -1,6 +1,6 @@ #! /bin/sh -# $NetBSD: bootstrap,v 1.202 2014/03/07 14:59:42 jperkin Exp $ +# $NetBSD: bootstrap,v 1.203 2014/03/10 20:50:35 asau Exp $ # # Copyright (c) 2001-2011 Alistair Crooks <agc@NetBSD.org> # All rights reserved. @@ -148,6 +148,15 @@ get_compiler() IFS="${save_IFS}" fi + # Clang compiler pretends to be GCC, so we have to check that + cat >${wrkdir}/$$.c <<EOF +#ifdef __clang__ +indeed +#endif +EOF + compiler_is_clang=`${testcc:-cc} -E ${wrkdir}/$$.c 2>/dev/null | grep -c indeed` + rm -f ${wrkdir}/$$.c + cat >${wrkdir}/$$.c <<EOF #ifdef __GNUC__ indeed @@ -549,6 +558,7 @@ FreeBSD) need_sed=no set_opsys=no machine_arch=`uname -p` + check_compiler=yes ;; FreeMiNT) root_group=root @@ -870,7 +880,10 @@ echo "Working directory is: ${wrkdir}" if [ "$compiler" = "" ] && [ x"$check_compiler" = x"yes" ]; then get_compiler - if [ $compiler_is_gnu -gt 0 ]; then + # Clang pretends to be GCC, so we have to check it first. + if [ $compiler_is_clang -gt 0 ]; then + compiler="clang" + elif [ $compiler_is_gnu -gt 0 ]; then compiler="gcc" else case "$opsys" in |