This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Autoconf stanza to test for 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