Skip to content

Commit fa1d1cd

Browse files
author
ripley
committed
omit -std=gnu23 for the upcoming gcc-15
git-svn-id: https://svn.r-project.org/R/trunk@88157 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 19c4481 commit fa1d1cd

File tree

3 files changed

+83
-10
lines changed

3 files changed

+83
-10
lines changed

config.site

+7-5
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
## which runs the compiler, for example 'c99'.
4545
## It is also necessary to set the architecture here, e.g. 'gcc -m32'.
4646
## If this is a wrapper it should pass on --version to the real compiler.
47+
## This will be replaced by CC23 (see below) if a C23 compiler is found.
4748
## CC=
4849

4950
## Debugging and optimization options for the C compiler.
@@ -69,11 +70,12 @@
6970

7071
## Ditto for a compiler that supports C23 features.
7172
## For example 'CC23=clang-15 -std=gnu2x'
72-
## -std=gnu2x is supported by at least GCC >= 12, LLVM clang >= 15 and Apple clang >= 16
73-
## Eventually -std=gnu23 will be supported and preferred
74-
## (and is by GCC >= 14 and LLVM >= 18).
75-
## Default to CC and CFLAGS with any -std options removed, then
76-
## -std=gmu2x appended to CC.
73+
## This is the default for GCC >= 15.
74+
## -std=gnu23 is addeds where supported
75+
## (it is by GCC >= 14, LLVM clang >= 18 and Apple Clang >= 17).
76+
## -std=gnu2x is supported by at least GCC 12-14, LLVM clang >= 15 and Apple clang >= 16
77+
## Default to CC and CFLAGS with any -std options removed, then with
78+
## -std=gmu23 then -std=gmu2x appended to CC
7779
## CC23=
7880
## C23FLAGS=
7981

configure

+62-3
Original file line numberDiff line numberDiff line change
@@ -8116,7 +8116,8 @@ CC_save=${CC}
81168116
CFLAGS_save=${CFLAGS}
81178117
CC_SUB=`echo "${CC}" | sed 's/-std=[^ ]*//'`
81188118
CFLAGS_SUB=`echo "${CFLAGS}" | sed -e 's/-std=[^ ]*//'`
8119-
: ${CC23="${CC_SUB} -std=gnu23"}
8119+
## try first without any additional -std
8120+
: ${CC23="${CC_SUB}"}
81208121
: ${C23FLAGS="${CFLAGS_SUB}"}
81218122
CC=${CC23}
81228123
CFLAGS=${C23FLAGS}
@@ -8169,6 +8170,63 @@ fi
81698170
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $r_cv_C23" >&5
81708171
printf "%s\n" "$r_cv_C23" >&6; }
81718172

8173+
8174+
if test x${r_cv_C23} = xno; then
8175+
CC23="${CC_SUB} -std=gnu23"
8176+
C23FLAGS="${CFLAGS_SUB}"
8177+
CC=${CC23}
8178+
CFLAGS=${C23FLAGS}
8179+
unset r_cv_C23
8180+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${CC} is a C23 compiler" >&5
8181+
printf %s "checking whether ${CC} is a C23 compiler... " >&6; }
8182+
if test ${r_cv_C23+y}
8183+
then :
8184+
printf %s "(cached) " >&6
8185+
else case e in #(
8186+
e) if test "$cross_compiling" = yes
8187+
then :
8188+
r_cv_C23=no
8189+
else case e in #(
8190+
e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8191+
/* end confdefs.h. */
8192+
8193+
#ifdef __STDC_VERSION__
8194+
# if __STDC_VERSION__ < 202000L
8195+
# error "Compiler does not claim C23 conformance"
8196+
# endif
8197+
#else
8198+
# error "Compiler does not advertise ISO C conformance"
8199+
#endif
8200+
8201+
// Most new features have feature tests. but bool type is fundamental.
8202+
8203+
int main(void) {
8204+
bool x = true;
8205+
8206+
return 0;
8207+
}
8208+
8209+
8210+
_ACEOF
8211+
if ac_fn_c_try_run "$LINENO"
8212+
then :
8213+
r_cv_C23=yes
8214+
else case e in #(
8215+
e) r_cv_C23=no ;;
8216+
esac
8217+
fi
8218+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
8219+
conftest.$ac_objext conftest.beam conftest.$ac_ext ;;
8220+
esac
8221+
fi
8222+
;;
8223+
esac
8224+
fi
8225+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $r_cv_C23" >&5
8226+
printf "%s\n" "$r_cv_C23" >&6; }
8227+
8228+
fi
8229+
81728230
if test x${r_cv_C23} = xno; then
81738231
unset r_cv_C23
81748232
CC23="${CC_SUB} -std=gnu2x"
@@ -8222,6 +8280,7 @@ fi
82228280
printf "%s\n" "$r_cv_C23" >&6; }
82238281

82248282
fi
8283+
82258284
if test x${r_cv_C23} = xno; then
82268285
CC23=
82278286
C23FLAGS=
@@ -27550,7 +27609,7 @@ _ACEOF
2755027609
# flags.
2755127610
r_save_CFLAGS=$CFLAGS
2755227611
CFLAGS="$CFLAGS $r_verb"
27553-
(eval echo $as_me:27553: \"$ac_link\") >&5
27612+
(eval echo $as_me:27612: \"$ac_link\") >&5
2755427613
r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
2755527614
echo "$r_c_v_output" >&5
2755627615
CFLAGS=$r_save_CFLAGS
@@ -27628,7 +27687,7 @@ _ACEOF
2762827687
# flags.
2762927688
r_save_CFLAGS=$CFLAGS
2763027689
CFLAGS="$CFLAGS $r_cv_prog_c_v"
27631-
(eval echo $as_me:27631: \"$ac_link\") >&5
27690+
(eval echo $as_me:27690: \"$ac_link\") >&5
2763227691
r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
2763327692
echo "$r_c_v_output" >&5
2763427693
CFLAGS=$r_save_CFLAGS

configure.ac

+14-2
Original file line numberDiff line numberDiff line change
@@ -761,19 +761,31 @@ CC_save=${CC}
761761
CFLAGS_save=${CFLAGS}
762762
CC_SUB=`echo "${CC}" | sed 's/-std=[[^ ]]*//'`
763763
CFLAGS_SUB=`echo "${CFLAGS}" | sed -e 's/-std=[[^ ]]*//'`
764-
dnl this is a hack until -std=gnu23 is widely accepted.
765-
: ${CC23="${CC_SUB} -std=gnu23"}
764+
## try first without any additional -std
765+
: ${CC23="${CC_SUB}"}
766766
: ${C23FLAGS="${CFLAGS_SUB}"}
767767
CC=${CC23}
768768
CFLAGS=${C23FLAGS}
769769
unset r_cv_C23
770770
R_C23
771+
772+
if test x${r_cv_C23} = xno; then
773+
CC23="${CC_SUB} -std=gnu23"
774+
C23FLAGS="${CFLAGS_SUB}"
775+
CC=${CC23}
776+
CFLAGS=${C23FLAGS}
777+
unset r_cv_C23
778+
R_C23
779+
fi
780+
781+
dnl this is a hack until -std=gnu23 is widely accepted.
771782
if test x${r_cv_C23} = xno; then
772783
unset r_cv_C23
773784
CC23="${CC_SUB} -std=gnu2x"
774785
CC=${CC23}
775786
R_C23
776787
fi
788+
777789
if test x${r_cv_C23} = xno; then
778790
CC23=
779791
C23FLAGS=

0 commit comments

Comments
 (0)