Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf9ea6a

Browse files
committed
Adjust configure so that it sets CFLAGS properly for Intel's icc
even if the compiler is not defining __GNUC__. Per report fromDirk Tilger that it is possible for icc to not do that.
1 parentc8b7e81 commitdf9ea6a

File tree

2 files changed

+96
-46
lines changed

2 files changed

+96
-46
lines changed

‎configure

Lines changed: 77 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,58 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
28182818
ac_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+
28212873
unset 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"
28552910
cat >conftest.$ac_ext <<_ACEOF
28562911
/* confdefs.h. */
28572912
_ACEOF
@@ -2862,9 +2917,7 @@ cat >>conftest.$ac_ext <<_ACEOF
28622917
int
28632918
main ()
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
28952949
else
28962950
echo "$as_me: failed program was:" >&5
28972951
sed '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
29002956
fi
29012957
rm -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
29082961
pgac_save_CFLAGS=$CFLAGS
2909-
CFLAGS="$pgac_save_CFLAGS -Wdeclaration-after-statement"
2962+
CFLAGS="$pgac_save_CFLAGS -Wendif-labels"
29102963
cat >conftest.$ac_ext <<_ACEOF
29112964
/* confdefs.h. */
29122965
_ACEOF
@@ -2956,10 +3009,11 @@ echo "${ECHO_T}no" >&6
29563009
fi
29573010
rm -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
29613015
pgac_save_CFLAGS=$CFLAGS
2962-
CFLAGS="$pgac_save_CFLAGS -Wendif-labels"
3016+
CFLAGS="$pgac_save_CFLAGS -fno-strict-aliasing"
29633017
cat >conftest.$ac_ext <<_ACEOF
29643018
/* confdefs.h. */
29653019
_ACEOF
@@ -3009,11 +3063,10 @@ echo "${ECHO_T}no" >&6
30093063
fi
30103064
rm -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
30173070
echo $ECHO_N "checking if $CC supports -mp1... $ECHO_C" >&6
30183071
pgac_save_CFLAGS=$CFLAGS
30193072
CFLAGS="$pgac_save_CFLAGS -mp1"
@@ -3066,9 +3119,7 @@ echo "${ECHO_T}no" >&6
30663119
fi
30673120
rm -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
30733124
echo $ECHO_N "checking if $CC supports -fno-strict-aliasing... $ECHO_C" >&6
30743125
pgac_save_CFLAGS=$CFLAGS

‎configure.in

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.522 2007/07/19 17:15:30 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.523 2007/08/0515:43:00 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -243,6 +243,13 @@ esac
243243

244244
AC_PROG_CC([$pgac_cc_list])
245245

246+
# Check if it's Intel's compiler, which (usually) pretends to be gcc,
247+
# but has idiosyncrasies of its own. We assume icc will define
248+
# __INTEL_COMPILER regardless of CFLAGS.
249+
AC_TRY_COMPILE([], [@%:@ifndef __INTEL_COMPILER
250+
choke me
251+
@%:@endif], [ICC=[yes]], [ICC=[no]])
252+
246253
unset CFLAGS
247254

248255
#
@@ -271,29 +278,21 @@ fi
271278

272279
# Some versions of GCC support some additional useful warning flags.
273280
# Check whether they are supported, and add them to CFLAGS if so.
274-
275-
if test "$GCC" = yes; then
276-
277281
# ICC pretends to be GCC but it's lying; it doesn't support these options.
278-
# So we have to check if "GCC" is really ICC.
279-
AC_TRY_COMPILE([], [@%:@ifndef __INTEL_COMPILER
280-
choke me
281-
@%:@endif], [ICC=[yes]], [ICC=[no]])
282-
283-
if test "$ICC" = no; then
284-
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith -Winline"
285-
286-
PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
287-
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
288-
else
289-
# Intel compiler has a bug/misoptimization in checking for
290-
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the
291-
# CFLAGS.
292-
PGAC_PROG_CC_CFLAGS_OPT([-mp1])
293-
fi
294282

283+
if test "$GCC" = yes -a "$ICC" = no; then
284+
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wpointer-arith -Winline"
285+
# These work in some but not all gcc versions
286+
PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
287+
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
295288
# Disable strict-aliasing rules; needed for gcc 3.3+
296289
PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
290+
elif test "$ICC" = yes; then
291+
# Intel's compiler has a bug/misoptimization in checking for
292+
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.
293+
PGAC_PROG_CC_CFLAGS_OPT([-mp1])
294+
# Not clear if this is needed, but seems like a good idea
295+
PGAC_PROG_CC_CFLAGS_OPT([-fno-strict-aliasing])
297296
elif test x"${CC}" = x"xlc"; then
298297
# AIX xlc has to have strict aliasing turned off too
299298
PGAC_PROG_CC_CFLAGS_OPT([-qnoansialias])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp