public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* autoconf macro for IEEE compiler flags
@ 2006-07-20  7:53 Steve M. Robbins
  2006-07-23  9:57 ` Brian Gough
  0 siblings, 1 reply; 2+ messages in thread
From: Steve M. Robbins @ 2006-07-20  7:53 UTC (permalink / raw)
  To: gsl-discuss

Hello,

I recently discovered that another project I'm involved with doesn't
compile properly on Alpha using GCC unless option -mieee is used
[http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=368263].  I thought
to fix it by writing an autoconf macro, below, that I plan to place in
the autoconf macro archive http://autoconf-archive.cryp.to/

The reason for posting here is to get some feedback from the gsl
developers because (a) gsl developers are more aware of IEEE
arithmetic issues than most, and (b) I cribbed the main part of the
macro from GSL's configure script.  ;-)

The main differences between GSL's current configure and the new macro
are: (1) I chose to modify CC rather than CFLAGS, following the model
of the standard automake macro AM_PROG_CC_STDC; and (2) I added the SH
cpu to the case switch because it, too, supports option -mieee.

Comments? 

-Steve


dnl @synopsis AX_PROG_CC_IEEE
dnl
dnl Ensure that the compiler is emitting IEEE floating point arithmetic.
dnl This macro modifies the variable CC, adding any options required.
dnl
dnl @category C
dnl @author Steve Robbins <smr@debian.org>
dnl @version 2006-07-19
dnl @license AllPermissive

AC_DEFUN([AX_PROG_CC_IEEE],
[
    AC_REQUIRE([AC_PROG_CC])
    AC_REQUIRE([AC_CANONICAL_HOST])

    AC_CACHE_CHECK([for ${CC-cc} option to enable IEEE floating point],
                   ax_cv_prog_cc_ieee,
    [
	case "$host_cpu" in
	    alpha*)
	        if test X"$GCC" = Xyes ; then
        	    ax_cv_prog_cc_ieee='-mieee -mfp-rounding-mode=d'
	        else
	            # This assumes Compaq's C compiler.
	            ax_cv_prog_cc_ieee='-ieee -fprm d'
	        fi
	        ;;
	    sh*)
	        if test X"$GCC" = Xyes ; then
        	    ax_cv_prog_cc_ieee='-mieee'
		fi
		;;
	esac

	if test X"$ax_cv_prog_cc_ieee" == X ; then
	    ax_cv_prog_cc_ieee="none"
	else
	    ac_save_CC="$CC"
	    AC_LANG_PUSH(C)
	    CC="$CC $ax_cv_prog_cc_ieee"
	    AC_COMPILE_IFELSE([int foo;],
                              [],
                              [ax_cv_prog_cc_ieee="none"])
	    CC="$ac_save_CC"
	    AC_LANG_POP
	fi
    ])

    case "x$ax_cv_prog_cc_ieee" in
	x|xnone) ;;
	*) CC="$CC $ax_cv_prog_cc_ieee" ;;
    esac
])

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: autoconf macro for IEEE compiler flags
  2006-07-20  7:53 autoconf macro for IEEE compiler flags Steve M. Robbins
@ 2006-07-23  9:57 ` Brian Gough
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gough @ 2006-07-23  9:57 UTC (permalink / raw)
  To: Steve M. Robbins; +Cc: gsl-discuss

At Thu, 20 Jul 2006 01:04:29 -0400,
Steve M. Robbins wrote:
> The main differences between GSL's current configure and the new macro
> are: (1) I chose to modify CC rather than CFLAGS, following the model
> of the standard automake macro AM_PROG_CC_STDC; and (2) I added the SH
> cpu to the case switch because it, too, supports option -mieee.
> 
> Comments? 

The one lingering problem I have with the test in GSL is that there is
no way to override it from the command-line by specifying an explicit
CFLAGS. However it hasn't generated any complaints so from that point of
view it seems ok.

-- 
Brian Gough

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-23  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20  7:53 autoconf macro for IEEE compiler flags Steve M. Robbins
2006-07-23  9:57 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).