Package: tophat
Version: 1.4.1-1
Severity: serious
tags: patch

The configure.ac file in your package contains code to determine c compiler flags based on architecture. Unfortunately this code is horriblly broken.

On i386 the configure script uses -march=i686. This is not acceptable in debian as debian supports (at least in theory) processors down to the 486.

On all other debian architectures the configure script falls into a broken* fallback test for -m64. This test always passes causing the build to use -m64. This is tolerable (but pointless) on amd64 and kfreebsd-amd64 and breaks the build on all other architectures.

Even more strangely the code seems to be setup to define _FILE_OFFSET_BITS=64 on unknown architectures that don't support -m64 (though due to the broken -m64 test that codepath is never used) but not on x86.

The attatched patch simply removes the broken checking code and leaves EXT_CFLAGS empty on all architectures. I have tested that with this patch the package builds on kfreebsd-i386.

* I have not determined exactly how it is broken but it seems to be passing on all architectures. My suspsicion is the CFLAGS set before the test aren't actually being used.
Description: Remove crazy cflag determination code
 This code was broken (for example the test for -m64 plain doesn't work)
 and does the wrong thing (uses -m686 on x86) for debian. Strip it out 
 completely
 
Author: Peter Michael Green <plugw...@p10link.net)

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- tophat-1.4.1.orig/configure.ac
+++ tophat-1.4.1/configure.ac
@@ -75,26 +75,6 @@ generic_CFLAGS="-Wall -Wno-strict-aliasi
 ext_CFLAGS=""
 debug_CFLAGS="-g"
 #echo "${host_cpu}-${host_os}"
-case "${host_cpu}-${host_os}" in
-   i*86-*linux*)
-    ext_CFLAGS="-march=i686";;
-   i*86-darwin*)
-    AC_ARG_ENABLE(universal, [  --enable-universal      enable universal binary (Intel Apple only)],
-				  [is_uni=1], [is_uni=0])
-	case $is_uni in
-	  1) CFLAGS="-m64"
-	     AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
-						   [ext_CFLAGS="-arch x86_64 -arch i386 -arch ppc64 -arch ppc"],
-						   [ext_CFLAGS="-arch i386 -arch ppc"]);;
-	  0) CFLAGS="-m64"
-	  	 AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [ext_CFLAGS="-arch x86_64"], []);;
-	esac;;
-  *)
-    AC_MSG_CHECKING([if gcc accepts -m64])
-    CFLAGS="-m64"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [ext_CFLAGS="-m64"; AC_MSG_RESULT([yes])],
-					  [ext_CFLAGS="-D_FILE_OFFSET_BITS=64"; AC_MSG_RESULT([no])]);;
-esac
 
 AC_ARG_ENABLE(intel64,      [  --enable-intel64        optimize for Intel64 CPU such as Xeon and Core2],
 			  [ext_CFLAGS="${ext_CFLAGS} -mtune=nocona"], [])

Reply via email to