From e7372d18a1a661d8c3dba9f51e1f17b5f94171a7 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Wed, 10 Jan 2024 11:17:08 +0100 Subject: New upstream version 3.3.0 --- configure.ac | 146 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 119 insertions(+), 27 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 7a52ab5..e4df238 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ # ---------------------------------------------------------------------- AC_PREREQ([2.69]) -AC_INIT([htop], [3.2.1], [htop@groups.io], [], [https://htop.dev/]) +AC_INIT([htop], [3.3.0], [htop@groups.io], [], [https://htop.dev/]) AC_CONFIG_SRCDIR([htop.c]) AC_CONFIG_AUX_DIR([build-aux]) @@ -60,6 +60,9 @@ esac # Enable extensions, required by hwloc scripts AC_USE_SYSTEM_EXTENSIONS +# Activate some more of the missing global defines +AC_SYS_LARGEFILE + # ---------------------------------------------------------------------- @@ -71,6 +74,7 @@ AC_PROG_CC AM_PROG_CC_C_O m4_version_prereq([2.70], [], [AC_PROG_CC_C99]) AS_IF([test "x$ac_cv_prog_cc_c99" = xno], [AC_MSG_ERROR([htop is written in C99. A newer compiler is required.])]) +AM_CFLAGS="-std=c99 -pedantic" # ---------------------------------------------------------------------- @@ -149,7 +153,7 @@ dnl been updated in Autoconf 2.69, so use a workaround: m4_version_prereq([2.70], [], [if test "x$ac_cv_header_sys_mkdev_h" != xyes; then AC_CHECK_HEADER([sys/sysmacros.h], [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], - [Define to 1 if `major', `minor', and `makedev' are declared in .])]) + [Define to 1 if 'major', 'minor', and 'makedev' are declared in .])]) fi]) # Optional Section @@ -167,7 +171,12 @@ fi # Checks for typedefs, structures, and compiler characteristics. # ---------------------------------------------------------------------- +AC_TYPE_MBSTATE_T +AC_TYPE_MODE_T +AC_TYPE_OFF_T AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T AC_TYPE_UID_T AC_TYPE_UINT8_T AC_TYPE_UINT16_T @@ -188,22 +197,73 @@ AC_COMPILE_IFELSE([ AC_MSG_RESULT(no)) CFLAGS="$old_CFLAGS" +AC_MSG_CHECKING(for access) +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Wno-error -Werror=attributes" +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE( + [ + __attribute__((access(read_only, 1, 2))) extern int foo(const char* str, unsigned len); + ],[] + )], + AC_DEFINE([HAVE_ATTR_ACCESS], 1, [The access attribute is supported.]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) +CFLAGS="$old_CFLAGS" + +AC_MSG_CHECKING(for nonnull) +old_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Wno-error -Werror=attributes" +AC_COMPILE_IFELSE([ + AC_LANG_SOURCE( + [[ + /* Attribute supported in GCC 3.3 or later */ + __attribute__((nonnull)) int my_strcmp(const char* a, const char* b); + __attribute__((nonnull(1))) long my_strtol(const char* str, char** endptr, int base); + ]] + )], + AC_DEFINE([HAVE_ATTR_NONNULL], 1, [The nonnull attribute is supported.]) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no)) +CFLAGS="$old_CFLAGS" + AC_MSG_CHECKING(for NaN support) -AC_RUN_IFELSE([ +dnl Note: AC_RUN_IFELSE does not try compiling the program at all when +dnl $cross_compiling is 'yes'. +AC_LINK_IFELSE([ AC_LANG_PROGRAM( [[ - #include +#include ]], [[ - double x = NAN; return !isnan(x); + double x = NAN; + /* Both should evaluate to false -> 0 (exit success) */ + return isgreater(x, x) || isgreaterequal(x, x); ]] )], - [AC_MSG_RESULT(yes)], - [ + [flag_finite_math_only=unknown + if test "$cross_compiling" = yes; then + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ +/* __FINITE_MATH_ONLY__ is documented in Clang. */ +#ifdef __FINITE_MATH_ONLY__ +#error "should not enable -ffinite-math-only" +#endif + ]])], + AC_MSG_RESULT([assume yes (cross compiling)]), + flag_finite_math_only=yes) + elif ./conftest$EXEEXT >&AS_MESSAGE_LOG_FD; then + flag_finite_math_only=no + AC_MSG_RESULT(yes) + else + flag_finite_math_only=yes + fi + if test "$flag_finite_math_only" = yes; then AC_MSG_RESULT(no) - AC_MSG_WARN([Compiler does not respect NaN, some functionality might break; consider using '-fno-finite-math-only']) - ], - [AC_MSG_RESULT(skipped)]) + AC_MSG_WARN([runtime behavior with NaN is not compliant - some functionality might break; consider using '-fno-finite-math-only']) + fi], + [AC_MSG_RESULT(no) + AC_MSG_ERROR([can not find required macros: NAN, isgreater() and isgreaterequal()])]) # ---------------------------------------------------------------------- @@ -212,7 +272,7 @@ AC_RUN_IFELSE([ # Checks for generic library functions. # ---------------------------------------------------------------------- -AC_CHECK_LIB([m], [ceil], [], [AC_MSG_ERROR([can not find required function ceil()])]) +AC_SEARCH_LIBS([ceil], [m], [], [AC_MSG_ERROR([can not find required function ceil()])]) if test "$my_htop_platform" = dragonflybsd; then AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])]) @@ -260,10 +320,19 @@ AC_CHECK_FUNCS([ \ memfd_create\ openat \ readlinkat \ + sched_getscheduler \ + sched_setscheduler \ + strchrnul \ ]) if test "$my_htop_platform" = darwin; then AC_CHECK_FUNCS([mach_timebase_info]) + AC_CHECK_DECLS([IOMainPort], [], [], [[#include ]]) + AC_CHECK_DECLS([IOMasterPort], [], [], [[#include ]]) +fi + +if test "$my_htop_platform" = pcp; then + AC_CHECK_FUNCS([pmLookupDescs]) fi if test "$my_htop_platform" = linux && test "x$enable_static" = xyes; then @@ -289,15 +358,15 @@ m4_define([HTOP_CHECK_SCRIPT], htop_config_script_cflags=$([$4] --cflags 2> /dev/null) fi htop_script_success=no - htop_save_CFLAGS="$CFLAGS" + htop_save_CFLAGS="$AM_CFLAGS" if test ! "x$htop_config_script_libs" = x; then - CFLAGS="$htop_config_script_cflags $CFLAGS" + AM_CFLAGS="$AM_CFLAGS $htop_config_script_cflags" AC_CHECK_LIB([$1], [$2], [ AC_DEFINE([$3], 1, [The library is present.]) LIBS="$htop_config_script_libs $LIBS " htop_script_success=yes ], [ - CFLAGS="$htop_save_CFLAGS" + AM_CFLAGS="$htop_save_CFLAGS" ], [ $htop_config_script_libs ]) @@ -338,6 +407,11 @@ if test "x$enable_unicode" = xyes; then [AC_CHECK_HEADERS([ncurses.h], [], [AC_MSG_ERROR([can not find required ncurses header file])])])])]) + AC_CHECK_HEADERS([ncursesw/term.h], [], + [AC_CHECK_HEADERS([ncurses/term.h], [], + [AC_CHECK_HEADERS([term.h], [], + [AC_MSG_ERROR([can not find required term header file])])])]) + # check if additional linker flags are needed for keypad(3) # (at this point we already link against a working ncurses library with wide character support) AC_SEARCH_LIBS([keypad], [tinfow tinfo]) @@ -353,13 +427,18 @@ else AC_CHECK_HEADERS([curses.h], [], [AC_CHECK_HEADERS([ncurses/curses.h], [], [AC_CHECK_HEADERS([ncurses/ncurses.h], [], - [AC_CHECK_HEADERS([ncurses.h] ,[], + [AC_CHECK_HEADERS([ncurses.h], [], [AC_MSG_ERROR([can not find required ncurses header file])])])])]) + AC_CHECK_HEADERS([ncurses/term.h], [], + [AC_CHECK_HEADERS([term.h], [], + [AC_MSG_ERROR([can not find required term header file])])]) + # check if additional linker flags are needed for keypad(3) # (at this point we already link against a working ncurses library) AC_SEARCH_LIBS([keypad], [tinfo]) fi + if test "$enable_static" = yes; then AC_SEARCH_LIBS([Gpm_GetEvent], [gpm]) fi @@ -396,7 +475,7 @@ if test "x$enable_affinity" = xcheck; then AC_MSG_RESULT([yes])], [enable_affinity=no AC_MSG_RESULT([no])], - [AC_MSG_RESULT([yes (assumed while cross compiling)])]) + [AC_MSG_RESULT([assume yes (cross compiling)])]) fi fi if test "x$enable_affinity" = xyes; then @@ -433,7 +512,7 @@ case "$enable_unwind" in yes) AC_CHECK_LIB([unwind], [backtrace], [], [AC_MSG_ERROR([can not find required library libunwind])]) AC_CHECK_HEADERS([libunwind.h], [], [ - CFLAGS="$CFLAGS -I/usr/include/libunwind" + AM_CFLAGS="$AM_CFLAGS -I/usr/include/libunwind" AC_CHECK_HEADERS([libunwind/libunwind.h], [], [AC_MSG_ERROR([can not find required header file libunwind.h])]) ]) ;; @@ -459,7 +538,9 @@ case "$enable_hwloc" in m4_ifdef([PKG_PROG_PKG_CONFIG], [ PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES(HWLOC, hwloc, [ - CFLAGS="$CFLAGS $HWLOC_CFLAGS" LIBS="$LIBS $HWLOC_LIBS" + AM_CFLAGS="$AM_CFLAGS $HWLOC_CFLAGS" + LIBS="$LIBS $HWLOC_LIBS" + AC_DEFINE([HAVE_LIBHWLOC], [1], [Define to 1 if you have the 'hwloc' library (-lhwloc).]) ], [ AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])]) AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])]) @@ -582,7 +663,7 @@ case "$enable_delayacct" in PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [enable_delayacct=no]) PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [enable_delayacct=no]) if test "$enable_delayacct" = yes; then - CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" + AM_CFLAGS="$AM_CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS" AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.]) fi @@ -597,7 +678,7 @@ case "$enable_delayacct" in PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [AC_MSG_ERROR([can not find required library libnl3])]) PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [AC_MSG_ERROR([can not find required library libnl3genl])]) - CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" + AM_CFLAGS="$AM_CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS" LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS" AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.]) ], [ @@ -648,7 +729,7 @@ fi # Checks for compiler warnings. # ---------------------------------------------------------------------- -AM_CFLAGS="\ +AM_CFLAGS="$AM_CFLAGS\ -Wall\ -Wcast-align\ -Wcast-qual\ @@ -666,11 +747,6 @@ AM_CFLAGS="\ -Wunused\ -Wwrite-strings" -# FreeBSD uses C11 _Generic in its isnan implementation, even with -std=c99 -if test "$my_htop_platform" = freebsd; then - AM_CFLAGS="$AM_CFLAGS -Wno-c11-extensions" -fi - dnl https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html AC_DEFUN([AX_CHECK_COMPILE_FLAG], [ @@ -708,6 +784,22 @@ AC_ARG_ENABLE([debug], [enable_debug=no]) if test "x$enable_debug" != xyes; then AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG" + + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ +#ifdef __SUPPORT_SNAN__ +#error "signaling NaN support not recommended" +#endif + ]])], + :, + [warning_msg="signaling NaN support is enabled; not recommended for htop" + case "$CC" in + *gcc*) + warning_msg="$warning_msg (use '-fno-signaling-nans' compiler flag to disable)" + ;; + esac + AC_MSG_WARN([$warning_msg]) + ]) else AM_CPPFLAGS="$AM_CPPFLAGS -ggdb3" fi @@ -723,7 +815,7 @@ AC_SUBST([AM_CPPFLAGS]) # We're done, let's go! # ---------------------------------------------------------------------- -AC_DEFINE_UNQUOTED([COPYRIGHT], ["(C) 2004-2019 Hisham Muhammad. (C) 2020-2022 htop dev team."], [Copyright message.]) +AC_DEFINE_UNQUOTED([COPYRIGHT], ["(C) 2004-2019 Hisham Muhammad. (C) 2020-2024 htop dev team."], [Copyright message.]) AM_CONDITIONAL([HTOP_LINUX], [test "$my_htop_platform" = linux]) AM_CONDITIONAL([HTOP_FREEBSD], [test "$my_htop_platform" = freebsd]) -- cgit v1.2.3