Source: warmux
Version: 1:11.04.1+repack2-3
Tags: patch upstream
User: helm...@debian.org
Usertags: rebootstrap

warmux fails to cross build from source, because it uses AC_RUN_IFELSE
to check the version of SDL_gfx. Unfortunately, AC_RUN_IFELSE cannot be
used for cross compilation at all. Fortunately, the aspectes being
checked are compile time constants, so we can turn it into
AC_COMPILE_IFELSE loosing the printout of the version. Please consider
applying the attached patch as it makes warmux cross buildable. If
printing the version is considered important, one can use AS_COMPUTE_INT
to determine each of the version parts and compose the version in shell.
Let me know if you need that as it is slightly more complex.

Helmut
--- warmux-11.04.1+repack2.orig/configure.ac
+++ warmux-11.04.1+repack2/configure.ac
@@ -281,22 +281,14 @@
 AC_CHECK_HEADER(SDL_rotozoom.h,,AC_MSG_ERROR(Please install SDL_gfx))
 AC_CHECK_LIB(SDL_gfx, rotozoomSurfaceXY,, AC_MSG_ERROR(Please install SDL_gfx))
 AC_MSG_CHECKING([whether SDL_gfx - version >= 2.0.22 ])
-AC_RUN_IFELSE([
-#include <stdio.h>
+AC_COMPILE_IFELSE([
 #include <SDL_gfxPrimitives.h>
-#undef main
-int main(void)
-{
-  FILE *f = fopen("conftest.out", "wt+");
-  fprintf(f, "%i.%i.%i\n",
-         SDL_GFXPRIMITIVES_MAJOR, SDL_GFXPRIMITIVES_MINOR, SDL_GFXPRIMITIVES_MICRO);
-  fclose(f);
-  int ver = SDL_GFXPRIMITIVES_MAJOR*1000+SDL_GFXPRIMITIVES_MINOR*100+SDL_GFXPRIMITIVES_MICRO;
-  return ver < 2022;
-}],
-  [echo "`cat conftest.out`, OK"],
-  [cat conftest.out
-   AC_MSG_ERROR(Please upgrade SDL_gfx)])
+#if SDL_GFXPRIMITIVES_MAJOR < 2 || (SDL_GFXPRIMITIVES_MAJOR == 2 && SDL_GFXPRIMITIVES_MINOR == 0 && SDL_GFXPRIMITIVES_MICRO < 22)
+#error too old
+#endif
+],
+  [echo "OK"],
+  [AC_MSG_ERROR(Please upgrade SDL_gfx)])
 
 dnl === Check for curl =====================================================
 

Reply via email to