Re: Correct way to build .deb with -mieee
Christopher C. Chimelis wrote:
On Tue, 19 Jun 2001, Adam C Powell IV wrote:
I have a program (petscgraphics) which, when built without -mieee, fails
with SIGFPE (division by zero); with -mieee, works perfectly (still
divides by zero, but works anyway).
So, should -mieee go in debian/rules, something like "CFLAGS=-mieee
./configure --prefix=/usr"? Or is there a more intelligent way for
upstream (me) to put it in, such that it is only used for one source
file (petscgraphics.c)?
It's usually ideal to make such changes in the autoconf scripts, unless
the software doesn't use autoconf. If it doesn't, then the best way may
be to handle it via debian/rules. Since it's only needed for one file,
though, doing a "blanket" -mieee compilation would probably be overkill...
Indeed. I took this approach (autoconf scripts), and now PETScGraphics
works on alpha.
Just "for the record", here's what I did: in configure.in
AC_CHECKING([whether -mieee is needed to avoid SIGFPE on divide by zero])
case $build/$CC in
alpha*/gcc* )
build_gcc_alpha=yes
AC_MSG_RESULT([yes, will be used for libpetscgraphics])
;;
* )
build_gcc_alpha=no
AC_MSG_RESULT([not needed])
;;
esac
AM_CONDITIONAL(GCC_ALPHA, test x$build_gcc_alpha != xno)
Then in Makefile.am, I copied the %.lo:%.c target from Makefile.in but
added -mieee for this particular file:
# This is to get -mieee in for gcc on Alpha
if GCC_ALPHA
petscgraphics.lo: petscgraphics.c
@echo '$(LTCOMPILE) -mieee -c $<'; \
$(LTCOMPILE) -mieee -Wp,-MD,.deps/$(*F).pp -c $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*F).pp > .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm -f .deps/$(*F).pp
endif # GCC_ALPHA
I really don't know what all the obscure sed and tr stuff does (except
that it helps set up build dependencies properly), and it may break on
automake upgrade, but at least for now it works. :-)
HTH, share and enjoy, etc.
--
-Adam P.
GPG fingerprint: D54D 1AEE B11C CE9B A02B C5DD 526F 01E8 564E E4B6
Welcome to the best software in the world today cafe!
<http://lyre.mit.edu/%7Epowell/The_Best_Stuff_In_The_World_Today_Cafe.ogg>
Reply to: