blob: 4e357a31dd67cb1e9efbd86343db90baa81c1c52 [file] [log] [blame]
Hisham Muhammadd6231ba2006-03-04 18:16:49 +00001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
Hisham Muhammadec17b702011-09-24 00:30:47 +00004AC_PREREQ(2.65)
Nathan Scotta7a5e352020-08-20 13:16:31 +10005AC_INIT([htop],[3.0.0],[htop@groups.io])
Hisham Muhammad3383d8e2015-01-21 23:27:31 -02006
Explorer09b71b07f2016-03-12 12:02:06 +08007AC_CONFIG_SRCDIR([htop.c])
8AC_CONFIG_AUX_DIR([.])
9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_MACRO_DIR([m4])
11
12# Required by hwloc scripts
Hisham Muhammadec17b702011-09-24 00:30:47 +000013AC_CANONICAL_TARGET
14
15AM_INIT_AUTOMAKE([1.11])
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000016
17# Checks for programs.
Hisham Muhammad300af4b2014-11-19 23:17:16 -020018# ----------------------------------------------------------------------
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000019AC_PROG_CC
Hisham Muhammad4df76d12008-03-05 09:46:47 +000020AM_PROG_CC_C_O
21
Explorer09b71b07f2016-03-12 12:02:06 +080022# Required by hwloc scripts
23AC_USE_SYSTEM_EXTENSIONS
24
Hisham Muhammadeb229d92014-11-24 18:55:03 -020025# Checks for platform.
26# ----------------------------------------------------------------------
James Clarkea9508272016-04-18 23:55:55 +010027case "$target_os" in
James Clarke2de52862016-04-18 23:57:30 +010028linux*|gnu*)
Hisham Muhammadeb229d92014-11-24 18:55:03 -020029 my_htop_platform=linux
30 ;;
James Clarkea9508272016-04-18 23:55:55 +010031freebsd*|kfreebsd*)
Hisham Muhammad8915b292014-11-27 16:27:34 -020032 my_htop_platform=freebsd
33 ;;
James Clarkea9508272016-04-18 23:55:55 +010034openbsd*)
Michael McConvillea9a5a532015-09-18 00:46:48 -040035 my_htop_platform=openbsd
36 ;;
Diederik de Grootb258d6e2017-04-19 16:12:17 +020037dragonfly*)
38 my_htop_platform=dragonflybsd
39 ;;
James Clarkea9508272016-04-18 23:55:55 +010040darwin*)
David Hunt70e7c8d2015-07-12 13:47:43 -050041 my_htop_platform=darwin
42 ;;
gmbroome697f5bb2018-03-02 16:20:46 -050043solaris*)
44 my_htop_platform=solaris
45 ;;
Hisham Muhammadeb229d92014-11-24 18:55:03 -020046*)
47 my_htop_platform=unsupported
48 ;;
49esac
Hisham Muhammadeb229d92014-11-24 18:55:03 -020050
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000051# Checks for libraries.
Hisham Muhammad300af4b2014-11-19 23:17:16 -020052# ----------------------------------------------------------------------
Hisham Muhammade46f1422006-07-12 01:15:14 +000053AC_CHECK_LIB([m], [ceil], [], [missing_libraries="$missing_libraries libm"])
54
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000055# Checks for header files.
Hisham Muhammad300af4b2014-11-19 23:17:16 -020056# ----------------------------------------------------------------------
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000057AC_HEADER_DIRENT
58AC_HEADER_STDC
Hisham Muhammada0810562013-02-26 17:10:11 +000059AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h],[:],[
Hisham Muhammade46f1422006-07-12 01:15:14 +000060 missing_headers="$missing_headers $ac_header"
61])
Hisham Muhammad36ef1a92010-12-05 15:43:56 +000062AC_CHECK_HEADERS([execinfo.h],[:],[:])
Hisham Muhammade46f1422006-07-12 01:15:14 +000063
Kang-Che Sung (宋岡哲)c01f40e2018-02-26 21:15:05 +080064AC_HEADER_MAJOR
65dnl glibc 2.25 deprecates 'major' and 'minor' in <sys/types.h> and requires to
66dnl include <sys/sysmacros.h>. However the logic in AC_HEADER_MAJOR has not yet
67dnl been updated in Autoconf 2.69, so use a workaround:
68m4_version_prereq([2.70], [],
Explorer0935129712018-12-30 12:18:27 +080069[if test "x$ac_cv_header_sys_mkdev_h" != xyes; then
Kang-Che Sung (宋岡哲)c01f40e2018-02-26 21:15:05 +080070 AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
71 [Define to 1 if `major', `minor', and `makedev' are declared in <sys/sysmacros.h>.])])
72fi])
73
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000074# Checks for typedefs, structures, and compiler characteristics.
Hisham Muhammad300af4b2014-11-19 23:17:16 -020075# ----------------------------------------------------------------------
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000076AC_HEADER_STDBOOL
77AC_C_CONST
78AC_TYPE_PID_T
79AC_TYPE_UID_T
80
Hisham Muhammad300af4b2014-11-19 23:17:16 -020081# Checks for library functions and compiler features.
82# ----------------------------------------------------------------------
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000083AC_FUNC_CLOSEDIR_VOID
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000084AC_TYPE_SIGNAL
85AC_FUNC_STAT
86AC_CHECK_FUNCS([memmove strncasecmp strstr strdup])
87
Hisham Muhammad4df76d12008-03-05 09:46:47 +000088save_cflags="${CFLAGS}"
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000089CFLAGS="${CFLAGS} -std=c99"
90AC_MSG_CHECKING([whether gcc -std=c99 option works])
Explorer09f0df28a2016-03-12 11:58:30 +080091AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
92 [AC_INCLUDES_DEFAULT], [[char *a; a = strdup("foo"); int i = 0; i++; // C99]])],
93 [AC_MSG_RESULT([yes])],
94 [AC_MSG_ERROR([htop is written in C99. A newer version of gcc is required.])])
Hisham Muhammad4df76d12008-03-05 09:46:47 +000095CFLAGS="$save_cflags"
Hisham Muhammadd6231ba2006-03-04 18:16:49 +000096
Hisham Muhammadaed9b9d2015-02-04 12:19:04 -020097save_cflags="${CFLAGS}"
98CFLAGS="$CFLAGS -Wextra"
99AC_MSG_CHECKING([if compiler supports -Wextra])
Explorer09f0df28a2016-03-12 11:58:30 +0800100AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],[
Hisham Muhammadaed9b9d2015-02-04 12:19:04 -0200101 wextra_flag=-Wextra
102 AC_MSG_RESULT([yes])
103],[
104 wextra_flag=
105 AC_MSG_RESULT([no])
106])
107CFLAGS="$save_cflags"
108AC_SUBST(wextra_flag)
109
Hisham Muhammad300af4b2014-11-19 23:17:16 -0200110# Checks for features and flags.
111# ----------------------------------------------------------------------
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000112PROCDIR=/proc
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200113
Explorer09f0df28a2016-03-12 11:58:30 +0800114AC_ARG_ENABLE(proc, [AS_HELP_STRING([--enable-proc], [use Linux-compatible proc filesystem])], enable_proc="yes", enable_proc="no")
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200115if test "x$enable_proc" = xyes; then
Hisham Muhammada75161f2014-11-24 20:11:33 -0200116 # An enabled proc assumes we're emulating Linux.
117 my_htop_platform=linux
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200118 AC_DEFINE(HAVE_PROC, 1, [Define if using a Linux-compatible proc filesystem.])
119fi
120
Explorer09f0df28a2016-03-12 11:58:30 +0800121AC_ARG_WITH(proc, [AS_HELP_STRING([--with-proc=DIR], [Location of a Linux-compatible proc filesystem (default=/proc).])],
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000122
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200123if test -n "$withval"; then
124 AC_DEFINE_UNQUOTED(PROCDIR, "$withval", [Path of proc filesystem])
125 PROCDIR="$withval"
126fi,
127AC_DEFINE(PROCDIR, "/proc", [Path of proc filesystem]))
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000128
Hisham Muhammad300af4b2014-11-19 23:17:16 -0200129if test "x$cross_compiling" = xno; then
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200130 if test "x$enable_proc" = xyes; then
131 AC_CHECK_FILE($PROCDIR/stat,,AC_MSG_ERROR(Cannot find $PROCDIR/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.))
132 AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find $PROCDIR/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.))
133 fi
Hisham Muhammad300af4b2014-11-19 23:17:16 -0200134fi
135
Explorer09f0df28a2016-03-12 11:58:30 +0800136AC_ARG_ENABLE(openvz, [AS_HELP_STRING([--enable-openvz], [enable OpenVZ support])], ,enable_openvz="no")
Hisham Muhammad4c51ad02007-08-10 05:07:14 +0000137if test "x$enable_openvz" = xyes; then
Hisham Muhammad8fa33dc2008-03-09 02:33:23 +0000138 AC_DEFINE(HAVE_OPENVZ, 1, [Define if openvz support enabled.])
139fi
140
Explorer09f0df28a2016-03-12 11:58:30 +0800141AC_ARG_ENABLE(cgroup, [AS_HELP_STRING([--enable-cgroup], [enable cgroups support])], ,enable_cgroup="no")
Hisham Muhammad84ed4c02010-10-30 19:24:07 +0000142if test "x$enable_cgroup" = xyes; then
143 AC_DEFINE(HAVE_CGROUP, 1, [Define if cgroup support enabled.])
144fi
145
Explorer09f0df28a2016-03-12 11:58:30 +0800146AC_ARG_ENABLE(vserver, [AS_HELP_STRING([--enable-vserver], [enable VServer support])], ,enable_vserver="no")
Hisham Muhammada5dfaa22008-09-23 04:31:13 +0000147if test "x$enable_vserver" = xyes; then
148 AC_DEFINE(HAVE_VSERVER, 1, [Define if vserver support enabled.])
149fi
150
Explorer09f0df28a2016-03-12 11:58:30 +0800151AC_ARG_ENABLE(ancient_vserver, [AS_HELP_STRING([--enable-ancient-vserver], [enable ancient VServer support (implies --enable-vserver)])], ,enable_ancient_vserver="no")
Hisham Muhammada5dfaa22008-09-23 04:31:13 +0000152if test "x$enable_ancient_vserver" = xyes; then
153 AC_DEFINE(HAVE_VSERVER, 1, [Define if vserver support enabled.])
154 AC_DEFINE(HAVE_ANCIENT_VSERVER, 1, [Define if ancient vserver support enabled.])
155fi
156
Explorer09f0df28a2016-03-12 11:58:30 +0800157AC_ARG_ENABLE(taskstats, [AS_HELP_STRING([--enable-taskstats], [enable per-task IO Stats (taskstats kernel sup required)])], ,enable_taskstats="yes")
Hisham Muhammad12f4f092008-03-09 08:02:22 +0000158if test "x$enable_taskstats" = xyes; then
159 AC_DEFINE(HAVE_TASKSTATS, 1, [Define if taskstats support enabled.])
160fi
161
Hisham Muhammaddb682862015-12-09 17:17:30 -0200162# HTOP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART)
163m4_define([HTOP_CHECK_SCRIPT],
Hisham Muhammad96c929f2015-11-30 16:36:22 -0200164[
Ricardo Martincoski78b82d02016-07-11 20:12:07 -0300165 if test ! -z "m4_toupper($HTOP_[$1]_CONFIG_SCRIPT)"; then
166 # to be used to set the path to ncurses*-config when cross-compiling
Michael Kleinbc5d4692018-02-26 14:19:01 +0100167 htop_config_script_libs=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null)
168 htop_config_script_cflags=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --cflags 2> /dev/null)
Ricardo Martincoski78b82d02016-07-11 20:12:07 -0300169 else
Michael Kleinbc5d4692018-02-26 14:19:01 +0100170 htop_config_script_libs=$([$4] --libs 2> /dev/null)
171 htop_config_script_cflags=$([$4] --cflags 2> /dev/null)
Ricardo Martincoski78b82d02016-07-11 20:12:07 -0300172 fi
Hisham Muhammaddb682862015-12-09 17:17:30 -0200173 htop_script_success=no
174 htop_save_LDFLAGS="$LDFLAGS"
Michael Kleinbc5d4692018-02-26 14:19:01 +0100175 htop_save_CFLAGS="$CFLAGS"
176 if test ! "x$htop_config_script_libs" = x; then
177 LDFLAGS="$htop_config_script_libs $LDFLAGS"
178 CFLAGS="$htop_config_script_cflags $CFLAGS"
Hisham Muhammaddb682862015-12-09 17:17:30 -0200179 AC_CHECK_LIB([$1], [$2], [
180 AC_DEFINE([$3], 1, [The library is present.])
Michael Kleinbc5d4692018-02-26 14:19:01 +0100181 LIBS="$htop_config_script_libs $LIBS "
Hisham Muhammaddb682862015-12-09 17:17:30 -0200182 htop_script_success=yes
Michael Kleinbc5d4692018-02-26 14:19:01 +0100183 ], [
184 CFLAGS="$htop_save_CFLAGS"
185 ])
Hisham Muhammaddf9922a2018-02-17 14:50:55 -0200186 LDFLAGS="$htop_save_LDFLAGS"
Hisham Muhammadc2377022015-12-06 19:06:23 -0200187 fi
Hisham Muhammadcccc18d2015-12-09 17:34:57 -0200188 if test "x$htop_script_success" = xno; then
Hisham Muhammaddb682862015-12-09 17:17:30 -0200189 [$5]
190 fi
191])
192
193# HTOP_CHECK_LIB(LIBNAME, FUNCTION, DEFINE, ELSE_PART)
194m4_define([HTOP_CHECK_LIB],
195[
Hisham Muhammad96c929f2015-11-30 16:36:22 -0200196 AC_CHECK_LIB([$1], [$2], [
197 AC_DEFINE([$3], 1, [The library is present.])
Hisham Muhammaddb682862015-12-09 17:17:30 -0200198 LIBS="-l[$1] $LIBS "
199 ], [$4])
Hisham Muhammad96c929f2015-11-30 16:36:22 -0200200])
201
Explorer09f0df28a2016-03-12 11:58:30 +0800202AC_ARG_ENABLE(unicode, [AS_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="yes")
Hisham Muhammad8fa33dc2008-03-09 02:33:23 +0000203if test "x$enable_unicode" = xyes; then
Hisham Muhammaddb682862015-12-09 17:17:30 -0200204 HTOP_CHECK_SCRIPT([ncursesw6], [addnwstr], [HAVE_LIBNCURSESW], "ncursesw6-config",
Diederik de Grootb258d6e2017-04-19 16:12:17 +0200205 HTOP_CHECK_SCRIPT([ncursesw], [addnwstr], [HAVE_LIBNCURSESW], "ncursesw6-config",
206 HTOP_CHECK_SCRIPT([ncursesw], [addnwstr], [HAVE_LIBNCURSESW], "ncursesw5-config",
207 HTOP_CHECK_SCRIPT([ncurses], [addnwstr], [HAVE_LIBNCURSESW], "ncurses5-config",
208 HTOP_CHECK_LIB([ncursesw6], [addnwstr], [HAVE_LIBNCURSESW],
209 HTOP_CHECK_LIB([ncursesw], [addnwstr], [HAVE_LIBNCURSESW],
210 HTOP_CHECK_LIB([ncurses], [addnwstr], [HAVE_LIBNCURSESW],
211 missing_libraries="$missing_libraries libncursesw"
212 AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.])
213 )))))))
Hisham Muhammaddb682862015-12-09 17:17:30 -0200214
Hisham Muhammada7bcf1d2011-09-08 01:45:16 +0000215 AC_CHECK_HEADERS([ncursesw/curses.h],[:],
Hisham Muhammada0810562013-02-26 17:10:11 +0000216 [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
217 [AC_CHECK_HEADERS([ncurses/curses.h],[:],
218 [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])])
Hisham Muhammad8fa33dc2008-03-09 02:33:23 +0000219else
Hisham Muhammaddb682862015-12-09 17:17:30 -0200220 HTOP_CHECK_SCRIPT([ncurses6], [refresh], [HAVE_LIBNCURSES], "ncurses6-config",
221 HTOP_CHECK_SCRIPT([ncurses], [refresh], [HAVE_LIBNCURSES], "ncurses5-config",
222 HTOP_CHECK_LIB([ncurses6], [refresh], [HAVE_LIBNCURSES],
223 HTOP_CHECK_LIB([ncurses], [refresh], [HAVE_LIBNCURSES],
224 missing_libraries="$missing_libraries libncurses"
225 ))))
226
Hisham Muhammada0810562013-02-26 17:10:11 +0000227 AC_CHECK_HEADERS([curses.h],[:],
228 [AC_CHECK_HEADERS([ncurses/curses.h],[:],
229 [AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
230 [AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])])
Hisham Muhammad4c51ad02007-08-10 05:07:14 +0000231fi
232
Hisham Muhammad0aa485c2014-11-27 18:31:39 -0200233if test "$my_htop_platform" = "freebsd"; then
234 AC_CHECK_LIB([kvm], [kvm_open], [], [missing_libraries="$missing_libraries libkvm"])
235fi
236
Michael McConvillea9a5a532015-09-18 00:46:48 -0400237if test "$my_htop_platform" = "openbsd"; then
238 AC_CHECK_LIB([kvm], [kvm_open], [], [missing_libraries="$missing_libraries libkvm"])
239fi
240
gmbroome697f5bb2018-03-02 16:20:46 -0500241if test "$my_htop_platform" = "solaris"; then
242 AC_CHECK_LIB([kstat], [kstat_open], [], [missing_libraries="$missing_libraries libkstat"])
Guy M. Broome45fad052018-03-28 12:48:37 -0400243 AC_CHECK_LIB([proc], [Pgrab_error], [], [missing_libraries="$missing_libraries libproc"])
Guy M. Broome76ef3682018-03-05 12:02:07 -0500244 AC_CHECK_LIB([malloc], [free], [], [missing_libraries="$missing_libraries libmalloc"])
gmbroome697f5bb2018-03-02 16:20:46 -0500245fi
246
Explorer09f0df28a2016-03-12 11:58:30 +0800247AC_ARG_ENABLE(linux_affinity, [AS_HELP_STRING([--enable-linux-affinity], [enable Linux sched_setaffinity and sched_getaffinity for affinity support, disables hwloc])], ,enable_linux_affinity="yes")
Hisham474d26c2016-02-14 19:57:29 -0200248if test "x$enable_linux_affinity" = xyes -a "x$cross_compiling" = xno; then
Hisham Muhammad7ca10812011-11-18 06:08:56 +0000249 AC_MSG_CHECKING([for usable sched_setaffinity])
250 AC_RUN_IFELSE([
251 AC_LANG_PROGRAM([[
252 #include <sched.h>
253 #include <errno.h>
254 static cpu_set_t cpuset;
255 ]], [[
256 CPU_ZERO(&cpuset);
257 sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
258 if (errno == ENOSYS) return 1;
259 ]])],
Hisham Muhammaddfad0af2011-11-23 18:43:35 +0000260 [AC_MSG_RESULT([yes])],
Hisham474d26c2016-02-14 19:57:29 -0200261 [enable_linux_affinity=no
Hisham Muhammaddfad0af2011-11-23 18:43:35 +0000262 AC_MSG_RESULT([no])])
263fi
Hisham474d26c2016-02-14 19:57:29 -0200264if test "x$enable_linux_affinity" = xyes; then
265 AC_DEFINE(HAVE_LINUX_AFFINITY, 1, [Define if Linux sched_setaffinity and sched_getaffinity are to be used.])
Hisham Muhammad7ca10812011-11-18 06:08:56 +0000266fi
267
Explorer09f0df28a2016-03-12 11:58:30 +0800268AC_ARG_ENABLE(hwloc, [AS_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity])],, enable_hwloc="no")
Hisham Muhammadec17b702011-09-24 00:30:47 +0000269if test "x$enable_hwloc" = xyes
Hisham Muhammad9604e022010-11-22 12:24:46 +0000270then
Hisham474d26c2016-02-14 19:57:29 -0200271 AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [missing_libraries="$missing_libraries libhwloc"])
Hisham Muhammadbc87a8f2011-11-21 02:52:41 +0000272 AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"])
Hisham Muhammad4df76d12008-03-05 09:46:47 +0000273fi
274
Hisham Muhammad543d65c2017-07-26 15:40:55 -0300275AC_ARG_ENABLE(setuid, [AS_HELP_STRING([--enable-setuid], [enable setuid support for platforms that need it])],, enable_setuid="no")
276if test "x$enable_setuid" = xyes
277then
278 AC_DEFINE(HAVE_SETUID_ENABLED, 1, [Define if setuid support should be enabled.])
279fi
280
Hisham Muhammade85b0722018-04-06 11:03:00 -0300281AC_ARG_ENABLE(delayacct, [AS_HELP_STRING([--enable-delayacct], [enable Linux delay accounting])],, enable_delayacct="no")
André Carvalhob7b66b72017-12-04 00:15:29 -0200282if test "x$enable_delayacct" = xyes
283then
Hisham Muhammade85b0722018-04-06 11:03:00 -0300284 m4_ifdef([PKG_PROG_PKG_CONFIG], [
285 PKG_PROG_PKG_CONFIG()
286 PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [missing_libraries="$missing_libraries libnl-3"])
287 PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [missing_libraries="$missing_libraries libnl-genl-3"])
288 CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
289 LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS"
290 AC_DEFINE(HAVE_DELAYACCT, 1, [Define if delay accounting support should be enabled.])
291 ], [
Explorer09103f1a42018-04-06 23:47:55 +0800292 pkg_m4_absent=1
293 m4_warning([configure is generated without pkg.m4. 'make dist' target will be disabled.])
294 AC_MSG_ERROR([htop on Linux requires pkg-config for checking delayacct requirements. Please install pkg-config and run ./autogen.sh to rebuild the configure script.])
Hisham Muhammade85b0722018-04-06 11:03:00 -0300295 ])
André Carvalhob7b66b72017-12-04 00:15:29 -0200296fi
297
Christian Göttsche57254cd2020-08-21 10:37:20 +0200298AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors (default: warnings are not errors)])], [enable_werror="$enableval"], [enable_werror=no])
299AS_IF([test "x$enable_werror" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -Werror"])
300AC_SUBST([AM_CFLAGS])
André Carvalhob7b66b72017-12-04 00:15:29 -0200301
Hisham Muhammad300af4b2014-11-19 23:17:16 -0200302# Bail out on errors.
303# ----------------------------------------------------------------------
304if test ! -z "$missing_libraries"; then
305 AC_MSG_ERROR([missing libraries: $missing_libraries])
306fi
307if test ! -z "$missing_headers"; then
308 AC_MSG_ERROR([missing headers: $missing_headers])
309fi
310
Nathan Scotta7a5e352020-08-20 13:16:31 +1000311AC_DEFINE_UNQUOTED(COPYRIGHT, "(C) 2004-2018 Hisham Muhammad", [Copyright message.])
Hisham Muhammad3383d8e2015-01-21 23:27:31 -0200312
Hisham Muhammad300af4b2014-11-19 23:17:16 -0200313# We're done, let's go!
314# ----------------------------------------------------------------------
Hisham Muhammada75161f2014-11-24 20:11:33 -0200315AM_CONDITIONAL([HTOP_LINUX], [test "$my_htop_platform" = linux])
Hisham Muhammad8915b292014-11-27 16:27:34 -0200316AM_CONDITIONAL([HTOP_FREEBSD], [test "$my_htop_platform" = freebsd])
Diederik de Grootb258d6e2017-04-19 16:12:17 +0200317AM_CONDITIONAL([HTOP_DRAGONFLYBSD], [test "$my_htop_platform" = dragonflybsd])
Michael McConvillea9a5a532015-09-18 00:46:48 -0400318AM_CONDITIONAL([HTOP_OPENBSD], [test "$my_htop_platform" = openbsd])
David Hunt70e7c8d2015-07-12 13:47:43 -0500319AM_CONDITIONAL([HTOP_DARWIN], [test "$my_htop_platform" = darwin])
gmbroome697f5bb2018-03-02 16:20:46 -0500320AM_CONDITIONAL([HTOP_SOLARIS], [test "$my_htop_platform" = solaris])
Hisham Muhammada75161f2014-11-24 20:11:33 -0200321AM_CONDITIONAL([HTOP_UNSUPPORTED], [test "$my_htop_platform" = unsupported])
Hisham Muhammadeb229d92014-11-24 18:55:03 -0200322AC_SUBST(my_htop_platform)
Hisham Muhammaddd86b9b2009-06-23 14:02:14 +0000323AC_CONFIG_FILES([Makefile htop.1])
Hisham Muhammadd6231ba2006-03-04 18:16:49 +0000324AC_OUTPUT
Hisham Muhammadc39f18a2017-07-10 20:14:25 -0300325
326if test "$my_htop_platform" = "unsupported"
327then
328 echo ""
329 echo "****************************************************************"
330 echo "WARNING! This platform is not currently supported by htop."
331 echo ""
332 echo "The code will build, but it will produce a dummy version of htop"
333 echo "which shows no processes, using the files from the unsupported/"
334 echo "directory. This is meant to be a skeleton, to be used as a"
335 echo "starting point if you are porting htop to a new platform."
336 echo "****************************************************************"
337 echo ""
338fi