-
-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New "configure" ncurses detection code #1512
Conversation
EDIT: This is done in a separate commit. In the static build of htop (see this CI build log), Apparently the |
b77e202
to
2019d85
Compare
2019d85
to
12f8c9b
Compare
12f8c9b
to
ac08506
Compare
@explorer: Please don't use On the patch series: LGTM. Maybe switch the order of the last two commits. If there's no objection from the OpenEmbedded people, I think we can go ahead with this one. |
I say "draft" in the commit because I don't think I'm done yet, and to prevent accidental pulling. Don't worry, I'll remove that tag when I think I'm ready. |
a811dcd
to
9b58ebd
Compare
The configure script is revised and ready. However I got an unexpected configure error in OpenBSD build job in CI. It seems that OpenBSD build system in CI has |
0d12439
to
ba89c02
Compare
There's also a failure for Solaris AFAICS. Any intel on that one? |
@BenBE I was testing whether htop can build on all BSD systems and Solaris with |
ba89c02
to
ce00fef
Compare
ab52bf9
to
ba0735e
Compare
ba0735e
to
cfbafb8
Compare
cfbafb8
to
544bf5a
Compare
544bf5a
to
e1a5e7d
Compare
e1a5e7d
to
ee333e0
Compare
Some minor notes on the current state of the patch: diff --git a/configure.ac b/configure.ac
index 6347859f..7c9a745b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,11 +383,13 @@ dnl PKG_PROG_PKG_CONFIG initializes $PKG_CONFIG and related variables.
dnl If the macro is not called, some pkg-config checks might be skipped
dnl and $PKG_CONFIG might be unset.
m4_ifdef([PKG_PROG_PKG_CONFIG], [
-PKG_PROG_PKG_CONFIG
+ PKG_PROG_PKG_CONFIG()
], [
-pkg_m4_absent=1
-m4_warn([syntax],
- [pkg.m4 is absent or older than version 0.16; this 'configure' would have incomplete pkg-config support])
+ pkg_m4_absent=1
+ m4_warn(
+ [syntax],
+ [pkg.m4 is absent or older than version 0.16; this 'configure' will have incomplete pkg-config support]
+ )
])
AC_ARG_ENABLE([unicode],
@@ -565,14 +567,14 @@ esac
case ${htop_curses_capability}-$enable_unicode in
none-*|nonwide-yes)
- if test "x$PKG_CONFIG" = x; then (
+ if test "x$PKG_CONFIG" = x; then
# Friendly warning to advise user to install pkg-config.
# The local variables get discarded when done.
list=""
echo "" >conftest.c
if test "$cross_compiling" != yes; then
# "-print-multi-directory" supported in GCC 3.0 or later
- name=""
+ name=""
if $CC $CPPFLAGS $CFLAGS -print-multi-directory -E conftest.c >/dev/null 2>&1; then
name=`$CC $CPPFLAGS $CFLAGS -print-multi-directory -E conftest.c 2>/dev/null |
sed '/^ *#/ d; s/^\.$//; q'`
@@ -610,7 +612,7 @@ none-*|nonwide-yes)
break
fi
done
- ) fi
+ fi
# OpenBSD and Solaris are known to not provide '*curses*.pc' files.
AC_MSG_RESULT([no curses information found through '*-config' utilities; will guess the linker flags])
@@ -796,7 +798,7 @@ AC_DEFINE_UNQUOTED([OSRELEASEFILE], ["$with_os_release"], [File with OS release
AC_ARG_WITH([config],
[AS_HELP_STRING([--with-config=DIR],
- [configuration path @<:@default=/.config@:>@])],
+ [configuration path @<:@default=/.config@:>@])],
[],
[with_config="/.config"])
dnl Performance Co-Pilot configuration location to prevent overwrite
diff --git a/netbsd/README.md b/netbsd/README.md
index c319c199..30b344a1 100644
--- a/netbsd/README.md
+++ b/netbsd/README.md
@@ -13,8 +13,8 @@ NetBSD is one of the last operating systems to use and maintain its own
implementation of Curses.
htop(1) can be compiled against either ncurses or NetBSD's curses(3).
-htop(1) would use ncurses by default when it is found, as NetBSD's curses
-support in htop is limited.
+By default, htop(1) will use ncurses when it is found, as support for
+NetBSD's curses in htop is limited.
To use NetBSD's libcurses, htop(1) must be configured with `--disable-unicode`.
Starting with htop 3.4.0, a new option `--with-curses=curses` may be specified |
|
||
case ${htop_curses_capability}-$enable_unicode in | ||
none-*|nonwide-yes) | ||
if test "x$PKG_CONFIG" = x; then ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replying the suggestion from @BenBE.
The parentheses on that if
block was intentional by me. This way I can isolate the local variables used within since all this block does is printing warning messages and it can all be done in a subshell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasonable. The way that scope is introduced just looks kinda strange without any annotation.
I'm also not sure if starting a subshell just for isolation is the right choice here or if braces ({}
) might do the trick too …
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The {}
won't isolate local variables like I had originally intended.
If it was braces {}
block, then it's no different from having no braces at all.
I wonder if I can make this code more obvious by turning into a shell function.
pkg-config will be used for detecting 'curses' library in a future commit. We have been using pkg-config for detecting multiple libraries ('hwloc' and formerly 'libnl'), thus the PKG_PROG_PKG_CONFIG macro should be called early. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Commit 24b1513 removed the warning when the configure script is generated without pkg.m4. I added that warning years ago (see 103f1a4) to prevent downstream distributions from creating a tarball with an "incomplete" configure script. Add the warning back, reword the messages to tell exactly what feature would be missing (to builders), and also add FORCE_MAKE_DIST variable for builders who want to ignore the warning. :) Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This allows configure to be generated with pkg.m4 in FreeBSD build job.
ee333e0
to
3269cb1
Compare
Code style fix.
The new curses library detection code in configure script * Uses pkg-config for detecting CFLAGS and LIBS for curses library, falls back to 'ncurses*-config' if pkg-config is not available, and falls back to "-l${library}" if both fail. * Supports override of compiling flags and linking flags through CURSES_CFLAGS and CURSES_LIBS variables. * Supports '--with-curses=library' option to manually specify the curses library name. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Since "-lncurses" might require explicit "-ltinfo" flag to link (especially for static libncurses without libtool or pkg-config), "-ltinfo" needs to be checked alongside "-lncurses" and not after it. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
If we can detect the presence of '*curses*.pc' files in some pkg-config default search directories, print a warning message. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Let configure detect ncurses if possible
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
3269cb1
to
d3c337b
Compare
This PR is intended to supersede #1506
New detection code for
curses
library forconfigure
.pkg-config
andncurses*-config
will be used to find the compiler flags and linker flags forcurses
/ncurses
. Fall back to simple-l<libname>
linking if neither utilities are available.CURSES_CFLAGS
andCURSES_LIBS
may be used to override the--cflags
and-libs
value.--with-curses=<libname>
to specify thecurses
/ncurses
module name. Should be used if the default detect list is not sufficient to find the library.