Bug 38076 - fftw-3.0.1: USE=3dnow yields "gcc -m3dnow", not supported by 2.95.3
Bug#: 38076 Product:  Gentoo Linux Version: unspecified Platform: x86
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: sci@gentoo.org Reported By: hahjortland@tande.com
Component: Ebuilds
URL: 
Summary: fftw-3.0.1: USE=3dnow yields "gcc -m3dnow", not supported by 2.95.3
Keywords:  
Status Whiteboard: 
Opened: 2004-01-13 06:18 0000
Description:   Opened: 2004-01-13 06:18 0000
Reproducible: Always
Steps to Reproduce:
1. USE=3dnow
2. gcc --version is 2.95.3
3. emerge fftw

Actual Results:  
checking whether gcc accepts -m3dnow... no
configure: error: Need a version of gcc with -m3dnow
[compilation stops]


Expected Results:  
Should not have use -m3dnow.


I have an AMD Athlon XP.

Problem seems to be that USE=3dnow sets --enable-3dnow,
which makes fftw use the -m3dnow, which is not supported by gcc 2.95.3.

Maybe I have misunderstood the use of the USE=3dnow flag, but this is the first
time I encounter this problem.

Suggested solutions:

(1) Use --enable-k7 instead.
FAQ says it's faster too:
http://fftw.org/faq/section2.html#3dnow
fftw-3.0.1.ebuild:
**********************************************************************
	elif [ `use 3dnow` ]; then
		myconfsingle="$myconfsingle --enable-k7"
	fi
**********************************************************************
I guess this is the best solution.

(2) Filter --enable-3dnow on machines where gcc does not support -m3dnow.
fftw-3.0.1.ebuild:
**********************************************************************
	elif [ `use 3dnow` ]; then
		local tmpdir="`mktemp -d`"
		pushd "$tmpdir"
		touch test.c
		gcc -m3dnow -c test.c && myconfsingle="$myconfsingle --enable-3dnow"
		popd
		rm -r "$tmpdir"
	fi
**********************************************************************

emerge info:
**********************************************************************
Portage 2.0.49-r21 (default-1.0, gcc-2.95.3, glibc-2.2.5-r2,2.2.5-r9,
2.4.20-gentoo-r9)
=================================================================
System uname: 2.4.20-gentoo-r9 i686 AMD Athlon(tm) XP 1700+
Gentoo Base System version 1.4.3.10p1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=i686 -O3 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.1/share/config /usr/kde/3/share/config /usr/share/config
/usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=i686 -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS=" ftp://sunsite.uio.no/linux/Gentoo/
ftp://gentoo.linux.no/pub/gentoo/ http://gentoo.linux.no/
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.no.gentoo.org/gentoo-portage"
USE="3dnow X aalib alsa apm arts avi berkdb bonobo cdr crypt directfb dvd encode
esd gdbm gif gnome gnome-libs gpm gtk gtk2 gtkhtml guile imlib java jpeg kde
ldap libg++ libwww matrox mikmod mmx motif mozilla mozsvg mpeg mysql ncurses nls
oggvorbis opengl oss pam pdflib perl png python qt quicktime readline ruby
scanner sdl slang spell ssl svga tcltk tcpd tetex tiff truetype x86 xml2 xmms xv"
**********************************************************************

------- Comment #1 From Alexander Gabert (RETIRED) 2004-03-03 05:49:33 0000 -------
dear Hakon,

i can change the following for you in the gcc ebuilds:

for USE 3dnow we say:

if has_version sys-devel/gcc higher than 3.2.3
then
   emit -m3dnow
else
   emit --enable-k7
fi

or do you want the ebuild to be changed to explicitly use --enable-k7 for all gcc versions supported?

maybe you could find me if recent versions of gcc 3.2.x and 3.3.x support both flags so that we could decide together.

thanks,

Alex

------- Comment #2 From Håkon A. Hjortland 2004-03-04 15:16:27 0000 -------
--enable-3dnow supports a greater range of CPUs (from the FAQ).
  But, it seems to require gcc-3-something.
--enable-k7 is faster, but only works on K7 processors.
  Supported by all versions of gcc?

The ebuild should then maybe look something like this:
if USE=3dnow then
  if machine=k7 then
    myconf += "--enable-k7"
  else
     if gcc supports -m3dnow then
       myconf += "--enable-3dnow"
     else
       # Bummer!
     endif
  endif
endif

This is not a problem with me anymore. I made fftw compile when I wrote the bugreport.
It would be nice to get it fixed, though, in case someone out there can't do a
complete "emerge world" just because they haven't upgraded their gcc.

------- Comment #3 From Patrick Kursawe 2004-04-19 06:53:20 0000 -------
Since people who explicitly ask for 3dnow by setting the USE flag I'd say we
take the --enable-k7 stuff. Alexander, what do you think?

------- Comment #4 From Patrick Kursawe 2004-04-19 07:17:07 0000 -------
Did this in -r1. Ok, let's wait what explodes. Thanks for the hint, H

------- Comment #5 From Patrick Kursawe 2004-04-19 07:17:07 0000 -------
Did this in -r1. Ok, let's wait what explodes. Thanks for the hint, Håkon!