configure

changeset 772
4586a84c0c0b
parent 766
e59b76889f00
child 788
b34ff44e6433
--- a/configure	Wed Dec 27 16:07:45 2023 +0100
+++ b/configure	Wed Dec 27 16:16:11 2023 +0100
@@ -77,6 +77,9 @@
   --release               add extra compile flags for release builds
   --with-docs=(all|html|api|none)
 
+Optional Features:
+  --enable-coverage
+
 __EOF__
 }
 
@@ -106,6 +109,8 @@
         "--debug")           BUILD_TYPE="debug" ;;
         "--release")         BUILD_TYPE="release" ;;
         "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;;
+        "--enable-coverage") FEATURE_COVERAGE=on ;;
+        "--disable-coverage") unset FEATURE_COVERAGE ;;
         "-"*) echo "unknown option: $ARG"; abort_configure ;;
     esac
 done
@@ -251,6 +256,21 @@
     return 0
 }
 
+dependency_error_coverage()
+{
+    printf "checking for coverage... "
+    # dependency coverage
+    while true
+    do
+        TEMP_CFLAGS="$TEMP_CFLAGS --coverage"
+        TEMP_LDFLAGS="$TEMP_LDFLAGS --coverage"
+        echo yes
+        return 1
+    done
+
+    echo no
+    return 0
+}
 dependency_error_pandoc()
 {
     printf "checking for pandoc... "
@@ -511,6 +531,21 @@
 fi
 
 # Features
+if [ -n "$FEATURE_COVERAGE" ]; then
+    # check dependency
+    if dependency_error_coverage ; then
+        # "auto" features can fail and are just disabled in this case
+        if [ "$FEATURE_COVERAGE" = "auto" ]; then
+            DISABLE_FEATURE_COVERAGE=1
+        else
+            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED coverage "
+            ERROR=1
+        fi
+    fi
+    if [ -n "$DISABLE_FEATURE_COVERAGE" ]; then
+        unset FEATURE_COVERAGE
+    fi
+fi
 
 # Option: --with-docs
 if [ -z "$OPT_WITH_DOCS" ]; then
@@ -629,6 +664,12 @@
 echo "  TOOLCHAIN:   $TOOLCHAIN_NAME"
 echo "Options:"
 cat "$TEMP_DIR/options"
+echo "Features:"
+if [ -n "$FEATURE_COVERAGE" ]; then
+echo "  coverage: on"
+else
+echo "  coverage: off"
+fi
 echo
 
 # generate the config.mk file

mercurial