1AC_DEFUN([AC_PROG_PS],[
2 AC_CHECK_PROGS(ps,[ps],no)
3 if test $ps = "no" ; then
4    AC_MSG_ERROR([Unable to find the ps application]);
5 else
6    AC_MSG_CHECKING([for ps capabilities])
7    echo
8
9    result=`ps -o rss  2>/dev/null`;
10
11    if test x"${result}" = x; then
12	AC_MSG_RESULT([no -o rss option found])
13	OPTION_FOUND=no
14    else
15	AC_DEFINE([HAVE_UNIX_O_RSS], [1], [Define ps -o rss is valid])
16	AC_MSG_RESULT([-o rss option found])
17	OPTION_FOUND=yes
18    fi
19    AM_CONDITIONAL([HAVE_UNIX_O_RSS], [test x"_OPTION_FOUND" = x"yes"])
20
21    result=`ps -jH  2>/dev/null`;
22    if test x"${result}" = x; then
23	AC_MSG_RESULT([no -jH option found])
24	OPTION_FOUND=no
25    else
26	AC_DEFINE([HAVE_UNIX_JH], [1], [Define ps -jH is valid])
27	AC_MSG_RESULT([-jH option found])
28	OPTION_FOUND=yes
29    fi
30    AM_CONDITIONAL([HAVE_UNIX_JH], [test x"_OPTION_FOUND" = x"yes"])
31
32    result=`ps -ly  2>/dev/null`;
33    if test x"${result}" = x; then
34	AC_MSG_RESULT([no -ly option found])
35	OPTION_FOUND=no
36    else
37	AC_DEFINE([HAVE_UNIX_LY], [1], [Define ps -ly is valid])
38	AC_MSG_RESULT([-ly option found])
39	OPTION_FOUND=yes
40    fi
41    AM_CONDITIONAL([HAVE_UNIX_LY], [test x"OPTION_FOUND" = x"yes"])
42
43    result=`ps -ef  2>/dev/null`;
44    if test x"${result}" = x; then
45	AC_MSG_RESULT([no -ef option found])
46	OPTION_FOUND=no
47    else
48	AC_DEFINE([HAVE_UNIX_EF], [1], [Define ps -ef is valid])
49	AC_MSG_RESULT([-ef option found])
50	OPTION_FOUND=yes
51    fi
52    AM_CONDITIONAL([HAVE_UNIX_EF], [test x"OPTION_FOUND" = x"yes"])
53
54    result=`ps -o pcpu 2>/dev/null`;
55    if test x"${result}" = x; then
56	AC_MSG_RESULT([no -o option found])
57	OPTION_FOUND=no
58    else
59	AC_DEFINE([HAVE_UNIX_O], [1], [Define ps -ef is valid])
60	AC_MSG_RESULT([-o option found])
61	OPTION_FOUND=yes
62    fi
63    AM_CONDITIONAL([HAVE_UNIX_O], [test x"OPTION_FOUND" = x"yes"])
64
65    result=`ps -w  2>/dev/null`;
66    if test x"${result}" = x; then
67	AC_MSG_RESULT([no -w option found])
68	OPTION_FOUND=no
69    else
70	AC_DEFINE([HAVE_UNIX_W], [1], [Define ps -ef is valid])
71	AC_MSG_RESULT([-w option found])
72	OPTION_FOUND=yes
73    fi
74    AM_CONDITIONAL([HAVE_UNIX_W], [test x"OPTION_FOUND" = x"yes"])
75
76    result=`ps xf  2>/dev/null`;
77    if test x"${result}" = x; then
78	AC_MSG_RESULT([no xf option found])
79	OPTION_FOUND=no
80    else
81	AC_DEFINE([HAVE_BSD_XF], [1], [Define ps xf is valid])
82	AC_MSG_RESULT([xf option found])
83	OPTION_FOUND=yes
84    fi
85    AM_CONDITIONAL([HAVE_BSD_XF], [test x"OPTION_FOUND" = x"yes"])
86
87    result=`ps l  2>/dev/null`;
88    if test x"${result}" = x; then
89	AC_MSG_RESULT([no l option found])
90	OPTION_FOUND=no
91    else
92	AC_DEFINE([HAVE_BSD_L], [1], [Define ps ux is valid])
93	AC_MSG_RESULT([l option found])
94	OPTION_FOUND=yes
95    fi
96    AM_CONDITIONAL([HAVE_BSD_L], [test x"OPTION_FOUND" = x"yes"])
97
98    result=`ps aux  2>/dev/null`;
99    if test x"${result}" = x; then
100	AC_MSG_RESULT([no aux option found])
101	OPTION_FOUND=no
102    else
103	AC_DEFINE([HAVE_BSD_AUX], [1], [Define ps aux is valid])
104	AC_MSG_RESULT([aux option found])
105	OPTION_FOUND=yes
106    fi
107    AM_CONDITIONAL([HAVE_BSD_AUX], [test x"OPTION_FOUND" = x"yes"])
108
109    result=`ps o pcpu  2>/dev/null`;
110    if test x"${result}" = x; then
111	AC_MSG_RESULT([no o option found])
112	OPTION_FOUND=no
113    else
114	AC_DEFINE([HAVE_BSD_O], [1], [Define ps aux is valid])
115	AC_MSG_RESULT([o option found])
116	OPTION_FOUND=yes
117    fi
118    AM_CONDITIONAL([HAVE_BSD_O], [test x"OPTION_FOUND" = x"yes"])
119
120    result=`ps w  2>/dev/null`;
121    if test x"${result}" = x; then
122	AC_MSG_RESULT([no w option found])
123	OPTION_FOUND=no
124    else
125	AC_DEFINE([HAVE_BSD_W], [1], [Define ps aux is valid])
126	AC_MSG_RESULT([w option found])
127	OPTION_FOUND=yes
128    fi
129    AM_CONDITIONAL([HAVE_BSD_W], [test x"OPTION_FOUND" = x"yes"])
130
131 fi
132])
133