diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 689bb7f181..30b270185b 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -428,26 +428,40 @@ fi])# PGAC_C_VA_ARGS
 
 
 
-# PGAC_PROG_CC_CFLAGS_OPT
+# PGAC_PROG_VARCC_VARFLAGS_OPT
 # -----------------------
-# Given a string, check if the compiler supports the string as a
-# command-line option. If it does, add the string to CFLAGS.
-AC_DEFUN([PGAC_PROG_CC_CFLAGS_OPT],
-[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_cflags_$1])])dnl
-AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar],
+# Given a compiler, variable name and a string, check if the compiler
+# supports the string as a command-line option. If it does, add the
+# string to the given variable.
+AC_DEFUN([PGAC_PROG_VARCC_VARFLAGS_OPT],
+[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_$1_cflags_$3])])dnl
+AC_CACHE_CHECK([whether ${$1} supports $3, for $2], [Ac_cachevar],
 [pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS $1"
+pgac_save_CC=$CC
+CC=${$1}
+CFLAGS="${$2} $3"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
                    [Ac_cachevar=yes],
                    [Ac_cachevar=no])
 ac_c_werror_flag=$ac_save_c_werror_flag
-CFLAGS="$pgac_save_CFLAGS"])
+CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"])
 if test x"$Ac_cachevar" = x"yes"; then
-  CFLAGS="$CFLAGS $1"
+  $2="${$2} $3"
 fi
 undefine([Ac_cachevar])dnl
+])# PGAC_PROG_VARCC_VARFLAGS_OPT
+
+
+
+# PGAC_PROG_CC_CFLAGS_OPT
+# -----------------------
+# Given a string, check if the compiler supports the string as a
+# command-line option. If it does, add the string to CFLAGS.
+AC_DEFUN([PGAC_PROG_CC_CFLAGS_OPT], [
+PGAC_PROG_VARCC_VARFLAGS_OPT(CC, CFLAGS, $1)
 ])# PGAC_PROG_CC_CFLAGS_OPT
 
 
@@ -458,21 +472,7 @@ undefine([Ac_cachevar])dnl
 # the string as a command-line option. If it does, add the string to
 # the given variable.
 AC_DEFUN([PGAC_PROG_CC_VAR_OPT],
-[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_cflags_$2])])dnl
-AC_CACHE_CHECK([whether $CC supports $2], [Ac_cachevar],
-[pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS $2"
-ac_save_c_werror_flag=$ac_c_werror_flag
-ac_c_werror_flag=yes
-_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
-                   [Ac_cachevar=yes],
-                   [Ac_cachevar=no])
-ac_c_werror_flag=$ac_save_c_werror_flag
-CFLAGS="$pgac_save_CFLAGS"])
-if test x"$Ac_cachevar" = x"yes"; then
-  $1="${$1} $2"
-fi
-undefine([Ac_cachevar])dnl
+[PGAC_PROG_VARCC_VARFLAGS_OPT(CC, $1, $2)
 ])# PGAC_PROG_CC_VAR_OPT
 
 
diff --git a/configure b/configure
index 1be8a1ab31..a5f309212d 100755
--- a/configure
+++ b/configure
@@ -4457,13 +4457,16 @@ fi
 if test "$GCC" = yes -a "$ICC" = no; then
   CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith"
   # These work in some but not all gcc versions
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wdeclaration-after-statement" >&5
-$as_echo_n "checking whether $CC supports -Wdeclaration-after-statement... " >&6; }
-if ${pgac_cv_prog_cc_cflags__Wdeclaration_after_statement+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wdeclaration-after-statement, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -Wdeclaration-after-statement, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__Wdeclaration_after_statement+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -Wdeclaration-after-statement"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4478,27 +4481,32 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__Wdeclaration_after_statement=yes
+  pgac_cv_prog_CC_cflags__Wdeclaration_after_statement=yes
 else
-  pgac_cv_prog_cc_cflags__Wdeclaration_after_statement=no
+  pgac_cv_prog_CC_cflags__Wdeclaration_after_statement=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wdeclaration_after_statement" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__Wdeclaration_after_statement" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__Wdeclaration_after_statement" = x"yes"; then
-  CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" = x"yes"; then
+  CFLAGS="${CFLAGS} -Wdeclaration-after-statement"
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wendif-labels" >&5
-$as_echo_n "checking whether $CC supports -Wendif-labels... " >&6; }
-if ${pgac_cv_prog_cc_cflags__Wendif_labels+:} false; then :
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wendif-labels, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -Wendif-labels, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__Wendif_labels+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wendif-labels"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -Wendif-labels"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4513,27 +4521,32 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__Wendif_labels=yes
+  pgac_cv_prog_CC_cflags__Wendif_labels=yes
 else
-  pgac_cv_prog_cc_cflags__Wendif_labels=no
+  pgac_cv_prog_CC_cflags__Wendif_labels=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wendif_labels" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__Wendif_labels" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__Wendif_labels" = x"yes"; then
-  CFLAGS="$CFLAGS -Wendif-labels"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wendif_labels" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__Wendif_labels" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__Wendif_labels" = x"yes"; then
+  CFLAGS="${CFLAGS} -Wendif-labels"
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wmissing-format-attribute" >&5
-$as_echo_n "checking whether $CC supports -Wmissing-format-attribute... " >&6; }
-if ${pgac_cv_prog_cc_cflags__Wmissing_format_attribute+:} false; then :
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wmissing-format-attribute, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -Wmissing-format-attribute, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__Wmissing_format_attribute+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wmissing-format-attribute"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -Wmissing-format-attribute"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4548,28 +4561,33 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__Wmissing_format_attribute=yes
+  pgac_cv_prog_CC_cflags__Wmissing_format_attribute=yes
 else
-  pgac_cv_prog_cc_cflags__Wmissing_format_attribute=no
+  pgac_cv_prog_CC_cflags__Wmissing_format_attribute=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wmissing_format_attribute" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__Wmissing_format_attribute" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__Wmissing_format_attribute" = x"yes"; then
-  CFLAGS="$CFLAGS -Wmissing-format-attribute"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wmissing_format_attribute" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__Wmissing_format_attribute" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__Wmissing_format_attribute" = x"yes"; then
+  CFLAGS="${CFLAGS} -Wmissing-format-attribute"
 fi
 
+
   # This was included in -Wall/-Wformat in older GCC versions
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wformat-security" >&5
-$as_echo_n "checking whether $CC supports -Wformat-security... " >&6; }
-if ${pgac_cv_prog_cc_cflags__Wformat_security+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-security, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -Wformat-security, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__Wformat_security+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wformat-security"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -Wformat-security"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4584,28 +4602,33 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__Wformat_security=yes
+  pgac_cv_prog_CC_cflags__Wformat_security=yes
 else
-  pgac_cv_prog_cc_cflags__Wformat_security=no
+  pgac_cv_prog_CC_cflags__Wformat_security=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wformat_security" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__Wformat_security" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__Wformat_security" = x"yes"; then
-  CFLAGS="$CFLAGS -Wformat-security"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wformat_security" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__Wformat_security" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__Wformat_security" = x"yes"; then
+  CFLAGS="${CFLAGS} -Wformat-security"
 fi
 
+
   # Disable strict-aliasing rules; needed for gcc 3.3+
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5
-$as_echo_n "checking whether $CC supports -fno-strict-aliasing... " >&6; }
-if ${pgac_cv_prog_cc_cflags__fno_strict_aliasing+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__fno_strict_aliasing+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -fno-strict-aliasing"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -fno-strict-aliasing"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4620,28 +4643,33 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__fno_strict_aliasing=yes
+  pgac_cv_prog_CC_cflags__fno_strict_aliasing=yes
 else
-  pgac_cv_prog_cc_cflags__fno_strict_aliasing=no
+  pgac_cv_prog_CC_cflags__fno_strict_aliasing=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__fno_strict_aliasing" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__fno_strict_aliasing" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__fno_strict_aliasing" = x"yes"; then
-  CFLAGS="$CFLAGS -fno-strict-aliasing"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__fno_strict_aliasing" = x"yes"; then
+  CFLAGS="${CFLAGS} -fno-strict-aliasing"
 fi
 
+
   # Disable optimizations that assume no overflow; needed for gcc 4.3+
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fwrapv" >&5
-$as_echo_n "checking whether $CC supports -fwrapv... " >&6; }
-if ${pgac_cv_prog_cc_cflags__fwrapv+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fwrapv, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -fwrapv, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__fwrapv+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -fwrapv"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -fwrapv"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4656,28 +4684,33 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__fwrapv=yes
+  pgac_cv_prog_CC_cflags__fwrapv=yes
 else
-  pgac_cv_prog_cc_cflags__fwrapv=no
+  pgac_cv_prog_CC_cflags__fwrapv=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__fwrapv" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__fwrapv" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__fwrapv" = x"yes"; then
-  CFLAGS="$CFLAGS -fwrapv"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fwrapv" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__fwrapv" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__fwrapv" = x"yes"; then
+  CFLAGS="${CFLAGS} -fwrapv"
 fi
 
+
   # Disable FP optimizations that cause various errors on gcc 4.5+ or maybe 4.6+
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fexcess-precision=standard" >&5
-$as_echo_n "checking whether $CC supports -fexcess-precision=standard... " >&6; }
-if ${pgac_cv_prog_cc_cflags__fexcess_precision_standard+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fexcess-precision=standard, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -fexcess-precision=standard, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__fexcess_precision_standard+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -fexcess-precision=standard"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -fexcess-precision=standard"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4692,28 +4725,32 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__fexcess_precision_standard=yes
+  pgac_cv_prog_CC_cflags__fexcess_precision_standard=yes
 else
-  pgac_cv_prog_cc_cflags__fexcess_precision_standard=no
+  pgac_cv_prog_CC_cflags__fexcess_precision_standard=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__fexcess_precision_standard" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__fexcess_precision_standard" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__fexcess_precision_standard" = x"yes"; then
-  CFLAGS="$CFLAGS -fexcess-precision=standard"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fexcess_precision_standard" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__fexcess_precision_standard" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__fexcess_precision_standard" = x"yes"; then
+  CFLAGS="${CFLAGS} -fexcess-precision=standard"
 fi
 
+
   # Optimization flags for specific files that benefit from vectorization
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -funroll-loops" >&5
-$as_echo_n "checking whether $CC supports -funroll-loops... " >&6; }
-if ${pgac_cv_prog_cc_cflags__funroll_loops+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -funroll-loops, for CFLAGS_VECTOR" >&5
+$as_echo_n "checking whether ${CC} supports -funroll-loops, for CFLAGS_VECTOR... " >&6; }
+if ${pgac_cv_prog_CC_cflags__funroll_loops+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -funroll-loops"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS_VECTOR} -funroll-loops"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4728,27 +4765,31 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__funroll_loops=yes
+  pgac_cv_prog_CC_cflags__funroll_loops=yes
 else
-  pgac_cv_prog_cc_cflags__funroll_loops=no
+  pgac_cv_prog_CC_cflags__funroll_loops=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__funroll_loops" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__funroll_loops" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__funroll_loops" = x"yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__funroll_loops" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__funroll_loops" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__funroll_loops" = x"yes"; then
   CFLAGS_VECTOR="${CFLAGS_VECTOR} -funroll-loops"
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -ftree-vectorize" >&5
-$as_echo_n "checking whether $CC supports -ftree-vectorize... " >&6; }
-if ${pgac_cv_prog_cc_cflags__ftree_vectorize+:} false; then :
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -ftree-vectorize, for CFLAGS_VECTOR" >&5
+$as_echo_n "checking whether ${CC} supports -ftree-vectorize, for CFLAGS_VECTOR... " >&6; }
+if ${pgac_cv_prog_CC_cflags__ftree_vectorize+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -ftree-vectorize"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS_VECTOR} -ftree-vectorize"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4763,30 +4804,34 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__ftree_vectorize=yes
+  pgac_cv_prog_CC_cflags__ftree_vectorize=yes
 else
-  pgac_cv_prog_cc_cflags__ftree_vectorize=no
+  pgac_cv_prog_CC_cflags__ftree_vectorize=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__ftree_vectorize" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__ftree_vectorize" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__ftree_vectorize" = x"yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__ftree_vectorize" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__ftree_vectorize" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__ftree_vectorize" = x"yes"; then
   CFLAGS_VECTOR="${CFLAGS_VECTOR} -ftree-vectorize"
 fi
 
+
   # We want to suppress clang's unhelpful unused-command-line-argument warnings
   # but gcc won't complain about unrecognized -Wno-foo switches, so we have to
   # test for the positive form and if that works, add the negative form
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wunused-command-line-argument" >&5
-$as_echo_n "checking whether $CC supports -Wunused-command-line-argument... " >&6; }
-if ${pgac_cv_prog_cc_cflags__Wunused_command_line_argument+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__Wunused_command_line_argument+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -Wunused-command-line-argument"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4801,33 +4846,38 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__Wunused_command_line_argument=yes
+  pgac_cv_prog_CC_cflags__Wunused_command_line_argument=yes
 else
-  pgac_cv_prog_cc_cflags__Wunused_command_line_argument=no
+  pgac_cv_prog_CC_cflags__Wunused_command_line_argument=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__Wunused_command_line_argument" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__Wunused_command_line_argument" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__Wunused_command_line_argument" = x"yes"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wunused_command_line_argument" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__Wunused_command_line_argument" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__Wunused_command_line_argument" = x"yes"; then
   NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wunused-command-line-argument"
 fi
 
+
   if test -n "$NOT_THE_CFLAGS"; then
     CFLAGS="$CFLAGS -Wno-unused-command-line-argument"
   fi
 elif test "$ICC" = yes; then
   # Intel's compiler has a bug/misoptimization in checking for
   # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -mp1" >&5
-$as_echo_n "checking whether $CC supports -mp1... " >&6; }
-if ${pgac_cv_prog_cc_cflags__mp1+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -mp1, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -mp1, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__mp1+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -mp1"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -mp1"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4842,28 +4892,33 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__mp1=yes
+  pgac_cv_prog_CC_cflags__mp1=yes
 else
-  pgac_cv_prog_cc_cflags__mp1=no
+  pgac_cv_prog_CC_cflags__mp1=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__mp1" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__mp1" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__mp1" = x"yes"; then
-  CFLAGS="$CFLAGS -mp1"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__mp1" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__mp1" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__mp1" = x"yes"; then
+  CFLAGS="${CFLAGS} -mp1"
 fi
 
+
   # Make sure strict aliasing is off (though this is said to be the default)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-strict-aliasing" >&5
-$as_echo_n "checking whether $CC supports -fno-strict-aliasing... " >&6; }
-if ${pgac_cv_prog_cc_cflags__fno_strict_aliasing+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -fno-strict-aliasing, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__fno_strict_aliasing+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -fno-strict-aliasing"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -fno-strict-aliasing"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4878,29 +4933,34 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__fno_strict_aliasing=yes
+  pgac_cv_prog_CC_cflags__fno_strict_aliasing=yes
 else
-  pgac_cv_prog_cc_cflags__fno_strict_aliasing=no
+  pgac_cv_prog_CC_cflags__fno_strict_aliasing=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__fno_strict_aliasing" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__fno_strict_aliasing" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__fno_strict_aliasing" = x"yes"; then
-  CFLAGS="$CFLAGS -fno-strict-aliasing"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__fno_strict_aliasing" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__fno_strict_aliasing" = x"yes"; then
+  CFLAGS="${CFLAGS} -fno-strict-aliasing"
 fi
 
+
 elif test "$PORTNAME" = "aix"; then
   # AIX's xlc has to have strict aliasing turned off too
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -qnoansialias" >&5
-$as_echo_n "checking whether $CC supports -qnoansialias... " >&6; }
-if ${pgac_cv_prog_cc_cflags__qnoansialias+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -qnoansialias, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -qnoansialias, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__qnoansialias+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -qnoansialias"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -qnoansialias"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4915,27 +4975,32 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__qnoansialias=yes
+  pgac_cv_prog_CC_cflags__qnoansialias=yes
 else
-  pgac_cv_prog_cc_cflags__qnoansialias=no
+  pgac_cv_prog_CC_cflags__qnoansialias=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__qnoansialias" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__qnoansialias" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__qnoansialias" = x"yes"; then
-  CFLAGS="$CFLAGS -qnoansialias"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__qnoansialias" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__qnoansialias" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__qnoansialias" = x"yes"; then
+  CFLAGS="${CFLAGS} -qnoansialias"
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -qlonglong" >&5
-$as_echo_n "checking whether $CC supports -qlonglong... " >&6; }
-if ${pgac_cv_prog_cc_cflags__qlonglong+:} false; then :
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -qlonglong, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -qlonglong, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__qlonglong+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS -qlonglong"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} -qlonglong"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4950,30 +5015,35 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags__qlonglong=yes
+  pgac_cv_prog_CC_cflags__qlonglong=yes
 else
-  pgac_cv_prog_cc_cflags__qlonglong=no
+  pgac_cv_prog_CC_cflags__qlonglong=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__qlonglong" >&5
-$as_echo "$pgac_cv_prog_cc_cflags__qlonglong" >&6; }
-if test x"$pgac_cv_prog_cc_cflags__qlonglong" = x"yes"; then
-  CFLAGS="$CFLAGS -qlonglong"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__qlonglong" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__qlonglong" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__qlonglong" = x"yes"; then
+  CFLAGS="${CFLAGS} -qlonglong"
 fi
 
+
 elif test "$PORTNAME" = "hpux"; then
   # On some versions of HP-UX, libm functions do not set errno by default.
   # Fix that by using +Olibmerrno if the compiler recognizes it.
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports +Olibmerrno" >&5
-$as_echo_n "checking whether $CC supports +Olibmerrno... " >&6; }
-if ${pgac_cv_prog_cc_cflags_pOlibmerrno+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports +Olibmerrno, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports +Olibmerrno, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags_pOlibmerrno+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
-CFLAGS="$pgac_save_CFLAGS +Olibmerrno"
+pgac_save_CC=$CC
+CC=${CC}
+CFLAGS="${CFLAGS} +Olibmerrno"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4988,20 +5058,22 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_cc_cflags_pOlibmerrno=yes
+  pgac_cv_prog_CC_cflags_pOlibmerrno=yes
 else
-  pgac_cv_prog_cc_cflags_pOlibmerrno=no
+  pgac_cv_prog_CC_cflags_pOlibmerrno=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags_pOlibmerrno" >&5
-$as_echo "$pgac_cv_prog_cc_cflags_pOlibmerrno" >&6; }
-if test x"$pgac_cv_prog_cc_cflags_pOlibmerrno" = x"yes"; then
-  CFLAGS="$CFLAGS +Olibmerrno"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags_pOlibmerrno" >&5
+$as_echo "$pgac_cv_prog_CC_cflags_pOlibmerrno" >&6; }
+if test x"$pgac_cv_prog_CC_cflags_pOlibmerrno" = x"yes"; then
+  CFLAGS="${CFLAGS} +Olibmerrno"
 fi
 
+
 fi
 
 CFLAGS_VECTOR=$CFLAGS_VECTOR