Skip to content

Commit

Permalink
Adding pkg-config for ncurses and slang.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhat committed Apr 22, 2020
1 parent fa0e6e5 commit 2b11d44
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 25 deletions.
6 changes: 6 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
Expand Down Expand Up @@ -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@
Expand Down
2 changes: 2 additions & 0 deletions Makefile.usr
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions advance/cfg.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions advance/v.mak
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
71 changes: 50 additions & 21 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -724,22 +724,42 @@ if test $ac_lib_slang = auto; then
[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 <slang.h>
], [
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],
Expand All @@ -748,28 +768,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 <ncurses.h>
], [
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],
Expand Down

0 comments on commit 2b11d44

Please sign in to comment.