configure.ac 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092
  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_ARG_ENABLE([affinity],
  585. [AS_HELP_STRING([--enable-affinity],
  586. [enable sched_setaffinity and sched_getaffinity for affinity support, conflicts with hwloc @<:@default=check@:>@])],
  587. [],
  588. [enable_affinity=check])
  589. if test "x$enable_affinity" = xcheck; then
  590. if test "x$enable_hwloc" = xyes; then
  591. enable_affinity=no
  592. else
  593. AC_MSG_CHECKING([for usable sched_setaffinity])
  594. AC_RUN_IFELSE([
  595. AC_LANG_PROGRAM([[
  596. #include <sched.h>
  597. #include <errno.h>
  598. static cpu_set_t cpuset;
  599. ]], [[
  600. CPU_ZERO(&cpuset);
  601. sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
  602. if (errno == ENOSYS) return 1;
  603. ]])],
  604. [enable_affinity=yes
  605. AC_MSG_RESULT([yes])],
  606. [enable_affinity=no
  607. AC_MSG_RESULT([no])],
  608. [AC_MSG_RESULT([assume yes (cross compiling)])])
  609. fi
  610. fi
  611. if test "x$enable_affinity" = xyes; then
  612. if test "x$enable_hwloc" = xyes; then
  613. AC_MSG_ERROR([--enable-hwloc and --enable-affinity are mutual exclusive. Specify at most one of them.])
  614. fi
  615. AC_DEFINE([HAVE_AFFINITY], [1], [Define if sched_setaffinity and sched_getaffinity are to be used.])
  616. fi
  617. AC_ARG_ENABLE([unwind],
  618. [AS_HELP_STRING([--enable-unwind],
  619. [enable unwind support for printing backtraces; requires libunwind @<:@default=check@:>@])],
  620. [],
  621. [enable_unwind=check])
  622. case "$enable_unwind" in
  623. check)
  624. enable_unwind=yes
  625. if test "$enable_static" = yes; then
  626. AC_CHECK_LIB([lzma], [lzma_index_buffer_decode])
  627. fi
  628. AC_CHECK_LIB([unwind], [backtrace], [], [enable_unwind=no])
  629. AC_CHECK_HEADERS([libunwind.h], [], [
  630. old_CFLAGS="$CFLAGS"
  631. CFLAGS="$CFLAGS -I/usr/include/libunwind"
  632. AC_CHECK_HEADERS([libunwind/libunwind.h], [], [
  633. enable_unwind=no
  634. CFLAGS="$old_CFLAGS"
  635. ])
  636. ])
  637. ;;
  638. no)
  639. ;;
  640. yes)
  641. AC_CHECK_LIB([unwind], [backtrace], [], [AC_MSG_ERROR([can not find required library libunwind])])
  642. AC_CHECK_HEADERS([libunwind.h], [], [
  643. AM_CFLAGS="$AM_CFLAGS -I/usr/include/libunwind"
  644. AC_CHECK_HEADERS([libunwind/libunwind.h], [], [AC_MSG_ERROR([can not find required header file libunwind.h])])
  645. ])
  646. ;;
  647. *)
  648. AC_MSG_ERROR([bad value '$enable_unwind' for --enable-unwind])
  649. ;;
  650. esac
  651. if test "x$enable_unwind" = xno; then
  652. # Fall back to backtrace(3) and add -lexecinfo if needed
  653. AC_SEARCH_LIBS([backtrace], [execinfo])
  654. fi
  655. AC_ARG_ENABLE([hwloc],
  656. [AS_HELP_STRING([--enable-hwloc],
  657. [enable hwloc support for CPU affinity; disables affinity support; requires libhwloc @<:@default=no@:>@])],
  658. [],
  659. [enable_hwloc=no])
  660. case "$enable_hwloc" in
  661. no)
  662. ;;
  663. yes)
  664. m4_ifdef([PKG_PROG_PKG_CONFIG], [
  665. PKG_CHECK_MODULES(HWLOC, hwloc, [
  666. AM_CFLAGS="$AM_CFLAGS $HWLOC_CFLAGS"
  667. LIBS="$LIBS $HWLOC_LIBS"
  668. AC_DEFINE([HAVE_LIBHWLOC], [1], [Define to 1 if you have the 'hwloc' library (-lhwloc).])
  669. ], [
  670. AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])])
  671. AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])])
  672. ])
  673. ], [
  674. AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])])
  675. AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])])
  676. ])
  677. ;;
  678. *)
  679. AC_MSG_ERROR([bad value '$enable_hwloc' for --enable-hwloc])
  680. ;;
  681. esac
  682. AC_ARG_WITH([os-release],
  683. [AS_HELP_STRING([--with-os-release=FILE],
  684. [location of an os-release file @<:@default=/etc/os-release@:>@])],
  685. [],
  686. [with_os_release=/etc/os-release])
  687. if test -n "$with_os_release" && test ! -f "$with_os_release"; then
  688. if test -f "/usr/lib/os-release"; then
  689. with_os_release="/usr/lib/os-release"
  690. fi
  691. fi
  692. AC_DEFINE_UNQUOTED([OSRELEASEFILE], ["$with_os_release"], [File with OS release details.])
  693. AC_ARG_WITH([config],
  694. [AS_HELP_STRING([--with-config=DIR],
  695. [configuration path @<:@default=/.config@:>@])],
  696. [],
  697. [with_config="/.config"])
  698. dnl Performance Co-Pilot configuration location to prevent overwrite
  699. if test "$my_htop_platform" = pcp -a "$with_config" = /.config; then
  700. with_config="/.pcp"
  701. elif test -z "$with_config"; then
  702. AC_MSG_ERROR([bad empty value for --with-config option])
  703. fi
  704. AC_DEFINE_UNQUOTED([CONFIGDIR], ["$with_config"], [Configuration path.])
  705. # ----------------------------------------------------------------------
  706. # ----------------------------------------------------------------------
  707. # Checks for Linux features and flags.
  708. # ----------------------------------------------------------------------
  709. AC_ARG_WITH([proc],
  710. [AS_HELP_STRING([--with-proc=DIR],
  711. [location of a Linux-compatible proc filesystem @<:@default=/proc@:>@])],
  712. [],
  713. [with_proc=/proc])
  714. if test -z "$with_proc"; then
  715. AC_MSG_ERROR([bad empty value for --with-proc option])
  716. fi
  717. AC_DEFINE_UNQUOTED([PROCDIR], ["$with_proc"], [Path of proc filesystem.])
  718. AC_ARG_ENABLE([openvz],
  719. [AS_HELP_STRING([--enable-openvz],
  720. [enable OpenVZ support @<:@default=no@:>@])],
  721. [],
  722. [enable_openvz=no])
  723. if test "x$enable_openvz" = xyes; then
  724. AC_DEFINE([HAVE_OPENVZ], [1], [Define if openvz support enabled.])
  725. fi
  726. AC_ARG_ENABLE([vserver],
  727. [AS_HELP_STRING([--enable-vserver],
  728. [enable VServer support @<:@default=no@:>@])],
  729. [],
  730. [enable_vserver=no])
  731. if test "x$enable_vserver" = xyes; then
  732. AC_DEFINE([HAVE_VSERVER], [1], [Define if VServer support enabled.])
  733. fi
  734. AC_ARG_ENABLE([ancient_vserver],
  735. [AS_HELP_STRING([--enable-ancient-vserver],
  736. [enable ancient VServer support (implies --enable-vserver) @<:@default=no@:>@])],
  737. [],
  738. [enable_ancient_vserver=no])
  739. if test "x$enable_ancient_vserver" = xyes; then
  740. if test "x$enable_vserver" != xyes; then
  741. enable_vserver=implied
  742. fi
  743. AC_DEFINE([HAVE_VSERVER], [1], [Define if VServer support enabled.])
  744. AC_DEFINE([HAVE_ANCIENT_VSERVER], [1], [Define if ancient vserver support enabled.])
  745. fi
  746. AC_ARG_ENABLE([capabilities],
  747. [AS_HELP_STRING([--enable-capabilities],
  748. [enable Linux capabilities support; requires libcap @<:@default=check@:>@])],
  749. [],
  750. [enable_capabilities=check])
  751. case "$enable_capabilities" in
  752. no)
  753. ;;
  754. check)
  755. enable_capabilities=yes
  756. AC_CHECK_LIB([cap], [cap_init], [], [enable_capabilities=no])
  757. AC_CHECK_HEADERS([sys/capability.h], [], [enable_capabilities=no])
  758. ;;
  759. yes)
  760. AC_CHECK_LIB([cap], [cap_init], [], [AC_MSG_ERROR([can not find required library libcap])])
  761. AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([can not find required header file sys/capability.h])])
  762. ;;
  763. *)
  764. AC_MSG_ERROR([bad value '$enable_capabilities' for --enable-capabilities])
  765. ;;
  766. esac
  767. AC_ARG_ENABLE([delayacct],
  768. [AS_HELP_STRING([--enable-delayacct],
  769. [enable Linux delay accounting support; requires pkg-config, libnl-3 and libnl-genl-3 @<:@default=check@:>@])],
  770. [],
  771. [enable_delayacct=check])
  772. case "$enable_delayacct" in
  773. no)
  774. ;;
  775. check)
  776. if test "$my_htop_platform" != linux; then
  777. enable_delayacct=no
  778. elif test "$enable_static" = yes; then
  779. enable_delayacct=no
  780. else
  781. old_CFLAGS="$CFLAGS"
  782. CFLAGS="$CFLAGS -I/usr/include/libnl3"
  783. AC_CHECK_HEADERS([netlink/attr.h netlink/handlers.h netlink/msg.h], [enable_delayacct=yes], [enable_delayacct=no])
  784. CFLAGS="$old_CFLAGS"
  785. fi
  786. ;;
  787. yes)
  788. old_CFLAGS="$CFLAGS"
  789. CFLAGS="$CFLAGS -I/usr/include/libnl3"
  790. 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])])
  791. CFLAGS="$old_CFLAGS"
  792. ;;
  793. *)
  794. AC_MSG_ERROR([bad value '$enable_delayacct' for --enable-delayacct])
  795. ;;
  796. esac
  797. if test "$enable_delayacct" = yes; then
  798. AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.])
  799. AM_CFLAGS="$AM_CFLAGS -I/usr/include/libnl3"
  800. fi
  801. AM_CONDITIONAL([HAVE_DELAYACCT], [test "$enable_delayacct" = yes])
  802. AC_ARG_ENABLE([sensors],
  803. [AS_HELP_STRING([--enable-sensors],
  804. [enable libsensors support for reading temperature data; requires only libsensors headers at compile time, at runtime libsensors is loaded via dlopen @<:@default=check@:>@])],
  805. [],
  806. [enable_sensors=check])
  807. case "$enable_sensors" in
  808. no)
  809. ;;
  810. check)
  811. enable_sensors=yes
  812. if test "$enable_static" = yes; then
  813. AC_CHECK_LIB([sensors], [sensors_init], [], [enable_sensors=no])
  814. fi
  815. AC_CHECK_HEADERS([sensors/sensors.h], [], [enable_sensors=no])
  816. ;;
  817. yes)
  818. if test "$enable_static" = yes; then
  819. AC_CHECK_LIB([sensors], [sensors_init], [], [AC_MSG_ERROR([can not find required library libsensors])])
  820. fi
  821. AC_CHECK_HEADERS([sensors/sensors.h], [], [AC_MSG_ERROR([can not find required header file sensors/sensors.h])])
  822. ;;
  823. *)
  824. AC_MSG_ERROR([bad value '$enable_sensors' for --enable-sensors])
  825. ;;
  826. esac
  827. if test "$enable_sensors" = yes || test "$my_htop_platform" = freebsd; then
  828. AC_DEFINE([BUILD_WITH_CPU_TEMP], [1], [Define if CPU temperature option should be enabled.])
  829. fi
  830. # ----------------------------------------------------------------------
  831. # ----------------------------------------------------------------------
  832. # Checks for compiler warnings.
  833. # ----------------------------------------------------------------------
  834. AM_CFLAGS="$AM_CFLAGS\
  835. -Wall\
  836. -Wcast-align\
  837. -Wcast-qual\
  838. -Wextra\
  839. -Wfloat-equal\
  840. -Wformat=2\
  841. -Winit-self\
  842. -Wmissing-format-attribute\
  843. -Wmissing-noreturn\
  844. -Wmissing-prototypes\
  845. -Wpointer-arith\
  846. -Wshadow\
  847. -Wstrict-prototypes\
  848. -Wundef\
  849. -Wunused\
  850. -Wwrite-strings"
  851. dnl https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
  852. AC_DEFUN([AX_CHECK_COMPILE_FLAG],
  853. [
  854. AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
  855. AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
  856. ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
  857. _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
  858. AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
  859. [AS_VAR_SET(CACHEVAR,[yes])],
  860. [AS_VAR_SET(CACHEVAR,[no])])
  861. _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
  862. AS_VAR_IF(CACHEVAR,yes,
  863. [m4_default([$2], :)],
  864. [m4_default([$3], :)])
  865. AS_VAR_POPDEF([CACHEVAR])dnl
  866. ])dnl AX_CHECK_COMPILE_FLAGS
  867. 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
  868. AX_CHECK_COMPILE_FLAG([-Wimplicit-int-conversion], [AM_CFLAGS="$AM_CFLAGS -Wimplicit-int-conversion"], , [-Werror])
  869. AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [AM_CFLAGS="$AM_CFLAGS -Wnull-dereference"], , [-Werror])
  870. AC_ARG_ENABLE([werror],
  871. [AS_HELP_STRING([--enable-werror],
  872. [Treat warnings as errors @<:@default=no@:>@])],
  873. [],
  874. [enable_werror=no])
  875. if test "x$enable_werror" = xyes; then
  876. AM_CFLAGS="$AM_CFLAGS -Werror"
  877. fi
  878. AC_ARG_ENABLE([debug],
  879. [AS_HELP_STRING([--enable-debug],
  880. [Enable compiling with maximum debug info, asserts and internal sanity checks @<:@default=no@:>@])],
  881. [],
  882. [enable_debug=no])
  883. if test "x$enable_debug" != xyes; then
  884. AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"
  885. AC_COMPILE_IFELSE([
  886. AC_LANG_SOURCE([[
  887. #ifdef __SUPPORT_SNAN__
  888. #error "signaling NaN support not recommended"
  889. #endif
  890. ]])],
  891. :,
  892. [warning_msg="signaling NaN support is enabled; not recommended for htop"
  893. case "$CC" in
  894. *gcc*)
  895. warning_msg="$warning_msg (use '-fno-signaling-nans' compiler flag to disable)"
  896. ;;
  897. esac
  898. AC_MSG_WARN([$warning_msg])
  899. ])
  900. else
  901. AM_CPPFLAGS="$AM_CPPFLAGS -ggdb3"
  902. fi
  903. AC_SUBST([AM_CFLAGS])
  904. AC_SUBST([AM_CPPFLAGS])
  905. # ----------------------------------------------------------------------
  906. # ----------------------------------------------------------------------
  907. # We're done, let's go!
  908. # ----------------------------------------------------------------------
  909. AC_DEFINE_UNQUOTED([COPYRIGHT], ["(C) 2004-2019 Hisham Muhammad. (C) 2020-2024 htop dev team."], [Copyright message.])
  910. AM_CONDITIONAL([HTOP_LINUX], [test "$my_htop_platform" = linux])
  911. AM_CONDITIONAL([HTOP_FREEBSD], [test "$my_htop_platform" = freebsd])
  912. AM_CONDITIONAL([HTOP_DRAGONFLYBSD], [test "$my_htop_platform" = dragonflybsd])
  913. AM_CONDITIONAL([HTOP_NETBSD], [test "$my_htop_platform" = netbsd])
  914. AM_CONDITIONAL([HTOP_OPENBSD], [test "$my_htop_platform" = openbsd])
  915. AM_CONDITIONAL([HTOP_DARWIN], [test "$my_htop_platform" = darwin])
  916. AM_CONDITIONAL([HTOP_SOLARIS], [test "$my_htop_platform" = solaris])
  917. AM_CONDITIONAL([HTOP_PCP], [test "$my_htop_platform" = pcp])
  918. AM_CONDITIONAL([HTOP_UNSUPPORTED], [test "$my_htop_platform" = unsupported])
  919. AC_SUBST(my_htop_platform)
  920. AC_CONFIG_FILES([Makefile htop.1])
  921. AC_OUTPUT
  922. if test "$my_htop_platform" = unsupported; then
  923. echo ""
  924. echo "****************************************************************"
  925. echo "WARNING! This platform is not currently supported by htop."
  926. echo ""
  927. echo "The code will build, but it will produce a dummy version of htop"
  928. echo "which shows no processes, using the files from the unsupported/"
  929. echo "directory. This is meant to be a skeleton, to be used as a"
  930. echo "starting point if you are porting htop to a new platform."
  931. echo "****************************************************************"
  932. echo ""
  933. fi
  934. AC_MSG_RESULT([
  935. ${PACKAGE_NAME} ${VERSION}
  936. platform: $my_htop_platform
  937. os-release file: $with_os_release
  938. (Linux) proc directory: $with_proc
  939. (Linux) openvz: $enable_openvz
  940. (Linux) vserver: $enable_vserver
  941. (Linux) ancient vserver: $enable_ancient_vserver
  942. (Linux) delay accounting: $enable_delayacct
  943. (Linux) sensors: $enable_sensors
  944. (Linux) capabilities: $enable_capabilities
  945. unicode: $enable_unicode
  946. affinity: $enable_affinity
  947. unwind: $enable_unwind
  948. hwloc: $enable_hwloc
  949. debug: $enable_debug
  950. static: $enable_static
  951. ])