README 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. POSIX compatibility code
  2. ------------------------
  3. This code exists to work around some common POSIX compatibility issues.
  4. POSIX specifies that if the first line of a Makefile is ".POSIX:" then the
  5. Makefile should be processed according to POSIX rules, including with CC=c99;
  6. thus we should see behaviour consistent with a standard-compliant C99
  7. compiler.
  8. One POSIX compatibility check requires a runtime test. This will be
  9. automatically disabled if the build system detects that you are
  10. cross-compiling for another platform, or it can be manually disabled by
  11. setting DISABLE_POSIX_RUNTIME_CHECKS to a non-zero value.
  12. - posix-cflags.sh: Detects if ${CC} supports certain POSIX features, and
  13. outputs a POSIXFAIL_ define if it is not supported so that we can work around
  14. the problem.
  15. The potential command-line flags are:
  16. - DPOSIXFAIL_MSG_NOSIGNAL: <sys/socket.h> not defining MSG_NOSIGNAL.
  17. - DPOSIXFAIL_CLOCK_REALTIME: <time.h> not defining CLOCK_REALTIME.
  18. - DPOSIXFAIL_CLOCK_GETTIME: <time.h> not declaring clock_gettime(), or
  19. clock_gettime() is not linkable. The latter test requires a runtime check.
  20. - DPOSIXFAIL_INET_ADDRSTRLEN: <netinet/in.h> not defining
  21. INET_ADDRSTRLEN.
  22. - DPOSIXFAIL_INET6_ADDRSTRLEN: <netinet/in.h> not defining
  23. INET6_ADDRSTRLEN.
  24. - DPOSIXFAIL_ABSTRACT_DECLARATOR: ${CC} does not accept
  25. qualifiers in an abstract declarator.
  26. - DPOSIXFAIL_STAT_ST_MTIM: struct stat does not contain st_mtim.
  27. - std=c99: ${CC} does not accept the `restrict` keyword by default, but
  28. accepts it when given this flag.
  29. - posix-cflags-filter.sh: Detects if ${CC} supports expected ${CFLAG} value(s).
  30. The potential ${CFLAGS} flags it checks are:
  31. - O2: some compilers only accept -O.
  32. - posix-l.sh: Detects whether the linker supports certain POSIX features.
  33. The potential command-line flags are:
  34. - lrt lxnet: c99 is required to understand these options, and ignore them if
  35. the routines for which they specify linkage are already in the standard C
  36. library