Enable including 'readline' from a non standard location.

--with-readline=<location> may be given instead of --with-readline=yes
This is required when on macOS readline is installed from Homebrew.
Standard Xcode readline in macOS is not compatible with ngspice.
If --with-readline=yes is given, there is no change of behaviour
compared with previous releases.
This commit is contained in:
Holger Vogt 2021-06-23 20:23:30 +02:00
parent 76eac5aa0f
commit 1d7e54d741
2 changed files with 34 additions and 15 deletions

View File

@ -51,14 +51,14 @@ if test "$1" = "d"; then
echo
# You may add --enable-adms to the following command for adding adms generated devices
# builtin readline not compatible (Big Sur), readline via Homebrew required (in /usr/local/opt)
../configure --with-x --enable-xspice --enable-cider --with-readline=/usr/local/opt --enable-openmp CFLAGS="-m64 -O0 -g -Wall -I/opt/X11/include/freetype2" LDFLAGS="-m64 -lomp -g"
../configure --with-x --enable-xspice --enable-cider --with-readline=/usr/local/opt/readline --enable-openmp CFLAGS="-m64 -O0 -g -Wall -I/opt/X11/include/freetype2 -I/usr/local/opt/readline/include" LDFLAGS="-m64 -lomp -g -L/usr/local/opt/readline/lib"
else
cd release
if [ $? -ne 0 ]; then echo "cd release failed"; exit 1 ; fi
echo "configuring for 64 bit release"
echo
# You may add --enable-adms to the following command for adding adms generated devices
../configure --with-x --enable-xspice --enable-cider --with-readline=/usr/local/opt --enable-openmp --disable-debug CFLAGS="-m64 -O2 -I/opt/X11/include/freetype2" LDFLAGS="-m64 -lomp"
../configure --with-x --enable-xspice --enable-cider --with-readline=/usr/local/opt/readline --enable-openmp --disable-debug CFLAGS="-m64 -O2 -I/opt/X11/include/freetype2 -I/usr/local/opt/readline/include" LDFLAGS="-m64 -lomp -L/usr/local/opt/readline/lib"
fi
if [ $? -ne 0 ]; then echo "../configure failed"; exit 1 ; fi

View File

@ -1161,24 +1161,43 @@ fi
# ---- Default: disabled. ----
# ---- Hope to see in the future readline replacement. ----
if test "x$with_readline" != xyes; then
if test "x$with_readline" = x || test "x$with_readline" = xno ; then
AC_MSG_RESULT([GNU readline disabled.])
else
if test "x$with_tcl" = x || test "x$with_tcl" = xno ; then
AC_MSG_RESULT([Checking for readline:])
AC_CHECK_HEADERS([readline/readline.h readline/history.h],
[AC_DEFINE([HAVE_GNUREADLINE], [], [Define if we have GNU readline])],
[AC_MSG_ERROR([Couldn't find GNU readline headers.])])
AC_SEARCH_LIBS([tputs], [ncurses tinfo termcap],
[AC_DEFINE([HAVE_TERMCAP], [], [Define if we have ncurses/terminfo or termcap])],
[AC_MSG_ERROR([Found neither ncurses/terminfo or termcap])])
AC_CHECK_LIB([readline], [readline],
[LIBS="$LIBS -lreadline"],
[AC_MSG_ERROR([Couldn't find readline libraries.])])
if test "x$with_readline" = xyes; then
if test "x$with_tcl" = x || test "x$with_tcl" = xno ; then
AC_MSG_RESULT([Checking for readline:])
AC_CHECK_HEADERS([readline/readline.h readline/history.h],
[AC_DEFINE([HAVE_GNUREADLINE], [], [Define if we have GNU readline])],
[AC_MSG_ERROR([Couldn't find GNU readline headers.])])
AC_SEARCH_LIBS([tputs], [ncurses tinfo termcap],
[AC_DEFINE([HAVE_TERMCAP], [], [Define if we have ncurses/terminfo or termcap])],
[AC_MSG_ERROR([Found neither ncurses/terminfo or termcap])])
AC_CHECK_LIB([readline], [readline],
[LIBS="$LIBS -lreadline"],
[AC_MSG_ERROR([Couldn't find readline libraries.])])
fi
else
# Especially defined for macOS (Big Sur), with readline installed from Brew
for dir in \
$with_readline
do
if test "x$with_tcl" = x || test "x$with_tcl" = xno ; then
AC_MSG_RESULT([Checking for readline:])
AC_CHECK_HEADERS([$dir/include/readline/readline.h $dir/include/readline/history.h],
[AC_DEFINE([HAVE_GNUREADLINE], [], [Define if we have GNU readline])],
[AC_MSG_ERROR([Couldn't find GNU readline headers.])])
AC_SEARCH_LIBS([tputs], [ncurses tinfo termcap],
[AC_DEFINE([HAVE_TERMCAP], [], [Define if we have ncurses/terminfo or termcap])],
[AC_MSG_ERROR([Found neither ncurses/terminfo or termcap])])
AC_CHECK_LIB([readline], [readline],
[LIBS="$LIBS -lreadline"],
[AC_MSG_ERROR([Couldn't find readline libraries.])])
fi
done
fi
fi
# ---- Option to include BSD editline support in ngspice CLI ----
# ---- Default: disabled. ----