Jeroen Demeyer on Fri, 05 Sep 2008 19:50:15 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Cross compiling PARI/what about autoconf?

Bill Allombert wrote:
On Thu, Sep 04, 2008 at 12:13:08PM +0200, Jeroen Demeyer wrote:
Karim Belabas wrote:
3) I noticed that a lot of checks in PARI use things like #ifdef UNIX or #ifdef __GNUC__, instead of checking for the features that you want. So these things should be changed, and then you might as well use GNU configure for that.

The symbol __GNUC__ is checked in _public_ headers file. This is
necessary, because once PARI is configured, build and installed
with one compiler, users might very well compile PARI programms
with _another_ compiler, and it would be wrong to assume both compilers
have the same features.
Good point. Just as a reference, I checked /usr/include/gmp.h and it also has lots of #ifdef's like that, for example to check for "inline".

I doubt one can write an autoconf macro that display the double
endianness (what config/get_double_format does) and support
That is very likely not possible. However there are various possible solutions: (1) Use a run-time check. In pari_init(), check the endianness of doubles and use that. This will however (slightly) slow down the code dealing with doubles. (2) Use some guessing depending on the machine type. Essentially a "database" of CPU architectures. Add a flag to Configure to override this choice or if the machine cannot be found in the "database". (3) Use C89 math functions instead of relying on any internal representation of double. What you are doing in dbltor() and related functions can be done using the C89 functions frexp() and modf(). This might also slow down the code.

I personally prefer (3).