Imported Upstream version 3.1.0
[debian/amanda] / config / amanda / ps.m4
index 83b88b5c8f00499ba02c9d709cc1b367f4ee51d5..cab96df96095f44422a3dd1f5cacbe6069129cfe 100644 (file)
@@ -11,32 +11,38 @@ AC_DEFUN([AMANDA_PS_ARGUMENT],
     # (e.g., -e) can mean different things.  So this macro tries to
     # special-case most known systems, and makes an effort to detect unknown
     # systems
-    case "$target" in
+    case "$host" in
        *-*-solaris*)
            PS_ARGUMENT="-eo pid,ppid,comm"
+           PS_ARGUMENT_ARGS="-eo pid,ppid,comm"
            ;;
 
        *-*-linux-*)
            PS_ARGUMENT="-eo pid,ppid,command"
+           PS_ARGUMENT_ARGS="-eo pid,ppid,command"
            ;;
 
        *-*-*bsd*)
            PS_ARGUMENT="-axo pid,ppid,command"
+           PS_ARGUMENT_ARGS="-axo pid,ppid,command"
            ;;
 
        *-apple-darwin*)
            PS_ARGUMENT="-aAco pid,ppid,command"
+           PS_ARGUMENT_ARGS="-aAo pid,ppid,command"
            ;;
 
        *-pc-cygwin)
            # Cygwin is special-cased in Amanda::Process
            PS_ARGUMENT=CYGWIN
+           PS_ARGUMENT_ARGS="-ef"
            ;;
 
        *-*-hpux*)
            # HPUX's 'PS' needs the env var UNIX95 to run in "xpg4" mode
            PS="UNIX95=1 $PS"
            PS_ARGUMENT="-eo pid,ppid,comm"
+           PS_ARGUMENT_ARGS="-eo pid,ppid,comm"
            ;;
 
        *)
@@ -51,7 +57,18 @@ AC_DEFUN([AMANDA_PS_ARGUMENT],
                    break
                fi
            done
-           if test -z "$PS_ARGUMENT"; then
+           for try in \
+               "-axo pid,ppid,command" \
+               "-aAo pid,ppid,command" \
+               "-eo pid,ppid,comm"
+           do
+               ps $try >/dev/null 2>/dev/null
+               if test $? -eq 0; then
+                   PS_ARGUMENT_ARGS="$try"
+                   break
+               fi
+           done
+           if test -z "$PS_ARGUMENT" -o -z "$PS_ARGUMENT_ARGS"; then
                AC_MSG_ERROR([Can't find ps argument to use.])
            fi
            ;;
@@ -59,4 +76,6 @@ AC_DEFUN([AMANDA_PS_ARGUMENT],
 
     AC_MSG_RESULT($PS_ARGUMENT)
     AC_SUBST(PS_ARGUMENT)
+    AC_MSG_RESULT($PS_ARGUMENT_ARGS)
+    AC_SUBST(PS_ARGUMENT_ARGS)
 ])