@@ -2818,6 +2818,58 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
28182818ac_compiler_gnu=$ac_cv_c_compiler_gnu
28192819
28202820
2821+ # Check if it's Intel's compiler, which (usually) pretends to be gcc,
2822+ # but has idiosyncrasies of its own. We assume icc will define
2823+ # __INTEL_COMPILER regardless of CFLAGS.
2824+
2825+ cat >conftest.$ac_ext <<_ACEOF
2826+ /* confdefs.h. */
2827+ _ACEOF
2828+ cat confdefs.h >>conftest.$ac_ext
2829+ cat >>conftest.$ac_ext <<_ACEOF
2830+ /* end confdefs.h. */
2831+
2832+ int
2833+ main ()
2834+ {
2835+ #ifndef __INTEL_COMPILER
2836+ choke me
2837+ #endif
2838+ ;
2839+ return 0;
2840+ }
2841+ _ACEOF
2842+ rm -f conftest.$ac_objext
2843+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2844+ (eval $ac_compile) 2>conftest.er1
2845+ ac_status=$?
2846+ grep -v '^ *+' conftest.er1 >conftest.err
2847+ rm -f conftest.er1
2848+ cat conftest.err >&5
2849+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
2850+ (exit $ac_status); } &&
2851+ { ac_try='test -z "$ac_c_werror_flag"
2852+ || test ! -s conftest.err'
2853+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2854+ (eval $ac_try) 2>&5
2855+ ac_status=$?
2856+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
2857+ (exit $ac_status); }; } &&
2858+ { ac_try='test -s conftest.$ac_objext'
2859+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2860+ (eval $ac_try) 2>&5
2861+ ac_status=$?
2862+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
2863+ (exit $ac_status); }; }; then
2864+ ICC=yes
2865+ else
2866+ echo "$as_me: failed program was:" >&5
2867+ sed 's/^/| /' conftest.$ac_ext >&5
2868+
2869+ ICC=no
2870+ fi
2871+ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2872+
28212873unset CFLAGS
28222874
28232875#
@@ -2846,12 +2898,15 @@ fi
28462898
28472899# Some versions of GCC support some additional useful warning flags.
28482900# Check whether they are supported, and add them to CFLAGS if so.
2849-
2850- if test "$GCC" = yes; then
2851-
28522901# ICC pretends to be GCC but it's lying; it doesn't support these options.
2853- # So we have to check if "GCC" is really ICC.
28542902
2903+ if test "$GCC" = yes -a "$ICC" = no; then
2904+ CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith -Winline"
2905+ # These work in some but not all gcc versions
2906+ echo "$as_me:$LINENO: checking if $CC supports -Wdeclaration-after-statement" >&5
2907+ echo $ECHO_N "checking if $CC supports -Wdeclaration-after-statement... $ECHO_C" >&6
2908+ pgac_save_CFLAGS=$CFLAGS
2909+ CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement"
28552910cat >conftest.$ac_ext <<_ACEOF
28562911/* confdefs.h. */
28572912_ACEOF
@@ -2862,9 +2917,7 @@ cat >>conftest.$ac_ext <<_ACEOF
28622917int
28632918main ()
28642919{
2865- #ifndef __INTEL_COMPILER
2866- choke me
2867- #endif
2920+
28682921 ;
28692922 return 0;
28702923}
@@ -2891,22 +2944,22 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
28912944 ac_status=$?
28922945 echo "$as_me:$LINENO: \$? = $ac_status" >&5
28932946 (exit $ac_status); }; }; then
2894- ICC=yes
2947+ echo "$as_me:$LINENO: result: yes" >&5
2948+ echo "${ECHO_T}yes" >&6
28952949else
28962950 echo "$as_me: failed program was:" >&5
28972951sed 's/^/| /' conftest.$ac_ext >&5
28982952
2899- ICC=no
2953+ CFLAGS="$pgac_save_CFLAGS"
2954+ echo "$as_me:$LINENO: result: no" >&5
2955+ echo "${ECHO_T}no" >&6
29002956fi
29012957rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
29022958
2903- if test "$ICC" = no; then
2904- CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith -Winline"
2905-
2906- echo "$as_me:$LINENO: checking if $CC supports -Wdeclaration-after-statement" >&5
2907- echo $ECHO_N "checking if $CC supports -Wdeclaration-after-statement... $ECHO_C" >&6
2959+ echo "$as_me:$LINENO: checking if $CC supports -Wendif-labels" >&5
2960+ echo $ECHO_N "checking if $CC supports -Wendif-labels... $ECHO_C" >&6
29082961pgac_save_CFLAGS=$CFLAGS
2909- CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement "
2962+ CFLAGS="$pgac_save_CFLAGS -Wendif-labels "
29102963cat >conftest.$ac_ext <<_ACEOF
29112964/* confdefs.h. */
29122965_ACEOF
@@ -2956,10 +3009,11 @@ echo "${ECHO_T}no" >&6
29563009fi
29573010rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
29583011
2959- echo "$as_me:$LINENO: checking if $CC supports -Wendif-labels" >&5
2960- echo $ECHO_N "checking if $CC supports -Wendif-labels... $ECHO_C" >&6
3012+ # Disable strict-aliasing rules; needed for gcc 3.3+
3013+ echo "$as_me:$LINENO: checking if $CC supports -fno-strict-aliasing" >&5
3014+ echo $ECHO_N "checking if $CC supports -fno-strict-aliasing... $ECHO_C" >&6
29613015pgac_save_CFLAGS=$CFLAGS
2962- CFLAGS="$pgac_save_CFLAGS -Wendif-labels "
3016+ CFLAGS="$pgac_save_CFLAGS -fno-strict-aliasing "
29633017cat >conftest.$ac_ext <<_ACEOF
29643018/* confdefs.h. */
29653019_ACEOF
@@ -3009,11 +3063,10 @@ echo "${ECHO_T}no" >&6
30093063fi
30103064rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
30113065
3012- else
3013- # Intel compiler has a bug/misoptimization in checking for
3014- # division by NAN (NaN == 0), -mp1 fixes it, so add it to the
3015- # CFLAGS.
3016- echo "$as_me:$LINENO: checking if $CC supports -mp1" >&5
3066+ elif test "$ICC" = yes; then
3067+ # Intel's compiler has a bug/misoptimization in checking for
3068+ # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
3069+ echo "$as_me:$LINENO: checking if $CC supports -mp1" >&5
30173070echo $ECHO_N "checking if $CC supports -mp1... $ECHO_C" >&6
30183071pgac_save_CFLAGS=$CFLAGS
30193072CFLAGS="$pgac_save_CFLAGS -mp1"
@@ -3066,9 +3119,7 @@ echo "${ECHO_T}no" >&6
30663119fi
30673120rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
30683121
3069- fi
3070-
3071- # Disable strict-aliasing rules; needed for gcc 3.3+
3122+ # Not clear if this is needed, but seems like a good idea
30723123 echo "$as_me:$LINENO: checking if $CC supports -fno-strict-aliasing" >&5
30733124echo $ECHO_N "checking if $CC supports -fno-strict-aliasing... $ECHO_C" >&6
30743125pgac_save_CFLAGS=$CFLAGS