0005-avoid-identifying-as-SVR4.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From: Maarten ter Huurne <maarten@treewalker.org>
  2. Date: Sun, 14 Sep 2014 11:16:58 +0200
  3. Subject: Avoid mis-identifying systems as SVR4
  4. My openSUSE 13.1 Linux system was detected as SVR4 because it had
  5. libelf installed. This leads to linking with libelf, even though no
  6. symbols from that library were actually used, and to a workaround for
  7. a buggy getlogin() being enabled.
  8. It is not documented which exact SVR4 system had the bug that the
  9. workaround was added for, so all I could do is make an educated guess
  10. at the #defines its compiler would be likely to set.
  11. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
  12. [Ricardo: rebase on top of 4.3.1]
  13. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
  14. ---
  15. configure.ac | 14 ++++++++++++--
  16. 1 file changed, 12 insertions(+), 2 deletions(-)
  17. diff --git a/configure.ac b/configure.ac
  18. index 9cf7cee..e09e4cf 100644
  19. --- a/configure.ac
  20. +++ b/configure.ac
  21. @@ -179,14 +179,24 @@ AC_EGREP_CPP(yes,
  22. #endif
  23. ], LIBS="$LIBS -lsocket -linet";seqptx=1)
  24. +AC_CHECKING(SVR4)
  25. +AC_EGREP_CPP(yes,
  26. +[main () {
  27. +#if defined(SVR4) || defined(__SVR4)
  28. + yes;
  29. +#endif
  30. +], AC_NOTE(- you have a SVR4 system) AC_DEFINE(SVR4) svr4=1)
  31. +if test -n "$svr4" ; then
  32. oldlibs="$LIBS"
  33. LIBS="$LIBS -lelf"
  34. AC_CHECKING(SVR4)
  35. AC_TRY_LINK([#include <utmpx.h>
  36. ],,
  37. -[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
  38. -[AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
  39. +[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(BUGGYGETLOGIN),
  40. +[AC_CHECK_HEADER(elf.h, AC_DEFINE(BUGGYGETLOGIN))])]
  41. ,LIBS="$oldlibs")
  42. +fi
  43. +
  44. AC_CHECK_HEADERS([stropts.h string.h strings.h])
  45. AC_CHECKING(for Solaris 2.x)
  46. --
  47. 1.8.4.5