# just in case
export PATH_SEPARATOR=:

# The following is needed, to get not the // syntax, when
# the configure script or the makefile calls pwd
current_drive=`pwd | sed 's,//\(.\).*,\1,'`
export SYSROOT=$current_drive:/

# set this to the wanted CFLAGS, I set here also the default output
# debugging type to stabs.
# currently disabled because we (djgpp-workers) have decided to leave
# the SBD COFF debug information as default.
# CFLAGS="-DPREFERRED_DEBUGGING_TYPE=DBX_DEBUG"

# Create now a stub, which has a larger stack, which is needed for
# at least cc1 when compiling gcc with itself
if [ ! -r stub.exe ]; then
  ln -s dummy stub
  stubedit stub.exe runfile= minstack=1536k
fi
export STUB=`pwd`/stub.exe

# check now, if the used cc1.exe has enough stack-space
cc1=`gcc -print-prog-name=cc1`
stack_space=`redir -eo stubedit -v $cc1 | sed -n 's,^.* (\([0-9][0-9]*\)k) .*stack space.*$,\1,p'`
if [ $stack_space -lt 1536 ]; then
  echo changing stack-siz of $cc1 from $stack_space''k to 1536k
  stubedit $cc1 minstack=1536k
fi

# now call make with any additional commandline argument
if [ -z $CFLAGS ]; then
  make $*
else
  make CFLAGS="$CFLAGS" $*
fi

