aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /configure.ac
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac189
1 files changed, 119 insertions, 70 deletions
diff --git a/configure.ac b/configure.ac
index 30834f2..f624664 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,12 +2,11 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.65)
-AC_INIT([htop],[3.0.2],[htop@groups.io])
+AC_INIT([htop],[3.0.3],[htop@groups.io])
AC_CONFIG_SRCDIR([htop.c])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_MACRO_DIR([m4])
# Required by hwloc scripts
AC_CANONICAL_TARGET
@@ -27,24 +26,31 @@ AC_USE_SYSTEM_EXTENSIONS
case "$target_os" in
linux*|gnu*)
my_htop_platform=linux
+ AC_DEFINE([HTOP_LINUX], [], [Building for Linux])
;;
freebsd*|kfreebsd*)
my_htop_platform=freebsd
+ AC_DEFINE([HTOP_FREEBSD], [], [Building for FreeBSD])
;;
openbsd*)
my_htop_platform=openbsd
+ AC_DEFINE([HTOP_OPENBSD], [], [Building for OpenBSD])
;;
dragonfly*)
my_htop_platform=dragonflybsd
+ AC_DEFINE([HTOP_DRAGONFLYBSD], [], [Building for DragonFlyBSD])
;;
darwin*)
my_htop_platform=darwin
+ AC_DEFINE([HTOP_DARWIN], [], [Building for Darwin])
;;
solaris*)
my_htop_platform=solaris
+ AC_DEFINE([HTOP_SOLARIS], [], [Building for Solaris])
;;
*)
my_htop_platform=unsupported
+ AC_DEFINE([HTOP_UNSUPPORTED], [], [Building for an unsupported platform])
;;
esac
@@ -77,35 +83,38 @@ AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_UID_T
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
# Checks for library functions and compiler features.
# ----------------------------------------------------------------------
AC_FUNC_CLOSEDIR_VOID
-AC_TYPE_SIGNAL
AC_FUNC_STAT
-AC_CHECK_FUNCS([memmove strncasecmp strstr strdup])
+AC_CHECK_FUNCS([\
+ faccessat\
+ fstatat\
+ openat\
+ readlinkat\
+])
+
+AC_SEARCH_LIBS([dlopen], [dl dld])
save_cflags="${CFLAGS}"
CFLAGS="${CFLAGS} -std=c99"
-AC_MSG_CHECKING([whether gcc -std=c99 option works])
+AC_MSG_CHECKING([whether cc -std=c99 option works])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[AC_INCLUDES_DEFAULT], [[char *a; a = strdup("foo"); int i = 0; i++; // C99]])],
[AC_MSG_RESULT([yes])],
- [AC_MSG_ERROR([htop is written in C99. A newer version of gcc is required.])])
+ [AC_MSG_ERROR([htop is written in C99. A newer compiler is required.])])
CFLAGS="$save_cflags"
-save_cflags="${CFLAGS}"
-CFLAGS="$CFLAGS -Wextra"
-AC_MSG_CHECKING([if compiler supports -Wextra])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],[
- wextra_flag=-Wextra
- AC_MSG_RESULT([yes])
-],[
- wextra_flag=
- AC_MSG_RESULT([no])
-])
-CFLAGS="$save_cflags"
-AC_SUBST(wextra_flag)
+# Add -lexecinfo if needed
+AC_SEARCH_LIBS([backtrace], [execinfo])
+
+# Add -ldevstat if needed
+AC_SEARCH_LIBS([devstat_checkversion], [devstat])
# Checks for features and flags.
# ----------------------------------------------------------------------
@@ -118,23 +127,11 @@ AC_ARG_WITH(proc, [AS_HELP_STRING([--with-proc=DIR], [Location of a Linux-compat
fi,
AC_DEFINE(PROCDIR, "/proc", [Path of proc filesystem]))
-if test "x$cross_compiling" = xno; then
- if test "x$enable_proc" = xyes; then
- AC_CHECK_FILE($PROCDIR/stat,,AC_MSG_ERROR(Cannot find $PROCDIR/stat. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.))
- AC_CHECK_FILE($PROCDIR/meminfo,,AC_MSG_ERROR(Cannot find $PROCDIR/meminfo. Make sure you have a Linux-compatible /proc filesystem mounted. See the file README for help.))
- fi
-fi
-
AC_ARG_ENABLE(openvz, [AS_HELP_STRING([--enable-openvz], [enable OpenVZ support])], ,enable_openvz="no")
if test "x$enable_openvz" = xyes; then
AC_DEFINE(HAVE_OPENVZ, 1, [Define if openvz support enabled.])
fi
-AC_ARG_ENABLE(cgroup, [AS_HELP_STRING([--enable-cgroup], [enable cgroups support])], ,enable_cgroup="no")
-if test "x$enable_cgroup" = xyes; then
- AC_DEFINE(HAVE_CGROUP, 1, [Define if cgroup support enabled.])
-fi
-
AC_ARG_ENABLE(vserver, [AS_HELP_STRING([--enable-vserver], [enable VServer support])], ,enable_vserver="no")
if test "x$enable_vserver" = xyes; then
AC_DEFINE(HAVE_VSERVER, 1, [Define if vserver support enabled.])
@@ -146,11 +143,6 @@ if test "x$enable_ancient_vserver" = xyes; then
AC_DEFINE(HAVE_ANCIENT_VSERVER, 1, [Define if ancient vserver support enabled.])
fi
-AC_ARG_ENABLE(taskstats, [AS_HELP_STRING([--enable-taskstats], [enable per-task IO Stats (taskstats kernel sup required)])], ,enable_taskstats="yes")
-if test "x$enable_taskstats" = xyes; then
- AC_DEFINE(HAVE_TASKSTATS, 1, [Define if taskstats support enabled.])
-fi
-
# HTOP_CHECK_SCRIPT(LIBNAME, FUNCTION, DEFINE, CONFIG_SCRIPT, ELSE_PART)
m4_define([HTOP_CHECK_SCRIPT],
[
@@ -191,6 +183,23 @@ m4_define([HTOP_CHECK_LIB],
], [$4])
])
+dnl https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+ AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+ [AS_VAR_SET(CACHEVAR,[yes])],
+ [AS_VAR_SET(CACHEVAR,[no])])
+ _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+ [m4_default([$2], :)],
+ [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS
+
AC_ARG_ENABLE(unicode, [AS_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="yes")
if test "x$enable_unicode" = xyes; then
HTOP_CHECK_SCRIPT([ncursesw6], [addnwstr], [HAVE_LIBNCURSESW], "ncursesw6-config",
@@ -236,32 +245,43 @@ if test "$my_htop_platform" = "solaris"; then
AC_CHECK_LIB([malloc], [free], [], [missing_libraries="$missing_libraries libmalloc"])
fi
-AC_ARG_ENABLE(linux_affinity, [AS_HELP_STRING([--enable-linux-affinity], [enable Linux sched_setaffinity and sched_getaffinity for affinity support, disables hwloc])], ,enable_linux_affinity="yes")
-if test "x$enable_linux_affinity" = xyes -a "x$cross_compiling" = xno; then
- AC_MSG_CHECKING([for usable sched_setaffinity])
- AC_RUN_IFELSE([
- AC_LANG_PROGRAM([[
- #include <sched.h>
- #include <errno.h>
- static cpu_set_t cpuset;
- ]], [[
- CPU_ZERO(&cpuset);
- sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
- if (errno == ENOSYS) return 1;
- ]])],
- [AC_MSG_RESULT([yes])],
- [enable_linux_affinity=no
- AC_MSG_RESULT([no])])
+AC_ARG_ENABLE(hwloc, [AS_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity, disables Linux affinity])],, enable_hwloc="no")
+if test "x$enable_hwloc" = xyes
+then
+ AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [missing_libraries="$missing_libraries libhwloc"])
+ AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"])
+fi
+
+AC_ARG_ENABLE(linux_affinity, [AS_HELP_STRING([--enable-linux-affinity], [enable Linux sched_setaffinity and sched_getaffinity for affinity support, conflicts with hwloc])], ,enable_linux_affinity="check")
+if test "x$enable_linux_affinity" = xcheck; then
+ if test "x$enable_hwloc" = xyes; then
+ enable_linux_affinity=no
+ else
+ AC_MSG_CHECKING([for usable sched_setaffinity])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[
+ #include <sched.h>
+ #include <errno.h>
+ static cpu_set_t cpuset;
+ ]], [[
+ CPU_ZERO(&cpuset);
+ sched_setaffinity(0, sizeof(cpu_set_t), &cpuset);
+ if (errno == ENOSYS) return 1;
+ ]])],
+ [enable_linux_affinity=yes
+ AC_MSG_RESULT([yes])],
+ [enable_linux_affinity=no
+ AC_MSG_RESULT([no])],
+ [AC_MSG_RESULT([yes (assumed while cross compiling)])])
+ fi
fi
if test "x$enable_linux_affinity" = xyes; then
AC_DEFINE(HAVE_LINUX_AFFINITY, 1, [Define if Linux sched_setaffinity and sched_getaffinity are to be used.])
fi
-AC_ARG_ENABLE(hwloc, [AS_HELP_STRING([--enable-hwloc], [enable hwloc support for CPU affinity])],, enable_hwloc="no")
-if test "x$enable_hwloc" = xyes
+if test "x$enable_linux_affinity" = xyes -a "x$enable_hwloc" = xyes
then
- AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [missing_libraries="$missing_libraries libhwloc"])
- AC_CHECK_HEADERS([hwloc.h],[:], [missing_headers="$missing_headers $ac_header"])
+ AC_MSG_ERROR([--enable-hwloc and --enable-linux-affinity are mutual exclusive. Specify at most one of them.])
fi
AC_ARG_ENABLE(setuid, [AS_HELP_STRING([--enable-setuid], [enable setuid support for platforms that need it])],, enable_setuid="no")
@@ -287,12 +307,41 @@ then
])
fi
+AC_ARG_WITH(sensors, [AS_HELP_STRING([--with-sensors], [Compile with libsensors support for reading temperature data. Only requires libsensors headers at compile time, at runtime libsensors is loaded via dlopen.])],, with_sensors="check")
+if test "x$with_sensors" = xyes; then
+ AC_CHECK_HEADERS([sensors/sensors.h], [], [missing_headers="$missing_headers $ac_header"])
+elif test "x$with_sensors" = xcheck; then
+ with_sensors=yes
+ AC_CHECK_HEADERS([sensors/sensors.h], [], [with_sensors=no])
+fi
+
+AM_CFLAGS="\
+ -Wall\
+ -Wcast-align\
+ -Wcast-qual\
+ -Wextra\
+ -Wfloat-equal\
+ -Wmissing-format-attribute\
+ -Wmissing-noreturn\
+ -Wmissing-prototypes\
+ -Wpointer-arith\
+ -Wshadow\
+ -Wstrict-prototypes\
+ -Wundef\
+ -Wunused\
+ -Wwrite-strings"
+
+AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [AM_CFLAGS="$AM_CFLAGS -Wnull-dereference"], , [-Werror])
+
AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors (default: warnings are not errors)])], [enable_werror="$enableval"], [enable_werror=no])
AS_IF([test "x$enable_werror" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -Werror"])
+
AC_SUBST([AM_CFLAGS])
-AC_CHECK_PROGS(PYTHON, [python python3 python2])
-AC_SUBST(PYTHON)
+AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Enable asserts (default: asserts are disabled)])], [enable_debug="$enableval"], [enable_debug=no])
+AS_IF([test "x$enable_debug" = "xyes"], , [AM_CPPFLAGS="$AM_CPPFLAGS -DNDEBUG"])
+
+AC_SUBST([AM_CPPFLAGS])
# Bail out on errors.
# ----------------------------------------------------------------------
@@ -303,7 +352,7 @@ if test ! -z "$missing_headers"; then
AC_MSG_ERROR([missing headers: $missing_headers])
fi
-AC_DEFINE_UNQUOTED(COPYRIGHT, "(C) 2004-2018 Hisham Muhammad", [Copyright message.])
+AC_DEFINE_UNQUOTED(COPYRIGHT, "(C) 2004-2019 Hisham Muhammad. (C) 2020 htop dev team.", [Copyright message.])
# We're done, let's go!
# ----------------------------------------------------------------------
@@ -335,16 +384,16 @@ fi
AC_MSG_RESULT([
${PACKAGE_NAME} ${VERSION}
- platform: $my_htop_platform
- proc directory: $PROCDIR
- openvz: $enable_openvz
- cgroup: $enable_cgroup
- vserver: $enable_vserver
- ancient vserver: $enable_ancient_vserver
- taskstats: $enable_taskstats
- unicode: $enable_unicode
- linux affinity: $enable_linux_affinity
- hwlock: $enable_hwloc
- setuid: $enable_setuid
- linux delay accounting: $enable_delayacct
+ platform: $my_htop_platform
+ (Linux) proc directory: $PROCDIR
+ (Linux) openvz: $enable_openvz
+ (Linux) vserver: $enable_vserver
+ (Linux) ancient vserver: $enable_ancient_vserver
+ (Linux) affinity: $enable_linux_affinity
+ (Linux) delay accounting: $enable_delayacct
+ (Linux) sensors: $with_sensors
+ unicode: $enable_unicode
+ hwloc: $enable_hwloc
+ setuid: $enable_setuid
+ debug: $enable_debug
])

© 2014-2024 Faster IT GmbH | imprint | privacy policy