configure

changeset 285
dc13730ff1ec
parent 284
22ff758b9fab
--- a/configure	Wed Oct 29 22:59:23 2025 +0100
+++ b/configure	Thu Nov 13 22:09:53 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"
@@ -176,6 +177,7 @@
         "--sysconfdir="*)     sysconfdir=${ARG#--sysconfdir=} ;;
         "--sharedstatedir="*) sharedstatedir=${ARG#--sharedstatedir=} ;;
         "--localstatedir="*)  localstatedir=${ARG#--localstatedir=} ;;
+        "--runstatedir="*)    runstatedir=${ARG#--runstatedir=} ;;
         "--includedir="*)     includedir=${ARG#--includedir=} ;;
         "--infodir="*)        infodir=${ARG#--infodir=} ;;
         "--mandir"*)          mandir=${ARG#--mandir} ;;
@@ -201,10 +203,28 @@
 : ${libexecdir:='${exec_prefix}/libexec'}
 : ${datarootdir:='${prefix}/share'}
 : ${datadir:='${datarootdir}'}
-: ${sysconfdir:='${prefix}/etc'}
 : ${sharedstatedir:='${prefix}/com'}
-: ${localstatedir:='${prefix}/var'}
-: ${runstatedir:='${localstatedir}/run'}
+if [ -z "$sysconfdir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        sysconfdir='/etc'
+    else
+        sysconfdir='${prefix}/etc'
+    fi
+fi
+if [ -z "$localstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        localstatedir='/var'
+    else
+        localstatedir='${prefix}/var'
+    fi
+fi
+if [ -z "$runstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        runstatedir='/var/run'
+    else
+        runstatedir='${prefix}/var'
+    fi
+fi
 : ${includedir:='${prefix}/include'}
 : ${infodir:='${datarootdir}/info'}
 : ${mandir:='${datarootdir}/man'}
@@ -242,6 +262,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
 
 
@@ -379,17 +421,17 @@
     # dependency toolkit
     while true
     do
-        if test -n "$TOOLKIT_HOME" > /dev/null ; then
+        if test -n "$TOOLKIT_HOME" > /dev/null 2>&1 ; then
             :
         else
             break
         fi
-        if test -f "$TOOLKIT_HOME/lib/libuitk.a" > /dev/null ; then
+        if test -f "$TOOLKIT_HOME/lib/libuitk.a" > /dev/null 2>&1 ; then
             :
         else
             break
         fi
-        if test -f "$TOOLKIT_HOME/include/ui/ui.h" > /dev/null ; then
+        if test -f "$TOOLKIT_HOME/include/ui/ui.h" > /dev/null 2>&1 ; then
             :
         else
             break
@@ -531,12 +573,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

mercurial