From 010c4d4c07d19ff3f50d0f3caa9fc519ec17df14 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 2 Apr 2019 22:59:43 +0200
Subject: Fixed some installation paths.

---
 configure.ac | 86 +++++++++++++++++++++++++++++++++---------------------------
 1 file changed, 47 insertions(+), 39 deletions(-)

diff --git a/configure.ac b/configure.ac
index 39ec70d..e4af946 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,68 +105,76 @@ AH_TEMPLATE([LOCALE_DIR], [Define the directory where the message catalogs are i
 
 AC_DEFINE_UNQUOTED(REVISION, AC_PACKAGE_VERSION)
 
-if test "x${datadir}" = 'x${prefix}/share'; then
-   if test "x${prefix}" = "xNONE"; then
-      pkgdatadir="${ac_default_prefix}/share/${PACKAGE}"
-   else
-      pkgdatadir="${prefix}/share/${PACKAGE}"
-   fi
-elif test "x${datadir}" = 'x${datarootdir}'; then
-   if test "x${datarootdir}" = 'x${prefix}/share'; then
-      if test "x${prefix}" = "xNONE"; then
-         pkgdatadir="${ac_default_prefix}/share/${PACKAGE}"
-      else
-         pkgdatadir="${prefix}/share/${PACKAGE}"
-      fi
-   else
-      pkgdatadir="${datarootdir}/${PACKAGE}"
-   fi 
-else
-   pkgdatadir="${datadir}/${PACKAGE}"
-fi
-
 packagesrcdir=`cd $srcdir && pwd`
 AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
 
-pixmapsdir="${pkgdatadir}/pixmaps"
+
+AC_LIB_PREPARE_PREFIX
+
+
+basedir=${datadir}/${PACKAGE}
+
+while : ; do
+   oldbasedir=${basedir}
+   AC_LIB_WITH_FINAL_PREFIX([basedir=$(eval echo ${basedir} )])
+   test ${oldbasedir} = ${basedir} && break
+done
+
+if echo ${basedir} | grep -q '^NONE'; then
+   AC_MSG_FAILURE([NONE found in \$datadir])
+fi
+
+
+pixmapsdir="${basedir}/pixmaps"
 AC_SUBST(pixmapsdir)
 
 AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${pixmapsdir}")
 
-themesdir="${pkgdatadir}/themes"
+themesdir="${basedir}/themes"
 AC_SUBST(themesdir)
 
 AC_DEFINE_UNQUOTED(THEMES_DIR, "${themesdir}")
 
-pluginsdatadir="${pkgdatadir}/plugins"
+pluginsdatadir="${basedir}/plugins"
 AC_SUBST(pluginsdatadir)
 
 AC_DEFINE_UNQUOTED(PLUGINS_DATA_DIR, "${pluginsdatadir}")
 
-if test "x${libdir}" = 'x${exec_prefix}/lib'; then
-   if test "x${exec_prefix}" = "xNONE"; then
-      if test "x${prefix}" = "xNONE"; then
-         pluginslibdir="${ac_default_prefix}/lib/chrysalide/plugins"
-      else
-         pluginslibdir="${prefix}/lib/chrysalide/plugins"
-      fi
-   else
-      pluginslibdir="${exec_prefix}/lib/chrysalide/plugins"
-   fi
-else
-   pluginslibdir="${libdir}/chrysalide/plugins"
+
+basedir=${libdir}/${PACKAGE}/plugins
+
+while : ; do
+   oldbasedir=${basedir}
+   AC_LIB_WITH_FINAL_PREFIX([basedir=$(eval echo ${basedir} )])
+   test ${oldbasedir} = ${basedir} && break
+done
+
+if echo ${basedir} | grep -q '^NONE'; then
+   AC_MSG_FAILURE([NONE found in \$libdir])
 fi
 
+
+pluginslibdir="${basedir}"
 AC_SUBST(pluginslibdir)
 
 AC_DEFINE_UNQUOTED(PLUGINS_LIB_DIR, "${pluginslibdir}")
 
-if test "x${prefix}" = "xNONE"; then
-   AC_DEFINE_UNQUOTED(LOCALE_DIR, "${ac_default_prefix}/share/locale")
-else
-   AC_DEFINE_UNQUOTED(LOCALE_DIR, "${prefix}/share/locale")
+
+basedir=${prefix}
+
+while : ; do
+   oldbasedir=${basedir}
+   AC_LIB_WITH_FINAL_PREFIX([basedir=$(eval echo ${basedir} )])
+   test ${oldbasedir} = ${basedir} && break
+done
+
+if echo ${basedir} | grep -q '^NONE'; then
+   AC_MSG_FAILURE([NONE found in \$prefix])
 fi
 
+AC_DEFINE_UNQUOTED(LOCALE_DIR, "${basedir}/share/locale")
+
+
 
 ############################################################
 # Compilation options
-- 
cgit v0.11.2-87-g4458