update uwproj (fixes various configure bugs) default tip

Tue, 04 Nov 2025 22:28:58 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 04 Nov 2025 22:28:58 +0100
changeset 86
db21aab20169
parent 85
6960d25eb0ba

update uwproj (fixes various configure bugs)

configure file | annotate | diff | comparison | revisions
make/configure.vm file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
make/toolchain.sh file | annotate | diff | comparison | revisions
make/uwproj.xsd file | annotate | diff | comparison | revisions
--- a/configure	Wed May 07 23:59:13 2025 +0200
+++ b/configure	Tue Nov 04 22:28:58 2025 +0100
@@ -58,6 +58,7 @@
 # $PLATFORM is used for platform dependent dependency selection
 OS=`uname -s`
 OS_VERSION=`uname -r`
+ARCH=`uname -m`
 printf "detect platform... "
 if [ "$OS" = "SunOS" ]; then
     PLATFORM="solaris sunos unix svr4"
@@ -229,6 +230,28 @@
     printf "loading site defaults... "
     . "$prefix/etc/config.site"
     echo ok
+else
+    # try to detect the correct libdir on our own, except it was changed by the user
+    if test "$libdir" = '${exec_prefix}/lib'; then
+        if [ "$OS" = "SunOS" ]; then
+            test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64'
+        else
+            # check if the standard libdir even exists
+            if test -d "${exec_prefix}/lib" ; then
+                :
+            else
+                # if it does not, maybe a lib32 exists
+                test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
+            fi
+            # now check if there is a special 64bit libdir that we should use
+            for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do
+                if [ $ARCH = $i ]; then
+                    test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64'
+                    break
+                fi
+            done
+        fi
+    fi
 fi
 
 
@@ -316,12 +339,12 @@
 
 # build type
 if [ "$BUILD_TYPE" = "debug" ]; then
-    TEMP_CFLAGS="\${DEBUG_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    TEMP_CFLAGS="\${RELEASE_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 
 # add general dependency flags to flags.mk
--- a/make/configure.vm	Wed May 07 23:59:13 2025 +0200
+++ b/make/configure.vm	Tue Nov 04 22:28:58 2025 +0100
@@ -59,6 +59,7 @@
 # $PLATFORM is used for platform dependent dependency selection
 OS=`uname -s`
 OS_VERSION=`uname -r`
+ARCH=`uname -m`
 printf "detect platform... "
 if [ "$OS" = "SunOS" ]; then
     PLATFORM="solaris sunos unix svr4"
@@ -276,6 +277,28 @@
     printf "loading site defaults... "
     . "$prefix/etc/config.site"
     echo ok
+else
+    # try to detect the correct libdir on our own, except it was changed by the user
+    if test "$libdir" = '${exec_prefix}/lib'; then
+        if [ "$OS" = "SunOS" ]; then
+            test -d "${exec_prefix}/lib/amd64" && libdir='${exec_prefix}/lib/amd64'
+        else
+            # check if the standard libdir even exists
+            if test -d "${exec_prefix}/lib" ; then
+                :
+            else
+                # if it does not, maybe a lib32 exists
+                test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
+            fi
+            # now check if there is a special 64bit libdir that we should use
+            for i in x86_64 ppc64 s390x aarch64 aarch64_be arm64 ; do
+                if [ $ARCH = $i ]; then
+                    test -d "${exec_prefix}/lib64" && libdir='${exec_prefix}/lib64'
+                    break
+                fi
+            done
+        fi
+    fi
 fi
 ]]#
 ## End of unparsed content **
@@ -377,7 +400,7 @@
         fi
         #end
         #foreach( $test in $sub.tests )
-        if $test > /dev/null ; then
+        if $test > /dev/null 2>&1 ; then
             :
         else
             break
@@ -479,7 +502,6 @@
 
         #foreach( $flags in $dependency.flags )
         #if( $flags.exec )
-        $flags.value > /dev/null
         if tmp_flags=`$flags.value` ; then
             TEMP_$flags.varName="$TEMP_$flags.varName $tmp_flags"
         else
@@ -503,12 +525,12 @@
 
 # build type
 if [ "$BUILD_TYPE" = "debug" ]; then
-    TEMP_CFLAGS="\${DEBUG_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${DEBUG_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${DEBUG_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 if [ "$BUILD_TYPE" = "release" ]; then
-    TEMP_CFLAGS="\${RELEASE_CFLAGS}$TEMP_CFLAGS"
-    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS}$TEMP_CXXFLAGS"
+    TEMP_CFLAGS="\${RELEASE_CFLAGS} $TEMP_CFLAGS"
+    TEMP_CXXFLAGS="\${RELEASE_CXXFLAGS} $TEMP_CXXFLAGS"
 fi
 
 # add general dependency flags to flags.mk
--- a/make/project.xml	Wed May 07 23:59:13 2025 +0200
+++ b/make/project.xml	Tue Nov 04 22:28:58 2025 +0100
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://unixwork.de/uwproj" version="0.3">
+<project xmlns="http://unixwork.de/uwproj" version="0.4">
 	<dependency>
 		<lang>c</lang>
 	</dependency>
--- a/make/toolchain.sh	Wed May 07 23:59:13 2025 +0200
+++ b/make/toolchain.sh	Tue Nov 04 22:28:58 2025 +0100
@@ -3,12 +3,19 @@
 # toolchain detection
 #
 
+TAIL=tail
 if isplatform "bsd" && notisplatform "openbsd"; then
   C_COMPILERS="clang gcc cc"
   CPP_COMPILERS="clang++ g++ CC"
+elif isplatform "solaris"; then
+  C_COMPILERS="cc suncc gcc clang"
+  CPP_COMPILERS="CC sunCC g++ clang++"
+  if [ -f /usr/xpg4/bin/tail ]; then
+    TAIL=/usr/xpg4/bin/tail
+  fi
 else
-  C_COMPILERS="gcc clang suncc cc"
-  CPP_COMPILERS="g++ clang++ sunCC CC"
+  C_COMPILERS="gcc clang cc"
+  CPP_COMPILERS="g++ clang++ c++"
 fi
 unset TOOLCHAIN
 unset TOOLCHAIN_NAME
@@ -68,7 +75,7 @@
 #else
   std::cout << "toolchain:unknown" << std::endl;
 #endif
-  std:cout << "wsize:" << sizeof(void*)*8 << std::endl;
+  std::cout << "wsize:" << sizeof(void*)*8 << std::endl;
   return 0;
 }
 __EOF__
@@ -91,39 +98,12 @@
   fi
 }
 
-check_c_lib()
-{
-  # $1: libname
-  # $2: optional include
-  if [ -z "$TOOLCHAIN_CC" ]; then
-    return 1
-  fi
-  create_libtest_source "test.c" "$2"
-  rm -f "$TEMP_DIR/checklib"
-  $TOOLCHAIN_CC -o "$TEMP_DIR/checklib" $CFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.c" 2> /dev/null
-}
-
-check_cpp_lib()
+parse_toolchain_properties()
 {
-  # $1: libname
-  # $2: optional include
-  if [ -z "$TOOLCHAIN_CXX" ]; then
-    return 1
-  fi
-  create_libtest_source "test.cpp" "$2"
-  rm -f "$TEMP_DIR/checklib"
-  $TOOLCHAIN_CXX -o "$TEMP_DIR/checklib" $CXXFLAGS $LDFLAGS "-l$1" "$TEMP_DIR/test.cpp" 2> /dev/null
-}
-
-check_lib()
-{
-  # $1: libname
-  # $2: optional include
-  if [ -n "$TOOLCHAIN_CC" ]; then
-    check_c_lib "$1" "$2"
-  elif  [ -n "$TOOLCHAIN_CXX" ]; then
-    check_cpp_lib "$1" "$2"
-  fi
+  info_file="$1"
+  TOOLCHAIN=`grep '^toolchain:' "$info_file" | $TAIL -c +11`
+  TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+  TOOLCHAIN_WSIZE=`grep '^wsize:' "$info_file" | $TAIL -c +7`
 }
 
 detect_c_compiler()
@@ -136,10 +116,8 @@
     if check_c_compiler "$CC"; then
       TOOLCHAIN_CC=$CC
       "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-      TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-      TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
-      TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7`
-      TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13`
+      parse_toolchain_properties "$TEMP_DIR/checkcc_out"
+      TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | $TAIL -c +13`
       echo "$CC"
       return 0
     else
@@ -152,10 +130,8 @@
       if check_c_compiler "$COMP"; then
         TOOLCHAIN_CC=$COMP
         "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-        TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-        TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
-        TOOLCHAIN_WSIZE=`grep '^wsize:' "$TEMP_DIR/checkcc_out" | tail -c +7`
-        TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | tail -c +13`
+        parse_toolchain_properties "$TEMP_DIR/checkcc_out"
+        TOOLCHAIN_CSTD=`grep '^stdcversion:' "$TEMP_DIR/checkcc_out" | $TAIL -c +13`
         echo "$COMP"
         return 0
       fi
@@ -176,8 +152,7 @@
     if check_cpp_compiler "$CXX"; then
       TOOLCHAIN_CXX=$CXX
       "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-      TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-      TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+      parse_toolchain_properties "$TEMP_DIR/checkcc_out"
       echo "$CXX"
       return 0
     else
@@ -190,8 +165,7 @@
       if check_cpp_compiler "$COMP"; then
         TOOLCHAIN_CXX=$COMP
         "$TEMP_DIR/checkcc" > "$TEMP_DIR/checkcc_out"
-        TOOLCHAIN=`grep '^toolchain:' "$TEMP_DIR/checkcc_out" | tail -c +11`
-        TOOLCHAIN_NAME=`echo "$TOOLCHAIN" | cut -f1 -d' ' -`
+        parse_toolchain_properties "$TEMP_DIR/checkcc_out"
         echo "$COMP"
         return 0
       fi
--- a/make/uwproj.xsd	Wed May 07 23:59:13 2025 +0200
+++ b/make/uwproj.xsd	Tue Nov 04 22:28:58 2025 +0100
@@ -3,7 +3,7 @@
            xmlns="http://unixwork.de/uwproj"
            targetNamespace="http://unixwork.de/uwproj"
            elementFormDefault="qualified"
-           version="0.3"
+           version="0.4"
 >
     <xs:element name="project" type="ProjectType"/>
 

mercurial