Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
List: pkgsrc-bugs
Date: 06/07/2005 11:19:02
The following reply was made to PR pkg/30366; it has been noted by GNATS.

From: Geert Hendrickx <geert.hendrickx@ua.ac.be>
To: Frederick Bruckman <fredb@immanent.net>
Cc: gnats-bugs@netbsd.org, tech-pkg@netbsd.org
Subject: Re: pkg/30366: multimedia/mjpegtools fails to build with -march=pentium4
Date: Tue, 7 Jun 2005 13:17:57 +0200

 --vkogqOf2sHV7VnPd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sun, May 29, 2005 at 04:36:52PM -0500, Frederick Bruckman wrote:
 > In article <20050529120001.592AB63B116@narn.netbsd.org>,
 > 	geert.hendrickx@ua.ac.be writes:
 > > pkgsrc/multimedia/mjpegtools fails when built with -march=pentium4
 > > in the CFLAGS.  It succeeds with any -march up to pentium3, but
 > > (!!), also succeeds with -march=pentium4 when -mcpu=pentium4 is
 > > added (however, this is automatically implied by gcc).  
 > > 
 > > The error comes from compiling some assembler code.  The ./configure
 > > script does some `uname -m' checking and accordingly sets a flag
 > > $have_cmov (unless $enable_cmov_extension == no).  However, on i386
 > > (or better), NetBSD's "uname -m" _always_ returns i386 (luckily,
 > > otherwise binary packages built on a pentium2 bulk build machine
 > > wouldn't work on a lesser cpu).  
 > 
 > My money's on the hand-tuned assembler, over the gcc flag. I agree 
 > with you, that it would bad to do that automatically.  The package 
 > could grow an option, ${MJPEGTOOLS_USE_CMOV}, and a note in the 
 > description in "defaults/mk.conf" not to set that unless you run 
 > only hosts that support it.  (I guess the simplist way to tell, on 
 > NetBSD, is "grep CMOV /var/run/dmesg.boot".)
 
 The patch in attachment introduces a "cmov" option (using the OPTIONS
 framwork), which only exists on i386, and is unset by default.
 According to this option being set or unset, the ./configure flag
 --enable-cmov-extension or --disable-cmov-extension is added.  
 
 This solves the problem.  Only thing to be done is to document the
 option in mk/defaults/.  It may be worth mentioning that, on NetBSD,
 this extension can be checked with "dmesg | grep CMOV".  
 
 GH
 
 -- 
 :wq
 
 --vkogqOf2sHV7VnPd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="Makefile.diff"
 
 --- multimedia/mjpegtools/Makefile.orig	2005-06-07 12:47:36.000000000 +0200
 +++ multimedia/mjpegtools/Makefile	2005-06-07 13:09:21.000000000 +0200
 @@ -26,6 +26,18 @@
  
  INFO_FILES=		mjpeg-howto.info
  
 +.if ${MACHINE_ARCH} == "i386"
 +PKG_OPTIONS_VAR=	PKG_OPTIONS.mjpegtools
 +PKG_SUPPORTED_OPTIONS=	cmov
 +.  include "../../mk/bsd.options.mk"
 +
 +.  if !empty(PKG_OPTIONS:Mcmov)
 +CONFIGURE_ARGS+=	--enable-cmov-extension
 +.  else
 +CONFIGURE_ARGS+=	--disable-cmov-extension
 +.  endif
 +.endif
 +
  .include "../../audio/lame/buildlink3.mk"
  .include "../../devel/SDL/buildlink3.mk"
  .include "../../graphics/ImageMagick/buildlink3.mk"
 
 --vkogqOf2sHV7VnPd--