From dd480fdb7e563c94a1bcb94c9bc73d2963e9d645 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 29 Feb 2016 22:41:18 +0000 Subject: [PATCH] Updated configure script for GCC6, and in general cleaned up some obsolete cruft. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3293 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- Changes.txt | 4 ++++ configure | 68 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/Changes.txt b/Changes.txt index 0432626b2..eaf70afae 100644 --- a/Changes.txt +++ b/Changes.txt @@ -23,6 +23,10 @@ adding and subtracting, but also fixes compile-time warnings that I couldn't get rid of before. + * Updated UNIX configure script to work with GCC 6.x compilers, and to + remove references to obsolete compiler versions that can no longer + be used to compile Stella. + -Have fun! diff --git a/configure b/configure index 5be1b5a44..0d90a4f0a 100755 --- a/configure +++ b/configure @@ -94,13 +94,13 @@ echocheck () { test_compiler () { cat <tmp_cxx_compiler.cpp +#include class Foo { int a; }; -int main(int argc, char **argv) +int main(int argc, char* argv[]) { - Foo *a = new Foo(); - delete a; + std::shared_ptr a = std::make_shared(); return 0; } EOF @@ -363,7 +363,7 @@ else fi for compiler in $compilers; do - if test_compiler $compiler; then + if test_compiler "$compiler -std=c++11"; then CXX=$compiler echo $CXX break @@ -379,34 +379,25 @@ fi echocheck "compiler version" +have_clang=no +cc_check_define __clang_version__ && have_clang=yes have_gcc=no cc_check_define __GNUC__ && have_gcc=yes -if test "$have_gcc" = yes; then +if test "$have_clang" = yes; then cxx_name=`( $cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1` - cxx_version=`( $CXX -dumpversion ) 2>&1` + cxx_version=$( $CXX -dM -E -x c /dev/null | grep __clang_version__ | sed 's/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/g' 2>&1) if test "$?" -gt 0; then cxx_version="not found" fi 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][-.]*|5.[0-9]|5.[0-9].[0-9]|5.[0-9].[0-9][-.]*|6.[0-9]|6.[0-9].[0-9]|6.[0-9].[0-9][-.]*) + [3].[4-9]|[3].[4-9].[0-9]|[3].[4-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 - _mxx_minor=4 - ;; 'not found') cxx_verc_fail=yes ;; @@ -415,13 +406,40 @@ if test "$have_gcc" = yes; then cxx_verc_fail=yes ;; esac - if test "$_cxx_major" -ge "3" ; then - CXXFLAGS="$CXXFLAGS" - _make_def_HAVE_GCC3='HAVE_GCC3 = 1' - add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' - fi; + CXXFLAGS="$CXXFLAGS" + _make_def_HAVE_GCC3='HAVE_GCC3 = 1' + add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' _make_def_HAVE_GCC='HAVE_GCC = 1' echo "$cxx_version" + +elif test "$have_gcc" = yes; then + cxx_name=`( $cc -v ) 2>&1 | tail -n 1 | cut -d ' ' -f 1` + cxx_version=`( $CXX -dumpversion ) 2>&1` + if test "$?" -gt 0; then + cxx_version="not found" + fi + + case $cxx_version in + 4.[7-9]|4.[7-9].[0-9]|4.[7-9].[0-9][-.]*|[5-6].[0-9]|[5-6].[0-9].[0-9]|[5-6].[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 + ;; + 'not found') + cxx_verc_fail=yes + ;; + *) + cxx_version="$cxx_version, bad" + cxx_verc_fail=yes + ;; + esac + CXXFLAGS="$CXXFLAGS" + _make_def_HAVE_GCC3='HAVE_GCC3 = 1' + add_line_to_config_mk 'CXX_UPDATE_DEP_FLAG = -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" -MQ "$@" -MP' + _make_def_HAVE_GCC='HAVE_GCC = 1' + echo "$cxx_version" + else cxx_version=`( $CXX -version ) 2>&1` if test "$?" -eq 0; then @@ -467,8 +485,8 @@ fi if test "$cxx_verc_fail" = yes ; then echo echo "The version of your compiler is not supported at this time" - echo "Please ensure you are using GCC 2.95.x or GCC 3.x" - #exit 1 + echo "Please ensure you are using GCC 4.7 / Clang 3.4 or above" + exit 1 fi #