public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* configure and asinl function problem
@ 2005-10-08 10:10 Joost Kraaijeveld
  2005-10-08 13:40 ` Tim Prince
  0 siblings, 1 reply; 9+ messages in thread
From: Joost Kraaijeveld @ 2005-10-08 10:10 UTC (permalink / raw)
  To: Cygwin

Hi,

I am trying to compile MICO, a CRBA implementation. It uses configure
for it's configuration.

Using "AC_CHECK_FUNCS(infnanl isnanl isinfl asinl ldexpl frexpl fabsl
floorl ceill):" in configure.in results in  "#define HAVE_ASINL 1" in
config.h

This appears however to be not true: during the actual compilation the
compiler complains when encountering the function. There is actually no
header that defines the function, so the compiler is right ;-).

According to a mail I found on internet
(http://www.mico.org/pipermail/mico-devel/2005-March/009248.html) this
happens because configure does not uses a compiler header but creates
its own function prototype and the function is included in the libraries
(as far as I can see it appears to be in libstdc++.a) 

1. Is the diagnose of the problem correct (I have looked into the macros
but I have to admit that I do not understand what they do) ?
2. If so, is there a solution for this problem?
3. If stdc++ contains asinl, is there a reason why it is not used?

TIA


-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-08 10:10 configure and asinl function problem Joost Kraaijeveld
@ 2005-10-08 13:40 ` Tim Prince
  2005-10-08 14:10   ` Joost Kraaijeveld
  0 siblings, 1 reply; 9+ messages in thread
From: Tim Prince @ 2005-10-08 13:40 UTC (permalink / raw)
  To: Joost Kraaijeveld; +Cc: Cygwin

Joost Kraaijeveld wrote:
> Hi,
> 
> I am trying to compile MICO, a CRBA implementation. It uses configure
> for it's configuration.
> 
> Using "AC_CHECK_FUNCS(infnanl isnanl isinfl asinl ldexpl frexpl fabsl
> floorl ceill):" in configure.in results in  "#define HAVE_ASINL 1" in
> config.h
> 
> This appears however to be not true: during the actual compilation the
> compiler complains when encountering the function. There is actually no
> header that defines the function, so the compiler is right ;-).
> 
> According to a mail I found on internet
> (http://www.mico.org/pipermail/mico-devel/2005-March/009248.html) this
> happens because configure does not uses a compiler header but creates
> its own function prototype and the function is included in the libraries
> (as far as I can see it appears to be in libstdc++.a) 
> 
> 1. Is the diagnose of the problem correct (I have looked into the macros
> but I have to admit that I do not understand what they do) ?
> 2. If so, is there a solution for this problem?
> 3. If stdc++ contains asinl, is there a reason why it is not used?
> 
Maybe you have omitted information, which might explain why you 
discarded some obvious possibilities, but here are some points:
newlib doesn't include full support for long double math, as you hinted.
You could supply your own asinl() (easy way: use the built in x87 
atan2l())).
If the function you want is in libstdc++, gcc doesn't see it, but g++ 
should see it.
You could fix the config.h manually, if, for example, you have a reason 
for running it only under g++, but you want the result to be applicable 
to gcc as well.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-08 13:40 ` Tim Prince
@ 2005-10-08 14:10   ` Joost Kraaijeveld
       [not found]     ` <4347D8DF.6080804@cygwin.com>
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Joost Kraaijeveld @ 2005-10-08 14:10 UTC (permalink / raw)
  To: tprince; +Cc: Cygwin

On Sat, 2005-10-08 at 06:40 -0700, Tim Prince wrote: 
> Maybe you have omitted information, which might explain why you 
> discarded some obvious possibilities, but here are some points:
> newlib doesn't include full support for long double math, as you hinted.
The problem is that configure seems to think that there *is* support 
"long double math": the test succeeds and HAVE_ASINL (and all other
double math) is defined. So both compile and link appear to be succesful
as far as configure is concerned.

Before choosing a solution, I want to understand why the problem is
occuring.

According to the cited mail however, that is because configure checks
the availibility of "long double math" with a short piece of code,
supplying *it's own* function definition (and not using e.g. math.h) and
linking with *some* libraries. Because I do not understand how configure
is doing that (I have looked into the macros but failed to understand
them), I do not know what exactly the code is configure is using or to
which libraries configure links the executable. I think btw that it is
using libstdc++:
$ objdump.exe -t libstdc++.a | grep asinl
[  2](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000020 _asinl

> You could supply your own asinl() (easy way: use the built in x87 
> atan2l())).
> If the function you want is in libstdc++, gcc doesn't see it, but g++ 
> should see it.
> You could fix the config.h manually, if, for example, you have a reason 
> for running it only under g++, but you want the result to be applicable 
> to gcc as well.
For this moment I edit the config.h but that is not the permanant
solution of choise. Maintaining ansi C99 function btw is not my
permanent choice either ;-).




-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
       [not found]     ` <4347D8DF.6080804@cygwin.com>
@ 2005-10-08 14:50       ` Joost Kraaijeveld
  0 siblings, 0 replies; 9+ messages in thread
From: Joost Kraaijeveld @ 2005-10-08 14:50 UTC (permalink / raw)
  To: Cygwin

On Sat, 2005-10-08 at 16:34 +0200, Cygwin wrote:
> You should see in config.log what configure is actually doing.
Not that I can see. The log just shows intersting stuff incase of a
failure and the tests do not fail (which is the problem as they should
fail):

...
configure:7378: checking for infnanl
configure:7378: checking for isnanl
configure:7378: checking for isinfl
configure:7378: checking for asinl
configure:7378: checking for ldexpl
configure:7378: checking for frexpl
configure:7378: checking for fabsl
configure:7378: checking for floorl
configure:7378: checking for ceill
configure:7436: checking for powl
configure:7436: checking for fmodl
...



-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-08 14:10   ` Joost Kraaijeveld
       [not found]     ` <4347D8DF.6080804@cygwin.com>
@ 2005-10-08 14:50     ` Tim Prince
  2005-10-08 16:04       ` Joost Kraaijeveld
  2005-10-09  3:51     ` Igor Pechtchanski
  2 siblings, 1 reply; 9+ messages in thread
From: Tim Prince @ 2005-10-08 14:50 UTC (permalink / raw)
  To: Joost Kraaijeveld; +Cc: tprince, Cygwin

Joost Kraaijeveld wrote:
> 
> The problem is that configure seems to think that there *is* support 
> "long double math": the test succeeds and HAVE_ASINL (and all other
> double math) is defined. So both compile and link appear to be succesful
> as far as configure is concerned.
> 
> Before choosing a solution, I want to understand why the problem is
> occuring.
> 
> According to the cited mail however, that is because configure checks
> the availibility of "long double math" with a short piece of code,
> supplying *it's own* function definition (and not using e.g. math.h) and
> linking with *some* libraries. Because I do not understand how configure
> is doing that (I have looked into the macros but failed to understand
> them), I do not know what exactly the code is configure is using or to
> which libraries configure links the executable. I think btw that it is
> using libstdc++:
> $ objdump.exe -t libstdc++.a | grep asinl
> [  2](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x00000020 _asinl
> 


If the application has a configure which simply checks for some 
instances of extra precision, without actually checking the presence of 
each function in the headers and libraries to be used, that seems 
broken.  There are plenty of expert models for such configure scripts, 
such as the one used in the libstdc++ build itself.  Maybe we should 
look into how libstdc++ decides it can support asinl() on Cygwin.  Did 
you check whether it is actually using long double, or some mixture of 
double and long double?  I'll try to remember to look next time I build 
libstdc++.

In case the application is serious about wanting more accuracy than 
asin(), I'll point out that the usual macro-like definitions using code 
like atan2l(x,sqrtl(1-x*x) will lose up to 9 bits of precision, compared 
with atan2l(x,sqrtl((1+x)*(1-x))). The former version is accurate (and 
faster) only on architecture with infinite precision fused multiply-add.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-08 14:50     ` Tim Prince
@ 2005-10-08 16:04       ` Joost Kraaijeveld
  2005-10-08 20:12         ` Tim Prince
  0 siblings, 1 reply; 9+ messages in thread
From: Joost Kraaijeveld @ 2005-10-08 16:04 UTC (permalink / raw)
  To: tprince; +Cc: Cygwin

On Sat, 2005-10-08 at 07:50 -0700, Tim Prince wrote:
> such as the one used in the libstdc++ build itself.  Maybe we should 
> look into how libstdc++ decides it can support asinl() on Cygwin.  Did 
Actually asinl is a built-in functions provided by GCC, so I
*think/hope* that it just is a matter of adding those functions to a
header? 

See:
http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/Other-Builtins.html


-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-08 16:04       ` Joost Kraaijeveld
@ 2005-10-08 20:12         ` Tim Prince
  0 siblings, 0 replies; 9+ messages in thread
From: Tim Prince @ 2005-10-08 20:12 UTC (permalink / raw)
  To: Joost Kraaijeveld; +Cc: tprince, Cygwin

Joost Kraaijeveld wrote:
> On Sat, 2005-10-08 at 07:50 -0700, Tim Prince wrote:
> 
>>such as the one used in the libstdc++ build itself.  Maybe we should 
>>look into how libstdc++ decides it can support asinl() on Cygwin.  Did 
> 
> Actually asinl is a built-in functions provided by GCC, so I
> *think/hope* that it just is a matter of adding those functions to a
> header? 
> 
> See:
> http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gcc/Other-Builtins.html
> 
I've never seen trig functions "provided" by gcc; a very few math 
built-ins are implemented for i386 (fabs, sqrt, et al., where it is 
clear what needs to be done to support the various -march= options). gcc 
has always followed the tradition of relying on someone else to provide 
the C math library, and the corresponding headers.
To me, at least, the provision of a framework for defining built-in 
functions is a separate question from actually "providing" them, in a 
form ready to use.
Commonly used linux glibc headers tend to over-ride even the existing 
limited built-in implementation, so gcc configure has to deal with that. 
  cygwin continues to get math functions from newlib, which supports 
primarily platforms without long double.
I checked libstdc++ config.log, and it does determine that cygwin 
supports no long double trig functions.  As a result, libstdc++ is built 
  with _asinl() calling asin().  It would seem that a configure script 
which comes to a different conclusion about cygwin math libraries than 
the ones used by gcc must be broken.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-08 14:10   ` Joost Kraaijeveld
       [not found]     ` <4347D8DF.6080804@cygwin.com>
  2005-10-08 14:50     ` Tim Prince
@ 2005-10-09  3:51     ` Igor Pechtchanski
  2005-10-09  6:21       ` Joost Kraaijeveld
  2 siblings, 1 reply; 9+ messages in thread
From: Igor Pechtchanski @ 2005-10-09  3:51 UTC (permalink / raw)
  To: Joost Kraaijeveld; +Cc: Cygwin

On Sat, 8 Oct 2005, Joost Kraaijeveld wrote:

> The problem is that configure seems to think that there *is* support
> "long double math": the test succeeds and HAVE_ASINL (and all other
> double math) is defined. So both compile and link appear to be succesful
> as far as configure is concerned.
>
> Before choosing a solution, I want to understand why the problem is
> occuring.
>
> According to the cited mail however, that is because configure checks
> the availibility of "long double math" with a short piece of code,
> supplying *it's own* function definition (and not using e.g. math.h) and
> linking with *some* libraries. Because I do not understand how configure
> is doing that (I have looked into the macros but failed to understand
> them), I do not know what exactly the code is configure is using or to
> which libraries configure links the executable.

FYI (and this is not Cygwin-specific), you can find the exact code run by
configure (with the exact compile command and the output) in config.log.
No need to expand the autoconf macros by hand.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: configure and asinl function problem
  2005-10-09  3:51     ` Igor Pechtchanski
@ 2005-10-09  6:21       ` Joost Kraaijeveld
  0 siblings, 0 replies; 9+ messages in thread
From: Joost Kraaijeveld @ 2005-10-09  6:21 UTC (permalink / raw)
  To: cygwin

On Sat, 2005-10-08 at 23:51 -0400, Igor Pechtchanski wrote:

> FYI (and this is not Cygwin-specific), you can find the exact code run by
> configure (with the exact compile command and the output) in config.log.
> No need to expand the autoconf macros by hand.
As far as I know and see in the log, configure logs only the exctact
code if a test fails, not if it succeeds and the long double math tests
all errouneously succeed .

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl 



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-10-09  6:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-08 10:10 configure and asinl function problem Joost Kraaijeveld
2005-10-08 13:40 ` Tim Prince
2005-10-08 14:10   ` Joost Kraaijeveld
     [not found]     ` <4347D8DF.6080804@cygwin.com>
2005-10-08 14:50       ` Joost Kraaijeveld
2005-10-08 14:50     ` Tim Prince
2005-10-08 16:04       ` Joost Kraaijeveld
2005-10-08 20:12         ` Tim Prince
2005-10-09  3:51     ` Igor Pechtchanski
2005-10-09  6:21       ` Joost Kraaijeveld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).