From d84e462b89ef26e22ba9393b507fbc02c2163b23 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 10 Aug 2012 10:32:58 +0400 Subject: [PATCH] Cleanup of screen library detection m4 code. Signed-off-by: Andrew Borodin --- m4.include/mc-with-screen-ncurses.m4 | 8 +++--- m4.include/mc-with-screen-slang.m4 | 47 ++++++++++++------------------------ m4.include/mc-with-screen.m4 | 13 ++++------ 3 files changed, 24 insertions(+), 44 deletions(-) diff --git a/m4.include/mc-with-screen-ncurses.m4 b/m4.include/mc-with-screen-ncurses.m4 index 3e7f4821b..14be9ed73 100644 --- a/m4.include/mc-with-screen-ncurses.m4 +++ b/m4.include/mc-with-screen-ncurses.m4 @@ -48,7 +48,7 @@ AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [ if test x"$found_ncurses" = x"yes"; then screen_type=ncurses - screen_msg="ncurses library (installed on the system)" + screen_msg="Ncurses library" AC_DEFINE(HAVE_NCURSES, 1, [Define to use ncurses library for screen management]) @@ -100,7 +100,7 @@ AC_DEFUN([MC_WITH_NCURSES], [ [AC_MSG_ERROR([Cannot find ncurses library])]) screen_type=ncurses - screen_msg="ncurses library" + screen_msg="Ncurses library" AC_DEFINE(USE_NCURSES, 1, [Define to use ncurses for screen management]) else @@ -124,7 +124,7 @@ AC_DEFUN([MC_WITH_NCURSES], [ fi screen_type=ncurses - screen_msg="ncurses library" + screen_msg="Ncurses library" AC_DEFINE(USE_NCURSES, 1, [Define to use ncurses for screen management]) fi @@ -174,7 +174,7 @@ AC_DEFUN([MC_WITH_NCURSESW], [ fi screen_type=ncursesw - screen_msg="ncursesw library" + screen_msg="Ncursesw library" AC_DEFINE(USE_NCURSESW, 1, [Define to use ncursesw for screen management]) diff --git a/m4.include/mc-with-screen-slang.m4 b/m4.include/mc-with-screen-slang.m4 index d1b4b2814..8e83e6a9c 100644 --- a/m4.include/mc-with-screen-slang.m4 +++ b/m4.include/mc-with-screen-slang.m4 @@ -4,11 +4,11 @@ AC_DEFUN([MC_CHECK_SLANG_HEADER], [ AC_MSG_CHECKING([for slang/slang.h]) AC_PREPROC_IFELSE( [ - AC_LANG_PROGRAM([#include ],[return 0;]) + AC_LANG_PROGRAM([#include ], [return 0;]) ], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SLANG_SLANG_H, 1,[Define to use slang.h]) + AC_DEFINE(HAVE_SLANG_SLANG_H, 1, [Define to use slang.h]) found_slang=yes ], [ @@ -44,7 +44,7 @@ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [ AC_MSG_CHECKING([for slang.h]) AC_PREPROC_IFELSE( [ - AC_LANG_PROGRAM([#include ],[return 0;]) + AC_LANG_PROGRAM([#include ], [return 0;]) ], [ AC_MSG_RESULT(yes) @@ -55,7 +55,7 @@ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [ ac_slang_lib_path="-L/usr/lib" fi found_slang=yes - AC_DEFINE(HAVE_SLANG_H, 1,[Define to use slang.h]) + AC_DEFINE(HAVE_SLANG_H, 1, [Define to use slang.h]) ], [ @@ -63,7 +63,7 @@ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [ MC_CHECK_SLANG_HEADER if test x"$found_slang" = xno; then - error_msg_slang="Slang header not found" + error_msg_slang="S-Lang header not found" else if test x"$ac_slang_inc_path" = x; then ac_slang_inc_path="-I/usr/include" @@ -124,42 +124,27 @@ int main (void) saved_LDFLAGS="-ltermcap $saved_LDFLAGS" fi - dnl Check the library - unset ac_cv_lib_slang_SLang_init_tty + unset ac_cv_lib_slang_SLang_init_tty AC_CHECK_LIB( [slang], [SLang_init_tty], [:], [ found_slang=no - error_msg_slang="S-lang library not found" + error_msg_slang="S-Lang library not found" ] ) fi - dnl Unless external S-Lang was requested, reject S-Lang with UTF-8 hacks - if test x"$found_slang" = x"yes"; then - unset ac_cv_lib_slang_SLsmg_write_nwchars - AC_CHECK_LIB( - [slang], - [SLsmg_write_nwchars], - [ - found_slang=no - error_msg_slang="Rejecting S-Lang with UTF-8 support, it's not fully supported yet" - ], - [:] - ) - fi - if test x"$found_slang" = x"yes"; then screen_type=slang - screen_msg="S-Lang library (installed on the system)" + screen_msg="S-Lang library" MCLIBS="$ac_slang_lib_path -lslang $MCLIBS" CFLAGS="$ac_slang_inc_path $saved_CFLAGS" dnl do not reset CPPFLAGS - dnl - if CPPFLAGS are resetted then cpp does not find the specified header + dnl - if CPPFLAGS are reset then cpp does not find the specified header LDFLAGS="$saved_LDFLAGS" else CFLAGS="$saved_CFLAGS" @@ -178,7 +163,7 @@ AC_DEFUN([MC_WITH_SLANG], [ AC_ARG_WITH([slang-includes], AS_HELP_STRING([--with-slang-includes=@<:@DIR@:>@], - [set path to SLANG includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang] + [set path to S-Lang includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang] ), [ac_slang_inc_path="$withval"], [ac_slang_inc_path=""] @@ -186,13 +171,13 @@ AC_DEFUN([MC_WITH_SLANG], [ AC_ARG_WITH([slang-libs], AS_HELP_STRING([--with-slang-libs=@<:@DIR@:>@], - [set path to SLANG library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang] + [set path to S-Lang library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang] ), [ac_slang_lib_path="$withval"], [ac_slang_lib_path=""] ) if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then - echo 'checking SLANG-headers in specified place ...' + echo 'checking S-Lang headers in specified place ...' MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path]) else found_slang=no @@ -208,14 +193,14 @@ AC_DEFUN([MC_WITH_SLANG], [ ac_slang_inc_path="/usr/include" ac_slang_lib_path="/usr/lib" - echo 'checking SLANG-headers in /usr ...' + echo 'checking S-Lang headers in /usr ...' MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path]) if test x"$found_slang" = "xno"; then found_slang=yes ac_slang_inc_path="/usr/local/include" ac_slang_lib_path="/usr/local/lib" - echo 'checking SLANG-headers in /usr/local ...' + echo 'checking S-Lang headers in /usr/local ...' MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path ) if test x"$found_slang" = "xno"; then AC_MSG_ERROR([$error_msg_slang]) @@ -223,9 +208,7 @@ AC_DEFUN([MC_WITH_SLANG], [ fi fi - AC_DEFINE(HAVE_SLANG, 1, - [Define to use S-Lang library for screen management]) + AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management]) MC_CHECK_SLANG_HEADER - ]) diff --git a/m4.include/mc-with-screen.m4 b/m4.include/mc-with-screen.m4 index 03c5a9dd1..3f5b5d52e 100644 --- a/m4.include/mc-with-screen.m4 +++ b/m4.include/mc-with-screen.m4 @@ -7,13 +7,13 @@ dnl AC_DEFUN([MC_WITH_SCREEN], [ - AC_ARG_WITH(screen, - [ --with-screen=LIB Compile with screen library: slang or - ncurses [[slang if found]]]) + AC_ARG_WITH([screen], + AS_HELP_STRING([--with-screen=@<:@LIB@:>@], + [Compile with screen library: slang or ncurses @<:@slang if found@:>@])) case x$with_screen in - xslang) - MC_WITH_SLANG(strict) + x | xslang) + MC_WITH_SLANG ;; xncurses) MC_WITH_NCURSES @@ -21,9 +21,6 @@ AC_DEFUN([MC_WITH_SCREEN], [ xncursesw) MC_WITH_NCURSESW ;; - x) - MC_WITH_SLANG - ;; *) AC_MSG_ERROR([Value of the screen library is incorrect]) ;; -- 2.11.4.GIT