--- configure.orig	2016-04-25 22:17:08 UTC
+++ configure
@@ -22470,13 +22470,13 @@ if test "x$ac_cv_lib_mw__mwvalidcheckl" 
   LIBM=-lmw
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lquadmath -lquadmath -lm" >&5
+$as_echo_n "checking for cos in -lquadmath -lquadmath -lm... " >&6; }
 if ${ac_cv_lib_m_cos+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
+LIBS="-lquadmath -lquadmath -lm  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -22507,18 +22507,18 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
 $as_echo "$ac_cv_lib_m_cos" >&6; }
 if test "x$ac_cv_lib_m_cos" = xyes; then :
-  LIBM="$LIBM -lm"
+  LIBM="$LIBM -lquadmath -lquadmath -lm"
 fi
 
   ;;
 *)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lquadmath -lquadmath -lm" >&5
+$as_echo_n "checking for cos in -lquadmath  -lquadmath -lm... " >&6; }
 if ${ac_cv_lib_m_cos+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
+LIBS="-lquadmath -lquadmath -lm  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -22549,7 +22549,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
 $as_echo "$ac_cv_lib_m_cos" >&6; }
 if test "x$ac_cv_lib_m_cos" = xyes; then :
-  LIBM=-lm
+  LIBM="-lquadmath -lquadmath -lm"
 fi
 
   ;;
@@ -22560,13 +22560,13 @@ esac
 ## </NOTE>
 ## AC_CHECK_LIBM computes LIBM but does not add to LIBS, hence we do
 ## the following as well.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin in -lm" >&5
-$as_echo_n "checking for sin in -lm... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sin in -lquadmath -lquadmath -lm" >&5
+$as_echo_n "checking for sin in -lquadmath -lquadmath -lm... " >&6; }
 if ${ac_cv_lib_m_sin+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
+LIBS="-lquadmath -lquadmath -lm  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -22601,7 +22601,7 @@ if test "x$ac_cv_lib_m_sin" = xyes; then
 #define HAVE_LIBM 1
 _ACEOF
 
-  LIBS="-lm $LIBS"
+  LIBS="-lquadmath -lquadmath -lm $LIBS"
 
 fi
 
@@ -27958,7 +27958,7 @@ fi
 ## if nothing was obtained for SHLIB_CXXLDFLAGS.
 ##
 ## Note also that some systems (formerly AIX) do not allow for unresolved
-## symbols at link time.  For such systems, we link against -lm (in case
+## symbols at link time.  For such systems, we link against -lquadmath -lm (in case
 ## it exists) when building a shlib module via SHLIB_LIBADD.
 
 main_ld="${CC}"
@@ -30147,7 +30147,7 @@ if ${ac_cv_lib_rt_clock_gettime+:} false
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt  $LIBS"
+LIBS="$LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -30190,7 +30190,7 @@ if test "x$ac_cv_lib_rt_clock_gettime" =
 #define HAVE_LIBRT 1
 _ACEOF
 
-  LIBS="-lrt $LIBS"
+  LIBS="$LIBS"
 
 fi
 
@@ -35109,7 +35109,7 @@ fi
     ## Part 2.  Try finding the tk library.
     if test -n "${TK_CONFIG}"; then
       . ${TK_CONFIG}
-      TCLTK_LIBS="${TCLTK_LIBS} ${TK_LIB_SPEC} ${TK_XLIBSW}"
+      TCLTK_LIBS="${TCLTK_LIBS} ${TK_LIB_SPEC} ${TK_XLIBSW} ${TCL_LD_FLAGS}"
     else
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tk_Init in -ltk" >&5
 $as_echo_n "checking for Tk_Init in -ltk... " >&6; }
