configure

changeset 1523
b5c32391802f
parent 1492
cc83ce484bf7
child 1525
f675a4e99fb5
--- a/configure	Fri Nov 28 15:23:40 2025 +0100
+++ b/configure	Sun Nov 30 13:29:07 2025 +0100
@@ -85,27 +85,52 @@
 printhelp()
 {
     echo "Usage: $0 [OPTIONS]..."
-    cat << __EOF__
-Installation directories:
-  --prefix=PREFIX         path prefix for architecture-independent files
-                          [$prefix]
-  --exec-prefix=EPREFIX   path prefix for architecture-dependent files
-                          [PREFIX]
-
-  --bindir=DIR            user executables [EPREFIX/bin]
-  --sbindir=DIR           system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --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]
+    echo 'Configuration:'
+if true \
+      ; then
+    :
+    if test -z "$prefix__described__"; then
+        prefix__described__=1
+        cat << '__EOF__'
+  --prefix                path prefix for architecture-independent files [/usr]
+__EOF__
+    fi
+    if test -z "$exec_prefix__described__"; then
+        exec_prefix__described__=1
+        cat << '__EOF__'
+  --exec-prefix           path prefix for architecture-dependent files [PREFIX]
+__EOF__
+    fi
+    if test -z "$libdir__described__"; then
+        libdir__described__=1
+        cat << '__EOF__'
+  --libdir                object code libraries [EPREFIX/lib]
+__EOF__
+    fi
+    if test -z "$includedir__described__"; then
+        includedir__described__=1
+        cat << '__EOF__'
+  --includedir            C header files [PREFIX/include]
+__EOF__
+    fi
+    if test -z "$DOXYGEN__described__"; then
+        DOXYGEN__described__=1
+        cat << '__EOF__'
+  --doxygen               path of the Doxygen executable
+__EOF__
+    fi
+fi
+if true \
+    && isplatform "bsd" \
+      ; then
+    :
+fi
+if true \
+      && notisplatform "bsd" \
+      ; then
+    :
+fi
+    cat << '__EOF__'
 
 Build Types:
   --debug                 add extra compile flags for debug builds
@@ -120,6 +145,7 @@
   --disable-szmul-builtin use custom implementation, instead
 
 __EOF__
+    abort_configure
 }
 
 # create temporary directory
@@ -135,30 +161,100 @@
 touch "$TEMP_DIR/options"
 touch "$TEMP_DIR/features"
 
-# define standard variables
-# 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
+# config variables
 if true \
       ; then
-    root_dir=`pwd`
-    DOXYGEN=`command -v doxygen`
+    :
+    if test -z "$prefix__initialized__"; then
+        prefix__initialized__=1
+        prefix="/usr"
+    fi
+    if test -z "$exec_prefix__initialized__"; then
+        exec_prefix__initialized__=1
+        exec_prefix=""
+    fi
+    if test -z "$libdir__initialized__"; then
+        libdir__initialized__=1
+        libdir=""
+    fi
+    if test -z "$includedir__initialized__"; then
+        includedir__initialized__=1
+        includedir=""
+    fi
+    if test -z "$VERSION__initialized__"; then
+        VERSION__initialized__=1
+        VERSION="3.2.0"
+    fi
+    if test -z "$LIBVERSION__initialized__"; then
+        LIBVERSION__initialized__=1
+        LIBVERSION="6.0.0"
+    fi
+    if test -z "$LIBVERSION_MAJOR__initialized__"; then
+        LIBVERSION_MAJOR__initialized__=1
+        LIBVERSION_MAJOR="6"
+    fi
+    if test -z "$root_dir__initialized__"; then
+        root_dir__initialized__=1
+        root_dir=`pwd`
+    fi
+    if test -z "$build_dir__initialized__"; then
+        build_dir__initialized__=1
+        build_dir="\${root_dir}/build"
+    fi
+    if test -z "$docs_dir__initialized__"; then
+        docs_dir__initialized__=1
+        docs_dir="\${root_dir}/build/docs"
+    fi
+    if test -z "$dist_dir__initialized__"; then
+        dist_dir__initialized__=1
+        dist_dir="\${root_dir}/dist"
+    fi
+    if test -z "$DOXYGEN__initialized__"; then
+        DOXYGEN__initialized__=1
+        DOXYGEN=`command -v doxygen`
+    fi
+    if test -z "$MKDIR__initialized__"; then
+        MKDIR__initialized__=1
+        MKDIR="/bin/mkdir -p"
+    fi
+    if test -z "$RMFILE__initialized__"; then
+        RMFILE__initialized__=1
+        RMFILE="/bin/rm -f"
+    fi
+    if test -z "$RMDIR__initialized__"; then
+        RMDIR__initialized__=1
+        RMDIR="/bin/rm -f -R"
+    fi
+    if test -z "$COPYFILE__initialized__"; then
+        COPYFILE__initialized__=1
+        COPYFILE="/bin/cp -f"
+    fi
+    if test -z "$COPYALL__initialized__"; then
+        COPYALL__initialized__=1
+        COPYALL="/bin/cp -f -R"
+    fi
+    if test -z "$SYMLINK__initialized__"; then
+        SYMLINK__initialized__=1
+        SYMLINK="/bin/ln -s"
+    fi
+fi
+if true \
+    && isplatform "bsd" \
+      ; then
+    :
+    if test -z "$pkgconfigdir__initialized__"; then
+        pkgconfigdir__initialized__=1
+        pkgconfigdir="\${exec_prefix}/libdata/pkgconfig"
+    fi
+fi
+if true \
+      && notisplatform "bsd" \
+      ; then
+    :
+    if test -z "$pkgconfigdir__initialized__"; then
+        pkgconfigdir__initialized__=1
+        pkgconfigdir="\${libdir}/pkgconfig"
+    fi
 fi
 
 # features
@@ -173,25 +269,14 @@
 for ARG in "$@"
 do
     case "$ARG" in
-        "--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=} ;;
-        "--runstatedir="*)    runstatedir=${ARG#--runstatedir=} ;;
-        "--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" ;;
+        "--prefix="*) prefix=${ARG#--prefix=} ;;
+        "--exec-prefix="*) exec_prefix=${ARG#--exec-prefix=} ;;
+        "--libdir="*) libdir=${ARG#--libdir=} ;;
+        "--includedir="*) includedir=${ARG#--includedir=} ;;
+        "--doxygen="*) DOXYGEN=${ARG#--doxygen=} ;;
+        "--help"*) printhelp ;;
+        "--debug") BUILD_TYPE="debug" ;;
+        "--release") BUILD_TYPE="release" ;;
         "--enable-api-docs") FEATURE_API_DOCS=on ;;
         "--disable-api-docs") unset FEATURE_API_DOCS ;;
         "--enable-coverage") FEATURE_COVERAGE=on ;;
@@ -208,6 +293,19 @@
     esac
 done
 
+# toolchain detection utilities
+. make/toolchain.sh
+
+# check languages
+lang_c=
+lang_cpp=
+if detect_cpp_compiler ; then
+    lang_cpp=1
+fi
+if detect_c_compiler ; then
+    lang_c=1
+fi
+
 
 
 # set defaults for dir variables
@@ -245,58 +343,49 @@
 : ${mandir:='${datarootdir}/man'}
 : ${localedir:='${datarootdir}/locale'}
 
-# remember the above values and compare them later
-orig_bindir="$bindir"
-orig_sbindir="$sbindir"
-orig_libdir="$libdir"
-orig_libexecdir="$libexecdir"
-orig_datarootdir="$datarootdir"
-orig_datadir="$datadir"
-orig_sysconfdir="$sysconfdir"
-orig_sharedstatedir="$sharedstatedir"
-orig_localstatedir="$localstatedir"
-orig_runstatedir="$runstatedir"
-orig_includedir="$includedir"
-orig_infodir="$infodir"
-orig_mandir="$mandir"
-orig_localedir="$localedir"
 
 # check if a config.site exists and load it
+CONFIG_SITE_OK=0
 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
+        if [ -f "$cs" ]; then
+            . "$cs"
+            echo ok
+            CONFIG_SITE_OK=1
+            break
+        else
+            echo "not found"
+        fi
     done
 elif [ -f "$prefix/share/config.site" ]; then
     printf "loading site defaults... "
     . "$prefix/share/config.site"
     echo ok
+    CONFIG_SITE_OK=1
 elif [ -f "$prefix/etc/config.site" ]; then
     printf "loading site defaults... "
     . "$prefix/etc/config.site"
     echo ok
-else
+    CONFIG_SITE_OK=1
+fi
+
+if [ $CONFIG_SITE_OK -eq 0 ]; then
     # 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
-                :
+    if [ "$libdir" = '${exec_prefix}/lib' ] ; then
+        if [ "$TOOLCHAIN_WSIZE" = "64" ] ; then
+            if [ "$OS" = "SunOS" ]; then
+                [ -d "${exec_prefix}/lib/64" ] && libdir='${exec_prefix}/lib/64'
             else
-                # if it does not, maybe a lib32 exists
-                test -d "${exec_prefix}/lib32" && libdir='${exec_prefix}/lib32'
+                [ -d "${exec_prefix}/lib64" ] && libdir='${exec_prefix}/lib64'
             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
+        elif [ "$TOOLCHAIN_WSIZE" = "32" ] ; then
+            if [ "$OS" = "SunOS" ]; then
+                [ -d "${exec_prefix}/lib/32" ] && libdir='${exec_prefix}/lib/32'
+            else
+                [ -d "${exec_prefix}/lib32" ] && libdir='${exec_prefix}/lib32'
+            fi
         fi
     fi
 fi
@@ -306,38 +395,31 @@
 cat > "$TEMP_DIR/vars.mk" << __EOF__
 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
+VERSION=$VERSION
+LIBVERSION=$LIBVERSION
+LIBVERSION_MAJOR=$LIBVERSION_MAJOR
+root_dir=$root_dir
+build_dir=$build_dir
+docs_dir=$docs_dir
+dist_dir=$dist_dir
+DOXYGEN=$DOXYGEN
+MKDIR=$MKDIR
+RMFILE=$RMFILE
+RMDIR=$RMDIR
+COPYFILE=$COPYFILE
+COPYALL=$COPYALL
+SYMLINK=$SYMLINK
+pkgconfigdir=$pkgconfigdir
 __EOF__
 
-# toolchain detection utilities
-. make/toolchain.sh
 
 #
 # DEPENDENCIES
 #
 
-# check languages
-lang_c=
-lang_cpp=
-if detect_cpp_compiler ; then
-    lang_cpp=1
-fi
-if detect_c_compiler ; then
-    lang_c=1
-fi
+
 
 # create buffer for make variables required by dependencies
 echo > "$TEMP_DIR/make.mk"
@@ -472,10 +554,6 @@
         else
             break
         fi
-        cat >> $TEMP_DIR/make.mk << __EOF__
-# Dependency: doxygen
-DOXYGEN=$DOXYGEN
-__EOF__
         print_check_msg "$dep_checked_doxygen" "yes\n"
         dep_checked_doxygen=1
         return 1
@@ -517,44 +595,6 @@
 TEMP_LDFLAGS="$LDFLAGS"
 while true
 do
-    while true
-    do
-
-        cat >> "$TEMP_DIR/make.mk" << __EOF__
-# library version
-VERSION=3.2.0
-LIBVERSION=6.0.0
-LIBVERSION_MAJOR=6
-
-# build directory structure !! do not change or override !!
-root_dir=${root_dir}
-build_dir=${root_dir}/build
-docs_dir=${root_dir}/build/docs
-dist_dir=${root_dir}/dist
-__EOF__
-        break
-    done
-    break
-done
-while true
-do
-    while true
-    do
-
-        cat >> "$TEMP_DIR/make.mk" << __EOF__
-MKDIR=/bin/mkdir -p
-RMFILE=/bin/rm -f
-RMDIR=/bin/rm -f -R
-COPYFILE=/bin/cp -f
-COPYALL=/bin/cp -f -R
-SYMLINK=/bin/ln -s
-__EOF__
-        break
-    done
-    break
-done
-while true
-do
     if notisplatform "macos"; then
         break
     fi
@@ -843,7 +883,7 @@
 
 echo "configure finished"
 echo
-echo "Toolchain"
+echo "Toolchain:"
 echo "  name:           $TOOLCHAIN_NAME"
 if [ -n "$TOOLCHAIN_CC" ]; then
     echo "  cc:             $TOOLCHAIN_CC"
@@ -858,82 +898,54 @@
     echo "  default C std:  $TOOLCHAIN_CSTD"
 fi
 echo
-echo "Build Config:"
-echo "  prefix:         $prefix"
-echo "  exec_prefix:    $exec_prefix"
-if [ "$orig_bindir" != "$bindir" ]; then
-    echo "  bindir:      $bindir"
-fi
-if [ "$orig_sbindir" != "$sbindir" ]; then
-    echo "  sbindir:     $sbindir"
-fi
-if [ "$orig_libdir" != "$libdir" ]; then
-    echo "  libdir:         $libdir"
-fi
-if [ "$orig_libexecdir" != "$libexecdir" ]; then
-    echo "  libexecdir:     $libexecdir"
-fi
-if [ "$orig_datarootdir" != "$datarootdir" ]; then
-    echo "  datarootdir:    $datarootdir"
-fi
-if [ "$orig_datadir" != "$datadir" ]; then
-    echo "  datadir:        $datadir"
-fi
-if [ "$orig_sysconfdir" != "$sysconfdir" ]; then
-    echo "  sysconfdir:     $sysconfdir"
-fi
-if [ "$orig_sharedstatedir" != "$sharedstatedir" ]; then
-    echo "  sharedstatedir: $sharedstatedir"
-fi
-if [ "$orig_localstatedir" != "$localstatedir" ]; then
-    echo "  localstatedir:  $localstatedir"
-fi
-if [ "$orig_runstatedir" != "$runstatedir" ]; then
-    echo "  runstatedir:    $runstatedir"
-fi
-if [ "$orig_includedir" != "$includedir" ]; then
-    echo "  includedir:     $includedir"
-fi
-if [ "$orig_infodir" != "$infodir" ]; then
-    echo "  infodir:        $infodir"
-fi
-if [ "$orig_mandir" != "$mandir" ]; then
-    echo "  mandir:         $mandir"
-fi
-if [ "$orig_localedir" != "$localedir" ]; then
-    echo "  localedir:      $localedir"
-fi
+echo "Config:"
+    printf '  %-16s' 'prefix:'
+    echo "$prefix"
+    printf '  %-16s' 'exec-prefix:'
+    echo "$exec_prefix"
+    printf '  %-16s' 'libdir:'
+    echo "$libdir"
+    printf '  %-16s' 'includedir:'
+    echo "$includedir"
+    printf '  %-16s' 'doxygen:'
+    echo "$DOXYGEN"
 echo
 echo "Features:"
+printf '  %-16s' 'api-docs:'
 if [ -n "$FEATURE_API_DOCS" ]; then
-echo "  api-docs: on"
+    echo 'on'
 else
-echo "  api-docs: off"
+    echo 'off'
 fi
+printf '  %-16s' 'coverage:'
 if [ -n "$FEATURE_COVERAGE" ]; then
-echo "  coverage: on"
+    echo 'on'
 else
-echo "  coverage: off"
+    echo 'off'
 fi
+printf '  %-16s' 'asan:'
 if [ -n "$FEATURE_ASAN" ]; then
-echo "  asan: on"
+    echo 'on'
 else
-echo "  asan: off"
+    echo 'off'
 fi
+printf '  %-16s' 'memrchr:'
 if [ -n "$FEATURE_MEMRCHR" ]; then
-echo "  memrchr: on"
+    echo 'on'
 else
-echo "  memrchr: off"
+    echo 'off'
 fi
+printf '  %-16s' 'cxx-tests:'
 if [ -n "$FEATURE_CXX_TESTS" ]; then
-echo "  cxx-tests: on"
+    echo 'on'
 else
-echo "  cxx-tests: off"
+    echo 'off'
 fi
+printf '  %-16s' 'szmul-builtin:'
 if [ -n "$FEATURE_SZMUL_BUILTIN" ]; then
-echo "  szmul-builtin: on"
+    echo 'on'
 else
-echo "  szmul-builtin: off"
+    echo 'off'
 fi
 echo
 

mercurial