aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Avtalion2010-04-09 12:23:43 +0000
committerOri Avtalion2010-04-09 12:23:43 +0000
commitf2f0e1aa67dda73aeba9caa6dd62edbfbf992947 (patch)
tree44df43525fe2f837c646caeb55c3f70680dd9493
parent7d97ee48e6c903ba850e38fb3b76c14e75b23e85 (diff)
downloadscummvm-rg350-f2f0e1aa67dda73aeba9caa6dd62edbfbf992947.tar.gz
scummvm-rg350-f2f0e1aa67dda73aeba9caa6dd62edbfbf992947.tar.bz2
scummvm-rg350-f2f0e1aa67dda73aeba9caa6dd62edbfbf992947.zip
Simplify GCC version tests, add support for the clang compiler
svn-id: r48594
-rw-r--r--Makefile4
-rwxr-xr-xconfigure80
2 files changed, 47 insertions, 37 deletions
diff --git a/Makefile b/Makefile
index 3ad8bff09f..66861d05e8 100644
--- a/Makefile
+++ b/Makefile
@@ -44,6 +44,10 @@ ifeq "$(HAVE_GCC)" "1"
#CXXFLAGS+= -O -Wuninitialized
endif
+ifeq "$(HAVE_CLANG)" "1"
+ CXXFLAGS+= -Wno-conversion -Wno-shorten-64-to-32 -Wno-sign-compare -Wno-four-char-constants
+endif
+
#######################################################################
# Default commands - put the necessary replacements in config.mk #
#######################################################################
diff --git a/configure b/configure
index a6ca6cba9d..2f6edb933e 100755
--- a/configure
+++ b/configure
@@ -190,6 +190,23 @@ cc_check() {
return "$TMP"
}
+cc_check_define() {
+cat > $TMPC << EOF
+int main(void) {
+ #ifdef $1
+ return 1;
+ #endif
+ return 0;
+}
+EOF
+ cc_check && $TMPO$HOSTEXEEXT
+ return $?
+}
+
+gcc_get_define() {
+ $CXX -dM -E - < /dev/null | fgrep -m 1 "$1" | cut -d ' ' -f 3-
+}
+
#
# Function to provide echo -n for bourne shells that don't have it
#
@@ -1066,9 +1083,31 @@ LD=$CXX
echocheck "compiler version"
have_gcc=no
-cxx_version=`( $CXX -dumpversion ) 2>&1`
-if test "$?" -gt 0; then
- # TODO: Big scary warning about unsupported Compilers
+cc_check_define __GNUC__
+if test "$?" -eq 1; then
+ have_gcc=yes
+fi
+
+if test "$have_gcc" = yes; then
+ add_line_to_config_mk 'HAVE_GCC = 1'
+ _cxx_major=`gcc_get_define __GNUC__`
+ _cxx_minor=`gcc_get_define __GNUC_MINOR__`
+ cxx_version="`( $CXX -dumpversion ) 2>&1`"
+
+ if test -n "`gcc_get_define __clang__`"; then
+ add_line_to_config_mk 'HAVE_CLANG = 1'
+ fi
+
+ if test "$_cxx_major" -eq 2 && test "$_cxx_minor" -ge 95 || \
+ test "$_cxx_major" -gt 2 ; then
+ cxx_version="$cxx_version, ok"
+ cxx_verc_fail=no
+ else
+ cxx_version="$cxx_version, bad"
+ cxx_verc_fail=yes
+ fi
+else
+ # TODO: Big scary warning about unsupported compilers
cxx_version=`( $CXX -version ) 2>&1`
if test "$?" -eq 0; then
cxx_version="`echo "${cxx_version}" | sed -ne 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/gp'`"
@@ -1082,39 +1121,7 @@ if test "$?" -gt 0; then
cxx_verc_fail=yes
echo found non-gcc compiler version ${cxx_version}
fi
-else
- add_line_to_config_mk 'HAVE_GCC = 1'
- have_gcc=yes
-fi
-if test "$have_gcc" = yes; then
- case $cxx_version in
- 2.95.[2-9]|2.95.[2-9][-.]*|3.[0-9]|3.[0-9].[0-9]|3.[0-9].[0-9][-.]*|4.[0-9]|4.[0-9].[0-9]|4.[0-9].[0-9][-.]*)
- _cxx_major=`echo $cxx_version | cut -d '.' -f 1`
- _cxx_minor=`echo $cxx_version | cut -d '.' -f 2`
- cxx_version="$cxx_version, ok"
- cxx_verc_fail=no
- ;;
- # whacky beos version strings
- 2.9-beos-991026*|2.9-beos-000224*)
- _cxx_major=2
- _cxx_minor=95
- cxx_version="$cxx_version, ok"
- cxx_verc_fail=no
- ;;
- 3_4)
- _cxx_major=3
- _cxx_minor=4
- ;;
- 'not found')
- cxx_verc_fail=yes
- ;;
- *)
- cxx_version="$cxx_version, bad"
- cxx_verc_fail=yes
- ;;
- esac
-else
case $_host_os in
irix*)
case $cxx_version in
@@ -1136,7 +1143,6 @@ else
cxx_verc_fail=yes
;;
esac
-
fi
echo "$cxx_version"
@@ -2361,7 +2367,7 @@ if test "$have_gcc" = yes ; then
;;
esac
add_line_to_config_mk 'HAVE_GCC3 = 1'
- add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP'
+ add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP'
fi;
if test "$_cxx_major" -ge "4" && test "$_cxx_minor" -ge "3" ; then