blob: 8de0735fcd939361700415ab422863ca261f3905 [file] [log] [blame]
Richard Marian Thomaiyar14fddef2018-07-13 23:55:56 +05301From 02a143f0068cbc6cea71359169210fbb3606d4bb 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---
18 aclocal.m4 | 2 +-
19 configure.ac | 60 ++++++++++--------------------------------------------------
20 2 files changed, 11 insertions(+), 51 deletions(-)
21
22diff --git a/aclocal.m4 b/aclocal.m4
23index a2e59a6..cd20a2f 100644
24--- a/aclocal.m4
25+++ b/aclocal.m4
26@@ -409,7 +409,7 @@ x_includes=NONE
27 x_libraries=NONE
28 DESTDIR=
29 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"
30-SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file"
31+SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file ps-path"
32
33 # Installation directory options.
34 # These are left unexpanded so users can "make install exec_prefix=/foo"
35diff --git a/configure.ac b/configure.ac
36index 5910b1f..8c3e087 100644
37--- a/configure.ac
38+++ b/configure.ac
39@@ -730,56 +730,16 @@ then
40 fi
41 AC_CHECK_HEADERS(gmp.h)
42
43-AC_MSG_CHECKING([for ps])
44-PS=
45-for ff in /usr/ucb /bin /usr/bin; do
46- if test -x "$ff/ps"; then
47- PS="$ff/ps"
48- AC_MSG_RESULT([$PS])
49- break
50- fi
51-done
52-if test x$PS = x
53-then
54- AC_MSG_RESULT([no])
55- AC_MSG_ERROR([Cannot find ps in any of /usr/ucb /bin /usr/bin])
56-fi
57-AC_DEFINE_UNQUOTED([PSPATH], _("$PS"), [Path to ps])
58-
59-AC_MSG_CHECKING([how to use ps])
60-$PS ax >/dev/null 2>&1
61-if test $? -eq 0; then
62- case "$host_os" in
63- *openbsd*)
64- one=`$PS akx | wc -l`
65- ;;
66- *)
67- one=`$PS ax | wc -l`
68- ;;
69- esac
70-else
71- one=0
72-fi
73-$PS -e >/dev/null 2>&1
74-if test $? -eq 0; then
75- two=`$PS -e | wc -l`
76-else
77- two=0
78-fi
79-if test $one -ge $two
80-then
81- case "$host_os" in
82- *openbsd*)
83- PSARG="akx"
84- ;;
85- *)
86- PSARG="ax"
87- ;;
88- esac
89-else
90- PSARG="-e"
91-fi
92-AC_DEFINE_UNQUOTED([PSARG], _("$PSARG"), [Argument for ps])
93+AC_ARG_WITH(ps-path,
94+ [ --with-ps-path=PATH set path to ps command ],
95+ [
96+ if test "x${withval}" != xno; then
97+ pspath="${withval}"
98+ AC_DEFINE_UNQUOTED([PSPATH], _("${pspath}"), [Path to ps])
99+ AC_DEFINE_UNQUOTED([PSARG], _("ax"), [Argument for ps])
100+ fi
101+ ])
102+
103 AC_MSG_RESULT([$PS $PSARG])
104
105 dnl *****************************************
106--
1071.9.1
108