xref: /openbmc/openbmc/meta-security/recipes-ids/samhain/files/0006-configure-add-option-for-ps.patch (revision eaae0b339f806200d8722cb09e5e3b83c15a5956)
1From 2a33032ee97be5015101d94b333244e6fc53840c Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Mon, 18 Jan 2016 00:24:57 -0500
4Subject: [PATCH] configure: add option for ps
5
6The configure searches hardcoded host paths for PSPATH
7and run ps commands to decide PSARG which will fail
8on host without ps:
9| configure: error: Cannot find ps in any of /usr/ucb /bin /usr/bin
10
11So add an option so we can specify the ps at configure
12to avoid host contamination.
13
14Upstream-Status: Inappropriate [cross compile specific]
15
16Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
17[AK: refactored for 4.4.3]
18Signed-off-by: Armin Kuster <akuster808@gmail.com>
19Refresh to 4.5.2
20Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
21---
22 acinclude.m4 |  2 +-
23 configure.ac | 60 +++++++++-------------------------------------------
24 2 files changed, 11 insertions(+), 51 deletions(-)
25
26diff --git a/acinclude.m4 b/acinclude.m4
27index def24be..e2a57e2 100644
28--- a/acinclude.m4
29+++ b/acinclude.m4
30@@ -359,7 +359,7 @@ x_includes=NONE
31 x_libraries=NONE
32 DESTDIR=
33 SH_ENABLE_OPTS="selinux posix-acl asm ssp db-reload xml-log message-queue login-watch process-check port-check mounts-check logfile-monitor userfiles debug ptrace static network udp nocl stealth micro-stealth install-name identity khide suidcheck base largefile mail external-scripts encrypt srp dnmalloc ipv6 shellexpand suid"
34-SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver signify pubkey-checksum gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
35+SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver signify pubkey-checksum gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file ps-path"
36
37 # Installation directory options.
38 # These are left unexpanded so users can "make install exec_prefix=/foo"
39diff --git a/configure.ac b/configure.ac
40index f59754c..d0e3657 100644
41--- a/configure.ac
42+++ b/configure.ac
43@@ -799,56 +799,16 @@ then
44 fi
45 AC_CHECK_HEADERS(gmp.h)
46
47-AC_MSG_CHECKING([for ps])
48-PS=
49-for ff in /usr/ucb /bin /usr/bin; do
50-    if test -x "$ff/ps"; then
51-       PS="$ff/ps"
52-       AC_MSG_RESULT([$PS])
53-       break
54-    fi
55-done
56-if test x$PS = x
57-then
58-	AC_MSG_RESULT([no])
59-	AC_MSG_ERROR([Cannot find ps in any of /usr/ucb /bin /usr/bin])
60-fi
61-AC_DEFINE_UNQUOTED([PSPATH], [_("$PS")], [Path to ps executable])
62-
63-AC_MSG_CHECKING([how to use ps])
64-$PS ax >/dev/null 2>&1
65-if test $? -eq 0; then
66-   case "$host_os" in
67-   *openbsd*)
68-   one=`$PS akx | wc -l`
69-   ;;
70-   *)
71-   one=`$PS ax | wc -l`
72-   ;;
73-   esac
74-else
75-   one=0
76-fi
77-$PS -e >/dev/null 2>&1
78-if test $? -eq 0; then
79-   two=`$PS -e | wc -l`
80-else
81-   two=0
82-fi
83-if test $one -ge $two
84-then
85-   case "$host_os" in
86-   *openbsd*)
87-	PSARG="akx"
88-	;;
89-   *)
90-	PSARG="ax"
91-	;;
92-   esac
93-else
94-	PSARG="-e"
95-fi
96-AC_DEFINE_UNQUOTED([PSARG], [_("$PSARG")], [Argument for ps])
97+AC_ARG_WITH(ps-path,
98+	[  --with-ps-path=PATH         set path to ps command ],
99+	[
100+	if test "x${withval}" != xno; then
101+		pspath="${withval}"
102+		AC_DEFINE_UNQUOTED([PSPATH], _("${pspath}"), [Path to ps])
103+		AC_DEFINE_UNQUOTED([PSARG], _("ax"), [Argument for ps])
104+	fi
105+	])
106+
107 AC_MSG_RESULT([$PS $PSARG])
108
109 dnl *****************************************
110--
1112.34.1
112
113