dungeon_crawler
diff prototype/configure @ 28:f5fb04fe12cd
moved compiler detection to the configure script
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 25 Aug 2012 20:20:56 +0300 |
parents | |
children | 938a6a155c94 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/prototype/configure Sat Aug 25 20:20:56 2012 +0300 1.3 @@ -0,0 +1,57 @@ 1.4 +#!/bin/sh 1.5 + 1.6 +opt=false 1.7 +dbg=true 1.8 + 1.9 +while [ $# -gt 0 ]; do 1.10 + case $1 in 1.11 + --prefix=*) 1.12 + PREFIX=`echo $1 | sed 's/--prefix=//'` 1.13 + ;; 1.14 + --enable-*) 1.15 + `echo $1 | sed 's/--enable-//'`=true 1.16 + ;; 1.17 + --disable-*) 1.18 + `echo $1 | sed 's/--disable-//'`=false 1.19 + ;; 1.20 + esac 1.21 + shift 1.22 +done 1.23 + 1.24 +echo '# Generated makefile, do not edit' >Makefile 1.25 +echo "PREFIX = $PREFIX" >>Makefile 1.26 +if $opt; then 1.27 + echo 'opt = -O3 -ffast-math' >>Makefile 1.28 +fi 1.29 +if $dbg; then 1.30 + echo 'dbg = -g' >>Makefile 1.31 +fi 1.32 + 1.33 +# determine the C++11 flags we need to pass to the C++ compiler 1.34 +if [ -z "$CXX" ]; then 1.35 + CXX=c++ 1.36 +fi 1.37 + 1.38 +verstr=`$CXX --version` 1.39 +if echo "$verstr" | grep LLVM; then 1.40 + if echo | $CXX -c -x c++ -std=c++11 - >/dev/null 2>&1; then 1.41 + cxxflags11='-std=c++11 -stdlib=libc++' 1.42 + ldflags11='-stdlib=libc++' 1.43 + fi 1.44 +else 1.45 + if echo | $CXX -c -x c++ -std=c++11 - >/dev/null 2>&1; then 1.46 + cxxflags11='-std=c++11' 1.47 + elif echo | $CXX -c -x c++ -std=c++0x - >/dev/null 2>&1; then 1.48 + cxxflags11='-std=c++0x' 1.49 + fi 1.50 +fi 1.51 +if [ -z "$cxxflags11" ]; then 1.52 + echo 'Failed to find C++11 capable compiler.' 1.53 +fi 1.54 + 1.55 +echo "cxx11_cflags = $cxxflags11" >>Makefile 1.56 +if [ -n "$ldflags11" ]; then 1.57 + echo "cxx11_ldflags = $ldflags11" >>Makefile 1.58 +fi 1.59 + 1.60 +cat Makefile.in >>Makefile