diff configure @ 460:cb1d1ea7f2c5

new build system: accept more directory options
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 10 May 2024 23:04:44 +0000
parents 19f1aa01ea10
children a53225b44ea5
line wrap: on
line diff
--- a/configure	Fri May 10 19:50:29 2024 +0000
+++ b/configure	Fri May 10 23:04:44 2024 +0000
@@ -13,13 +13,29 @@
 # defaults that can be overridden
 CC=gcc
 CFLAGS=-O2
-PREFIX=/opt/themwi
+prefix=/opt/themwi
+exec_prefix=
+bindir=
+includedir=
+libdir=
 
 while [ $# != 0 ]
 do
 	case "$1" in
 		--prefix=*)
-			PREFIX=`echo $1 | cut -c 10-`
+			prefix=`echo $1 | cut -c 10-`
+			;;
+		--exec-prefix=*)
+			exec_prefix=`echo $1 | cut -c 15-`
+			;;
+		--bindir=*)
+			bindir=`echo $1 | cut -c 10-`
+			;;
+		--includedir=*)
+			includedir=`echo $1 | cut -c 14-`
+			;;
+		--libdir=*)
+			libdir=`echo $1 | cut -c 10-`
 			;;
 		CC=*)
 			CC=`echo $1 | cut -c 4-`
@@ -35,7 +51,38 @@
 	shift
 done
 
+# inheritance rules for install directories
+
+if [ -z "$exec_prefix" ]
+then
+	exec_prefix="$prefix"
+fi
+if [ -z "$bindir" ]
+then
+	bindir="$exec_prefix/bin"
+fi
+if [ -z "$includedir" ]
+then
+	includedir="$prefix/include"
+fi
+if [ -z "$libdir" ]
+then
+	libdir="$exec_prefix/lib"
+fi
+
+# report the final configuration
+
+echo "C code will be compiled with:"
+echo "  CC=$CC"
+echo "  CFLAGS=$CFLAGS"
+echo "Installation directories:"
+echo "  bindir=$bindir"
+echo "  includedir=$includedir"
+echo "  libdir=$libdir"
+
 # emit the Makefile include fragment
 echo "CC=$CC" > config.defs
 echo "CFLAGS=$CFLAGS" >> config.defs
-echo "PREFIX=$PREFIX" >> config.defs
+echo "bindir=$bindir" >> config.defs
+echo "includedir=$includedir" >> config.defs
+echo "libdir=$libdir" >> config.defs