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],,[http://gitorious.org/procps])
9 AM_INIT_AUTOMAKE([foreign 1.11 -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])
14 # Checks for programs.
15 AC_USE_SYSTEM_EXTENSIONS(_GNU_SOURCE)
20 if test "$cross_compiling" = no; then
21 if test "x$ac_cv_prog_cc_c99" = "xno" || test "x$ac_cv_prog_cc_c99" = "x"; then
22 # We might be on RHEL5 with a git checkout and so broken
23 # autoconf. Check if CC is gcc and if it bails when given -std=gnu99.
24 # If not, use that. Yuck.
25 if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
28 [AC_LANG_PROGRAM([],[[
32 [AC_MSG_ERROR([Could not find a C99 compatible compiler])])
34 AC_MSG_ERROR([Could not find a C99 compatible compiler])
46 # Checks for header files.
48 AC_CHECK_HEADERS([arpa/inet.h fcntl.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 values.h wchar.h wctype.h])
50 # Checks for typedefs, structures, and compiler characteristics.
51 AC_CHECK_HEADER_STDBOOL
59 AC_CHECK_MEMBERS([struct stat.st_rdev])
64 # Checks for library functions.
73 usrbin_execdir='${exec_prefix}/usr/bin'
74 AC_SUBST([usrbin_execdir])
76 AM_GNU_GETTEXT_VERSION([0.14.1])
77 AM_GNU_GETTEXT([external])
78 dnl if test -d "$srcdir/po"
80 dnl ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
82 dnl 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"
85 AC_CHECK_HEADERS(error.h, [], [], AC_INCLUDES_DEFAULT)
87 AC_CHECK_HEADERS(stdio_ext.h, [], [], AC_INCLUDES_DEFAULT)
89 AC_MSG_CHECKING(whether program_invocation_name is defined)
90 AC_TRY_COMPILE([#include <errno.h>],
91 [program_invocation_name = "test";],
92 AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME, 1,
93 [Define if program_invocation_name is defined])
97 AC_MSG_CHECKING(whether program_invocation_short_name is defined)
98 AC_TRY_COMPILE([#include <errno.h>],
99 [program_invocation_short_name = "test";],
100 AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
101 [Define if program_invocation_short_name is defined])
105 dnl watch8bit must be before the AC_ARG_WITH set as it sets up ncurses
106 AC_SUBST([WITH_WATCH8BIT])
107 AC_ARG_ENABLE([watch8bit],
108 AS_HELP_STRING([--enable-watch8bit], [enable watch to be 8bit clean (requires ncursesw)]),
109 [], [enable_watch8bit=no]
111 if test "$enable_watch8bit" = "yes"; then
112 AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
115 AC_ARG_ENABLE([libselinux],
116 AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
117 [], [enable_libselinux=no]
119 if test "$enable_libselinux" = "yes"; then
120 AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
123 # Optional packages - AC_ARG_WITH
124 AC_ARG_WITH([ncurses],
125 AS_HELP_STRING([--without-ncurses], [build only applications not needing ncurses]),
126 [], [with_ncurses=yes]
128 if test "x$with_ncurses" = xno; then
129 AM_CONDITIONAL(WITH_NCURSES, false)
131 PKG_CHECK_MODULES([NCURSES], [ncurses], [], [
132 AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
133 AC_CHECK_HEADERS(curses.h ncurses.h term.h, [], [have_ncurses=no], AC_INCLUDES_DEFAULT)
134 if test "x$have_ncurses" = xno; then
135 AC_MSG_ERROR([ncurses support missing/incomplete (for partial build use --without-ncurses)])
137 NCURSES_LIBS="-lncurses"
139 AM_CONDITIONAL(WITH_NCURSES, true)
140 if test "$enable_watch8bit" = yes; then
141 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [WATCH_NCURSES_LIBS="$NCURSESW_LIBS"], [
142 AC_CHECK_LIB([ncursesw], [addwstr], [WATCH_NCURSES_LIBS=-lncursesw],
143 [AC_MSG_ERROR([Cannot find ncurses wide library ncursesw with --enable-watch8bit])])
146 WATCH_NCURSES_LIBS="$NCURSES_LIBS"
149 AC_SUBST([NCURSES_LIBS])
150 AC_SUBST([WATCH_NCURSES_LIBS])
152 AC_ARG_WITH([systemd],
153 [AS_HELP_STRING([--with-systemd], [enable systemd support])],
154 [], [with_systemd=no]
156 if test "x$with_systemd" != xno; then
157 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login >= 206], [], [
158 AC_CHECK_LIB(systemd-login, sd_pid_get_slice, [have_systemd=yes], [have_systemd=no])
159 if test "x$have_systemd" = xno; then
160 AC_MSG_ERROR([systemd support missing/incomplete])
162 SYSTEMD_LIBS="-lsystemd-login"
164 AM_CONDITIONAL(WITH_SYSTEMD, true)
165 AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
167 AM_CONDITIONAL(WITH_SYSTEMD, false)
171 AC_ARG_ENABLE([pidof],
172 AS_HELP_STRING([--disable-pidof], [do not build pidof]),
173 [], [enable_pidof=yes]
175 AM_CONDITIONAL(BUILD_PIDOF, test "x$enable_pidof" = xyes)
177 AC_ARG_ENABLE([kill],
178 AS_HELP_STRING([--disable-kill], [do not build kill]),
179 [], [enable_kill=yes]
181 AM_CONDITIONAL(BUILD_KILL, test "x$enable_kill" = xyes)
182 AM_CONDITIONAL(LINUX, test "x$host_os" = xlinux-gnu)
184 AC_ARG_ENABLE([skill],
185 AS_HELP_STRING([--enable-skill], [build skill and snice]),
186 [], [enable_skill=no]
188 AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes)
190 AC_ARG_ENABLE([examples],
191 AS_HELP_STRING([--enable-examples], [add example files to installation]),
192 [], [enable_examples=no]
194 AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
196 AC_ARG_ENABLE([oomem],
197 AS_HELP_STRING([--enable-oomem], [add out-of-memory fields to the library and top]),
198 [], [enable_oomem=no]
200 if test "x$enable_oomem" = xyes; then
201 AC_DEFINE(OOMEM_ENABLE, 1, [add out-of-memory fields to the library and top])
204 AC_ARG_ENABLE([sigwinch],
205 AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
206 [], [enable_sigwinch=no]
208 if test "x$enable_sigwinch" = xyes; then
209 AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
212 AC_ARG_ENABLE([wide-percent],
213 AS_HELP_STRING([--enable-wide-percent], [provide extra precision under %CPU and %MEM for top]),
214 [], [enable_wide_percent=no]
216 if test "x$enable_wide_percent" = xyes; then
217 AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top])
220 AC_ARG_ENABLE([wide-memory],
221 AS_HELP_STRING([--disable-wide-memory], [disable extra precision under memory fields for top]),
222 [], [enable_wide_memory=yes]
224 if test "x$enable_wide_memory" = xno; then
225 AC_DEFINE(NOBOOST_MEMS, 1, [disable extra precision under memory fields for top])
229 AC_ARG_ENABLE([numa],
230 AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
231 [], [enable_numa=yes]
233 if test "x$enable_numa" = xno; then
234 AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
236 AC_SEARCH_LIBS([dlopen], [dl], [],
237 [AC_MSG_ERROR([dynamic linking unavailable, circumvent with --disable-numa])])
238 DL_LIB="$ac_cv_search_dlopen"
242 AC_ARG_ENABLE([w-from],
243 AS_HELP_STRING([--enable-w-from], [enable w from field by default]),
244 [], [enable_w_from=no]
246 if test "x$enable_w_from" = xyes; then
247 AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
250 AC_ARG_ENABLE([whining],
251 AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]),
252 [], [enable_whining=yes]
254 if test "x$enable_whining" = xyes; then
255 AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)])
258 if test x"$DEJAGNU" = x
264 AC_CHECK_FUNCS([__fpending alarm atexit dup2 getpagesize gettimeofday iswprint memchr memmove memset munmap nl_langinfo putenv regcomp rpmatch select setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strspn strstr strtol strtoul strtoull strverscmp uname utmpname wcwidth])
266 AC_CONFIG_FILES([Makefile