Source: crossfire
Version: 1.75.0-9
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs
crossfire fails to cross build from source for two distinct reasons.
The immediate failure arises from AC_CHECK_FILE. This macro is meant to
check for files on the host system, but a cross build has not access to
it. Therefore all uses of AC_CHECK_FILE fail unless the result is
seeded. crossfire uses it to check for files on the build system
however. It really should be using test -e instead.
The second problem resides in CF_CHECK_VISIBILITY. It uses AC_RUN_IFELSE
while having added -Werror to CFLAGS and removes -Werror in both the yes
and the no path. Unfortunately, the cross path does not remove -Werror
and from then on the compiler flags include -Werror breaking other
checks such as AC_CHECK_FUNCS for strdup. The easy path here is
restoring CFLAGS in the cross path, but the program under test always
returns 0, so running it isn't actually necessary. Turning it into
AC_LINK_IFELSE should be sufficient and completely removes the cross
code path.
Both changes are applicable upstream and benefit other distributions
such as PtxDist or Yocto. Please consider applying the patch attached
for your convenience.
Helmut
--- crossfire-1.75.0.orig/configure.ac
+++ crossfire-1.75.0/configure.ac
@@ -149,8 +149,8 @@
AM_CONDITIONAL(PROCESS_XSLT, [test -n "$xsltengine"])
dnl Make sure pre-built archetypes or an 'arch' directory exists.
-AC_CHECK_FILE([$srcdir/lib/archetypes], [], [has_archetypes=no])
-AC_CHECK_FILE([$srcdir/lib/arch], [], [has_arch_dir=no])
+AS_IF([test -e "$srcdir/lib/archetypes"], [], [has_archetypes=no])
+AS_IF([test -e "$srcdir/lib/arch"], [], [has_arch_dir=no])
AS_IF([test "$has_archetypes" == no -a "$has_arch_dir" == no], [
AC_MSG_ERROR([Could not find pre-built or raw archetypes.])
--- crossfire-1.75.0.orig/macros/cf_visibility.m4
+++ crossfire-1.75.0/macros/cf_visibility.m4
@@ -5,7 +5,7 @@
AC_MSG_CHECKING([whether the C compiler supports -fvisibility=hidden and the visibility __attribute__])
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
__attribute__((visibility("hidden")))
int t1(void)
{
@@ -31,7 +31,5 @@
],[
AC_MSG_RESULT([no])
CFLAGS="$saved_CFLAGS"
- ],[
- AC_MSG_RESULT([skipped because cross compiling])
])
])