]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
guile: Arrange to make 'gnutls.scm' architecture-independent.
authorLudovic Courtès <ludo@gnu.org>
Wed, 20 Nov 2019 15:10:11 +0000 (16:10 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 26 Dec 2019 17:36:52 +0000 (18:36 +0100)
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>
configure.ac
guile/Makefile.am
guile/modules/gnutls.in

index 30dd51743749a8de39996dc3f72837ce734e9519..3cab0dd612cae693997a96597514d3be8ee7fad1 100644 (file)
@@ -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"])
index a6185aae7b21dfacc1de2a307f110d5048fb75ca..4f82a9fa9d8a91fcce3fd163d1b469c6d937826d 100644 (file)
@@ -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" "$@"
 
index 2c84d4c3e508f9db67040f3e282ab4a47e045139..6461c404a251787791dd6a0069309c35c18db8a7 100644 (file)
 (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