Index: build-system/configure.early
===================================================================
--- build-system/configure.early	(revision 5670)
+++ build-system/configure.early	(revision 5670)
@@ -0,0 +1,32 @@
+#!/bin/false
+# vim:ft=sh
+
+#     Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
+#
+# This file is part of roard a part of RoarAudio,
+# a cross-platform sound system for both, home and professional use.
+# See README for details.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3
+# as published by the Free Software Foundation.
+#
+# RoarAudio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# check for bash...
+
+if [ "$(echo -n)" = '-n' ]
+then
+ SHELL=$(which bash ksh sh 2> /dev/null | grep ^/ | head -n 1)
+ exec $SHELL $0 "$@"
+fi
+
+#ll
Index: build-system/configure.lib
===================================================================
--- build-system/configure.lib	(revision 5670)
+++ build-system/configure.lib	(revision 5670)
@@ -0,0 +1,345 @@
+#!/bin/false
+# vim:ft=sh
+
+#     Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
+#
+# This file is part of roard a part of RoarAudio,
+# a cross-platform sound system for both, home and professional use.
+# See README for details.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3
+# as published by the Free Software Foundation.
+#
+# RoarAudio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# some very basic string functions:
+to_upper() {
+ tr 'a-z' 'A-Z'
+}
+
+to_escaped() {
+ tr 'A-Z/.+-' 'a-z____'
+}
+
+parse_option() {
+ # Options are given via $n.
+ # we can not shift used ones so we tell the caller
+ # how many to shift: shift $SHIFT_COUNT
+ SHIFT_COUNT=0
+ # we also tell if the option was handelt.
+ HANDLED=true # will be reset if not.
+
+ case "$1" in
+  '--ldpath')
+   LDPATH="$LDPATH -L$2"
+   SHIFT_COUNT=1
+  ;;
+  '--incpath')
+   INCPATH="$INCPATH -I$2"
+   SHIFT_COUNT=1
+  ;;
+  '--addpath')
+   LDPATH="$LDPATH -L$2/lib/"
+   INCPATH="$INCPATH -I$2/include/"
+   SHIFT_COUNT=1
+  ;;
+  '--root')
+   LDPATH="$LDPATH -L$2/lib/"
+   INCPATH="$INCPATH -I$2/include/"
+   PREFIX="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--cflags')
+   CFLAGS="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--ldflags')
+   LDFLAGS="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--opti')
+   OPTI_O="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--link-deps')
+   LINK_DEPS="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--cc')
+   CC="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--ranlib')
+   RANLIB="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--root-uid')
+   ROOT_UID="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--no-'*)
+   lib=$(echo "$1" | sed 's/^--no-//' | to_escaped)
+   eval no_lib_$lib=true
+  ;;
+  '--maybe-'*)
+   lib=$(echo "$1" | sed 's/^--maybe-//' | to_escaped)
+   eval unset no_lib_$lib
+  ;;
+  '--distribution-version-string')
+   DISTRIBUTION_VERSION_STRING="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--without-beta')
+   BETA=false
+   EXPERIMENTAL=false
+  ;;
+  '--without-experimental')
+   EXPERIMENTAL=false
+  ;;
+  '--prefix')
+   PREFIX="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--prefix-bin')
+   PREFIX_BIN="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--prefix-lib')
+   PREFIX_LIB="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--prefix-inc')
+   PREFIX_INC="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--prefix-man')
+   PREFIX_MAN="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--prefix-pc')
+   PREFIX_PC="$2"
+   SHIFT_COUNT=1
+  ;;
+####################################
+# autof* options block:
+  '--prefix='*)
+   PREFIX=$(echo "$1" | cut -d= -f2)
+  ;;
+  '--prefix-bin='*)
+   PREFIX_BIN=$(echo "$1" | cut -d= -f2)
+  ;;
+  '--prefix-lib='*)
+   PREFIX_LIB=$(echo "$1" | cut -d= -f2)
+  ;;
+  '--prefix-inc='*)
+   PREFIX_INC=$(echo "$1" | cut -d= -f2)
+  ;;
+  '--prefix-man='*)
+   PREFIX_MAN=$(echo "$1" | cut -d= -f2)
+  ;;
+  '--prefix-pc='*)
+   PREFIX_PC=$(echo "$1" | cut -d= -f2)
+  ;;
+####################################
+  '--mmcu')
+   MMCU="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--exec-helper')
+   EXEC_HELPER="$2"
+   SHIFT_COUNT=1
+  ;;
+  '--target-win32')
+   TARGET_WIN32=true
+  ;;
+  *)
+   HANDLED=false
+  ;;
+ esac;
+}
+
+open_configure_files() {
+ exec 3> config.h 4> Makefile.conf 5> config.log
+}
+
+update_target() {
+ TARGET_CYGWIN=`echo "$SYSNAME" | if grep CYGWIN  > /dev/null; then echo true; else echo false; fi`
+ TARGET_WIN32=`echo  "$SYSNAME" | if grep MINGW32 > /dev/null; then echo true; else echo $TARGET_WIN32; fi`
+
+ if [ "$SYSNAME" = 'Darwin' ]
+ then
+  echo "Adding common $SYSNAME shared lib arguments..."
+  SHARED="$SHARED -fno-common -dynamiclib -compatibility_version 0.1 -current_version 0.1.0"
+  SHARED_CF="$SHARED_CF -fno-common"
+ elif [ "$SYSNAME" = 'NetBSD' ]
+ then
+  echo "Adding common $SYSNAME libpath arguments..."
+  LDPATH="$LDPATH -L/usr/local/lib/"
+ elif [ "$SYSNAME" = 'OpenBSD' ]
+ then
+  echo "Adding common $SYSNAME search path arguments..."
+  LDPATH="$LDPATH -L/usr/local/lib/"
+  INCPATH="$INCPATH -I/usr/local/include/"
+ # echo "Adding $SYSNAME build arguments..."
+ # SNDIO_EMUL=false
+ elif [ "$SYSNAME" = 'FreeBSD' ]
+ then
+  echo "Adding common $SYSNAME search path arguments..."
+  LDPATH="$LDPATH -L/usr/local/lib/"
+  INCPATH="$INCPATH -I/usr/local/include/"
+ elif $TARGET_WIN32
+ then
+  echo "Adding common win32 build arguments..."
+  rdynamic=false
+  fPIC=false
+  SHARED_SUFFIX='.dll'
+ elif $TARGET_CYGWIN
+ then
+  echo "Adding common cygwin build arguments..."
+  rdynamic=false
+  fPIC=false
+  SHARED_SUFFIX='.dll'
+ fi
+}
+
+update_prefixes() {
+ [ "$PREFIX_BIN"  = '' ] && PREFIX_BIN="$PREFIX/bin/"
+ [ "$PREFIX_LIB"  = '' ] && PREFIX_LIB="$PREFIX/lib/"
+ [ "$PREFIX_INC"  = '' ] && PREFIX_INC="$PREFIX/include/"
+ [ "$PREFIX_MAN"  = '' ] && PREFIX_MAN="$PREFIX/share/man/"
+ [ "$PREFIX_PC"   = '' ] && PREFIX_PC="$PREFIX_LIB/pkgconfig/"
+}
+
+update_ccft() {
+ CCTF="$CC $CFLAGS $LDFLAGS $LDPATH $INCPATH -Iinclude/ -o $TF_E $TF_C"
+}
+
+cleanup_ccft() {
+ rm -f $TF_C $TF_E
+ if [ "$TARGET_CYGWIN" = 'true' -o "$TARGET_WIN32" = 'true' ]
+ then
+  echo "Deleting win32 specific temp files: $TF_E.exe"
+  rm -f $TF_E.exe
+ fi
+}
+
+update_cc() {
+ if [ "$MMCU" != '' ]
+ then
+  CC="$CC -mmcu=$MMCU"
+ fi
+}
+
+write_header_makefileconf() {
+ {
+  echo "VERSION=$VERSION"
+  echo "DISTRIBUTION_VERSION_STRING=$DISTRIBUTION_VERSION_STRING"
+  echo
+  echo "SHARED=$SHARED"
+  echo "SHARED_CF=$SHARED_CF"
+  echo "SHARED_SUFFIX=$SHARED_SUFFIX"
+  $rdynamic && echo 'rdynamic=-rdynamic'
+  $fPIC     && echo 'fPIC=-fPIC'
+  $Wextra   && echo 'Wextra=-Wextra'
+  echo
+  echo "CC=$CC"
+  echo "RANLIB=$RANLIB"
+  echo "LDPATH=$LDPATH"
+  echo "INCPATH=$INCPATH"
+  echo
+  echo "OPTI_O=-O$OPTI_O"
+  echo
+  [ "$CFLAGS"  != '' ] && echo "CFLAGS  += $CFLAGS"
+  [ "$LDFLAGS" != '' ] && echo "LDFLAGS += $LDFLAGS"
+  echo
+  echo "EXEC_HELPER=$EXEC_HELPER"
+  echo "CROSS_COMPILE=$CROSS_COMPILE"
+  echo
+  echo "PREFIX=$PREFIX"
+  echo "PREFIX_BIN=$PREFIX_BIN"
+  echo "PREFIX_LIB=$PREFIX_LIB"
+  echo "PREFIX_INC=$PREFIX_INC"
+  echo "PREFIX_MAN=$PREFIX_MAN"
+  echo "PREFIX_PC=$PREFIX_PC"
+  echo
+ } >&4
+}
+
+write_footer_makefileconf() {
+ {
+  echo
+  echo '#ll'
+ } >&4
+}
+
+write_header_configlog() {
+ {
+  cat <<'EOF'
+//config.log:
+
+/*
+ * Logfile for configure script $Revision$ of RoarAudio
+ */
+
+EOF
+  echo '/* uname: ' $(uname -a) '*/'
+  echo '/* Date : ' $(date)  '*/'
+  echo
+
+  echo
+  echo
+
+  echo "ARGS(): $_CARGS"
+
+  for i in PATH SHELL CC RANLIB PKG_CONFIG SYSNAME \
+           TARGET_CYGWIN TARGET_WIN32 TARGET_MICROCONTROLLER CROSS_COMPILE \
+           MINIMAL EXEC_HELPER \
+           "$@"
+  do
+   eval echo "BASICCONF\($i\): \$$i";
+  done
+
+  echo
+  echo
+ } >&5
+}
+
+write_footer_configlog() {
+ {
+  echo
+  echo '//ll'
+ } >&5
+}
+
+write_header_configh() {
+ {
+  echo '//config.h:'
+  echo
+  echo "#ifndef $1"
+  echo "#define $1"
+  echo
+  echo '/* uname: ' $(uname -a) '*/'
+  echo '/* Date : ' $(date)  '*/'
+  echo
+ } >&3
+}
+
+write_footer_configh() {
+ {
+  echo
+  echo '#endif'
+  echo
+  echo '//ll'
+ } >&3
+}
+
+#ll
Index: build-system/configure.tests
===================================================================
--- build-system/configure.tests	(revision 5670)
+++ build-system/configure.tests	(revision 5670)
@@ -0,0 +1,868 @@
+#!/bin/false
+# vim:ft=sh
+
+#     Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
+#
+# This file is part of roard a part of RoarAudio,
+# a cross-platform sound system for both, home and professional use.
+# See README for details.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3
+# as published by the Free Software Foundation.
+#
+# RoarAudio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+
+test_pkgversion() {
+ echo -n "checking for version of this package... "
+ VERSION=`head -n 1 ChangeLog | cut -d' ' -f2`
+ echo "$VERSION"
+}
+
+test_buildstamp() {
+ echo -n "checking for build stamp of this package... "
+ BUILD_STAMP="`date -u +'%F %X'` (`id -un`@`uname -n`)"
+ echo "$BUILD_STAMP"
+}
+
+test_cc() {
+ echo -n "checking for C compiler... "
+ if [ "$CC" != '' ]
+ then
+  echo $CC
+ else
+  CC=$(which gcc cc 2> /dev/null | grep ^/ | head -n 1)
+  if [ "$CC" = '' ]
+  then
+   echo 'none'
+   exit 1;
+  fi
+  echo $CC
+ fi
+}
+
+test_ranlib() {
+ echo -n "checking for ranlib... "
+ if [ "$RANLIB" != '' ]
+ then
+  echo $RANLIB
+ else
+  _guess=`echo $CC | sed 's/[gp]*cc\(-.*\)*//'`
+  RANLIB=$(which ${_guess}ranlib ranlib 2> /dev/null | grep ^/ | head -n 1)
+  if [ "$RANLIB" = '' ]
+  then
+   echo 'none'
+  fi
+  echo $RANLIB
+ fi
+}
+
+test_pkgconfig() {
+ echo -n "checking for pkg-config... "
+ PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
+ if $PKG_CONFIG --help > /dev/null 2> /dev/null
+ then
+  echo $PKG_CONFIG
+ else
+  echo no
+ fi
+}
+
+test_sysname() {
+ echo -n "checking for sysname... "
+ SYSNAME=$(uname -s)
+ echo "$SYSNAME"
+}
+
+test_crosscompile() {
+ echo -n 'checking if we cross compile... '
+ if $CROSS_COMPILE
+ then
+  echo yes
+
+  echo -n "checking for exec helper... "
+  if [ "$EXEC_HELPER" = '' ]
+  then
+   if $TARGET_WIN32
+   then
+    EXEC_HELPER=$(which wine 2> /dev/null | grep ^/ | head -n 1)
+    if [ "$EXEC_HELPER" = '' ]
+    then
+     echo 'none (please install wine)'
+    else
+     echo "$EXEC_HELPER"
+    fi
+   else
+    echo 'none (unknown)'
+   fi
+  else
+   echo "$EXEC_HELPER"
+  fi
+
+  echo -n "checking for sysname... "
+  if $TARGET_CYGWIN
+  then
+   SYSNAME=cygwin
+  elif $TARGET_WIN32
+  then
+   SYSNAME=win32
+  else
+   SYSNAME=unknown
+  fi
+  echo "$SYSNAME"
+ else
+  echo no
+ fi
+}
+
+test_wextra() {
+ # Check for -Wextra
+ #Wextra
+ echo -n "checking if compiler supports -Wextra... "
+ echo 'int main (void) { return 0; }' > $TF_C
+ if $CCTF -Wextra 2> /dev/null;
+ then
+  echo yes
+  Wextra=true
+ else
+  echo no
+  Wextra=false
+ fi
+}
+
+test_cp_v() {
+ echo -n 'checking if cp supports -v... '
+ if cp -v --help > /dev/null 2> /dev/null
+ then
+  echo "cp_v=-v" >&4
+  echo yes
+ else
+  echo "cp_v=" >&4
+  echo no
+ fi
+}
+
+test_bin_format() {
+ echo -n "checking for binary format... "
+ echo "TEST BIN FORMAT:" >&5
+
+ {
+  echo "#include <stdio.h>"
+  echo
+  echo "int main (void) {"
+  echo " char buf[512];"
+  echo " size_t len;"
+  echo
+  echo " len = fread(buf, 1, sizeof(buf), stdin);"
+  echo " if ( len < 4 )"
+  echo "  return 1;"
+  echo
+  echo " if ( buf[0] == '\\177' && buf[1] == 'E' && buf[2] == 'L' && buf[3] == 'F' ) {"
+  echo '  printf("ELF\n");'
+  echo "  return 0;"
+  echo " }"
+  echo
+  echo " if ( buf[0] == 'M' && buf[1] == 'Z' ) {"
+  echo '  printf("MZ\n");'
+  echo "  return 0;"
+  echo " }"
+  echo
+  echo " return 1;"
+  echo "}"
+ } > $TF_C
+
+ echo "--- BEGIN OF CODE BLOCK ---" >&5
+ cat $TF_C >&5
+ echo "--- END OF CODE BLOCK ---" >&5
+
+ echo "BIN FORMAT() HAS COMPILER/LINKER OUTPUT:" >&5
+ echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
+ $CCTF >&5 2>&5;
+ R=$?
+ echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
+
+ if [ "$R" = '0' ]
+ then
+  BIN_FORMAT=`$EXEC_HELPER $TF_E < $TF_E 2> /dev/null`
+  R=$?
+  if [ "$R" = '0' ]
+  then
+   echo "$BIN_FORMAT"
+   echo "BIN FORMAT() IS '$BIN_FORMAT'" >&5
+  else
+   BIN_FORMAT=unknown
+   echo 'unknown'
+   echo "BIN FORMAT() NOT KNOWN" >&5
+  fi
+ else
+  BIN_FORMAT=unknown
+  echo 'unknown'
+  echo "BIN FORMAT() NOT KNOWN" >&5
+ fi
+}
+
+test_linkdeps() {
+ if [ "$LINK_DEPS" = 'auto' ]
+ then
+  if [ "$BIN_FORMAT" = 'ELF' ]
+  then
+   LINK_DEPS='indirect'
+  else
+   LINK_DEPS='full'
+  fi
+ fi
+
+ echo "LINK_DEPS=$LINK_DEPS" >&4
+ echo "checking for linkage model... $LINK_DEPS"
+}
+
+test_lib () {
+ _have_libs=false
+ _have_headers=false
+ _defs=''
+ echo > $TF_C
+
+ $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE"
+
+ name="$1"
+ echo -n "checking for $name... "
+ echo "TEST LIB: $name" >&5
+ shift;
+
+ if [ "$infotext" = '' ]
+ then
+  _info=''
+ else
+  _info=" ($infotext)"
+ fi
+
+ LIBS=''
+
+ while [ "$1" != '--' ]
+ do
+  echo "LIB($name) HAS LIB INFO: $1" >&5
+  case "$1" in
+   'c'|'-lc')
+    :; # no need to do anything
+   ;;
+   '-'*)
+    LIBS="$LIBS $1"
+    _have_libs=true
+   ;;
+   *)
+    LIBS="$LIBS -l$1"
+    _have_libs=true
+   ;;
+  esac
+  shift;
+ done
+
+ shift;
+
+ echo "LIB($name) IS TESTED USING LIBS: $LIBS" >&5
+
+ while [ "$1" != '' ]
+ do
+  _h="$1";
+  shift;
+  _envname=`echo "$_h" | to_escaped`
+  eval "_t=\$libname_$_envname"
+  echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
+  if [ "$_t" = 'false' ]
+  then
+   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
+  else
+   echo "#include <$_h>"  >> $TF_C
+   _have_headers=true
+  fi
+ done
+
+ echo 'int main (void) { return 0; }' >> $TF_C
+
+ if [ "$_have_libs" = 'false' -a "$_have_headers" = 'false' ]
+ then
+  echo "no (nothing left to test)$_info"
+  echo "LIB($name) HAS NOTHING TO TEST" >&5
+  return 1
+ fi
+
+ echo "LIB($name) IS TESTED USING TEST CODE:" >&5
+ echo "--- BEGIN OF CODE BLOCK ---" >&5
+ cat $TF_C >&5
+ echo "--- END OF CODE BLOCK ---" >&5
+
+ echo "LIB($name) HAS COMPILER/LINKER OUTPUT:" >&5
+ echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
+ $CCTF $_defs $LIBS >&5 2>&5;
+ R=$?
+ echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
+
+ if [ "$R" = '0' ]
+ then
+  echo "yes$_info"
+  echo "LIB($name) WAS FOUND" >&5
+ else
+  echo "no$_info"
+  echo "LIB($name) NOT FOUND" >&5
+ fi
+
+ return $R
+}
+
+test_lib_defmake () {
+ def="$1"
+ subdir="$2"
+ shift
+ shift
+ name="$1"
+ lib="$2"
+ shift
+
+ echo "TEST LIB: $name" >&5
+
+ [ "$subdir" = '%' ] && subdir=''
+
+ envlib=`echo "$lib"   | cut -d/ -f1 | to_escaped`
+ envname=`echo "$name" | to_escaped`
+
+ if [ "$envlib" = 'c' ]
+ then
+  envlib="$envname"
+ fi
+
+ echo "LIB($name) HAS envlib='$envlib', envname='$envname'" >&5
+
+ if [ "$lib" != '--' ]
+ then
+  echo "EVAL: _no=\$no_lib_$envlib" >&5
+  eval _no="\$no_lib_$envlib";
+  $MINIMAL && _no='XXX'
+
+  if [ "$_no" != '' ]
+  then
+    echo "checking for $name... disabled by user"
+    echo "LIB($name) IS DISABLED BY USER" >&5
+   [ "$subdir" != '' ] && \
+    echo "subdir_$subdir=" >&4
+   echo "lib_$envlib=" >&4
+   return;
+  fi
+ fi
+
+ lib="$lib/"
+
+ libn=`echo $lib | cut -d/ -f1`
+ is_fatal=`echo $lib | cut -d/ -f2`
+
+ lib="$libn"
+
+# echo "is_fatal(i)=$is_fatal" >&5
+
+ if [ "$is_fatal" = '' -o "$is_fatal" = 'no' -o "$is_fatal" = 'false' ]
+ then
+  is_fatal=false
+ else
+  is_fatal=true
+  shift; # maybe we have a pkg name, not a lib
+ fi
+
+ echo "LIB($name) HAS FATAL FLAG SET TO $is_fatal" >&5
+
+# echo "is_fatal(b)=$is_fatal" >&5
+
+ LIBS=$($PKG_CONFIG --silence-errors --cflags --libs $lib 2> /dev/null)
+ if [ "$?" != '0' ]
+ then
+  if $is_fatal
+  then
+   echo "checking for $name... no (fatal config errors)"
+   echo "LIB($name) HAS FATAL ERRORS" >&5
+   echo "LIB($name) NOT FOUND" >&5
+   [ "$subdir" != '' ] && \
+    echo "subdir_$subdir=" >&4
+   echo "lib_$envlib=" >&4
+   return
+  fi
+  LIBS="-l$lib"
+ fi
+
+ echo "LIB($name) HAS LIBS: $LIBS" >&5
+
+ if test_lib "$name" $LIBS "$@"
+ then
+  subdir_var='subdir_'"`echo $subdir | to_escaped`"
+  echo "#define $def"            >&3
+  [ "$subdir" != '' ] && \
+   echo "$subdir_var=$subdir" >&4
+  [ "$lib" != 'c' ] && \
+   echo "lib_$envlib=$LIBS" >&4
+  if [ "$lib" != 'c' ]
+  then
+   eval "lib_$envlib='$LIBS'"
+  else
+   echo "LIB($name) SETS libname_$envname=true" >&5
+   eval "libname_$envname=true"
+  fi
+ else
+  [ "$subdir" != '' ] && \
+   echo "subdir_$subdir=" >&4
+  [ "$lib" != 'c' ] && \
+   echo "lib_$envlib=" >&4
+  echo "LIB($name) SETS libname_$envname=false" >&5
+  eval "libname_$envname=false"
+ fi
+ echo >&5
+ echo >&5
+}
+
+test_tool_defmake () {
+ DEF="$1"
+ NAME="$2"
+ shift;
+ shift;
+ echo -n "checking for $NAME... "
+
+ echo "TEST TOOL: $NAME" >&5
+
+ if $RUNTIME_DETECT
+ then
+  echo "$1 (runtime detect)"
+  echo "TOOL($NAME) WILL BE RUNTIME DETECTED" >&5
+  echo "#define $DEF "\""$1"\" >&3
+ elif $MINIMAL
+ then
+  echo "disabled by user (minimalstic build)"
+  echo "TOOL($NAME) IS DISABLED BY USER" >&5
+ else
+
+  LIST=$(which "$@" 2> /dev/null | grep ^/ | head -n 1)
+
+  if [ "$LIST" = '' ]
+  then
+   echo 'no'
+   echo "TOOL($NAME) NOT FOUND" >&5
+  else
+   echo $LIST
+   echo "#define $DEF "\""$LIST"\" >&3
+   echo "TOOL($NAME) IS AT $LIST" >&5
+  fi
+ fi
+}
+
+test_func_defmake () {
+ _defs=''
+ DEF="$1"
+ NAME="$2"
+ shift;
+ shift;
+ echo -n "checking for $NAME()... "
+
+ CALL="$1"
+ shift;
+
+ $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE"
+
+ if [ "$infotext" = '' ]
+ then
+  _info=''
+ else
+  _info=" ($infotext)"
+ fi
+
+ LIBS=''
+
+ _funcname=`echo "$NAME" | to_escaped`
+
+ while [ "$1" != '--' ]
+ do
+  case "$1" in
+   'c'|'-lc')
+    :; # no need to do anything
+   ;;
+   '-'*)
+    LIBS="$LIBS $1"
+   ;;
+   *)
+    LIBS="-l$1"
+   ;;
+  esac
+  shift;
+ done
+
+ shift; # skip '--'
+
+ echo "TEST FUNCTION: $NAME" >&5
+
+ {
+  while [ "$1" != '' ]
+  do
+   _h="$1";
+   shift;
+   _envname=`echo "$_h" | to_escaped`
+   eval "_t=\$libname_$_envname"
+   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
+   if [ "$_t" = 'false' ]
+   then
+    echo "// not including <$_h> as it was tested as not present"
+   else
+    echo "#include <$_h>"
+   fi
+  done
+
+  echo 'int main (void) {'
+  echo " $CALL;"
+  echo ' return 0;'
+  echo '}'
+
+ } > $TF_C
+
+ echo "--- BEGIN OF CODE BLOCK ---" >&5
+ cat $TF_C >&5
+ echo "--- END OF CODE BLOCK ---" >&5
+
+ echo "FUNCTION($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
+ echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
+ $CCTF $_defs $LIBS >&5 2>&5;
+ R=$?
+ echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
+
+ if [ "$R" = '0' ]
+ then
+  eval funcname_$_funcname=true
+  echo "#define $DEF" >&3
+  echo "FUNCTION($NAME) IS OK" >&5
+  echo "yes$_info"
+ else
+  eval funcname_$_funcname=false
+  echo "FUNCTION($NAME) IS NOT OK" >&5
+  echo "no$_info"
+ fi
+
+}
+
+test_const_defmake () {
+ DEF="$1"
+ NAME="$2"
+ shift;
+ shift;
+ echo -n "checking for constant $NAME... "
+
+ TYPE="$1"
+ CONST="$2"
+ shift;
+ shift;
+
+ LIBS=''
+
+ while [ "$1" != '--' ]
+ do
+  case "$1" in
+   'c'|'-lc')
+    :; # no need to do anything
+   ;;
+   '-'*)
+    LIBS="$LIBS $1"
+   ;;
+   *)
+    LIBS="-l$1"
+   ;;
+  esac
+  shift;
+ done
+
+ shift; # skip '--'
+
+ echo "TEST CONST: $NAME" >&5
+
+ {
+  while [ "$1" != '' ]
+  do
+   _h="$1";
+   shift;
+   _envname=`echo "$_h" | to_escaped`
+   eval "_t=\$libname_$_envname"
+   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
+   if [ "$_t" = 'false' ]
+   then
+    echo "// not including <$_h> as it was tested as not present"
+   else
+    echo "#include <$_h>"
+   fi
+  done
+
+  case "$TYPE" in
+   ':int')
+    _type='int'
+   ;;
+   ':float')
+    _type='float'
+   ;;
+   ':ptr')
+    _type='void *'
+   ;;
+   *)
+    _type="$TYPE"
+   ;;
+  esac
+
+  echo 'int main (void) {'
+  echo " $_type x;"
+  echo " x = ($_type)$CONST;"
+  echo ' return 0;'
+  echo '}'
+
+ } > $TF_C
+
+ echo "--- BEGIN OF CODE BLOCK ---" >&5
+ cat $TF_C >&5
+ echo "--- END OF CODE BLOCK ---" >&5
+
+ echo "CONST($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
+ echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
+ $CCTF $LIBS >&5 2>&5;
+ R=$?
+ echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
+
+ if [ "$R" = '0' ]
+ then
+  echo "#define $DEF" >&3
+  echo "CONST($NAME) IS OK" >&5
+  echo yes
+ else
+  echo "CONST($NAME) IS NOT OK" >&5
+  echo no
+ fi
+}
+
+test_var_defmake () {
+ DEF="$1"
+ NAME="$2"
+ shift;
+ shift;
+ echo -n "checking for global variable $NAME... "
+
+ TYPE="$1"
+ VAR="$2"
+ shift;
+ shift;
+
+ LIBS=''
+
+ while [ "$1" != '--' ]
+ do
+  case "$1" in
+   'c'|'-lc')
+    :; # no need to do anything
+   ;;
+   '-'*)
+    LIBS="$LIBS $1"
+   ;;
+   *)
+    LIBS="-l$1"
+   ;;
+  esac
+  shift;
+ done
+
+ shift; # skip '--'
+
+ echo "TEST VAR: $NAME" >&5
+
+ {
+  while [ "$1" != '' ]
+  do
+   _h="$1";
+   shift;
+   _envname=`echo "$_h" | to_escaped`
+   eval "_t=\$libname_$_envname"
+   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
+   if [ "$_t" = 'false' ]
+   then
+    echo "// not including <$_h> as it was tested as not present"
+   else
+    echo "#include <$_h>"
+   fi
+  done
+
+  case "$TYPE" in
+   ':int')
+    _type='int'
+   ;;
+   ':float')
+    _type='float'
+   ;;
+   ':ptr')
+    _type='void *'
+   ;;
+   *)
+    _type="$TYPE"
+   ;;
+  esac
+
+  echo 'int main (void) {'
+  echo " $_type x;"
+  echo " x = ($_type)$VAR;"
+  echo " $VAR = x;"
+  echo ' return 0;'
+  echo '}'
+
+ } > $TF_C
+
+ echo "--- BEGIN OF CODE BLOCK ---" >&5
+ cat $TF_C >&5
+ echo "--- END OF CODE BLOCK ---" >&5
+
+ echo "VAR($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
+ echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
+ $CCTF $LIBS >&5 2>&5;
+ R=$?
+ echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
+
+ if [ "$R" = '0' ]
+ then
+  echo "#define $DEF" >&3
+  echo "VAR($NAME) IS OK" >&5
+  echo yes
+ else
+  echo "VAR($NAME) IS NOT OK" >&5
+  echo no
+ fi
+}
+
+test_version () {
+ DEF="$1"
+ NAME="$2"
+ PKGNAME="$3"
+
+ echo -n "checking for version of $NAME... "
+
+ _ver=$($PKG_CONFIG --modversion $PKGNAME 2> /dev/null)
+
+ if [ "$_ver" = '' ]
+ then
+  _ver=unknown
+ fi
+
+ echo $_ver
+
+ _ver_def=$(echo $_ver | to_escaped | to_upper)
+ echo "#define ${DEF}_$_ver_def" >&3
+
+ echo "$_ver" | if grep '^[0-9]*\.[0-9]*\.[0-9]*$' > /dev/null
+ then
+  _ver_vdef=$(echo "$_ver" | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]\)*$/_ROAR_MKVERSION(\1, \2, \3)/')
+  echo "#define ${DEF} $_ver_vdef" >&3
+ else
+  echo "#define ${DEF} 0" >&3
+ fi
+
+}
+
+test_type () {
+ DEF="$1"
+ NAME="$2"
+ INITVAL="$3"
+ DASHDASH="$4"
+ shift; shift;
+
+ if [ "$#" -ge '2' ]
+ then
+  shift; shift;
+ fi
+
+ HEADERS="stdint.h string.h unistd.h sys/types.h $*" #including headers here let
+                                                     #them get checked for presence.
+
+ [ "$INITVAL" = '' ] && INITVAL='0'
+
+ echo -n "checking for type $NAME... "
+ echo "TEST TYPE: $NAME" >&5
+
+ echo "// type test for type $NAME"  >  $TF_C # need a clean file, write something
+ for _h in $HEADERS
+ do
+  _envname=`echo "$_h" | to_escaped`
+  eval "_t=\$libname_$_envname"
+  echo "TYPE($NAME) DEPENDS ON $_h($_envname) with state '$_t'" >&5
+  if [ "$_t" = 'false' ]
+  then
+   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
+  else
+   echo "#include <$_h>"  >> $TF_C
+  fi
+ done
+ echo "int main (void) { $NAME _var = $INITVAL; return 0; }" >> $TF_C
+
+ echo "--- BEGIN OF CODE BLOCK ---" >&5
+ cat $TF_C >&5
+ echo "--- END OF CODE BLOCK ---" >&5
+
+ echo "TYPE($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
+ echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
+ $CCTF >&5 2>&5;
+ R=$?
+ echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
+
+ if [ "$R" = '0' ]
+ then
+  echo "#define $DEF" >&3
+  echo 'ok'
+  echo "TYPE($NAME) IS OK" >&5
+ else
+  echo 'not found'
+  echo "TYPE($NAME) NOT FOUND" >&5
+ fi
+}
+
+test_pa_type () {
+ DEF="$1"
+ NAME="$2"
+ TYPE="$3"
+ V0="$4"
+ V1="$5"
+ TEST="$6"
+ shift; shift; shift; shift; shift; shift;
+ HEADER="$*"
+ RS='%s'
+
+ case "$TYPE" in
+  'type')
+   MSG="checking for type of $NAME()... "
+  ;;
+  'args:'*)
+   MSG="checking for argument types of $NAME()... "
+   RS=`echo "$TYPE" | cut -d: -f2`
+  ;;
+ esac;
+
+ echo -n "$MSG"
+ echo '#include <pulse/pulseaudio.h>'  >  $TF_C
+ for _h in $HEADERS
+ do
+  echo "#include <$_h>"  >> $TF_C
+ done
+ echo '#include <string.h>'           >> $TF_C
+ echo 'int main (void) { return 0; }' >> $TF_C
+ echo "$TEST"                         >> $TF_C
+
+ if $CCTF 2> /dev/null;
+ then
+  R="$V0"
+ else
+  R="$V1"
+ fi
+
+ echo "#define $DEF $R" >&3
+ printf "$RS\n" "$R"
+}
+
+#ll
Index: build-system/configure.vars
===================================================================
--- build-system/configure.vars	(revision 5670)
+++ build-system/configure.vars	(revision 5670)
@@ -0,0 +1,86 @@
+#!/bin/false
+# vim:ft=sh
+
+#     Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2012
+#
+# This file is part of roard a part of RoarAudio,
+# a cross-platform sound system for both, home and professional use.
+# See README for details.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3
+# as published by the Free Software Foundation.
+#
+# RoarAudio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING.  If not, write to
+# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# wine prints errors to stdout so stderr redirects do not work.
+# To avoid common problems with wine and $LANG/$LC_* we just reset them.
+
+LANG=C
+LC_CTYPE=C
+LC_NUMERIC=C
+LC_TIME=C
+LC_COLLATE=C
+LC_MONETARY=C
+
+DISTRIBUTION_VERSION_STRING=''
+
+
+TF_C=testit.c
+TF_E=./testit
+LDPATH=''
+INCPATH=''
+
+OPTI_O=2
+
+CROSS_COMPILE=false
+
+SYSNAME='unknown'
+SHARED='-shared'
+SHARED_CF=''
+SHARED_SUFFIX='.so'
+fPIC=true
+Wextra=false
+rdynamic=true
+MMCU=''
+LINK_DEPS=auto
+PKG_CONFIG=false
+
+NEED_GNU_SOURCE=false
+
+PREFIX='/usr/local'
+PREFIX_BIN=''
+PREFIX_LIB=''
+PREFIX_INC=''
+PREFIX_MAN=''
+PREFIX_PC=''
+
+ROOT_UID=''
+
+HAVE_MAIN_ARGS=true
+
+MINIMAL=false
+BETA=true
+EXPERIMENTAL=true
+
+TARGET_WIN32=false
+TARGET_MICROCONTROLLER=false
+TARGET_CYGWIN=false
+
+EXEC_HELPER=''
+
+# other stuff we need to reset:
+infotext=''
+
+CCTF="false"
+_CARGS="$@";
+
+#ll
Index: configure
===================================================================
--- configure	(revision 5669)
+++ configure	(revision 5670)
@@ -1,24 +1,14 @@
 #!/bin/sh
 
-# check for bash...
-
-if [ "$(echo -n)" = '-n' ]
-then
- SHELL=$(which bash ksh sh 2> /dev/null | grep ^/ | head -n 1)
- exec $SHELL $0 "$@"
-fi
+CWD="`pwd`"
+ROAR_BUILDSYSTEM_DIR="$CWD/build-system"
+
+. "$ROAR_BUILDSYSTEM_DIR/configure.early"
+. "$ROAR_BUILDSYSTEM_DIR/configure.vars"
+. "$ROAR_BUILDSYSTEM_DIR/configure.lib"
+. "$ROAR_BUILDSYSTEM_DIR/configure.tests"
 
 PATH="$PATH":/sbin:/usr/sbin:/usr/local/sbin:/usr/pkg/sbin # Ensure superuser paths
 PATH="$PATH":/usr/lib/ssh:/usr/lib/openssh                 # Ensure SSH paths
-
-# wine prints errors to stdout so stderr redirects do not work.
-# To avoid common problems with wine and $LANG/$LC_* we just reset them.
-
-LANG=C
-LC_CTYPE=C
-LC_NUMERIC=C
-LC_TIME=C
-LC_COLLATE=C
-LC_MONETARY=C
 
 #set -x
@@ -29,37 +19,7 @@
 #--------
 
-DISTRIBUTION_VERSION_STRING=''
-
-
-TF_C=testit.c
-TF_E=./testit
-LDPATH=''
-INCPATH=''
-
-OPTI_O=2
-
-CROSS_COMPILE=false
-
-SYSNAME='unknown'
-SHARED='-shared'
-SHARED_CF=''
-SHARED_SUFFIX='.so'
 COMPBIN_SUFFIX='.r'
-fPIC=true
-Wextra=false
-rdynamic=true
-MMCU=''
-LINK_DEPS=auto
-PKG_CONFIG=false
 RUNTIME_DETECT=false
 
-NEED_GNU_SOURCE=false
-
-PREFIX='/usr/local'
-PREFIX_BIN=''
-PREFIX_LIB=''
-PREFIX_INC=''
-PREFIX_MAN=''
-PREFIX_PC=''
 PREFIX_COMP_LIBS=''
 PREFIX_COMP_BINS=''
@@ -75,6 +35,4 @@
 TTY_DEV=""
 
-ROOT_UID=''
-
 VORBIS_BITS=32
 
@@ -127,16 +85,4 @@
 WITHOUT_DCOMP=''
 
-HAVE_MAIN_ARGS=true
-
-MINIMAL=false
-BETA=true
-EXPERIMENTAL=true
-
-TARGET_WIN32=false
-TARGET_MICROCONTROLLER=false
-TARGET_CYGWIN=false
-
-EXEC_HELPER=''
-
 ROAR_DRIVER_DEFAULT=''
 ROAR_DRIVER_CODEC=''
@@ -148,71 +94,19 @@
 no_lib_ssl=true
 
-_CARGS="$@";
-
-# other stuff we need to reset:
-infotext=''
-
-# some very basic string functions:
-to_upper() {
- tr 'a-z' 'A-Z'
-}
-
-to_escaped() {
- tr 'A-Z/.+-' 'a-z____'
-}
-
-echo -n "checking for version of this package... "
-VERSION=`head -n 1 ChangeLog | cut -d' ' -f2`
-echo "$VERSION"
-
-echo -n "checking for build stamp of this package... "
-BUILD_STAMP="`date -u +'%F %X'` (`id -un`@`uname -n`)"
-echo "$BUILD_STAMP"
-
-echo -n "checking for C compiler... "
-if [ "$CC" != '' ]
-then
- echo $CC
-else
- CC=$(which gcc cc 2> /dev/null | grep ^/ | head -n 1)
- if [ "$CC" = '' ]
- then
-  echo 'none'
-  exit 1;
- fi
- echo $CC
-fi
-
-echo -n "checking for ranlib... "
-if [ "$RANLIB" != '' ]
-then
- echo $RANLIB
-else
- _guess=`echo $CC | sed 's/[gp]*cc\(-.*\)*//'`
- RANLIB=$(which ${_guess}ranlib ranlib 2> /dev/null | grep ^/ | head -n 1)
- if [ "$RANLIB" = '' ]
- then
-  echo 'none'
- fi
- echo $RANLIB
-fi
-
-echo -n "checking for pkg-config... "
-PKG_CONFIG=$(which pkg-config false 2> /dev/null | grep ^/ | head -n 1)
-if $PKG_CONFIG --help > /dev/null 2> /dev/null
-then
- echo $PKG_CONFIG
-else
- echo no
-fi
+test_pkgversion
+test_buildstamp
+test_cc
+test_ranlib
+test_pkgconfig
+test_sysname
 
 #Makefile.conf not yet open, write it later
-
-echo -n "checking for sysname... "
-SYSNAME=$(uname -s)
-echo "$SYSNAME"
 
 while [ "$1" != '' ]
 do
+ parse_option "$@"
+ shift $SHIFT_COUNT
+ $HANDLED && continue;
+
  case "$1" in
   '--help')
@@ -341,47 +235,4 @@
    exit 0;
   ;;
-  '--ldpath')
-   LDPATH="$LDPATH -L$2"
-   shift;
-  ;;
-  '--incpath')
-   INCPATH="$INCPATH -I$2"
-   shift;
-  ;;
-  '--addpath')
-   LDPATH="$LDPATH -L$2/lib/"
-   INCPATH="$INCPATH -I$2/include/"
-   shift;
-  ;;
-  '--root')
-   LDPATH="$LDPATH -L$2/lib/"
-   INCPATH="$INCPATH -I$2/include/"
-   PREFIX="$2"
-   shift;
-  ;;
-  '--cflags')
-   CFLAGS="$2"
-   shift;
-  ;;
-  '--ldflags')
-   LDFLAGS="$2"
-   shift;
-  ;;
-  '--opti')
-   OPTI_O="$2"
-   shift;
-  ;;
-  '--link-deps')
-   LINK_DEPS="$2"
-   shift;
-  ;;
-  '--cc')
-   CC="$2"
-   shift;
-  ;;
-  '--ranlib')
-   RANLIB="$2"
-   shift;
-  ;;
   '--cdrom')
    CDROM="$2"
@@ -415,16 +266,4 @@
    DEFAULT_GRP="$2"
    shift;
-  ;;
-  '--root-uid')
-   ROOT_UID="$2"
-   shift;
-  ;;
-  '--no-'*)
-   lib=$(echo "$1" | sed 's/^--no-//' | to_escaped)
-   eval no_lib_$lib=true
-  ;;
-  '--maybe-'*)
-   lib=$(echo "$1" | sed 's/^--maybe-//' | to_escaped)
-   eval unset no_lib_$lib
   ;;
   '--runtime-detect')
@@ -524,8 +363,4 @@
   '--without-listen')
    NO_LISTEN=true
-  ;;
-  '--distribution-version-string')
-   DISTRIBUTION_VERSION_STRING="$2"
-   shift;
   ;;
   '--roard-cfreq')
@@ -570,35 +405,4 @@
    WITHOUT_DCOMP="$WITHOUT_DCOMP"' sources ssynth cb midi light raw rdtcs cdriver emul_esd emul_simple emul_rsound emul_rplay emul_gopher mixer'
   ;;
-  '--without-beta')
-   BETA=false
-   EXPERIMENTAL=false
-  ;;
-  '--without-experimental')
-   EXPERIMENTAL=false
-  ;;
-  '--prefix')
-   PREFIX="$2"
-   shift;
-  ;;
-  '--prefix-bin')
-   PREFIX_BIN="$2"
-   shift;
-  ;;
-  '--prefix-lib')
-   PREFIX_LIB="$2"
-   shift;
-  ;;
-  '--prefix-inc')
-   PREFIX_INC="$2"
-   shift;
-  ;;
-  '--prefix-man')
-   PREFIX_MAN="$2"
-   shift;
-  ;;
-  '--prefix-pc')
-   PREFIX_PC="$2"
-   shift;
-  ;;
   # we should remove --prefix-comp soon
   '--prefix-comp'|'--prefix-comp-libs')
@@ -616,22 +420,4 @@
 ####################################
 # autof* options block:
-  '--prefix='*)
-   PREFIX=$(echo "$1" | cut -d= -f2)
-  ;;
-  '--prefix-bin='*)
-   PREFIX_BIN=$(echo "$1" | cut -d= -f2)
-  ;;
-  '--prefix-lib='*)
-   PREFIX_LIB=$(echo "$1" | cut -d= -f2)
-  ;;
-  '--prefix-inc='*)
-   PREFIX_INC=$(echo "$1" | cut -d= -f2)
-  ;;
-  '--prefix-man='*)
-   PREFIX_MAN=$(echo "$1" | cut -d= -f2)
-  ;;
-  '--prefix-pc='*)
-   PREFIX_PC=$(echo "$1" | cut -d= -f2)
-  ;;
   '--prefix-comp-libs='*)
    PREFIX_COMP_LIBS=$(echo "$1" | cut -d= -f2)
@@ -644,15 +430,7 @@
   ;;
 ####################################
-  '--mmcu')
-   MMCU="$2"
-   shift;
-  ;;
   '--cross-compile')
    CROSS_COMPILE=true
    RUNTIME_DETECT=true
-  ;;
-  '--exec-helper')
-   EXEC_HELPER="$2"
-   shift;
   ;;
   '--target-microcontroller')
@@ -666,7 +444,4 @@
    WITHOUT_VIO="$WITHOUT_VIO"' cmd'
   ;;
-  '--target-win32')
-   TARGET_WIN32=true
-  ;;
  esac;
 
@@ -694,709 +469,6 @@
 fi
 
-CCTF="false"
-
-test_lib () {
- _have_libs=false
- _have_headers=false
- _defs=''
- echo > $TF_C
-
- $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE"
-
- name="$1"
- echo -n "checking for $name... "
- echo "TEST LIB: $name" >&5
- shift;
-
- if [ "$infotext" = '' ]
- then
-  _info=''
- else
-  _info=" ($infotext)"
- fi
-
- LIBS=''
-
- while [ "$1" != '--' ]
- do
-  echo "LIB($name) HAS LIB INFO: $1" >&5
-  case "$1" in
-   'c'|'-lc')
-    :; # no need to do anything
-   ;;
-   '-'*)
-    LIBS="$LIBS $1"
-    _have_libs=true
-   ;;
-   *)
-    LIBS="$LIBS -l$1"
-    _have_libs=true
-   ;;
-  esac
-  shift;
- done
-
- shift;
-
- echo "LIB($name) IS TESTED USING LIBS: $LIBS" >&5
-
- while [ "$1" != '' ]
- do
-  _h="$1";
-  shift;
-  _envname=`echo "$_h" | to_escaped`
-  eval "_t=\$libname_$_envname"
-  echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
-  if [ "$_t" = 'false' ]
-  then
-   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
-  else
-   echo "#include <$_h>"  >> $TF_C
-   _have_headers=true
-  fi
- done
-
- echo 'int main (void) { return 0; }' >> $TF_C
-
- if [ "$_have_libs" = 'false' -a "$_have_headers" = 'false' ]
- then
-  echo "no (nothing left to test)$_info"
-  echo "LIB($name) HAS NOTHING TO TEST" >&5
-  return 1
- fi
-
- echo "LIB($name) IS TESTED USING TEST CODE:" >&5
- echo "--- BEGIN OF CODE BLOCK ---" >&5
- cat $TF_C >&5
- echo "--- END OF CODE BLOCK ---" >&5
-
- echo "LIB($name) HAS COMPILER/LINKER OUTPUT:" >&5
- echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
- $CCTF $_defs $LIBS >&5 2>&5;
- R=$?
- echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
-
- if [ "$R" = '0' ]
- then
-  echo "yes$_info"
-  echo "LIB($name) WAS FOUND" >&5
- else
-  echo "no$_info"
-  echo "LIB($name) NOT FOUND" >&5
- fi
-
- return $R
-}
-
-test_lib_defmake () {
- def="$1"
- subdir="$2"
- shift
- shift
- name="$1"
- lib="$2"
- shift
-
- echo "TEST LIB: $name" >&5
-
- [ "$subdir" = '%' ] && subdir=''
-
- envlib=`echo "$lib"   | cut -d/ -f1 | to_escaped`
- envname=`echo "$name" | to_escaped`
-
- if [ "$envlib" = 'c' ]
- then
-  envlib="$envname"
- fi
-
- echo "LIB($name) HAS envlib='$envlib', envname='$envname'" >&5
-
- if [ "$lib" != '--' ]
- then
-  echo "EVAL: _no=\$no_lib_$envlib" >&5
-  eval _no="\$no_lib_$envlib";
-  $MINIMAL && _no='XXX'
-
-  if [ "$_no" != '' ]
-  then
-    echo "checking for $name... disabled by user"
-    echo "LIB($name) IS DISABLED BY USER" >&5
-   [ "$subdir" != '' ] && \
-    echo "subdir_$subdir=" >&4
-   echo "lib_$envlib=" >&4
-   return;
-  fi
- fi
-
- lib="$lib/"
-
- libn=`echo $lib | cut -d/ -f1`
- is_fatal=`echo $lib | cut -d/ -f2`
-
- lib="$libn"
-
-# echo "is_fatal(i)=$is_fatal" >&5
-
- if [ "$is_fatal" = '' -o "$is_fatal" = 'no' -o "$is_fatal" = 'false' ]
- then
-  is_fatal=false
- else
-  is_fatal=true
-  shift; # maybe we have a pkg name, not a lib
- fi
-
- echo "LIB($name) HAS FATAL FLAG SET TO $is_fatal" >&5
-
-# echo "is_fatal(b)=$is_fatal" >&5
-
- LIBS=$($PKG_CONFIG --silence-errors --cflags --libs $lib 2> /dev/null)
- if [ "$?" != '0' ]
- then
-  if $is_fatal
-  then
-   echo "checking for $name... no (fatal config errors)"
-   echo "LIB($name) HAS FATAL ERRORS" >&5
-   echo "LIB($name) NOT FOUND" >&5
-   [ "$subdir" != '' ] && \
-    echo "subdir_$subdir=" >&4
-   echo "lib_$envlib=" >&4
-   return
-  fi
-  LIBS="-l$lib"
- fi
-
- echo "LIB($name) HAS LIBS: $LIBS" >&5
-
- if test_lib "$name" $LIBS "$@"
- then
-  subdir_var='subdir_'"`echo $subdir | to_escaped`"
-  echo "#define $def"            >&3
-  [ "$subdir" != '' ] && \
-   echo "$subdir_var=$subdir" >&4
-  [ "$lib" != 'c' ] && \
-   echo "lib_$envlib=$LIBS" >&4
-  if [ "$lib" != 'c' ]
-  then
-   eval "lib_$envlib='$LIBS'"
-  else
-   echo "LIB($name) SETS libname_$envname=true" >&5
-   eval "libname_$envname=true"
-  fi
- else
-  [ "$subdir" != '' ] && \
-   echo "subdir_$subdir=" >&4
-  [ "$lib" != 'c' ] && \
-   echo "lib_$envlib=" >&4
-  echo "LIB($name) SETS libname_$envname=false" >&5
-  eval "libname_$envname=false"
- fi
- echo >&5
- echo >&5
-}
-
-test_tool_defmake () {
- DEF="$1"
- NAME="$2"
- shift;
- shift;
- echo -n "checking for $NAME... "
-
- echo "TEST TOOL: $NAME" >&5
-
- if $RUNTIME_DETECT
- then
-  echo "$1 (runtime detect)"
-  echo "TOOL($NAME) WILL BE RUNTIME DETECTED" >&5
-  echo "#define $DEF "\""$1"\" >&3
- elif $MINIMAL
- then
-  echo "disabled by user (minimalstic build)"
-  echo "TOOL($NAME) IS DISABLED BY USER" >&5
- else
-
-  LIST=$(which "$@" 2> /dev/null | grep ^/ | head -n 1)
-
-  if [ "$LIST" = '' ]
-  then
-   echo 'no'
-   echo "TOOL($NAME) NOT FOUND" >&5
-  else
-   echo $LIST
-   echo "#define $DEF "\""$LIST"\" >&3
-   echo "TOOL($NAME) IS AT $LIST" >&5
-  fi
- fi
-}
-
-test_func_defmake () {
- _defs=''
- DEF="$1"
- NAME="$2"
- shift;
- shift;
- echo -n "checking for $NAME()... "
-
- CALL="$1"
- shift;
-
- $NEED_GNU_SOURCE && _defs="$_defs -D_GNU_SOURCE"
-
- if [ "$infotext" = '' ]
- then
-  _info=''
- else
-  _info=" ($infotext)"
- fi
-
- LIBS=''
-
- _funcname=`echo "$NAME" | to_escaped`
-
- while [ "$1" != '--' ]
- do
-  case "$1" in
-   'c'|'-lc')
-    :; # no need to do anything
-   ;;
-   '-'*)
-    LIBS="$LIBS $1"
-   ;;
-   *)
-    LIBS="-l$1"
-   ;;
-  esac
-  shift;
- done
-
- shift; # skip '--'
-
- echo "TEST FUNCTION: $NAME" >&5
-
- {
-  while [ "$1" != '' ]
-  do
-   _h="$1";
-   shift;
-   _envname=`echo "$_h" | to_escaped`
-   eval "_t=\$libname_$_envname"
-   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
-   if [ "$_t" = 'false' ]
-   then
-    echo "// not including <$_h> as it was tested as not present"
-   else
-    echo "#include <$_h>"
-   fi
-  done
-
-  echo 'int main (void) {'
-  echo " $CALL;"
-  echo ' return 0;'
-  echo '}'
-
- } > $TF_C
-
- echo "--- BEGIN OF CODE BLOCK ---" >&5
- cat $TF_C >&5
- echo "--- END OF CODE BLOCK ---" >&5
-
- echo "FUNCTION($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
- echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
- $CCTF $_defs $LIBS >&5 2>&5;
- R=$?
- echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
-
- if [ "$R" = '0' ]
- then
-  eval funcname_$_funcname=true
-  echo "#define $DEF" >&3
-  echo "FUNCTION($NAME) IS OK" >&5
-  echo "yes$_info"
- else
-  eval funcname_$_funcname=false
-  echo "FUNCTION($NAME) IS NOT OK" >&5
-  echo "no$_info"
- fi
-
-}
-
-test_const_defmake () {
- DEF="$1"
- NAME="$2"
- shift;
- shift;
- echo -n "checking for constant $NAME... "
-
- TYPE="$1"
- CONST="$2"
- shift;
- shift;
-
- LIBS=''
-
- while [ "$1" != '--' ]
- do
-  case "$1" in
-   'c'|'-lc')
-    :; # no need to do anything
-   ;;
-   '-'*)
-    LIBS="$LIBS $1"
-   ;;
-   *)
-    LIBS="-l$1"
-   ;;
-  esac
-  shift;
- done
-
- shift; # skip '--'
-
- echo "TEST CONST: $NAME" >&5
-
- {
-  while [ "$1" != '' ]
-  do
-   _h="$1";
-   shift;
-   _envname=`echo "$_h" | to_escaped`
-   eval "_t=\$libname_$_envname"
-   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
-   if [ "$_t" = 'false' ]
-   then
-    echo "// not including <$_h> as it was tested as not present"
-   else
-    echo "#include <$_h>"
-   fi
-  done
-
-  case "$TYPE" in
-   ':int')
-    _type='int'
-   ;;
-   ':float')
-    _type='float'
-   ;;
-   ':ptr')
-    _type='void *'
-   ;;
-   *)
-    _type="$TYPE"
-   ;;
-  esac
-
-  echo 'int main (void) {'
-  echo " $_type x;"
-  echo " x = ($_type)$CONST;"
-  echo ' return 0;'
-  echo '}'
-
- } > $TF_C
-
- echo "--- BEGIN OF CODE BLOCK ---" >&5
- cat $TF_C >&5
- echo "--- END OF CODE BLOCK ---" >&5
-
- echo "CONST($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
- echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
- $CCTF $LIBS >&5 2>&5;
- R=$?
- echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
-
- if [ "$R" = '0' ]
- then
-  echo "#define $DEF" >&3
-  echo "CONST($NAME) IS OK" >&5
-  echo yes
- else
-  echo "CONST($NAME) IS NOT OK" >&5
-  echo no
- fi
-}
-
-test_var_defmake () {
- DEF="$1"
- NAME="$2"
- shift;
- shift;
- echo -n "checking for global variable $NAME... "
-
- TYPE="$1"
- VAR="$2"
- shift;
- shift;
-
- LIBS=''
-
- while [ "$1" != '--' ]
- do
-  case "$1" in
-   'c'|'-lc')
-    :; # no need to do anything
-   ;;
-   '-'*)
-    LIBS="$LIBS $1"
-   ;;
-   *)
-    LIBS="-l$1"
-   ;;
-  esac
-  shift;
- done
-
- shift; # skip '--'
-
- echo "TEST VAR: $NAME" >&5
-
- {
-  while [ "$1" != '' ]
-  do
-   _h="$1";
-   shift;
-   _envname=`echo "$_h" | to_escaped`
-   eval "_t=\$libname_$_envname"
-   echo "LIB($name) DEPENDS ON $_h($_envname) with state '$_t'" >&5
-   if [ "$_t" = 'false' ]
-   then
-    echo "// not including <$_h> as it was tested as not present"
-   else
-    echo "#include <$_h>"
-   fi
-  done
-
-  case "$TYPE" in
-   ':int')
-    _type='int'
-   ;;
-   ':float')
-    _type='float'
-   ;;
-   ':ptr')
-    _type='void *'
-   ;;
-   *)
-    _type="$TYPE"
-   ;;
-  esac
-
-  echo 'int main (void) {'
-  echo " $_type x;"
-  echo " x = ($_type)$VAR;"
-  echo " $VAR = x;"
-  echo ' return 0;'
-  echo '}'
-
- } > $TF_C
-
- echo "--- BEGIN OF CODE BLOCK ---" >&5
- cat $TF_C >&5
- echo "--- END OF CODE BLOCK ---" >&5
-
- echo "VAR($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
- echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
- $CCTF $LIBS >&5 2>&5;
- R=$?
- echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
-
- if [ "$R" = '0' ]
- then
-  echo "#define $DEF" >&3
-  echo "VAR($NAME) IS OK" >&5
-  echo yes
- else
-  echo "VAR($NAME) IS NOT OK" >&5
-  echo no
- fi
-}
-
-test_version () {
- DEF="$1"
- NAME="$2"
- PKGNAME="$3"
-
- echo -n "checking for version of $NAME... "
-
- _ver=$($PKG_CONFIG --modversion $PKGNAME 2> /dev/null)
-
- if [ "$_ver" = '' ]
- then
-  _ver=unknown
- fi
-
- echo $_ver
-
- _ver_def=$(echo $_ver | to_escaped | to_upper)
- echo "#define ${DEF}_$_ver_def" >&3
-
- echo "$_ver" | if grep '^[0-9]*\.[0-9]*\.[0-9]*$' > /dev/null
- then
-  _ver_vdef=$(echo "$_ver" | sed 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]\)*$/_ROAR_MKVERSION(\1, \2, \3)/')
-  echo "#define ${DEF} $_ver_vdef" >&3
- else
-  echo "#define ${DEF} 0" >&3
- fi
-
-}
-
-test_type () {
- DEF="$1"
- NAME="$2"
- INITVAL="$3"
- DASHDASH="$4"
- shift; shift;
-
- if [ "$#" -ge '2' ]
- then
-  shift; shift;
- fi
-
- HEADERS="stdint.h string.h unistd.h sys/types.h $*" #including headers here let
-                                                     #them get checked for presence.
-
- [ "$INITVAL" = '' ] && INITVAL='0'
-
- echo -n "checking for type $NAME... "
- echo "TEST TYPE: $NAME" >&5
-
- echo "// type test for type $NAME"  >  $TF_C # need a clean file, write something
- for _h in $HEADERS
- do
-  _envname=`echo "$_h" | to_escaped`
-  eval "_t=\$libname_$_envname"
-  echo "TYPE($NAME) DEPENDS ON $_h($_envname) with state '$_t'" >&5
-  if [ "$_t" = 'false' ]
-  then
-   echo "// not including <$_h> as it was tested as not present"  >> $TF_C
-  else
-   echo "#include <$_h>"  >> $TF_C
-  fi
- done
- echo "int main (void) { $NAME _var = $INITVAL; return 0; }" >> $TF_C
-
- echo "--- BEGIN OF CODE BLOCK ---" >&5
- cat $TF_C >&5
- echo "--- END OF CODE BLOCK ---" >&5
-
- echo "TYPE($NAME) HAS COMPILER/LINKER OUTPUT:" >&5
- echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
- $CCTF >&5 2>&5;
- R=$?
- echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
-
- if [ "$R" = '0' ]
- then
-  echo "#define $DEF" >&3
-  echo 'ok'
-  echo "TYPE($NAME) IS OK" >&5
- else
-  echo 'not found'
-  echo "TYPE($NAME) NOT FOUND" >&5
- fi
-}
-
-test_pa_type () {
- DEF="$1"
- NAME="$2"
- TYPE="$3"
- V0="$4"
- V1="$5"
- TEST="$6"
- shift; shift; shift; shift; shift; shift;
- HEADER="$*"
- RS='%s'
-
- case "$TYPE" in
-  'type')
-   MSG="checking for type of $NAME()... "
-  ;;
-  'args:'*)
-   MSG="checking for argument types of $NAME()... "
-   RS=`echo "$TYPE" | cut -d: -f2`
-  ;;
- esac;
-
- echo -n "$MSG"
- echo '#include <pulse/pulseaudio.h>'  >  $TF_C
- for _h in $HEADERS
- do
-  echo "#include <$_h>"  >> $TF_C
- done
- echo '#include <string.h>'           >> $TF_C
- echo 'int main (void) { return 0; }' >> $TF_C
- echo "$TEST"                         >> $TF_C
-
- if $CCTF 2> /dev/null;
- then
-  R="$V0"
- else
-  R="$V1"
- fi
-
- echo "#define $DEF $R" >&3
- printf "$RS\n" "$R"
-}
-
-test_bin_format() {
- echo -n "checking for binary format... "
- echo "TEST BIN FORMAT:" >&5
-
- {
-  echo "#include <stdio.h>"
-  echo
-  echo "int main (void) {"
-  echo " char buf[512];"
-  echo " size_t len;"
-  echo
-  echo " len = fread(buf, 1, sizeof(buf), stdin);"
-  echo " if ( len < 4 )"
-  echo "  return 1;"
-  echo
-  echo " if ( buf[0] == '\\177' && buf[1] == 'E' && buf[2] == 'L' && buf[3] == 'F' ) {"
-  echo '  printf("ELF\n");'
-  echo "  return 0;"
-  echo " }"
-  echo
-  echo " if ( buf[0] == 'M' && buf[1] == 'Z' ) {"
-  echo '  printf("MZ\n");'
-  echo "  return 0;"
-  echo " }"
-  echo
-  echo " return 1;"
-  echo "}"
- } > $TF_C
-
- echo "--- BEGIN OF CODE BLOCK ---" >&5
- cat $TF_C >&5
- echo "--- END OF CODE BLOCK ---" >&5
-
- echo "BIN FORMAT() HAS COMPILER/LINKER OUTPUT:" >&5
- echo "--- BEGIN OF CHILD OUTPUT BLOCK ---" >&5
- $CCTF >&5 2>&5;
- R=$?
- echo "--- END OF CHILD OUTPUT BLOCK ---" >&5
-
- if [ "$R" = '0' ]
- then
-  BIN_FORMAT=`$EXEC_HELPER $TF_E < $TF_E 2> /dev/null`
-  R=$?
-  if [ "$R" = '0' ]
-  then
-   echo "$BIN_FORMAT"
-   echo "BIN FORMAT() IS '$BIN_FORMAT'" >&5
-  else
-   BIN_FORMAT=unknown
-   echo 'unknown'
-   echo "BIN FORMAT() NOT KNOWN" >&5
-  fi
- else
-  BIN_FORMAT=unknown
-  echo 'unknown'
-  echo "BIN FORMAT() NOT KNOWN" >&5
- fi
-}
-
-exec 3> config.h 4> Makefile.conf 5> config.log
-
-TARGET_CYGWIN=`echo "$SYSNAME" | if grep CYGWIN  > /dev/null; then echo true; else echo false; fi`
-TARGET_WIN32=`echo  "$SYSNAME" | if grep MINGW32 > /dev/null; then echo true; else echo $TARGET_WIN32; fi`
+open_configure_files
+update_target
 
 if $TARGET_WIN32
@@ -1414,86 +486,21 @@
 fi
 
-if [ "$SYSNAME" = 'Darwin' ]
-then
- echo "Adding $SYSNAME shared lib arguments..."
- SHARED="$SHARED -fno-common -dynamiclib -compatibility_version 0.1 -current_version 0.1.0"
- SHARED_CF="$SHARED_CF -fno-common"
-elif [ "$SYSNAME" = 'NetBSD' ]
-then
- echo "Adding $SYSNAME libpath arguments..."
- LDPATH="$LDPATH -L/usr/local/lib/"
-elif [ "$SYSNAME" = 'OpenBSD' ]
+if [ "$SYSNAME" = 'FreeBSD' ]
 then
  echo "Adding $SYSNAME search path arguments..."
- LDPATH="$LDPATH -L/usr/local/lib/"
- INCPATH="$INCPATH -I/usr/local/include/"
-# echo "Adding $SYSNAME build arguments..."
-# SNDIO_EMUL=false
-elif [ "$SYSNAME" = 'FreeBSD' ]
-then
- echo "Adding $SYSNAME search path arguments..."
- LDPATH="$LDPATH -L/usr/local/lib/"
- INCPATH="$INCPATH -I/usr/local/include/"
  [ "$DEFAULT_GRP" = '' ] && DEFAULT_GRP='wheel'
 elif $TARGET_WIN32
 then
  echo "Adding win32 build arguments..."
- rdynamic=false
- fPIC=false
- SHARED_SUFFIX='.dll'
  COMPBIN_SUFFIX='.bat'
 elif $TARGET_CYGWIN
 then
  echo "Adding cygwin build arguments..."
- rdynamic=false
- fPIC=false
- SHARED_SUFFIX='.dll'
  COMPBIN_SUFFIX='.bat'
 fi
 
-echo -n 'checking if we cross compile... '
-if $CROSS_COMPILE
-then
- echo yes
-
- echo -n "checking for exec helper... "
- if [ "$EXEC_HELPER" = '' ]
- then
-  if $TARGET_WIN32
-  then
-   EXEC_HELPER=$(which wine 2> /dev/null | grep ^/ | head -n 1)
-   if [ "$EXEC_HELPER" = '' ]
-   then
-    echo 'none (please install wine)'
-   else
-    echo "$EXEC_HELPER"
-   fi
-  else
-   echo 'none (unknown)'
-  fi
- else
-  echo "$EXEC_HELPER"
- fi
-
- echo -n "checking for sysname... "
- if $TARGET_CYGWIN
- then
-  SYSNAME=cygwin
- elif $TARGET_WIN32
- then
-  SYSNAME=win32
- else
-  SYSNAME=unknown
- fi
- echo "$SYSNAME"
-else
- echo no
-fi
-
-[ "$PREFIX_BIN"  = '' ] && PREFIX_BIN="$PREFIX/bin/"
-[ "$PREFIX_LIB"  = '' ] && PREFIX_LIB="$PREFIX/lib/"
-[ "$PREFIX_INC"  = '' ] && PREFIX_INC="$PREFIX/include/"
-[ "$PREFIX_MAN"  = '' ] && PREFIX_MAN="$PREFIX/share/man/"
-[ "$PREFIX_PC"   = '' ] && PREFIX_PC="$PREFIX_LIB/pkgconfig/"
+test_crosscompile
+
+update_prefixes
 [ "$PREFIX_COMP_LIBS" = '' ] && PREFIX_COMP_LIBS="$PREFIX_LIB/roaraudio/complibs/"
 [ "$PREFIX_COMP_BINS" = '' ] && PREFIX_COMP_BINS="$PREFIX_LIB/roaraudio/compbins/"
@@ -1502,59 +509,18 @@
 [ "$DEFAULT_GRP" = '' ] && DEFAULT_GRP='audio'
 
-CCTF="$CC $CFLAGS $LDFLAGS $LDPATH $INCPATH -Iinclude/ -o $TF_E $TF_C"
-
-if [ "$MMCU" != '' ]
-then
- CC="$CC -mmcu=$MMCU"
-fi
-
-# Check for -Wextra
-#Wextra
-echo -n "checking if compiler supports -Wextra... "
-echo 'int main (void) { return 0; }' > $TF_C
-if $CCTF -Wextra 2> /dev/null;
-then
- echo yes
- Wextra=true
-else
- echo no
- Wextra=false
-fi
+update_ccft
+update_cc
+
+test_wextra
 
 # now write the cc name to Makefile.conf
+write_header_makefileconf
 {
- echo "VERSION=$VERSION"
  echo "DEV_VENDOR=$DEV_VENDOR"
  echo "DEV_VENDOR_NAME=$DEV_VENDOR_NAME"
  echo "DEV_VENDOR_STRING=$DEV_VENDOR/$DEV_VENDOR_NAME"
- echo "DISTRIBUTION_VERSION_STRING=$DISTRIBUTION_VERSION_STRING"
  echo
- echo "SHARED=$SHARED"
- echo "SHARED_CF=$SHARED_CF"
- echo "SHARED_SUFFIX=$SHARED_SUFFIX"
  echo "COMPBIN_SUFFIX=$COMPBIN_SUFFIX"
- $rdynamic && echo 'rdynamic=-rdynamic'
- $fPIC     && echo 'fPIC=-fPIC'
- $Wextra   && echo 'Wextra=-Wextra'
  echo
- echo "CC=$CC"
- echo "RANLIB=$RANLIB"
- echo "LDPATH=$LDPATH"
- echo "INCPATH=$INCPATH"
- echo
- echo "OPTI_O=-O$OPTI_O"
- echo
- [ "$CFLAGS"  != '' ] && echo "CFLAGS  += $CFLAGS"
- [ "$LDFLAGS" != '' ] && echo "LDFLAGS += $LDFLAGS"
- echo
- echo "EXEC_HELPER=$EXEC_HELPER"
- echo "CROSS_COMPILE=$CROSS_COMPILE"
- echo
- echo "PREFIX=$PREFIX"
- echo "PREFIX_BIN=$PREFIX_BIN"
- echo "PREFIX_LIB=$PREFIX_LIB"
- echo "PREFIX_INC=$PREFIX_INC"
- echo "PREFIX_MAN=$PREFIX_MAN"
- echo "PREFIX_PC=$PREFIX_PC"
  echo "PREFIX_COMP_LIBS=$PREFIX_COMP_LIBS"
  echo "PREFIX_COMP_BINS=$PREFIX_COMP_BINS"
@@ -1571,45 +537,8 @@
 } >&4
 
+write_header_configlog RUNTIME_DETECT
+write_header_configh _ROARAUDIO_CONFIG_H_
+
 {
- cat <<'EOF'
-//config.log:
-
-/*
- * Logfile for configure script $Revision$ of RoarAudio
- */
-
-EOF
- echo '/* uname: ' $(uname -a) '*/'
- echo '/* Date : ' $(date)  '*/'
- echo
-
- echo
- echo
-
- echo "ARGS(): $_CARGS"
-
- for i in PATH SHELL CC RANLIB PKG_CONFIG SYSNAME \
-          TARGET_CYGWIN TARGET_WIN32 TARGET_MICROCONTROLLER CROSS_COMPILE \
-          RUNTIME_DETECT MINIMAL EXEC_HELPER
- do
-  eval echo "BASICCONF\($i\): \$$i";
- done
-
- echo
- echo
-} >&5
-
-cat >&3 << EOF
-//config.h:
-
-#ifndef _ROARAUDIO_CONFIG_H_
-#define _ROARAUDIO_CONFIG_H_
-
-EOF
-
-{
- echo '/* uname: ' $(uname -a) '*/'
- echo '/* Date : ' $(date)  '*/'
- echo
  echo "#define ROAR_VERSION_STRING \"$VERSION\""
  grep -E '^COMMON_V_(MAJOR|MINOR|REV) *= [0-9]*$' Makefile.inc | sed 's/^COMMON_V_/#define ROAR_VERSION_/; s/=//'
@@ -1676,17 +605,5 @@
 # test binary format.
 test_bin_format
-
-if [ "$LINK_DEPS" = 'auto' ]
-then
- if [ "$BIN_FORMAT" = 'ELF' ]
- then
-  LINK_DEPS='indirect'
- else
-  LINK_DEPS='full'
- fi
-fi
-
-echo "LINK_DEPS=$LINK_DEPS" >&4
-echo "checking for linkage model... $LINK_DEPS"
+test_linkdeps
 
 #                 #define                   name         cmds...
@@ -2486,14 +1403,5 @@
 fi
 
-
-echo -n 'checking if cp supports -v... '
-if cp -v --help > /dev/null 2> /dev/null
-then
- echo "cp_v=-v" >&4
- echo yes
-else
- echo "cp_v=" >&4
- echo no
-fi
+test_cp_v
 
 echo -n 'checking for cdrom device... '
@@ -2731,15 +1639,5 @@
 #define ROAR_HAVE_LIBCELT
 #endif
-
-#endif
-
-//ll
 EOF
-
-echo >&5
-echo '//ll' >&5
-
-echo >&4
-echo >&4
 
 cd plugins
@@ -2794,14 +1692,12 @@
 cd ..
 
-rm -f $TF_C $TF_E
+cleanup_ccft
+
+write_footer_makefileconf
+write_footer_configlog
+write_footer_configh
 
 mv config.h include/roaraudio/
 echo 'config.h created and moved into include/roaraudio/'
 
-if [ "$TARGET_CYGWIN" = 'true' -o "$TARGET_WIN32" = 'true' ]
-then
- echo "Deleting win32 specific temp files: $TF_E.exe"
- rm -f $TF_E.exe
-fi
-
 #ll
