2 # Process this file with autoconf to produce a configure script.
5 AC_CONFIG_MACRO_DIR([m4])
7 m4_esyscmd([misc/git-version-gen .tarball-version]),
8 [procps@freelists.org],,[https://gitlab.com/procps-ng/procps])
9 AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects -Wall -Wno-portability tar-pax no-dist-gzip dist-xz])
10 AM_SILENT_RULES([yes])
11 AC_CONFIG_SRCDIR([free.c])
12 AC_CONFIG_HEADERS([config.h])
15 # Checks for programs.
16 AC_USE_SYSTEM_EXTENSIONS
21 if test "$cross_compiling" = no; then
22 if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then
23 # We might be on RHEL5 with a git checkout and so broken
24 # autoconf. Check if CC is gcc and if it bails when given -std=gnu99.
25 # If not, use that. Yuck.
26 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
29 [AC_LANG_PROGRAM([],[[
33 [AC_MSG_ERROR([Could not find a C99 compatible compiler])])
35 AC_MSG_ERROR([Could not find a C99 compatible compiler])
46 AC_DEFUN([PROCPS_PROG_PO4A], [
48 AC_CHECK_PROGS([PO4A], [po4a])
49 AS_IF([test "$USE_NLS" = "yes" && test -n "$PO4A"], [
58 # Checks for header files.
60 AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h netinet/in.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])
62 # Checks for typedefs, structures, and compiler characteristics.
63 AC_CHECK_HEADER_STDBOOL
71 AC_CHECK_MEMBERS([struct stat.st_rdev])
76 # Checks for library functions.
85 usrbin_execdir='${exec_prefix}/bin'
86 AC_SUBST([usrbin_execdir])
88 if test "x$host_os" = xcygwin
96 infodir=/usr/share/info
98 AC_SUBST([sysconfdir])
99 AC_SUBST([libexecdir])
100 AC_SUBST([localstatedir])
106 AM_GNU_GETTEXT_VERSION([0.14.1])
107 AM_GNU_GETTEXT([external])
108 if test -d "$srcdir/po"
110 ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
112 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"
115 AC_CHECK_HEADERS(error.h, [], [], AC_INCLUDES_DEFAULT)
117 AC_CHECK_HEADERS(stdio_ext.h, [], [], AC_INCLUDES_DEFAULT)
119 AC_MSG_CHECKING(whether program_invocation_name is defined)
120 AC_TRY_COMPILE([#include <errno.h>],
121 [program_invocation_name = "test";],
122 AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME, 1,
123 [Define if program_invocation_name is defined])
127 AC_MSG_CHECKING(whether program_invocation_short_name is defined)
128 AC_TRY_COMPILE([#include <errno.h>],
129 [program_invocation_short_name = "test";],
130 AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
131 [Define if program_invocation_short_name is defined])
135 AC_CHECK_FUNC([pidfd_open], [enable_pwait=yes], [
136 AC_MSG_CHECKING([for __NR_pidfd_open])
137 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
138 #include <sys/syscall.h>
139 #ifndef __NR_pidfd_open
140 #error __NR_pidfd_open not defined
142 ])], [enable_pwait=yes], [enable_pwait=no])
143 AC_MSG_RESULT([$enable_pwait])
145 if test "$enable_pwait" = yes; then
146 AC_DEFINE([ENABLE_PWAIT], [1], [Enable pwait])
148 AM_CONDITIONAL([BUILD_PWAIT], [test x$enable_pwait = xyes])
150 dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses
151 AC_SUBST([WITH_WATCH8BIT])
152 AC_ARG_ENABLE([watch8bit],
153 AS_HELP_STRING([--enable-watch8bit], [enable watch to be 8bit clean (requires ncursesw)]),
154 [], [enable_watch8bit=no]
156 if test "$enable_watch8bit" = "yes"; then
157 AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
160 AC_ARG_ENABLE([libselinux],
161 AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
162 [], [enable_libselinux=no]
164 if test "$enable_libselinux" = "yes"; then
165 AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
168 # Optional packages - AC_ARG_WITH
169 AC_ARG_WITH([ncurses],
170 AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
171 [], [with_ncurses=yes]
173 if test "x$with_ncurses" = xno; then
174 AM_CONDITIONAL(WITH_NCURSES, false)
176 PKG_CHECK_MODULES([NCURSES], [ncurses], [], [
177 AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
178 AC_CHECK_HEADERS(curses.h ncurses.h term.h, [], [have_ncurses=no], AC_INCLUDES_DEFAULT)
179 if test "x$have_ncurses" = xno; then
180 AC_MSG_ERROR([ncurses support missing/incomplete (for partial build use --without-ncurses)])
182 NCURSES_LIBS="-lncurses"
184 AM_CONDITIONAL(WITH_NCURSES, true)
185 if test "$enable_watch8bit" = yes; then
186 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [WATCH_NCURSES_LIBS="$NCURSESW_LIBS"]
187 [WATCH_NCURSES_CFLAGS="$NCURSESW_CFLAGS"], [
188 AC_CHECK_LIB([ncursesw], [addwstr], [WATCH_NCURSES_LIBS=-lncursesw], [
189 AC_CHECK_LIB([ncurses], [addwstr], [WATCH_NCURSES_LIBS=-lncurses], [
190 AC_MSG_ERROR([Cannot find ncurses wide library ncursesw with --enable-watch8bit])
195 WATCH_NCURSES_LIBS="$NCURSES_LIBS"
198 AC_SUBST([NCURSES_LIBS])
199 AC_SUBST([WATCH_NCURSES_LIBS])
200 AC_SUBST([WATCH_NCURSES_CFLAGS])
202 AC_ARG_WITH([systemd],
203 [AS_HELP_STRING([--with-systemd], [enable systemd support])],
204 [], [with_systemd=no]
206 AS_IF([test "x$with_systemd" != "xno"], [
207 PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
208 AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
210 AM_CONDITIONAL([WITH_SYSTEMD], [test x$with_systemd != xno])
212 AC_ARG_WITH([elogind],
213 [AS_HELP_STRING([--with-elogind], [enable elogind support])],
214 [], [with_elogind=no]
216 # Do not allow elogind if systemd is wanted and found
217 AS_IF([test "x$with_systemd" != "xno"], [with_elogind=no])
219 AS_IF([test "x$with_elogind" != "xno"], [
220 PKG_CHECK_MODULES([ELOGIND], [libelogind])
221 AC_DEFINE(WITH_ELOGIND, 1, [enable elogind support])
223 AM_CONDITIONAL([WITH_ELOGIND], [test x$with_elogind != xno])
226 AC_ARG_ENABLE([pidof],
227 AS_HELP_STRING([--disable-pidof], [do not build pidof]),
228 [], [enable_pidof=yes]
230 AM_CONDITIONAL(BUILD_PIDOF, test "x$enable_pidof" = xyes)
232 AC_ARG_ENABLE([kill],
233 AS_HELP_STRING([--disable-kill], [do not build kill]),
234 [], [enable_kill=yes]
236 AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
237 AM_CONDITIONAL(LINUX, test "x$host_os" = xlinux-gnu)
238 AM_CONDITIONAL(CYGWIN, test "x$host_os" = xcygwin)
240 AC_ARG_ENABLE([skill],
241 AS_HELP_STRING([--enable-skill], [build skill and snice]),
242 [], [enable_skill=no]
244 AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes)
246 AC_ARG_ENABLE([examples],
247 AS_HELP_STRING([--enable-examples], [add example files to installation]),
248 [], [enable_examples=no]
250 AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
252 AC_ARG_ENABLE([sigwinch],
253 AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
254 [], [enable_sigwinch=no]
256 if test "x$enable_sigwinch" = xyes; then
257 AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
260 AC_ARG_ENABLE([wide-percent],
261 AS_HELP_STRING([--enable-wide-percent], [provide extra precision under %CPU and %MEM for top]),
262 [], [enable_wide_percent=no]
264 if test "x$enable_wide_percent" = xyes; then
265 AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top])
268 AC_ARG_ENABLE([wide-memory],
269 AS_HELP_STRING([--enable-wide-memory], [provide extra precision under memory fields for top]),
270 [], [enable_wide_memory=no]
272 if test "x$enable_wide_memory" = xyes; then
273 AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
276 AC_ARG_ENABLE([modern-top],
277 AS_HELP_STRING([--disable-modern-top], [disable new startup defaults, return to original top]),
278 [], [enable_modern_top=yes]
280 if test "x$enable_modern_top" = xno; then
281 AC_DEFINE(ORIG_TOPDEFS, 1, [disable new startup defaults, return to original top])
285 AC_ARG_ENABLE([numa],
286 AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
287 [], [enable_numa=yes]
289 if test "x$enable_numa" = xno; then
290 AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
292 AC_SEARCH_LIBS([dlopen], [dl], [],
293 [AC_MSG_ERROR([dynamic linking unavailable, circumvent with --disable-numa])])
294 if test "x$ac_cv_search_dlopen" != "xnone required"; then
295 DL_LIB="$ac_cv_search_dlopen"
300 AC_ARG_ENABLE([w-from],
301 AS_HELP_STRING([--enable-w-from], [enable w from field by default]),
302 [], [enable_w_from=no]
304 if test "x$enable_w_from" = xyes; then
305 AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
308 AC_ARG_ENABLE([whining],
309 AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]),
310 [], [enable_whining=yes]
312 if test "x$enable_whining" = xyes; then
313 AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)])
316 if test x"$DEJAGNU" = x
322 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 strtoull strverscmp utmpname wcwidth])
324 AC_CONFIG_FILES([Makefile