summaryrefslogtreecommitdiff
path: root/bootstrap/bootstrap
diff options
context:
space:
mode:
authorasau <asau>2014-03-10 20:50:35 +0000
committerasau <asau>2014-03-10 20:50:35 +0000
commit5e0c6f76a79e3b0741d5707ea6f1ed991852b711 (patch)
tree7aa99af12931e1fb7d664feb9f48682c76504e43 /bootstrap/bootstrap
parent1cbc793ade6286c0058f831c84cf5e96818cbdc4 (diff)
downloadpkgsrc-5e0c6f76a79e3b0741d5707ea6f1ed991852b711.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/bootstrap')
-rwxr-xr-xbootstrap/bootstrap17
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