pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/bootstrap Detect Clang and apply proper compiler setti...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5147c27840fb
branches:  trunk
changeset: 631600:5147c27840fb
user:      asau <asau%pkgsrc.org@localhost>
date:      Mon Mar 10 20:50:35 2014 +0000

description:
Detect Clang and apply proper compiler settings.
This fixes bootstrapping on FreeBSD 10 where cc is Clang
pretending poorly to be GCC.

diffstat:

 bootstrap/bootstrap |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (47 lines):

diff -r 8b0e0f09af4a -r 5147c27840fb bootstrap/bootstrap
--- a/bootstrap/bootstrap       Mon Mar 10 20:40:28 2014 +0000
+++ b/bootstrap/bootstrap       Mon Mar 10 20:50:35 2014 +0000
@@ -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@localhost>
 # All rights reserved.
@@ -148,6 +148,15 @@
                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 @@
        need_sed=no
        set_opsys=no
        machine_arch=`uname -p`
+       check_compiler=yes
        ;;
 FreeMiNT)
        root_group=root
@@ -870,7 +880,10 @@
 
 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



Home | Main Index | Thread Index | Old Index