check compilers before any dependency checks

Tue, 19 Sep 2023 19:29:19 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 19 Sep 2023 19:29:19 +0200
changeset 67
e43d30273f74
parent 66
dc758dcd4645
child 68
c997c0978665

check compilers before any dependency checks

src/main/java/de/unixwork/uwproj/Main.java file | annotate | diff | comparison | revisions
src/main/java/de/unixwork/uwproj/Project.java file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure file | annotate | diff | comparison | revisions
src/test/resources/golden-sample/configure2 file | annotate | diff | comparison | revisions
test/configure file | annotate | diff | comparison | revisions
test/make/configure.vm file | annotate | diff | comparison | revisions
test/make/project.xml file | annotate | diff | comparison | revisions
--- a/src/main/java/de/unixwork/uwproj/Main.java	Mon Sep 18 23:20:29 2023 +0200
+++ b/src/main/java/de/unixwork/uwproj/Main.java	Tue Sep 19 19:29:19 2023 +0200
@@ -25,6 +25,7 @@
         context.put("features", project.getFeatures());
         context.put("project", project);
         context.put("vars", project.getVars());
+        context.put("languages", project.getLang());
         new VelocityEngine().getTemplate(tplFileName).merge(context, out);
     }
 
--- a/src/main/java/de/unixwork/uwproj/Project.java	Mon Sep 18 23:20:29 2023 +0200
+++ b/src/main/java/de/unixwork/uwproj/Project.java	Tue Sep 19 19:29:19 2023 +0200
@@ -20,6 +20,8 @@
 
     private final HashMap<String, ConfigVar> configVars = new HashMap<>();
     private final List<ConfigVar> configVarsList = new LinkedList<>();
+    
+    private final List<String> langList = new LinkedList<>();
 
     public Project(File file) throws Exception {
         var root = DocumentBuilderFactory.
@@ -56,6 +58,24 @@
         if (targets.isEmpty()) {
             createDefaultTarget();
         }
+        
+        // create a list of all languages that are used
+        for (Dependency d : dependencies) {
+            for (String lang : d.getLang()) {
+                if(!langList.contains(lang)) {
+                    langList.add(lang);
+                }
+            }
+        }
+        for (var nd : namedDependencies.entrySet()) {
+            for (var d : nd.getValue()) {
+                for (String lang : d.getLang()) {
+                    if(!langList.contains(lang)) {
+                        langList.add(lang);
+                    }
+                }
+            }
+        }
     }
 
     private void createDefaultTarget() {
@@ -118,4 +138,8 @@
     public List<ConfigVar> getVars() {
         return configVarsList;
     }
+    
+    public List<String> getLang() {
+        return langList;
+    }
 }
--- a/src/test/resources/golden-sample/configure	Mon Sep 18 23:20:29 2023 +0200
+++ b/src/test/resources/golden-sample/configure	Tue Sep 19 19:29:19 2023 +0200
@@ -196,6 +196,16 @@
 # DEPENDENCIES
 #
 
+# check languages
+lang_c=
+lang_cpp=
+if detect_c_compiler ; then
+    lang_c=1
+fi
+if detect_cpp_compiler ; then
+    lang_cpp=1
+fi
+
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
@@ -212,6 +222,22 @@
     return 0
 }
 
+dependency_error_cpp()
+{
+    printf "checking for cpp... "
+    # dependency cpp
+    while true
+    do
+        if [ -z "$lang_cpp" ] ; then
+            break
+        fi
+        echo yes
+        return 1
+    done
+
+    echo no
+    return 0
+}
 dependency_error_libpq()
 {
     printf "checking for libpq... "
@@ -240,6 +266,9 @@
     # dependency openssl
     while true
     do
+        if [ -z "$lang_c" ] ; then
+            break
+        fi
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
@@ -293,6 +322,9 @@
     # dependency libxml2
     while true
     do
+        if [ -z "$lang_c" ] ; then
+            break
+        fi
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
@@ -310,6 +342,9 @@
     return 0
 }
 
+
+
+
 # start collecting dependency information
 echo > "$TEMP_DIR/flags.mk"
 
@@ -323,9 +358,7 @@
 do
     while true
     do
-        if detect_cpp_compiler ; then
-            :
-        else
+        if [ -z "$lang_c" ] ; then
             ERROR=1
             break
         fi
@@ -370,6 +403,10 @@
     DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
     ERROR=1
 fi
+if dependency_error_libpq; then
+    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
+    ERROR=1
+fi
 
 # Features
 if [ -n "$FEATURE_PG" ]; then
@@ -383,6 +420,16 @@
             ERROR=1
         fi
     fi
+    # check dependency
+    if dependency_error_cpp ; then
+        # "auto" features can fail and are just disabled in this case
+        if [ "$FEATURE_PG" = "auto" ]; then
+            unset FEATURE_PG
+		else
+            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED cpp "
+            ERROR=1
+        fi
+    fi
 fi
 
 
--- a/src/test/resources/golden-sample/configure2	Mon Sep 18 23:20:29 2023 +0200
+++ b/src/test/resources/golden-sample/configure2	Tue Sep 19 19:29:19 2023 +0200
@@ -199,6 +199,13 @@
 # DEPENDENCIES
 #
 
+# check languages
+lang_c=
+lang_cpp=
+if detect_c_compiler ; then
+    lang_c=1
+fi
+
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
@@ -423,6 +430,9 @@
     return 0
 }
 
+
+
+
 # start collecting dependency information
 echo > "$TEMP_DIR/flags.mk"
 
@@ -436,9 +446,7 @@
 do
     while true
     do
-        if detect_c_compiler ; then
-            :
-        else
+        if [ -z "$lang_c" ] ; then
             ERROR=1
             break
         fi
--- a/test/configure	Mon Sep 18 23:20:29 2023 +0200
+++ b/test/configure	Tue Sep 19 19:29:19 2023 +0200
@@ -29,9 +29,12 @@
 MANDIR=
 
 # custom variables
+HOST=`uname -n`
+PREFIX=`pwd`/work
+INSTALL_DIR=$PREFIX
 
 # features
-FEATURE_DB=auto
+FEATURE_PG=auto
 
 # clean abort
 abort_configure()
@@ -64,14 +67,8 @@
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
 
-Options:
-  --debug                 add extra compile flags for debug builds
-  --release               add extra compile flags for release builds
-  --toolkit=(gtk3|cli|gtk2|wpf)
-
 Optional Features:
-  --disable-db
-  --enable-gui
+  --disable-pg
 
 __EOF__
 }
@@ -99,11 +96,8 @@
         "--help"*) printhelp; abort_configure ;;
         "--debug")           BUILD_TYPE="debug" ;;
         "--release")         BUILD_TYPE="release" ;;
-        "--toolkit="*) OPT_TOOLKIT=${ARG#--toolkit=} ;;
-        "--enable-db") FEATURE_DB=on ;;
-        "--disable-db") unset FEATURE_DB ;;
-        "--enable-gui") FEATURE_GUI=on ;;
-        "--disable-gui") unset FEATURE_GUI ;;
+        "--enable-pg") FEATURE_PG=on ;;
+        "--disable-pg") unset FEATURE_PG ;;
         "-"*) echo "unknown option: $ARG"; abort_configure ;;
     esac
 done
@@ -188,6 +182,9 @@
 INCLUDEDIR=$INCLUDEDIR
 INFODIR=$INFODIR
 MANDIR=$MANDIR
+HOST=$HOST
+PREFIX=$PREFIX
+INSTALL_DIR=$INSTALL_DIR
 __EOF__
 sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
 
@@ -199,6 +196,16 @@
 # DEPENDENCIES
 #
 
+# check languages
+lang_c=
+lang_cpp=
+if detect_c_compiler ; then
+    lang_c=1
+fi
+if detect_cpp_compiler ; then
+    lang_cpp=1
+fi
+
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
@@ -215,15 +222,13 @@
     return 0
 }
 
-dependency_error_qt4()
+dependency_error_cpp()
 {
-    printf "checking for qt4... "
-    # dependency qt4
+    printf "checking for cpp... "
+    # dependency cpp
     while true
     do
-        if which qmake-qt4 > /dev/null ; then
-            :
-        else
+        if [ -z "$lang_cpp" ] ; then
             break
         fi
         echo yes
@@ -233,72 +238,18 @@
     echo no
     return 0
 }
-dependency_error_curl()
+dependency_error_libpq()
 {
-    printf "checking for curl... "
-    # dependency curl platform="windows"
-    while true
-    do
-        if notisplatform "windows"; then
-            break
-        fi
-        TEMP_CFLAGS="$TEMP_CFLAGS -I/mingw/include"
-        TEMP_LDFLAGS="$TEMP_LDFLAGS -lcurl"
-        echo yes
-        return 1
-    done
-
-    # dependency curl platform="macos"
-    while true
-    do
-        if notisplatform "macos"; then
-            break
-        fi
-        if tmp_flags=`curl-config --cflags` ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
-        else
-            break
-        fi
-        if tmp_flags=`curl-config --ldflags` ; then
-            TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    # dependency curl
+    printf "checking for libpq... "
+    # dependency libpq
     while true
     do
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if test_pkg_config "libcurl" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libcurl`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libcurl`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_gtk2()
-{
-    printf "checking for gtk2... "
-    # dependency gtk2
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "gtk+-2.0" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-2.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-2.0`"
+        if test_pkg_config "libpq" "" "" "" ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libpq`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libpq`"
         else
             break
         fi
@@ -309,18 +260,77 @@
     echo no
     return 0
 }
-dependency_error_sqlite()
+dependency_error_openssl()
 {
-    printf "checking for sqlite... "
-    # dependency sqlite
+    printf "checking for openssl... "
+    # dependency openssl
     while true
     do
+        if [ -z "$lang_c" ] ; then
+            break
+        fi
         if [ -z "$PKG_CONFIG" ]; then
             break
         fi
-        if test_pkg_config "sqlite3" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags sqlite3`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs sqlite3`"
+        if test_pkg_config "openssl" "" "" "" ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags openssl`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs openssl`"
+        else
+            break
+        fi
+        echo yes
+        return 1
+    done
+
+    # dependency openssl platform="bsd"
+    while true
+    do
+        if notisplatform "bsd"; then
+            break
+        fi
+        TEMP_LDFLAGS="$TEMP_LDFLAGS -lssl -lcrypto"
+        echo yes
+        return 1
+    done
+
+    echo no
+    return 0
+}
+dependency_error_libxml2()
+{
+    printf "checking for libxml2... "
+    # dependency libxml2 platform="macos"
+    while true
+    do
+        if notisplatform "macos"; then
+            break
+        fi
+        if tmp_flags=`xml2-config --cflags` ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS $tmp_flags"
+        else
+            break
+        fi
+        if tmp_flags=`xml2-config --libs` ; then
+            TEMP_LDFLAGS="$TEMP_LDFLAGS $tmp_flags"
+        else
+            break
+        fi
+        echo yes
+        return 1
+    done
+
+    # dependency libxml2
+    while true
+    do
+        if [ -z "$lang_c" ] ; then
+            break
+        fi
+        if [ -z "$PKG_CONFIG" ]; then
+            break
+        fi
+        if test_pkg_config "libxml-2.0" "" "" "" ; then
+            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`"
+            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`"
         else
             break
         fi
@@ -331,97 +341,9 @@
     echo no
     return 0
 }
-dependency_error_test()
-{
-    printf "checking for test... "
-    # dependency test platform="bsd"
-    while true
-    do
-        if notisplatform "bsd"; then
-            break
-        fi
-        if isplatform "macos"; then
-            break
-        fi
-        TEMP_CFLAGS="$TEMP_CFLAGS -DBSD"
-        echo yes
-        return 1
-    done
 
-    # dependency test
-    while true
-    do
-        TEMP_CFLAGS="$TEMP_CFLAGS -DTEST"
-        echo yes
-        return 1
-    done
 
-    echo no
-    return 0
-}
-dependency_error_gtk3()
-{
-    printf "checking for gtk3... "
-    # dependency gtk3
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "gtk+-5.0" "" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags gtk+-5.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs gtk+-5.0`"
-        else
-            break
-        fi
-        echo yes
-        return 1
-    done
 
-    echo no
-    return 0
-}
-dependency_error_deptest()
-{
-    printf "checking for deptest... "
-    # dependency deptest
-    while true
-    do
-        TEMP_CFLAGS="$TEMP_CFLAGS -DDEPTEST"
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
-dependency_error_libxml2()
-{
-    printf "checking for libxml2... "
-    # dependency libxml2
-    while true
-    do
-        if [ -z "$PKG_CONFIG" ]; then
-            break
-        fi
-        if test_pkg_config "libxml-2.0" "2.8" "" "" ; then
-            TEMP_CFLAGS="$TEMP_CFLAGS `"$PKG_CONFIG" --cflags libxml-2.0`"
-            TEMP_LDFLAGS="$TEMP_LDFLAGS `"$PKG_CONFIG" --libs libxml-2.0`"
-        else
-            break
-        fi
-        cat >> $TEMP_DIR/make.mk << __EOF__
-# Dependency: libxml2
-xml = libxml2
-
-__EOF__
-        echo yes
-        return 1
-    done
-
-    echo no
-    return 0
-}
 
 # start collecting dependency information
 echo > "$TEMP_DIR/flags.mk"
@@ -436,18 +358,11 @@
 do
     while true
     do
-        if detect_c_compiler ; then
-            :
-        else
+        if [ -z "$lang_c" ] ; then
             ERROR=1
             break
         fi
 
-        cat >> "$TEMP_DIR/make.mk" << __EOF__
-MVAR = 123
-MVAR += 123
-
-__EOF__
         break
     done
     break
@@ -468,206 +383,54 @@
 #
 # OPTION VALUES
 #
-checkopt_toolkit_gtk3()
-{
-    VERR=0
-    if dependency_error_gtk3 ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-        TEMP_CFLAGS="$TEMP_CFLAGS -Da=b"
-        TEMP_CXXFLAGS="$TEMP_CXXFLAGS -Da=b"
-    cat >> "$TEMP_DIR/make.mk" << __EOF__
-UIOBJ += graphics_cairo.o
-
-__EOF__
-    return 0
-}
-checkopt_toolkit_cli()
-{
-    VERR=0
-    if dependency_error_curl ; then
-        VERR=1
-    fi
-    if dependency_error_test ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
-checkopt_toolkit_gtk2()
-{
-    VERR=0
-    if dependency_error_gtk2 ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
-checkopt_toolkit_wpf()
-{
-    VERR=0
-    if dependency_error_test ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
 
 #
 # TARGETS
 #
 
 echo >> "$TEMP_DIR/flags.mk"
-# Target: dav
-echo "# flags for target dav" >> "$TEMP_DIR/flags.mk"
-TEMP_CFLAGS=
-TEMP_CXXFLAGS=
-TEMP_LDFLAGS=
-
-if dependency_error_curl; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED curl "
-    ERROR=1
-fi
-if dependency_error_libxml2; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
-    ERROR=1
-fi
-if dependency_error_test; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED test "
-    ERROR=1
-fi
-
-# Features
-if [ -n "$FEATURE_DB" ]; then
-    # check dependency
-    if dependency_error_sqlite ; then
-        # "auto" features can fail and are just disabled in this case
-        if [ "$FEATURE_DB" = "auto" ]; then
-            unset FEATURE_DB
-		else
-            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite "
-            ERROR=1
-        fi
-    fi
-fi
-if [ -n "$FEATURE_GUI" ]; then
-    # check dependency
-    if dependency_error_gtk3 ; then
-        # "auto" features can fail and are just disabled in this case
-        if [ "$FEATURE_GUI" = "auto" ]; then
-            unset FEATURE_GUI
-		else
-            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED gtk3 "
-            ERROR=1
-        fi
-    fi
-fi
-
-# Option: --toolkit
-if [ -z $OPT_TOOLKIT ]; then
-    SAVED_ERROR="$ERROR"
-    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
-    ERROR=1
-    while true
-    do
-        if isplatform "windows"; then
-        if checkopt_toolkit_wpf ; then
-            echo "  toolkit: wpf" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        fi
-        if checkopt_toolkit_gtk3 ; then
-            echo "  toolkit: gtk3" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        if checkopt_toolkit_gtk2 ; then
-            echo "  toolkit: gtk2" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        break
-    done
-    if [ $ERROR -ne 0 ]; then
-        SAVED_ERROR=1
-    fi
-    ERROR="$SAVED_ERROR"
-    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
-else
-    if false; then
-        false
-    elif [ "$OPT_TOOLKIT" = "gtk3" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_gtk3 ; then
-            :
-        else
-            ERROR=1
-        fi
-    elif [ "$OPT_TOOLKIT" = "cli" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_cli ; then
-            :
-        else
-            ERROR=1
-        fi
-    elif [ "$OPT_TOOLKIT" = "gtk2" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_gtk2 ; then
-            :
-        else
-            ERROR=1
-        fi
-    elif [ "$OPT_TOOLKIT" = "wpf" ]; then
-        echo "  toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options
-        if checkopt_toolkit_wpf ; then
-            :
-        else
-            ERROR=1
-        fi
-    fi
-fi
-
-if [ -n "${TEMP_CFLAGS}" ]; then
-    echo "DAV_CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
-    echo "DAV_CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-if [ "$BUILD_TYPE" = "debug" ]; then
-    echo 'DAV_CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'DAV_CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-fi
-if [ "$BUILD_TYPE" = "release" ]; then
-    echo 'DAV_CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'DAV_CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
-fi
-if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "DAV_LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
-fi
-
-echo >> "$TEMP_DIR/flags.mk"
 # Target
 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
 TEMP_CFLAGS=
 TEMP_CXXFLAGS=
 TEMP_LDFLAGS=
 
-if dependency_error_deptest; then
-    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED deptest "
+if dependency_error_libxml2; then
+    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libxml2 "
+    ERROR=1
+fi
+if dependency_error_openssl; then
+    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED openssl "
+    ERROR=1
+fi
+if dependency_error_libpq; then
+    DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
     ERROR=1
 fi
 
 # Features
+if [ -n "$FEATURE_PG" ]; then
+    # check dependency
+    if dependency_error_libpq ; then
+        # "auto" features can fail and are just disabled in this case
+        if [ "$FEATURE_PG" = "auto" ]; then
+            unset FEATURE_PG
+		else
+            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED libpq "
+            ERROR=1
+        fi
+    fi
+    # check dependency
+    if dependency_error_cpp ; then
+        # "auto" features can fail and are just disabled in this case
+        if [ "$FEATURE_PG" = "auto" ]; then
+            unset FEATURE_PG
+		else
+            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED cpp "
+            ERROR=1
+        fi
+    fi
+fi
 
 
 if [ -n "${TEMP_CFLAGS}" ]; then
@@ -702,18 +465,11 @@
 echo "Build Config:"
 echo "  PREFIX:    $PREFIX"
 echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
-echo "Options:"
-cat "$TEMP_DIR/options"
 echo "Features:"
-if [ -n "$FEATURE_DB" ]; then
-echo "  db: on"
+if [ -n "$FEATURE_PG" ]; then
+echo "  pg: on"
 else
-echo "  db: off"
-fi
-if [ -n "$FEATURE_GUI" ]; then
-echo "  gui: on"
-else
-echo "  gui: off"
+echo "  pg: off"
 fi
 echo
 
--- a/test/make/configure.vm	Mon Sep 18 23:20:29 2023 +0200
+++ b/test/make/configure.vm	Tue Sep 19 19:29:19 2023 +0200
@@ -229,6 +229,15 @@
 # DEPENDENCIES
 #
 
+# check languages
+lang_c=
+lang_cpp=
+#foreach( $lang in $languages )
+if detect_${lang}_compiler ; then
+    lang_${lang}=1
+fi
+#end
+
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
 
@@ -264,9 +273,7 @@
         fi
         #end
         #foreach( $lang in $sub.lang )
-        if detect_${lang}_compiler ; then
-            :
-        else
+        if [ -z "$lang_${lang}" ] ; then
             break
         fi
         #end
@@ -317,6 +324,9 @@
 }
 #end
 
+
+
+
 # start collecting dependency information
 echo > "$TEMP_DIR/flags.mk"
 
@@ -343,9 +353,7 @@
     while true
     do
         #foreach( $lang in $dependency.lang )
-        if detect_${lang}_compiler ; then
-            :
-        else
+        if [ -z "$lang_${lang}" ] ; then
             ERROR=1
             break
         fi
--- a/test/make/project.xml	Mon Sep 18 23:20:29 2023 +0200
+++ b/test/make/project.xml	Tue Sep 19 19:29:19 2023 +0200
@@ -8,8 +8,12 @@
 	</config>
 	
 	<dependency>
+		<lang>c</lang>
+	</dependency>
+	
+	<dependency name="cpp">
 		<lang>cpp</lang>
-	</dependency>
+	</dependency>	
 
 	<!-- library dependencies -->
 	<dependency name="libxml2" platform="macos">
@@ -19,16 +23,18 @@
 
 	<dependency name="libxml2">
 		<pkgconfig>libxml-2.0</pkgconfig>
+		<lang>c</lang>
 	</dependency>
 	
 	<dependency name="openssl">
 		<pkgconfig>openssl</pkgconfig>
+		<lang>c</lang>
 	</dependency>
 	
 	<dependency name="openssl" platform="bsd">
 		<ldflags>-lssl -lcrypto</ldflags>
 	</dependency>
-	
+    
 	<!-- optional dependencies -->
 	<dependency name="libpq">
 		<pkgconfig>libpq</pkgconfig>
@@ -36,9 +42,9 @@
 	
 	<target>
 		<feature name="pg" default="true">
-			<dependencies>libpq</dependencies>
+			<dependencies>libpq,cpp</dependencies>
 		</feature>
-		<dependencies>libxml2,openssl</dependencies>
+		<dependencies>libxml2,openssl,libpq</dependencies>
 	</target>
 </project>
 

mercurial