Cleanup of screen library detection m4 code.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-08-10 10:32:58 +04:00
parent 6c249ec0f2
commit d84e462b89
3 changed files with 24 additions and 44 deletions

View File

@ -48,7 +48,7 @@ AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [
if test x"$found_ncurses" = x"yes"; then if test x"$found_ncurses" = x"yes"; then
screen_type=ncurses screen_type=ncurses
screen_msg="ncurses library (installed on the system)" screen_msg="Ncurses library"
AC_DEFINE(HAVE_NCURSES, 1, AC_DEFINE(HAVE_NCURSES, 1,
[Define to use ncurses library for screen management]) [Define to use ncurses library for screen management])
@ -100,7 +100,7 @@ AC_DEFUN([MC_WITH_NCURSES], [
[AC_MSG_ERROR([Cannot find ncurses library])]) [AC_MSG_ERROR([Cannot find ncurses library])])
screen_type=ncurses screen_type=ncurses
screen_msg="ncurses library" screen_msg="Ncurses library"
AC_DEFINE(USE_NCURSES, 1, AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management]) [Define to use ncurses for screen management])
else else
@ -124,7 +124,7 @@ AC_DEFUN([MC_WITH_NCURSES], [
fi fi
screen_type=ncurses screen_type=ncurses
screen_msg="ncurses library" screen_msg="Ncurses library"
AC_DEFINE(USE_NCURSES, 1, AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management]) [Define to use ncurses for screen management])
fi fi
@ -174,7 +174,7 @@ AC_DEFUN([MC_WITH_NCURSESW], [
fi fi
screen_type=ncursesw screen_type=ncursesw
screen_msg="ncursesw library" screen_msg="Ncursesw library"
AC_DEFINE(USE_NCURSESW, 1, AC_DEFINE(USE_NCURSESW, 1,
[Define to use ncursesw for screen management]) [Define to use ncursesw for screen management])

View File

@ -4,11 +4,11 @@ AC_DEFUN([MC_CHECK_SLANG_HEADER], [
AC_MSG_CHECKING([for slang/slang.h]) AC_MSG_CHECKING([for slang/slang.h])
AC_PREPROC_IFELSE( AC_PREPROC_IFELSE(
[ [
AC_LANG_PROGRAM([#include <slang/slang.h>],[return 0;]) AC_LANG_PROGRAM([#include <slang/slang.h>], [return 0;])
], ],
[ [
AC_MSG_RESULT(yes) 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 found_slang=yes
], ],
[ [
@ -44,7 +44,7 @@ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
AC_MSG_CHECKING([for slang.h]) AC_MSG_CHECKING([for slang.h])
AC_PREPROC_IFELSE( AC_PREPROC_IFELSE(
[ [
AC_LANG_PROGRAM([#include <slang.h>],[return 0;]) AC_LANG_PROGRAM([#include <slang.h>], [return 0;])
], ],
[ [
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
@ -55,7 +55,7 @@ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
ac_slang_lib_path="-L/usr/lib" ac_slang_lib_path="-L/usr/lib"
fi fi
found_slang=yes 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 MC_CHECK_SLANG_HEADER
if test x"$found_slang" = xno; then if test x"$found_slang" = xno; then
error_msg_slang="Slang header not found" error_msg_slang="S-Lang header not found"
else else
if test x"$ac_slang_inc_path" = x; then if test x"$ac_slang_inc_path" = x; then
ac_slang_inc_path="-I/usr/include" ac_slang_inc_path="-I/usr/include"
@ -124,42 +124,27 @@ int main (void)
saved_LDFLAGS="-ltermcap $saved_LDFLAGS" saved_LDFLAGS="-ltermcap $saved_LDFLAGS"
fi fi
dnl Check the library dnl Check the library
unset ac_cv_lib_slang_SLang_init_tty unset ac_cv_lib_slang_SLang_init_tty
AC_CHECK_LIB( AC_CHECK_LIB(
[slang], [slang],
[SLang_init_tty], [SLang_init_tty],
[:], [:],
[ [
found_slang=no found_slang=no
error_msg_slang="S-lang library not found" error_msg_slang="S-Lang library not found"
] ]
) )
fi 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 if test x"$found_slang" = x"yes"; then
screen_type=slang screen_type=slang
screen_msg="S-Lang library (installed on the system)" screen_msg="S-Lang library"
MCLIBS="$ac_slang_lib_path -lslang $MCLIBS" MCLIBS="$ac_slang_lib_path -lslang $MCLIBS"
CFLAGS="$ac_slang_inc_path $saved_CFLAGS" CFLAGS="$ac_slang_inc_path $saved_CFLAGS"
dnl do not reset CPPFLAGS 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" LDFLAGS="$saved_LDFLAGS"
else else
CFLAGS="$saved_CFLAGS" CFLAGS="$saved_CFLAGS"
@ -178,7 +163,7 @@ AC_DEFUN([MC_WITH_SLANG], [
AC_ARG_WITH([slang-includes], AC_ARG_WITH([slang-includes],
AS_HELP_STRING([--with-slang-includes=@<:@DIR@:>@], 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="$withval"],
[ac_slang_inc_path=""] [ac_slang_inc_path=""]
@ -186,13 +171,13 @@ AC_DEFUN([MC_WITH_SLANG], [
AC_ARG_WITH([slang-libs], AC_ARG_WITH([slang-libs],
AS_HELP_STRING([--with-slang-libs=@<:@DIR@:>@], 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="$withval"],
[ac_slang_lib_path=""] [ac_slang_lib_path=""]
) )
if test x"$ac_slang_lib_path" != x -o x"$ac_slang_inc_path" != x; then 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]) MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
else else
found_slang=no found_slang=no
@ -208,14 +193,14 @@ AC_DEFUN([MC_WITH_SLANG], [
ac_slang_inc_path="/usr/include" ac_slang_inc_path="/usr/include"
ac_slang_lib_path="/usr/lib" 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]) MC_CHECK_SLANG_BY_PATH([$ac_slang_inc_path],[$ac_slang_lib_path])
if test x"$found_slang" = "xno"; then if test x"$found_slang" = "xno"; then
found_slang=yes found_slang=yes
ac_slang_inc_path="/usr/local/include" ac_slang_inc_path="/usr/local/include"
ac_slang_lib_path="/usr/local/lib" 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 ) MC_CHECK_SLANG_BY_PATH( $ac_slang_inc_path , $ac_slang_lib_path )
if test x"$found_slang" = "xno"; then if test x"$found_slang" = "xno"; then
AC_MSG_ERROR([$error_msg_slang]) AC_MSG_ERROR([$error_msg_slang])
@ -223,9 +208,7 @@ AC_DEFUN([MC_WITH_SLANG], [
fi fi
fi fi
AC_DEFINE(HAVE_SLANG, 1, AC_DEFINE(HAVE_SLANG, 1, [Define to use S-Lang library for screen management])
[Define to use S-Lang library for screen management])
MC_CHECK_SLANG_HEADER MC_CHECK_SLANG_HEADER
]) ])

View File

@ -7,13 +7,13 @@ dnl
AC_DEFUN([MC_WITH_SCREEN], [ AC_DEFUN([MC_WITH_SCREEN], [
AC_ARG_WITH(screen, AC_ARG_WITH([screen],
[ --with-screen=LIB Compile with screen library: slang or AS_HELP_STRING([--with-screen=@<:@LIB@:>@],
ncurses [[slang if found]]]) [Compile with screen library: slang or ncurses @<:@slang if found@:>@]))
case x$with_screen in case x$with_screen in
xslang) x | xslang)
MC_WITH_SLANG(strict) MC_WITH_SLANG
;; ;;
xncurses) xncurses)
MC_WITH_NCURSES MC_WITH_NCURSES
@ -21,9 +21,6 @@ AC_DEFUN([MC_WITH_SCREEN], [
xncursesw) xncursesw)
MC_WITH_NCURSESW MC_WITH_NCURSESW
;; ;;
x)
MC_WITH_SLANG
;;
*) *)
AC_MSG_ERROR([Value of the screen library is incorrect]) AC_MSG_ERROR([Value of the screen library is incorrect])
;; ;;