From 697fb3053991c5fd03e0d89f1a739c1917d160c2 Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pjm@nac.net>
Date: Mon, 20 Feb 2012 20:26:12 -0500
Subject: Add DATADIR to build system.

---
diff --git a/Makefile.in b/Makefile.in
index 5289caf..eb6d8de 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -25,6 +25,7 @@ SRCDIR = @srcdir@
 PREFIX = @prefix@
 BINDIR = @bindir@
 LIBDIR = @libdir@
+DATADIR = @datadir@
 MANDIR = @mandir@
 
 PACKAGE = @package@
@@ -48,6 +49,7 @@ all: sedscript
 sedscript:
 	@printf 'Writing sed script...\n'
 	@echo 's&@@BINDIR@@&$(BINDIR)&' > sedscript
+	@echo 's&@@DATADIR@@&$(DATADIR)&' >> sedscript
 	@echo 's&@@LIBDIR@@&$(LIBDIR)&' >> sedscript
 
 .PHONY: clean
diff --git a/configure b/configure
index d5cf3bb..709e417 100755
--- a/configure
+++ b/configure
@@ -48,6 +48,8 @@ Installation directories:
                         default: PREFIX/bin
   --libdir=LIBDIR       install library scripts in LIBDIR
                         default: PREFIX/lib
+  --datadir=DATADIR     expect to find data in DATADIR
+                        default: PREFIX/share
   --mandir=MANDIR       install manual pages in MANDIR
                         default: PREFIX/share/man
 EOF
@@ -105,6 +107,11 @@ while true; do
 			LIBDIR="\${PREFIX}/${2}"
 			shift 2
 			;;
+		--datadir)
+			# Leave PREFIX unexpanded for now, in case it isn't set yet.
+			DATADIR="\${PREFIX}/${2}"
+			shift 2
+			;;
 		--mandir)
 			# Leave PREFIX unexpanded for now, in case it isn't set yet.
 			MANDIR="\${PREFIX}/${2}"
@@ -139,12 +146,16 @@ fi
 if [ -z "${LIBDIR}" ]; then
 	LIBDIR=${PREFIX}/lib
 fi
+if [ -z "${DATADIR}" ]; then
+	DATADIR=${PREFIX}/share
+fi
 if [ -z "${MANDIR}" ]; then
 	MANDIR=${PREFIX}/share/man
 fi
 # Expand PREFIX if it's there.
 eval "BINDIR=${BINDIR}"
 eval "LIBDIR=${LIBDIR}"
+eval "DATADIR=${DATADIR}"
 eval "MANDIR=${MANDIR}"
 
 find_dependency()
@@ -189,6 +200,7 @@ s&@srcdir@&${SRCDIR}&
 s&@prefix@&${PREFIX}&
 s&@bindir@&${BINDIR}&
 s&@libdir@&${LIBDIR}&
+s&@datadir@&${DATADIR}&
 s&@mandir@&${MANDIR}&
 s&@package@&${PACKAGE}&
 s&@version@&${VERSION}&"
--
cgit v0.9.1