#!/bin/sh

echo ==============================================================================
echo  Using libc++
echo ==============================================================================

LIBCXXDIR=$HOME/contrib/libcxx
LIBCXXRTDIR=$HOME/contrib/FreeBSD-HEAD/lib/libcxxrt

CXXOPTS="-std=c++0x -nostdinc++ -Wall -g"
CXXINCL="-I $LIBCXXDIR/include"
CXXFLAGS="$CXXOPTS $CXXINCL"

LDOPTS="-nodefaultlibs"
LDLIBS="-L $LIBCXXDIR/lib -lc++
        -L $LIBCXXRTDIR -lcxxrt
        -lm"
LDFLAGS="$LDOPTS $LDLIBS"

for NS in -DWITHOUT_NS_STD -DWITH_NS_STD
{
	for POW in -DWITHOUT_EXP_OVERLOAD -DWITH_EXP_OVERLOAD
	{
		echo ------------------------------------------------------------------------------
		echo  defines $NS $POW
		echo ------------------------------------------------------------------------------
		clang++ $CXXFLAGS $NS $POW $LDFLAGS pow_complex_test.cpp
		./a.out
	}
}

echo ==============================================================================
echo  Using libstdc++
echo ==============================================================================

CXXFLAGS="-Wall -g"
LDFLAGS=""

for NS in -DWITHOUT_NS_STD -DWITH_NS_STD
{
	for POW in -DWITHOUT_EXP_OVERLOAD -DWITH_EXP_OVERLOAD
	{
		echo ------------------------------------------------------------------------------
		echo  defines $NS $POW
		echo ------------------------------------------------------------------------------
		clang++ $CXXFLAGS $NS $POW $LDFLAGS $STDLIB pow_complex_test.cpp
		./a.out
	}
}
