dungeon_crawler

view 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
line source
1 #!/bin/sh
3 opt=false
4 dbg=true
6 while [ $# -gt 0 ]; do
7 case $1 in
8 --prefix=*)
9 PREFIX=`echo $1 | sed 's/--prefix=//'`
10 ;;
11 --enable-*)
12 `echo $1 | sed 's/--enable-//'`=true
13 ;;
14 --disable-*)
15 `echo $1 | sed 's/--disable-//'`=false
16 ;;
17 esac
18 shift
19 done
21 echo '# Generated makefile, do not edit' >Makefile
22 echo "PREFIX = $PREFIX" >>Makefile
23 if $opt; then
24 echo 'opt = -O3 -ffast-math' >>Makefile
25 fi
26 if $dbg; then
27 echo 'dbg = -g' >>Makefile
28 fi
30 # determine the C++11 flags we need to pass to the C++ compiler
31 if [ -z "$CXX" ]; then
32 CXX=c++
33 fi
35 verstr=`$CXX --version`
36 if echo "$verstr" | grep LLVM; then
37 if echo | $CXX -c -x c++ -o /dev/null -std=c++11 - >/dev/null 2>&1; then
38 cxxflags11='-std=c++11 -stdlib=libc++'
39 ldflags11='-stdlib=libc++'
40 fi
41 else
42 if echo | $CXX -c -x c++ -o /dev/null -std=c++11 - >/dev/null 2>&1; then
43 cxxflags11='-std=c++11'
44 elif echo | $CXX -c -x c++ -o /dev/null -std=c++0x - >/dev/null 2>&1; then
45 cxxflags11='-std=c++0x'
46 fi
47 fi
48 if [ -z "$cxxflags11" ]; then
49 echo 'Failed to find C++11 capable compiler.'
50 fi
52 echo "cxx11_cflags = $cxxflags11" >>Makefile
53 if [ -n "$ldflags11" ]; then
54 echo "cxx11_ldflags = $ldflags11" >>Makefile
55 fi
57 cat Makefile.in >>Makefile