Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 79afb676904653403145fda9e1a6a9d3ea1cb22a Mon Sep 17 00:00:00 2001 |
| 2 | From: Jussi Kukkonen <jussi.kukkonen@intel.com> |
| 3 | Date: Fri, 7 Aug 2015 11:10:32 +0300 |
| 4 | Subject: [PATCH 4/4] Avoid mis-identifying systems as SVR4 |
| 5 | |
| 6 | Linux can be misdetected as SVR4 because it has |
| 7 | libelf installed. This leads to linking with libelf, even though no |
| 8 | symbols from that library were actually used, and to a workaround for |
| 9 | a buggy getlogin() being enabled. |
| 10 | |
| 11 | It is not documented which exact SVR4 system had the bug that the |
| 12 | workaround was added for, so all I could do is make an educated guess |
| 13 | at the #defines its compiler would be likely to set. |
| 14 | |
| 15 | Modified from patch by Maarten ter Huurne. |
| 16 | |
| 17 | Upstream-Status: Submitted [http://savannah.gnu.org/bugs/?43223] |
| 18 | |
| 19 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> |
| 20 | --- |
| 21 | configure.ac | 14 ++++++++++++-- |
| 22 | 1 file changed, 12 insertions(+), 2 deletions(-) |
| 23 | |
| 24 | diff --git a/configure.ac b/configure.ac |
| 25 | index dc928ae..65439ce 100644 |
| 26 | --- a/configure.ac |
| 27 | +++ b/configure.ac |
| 28 | @@ -179,14 +179,24 @@ AC_EGREP_CPP(yes, |
| 29 | #endif |
| 30 | ], LIBS="$LIBS -lsocket -linet";seqptx=1) |
| 31 | |
| 32 | +AC_CHECKING(SVR4) |
| 33 | +AC_EGREP_CPP(yes, |
| 34 | +[main () { |
| 35 | +#if defined(SVR4) || defined(__SVR4) |
| 36 | + yes; |
| 37 | +#endif |
| 38 | +], AC_NOTE(- you have a SVR4 system) AC_DEFINE(SVR4) svr4=1) |
| 39 | +if test -n "$svr4" ; then |
| 40 | oldlibs="$LIBS" |
| 41 | LIBS="$LIBS -lelf" |
| 42 | AC_CHECKING(SVR4) |
| 43 | AC_TRY_LINK([#include <utmpx.h> |
| 44 | ],, |
| 45 | -[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN), |
| 46 | -[AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])] |
| 47 | +[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(BUGGYGETLOGIN), |
| 48 | +[AC_CHECK_HEADER(elf.h, AC_DEFINE(BUGGYGETLOGIN))])] |
| 49 | ,LIBS="$oldlibs") |
| 50 | +fi |
| 51 | + |
| 52 | AC_CHECK_HEADERS([stropts.h string.h strings.h]) |
| 53 | |
| 54 | AC_CHECKING(for Solaris 2.x) |
| 55 | -- |
| 56 | 2.1.4 |
| 57 | |