Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 128828 - vim 7 beta configure regex detects wrong gcc version
Summary: vim 7 beta configure regex detects wrong gcc version
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-04 14:52 UTC by vvy
Modified: 2006-05-09 03:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vvy 2006-04-04 14:52:45 UTC
The configure script of vim[-core]-7.0_beta has a broken regex that will detect gcc's major version as 2 or lower if $CC contains a numeral, e.g. CC=gcc will work, but CC=i686-pc-linux-gnu-gcc won't. The build will then omit some header magic I don't understand and maybe do something else, but still compile.

The problem lies with line 5 of the following configure snippet:

echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
echo $ECHO_N "checking for GCC 3 or later... $ECHO_C" >&6
DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
  gccmajor=`"$CC" --version | sed -e '2,$d;s/^[^0-9]*\(darwin.[^0-9]*\)*\([1-9]\
)\.[0-9].*$/\2/g'`
  if test "$gccmajor" -gt "2"; then
    DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
  fi
fi
if test "$DEPEND_CFLAGS_FILTER" = ""; then
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
else
  echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
fi

To have configure use the gcc-major-version as reported by portage, I added this ugly mother before econf in my vim.eclass:

sed 's#`"$CC" --version | sed -e '\''2,$d\;s/^\[^0-9\]\*\\(darwin.\[^0-9\]\*\\)\*\\(\[1-9\]\\)\\\.\[0-9\]\.\*\$/\\2/g'\'\`#$(gcc-major-version)# -i src/auto/configure

I wonder if that is a general autoconf bug?
Comment 1 vvy 2006-04-04 14:57:54 UTC
Sorry, got a line break in there. In the code snippet, everything from gccmajor= to the last backtick goes into one line.
Comment 2 vvy 2006-04-04 15:02:50 UTC
Sorry, line breaks in the ugly hotfix as well. Aw shoot.
Comment 3 Ciaran McCreesh 2006-04-05 00:32:42 UTC
What's the relevant autoconf check?
Comment 4 vvy 2006-04-05 04:07:35 UTC
I'm not sure what you mean... "checking for GCC 3 or later"? Btw, I think now that this is just a vim problem and not a general autoconf bug. In configure.in, they seem to have added the following section:

dnl gcc 3.1 changed the meaning of -MM.  The only solution appears to be to
dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
dnl But only when making dependencies, cproto and lint don't take "-isystem".
dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
dnl the number before the version number.
AC_MSG_CHECKING(for GCC 3 or later)
DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
  gccmajor=`"$CC" --version | sed -e '2,$d;s/^[[^0-9]]*\(darwin.[[^0-9]]*\)*\([[
1-9]]\)\.[[0-9]].*$/\2/g'`
  if test "$gccmajor" -gt "2"; then
    DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
  fi
fi
if test "$DEPEND_CFLAGS_FILTER" = ""; then
  AC_MSG_RESULT(no)
else
  AC_MSG_RESULT(yes)
fi
AC_SUBST(DEPEND_CFLAGS_FILTER)
Comment 5 vvy 2006-05-09 03:16:29 UTC
Fixed upstream in vim 7 final