patches for AIX with ncurses support

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Rainer Tammer 2010-01-17 13:51:07 +01:00 committed by Slava Zanko
parent 2bbe975b2c
commit 476145a0f5
8 changed files with 216 additions and 39 deletions

View File

@ -224,11 +224,28 @@ ncurses):
by default if found, otherwise the included S-Lang library is by default if found, otherwise the included S-Lang library is
used. used.
`--with-slang-includes=[DIR]'
Set path to SLANG includes [default=/usr/include]; make sense
only if --with-screen=slang is used.
`--with-slang-libs=[DIR]'
Set path to SLANG library [default=/usr/lib]; mke sense only
if --with-screen=slang is used.
`--with-termcap' `--with-termcap'
If the included S-Lang library is used, this option forces it to If the included S-Lang library is used, this option forces it to
use the termcap database, as opposed to the default terminfo use the termcap database, as opposed to the default terminfo
database. database.
`--with-ncurses-includes=[DIR]'
Set path to ncurses includes [default=/usr/include]; make
sense only if --with-screen=ncurses is used;
for /usr/local/include/ncurses specify /usr/local/include.
`--with-ncurses-libs=[DIR]'
Set path to ncurses library [default=/usr/lib]; make sense
only if --with-screen=ncurses is used.
Compiler options: Compiler options:
- - - - - - - - - - - - - - - - - -
@ -320,7 +337,7 @@ mips-dec-ultrix4.3
mips-dec-{open,net}bsd1.0 mips-dec-{open,net}bsd1.0
mips-sgi-irix5.2 mips-sgi-irix5.2
mips-sgi-irix5.3 mips-sgi-irix5.3
rs6000-ibm-aix3.2.5 powerpc-ibm-aix5.3.0.0 (IBM XL C, IBM XL C/C++)
sparc-sun-sunos4.1 sparc-sun-sunos4.1
sparc-sun-netbsd1.0 sparc-sun-netbsd1.0
sparc-sun-solaris2.3 sparc-sun-solaris2.3
@ -435,3 +452,33 @@ team. Sometimes there is no solution than upgrading to a modern and
free compiler - GCC (Compiler Collection): free compiler - GCC (Compiler Collection):
http://gcc.gnu.org/ http://gcc.gnu.org/
AIX
---
Currently you can not use gcc 4.2.4 (and probably other versions) on
AIX to compiler the S-Lang version. Please use IBM XL C or IBM XL C/C++
instead.
If you compile a ncurses version you need to set TERM=dtterm to get
working color support. Furthermore it is important to specify the
--with-ncurses-includes/--with-ncurses-lib parameters because otherwise
mc will pick up term.h from AIX which does not work with the ncurses
library.
The AIX S-Lang build was tested with S-Lang 2.0.7. Later versions may
also work but are not tested yet.
Here is an example for S-Lang, it is assumed that the S-Lang library
is installed under /user/local and that you also want want to install
to /usr/local:
export CC=cc_r
export CXX=xlC_r
export CONFIG_SHELL=/usr/bin/bash (if installed)
export SHELL=/usr/bin/bash (if installed)
./configure \
--prefix=/usr/local \
--with-screen=slang \
--with-slang-includes=/usr/local/include \
--with-slang-libs=/usr/local/lib

View File

@ -52,12 +52,19 @@
/* include at last !!! */ /* include at last !!! */
#ifdef WANT_TERM_H #ifdef WANT_TERM_H
#ifdef HAVE_NCURSES_TERM_H
# include <ncurses/term.h>
#else
# include <term.h> # include <term.h>
#endif /* HAVE_NCURSES_TERM_H */
#endif /* WANT_TERM_H */ #endif /* WANT_TERM_H */
/*** global variables **************************************************/ /*** global variables **************************************************/
/*** file scope macro definitions **************************************/ /*** file scope macro definitions **************************************/
#if defined(_AIX) && !defined(CTRL)
# define CTRL(x) ((x) & 0x1f)
#endif
/*** global variables **************************************************/ /*** global variables **************************************************/

View File

@ -5,8 +5,12 @@
#ifdef USE_NCURSES #ifdef USE_NCURSES
# ifdef HAVE_NCURSES_CURSES_H # ifdef HAVE_NCURSES_CURSES_H
# include <ncurses/curses.h> # include <ncurses/curses.h>
# elif HAVE_NCURSES_NCURSES_H
# include <ncurses/ncurses.h>
# elif HAVE_NCURSESW_CURSES_H # elif HAVE_NCURSESW_CURSES_H
# include <ncursesw/curses.h> # include <ncursesw/curses.h>
# elif HAVE_NCURSES_HCURSES_H
# include <ncurses.h>
# elif HAVE_NCURSES_H # elif HAVE_NCURSES_H
# include <ncurses.h> # include <ncurses.h>
# else # else

View File

@ -20,6 +20,10 @@
# include <sys/sysmacros.h> /* AIX */ # include <sys/sysmacros.h> /* AIX */
#endif #endif
#if defined(_AIX)
# include <time.h> /* AIX for tm */
#endif
#ifndef major #ifndef major
# warning major() is undefined. Device numbers will not be shown correctly. # warning major() is undefined. Device numbers will not be shown correctly.
# define major(devnum) (((devnum) >> 8) & 0xff) # define major(devnum) (((devnum) >> 8) & 0xff)

View File

@ -31,7 +31,8 @@
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#include <sys/fcntl.h> #include <fcntl.h> /* include fcntl.h -> sys/fcntl.h only */
/* includes fcntl.h see IEEE Std 1003.1-2008 */
#include <time.h> #include <time.h>
#include <sys/time.h> /* gettimeofday() */ #include <sys/time.h> /* gettimeofday() */

View File

@ -67,6 +67,10 @@
#include "smbfs.h" #include "smbfs.h"
#include "local.h" #include "local.h"
#if defined(_AIX) && !defined(NAME_MAX)
# define NAME_MAX FILENAME_MAX
#endif
/** They keep track of the current directory */ /** They keep track of the current directory */
static struct vfs_class *current_vfs; static struct vfs_class *current_vfs;
static char *current_dir; static char *current_dir;

View File

@ -37,8 +37,15 @@ AC_DEFUN([MC_CHECK_CFLAGS],[
mc_configured_cflags="" mc_configured_cflags=""
dnl Sorted -f options: dnl Sorted -f options:
dnl AC_MSG_CHECKING([CC is $CC])
case "$CC" in
gcc*)
MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option]) MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option])
dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector]) dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector])
;;
*)
;;
esac
dnl Sorted -W options: dnl Sorted -W options:
MC_CHECK_ONE_CFLAG([-Wcomment]) MC_CHECK_ONE_CFLAG([-Wcomment])

View File

@ -1,6 +1,6 @@
dnl dnl
dnl Check if the system S-Lang library can be used. 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 If not, and $1 is "strict", exit.
dnl dnl
AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [ AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [
@ -146,10 +146,15 @@ int main (void)
[Define to use S-Lang library for screen management]) [Define to use S-Lang library for screen management])
MCLIBS="$MCLIBS $ac_slang_lib_path -lslang" MCLIBS="$MCLIBS $ac_slang_lib_path -lslang"
fi CFLAGS="$saved_CFLAGS"
dnl do not reset CPPFLAGS
dnl - if CPPFLAGS are resetted then cpp does not find the specified header
LDFLAGS="$saved_LDFLAGS"
else
CFLAGS="$saved_CFLAGS" CFLAGS="$saved_CFLAGS"
CPPFLAGS="$saved_CPPFLAGS" CPPFLAGS="$saved_CPPFLAGS"
LDFLAGS="$saved_LDFLAGS" LDFLAGS="$saved_LDFLAGS"
fi
]) ])
dnl dnl
@ -162,7 +167,7 @@ AC_DEFUN([MC_WITH_SLANG], [
AC_ARG_WITH([slang-includes], AC_ARG_WITH([slang-includes],
AC_HELP_STRING([--with-slang-includes=@<:@DIR@:>@], AC_HELP_STRING([--with-slang-includes=@<:@DIR@:>@],
[set path to SLANG includes @<:@default=/usr/include@:>@; may sense only if --with-screen=slang] [set path to SLANG 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=""]
@ -170,7 +175,7 @@ AC_DEFUN([MC_WITH_SLANG], [
AC_ARG_WITH([slang-libs], AC_ARG_WITH([slang-libs],
AC_HELP_STRING([--with-slang-libs=@<:@DIR@:>@], AC_HELP_STRING([--with-slang-libs=@<:@DIR@:>@],
[set path to SLANG library @<:@default=/usr/lib@:>@; may sense only if --with-screen=slang] [set path to SLANG 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=""]
@ -197,6 +202,68 @@ AC_DEFUN([MC_WITH_SLANG], [
]) ])
dnl check for ncurses in user supplied path
AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [
ac_ncurses_inc_path=[$1]
ac_ncurses_lib_path=[$2]
if test x"$ac_ncurses_inc_path" != x; then
ac_ncurses_inc_path="-I"$ac_ncurses_inc_path
fi
if test x"$ac_ncurses_lib_path" != x; then
ac_ncurses_lib_path="-L"$ac_ncurses_lib_path
fi
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path"
dnl Check for the headers
dnl Both headers should be in the same directory
dnl AIX term.h is unusable for mc
AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h])
AC_PREPROC_IFELSE(
[
AC_LANG_PROGRAM([[#include <ncurses/ncurses.h>
#include <ncurses/term.h>
]],[[return 0;]])
],
[
AC_MSG_RESULT(yes)
if test x"$ac_ncurses_inc_path" = x; then
ac_ncurses_inc_path="-I/usr/include"
fi
if test x"$ac_ncurses_lib_path" = x; then
ac_ncurses_lib_path="-L/usr/lib"
fi
found_ncurses=yes
AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1,
[Define to 1 if you have the <ncurses/ncurses.h> header file.])
AC_DEFINE(HAVE_NCURSES_TERM_H, 1,
[Define to 1 if you have the <ncurses/term.h> header file.])
],
[
AC_MSG_RESULT(no)
found_ncurses=no
error_msg_ncurses="ncurses header not found"
],
)
if test x"$found_ncurses" = x"yes"; then
screen_type=ncurses
screen_msg="ncurses library (installed on the system)"
AC_DEFINE(HAVE_NCURSES, 1,
[Define to use ncurses library for screen management])
MCLIBS="$MCLIBS $ac_ncurses_lib_path"
else
CPPFLAGS="$saved_CPPFLAGS"
AC_MSG_ERROR([$error_msg_ncurses])
fi
])
dnl dnl
dnl Use the ncurses library. It can only be requested explicitly, dnl Use the ncurses library. It can only be requested explicitly,
dnl so just fail if anything goes wrong. dnl so just fail if anything goes wrong.
@ -208,6 +275,39 @@ AC_DEFUN([MC_WITH_NCURSES], [
dnl has_colors() is specific to ncurses, it's not in the old curses dnl has_colors() is specific to ncurses, it's not in the old curses
save_LIBS="$LIBS" save_LIBS="$LIBS"
ncursesw_found= ncursesw_found=
dnl get the user supplied include path
AC_ARG_WITH([ncurses-includes],
AC_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@],
[set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include]
),
[ac_ncurses_inc_path="$withval"],
[ac_ncurses_inc_path=""]
)
dnl get the user supplied lib path
AC_ARG_WITH([ncurses-libs],
AC_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@],
[set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses]
),
[ac_ncurses_lib_path="$withval"],
[ac_ncurses_lib_path=""]
)
dnl we need at least the inc path, the lib may be in a std location
if test x"$ac_ncurses_inc_path" != x; then
dnl check the user supplied location
MC_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path])
LIBS=
AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"],
[AC_MSG_ERROR([Cannot find ncurses library])])
screen_type=ncurses
screen_msg="ncurses library"
AC_DEFINE(USE_NCURSES, 1,
[Define to use ncurses for screen management])
else
LIBS= LIBS=
AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes], AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],
[AC_MSG_WARN([Cannot find ncurses library, that support wide characters])]) [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])
@ -231,7 +331,9 @@ AC_DEFUN([MC_WITH_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
dnl check for ESCDELAY
AC_CACHE_CHECK([for ESCDELAY variable], AC_CACHE_CHECK([for ESCDELAY variable],
[mc_cv_ncurses_escdelay], [mc_cv_ncurses_escdelay],
[AC_TRY_LINK([], [ [AC_TRY_LINK([], [
@ -246,6 +348,7 @@ AC_DEFUN([MC_WITH_NCURSES], [
[Define if ncurses has ESCDELAY variable]) [Define if ncurses has ESCDELAY variable])
fi fi
dnl check for resizeterm
AC_CHECK_FUNCS(resizeterm) AC_CHECK_FUNCS(resizeterm)
LIBS="$save_LIBS" LIBS="$save_LIBS"
]) ])