nuclear@28: #!/bin/sh nuclear@28: nuclear@28: opt=false nuclear@28: dbg=true nuclear@57: profiling=false nuclear@28: nuclear@28: while [ $# -gt 0 ]; do nuclear@28: case $1 in nuclear@28: --prefix=*) nuclear@28: PREFIX=`echo $1 | sed 's/--prefix=//'` nuclear@28: ;; nuclear@28: --enable-*) nuclear@57: export `echo $1 | sed 's/--enable-//'`=true nuclear@28: ;; nuclear@28: --disable-*) nuclear@57: export `echo $1 | sed 's/--disable-//'`=false nuclear@28: ;; nuclear@28: esac nuclear@28: shift nuclear@28: done nuclear@28: nuclear@28: echo '# Generated makefile, do not edit' >Makefile nuclear@28: echo "PREFIX = $PREFIX" >>Makefile nuclear@28: if $opt; then nuclear@28: echo 'opt = -O3 -ffast-math' >>Makefile nuclear@28: fi nuclear@28: if $dbg; then nuclear@28: echo 'dbg = -g' >>Makefile nuclear@28: fi nuclear@57: if $profiling; then nuclear@57: echo 'prof = -pg' >>Makefile nuclear@57: fi nuclear@28: nuclear@28: # determine the C++11 flags we need to pass to the C++ compiler nuclear@28: if [ -z "$CXX" ]; then nuclear@28: CXX=c++ nuclear@28: fi nuclear@28: nuclear@28: verstr=`$CXX --version` nuclear@28: if echo "$verstr" | grep LLVM; then nuclear@30: if echo | $CXX -c -x c++ -o /dev/null -std=c++11 - >/dev/null 2>&1; then nuclear@28: cxxflags11='-std=c++11 -stdlib=libc++' nuclear@28: ldflags11='-stdlib=libc++' nuclear@28: fi nuclear@28: else nuclear@30: if echo | $CXX -c -x c++ -o /dev/null -std=c++11 - >/dev/null 2>&1; then nuclear@28: cxxflags11='-std=c++11' nuclear@30: elif echo | $CXX -c -x c++ -o /dev/null -std=c++0x - >/dev/null 2>&1; then nuclear@28: cxxflags11='-std=c++0x' nuclear@28: fi nuclear@28: fi nuclear@28: if [ -z "$cxxflags11" ]; then nuclear@28: echo 'Failed to find C++11 capable compiler.' nuclear@28: fi nuclear@28: nuclear@28: echo "cxx11_cflags = $cxxflags11" >>Makefile nuclear@28: if [ -n "$ldflags11" ]; then nuclear@28: echo "cxx11_ldflags = $ldflags11" >>Makefile nuclear@28: fi nuclear@28: nuclear@28: cat Makefile.in >>Makefile