update build system

Sat, 14 Nov 2020 20:58:20 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 14 Nov 2020 20:58:20 +0100
changeset 158
4bde241c49b1
parent 157
0b33b9396851
child 159
84a6e7a7b457

update build system

application/main.c file | annotate | diff | comparison | revisions
configure 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/project.xml file | annotate | diff | comparison | revisions
make/suncc.mk file | annotate | diff | comparison | revisions
make/toolchain.sh file | annotate | diff | comparison | revisions
ui/gtk/Makefile file | annotate | diff | comparison | revisions
ui/motif/Makefile file | annotate | diff | comparison | revisions
--- a/application/main.c	Mon Feb 04 17:49:50 2019 +0100
+++ b/application/main.c	Sat Nov 14 20:58:20 2020 +0100
@@ -187,6 +187,9 @@
     //d1->d->observers = ui_add_observer(d1->d->observers, doublechanged, NULL);
     
     //ui_progressbar_nv(obj, "progress");
+    
+    ui_textfield(obj, NULL);
+    
     ui_button(obj, "Switch Document", action_newdoc, NULL);
     
     ui_show(obj);
--- a/configure	Mon Feb 04 17:49:50 2019 +0100
+++ b/configure	Sat Nov 14 20:58:20 2020 +0100
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+
 PREFIX=/usr
 EPREFIX=$PREFIX
 
@@ -64,77 +65,63 @@
 #
 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 == --toolkit=* ]]; then
-    	OPT_TOOLKIT=${ARG:10}
-    fi
+    case "$ARG" in
+		"--prefix="*)         PREFIX=${ARG#--prefix=} ;;
+		"--exec-prefix="*)    EPREFIX=${ARG#--exec-prefix=} ;;
+		"--bindir="*)         BINDIR=${ARG#----bindir=} ;;
+		"--sbindir="*)        SBINDIR=${ARG#--sbindir=} ;;
+		"--libdir="*)         LIBDIR=${ARG#--libdir=} ;;
+		"--libexecdir="*)     LIBEXECDIR=${ARG#--libexecdir=} ;;
+		"--datadir="*)        DATADIR=${ARG#--datadir=} ;;
+		"--sysconfdir="*)     SYSCONFDIR=${ARG#--sysconfdir=} ;;
+		"--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
+		"--localstatedir="*)  LOCALSTATEDIR=${ARG#--localstatedir=} ;;
+		"--includedir="*)     INCLUDEDIR=${ARG#--includedir=} ;;
+		"--infodir="*)        INFODIR=${ARG#--infodir=} ;;
+		"--mandir"*)          MANDIR=${ARG#--mandir} ;;
+		"--help"*) printhelp; exit 1 ;;
+    	"--toolkit="*) OPT_TOOLKIT={ARG#toolkit=} ;;
+		"-"*) echo "unknown option: $ARG"; exit 1 ;;
+	esac
 done
 
 # set dir variables
-if [ -z $BINDIR ]; then
+if [ -z "$BINDIR" ]; then
 	BINDIR=$EPREFIX/bin
 fi
-if [ -z $SBINDIR ]; then
+if [ -z "$SBINDIR" ]; then
 	SBINDIR=$EPREFIX/sbin
 fi
-if [ -z $LIBDIR ]; then
-	LIBDIRDIR=$EPREFIX/lib
+if [ -z "$LIBDIR" ]; then
+	LIBDIR=$EPREFIX/lib
 fi
-if [ -z $LIBEXEC ]; then
-	LIBExECDIR=$EPREFIX/libexec
+if [ -z "$LIBEXEC" ]; then
+	LIBEXECDIR=$EPREFIX/libexec
 fi
-if [ -z $DATADIR ]; then
+if [ -z "$DATADIR" ]; then
 	DATADIR=$PREFIX/share
 fi
-if [ -z $SYSCONFDIR]; then
+if [ -z "$SYSCONFDIR" ]; then
 	SYSCONFDIR=$PREFIX/etc
 fi
-if [ -z $SHAREDSTATEDIR ]; then
+if [ -z "$SHAREDSTATEDIR" ]; then
 	SHAREDSTATEDIR=$PREFIX/com
 fi
-if [ -z $LOCALSTATEDIR ]; then
+if [ -z "$LOCALSTATEDIR" ]; then
 	LOCALSTATEDIR=$PREFIX/var
 fi
-if [ -z $INCLUDEDIR ]; then
+if [ -z "$INCLUDEDIR" ]; then
 	INCLUDEDIR=$PREFIX/include
 fi
-if [ -z $INFODIR ]; then
+if [ -z "$INFODIR" ]; then
 	INFODIR=$PREFIX/info
 fi
-if [ -z $MANDIR ]; then
+if [ -z "$MANDIR" ]; then
 	MANDIR=$PREFIX/man
 fi
 
 which pkg-config > /dev/null
-if [ $? -ne 0 ]; then
+if [ $? -eq 0 ]; then
     PKG_CONFIG=pkg-config
 else
     PKG_CONFIG=false
@@ -181,12 +168,40 @@
     done
     return 1
 }
+isnotplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 # generate config.mk and config.h
 cat > $TEMP_DIR/config.mk << __EOF__
 #
 # config.mk generated by configure
 #
+
+# general vars
+
+PREFIX=$PREFIX
+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__
 
 echo > $TEMP_DIR/make.mk
@@ -197,17 +212,17 @@
 
 # Toolchain detection
 # this will insert make vars to config.mk
-source make/toolchain.sh
+. make/toolchain.sh
 
 # add user specified flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${ENV_CFLAGS} ]]; then
+if [ ! -z "${ENV_CFLAGS}" ]; then
     echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_CXXFLAGS} ]]; then
+if [ ! -z "${ENV_CXXFLAGS}" ]; then
     echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_LDFLAGS} ]]; then
+if [ ! -z "${ENV_LDFLAGS}" ]; then
     echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
@@ -223,19 +238,19 @@
     do
         qmake-qt4 -o - /dev/null | grep DEFINES\  > /dev/null
         if [ $? -eq 0 ]; then
-            CFLAGS+=" `qmake-qt4 -o - /dev/null | grep DEFINES\ `"
+            CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep DEFINES\ `"
         else
             break
         fi
         qmake-qt4 -o - /dev/null | grep INCPATH\  > /dev/null
         if [ $? -eq 0 ]; then
-            CFLAGS+=" `qmake-qt4 -o - /dev/null | grep INCPATH\ `"
+            CFLAGS="$CFLAGS `qmake-qt4 -o - /dev/null | grep INCPATH\ `"
         else
             break
         fi
          > /dev/null
         if [ $? -eq 0 ]; then
-            LDFLAGS+=" ``"
+            LDFLAGS="$LDFLAGS ``"
         else
             break
         fi
@@ -243,7 +258,7 @@
         if [ $? -ne 0 ]; then
         	break
         fi
-        echo yes
+		echo yes
         return 0
     done
 	
@@ -256,17 +271,18 @@
     # dependency gtk2legacy 
     while true
     do
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
-        if ! pkg-config gtk+-2.0 ; then
+		$PKG_CONFIG gtk+-2.0
+        if [ $? -ne 0 ] ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags gtk+-2.0`"
-        LDFLAGS+=" `pkg-config --libs gtk+-2.0`"
-        CFLAGS+="-DUI_GTK2 -DUI_GTK2LEGACY"    
-        LDFLAGS+="-lpthread"    
-        echo yes
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`"
+        CFLAGS="$CFLAGS -DUI_GTK2 -DUI_GTK2LEGACY"    
+        LDFLAGS="$LDFLAGS -lpthread"    
+		echo yes
         return 0
     done
 	
@@ -281,19 +297,19 @@
     do
         qmake-qt5 -o - /dev/null | grep DEFINES\  > /dev/null
         if [ $? -eq 0 ]; then
-            CFLAGS+=" `qmake-qt5 -o - /dev/null | grep DEFINES\ `"
+            CFLAGS="$CFLAGS `qmake-qt5 -o - /dev/null | grep DEFINES\ `"
         else
             break
         fi
         qmake-qt5 -o - /dev/null | grep INCPATH\  > /dev/null
         if [ $? -eq 0 ]; then
-            CFLAGS+=" `qmake-qt5 -o - /dev/null | grep INCPATH\ `"
+            CFLAGS="$CFLAGS `qmake-qt5 -o - /dev/null | grep INCPATH\ `"
         else
             break
         fi
          > /dev/null
         if [ $? -eq 0 ]; then
-            LDFLAGS+=" ``"
+            LDFLAGS="$LDFLAGS ``"
         else
             break
         fi
@@ -301,7 +317,7 @@
         if [ $? -ne 0 ]; then
         	break
         fi
-        echo yes
+		echo yes
         return 0
     done
 	
@@ -314,21 +330,22 @@
     # dependency gtk2 
     while true
     do
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
-        if ! pkg-config gtk+-2.0 ; then
+		$PKG_CONFIG gtk+-2.0
+        if [ $? -ne 0 ] ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags gtk+-2.0`"
-        LDFLAGS+=" `pkg-config --libs gtk+-2.0`"
-        CFLAGS+="-DUI_GTK2"    
-        LDFLAGS+="-lpthread"    
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-2.0`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-2.0`"
+        CFLAGS="$CFLAGS -DUI_GTK2"    
+        LDFLAGS="$LDFLAGS -lpthread"    
         pkg-config --atleast-version=2.20 gtk+-2.0 > /dev/null
         if [ $? -ne 0 ]; then
         	break
         fi
-        echo yes
+		echo yes
         return 0
     done
 	
@@ -341,17 +358,18 @@
     # dependency gtk3 
     while true
     do
-        if [ -z "PKG_CONFIG" ]; then
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
-        if ! pkg-config gtk+-3.0 ; then
+		$PKG_CONFIG gtk+-3.0
+        if [ $? -ne 0 ] ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags gtk+-3.0`"
-        LDFLAGS+=" `pkg-config --libs gtk+-3.0`"
-        CFLAGS+="-DUI_GTK3"    
-        LDFLAGS+="-lpthread"    
-        echo yes
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtk+-3.0`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs gtk+-3.0`"
+        CFLAGS="$CFLAGS -DUI_GTK3"    
+        LDFLAGS="$LDFLAGS -lpthread"    
+		echo yes
         return 0
     done
 	
@@ -364,9 +382,9 @@
     # dependency motif 
     while true
     do
-        CFLAGS+="-DUI_MOTIF"    
-        LDFLAGS+="-lXm -lXt -lX11 -lpthread"    
-        echo yes
+        CFLAGS="$CFLAGS -DUI_MOTIF"    
+        LDFLAGS="$LDFLAGS -lXm -lXt -lX11 -lpthread"    
+		echo yes
         return 0
     done
 	
@@ -379,11 +397,11 @@
     # dependency wpf platform="windows"
     while true
     do
-    	if ! isplatform "windows"; then
+    	if isnotplatform "windows"; then
             break
         fi
-        CFLAGS+="-DUI_WPF"    
-        echo yes
+        CFLAGS="$CFLAGS -DUI_WPF"    
+		echo yes
         return 0
     done
 	
@@ -396,12 +414,12 @@
     # dependency cocoa platform="macos"
     while true
     do
-    	if ! isplatform "macos"; then
+    	if isnotplatform "macos"; then
             break
         fi
-        CFLAGS+="-DUI_COCOA"    
-        LDFLAGS+="-lobjc -framework Cocoa"    
-        echo yes
+        CFLAGS="$CFLAGS -DUI_COCOA"    
+        LDFLAGS="$LDFLAGS -lobjc -framework Cocoa"    
+		echo yes
         return 0
     done
 	
@@ -411,6 +429,64 @@
 
 DEPENDENCIES_FAILED=
 ERROR=0
+# general dependencies
+CFLAGS=
+LDFLAGS=
+while true
+do
+    if isnotplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+		cat >> $TEMP_DIR/make.mk << __EOF__
+OBJ_EXT = o
+LIB_EXT = a
+PACKAGE_SCRIPT = package_osx.sh
+
+__EOF__
+        
+        break
+    done
+    
+    break
+done
+while true
+do
+    if isnotplatform "unix"; then
+        break
+    fi
+    if isplatform "macos"; then
+        break
+    fi
+    while true
+    do
+        
+		cat >> $TEMP_DIR/make.mk << __EOF__
+OBJ_EXT = o
+LIB_EXT = a
+PACKAGE_SCRIPT = package_unix.sh
+
+__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
 
 #
 # OPTION VALUES
@@ -530,6 +606,8 @@
 CXXFLAGS=
 
 
+# Features
+
 # Option: --toolkit
 if [ -z $OPT_TOOLKIT ]; then
 	SAVED_ERROR=$ERROR
@@ -633,20 +711,20 @@
 fi
 
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "TK_CFLAGS  += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "TK_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
 if [ $ERROR -ne 0 ]; then
 	echo
 	echo "Error: Unresolved dependencies"
-	echo $DEPENCIES_FAILED
+	echo $DEPENDENCIES_FAILED
 	rm -Rf $TEMP_DIR
 	exit 1
 fi
--- a/make/clang.mk	Mon Feb 04 17:49:50 2019 +0100
+++ b/make/clang.mk	Sat Nov 14 20:58:20 2020 +0100
@@ -1,46 +1,9 @@
 #
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2015 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
 #
 
-CC = clang
-CXX = clang++
-LD = clang
-AR = ar
-RM = rm
+CFLAGS = 
+LDFLAGS = 
 
-CFLAGS  += -g -c
-CXXFLAGS += -g
-LDFLAGS += 
-ARFLAGS = -r
-RMFLAGS = -f
-
-OBJ_EXT = o
-LIB_EXT = a
-APP_EXT =
-
-PACKAGE_SCRIPT = package_unix.sh
-
+SHLIB_CFLAGS = -fPIC
+SHLIB_LDFLAGS = -shared
--- a/make/configure.vm	Mon Feb 04 17:49:50 2019 +0100
+++ b/make/configure.vm	Sat Nov 14 20:58:20 2020 +0100
@@ -1,19 +1,53 @@
 #!/bin/sh
 
-PREFIX=/usr
-EPREFIX=$PREFIX
+#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`
@@ -85,85 +119,69 @@
 #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()}
+    case "$ARG" in
+		"--prefix="*)         PREFIX=${D}{ARG#--prefix=} ;;
+		"--exec-prefix="*)    EPREFIX=${D}{ARG#--exec-prefix=} ;;
+		"--bindir="*)         BINDIR=${D}{ARG#----bindir=} ;;
+		"--sbindir="*)        SBINDIR=${D}{ARG#--sbindir=} ;;
+		"--libdir="*)         LIBDIR=${D}{ARG#--libdir=} ;;
+		"--libexecdir="*)     LIBEXECDIR=${D}{ARG#--libexecdir=} ;;
+		"--datadir="*)        DATADIR=${D}{ARG#--datadir=} ;;
+		"--sysconfdir="*)     SYSCONFDIR=${D}{ARG#--sysconfdir=} ;;
+		"--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
+		"--localstatedir="*)  LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
+		"--includedir="*)     INCLUDEDIR=${D}{ARG#--includedir=} ;;
+		"--infodir="*)        INFODIR=${D}{ARG#--infodir=} ;;
+		"--mandir"*)          MANDIR=${D}{ARG#--mandir} ;;
+		"--help"*) printhelp; exit 1 ;;
+	#foreach( $opt in $options )
+    	"--${opt.getArgument()}="*) ${opt.getVarName()}={ARG#${opt.getArgument()}=} ;;
     #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
+	#foreach( $feature in $features )
+		"--enable-${feature.arg}") ${feature.getVarName()}=on ;;
+		"--disable-${feature.arg}") unset ${feature.getVarName()} ;;
+	#end
+		"-"*) echo "unknown option: $ARG"; exit 1 ;;
+	esac
 done
 
 # set dir variables
-if [ -z $BINDIR ]; then
+if [ -z "$BINDIR" ]; then
 	BINDIR=$EPREFIX/bin
 fi
-if [ -z $SBINDIR ]; then
+if [ -z "$SBINDIR" ]; then
 	SBINDIR=$EPREFIX/sbin
 fi
-if [ -z $LIBDIR ]; then
-	LIBDIRDIR=$EPREFIX/lib
+if [ -z "$LIBDIR" ]; then
+	LIBDIR=$EPREFIX/lib
 fi
-if [ -z $LIBEXEC ]; then
-	LIBExECDIR=$EPREFIX/libexec
+if [ -z "$LIBEXEC" ]; then
+	LIBEXECDIR=$EPREFIX/libexec
 fi
-if [ -z $DATADIR ]; then
+if [ -z "$DATADIR" ]; then
 	DATADIR=$PREFIX/share
 fi
-if [ -z $SYSCONFDIR]; then
+if [ -z "$SYSCONFDIR" ]; then
 	SYSCONFDIR=$PREFIX/etc
 fi
-if [ -z $SHAREDSTATEDIR ]; then
+if [ -z "$SHAREDSTATEDIR" ]; then
 	SHAREDSTATEDIR=$PREFIX/com
 fi
-if [ -z $LOCALSTATEDIR ]; then
+if [ -z "$LOCALSTATEDIR" ]; then
 	LOCALSTATEDIR=$PREFIX/var
 fi
-if [ -z $INCLUDEDIR ]; then
+if [ -z "$INCLUDEDIR" ]; then
 	INCLUDEDIR=$PREFIX/include
 fi
-if [ -z $INFODIR ]; then
+if [ -z "$INFODIR" ]; then
 	INFODIR=$PREFIX/info
 fi
-if [ -z $MANDIR ]; then
+if [ -z "$MANDIR" ]; then
 	MANDIR=$PREFIX/man
 fi
 
 which pkg-config > /dev/null
-if [ $? -ne 0 ]; then
+if [ $? -eq 0 ]; then
     PKG_CONFIG=pkg-config
 else
     PKG_CONFIG=false
@@ -210,12 +228,69 @@
     done
     return 1
 }
+isnotplatform()
+{
+    for p in $PLATFORM
+    do
+        if [ $p = $1 ]; then
+            return 1
+        fi
+    done
+    return 0
+}
 
 # 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
@@ -226,17 +301,17 @@
 
 # Toolchain detection
 # this will insert make vars to config.mk
-source make/toolchain.sh
+. make/toolchain.sh
 
 # add user specified flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${ENV_CFLAGS} ]]; then
+if [ ! -z "${ENV_CFLAGS}" ]; then
     echo "CFLAGS += $ENV_CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_CXXFLAGS} ]]; then
+if [ ! -z "${ENV_CXXFLAGS}" ]; then
     echo "CXXFLAGS += $ENV_CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${ENV_LDFLAGS} ]]; then
+if [ ! -z "${ENV_LDFLAGS}" ]; then
     echo "LDFLAGS += $ENV_LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
@@ -253,32 +328,38 @@
     while true
     do
     	#if( $sub.platform )
-    	if ! isplatform "${sub.platform}"; then
+    	if isnotplatform "${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
+        if [ -z "$PKG_CONFIG" ]; then
         	break
         fi
         #end
         #foreach( $pkg in $sub.pkgconfig )
-        if ! pkg-config $pkg.getPkgConfigParam() ; then
+		$PKG_CONFIG $pkg.getPkgConfigParam()
+        if [ $? -ne 0 ] ; then
             break
         fi
-        CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS+=" `pkg-config --libs $pkg.getPkgConfigParam()`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS="$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`"
+            $flags.varName="$$flags.varName `$flags.value`"
         else
             break
         fi
         #else
-        $flags.varName+="$flags.value"    
+        $flags.varName="$$flags.varName $flags.value"    
         #end
         #end
         #foreach( $test in $sub.tests )
@@ -287,7 +368,13 @@
         	break
         fi
         #end
-        echo yes
+		#if ( $sub.make.length() > 0 )
+		cat >> $TEMP_DIR/make.mk << __EOF__
+# Dependency: $dependency.name		
+$sub.make
+__EOF__
+        #end
+		echo yes
         return 0
     done
 	
@@ -307,42 +394,53 @@
 while true
 do
 	#if( $dependency.platform )
-    if ! isplatform "${sub.platform}"; then
+    if isnotplatform "${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
+        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
+		$PKG_CONFIG $pkg.getPkgConfigParam()
+        if [ $? -ne 0 ]; then
             echo no
             ERROR=1
             break
         fi
         echo yes
-        CFLAGS+=" `pkg-config --cflags $pkg.getPkgConfigParam()`"
-        LDFLAGS+=" `pkg-config --libs $pkg.getPkgConfigParam()`"
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags $pkg.getPkgConfigParam()`"
+        LDFLAGS="$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`"
+            $flags.varName="$$flags.varName `$flags.value`"
         else
             ERROR=1
             break
         fi
         #else
-        $flags.varName+="$flags.value"    
+        $flags.varName="$$flags.varName $flags.value"    
+        #end
         #end
+		#if ( $dependency.make.length() > 0 )
+		cat >> $TEMP_DIR/make.mk << __EOF__
+$dependency.make
+__EOF__
         #end
         
         break
@@ -354,13 +452,13 @@
 
 # add general dependency flags to config.mk
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 #end
@@ -383,7 +481,7 @@
 		return 1
 	fi
 	#foreach( $def in $val.defines )
-		CFLAGS+=" ${def.toFlags()}"
+		CFLAGS="$CFLAGS ${def.toFlags()}"
 	#end
 	#if( $val.hasMake() )
 	cat >> $TEMP_DIR/make.mk << __EOF__
@@ -415,11 +513,28 @@
 #foreach( $dependency in $target.dependencies )
 dependency_$dependency
 if [ $? -ne 0 ]; then
-	DEPENDENCIES_FAILED+="${dependency} "
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
 	ERROR=1
 fi
 #end
 
+# Features
+#foreach( $feature in $target.features )
+if [ ! -z "$${feature.getVarName()}" ]; then
+#foreach( $dependency in $feature.dependencies )
+	# check dependency
+	dependency_$dependency
+	if [ $? -ne 0 ]; then
+		# "auto" features can fail and are just disabled in this case
+		if [ $${feature.getVarName()} != "auto" ]; then
+			DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
+			ERROR=1
+		fi
+	fi
+#end
+fi
+#end
+
 #foreach( $opt in $target.options )
 # Option: --${opt.argument}
 if [ -z ${D}${opt.getVarName()} ]; then
@@ -465,13 +580,13 @@
 #end
 
 echo >> $TEMP_DIR/config.mk
-if [[ ! -z ${CFLAGS} ]]; then
+if [ ! -z "${CFLAGS}" ]; then
     echo "${target.getCFlags()}  += $CFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${CXXFLAGS} ]]; then
+if [ ! -z "${CXXFLAGS}" ]; then
     echo "${target.getCXXFlags()} += $CXXFLAGS" >> $TEMP_DIR/config.mk
 fi
-if [[ ! -z ${LDFLAGS} ]]; then
+if [ ! -z "${LDFLAGS}" ]; then
     echo "${target.getLDFlags()} += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
@@ -479,7 +594,7 @@
 if [ $ERROR -ne 0 ]; then
 	echo
 	echo "Error: Unresolved dependencies"
-	echo $DEPENCIES_FAILED
+	echo $DEPENDENCIES_FAILED
 	rm -Rf $TEMP_DIR
 	exit 1
 fi
--- a/make/gcc.mk	Mon Feb 04 17:49:50 2019 +0100
+++ b/make/gcc.mk	Sat Nov 14 20:58:20 2020 +0100
@@ -1,45 +1,10 @@
 #
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2011 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
 #
 
-CC  = gcc
-CXX = g++
-LD  = gcc
-AR  = ar
-RM  = rm
+CFLAGS = 
+LDFLAGS = 
 
-CFLAGS  += -std=gnu99 -g
-CXXFLAGS += -g
-LDFLAGS += 
-ARFLAGS = -r
-RMFLAGS = -f
+SHLIB_CFLAGS = -fPIC
+SHLIB_LDFLAGS = -shared
 
-OBJ_EXT = o
-LIB_EXT = a
-APP_EXT =
-
-PACKAGE_SCRIPT = package_unix.sh
--- a/make/project.xml	Mon Feb 04 17:49:50 2019 +0100
+++ b/make/project.xml	Sat Nov 14 20:58:20 2020 +0100
@@ -1,5 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project>
+	<!--
+	<dependency name="gtk4">
+		<pkgconfig>gtk+-4.0</pkgconfig>
+		<cflags>-DUI_GTK3</cflags>
+		<ldflags>-lpthread</ldflags>
+	</dependency>
+	-->
 	<dependency name="gtk3">
 		<pkgconfig>gtk+-3.0</pkgconfig>
 		<cflags>-DUI_GTK3</cflags>
@@ -40,8 +47,26 @@
 		<ldflags>-lXm -lXt -lX11 -lpthread</ldflags>
 	</dependency>
 	
+	<dependency platform="macos">
+		<make>OBJ_EXT = o</make>
+		<make>LIB_EXT = a</make>
+		<make>PACKAGE_SCRIPT = package_osx.sh</make>
+	</dependency>
+	<dependency platform="unix" not="macos">
+		<make>OBJ_EXT = o</make>
+		<make>LIB_EXT = a</make>
+		<make>PACKAGE_SCRIPT = package_unix.sh</make>
+	</dependency>
+	
 	<target name="tk">
 		<option arg="toolkit">
+			<!--
+			<value str="gtk4">
+				<dependencies>gtk4</dependencies>
+				<make>TOOLKIT = gtk</make>
+				<make>GTKOBJ = draw_cairo.o</make>
+			</value>
+			-->
 			<value str="gtk3">
 				<dependencies>gtk3</dependencies>
 				<make>TOOLKIT = gtk</make>
--- a/make/suncc.mk	Mon Feb 04 17:49:50 2019 +0100
+++ b/make/suncc.mk	Sat Nov 14 20:58:20 2020 +0100
@@ -1,43 +1,10 @@
 #
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
-#
-# Copyright 2011 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
 #
 
-CC = cc
-LD = cc
-AR = ar
-RM = rm
+CFLAGS = 
+LDFLAGS = 
 
-CFLAGS  += -g -xc99
-LDFLAGS += -lm
-ARFLAGS = -r
-RMFLAGS = -f
+SHLIB_CFLAGS = -Kpic
+SHLIB_LDFLAGS = -G
 
-OBJ_EXT = o
-LIB_EXT = a
-APP_EXT =
-
-PACKAGE_SCRIPT = package_unix.sh
--- a/make/toolchain.sh	Mon Feb 04 17:49:50 2019 +0100
+++ b/make/toolchain.sh	Sat Nov 14 20:58:20 2020 +0100
@@ -3,66 +3,179 @@
 # toolchain detection
 #
 
-COMPILERS="cc gcc clang suncc"
+C_COMPILERS="cc gcc clang suncc"
+CPP_COMPILERS="CC g++ clang++ sunCC"
 unset CC_ARG_CHECKED
 unset TOOLCHAIN_DETECTION_ERROR
 unset TOOLCHAIN_NAME
 
-check_compiler()
+check_c_compiler()
 {
-    cat > $TEMP_DIR/test.c << __EOF__
+	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");
+#if defined(__clang__)
+	printf("clang\n");
+#elif defined(__GNUC__)
+	printf("gcc\n");
 #elif defined(__sun)
-    printf("suncc\n");
+	printf("suncc\n");
 #else
-    printf("unknown\n");
+	printf("unknown\n");
 #endif
-    return 0;
+	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(__clang__)
+	std::cout << "clang" << std::endl;
+#elif defined(__GNUC__)
+	std::cout << "gcc" << 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 $CFLAGS $LDFLAGS $TEMP_DIR/test.c
-    
-    if [ $? -ne 0 ]; then
-        return 1
-    fi
-    return 0
+	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... "
+printf "detect C compiler... "
 
-for COMP in $COMPILERS
+for COMP in $C_COMPILERS
 do
-    check_compiler $COMP
-    if [ $? -ne 0 ]; then
-        if [ $COMP = $CC ]; then
-            echo "$CC is not a working C Compiler"
-            TOOLCHAIN_DETECTION_ERROR="error"
-            break
-        fi
-    else
-        TOOLCHAIN_NAME=`$TEMP_DIR/checkcc`
-        TOOLCHAIN_CC=$COMP
-        echo $TOOLCHAIN_NAME
-        break
-    fi
+	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`
+		USE_TOOLCHAIN=$TOOLCHAIN_NAME
+		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
+					USE_TOOLCHAIN="gcc"
+				fi
+			fi
+			if [ $TOOLCHAIN_NAME = "clang" ]; then
+				check_c_compiler "clang"
+				if [ $? -eq 0 ]; then
+					COMP=clang
+					USE_TOOLCHAIN="clang"
+				fi
+			fi
+		fi
+		
+		TOOLCHAIN_NAME=$USE_TOOLCHAIN
+		TOOLCHAIN_CC=$COMP
+		echo $COMP
+		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`
+			USE_TOOLCHAIN=$TOOLCHAIN_NAME
+			if [ $TOOLCHAIN_NAME = "gcc" ]; then
+				check_cpp_compiler "g++"
+				if [ $? -eq 0 ]; then
+				   COMP=g++
+				   USE_TOOLCHAIN="gcc"
+				fi
+			fi
+			if [ $TOOLCHAIN_NAME = "clang" ]; then
+				check_cpp_compiler "clang++"
+				if [ $? -eq 0 ]; then
+				   COMP=clang++
+				   USE_TOOLCHAIN="clang"
+				fi
+			fi
+		fi
+		
+		TOOLCHAIN_NAME=$USE_TOOLCHAIN
+		TOOLCHAIN_CXX=$COMP
+		echo $COMP
+		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"
+if [ -z "$TOOLCHAIN_NAME" ]; then
+	TOOLCHAIN_DETECTION_ERROR="error"
 else
-    echo "CC = ${TOOLCHAIN_CC}" >> $TEMP_DIR/config.mk
-    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
+	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
+	echo >> $TEMP_DIR/config.mk
+	
+	cat "make/${TOOLCHAIN_NAME}.mk" > /dev/null 2>&1
+	if [ $? -eq 0 ]; then 
+		echo "include \$(BUILD_ROOT)/make/${TOOLCHAIN_NAME}.mk" >> $TEMP_DIR/config.mk
+	else
+		echo "SHLIB_CFLAGS = -fPIC" >> $TEMP_DIR/config.mk
+		echo "SHLIB_LDFLAGS = -shared" >> $TEMP_DIR/config.mk
+	fi
 fi
--- a/ui/gtk/Makefile	Mon Feb 04 17:49:50 2019 +0100
+++ b/ui/gtk/Makefile	Sat Nov 14 20:58:20 2020 +0100
@@ -27,7 +27,7 @@
 #
 
 $(GTK_OBJPRE)%.o: gtk/%.c
-	$(CC) -o $@ -c $(CFLAGS) $(TK_CFLAGS) $<
+	$(CC) -o $@ -c -I../ucx $(CFLAGS) $(TK_CFLAGS) $<
 	
 $(UI_LIB): $(OBJ)
 	$(AR) $(ARFLAGS) $(UI_LIB) $(OBJ)	
--- a/ui/motif/Makefile	Mon Feb 04 17:49:50 2019 +0100
+++ b/ui/motif/Makefile	Sat Nov 14 20:58:20 2020 +0100
@@ -27,7 +27,7 @@
 #
 
 $(MOTIF_OBJPRE)%.o: motif/%.c
-	$(CC) -o $@ -c $(CFLAGS) $(TK_CFLAGS) $<
+	$(CC) -o $@ -c -I../ucx $(CFLAGS) $(TK_CFLAGS) $<
 
 $(UI_LIB): $(OBJ)
 	$(AR) $(ARFLAGS) $(UI_LIB) $(OBJ)	

mercurial