public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Steve M. Robbins" <steven.robbins@videotron.ca>
To: gsl-discuss@sources.redhat.com
Subject: autoconf macro for IEEE compiler flags
Date: Thu, 20 Jul 2006 07:53:00 -0000	[thread overview]
Message-ID: <20060720050428.GA19940@nyongwa.montreal.qc.ca> (raw)

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
])

             reply	other threads:[~2006-07-20  7:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-20  7:53 Steve M. Robbins [this message]
2006-07-23  9:57 ` Brian Gough

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060720050428.GA19940@nyongwa.montreal.qc.ca \
    --to=steven.robbins@videotron.ca \
    --cc=gsl-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).