Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 7 additions & 51 deletions src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1531,59 +1531,15 @@ if test "x$HAVE_LIBFMT" = "xno"; then
AC_MSG_ERROR([libfmt header not found. Install with 'sudo apt-get install libfmt-dev'])
fi

# check for readline.h and friends, optional for halcmd
AC_CHECK_HEADERS(readline/readline.h, [HAVE_READLINE=yes], [HAVE_READLINE=no])
AC_CHECK_HEADERS(readline/history.h, [], [HAVE_READLINE=no])

echo "Trying readline without -ltermcap"
AC_CHECK_LIB(readline, readline, [HAVE_READLINE_NOTERMCAP=yes], [])
unset ac_cv_lib_readline_readline
echo "Trying readline with -ltermcap"
AC_CHECK_LIB(readline, readline, [HAVE_READLINE_TERMCAP=yes], [], -ltermcap)
unset ac_cv_lib_readline_readline

if test "x$HAVE_READLINE_NOTERMCAP" = "xyes"; then
echo "Readline does not require -ltermcap"
READLINE_LIBS="-lreadline"
elif test "x$HAVE_READLINE_TERMCAP" = "xyes"; then
echo "Readline requires -ltermcap"
READLINE_LIBS="-lreadline -ltermcap"
else
HAVE_READLINE=no
fi

AC_MSG_CHECKING([whether readline license is compatible with GPL-2])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <readline/readline.h>
]], [[
#if RL_VERSION_MAJOR > 5
#error Readline version 6 and up are not compatible with GPL-2
#endif
]])],[AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_WARN(
[The LinuxCNC binary you are building may not be
distributable due to a license incompatibility with LinuxCNC (some portions
GPL-2 only) and Readline version 6 and greater (GPL-3 or later).])
if $NONDISTRIBUTABLE; then
AC_MSG_WARN(
[User requested to enable non-distributable builds. Continuing.])
else
AC_MSG_ERROR(
[To configure LinuxCNC in this way, you must
invoke configure with "--enable-non-distributable=yes". Note that on
Debian-based systems, you may be able to use libeditreadline-dev or
libreadline-gplv2-dev instead of libreadline-dev.])
fi
AC_CHECK_HEADERS([editline/readline.h], [], [
AC_MSG_ERROR([libedit headers not found. Please install libedit-dev or libedit-devel.])
])

if test "x$HAVE_READLINE" = "xyes"; then
AC_DEFINE([HAVE_READLINE], [], [Define to 1 if you have the 'readline' library (-lreadline) and required headers])
else
AC_MSG_ERROR([Required library 'readline' missing.])
fi
AC_SUBST([HAVE_READLINE])
AC_CHECK_LIB([edit], [readline], [
READLINE_LIBS="-ledit"
], [
AC_MSG_ERROR([libedit library (-ledit) not found.])
])
AC_SUBST([READLINE_LIBS])

##############################################################################
Expand Down
4 changes: 2 additions & 2 deletions src/emc/sai/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include <stdarg.h>
#include <string>

#include <readline/readline.h>
#include <readline/history.h>
#include <editline/readline.h>
#include <histedit.h>
#include <glob.h>
#include <wordexp.h>
#include <rtapi_string.h>
Expand Down
4 changes: 2 additions & 2 deletions src/hal/utils/halcmd_completion.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#define HALCMD_COMPLETION_H

#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <editline/readline.h>
#include <histedit.h>

extern int comp_id;
extern void halcmd_init_readline();
Expand Down
Loading