* Autoconf stanza to test for Newlib?
@ 2017-11-08 11:12 Jeffrey Walton
2017-11-09 15:40 ` Hans-Bernhard Bröker
0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey Walton @ 2017-11-08 11:12 UTC (permalink / raw)
To: newlib
Hi Everyone,
We are trying to add Autoool support to an existing library. We don't
do much of anything special if Newlib is the runtime library. We just
need to add an _XOPEN_SOURCE=600.
Before I go down a rabbit hole on ways to check for Newlib I wanted to
ask... Does anyone have a a Autonconf stanza they can share to detect
Newlib?
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Autoconf stanza to test for Newlib?
2017-11-08 11:12 Autoconf stanza to test for Newlib? Jeffrey Walton
@ 2017-11-09 15:40 ` Hans-Bernhard Bröker
2017-11-14 7:23 ` Jeffrey Walton
0 siblings, 1 reply; 4+ messages in thread
From: Hans-Bernhard Bröker @ 2017-11-09 15:40 UTC (permalink / raw)
To: newlib
Am 08.11.2017 um 01:13 schrieb Jeffrey Walton:
> Hi Everyone,
>
> We are trying to add Autoool support to an existing library. We don't
> do much of anything special if Newlib is the runtime library. We just
> need to add an _XOPEN_SOURCE=600.
It doesn't make terribly much sense to have to define such a macro only
for Newlib. If your code needs that macro for Newlib, it'll need it for
all libc implementations, or at least all that do know about it.
Given that, I believe you should be looking for
AC_USE_SYSTEM_EXTENSIONS
instead.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Autoconf stanza to test for Newlib?
2017-11-09 15:40 ` Hans-Bernhard Bröker
@ 2017-11-14 7:23 ` Jeffrey Walton
2017-11-20 7:55 ` Hans-Bernhard Bröker
0 siblings, 1 reply; 4+ messages in thread
From: Jeffrey Walton @ 2017-11-14 7:23 UTC (permalink / raw)
To: Hans-Bernhard Bröker; +Cc: newlib
On Wed, Nov 8, 2017 at 4:23 PM, Hans-Bernhard Bröker
<HBBroeker@t-online.de> wrote:
> Am 08.11.2017 um 01:13 schrieb Jeffrey Walton:
>> ...
>> We are trying to add Autoool support to an existing library. We don't
>> do much of anything special if Newlib is the runtime library. We just
>> need to add an _XOPEN_SOURCE=600.
>
> It doesn't make terribly much sense to have to define such a macro only for
> Newlib. If your code needs that macro for Newlib, it'll need it for all
> libc implementations, or at least all that do know about it.
>
> Given that, I believe you should be looking for
>
> AC_USE_SYSTEM_EXTENSIONS
Thanks Hans.
I wanted to give this some more thought before replying, so sorry
about the late reply. I know the issue you are referring to -
libstdc++ running fast and loose, and making too many symbols
available in C++ by default.
At this point I think I would like to solve the concrete problem that
exists rather than problems that don't exist. (with the understanding
I may have to do it in the future).
I'm currently using:
AC_MSG_CHECKING([if runtime library is Newlib])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <_newlib_version.h>])],
[AC_MSG_RESULT([yes]); AC_SUBST([tr_RESULT], [1])],
[AC_MSG_RESULT([no]); AC_SUBST([tr_RESULT], [0])]
)
because the head notes in <_newlib_version.h> state its OK for
downstream to use. But I am not sure this is the best test to use
since its mostly static and does not take compiler defaults and
CXXFLAGS into account.
I guess my next question is, should we be checking the preprocessor
for a symbol like __NEWLIB__?
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Autoconf stanza to test for Newlib?
2017-11-14 7:23 ` Jeffrey Walton
@ 2017-11-20 7:55 ` Hans-Bernhard Bröker
0 siblings, 0 replies; 4+ messages in thread
From: Hans-Bernhard Bröker @ 2017-11-20 7:55 UTC (permalink / raw)
To: noloader; +Cc: newlib
Am 13.11.2017 um 21:02 schrieb Jeffrey Walton:
> I wanted to give this some more thought before replying, so sorry
> about the late reply. I know the issue you are referring to -
> libstdc++ running fast and loose, and making too many symbols
> available in C++ by default.
No, that's not the issue I was pointing at. libstdc++ has nothing to do
with it.
The feature test macros, including _XOPEN_SOURCE, exist to turn on/off
various extensions of the bare ISO Standard C runtime library. C++ only
gets those same extensions by references. The question whether code
needs those macros set to work is determined by that source code itself,
not by which libc is in use.
That means the question whether to set that macro has no relation at all
to whether the libc is newlib or not. You just don't need to know one
to decide about the other.
> At this point I think I would like to solve the concrete problem that
> exists rather than problems that don't exist.
And I remain unconvinced that the problem you claim exists, actually does.
> I'm currently using:
>
> AC_MSG_CHECKING([if runtime library is Newlib])
> AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <_newlib_version.h>])],
> [AC_MSG_RESULT([yes]); AC_SUBST([tr_RESULT], [1])],
> [AC_MSG_RESULT([no]); AC_SUBST([tr_RESULT], [0])]
> )
That check is flawed because it doesn't test what it says it does. It
detects whether the compiler can _find_ (some part of) newlib, not
whether the active libc is newlib.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-15 19:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-08 11:12 Autoconf stanza to test for Newlib? Jeffrey Walton
2017-11-09 15:40 ` Hans-Bernhard Bröker
2017-11-14 7:23 ` Jeffrey Walton
2017-11-20 7:55 ` Hans-Bernhard Bröker
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).