From 67154066915430626eff8ddf88632fa94558841a Mon Sep 17 00:00:00 2001 From: Slack Coder Date: Fri, 18 Jul 2025 12:34:15 -0500 Subject: [PATCH] configure: allow setting mandir+prefix Follow the pattern from gmid to implement the configuration options mandir and prefix. --- Makefile | 2 -- configure | 26 ++++++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8007454..62ef4f3 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,7 @@ include config.mk # -- options -- -PREFIX = /usr/local SBINDIR = ${PREFIX}/sbin -MANDIR = ${PREFIX}/man WWWDIR = /var/www/htdocs # -- build-related variables -- diff --git a/configure b/configure index 0568bea..ae93be8 100755 --- a/configure +++ b/configure @@ -54,16 +54,18 @@ while [ $# -gt 0 ]; do usage fi - if [ "$key" = --prefix ]; then - key=PREFIX - if [ "$1" = --prefix ]; then # no =, look at next arg - if !shift 2>&1 >/dev/null; then - echo "$0: missing value for --prefix" >&2 - exit 1 - fi - val="$1" + if [ "$key" = "$1" ]; then + # if no --xy=, look at the next arg + if ! shift 2>/dev/null; then + echo "$0: missing value for $key" >&2 + exit 1 fi + val="$1" fi + case "$key" in + --mandir) key=MANDIR ;; + --prefix) key=PREFIX ;; + esac if [ "$1" = "$key" ]; then echo "$0: invalid key-value: $1" >&2 @@ -85,8 +87,12 @@ while [ $# -gt 0 ]; do LDADD_LIBEVENT="$val" ;; LDADD_LIBSOCKET) LDADD_LIBSOCKET="$val" ;; + MANDIR) + MANDIR="$val" ;; PKG_CONFIG) pkgconfig="$val" ;; + PREFIX) + PREFIX="$val" ;; SOCK) sock="$sock" ;; USER) @@ -388,12 +394,16 @@ EOF exec > config.mk echo "config.mk: writing..." >&2 +[ -z "${MANDIR}" ] && MANDIR="\${PREFIX}/man" + cat <