Ticket #1957: 0001-patches-for-AIX-with-ncurses-support.patch
File 0001-patches-for-AIX-with-ncurses-support.patch, 14.1 KB (added by tammer, 15 years ago) |
---|
-
doc/INSTALL
From 918646020df0298f54c50a081f54d6167f8bda04 Mon Sep 17 00:00:00 2001 From: Rainer Tammer <tammer@tammer.net> Date: Sun, 17 Jan 2010 13:51:07 +0100 Subject: [PATCH] patches for AIX with ncurses support --- doc/INSTALL | 49 ++++++++++++- m4.include/mc-cflags.m4 | 9 ++- m4.include/mc-with-screen.m4 | 173 +++++++++++++++++++++++++++++++++--------- src/tty/tty-ncurses.c | 7 ++ src/tty/tty-ncurses.h | 4 + src/unixcompat.h | 4 + vfs/direntry.c | 3 +- vfs/vfs.c | 4 + 8 files changed, 215 insertions(+), 38 deletions(-) diff --git a/doc/INSTALL b/doc/INSTALL index 5a39d6a..7b5959b 100644
a b ncurses): 224 224 by default if found, otherwise the included S-Lang library is 225 225 used. 226 226 227 `--with-slang-includes=[DIR]' 228 Set path to SLANG includes [default=/usr/include]; make sense 229 only if --with-screen=slang is used. 230 231 `--with-slang-libs=[DIR]' 232 Set path to SLANG library [default=/usr/lib]; mke sense only 233 if --with-screen=slang is used. 234 227 235 `--with-termcap' 228 236 If the included S-Lang library is used, this option forces it to 229 237 use the termcap database, as opposed to the default terminfo 230 238 database. 231 239 240 `--with-ncurses-includes=[DIR]' 241 Set path to ncurses includes [default=/usr/include]; make 242 sense only if --with-screen=ncurses is used; 243 for /usr/local/include/ncurses specify /usr/local/include. 244 245 `--with-ncurses-libs=[DIR]' 246 Set path to ncurses library [default=/usr/lib]; make sense 247 only if --with-screen=ncurses is used. 248 232 249 Compiler options: 233 250 - - - - - - - - - 234 251 … … mips-dec-ultrix4.3 320 337 mips-dec-{open,net}bsd1.0 321 338 mips-sgi-irix5.2 322 339 mips-sgi-irix5.3 323 rs6000-ibm-aix3.2.5 340 powerpc-ibm-aix5.3.0.0 (IBM XL C, IBM XL C/C++) 324 341 sparc-sun-sunos4.1 325 342 sparc-sun-netbsd1.0 326 343 sparc-sun-solaris2.3 … … team. Sometimes there is no solution than upgrading to a modern and 435 452 free compiler - GCC (Compiler Collection): 436 453 437 454 http://gcc.gnu.org/ 455 456 AIX 457 --- 458 Currently you can not use gcc 4.2.4 (and probably other versions) on 459 AIX to compiler the S-Lang version. Please use IBM XL C or IBM XL C/C++ 460 instead. 461 462 If you compile a ncurses version you need to set TERM=dtterm to get 463 working color support. Furthermore it is important to specify the 464 --with-ncurses-includes/--with-ncurses-lib parameters because otherwise 465 mc will pick up term.h from AIX which does not work with the ncurses 466 library. 467 468 The AIX S-Lang build was tested with S-Lang 2.0.7. Later versions may 469 also work but are not tested yet. 470 471 Here is an example for S-Lang, it is assumed that the S-Lang library 472 is installed under /user/local and that you also want want to install 473 to /usr/local: 474 475 export CC=cc_r 476 export CXX=xlC_r 477 export CONFIG_SHELL=/usr/bin/bash (if installed) 478 export SHELL=/usr/bin/bash (if installed) 479 480 ./configure \ 481 --prefix=/usr/local \ 482 --with-screen=slang \ 483 --with-slang-includes=/usr/local/include \ 484 --with-slang-libs=/usr/local/lib -
m4.include/mc-cflags.m4
diff --git a/m4.include/mc-cflags.m4 b/m4.include/mc-cflags.m4 index d7d4c0b..754ef21 100644
a b dnl @copyright Free Software Foundation, Inc. 9 9 10 10 AC_DEFUN([MC_CHECK_ONE_CFLAG],[ 11 11 12 12 AC_MSG_CHECKING([if gcc accepts $1]) 13 13 14 14 safe_CFLAGS=$CFLAGS 15 15 CFLAGS="$1" … … AC_DEFUN([MC_CHECK_CFLAGS],[ 37 37 mc_configured_cflags="" 38 38 39 39 dnl Sorted -f options: 40 dnl AC_MSG_CHECKING([CC is $CC]) 41 case "$CC" in 42 gcc*) 40 43 MC_CHECK_ONE_CFLAG([-fdiagnostics-show-option]) 41 44 dnl MC_CHECK_ONE_CFLAG([-fno-stack-protector]) 45 ;; 46 *) 47 ;; 48 esac 42 49 43 50 dnl Sorted -W options: 44 51 MC_CHECK_ONE_CFLAG([-Wcomment]) -
m4.include/mc-with-screen.m4
diff --git a/m4.include/mc-with-screen.m4 b/m4.include/mc-with-screen.m4 index e130975..f22f68a 100644
a b 1 1 dnl 2 2 dnl Check if the system S-Lang library can be used. 3 dnl If not, and $1 is "strict", exit , otherwise fall back to mcslang.3 dnl If not, and $1 is "strict", exit. 4 4 dnl 5 5 AC_DEFUN([MC_CHECK_SLANG_BY_PATH], [ 6 6 … … int main (void) 146 146 [Define to use S-Lang library for screen management]) 147 147 148 148 MCLIBS="$MCLIBS $ac_slang_lib_path -lslang" 149 CFLAGS="$saved_CFLAGS" 150 dnl do not reset CPPFLAGS 151 dnl - if CPPFLAGS are resetted then cpp does not find the specified header 152 LDFLAGS="$saved_LDFLAGS" 153 else 154 CFLAGS="$saved_CFLAGS" 155 CPPFLAGS="$saved_CPPFLAGS" 156 LDFLAGS="$saved_LDFLAGS" 149 157 fi 150 CFLAGS="$saved_CFLAGS"151 CPPFLAGS="$saved_CPPFLAGS"152 LDFLAGS="$saved_LDFLAGS"153 158 ]) 154 159 155 160 dnl … … AC_DEFUN([MC_WITH_SLANG], [ 162 167 163 168 AC_ARG_WITH([slang-includes], 164 169 AC_HELP_STRING([--with-slang-includes=@<:@DIR@:>@], 165 [set path to SLANG includes @<:@default=/usr/include@:>@; ma ysense only if --with-screen=slang]170 [set path to SLANG includes @<:@default=/usr/include@:>@; make sense only if --with-screen=slang] 166 171 ), 167 172 [ac_slang_inc_path="$withval"], 168 173 [ac_slang_inc_path=""] … … AC_DEFUN([MC_WITH_SLANG], [ 170 175 171 176 AC_ARG_WITH([slang-libs], 172 177 AC_HELP_STRING([--with-slang-libs=@<:@DIR@:>@], 173 [set path to SLANG library @<:@default=/usr/lib@:>@; ma ysense only if --with-screen=slang]178 [set path to SLANG library @<:@default=/usr/lib@:>@; make sense only if --with-screen=slang] 174 179 ), 175 180 [ac_slang_lib_path="$withval"], 176 181 [ac_slang_lib_path=""] … … AC_DEFUN([MC_WITH_SLANG], [ 197 202 198 203 ]) 199 204 205 dnl check for ncurses in user supplied path 206 AC_DEFUN([MC_CHECK_NCURSES_BY_PATH], [ 207 208 ac_ncurses_inc_path=[$1] 209 ac_ncurses_lib_path=[$2] 210 211 if test x"$ac_ncurses_inc_path" != x; then 212 ac_ncurses_inc_path="-I"$ac_ncurses_inc_path 213 fi 214 215 if test x"$ac_ncurses_lib_path" != x; then 216 ac_ncurses_lib_path="-L"$ac_ncurses_lib_path 217 fi 218 219 saved_CPPFLAGS="$CPPFLAGS" 220 CPPFLAGS="$CPPFLAGS $ac_ncurses_inc_path" 221 222 dnl Check for the headers 223 dnl Both headers should be in the same directory 224 dnl AIX term.h is unusable for mc 225 AC_MSG_CHECKING([for ncurses/ncurses.h and ncurses/term.h]) 226 AC_PREPROC_IFELSE( 227 [ 228 AC_LANG_PROGRAM([[#include <ncurses/ncurses.h> 229 #include <ncurses/term.h> 230 ]],[[return 0;]]) 231 ], 232 [ 233 AC_MSG_RESULT(yes) 234 if test x"$ac_ncurses_inc_path" = x; then 235 ac_ncurses_inc_path="-I/usr/include" 236 fi 237 if test x"$ac_ncurses_lib_path" = x; then 238 ac_ncurses_lib_path="-L/usr/lib" 239 fi 240 found_ncurses=yes 241 AC_DEFINE(HAVE_NCURSES_NCURSES_H, 1, 242 [Define to 1 if you have the <ncurses/ncurses.h> header file.]) 243 AC_DEFINE(HAVE_NCURSES_TERM_H, 1, 244 [Define to 1 if you have the <ncurses/term.h> header file.]) 245 ], 246 [ 247 AC_MSG_RESULT(no) 248 found_ncurses=no 249 error_msg_ncurses="ncurses header not found" 250 ], 251 ) 252 253 if test x"$found_ncurses" = x"yes"; then 254 screen_type=ncurses 255 screen_msg="ncurses library (installed on the system)" 256 257 AC_DEFINE(HAVE_NCURSES, 1, 258 [Define to use ncurses library for screen management]) 259 260 MCLIBS="$MCLIBS $ac_ncurses_lib_path" 261 else 262 CPPFLAGS="$saved_CPPFLAGS" 263 AC_MSG_ERROR([$error_msg_ncurses]) 264 fi 265 ]) 266 200 267 dnl 201 268 dnl Use the ncurses library. It can only be requested explicitly, 202 269 dnl so just fail if anything goes wrong. … … AC_DEFUN([MC_WITH_NCURSES], [ 208 275 dnl has_colors() is specific to ncurses, it's not in the old curses 209 276 save_LIBS="$LIBS" 210 277 ncursesw_found= 211 LIBS=212 AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes],213 [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])])214 278 215 if test x"$ncursesw_found" = "x"; then 216 LIBS= 217 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"], 218 [AC_MSG_ERROR([Cannot find ncurses library])]) 219 fi 279 dnl get the user supplied include path 280 AC_ARG_WITH([ncurses-includes], 281 AC_HELP_STRING([--with-ncurses-includes=@<:@DIR@:>@], 282 [set path to ncurses includes @<:@default=/usr/include@:>@; make sense only if --with-screen=ncurses; for /usr/local/include/ncurses specify /usr/local/include] 283 ), 284 [ac_ncurses_inc_path="$withval"], 285 [ac_ncurses_inc_path=""] 286 ) 220 287 221 dnl Check the header 222 ncurses_h_found= 223 AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h], 224 [ncurses_h_found=yes; break]) 288 dnl get the user supplied lib path 289 AC_ARG_WITH([ncurses-libs], 290 AC_HELP_STRING([--with-ncurses-libs=@<:@DIR@:>@], 291 [set path to ncurses library @<:@default=/usr/lib@:>@; make sense only if --with-screen=ncurses] 292 ), 293 [ac_ncurses_lib_path="$withval"], 294 [ac_ncurses_lib_path=""] 295 ) 225 296 226 if test x"$ncurses_h_found" = "x"; then 227 AC_MSG_ERROR([Cannot find ncurses header file]) 228 fi 297 dnl we need at least the inc path, the lib may be in a std location 298 if test x"$ac_ncurses_inc_path" != x; then 299 dnl check the user supplied location 300 MC_CHECK_NCURSES_BY_PATH([$ac_ncurses_inc_path],[$ac_ncurses_lib_path]) 301 302 LIBS= 303 AC_SEARCH_LIBS([has_colors], [ncurses], [MCLIBS="$MCLIBS $LIBS"], 304 [AC_MSG_ERROR([Cannot find ncurses library])]) 305 306 screen_type=ncurses 307 screen_msg="ncurses library" 308 AC_DEFINE(USE_NCURSES, 1, 309 [Define to use ncurses for screen management]) 310 else 311 LIBS= 312 AC_SEARCH_LIBS([addwstr], [ncursesw ncurses curses], [MCLIBS="$MCLIBS $LIBS";ncursesw_found=yes], 313 [AC_MSG_WARN([Cannot find ncurses library, that support wide characters])]) 314 315 if test x"$ncursesw_found" = "x"; then 316 LIBS= 317 AC_SEARCH_LIBS([has_colors], [ncurses curses], [MCLIBS="$MCLIBS $LIBS"], 318 [AC_MSG_ERROR([Cannot find ncurses library])]) 319 fi 229 320 230 screen_type=ncurses231 screen_msg="ncurses library"232 AC_DEFINE(USE_NCURSES, 1,233 [Define to use ncurses for screen management])321 dnl Check the header 322 ncurses_h_found= 323 AC_CHECK_HEADERS([ncursesw/curses.h ncurses/curses.h ncurses.h curses.h], 324 [ncurses_h_found=yes; break]) 234 325 326 if test x"$ncurses_h_found" = "x"; then 327 AC_MSG_ERROR([Cannot find ncurses header file]) 328 fi 329 330 screen_type=ncurses 331 screen_msg="ncurses library" 332 AC_DEFINE(USE_NCURSES, 1, 333 [Define to use ncurses for screen management]) 334 fi 335 336 dnl check for ESCDELAY 235 337 AC_CACHE_CHECK([for ESCDELAY variable], 236 237 238 239 240 241 242 338 [mc_cv_ncurses_escdelay], 339 [AC_TRY_LINK([], [ 340 extern int ESCDELAY; 341 ESCDELAY = 0; 342 ], 343 [mc_cv_ncurses_escdelay=yes], 344 [mc_cv_ncurses_escdelay=no]) 243 345 ]) 244 346 if test x"$mc_cv_ncurses_escdelay" = xyes; then 245 AC_DEFINE(HAVE_ESCDELAY, 1, 246 347 AC_DEFINE(HAVE_ESCDELAY, 1, 348 [Define if ncurses has ESCDELAY variable]) 247 349 fi 248 350 351 dnl check for resizeterm 249 352 AC_CHECK_FUNCS(resizeterm) 250 353 LIBS="$save_LIBS" 251 354 ]) -
src/tty/tty-ncurses.c
diff --git a/src/tty/tty-ncurses.c b/src/tty/tty-ncurses.c index 76b0f5f..810bdc4 100644
a b 52 52 53 53 /* include at last !!! */ 54 54 #ifdef WANT_TERM_H 55 #ifdef HAVE_NCURSES_TERM_H 56 # include <ncurses/term.h> 57 #else 55 58 # include <term.h> 59 #endif /* HAVE_NCURSES_TERM_H */ 56 60 #endif /* WANT_TERM_H */ 57 61 58 62 /*** global variables **************************************************/ 59 63 60 64 /*** file scope macro definitions **************************************/ 65 #if defined(_AIX) && !defined(CTRL) 66 # define CTRL(x) ((x) & 0x1f) 67 #endif 61 68 62 69 /*** global variables **************************************************/ 63 70 -
src/tty/tty-ncurses.h
diff --git a/src/tty/tty-ncurses.h b/src/tty/tty-ncurses.h index 6363a69..c45141a 100644
a b 5 5 #ifdef USE_NCURSES 6 6 # ifdef HAVE_NCURSES_CURSES_H 7 7 # include <ncurses/curses.h> 8 # elif HAVE_NCURSES_NCURSES_H 9 # include <ncurses/ncurses.h> 8 10 # elif HAVE_NCURSESW_CURSES_H 9 11 # include <ncursesw/curses.h> 12 # elif HAVE_NCURSES_HCURSES_H 13 # include <ncurses.h> 10 14 # elif HAVE_NCURSES_H 11 15 # include <ncurses.h> 12 16 # else -
src/unixcompat.h
diff --git a/src/unixcompat.h b/src/unixcompat.h index e71332f..9ad6e31 100644
a b 20 20 # include <sys/sysmacros.h> /* AIX */ 21 21 #endif 22 22 23 #if defined(_AIX) 24 # include <time.h> /* AIX for tm */ 25 #endif 26 23 27 #ifndef major 24 28 # warning major() is undefined. Device numbers will not be shown correctly. 25 29 # define major(devnum) (((devnum) >> 8) & 0xff) -
vfs/direntry.c
diff --git a/vfs/direntry.c b/vfs/direntry.c index 9a41aa9..bcd4ccd 100644
a b 31 31 #include <config.h> 32 32 33 33 #include <errno.h> 34 #include <sys/fcntl.h> 34 #include <fcntl.h> /* include fcntl.h -> sys/fcntl.h only */ 35 /* includes fcntl.h see IEEE Std 1003.1-2008 */ 35 36 #include <time.h> 36 37 #include <sys/time.h> /* gettimeofday() */ 37 38 -
vfs/vfs.c
diff --git a/vfs/vfs.c b/vfs/vfs.c index 6ca2c75..d16f45b 100644
a b 67 67 #include "smbfs.h" 68 68 #include "local.h" 69 69 70 #if defined(_AIX) && !defined(NAME_MAX) 71 # define NAME_MAX FILENAME_MAX 72 #endif 73 70 74 /** They keep track of the current directory */ 71 75 static struct vfs_class *current_vfs; 72 76 static char *current_dir;