Hello,

On a gcc 4.7 tree, we are witnessing build failures on Aix 5.2 with libstdc++ 
failing on

  << 
...pthread/libstdc++-v3/include/powerpc-ibm-aix5.2.0.0/bits/gthr-posix.h:789:69:
     error: 'pthread_mutex_timedlock' was not declared in this scope
  >>

The anomaly is visible from the libstdc++ configure log, where we have

  configure:65567: checking whether it can be safely assumed that 
mutex_timedlock is available
  ...
  configure:65587: $? = 0
  configure:65602: result: yes

then shortly after an error like the one quoted above.

The check does:

  AC_TRY_COMPILE([#include <unistd.h>],
   [
     // In case of POSIX threads check _POSIX_TIMEOUTS.
     #if (defined(_PTHREADS) \
         && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
     #error
     #endif
   ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0])

Eventhough aix 5.2 is supposed to be posix compliant, _PTHREADS is not
defined and the test succeeds without even checking _POSIX_TIMEOUTS.

Still, on our aix 5.2 machine we find:

 /usr/include/unistd.h:#define _POSIX_TIMEOUTS  (-1)

While I understand that aix 5.2 is old now, it seems to me that
the attached patch might make sense in general.

The idea is simply to test only for the POSIX_TIMEOUTS conditions
so the test will fail as well if none is met and _PTHREADS is not
defined. It still seems legitimate for the test to fail in this
situation, as the aix 5.2 case actually illustrates.

OK to commit ?

Thanks in advance for your feedback,

With Kind Regards,

Olivier

libstdc++-v3/

        * acinclude.m4 (check for mutex_timelock): Check straight
        on _POSIX_TIMEOUTS, regardless of defined (_PTHREADS).
        * configure: Regenerate.

Attachment: timedlock.diff
Description: Binary data

Reply via email to