| Hisham Muhammad | d6231ba | 2006-03-04 18:16:49 +0000 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 4 | # ---------------------------------------------------------------------- |
| 5 | # Autoconf initialization. |
| 6 | # ---------------------------------------------------------------------- |
| 7 | |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 8 | AC_PREREQ([2.69]) |
| Daniel Lange | 8aca6fb | 2021-06-18 07:52:44 +0200 | [diff] [blame] | 9 | AC_INIT([htop], [3.1.0-dev], [htop@groups.io], [], [https://htop.dev/]) |
| Hisham Muhammad | 3383d8e | 2015-01-21 23:27:31 -0200 | [diff] [blame] | 10 | |
| Explorer09 | b71b07f | 2016-03-12 12:02:06 +0800 | [diff] [blame] | 11 | AC_CONFIG_SRCDIR([htop.c]) |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 12 | AC_CONFIG_AUX_DIR([build-aux]) |
| Explorer09 | b71b07f | 2016-03-12 12:02:06 +0800 | [diff] [blame] | 13 | AC_CONFIG_HEADERS([config.h]) |
| Explorer09 | b71b07f | 2016-03-12 12:02:06 +0800 | [diff] [blame] | 14 | |
| Hisham Muhammad | ec17b70 | 2011-09-24 00:30:47 +0000 | [diff] [blame] | 15 | AC_CANONICAL_TARGET |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 16 | AM_INIT_AUTOMAKE([-Wall std-options subdir-objects]) |
| Hisham Muhammad | d6231ba | 2006-03-04 18:16:49 +0000 | [diff] [blame] | 17 | |
| Hisham Muhammad | 300af4b | 2014-11-19 23:17:16 -0200 | [diff] [blame] | 18 | # ---------------------------------------------------------------------- |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 19 | |
| 20 | |
| 21 | # ---------------------------------------------------------------------- |
| 22 | # Checks for platform. |
| 23 | # ---------------------------------------------------------------------- |
| 24 | |
| 25 | case "$target_os" in |
| 26 | linux*|gnu*) |
| 27 | my_htop_platform=linux |
| 28 | AC_DEFINE([HTOP_LINUX], [], [Building for Linux.]) |
| 29 | ;; |
| 30 | freebsd*|kfreebsd*) |
| 31 | my_htop_platform=freebsd |
| 32 | AC_DEFINE([HTOP_FREEBSD], [], [Building for FreeBSD.]) |
| 33 | ;; |
| fraggerfox | 4b49de4 | 2021-03-15 13:14:39 +0530 | [diff] [blame^] | 34 | netbsd*) |
| 35 | my_htop_platform=netbsd |
| 36 | AC_DEFINE([HTOP_NETBSD], [], [Building for NetBSD.]) |
| 37 | ;; |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 38 | openbsd*) |
| 39 | my_htop_platform=openbsd |
| 40 | AC_DEFINE([HTOP_OPENBSD], [], [Building for OpenBSD.]) |
| 41 | ;; |
| 42 | dragonfly*) |
| 43 | my_htop_platform=dragonflybsd |
| 44 | AC_DEFINE([HTOP_DRAGONFLYBSD], [], [Building for DragonFlyBSD.]) |
| 45 | ;; |
| 46 | darwin*) |
| 47 | my_htop_platform=darwin |
| 48 | AC_DEFINE([HTOP_DARWIN], [], [Building for Darwin.]) |
| 49 | ;; |
| 50 | solaris*) |
| 51 | my_htop_platform=solaris |
| 52 | AC_DEFINE([HTOP_SOLARIS], [], [Building for Solaris.]) |
| 53 | ;; |
| 54 | *) |
| 55 | my_htop_platform=unsupported |
| 56 | AC_DEFINE([HTOP_UNSUPPORTED], [], [Building for an unsupported platform.]) |
| 57 | ;; |
| 58 | esac |
| Hisham Muhammad | 4df76d1 | 2008-03-05 09:46:47 +0000 | [diff] [blame] | 59 | |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 60 | # Enable extensions, required by hwloc scripts |
| Explorer09 | b71b07f | 2016-03-12 12:02:06 +0800 | [diff] [blame] | 61 | AC_USE_SYSTEM_EXTENSIONS |
| 62 | |
| Hisham Muhammad | eb229d9 | 2014-11-24 18:55:03 -0200 | [diff] [blame] | 63 | # ---------------------------------------------------------------------- |
| Hisham Muhammad | eb229d9 | 2014-11-24 18:55:03 -0200 | [diff] [blame] | 64 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 65 | |
| Hisham Muhammad | 300af4b | 2014-11-19 23:17:16 -0200 | [diff] [blame] | 66 | # ---------------------------------------------------------------------- |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 67 | # Checks for compiler. |
| Hisham Muhammad | 300af4b | 2014-11-19 23:17:16 -0200 | [diff] [blame] | 68 | # ---------------------------------------------------------------------- |
| Hisham Muhammad | e46f142 | 2006-07-12 01:15:14 +0000 | [diff] [blame] | 69 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 70 | AC_PROG_CC |
| 71 | AM_PROG_CC_C_O |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 72 | AC_PROG_CC_C99 |
| 73 | AS_IF([test "x$ac_cv_prog_cc_c99" = xno], [AC_MSG_ERROR([htop is written in C99. A newer compiler is required.])]) |
| Hisham Muhammad | d6231ba | 2006-03-04 18:16:49 +0000 | [diff] [blame] | 74 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 75 | # ---------------------------------------------------------------------- |
| 76 | |
| 77 | |
| 78 | # ---------------------------------------------------------------------- |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 79 | # Checks for static build. |
| 80 | # ---------------------------------------------------------------------- |
| 81 | |
| 82 | AC_ARG_ENABLE([static], |
| 83 | [AS_HELP_STRING([--enable-static], |
| 84 | [build a static htop binary @<:@default=no@:>@])], |
| 85 | [], |
| 86 | [enable_static=no]) |
| 87 | case "$enable_static" in |
| 88 | no) |
| 89 | ;; |
| 90 | yes) |
| 91 | AC_DEFINE([BUILD_STATIC], [1], [Define if building static binary.]) |
| 92 | CFLAGS="$CFLAGS -static" |
| 93 | LDFLAGS="$LDFLAGS -static" |
| 94 | ;; |
| 95 | *) |
| 96 | AC_MSG_ERROR([bad value '$enable_static' for --enable-static option]) |
| 97 | ;; |
| 98 | esac |
| 99 | |
| 100 | # ---------------------------------------------------------------------- |
| 101 | |
| Nathan Scott | c14a45b | 2021-02-17 14:43:56 +1100 | [diff] [blame] | 102 | # ---------------------------------------------------------------------- |
| 103 | # Checks for a PCP-based htop build. (https://pcp.io) |
| 104 | # ---------------------------------------------------------------------- |
| 105 | |
| 106 | AC_ARG_ENABLE([pcp], |
| 107 | [AS_HELP_STRING([--enable-pcp], |
| Nathan Scott | 9ce9557 | 2021-04-14 11:34:47 +1000 | [diff] [blame] | 108 | [build a pcp-htop binary @<:@default=no@:>@])], |
| Nathan Scott | c14a45b | 2021-02-17 14:43:56 +1100 | [diff] [blame] | 109 | [], |
| 110 | [enable_pcp=no]) |
| 111 | case "$enable_pcp" in |
| 112 | no) |
| 113 | ;; |
| 114 | yes) |
| 115 | AC_CHECK_HEADERS([pcp/pmapi.h], [my_htop_platform=pcp], |
| Benny Baumann | 92324d3 | 2021-06-13 19:46:13 +0200 | [diff] [blame] | 116 | [AC_MSG_ERROR([can not find PCP header file])]) |
| Nathan Scott | 94d3798 | 2021-06-08 09:46:02 +1000 | [diff] [blame] | 117 | AC_SEARCH_LIBS([pmNewContext], [pcp], [], [AC_MSG_ERROR([can not find PCP library])]) |
| 118 | AC_DEFINE([HTOP_PCP], [1], [Define if building pcp-htop binary.]) |
| Nathan Scott | c14a45b | 2021-02-17 14:43:56 +1100 | [diff] [blame] | 119 | ;; |
| 120 | *) |
| Nathan Scott | 6bb59f8 | 2021-02-19 14:13:27 +1100 | [diff] [blame] | 121 | AC_MSG_ERROR([bad value '$enable_pcp' for --enable-pcp option]) |
| Nathan Scott | c14a45b | 2021-02-17 14:43:56 +1100 | [diff] [blame] | 122 | ;; |
| 123 | esac |
| 124 | |
| 125 | # ---------------------------------------------------------------------- |
| 126 | |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 127 | |
| 128 | # ---------------------------------------------------------------------- |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 129 | # Checks for generic header files. |
| 130 | # ---------------------------------------------------------------------- |
| 131 | |
| 132 | AC_HEADER_DIRENT |
| 133 | AC_HEADER_STDC |
| 134 | AC_CHECK_HEADERS([ \ |
| 135 | stdlib.h \ |
| 136 | string.h \ |
| 137 | strings.h \ |
| 138 | sys/param.h \ |
| 139 | sys/time.h \ |
| Nathan Scott | 5b50ae3 | 2021-03-02 15:58:11 +1100 | [diff] [blame] | 140 | sys/utsname.h \ |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 141 | unistd.h |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 142 | ], [], [AC_MSG_ERROR([can not find required generic header files])]) |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 143 | |
| 144 | AC_HEADER_MAJOR |
| 145 | dnl glibc 2.25 deprecates 'major' and 'minor' in <sys/types.h> and requires to |
| 146 | dnl include <sys/sysmacros.h>. However the logic in AC_HEADER_MAJOR has not yet |
| 147 | dnl been updated in Autoconf 2.69, so use a workaround: |
| 148 | m4_version_prereq([2.70], [], |
| 149 | [if test "x$ac_cv_header_sys_mkdev_h" != xyes; then |
| 150 | AC_CHECK_HEADER([sys/sysmacros.h], [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], |
| 151 | [Define to 1 if `major', `minor', and `makedev' are declared in <sys/sysmacros.h>.])]) |
| 152 | fi]) |
| 153 | |
| 154 | # Optional Section |
| 155 | |
| 156 | AC_CHECK_HEADERS([execinfo.h]) |
| 157 | |
| 158 | if test "$my_htop_platform" = darwin; then |
| 159 | AC_CHECK_HEADERS([mach/mach_time.h]) |
| 160 | fi |
| 161 | |
| 162 | # ---------------------------------------------------------------------- |
| 163 | |
| 164 | |
| 165 | # ---------------------------------------------------------------------- |
| 166 | # Checks for typedefs, structures, and compiler characteristics. |
| 167 | # ---------------------------------------------------------------------- |
| 168 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 169 | AC_TYPE_PID_T |
| 170 | AC_TYPE_UID_T |
| 171 | AC_TYPE_UINT8_T |
| 172 | AC_TYPE_UINT16_T |
| 173 | AC_TYPE_UINT32_T |
| 174 | AC_TYPE_UINT64_T |
| 175 | |
| 176 | # ---------------------------------------------------------------------- |
| 177 | |
| 178 | |
| 179 | # ---------------------------------------------------------------------- |
| 180 | # Checks for generic library functions. |
| 181 | # ---------------------------------------------------------------------- |
| 182 | |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 183 | AC_CHECK_LIB([m], [ceil], [], [AC_MSG_ERROR([can not find required function ceil()])]) |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 184 | |
| 185 | if test "$my_htop_platform" = dragonflybsd; then |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 186 | AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])]) |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 187 | fi |
| 188 | |
| 189 | if test "$my_htop_platform" = freebsd; then |
| Christian Göttsche | cae47bb | 2021-02-05 15:15:01 +0100 | [diff] [blame] | 190 | if test "$enable_static" = yes; then |
| 191 | AC_SEARCH_LIBS([elf_version], [elf], [], [AC_MSG_ERROR([can not find required function elf_version()])]) |
| 192 | fi |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 193 | AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])]) |
| 194 | AC_SEARCH_LIBS([devstat_checkversion], [devstat], [], [AC_MSG_ERROR([can not find required function devstat_checkversion()])]) |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 195 | fi |
| 196 | |
| 197 | if test "$my_htop_platform" = linux; then |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 198 | if test "$enable_static" != yes; then |
| 199 | AC_SEARCH_LIBS([dlopen], [dl dld], [], [AC_MSG_ERROR([can not find required function dlopen()])]) |
| 200 | fi |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 201 | fi |
| 202 | |
| fraggerfox | 4b49de4 | 2021-03-15 13:14:39 +0530 | [diff] [blame^] | 203 | if test "$my_htop_platform" = netbsd; then |
| 204 | AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])]) |
| 205 | fi |
| 206 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 207 | if test "$my_htop_platform" = openbsd; then |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 208 | AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])]) |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 209 | fi |
| 210 | |
| 211 | if test "$my_htop_platform" = solaris; then |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 212 | AC_SEARCH_LIBS([kstat_open], [kstat], [], [AC_MSG_ERROR([can not find required function kstat_open()])]) |
| 213 | AC_SEARCH_LIBS([Pgrab_error], [proc], [], [AC_MSG_ERROR([can not find required function Pgrab_error()])]) |
| 214 | AC_SEARCH_LIBS([free], [malloc], [], [AC_MSG_ERROR([can not find required function free()])]) |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 215 | fi |
| 216 | |
| 217 | # Optional Section |
| 218 | |
| 219 | AC_SEARCH_LIBS([clock_gettime], [rt]) |
| 220 | |
| 221 | AC_CHECK_FUNCS([ \ |
| 222 | clock_gettime \ |
| 223 | faccessat \ |
| 224 | fstatat \ |
| 225 | host_get_clock_service \ |
| Christian Göttsche | 7b1fa1b | 2020-12-25 11:03:15 +0100 | [diff] [blame] | 226 | memfd_create\ |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 227 | openat \ |
| 228 | readlinkat \ |
| 229 | ]) |
| 230 | |
| Christian Göttsche | 1d00893 | 2020-10-15 21:12:57 +0200 | [diff] [blame] | 231 | # Add -lexecinfo if needed |
| 232 | AC_SEARCH_LIBS([backtrace], [execinfo]) |
| 233 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 234 | if test "$my_htop_platform" = darwin; then |
| 235 | AC_CHECK_FUNCS([mach_timebase_info]) |
| 236 | fi |
| Christian Goettsche | c2fdfd9 | 2020-10-21 17:06:32 +0200 | [diff] [blame] | 237 | |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 238 | if test "$my_htop_platform" = linux && test "x$enable_static" = xyes; then |
| 239 | AC_CHECK_LIB([systemd], [sd_bus_open_system]) |
| 240 | fi |
| 241 | |
| Hisham Muhammad | 300af4b | 2014-11-19 23:17:16 -0200 | [diff] [blame] | 242 | # ---------------------------------------------------------------------- |
| Hisham Muhammad | eb229d9 | 2014-11-24 18:55:03 -0200 | [diff] [blame] | 243 | |
| Hisham Muhammad | d6231ba | 2006-03-04 18:16:49 +0000 | [diff] [blame] | 244 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 245 | # ---------------------------------------------------------------------- |
| 246 | # Checks for cross-platform features and flags. |
| 247 | # ---------------------------------------------------------------------- |
| Hisham Muhammad | a5dfaa2 | 2008-09-23 04:31:13 +0000 | [diff] [blame] | 248 | |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 249 | # HTOP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART) |
| 250 | m4_define([HTOP_CHECK_SCRIPT], |
| Hisham Muhammad | 96c929f | 2015-11-30 16:36:22 -0200 | [diff] [blame] | 251 | [ |
| Ricardo Martincoski | 78b82d0 | 2016-07-11 20:12:07 -0300 | [diff] [blame] | 252 | if test ! -z "m4_toupper($HTOP_[$1]_CONFIG_SCRIPT)"; then |
| 253 | # to be used to set the path to ncurses*-config when cross-compiling |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 254 | htop_config_script_libs=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --libs 2> /dev/null) |
| 255 | htop_config_script_cflags=$(m4_toupper($HTOP_[$1]_CONFIG_SCRIPT) --cflags 2> /dev/null) |
| Ricardo Martincoski | 78b82d0 | 2016-07-11 20:12:07 -0300 | [diff] [blame] | 256 | else |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 257 | htop_config_script_libs=$([$4] --libs 2> /dev/null) |
| 258 | htop_config_script_cflags=$([$4] --cflags 2> /dev/null) |
| Ricardo Martincoski | 78b82d0 | 2016-07-11 20:12:07 -0300 | [diff] [blame] | 259 | fi |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 260 | htop_script_success=no |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 261 | htop_save_CFLAGS="$CFLAGS" |
| 262 | if test ! "x$htop_config_script_libs" = x; then |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 263 | CFLAGS="$htop_config_script_cflags $CFLAGS" |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 264 | AC_CHECK_LIB([$1], [$2], [ |
| 265 | AC_DEFINE([$3], 1, [The library is present.]) |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 266 | LIBS="$htop_config_script_libs $LIBS " |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 267 | htop_script_success=yes |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 268 | ], [ |
| Benny Baumann | 880eeca | 2020-12-12 19:49:52 +0100 | [diff] [blame] | 269 | CFLAGS="$htop_save_CFLAGS" |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 270 | ], [ |
| 271 | $htop_config_script_libs |
| Michael Klein | bc5d469 | 2018-02-26 14:19:01 +0100 | [diff] [blame] | 272 | ]) |
| Hisham Muhammad | c237702 | 2015-12-06 19:06:23 -0200 | [diff] [blame] | 273 | fi |
| Hisham Muhammad | cccc18d | 2015-12-09 17:34:57 -0200 | [diff] [blame] | 274 | if test "x$htop_script_success" = xno; then |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 275 | [$5] |
| 276 | fi |
| 277 | ]) |
| 278 | |
| 279 | # HTOP_CHECK_LIB(LIBNAME, FUNCTION, DEFINE, ELSE_PART) |
| 280 | m4_define([HTOP_CHECK_LIB], |
| 281 | [ |
| Hisham Muhammad | 96c929f | 2015-11-30 16:36:22 -0200 | [diff] [blame] | 282 | AC_CHECK_LIB([$1], [$2], [ |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 283 | AC_DEFINE([$3], [1], [The library is present.]) |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 284 | LIBS="-l[$1] $LIBS " |
| 285 | ], [$4]) |
| Hisham Muhammad | 96c929f | 2015-11-30 16:36:22 -0200 | [diff] [blame] | 286 | ]) |
| 287 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 288 | AC_ARG_ENABLE([unicode], |
| 289 | [AS_HELP_STRING([--enable-unicode], |
| 290 | [enable Unicode support @<:@default=yes@:>@])], |
| 291 | [], |
| 292 | [enable_unicode=yes]) |
| Hisham Muhammad | 8fa33dc | 2008-03-09 02:33:23 +0000 | [diff] [blame] | 293 | if test "x$enable_unicode" = xyes; then |
| Christian Göttsche | fd8c061 | 2021-01-28 17:40:33 +0100 | [diff] [blame] | 294 | HTOP_CHECK_SCRIPT([ncursesw6], [waddwstr], [HAVE_LIBNCURSESW], "ncursesw6-config", |
| 295 | HTOP_CHECK_SCRIPT([ncursesw], [waddwstr], [HAVE_LIBNCURSESW], "ncursesw6-config", |
| 296 | HTOP_CHECK_SCRIPT([ncursesw], [wadd_wch], [HAVE_LIBNCURSESW], "ncursesw5-config", |
| 297 | HTOP_CHECK_SCRIPT([ncurses], [wadd_wch], [HAVE_LIBNCURSESW], "ncurses5-config", |
| 298 | HTOP_CHECK_LIB([ncursesw6], [addnwstr], [HAVE_LIBNCURSESW], |
| 299 | HTOP_CHECK_LIB([ncursesw], [addnwstr], [HAVE_LIBNCURSESW], |
| 300 | HTOP_CHECK_LIB([ncurses], [addnwstr], [HAVE_LIBNCURSESW], |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 301 | AC_MSG_ERROR([can not find required library libncursesw; you may want to use --disable-unicode]) |
| Diederik de Groot | b258d6e | 2017-04-19 16:12:17 +0200 | [diff] [blame] | 302 | ))))))) |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 303 | |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 304 | AC_CHECK_HEADERS([ncursesw/curses.h], [], |
| 305 | [AC_CHECK_HEADERS([ncurses/ncurses.h], [], |
| 306 | [AC_CHECK_HEADERS([ncurses/curses.h], [], |
| 307 | [AC_CHECK_HEADERS([ncurses.h], [], |
| 308 | [AC_MSG_ERROR([can not find required ncurses header file])])])])]) |
| Christian Göttsche | ead978b | 2020-12-07 15:30:56 +0100 | [diff] [blame] | 309 | |
| 310 | # check if additional linker flags are needed for keypad(3) |
| 311 | # (at this point we already link against a working ncurses library with wide character support) |
| 312 | AC_SEARCH_LIBS([keypad], [tinfow tinfo]) |
| Hisham Muhammad | 8fa33dc | 2008-03-09 02:33:23 +0000 | [diff] [blame] | 313 | else |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 314 | HTOP_CHECK_SCRIPT([ncurses6], [wnoutrefresh], [HAVE_LIBNCURSES], [ncurses6-config], |
| 315 | HTOP_CHECK_SCRIPT([ncurses], [wnoutrefresh], [HAVE_LIBNCURSES], [ncurses5-config], |
| Christian Göttsche | fd8c061 | 2021-01-28 17:40:33 +0100 | [diff] [blame] | 316 | HTOP_CHECK_LIB([ncurses6], [doupdate], [HAVE_LIBNCURSES], |
| 317 | HTOP_CHECK_LIB([ncurses], [doupdate], [HAVE_LIBNCURSES], |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 318 | AC_MSG_ERROR([can not find required library libncurses]) |
| Hisham Muhammad | db68286 | 2015-12-09 17:17:30 -0200 | [diff] [blame] | 319 | )))) |
| Christian Göttsche | b92f62f | 2020-08-21 10:37:33 +0200 | [diff] [blame] | 320 | |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 321 | AC_CHECK_HEADERS([curses.h], [], |
| 322 | [AC_CHECK_HEADERS([ncurses/curses.h], [], |
| 323 | [AC_CHECK_HEADERS([ncurses/ncurses.h], [], |
| 324 | [AC_CHECK_HEADERS([ncurses.h] ,[], |
| 325 | [AC_MSG_ERROR([can not find required ncurses header file])])])])]) |
| Christian Göttsche | ead978b | 2020-12-07 15:30:56 +0100 | [diff] [blame] | 326 | |
| 327 | # check if additional linker flags are needed for keypad(3) |
| 328 | # (at this point we already link against a working ncurses library) |
| 329 | AC_SEARCH_LIBS([keypad], [tinfo]) |
| Hisham Muhammad | 4c51ad0 | 2007-08-10 05:07:14 +0000 | [diff] [blame] | 330 | fi |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 331 | if test "$enable_static" = yes; then |
| 332 | AC_SEARCH_LIBS([Gpm_GetEvent], [gpm]) |
| 333 | fi |
| Christian Göttsche | ee9e7ed | 2021-05-20 18:27:10 +0200 | [diff] [blame] | 334 | if test "$my_htop_platform" = "solaris"; then |
| 335 | # On OmniOS /usr/include/sys/regset.h redefines ERR to 13 - \r, breaking the Enter key. |
| 336 | # Since ncruses macros use the ERR macro, we can not use another name. |
| 337 | AC_DEFINE([ERR], [(-1)], [Predefine ncurses macro.]) |
| 338 | fi |
| Hisham Muhammad | 4c51ad0 | 2007-08-10 05:07:14 +0000 | [diff] [blame] | 339 | |
| gmbroome | 697f5bb | 2018-03-02 16:20:46 -0500 | [diff] [blame] | 340 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 341 | AC_ARG_ENABLE([hwloc], |
| 342 | [AS_HELP_STRING([--enable-hwloc], |
| 343 | [enable hwloc support for CPU affinity; disables Linux affinity; requires libhwloc @<:@default=no@:>@])], |
| 344 | [], |
| 345 | [enable_hwloc=no]) |
| 346 | case "$enable_hwloc" in |
| 347 | no) |
| 348 | ;; |
| 349 | yes) |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 350 | AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])]) |
| 351 | AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])]) |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 352 | ;; |
| 353 | *) |
| 354 | AC_MSG_ERROR([bad value '$enable_hwloc' for --enable-hwloc]) |
| 355 | ;; |
| 356 | esac |
| Christian Göttsche | 005c4d1 | 2020-09-08 16:25:22 +0200 | [diff] [blame] | 357 | |
| Nathan Scott | 5b50ae3 | 2021-03-02 15:58:11 +1100 | [diff] [blame] | 358 | AC_ARG_WITH([os-release], |
| 359 | [AS_HELP_STRING([--with-os-release=FILE], |
| Christian Göttsche | 8ba4ef3 | 2021-03-12 16:37:17 +0100 | [diff] [blame] | 360 | [location of an os-release file @<:@default=/etc/os-release@:>@])], |
| Nathan Scott | 5b50ae3 | 2021-03-02 15:58:11 +1100 | [diff] [blame] | 361 | [], |
| 362 | [with_os_release=/etc/os-release]) |
| Christian Göttsche | 8ba4ef3 | 2021-03-12 16:37:17 +0100 | [diff] [blame] | 363 | if test -n "$with_os_release" && test ! -f "$with_os_release"; then |
| Nathan Scott | 5b50ae3 | 2021-03-02 15:58:11 +1100 | [diff] [blame] | 364 | if test -f "/usr/lib/os-release"; then |
| 365 | with_os_release="/usr/lib/os-release" |
| 366 | fi |
| 367 | fi |
| 368 | AC_DEFINE_UNQUOTED([OSRELEASEFILE], ["$with_os_release"], [File with OS release details.]) |
| 369 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 370 | # ---------------------------------------------------------------------- |
| 371 | |
| 372 | |
| 373 | # ---------------------------------------------------------------------- |
| 374 | # Checks for Linux features and flags. |
| 375 | # ---------------------------------------------------------------------- |
| 376 | |
| 377 | AC_ARG_WITH([proc], |
| 378 | [AS_HELP_STRING([--with-proc=DIR], |
| 379 | [location of a Linux-compatible proc filesystem @<:@default=/proc@:>@])], |
| 380 | [], |
| 381 | [with_proc=/proc]) |
| 382 | if test -z "$with_proc"; then |
| 383 | AC_MSG_ERROR([bad empty value for --with-proc option]) |
| 384 | fi |
| 385 | AC_DEFINE_UNQUOTED([PROCDIR], ["$with_proc"], [Path of proc filesystem.]) |
| 386 | |
| 387 | |
| 388 | AC_ARG_ENABLE([openvz], |
| 389 | [AS_HELP_STRING([--enable-openvz], |
| 390 | [enable OpenVZ support @<:@default=no@:>@])], |
| 391 | [], |
| 392 | [enable_openvz=no]) |
| 393 | if test "x$enable_openvz" = xyes; then |
| 394 | AC_DEFINE([HAVE_OPENVZ], [1], [Define if openvz support enabled.]) |
| 395 | fi |
| 396 | |
| 397 | |
| 398 | AC_ARG_ENABLE([vserver], |
| 399 | [AS_HELP_STRING([--enable-vserver], |
| 400 | [enable VServer support @<:@default=no@:>@])], |
| 401 | [], |
| 402 | [enable_vserver=no]) |
| 403 | if test "x$enable_vserver" = xyes; then |
| 404 | AC_DEFINE([HAVE_VSERVER], [1], [Define if VServer support enabled.]) |
| 405 | fi |
| 406 | |
| 407 | |
| 408 | AC_ARG_ENABLE([ancient_vserver], |
| 409 | [AS_HELP_STRING([--enable-ancient-vserver], |
| 410 | [enable ancient VServer support (implies --enable-vserver) @<:@default=no@:>@])], |
| 411 | [], |
| 412 | [enable_ancient_vserver=no]) |
| 413 | if test "x$enable_ancient_vserver" = xyes; then |
| 414 | AC_DEFINE([HAVE_VSERVER], [1], [Define if VServer support enabled.]) |
| 415 | AC_DEFINE([HAVE_ANCIENT_VSERVER], [1], [Define if ancient vserver support enabled.]) |
| 416 | fi |
| 417 | |
| 418 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 419 | AC_ARG_ENABLE([linux_affinity], |
| 420 | [AS_HELP_STRING([--enable-linux-affinity], |
| 421 | [enable Linux sched_setaffinity and sched_getaffinity for affinity support, conflicts with hwloc @<:@default=check@:>@])], |
| 422 | [], |
| 423 | [enable_linux_affinity=check]) |
| Christian Göttsche | 005c4d1 | 2020-09-08 16:25:22 +0200 | [diff] [blame] | 424 | if test "x$enable_linux_affinity" = xcheck; then |
| 425 | if test "x$enable_hwloc" = xyes; then |
| 426 | enable_linux_affinity=no |
| 427 | else |
| 428 | AC_MSG_CHECKING([for usable sched_setaffinity]) |
| 429 | AC_RUN_IFELSE([ |
| 430 | AC_LANG_PROGRAM([[ |
| 431 | #include <sched.h> |
| 432 | #include <errno.h> |
| 433 | static cpu_set_t cpuset; |
| 434 | ]], [[ |
| 435 | CPU_ZERO(&cpuset); |
| 436 | sched_setaffinity(0, sizeof(cpu_set_t), &cpuset); |
| 437 | if (errno == ENOSYS) return 1; |
| 438 | ]])], |
| 439 | [enable_linux_affinity=yes |
| Benny Baumann | 880eeca | 2020-12-12 19:49:52 +0100 | [diff] [blame] | 440 | AC_MSG_RESULT([yes])], |
| Christian Göttsche | 005c4d1 | 2020-09-08 16:25:22 +0200 | [diff] [blame] | 441 | [enable_linux_affinity=no |
| Benny Baumann | 880eeca | 2020-12-12 19:49:52 +0100 | [diff] [blame] | 442 | AC_MSG_RESULT([no])], |
| Christian Göttsche | 005c4d1 | 2020-09-08 16:25:22 +0200 | [diff] [blame] | 443 | [AC_MSG_RESULT([yes (assumed while cross compiling)])]) |
| 444 | fi |
| Hisham Muhammad | dfad0af | 2011-11-23 18:43:35 +0000 | [diff] [blame] | 445 | fi |
| Hisham | 474d26c | 2016-02-14 19:57:29 -0200 | [diff] [blame] | 446 | if test "x$enable_linux_affinity" = xyes; then |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 447 | if test "x$enable_hwloc" = xyes; then |
| 448 | AC_MSG_ERROR([--enable-hwloc and --enable-linux-affinity are mutual exclusive. Specify at most one of them.]) |
| 449 | fi |
| 450 | AC_DEFINE([HAVE_LINUX_AFFINITY], [1], [Define if Linux sched_setaffinity and sched_getaffinity are to be used.]) |
| Hisham Muhammad | 7ca1081 | 2011-11-18 06:08:56 +0000 | [diff] [blame] | 451 | fi |
| 452 | |
| Hisham Muhammad | 543d65c | 2017-07-26 15:40:55 -0300 | [diff] [blame] | 453 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 454 | AC_ARG_ENABLE([capabilities], |
| 455 | [AS_HELP_STRING([--enable-capabilities], |
| 456 | [enable Linux capabilities support; requires libcap @<:@default=check@:>@])], |
| 457 | [], |
| 458 | [enable_capabilities=check]) |
| 459 | case "$enable_capabilities" in |
| 460 | no) |
| 461 | ;; |
| 462 | check) |
| 463 | enable_capabilities=yes |
| 464 | AC_CHECK_LIB([cap], [cap_init], [], [enable_capabilities=no]) |
| 465 | AC_CHECK_HEADERS([sys/capability.h], [], [enable_capabilities=no]) |
| 466 | ;; |
| 467 | yes) |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 468 | AC_CHECK_LIB([cap], [cap_init], [], [AC_MSG_ERROR([can not find required library libcap])]) |
| 469 | AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([can not find required header file sys/capability.h])]) |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 470 | ;; |
| 471 | *) |
| 472 | AC_MSG_ERROR([bad value '$enable_capabilities' for --enable-capabilities]) |
| 473 | ;; |
| 474 | esac |
| Christian Göttsche | f4404ef | 2020-09-02 14:39:25 +0200 | [diff] [blame] | 475 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 476 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 477 | AC_ARG_ENABLE([delayacct], |
| 478 | [AS_HELP_STRING([--enable-delayacct], |
| 479 | [enable Linux delay accounting support; requires pkg-config, libnl-3 and libnl-genl-3 @<:@default=check@:>@])], |
| 480 | [], |
| 481 | [enable_delayacct=check]) |
| 482 | case "$enable_delayacct" in |
| 483 | no) |
| 484 | ;; |
| 485 | check) |
| Christian Göttsche | 69cfaf2 | 2021-05-16 20:01:25 +0200 | [diff] [blame] | 486 | if test "$my_htop_platform" != linux; then |
| 487 | enable_delayacct=no |
| 488 | elif test "$enable_static" = yes; then |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 489 | enable_delayacct=no |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 490 | else |
| 491 | m4_ifdef([PKG_PROG_PKG_CONFIG], [ |
| 492 | enable_delayacct=yes |
| 493 | PKG_PROG_PKG_CONFIG() |
| 494 | PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [enable_delayacct=no]) |
| 495 | PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [enable_delayacct=no]) |
| 496 | if test "$enable_delayacct" = yes; then |
| 497 | CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" |
| 498 | LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS" |
| 499 | AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.]) |
| 500 | fi |
| 501 | ], [ |
| 502 | enable_delayacct=no |
| 503 | AC_MSG_NOTICE([Linux delay accounting support can not be enabled, cause pkg-config is required for checking its availability]) |
| 504 | ]) |
| 505 | fi |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 506 | ;; |
| 507 | yes) |
| 508 | m4_ifdef([PKG_PROG_PKG_CONFIG], [ |
| 509 | PKG_PROG_PKG_CONFIG() |
| Christian Göttsche | 759a340 | 2021-01-22 19:14:55 +0100 | [diff] [blame] | 510 | PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [AC_MSG_ERROR([can not find required library libnl3])]) |
| 511 | PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [AC_MSG_ERROR([can not find required library libnl3genl])]) |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 512 | CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" |
| 513 | LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS" |
| 514 | AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.]) |
| 515 | ], [ |
| 516 | pkg_m4_absent=1 |
| 517 | m4_warning([configure is generated without pkg.m4. 'make dist' target will be disabled.]) |
| 518 | 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.]) |
| 519 | ]) |
| 520 | ;; |
| 521 | *) |
| 522 | AC_MSG_ERROR([bad value '$enable_delayacct' for --enable-delayacct]) |
| 523 | ;; |
| 524 | esac |
| André Carvalho | b7b66b7 | 2017-12-04 00:15:29 -0200 | [diff] [blame] | 525 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 526 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 527 | AC_ARG_ENABLE([sensors], |
| 528 | [AS_HELP_STRING([--enable-sensors], |
| 529 | [enable libsensors support for reading temperature data; requires only libsensors headers at compile time, at runtime libsensors is loaded via dlopen @<:@default=check@:>@])], |
| 530 | [], |
| 531 | [enable_sensors=check]) |
| 532 | case "$enable_sensors" in |
| 533 | no) |
| 534 | ;; |
| 535 | check) |
| 536 | enable_sensors=yes |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 537 | if test "$enable_static" = yes; then |
| 538 | AC_CHECK_LIB([sensors], [sensors_init], [], [enable_sensors=no]) |
| 539 | fi |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 540 | AC_CHECK_HEADERS([sensors/sensors.h], [], [enable_sensors=no]) |
| 541 | ;; |
| 542 | yes) |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 543 | if test "$enable_static" = yes; then |
| 544 | AC_CHECK_LIB([sensors], [sensors_init], [], [AC_MSG_ERROR([can not find required library libsensors])]) |
| 545 | fi |
| 546 | AC_CHECK_HEADERS([sensors/sensors.h], [], [AC_MSG_ERROR([can not find required header file sensors/sensors.h])]) |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 547 | ;; |
| 548 | *) |
| 549 | AC_MSG_ERROR([bad value '$enable_sensors' for --enable-sensors]) |
| 550 | ;; |
| 551 | esac |
| Christian Göttsche | fd2a0cf | 2020-12-22 20:02:01 +0100 | [diff] [blame] | 552 | if test "$enable_sensors" = yes || test "$my_htop_platform" = freebsd; then |
| 553 | AC_DEFINE([BUILD_WITH_CPU_TEMP], [1], [Define if CPU temperature option should be enabled.]) |
| 554 | fi |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 555 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 556 | # ---------------------------------------------------------------------- |
| 557 | |
| 558 | |
| 559 | # ---------------------------------------------------------------------- |
| 560 | # Checks for compiler warnings. |
| 561 | # ---------------------------------------------------------------------- |
| Christian Göttsche | 1b225cd | 2020-09-10 19:56:33 +0200 | [diff] [blame] | 562 | |
| Christian Göttsche | f4602f7 | 2020-09-08 14:25:46 +0200 | [diff] [blame] | 563 | AM_CFLAGS="\ |
| 564 | -Wall\ |
| 565 | -Wcast-align\ |
| Christian Göttsche | db47207 | 2020-10-04 14:30:35 +0200 | [diff] [blame] | 566 | -Wcast-qual\ |
| Christian Göttsche | f4602f7 | 2020-09-08 14:25:46 +0200 | [diff] [blame] | 567 | -Wextra\ |
| Benny Baumann | ba0fca1 | 2020-09-18 16:58:03 +0200 | [diff] [blame] | 568 | -Wfloat-equal\ |
| Christian Göttsche | c150e4b | 2020-12-18 15:49:37 +0100 | [diff] [blame] | 569 | -Wformat=2\ |
| Christian Göttsche | 4dadbe3 | 2021-01-21 19:49:07 +0100 | [diff] [blame] | 570 | -Winit-self\ |
| Christian Göttsche | f4602f7 | 2020-09-08 14:25:46 +0200 | [diff] [blame] | 571 | -Wmissing-format-attribute\ |
| 572 | -Wmissing-noreturn\ |
| Christian Göttsche | 4e282eb | 2020-09-25 14:03:55 +0200 | [diff] [blame] | 573 | -Wmissing-prototypes\ |
| Christian Göttsche | f4602f7 | 2020-09-08 14:25:46 +0200 | [diff] [blame] | 574 | -Wpointer-arith\ |
| 575 | -Wshadow\ |
| 576 | -Wstrict-prototypes\ |
| 577 | -Wundef\ |
| 578 | -Wunused\ |
| 579 | -Wwrite-strings" |
| 580 | |
| Christian Göttsche | 64a1ab8 | 2021-02-05 15:20:00 +0100 | [diff] [blame] | 581 | # FreeBSD uses C11 _Generic in its isnan implementation, even with -std=c99 |
| 582 | if test "$my_htop_platform" = freebsd; then |
| 583 | AM_CFLAGS="$AM_CFLAGS -Wno-c11-extensions" |
| 584 | fi |
| 585 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 586 | dnl https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html |
| 587 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 588 | [ |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 589 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl |
| 590 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ |
| 591 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS |
| 592 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" |
| 593 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], |
| 594 | [AS_VAR_SET(CACHEVAR,[yes])], |
| 595 | [AS_VAR_SET(CACHEVAR,[no])]) |
| 596 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) |
| 597 | AS_VAR_IF(CACHEVAR,yes, |
| 598 | [m4_default([$2], :)], |
| 599 | [m4_default([$3], :)]) |
| 600 | AS_VAR_POPDEF([CACHEVAR])dnl |
| 601 | ])dnl AX_CHECK_COMPILE_FLAGS |
| 602 | |
| Benny Baumann | 2cde4a7 | 2020-09-18 19:32:41 +0200 | [diff] [blame] | 603 | AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [AM_CFLAGS="$AM_CFLAGS -Wnull-dereference"], , [-Werror]) |
| 604 | |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 605 | AC_ARG_ENABLE([werror], |
| 606 | [AS_HELP_STRING([--enable-werror], |
| 607 | [Treat warnings as errors @<:@default=no@:>@])], |
| 608 | [], |
| 609 | [enable_werror=no]) |
| 610 | if test "x$enable_werror" = xyes; then |
| 611 | AM_CFLAGS="$AM_CFLAGS -Werror" |
| 612 | fi |
| 613 | |
| 614 | AC_ARG_ENABLE([debug], |
| 615 | [AS_HELP_STRING([--enable-debug], |
| Daniel Lange | 135efd5 | 2021-02-16 11:22:02 +0100 | [diff] [blame] | 616 | [Enable compiling with maximum debug info, asserts and internal sanity checks @<:@default=no@:>@])], |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 617 | [], |
| 618 | [enable_debug=no]) |
| 619 | if test "x$enable_debug" != xyes; then |
| 620 | AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG" |
| Daniel Lange | 135efd5 | 2021-02-16 11:22:02 +0100 | [diff] [blame] | 621 | else |
| 622 | AM_CPPFLAGS="$AM_CPPFLAGS -ggdb3" |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 623 | fi |
| Christian Göttsche | b7f6329 | 2020-09-17 22:23:05 +0200 | [diff] [blame] | 624 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 625 | |
| Christian Göttsche | 57254cd | 2020-08-21 10:37:20 +0200 | [diff] [blame] | 626 | AC_SUBST([AM_CFLAGS]) |
| Christian Göttsche | b7f6329 | 2020-09-17 22:23:05 +0200 | [diff] [blame] | 627 | AC_SUBST([AM_CPPFLAGS]) |
| 628 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 629 | # ---------------------------------------------------------------------- |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 630 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 631 | |
| 632 | # ---------------------------------------------------------------------- |
| Hisham Muhammad | 300af4b | 2014-11-19 23:17:16 -0200 | [diff] [blame] | 633 | # We're done, let's go! |
| 634 | # ---------------------------------------------------------------------- |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 635 | |
| 636 | AC_DEFINE_UNQUOTED([COPYRIGHT], ["(C) 2004-2019 Hisham Muhammad. (C) 2020-2021 htop dev team."], [Copyright message.]) |
| 637 | |
| Hisham Muhammad | a75161f | 2014-11-24 20:11:33 -0200 | [diff] [blame] | 638 | AM_CONDITIONAL([HTOP_LINUX], [test "$my_htop_platform" = linux]) |
| Hisham Muhammad | 8915b29 | 2014-11-27 16:27:34 -0200 | [diff] [blame] | 639 | AM_CONDITIONAL([HTOP_FREEBSD], [test "$my_htop_platform" = freebsd]) |
| Diederik de Groot | b258d6e | 2017-04-19 16:12:17 +0200 | [diff] [blame] | 640 | AM_CONDITIONAL([HTOP_DRAGONFLYBSD], [test "$my_htop_platform" = dragonflybsd]) |
| fraggerfox | 4b49de4 | 2021-03-15 13:14:39 +0530 | [diff] [blame^] | 641 | AM_CONDITIONAL([HTOP_NETBSD], [test "$my_htop_platform" = netbsd]) |
| Michael McConville | a9a5a53 | 2015-09-18 00:46:48 -0400 | [diff] [blame] | 642 | AM_CONDITIONAL([HTOP_OPENBSD], [test "$my_htop_platform" = openbsd]) |
| David Hunt | 70e7c8d | 2015-07-12 13:47:43 -0500 | [diff] [blame] | 643 | AM_CONDITIONAL([HTOP_DARWIN], [test "$my_htop_platform" = darwin]) |
| gmbroome | 697f5bb | 2018-03-02 16:20:46 -0500 | [diff] [blame] | 644 | AM_CONDITIONAL([HTOP_SOLARIS], [test "$my_htop_platform" = solaris]) |
| Nathan Scott | c14a45b | 2021-02-17 14:43:56 +1100 | [diff] [blame] | 645 | AM_CONDITIONAL([HTOP_PCP], [test "$my_htop_platform" = pcp]) |
| Hisham Muhammad | a75161f | 2014-11-24 20:11:33 -0200 | [diff] [blame] | 646 | AM_CONDITIONAL([HTOP_UNSUPPORTED], [test "$my_htop_platform" = unsupported]) |
| Christian Göttsche | 38b6a01 | 2021-01-22 19:14:53 +0100 | [diff] [blame] | 647 | |
| Hisham Muhammad | eb229d9 | 2014-11-24 18:55:03 -0200 | [diff] [blame] | 648 | AC_SUBST(my_htop_platform) |
| Daniel Lange | e172282 | 2020-08-24 21:37:28 +0200 | [diff] [blame] | 649 | AC_CONFIG_FILES([Makefile htop.1]) |
| Hisham Muhammad | d6231ba | 2006-03-04 18:16:49 +0000 | [diff] [blame] | 650 | AC_OUTPUT |
| Hisham Muhammad | c39f18a | 2017-07-10 20:14:25 -0300 | [diff] [blame] | 651 | |
| Christian Göttsche | f3623b7 | 2021-01-22 19:14:50 +0100 | [diff] [blame] | 652 | if test "$my_htop_platform" = unsupported; then |
| Hisham Muhammad | c39f18a | 2017-07-10 20:14:25 -0300 | [diff] [blame] | 653 | echo "" |
| 654 | echo "****************************************************************" |
| 655 | echo "WARNING! This platform is not currently supported by htop." |
| 656 | echo "" |
| 657 | echo "The code will build, but it will produce a dummy version of htop" |
| 658 | echo "which shows no processes, using the files from the unsupported/" |
| 659 | echo "directory. This is meant to be a skeleton, to be used as a" |
| 660 | echo "starting point if you are porting htop to a new platform." |
| 661 | echo "****************************************************************" |
| 662 | echo "" |
| 663 | fi |
| Christian Göttsche | 3b084db | 2020-08-28 12:10:31 +0200 | [diff] [blame] | 664 | |
| 665 | AC_MSG_RESULT([ |
| 666 | ${PACKAGE_NAME} ${VERSION} |
| 667 | |
| Christian Göttsche | ffd90c2 | 2020-10-05 12:29:31 +0200 | [diff] [blame] | 668 | platform: $my_htop_platform |
| Nathan Scott | 5b50ae3 | 2021-03-02 15:58:11 +1100 | [diff] [blame] | 669 | os-release file: $with_os_release |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 670 | (Linux) proc directory: $with_proc |
| Christian Göttsche | ffd90c2 | 2020-10-05 12:29:31 +0200 | [diff] [blame] | 671 | (Linux) openvz: $enable_openvz |
| Christian Göttsche | ffd90c2 | 2020-10-05 12:29:31 +0200 | [diff] [blame] | 672 | (Linux) vserver: $enable_vserver |
| 673 | (Linux) ancient vserver: $enable_ancient_vserver |
| Christian Göttsche | ffd90c2 | 2020-10-05 12:29:31 +0200 | [diff] [blame] | 674 | (Linux) affinity: $enable_linux_affinity |
| 675 | (Linux) delay accounting: $enable_delayacct |
| Christian Göttsche | 5e103ff | 2021-01-22 19:14:46 +0100 | [diff] [blame] | 676 | (Linux) sensors: $enable_sensors |
| 677 | (Linux) capabilities: $enable_capabilities |
| Christian Göttsche | ffd90c2 | 2020-10-05 12:29:31 +0200 | [diff] [blame] | 678 | unicode: $enable_unicode |
| Daniel Lange | 309f1d7 | 2020-11-16 13:29:37 +0100 | [diff] [blame] | 679 | hwloc: $enable_hwloc |
| Daniel Lange | a8a723f | 2020-11-16 17:01:51 +0100 | [diff] [blame] | 680 | debug: $enable_debug |
| Christian Göttsche | 575edff | 2021-01-22 19:14:59 +0100 | [diff] [blame] | 681 | static: $enable_static |
| Christian Göttsche | 3b084db | 2020-08-28 12:10:31 +0200 | [diff] [blame] | 682 | ]) |