Change GPL-2.0+/LGPL-2.0+ to GPL-2.0-or-later/LGPL-2.0-or-later
[platform/upstream/procps-ng.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ([2.69])
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_INIT([procps-ng],
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])
13 AC_LANG([C])
14
15 # Checks for programs.
16 AC_USE_SYSTEM_EXTENSIONS
17 AC_SYS_LARGEFILE
18 AC_PROG_AWK
19 AC_PROG_CC
20 AC_PROG_CC_STDC
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
27        CC="$CC -std=gnu99"
28        AC_RUN_IFELSE(
29           [AC_LANG_PROGRAM([],[[
30   return 0;
31       ]])],
32       [],
33       [AC_MSG_ERROR([Could not find a C99 compatible compiler])])
34     else
35       AC_MSG_ERROR([Could not find a C99 compatible compiler])
36     fi
37   fi
38 fi
39 AM_PROG_CC_C_O
40 AC_PROG_CPP
41 AC_PROG_INSTALL
42 AC_PROG_LN_S
43 PKG_PROG_PKG_CONFIG
44 AC_PROG_MAKE_SET
45
46 AC_DEFUN([PROCPS_PROG_PO4A], [
47   AC_REQUIRE([AM_NLS])
48   AC_CHECK_PROGS([PO4A], [po4a])
49   AS_IF([test "$USE_NLS" = "yes" && test -n "$PO4A"], [
50     USE_PO4A=yes
51   ], [
52     USE_PO4A=no
53   ])
54   AC_SUBST([USE_PO4A])
55 ])
56 PROCPS_PROG_PO4A
57
58 # Checks for header files.
59 AC_HEADER_MAJOR
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])
61
62 # Checks for typedefs, structures, and compiler characteristics.
63 AC_CHECK_HEADER_STDBOOL
64 AC_TYPE_UID_T
65 AC_C_INLINE
66 AC_TYPE_INT32_T
67 AC_TYPE_PID_T
68 AC_C_RESTRICT
69 AC_TYPE_SIZE_T
70 AC_TYPE_SSIZE_T
71 AC_CHECK_MEMBERS([struct stat.st_rdev])
72
73 dnl libtool
74 LT_INIT
75
76 # Checks for library functions.
77 AC_FUNC_ERROR_AT_LINE
78 AC_FUNC_FORK
79 AC_FUNC_MALLOC
80 AC_FUNC_MBRTOWC
81 AC_FUNC_MMAP
82 AC_FUNC_REALLOC
83 AC_FUNC_STRTOD
84
85 usrbin_execdir='${exec_prefix}/bin'
86 AC_SUBST([usrbin_execdir])
87
88 if test "x$host_os" = xcygwin
89 then
90   prefix=/usr
91   sysconfdir=/etc
92   libexecdir=/usr/lib
93   localstatedir=/var
94   datadir=/usr/share
95   mandir=/usr/share/man
96   infodir=/usr/share/info
97   AC_SUBST([prefix])
98   AC_SUBST([sysconfdir])
99   AC_SUBST([libexecdir])
100   AC_SUBST([localstatedir])
101   AC_SUBST([datadir])
102   AC_SUBST([mandir])
103   AC_SUBST([infodir])
104 fi
105
106 AM_GNU_GETTEXT_VERSION([0.14.1])
107 AM_GNU_GETTEXT([external])
108 if test -d "$srcdir/po"
109 then
110         ALL_LINGUAS=`cd $srcdir/po > /dev/null && echo *.po | sed 's/\.po//g'`
111 else
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"
113 fi
114
115 AC_CHECK_HEADERS(error.h, [], [], AC_INCLUDES_DEFAULT)
116
117 AC_CHECK_HEADERS(stdio_ext.h, [], [], AC_INCLUDES_DEFAULT)
118
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])
124                 AC_MSG_RESULT(yes),
125                 AC_MSG_RESULT(no))
126
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])
132                 AC_MSG_RESULT(yes),
133                 AC_MSG_RESULT(no))
134
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
141 #endif
142     ])], [enable_pwait=yes], [enable_pwait=no])
143   AC_MSG_RESULT([$enable_pwait])
144 ])
145 if test "$enable_pwait" = yes; then
146   AC_DEFINE([ENABLE_PWAIT], [1], [Enable pwait])
147 fi
148 AM_CONDITIONAL([BUILD_PWAIT], [test x$enable_pwait = xyes])
149
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]
155 )
156 if test "$enable_watch8bit" = "yes"; then
157   AC_DEFINE([WITH_WATCH8BIT], [1], [Enable 8 bit clean watch])
158 fi
159
160 AC_ARG_ENABLE([libselinux],
161   AS_HELP_STRING([--enable-libselinux], [enable libselinux]),
162   [], [enable_libselinux=no]
163 )
164 if test "$enable_libselinux" = "yes"; then
165   AC_DEFINE([ENABLE_LIBSELINUX], [1], [Enable libselinux])
166 fi
167
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]
172 )
173 if test "x$with_ncurses" = xno; then
174   AM_CONDITIONAL(WITH_NCURSES, false)
175 else
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)])
181     fi
182     NCURSES_LIBS="-lncurses"
183   ])
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])
191         ])
192       ])
193     ])
194   else
195     WATCH_NCURSES_LIBS="$NCURSES_LIBS"
196   fi
197 fi
198 AC_SUBST([NCURSES_LIBS])
199 AC_SUBST([WATCH_NCURSES_LIBS])
200 AC_SUBST([WATCH_NCURSES_CFLAGS])
201
202 AC_ARG_WITH([systemd],
203   [AS_HELP_STRING([--with-systemd], [enable systemd support])],
204   [], [with_systemd=no]
205 )
206 AS_IF([test "x$with_systemd" != "xno"], [
207   PKG_CHECK_MODULES([SYSTEMD], [libsystemd])
208   AC_DEFINE(WITH_SYSTEMD, 1, [enable systemd support])
209 ])
210 AM_CONDITIONAL([WITH_SYSTEMD], [test x$with_systemd != xno])
211
212 AC_ARG_WITH([elogind],
213   [AS_HELP_STRING([--with-elogind], [enable elogind support])],
214   [], [with_elogind=no]
215 )
216 # Do not allow elogind if systemd is wanted and found
217 AS_IF([test "x$with_systemd" != "xno"], [with_elogind=no])
218
219 AS_IF([test "x$with_elogind" != "xno"], [
220   PKG_CHECK_MODULES([ELOGIND], [libelogind])
221   AC_DEFINE(WITH_ELOGIND, 1, [enable elogind support])
222 ])
223 AM_CONDITIONAL([WITH_ELOGIND], [test x$with_elogind != xno])
224
225 # AC_ARG_ENABLEs
226 AC_ARG_ENABLE([pidof],
227   AS_HELP_STRING([--disable-pidof], [do not build pidof]),
228   [], [enable_pidof=yes]
229 )
230 AM_CONDITIONAL(BUILD_PIDOF, test "x$enable_pidof" = xyes)
231
232 AC_ARG_ENABLE([kill],
233   AS_HELP_STRING([--disable-kill], [do not build kill]),
234   [], [enable_kill=yes]
235 )
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)
239
240 AC_ARG_ENABLE([skill],
241   AS_HELP_STRING([--enable-skill], [build skill and snice]),
242   [], [enable_skill=no]
243 )
244 AM_CONDITIONAL(BUILD_SKILL, test "x$enable_skill" = xyes)
245
246 AC_ARG_ENABLE([examples],
247   AS_HELP_STRING([--enable-examples], [add example files to installation]),
248   [], [enable_examples=no]
249 )
250 AM_CONDITIONAL(EXAMPLE_FILES, test "x$enable_examples" = xyes)
251
252 AC_ARG_ENABLE([sigwinch],
253   AS_HELP_STRING([--enable-sigwinch], [reduce impact of x-windows resize operations on top]),
254   [], [enable_sigwinch=no]
255 )
256 if test "x$enable_sigwinch" = xyes; then
257   AC_DEFINE(SIGNALS_LESS, 1, [reduce impact of x-windows resize operations on top])
258 fi
259
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]
263 )
264 if test "x$enable_wide_percent" = xyes; then
265   AC_DEFINE(BOOST_PERCNT, 1, [provide extra precision under %CPU and %MEM for top])
266 fi
267
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]
271 )
272 if test "x$enable_wide_memory" = xyes; then
273   AC_DEFINE(BOOST_MEMORY, 1, [provide extra precision under memory fields for top])
274 fi
275
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]
279 )
280 if test "x$enable_modern_top" = xno; then
281   AC_DEFINE(ORIG_TOPDEFS, 1, [disable new startup defaults, return to original top])
282 fi
283
284 DL_LIB=
285 AC_ARG_ENABLE([numa],
286   AS_HELP_STRING([--disable-numa], [disable NUMA/Node support in top]),
287   [], [enable_numa=yes]
288 )
289 if test "x$enable_numa" = xno; then
290   AC_DEFINE([NUMA_DISABLE], [1], [disable NUMA/Node support in top])
291 else
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"
296   fi
297 fi
298 AC_SUBST([DL_LIB])
299
300 AC_ARG_ENABLE([w-from],
301   AS_HELP_STRING([--enable-w-from], [enable w from field by default]),
302   [], [enable_w_from=no]
303 )
304 if test "x$enable_w_from" = xyes; then
305   AC_DEFINE(W_SHOWFROM, 1, [enable w from field by default])
306 fi
307
308 AC_ARG_ENABLE([whining],
309   AS_HELP_STRING([--disable-whining], [do not print unnecessary warnings (slackware-ism)]),
310   [], [enable_whining=yes]
311 )
312 if test "x$enable_whining" = xyes; then
313   AC_DEFINE(BUILD_WITH_WHINE, 1, [should extra warnings be printed (slackware-ism)])
314 fi
315
316 if test x"$DEJAGNU" = x
317 then
318   DEJAGNU="/dev/null"
319 fi
320 AC_SUBST(DEJAGNU)
321
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])
323
324 AC_CONFIG_FILES([Makefile
325                  include/Makefile
326                  man-po/Makefile
327                  po/Makefile.in
328                  proc/libprocps.pc
329                  testsuite/Makefile])
330 AC_OUTPUT