diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-11-20 16:10:11 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-12-26 18:36:52 +0100 |
commit | fba9533e260d98e1152bd263ec893458d5f81fd2 (patch) | |
tree | c2fccb7a74f2fa82b542306a83c9af18275e485c | |
parent | 3b6c6420ac5d1e58334bc3055af4a85222c481b8 (diff) | |
download | gnutls-fba9533e260d98e1152bd263ec893458d5f81fd2.tar.gz |
guile: Arrange to make 'gnutls.scm' architecture-independent.
Fixes #838.
Reported by Andreas Metzler.
* configure.ac: Define and substitute 'maybe_guileextensiondir'.
* guile/Makefile.am (.in.scm): Substitute 'maybe_guileextensiondir'.
* guile/modules/gnutls.in <top level>: Use @maybe_guileextensiondir@.
Check if %LIBDIR is true.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | guile/Makefile.am | 2 | ||||
-rw-r--r-- | guile/modules/gnutls.in | 9 |
3 files changed, 18 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 30dd517437..3cab0dd612 100644 --- a/configure.ac +++ b/configure.ac @@ -919,6 +919,7 @@ AC_ARG_WITH([guile-extension-dir], AS_HELP_STRING([--with-guile-extension-dir=DI AC_SUBST([guilesitedir]) AC_SUBST([guilesiteccachedir]) AC_SUBST([guileextensiondir]) +maybe_guileextensiondir="\"$guileextensiondir\"" if test "$opt_guile_bindings" = "yes"; then AC_MSG_RESULT([*** @@ -990,6 +991,14 @@ if test "$opt_guile_bindings" = "yes"; then AC_CHECK_FUNCS([scm_gc_malloc_pointerless]) CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" + + # Do we need to hard-code $guileextensiondir in gnutls.scm? + # This is not necessary when $guileextensiondir is equal to + # Guile's 'extensiondir' as specified in 'guile-MAJOR.MINOR.pc'. + if test "$guileextensiondir" = "`$PKG_CONFIG guile-$GUILE_EFFECTIVE_VERSION --variable extensiondir`" \ + || test "$guileextensiondir" = '$(GUILE_EXTENSION)'; then + maybe_guileextensiondir='#f' + fi else AC_MSG_RESULT([no]) AC_MSG_WARN([A sufficiently recent GNU Guile not found. Guile bindings not built.]) @@ -998,6 +1007,7 @@ if test "$opt_guile_bindings" = "yes"; then fi fi +AC_SUBST([maybe_guileextensiondir]) AM_CONDITIONAL([HAVE_GUILE], [test "$opt_guile_bindings" = "yes"]) AM_CONDITIONAL([HAVE_GUILD], [test "x$GUILD" != "x"]) AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) diff --git a/guile/Makefile.am b/guile/Makefile.am index a6185aae7b..4f82a9fa9d 100644 --- a/guile/Makefile.am +++ b/guile/Makefile.am @@ -44,7 +44,7 @@ CLEANFILES = modules/gnutls.scm .in.scm: $(AM_V_GEN)$(MKDIR_P) "`dirname "$@"`" ; cat "$^" | \ - $(SED) -e's|[@]guileextensiondir[@]|$(guileextensiondir)|g' \ + $(SED) -e's|[@]maybe_guileextensiondir[@]|$(maybe_guileextensiondir)|g' \ > "$@.tmp" $(AM_V_at)mv "$@.tmp" "$@" diff --git a/guile/modules/gnutls.in b/guile/modules/gnutls.in index 2c84d4c3e5..6461c404a2 100644 --- a/guile/modules/gnutls.in +++ b/guile/modules/gnutls.in @@ -519,10 +519,15 @@ (eval-when (expand load eval) (define %libdir (or (getenv "GNUTLS_GUILE_EXTENSION_DIR") - "@guileextensiondir@")) + + ;; The .scm file is supposed to be architecture-independent. Thus, + ;; save 'extensiondir' only if it's different from what Guile expects. + @maybe_guileextensiondir@)) (unless (getenv "GNUTLS_GUILE_CROSS_COMPILING") - (load-extension (string-append %libdir "/guile-gnutls-v-2") + (load-extension (if %libdir + (string-append %libdir "/guile-gnutls-v-2") + "guile-gnutls-v-2") "scm_init_gnutls"))) (cond-expand |