Merge from GCC 4.8 branch revision 203800.

From-SVN: r203803
diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am
index 6c97ee8..9acf619 100644
--- a/libquadmath/Makefile.am
+++ b/libquadmath/Makefile.am
@@ -69,6 +69,9 @@
   printf/quadmath-printf.c printf/rshift.c printf/submul_1.c printf/sub_n.c \
   strtod/strtoflt128.c strtod/mpn2flt128.c strtod/tens_in_limb.c
 
+if LIBQUAD_FERAISEEXCEPT
+libquadmath_la_SOURCES += math/feraiseexcept.c
+endif
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in
index 92c5d25..bcd6cde 100644
--- a/libquadmath/Makefile.in
+++ b/libquadmath/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,6 +17,23 @@
 
 
 VPATH = @srcdir@
+am__make_dryrun = \
+  { \
+    am__dry=no; \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
+    test $$am__dry = yes; \
+  }
 pkgdatadir = $(datadir)/@PACKAGE@
 pkgincludedir = $(includedir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -37,6 +54,7 @@
 host_triplet = @host@
 target_triplet = @target@
 @BUILD_LIBQUADMATH_FALSE@libquadmath_la_DEPENDENCIES =
+@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_FERAISEEXCEPT_TRUE@am__append_1 = math/feraiseexcept.c
 subdir = .
 DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(top_srcdir)/configure $(am__configure_deps) \
@@ -83,10 +101,17 @@
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \
 	"$(DESTDIR)$(libsubincludedir)"
 LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 am__dirstamp = $(am__leading_dot)dirstamp
+@BUILD_LIBQUADMATH_TRUE@@LIBQUAD_FERAISEEXCEPT_TRUE@am__objects_1 = math/feraiseexcept.lo
 @BUILD_LIBQUADMATH_TRUE@am_libquadmath_la_OBJECTS = math/x2y2m1q.lo \
 @BUILD_LIBQUADMATH_TRUE@	math/isinf_nsq.lo math/acoshq.lo \
 @BUILD_LIBQUADMATH_TRUE@	math/fmodq.lo math/acosq.lo \
@@ -142,7 +167,8 @@
 @BUILD_LIBQUADMATH_TRUE@	printf/rshift.lo printf/submul_1.lo \
 @BUILD_LIBQUADMATH_TRUE@	printf/sub_n.lo strtod/strtoflt128.lo \
 @BUILD_LIBQUADMATH_TRUE@	strtod/mpn2flt128.lo \
-@BUILD_LIBQUADMATH_TRUE@	strtod/tens_in_limb.lo
+@BUILD_LIBQUADMATH_TRUE@	strtod/tens_in_limb.lo \
+@BUILD_LIBQUADMATH_TRUE@	$(am__objects_1)
 libquadmath_la_OBJECTS = $(am_libquadmath_la_OBJECTS)
 libquadmath_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -181,6 +207,11 @@
 MAKEINFOHTML = $(MAKEINFO) --html
 AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
 DVIPS = dvips
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
 HEADERS = $(nodist_libsubinclude_HEADERS)
 ETAGS = etags
 CTAGS = ctags
@@ -325,33 +356,59 @@
 @BUILD_LIBQUADMATH_TRUE@libquadmath_la_DEPENDENCIES = $(version_dep) $(libquadmath_la_LIBADD)
 @BUILD_LIBQUADMATH_TRUE@nodist_libsubinclude_HEADERS = quadmath.h quadmath_weak.h
 @BUILD_LIBQUADMATH_TRUE@libsubincludedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
-@BUILD_LIBQUADMATH_TRUE@libquadmath_la_SOURCES = \
-@BUILD_LIBQUADMATH_TRUE@  math/x2y2m1q.c math/isinf_nsq.c math/acoshq.c math/fmodq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/acosq.c math/frexpq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/rem_pio2q.c math/asinhq.c math/hypotq.c math/remainderq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/asinq.c math/rintq.c math/atan2q.c math/isinfq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/roundq.c math/atanhq.c math/isnanq.c math/scalblnq.c math/atanq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/j0q.c math/scalbnq.c math/cbrtq.c math/j1q.c math/signbitq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/ceilq.c math/jnq.c math/sincos_table.c math/complex.c math/ldexpq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/sincosq.c math/copysignq.c math/lgammaq.c math/sincosq_kernel.c \
-@BUILD_LIBQUADMATH_TRUE@  math/coshq.c math/llroundq.c math/sinhq.c math/cosq.c math/log10q.c \
-@BUILD_LIBQUADMATH_TRUE@  math/sinq.c math/cosq_kernel.c math/log1pq.c math/sinq_kernel.c \
-@BUILD_LIBQUADMATH_TRUE@  math/erfq.c math/logq.c math/sqrtq.c math/expm1q.c math/lroundq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/tanhq.c math/expq.c math/modfq.c math/tanq.c math/fabsq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/nanq.c math/tgammaq.c math/finiteq.c math/nextafterq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/truncq.c math/floorq.c math/powq.c math/fmaq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/cacoshq.c math/cacosq.c math/casinhq.c math/casinq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/catanhq.c math/catanq.c math/cimagq.c math/conjq.c math/cprojq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/crealq.c math/fdimq.c math/fmaxq.c math/fminq.c math/ilogbq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/llrintq.c math/log2q.c math/lrintq.c math/nearbyintq.c math/remquoq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/ccoshq.c math/cexpq.c math/clog10q.c math/clogq.c math/csinq.c \
-@BUILD_LIBQUADMATH_TRUE@  math/csinhq.c math/csqrtq.c math/ctanq.c math/ctanhq.c \
-@BUILD_LIBQUADMATH_TRUE@  printf/addmul_1.c printf/add_n.c printf/cmp.c printf/divrem.c \
-@BUILD_LIBQUADMATH_TRUE@  printf/flt1282mpn.c printf/fpioconst.c printf/lshift.c printf/mul_1.c \
-@BUILD_LIBQUADMATH_TRUE@  printf/mul_n.c printf/mul.c printf/printf_fphex.c printf/printf_fp.c \
-@BUILD_LIBQUADMATH_TRUE@  printf/quadmath-printf.c printf/rshift.c printf/submul_1.c printf/sub_n.c \
-@BUILD_LIBQUADMATH_TRUE@  strtod/strtoflt128.c strtod/mpn2flt128.c strtod/tens_in_limb.c
-
+@BUILD_LIBQUADMATH_TRUE@libquadmath_la_SOURCES = math/x2y2m1q.c \
+@BUILD_LIBQUADMATH_TRUE@	math/isinf_nsq.c math/acoshq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/fmodq.c math/acosq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/frexpq.c math/rem_pio2q.c \
+@BUILD_LIBQUADMATH_TRUE@	math/asinhq.c math/hypotq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/remainderq.c math/asinq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/rintq.c math/atan2q.c \
+@BUILD_LIBQUADMATH_TRUE@	math/isinfq.c math/roundq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/atanhq.c math/isnanq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/scalblnq.c math/atanq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/j0q.c math/scalbnq.c math/cbrtq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/j1q.c math/signbitq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/ceilq.c math/jnq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/sincos_table.c math/complex.c \
+@BUILD_LIBQUADMATH_TRUE@	math/ldexpq.c math/sincosq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/copysignq.c math/lgammaq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/sincosq_kernel.c math/coshq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/llroundq.c math/sinhq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/cosq.c math/log10q.c math/sinq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/cosq_kernel.c math/log1pq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/sinq_kernel.c math/erfq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/logq.c math/sqrtq.c math/expm1q.c \
+@BUILD_LIBQUADMATH_TRUE@	math/lroundq.c math/tanhq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/expq.c math/modfq.c math/tanq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/fabsq.c math/nanq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/tgammaq.c math/finiteq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/nextafterq.c math/truncq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/floorq.c math/powq.c math/fmaq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/cacoshq.c math/cacosq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/casinhq.c math/casinq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/catanhq.c math/catanq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/cimagq.c math/conjq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/cprojq.c math/crealq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/fdimq.c math/fmaxq.c math/fminq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/ilogbq.c math/llrintq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/log2q.c math/lrintq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/nearbyintq.c math/remquoq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/ccoshq.c math/cexpq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/clog10q.c math/clogq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/csinq.c math/csinhq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/csqrtq.c math/ctanq.c \
+@BUILD_LIBQUADMATH_TRUE@	math/ctanhq.c printf/addmul_1.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/add_n.c printf/cmp.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/divrem.c printf/flt1282mpn.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/fpioconst.c printf/lshift.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/mul_1.c printf/mul_n.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/mul.c printf/printf_fphex.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/printf_fp.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/quadmath-printf.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/rshift.c printf/submul_1.c \
+@BUILD_LIBQUADMATH_TRUE@	printf/sub_n.c strtod/strtoflt128.c \
+@BUILD_LIBQUADMATH_TRUE@	strtod/mpn2flt128.c \
+@BUILD_LIBQUADMATH_TRUE@	strtod/tens_in_limb.c $(am__append_1)
 
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
@@ -424,7 +481,7 @@
 
 .SUFFIXES:
 .SUFFIXES: .c .dvi .lo .o .obj .ps
-am--refresh:
+am--refresh: Makefile
 	@:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
@@ -460,10 +517,8 @@
 $(am__aclocal_m4_deps):
 
 config.h: stamp-h1
-	@if test ! -f $@; then \
-	  rm -f stamp-h1; \
-	  $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
-	else :; fi
+	@if test ! -f $@; then rm -f stamp-h1; else :; fi
+	@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
 
 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
 	@rm -f stamp-h1
@@ -477,7 +532,6 @@
 	-rm -f config.h stamp-h1
 install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
 	@$(NORMAL_INSTALL)
-	test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
 	@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
 	list2=; for p in $$list; do \
 	  if test -f $$p; then \
@@ -485,6 +539,8 @@
 	  else :; fi; \
 	done; \
 	test -z "$$list2" || { \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
 	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
 	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
 	}
@@ -655,7 +711,9 @@
 	strtod/$(DEPDIR)/$(am__dirstamp)
 strtod/tens_in_limb.lo: strtod/$(am__dirstamp) \
 	strtod/$(DEPDIR)/$(am__dirstamp)
-libquadmath.la: $(libquadmath_la_OBJECTS) $(libquadmath_la_DEPENDENCIES) 
+math/feraiseexcept.lo: math/$(am__dirstamp) \
+	math/$(DEPDIR)/$(am__dirstamp)
+libquadmath.la: $(libquadmath_la_OBJECTS) $(libquadmath_la_DEPENDENCIES) $(EXTRA_libquadmath_la_DEPENDENCIES) 
 	$(libquadmath_la_LINK) $(am_libquadmath_la_rpath) $(libquadmath_la_OBJECTS) $(libquadmath_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
@@ -736,6 +794,8 @@
 	-rm -f math/fabsq.lo
 	-rm -f math/fdimq.$(OBJEXT)
 	-rm -f math/fdimq.lo
+	-rm -f math/feraiseexcept.$(OBJEXT)
+	-rm -f math/feraiseexcept.lo
 	-rm -f math/finiteq.$(OBJEXT)
 	-rm -f math/finiteq.lo
 	-rm -f math/floorq.$(OBJEXT)
@@ -916,6 +976,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/expq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fabsq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fdimq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/feraiseexcept.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/finiteq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/floorq.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@math/$(DEPDIR)/fmaq.Plo@am__quote@
@@ -1086,9 +1147,7 @@
 
 uninstall-info-am:
 	@$(PRE_UNINSTALL)
-	@if test -d '$(DESTDIR)$(infodir)' && \
-	    (install-info --version && \
-	     install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+	@if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
 	  list='$(INFO_DEPS)'; \
 	  for file in $$list; do \
 	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
@@ -1163,8 +1222,11 @@
 	done
 install-nodist_libsubincludeHEADERS: $(nodist_libsubinclude_HEADERS)
 	@$(NORMAL_INSTALL)
-	test -z "$(libsubincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)"
 	@list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(libsubincludedir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -1178,9 +1240,7 @@
 	@$(NORMAL_UNINSTALL)
 	@list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
 	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	test -n "$$files" || exit 0; \
-	echo " ( cd '$(DESTDIR)$(libsubincludedir)' && rm -f" $$files ")"; \
-	cd "$(DESTDIR)$(libsubincludedir)" && rm -f $$files
+	dir='$(DESTDIR)$(libsubincludedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -1252,10 +1312,15 @@
 
 installcheck: installcheck-am
 install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
 mostlyclean-generic:
 
 clean-generic:
@@ -1305,8 +1370,11 @@
 
 install-dvi-am: $(DVIS)
 	@$(NORMAL_INSTALL)
-	test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)"
 	@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -1321,18 +1389,22 @@
 
 install-html-am: $(HTMLS)
 	@$(NORMAL_INSTALL)
-	test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"
 	@list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  $(am__strip_dir) \
-	  if test -d "$$d$$p"; then \
+	  d2=$$d$$p; \
+	  if test -d "$$d2"; then \
 	    echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
 	    $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
-	    echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
-	    $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+	    echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+	    $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
 	  else \
-	    list2="$$list2 $$d$$p"; \
+	    list2="$$list2 $$d2"; \
 	  fi; \
 	done; \
 	test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
@@ -1344,9 +1416,12 @@
 
 install-info-am: $(INFO_DEPS)
 	@$(NORMAL_INSTALL)
-	test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)"
 	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
 	list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
+	fi; \
 	for file in $$list; do \
 	  case $$file in \
 	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
@@ -1364,8 +1439,7 @@
 	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
 	  $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
 	@$(POST_INSTALL)
-	@if (install-info --version && \
-	     install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+	@if $(am__can_run_installinfo); then \
 	  list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
 	  for file in $$list; do \
 	    relfile=`echo "$$file" | sed 's|^.*/||'`; \
@@ -1379,8 +1453,11 @@
 
 install-pdf-am: $(PDFS)
 	@$(NORMAL_INSTALL)
-	test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
 	@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
@@ -1392,8 +1469,11 @@
 
 install-ps-am: $(PSS)
 	@$(NORMAL_INSTALL)
-	test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)"
 	@list='$(PSS)'; test -n "$(psdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
+	fi; \
 	for p in $$list; do \
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
 	  echo "$$d$$p"; \
diff --git a/libquadmath/aclocal.m4 b/libquadmath/aclocal.m4
index 6116764e6..b9ebb8a 100644
--- a/libquadmath/aclocal.m4
+++ b/libquadmath/aclocal.m4
@@ -1,7 +1,8 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -19,12 +20,15 @@
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # Automake X.Y traces this macro to ensure aclocal.m4 has been
@@ -34,7 +38,7 @@
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.1], [],
+m4_if([$1], [1.11.6], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -50,19 +54,21 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -144,14 +150,14 @@
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 12
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -191,6 +197,7 @@
   # instance it was reported that on HP-UX the gcc test will end up
   # making a dummy file named `D' -- because `-MD' means `put the output
   # in D'.
+  rm -rf conftest.dir
   mkdir conftest.dir
   # Copy depcomp to subdir because otherwise we won't find it if we're
   # using a relative directory.
@@ -255,7 +262,7 @@
 	break
       fi
       ;;
-    msvisualcpp | msvcmsys)
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -320,10 +327,13 @@
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
+  am__nodep='_no'
 fi
 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
 AC_SUBST([AMDEPBACKSLASH])dnl
 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
 ])
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
@@ -545,12 +555,15 @@
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_SH
 # ------------------
 # Define $install_sh.
@@ -569,8 +582,8 @@
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -590,7 +603,7 @@
        [disable], [m4_define([am_maintainer_other], [enable])],
        [m4_define([am_maintainer_other], [enable])
         m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
-AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode's default is 'disable' unless 'enable' is passed
   AC_ARG_ENABLE([maintainer-mode],
 [  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
@@ -736,12 +749,15 @@
 fi
 ])
 
-# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_MKDIR_P
 # ---------------
 # Check for `mkdir -p'.
@@ -764,13 +780,14 @@
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -778,13 +795,13 @@
 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
 
 # _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
 
 # _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -860,12 +877,14 @@
 fi
 AC_MSG_RESULT(yes)])
 
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
+# serial 1
+
 # AM_PROG_INSTALL_STRIP
 # ---------------------
 # One issue with vendor `install' (even GNU) is that you can't
@@ -888,13 +907,13 @@
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
@@ -903,13 +922,13 @@
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
 # AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
+# --------------------------
 # Public sister of _AM_SUBST_NOTMAKE.
 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -931,10 +950,11 @@
 # a tarball read from stdin.
 #     $(am__untar) < result.tar
 AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
+[# Always define AMTAR for backward compatibility.  Yes, it's still used
+# in the wild :-(  We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
 m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
      [m4_case([$1], [ustar],, [pax],,
               [m4_fatal([Unknown tar format])])
 AC_MSG_CHECKING([how to create a $1 tar archive])
diff --git a/libquadmath/config.h.in b/libquadmath/config.h.in
index 9d18cc3..2ec0e1f 100644
--- a/libquadmath/config.h.in
+++ b/libquadmath/config.h.in
@@ -118,6 +118,9 @@
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
+/* Optional replacement for compile-time broken feraiseexcept. */
+#undef QUADMATH_FERAISEEXCEPT
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
diff --git a/libquadmath/configure b/libquadmath/configure
index 0ea6e07..907daaf 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -611,6 +611,8 @@
 LIBQUAD_USE_SYMVER_GNU_TRUE
 LIBQUAD_USE_SYMVER_FALSE
 LIBQUAD_USE_SYMVER_TRUE
+LIBQUAD_FERAISEEXCEPT_FALSE
+LIBQUAD_FERAISEEXCEPT_TRUE
 toolexeclibdir
 toolexecdir
 multi_basedir
@@ -10521,7 +10523,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10524 "configure"
+#line 10526 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10627,7 +10629,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10630 "configure"
+#line 10632 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12351,6 +12353,54 @@
   fi
 fi
 
+if test "x$ac_cv_header_fenv_h" = "xyes"; then
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether feraiseexcept is broken in fenv.h" >&5
+$as_echo_n "checking whether feraiseexcept is broken in fenv.h... " >&6; }
+if test "${quadmath_cv_feraiseexcept_fenv_broken+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <fenv.h>
+int
+main ()
+{
+feraiseexcept (FE_INVALID);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  quadmath_cv_feraiseexcept_fenv_broken=no
+else
+  quadmath_cv_feraiseexcept_fenv_broken=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $quadmath_cv_feraiseexcept_fenv_broken" >&5
+$as_echo "$quadmath_cv_feraiseexcept_fenv_broken" >&6; }
+  if test "x$quadmath_cv_feraiseexcept_fenv_broken" = "xyes"; then
+    feraiseexcept=__quadmath_feraiseexcept
+  else
+    feraiseexcept=feraiseexcept
+  fi
+
+cat >>confdefs.h <<_ACEOF
+#define QUADMATH_FERAISEEXCEPT $feraiseexcept
+_ACEOF
+
+fi
+ if test "x$ac_cv_header_fenv_h$quadmath_cv_feraiseexcept_fenv_broken" = "xyesyes"; then
+  LIBQUAD_FERAISEEXCEPT_TRUE=
+  LIBQUAD_FERAISEEXCEPT_FALSE='#'
+else
+  LIBQUAD_FERAISEEXCEPT_TRUE='#'
+  LIBQUAD_FERAISEEXCEPT_FALSE=
+fi
+
+
 # Check for hidden visibility (copied from libssp).
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Werror"
@@ -13035,6 +13085,10 @@
   as_fn_error "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${LIBQUAD_FERAISEEXCEPT_TRUE}" && test -z "${LIBQUAD_FERAISEEXCEPT_FALSE}"; then
+  as_fn_error "conditional \"LIBQUAD_FERAISEEXCEPT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${LIBQUAD_USE_SYMVER_TRUE}" && test -z "${LIBQUAD_USE_SYMVER_FALSE}"; then
   as_fn_error "conditional \"LIBQUAD_USE_SYMVER\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libquadmath/configure.ac b/libquadmath/configure.ac
index c547da8..765dfea 100644
--- a/libquadmath/configure.ac
+++ b/libquadmath/configure.ac
@@ -150,6 +150,27 @@
   fi
 fi
 
+if test "x$ac_cv_header_fenv_h" = "xyes"; then
+  dnl Some versions of libc 2.16 for x86_64 have an extern inline
+  dnl definition of feraiseexcept in bits/fenv.h that requires SSE
+  dnl support, and they fail to compile with -m32 when targeting
+  dnl pre-x86_64 32-bit architectures.
+
+  dnl This wrapper enables us to bypass the inline definition and call
+  dnl the out-of-line feraiseexcept definition, because it does not
+  dnl include fenv.h itself.
+
+  AC_CACHE_CHECK([whether feraiseexcept is broken in fenv.h], [quadmath_cv_feraiseexcept_fenv_broken], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fenv.h>]], [feraiseexcept (FE_INVALID);])], [quadmath_cv_feraiseexcept_fenv_broken=no], [quadmath_cv_feraiseexcept_fenv_broken=yes])])
+  if test "x$quadmath_cv_feraiseexcept_fenv_broken" = "xyes"; then
+    feraiseexcept=__quadmath_feraiseexcept
+  else
+    feraiseexcept=feraiseexcept
+  fi
+  AC_DEFINE_UNQUOTED([QUADMATH_FERAISEEXCEPT], [$feraiseexcept],
+    		     [Optional replacement for compile-time broken feraiseexcept.])
+fi
+AM_CONDITIONAL([LIBQUAD_FERAISEEXCEPT], [test "x$ac_cv_header_fenv_h$quadmath_cv_feraiseexcept_fenv_broken" = "xyesyes"])
+
 # Check for hidden visibility (copied from libssp).
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -Werror"
diff --git a/libquadmath/math/ccoshq.c b/libquadmath/math/ccoshq.c
index 8d55ad3..c1b24ac 100644
--- a/libquadmath/math/ccoshq.c
+++ b/libquadmath/math/ccoshq.c
@@ -89,9 +89,9 @@
 	  __imag__ retval = __real__ x == 0.0Q ? 0.0Q : nanq ("");
 	  __real__ retval = nanq ("") + nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (icls == QUADFP_INFINITE)
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
         }
     }
@@ -129,9 +129,9 @@
 	  __real__ retval = HUGE_VALQ;
 	  __imag__ retval = nanq ("") + nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (icls == QUADFP_INFINITE)
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	 }
     }
diff --git a/libquadmath/math/cexpq.c b/libquadmath/math/cexpq.c
index bd4be1e..a7f42bf 100644
--- a/libquadmath/math/cexpq.c
+++ b/libquadmath/math/cexpq.c
@@ -83,8 +83,8 @@
 	  __real__ retval = nanq ("");
 	  __imag__ retval = nanq ("");
 
-#ifdef HAVE_FENV_H
-	  feraiseexcept (FE_INVALID);
+#ifdef QUADMATH_FERAISEEXCEPT
+	  QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	}
     }
@@ -125,9 +125,9 @@
 	  __real__ retval = HUGE_VALQ;
 	  __imag__ retval = nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (icls == QUADFP_INFINITE)
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	}
       else
@@ -142,9 +142,9 @@
       __real__ retval = nanq ("");
       __imag__ retval = nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
       if (rcls != QUADFP_NAN || icls != QUADFP_NAN)
-	feraiseexcept (FE_INVALID);
+	QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
     }
 
diff --git a/libquadmath/math/csinhq.c b/libquadmath/math/csinhq.c
index c16d576..5f1d8df 100644
--- a/libquadmath/math/csinhq.c
+++ b/libquadmath/math/csinhq.c
@@ -98,9 +98,9 @@
 	      __real__ retval = copysignq (0.0Q, negate ? -1.0Q : 1.0Q);
 	      __imag__ retval = nanq ("") + nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	      if (icls == QUADFP_INFINITE)
-		feraiseexcept (FE_INVALID);
+		QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	    }
 	  else
@@ -108,8 +108,8 @@
 	      __real__ retval = nanq ("");
 	      __imag__ retval = nanq ("");
 
-#ifdef HAVE_FENV_H
-	      feraiseexcept (FE_INVALID);
+#ifdef QUADMATH_FERAISEEXCEPT
+	      QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	    }
 	}
@@ -150,9 +150,9 @@
 	  __real__ retval = HUGE_VALQ;
 	  __imag__ retval = nanq ("") + nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (icls == QUADFP_INFINITE)
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	}
     }
diff --git a/libquadmath/math/csinq.c b/libquadmath/math/csinq.c
index c837e50..cd37013 100644
--- a/libquadmath/math/csinq.c
+++ b/libquadmath/math/csinq.c
@@ -98,9 +98,9 @@
 	      __real__ retval = nanq ("");
 	      __imag__ retval = __imag__ x;
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	      if (rcls == QUADFP_INFINITE)
-		feraiseexcept (FE_INVALID);
+		QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	    }
 	  else
@@ -108,8 +108,8 @@
 	      __real__ retval = nanq ("");
 	      __imag__ retval = nanq ("");
 
-#ifdef HAVE_FENV_H
-	      feraiseexcept (FE_INVALID);
+#ifdef QUADMATH_FERAISEEXCEPT
+	      QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	    }
 	}
@@ -152,9 +152,9 @@
 	  __real__ retval = nanq ("");
 	  __imag__ retval = HUGE_VALQ;
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (rcls == QUADFP_INFINITE)
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	}
     }
diff --git a/libquadmath/math/ctanhq.c b/libquadmath/math/ctanhq.c
index 8934cfa..e954965 100644
--- a/libquadmath/math/ctanhq.c
+++ b/libquadmath/math/ctanhq.c
@@ -45,9 +45,9 @@
 	  __real__ res = nanq ("");
 	  __imag__ res = nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (__quadmath_isinf_nsq (__imag__ x))
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	}
     }
diff --git a/libquadmath/math/ctanq.c b/libquadmath/math/ctanq.c
index d390511..d3570be 100644
--- a/libquadmath/math/ctanq.c
+++ b/libquadmath/math/ctanq.c
@@ -45,9 +45,9 @@
 	  __real__ res = nanq ("");
 	  __imag__ res = nanq ("");
 
-#ifdef HAVE_FENV_H
+#ifdef QUADMATH_FERAISEEXCEPT
 	  if (__quadmath_isinf_nsq (__real__ x))
-	    feraiseexcept (FE_INVALID);
+	    QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	}
     }
diff --git a/libquadmath/math/feraiseexcept.c b/libquadmath/math/feraiseexcept.c
new file mode 100644
index 0000000..3d13743
--- /dev/null
+++ b/libquadmath/math/feraiseexcept.c
@@ -0,0 +1,9 @@
+/* Wrapper for feraiseexcept.  This file is in the public domain.
+   Contributed by Alexandre Oliva <aoliva@redhat.com>
+   See QUADMATH_FERAISEEXCEPT in configure.ac for more information.  */
+
+int
+__quadmath_feraiseexcept (int xcpt)
+{
+  feraiseexcept (xcpt);
+}
diff --git a/libquadmath/math/ilogbq.c b/libquadmath/math/ilogbq.c
index 7f95e9c..553df9e 100644
--- a/libquadmath/math/ilogbq.c
+++ b/libquadmath/math/ilogbq.c
@@ -29,6 +29,10 @@
 #include <errno.h>
 #include "quadmath-imp.h"
 
+#ifdef HAVE_FENV_H
+# include <fenv.h>
+#endif
+
 #ifndef FP_ILOGB0
 # define FP_ILOGB0 INT_MIN
 #endif
@@ -48,8 +52,8 @@
 	    if((hx|lx)==0)
 	      {
 		errno = EDOM;
-#ifdef USE_FENV_H
-		feraiseexcept (FE_INVALID);
+#ifdef QUADMATH_FERAISEEXCEPT
+		QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 		return FP_ILOGB0;	/* ilogbl(0) = FP_ILOGB0 */
 	      }
@@ -67,16 +71,16 @@
 	    if (((hx^0x7fff000000000000LL)|lx) == 0)
 	      {
 		errno = EDOM;
-#ifdef USE_FENV_H
-		feraiseexcept (FE_INVALID);
+#ifdef QUADMATH_FERAISEEXCEPT
+		QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 		return INT_MAX;
 	      }
 	}
 
 	errno = EDOM;
-#ifdef USE_FENV_H
-	feraiseexcept (FE_INVALID);
+#ifdef QUADMATH_FERAISEEXCEPT
+	QUADMATH_FERAISEEXCEPT (FE_INVALID);
 #endif
 	return FP_ILOGBNAN;
 }
diff --git a/libquadmath/quadmath-imp.h b/libquadmath/quadmath-imp.h
index 40b346b..6951393 100644
--- a/libquadmath/quadmath-imp.h
+++ b/libquadmath/quadmath-imp.h
@@ -46,8 +46,9 @@
 extern __float128 __quadmath_x2y2m1q (__float128 x, __float128 y);
 extern int __quadmath_isinf_nsq (__float128 x);
 
-
-
+#ifdef HAVE_FENV_H
+extern int __quadmath_feraiseexcept (int);
+#endif
 
 
 /* Frankly, if you have __float128, you have 64-bit integers, right?  */