guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH devel 6/6] configure.ac: Standardize default installation directo


From: Maxim Cournoyer
Subject: [PATCH devel 6/6] configure.ac: Standardize default installation directory.
Date: Thu, 4 Mar 2021 21:35:24 -0500

And add a new --with-guile-site-dir option that allows specifying an
exact location explicitly.  Also add a --with-versioned-site-dir
option that appends the effective Guile version to the default site
directory when set to 'yes'.

* m4/guile-ext.m4: Remove file.
* configure.ac (GUILE_GLOBAL_SITE_DIR, GUILE_SITE_CCACHE_DIR): Remove
macro uses.  Adjust to use the GUILE_SITE and GUILE_SITE_CCACHE
variables defined by the GUILE_SITE_DIR macro from guile.m4.  The
default SITEDIR and SITECCACHEDIR values now match the more standard
layout suggested in the Guile Reference manual.  It's now also
possible to have the default SITEDIR versioned.
[--with-guile-site-dir]: New option to specify an exact site
installation directory.  Add it to the notice message.
---
 configure.ac    | 57 +++++++++++++++++++++++++++++--------
 m4/guile-ext.m4 | 74 -------------------------------------------------
 2 files changed, 45 insertions(+), 86 deletions(-)
 delete mode 100644 m4/guile-ext.m4

diff --git a/configure.ac b/configure.ac
index da741ba..dd5e91c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,6 +8,7 @@ define(GUILE_LIB_CONFIGURE_COPYRIGHT,[[
 
 Copyright (C) 2016 -  2018 David Pirotte
 David Pirotte <david at altosw dot be>
+Copyright (C) 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 
 This file is part of Guile-Lib.
 
@@ -63,8 +64,6 @@ dnl dependency version to 2.0.12 [or higher], because it has 
texinfo
 dnl patches so 'make check' pass.
 GUILE_PROGS([2.0.12])
 GUILE_SITE_DIR
-GUILE_GLOBAL_SITE_DIR
-GUILE_SITE_CCACHE_DIR
 GUILE_FLAGS
 
 dnl This argument is passed to guild; it ensures cross-compiling uses
@@ -78,22 +77,54 @@ AC_ARG_WITH(
   [AS_HELP_STRING(
      [--with-guile-site],
      [install source modules and compiled files using Guile's site and 
site-ccache dirs])],
-  [case "x$withval" in
-     xyes)
-     guile_site="yes";;
+  [case "$withval" in
+     yes)
+     guile_site=yes;;
      *)
-     guile_site="no";;
+     guile_site=no;;
    esac],
   [guile_site="no"])
 AC_SUBST([guile_site])
 
-if test "x$guile_site" = "xyes"; then
-   SITEDIR="$GUILE_GLOBAL_SITE";
-   SITECCACHEDIR="$GUILE_SITE_CCACHE";
+AC_ARG_WITH(
+  [guile-site-dir],
+  [AS_HELP_STRING(
+     [--with-guile-site-dir],
+     [install source modules to the provided directory])],
+  [guile_site_dir=$withval],
+  [guile_site_dir=""])
+AC_SUBST([guile_site_dir])
+
+AC_ARG_WITH(
+  [versioned-site-dir],
+  [AS_HELP_STRING(
+     [--with-versioned-site-dir],
+     [append the effective version of Guile to the default site directory])],
+  [case "$withval" in
+     yes)
+     versioned_site_dir=yes;;
+     *)
+     versioned_site_dir=no;;
+   esac],
+  [versioned_site_dir=no])
+AC_SUBST([versioned_site_dir])
+
+if test "$guile_site" = "yes"; then
+   SITEDIR=$GUILE_SITE
+   SITECCACHEDIR=$GUILE_SITE_CCACHE
 else
-   SITEDIR="$datadir/guile-lib";
-   
SITECCACHEDIR="$libdir/guile-lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache";
+dnl These are the default values.
+   SITEDIR=$datadir/guile/site
+   test "$versioned_site_dir" = yes && SITEDIR+=/$GUILE_EFFECTIVE_VERSION
+   SITECCACHEDIR=$libdir/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
 fi
+
+dnl Process guile_site_dir here, so that it takes precedence over any
+dnl other value.
+if test "$guile_site_dir" != ""; then
+   SITEDIR=$guile_site_dir
+fi
+
 AC_SUBST([SITEDIR])
 AC_SUBST([SITECCACHEDIR])
 
@@ -122,7 +153,9 @@ AC_MSG_NOTICE(
   [datarootdir=$datarootdir]
   [datadir=$datadir]
   []
-  [--with-guile-site="$guile_site"]
+  [--with-guile-site=$guile_site]
+  [--with-guile-site-dir=${guile_site_dir:-unspecified}]
+  [--with-versioned-site-dir=${versioned_site_dir}]
   []
   [sitedir (source code): ${SITEDIR}]
   [siteccachedir (compiled modules): ${SITECCACHEDIR}]
diff --git a/m4/guile-ext.m4 b/m4/guile-ext.m4
deleted file mode 100644
index 9eebcc5..0000000
--- a/m4/guile-ext.m4
+++ /dev/null
@@ -1,74 +0,0 @@
-## Autoconf macros for working with Guile.
-
-##   Copyright (C) 2017 Free Software Foundation, Inc.
-
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public License
-## as published by the Free Software Foundation; either version 3 of
-## the License, or (at your option) any later version.
-
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## Lesser General Public License for more details.
-
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-## 02110-1301 USA
-
-# serial 10
-
-## Index
-## -----
-
-## GUILE_GLOBAL_SITE_DIR -- find path to Guile "global site" directory
-## GUILE_SITE_CCACHE_DIR -- find path to Guile "site-ccache" directory
-
-## Code
-## ----
-
-
-# GUILE_GLOBAL_SITE_DIR -- find path to Guile global site directory
-#
-# Usage: GUILE_GLOBAL_SITE_DIR
-#
-# This looks for Guile's global site directory, usually something like
-# PREFIX/share/guile/site, and sets var @var{GUILE_GLOBAL_SITE} to the
-# path.  Note that the var name is different from the macro name.
-#
-# The variable is marked for substitution, as by @code{AC_SUBST}.
-#
-AC_DEFUN([GUILE_GLOBAL_SITE_DIR],
- [AC_REQUIRE([GUILE_PROGS])
-  AC_MSG_CHECKING(for Guile global site directory)
-  GUILE_GLOBAL_SITE=`$GUILE -c "(display (%global-site-dir))"`
-  if test "$GUILE_GLOBAL_SITE" = ""; then
-     AC_MSG_FAILURE(global site dir not found)
-  fi
-  AC_MSG_RESULT($GUILE_GLOBAL_SITE)
-  AC_SUBST(GUILE_GLOBAL_SITE)
- ])
-
-
-# GUILE_SITE_CCACHE_DIR -- find path to Guile "site-ccache" directory
-#
-# Usage: GUILE_SITE_CCACHE_DIR
-#
-# This looks for Guile's "site-ccache" directory, usually something
-# like PREFIX/lib/guile/GUILE_EFFECTIVE_VERSION/site-ccache, and sets
-# var @var{GUILE_SITE_CCACHE} to the path.  Note that the var name is
-# different from the macro name.
-#
-# The variable is marked for substitution, as by @code{AC_SUBST}.
-#
-AC_DEFUN([GUILE_SITE_CCACHE_DIR],
- [AC_REQUIRE([GUILE_PROGS])
-  AC_MSG_CHECKING(for Guile site ccache directory)
-  GUILE_SITE_CCACHE=`$GUILE -c "(display (%site-ccache-dir))"`
-  if test "$GUILE_SITE_CCACHE" = ""; then
-     AC_MSG_FAILURE(site ccache dir not found)
-  fi
-  AC_MSG_RESULT($GUILE_SITE_CCACHE)
-  AC_SUBST(GUILE_SITE_CCACHE)
- ])
-- 
2.30.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]