Skip to content

Commit

Permalink
Also check brew for clang and boost dir.
Browse files Browse the repository at this point in the history
We now prefer Apple’s clang over MacPorts/homebrew. This is because clang on Lion (with latest Xcode) should be recent enough to build TextMate.
  • Loading branch information
sorbits committed Aug 10, 2012
1 parent 9637bc5 commit a94ad3c
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions configure
@@ -1,5 +1,5 @@
#!/bin/sh
set -u
# set -u
function error () { printf >&2 "%s\n\nPlease see README.md for build instructions.\n" "$1"; exit; }

# =================================================
Expand All @@ -24,29 +24,33 @@ rev=$(( $(curl -sf "${rest_api}/releases/nightly/revision")+1 )) || \
rev=$(git log --oneline master | wc -l)
fi

# ===============================================================
# = Prefer clang (3.2-trunk) from MacPorts over Apple’s version =
# ===============================================================
# ===============================================
# = Find clang via xcrun, MacPorts, or Homebrew =
# ===============================================

: "${CC:=/opt/local/bin/clang}"
: "${CXX:=/opt/local/bin/clang++}"
if which -s xcrun; then
: ${CC:=$(xcrun -find clang)}

This comment has been minimized.

Copy link
@ViViDboarder

ViViDboarder Aug 10, 2012

On OSX Lion (at least my version), this is finding /Developer/.../clang which is the default installed and not compatible. It then skips the for loop on line 36 causing configure to fail. Removing this if block allowed my compile to succeed. Perhaps configure would work better checking all system clangs until a valid one is found.

: ${CXX:=$(xcrun -find clang++)}
fi

if ! [[ -x "$CC" && -x "$CXX" ]]; then
if which -s xcrun; then
CC=$(xcrun -find clang)
CXX=$(xcrun -find clang++)
else
CC='/usr/bin/clang'
CXX='/usr/bin/clang++'
for cc in /{opt,usr}/local/bin/clang /usr/bin/clang; do
if [[ ! -x "$CC" || ! -x "$CXX" ]]; then
CC="${cc}"
CXX="${cc}++"
fi
fi
done

test -x "$CC" || error "*** clang not installed."
"$CC" &>/dev/null -x objective-c -include Foundation/Foundation.h -c -o /tmp/dummy - <<< 'int main () { id str = @("str"); return 0; }' || error "$CC is too old to build this project."

# ===============================
# = Check if boost is installed =
# ===============================

if which -s brew && [[ -z "$boostdir" && ! -d /usr/local/include/boost ]]; then
boostdir=$(brew --prefix boost)/include/boost
fi

for dir in "${boostdir:-/usr/include/boost}" /{opt,usr}/local/include/boost; do
if [[ ! -L "${builddir}/include/boost" && -d "${dir}" ]]; then
mkdir -p "${builddir}/include" && ln -fs "${dir}" "${builddir}/include/boost"
Expand Down

0 comments on commit a94ad3c

Please sign in to comment.