blob: e184aa1f310296a6933900640bc0a2ab98d85963 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001From 79afb676904653403145fda9e1a6a9d3ea1cb22a Mon Sep 17 00:00:00 2001
2From: Jussi Kukkonen <jussi.kukkonen@intel.com>
3Date: Fri, 7 Aug 2015 11:10:32 +0300
4Subject: [PATCH 4/4] Avoid mis-identifying systems as SVR4
5
6Linux can be misdetected as SVR4 because it has
7libelf installed. This leads to linking with libelf, even though no
8symbols from that library were actually used, and to a workaround for
9a buggy getlogin() being enabled.
10
11It is not documented which exact SVR4 system had the bug that the
12workaround was added for, so all I could do is make an educated guess
13at the #defines its compiler would be likely to set.
14
15Modified from patch by Maarten ter Huurne.
16
17Upstream-Status: Submitted [http://savannah.gnu.org/bugs/?43223]
18
19Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
20---
21 configure.ac | 14 ++++++++++++--
22 1 file changed, 12 insertions(+), 2 deletions(-)
23
24diff --git a/configure.ac b/configure.ac
25index 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--
562.1.4
57