update uwproj (adds support for config.site)

Tue, 10 Oct 2023 20:34:51 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 10 Oct 2023 20:34:51 +0200
changeset 74
ed9a5ffd1f13
parent 73
b383b1b61cbf
child 75
ba4bc497c6a7

update uwproj (adds support for config.site)

configure file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
src/Makefile file | annotate | diff | comparison | revisions
--- a/configure	Sun Oct 01 14:25:26 2023 +0200
+++ b/configure	Tue Oct 10 20:34:51 2023 +0200
@@ -14,19 +14,23 @@
 touch "$TEMP_DIR/features"
 
 # define standard variables
-PREFIX=/usr
-EPREFIX=
-BINDIR=
-SBINDIR=
-LIBDIR=
-LIBEXECDIR=
-DATADIR=
-SYSCONFDIR=
-SHAREDSTATEDIR=
-LOCALSTATEDIR=
-INCLUDEDIR=
-INFODIR=
-MANDIR=
+# also define standard prefix (this is where we will search for config.site)
+prefix=/usr
+exec_prefix=
+bindir=
+sbindir=
+libdir=
+libexecdir=
+datarootdir=
+datadir=
+sysconfdir=
+sharedstatedir=
+localstatedir=
+runstatedir=
+includedir=
+infodir=
+localedir=
+mandir=
 
 # custom variables
 
@@ -56,12 +60,14 @@
   --sysconfdir=DIR        system configuration files [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       run-time variable data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
   --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
 
 __EOF__
 }
@@ -73,19 +79,21 @@
 for ARG in "$@"
 do
     case "$ARG" in
-        "--prefix="*)         PREFIX=${ARG#--prefix=} ;;
-        "--exec-prefix="*)    EPREFIX=${ARG#--exec-prefix=} ;;
-        "--bindir="*)         BINDIR=${ARG#----bindir=} ;;
-        "--sbindir="*)        SBINDIR=${ARG#--sbindir=} ;;
-        "--libdir="*)         LIBDIR=${ARG#--libdir=} ;;
-        "--libexecdir="*)     LIBEXECDIR=${ARG#--libexecdir=} ;;
-        "--datadir="*)        DATADIR=${ARG#--datadir=} ;;
-        "--sysconfdir="*)     SYSCONFDIR=${ARG#--sysconfdir=} ;;
-        "--sharedstatedir="*) SHAREDSTATEDIR=${ARG#--sharedstatedir=} ;;
-        "--localstatedir="*)  LOCALSTATEDIR=${ARG#--localstatedir=} ;;
-        "--includedir="*)     INCLUDEDIR=${ARG#--includedir=} ;;
-        "--infodir="*)        INFODIR=${ARG#--infodir=} ;;
-        "--mandir"*)          MANDIR=${ARG#--mandir} ;;
+        "--prefix="*)         prefix=${ARG#--prefix=} ;;
+        "--exec-prefix="*)    exec_prefix=${ARG#--exec-prefix=} ;;
+        "--bindir="*)         bindir=${ARG#----bindir=} ;;
+        "--sbindir="*)        sbindir=${ARG#--sbindir=} ;;
+        "--libdir="*)         libdir=${ARG#--libdir=} ;;
+        "--libexecdir="*)     libexecdir=${ARG#--libexecdir=} ;;
+        "--datarootdir="*)    datarootdir=${ARG#--datarootdir=} ;;
+        "--datadir="*)        datadir=${ARG#--datadir=} ;;
+        "--sysconfdir="*)     sysconfdir=${ARG#--sysconfdir=} ;;
+        "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
+        "--localstatedir="*)  localstatedir=${ARG#--localstatedir=} ;;
+        "--includedir="*)     includedir=${ARG#--includedir=} ;;
+        "--infodir="*)        infodir=${ARG#--infodir=} ;;
+        "--mandir"*)          mandir=${ARG#--mandir} ;;
+        "--localedir"*)       localedir=${ARG#--localedir} ;;
         "--help"*) printhelp; abort_configure ;;
         "--debug")           BUILD_TYPE="debug" ;;
         "--release")         BUILD_TYPE="release" ;;
@@ -94,19 +102,41 @@
 done
 
 
-# set dir variables
-: ${EPREFIX:="$PREFIX"}
-: ${BINDIR:="$EPREFIX/bin"}
-: ${SBINDIR:="$EPREFIX/sbin"}
-: ${LIBDIR:="$EPREFIX/lib"}
-: ${LIBEXECDIR:="$EPREFIX/libexec"}
-: ${DATADIR:="$PREFIX/share"}
-: ${SYSCONFDIR:="$PREFIX/etc"}
-: ${SHAREDSTATEDIR:="$PREFIX/com"}
-: ${LOCALSTATEDIR:="$PREFIX/var"}
-: ${INCLUDEDIR:="$PREFIX/include"}
-: ${INFODIR:="$PREFIX/info"}
-: ${MANDIR:="$PREFIX/man"}
+
+# set defaults for dir variables
+: ${exec_prefix:="$prefix"}
+: ${bindir:='${exec_prefix}/bin'}
+: ${sbindir:='${exec_prefix}/sbin'}
+: ${libdir:='${exec_prefix}/lib'}
+: ${libexecdir:='${exec_prefix}/libexec'}
+: ${datarootdir:='${prefix}/share'}
+: ${datadir:='${datarootdir}'}
+: ${sysconfdir:='${prefix}/etc'}
+: ${sharedstatedir:='${prefix}/com'}
+: ${localstatedir:='${prefix}/var'}
+: ${runstatedir:='${localstatedir}/run'}
+: ${includedir:='${prefix}/include'}
+: ${infodir:='${datarootdir}/info'}
+: ${mandir:='${datarootdir}/man'}
+: ${localedir:='${datarootdir}/locale'}
+
+# check if a config.site exists and load it
+if [ -n "$CONFIG_SITE" ]; then
+    # CONFIG_SITE may contain space separated file names
+    for cs in $CONFIG_SITE; do
+        printf "loading defaults from $cs... "
+        . "$cs"
+        echo ok
+    done
+elif [ -f "$prefix/share/config.site" ]; then
+    printf "loading site defaults... "
+    . "$prefix/share/config.site"
+    echo ok
+elif [ -f "$prefix/etc/config.site" ]; then
+    printf "loading site defaults... "
+    . "$prefix/etc/config.site"
+    echo ok
+fi
 
 # Test for availability of pkg-config
 PKG_CONFIG=`command -v pkg-config`
@@ -161,22 +191,23 @@
 
 # generate vars.mk
 cat > "$TEMP_DIR/vars.mk" << __EOF__
-PREFIX=$PREFIX
-EPREFIX=$EPREFIX
-BINDIR=$BINDIR
-SBINDIR=$SBINDIR
-LIBDIR=$LIBDIR
-LIBEXECDIR=$LIBEXECDIR
-DATADIR=$DATADIR
-SYSCONFDIR=$SYSCONFDIR
-SHAREDSTATEDIR=$SHAREDSTATEDIR
-LOCALSTATEDIR=$LOCALSTATEDIR
-INCLUDEDIR=$INCLUDEDIR
-INFODIR=$INFODIR
-MANDIR=$MANDIR
+prefix="$prefix"
+exec_prefix="$exec_prefix"
+bindir="$bindir"
+sbindir="$sbindir"
+libdir="$libdir"
+libexecdir="$libexecdir"
+datarootdir="$datarootdir"
+datadir="$datadir"
+sysconfdir="$sysconfdir"
+sharedstatedir="$sharedstatedir"
+localstatedir="$localstatedir"
+runstatedir="$runstatedir"
+includedir="$includedir"
+infodir="$infodir"
+mandir="$mandir"
+localedir="$localedir"
 __EOF__
-sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
-
 
 # toolchain detection utilities
 . make/toolchain.sh
@@ -237,10 +268,10 @@
 
 # add general dependency flags to flags.mk
 echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -256,7 +287,7 @@
 #
 
 echo >> "$TEMP_DIR/flags.mk"
-# Target: default
+echo "configuring target: default"
 echo "# flags for target default" >> "$TEMP_DIR/flags.mk"
 TEMP_CFLAGS=
 TEMP_CXXFLAGS=
@@ -266,19 +297,27 @@
 # Features
 
 
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo 'CFLAGS += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo 'CXXFLAGS += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
     echo "LDFLAGS += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
@@ -296,8 +335,8 @@
 echo "configure finished"
 echo
 echo "Build Config:"
-echo "  PREFIX:    $PREFIX"
-echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
+echo "  PREFIX:      $prefix"
+echo "  TOOLCHAIN:   $TOOLCHAIN_NAME"
 echo
 
 # generate the config.mk file
--- a/make/configure.vm	Sun Oct 01 14:25:26 2023 +0200
+++ b/make/configure.vm	Tue Oct 10 20:34:51 2023 +0200
@@ -14,33 +14,37 @@
 touch "$TEMP_DIR/features"
 
 # define standard variables
-PREFIX=/usr
-EPREFIX=
-BINDIR=
-SBINDIR=
-LIBDIR=
-LIBEXECDIR=
-DATADIR=
-SYSCONFDIR=
-SHAREDSTATEDIR=
-LOCALSTATEDIR=
-INCLUDEDIR=
-INFODIR=
-MANDIR=
+# also define standard prefix (this is where we will search for config.site)
+prefix=/usr
+exec_prefix=
+bindir=
+sbindir=
+libdir=
+libexecdir=
+datarootdir=
+datadir=
+sysconfdir=
+sharedstatedir=
+localstatedir=
+runstatedir=
+includedir=
+infodir=
+localedir=
+mandir=
 
 # custom variables
 #foreach( $var in $vars )
 #if( $var.exec )
 ${var.varName}=`${var.value}`
 #else
-${var.varName}=${var.value}
+${var.varName}="${var.value}"
 #end
 #end
 
 # features
 #foreach( $feature in $features )
-#if( ${feature.isDefault()} )
-${feature.getVarName()}=auto
+#if( ${feature.auto} )
+${feature.varName}=auto
 #end
 #end
 
@@ -68,26 +72,28 @@
   --sysconfdir=DIR        system configuration files [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       run-time variable data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
   --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
 
 #if( $options.size() > 0 )
 Options:
   --debug                 add extra compile flags for debug builds
   --release               add extra compile flags for release builds
 #foreach( $opt in $options )
-  --${opt.getArgument()}=${opt.getValuesString()}
+  --${opt.argument}=${opt.valuesString}
 #end
 
 #end
 #if( $features.size() > 0 )
 Optional Features:
 #foreach( $feature in $features )
-#if( $feature.default )
+#if( $feature.auto )
   --disable-${feature.arg}
 #else
   --enable-${feature.arg}
@@ -106,28 +112,30 @@
 for ARG in "$@"
 do
     case "$ARG" in
-        "--prefix="*)         PREFIX=${D}{ARG#--prefix=} ;;
-        "--exec-prefix="*)    EPREFIX=${D}{ARG#--exec-prefix=} ;;
-        "--bindir="*)         BINDIR=${D}{ARG#----bindir=} ;;
-        "--sbindir="*)        SBINDIR=${D}{ARG#--sbindir=} ;;
-        "--libdir="*)         LIBDIR=${D}{ARG#--libdir=} ;;
-        "--libexecdir="*)     LIBEXECDIR=${D}{ARG#--libexecdir=} ;;
-        "--datadir="*)        DATADIR=${D}{ARG#--datadir=} ;;
-        "--sysconfdir="*)     SYSCONFDIR=${D}{ARG#--sysconfdir=} ;;
-        "--sharedstatedir="*) SHAREDSTATEDIR=${D}{ARG#--sharedstatedir=} ;;
-        "--localstatedir="*)  LOCALSTATEDIR=${D}{ARG#--localstatedir=} ;;
-        "--includedir="*)     INCLUDEDIR=${D}{ARG#--includedir=} ;;
-        "--infodir="*)        INFODIR=${D}{ARG#--infodir=} ;;
-        "--mandir"*)          MANDIR=${D}{ARG#--mandir} ;;
+        "--prefix="*)         prefix=${D}{ARG#--prefix=} ;;
+        "--exec-prefix="*)    exec_prefix=${D}{ARG#--exec-prefix=} ;;
+        "--bindir="*)         bindir=${D}{ARG#----bindir=} ;;
+        "--sbindir="*)        sbindir=${D}{ARG#--sbindir=} ;;
+        "--libdir="*)         libdir=${D}{ARG#--libdir=} ;;
+        "--libexecdir="*)     libexecdir=${D}{ARG#--libexecdir=} ;;
+        "--datarootdir="*)    datarootdir=${D}{ARG#--datarootdir=} ;;
+        "--datadir="*)        datadir=${D}{ARG#--datadir=} ;;
+        "--sysconfdir="*)     sysconfdir=${D}{ARG#--sysconfdir=} ;;
+        "--sharedstatedir="*) sharedstatedir=${D}{ARG#--sharedstatedir=} ;;
+        "--localstatedir="*)  localstatedir=${D}{ARG#--localstatedir=} ;;
+        "--includedir="*)     includedir=${D}{ARG#--includedir=} ;;
+        "--infodir="*)        infodir=${D}{ARG#--infodir=} ;;
+        "--mandir"*)          mandir=${D}{ARG#--mandir} ;;
+        "--localedir"*)       localedir=${D}{ARG#--localedir} ;;
         "--help"*) printhelp; abort_configure ;;
         "--debug")           BUILD_TYPE="debug" ;;
         "--release")         BUILD_TYPE="release" ;;
     #foreach( $opt in $options )
-        "--${opt.getArgument()}="*) ${opt.getVarName()}=${D}{ARG#--${opt.getArgument()}=} ;;
+        "--${opt.argument}="*) ${opt.varName}=${D}{ARG#--${opt.argument}=} ;;
     #end
     #foreach( $feature in $features )
-        "--enable-${feature.arg}") ${feature.getVarName()}=on ;;
-        "--disable-${feature.arg}") unset ${feature.getVarName()} ;;
+        "--enable-${feature.arg}") ${feature.varName}=on ;;
+        "--disable-${feature.arg}") unset ${feature.varName} ;;
     #end
         "-"*) echo "unknown option: $ARG"; abort_configure ;;
     esac
@@ -135,19 +143,41 @@
 
 ## Begin unparsed content. **
 #[[
-# set dir variables
-: ${EPREFIX:="$PREFIX"}
-: ${BINDIR:="$EPREFIX/bin"}
-: ${SBINDIR:="$EPREFIX/sbin"}
-: ${LIBDIR:="$EPREFIX/lib"}
-: ${LIBEXECDIR:="$EPREFIX/libexec"}
-: ${DATADIR:="$PREFIX/share"}
-: ${SYSCONFDIR:="$PREFIX/etc"}
-: ${SHAREDSTATEDIR:="$PREFIX/com"}
-: ${LOCALSTATEDIR:="$PREFIX/var"}
-: ${INCLUDEDIR:="$PREFIX/include"}
-: ${INFODIR:="$PREFIX/info"}
-: ${MANDIR:="$PREFIX/man"}
+
+# set defaults for dir variables
+: ${exec_prefix:="$prefix"}
+: ${bindir:='${exec_prefix}/bin'}
+: ${sbindir:='${exec_prefix}/sbin'}
+: ${libdir:='${exec_prefix}/lib'}
+: ${libexecdir:='${exec_prefix}/libexec'}
+: ${datarootdir:='${prefix}/share'}
+: ${datadir:='${datarootdir}'}
+: ${sysconfdir:='${prefix}/etc'}
+: ${sharedstatedir:='${prefix}/com'}
+: ${localstatedir:='${prefix}/var'}
+: ${runstatedir:='${localstatedir}/run'}
+: ${includedir:='${prefix}/include'}
+: ${infodir:='${datarootdir}/info'}
+: ${mandir:='${datarootdir}/man'}
+: ${localedir:='${datarootdir}/locale'}
+
+# check if a config.site exists and load it
+if [ -n "$CONFIG_SITE" ]; then
+    # CONFIG_SITE may contain space separated file names
+    for cs in $CONFIG_SITE; do
+        printf "loading defaults from $cs... "
+        . "$cs"
+        echo ok
+    done
+elif [ -f "$prefix/share/config.site" ]; then
+    printf "loading site defaults... "
+    . "$prefix/share/config.site"
+    echo ok
+elif [ -f "$prefix/etc/config.site" ]; then
+    printf "loading site defaults... "
+    . "$prefix/etc/config.site"
+    echo ok
+fi
 
 # Test for availability of pkg-config
 PKG_CONFIG=`command -v pkg-config`
@@ -203,25 +233,26 @@
 
 # generate vars.mk
 cat > "$TEMP_DIR/vars.mk" << __EOF__
-PREFIX=$PREFIX
-EPREFIX=$EPREFIX
-BINDIR=$BINDIR
-SBINDIR=$SBINDIR
-LIBDIR=$LIBDIR
-LIBEXECDIR=$LIBEXECDIR
-DATADIR=$DATADIR
-SYSCONFDIR=$SYSCONFDIR
-SHAREDSTATEDIR=$SHAREDSTATEDIR
-LOCALSTATEDIR=$LOCALSTATEDIR
-INCLUDEDIR=$INCLUDEDIR
-INFODIR=$INFODIR
-MANDIR=$MANDIR
+prefix="$prefix"
+exec_prefix="$exec_prefix"
+bindir="$bindir"
+sbindir="$sbindir"
+libdir="$libdir"
+libexecdir="$libexecdir"
+datarootdir="$datarootdir"
+datadir="$datadir"
+sysconfdir="$sysconfdir"
+sharedstatedir="$sharedstatedir"
+localstatedir="$localstatedir"
+runstatedir="$runstatedir"
+includedir="$includedir"
+infodir="$infodir"
+mandir="$mandir"
+localedir="$localedir"
 #foreach( $var in $vars )
-${var.varName}=$${var.varName}
+${var.varName}="${D}${var.varName}"
 #end
 __EOF__
-sort -u -o "$TEMP_DIR/vars.mk" "$TEMP_DIR/vars.mk"
-
 
 # toolchain detection utilities
 . make/toolchain.sh
@@ -256,11 +287,11 @@
 }
 
 #foreach( $dependency in $namedDependencies )
-dependency_error_${dependency.name}()
+dependency_error_${dependency.id}()
 {
     printf "checking for ${dependency.name}... "
-    #foreach( $sub in $dependency.getSubdependencies() )
-    # dependency $sub.getFullName()
+    #foreach( $sub in $dependency.subdependencies )
+    # dependency $sub.fullName
     while true
     do
         #if( $sub.platform )
@@ -268,7 +299,7 @@
             break
         fi
         #end
-        #foreach( $np in $sub.getNotList() )
+        #foreach( $np in $sub.notList )
         if isplatform "${np}"; then
             break
         fi
@@ -346,7 +377,7 @@
         break
     fi
     #end
-    #foreach( $np in $dependency.getNotList() )
+    #foreach( $np in $dependency.notList )
     if isplatform "${np}"; then
         break
     fi
@@ -404,10 +435,10 @@
 
 # add general dependency flags to flags.mk
 echo "# general flags" >> "$TEMP_DIR/flags.mk"
-if [ -n "${TEMP_CFLAGS}" ]; then
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
     echo "CFLAGS += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
     echo "CXXFLAGS += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
@@ -452,10 +483,10 @@
 #foreach( $target in $targets )
 echo >> "$TEMP_DIR/flags.mk"
 #if ( $target.name )
-# Target: $target.name
+echo "configuring target: $target.name"
 echo "# flags for target $target.name" >> "$TEMP_DIR/flags.mk"
 #else
-# Target
+echo "configuring global target"
 echo "# flags for unnamed target" >> "$TEMP_DIR/flags.mk"
 #end
 TEMP_CFLAGS=
@@ -471,28 +502,29 @@
 
 # Features
 #foreach( $feature in $target.features )
-if [ -n "$${feature.getVarName()}" ]; then
+if [ -n "${D}${feature.varName}" ]; then
 #foreach( $dependency in $feature.dependencies )
     # check dependency
     if dependency_error_$dependency ; then
         # "auto" features can fail and are just disabled in this case
-        if [ "$${feature.getVarName()}" = "auto" ]; then
-            DISABLE_${feature.getVarName()}=1
+        if [ "${D}${feature.varName}" = "auto" ]; then
+            DISABLE_${feature.varName}=1
         else
             DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED ${dependency} "
             ERROR=1
         fi
     fi
 #end
-    if [ -n "$DISABLE_${feature.getVarName()}" ]; then
-        unset ${feature.getVarName()}
+    if [ -n "$DISABLE_${feature.varName}" ]; then
+        unset ${feature.varName}
     fi
 fi
 #end
 
 #foreach( $opt in $target.options )
 # Option: --${opt.argument}
-if [ -z ${D}${opt.getVarName()} ]; then
+if [ -z "${D}${opt.varName}" ]; then
+    echo "auto-detecting option '${opt.argument}'"
     SAVED_ERROR="$ERROR"
     SAVED_DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED"
     ERROR=1
@@ -515,41 +547,52 @@
     done
     if [ $ERROR -ne 0 ]; then
         SAVED_ERROR=1
+        SAVED_DEPENDENCIES_FAILED="option '${opt.argument}' $SAVED_DEPENDENCIES_FAILED"
     fi
     ERROR="$SAVED_ERROR"
     DEPENDENCIES_FAILED="$SAVED_DEPENDENCIES_FAILED"
 else
+    echo "checking option ${opt.argument} = ${D}${opt.varName}"
     if false; then
         false
     #foreach( $optval in $opt.values )
-    elif [ "${D}${opt.getVarName()}" = "${optval.value}" ]; then
-        echo "  ${opt.argument}: ${D}${opt.getVarName()}" >> $TEMP_DIR/options
+    elif [ "${D}${opt.varName}" = "${optval.value}" ]; then
+        echo "  ${opt.argument}: ${D}${opt.varName}" >> $TEMP_DIR/options
         if $optval.func ; then
             :
         else
             ERROR=1
+            DEPENDENCIES_FAILED="option '${opt.argument}' $DEPENDENCIES_FAILED"
         fi
     #end
     fi
 fi
 #end
 
-if [ -n "${TEMP_CFLAGS}" ]; then
-    echo "${target.getCFlags()}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
+if [ -n "${TEMP_CFLAGS}" -a -n "$lang_c" ]; then
+    echo "${target.cFlags}  += $TEMP_CFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
-if [ -n "${TEMP_CXXFLAGS}" ]; then
-    echo "${target.getCXXFlags()}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
+if [ -n "${TEMP_CXXFLAGS}" -a -n "$lang_cpp" ]; then
+    echo "${target.cxxFlags}  += $TEMP_CXXFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 if [ "$BUILD_TYPE" = "debug" ]; then
-    echo '${target.getCFlags()} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo '${target.getCXXFlags()} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo '${target.cFlags} += ${DEBUG_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo '${target.cxxFlags} += ${DEBUG_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    echo '${target.getCFlags()} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
-    echo '${target.getCXXFlags()} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    if [ -n "$lang_c" ]; then
+        echo '${target.cFlags} += ${RELEASE_CC_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
+    if [ -n "$lang_cpp" ]; then
+        echo '${target.cxxFlags} += ${RELEASE_CXX_FLAGS}' >> "$TEMP_DIR/flags.mk"
+    fi
 fi
 if [ -n "${TEMP_LDFLAGS}" ]; then
-    echo "${target.getLDFlags()} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
+    echo "${target.ldFlags} += $TEMP_LDFLAGS" >> "$TEMP_DIR/flags.mk"
 fi
 
 #end
@@ -565,8 +608,8 @@
 echo "configure finished"
 echo
 echo "Build Config:"
-echo "  PREFIX:    $PREFIX"
-echo "  TOOLCHAIN: $TOOLCHAIN_NAME"
+echo "  PREFIX:      $prefix"
+echo "  TOOLCHAIN:   $TOOLCHAIN_NAME"
 #if ( $options.size() > 0 )
 echo "Options:"
 cat "$TEMP_DIR/options"
@@ -574,7 +617,7 @@
 #if ( $features.size() > 0 )
 echo "Features:"
 #foreach( $feature in $features )
-if [ -n "$${feature.getVarName()}" ]; then
+if [ -n "${D}${feature.varName}" ]; then
 echo "  $feature.name: on"
 else
 echo "  $feature.name: off"
--- a/src/Makefile	Sun Oct 01 14:25:26 2023 +0200
+++ b/src/Makefile	Tue Oct 10 20:34:51 2023 +0200
@@ -32,8 +32,8 @@
 	echo "Build successful."
 
 install: $(BUILD_DIR)/cline FORCE
-	cd .. && cp "build/cline" "$(BINDIR)/cline"
-	echo "Installed to: $(BINDIR)/cline"
+	cd .. && cp "build/cline" "$(bindir)/cline"
+	echo "Installed to: $(bindir)/cline"
 
 $(BUILD_DIR)/cline: $(OBJ)
 	echo "Linking executable..."

mercurial