@@ -2818,6 +2818,58 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
2818
2818
ac_compiler_gnu=$ac_cv_c_compiler_gnu
2819
2819
2820
2820
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
+
2821
2873
unset CFLAGS
2822
2874
2823
2875
#
@@ -2846,12 +2898,15 @@ fi
2846
2898
2847
2899
# Some versions of GCC support some additional useful warning flags.
2848
2900
# Check whether they are supported, and add them to CFLAGS if so.
2849
-
2850
- if test "$GCC" = yes; then
2851
-
2852
2901
# 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.
2854
2902
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"
2855
2910
cat >conftest.$ac_ext <<_ACEOF
2856
2911
/* confdefs.h. */
2857
2912
_ACEOF
@@ -2862,9 +2917,7 @@ cat >>conftest.$ac_ext <<_ACEOF
2862
2917
int
2863
2918
main ()
2864
2919
{
2865
- #ifndef __INTEL_COMPILER
2866
- choke me
2867
- #endif
2920
+
2868
2921
;
2869
2922
return 0;
2870
2923
}
@@ -2891,22 +2944,22 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2891
2944
ac_status=$?
2892
2945
echo "$as_me:$LINENO: \$? = $ac_status" >&5
2893
2946
(exit $ac_status); }; }; then
2894
- ICC=yes
2947
+ echo "$as_me:$LINENO: result: yes" >&5
2948
+ echo "${ECHO_T}yes" >&6
2895
2949
else
2896
2950
echo "$as_me: failed program was:" >&5
2897
2951
sed 's/^/| /' conftest.$ac_ext >&5
2898
2952
2899
- ICC=no
2953
+ CFLAGS="$pgac_save_CFLAGS"
2954
+ echo "$as_me:$LINENO: result: no" >&5
2955
+ echo "${ECHO_T}no" >&6
2900
2956
fi
2901
2957
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2902
2958
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
2908
2961
pgac_save_CFLAGS=$CFLAGS
2909
- CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement "
2962
+ CFLAGS="$pgac_save_CFLAGS -Wendif-labels "
2910
2963
cat >conftest.$ac_ext <<_ACEOF
2911
2964
/* confdefs.h. */
2912
2965
_ACEOF
@@ -2956,10 +3009,11 @@ echo "${ECHO_T}no" >&6
2956
3009
fi
2957
3010
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2958
3011
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
2961
3015
pgac_save_CFLAGS=$CFLAGS
2962
- CFLAGS="$pgac_save_CFLAGS -Wendif-labels "
3016
+ CFLAGS="$pgac_save_CFLAGS -fno-strict-aliasing "
2963
3017
cat >conftest.$ac_ext <<_ACEOF
2964
3018
/* confdefs.h. */
2965
3019
_ACEOF
@@ -3009,11 +3063,10 @@ echo "${ECHO_T}no" >&6
3009
3063
fi
3010
3064
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3011
3065
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
3017
3070
echo $ECHO_N "checking if $CC supports -mp1... $ECHO_C" >&6
3018
3071
pgac_save_CFLAGS=$CFLAGS
3019
3072
CFLAGS="$pgac_save_CFLAGS -mp1"
@@ -3066,9 +3119,7 @@ echo "${ECHO_T}no" >&6
3066
3119
fi
3067
3120
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3068
3121
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
3072
3123
echo "$as_me:$LINENO: checking if $CC supports -fno-strict-aliasing" >&5
3073
3124
echo $ECHO_N "checking if $CC supports -fno-strict-aliasing... $ECHO_C" >&6
3074
3125
pgac_save_CFLAGS=$CFLAGS
0 commit comments