Re: GCC version check issue
Michael Militzer <[email protected]> Wed, 14 Sep 2011 12:54:24 +0200
| Newsgroups | gmane.comp.video.xvid.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, well, I don't quite agree with your conclusion that cross-compiling a windows binary with mingw from linux "wouldn't work at all". For me, the following commands produce a 64-bit windows binary successfully from linux also without wine available: ./configure --host=x86_64-pc-mingw32 --build=i386-pc-linux-gnu make I agree however that your proposal for performing the gcc version check is the better solution. So your patch got applied. Thank you. Regards, Michael Quoting Motofumi Oka <[email protected]>: > 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 > _______________________________________________ > Xvid-devel mailing list > [email protected] > http://list.xvid.org/mailman/listinfo/xvid-devel > >