dungeon_crawler

annotate prototype/configure @ 80:a373b36ffc17

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