add configure option for szmul default tip

Tue, 12 Nov 2024 17:34:04 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 12 Nov 2024 17:34:04 +0100
changeset 987
53e22f112b11
parent 986
38fa7e41194c

add configure option for szmul

check-all.sh file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
make/uwproj.xsd file | annotate | diff | comparison | revisions
--- a/check-all.sh	Mon Nov 11 21:42:14 2024 +0100
+++ b/check-all.sh	Tue Nov 12 17:34:04 2024 +0100
@@ -1,15 +1,27 @@
 #!/bin/sh
 
-for cc in clang gcc; do
-  make clean > /dev/null
-  CC=$cc ./configure --debug > /dev/null
-  printf "Check $cc... "
-  if ! make check > /dev/null ; then
+# backup config
+cp config.mk config.mk.bak
+
+function perform_check
+{
+  if ! make clean check > /dev/null ; then
     echo "fail."
-    exit 1
   else
     echo "ok."
   fi
+}
+
+for cc in clang gcc; do
+  CC=$cc ./configure --debug > /dev/null
+  printf "Check $cc... "
+  perform_check
 done
 
+printf "Check w/o szmul builtin... "
+./configure --debug --disable-szmul-builtin > /dev/null
+perform_check
 
+# clean build files and restore config
+make clean > /dev/null
+mv config.mk.bak config.mk
--- a/configure	Mon Nov 11 21:42:14 2024 +0100
+++ b/configure	Tue Nov 12 17:34:04 2024 +0100
@@ -113,6 +113,7 @@
 
 Optional Features:
   --enable-coverage
+  --disable-szmul-builtin use custom implementation, instead
 
 __EOF__
 }
@@ -158,6 +159,7 @@
 fi
 
 # features
+FEATURE_SZMUL_BUILTIN=auto
 
 #
 # parse arguments
@@ -187,6 +189,8 @@
         "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;;
         "--enable-coverage") FEATURE_COVERAGE=on ;;
         "--disable-coverage") unset FEATURE_COVERAGE ;;
+        "--enable-szmul-builtin") FEATURE_SZMUL_BUILTIN=on ;;
+        "--disable-szmul-builtin") unset FEATURE_SZMUL_BUILTIN ;;
         "-"*) echo "unknown option: $ARG"; abort_configure ;;
     esac
 done
@@ -603,6 +607,23 @@
         unset FEATURE_COVERAGE
     fi
 fi
+if [ -n "$FEATURE_COVERAGE" ]; then
+    :
+else
+    :
+fi
+if [ -n "$FEATURE_SZMUL_BUILTIN" ]; then
+    if [ -n "$DISABLE_FEATURE_SZMUL_BUILTIN" ]; then
+        unset FEATURE_SZMUL_BUILTIN
+    fi
+fi
+if [ -n "$FEATURE_SZMUL_BUILTIN" ]; then
+    :
+else
+    :
+    TEMP_CFLAGS="$TEMP_CFLAGS -DCX_NO_SZMUL_BUILTIN"
+    TEMP_CXXFLAGS="$TEMP_CXXFLAGS -DCX_NO_SZMUL_BUILTIN"
+fi
 
 # Option: --with-docs
 if [ -z "$OPT_WITH_DOCS" ]; then
@@ -727,6 +748,11 @@
 else
 echo "  coverage: off"
 fi
+if [ -n "$FEATURE_SZMUL_BUILTIN" ]; then
+echo "  szmul-builtin: on"
+else
+echo "  szmul-builtin: off"
+fi
 echo
 
 # generate the config.mk file
--- a/make/configure.vm	Mon Nov 11 21:42:14 2024 +0100
+++ b/make/configure.vm	Tue Nov 12 17:34:04 2024 +0100
@@ -568,6 +568,35 @@
         unset ${feature.varName}
     fi
 fi
+if [ -n "${D}${feature.varName}" ]; then
+    :
+#foreach( $def in $feature.defines )
+    TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}"
+    TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}"
+#end
+#if( $feature.hasMake() )
+    cat >> "$TEMP_DIR/make.mk" << __EOF__
+$feature.make
+__EOF__
+#end
+else
+    :
+#foreach( $def in $feature.disabled.defines )
+    TEMP_CFLAGS="$TEMP_CFLAGS ${def.toFlags()}"
+    TEMP_CXXFLAGS="$TEMP_CXXFLAGS ${def.toFlags()}"
+#end
+#if( $feature.disabled.hasMake() )
+    cat >> "$TEMP_DIR/make.mk" << __EOF__
+$feature.disabled.make
+__EOF__
+#end
+#foreach( $dependency in $feature.disabled.dependencies )
+    if dependency_error_$dependency ; then
+        DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
+        ERROR=1
+    fi
+#end
+fi
 #end
 
 #foreach( $opt in $target.options )
--- a/make/project.xml	Mon Nov 11 21:42:14 2024 +0100
+++ b/make/project.xml	Tue Nov 12 17:34:04 2024 +0100
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://unixwork.de/uwproj">
+<project version="0.3" xmlns="http://unixwork.de/uwproj">
     <config>
         <var name="src_dir" exec="true">pwd</var>
         <var name="DOXYGEN" exec="true">command -v doxygen</var>
@@ -114,6 +114,12 @@
         <feature name="coverage">
             <dependencies>coverage</dependencies>
         </feature>
+        <feature name="szmul-builtin" default="true">
+            <desc>use custom implementation, instead</desc>
+            <disabled>
+                <define name="CX_NO_SZMUL_BUILTIN"/>
+            </disabled>
+        </feature>
         <dependencies>c,file-tools</dependencies>
     </target>
 </project>
--- a/make/uwproj.xsd	Mon Nov 11 21:42:14 2024 +0100
+++ b/make/uwproj.xsd	Tue Nov 12 17:34:04 2024 +0100
@@ -3,7 +3,7 @@
            xmlns="http://unixwork.de/uwproj"
            targetNamespace="http://unixwork.de/uwproj"
            elementFormDefault="qualified"
-           version="0.2"
+           version="0.3"
 >
     <xs:element name="project" type="ProjectType"/>
 
@@ -21,6 +21,7 @@
             <xs:element name="dependency" type="DependencyType" minOccurs="0" maxOccurs="unbounded"/>
             <xs:element name="target" type="TargetType" minOccurs="0" maxOccurs="unbounded"/>
         </xs:sequence>
+        <xs:attribute name="version" type="xs:string" use="required" />
     </xs:complexType>
 
     <xs:complexType name="ConfigType">
@@ -195,6 +196,9 @@
                 <code>dependencies</code> are satisfied.
                 If a feature is enabled, all <code>define</code> and <code>make</code> definitions are
                 supposed to be applied to the config file.
+                If a feature is disabled, an optional <code>disabled</code> element may specify which
+                <code>define</code> and <code>make</code> definitions are supposed to be applied.
+                There might also be <code>dependencies</code> when the feature is disabled (e.g. specifying a fallback).
                 In case the optional <code>default</code> attribute is set to true, the feature is enabled by default
                 and is supposed to be automatically disabled (without error) when the dependencies are not satisfied.
                 The name that is supposed to be used for the --enable and --disable arguments can be optionally
@@ -206,6 +210,13 @@
         <xs:choice minOccurs="0" maxOccurs="unbounded">
             <xs:group ref="TargetDataGroup"/>
             <xs:element name="desc" type="xs:string"/>
+            <xs:element name="disabled">
+                <xs:complexType>
+                    <xs:choice minOccurs="0" maxOccurs="unbounded">
+                        <xs:group ref="TargetDataGroup"/>
+                    </xs:choice>
+                </xs:complexType>
+            </xs:element>
         </xs:choice>
         <xs:attribute name="name" type="xs:string" use="required"/>
         <xs:attribute name="arg" type="xs:string"/>

mercurial