GNOME Bugzilla – Bug 89622
[BUILD] -Wall and -Werror break non gcc compilers
Last modified: 2004-12-22 21:47:04 UTC
I tried to build gstreamer from cvs. the flags -Wall and -Werror are not supported in forte I had to edit configure.ac -AS_VERSION(gstreamer, GST_VERSION, 0, 4, 0, 1, GST_ERROR="-Wall", GST_ERROR="-Wall -Werror") +AS_VERSION(gstreamer, GST_VERSION, 0, 4, 0, 1, GST_ERROR="", GST_ERROR="") could you only set these flags if it finds a compilers which supports them? it is also hard coded in some of the makefiles Regards Shaun
Never used forte before ;) can you tell me how I go about detecting this in the configure.ac file ? thanks
[i think this should be reopened] you can check say the $GCC varaible to see whetever the compiler (as presented in $CC/$CXX) is gcc or no and use gcc specific options only when the compiler is actually gcc.
this macro GNOME_COMPILE_WARNINGS in gnome-common/macros2/compiler-flags.m4 seems to be the thing we need I have found examples of its use in these packages hope this helps ./src-2.0n-160802/libbonobo/configure.in ./src-2.0n-160802/gnome-vfs/configure.in ./src-2.0n-160802/libgnomecanvas/configure.in ./src-2.0n-160802/libgnome/configure.in ./src-2.0n-160802/libbonoboui/configure.in ./src-2.0n-160802/libgnomeui/configure.in ./src-2.0n-160802/libgnomeprint/configure.in ./src-2.0n-160802/libgnomeprintui/configure.in ./src-2.0n-160802/gnome-desktop/configure.in ./src-2.0n-160802/gnome-panel/configure.in ./src-2.0n-160802/gnome-session/configure.in ./src-2.0n-160802/at-spi/configure.in ./src-2.0n-160802/gnome-utils/configure.in ./src-2.0n-160802/gnome-control-center/configure.in ./src-2.0n-160802/gnome-applets/configure.in ./src-2.0n-160802/yelp/configure.in ./src-2.0n-160802/eog/configure.in ./src-2.0n-160802/ghex/configure.in ./src-2.0n-160802/gperfmeter/configure.in ./src-2.0n-160802/gprocview/configure.in ./src-2.0n-160802/gok/configure.in ./src-2.0n-160802/gnome-speech/configure.in ./src-2.0n-160802/at-poke/configure.in ./src-2.0n-160802/gnopernicus/configure.in ./src-2.0n-160802/gnome-mag/configure.in ./src-2.0n-160802/galf/configure.in
*** Bug 89574 has been marked as a duplicate of this bug. ***
*** Bug 87823 has been marked as a duplicate of this bug. ***
Ok, since I am over on RH8 this is starting to bite me too, thomas do you have any fix for this in the horizon? Or is configure.in editing the solution atm :)
Christian, you're bitten by another bug ;) AFAIK you still use gcc ;)
Sander does Forte have something similar to -Wall and -Werror?
<Uraeus> laca: when my question is simply; is there some equivalents to -Wall and -Werror in Forte? <laca> -Wall: the forte default is to show all warnings <laca> -Werror: -errwarn=<t> Treats warnings specified by tags t(%none, %all, <tag list>) as errors
*** Bug 99816 has been marked as a duplicate of this bug. ***
I'm copying this information from my other bug, which was marked as a duplicate of this one. Following is a technique that glib uses to only include -Wall and -Werror if gcc is the compiler being used: --glib example start-- if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[[\ \ ]]-Wall[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac if test "x$enable_ansi" = "xyes"; then case " $CFLAGS " in *[[\ \ ]]-ansi[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -ansi" ;; esac case " $CFLAGS " in *[[\ \ ]]-pedantic[[\ \ ]]*) ;; *) CFLAGS="$CFLAGS -pedantic" ;; esac fi fi
Actually we want to make this fix the opposite, that instead of checking for gcc we check for Forte and if Forte is used then we don't use -Wall -Werror
I'm not sure that is a good solution - it will just mean that whenever somebody goes to compile with a compiler that is not gcc they will need yet another workaround. Compiler / environment specific flags should only be set if you know that the result is going to be valid.
I guess the question here is if -Wall and -Werror can be assumed to exist in most C compilers or not. If it is just gcc and a few others I guess checking for gcc is the solution. However if -Wall and -Werror exist in most C compilers except Forte and a few others I guess checking for Forte is the right solution.
*** Bug 103582 has been marked as a duplicate of this bug. ***
Ok, just marked a bug of my result trying to compile GStreamer with the Intel Linux compiler and it to barfs due to -Wall. I think we can assume that making -Wall only used for gcc is the correct solution.
fixed in cvs for forte. I'll need access to an intel compiler if I want to do somethign similar there.