Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pkg-config for ncurses and slang. #8

Merged
merged 1 commit into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chewi I am not sure what this file is for, but it seems like it should have some SLANGCFLAGS and SLANGLIBS definitions somewhere? I also didn't make an attempt to add anything for Windows, Dos or any other targets outside of Linux as I am not sure what the impact maybe. Just let me know if any adjustments are need.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is only used for DOS and Windows. It's merged now so hey ho.

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
77 changes: 49 additions & 28 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 +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 <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