dungeon_crawler
annotate prototype/configure @ 30:938a6a155c94
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 27 Aug 2012 04:03:22 +0300 |
parents | f5fb04fe12cd |
children | 508540dae114 |
rev | line source |
---|---|
nuclear@28 | 1 #!/bin/sh |
nuclear@28 | 2 |
nuclear@28 | 3 opt=false |
nuclear@28 | 4 dbg=true |
nuclear@28 | 5 |
nuclear@28 | 6 while [ $# -gt 0 ]; do |
nuclear@28 | 7 case $1 in |
nuclear@28 | 8 --prefix=*) |
nuclear@28 | 9 PREFIX=`echo $1 | sed 's/--prefix=//'` |
nuclear@28 | 10 ;; |
nuclear@28 | 11 --enable-*) |
nuclear@28 | 12 `echo $1 | sed 's/--enable-//'`=true |
nuclear@28 | 13 ;; |
nuclear@28 | 14 --disable-*) |
nuclear@28 | 15 `echo $1 | sed 's/--disable-//'`=false |
nuclear@28 | 16 ;; |
nuclear@28 | 17 esac |
nuclear@28 | 18 shift |
nuclear@28 | 19 done |
nuclear@28 | 20 |
nuclear@28 | 21 echo '# Generated makefile, do not edit' >Makefile |
nuclear@28 | 22 echo "PREFIX = $PREFIX" >>Makefile |
nuclear@28 | 23 if $opt; then |
nuclear@28 | 24 echo 'opt = -O3 -ffast-math' >>Makefile |
nuclear@28 | 25 fi |
nuclear@28 | 26 if $dbg; then |
nuclear@28 | 27 echo 'dbg = -g' >>Makefile |
nuclear@28 | 28 fi |
nuclear@28 | 29 |
nuclear@28 | 30 # determine the C++11 flags we need to pass to the C++ compiler |
nuclear@28 | 31 if [ -z "$CXX" ]; then |
nuclear@28 | 32 CXX=c++ |
nuclear@28 | 33 fi |
nuclear@28 | 34 |
nuclear@28 | 35 verstr=`$CXX --version` |
nuclear@28 | 36 if echo "$verstr" | grep LLVM; then |
nuclear@30 | 37 if echo | $CXX -c -x c++ -o /dev/null -std=c++11 - >/dev/null 2>&1; then |
nuclear@28 | 38 cxxflags11='-std=c++11 -stdlib=libc++' |
nuclear@28 | 39 ldflags11='-stdlib=libc++' |
nuclear@28 | 40 fi |
nuclear@28 | 41 else |
nuclear@30 | 42 if echo | $CXX -c -x c++ -o /dev/null -std=c++11 - >/dev/null 2>&1; then |
nuclear@28 | 43 cxxflags11='-std=c++11' |
nuclear@30 | 44 elif echo | $CXX -c -x c++ -o /dev/null -std=c++0x - >/dev/null 2>&1; then |
nuclear@28 | 45 cxxflags11='-std=c++0x' |
nuclear@28 | 46 fi |
nuclear@28 | 47 fi |
nuclear@28 | 48 if [ -z "$cxxflags11" ]; then |
nuclear@28 | 49 echo 'Failed to find C++11 capable compiler.' |
nuclear@28 | 50 fi |
nuclear@28 | 51 |
nuclear@28 | 52 echo "cxx11_cflags = $cxxflags11" >>Makefile |
nuclear@28 | 53 if [ -n "$ldflags11" ]; then |
nuclear@28 | 54 echo "cxx11_ldflags = $ldflags11" >>Makefile |
nuclear@28 | 55 fi |
nuclear@28 | 56 |
nuclear@28 | 57 cat Makefile.in >>Makefile |