Don't check for readline, if shared lib or Windows GUI is selected

This commit is contained in:
Holger Vogt 2024-07-10 17:21:38 +02:00
parent cf9b889bb2
commit 6b3c085037
1 changed files with 57 additions and 52 deletions

View File

@ -1252,63 +1252,68 @@ if test "x$enable_expdevices" = xyes; then
fi
# ---- Option to include GNU readline support in ngspice CLI ----
# ---- Default: disabled. ----
# ---- Default: enabled. ----
# ---- Hope to see in the future readline replacement. ----
if test "x$with_readline" = xno ; then
if test "x$with_wingui" = xyes || test "x$with_ngshared" = xyes; then
AC_MSG_RESULT([GNU readline disabled.])
else
if test "x$with_readline" = x || 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. ----
if test "x$with_editline" != xyes; then
AC_MSG_RESULT([BSD editline disabled.])
else
AC_MSG_RESULT([Checking for editline:])
AC_CHECK_HEADERS([editline/readline.h],
[AC_DEFINE([HAVE_BSDEDITLINE], [1], [Define to enable BSD editline])],
[AC_MSG_ERROR([Couldn't find BSD editline 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([edit], [readline],
[LIBS="$LIBS -ledit"],
[AC_MSG_ERROR([Couldn't find editline libraries.])],
[-lncurses])
if test "x$with_readline" = xno ; then
AC_MSG_RESULT([GNU readline disabled.])
else
if test "x$with_readline" = x || 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. ----
if test "x$with_editline" != xyes; then
AC_MSG_RESULT([BSD editline disabled.])
else
AC_MSG_RESULT([Checking for editline:])
AC_CHECK_HEADERS([editline/readline.h],
[AC_DEFINE([HAVE_BSDEDITLINE], [1], [Define to enable BSD editline])],
[AC_MSG_ERROR([Couldn't find BSD editline 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([edit], [readline],
[LIBS="$LIBS -ledit"],
[AC_MSG_ERROR([Couldn't find editline libraries.])],
[-lncurses])
fi
fi
# Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined