* configure.in: Complete rewrite of the screen library support.

Add new option --with-screen instead on --with-slang,
--with-included-slang and --with-ncurses.  Only allow
--with-termcap is using the included S-Lang library.
* aclocal.m4: Corresponding changes.
This commit is contained in:
Pavel Roskin 2002-09-30 01:02:02 +00:00
parent 31093df1bc
commit 89fb039e0f
3 changed files with 198 additions and 184 deletions

View File

@ -1,5 +1,11 @@
2002-09-29 Pavel Roskin <proski@gnu.org>
* configure.in: Complete rewrite of the screen library support.
Add new option --with-screen instead on --with-slang,
--with-included-slang and --with-ncurses. Only allow
--with-termcap is using the included S-Lang library.
* aclocal.m4: Corresponding changes.
* syntax/mail.syntax: Replace "wholechars right" and "wholechars
left" with single "wholechars".
* syntax/nroff.syntax: Likewise.

View File

@ -604,57 +604,163 @@ and uses `struct fs_data'])
dnl fi
])
AC_DEFUN([AC_USE_TERMCAP], [
AC_MSG_NOTICE([using S-Lang screen manager/termcap])
AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap library])
AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS])
slang_term=" with termcap"
])
AC_DEFUN([AC_WITH_SLANG], [
AC_DEFINE(HAVE_SLANG, 1,
[Define to use S-Lang library for screen management])
screen_type="slang"
if $slang_use_system_installed_lib
then
AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
[Define to use S-Lang library installed on the system])
MCLIBS="-lslang $MCLIBS"
screen_manager="SLang (system-installed library)"
AC_MSG_NOTICE([using system installed S-Lang library])
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lslang"
AC_TRY_LINK(
[
#ifdef HAVE_SLANG_SLANG_H
#include <slang/slang.h>
#else
#include <slang.h>
#endif], [
SLtt_get_terminfo();
SLtt_tgetflag("");],
[LIBS="$ac_save_LIBS"],
[LIBS="$ac_save_LIBS"; AC_USE_TERMCAP])
else
screen_manager="SLang"
fi
if $slang_check_lib
then
use_terminfo=
for dir in /usr/lib /usr/share/lib /usr/local/lib /lib \
/usr/local/share /usr/share
do
if test -d $dir/terminfo; then
use_terminfo=yes
break
fi
done
if test -z "$use_terminfo"; then
AC_USE_TERMCAP
fi
fi]
)
dnl
dnl Try using termcap database and link with libtermcap if possible.
dnl
AC_DEFUN([MC_USE_TERMCAP], [
screen_msg="$screen_msg with termcap database"
AC_MSG_NOTICE([using S-Lang screen manager with termcap])
AC_DEFINE(USE_TERMCAP, 1, [Define to use termcap database])
AC_CHECK_LIB(termcap, tgoto, [MCLIBS="$MCLIBS -ltermcap"], , [$LIBS])
])
dnl
dnl Common code for MC_WITH_SLANG and MC_WITH_MCSLANG
dnl
dnl We check for the existance of setupterm on curses library
dnl this is required to load certain definitions on some termcaps
dnl editions (AIX and OSF/1 I seem to remember).
dnl Note that we avoid using setupterm
dnl
AC_DEFUN([_MC_WITH_XSLANG], [
screen_type=slang
AC_DEFINE(HAVE_SLANG, 1,
[Define to use S-Lang library for screen management])
case $host_os in
linux*)
;;
*)
AC_CHECK_LIB(curses,setupterm,
[AC_TRY_COMPILE([
#include <curses.h>
#include <term.h>],
[return (key_end == parm_insert_line);],
[MCLIBS="$MCLIBS -lcurses"
AC_DEFINE(USE_SETUPTERM, 1,
[Define to use function `setupterm'
from `curses' library in S-Lang])])
])
;;
esac
])
dnl
dnl Check if the system S-Lang library can be used.
dnl If not, and $1 is "strict", exit, otherwise fall back to mcslang.
dnl
AC_DEFUN([MC_WITH_SLANG], [
with_screen=slang
AC_CHECK_LIB([slang], [SLang_init_tty], [MCLIBS="$MCLIBS -lslang"],
[with_screen=mcslang])
dnl Check the header
if test x$with_screen = xslang; then
slang_h_found=
AC_CHECK_HEADERS([slang.h slang/slang.h],
[slang_h_found=yes; break])
if test -z "$slang_h_found"; then
with_screen=mcslang
fi
fi
dnl Check if the installed S-Lang library uses termcap
if test x$with_screen = xslang; then
screen_type=slang
screen_msg="S-Lang library (installed on the system)"
AC_DEFINE(HAVE_SYSTEM_SLANG, 1,
[Define to use S-Lang library installed on the system])
ac_save_LIBS="$LIBS"
LIBS="$LIBS -lslang"
AC_TRY_LINK([
#ifdef HAVE_SLANG_SLANG_H
#include <slang/slang.h>
#else
#include <slang.h>
#endif],
[SLtt_get_terminfo();
SLtt_tgetflag("");],
[LIBS="$ac_save_LIBS"],
[LIBS="$ac_save_LIBS"; MC_USE_TERMCAP])
_MC_WITH_XSLANG
else
m4_if([$1], strict,
[if test $with_screen != slang; then
AC_MSG_ERROR([S-Lang library not found])
fi],
[MC_WITH_MCSLANG]
)
fi
])
dnl
dnl Use the included S-Lang library.
dnl
AC_DEFUN([MC_WITH_MCSLANG], [
screen_type=slang
screen_msg="Included S-Lang library (mcslang)"
_MC_WITH_XSLANG
])
dnl
dnl Use the ncurses library. It can only be requested explicitly,
dnl so just fail if anything goes wrong.
dnl
dnl If ncurses exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
AC_DEFUN([MC_WITH_NCURSES], [
dnl has_colors() is specific to ncurses, it's not in the old curses
AC_CHECK_LIB([ncurses], [has_colors], [MCLIBS="$MCLIBS -lncurses"],
[AC_MSG_ERROR([Could not find ncurses library])])
dnl Check the header
ncurses_h_found=
AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
[ncurses_h_found=yes; break])
if test -z "$ncurses_h_found"; then
AC_MSG_ERROR([Could not find ncurses header file])
fi
screen_type=ncurses
screen_msg="ncurses library"
AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management])
save_LIBS="$LIBS"
LIBS="$LIBS -lncurses"
AC_CACHE_CHECK([for ESCDELAY variable],
[mc_cv_ncurses_escdelay],
[AC_TRY_COMPILE([], [
extern int ESCDELAY;
int main ()
{
ESCDELAY = 0;
}
],
[mc_cv_ncurses_escdelay=yes],
[mc_cv_ncurses_escdelay=no])
])
if test "$mc_cv_ncurses_escdelay" = yes; then
AC_DEFINE(HAVE_ESCDELAY, 1,
[Define if ncurses has ESCDELAY variable])
fi
AC_CHECK_FUNCS(resizeterm)
LIBS="$save_LIBS"
])
dnl
dnl Check for ext2fs recovery code
dnl
AC_DEFUN([AC_EXT2_UNDEL], [
MC_UNDELFS_CHECKS
if test "$ext2fs_undel" = yes; then

View File

@ -258,12 +258,6 @@ if test x$use_vfs = xyes; then
vfs_type="Midnight Commander Virtual File System"
fi
dnl This should be unadorned "slang" or "ncurses"
screen_type=""
dnl Screen manager name (for the output only)
screen_manager=unknown
mouse_lib="xterm only"
case $host_os in
linux*)
@ -292,31 +286,6 @@ linux*)
;;
esac
AC_ARG_WITH(ncurses,
[ --with-ncurses[[=base-dir]] Compile with ncurses [[no]]],
[if test x$withval != xno; then
if test x$withval != xyes; then
LDFLAGS="$LDFLAGS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include"
fi
AC_CHECK_HEADERS([ncurses/curses.h ncurses.h curses.h],
[ncurses_h_found=yes; break])
if test -z "$ncurses_h_found"; then
AC_MSG_ERROR([Could not find ncurses header])
fi
dnl curses_version is specific to ncurses, it's not in old curses
AC_CHECK_LIB(ncurses, has_colors, [MCLIBS="$MCLIBS -lncurses"],
[AC_MSG_ERROR([Could not find ncurses library])])
screen_type="ncurses"
screen_manager="ncurses"
AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management])
fi
])
dnl
dnl Check for the -mandoc package
dnl
@ -450,44 +419,44 @@ fi
AC_MSG_RESULT([$result])
subshell="$result"
if test "x$screen_type" != xncurses; then
slang_check_lib=true
slang_term=""
slang_use_system_installed_lib=false
AC_CHECK_LIB(slang,SLang_init_tty,
[AC_CHECK_HEADERS([slang.h slang/slang.h],
[slang_h_found=yes; break])
if test "x$slang_h_found" = xyes; then
slang_use_system_installed_lib=true
slang_check_lib=false
fi
])
fi
AC_ARG_WITH(slang,
[ --with-slang Compile with S-Lang screen manager [[yes]]],
[if test x$withval = xyes; then
AC_WITH_SLANG
fi]
)
dnl
dnl Select the screen library. mcslang is the included S-Lang library.
dnl
AC_ARG_WITH(screen,
[ --with-screen=LIB Compile with screen library: slang, mcslang or
ncurses [[slang if found, else mcslang]]])
AC_ARG_WITH(included-slang,
[ --with-included-slang Use S-Lang library included with mc sources
[[use installed library if found]]],
[if test x$withval = xyes; then
slang_use_system_installed_lib=false
slang_check_lib=true
fi]
)
case x$with_screen in
xslang)
MC_WITH_SLANG(strict)
;;
xmcslang)
MC_WITH_MCSLANG
;;
xncurses)
MC_WITH_NCURSES
;;
x)
MC_WITH_SLANG
;;
*)
AC_MSG_ERROR([Value of the screen library is incorrect])
;;
esac
dnl
dnl Force using termcap
dnl
AC_ARG_WITH(termcap,
[ --with-termcap Same as above, and try using termcap database [[no]]],
[if test x$withval = xyes; then
AC_USE_TERMCAP
slang_check_lib=false
slang_use_system_installed_lib=false
fi]
)
[ --with-termcap Try using termcap database [[no]]],
[if test x$with_screen = xmcslang; then
MC_USE_TERMCAP
else
AC_MSG_ERROR([Option `--with-termcap' only works with `--with-screen=mcslang'])
fi
])
dnl
@ -522,40 +491,6 @@ if test $use_vfs = yes; then
fi
dnl Ncurses specific checks
dnl
dnl If ncurses exports the ESCDELAY variable it should be set to 0
dnl or you'll have to press Esc three times to dismiss a dialog box.
dnl
if test "x$screen_type" = xncurses; then
save_LIBS="$LIBS"
LIBS="$MCLIBS $LIBS"
AC_CACHE_CHECK([for ESCDELAY variable],
[mc_cv_ncurses_escdelay],
[AC_TRY_COMPILE([], [
extern int ESCDELAY;
int main ()
{
ESCDELAY = 0;
}
],
[mc_cv_ncurses_escdelay=yes],
[mc_cv_ncurses_escdelay=no]
)
])
if test "$mc_cv_ncurses_escdelay" = yes; then
AC_DEFINE(HAVE_ESCDELAY, 1,
[Define if ncurses has ESCDELAY variable])
fi
AC_CHECK_FUNCS(resizeterm)
LIBS="$save_LIBS"
fi
if test "x$screen_type" = "x"; then
AC_WITH_SLANG
fi
dnl
dnl The variables used for expanding the auto saver.
dnl
@ -600,34 +535,6 @@ if test "$GLIBC21" != yes; then
AC_DEFINE(USE_INCLUDED_REGEX, 1, [Use the regex included here])
fi
dnl
dnl This code should be moved to the ac_WITH_SLANG
dnl
dnl We check for the existance of setupterm on curses library
dnl this is required to load certain definitions on some termcaps
dnl editions (AIX and OSF/1 I seem to remember).
dnl Note that we avoid using setupterm
if test "x$screen_type" = xslang; then
case $host_os in
linux*)
;;
*)
AC_CHECK_LIB(curses,setupterm,
[AC_TRY_COMPILE([
#include <curses.h>
#include <term.h>],[
if (key_end == parm_insert_line)
return 1;
return 0;
],
[MCLIBS="$MCLIBS -lcurses"
AC_DEFINE(USE_SETUPTERM, 1,
[Define to use function `setupterm'
from `curses' library in S-Lang])])
])
esac
fi
LIBS="$LIBS $posix_libs"
AC_SUBST(CFLAGS)
@ -652,8 +559,7 @@ AM_CONDITIONAL(USE_VFS_NET, [test x"$use_net_code" = xtrue])
AM_CONDITIONAL(USE_UNDEL_FS, [test -n "$use_undelfs"])
AM_CONDITIONAL(USE_SAMBA_FS, [test -n "$use_smbfs"])
AM_CONDITIONAL(USE_MCFS, [test -n "$use_mcfs"])
AM_CONDITIONAL(INCLUDED_SLANG,
[test "x$slang_use_system_installed_lib" = xfalse])
AM_CONDITIONAL(INCLUDED_SLANG, [test "x$with_screen" = xmcslang])
AM_CONDITIONAL(CHARSET, [test -n "$have_charset"])
AM_CONDITIONAL(CONS_SAVER, [test -n "$cons_saver"])
@ -700,10 +606,6 @@ po/Makefile.in
AC_OUTPUT
if test "x$screen_type" = xslang; then
screen_manager="${screen_manager}${slang_term}"
fi
echo "
Configuration:
@ -712,7 +614,7 @@ Configuration:
Compiler flags: ${CFLAGS}
File system: ${vfs_type}
${vfs_flags}
Screen manager: ${screen_manager}
Screen library: ${screen_msg}
Install console saver: ${install_saver}
Mouse support: ${mouse_lib}
X11 events support: ${textmode_x11_support}