--- a/configure Tue Nov 12 17:34:04 2024 +0100 +++ b/configure Mon Nov 18 22:05:42 2024 +0100 @@ -113,6 +113,7 @@ Optional Features: --enable-coverage + --disable-cxx-tests the check-cxx makefile target --disable-szmul-builtin use custom implementation, instead __EOF__ @@ -159,6 +160,7 @@ fi # features +FEATURE_CXX_TESTS=auto FEATURE_SZMUL_BUILTIN=auto # @@ -189,6 +191,8 @@ "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;; "--enable-coverage") FEATURE_COVERAGE=on ;; "--disable-coverage") unset FEATURE_COVERAGE ;; + "--enable-cxx-tests") FEATURE_CXX_TESTS=on ;; + "--disable-cxx-tests") unset FEATURE_CXX_TESTS ;; "--enable-szmul-builtin") FEATURE_SZMUL_BUILTIN=on ;; "--disable-szmul-builtin") unset FEATURE_SZMUL_BUILTIN ;; "-"*) echo "unknown option: $ARG"; abort_configure ;; @@ -263,6 +267,9 @@ # check languages lang_c= lang_cpp= +if detect_cpp_compiler ; then + lang_cpp=1 +fi if detect_c_compiler ; then lang_c=1 fi @@ -335,6 +342,24 @@ dep_checked_pandoc=1 return 0 } +dependency_error_cxx() +{ + print_check_msg "$dep_checked_cxx" "checking for cxx... " + # dependency cxx + while true + do + if [ -z "$lang_cpp" ] ; then + break + fi + print_check_msg "$dep_checked_cxx" "yes\n" + dep_checked_cxx=1 + return 1 + done + + print_check_msg "$dep_checked_cxx" "no\n" + dep_checked_cxx=1 + return 0 +} dependency_error_c() { print_check_msg "$dep_checked_c" "checking for c... " @@ -612,6 +637,30 @@ else : fi +if [ -n "$FEATURE_CXX_TESTS" ]; then + # check dependency + if dependency_error_cxx ; then + # "auto" features can fail and are just disabled in this case + if [ "$FEATURE_CXX_TESTS" = "auto" ]; then + DISABLE_FEATURE_CXX_TESTS=1 + else + DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED cxx " + ERROR=1 + fi + fi + if [ -n "$DISABLE_FEATURE_CXX_TESTS" ]; then + unset FEATURE_CXX_TESTS + fi +fi +if [ -n "$FEATURE_CXX_TESTS" ]; then + : + cat >> "$TEMP_DIR/make.mk" << __EOF__ +# Enable the check-cxx target +WITH_CXX_TEST=yes +__EOF__ +else + : +fi if [ -n "$FEATURE_SZMUL_BUILTIN" ]; then if [ -n "$DISABLE_FEATURE_SZMUL_BUILTIN" ]; then unset FEATURE_SZMUL_BUILTIN @@ -748,6 +797,11 @@ else echo " coverage: off" fi +if [ -n "$FEATURE_CXX_TESTS" ]; then +echo " cxx-tests: on" +else +echo " cxx-tests: off" +fi if [ -n "$FEATURE_SZMUL_BUILTIN" ]; then echo " szmul-builtin: on" else