add special treatment of sysconfdir, localstatedir, and runstatedir even when no config.site exists

Thu, 13 Nov 2025 18:24:22 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 13 Nov 2025 18:24:22 +0100
changeset 159
b0344d89ade6
parent 158
10c95fc02326
child 160
3644d06f60d4

add special treatment of sysconfdir, localstatedir, and runstatedir even when no config.site exists

src/main/resources/make/configure.vm file | annotate | diff | comparison | revisions
test/configure file | annotate | diff | comparison | revisions
test/configure2 file | annotate | diff | comparison | revisions
test/make/configure.vm file | annotate | diff | comparison | revisions
test/make/project.xml file | annotate | diff | comparison | revisions
test/make/project2.xml file | annotate | diff | comparison | revisions
--- a/src/main/resources/make/configure.vm	Wed Nov 12 20:26:42 2025 +0100
+++ b/src/main/resources/make/configure.vm	Thu Nov 13 18:24:22 2025 +0100
@@ -236,10 +236,34 @@
 : ${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'
+    elif [ "$prefix" = '/opt' ]; then
+        sysconfdir='/etc/opt'
+    else
+        sysconfdir='${prefix}/etc'
+    fi
+fi
+if [ -z "$localstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        localstatedir='/var'
+    elif [ "$prefix" = '/opt' ]; then
+        localstatedir='/var/opt'
+    else
+        localstatedir='${prefix}/var'
+    fi
+fi
+if [ -z "$runstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        runstatedir='/var/run'
+    elif [ "$prefix" = '/opt' ]; then
+        runstatedir='/var/run/opt'
+    else
+        runstatedir='${prefix}/var'
+    fi
+fi
 : ${includedir:='${prefix}/include'}
 : ${infodir:='${datarootdir}/info'}
 : ${mandir:='${datarootdir}/man'}
--- a/test/configure	Wed Nov 12 20:26:42 2025 +0100
+++ b/test/configure	Thu Nov 13 18:24:22 2025 +0100
@@ -153,17 +153,16 @@
 if true \
       && notisplatform "mingw" \
       ; then
-    prefix="`pwd`/work"
+    PWD="pwd"
 fi
 if true \
     && isplatform "mingw" \
       ; then
-    prefix="`pwd -W`/work"
+    PWD="pwd -W"
 fi
 if true \
       ; then
     HOST=`uname -n`
-    install_dir="$prefix"
 fi
 
 # features
@@ -210,10 +209,34 @@
 : ${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'
+    elif [ "$prefix" = '/opt' ]; then
+        sysconfdir='/etc/opt'
+    else
+        sysconfdir='${prefix}/etc'
+    fi
+fi
+if [ -z "$localstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        localstatedir='/var'
+    elif [ "$prefix" = '/opt' ]; then
+        localstatedir='/var/opt'
+    else
+        localstatedir='${prefix}/var'
+    fi
+fi
+if [ -z "$runstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        runstatedir='/var/run'
+    elif [ "$prefix" = '/opt' ]; then
+        runstatedir='/var/run/opt'
+    else
+        runstatedir='${prefix}/var'
+    fi
+fi
 : ${includedir:='${prefix}/include'}
 : ${infodir:='${datarootdir}/info'}
 : ${mandir:='${datarootdir}/man'}
--- a/test/configure2	Wed Nov 12 20:26:42 2025 +0100
+++ b/test/configure2	Thu Nov 13 18:24:22 2025 +0100
@@ -207,10 +207,34 @@
 : ${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'
+    elif [ "$prefix" = '/opt' ]; then
+        sysconfdir='/etc/opt'
+    else
+        sysconfdir='${prefix}/etc'
+    fi
+fi
+if [ -z "$localstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        localstatedir='/var'
+    elif [ "$prefix" = '/opt' ]; then
+        localstatedir='/var/opt'
+    else
+        localstatedir='${prefix}/var'
+    fi
+fi
+if [ -z "$runstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        runstatedir='/var/run'
+    elif [ "$prefix" = '/opt' ]; then
+        runstatedir='/var/run/opt'
+    else
+        runstatedir='${prefix}/var'
+    fi
+fi
 : ${includedir:='${prefix}/include'}
 : ${infodir:='${datarootdir}/info'}
 : ${mandir:='${datarootdir}/man'}
--- a/test/make/configure.vm	Wed Nov 12 20:26:42 2025 +0100
+++ b/test/make/configure.vm	Thu Nov 13 18:24:22 2025 +0100
@@ -236,10 +236,34 @@
 : ${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'
+    elif [ "$prefix" = '/opt' ]; then
+        sysconfdir='/etc/opt'
+    else
+        sysconfdir='${prefix}/etc'
+    fi
+fi
+if [ -z "$localstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        localstatedir='/var'
+    elif [ "$prefix" = '/opt' ]; then
+        localstatedir='/var/opt'
+    else
+        localstatedir='${prefix}/var'
+    fi
+fi
+if [ -z "$runstatedir" ]; then
+    if [ "$prefix" = '/usr' ]; then
+        runstatedir='/var/run'
+    elif [ "$prefix" = '/opt' ]; then
+        runstatedir='/var/run/opt'
+    else
+        runstatedir='${prefix}/var'
+    fi
+fi
 : ${includedir:='${prefix}/include'}
 : ${infodir:='${datarootdir}/info'}
 : ${mandir:='${datarootdir}/man'}
--- a/test/make/project.xml	Wed Nov 12 20:26:42 2025 +0100
+++ b/test/make/project.xml	Thu Nov 13 18:24:22 2025 +0100
@@ -1,15 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project version="0.3" xmlns="http://unixwork.de/uwproj">
+<project version="0.4" xmlns="http://unixwork.de/uwproj">
 	<!-- makefile config -->
 	<config not="mingw">
-		<var name="prefix">`pwd`/work</var>
+		<var name="PWD">pwd</var>
 	</config>
 	<config platform="mingw">
-		<var name="prefix">`pwd -W`/work</var>
+		<var name="PWD">pwd -W</var>
 	</config>
 	<config>
 		<var name="HOST" exec="true">uname -n</var>
-		<var name="install_dir">$prefix</var>
 	</config>
 	
 	<dependency>
--- a/test/make/project2.xml	Wed Nov 12 20:26:42 2025 +0100
+++ b/test/make/project2.xml	Thu Nov 13 18:24:22 2025 +0100
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project version="0.3" xmlns="http://unixwork.de/uwproj">
+<project version="0.4" xmlns="http://unixwork.de/uwproj">
 	<dependency name="curl" platform="windows">
 		<cflags>-I/mingw/include</cflags>
 		<ldflags>-lcurl</ldflags>

mercurial