2011-06-04 22:26:58 +08:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2013-05-05 08:07:30 +08:00
AC_PREREQ([2.69])
2011-06-04 22:26:58 +08:00
AC_CONFIG_MACRO_DIR([m4])
2011-06-05 01:40:29 +08:00
AC_INIT([procps-ng],
2012-02-12 01:11:11 +08:00
m4_esyscmd([misc/git-version-gen .tarball-version]),
2015-05-10 12:57:50 +08:00
[procps@freelists.org],,[https://gitlab.com/procps-ng/procps])
2015-05-02 07:48:21 +08:00
AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects -Wall -Wno-portability tar-pax no-dist-gzip dist-xz])
2013-08-13 21:21:33 +08:00
AM_SILENT_RULES([yes])
2011-10-12 03:02:59 +08:00
AC_CONFIG_SRCDIR([free.c])
2011-06-04 22:26:58 +08:00
AC_CONFIG_HEADERS([config.h])
2020-02-24 11:02:59 +08:00
AC_LANG([C])
2011-06-04 22:26:58 +08:00
# Checks for programs.
2016-03-08 04:36:59 +08:00
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
2013-05-05 08:07:30 +08:00
AC_PROG_AWK
2011-06-04 22:26:58 +08:00
AC_PROG_CC
2012-02-26 05:52:02 +08:00
AC_PROG_CC_STDC
2012-04-18 03:21:20 +08:00
if test "$cross_compiling" = no; then
if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then
# We might be on RHEL5 with a git checkout and so broken
# autoconf. Check if CC is gcc and if it bails when given -std=gnu99.
# If not, use that. Yuck.
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
CC="$CC -std=gnu99"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],[[
return 0;
]])],
[],
[AC_MSG_ERROR([Could not find a C99 compatible compiler])])
else
AC_MSG_ERROR([Could not find a C99 compatible compiler])
fi
2012-02-26 05:52:02 +08:00
fi
fi
2011-06-04 22:26:58 +08:00
AM_PROG_CC_C_O
2013-05-05 08:07:30 +08:00
AC_PROG_CPP
2011-06-04 22:26:58 +08:00
AC_PROG_INSTALL
AC_PROG_LN_S
2022-05-25 19:08:50 +08:00
dnl Check pkg-config is there for autoconf and at ./configure
m4_ifndef([PKG_PREREQ],
[m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
2012-01-25 02:01:15 +08:00
PKG_PROG_PKG_CONFIG
2022-05-25 19:08:50 +08:00
AS_IF([test -z "$PKG_CONFIG"],[
AC_MSG_ERROR([Could not find pkg-config])])
2013-05-05 08:07:30 +08:00
AC_PROG_MAKE_SET
2011-12-20 19:12:37 +08:00
2021-02-15 18:36:57 +08:00
AC_DEFUN([PROCPS_PROG_PO4A], [
AC_REQUIRE([AM_NLS])
AC_CHECK_PROGS([PO4A], [po4a])
AS_IF([test "$USE_NLS" = "yes" && test -n "$PO4A"], [
USE_PO4A=yes
], [
USE_PO4A=no
])
AC_SUBST([USE_PO4A])
])
PROCPS_PROG_PO4A
2011-06-04 22:26:58 +08:00
# Checks for header files.
AC_HEADER_MAJOR
2020-12-22 11:59:47 +08:00
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h stdint.h stdio_ext.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utmp.h utmpx.h values.h wchar.h wctype.h])
2011-06-04 22:26:58 +08:00
# Checks for typedefs, structures, and compiler characteristics.
2013-05-05 08:07:30 +08:00
AC_CHECK_HEADER_STDBOOL
AC_TYPE_UID_T
2011-06-04 22:26:58 +08:00
AC_C_INLINE
2013-05-05 08:07:30 +08:00
AC_TYPE_INT32_T
2011-06-04 22:26:58 +08:00
AC_TYPE_PID_T
2013-05-05 08:07:30 +08:00
AC_C_RESTRICT
2011-06-04 22:26:58 +08:00
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
2013-05-05 08:07:30 +08:00
AC_CHECK_MEMBERS([struct stat.st_rdev])
2022-04-11 15:09:53 +08:00
AC_CHECK_MEMBERS([siginfo_t.si_int], [], [], [[#include <signal.h>]])
2011-06-04 22:26:58 +08:00
dnl libtool
LT_INIT
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MBRTOWC
AC_FUNC_MMAP
AC_FUNC_REALLOC
2016-07-07 13:00:00 +08:00
AC_FUNC_STRCOLL
2011-06-04 22:26:58 +08:00
AC_FUNC_STRTOD
2017-08-19 21:05:22 +08:00
usrbin_execdir='${exec_prefix}/bin'
AC_SUBST([usrbin_execdir])
if test "x$host_os" = xcygwin
then
prefix=/usr
sysconfdir='${prefix}/etc'
libexecdir='${prefix}/lib'
localstatedir='${prefix}/var'
datadir='${prefix}/share'
mandir='${prefix}/share/man'
infodir='${prefix}/share/info'
AC_SUBST([prefix])
AC_SUBST([sysconfdir])
AC_SUBST([libexecdir])
AC_SUBST([localstatedir])
AC_SUBST([datadir])
AC_SUBST([mandir])
AC_SUBST([infodir])
2022-05-04 15:02:39 +08:00
AC_DEFINE([USE_PROC_CTTY], [1], [Use /proc/$PID/ctty to determine controlling TTY])
else
AC_DEFINE([USE_PROC_CTTY], [0], [Use /proc/$PID/ctty to determine controlling TTY])
2017-08-19 21:05:22 +08:00
fi
2011-10-09 03:14:21 +08:00
AM_GNU_GETTEXT_VERSION([0.14.1])
AM_GNU_GETTEXT([external])
2014-09-15 21:30:08 +08:00
if test -d "$srcdir/po"
then
ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
else
ALL_LINGUAS="af am ar as be bg bn_IN bn ca cs cy da de el en_GB es et eu_ES fa fi fr gl gu he hi hr hu hy id is it ja ka kn ko ku lo lt lv mk ml mr ms my nb nl nn no nso or pa pl pt_BR pt ro ru si sk sl sq sr@Latn sr sv ta te th tr uk ur vi zh_CN zh_TW zu"
fi
2011-10-09 03:14:21 +08:00
2013-02-21 03:14:29 +08:00
AC_CHECK_HEADERS(error.h, [], [], AC_INCLUDES_DEFAULT)
2013-02-21 03:10:40 +08:00
AC_CHECK_HEADERS(stdio_ext.h, [], [], AC_INCLUDES_DEFAULT)
2021-05-26 21:45:02 +08:00
AC_MSG_CHECKING(for __progname)
AC_LINK_IFELSE([AC_LANG_SOURCE(
[
#include <stdio.h>
#include <stdlib.h>
extern char *__progname;
int main(void) {
const char *cp = __progname;
printf("%s\n", cp);
exit(0);
}
])],
AC_DEFINE(HAVE___PROGNAME, 1, [Define if __progname exists])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
2013-02-21 01:31:48 +08:00
AC_MSG_CHECKING(whether program_invocation_name is defined)
AC_TRY_COMPILE([#include <errno.h>],
[program_invocation_name = "test";],
AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME, 1,
[Define if program_invocation_name is defined])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
2011-10-27 06:29:48 +08:00
AC_MSG_CHECKING(whether program_invocation_short_name is defined)
2012-04-17 02:43:16 +08:00
AC_TRY_COMPILE([#include <errno.h>],
2011-10-27 06:29:48 +08:00
[program_invocation_short_name = "test";],
AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
[Define if program_invocation_short_name is defined])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
2011-10-09 03:14:21 +08:00
2021-02-15 18:10:06 +08:00
AC_CHECK_FUNC([pidfd_open], [enable_pidwait=yes], [
2020-02-24 11:02:59 +08:00
AC_MSG_CHECKING([for __NR_pidfd_open])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <sys/syscall.h>
#ifndef __NR_pidfd_open
#error __NR_pidfd_open not defined
#endif
2021-02-15 18:10:06 +08:00
])], [enable_pidwait=yes], [enable_pidwait=no])
AC_MSG_RESULT([$enable_pidwait])
2020-02-24 11:02:59 +08:00
])
2021-02-15 18:10:06 +08:00
if test "$enable_pidwait" = yes; then
AC_DEFINE([ENABLE_PIDWAIT], [1], [Enable pidwait])
2020-02-24 11:02:59 +08:00
fi
2021-02-15 18:10:06 +08:00
AM_CONDITIONAL([BUILD_PIDWAIT], [test x$enable_pidwait = xyes])
2020-02-24 11:02:59 +08:00
2013-05-05 08:07:30 +08:00
dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses
AC_SUBST([WITH_WATCH8BIT])
AC_ARG_ENABLE([watch8bit],
2013-08-13 21:21:31 +08:00
AS_HELP_STRING([--enable-watch8bit], [enable watch to be 8bit clean (requires ncursesw)]),
[], [enable_watch8bit=no]
)
2013-05-05 08:07:30 +08:00
if test "$enable_watch8bit" = "yes"; then
AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
fi
2013-08-07 23:52:38 +08:00
AC_ARG_ENABLE([libselinux],
2013-08-13 21:21:31 +08:00
AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
[], [enable_libselinux=no]
)
2013-08-07 23:52:38 +08:00
if test "$enable_libselinux" = "yes"; then
AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
fi
2016-04-25 15:07:22 +08:00
# Enable hardened compile and link flags
AC_ARG_ENABLE([harden_flags],
[AS_HELP_STRING([--enable-harden-flags], [enable hardened compilier and linker flags])],
[enable_harden_flags=$enableval],
[enable_harden_flags="no"])
# Check that harden CFLAGS and LDFLAGS will compile
AS_IF([test "$enable_harden_flags" = "yes"],
HARDEN_CFLAGS="-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security"
[HARDEN_LDFLAGS="-fPIE -pie -Wl,-z,relro -Wl,-z,now"]
[ AC_MSG_CHECKING([compiler supports harden flags])
save_harden_cflags="$CFLAGS"
CFLAGS="$CFLAGS $HARDEN_CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,,)],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]); HARDEN_CFLAGS='']
)
CFLAGS="$save_harden_cflags"],
[HARDEN_CFLAGS=""
HARDEN_LDFLAGS=""])
AC_SUBST([HARDEN_CFLAGS])
AC_SUBST([HARDEN_LDFLAGS])
2013-05-05 08:07:30 +08:00
# Optional packages - AC_ARG_WITH
2011-06-04 22:26:58 +08:00
AC_ARG_WITH([ncurses],
2011-10-26 19:29:44 +08:00
AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
2022-05-21 09:06:57 +08:00
[AS_IF([test "x$enable_watch8bit" = "xyes"],
[AC_MSG_ERROR([Cannot have both --enable-watch8bit and --without-ncurses])]
)],
[with_ncurses=yes]
2011-06-04 22:26:58 +08:00
)
2011-10-27 05:53:55 +08:00
if test "x$with_ncurses" = xno; then
AM_CONDITIONAL(WITH_NCURSES, false)
else
AM_CONDITIONAL(WITH_NCURSES, true)
2022-05-21 09:06:57 +08:00
PKG_CHECK_MODULES([NCURSES], [ncursesw],
[AC_DEFINE([HAVE_NCURSES], [1], [Use NCURSESW])],
[
AS_IF([test "x$enable_watch8bit" = "xyes"],
[AC_MSG_ERROR([Cannot find ncurses wide library ncursesw with --enable-watch8bit])])
PKG_CHECK_MODULES([NCURSES], [ncurses],
[AC_DEFINE([HAVE_NCURSES], [1], [Use NCURSES])],
[AC_MSG_ERROR([ncurses support missing/incomplete (for partial build use --without-ncurses)])]
)
]
)
2011-06-04 22:26:58 +08:00
fi
2022-05-21 09:06:57 +08:00
# PKG_CHECK_MODULES([NCURSES], [ncurses], [], [
# AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
# AC_CHECK_HEADERS(curses.h ncurses.h term.h, [], [have_ncurses=no], AC_INCLUDES_DEFAULT)
# if test "x$have_ncurses" = xno; then
# AC_MSG_ERROR([ncurses support missing/incomplete (for partial build use --without-ncurses)])
# fi
# NCURSES_LIBS="-lncurses"
# ])
# AM_CONDITIONAL(WITH_NCURSES, true)
# if test "$enable_watch8bit" = yes; then
# PKG_CHECK_MODULES([NCURSESW], [ncursesw], [WATCH_NCURSES_LIBS="$NCURSESW_LIBS"], [
# AC_CHECK_LIB([ncursesw], [addwstr], [WATCH_NCURSES_LIBS=-lncursesw], [
# AC_CHECK_LIB([ncurses], [addwstr], [WATCH_NCURSES_LIBS=-lncurses], [
# AC_MSG_ERROR([Cannot find ncurses wide library ncursesw with --enable-watch8bit])
# ])
# ])
# ])
# else
# WATCH_NCURSES_LIBS="$NCURSES_LIBS"
# fi
2011-06-04 22:26:58 +08:00
2013-05-05 08:07:30 +08:00
AC_ARG_WITH([systemd],
[AS_HELP_STRING([--with-systemd], [enable systemd support])],
2013-08-13 21:21:31 +08:00
[], [with_systemd=no]
)
2015-07-09 21:11:40 +08:00
AS_IF([test "x$with_systemd" != "xno"], [
2021-04-14 15:42:53 +08:00
PKG_CHECK_MODULES([SYSTEMD], [libsystemd],,
[PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login])]
)
2013-05-05 08:07:30 +08:00
AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
2015-07-09 21:11:40 +08:00
])
AM_CONDITIONAL([WITH_SYSTEMD], [test x$with_systemd != xno])
2013-05-05 08:07:30 +08:00
2017-05-30 22:33:28 +08:00
AC_ARG_WITH([elogind],
[AS_HELP_STRING([--with-elogind], [enable elogind support])],
[], [with_elogind=no]
)
# Do not allow elogind if systemd is wanted and found
AS_IF([test "x$with_systemd" != "xno"], [with_elogind=no])
AS_IF([test "x$with_elogind" != "xno"], [
PKG_CHECK_MODULES([ELOGIND], [libelogind])
AC_DEFINE(WITH_ELOGIND, 1, [enable elogind support])
])
AM_CONDITIONAL([WITH_ELOGIND], [test x$with_elogind != xno])
2013-05-05 08:07:30 +08:00
# AC_ARG_ENABLEs
2013-10-05 02:35:01 +08:00
AC_ARG_ENABLE([pidof],
AS_HELP_STRING([--disable-pidof], [do not build pidof]),
[], [enable_pidof=yes]
)
AM_CONDITIONAL(BUILD_PIDOF, test "x$enable_pidof" = xyes)
2011-10-05 02:16:46 +08:00
AC_ARG_ENABLE([kill],
AS_HELP_STRING([--disable-kill], [do not build kill]),
2013-08-13 21:21:31 +08:00
[], [enable_kill=yes]
2011-10-05 02:16:46 +08:00
)
AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
2021-04-24 03:58:36 +08:00
AC_ARG_ENABLE([w],
AS_HELP_STRING([--disable-w], [do not build w]),
[], [enable_w=yes]
)
AM_CONDITIONAL(BUILD_W, test "x$enable_w" = xyes)
2011-12-02 21:32:14 +08:00
AM_CONDITIONAL(LINUX, test "x$host_os" = xlinux-gnu)
2016-03-11 07:04:27 +08:00
AM_CONDITIONAL(CYGWIN, test "x$host_os" = xcygwin)
2011-10-05 02:16:46 +08:00
2012-03-16 04:29:13 +08:00
AC_ARG_ENABLE([skill],
AS_HELP_STRING([--enable-skill], [build skill and snice]),
2013-08-13 21:21:31 +08:00
[], [enable_skill=no]
2012-03-16 04:29:13 +08:00
)
2012-05-07 03:30:25 +08:00
AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes)
2012-03-16 04:29:13 +08:00
2012-04-29 23:22:29 +08:00
AC_ARG_ENABLE([examples],
AS_HELP_STRING([--enable-examples], [add example files to installation]),
2013-08-13 21:21:31 +08:00
[], [enable_examples=no]
2012-04-29 23:22:29 +08:00
)
AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
2013-01-29 14:00:00 +08:00
AC_ARG_ENABLE([sigwinch],
AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
2013-08-13 21:21:31 +08:00
[], [enable_sigwinch=no]
2013-01-29 14:00:00 +08:00
)
if test "x$enable_sigwinch" = xyes; then
AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
fi
2013-05-14 13:00:00 +08:00
AC_ARG_ENABLE([wide-percent],
AS_HELP_STRING([--enable-wide-percent], [provide extra precision under %CPU and %MEM for top]),
2013-08-13 21:21:31 +08:00
[], [enable_wide_percent=no]
2013-05-14 13:00:00 +08:00
)
if test "x$enable_wide_percent" = xyes; then
AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top])
fi
2013-05-14 13:00:00 +08:00
AC_ARG_ENABLE([wide-memory],
2017-03-13 16:00:00 +08:00
AS_HELP_STRING([--enable-wide-memory], [provide extra precision under memory fields for top]),
[], [enable_wide_memory=no]
2013-05-14 13:00:00 +08:00
)
2017-03-13 16:00:00 +08:00
if test "x$enable_wide_memory" = xyes; then
AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
2013-05-14 13:00:00 +08:00
fi
2014-06-29 13:00:00 +08:00
AC_ARG_ENABLE([modern-top],
AS_HELP_STRING([--disable-modern-top], [disable new startup defaults, return to original top]),
[], [enable_modern_top=yes]
)
if test "x$enable_modern_top" = xno; then
AC_DEFINE(ORIG_TOPDEFS, 1, [disable new startup defaults, return to original top])
fi
2013-05-05 13:00:00 +08:00
DL_LIB=
2013-04-08 13:00:00 +08:00
AC_ARG_ENABLE([numa],
2013-04-25 13:00:00 +08:00
AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
2013-08-13 21:21:31 +08:00
[], [enable_numa=yes]
)
if test "x$enable_numa" = xno; then
2013-04-25 13:00:00 +08:00
AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
else
AC_SEARCH_LIBS([dlopen], [dl], [],
[AC_MSG_ERROR([dynamic linking unavailable, circumvent with --disable-numa])])
2013-10-01 10:36:58 +08:00
if test "x$ac_cv_search_dlopen" != "xnone required"; then
DL_LIB="$ac_cv_search_dlopen"
fi
2013-04-08 13:00:00 +08:00
fi
2013-05-05 13:00:00 +08:00
AC_SUBST([DL_LIB])
2013-04-08 13:00:00 +08:00
2011-10-05 02:40:19 +08:00
AC_ARG_ENABLE([w-from],
AS_HELP_STRING([--enable-w-from], [enable w from field by default]),
2013-08-13 21:21:31 +08:00
[], [enable_w_from=no]
2011-10-05 02:40:19 +08:00
)
if test "x$enable_w_from" = xyes; then
AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
fi
2011-12-05 23:35:35 +08:00
AC_ARG_ENABLE([whining],
2012-02-25 17:01:36 +08:00
AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]),
2013-08-13 21:21:31 +08:00
[], [enable_whining=yes]
2011-12-05 23:35:35 +08:00
)
if test "x$enable_whining" = xyes; then
AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)])
fi
2011-10-12 03:02:59 +08:00
if test x"$DEJAGNU" = x
then
2013-05-24 05:35:09 +08:00
DEJAGNU="/dev/null"
2011-10-12 03:02:59 +08:00
fi
AC_SUBST(DEJAGNU)
2011-11-23 18:44:51 +08:00
2020-08-30 13:00:00 +08:00
AC_CHECK_FUNCS([__fpending alarm atexit dup2 gethostname getpagesize gettimeofday iswprint memchr memmove memset mkdir nl_langinfo putenv regcomp rpmatch select setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strndup strpbrk strrchr strspn strstr strtol strtoul strverscmp utmpname wcwidth])
2013-05-05 08:07:30 +08:00
AC_CONFIG_FILES([Makefile
include/Makefile
2022-08-29 16:07:43 +08:00
po-man/Makefile
2015-05-02 12:28:53 +08:00
po/Makefile.in
2021-02-20 19:30:31 +08:00
proc/libproc-2.pc
2015-05-02 12:28:53 +08:00
testsuite/Makefile])
2011-06-04 22:26:58 +08:00
AC_OUTPUT