Opened 14 years ago
Closed 14 years ago
Last modified 4 years ago
#9069 closed patch
Add support for non-gcc compilers to configure, Makefile etc
|Reported by:||SF/canavan||Owned by:||fingolfin|
Currently, configure fails for any compilers that don't support -dumpversion and adds numerous gcc-only Warning flags even if this check is circumvented. This patch adds some basic infrastructure to support non-gcc compilers and adds actual support for one, namely MipsPRO on IRIX.
Ticket imported from: #2838507. Ticket imported from: patches/1174.
Change History (8)
by , 14 years ago
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Now that sourceforge has eaten my carefully crafted comment, a shorter version will ahve to do.
7.4.4 is most likely the only wokring version of the MipsPRO C++ compiler, since it fixes a bunch of tempolate handling bugs that outright prevent older versions (at least 7.4.1) from compiling scummvm. I assume that there is at least a 99% probablility that a non-gcc compiler on IRIX is MipsPRO, but it would be trivial to add another check for that.
-lm and -lfastm are the math libraries that contain trigonometric, exp/log, rounding etc. routines, libfastm just has some less precise but faster versions. gcc links libm automatically when needed, CC doesn't and requires at least -lm to be added to scummvm's link command.
I believe a generic flag is a better option, since the branch in the Makeifle can be recycled for other compilers. I think SUN's C++ compiler should be able to use the same feature by just substituting -xM for -MDupdate.
comment:3 by , 14 years ago
SF.net ate your comment? Man, I fully sympathize, it's kind of refreshing to hear that I am not the only one it happens to (luckily, it's far less bad these days then it used to be a couple months ago). Really really annoying :(.
Regarding CXX_UPDATE_DEP_FLAG -- looking at the Sun C++ docs, it seems that its -xMMD option mirrors the -MMD option of GCC, so that looks as if it could be used to also provide an intelligent build rule.
But what I find more convincing now that I looked at the patch once more is that the GCC3 rule could also be modified to use CXX_UPDATE_DEP_FLAG.
The Sun C++ (and maybe also the MipsPRO?) build rule would still be dumber than the GCC3 one, esp. since there seems to be no equivalent of -MP, but well, so be it.
comment:4 by , 14 years ago
I committed a modified version of this patch. It would be good if you could test it on your system to see if it still works there.
comment:5 by , 14 years ago
|Status:||new → closed|
comment:6 by , 13 years ago
configure seems to be working so far, but there's still one issue i had forgotten about: With templates, one cannot use ar, but has to use CC -ptused -ar -o. Since configure sets _ar automatically, with no manual method to override, one needs seomthing like the patch below:
--- configure (revision 44403) +++ configure (working copy) @@ -1218,6 +1218,9 @@ irix*) DEFINES="$DEFINES -DUNIX -DIRIX -DSYSTEM_NOT_SUPPORTING_D_TYPE" LIBS="$LIBS -lmd -lfastm -lm" + if test "$have_gcc" != yes; then + _ar="$CXX -ptused -quiet_prelink -ar -o" + fi _ranlib=: ;; darwin*) @@ -1648,6 +1651,16 @@ add_to_config_mk_if_yes "$_verbose_build" 'VERBOSE_BUILD = 1'
# +# Check whether AR and/or ARFLAGS is set +# +if test -n "$AR"; then + _ar="$AR"; +fi +if test -n "$ARFLAGS"; then + _ar="$_ar $ARFLAGS"; +fi + +# # Check whether plugin support is requested and possible # echo_n "Checking whether building plugins was requested... "
comment:7 by , 4 years ago
Hi there, first off, thanks for your patch! Adding support for other compilers seems like a good idea, in principle. In particular, it's a good idea to add an HAVE_GCC flag.
However, I am a bit wary of the way this is done here. Essentially, the patch assumes that if a non-GCC compiler is found on IRIX, then it is MipsPRO. Well, actually, not quite true: It also requires the version of that compiler to be 7.4.4*, else it'll bail out, too.
Also, this patch does more than advertised: It sets some special flags on IRIX:
- LIBS="$LIBS -lmd " + LIBS="$LIBS -lmd -lfastm -lm" + if test "$HAVE_GCC" -ne 1 ; then + add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MDupdate' + fi
I have to wonder, what do -lfastm and -lm do? Are those compatible with GCC?
Finally, a new variable "CXX_UPDATE_DEP_FLAG" is introduced, which seems to be there to take advantage of a MIPSPro feature, yet the name sounds as if it was something generic. To me it would seem to make more sense to have a HAVE_MIPSPRO flag for that. Or at least a HAVE_MIPSPRO_UPDATE_DEP_OPTION.