The README.txt says

SUPPORTED COMPILERS:
     * Sage builds with GCC >= 3.x and GCC >= 4.1.x.
     * Sage will not build with GCC 2.9.x.
     * WARNING: Don't build with GCC 4.0.0, which is very buggy.
     * Sage has never been built without using GCC compiler.


Yet from what I gather, people on OS X are using 4.0.1 with success. 
I've also herd it said that gcc < 3.4 will not work.



I'm trying to put some sensible tests for the compilers - the current 
'configure' script is lacking in places. I'll show you what I have to date.


My aim is to do these things.

1) Allows non-GNU compilers, but issues a warning when compilers are not GNU
2) Checks if gcc is version is 4.0.0 and if so exits
3) Checks if version is less than 3.4.0 and if so exits. (but is 3.4.0 
the sensible number)?
4) Checks if gcc4 is at least 4.0.1
5) Checks that if the C compiler is gcc, then the C++ compiler is g++, 
and will now allow mixing compilers.
6) Checks the versions of gcc and g++ are the same, if the GNU tools are 
used.

i.e. this throws an error

checking gcc version... 3.4.3
checking if gcc accepts -dumpversion option... yes
checking gxx version... 4.4.1
configure: error: gcc and g++ must be the same version

7) I hope to extend this to fortran - somewhat more difficult to do in 
fact.

I'm defining:

Buggy_gcc_version="4.0.0"
Sage_minimum_gcc3_version="3.4.0"
Sage_minimum_gcc4_version="4.0.1"

Are those ok? If not, what should they be? Should they be different for 
OS X?


This is what I have as a basic configure.ac (this uses M4 macros, do 
don't try to build it, but you should get the idea what it does).

I really need to know what compiler versions to accept, and what to 
reject, as things that are said on sage-devel and things that it says in 
README.txt are not the same.

If we are going to permit 4.0.1 on OS X, but not anywhere else, then I'd 
need to come up with a test for that.


Dave

AC_PREREQ(2.62)
AC_COPYRIGHT([GPL version 2])
AC_INIT([Sage],[version], sage-devel@googlegroups.com)
AC_CONFIG_SRCDIR([Sage.c])

AM_INIT_AUTOMAKE([1.9.6 foreign])

#---------------------------------------------------------
#   Hardware architecture
#
AC_CANONICAL_HOST

#---------------------------------------------------------
#       C/C++ compilers

AC_LANG(C)
AC_LANG(C++)
AC_LANG(Fortran)
AC_PROG_CC()
AC_PROG_CXX()
AC_PROG_F77([gfortran g95])
AC_PROG_CPP

Buggy_gcc_version="4.0.0"
Sage_minimum_gcc3_version="3.4.0"
Sage_minimum_gcc4_version="4.0.1"
if test x$GCC = xyes
then
     dnl Check if C++ compiler is g++. If not, there is a problem.
     dnl as mixing GNU and non-GNU compilers is likely to cause problems.
     if test x$GXX != xyes
     then
        AC_MSG_WARN([You are trying to use gcc but not g++])
        AC_MSG_ERROR([The mixing of GNU and non-GNU compilers is not 
permitted])
     fi
     dnl do likewise with the Fortran compiler (not working yet)
     if test x$G77 != xyes
     then
        AC_MSG_WARN([You are trying to use gcc but not a GNU Fortran 
compiler])
        AC_MSG_ERROR([The mixing of GNU and non-GNU compilers is not 
permitted])
     fi

     dnl Thank you to Andrew W. Nosenko andrew.w.nose...@gmail.com who 
answered my query about
     dnl testing of gcc versions on the autoc...@gnu.org mailing list.
     dnl AS_VERSION_COMPARE(ver-1, ver-2, [action-if-less], 
[action-if-eq], [action-if-greater])
     AX_GCC_VERSION
     AX_GXX_VERSION
     AS_VERSION_COMPARE([$GCC_VERSION], [$GXX_VERSION],
     [AC_MSG_ERROR([gcc and g++ must be the same version])],
     [],
     [AC_MSG_ERROR([gcc and g++ must be the same version])])

     dnl Exit if the version of GCC is known to be buggy.
     AS_VERSION_COMPARE([$GCC_VERSION], [$Buggy_gcc_version],[],
         [
         AC_MSG_WARN([GCC $Buggy_gcc_version is very buggy and can not 
build AC_PACKAGE_NAME. Please use])
         AC_MSG_WARN([a GCC 3.x version of at least 
$Sage_minimum_gcc3_version or a GCC 4.x version])
         AC_MSG_WARN([of at least $Sage_minimum_gcc4_version. (GCC 
$Buggy_gcc_version is too bug ridden)])
         AC_MSG_ERROR([Exiting due to the use of a buggy GCC])
         ]
     , [])
     dnl Exit if the version of GCC is known to be too old
     AS_VERSION_COMPARE([$GCC_VERSION], [$Sage_minimum_gcc3_version],[
         AC_MSG_WARN([GCC $GCC_VERSION is too old and can not build 
AC_PACKAGE_NAME. Please use])
         AC_MSG_WARN([a GCC 3.x version of at least 
$Sage_minimum_gcc3_version or a GCC 4.x version])
         AC_MSG_WARN([of at least $Sage_minimum_gcc4_version. (GCC 
$Buggy_gcc_version is too bug ridden)])
         AC_MSG_ERROR([Exiting due to the use of a version of GCC that 
is too old])
     ], [],[])

     dnl AS_VERSION_COMPARE(ver-1, ver-2, [action-if-less], 
[action-if-eq], [action-if-greater])
else
     AC_MSG_WARN([You have a non-GNU compiler, but AC_PACKAGE_NAME has 
never been built])
     AC_MSG_WARN([successfully with any compiler other than GCC, despite])
     AC_MSG_WARN([some attempts made on Solaris to use Sun's compiler, 
which])
     AC_MSG_WARN([produces faster code than GCC. However, the 
AC_PACKAGE_NAME developers])
     AC_MSG_WARN([want AC_PACKAGE_NAME to work with other compilers, so 
please try.])
     AC_MSG_WARN([The developers would welcome any feedback you can give.])
     AC_MSG_WARN([If you just want to use AC_PACKAGE_NAME, we suggest 
the use of])
     AC_MSG_WARN([a GCC 3.x version of at least 
$Sage_minimum_gcc3_version or a GCC 4.x version])
     AC_MSG_WARN([of at least $Sage_minimum_gcc4_version. (GCC 
$Buggy_gcc_version is too bug ridden)])
fi

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])

AC_OUTPUT

AC_CONFIG_MACRO_DIR([m4])

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to