Skip to content

Commit

Permalink
build: Use gnulib module to get readline libraries.
Browse files Browse the repository at this point in the history
* bootstrap.conf: Import readline module.
* configure.ac: Remove separate checks for terminal library. Use readline linker
flags as set by gnulib module.
* m4/acinclude.m4 (OCTAVE_CHECK_LIB_TERMLIB): Remove function that is no longer
needed.
(OCTAVE_ENABLE_READLINE): Replace custom check by calling gnulib function. No
longer check if version is at least 4.2. (It was released 20+ years ago.)
* build-aux/subst-config-vals.in.h, build-aux/subst-cross-config-vals.in.h:
Substitute READLINE_LIBS with result from gnulib function. Remove TERM_LIBS.
* libinterp/build-env.h, libinterp/build-env.in.cc, libinterp/corefcn/toplev.cc:
Remove TERM_LIBS.

See also: https://octave.discourse.group/t/3559
  • Loading branch information
mmuetzel committed Nov 10, 2022
1 parent cfac99a commit 3645c78
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 59 deletions.
1 change: 1 addition & 0 deletions bootstrap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ gnulib_modules="
putenv
raise
readdir
readline
rewinddir
rmdir
select
Expand Down
4 changes: 1 addition & 3 deletions build-aux/subst-config-vals.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ QT_LIBS="@QT_LIBS@"
QT_OPENGL_LIBS="@QT_OPENGL_LIBS@"
RANLIB="@RANLIB@"
RDYNAMIC_FLAG="@RDYNAMIC_FLAG@"
READLINE_LIBS="@READLINE_LIBS@"
READLINE_LIBS="@LIBREADLINE@"
SHARED_LIBS="@SHARED_LIBS@"
SH_LDFLAGS="@SH_LDFLAGS@"
STATIC_LIBS="@STATIC_LIBS@"
Expand All @@ -227,7 +227,6 @@ SUNDIALS_NVECSERIAL_LIBS="@SUNDIALS_NVECSERIAL_LIBS@"
SUNDIALS_SUNLINSOLKLU_CPPFLAGS="@SUNDIALS_SUNLINSOLKLU_CPPFLAGS@"
SUNDIALS_SUNLINSOLKLU_LDFLAGS="@SUNDIALS_SUNLINSOLKLU_LDFLAGS@"
SUNDIALS_SUNLINSOLKLU_LIBS="@SUNDIALS_SUNLINSOLKLU_LIBS@"
TERM_LIBS="@TERM_LIBS@"
UMFPACK_CPPFLAGS="@UMFPACK_CPPFLAGS@"
UMFPACK_LDFLAGS="@UMFPACK_LDFLAGS@"
UMFPACK_LIBS="@UMFPACK_LIBS@"
Expand Down Expand Up @@ -391,7 +390,6 @@ $SED \
-e "s|%OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_CPPFLAGS%|\"${SUNDIALS_SUNLINSOLKLU_CPPFLAGS}\"|" \
-e "s|%OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_LDFLAGS%|\"${SUNDIALS_SUNLINSOLKLU_LDFLAGS}\"|" \
-e "s|%OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_LIBS%|\"${SUNDIALS_SUNLINSOLKLU_LIBS}\"|" \
-e "s|%OCTAVE_CONF_TERM_LIBS%|\"${TERM_LIBS}\"|" \
-e "s|%OCTAVE_CONF_UMFPACK_CPPFLAGS%|\"${UMFPACK_CPPFLAGS}\"|" \
-e "s|%OCTAVE_CONF_UMFPACK_LDFLAGS%|\"${UMFPACK_LDFLAGS}\"|" \
-e "s|%OCTAVE_CONF_UMFPACK_LIBS%|\"${UMFPACK_LIBS}\"|" \
Expand Down
4 changes: 1 addition & 3 deletions build-aux/subst-cross-config-vals.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ QT_LIBS="@QT_LIBS@"
QT_OPENGL_LIBS="@QT_OPENGL_LIBS@"
RANLIB="@RANLIB@"
RDYNAMIC_FLAG="@RDYNAMIC_FLAG@"
READLINE_LIBS="@READLINE_LIBS@"
READLINE_LIBS="@LIBREADLINE@"
SHARED_LIBS="@SHARED_LIBS@"
SH_LDFLAGS="@SH_LDFLAGS@"
STATIC_LIBS="@STATIC_LIBS@"
Expand All @@ -231,7 +231,6 @@ SUNDIALS_NVECSERIAL_LIBS="@SUNDIALS_NVECSERIAL_LIBS@"
SUNDIALS_SUNLINSOLKLU_CPPFLAGS="@SUNDIALS_SUNLINSOLKLU_CPPFLAGS@"
SUNDIALS_SUNLINSOLKLU_LDFLAGS="@SUNDIALS_SUNLINSOLKLU_LDFLAGS@"
SUNDIALS_SUNLINSOLKLU_LIBS="@SUNDIALS_SUNLINSOLKLU_LIBS@"
TERM_LIBS="@TERM_LIBS@"
UMFPACK_CPPFLAGS="@UMFPACK_CPPFLAGS@"
UMFPACK_LDFLAGS="@UMFPACK_LDFLAGS@"
UMFPACK_LIBS="@UMFPACK_LIBS@"
Expand Down Expand Up @@ -395,7 +394,6 @@ $SED \
-e "s|%OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_CPPFLAGS%|\"${SUNDIALS_SUNLINSOLKLU_CPPFLAGS}\"|" \
-e "s|%OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_LDFLAGS%|\"${SUNDIALS_SUNLINSOLKLU_LDFLAGS}\"|" \
-e "s|%OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_LIBS%|\"${SUNDIALS_SUNLINSOLKLU_LIBS}\"|" \
-e "s|%OCTAVE_CONF_TERM_LIBS%|\"${TERM_LIBS}\"|" \
-e "s|%OCTAVE_CONF_UMFPACK_CPPFLAGS%|\"${UMFPACK_CPPFLAGS}\"|" \
-e "s|%OCTAVE_CONF_UMFPACK_LDFLAGS%|\"${UMFPACK_LDFLAGS}\"|" \
-e "s|%OCTAVE_CONF_UMFPACK_LIBS%|\"${UMFPACK_LIBS}\"|" \
Expand Down
8 changes: 2 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1460,9 +1460,6 @@ fi

OCTAVE_ENABLE_READLINE

## Find a termlib to use.
OCTAVE_CHECK_LIB_TERMLIB

### Check for ZLIB library.

OCTAVE_CHECK_LIB(z, ZLIB,
Expand Down Expand Up @@ -2943,7 +2940,7 @@ AC_SUBST(GNULIB_LINK_DEPS)

### Set variables for link dependencies and options.

BASE_LIBOCTAVE_LINK_DEPS="$CURL_LIBS $SPARSE_XLIBS $ARPACK_LIBS $QRUPDATE_LIBS $FFTW_XLIBS $LAPACK_LIBS $BLAS_LIBS $READLINE_LIBS $TERM_LIBS $LIBGLOB $PCRE_LIBS $DL_LIBS $PTHREAD_LIBS $FLIBS $LIBS"
BASE_LIBOCTAVE_LINK_DEPS="$CURL_LIBS $SPARSE_XLIBS $ARPACK_LIBS $QRUPDATE_LIBS $FFTW_XLIBS $LAPACK_LIBS $BLAS_LIBS $LTLIBREADLINE $LIBGLOB $PCRE_LIBS $DL_LIBS $PTHREAD_LIBS $FLIBS $LIBS"

LIBOCTAVE_LINK_DEPS="$BASE_LIBOCTAVE_LINK_DEPS $GNULIB_LINK_DEPS"

Expand Down Expand Up @@ -3265,7 +3262,7 @@ Octave is now configured for $canonical_host_type
Qt lrelease: $LRELEASE $LRELEASEFLAGS
Qt qcollectiongenerator: $QCOLLECTIONGENERATOR $QCOLLECTIONGENERATORFLAGS
Qt qhelpgenerator: $QHELPGENERATOR $QHELPGENERATORFLAGS
READLINE libraries: $READLINE_LIBS
READLINE libraries: $LIBREADLINE
Sndfile CPPFLAGS: $SNDFILE_CPPFLAGS
Sndfile LDFLAGS: $SNDFILE_LDFLAGS
Sndfile libraries: $SNDFILE_LIBS
Expand All @@ -3282,7 +3279,6 @@ Octave is now configured for $canonical_host_type
SUNLINSOL KLU CPPFLAGS: $SUNDIALS_SUNLINSOLKLU_CPPFLAGS
SUNLINSOL KLU LDFLAGS: $SUNDIALS_SUNLINSOLKLU_LDFLAGS
SUNLINSOL KLU libraries: $SUNDIALS_SUNLINSOLKLU_LIBS
TERM libraries: $TERM_LIBS
UMFPACK CPPFLAGS: $UMFPACK_CPPFLAGS
UMFPACK LDFLAGS: $UMFPACK_LDFLAGS
UMFPACK libraries: $UMFPACK_LIBS
Expand Down
1 change: 0 additions & 1 deletion libinterp/build-env.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ namespace octave
extern OCTINTERP_API const char *SUNDIALS_SUNLINSOLKLU_CPPFLAGS;
extern OCTINTERP_API const char *SUNDIALS_SUNLINSOLKLU_LDFLAGS;
extern OCTINTERP_API const char *SUNDIALS_SUNLINSOLKLU_LIBS;
extern OCTINTERP_API const char *TERM_LIBS;
extern OCTINTERP_API const char *UMFPACK_CPPFLAGS;
extern OCTINTERP_API const char *UMFPACK_LDFLAGS;
extern OCTINTERP_API const char *UMFPACK_LIBS;
Expand Down
2 changes: 0 additions & 2 deletions libinterp/build-env.in.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ namespace octave

const char *SUNDIALS_SUNLINSOLKLU_LIBS = %OCTAVE_CONF_SUNDIALS_SUNLINSOLKLU_LIBS%;

const char *TERM_LIBS = %OCTAVE_CONF_TERM_LIBS%;

const char *UMFPACK_CPPFLAGS = %OCTAVE_CONF_UMFPACK_CPPFLAGS%;

const char *UMFPACK_LDFLAGS = %OCTAVE_CONF_UMFPACK_LDFLAGS%;
Expand Down
1 change: 0 additions & 1 deletion libinterp/corefcn/toplev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ specified option.
{ "SH_LDFLAGS", build_env::SH_LDFLAGS },
{ "STATIC_LIBS", build_env::STATIC_LIBS },
{ "SUITESPARSECONFIG_LIBS", build_env::SUITESPARSECONFIG_LIBS },
{ "TERM_LIBS", build_env::TERM_LIBS },
{ "UMFPACK_CPPFLAGS", build_env::UMFPACK_CPPFLAGS },
{ "UMFPACK_LDFLAGS", build_env::UMFPACK_LDFLAGS },
{ "UMFPACK_LIBS", build_env::UMFPACK_LIBS },
Expand Down
48 changes: 5 additions & 43 deletions m4/acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1598,37 +1598,6 @@ AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [
fi
])
dnl
dnl Find a suitable termlib to use.
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_TERMLIB], [
TERM_LIBS=
ac_octave_save_LIBS="$LIBS"
AC_SEARCH_LIBS([tputs],
[ncurses curses termcap terminfo termlib],
[], [])
LIBS="$ac_octave_save_LIBS"
case "$ac_cv_search_tputs" in
-l*)
TERM_LIBS="$ac_cv_search_tputs"
;;
no)
warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, or -ltermlib!"
AC_MSG_WARN([$warn_termlibs])
;;
esac
dnl Old code (9/9/2012). Delete when new code is definitely proven.
dnl
dnl for _termlib in ncurses curses termcap terminfo termlib; do
dnl AC_CHECK_LIB([${_termlib}], [tputs], [
dnl TERM_LIBS="-l${termlib}"
dnl octave_cv_lib_found_termlib=yes
dnl break])
dnl done
AC_SUBST(TERM_LIBS)
])
dnl
dnl Check whether new API is used with QHelpIndexWidget.
dnl Under new API, QHelpIndexWidget emits documentActivates.
dnl Under old API, QHelpIndexWidget emits linkActivated.
Expand Down Expand Up @@ -2915,7 +2884,6 @@ dnl readline.
dnl
AC_DEFUN([OCTAVE_ENABLE_READLINE], [
USE_READLINE=yes
READLINE_LIBS=
AC_ARG_ENABLE([readline],
[AS_HELP_STRING([--disable-readline],
[do not use readline library])],
Expand All @@ -2924,20 +2892,14 @@ AC_DEFUN([OCTAVE_ENABLE_READLINE], [
warn_readline="command editing and history features require GNU Readline"
fi])
if test $USE_READLINE = yes; then
dnl RHEL 5 and older systems require termlib set before enabling readline
AC_REQUIRE([OCTAVE_CHECK_LIB_TERMLIB])
ac_octave_save_LIBS="$LIBS"
LIBS="$TERM_LIBS"
AC_CHECK_LIB([readline], [rl_set_keyboard_input_timeout],
[READLINE_LIBS="-lreadline"
gl_FUNC_READLINE
if test "$gl_cv_lib_readline" != no; then
AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.])
],
[AC_MSG_WARN([I need GNU Readline 4.2 or later])
else
AC_MSG_WARN([I need GNU Readline 4.2 or later])
AC_MSG_ERROR([this is fatal unless you specify --disable-readline])
])
LIBS="$ac_octave_save_LIBS"
fi
fi
AC_SUBST(READLINE_LIBS)
])
dnl
dnl Check if Fortran compiler handles FLAG command line option. If
Expand Down

0 comments on commit 3645c78

Please sign in to comment.