Commit graph

10 commits

Author SHA1 Message Date
Thomas Haller bf86f51c9e
build: rework libreadline detection in autotools
- `m4/ax_lib_readline.m4` was already aware of "$with_readline".
  Move the entire handling of the parameter inside the AX_LIB_READLINE
  macro.
  This lets our fork of ax_lib_readline.m4 further deviate from upstream
  version, but it's already so different that this is no new problem.

- raise an error if the user requested --with-readline=libreadline|libedit
  but the library was not found.

- only allow yes|no for --with-nmcli argument. But still default to
  "yes", which will always require one libreadline library to be
  detected. In particular, don't automatically disable nmcli if
  libreadline is not available, because building without nmcli
  should be an explicit choice. That is like before.

- update the "$with_readline" variable for the "auto" case to reflect
  what was detected.
2021-07-19 09:08:06 +02:00
Lukasz Majewski 8ea9da85b3
m4: cli: Add support for --with-readline=auto|libreadline|libedit|none configuration options
This commit provides support for --with-readline=auto|libreadline|libedit|none option
for the configure script.

It allows building the NetworkManager's nmcli tool with libedit instead
of libreadline.

With --with-readline=auto the system looks for any eligible readline library
to use.

Moreover, in this commit all required defines are provided (e.g.
HAVE_EDITLINE_READLINE) to allow correct buil of the code.
2021-07-14 17:16:45 +02:00
Lukasz Majewski 0c5adc6938
m4: Check for history_set_history_state instead of add_history
The add_history function is available on both - libreadline and libedit.

The read difference between those two libraries is that for libedit the
history_set_history_state is missing.
On that basis one can assess if we do have history from libreadline or
from libedit.
2021-07-14 17:16:45 +02:00
Lukasz Majewski 552e00990d
m4: ax_lib_readline.m4: Use readline libraries when linking add_history test program
Up till now the AC_LANG_CALL() was just checking if program which
uses the add_history call can be correctly linked without passing
required libraries (e.g. -libreadline to LIBS variable).

This commit fixes this issue as now the add_history can be found as it
is now available in any of passed libs.
2021-07-14 17:16:45 +02:00
Beniamino Galvani b9929b647b m4: fix readline macro
The macro always overwrites LIBS and the result is that every binary
links against libreadline.

Instead, save the library to READLINE_LIBS.

See also: 94274c6fcd ('build: fix wrongly linking against libreadline in all applications')

Fixes: af360238be ('m4/ax_lib_readline.m4: Update after running aclocal')
2021-04-27 10:33:59 +02:00
Javier Jardón af360238be
m4/ax_lib_readline.m4: Update after running aclocal
See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/796
See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/807
2021-04-07 09:17:17 +02:00
Dan Williams 21fef6a357 build: correct help message about missing readline + termcap libraries 2015-05-11 10:33:21 -05:00
Thomas Haller 94274c6fcd build: fix wrongly linking against libreadline in all applications
Every Makefile in the subtrees would include -lreadline
as part of LIBS, hence every application would link against
the library.

This was broken since we added 'm4/ax_lib_readline.m4'.

Fixes: 29297f8531
2014-11-26 11:43:23 +01:00
Dan Williams b69143b508 build: ensure rl_echo_signal_char() exists in the readline library 2014-10-14 14:30:44 -05:00
Dan Williams 29297f8531 build: check harder for readline
Not all distros build their readline linked with a termcap library,
since apps are (apparently) supposed to choose one for themselves
and explicitly link to it when using readline.  So add some checks
to figure out whether readline is already linked, and if not, prefer
ncurses since we use that for nmtui already.

ax_lib_readline based off:

http://www.gnu.org/software/autoconf-archive/ax_lib_readline.html
2014-06-27 13:10:50 -05:00