http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47491
Janne Blomqvist <jb at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- URL| |http://gcc.gnu.org/ml/gcc-p | |atches/2011-01/msg02026.htm | |l --- Comment #4 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-27 17:10:42 UTC --- Patch: http://gcc.gnu.org/ml/gcc-patches/2011-01/msg02026.html (In reply to comment #3) > > --- Comment #2 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-27 > > 16:10:41 UTC --- > > Some git-grepping showed that at least libjava has in configure.ac > > > > AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Required define if using POSIX > > threads]) > > > > and in case Boehm GC is not used (which libgfortran never uses): > > > > AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads]) > > > > However, if I understand gcc/config/ correctly, _REENTRANT should be > > automatically set for all targets that need it. > > At least on Solaris (and I think on other targets as well), only with > -pthread. I think that's Ok. If we're not building with threads, and lack of _REENTRANT causes the _r() functions not to be seen, gfortran falls back to the non-_r() functions, which is no problem on a non-threaded build. > > Also in gcc/config a few targets set > > > > -D_POSIX_C_SOURCE=199506L > > > > (not Solaris, though). But apparently we shouldn't go and set this > > somewhere in > > libgfortran? That is, at least no other library does this.. > > That may not provide the best guidance. I'd rather look for autoconf > and/or gnulib here. On Solaris, this may not be enough: starting with > Solaris 10, there's POSIX.1-2001 support via -D_POSIX_C_SOURCE=200112L. The comments at http://blogs.gnome.org/tthurman/2008/11/23/_posix_c_source/ suggests defining POSIX_C_SOURCE might not be such a good idea, so I think it's best to avoid this. Also, for GNU platforms http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html seems _GNU_SOURCE is sort of a superset of POSIX_C_SOURCE and the kitchen sink. Which is what we're using today, hopefully the AC_USE_SYSTEM_EXTENSIONS thing is enough to make things work on other targets.