configure

branch
docs/3.1
changeset 1140
88a9ee79c102
parent 1064
f3b04cd60776
--- a/configure	Wed Jan 22 21:02:46 2025 +0100
+++ b/configure	Thu Jan 23 01:15:52 2025 +0100
@@ -110,10 +110,8 @@
 --debug                 add extra compile flags for debug builds
 --release               add extra compile flags for release builds
 
-Options:
-  --with-docs=(all|html|api|none)
-
 Optional Features:
+  --enable-api-docs
   --enable-coverage
   --disable-cxx-tests     the check-cxx makefile target
   --disable-szmul-builtin use custom implementation, instead
@@ -158,7 +156,6 @@
       ; then
     root_dir=`pwd`
     DOXYGEN=`command -v doxygen`
-    PANDOC=`command -v pandoc`
 fi
 
 # features
@@ -190,8 +187,8 @@
         "--help"*)            printhelp; abort_configure ;;
         "--debug")            BUILD_TYPE="debug" ;;
         "--release")          BUILD_TYPE="release" ;;
-        "--with-docs="*) OPT_WITH_DOCS=${ARG#--with-docs=} ;;
-        "--with-docs")  echo "option '$ARG' needs a value:"; echo "  $ARG=(all|html|api|none)"; abort_configure ;;
+        "--enable-api-docs") FEATURE_API_DOCS=on ;;
+        "--disable-api-docs") unset FEATURE_API_DOCS ;;
         "--enable-coverage") FEATURE_COVERAGE=on ;;
         "--disable-coverage") unset FEATURE_COVERAGE ;;
         "--enable-cxx-tests") FEATURE_CXX_TESTS=on ;;
@@ -326,30 +323,6 @@
     dep_checked_coverage=1
     return 0
 }
-dependency_error_pandoc()
-{
-    print_check_msg "$dep_checked_pandoc" "checking for pandoc... "
-    # dependency pandoc
-    while true
-    do
-        if test -n "$PANDOC" > /dev/null ; then
-            :
-        else
-            break
-        fi
-        cat >> $TEMP_DIR/make.mk << __EOF__
-# Dependency: pandoc
-PANDOC=$PANDOC
-__EOF__
-        print_check_msg "$dep_checked_pandoc" "yes\n"
-        dep_checked_pandoc=1
-        return 1
-    done
-
-    print_check_msg "$dep_checked_pandoc" "no\n"
-    dep_checked_pandoc=1
-    return 0
-}
 dependency_error_cxx()
 {
     print_check_msg "$dep_checked_cxx" "checking for cxx... "
@@ -566,63 +539,6 @@
 #
 # OPTION VALUES
 #
-checkopt_with_docs_all()
-{
-    VERR=0
-    if dependency_error_pandoc ; then
-        VERR=1
-    fi
-    if dependency_error_doxygen ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    cat >> "$TEMP_DIR/make.mk" << __EOF__
-# Documentation
-WITH_DOCS_API=yes
-WITH_DOCS_HTML=yes
-__EOF__
-    return 0
-}
-checkopt_with_docs_html()
-{
-    VERR=0
-    if dependency_error_pandoc ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    cat >> "$TEMP_DIR/make.mk" << __EOF__
-# Documentation
-WITH_DOCS_HTML=yes
-__EOF__
-    return 0
-}
-checkopt_with_docs_api()
-{
-    VERR=0
-    if dependency_error_doxygen ; then
-        VERR=1
-    fi
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    cat >> "$TEMP_DIR/make.mk" << __EOF__
-# Documentation
-WITH_DOCS_API=yes
-__EOF__
-    return 0
-}
-checkopt_with_docs_none()
-{
-    VERR=0
-    if [ $VERR -ne 0 ]; then
-        return 1
-    fi
-    return 0
-}
 
 #
 # TARGETS
@@ -645,6 +561,30 @@
 fi
 
 # Features
+if [ -n "$FEATURE_API_DOCS" ]; then
+    # check dependency
+    if dependency_error_doxygen ; then
+        # "auto" features can fail and are just disabled in this case
+        if [ "$FEATURE_API_DOCS" = "auto" ]; then
+            DISABLE_FEATURE_API_DOCS=1
+        else
+            DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED doxygen "
+            ERROR=1
+        fi
+    fi
+    if [ -n "$DISABLE_FEATURE_API_DOCS" ]; then
+        unset FEATURE_API_DOCS
+    fi
+fi
+if [ -n "$FEATURE_API_DOCS" ]; then
+    :
+    cat >> "$TEMP_DIR/make.mk" << __EOF__
+# Documentation
+WITH_API_DOCS=yes
+__EOF__
+else
+    :
+fi
 if [ -n "$FEATURE_COVERAGE" ]; then
     # check dependency
     if dependency_error_coverage ; then
@@ -712,85 +652,6 @@
     TEMP_CXXFLAGS="$TEMP_CXXFLAGS -DCX_NO_SZMUL_BUILTIN"
 fi
 
-# Option: --with-docs
-if [ -z "$OPT_WITH_DOCS" ]; then
-    echo "auto-detecting option 'with-docs'"
-    SAVED_ERROR="$ERROR"
-    SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
-    ERROR=1
-    while true
-    do
-        if checkopt_with_docs_all ; then
-            echo "  with-docs: all" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        if checkopt_with_docs_html ; then
-            echo "  with-docs: html" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        if checkopt_with_docs_api ; then
-            echo "  with-docs: api" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        if checkopt_with_docs_none ; then
-            echo "  with-docs: none" >> "$TEMP_DIR/options"
-            ERROR=0
-            break
-        fi
-        break
-    done
-    if [ $ERROR -ne 0 ]; then
-        SAVED_ERROR=1
-        SAVED_DEPENDENCIES_FAILED="option 'with-docs' $SAVED_DEPENDENCIES_FAILED"
-    fi
-    ERROR="$SAVED_ERROR"
-    DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
-else
-    echo "checking option with-docs = $OPT_WITH_DOCS"
-    if false; then
-        false
-    elif [ "$OPT_WITH_DOCS" = "all" ]; then
-        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
-        if checkopt_with_docs_all ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
-        fi
-    elif [ "$OPT_WITH_DOCS" = "html" ]; then
-        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
-        if checkopt_with_docs_html ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
-        fi
-    elif [ "$OPT_WITH_DOCS" = "api" ]; then
-        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
-        if checkopt_with_docs_api ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
-        fi
-    elif [ "$OPT_WITH_DOCS" = "none" ]; then
-        echo "  with-docs: $OPT_WITH_DOCS" >> $TEMP_DIR/options
-        if checkopt_with_docs_none ; then
-            :
-        else
-            ERROR=1
-            DEPENDENCIES_FAILED="option 'with-docs' $DEPENDENCIES_FAILED"
-        fi
-    else
-        echo
-        echo "Invalid option value - usage:"
-        echo "  --with-docs=(all|html|api|none)"
-        abort_configure
-    fi
-fi
 
 if [ -n "${TEMP_CFLAGS}" ] && [ -n "$lang_c" ]; then
     echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
@@ -832,9 +693,12 @@
 echo "Build Config:"
 echo "  PREFIX:      $prefix"
 echo "  TOOLCHAIN:   $TOOLCHAIN_NAME"
-echo "Options:"
-cat "$TEMP_DIR/options"
 echo "Features:"
+if [ -n "$FEATURE_API_DOCS" ]; then
+echo "  api-docs: on"
+else
+echo "  api-docs: off"
+fi
 if [ -n "$FEATURE_COVERAGE" ]; then
 echo "  coverage: on"
 else

mercurial