Skip to content

Commit a53dd3c

Browse files
committed
updated for version 7.4.048
Problem: Recent clang version complains about -fno-strength-reduce. Solution: Add a configure check for the clang version. (Kazunobu Kuriyama)
1 parent 68f317f commit a53dd3c

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

src/auto/configure

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3989,6 +3989,24 @@ if test "$GCC" = yes; then
39893989
fi
39903990
fi
39913991

3992+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent clang version" >&5
3993+
$as_echo_n "checking for recent clang version... " >&6; }
3994+
CLANG_VERSION_STRING=`"$CC" --version 2>/dev/null | sed -n -e 's/^.*clang.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'`
3995+
if test x"$CLANG_VERSION_STRING" != x"" ; then
3996+
CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*/\1/p'`
3997+
CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/p'`
3998+
CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)/\1/p'`
3999+
CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
4000+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLANG_VERSION" >&5
4001+
$as_echo "$CLANG_VERSION" >&6; }
4002+
if test "$CLANG_VERSION" -ge 500002075 ; then
4003+
CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'`
4004+
fi
4005+
else
4006+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
4007+
$as_echo "no" >&6; }
4008+
fi
4009+
39924010
if test "$cross_compiling" = yes; then
39934011
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot compile a simple program; if not cross compiling check CC and CFLAGS" >&5
39944012
$as_echo "cannot compile a simple program; if not cross compiling check CC and CFLAGS" >&6; }

src/configure.in

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ if test "$GCC" = yes; then
6262
fi
6363
fi
6464

65+
dnl clang-500.2.75 or around has abandoned -f[no-]strength-reduce and issues a
66+
dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on
67+
dnl the version number of the clang in use.
68+
dnl Note that this does not work to get the version of clang 3.1 or 3.2.
69+
AC_MSG_CHECKING(for recent clang version)
70+
CLANG_VERSION_STRING=`"$CC" --version 2>/dev/null | sed -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'`
71+
if test x"$CLANG_VERSION_STRING" != x"" ; then
72+
CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
73+
CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
74+
CLANG_REVISION=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)/\1/p'`
75+
CLANG_VERSION=`expr $CLANG_MAJOR '*' 1000000 '+' $CLANG_MINOR '*' 1000 '+' $CLANG_REVISION`
76+
AC_MSG_RESULT($CLANG_VERSION)
77+
dnl If you find the same issue with versions earlier than 500.2.75,
78+
dnl change the constant 500002075 below appropriately. To get the
79+
dnl integer corresponding to a version number, refer to the
80+
dnl definition of CLANG_VERSION above.
81+
if test "$CLANG_VERSION" -ge 500002075 ; then
82+
CFLAGS=`echo "$CFLAGS" | sed -n -e 's/-fno-strength-reduce/ /p'`
83+
fi
84+
else
85+
AC_MSG_RESULT(no)
86+
fi
87+
6588
dnl If configure thinks we are cross compiling, there might be something
6689
dnl wrong with the CC or CFLAGS settings, give a useful warning message
6790
if test "$cross_compiling" = yes; then

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
48,
741743
/**/
742744
47,
743745
/**/

0 commit comments

Comments
 (0)