[Xvid-devel] GCC version check issue
Motofumi Oka
chikuzen.mo at gmail.com
Wed Sep 14 00:58:54 CEST 2011
Hi.
The current GCC version check has an issue when cross-compiling on a
non-native environment.
For example, should someone try to compile a windows binary with mingw on
linux, it wouldn't work at all and cause an error in all cases where wine
wouldn't be around to launch the binary.
With a win64 build it would just fail with wine as well, unless wine64 is
used (which is experimental and not exactly found on many systems).
Thus, I think that the version check should be changed as follows:
diff --git a/build/generic/configure.in b/build/generic/configure.in
index cd54056..a1a2cc6 100644
--- a/build/generic/configure.in
+++ b/build/generic/configure.in
@@ -649,26 +655,8 @@ dnl Some gcc flags can't be used for gcc >= 3.4.0
dnl ==============================
============================================
if test "$GCC" = "yes" ; then
-cat << EOF > test.c
-#include <stdio.h>
-int main(int argc, char **argv)
-{
- if (*argv[[1]] == 'M') {
- printf("%d", __GNUC__);
- }
- if (*argv[[1]] == 'm') {
- printf("%d", __GNUC_MINOR__);
- }
- return 0;
-}
-EOF
- $CC -o gcc-ver test.c
-
- GCC_MAJOR=`./gcc-ver M`
- GCC_MINOR=`./gcc-ver m`
-
- rm -f test.c
- rm -f gcc-ver
+ GCC_MAJOR=`$CC -dumpversion | cut -d . -f 1`
+ GCC_MINOR=`$CC -dumpversion | cut -d . -f 2`
# GCC 4.x
if test "${GCC_MAJOR}" -gt 3 ; then
More information about the Xvid-devel
mailing list