replace old build system with uwproj

Sat, 03 Aug 2019 17:54:54 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 03 Aug 2019 17:54:54 +0200
changeset 204
e870a7c8f223
parent 203
7fe53d5d587c
child 205
b8515afa450a

replace old build system with uwproj

configure file | annotate | diff | comparison | revisions
make/bsd.mk file | annotate | diff | comparison | revisions
make/clang.mk file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
make/gcc.mk file | annotate | diff | comparison | revisions
make/linux.mk file | annotate | diff | comparison | revisions
make/mingw.mk file | annotate | diff | comparison | revisions
make/osx.mk file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
make/solaris.mk file | annotate | diff | comparison | revisions
make/suncc.mk file | annotate | diff | comparison | revisions
make/toolchain.sh file | annotate | diff | comparison | revisions
make/windows.mk file | annotate | diff | comparison | revisions
--- a/configure	Fri Aug 02 22:40:02 2019 +0200
+++ b/configure	Sat Aug 03 17:54:54 2019 +0200
@@ -1,95 +1,488 @@
 #!/bin/sh
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
+
+HOST=`uname -n`
+PREFIX=`pwd`/work
+INSTALL_DIR=$PREFIX
+
+EPREFIX=$PREFIX
+
+BINDIR=
+SBINDIR=
+LIBDIR=
+LIBEXECDIR=
+DATADIR=
+SYSCONFDIR=
+SHAREDSTATEDIR=
+LOCALSTATEDIR=
+INCLUDEDIR=
+INFODIR=
+MANDIR=
+
+OS=`uname -s`
+OS_VERSION=`uname -r`
+
+TEMP_DIR=".tmp-`uname -n`"
+mkdir -p $TEMP_DIR
+if [ $? -ne 0 ]; then
+	echo "Cannot create tmp dir"
+	echo "Abort"
+fi
+touch $TEMP_DIR/options
+touch $TEMP_DIR/features
+
+# features
+
+# help text
+printhelp()
+{
+	echo "Usage: $0 [OPTIONS]..."
+	cat << __EOF__
+Installation directories:
+  --prefix=PREFIX         path prefix for architecture-independent files
+                          [/usr]
+  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
+                          [PREFIX]
+
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        system configuration files [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+
+Optional Features:
+  --enable-pg
+
+__EOF__
+}
 
 #
-# TODO: parse arguments
+# parse arguments 
 #
-
-OS=`uname -s`
-HOST=`uname -n`
-INSTALL_DIR=`pwd`/work
+for ARG in $@
+do
+    if [[ $ARG == --prefix=* ]]; then
+        PREFIX=${ARG:9}
+    elif [[ $ARG = --exec-prefix=* ]]; then
+    	EPREFIX=${ARG:14}
+    elif [[ $ARG = --bindir=* ]]; then
+    	BINDIR=${ARG:9}
+    elif [[ $ARG = --sbindir=* ]]; then
+    	SBINDIR=${ARG:10}
+    elif [[ $ARG = --libdir=* ]]; then
+    	LIBDIR=${ARG:9}
+    elif [[ $ARG = --libexecdir=* ]]; then
+    	LIBEXECDIR=${ARG:13}
+    elif [[ $ARG = --datadir=* ]]; then
+    	DATADIR=${ARG:10}
+    elif [[ $ARG = --sysconfdir=* ]]; then
+    	SYSCONFDIR=${ARG:13}
+    elif [[ $ARG = --sharedstatedir=* ]]; then
+    	SHAREDSTATEDIR=${ARG:17}
+    elif [[ $ARG = --localstatedir=* ]]; then
+    	LOCALSTATEDIR=${ARG:16}
+    elif [[ $ARG = --includedir=* ]]; then
+    	INCLUDEDIR=${ARG:12}
+    elif [[ $ARG = --infodir=* ]]; then
+    	INFODIR=${ARG:10}
+    elif [[ $ARG = --mandir=* ]]; then
+    	MANDIR=${ARG:9}
+    elif [ $ARG = "--help" ]; then
+		printhelp
+        exit 0	
+    elif [[ $ARG == --enable-pg ]]; then
+    	FEATURE_PG=on
+    elif [[ $ARG == --disable-pg ]]; then
+    	unset FEATURE_PG
+    fi
+done
 
-LIBS_CFLAGS=`pkg-config --cflags libxml-2.0 openssl`
-LIBS_LDFLAGS=`pkg-config --libs libxml-2.0 openssl`
+# set dir variables
+if [ -z $BINDIR ]; then
+	BINDIR=$EPREFIX/bin
+fi
+if [ -z $SBINDIR ]; then
+	SBINDIR=$EPREFIX/sbin
+fi
+if [ -z $LIBDIR ]; then
+	LIBDIR=$EPREFIX/lib
+fi
+if [ -z $LIBEXEC ]; then
+	LIBEXECDIR=$EPREFIX/libexec
+fi
+if [ -z $DATADIR ]; then
+	DATADIR=$PREFIX/share
+fi
+if [ -z $SYSCONFDIR]; then
+	SYSCONFDIR=$PREFIX/etc
+fi
+if [ -z $SHAREDSTATEDIR ]; then
+	SHAREDSTATEDIR=$PREFIX/com
+fi
+if [ -z $LOCALSTATEDIR ]; then
+	LOCALSTATEDIR=$PREFIX/var
+fi
+if [ -z $INCLUDEDIR ]; then
+	INCLUDEDIR=$PREFIX/include
+fi
+if [ -z $INFODIR ]; then
+	INFODIR=$PREFIX/info
+fi
+if [ -z $MANDIR ]; then
+	MANDIR=$PREFIX/man
+fi
+
+which pkg-config > /dev/null
+if [ $? -ne 0 ]; then
+    PKG_CONFIG=pkg-config
+else
+    PKG_CONFIG=false
+fi
 
-# create config.mk
-echo "generate config.mk"
+# Simple uname based platform detection
+# $PLATFORM is used for platform dependent dependency selection
+printf "detect platform... "
+if [ $OS = SunOS ]; then
+    PLATFORM="solaris sunos unix svr4"
+fi
+if [ $OS = Linux ]; then
+    PLATFORM="linux unix"
+fi
+if [ $OS = FreeBSD ]; then
+    PLATFORM="freebsd bsd unix"
+fi
+if [ $OS = Darwin ]; then
+    PLATFORM="macos osx bsd unix"
+fi
+echo $OS | grep "MINGW" > /dev/null
+if [ $? -eq 0 ]; then
+    PLATFORM="windows mingw"
+fi
 
-cat > config.mk << __EOF__
+if [ -z "$PLATFORM" ]; then
+    PLATFORM="unix"
+fi
+
+for p in $PLATFORM
+do
+	PLATFORM_NAME=$p
+	break
+done
+echo $PLATFORM_NAME
+
+isplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 0
+        fi
+    done
+    return 1
+}
+
+# generate config.mk and config.h
+cat > $TEMP_DIR/config.mk << __EOF__
 #
 # config.mk generated by configure
 #
 
-INSTALL_DIR = $INSTALL_DIR
-HOST = $HOST
+# general vars
+HOST=$HOST
+PREFIX=$PREFIX
+INSTALL_DIR=$INSTALL_DIR
+
+EPREFIX=$EPREFIX
+
+BINDIR=$BINDIR
+SBINDIR=$SBINDIR
+LIBDIR=$LIBDIR
+LIBEXECDIR=$LIBEXECDIR
+DATADIR=$DATADIR
+SYSCONFDIR=$SYSCONFDIR
+SHAREDSTATEDIR=$SHAREDSTATEDIR
+LOCALSTATEDIR=$LOCALSTATEDIR
+INCLUDEDIR=$INCLUDEDIR
+INFODIR=$INFODIR
+MANDIR=$MANDIR
 
 __EOF__
 
-# platform
+echo > $TEMP_DIR/make.mk
 
-if [ $OS = SunOS ]; then
-   CCONF=suncc.mk
-   PLATFORM=solaris.mk
-fi
+ENV_CFLAGS=$CFLAGS
+ENV_LDFLAGS=$LDFLAGS
+ENV_CXXFLAGS=$CXXFLAGS
+
+# Toolchain detection
+# this will insert make vars to config.mk
+source make/toolchain.sh
 
-if [ $OS = Linux ]; then
-    if `type clang > /dev/null`; then
-        CCONF=clang.mk
-    else
-        CCONF=gcc.mk
-    fi
-    PLATFORM=linux.mk
+# add user specified flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [[ ! -z ${ENV_CFLAGS} ]]; then
+    echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-
-if [ $OS = Darwin ]; then
-    CCONF=clang.mk
-    PLATFORM=osx.mk
+if [[ ! -z ${ENV_CXXFLAGS} ]]; then
+    echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${ENV_LDFLAGS} ]]; then
+    echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
-ISBSD=`echo $OS | grep -c BSD`
-if [ $ISBSD = 1 ]; then
-   if `type clang > /dev/null`; then
-        CCONF=clang.mk
-    else
-        CCONF=gcc.mk
+#
+# DEPENDENCIES
+#
+
+dependency_libpq()
+{
+    printf "checking for libpq... "
+    # dependency libpq 
+    while true
+    do
+        if [ -z "PKG_CONFIG" ]; then
+        	break
+        fi
+        if ! pkg-config libpq ; then
+            break
+        fi
+        CFLAGS+=" `pkg-config --cflags libpq`"
+        LDFLAGS+=" `pkg-config --libs libpq`"
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
+dependency_openssl()
+{
+    printf "checking for openssl... "
+    # dependency openssl 
+    while true
+    do
+        if [ -z "PKG_CONFIG" ]; then
+        	break
+        fi
+        if ! pkg-config openssl ; then
+            break
+        fi
+        CFLAGS+=" `pkg-config --cflags openssl`"
+        LDFLAGS+=" `pkg-config --libs openssl`"
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
+dependency_libxml2()
+{
+    printf "checking for libxml2... "
+    # dependency libxml2 
+    while true
+    do
+        if [ -z "PKG_CONFIG" ]; then
+        	break
+        fi
+        if ! pkg-config libxml-2.0 ; then
+            break
+        fi
+        CFLAGS+=" `pkg-config --cflags libxml-2.0`"
+        LDFLAGS+=" `pkg-config --libs libxml-2.0`"
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
+
+DEPENDENCIES_FAILED=
+ERROR=0
+# general dependencies
+CFLAGS=
+LDFLAGS=
+while true
+do
+    if ! isplatform "linux"; then
+        break
     fi
-    PLATFORM=bsd.mk
+    while true
+    do
+        
+        CFLAGS+="-DLINUX"    
+        LDFLAGS+="-lpthread -ldl -lm -lldap"    
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_linux.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .so
+APP_EXT =
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if ! isplatform "bsd"; then
+        break
+    fi
+    if isplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+        CFLAGS+="-DBSD"    
+        LDFLAGS+="-lpthread -lm -lldap"    
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_bsd.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .so
+APP_EXT =
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if ! isplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+        CFLAGS+="-DBSD -DOSX"    
+        LDFLAGS+="-lpthread -ldl -lm -lldap"    
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_bsd.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .dylib
+APP_EXT =
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if ! isplatform "solaris"; then
+        break
+    fi
+    while true
+    do
+        
+        CFLAGS+="-DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"    
+        LDFLAGS+="-lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap"    
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_solaris.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .so
+APP_EXT =
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+
+# add general dependency flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [[ ! -z ${CFLAGS} ]]; then
+    echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${CXXFLAGS} ]]; then
+    echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${LDFLAGS} ]]; then
+    echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
-echo "
-include \$(BUILD_ROOT)/make/$CCONF
-include \$(BUILD_ROOT)/make/$PLATFORM
+#
+# OPTION VALUES
+#
+
+#
+# TARGETS
+#
+CFLAGS=
+CXXFLAGS=
+LDFLAGS=
 
-CFLAGS += $LIBS_CFLAGS
-LDFLAGS += $LIBS_LDFLAGS
+# Target
+CFLAGS=
+LDFLAGS=
+CXXFLAGS=
 
-" >> config.mk
+dependency_libxml2
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED+="libxml2 "
+	ERROR=1
+fi
+dependency_openssl
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED+="openssl "
+	ERROR=1
+fi
 
 
+echo >> $TEMP_DIR/config.mk
+if [[ ! -z ${CFLAGS} ]]; then
+    echo "CFLAGS  += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${CXXFLAGS} ]]; then
+    echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${LDFLAGS} ]]; then
+    echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
 
+if [ $ERROR -ne 0 ]; then
+	echo
+	echo "Error: Unresolved dependencies"
+	echo $DEPENCIES_FAILED
+	rm -Rf $TEMP_DIR
+	exit 1
+fi
+
+echo "configure finished"
+echo
+echo "Build Config:"
+echo "  PREFIX:    $PREFIX"
+echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
+echo
+cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk
+rm -Rf $TEMP_DIR
+
+
--- a/make/bsd.mk	Fri Aug 02 22:40:02 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-# compiler and linker flags
-CFLAGS += -DBSD
-LDFLAGS += -lpthread -lm -lldap
-
-
-# platform dependend source files
-PLATFORM_DAEMONOBJ = event_bsd.o
-
-# platform dependend vars
-OBJ_EXT = .o
-LIB_EXT = .so
-APP_EXT =
-
--- a/make/clang.mk	Fri Aug 02 22:40:02 2019 +0200
+++ b/make/clang.mk	Sat Aug 03 17:54:54 2019 +0200
@@ -1,37 +1,9 @@
 #
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# clang toolchain config
 #
 
 CFLAGS = -g
 LDFLAGS = -rdynamic -Wl,-R,'$$ORIGIN/../lib'
 
-CC  = clang
-CXX = clang++
-LD = clang
-
 SHLIB_CFLAGS = -fPIC
 SHLIB_LDFLAGS = -shared
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/configure.vm	Sat Aug 03 17:54:54 2019 +0200
@@ -0,0 +1,602 @@
+#!/bin/sh
+
+#foreach( $var in $vars )
+#if( $var.exec )
+${var.name}=`${var.value}`
+#else
+${var.name}=${var.value}
+#end
+#end
+
+#if ( ! $project.hasVar("PREFIX") )
+PREFIX=/usr
+#end
+#if ( ! $project.hasVar("EPREFIX") )
+EPREFIX=$PREFIX
+#end
+
+#if ( ! $project.hasVar("BINDIR") )
+BINDIR=
+#end
+#if ( ! $project.hasVar("SBINDIR") )
+SBINDIR=
+#end
+#if ( ! $project.hasVar("LIBDIR") )
+LIBDIR=
+#end
+#if ( ! $project.hasVar("LIBEXECDIR") )
+LIBEXECDIR=
+#end
+#if ( ! $project.hasVar("DATADIR") )
+DATADIR=
+#end
+#if ( ! $project.hasVar("SYSCONFDIR") )
+SYSCONFDIR=
+#end
+#if ( ! $project.hasVar("SHAREDSTATEDIR") )
+SHAREDSTATEDIR=
+#end
+#if ( ! $project.hasVar("LOCALSTATEDIR") )
+LOCALSTATEDIR=
+#end
+#if ( ! $project.hasVar("INCLUDEDIR") )
+INCLUDEDIR=
+#end
+#if ( ! $project.hasVar("INFODIR") )
+INFODIR=
+#end
+#if ( ! $project.hasVar("MANDIR") )
+MANDIR=
+#end
+
+OS=`uname -s`
+OS_VERSION=`uname -r`
+
+TEMP_DIR=".tmp-`uname -n`"
+mkdir -p $TEMP_DIR
+if [ $? -ne 0 ]; then
+	echo "Cannot create tmp dir"
+	echo "Abort"
+fi
+touch $TEMP_DIR/options
+touch $TEMP_DIR/features
+
+# features
+#foreach( $feature in $features )
+#if( ${feature.isDefault()} )
+${feature.getVarName()}=on
+#end
+#end
+
+# help text
+printhelp()
+{
+	echo "Usage: $0 [OPTIONS]..."
+	cat << __EOF__
+Installation directories:
+  --prefix=PREFIX         path prefix for architecture-independent files
+                          [/usr]
+  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
+                          [PREFIX]
+
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        system configuration files [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+
+#if( $options.size() > 0 )
+Options:
+#foreach( $opt in $options )
+  --${opt.getArgument()}=${opt.getValuesString()}
+#end
+
+#end
+#if( $features.size() > 0 )
+Optional Features:
+#foreach( $feature in $features )
+#if( $feature.default )
+  --disable-${feature.arg}
+#else
+  --enable-${feature.arg}
+#end
+#end
+
+#end
+__EOF__
+}
+
+#
+# parse arguments 
+#
+#set( $D = '$' )
+for ARG in $@
+do
+    if [[ $ARG == --prefix=* ]]; then
+        PREFIX=${D}{ARG:9}
+    elif [[ $ARG = --exec-prefix=* ]]; then
+    	EPREFIX=${D}{ARG:14}
+    elif [[ $ARG = --bindir=* ]]; then
+    	BINDIR=${D}{ARG:9}
+    elif [[ $ARG = --sbindir=* ]]; then
+    	SBINDIR=${D}{ARG:10}
+    elif [[ $ARG = --libdir=* ]]; then
+    	LIBDIR=${D}{ARG:9}
+    elif [[ $ARG = --libexecdir=* ]]; then
+    	LIBEXECDIR=${D}{ARG:13}
+    elif [[ $ARG = --datadir=* ]]; then
+    	DATADIR=${D}{ARG:10}
+    elif [[ $ARG = --sysconfdir=* ]]; then
+    	SYSCONFDIR=${D}{ARG:13}
+    elif [[ $ARG = --sharedstatedir=* ]]; then
+    	SHAREDSTATEDIR=${D}{ARG:17}
+    elif [[ $ARG = --localstatedir=* ]]; then
+    	LOCALSTATEDIR=${D}{ARG:16}
+    elif [[ $ARG = --includedir=* ]]; then
+    	INCLUDEDIR=${D}{ARG:12}
+    elif [[ $ARG = --infodir=* ]]; then
+    	INFODIR=${D}{ARG:10}
+    elif [[ $ARG = --mandir=* ]]; then
+    	MANDIR=${D}{ARG:9}
+    elif [ $ARG = "--help" ]; then
+		printhelp
+        exit 0	
+    #foreach( $opt in $options )
+    elif [[ $ARG == --${opt.getArgument()}=* ]]; then
+    	${opt.getVarName()}=${opt.getArgValue()}
+    #end
+    #foreach( $feature in $features )
+    elif [[ $ARG == --enable-${feature.arg} ]]; then
+    	${feature.getVarName()}=on
+    elif [[ $ARG == --disable-${feature.arg} ]]; then
+    	unset ${feature.getVarName()}
+    #end
+    fi
+done
+
+# set dir variables
+if [ -z $BINDIR ]; then
+	BINDIR=$EPREFIX/bin
+fi
+if [ -z $SBINDIR ]; then
+	SBINDIR=$EPREFIX/sbin
+fi
+if [ -z $LIBDIR ]; then
+	LIBDIR=$EPREFIX/lib
+fi
+if [ -z $LIBEXEC ]; then
+	LIBEXECDIR=$EPREFIX/libexec
+fi
+if [ -z $DATADIR ]; then
+	DATADIR=$PREFIX/share
+fi
+if [ -z $SYSCONFDIR]; then
+	SYSCONFDIR=$PREFIX/etc
+fi
+if [ -z $SHAREDSTATEDIR ]; then
+	SHAREDSTATEDIR=$PREFIX/com
+fi
+if [ -z $LOCALSTATEDIR ]; then
+	LOCALSTATEDIR=$PREFIX/var
+fi
+if [ -z $INCLUDEDIR ]; then
+	INCLUDEDIR=$PREFIX/include
+fi
+if [ -z $INFODIR ]; then
+	INFODIR=$PREFIX/info
+fi
+if [ -z $MANDIR ]; then
+	MANDIR=$PREFIX/man
+fi
+
+which pkg-config > /dev/null
+if [ $? -ne 0 ]; then
+    PKG_CONFIG=pkg-config
+else
+    PKG_CONFIG=false
+fi
+
+# Simple uname based platform detection
+# $PLATFORM is used for platform dependent dependency selection
+printf "detect platform... "
+if [ $OS = SunOS ]; then
+    PLATFORM="solaris sunos unix svr4"
+fi
+if [ $OS = Linux ]; then
+    PLATFORM="linux unix"
+fi
+if [ $OS = FreeBSD ]; then
+    PLATFORM="freebsd bsd unix"
+fi
+if [ $OS = Darwin ]; then
+    PLATFORM="macos osx bsd unix"
+fi
+echo $OS | grep "MINGW" > /dev/null
+if [ $? -eq 0 ]; then
+    PLATFORM="windows mingw"
+fi
+
+if [ -z "$PLATFORM" ]; then
+    PLATFORM="unix"
+fi
+
+for p in $PLATFORM
+do
+	PLATFORM_NAME=$p
+	break
+done
+echo $PLATFORM_NAME
+
+isplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 0
+        fi
+    done
+    return 1
+}
+
+# generate config.mk and config.h
+cat > $TEMP_DIR/config.mk << __EOF__
+#
+# config.mk generated by configure
+#
+
+# general vars
+#foreach( $var in $vars )
+${var.name}=$${var.name}
+#end
+
+#if ( ! $project.hasVar("PREFIX") )
+PREFIX=$PREFIX
+#end
+#if ( ! $project.hasVar("EPREFIX") )
+EPREFIX=$EPREFIX
+#end
+
+#if ( ! $project.hasVar("BINDIR") )
+BINDIR=$BINDIR
+#end
+#if ( ! $project.hasVar("SBINDIR") )
+SBINDIR=$SBINDIR
+#end
+#if ( ! $project.hasVar("LIBDIR") )
+LIBDIR=$LIBDIR
+#end
+#if ( ! $project.hasVar("LIBEXECDIR") )
+LIBEXECDIR=$LIBEXECDIR
+#end
+#if ( ! $project.hasVar("DATADIR") )
+DATADIR=$DATADIR
+#end
+#if ( ! $project.hasVar("SYSCONFDIR") )
+SYSCONFDIR=$SYSCONFDIR
+#end
+#if ( ! $project.hasVar("SHAREDSTATEDIR") )
+SHAREDSTATEDIR=$SHAREDSTATEDIR
+#end
+#if ( ! $project.hasVar("LOCALSTATEDIR") )
+LOCALSTATEDIR=$LOCALSTATEDIR
+#end
+#if ( ! $project.hasVar("INCLUDEDIR") )
+INCLUDEDIR=$INCLUDEDIR
+#end
+#if ( ! $project.hasVar("INFODIR") )
+INFODIR=$INFODIR
+#end
+#if ( ! $project.hasVar("MANDIR") )
+MANDIR=$MANDIR
+#end
+
+__EOF__
+
+echo > $TEMP_DIR/make.mk
+
+ENV_CFLAGS=$CFLAGS
+ENV_LDFLAGS=$LDFLAGS
+ENV_CXXFLAGS=$CXXFLAGS
+
+# Toolchain detection
+# this will insert make vars to config.mk
+source make/toolchain.sh
+
+# add user specified flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [[ ! -z ${ENV_CFLAGS} ]]; then
+    echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${ENV_CXXFLAGS} ]]; then
+    echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${ENV_LDFLAGS} ]]; then
+    echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+#
+# DEPENDENCIES
+#
+
+#foreach( $dependency in $namedDependencies )
+dependency_${dependency.name}()
+{
+    printf "checking for ${dependency.name}... "
+    #foreach( $sub in $dependency.getSubdependencies() )
+    # dependency $sub.name $sub.getPlatformString()
+    while true
+    do
+    	#if( $sub.platform )
+    	if ! isplatform "${sub.platform}"; then
+            break
+        fi
+    	#end
+		#foreach( $not in $sub.getNotList() )
+		if isplatform "${not}"; then
+            break
+        fi
+		#end
+        #if( $sub.pkgconfig.size() > 0 )
+        if [ -z "PKG_CONFIG" ]; then
+        	break
+        fi
+        #end
+        #foreach( $pkg in $sub.pkgconfig )
+        if ! pkg-config $pkg.getPkgConfigParam() ; then
+            break
+        fi
+        CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS+=" `pkg-config --libs $pkg.getPkgConfigParam()`"
+        #end
+        #foreach( $flags in $sub.flags )
+        #if( $flags.exec )
+        $flags.value > /dev/null
+        if [ $? -eq 0 ]; then
+            $flags.varName+=" `$flags.value`"
+        else
+            break
+        fi
+        #else
+        $flags.varName+="$flags.value"    
+        #end
+        #end
+        #foreach( $test in $sub.tests )
+        $test > /dev/null
+        if [ $? -ne 0 ]; then
+        	break
+        fi
+        #end
+		#if ( $sub.make.length() > 0 )
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# Dependency: $dependency.name		
+$sub.make
+__EOF__
+        #end
+		echo yes
+        return 0
+    done
+	
+	#end
+	echo no
+	return 1
+}
+#end
+
+DEPENDENCIES_FAILED=
+ERROR=0
+#if( $dependencies.size() > 0 )
+# general dependencies
+CFLAGS=
+LDFLAGS=
+#foreach( $dependency in $dependencies )
+while true
+do
+	#if( $dependency.platform )
+    if ! isplatform "${dependency.platform}"; then
+        break
+    fi
+    #end
+	#foreach( $not in $dependency.getNotList() )
+    if isplatform "${not}"; then
+        break
+    fi
+	#end
+    while true
+    do
+        #if( $dependency.pkgconfig.size() > 0 )
+        if [ -z "PKG_CONFIG" ]; then
+            ERROR=1
+            break
+        fi
+        #end
+        #foreach( $pkg in $dependency.pkgconfig )
+        printf "checking for pkg-config package $pkg.getPkgConfigParam()... "
+        if ! pkg-config $pkg.getPkgConfigParam() ; then
+            echo no
+            ERROR=1
+            break
+        fi
+        echo yes
+        CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS+=" `pkg-config --libs $pkg.getPkgConfigParam()`"
+        #end
+        
+        #foreach( $flags in $dependency.flags )
+        #if( $flags.exec )
+        $flags.value > /dev/null
+        if [ $? -ne 0 ]; then
+            $flags.varName+=" `$flags.value`"
+        else
+            ERROR=1
+            break
+        fi
+        #else
+        $flags.varName+="$flags.value"    
+        #end
+        #end
+		#if ( $dependency.make.length() > 0 )
+		cat >> $TEMP_DIR/make.mk << __EOF__
+$dependency.make
+__EOF__
+        #end
+        
+        break
+    done
+    
+    break
+done
+#end
+
+# add general dependency flags to config.mk
+echo >> $TEMP_DIR/config.mk
+if [[ ! -z ${CFLAGS} ]]; then
+    echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${CXXFLAGS} ]]; then
+    echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${LDFLAGS} ]]; then
+    echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+#end
+
+#
+# OPTION VALUES
+#
+#foreach( $opt in $options )
+#foreach( $val in $opt.values )
+${val.func}()
+{
+	VERR=0
+	#foreach( $dep in $val.dependencies )
+	dependency_$dep
+	if [ $? -ne 0 ]; then
+		VERR=1
+	fi
+	#end
+	if [ $VERR -ne 0 ]; then
+		return 1
+	fi
+	#foreach( $def in $val.defines )
+		CFLAGS+=" ${def.toFlags()}"
+	#end
+	#if( $val.hasMake() )
+	cat >> $TEMP_DIR/make.mk << __EOF__
+$val.make
+__EOF__
+	#end
+	return 0
+}
+#end
+#end
+
+#
+# TARGETS
+#
+CFLAGS=
+CXXFLAGS=
+LDFLAGS=
+
+#foreach( $target in $targets )
+#if ( $target.name )
+# Target: $target.name
+#else
+# Target
+#end
+CFLAGS=
+LDFLAGS=
+CXXFLAGS=
+
+#foreach( $dependency in $target.dependencies )
+dependency_$dependency
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED+="${dependency} "
+	ERROR=1
+fi
+#end
+
+#foreach( $opt in $target.options )
+# Option: --${opt.argument}
+if [ -z ${D}${opt.getVarName()} ]; then
+	SAVED_ERROR=$ERROR
+	SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED
+	ERROR=0
+	while true
+	do
+		#foreach( $optdef in $opt.defaults )
+		#if( $optdef.platform )
+		if isplatform "$optdef.platform"; then
+		#end
+		$optdef.func
+		if [ $? -eq 0 ]; then
+			echo "  ${opt.argument}: ${optdef.valueName}" >> $TEMP_DIR/options
+			ERROR=0
+			break
+		fi
+		#if( $optdef.platform )
+		fi
+		#end
+		#end
+		break
+	done
+	if [ $ERROR -ne 0 ]; then
+		SAVED_ERROR=1
+	fi
+	ERROR=$SAVED_ERROR
+	DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED=
+else
+	if false; then
+		false
+	#foreach( $optval in $opt.values )
+	elif [ ${D}${opt.getVarName()} = "${optval.value}" ]; then
+		echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
+		$optval.func
+		if [ $? -ne 0 ]; then
+			ERROR=1
+		fi
+	#end
+	fi
+fi
+#end
+
+echo >> $TEMP_DIR/config.mk
+if [[ ! -z ${CFLAGS} ]]; then
+    echo "${target.getCFlags()}  += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${CXXFLAGS} ]]; then
+    echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [[ ! -z ${LDFLAGS} ]]; then
+    echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
+#end
+if [ $ERROR -ne 0 ]; then
+	echo
+	echo "Error: Unresolved dependencies"
+	echo $DEPENCIES_FAILED
+	rm -Rf $TEMP_DIR
+	exit 1
+fi
+
+echo "configure finished"
+echo
+echo "Build Config:"
+echo "  PREFIX:    $PREFIX"
+echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
+#if ( $options.size() > 0 )
+echo "Options:"
+cat $TEMP_DIR/options
+#end
+echo
+cat $TEMP_DIR/config.mk $TEMP_DIR/make.mk > config.mk
+rm -Rf $TEMP_DIR
+
+
--- a/make/gcc.mk	Fri Aug 02 22:40:02 2019 +0200
+++ b/make/gcc.mk	Sat Aug 03 17:54:54 2019 +0200
@@ -1,38 +1,11 @@
 #
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# gcc toolchain config
 #
 
 CFLAGS = -std=gnu99 -g
 LDFLAGS = -rdynamic -Wl,-R,'$$ORIGIN/../lib'
 
-CC  = gcc
-CXX = g++
-LD = g++
-
 SHLIB_CFLAGS = -fPIC
 SHLIB_LDFLAGS = -shared
 
+
--- a/make/linux.mk	Fri Aug 02 22:40:02 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-# compiler and linker flags
-CFLAGS += -DLINUX
-LDFLAGS += -lpthread -ldl -lm -lldap
-
-
-# platform dependend source files
-PLATFORM_DAEMONOBJ = event_linux.o
-
-# platform dependend vars
-OBJ_EXT = .o
-LIB_EXT = .so
-APP_EXT =
-
--- a/make/mingw.mk	Fri Aug 02 22:40:02 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-CFLAGS = -std=gnu99 -g
-LDFLAGS = -rdynamic -Wl,-R,'$$ORIGIN/../lib'
-
-CC  = gcc
-CXX = g++
-LD = g++
-
-SHLIB_CFLAGS = 
-SHLIB_LDFLAGS = -shared
-
--- a/make/osx.mk	Fri Aug 02 22:40:02 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-# compiler and linker flags
-CFLAGS += -DBSD -DOSX
-LDFLAGS += -lpthread -ldl -lm -lldap
-
-
-# platform dependend source files
-PLATFORM_DAEMONOBJ = event_bsd.o
-
-# platform dependend vars
-OBJ_EXT = .o
-LIB_EXT = .dylib
-APP_EXT =
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/project.xml	Sat Aug 03 17:54:54 2019 +0200
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+	<!-- makefile config -->
+	<config>
+		<var name="HOST" type="exec">uname -n</var>
+		<var name="PREFIX">`pwd`/work</var>
+		<var name="INSTALL_DIR">$PREFIX</var>
+	</config>
+	
+	<!-- platform specific settings -->
+	<dependency platform="linux">
+		<cflags>-DLINUX</cflags>
+		<ldflags>-lpthread -ldl -lm -lldap</ldflags>
+		<make>
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_linux.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .so
+APP_EXT =
+		</make>
+	</dependency>
+	
+	<dependency platform="bsd" not="macos">
+		<cflags>-DBSD</cflags>
+		<ldflags>-lpthread -lm -lldap</ldflags>
+		<make>
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_bsd.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .so
+APP_EXT =
+		</make>
+	</dependency>
+	
+	<dependency platform="macos">
+		<cflags>-DBSD -DOSX</cflags>
+		<ldflags>-lpthread -ldl -lm -lldap</ldflags>
+		<make>
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_bsd.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .dylib
+APP_EXT =
+		</make>
+	</dependency>
+	
+	<dependency platform="solaris">
+		<cflags>-DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS</cflags>
+		<ldflags>-lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap</ldflags>
+		<make>
+# platform dependend source files
+PLATFORM_DAEMONOBJ = event_solaris.o
+
+# platform dependend vars
+OBJ_EXT = .o
+LIB_EXT = .so
+APP_EXT =
+		</make>
+	</dependency>
+
+	<!-- library dependencies -->
+	<dependency name="libxml2">
+		<pkgconfig>libxml-2.0</pkgconfig>
+	</dependency>
+	
+	<dependency name="openssl">
+		<pkgconfig>openssl</pkgconfig>
+	</dependency>
+	
+	<!-- optional dependencies -->
+	<dependency name="libpq">
+		<pkgconfig>libpq</pkgconfig>
+	</dependency>
+	
+	<target>
+		<feature name="pg" default="false">
+			<dependencies>libpq</dependencies>
+		</feature>
+		<dependencies>libxml2,openssl</dependencies>
+	</target>
+</project>
+
--- a/make/solaris.mk	Fri Aug 02 22:40:02 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-# compiler and linker flags
-CFLAGS += -DSOLARIS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
-LDFLAGS += -lsocket -lnsl -lsendfile -lposix4 -lpthread -ldl -lm -lmd -lldap
-
-#PLUGINS = java
-
-
-# platform dependend source files
-PLATFORM_DAEMONOBJ = event_solaris.o
-
-# platform dependend vars
-OBJ_EXT = .o
-LIB_EXT = .so
-APP_EXT =
-
--- a/make/suncc.mk	Fri Aug 02 22:40:02 2019 +0200
+++ b/make/suncc.mk	Sat Aug 03 17:54:54 2019 +0200
@@ -1,37 +1,10 @@
 #
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# suncc toolchain
 #
 
 CFLAGS += -xc99 -g
 LDFLAGS += -Wl,-R,'$$ORIGIN/../lib'
 
-CC  = cc
-CXX = CC
-LD = cc
-
 SHLIB_CFLAGS = -Kpic
 SHLIB_LDFLAGS = -G
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/toolchain.sh	Sat Aug 03 17:54:54 2019 +0200
@@ -0,0 +1,170 @@
+#!/bin/sh
+#
+# toolchain detection
+#
+
+C_COMPILERS="cc gcc clang suncc"
+CPP_COMPILERS="CC g++ clang++ sunCC"
+unset CC_ARG_CHECKED
+unset TOOLCHAIN_DETECTION_ERROR
+unset TOOLCHAIN_NAME
+
+check_c_compiler()
+{
+    cat > $TEMP_DIR/test.c << __EOF__
+/* test file */
+#include <stdio.h>
+int main(int argc, char **argv) {
+#if defined(__GNUC__)
+    printf("gcc\n");
+#elif defined(__clang__)
+    printf("clang\n");
+#elif defined(__sun)
+    printf("suncc\n");
+#else
+    printf("unknown\n");
+#endif
+    return 0;
+}
+__EOF__
+    rm -f $TEMP_DIR/checkcc
+    $1 -o $TEMP_DIR/checkcc $CFLAGS $LDFLAGS $TEMP_DIR/test.c 2> /dev/null
+    
+    if [ $? -ne 0 ]; then
+        return 1
+    fi
+    return 0
+}
+
+check_cpp_compiler()
+{
+    cat > $TEMP_DIR/test.cpp << __EOF__
+/* test file */
+#include <iostream>
+int main(int argc, char **argv) {
+#if defined(__GNUC__)
+    std::cout << "gcc" << std::endl;
+#elif defined(__clang__)
+    std::cout << "clang" << std::endl;
+#elif defined(__sun)
+	std::cout << "suncc" << std::endl;
+#else
+    std::cout << "unknown" << std::endl;
+#endif
+    return 0;
+}
+__EOF__
+    rm -f $TEMP_DIR/checkcc
+    $1 -o $TEMP_DIR/checkcc $CXXFLAGS $LDFLAGS $TEMP_DIR/test.cpp 2> /dev/null
+    
+    if [ $? -ne 0 ]; then
+        return 1
+    fi
+    return 0
+}
+
+printf "detect toolchain... "
+
+for COMP in $C_COMPILERS
+do
+    check_c_compiler $COMP
+    if [ $? -ne 0 ]; then
+	    if [[ ! -z $CC ]]; then
+        	if [ $COMP = $CC ]; then
+            	echo "$CC is not a working C Compiler"
+            	TOOLCHAIN_DETECTION_ERROR="error"
+            	break
+        	fi
+		fi
+    else
+        TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+		if [ $COMP = "cc" ]; then
+		   # we have found a working compiler, but in case
+		   # the compiler is gcc or clang, we try to use
+		   # these commands and not 'cc'
+		   TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+		   if [ $TOOLCHAIN_NAME = "gcc" ]; then
+		       check_c_compiler "gcc"
+			   if [ $? -eq 0 ]; then
+			       COMP=gcc
+			   fi
+		   fi
+		   if [ $TOOLCHAIN_NAME = "clang" ]; then
+		       check_c_compiler "clang"
+			   if [ $? -eq 0 ]; then
+			       COMP=clang
+			   fi
+		   fi
+		fi
+		
+		TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+        TOOLCHAIN_CC=$COMP
+        echo $TOOLCHAIN_NAME 
+        break
+    fi
+done
+if [ -z $TOOLCHAIN_CC ]; then
+    echo "not found"
+fi
+
+printf "detect C++ compiler... "
+
+for COMP in $CPP_COMPILERS
+do
+    check_cpp_compiler $COMP
+    if [ $? -ne 0 ]; then
+		if [[ ! -z $CXX ]]; then
+        	if [ $COMP = $CXX ]; then
+                echo "$CC is not a working C++ Compiler"
+                TOOLCHAIN_DETECTION_ERROR="error"
+                break
+            fi
+		fi
+    else
+        if [ $COMP = "CC" ]; then
+		   # we have found a working compiler, but in case
+		   # the compiler is gcc or clang, we try to use
+		   # these commands and not 'cc'
+		   TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+		   if [ $TOOLCHAIN_NAME = "gcc" ]; then
+		       check_c_compiler "gcc"
+			   if [ $? -eq 0 ]; then
+			       COMP=gcc
+			   fi
+		   fi
+		   if [ $TOOLCHAIN_NAME = "clang" ]; then
+		       check_c_compiler "clang"
+			   if [ $? -eq 0 ]; then
+			       COMP=clang
+			   fi
+		   fi
+		fi
+		
+		TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
+        TOOLCHAIN_CXX=$COMP
+        echo $TOOLCHAIN_NAME 
+        break
+    fi
+done
+if [ -z $TOOLCHAIN_CXX ]; then
+    echo "not found"
+fi
+
+TOOLCHAIN_LD=$TOOLCHAIN_CC
+
+if [ -z TOOLCHAIN_NAME ]; then
+    TOOLCHAIN_DETECTION_ERROR="error"
+else
+    cat >> $TEMP_DIR/config.mk << __EOF__
+# toolchain
+__EOF__
+	echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk
+	if [[ ! -z $TOOLCHAIN_CXX ]]; then
+		echo "CXX = ${TOOLCHAIN_CXX}" >> $TEMP_DIR/config.mk
+	fi
+    echo "LD = ${TOOLCHAIN_LD}" >> $TEMP_DIR/config.mk
+    
+    if [ -e "make/${TOOLCHAIN_NAME}.mk" ]; then 
+        echo "include \$(BUILD_ROOT)/make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk
+    fi
+fi
--- a/make/windows.mk	Fri Aug 02 22:40:02 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2013 Olaf Wintermann. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-#   1. Redistributions of source code must retain the above copyright
-#      notice, this list of conditions and the following disclaimer.
-#
-#   2. Redistributions in binary form must reproduce the above copyright
-#      notice, this list of conditions and the following disclaimer in the
-#      documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-
-# compiler and linker flags
-CFLAGS += -DWINDOWS
-LDFLAGS += 
-
-
-# platform dependend source files
-PLATFORM_DAEMONOBJ = event_windows.o
-
-# platform dependend vars
-OBJ_EXT = .o
-LIB_EXT = .dll
-APP_EXT = .exe
-

mercurial