Source: scheme48
Version: 1.9.2-4
Tags: patch
User: [email protected]
Usertags: ftcbfs

scheme48 fails to cross build from source, because it uses AC_TRY_RUN a
lot and it doesn't work during cross compilation. In many cases, the use
is not necessary. For instance determining the size of a pointer can be
done with AC_CHECK_SIZEOF. In other cases, the program being run simply
is int main() { return 0; } and that doesn't provide any benefit over
AC_LINK_IFELSE. I am attaching a patch that reduces some amount of
AC_TRY_RUN and thus brings scheme48 quite a bit close to cross building.
Many of the remaining checks actually do need to run something. Going
further probably requires exporting cached check results. In this bug
report, I want to focus on the low hanging fruit though. Do you find the
proposed changes acceptable?

Helmut
diff -Nru 
scheme48-1.9.2/debian/additional-sources/m4/s48_determine_pointer_size.m4 
scheme48-1.9.2/debian/additional-sources/m4/s48_determine_pointer_size.m4
--- scheme48-1.9.2/debian/additional-sources/m4/s48_determine_pointer_size.m4   
2024-08-18 09:41:05.000000000 +0200
+++ scheme48-1.9.2/debian/additional-sources/m4/s48_determine_pointer_size.m4   
1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-### s48_determine_pointer_size.m4 --- S48_DETERMINE_POINTER_SIZE macro  -*- 
Autoconf -*-
-# serial 1
-dnl
-dnl
-dnl Determines the size of a pointer.
-AC_DEFUN([S48_DETERMINE_POINTER_SIZE], [dnl
-dnl Our own version of AC_CHECK_SIZEOF([void *])
-AC_MSG_CHECKING(size of void *)
-AC_CACHE_VAL(ac_cv_sizeof_void_p,
-       [AC_TRY_RUN([#include <stdio.h>
-               #include <stdlib.h>
-               int main()
-               {
-                 FILE *f=fopen("conftestval", "w");
-                 if (!f) exit(1);
-                 fprintf(f, "%d\n", (int)sizeof(void *));
-                 exit(0);
-               }],
-           ac_cv_sizeof_void_p=`cat conftestval`,
-           ac_cv_sizeof_void_p=0,
-           AC_MSG_ERROR(failed to compile test program))])
-     if test "$ac_cv_sizeof_void_p" = "0" -o "$ac_cv_sizeof_void_p" = ""; then
-       AC_MSG_ERROR([Unable to determine sizeof (void *), see config.log for 
details.]);
-     fi
-     AC_MSG_RESULT($ac_cv_sizeof_void_p)
-     AC_DEFINE_UNQUOTED(SIZEOF_VOID_P, [$ac_cv_sizeof_void_p], [Check for 
sizeof (void *)])
-])
-### s48_determine_pointer_size.m4 ends here
diff -Nru scheme48-1.9.2/debian/additional-sources/m4/s48_glib.m4 
scheme48-1.9.2/debian/additional-sources/m4/s48_glib.m4
--- scheme48-1.9.2/debian/additional-sources/m4/s48_glib.m4     2024-08-18 
09:41:05.000000000 +0200
+++ scheme48-1.9.2/debian/additional-sources/m4/s48_glib.m4     2026-01-27 
09:16:29.000000000 +0100
@@ -15,7 +15,7 @@
          CFLAGS="$CFLAGS $GLIB_CFLAGS"
          dnl Check if we still are able to compile, link, and run with glib's 
build options
         AC_MSG_CHECKING([whether the GLIB flags work])
-        AC_TRY_RUN([int main() { return 0;}], [AC_MSG_RESULT([yes])], 
[AC_MSG_ERROR(Failed to compile with GLIB flags.)], [])
+        AC_LINK_IFELSE([int main() { return 0;}], [AC_MSG_RESULT([yes])], 
[AC_MSG_ERROR(Failed to compile with GLIB flags.)])
     fi])
   ])
 ### s48_glib.m4 ends here
diff -Nru scheme48-1.9.2/debian/additional-sources/m4/s48_ldflags.m4 
scheme48-1.9.2/debian/additional-sources/m4/s48_ldflags.m4
--- scheme48-1.9.2/debian/additional-sources/m4/s48_ldflags.m4  2024-08-18 
09:41:05.000000000 +0200
+++ scheme48-1.9.2/debian/additional-sources/m4/s48_ldflags.m4  2026-01-27 
09:16:29.000000000 +0100
@@ -8,11 +8,9 @@
        AC_MSG_CHECKING([-rdynamic])
        oldLDFLAGS="$LDFLAGS"
        LDFLAGS="$LDFLAGS -rdynamic"
-       AC_TRY_RUN([int main() { return 0;}],
+       AC_LINK_IFELSE([int main() { return 0;}],
                [AC_MSG_RESULT(yes)],
                [AC_MSG_RESULT(no)
-                       LDFLAGS="$oldLDFLAGS"],
-               [AC_MSG_RESULT(no)
                        LDFLAGS="$oldLDFLAGS"])
        AC_MSG_CHECKING([LDFLAGS_VM])
        case "$host_os" in
diff -Nru scheme48-1.9.2/debian/additional-sources/m4/s48_misaligned_doubles.m4 
scheme48-1.9.2/debian/additional-sources/m4/s48_misaligned_doubles.m4
--- scheme48-1.9.2/debian/additional-sources/m4/s48_misaligned_doubles.m4       
2024-08-18 09:41:05.000000000 +0200
+++ scheme48-1.9.2/debian/additional-sources/m4/s48_misaligned_doubles.m4       
2026-01-27 09:16:29.000000000 +0100
@@ -8,12 +8,10 @@
                AC_MSG_CHECKING([-munaligned-doubles])
                oldCFLAGS="$CFLAGS"
                CFLAGS="$CFLAGS -munaligned-doubles"
-               AC_TRY_RUN([int main() { return 0;}],
+               AC_LINK_IFELSE([int main() { return 0;}],
                        [AC_MSG_RESULT(yes)
                                
DYNAMIC_EXTERNALS_CFLAGS="$DYNAMIC_EXTERNALS_CFLAGS -munaligned-doubles"],
                        [AC_MSG_RESULT(no)
-                               CFLAGS="$oldCFLAGS"],
-                       [AC_MSG_RESULT(no)
                                CFLAGS="$oldCFLAGS"])
        fi
 ])dnl
diff -Nru scheme48-1.9.2/debian/changelog scheme48-1.9.2/debian/changelog
--- scheme48-1.9.2/debian/changelog     2024-08-18 09:41:05.000000000 +0200
+++ scheme48-1.9.2/debian/changelog     2026-01-27 09:16:29.000000000 +0100
@@ -1,3 +1,12 @@
+scheme48 (1.9.2-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + Replace custom check with AC_CHECK_SIZEOF.
+    + Turn some AC_TRY_RUN into AC_LINK_IFELSE.
+
+ -- Helmut Grohne <[email protected]>  Tue, 27 Jan 2026 09:16:29 +0100
+
 scheme48 (1.9.2-4) unstable; urgency=medium
 
   * debian/rules: after having fixed the ./configure problems, the errors
diff -Nru scheme48-1.9.2/debian/patches/cross.patch 
scheme48-1.9.2/debian/patches/cross.patch
--- scheme48-1.9.2/debian/patches/cross.patch   1970-01-01 01:00:00.000000000 
+0100
+++ scheme48-1.9.2/debian/patches/cross.patch   2026-01-27 09:16:23.000000000 
+0100
@@ -0,0 +1,11 @@
+--- scheme48-1.9.2.orig/configure.in
++++ scheme48-1.9.2/configure.in
+@@ -26,7 +26,7 @@
+      S48_PICK_GC
+      S48_ENABLE_FORCE_32BIT
+      S48_DETERMINE_BITS_PER_BYTE
+-     S48_DETERMINE_POINTER_SIZE
++     AC_CHECK_SIZEOF([void *])
+      S48_DETERMINE_BIT_SUFFIX
+      S48_ENABLE_UNIVERSAL_BINARY
+      S48_OSX_ARCH_FLAGS($S48_BUILD_UNIVERSAL_P,$S48_FORCE_32_P)
diff -Nru scheme48-1.9.2/debian/patches/series 
scheme48-1.9.2/debian/patches/series
--- scheme48-1.9.2/debian/patches/series        2024-08-18 09:41:05.000000000 
+0200
+++ scheme48-1.9.2/debian/patches/series        2026-01-27 09:15:17.000000000 
+0100
@@ -7,3 +7,4 @@
 security-tmpfile.patch
 spelling.patch
 #does not seem to work (see #776236) ignore-radix-1.patch
+cross.patch

Reply via email to