configure.ac 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. # ----------------------------------------------------------------------
  4. # Build version string.
  5. # ----------------------------------------------------------------------
  6. m4_define([htop_git_version],
  7. m4_normalize(m4_esyscmd([git describe --abbrev=7 --dirty --always --tags 2> /dev/null || echo ''])))
  8. m4_define([htop_release_version], [3.4.0-dev])
  9. # ----------------------------------------------------------------------
  10. # Autoconf initialization.
  11. # ----------------------------------------------------------------------
  12. AC_PREREQ([2.69])
  13. AC_INIT([htop], [m4_join([-],m4_defn([htop_release_version]),m4_defn([htop_git_version]))], [htop@groups.io], [], [https://htop.dev/])
  14. AC_CONFIG_SRCDIR([htop.c])
  15. AC_CONFIG_AUX_DIR([build-aux])
  16. AC_CONFIG_HEADERS([config.h])
  17. AC_CANONICAL_HOST
  18. AM_INIT_AUTOMAKE([-Wall std-options subdir-objects])
  19. # ----------------------------------------------------------------------
  20. # ----------------------------------------------------------------------
  21. # Checks for platform.
  22. # ----------------------------------------------------------------------
  23. case "$host_os" in
  24. linux*|gnu*)
  25. my_htop_platform=linux
  26. AC_DEFINE([HTOP_LINUX], [], [Building for Linux.])
  27. ;;
  28. freebsd*|kfreebsd*)
  29. my_htop_platform=freebsd
  30. AC_DEFINE([HTOP_FREEBSD], [], [Building for FreeBSD.])
  31. ;;
  32. netbsd*)
  33. my_htop_platform=netbsd
  34. AC_DEFINE([HTOP_NETBSD], [], [Building for NetBSD.])
  35. ;;
  36. openbsd*)
  37. my_htop_platform=openbsd
  38. AC_DEFINE([HTOP_OPENBSD], [], [Building for OpenBSD.])
  39. ;;
  40. dragonfly*)
  41. my_htop_platform=dragonflybsd
  42. AC_DEFINE([HTOP_DRAGONFLYBSD], [], [Building for DragonFlyBSD.])
  43. ;;
  44. darwin*)
  45. my_htop_platform=darwin
  46. AC_DEFINE([HTOP_DARWIN], [], [Building for Darwin.])
  47. ;;
  48. solaris*)
  49. my_htop_platform=solaris
  50. AC_DEFINE([HTOP_SOLARIS], [], [Building for Solaris.])
  51. ;;
  52. *)
  53. my_htop_platform=unsupported
  54. AC_DEFINE([HTOP_UNSUPPORTED], [], [Building for an unsupported platform.])
  55. ;;
  56. esac
  57. # Enable extensions, required by hwloc scripts
  58. AC_USE_SYSTEM_EXTENSIONS
  59. # Activate some more of the missing global defines
  60. AC_SYS_LARGEFILE
  61. # ----------------------------------------------------------------------
  62. # ----------------------------------------------------------------------
  63. # Checks for compiler.
  64. # ----------------------------------------------------------------------
  65. AC_PROG_CC
  66. AM_PROG_CC_C_O
  67. m4_version_prereq([2.70], [], [AC_PROG_CC_C99])
  68. AS_IF([test "x$ac_cv_prog_cc_c99" = xno], [AC_MSG_ERROR([htop is written in C99. A newer compiler is required.])])
  69. AM_CFLAGS="-std=c99 -pedantic"
  70. # ----------------------------------------------------------------------
  71. # ----------------------------------------------------------------------
  72. # Checks for static build.
  73. # ----------------------------------------------------------------------
  74. AC_ARG_ENABLE([static],
  75. [AS_HELP_STRING([--enable-static],
  76. [build a static htop binary @<:@default=no@:>@])],
  77. [],
  78. [enable_static=no])
  79. case "$enable_static" in
  80. no)
  81. ;;
  82. yes)
  83. AC_DEFINE([BUILD_STATIC], [1], [Define if building static binary.])
  84. CFLAGS="$CFLAGS -static"
  85. LDFLAGS="$LDFLAGS -static"
  86. ;;
  87. *)
  88. AC_MSG_ERROR([bad value '$enable_static' for --enable-static option])
  89. ;;
  90. esac
  91. # ----------------------------------------------------------------------
  92. # ----------------------------------------------------------------------
  93. # Checks for a PCP-based htop build. (https://pcp.io)
  94. # ----------------------------------------------------------------------
  95. AC_ARG_ENABLE([pcp],
  96. [AS_HELP_STRING([--enable-pcp],
  97. [build a pcp-htop binary @<:@default=no@:>@])],
  98. [],
  99. [enable_pcp=no])
  100. case "$enable_pcp" in
  101. no)
  102. ;;
  103. yes)
  104. AC_CHECK_HEADERS([pcp/pmapi.h], [my_htop_platform=pcp],
  105. [AC_MSG_ERROR([can not find PCP header file])])
  106. AC_SEARCH_LIBS([pmNewContext], [pcp], [], [AC_MSG_ERROR([can not find PCP library])])
  107. AC_DEFINE([HTOP_PCP], [1], [Define if building pcp-htop binary.])
  108. AC_CONFIG_FILES([pcp-htop.5])
  109. ;;
  110. *)
  111. AC_MSG_ERROR([bad value '$enable_pcp' for --enable-pcp option])
  112. ;;
  113. esac
  114. # ----------------------------------------------------------------------
  115. # ----------------------------------------------------------------------
  116. # Checks for generic header files.
  117. # ----------------------------------------------------------------------
  118. AC_HEADER_DIRENT
  119. m4_version_prereq([2.70], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC])
  120. AC_CHECK_HEADERS([ \
  121. stdlib.h \
  122. string.h \
  123. strings.h \
  124. sys/param.h \
  125. sys/time.h \
  126. sys/utsname.h \
  127. unistd.h
  128. ], [], [AC_MSG_ERROR([can not find required generic header files])])
  129. AC_HEADER_MAJOR
  130. dnl glibc 2.25 deprecates 'major' and 'minor' in <sys/types.h> and requires to
  131. dnl include <sys/sysmacros.h>. However the logic in AC_HEADER_MAJOR has not yet
  132. dnl been updated in Autoconf 2.69, so use a workaround:
  133. m4_version_prereq([2.70], [],
  134. [if test "x$ac_cv_header_sys_mkdev_h" != xyes; then
  135. AC_CHECK_HEADER([sys/sysmacros.h], [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
  136. [Define to 1 if 'major', 'minor', and 'makedev' are declared in <sys/sysmacros.h>.])])
  137. fi])
  138. # Optional Section
  139. AC_CHECK_HEADERS([execinfo.h])
  140. if test "$my_htop_platform" = darwin; then
  141. AC_CHECK_HEADERS([mach/mach_time.h])
  142. fi
  143. # ----------------------------------------------------------------------
  144. # ----------------------------------------------------------------------
  145. # Checks for typedefs, structures, and compiler characteristics.
  146. # ----------------------------------------------------------------------
  147. AC_TYPE_MBSTATE_T
  148. AC_TYPE_MODE_T
  149. AC_TYPE_OFF_T
  150. AC_TYPE_PID_T
  151. AC_TYPE_SIZE_T
  152. AC_TYPE_SSIZE_T
  153. AC_TYPE_UID_T
  154. AC_TYPE_UINT8_T
  155. AC_TYPE_UINT16_T
  156. AC_TYPE_UINT32_T
  157. AC_TYPE_UINT64_T
  158. AC_MSG_CHECKING(for alloc_size)
  159. old_CFLAGS="$CFLAGS"
  160. CFLAGS="$CFLAGS -Wno-error -Werror=attributes"
  161. AC_COMPILE_IFELSE([
  162. AC_LANG_SOURCE(
  163. [
  164. /* Attribute supported in GCC 4.3 or later */
  165. __attribute__((alloc_size(1))) char* my_alloc(int size) { return 0; }
  166. ],[]
  167. )],
  168. AC_DEFINE([HAVE_ATTR_ALLOC_SIZE], 1, [The alloc_size attribute is supported.])
  169. AC_MSG_RESULT(yes),
  170. AC_MSG_RESULT(no))
  171. CFLAGS="$old_CFLAGS"
  172. AC_MSG_CHECKING(for access)
  173. old_CFLAGS="$CFLAGS"
  174. CFLAGS="$CFLAGS -Wno-error -Werror=attributes"
  175. AC_COMPILE_IFELSE([
  176. AC_LANG_SOURCE(
  177. [
  178. /* Attribute supported in GCC 10 or later */
  179. __attribute__((access(read_only, 1, 2))) extern int foo(const char* str, unsigned len);
  180. ],[]
  181. )],
  182. AC_DEFINE([HAVE_ATTR_ACCESS], 1, [The access attribute is supported.])
  183. AC_MSG_RESULT(yes),
  184. AC_MSG_RESULT(no))
  185. CFLAGS="$old_CFLAGS"
  186. AC_MSG_CHECKING(for nonnull)
  187. old_CFLAGS="$CFLAGS"
  188. CFLAGS="$CFLAGS -Wno-error -Werror=attributes"
  189. AC_COMPILE_IFELSE([
  190. AC_LANG_SOURCE(
  191. [[
  192. /* Attribute supported in GCC 3.3 or later */
  193. __attribute__((nonnull)) int my_strcmp(const char* a, const char* b);
  194. __attribute__((nonnull(1))) long my_strtol(const char* str, char** endptr, int base);
  195. ]]
  196. )],
  197. AC_DEFINE([HAVE_ATTR_NONNULL], 1, [The nonnull attribute is supported.])
  198. AC_MSG_RESULT(yes),
  199. AC_MSG_RESULT(no))
  200. CFLAGS="$old_CFLAGS"
  201. AC_MSG_CHECKING(for returns_nonnull)
  202. old_CFLAGS="$CFLAGS"
  203. CFLAGS="$CFLAGS -Wno-error -Werror=attributes"
  204. AC_COMPILE_IFELSE([
  205. AC_LANG_SOURCE(
  206. [[
  207. /* Attribute supported in GCC 4.9 or later */
  208. __attribute__((returns_nonnull)) void* foo(void);
  209. ]]
  210. )],
  211. AC_DEFINE([HAVE_ATTR_RETNONNULL], 1, [The returns_nonnull attribute is supported.])
  212. AC_MSG_RESULT(yes),
  213. AC_MSG_RESULT(no))
  214. CFLAGS="$old_CFLAGS"
  215. AC_MSG_CHECKING(for NaN support)
  216. dnl Note: AC_RUN_IFELSE does not try compiling the program at all when
  217. dnl $cross_compiling is 'yes'.
  218. AC_LINK_IFELSE([
  219. AC_LANG_PROGRAM(
  220. [[
  221. #include <math.h>
  222. ]],
  223. [[
  224. double x = NAN;
  225. /* Both should evaluate to false -> 0 (exit success) */
  226. return isgreater(x, x) || isgreaterequal(x, x);
  227. ]]
  228. )],
  229. [flag_finite_math_only=unknown
  230. if test "$cross_compiling" = yes; then
  231. AC_COMPILE_IFELSE([
  232. AC_LANG_SOURCE([[
  233. /* __FINITE_MATH_ONLY__ is documented in Clang. */
  234. #ifdef __FINITE_MATH_ONLY__
  235. #error "should not enable -ffinite-math-only"
  236. #endif
  237. ]])],
  238. AC_MSG_RESULT([assume yes (cross compiling)]),
  239. flag_finite_math_only=yes)
  240. elif ./conftest$EXEEXT >&AS_MESSAGE_LOG_FD; then
  241. flag_finite_math_only=no
  242. AC_MSG_RESULT(yes)
  243. else
  244. flag_finite_math_only=yes
  245. fi
  246. if test "$flag_finite_math_only" = yes; then
  247. AC_MSG_RESULT(no)
  248. AC_MSG_WARN([runtime behavior with NaN is not compliant - some functionality might break; consider using '-fno-finite-math-only'])
  249. fi],
  250. [AC_MSG_RESULT(no)
  251. AC_MSG_ERROR([can not find required macros: NAN, isgreater() and isgreaterequal()])])
  252. AC_MSG_CHECKING(for __builtin_ctz)
  253. AC_COMPILE_IFELSE([
  254. AC_LANG_PROGRAM([], [[__builtin_ctz(1); /* Supported in GCC 3.4 or later */]])],
  255. [AC_DEFINE([HAVE_BUILTIN_CTZ], 1, [Define to 1 if the compiler supports '__builtin_ctz' function.])
  256. AC_MSG_RESULT(yes)],
  257. AC_MSG_RESULT(no))
  258. # ----------------------------------------------------------------------
  259. # ----------------------------------------------------------------------
  260. # Checks for generic library functions.
  261. # ----------------------------------------------------------------------
  262. AC_SEARCH_LIBS([ceil], [m], [], [AC_MSG_ERROR([can not find required function ceil()])])
  263. if test "$my_htop_platform" = dragonflybsd; then
  264. AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
  265. AC_SEARCH_LIBS([getdevs], [devstat], [], [AC_MSG_ERROR([can not find required function getdevs()])])
  266. fi
  267. if test "$my_htop_platform" = freebsd; then
  268. if test "$enable_static" = yes; then
  269. AC_SEARCH_LIBS([elf_version], [elf], [], [AC_MSG_ERROR([can not find required function elf_version()])])
  270. fi
  271. AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
  272. AC_SEARCH_LIBS([devstat_checkversion], [devstat], [], [AC_MSG_ERROR([can not find required function devstat_checkversion()])])
  273. fi
  274. if test "$my_htop_platform" = linux; then
  275. if test "$enable_static" != yes; then
  276. AC_SEARCH_LIBS([dlopen], [dl dld], [], [AC_MSG_ERROR([can not find required function dlopen()])])
  277. fi
  278. fi
  279. if test "$my_htop_platform" = netbsd; then
  280. AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
  281. AC_SEARCH_LIBS([prop_dictionary_get], [prop], [], [AC_MSG_ERROR([can not find required function prop_dictionary_get()])])
  282. fi
  283. if test "$my_htop_platform" = openbsd; then
  284. AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
  285. fi
  286. if test "$my_htop_platform" = solaris; then
  287. AC_SEARCH_LIBS([kstat_open], [kstat], [], [AC_MSG_ERROR([can not find required function kstat_open()])])
  288. AC_SEARCH_LIBS([Pgrab_error], [proc], [], [AC_MSG_ERROR([can not find required function Pgrab_error()])])
  289. AC_SEARCH_LIBS([free], [malloc], [], [AC_MSG_ERROR([can not find required function free()])])
  290. fi
  291. # Optional Section
  292. AC_SEARCH_LIBS([clock_gettime], [rt])
  293. AC_CHECK_FUNCS([ \
  294. clock_gettime \
  295. dladdr \
  296. faccessat \
  297. fstatat \
  298. host_get_clock_service \
  299. memfd_create\
  300. openat \
  301. readlinkat \
  302. sched_getscheduler \
  303. sched_setscheduler \
  304. strchrnul \
  305. ])
  306. if test "$my_htop_platform" = darwin; then
  307. AC_CHECK_FUNCS([mach_timebase_info])
  308. AC_CHECK_DECLS([IOMainPort], [], [], [[#include <IOKit/IOKitLib.h>]])
  309. AC_CHECK_DECLS([IOMasterPort], [], [], [[#include <IOKit/IOKitLib.h>]])
  310. fi
  311. if test "$my_htop_platform" = pcp; then
  312. AC_CHECK_FUNCS([pmLookupDescs])
  313. fi
  314. if test "$my_htop_platform" = linux && test "x$enable_static" = xyes; then
  315. AC_CHECK_LIB([systemd], [sd_bus_open_system], [], [], [-lcap])
  316. fi
  317. # ----------------------------------------------------------------------
  318. # ----------------------------------------------------------------------
  319. # Checks for cross-platform features and flags.
  320. # ----------------------------------------------------------------------
  321. dnl PKG_PROG_PKG_CONFIG initializes $PKG_CONFIG and related variables.
  322. dnl If the macro is not called, some pkg-config checks might be skipped
  323. dnl and $PKG_CONFIG might be unset.
  324. m4_ifdef([PKG_PROG_PKG_CONFIG], [
  325. PKG_PROG_PKG_CONFIG()
  326. ], [
  327. pkg_m4_absent=1 # Makefile might grep this keyword. Don't remove.
  328. m4_warn(
  329. [syntax],
  330. [pkg.m4 is absent or older than version 0.16; this 'configure' would have incomplete pkg-config support])
  331. ])
  332. AC_ARG_ENABLE([unicode],
  333. [AS_HELP_STRING([--enable-unicode],
  334. [enable Unicode support @<:@default=yes@:>@])],
  335. [],
  336. [enable_unicode=yes])
  337. AC_ARG_VAR([CURSES_CFLAGS], [C compiler flags for curses; this overrides auto detected values])
  338. AC_ARG_VAR([CURSES_LIBS], [linker flags for curses; this overrides auto detected values])
  339. curses_pkg_names="ncurses6 ncurses5 ncurses curses"
  340. if test "x$enable_unicode" = xyes; then
  341. curses_pkg_names="ncursesw6 ncursesw5 ncursesw $curses_pkg_names"
  342. fi
  343. AC_ARG_WITH([curses],
  344. [AS_HELP_STRING([--with-curses=NAME],
  345. [select curses package NAME to link with; e.g. ncursesw6])],
  346. [],
  347. [with_curses=check])
  348. case $with_curses in
  349. check)
  350. : # No-op. Use default list.
  351. ;;
  352. yes|no)
  353. AC_MSG_ERROR([bad value '$with_curses' for --with-curses option])
  354. ;;
  355. *)
  356. if test "x${CURSES_CFLAGS+y}${CURSES_LIBS+y}" = xyy; then
  357. AC_MSG_WARN([ignoring --with-curses value due to override])
  358. fi
  359. curses_pkg_names=`echo "x$with_curses" | sed 's/^x\(lib\)\{0,1\}//'`
  360. ;;
  361. esac
  362. # $1: C preprocessor and compiler flags for curses library
  363. # $2: linker flags for curses library
  364. htop_check_curses_capability () {
  365. htop_curses_cflags=${CURSES_CFLAGS-"$1"}
  366. htop_curses_libs=${CURSES_LIBS-"$2"}
  367. echo "curses cflags${CURSES_CFLAGS+ (override)}: $htop_curses_cflags" >&AS_MESSAGE_LOG_FD
  368. echo "curses libs${CURSES_LIBS+ (override)}: $htop_curses_libs" >&AS_MESSAGE_LOG_FD
  369. htop_msg_linker_flags=$htop_curses_libs
  370. if test "`echo x $htop_msg_linker_flags`" = x; then
  371. htop_msg_linker_flags="(no linker flags)"
  372. fi
  373. htop_curses_status=0 # 0 for success; nonzero for failure
  374. htop_save_CFLAGS=$CFLAGS
  375. htop_save_LIBS=$LIBS
  376. CFLAGS="$AM_CFLAGS $htop_curses_cflags $CFLAGS"
  377. LIBS="$htop_curses_libs $LIBS"
  378. # At this point we have not checked the name of curses header, so
  379. # use forward declaration for the linking tests below.
  380. # htop uses keypad() and "stdscr", but for ncurses implementation,
  381. # the symbols are in "-ltinfo" and not "-lncurses".
  382. # Check "-ltinfo" symbols first, as libncurses might require
  383. # explicit "-ltinfo" to link (for internal dependency).
  384. AC_MSG_CHECKING([for keypad in $htop_msg_linker_flags])
  385. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  386. /* extern WINDOW* stdscr; */
  387. /* int keypad(WINDOW* win, bool enable); */
  388. extern void* stdscr;
  389. int keypad(void* win, int enable);
  390. ]], [[
  391. keypad(stdscr, 0);
  392. ]])],
  393. [AC_MSG_RESULT(yes)],
  394. [AC_MSG_RESULT(no)
  395. htop_curses_status=1])
  396. # htop calls refresh(), which might be implemented as a macro.
  397. # It is more reliable to test linking with doupdate(), which
  398. # refresh() would call internally.
  399. if test "$htop_curses_status" -eq 0; then
  400. AC_MSG_CHECKING([for doupdate in $htop_msg_linker_flags])
  401. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  402. int doupdate(void);
  403. ]], [[
  404. doupdate();
  405. ]])],
  406. [AC_MSG_RESULT(yes)
  407. htop_curses_capability=nonwide],
  408. [AC_MSG_RESULT(no)
  409. htop_curses_status=1])
  410. fi
  411. if test "x$htop_curses_status$enable_unicode" = x0yes; then
  412. AC_MSG_CHECKING([for mvadd_wchnstr in $htop_msg_linker_flags])
  413. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  414. /* int mvadd_wchnstr(int y, int x, const cchar_t* wchstr, int n); */
  415. int mvadd_wchnstr(int y, int x, const void* wchstr, int n);
  416. ]], [[
  417. mvadd_wchnstr(0, 0, (void*)0, 0);
  418. ]])],
  419. [AC_MSG_RESULT(yes)
  420. htop_curses_capability=wide],
  421. [AC_MSG_RESULT(no)
  422. htop_curses_status=1])
  423. fi
  424. if test "$htop_curses_status" -eq 0; then
  425. AM_CFLAGS="$AM_CFLAGS $htop_curses_cflags"
  426. if test "$htop_curses_capability" = wide; then
  427. AC_DEFINE([HAVE_LIBNCURSESW], 1, [libncursesw is present])
  428. else
  429. AC_DEFINE([HAVE_LIBNCURSES], 1, [libcurses is present])
  430. fi
  431. else
  432. LIBS=$htop_save_LIBS
  433. fi
  434. CFLAGS=$htop_save_CFLAGS
  435. return "$htop_curses_status"
  436. } # htop_check_curses_capability
  437. htop_curses_capability=none
  438. if test "x${CURSES_CFLAGS+y}${CURSES_LIBS+y}" = xyy; then
  439. curses_pkg_names=""
  440. htop_check_curses_capability "$CURSES_CFLAGS" "$CURSES_LIBS"
  441. fi
  442. # Prioritize $PKG_CONFIG over ncurses*-config, as users might need to
  443. # cross-compile htop.
  444. if test "x$PKG_CONFIG" != x; then
  445. pkg_config_static_flag=""
  446. if test "$enable_static" = yes; then
  447. pkg_config_static_flag=--static
  448. fi
  449. for curses_name in $curses_pkg_names; do
  450. echo retrieving $curses_name information through $PKG_CONFIG >&AS_MESSAGE_LOG_FD
  451. $PKG_CONFIG --exists --print-errors $curses_name >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD || continue
  452. : # Resets "$?" to 0
  453. htop_config_cflags=`$PKG_CONFIG --cflags $pkg_config_static_flag $curses_name 2>/dev/null` || continue
  454. : # Resets "$?" to 0
  455. htop_config_libs=`$PKG_CONFIG --libs $pkg_config_static_flag $curses_name 2>/dev/null` || continue
  456. AC_MSG_RESULT([found $curses_name information through $PKG_CONFIG])
  457. if htop_check_curses_capability "$htop_config_cflags" "$htop_config_libs"; then
  458. break
  459. fi
  460. done
  461. fi
  462. case ${htop_curses_capability}-$enable_unicode in
  463. none-*|nonwide-yes)
  464. for curses_name in $curses_pkg_names; do
  465. echo retrieving $curses_name information through ${curses_name}-config >&AS_MESSAGE_LOG_FD
  466. ${curses_name}-config --cflags >/dev/null 2>&AS_MESSAGE_LOG_FD || continue
  467. : # Resets "$?" to 0
  468. htop_config_cflags=`${curses_name}-config --cflags 2>/dev/null` || continue
  469. : # Resets "$?" to 0
  470. htop_config_libs=`${curses_name}-config --libs 2>/dev/null` || continue
  471. AC_MSG_RESULT([found $curses_name information through ${curses_name}-config])
  472. if htop_check_curses_capability "$htop_config_cflags" "$htop_config_libs"; then
  473. break
  474. fi
  475. done
  476. ;;
  477. esac
  478. case ${htop_curses_capability}-$enable_unicode in
  479. none-*|nonwide-yes)
  480. if test "x$PKG_CONFIG" = x; then (
  481. # Friendly warning to advise user to install pkg-config.
  482. # The local variables get discarded when done.
  483. list=""
  484. echo "" >conftest.c
  485. if test "$cross_compiling" != yes; then
  486. # "-print-multi-directory" supported in GCC 3.0 or later
  487. name=""
  488. if $CC $CPPFLAGS $CFLAGS -print-multi-directory -E conftest.c >/dev/null 2>&1; then
  489. name=`$CC $CPPFLAGS $CFLAGS -print-multi-directory -E conftest.c 2>/dev/null |
  490. sed '/^ *#/ d; s/^\.$//; q'`
  491. fi
  492. list="/usr/lib${name}/pkgconfig $list"
  493. case $host_os in
  494. darwin*)
  495. list="/opt/homebrew/Library/Homebrew/os/mac/pkgconfig $list"
  496. ;;
  497. freebsd*)
  498. list="/usr/libdata/pkgconfig $list"
  499. ;;
  500. netbsd*)
  501. list="/usr/pkg/lib/pkgconfig $list"
  502. ;;
  503. esac
  504. fi
  505. if test "x$host_alias" != x; then
  506. list="/usr/lib/${host_alias}/pkgconfig $list"
  507. fi
  508. # "-print-multiarch" supported in GCC 4.6 or later
  509. if $CC $CPPFLAGS $CFLAGS -print-multiarch -E conftest.c >/dev/null 2>&1; then
  510. name=`$CC $CPPFLAGS $CFLAGS -print-multiarch -E conftest.c 2>/dev/null |
  511. sed '/^ *#/ d; q'`
  512. if test "x$name" != x; then
  513. list="/usr/lib/${name}/pkgconfig $list"
  514. fi
  515. fi
  516. rm -f conftest.*
  517. for d in $list; do
  518. result=`find "$d" -name '*curses*.pc' 2>/dev/null | sed '1 q'`
  519. if test "x$result" != x; then
  520. AC_MSG_WARN([your system supports pkg-config; installing pkg-config is recommended before configuring htop])
  521. break
  522. fi
  523. done
  524. ) fi
  525. # OpenBSD and Solaris are known to not provide '*curses*.pc' files.
  526. AC_MSG_RESULT([no curses information found through '*-config' utilities; will guess the linker flags])
  527. for curses_name in $curses_pkg_names; do
  528. if htop_check_curses_capability "" "-l$curses_name"; then
  529. break
  530. fi
  531. # For ncurses implementation, an extra "-ltinfo" or "-ltinfow"
  532. # flag might be needed to link.
  533. if test "x$enable_unicode" = xyes &&
  534. htop_check_curses_capability "" "-l$curses_name -ltinfow"; then
  535. break
  536. fi
  537. if htop_check_curses_capability "" "-l$curses_name -ltinfo"; then
  538. break
  539. fi
  540. done
  541. ;;
  542. esac
  543. case ${htop_curses_capability}-$enable_unicode in
  544. nonwide-yes)
  545. AC_MSG_ERROR([cannot find required ncursesw library; you may want to use --disable-unicode])
  546. ;;
  547. none-*)
  548. AC_MSG_ERROR([cannot find required curses/ncurses library])
  549. ;;
  550. esac
  551. htop_save_CFLAGS=$CFLAGS
  552. CFLAGS="$AM_CFLAGS $CFLAGS"
  553. if test "x$enable_unicode" = xyes; then
  554. AC_CHECK_HEADERS([ncursesw/curses.h], [],
  555. [AC_CHECK_HEADERS([ncurses/ncurses.h], [],
  556. [AC_CHECK_HEADERS([ncurses/curses.h], [],
  557. [AC_CHECK_HEADERS([ncurses.h], [],
  558. [AC_MSG_ERROR([can not find required ncurses header file])])])])])
  559. AC_CHECK_HEADERS([ncursesw/term.h], [],
  560. [AC_CHECK_HEADERS([ncurses/term.h], [],
  561. [AC_CHECK_HEADERS([term.h], [],
  562. [AC_MSG_ERROR([can not find required term header file])])])])
  563. else
  564. AC_CHECK_HEADERS([curses.h], [],
  565. [AC_CHECK_HEADERS([ncurses/curses.h], [],
  566. [AC_CHECK_HEADERS([ncurses/ncurses.h], [],
  567. [AC_CHECK_HEADERS([ncurses.h], [],
  568. [AC_MSG_ERROR([can not find required ncurses header file])])])])])
  569. AC_CHECK_HEADERS([ncurses/term.h], [],
  570. [AC_CHECK_HEADERS([term.h], [],
  571. [AC_MSG_ERROR([can not find required term header file])])])
  572. fi
  573. CFLAGS=$htop_save_CFLAGS
  574. if test "$enable_static" = yes; then
  575. AC_SEARCH_LIBS([Gpm_GetEvent], [gpm])
  576. fi
  577. if test "$my_htop_platform" = "solaris"; then
  578. # On OmniOS /usr/include/sys/regset.h redefines ERR to 13 - \r, breaking the Enter key.
  579. # Since ncurses macros use the ERR macro, we can not use another name.
  580. AC_DEFINE([ERR], [(-1)], [Predefine ncurses macro.])
  581. fi
  582. AC_CHECK_FUNCS( [set_escdelay] )
  583. AC_CHECK_FUNCS( [getmouse] )
  584. AC_DEFINE([NCURSES_ENABLE_STDBOOL_H], [1], [Define to enable stdbool.h in ncurses])
  585. AC_ARG_ENABLE([affinity],
  586. [AS_HELP_STRING([--enable-affinity],
  587. [enable sched_setaffinity and sched_getaffinity for affinity support, conflicts with hwloc @<:@default=check@:>@])],
  588. [],
  589. [enable_affinity=check])
  590. if test "x$enable_affinity" = xcheck; then
  591. if test "x$enable_hwloc" = xyes; then
  592. enable_affinity=no
  593. else
  594. AC_MSG_CHECKING([for usable sched_setaffinity])
  595. AC_RUN_IFELSE([
  596. AC_LANG_PROGRAM([[
  597. #include <sched.h>
  598. #include <errno.h>
  599. static cpu_set_t cpuset;
  600. ]], [[
  601. CPU_ZERO(&cpuset);
  602. sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
  603. if (errno == ENOSYS) return 1;
  604. ]])],
  605. [enable_affinity=yes
  606. AC_MSG_RESULT([yes])],
  607. [enable_affinity=no
  608. AC_MSG_RESULT([no])],
  609. [AC_MSG_RESULT([assume yes (cross compiling)])])
  610. fi
  611. fi
  612. if test "x$enable_affinity" = xyes; then
  613. if test "x$enable_hwloc" = xyes; then
  614. AC_MSG_ERROR([--enable-hwloc and --enable-affinity are mutual exclusive. Specify at most one of them.])
  615. fi
  616. AC_DEFINE([HAVE_AFFINITY], [1], [Define if sched_setaffinity and sched_getaffinity are to be used.])
  617. fi
  618. AC_ARG_ENABLE([unwind],
  619. [AS_HELP_STRING([--enable-unwind],
  620. [enable unwind support for printing backtraces; requires libunwind @<:@default=check@:>@])],
  621. [],
  622. [enable_unwind=check])
  623. case "$enable_unwind" in
  624. check)
  625. enable_unwind=yes
  626. if test "$enable_static" = yes; then
  627. AC_CHECK_LIB([lzma], [lzma_index_buffer_decode])
  628. fi
  629. AC_CHECK_LIB([unwind], [backtrace], [], [enable_unwind=no])
  630. AC_CHECK_HEADERS([libunwind.h], [], [
  631. old_CFLAGS="$CFLAGS"
  632. CFLAGS="$CFLAGS -I/usr/include/libunwind"
  633. AC_CHECK_HEADERS([libunwind/libunwind.h], [], [
  634. enable_unwind=no
  635. CFLAGS="$old_CFLAGS"
  636. ])
  637. ])
  638. ;;
  639. no)
  640. ;;
  641. yes)
  642. AC_CHECK_LIB([unwind], [backtrace], [], [AC_MSG_ERROR([can not find required library libunwind])])
  643. AC_CHECK_HEADERS([libunwind.h], [], [
  644. AM_CFLAGS="$AM_CFLAGS -I/usr/include/libunwind"
  645. AC_CHECK_HEADERS([libunwind/libunwind.h], [], [AC_MSG_ERROR([can not find required header file libunwind.h])])
  646. ])
  647. ;;
  648. *)
  649. AC_MSG_ERROR([bad value '$enable_unwind' for --enable-unwind])
  650. ;;
  651. esac
  652. if test "x$enable_unwind" = xno; then
  653. # Fall back to backtrace(3) and add -lexecinfo if needed
  654. AC_SEARCH_LIBS([backtrace], [execinfo])
  655. fi
  656. AC_ARG_ENABLE([hwloc],
  657. [AS_HELP_STRING([--enable-hwloc],
  658. [enable hwloc support for CPU affinity; disables affinity support; requires libhwloc @<:@default=no@:>@])],
  659. [],
  660. [enable_hwloc=no])
  661. case "$enable_hwloc" in
  662. no)
  663. ;;
  664. yes)
  665. m4_ifdef([PKG_PROG_PKG_CONFIG], [
  666. PKG_CHECK_MODULES(HWLOC, hwloc, [
  667. AM_CFLAGS="$AM_CFLAGS $HWLOC_CFLAGS"
  668. LIBS="$LIBS $HWLOC_LIBS"
  669. AC_DEFINE([HAVE_LIBHWLOC], [1], [Define to 1 if you have the 'hwloc' library (-lhwloc).])
  670. ], [
  671. AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])])
  672. AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])])
  673. ])
  674. ], [
  675. AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])])
  676. AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])])
  677. ])
  678. ;;
  679. *)
  680. AC_MSG_ERROR([bad value '$enable_hwloc' for --enable-hwloc])
  681. ;;
  682. esac
  683. AC_ARG_WITH([os-release],
  684. [AS_HELP_STRING([--with-os-release=FILE],
  685. [location of an os-release file @<:@default=/etc/os-release@:>@])],
  686. [],
  687. [with_os_release=/etc/os-release])
  688. if test -n "$with_os_release" && test ! -f "$with_os_release"; then
  689. if test -f "/usr/lib/os-release"; then
  690. with_os_release="/usr/lib/os-release"
  691. fi
  692. fi
  693. AC_DEFINE_UNQUOTED([OSRELEASEFILE], ["$with_os_release"], [File with OS release details.])
  694. AC_ARG_WITH([config],
  695. [AS_HELP_STRING([--with-config=DIR],
  696. [configuration path @<:@default=/.config@:>@])],
  697. [],
  698. [with_config="/.config"])
  699. dnl Performance Co-Pilot configuration location to prevent overwrite
  700. if test "$my_htop_platform" = pcp -a "$with_config" = /.config; then
  701. with_config="/.pcp"
  702. elif test -z "$with_config"; then
  703. AC_MSG_ERROR([bad empty value for --with-config option])
  704. fi
  705. AC_DEFINE_UNQUOTED([CONFIGDIR], ["$with_config"], [Configuration path.])
  706. # ----------------------------------------------------------------------
  707. # ----------------------------------------------------------------------
  708. # Checks for Linux features and flags.
  709. # ----------------------------------------------------------------------
  710. AC_ARG_WITH([proc],
  711. [AS_HELP_STRING([--with-proc=DIR],
  712. [location of a Linux-compatible proc filesystem @<:@default=/proc@:>@])],
  713. [],
  714. [with_proc=/proc])
  715. if test -z "$with_proc"; then
  716. AC_MSG_ERROR([bad empty value for --with-proc option])
  717. fi
  718. AC_DEFINE_UNQUOTED([PROCDIR], ["$with_proc"], [Path of proc filesystem.])
  719. AC_ARG_ENABLE([openvz],
  720. [AS_HELP_STRING([--enable-openvz],
  721. [enable OpenVZ support @<:@default=no@:>@])],
  722. [],
  723. [enable_openvz=no])
  724. if test "x$enable_openvz" = xyes; then
  725. AC_DEFINE([HAVE_OPENVZ], [1], [Define if openvz support enabled.])
  726. fi
  727. AC_ARG_ENABLE([vserver],
  728. [AS_HELP_STRING([--enable-vserver],
  729. [enable VServer support @<:@default=no@:>@])],
  730. [],
  731. [enable_vserver=no])
  732. if test "x$enable_vserver" = xyes; then
  733. AC_DEFINE([HAVE_VSERVER], [1], [Define if VServer support enabled.])
  734. fi
  735. AC_ARG_ENABLE([ancient_vserver],
  736. [AS_HELP_STRING([--enable-ancient-vserver],
  737. [enable ancient VServer support (implies --enable-vserver) @<:@default=no@:>@])],
  738. [],
  739. [enable_ancient_vserver=no])
  740. if test "x$enable_ancient_vserver" = xyes; then
  741. if test "x$enable_vserver" != xyes; then
  742. enable_vserver=implied
  743. fi
  744. AC_DEFINE([HAVE_VSERVER], [1], [Define if VServer support enabled.])
  745. AC_DEFINE([HAVE_ANCIENT_VSERVER], [1], [Define if ancient vserver support enabled.])
  746. fi
  747. AC_ARG_ENABLE([capabilities],
  748. [AS_HELP_STRING([--enable-capabilities],
  749. [enable Linux capabilities support; requires libcap @<:@default=check@:>@])],
  750. [],
  751. [enable_capabilities=check])
  752. case "$enable_capabilities" in
  753. no)
  754. ;;
  755. check)
  756. enable_capabilities=yes
  757. AC_CHECK_LIB([cap], [cap_init], [], [enable_capabilities=no])
  758. AC_CHECK_HEADERS([sys/capability.h], [], [enable_capabilities=no])
  759. ;;
  760. yes)
  761. AC_CHECK_LIB([cap], [cap_init], [], [AC_MSG_ERROR([can not find required library libcap])])
  762. AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([can not find required header file sys/capability.h])])
  763. ;;
  764. *)
  765. AC_MSG_ERROR([bad value '$enable_capabilities' for --enable-capabilities])
  766. ;;
  767. esac
  768. AC_ARG_ENABLE([delayacct],
  769. [AS_HELP_STRING([--enable-delayacct],
  770. [enable Linux delay accounting support; requires pkg-config, libnl-3 and libnl-genl-3 @<:@default=check@:>@])],
  771. [],
  772. [enable_delayacct=check])
  773. case "$enable_delayacct" in
  774. no)
  775. ;;
  776. check)
  777. if test "$my_htop_platform" != linux; then
  778. enable_delayacct=no
  779. elif test "$enable_static" = yes; then
  780. enable_delayacct=no
  781. else
  782. old_CFLAGS="$CFLAGS"
  783. CFLAGS="$CFLAGS -I/usr/include/libnl3"
  784. AC_CHECK_HEADERS([netlink/attr.h netlink/handlers.h netlink/msg.h], [enable_delayacct=yes], [enable_delayacct=no])
  785. CFLAGS="$old_CFLAGS"
  786. fi
  787. ;;
  788. yes)
  789. old_CFLAGS="$CFLAGS"
  790. CFLAGS="$CFLAGS -I/usr/include/libnl3"
  791. AC_CHECK_HEADERS([netlink/attr.h netlink/handlers.h netlink/msg.h], [], [AC_MSG_ERROR([can not find required header files netlink/attr.h, netlink/handlers.h, netlink/msg.h])])
  792. CFLAGS="$old_CFLAGS"
  793. ;;
  794. *)
  795. AC_MSG_ERROR([bad value '$enable_delayacct' for --enable-delayacct])
  796. ;;
  797. esac
  798. if test "$enable_delayacct" = yes; then
  799. AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.])
  800. AM_CFLAGS="$AM_CFLAGS -I/usr/include/libnl3"
  801. fi
  802. AM_CONDITIONAL([HAVE_DELAYACCT], [test "$enable_delayacct" = yes])
  803. AC_ARG_ENABLE([sensors],
  804. [AS_HELP_STRING([--enable-sensors],
  805. [enable libsensors support for reading temperature data; requires only libsensors headers at compile time, at runtime libsensors is loaded via dlopen @<:@default=check@:>@])],
  806. [],
  807. [enable_sensors=check])
  808. case "$enable_sensors" in
  809. no)
  810. ;;
  811. check)
  812. enable_sensors=yes
  813. if test "$enable_static" = yes; then
  814. AC_CHECK_LIB([sensors], [sensors_init], [], [enable_sensors=no])
  815. fi
  816. AC_CHECK_HEADERS([sensors/sensors.h], [], [enable_sensors=no])
  817. ;;
  818. yes)
  819. if test "$enable_static" = yes; then
  820. AC_CHECK_LIB([sensors], [sensors_init], [], [AC_MSG_ERROR([can not find required library libsensors])])
  821. fi
  822. AC_CHECK_HEADERS([sensors/sensors.h], [], [AC_MSG_ERROR([can not find required header file sensors/sensors.h])])
  823. ;;
  824. *)
  825. AC_MSG_ERROR([bad value '$enable_sensors' for --enable-sensors])
  826. ;;
  827. esac
  828. if test "$enable_sensors" = yes || test "$my_htop_platform" = freebsd; then
  829. AC_DEFINE([BUILD_WITH_CPU_TEMP], [1], [Define if CPU temperature option should be enabled.])
  830. fi
  831. # ----------------------------------------------------------------------
  832. # ----------------------------------------------------------------------
  833. # Checks for compiler warnings.
  834. # ----------------------------------------------------------------------
  835. AM_CFLAGS="$AM_CFLAGS\
  836. -Wall\
  837. -Wcast-align\
  838. -Wcast-qual\
  839. -Wextra\
  840. -Wfloat-equal\
  841. -Wformat=2\
  842. -Winit-self\
  843. -Wmissing-format-attribute\
  844. -Wmissing-noreturn\
  845. -Wmissing-prototypes\
  846. -Wpointer-arith\
  847. -Wshadow\
  848. -Wstrict-prototypes\
  849. -Wundef\
  850. -Wunused\
  851. -Wwrite-strings"
  852. dnl https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
  853. AC_DEFUN([AX_CHECK_COMPILE_FLAG],
  854. [
  855. AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
  856. AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
  857. ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
  858. _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
  859. AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
  860. [AS_VAR_SET(CACHEVAR,[yes])],
  861. [AS_VAR_SET(CACHEVAR,[no])])
  862. _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
  863. AS_VAR_IF(CACHEVAR,yes,
  864. [m4_default([$2], :)],
  865. [m4_default([$3], :)])
  866. AS_VAR_POPDEF([CACHEVAR])dnl
  867. ])dnl AX_CHECK_COMPILE_FLAGS
  868. AX_CHECK_COMPILE_FLAG([-Wextra-semi-stmt], [AM_CFLAGS="$AM_CFLAGS -Wextra-semi-stmt"], , [-Werror=unknown-warning-option]) dnl the autoconf check itself generates -Wextra-semi-stmt
  869. AX_CHECK_COMPILE_FLAG([-Wimplicit-int-conversion], [AM_CFLAGS="$AM_CFLAGS -Wimplicit-int-conversion"], , [-Werror])
  870. AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [AM_CFLAGS="$AM_CFLAGS -Wnull-dereference"], , [-Werror])
  871. AC_ARG_ENABLE([werror],
  872. [AS_HELP_STRING([--enable-werror],
  873. [Treat warnings as errors @<:@default=no@:>@])],
  874. [],
  875. [enable_werror=no])
  876. if test "x$enable_werror" = xyes; then
  877. AM_CFLAGS="$AM_CFLAGS -Werror"
  878. fi
  879. AC_ARG_ENABLE([debug],
  880. [AS_HELP_STRING([--enable-debug],
  881. [Enable compiling with maximum debug info, asserts and internal sanity checks @<:@default=no@:>@])],
  882. [],
  883. [enable_debug=no])
  884. if test "x$enable_debug" != xyes; then
  885. AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
  886. AC_COMPILE_IFELSE([
  887. AC_LANG_SOURCE([[
  888. #ifdef __SUPPORT_SNAN__
  889. #error "signaling NaN support not recommended"
  890. #endif
  891. ]])],
  892. :,
  893. [warning_msg="signaling NaN support is enabled; not recommended for htop"
  894. case "$CC" in
  895. *gcc*)
  896. warning_msg="$warning_msg (use '-fno-signaling-nans' compiler flag to disable)"
  897. ;;
  898. esac
  899. AC_MSG_WARN([$warning_msg])
  900. ])
  901. else
  902. AM_CPPFLAGS="$AM_CPPFLAGS -ggdb3"
  903. fi
  904. AC_SUBST([AM_CFLAGS])
  905. AC_SUBST([AM_CPPFLAGS])
  906. # ----------------------------------------------------------------------
  907. # ----------------------------------------------------------------------
  908. # We're done, let's go!
  909. # ----------------------------------------------------------------------
  910. AC_DEFINE_UNQUOTED([COPYRIGHT], ["(C) 2004-2019 Hisham Muhammad. (C) 2020-2024 htop dev team."], [Copyright message.])
  911. AM_CONDITIONAL([HTOP_LINUX], [test "$my_htop_platform" = linux])
  912. AM_CONDITIONAL([HTOP_FREEBSD], [test "$my_htop_platform" = freebsd])
  913. AM_CONDITIONAL([HTOP_DRAGONFLYBSD], [test "$my_htop_platform" = dragonflybsd])
  914. AM_CONDITIONAL([HTOP_NETBSD], [test "$my_htop_platform" = netbsd])
  915. AM_CONDITIONAL([HTOP_OPENBSD], [test "$my_htop_platform" = openbsd])
  916. AM_CONDITIONAL([HTOP_DARWIN], [test "$my_htop_platform" = darwin])
  917. AM_CONDITIONAL([HTOP_SOLARIS], [test "$my_htop_platform" = solaris])
  918. AM_CONDITIONAL([HTOP_PCP], [test "$my_htop_platform" = pcp])
  919. AM_CONDITIONAL([HTOP_UNSUPPORTED], [test "$my_htop_platform" = unsupported])
  920. AC_SUBST(my_htop_platform)
  921. AC_CONFIG_FILES([Makefile htop.1])
  922. AC_OUTPUT
  923. if test "$my_htop_platform" = unsupported; then
  924. echo ""
  925. echo "****************************************************************"
  926. echo "WARNING! This platform is not currently supported by htop."
  927. echo ""
  928. echo "The code will build, but it will produce a dummy version of htop"
  929. echo "which shows no processes, using the files from the unsupported/"
  930. echo "directory. This is meant to be a skeleton, to be used as a"
  931. echo "starting point if you are porting htop to a new platform."
  932. echo "****************************************************************"
  933. echo ""
  934. fi
  935. AC_MSG_RESULT([
  936. ${PACKAGE_NAME} ${VERSION}
  937. platform: $my_htop_platform
  938. os-release file: $with_os_release
  939. (Linux) proc directory: $with_proc
  940. (Linux) openvz: $enable_openvz
  941. (Linux) vserver: $enable_vserver
  942. (Linux) ancient vserver: $enable_ancient_vserver
  943. (Linux) delay accounting: $enable_delayacct
  944. (Linux) sensors: $enable_sensors
  945. (Linux) capabilities: $enable_capabilities
  946. unicode: $enable_unicode
  947. affinity: $enable_affinity
  948. unwind: $enable_unwind
  949. hwloc: $enable_hwloc
  950. debug: $enable_debug
  951. static: $enable_static
  952. ])