s48_pthread_try_flags.m4 754 B

123456789101112131415161718192021222324252627282930313233343536
  1. ### s48_pthread_try_flags.m4 --- S48_PTHREAD_TRY_FLAGS macro -*- Autoconf -*-
  2. # serial 1
  3. dnl
  4. AC_DEFUN([S48_PTHREAD_TRY_FLAGS], [
  5. if test "$pthreads_done" = "no"; then
  6. flags_result=""
  7. oldCFLAGS="$CFLAGS"
  8. CFLAGS="$CFLAGS $1"
  9. AC_TRY_RUN([#include <pthread.h>
  10. int
  11. main(void)
  12. {
  13. pthread_kill(pthread_self(), 0);
  14. }],
  15. [flags_result="$1 (compile)"],
  16. [CFLAGS="$oldCFLAGS"])
  17. oldLDFLAGS="$LDFLAGS"
  18. LDFLAGS="$LDFLAGS $1"
  19. AC_TRY_RUN([#include <pthread.h>
  20. int
  21. main(void)
  22. {
  23. pthread_kill(pthread_self(), 0);
  24. }],
  25. [flags_result="$flags_result $1 (link)"
  26. pthreads_done="yes"],
  27. [LDFLAGS="$oldLDFLAGS"])
  28. if test -n "$flags_result"; then
  29. AC_MSG_RESULT($flags_result)
  30. fi
  31. fi
  32. ])
  33. ### s48_pthread_try_flags.m4 ends here