1dnl procfs macros 2dnl Copyright (C) 2005 Free Software Foundation 3dnl Copying and distribution of this file, with or without modification, 4dnl are permitted in any medium without royalty provided the copyright 5dnl notice and this notice are preserved. 6dnl 7dnl AC_SYS_PROCFS 8dnl This macro defines HAVE_PROCFS if either it finds a mounted /proc 9dnl or the user explicitly enables it for cross-compiles. 10AC_DEFUN(AC_SYS_PROCFS, 11[ AC_ARG_ENABLE(procfs, 12 [ --enable-procfs Use /proc filesystem (default)], 13 enable_procfs="$enableval", if test "$cross_compiling" = yes; then enable_procfs=cross; else enable_procfs=yes; fi;) 14 15 AC_CACHE_CHECK([kernel support for /proc filesystem], ac_cv_sys_procfs, 16 [if test "$enable_procfs" = yes; then 17 # Suggested change for the following line was 18 # if test -d /proc/0; then 19 # but it doesn't work on my linux - /proc/0 does not exist, but /proc 20 # works fine 21 if grep 'proc' /proc/mounts >/dev/null 2>/dev/null; then 22 ac_cv_sys_procfs=yes 23 else 24 ac_cv_sys_procfs=no 25 fi 26 case "$target_os" in 27 # Solaris has proc, but it is not readable 28 solaris*) ac_cv_sys_procfs=no;; 29 irix*) ac_cv_sys_procfs=no;; 30 # Cygwin does have proc, but it does not show with mount 31 cygwin*) ac_cv_sys_procfs=yes;; 32 esac 33 elif test "$enable_procfs" = cross; then 34 ac_cv_sys_procfs=no 35 else 36 ac_cv_sys_procfs=no 37 fi]) 38 39 if test "$enable_procfs" = cross; then 40 AC_MSG_WARN(Cross-compiling: Pass --enable-procfs argument to enable use of /proc filesystem.) 41 fi 42 if test $ac_cv_sys_procfs = yes; then 43 AC_DEFINE(HAVE_PROCFS, 1, [Define if system supports the /proc filesystem]) 44 fi 45] 46) 47 48dnl AC_SYS_PROCFS_PSINFO 49dnl This macro defines HAVE_PROCFS_PSINFO if it can read the psinfo 50dnl structure from the /proc/%pid% directory 51AC_DEFUN(AC_SYS_PROCFS_PSINFO, 52[ AC_ARG_ENABLE(procfs-psinfo, 53 [ --enable-procfs-psinfo Use /proc/%pid% to get info], 54 enable_procfs_psinfo="$enableval", if test "$cross_compiling" = yes; then enable_procfs_psinfo=cross; else enable_procfs_psinfo=yes; fi;) 55 56 AC_CACHE_CHECK([support for /proc psinfo struct], ac_cv_sys_procfs_psinfo, 57 [if test "$enable_procfs_psinfo" = yes; then 58 AC_TRY_RUN([#include "$srcdir/config/config.psinfo.c"], 59 ac_cv_sys_procfs_psinfo=yes, ac_cv_sys_procfs_psinfo=no, 60 ac_cv_sys_procfs_psinfo=yes) 61 elif test "$enable_procfs" = cross; then 62 ac_cv_sys_procfs_psinfo=no 63 else 64 ac_cv_sys_procfs_psinfo=no 65 fi]) 66 67 if test "$enable_procfs" = cross; then 68 AC_MSG_WARN(Cross-compiling: Pass --enable-procfs-psinfo argument to enable use of /proc psinfo information.) 69 fi 70 if test $ac_cv_sys_procfs_psinfo = yes; then 71 AC_DEFINE(HAVE_PROCFS_PSINFO, 1, [Define if system supports reading psinfo from /proc]) 72 fi 73] 74) 75