diff --git a/Makefile.in b/Makefile.in index 4e30ada35..e92a10727 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,6 +27,8 @@ CONF_LIB_ALSA=@CONF_LIB_ALSA@ CONF_LIB_OSS=@CONF_LIB_OSS@ CONF_LIB_SDL=@CONF_LIB_SDL@ CONF_LIB_FREETYPE=@CONF_LIB_FREETYPE@ +CONF_LIB_SLANG=@CONF_LIB_SLANG@ +CONF_LIB_NCURSES=@CONF_LIB_NCURSES@ CONF_LIB_SVGAWIN=@CONF_LIB_SVGAWIN@ CONF_LIB_PTHREAD=@CONF_LIB_PTHREAD@ CONF_LIB_SLANG=@CONF_LIB_SLANG@ @@ -97,6 +99,10 @@ SDLCFLAGS=@SDLCFLAGS@ SDLLIBS=@SDLLIBS@ FREETYPECFLAGS=@FREETYPECFLAGS@ FREETYPELIBS=@FREETYPELIBS@ +SLANGCFLAGS=@SLANGCFLAGS@ +SLANGLIBS=@SLANGLIBS@ +NCURSESCFLAGS=@NCURSESCFLAGS@ +NCURSESLIBS=@NCURSESLIBS@ VCCFLAGS=@VCCFLAGS@ VCLIBS=@VCLIBS@ ASMFLAGS=@ASMFLAGS@ diff --git a/Makefile.usr b/Makefile.usr index 7c9444b41..45198579d 100644 --- a/Makefile.usr +++ b/Makefile.usr @@ -302,6 +302,8 @@ SDLCFLAGS = $(shell sdl-config --cflags) SDLLIBS = $(shell sdl-config --libs) FREETYPECFLAGS = $(shell freetype-config --cflags) FREETYPELIBS = $(shell freetype-config --libs) +NCURSESCFLAGS = $(shell ncurses6-config --cflags) +NCURSESLIBS = $(shell ncurses6-config --libs) endif ifeq ($(CONF_HOST),dos) # Probably you need to changes these to cross compile: diff --git a/advance/cfg.mak b/advance/cfg.mak index 222533ff3..d2f832330 100644 --- a/advance/cfg.mak +++ b/advance/cfg.mak @@ -57,15 +57,17 @@ CFGOBJS += \ $(CFGOBJ)/linux/os.o ifeq ($(CONF_LIB_SLANG),yes) CFGCFLAGS += \ + $(SLANGCFLAGS) \ -DUSE_VIDEO_SLANG -CFGLIBS += -lslang +CFGLIBS += $(SLANGLIBS) CFGOBJS += \ $(CFGOBJ)/linux/vslang.o endif ifeq ($(CONF_LIB_NCURSES),yes) CFGCFLAGS += \ + $(NCURSESCFLAGS) \ -DUSE_VIDEO_CURSES -CFGLIBS += -lncurses +CFGLIBS += $(NCURSESLIBS) CFGOBJS += \ $(CFGOBJ)/linux/vcurses.o endif diff --git a/advance/v.mak b/advance/v.mak index 4ffe708f3..451f0d55f 100644 --- a/advance/v.mak +++ b/advance/v.mak @@ -53,15 +53,17 @@ VOBJS += \ $(VOBJ)/linux/os.o ifeq ($(CONF_LIB_SLANG),yes) VCFLAGS += \ + $(SLANGCFLAGS) \ -DUSE_VIDEO_SLANG -VLIBS += -lslang +VLIBS += $(SLANGLIBS) VOBJS += \ $(VOBJ)/linux/vslang.o endif ifeq ($(CONF_LIB_NCURSES),yes) VCFLAGS += \ + $(NCURSESCFLAGS) \ -DUSE_VIDEO_CURSES -VLIBS += -lncurses +VLIBS += $(NCURSESLIBS) VOBJS += \ $(VOBJ)/linux/vcurses.o endif diff --git a/configure.ac b/configure.ac index 063c407a4..f8ba989aa 100644 --- a/configure.ac +++ b/configure.ac @@ -717,29 +717,41 @@ AC_ARG_ENABLE( [ac_lib_slang=auto] ) if test $ac_lib_slang = auto; then - AC_CHECK_LIB( - [slang], - [SLang_init_tty], - [ac_lib_slang=yes], - [ac_lib_slang=no], - [] - ) + PKG_CHECK_MODULES([SLANG], [slang], [ac_lib_slang=yes], [ac_lib_slang=no]) + if test $ac_lib_slang = yes; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="SLANG_CFLAGS $CFLAGS" + LIBS="$SLANG_LIBS $LIBS" + AC_MSG_CHECKING([for linking slang]) + AC_TRY_LINK([ + #include + ], [ + if (SLang_init_tty(-1, 0, 0) < 0) { + perror("SLang_init_tty"); + return 1; + } + + SLang_reset_tty(); + return 0; + ],[ac_lib_slang=yes],[ac_lib_slang=no]) + AC_MSG_RESULT([$ac_lib_slang]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi elif test $ac_lib_slang = yes; then - AC_CHECK_LIB( - [slang], - [SLang_init_tty], - [], - [AC_MSG_ERROR([the sLang library is missing])], - [] - ) + PKG_CHECK_MODULES([SLANG], [slang], [], AC_MSG_ERROR([the slang library is missing])) fi if test $ac_lib_slang = yes; then AC_CHECK_HEADERS([slang.h slang/slang.h], [break]) ac_lib_video="$ac_lib_video slang" ac_lib_text_flag=yes fi +AC_SUBST([SLANGCFLAGS],[$SLANG_CFLAGS]) +AC_SUBST([SLANGLIBS],[$SLANG_LIBS]) AC_SUBST([CONF_LIB_SLANG],[$ac_lib_slang]) + dnl Checks for ncurses AC_ARG_ENABLE( [ncurses], @@ -748,28 +760,37 @@ AC_ARG_ENABLE( [ac_lib_ncurses=auto] ) if test $ac_lib_ncurses = auto; then - AC_CHECK_LIB( - [ncurses], - [endwin], - [ac_lib_ncurses=yes], - [ac_lib_ncurses=no], - [] - ) + PKG_CHECK_MODULES([NCURSES], [ncurses], [ac_lib_ncurses=yes], [ac_lib_ncurses=no]) + if test $ac_lib_ncurses = yes; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$NCURSES_CFLAGS $CFLAGS" + LIBS="$NCURSES_LIBS $LIBS" + AC_MSG_CHECKING([for linking ncurses]) + AC_TRY_LINK([ + #include + ], [ + initscr(); + noecho(); + curs_set(FALSE); + endwin(); + ],[ac_lib_ncurses=yes],[ac_lib_ncurses=no]) + AC_MSG_RESULT([$ac_lib_ncurses]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi elif test $ac_lib_ncurses = yes; then - AC_CHECK_LIB( - [ncurses], - [endwin], - [], - [AC_MSG_ERROR([the sLang library is missing])], - [] - ) + PKG_CHECK_MODULES([NCURSES], [ncurses], [], AC_MSG_ERROR([the ncurses library is missing])) fi if test $ac_lib_ncurses = yes; then ac_lib_video="$ac_lib_video ncurses" ac_lib_text_flag=yes fi +AC_SUBST([NCURSESCFLAGS],[$NCURSES_CFLAGS]) +AC_SUBST([NCURSESLIBS],[$NCURSES_LIBS]) AC_SUBST([CONF_LIB_NCURSES],[$ac_lib_ncurses]) + dnl Checks for freetype AC_ARG_ENABLE( [freetype],