William Stein wrote:
> On Fri, Oct 2, 2009 at 3:42 AM, Dr. David Kirkby
> <david.kir...@onetel.net> wrote:
>> I was thinking of making some changes to sage-env, with the main aim of
>> improving portability and getting rid of GNUisms. I'd be intersted in
>> any thoughts on the following, or other things which could be done. I've
>> also made some changes to 'prereq-0.4',
>>
>> http://sage.math.washington.edu/home/kirkby/Solaris-fixes/prereq-0.4/
>>
>> which don't overlap with this.
>>
>> My thoughts were
>>
>> 1) Define 5 new environment variables used for creating shared libraries.
>>
>>  * SAGE_SHARED_FLAG,
>>  * SAGE_SONAME_FLAG
>>  * SAGE_WHOLE_ARCHIVE_FLAG
>>  * SAGE_NO_WHOLE_ARCHIVE_FLAG
>>  * SAGE_FPIC_FLAG
>>
>> For gnu compilers, these would be set to
>>
>> -shared
>> -soname
>> -whole-archive
>> -no-whole-archieve
>> -fPIC
>>
>> For other compilers, they would be set to whatever the compilers need.
>>
>> In the case of Sun's compilers, for 32-bit code they are:
>>
>> -G
>> -h
>> -z allextract
>> -z defaultextract
>> -KPIC
>>
>> That should mean any time where -fPIC is seen as a compiler option, it
>> just needs replacing by $SAGE_FPIC and would work with any compiler.
>>
>> I'll try to find out what the names are for some of the other compilers
>> (IBM's on AIX, HP's on HP-UX etc).
>>
>> Other things I intended doing are:
>>
>> 2) Check 'make' is GNU make, as I don't believe we have a hope in hell
>> of building Sage with any other make.
>>
>> 3) Check 'tar' is GNU tar.
>>
>> 4) Check carefully for the type of compiler - Intel, Sun, GNU etc, by
>> checking what the pre-processor defines. That should be a pretty
>> reliable test.
>>
>> 5) Add new environment variables SAGE_LINKER and SAGE_ASSEMBLER setting
>> that to GNU, Sun, etc.
>>
>> To do that I need to try to work out what linker the compiler uses in
>> the case of gcc. On Solaris at least, it's not too easy to tell, though
>> most people do build gcc on Solaris with flags like
>>
>> --without-gnu-ld
>> --with-ld=/usr/ccs/bin/ld
>> --without-gnu-as
>> --with-as=/usr/ccs/bin/as
>>
>> gcc -v will show these.
>>
>> However, there is no requirement to do so. But any time I've seen a GCC
>> distribution (that in /usr/sfw/bin, sunfreeware.com, blastwave.org,
>> anything I've built...), these have been defined, so it is possible to
>> work out what linker and assembler are used in any case I know of.
>>
>> 6) Issue a warning if gcc is used on Solaris, and I can't work out what
>> the linker and/or assembler is.
>>
>> 7) Check there is not a mix of GNU and non-GNU compilers. This is also
>> done in my revised 'prereq' but checking in two places will do no harm,
>> and might pick up some problems if someone manages to screw up their build.
>>
>> Do these seem reasonable?
> 
> +100
> 
> Yes, definitely.  They are all the sort of thing that I would have
> liked to do long ago, but didn't have the patience to figure out how
> to do right.  Props to you for working on this!
> 
> William

I'll make those changes.

We also need an environment variable to set a flag for 64-bit code, as 
while both gcc and Sun's compilers use '-m64', this is not universal 
among all compilers. IBM's compiler on AIX uses -q64, and HP's on HP-UX 
uses +DD64. I think we better let a user set that, though default to 
-m64 except in cases where it is known that is not correct.



--~--~---------~--~----~------------~-------~--~----~
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
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to