From 39874bbf878f4ba648d676cd2c6b2462472b2b85 Mon Sep 17 00:00:00 2001 From: gfk Date: Wed, 31 Oct 2001 22:05:14 +0000 Subject: [PATCH] Some cleanup: Changed the optimization value to -O3 Moved the (n)curses autoconf tests to the (n)curses driver section. Removed commented commands in configure.in Added define ACS_* test for curses driver --- acconfig.h | 2 ++ acinclude.m4 | 53 +++++++++++++++++++++++++++++++------ configure.in | 12 +++------ server/drivers/curses_drv.c | 10 ++++--- 4 files changed, 57 insertions(+), 20 deletions(-) diff --git a/acconfig.h b/acconfig.h index c285268..1620f75 100644 --- a/acconfig.h +++ b/acconfig.h @@ -28,6 +28,8 @@ #undef DEBUG +#undef DEFINED_ACS + #undef GLK_DRV #undef HD44780_DRV diff --git a/acinclude.m4 b/acinclude.m4 index 636f777..73fe05c 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,3 +1,23 @@ +dnl This test is used by the curses driver. +dnl Checks if $1 defined the ACS_S* preprocessor macros. +dnl Example: AC_CHECK_DEFINE_ACS(curses.h) +AC_DEFUN(AC_CHECK_DEFINE_ACS, [ + AC_MSG_CHECKING(if $1 defines ACS_S*) + AC_TRY_RUN([ + #include <$1> + int main() { + [[char map[] = { ACS_S9, ACS_S7, ACS_S3, ACS_S1 };]] + return 0; + } + ], [ + dnl then + AC_DEFINE(DEFINED_ACS) + AC_MSG_RESULT(yes) ], [ + dnl else + AC_MSG_RESULT(no) ], + [:]) +]) + AC_DEFUN(LCD_DRIVERS_SELECT, [ AC_MSG_CHECKING(for which drivers to compile) @@ -52,20 +72,35 @@ fi actdrivers=["$actdrivers sli"] ;; curses) + AC_CHECK_HEADERS(ncurses.h curses.h) AC_CHECK_LIB(ncurses, main, - LIBCURSES="-lncurses" - DRIVERS="$DRIVERS curses_drv.o" - AC_DEFINE(CURSES_DRV) - actdrivers=["$actdrivers ncurses"] - , -dnl else - AC_CHECK_LIB(curses, main, - LIBCURSES="-lcurses" + AC_CHECK_HEADER(ncurses.h, + dnl We have ncurses.h and libncurses, add driver. + AC_CHECK_DEFINE_ACS(ncurses.h) + LIBCURSES="-lncurses" DRIVERS="$DRIVERS curses_drv.o" AC_DEFINE(CURSES_DRV) actdrivers=["$actdrivers curses"] + , +dnl else + AC_MSG_WARN([Could not find ncurses.h]), + ) + , +dnl else + AC_CHECK_LIB(curses, main, + AC_CHECK_HEADER(curses.h, + dnl We have curses.h and libcurses, add driver. + AC_CHECK_DEFINE_ACS(curses.h) + LIBCURSES="-lcurses" + DRIVERS="$DRIVERS curses_drv.o" + AC_DEFINE(CURSES_DRV) + actdrivers=["$actdrivers curses"] , dnl else + AC_MSG_WARN([Could not find curses.h]), + ) + , +dnl else AC_MSG_WARN([The curses driver needs the curses (or ncurses) library.]), ) ) @@ -158,6 +193,8 @@ AC_SUBST(DRIVERS) ]) + + dnl dnl Filesystem information detection dnl diff --git a/configure.in b/configure.in index 02cc071..c07a523 100644 --- a/configure.in +++ b/configure.in @@ -23,10 +23,11 @@ AC_ARG_ENABLE(debug, AC_MSG_RESULT($debug) if test $debug = "yes"; then +dnl Enable debugging information CFLAGS="-g" else -dnl CFLAGS="-Wno-unused -O6" - CFLAGS="-O6" +dnl Maximum optimization + CFLAGS="-O3" fi CFLAGS="-Wall $CFLAGS" export CFLAGS @@ -37,12 +38,6 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_RANLIB -dnl Checks for libraries. -dnl Replace `main' with a function in -lLCDstuff: -dnl AC_CHECK_LIB(LCDstuff, main) -dnl Replace `main' with a function in -lncurses: -dnl AC_CHECK_LIB(ncurses, main) - dnl Solaris AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)]) @@ -74,7 +69,6 @@ dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h) -AC_CHECK_HEADERS(curses.h ncurses.h) dnl Check for particular preprocessor macros diff --git a/server/drivers/curses_drv.c b/server/drivers/curses_drv.c index 4dea71f..1c0bd80 100644 --- a/server/drivers/curses_drv.c +++ b/server/drivers/curses_drv.c @@ -454,10 +454,14 @@ curses_drv_num (int x, int num) void curses_drv_vbar (int x, int len) { - //char map[] = "_.,,ooO8"; - char map[] = { ACS_S9, ACS_S9, ACS_S7, ACS_S7, ACS_S3, ACS_S3, ACS_S1, ACS_S1 }; int y; - +// Some curses.h do not define ACS_S* preprocessor macros, so we take a guess. +#ifdef DEFINED_ACS + char map[] = { ACS_S9, ACS_S9, ACS_S7, ACS_S7, ACS_S3, ACS_S3, ACS_S1, ACS_S1 }; +#else + char map[] = "_.,,ooO8"; +#endif + ValidX(x); #define MAX_LINES (curses_drv->cellhgt * curses_drv->hgt)