Skip to content

Commit

Permalink
Enables building without matrix fonts
Browse files Browse the repository at this point in the history
Fixes bugs caused due to the disabling of matrix fonts option provided
by commit:2869565.

Adds a conditional variable (MATRIX_FONTS) whose value becomes true or
false depending on whether enable_fonts variable has true as it's
value which in turn depends whether the user has passed the
--without-fonts flag. (enable_font is true if --without-fonts flag is
not passed along with configure). The value of MATRIX_FONTS is checked
in Makefile.am and another variable BUILD_FONTS to 0 or 1.
install-data-local in Makefile.am checks for BUILD_FONTS and installs
fonts if BUILD_FONTS is set to 1.
  • Loading branch information
abishekvashok committed Aug 5, 2017
1 parent 33cae7f commit c85f375
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 67 deletions.
67 changes: 39 additions & 28 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,48 @@ cmatrix_SOURCES = cmatrix.c

man_MANS = cmatrix.1

EXTRA_DIST = COPYING INSTALL install-sh\
if MATRIX_FONTS
BUILD_FONTS = 1
else
BUILD_FONTS = 0
endif

EXTRA_DIST = COPYING INSTALL install-sh \
missing mkinstalldirs matrix.fnt \
matrix.psf.gz mtx.pcf cmatrix.1 cmatrix.spec

install-data-local:
@if test -d /usr/share/consolefonts; then \
echo " Installing matrix fonts in /usr/share/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/share/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/share/consolefonts; \
fi
@if test -d /usr/lib/kbd/consolefonts; then \
echo " Installing matrix fonts in /usr/lib/kbd/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/lib/kbd/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/lib/kbd/consolefonts; \
fi
@if test -d /usr/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
if test $(BUILD_FONTS) = 1; then \
if test -d /usr/share/consolefonts; then \
echo " Installing matrix fonts in /usr/share/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/share/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/share/consolefonts; \
fi; \
if test -d /usr/lib/kbd/consolefonts; then \
echo " Installing matrix fonts in /usr/lib/kbd/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/lib/kbd/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/lib/kbd/consolefonts; \
fi; \
if test -d /usr/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
else \
if test -d /usr/X11R6/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/X11R6/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/X11R6/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/X11R6/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
fi \
fi; \
else \
if test -d /usr/X11R6/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/X11R6/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/X11R6/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/X11R6/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
fi \
echo "Not installing matrix fonts"; \
fi

62 changes: 34 additions & 28 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
cmatrix_SOURCES = cmatrix.c
man_MANS = cmatrix.1
EXTRA_DIST = COPYING INSTALL install-sh\
@MATRIX_FONTS_FALSE@BUILD_FONTS = 0
@MATRIX_FONTS_TRUE@BUILD_FONTS = 1
EXTRA_DIST = COPYING INSTALL install-sh \
missing mkinstalldirs matrix.fnt \
matrix.psf.gz mtx.pcf cmatrix.1 cmatrix.spec

Expand Down Expand Up @@ -835,34 +837,38 @@ uninstall-man: uninstall-man1


install-data-local:
@if test -d /usr/share/consolefonts; then \
echo " Installing matrix fonts in /usr/share/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/share/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/share/consolefonts; \
fi
@if test -d /usr/lib/kbd/consolefonts; then \
echo " Installing matrix fonts in /usr/lib/kbd/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/lib/kbd/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/lib/kbd/consolefonts; \
fi
@if test -d /usr/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
if test $(BUILD_FONTS) = 1; then \
if test -d /usr/share/consolefonts; then \
echo " Installing matrix fonts in /usr/share/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/share/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/share/consolefonts; \
fi; \
if test -d /usr/lib/kbd/consolefonts; then \
echo " Installing matrix fonts in /usr/lib/kbd/consolefonts..."; \
$(INSTALL_DATA) $(srcdir)/matrix.fnt /usr/lib/kbd/consolefonts; \
$(INSTALL_DATA) $(srcdir)/matrix.psf.gz /usr/lib/kbd/consolefonts; \
fi; \
if test -d /usr/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
else \
if test -d /usr/X11R6/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/X11R6/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/X11R6/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/X11R6/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
fi \
fi; \
else \
if test -d /usr/X11R6/lib/X11/fonts/misc; then \
echo " Installing X window matrix fonts in /usr/X11R6/lib/X11/fonts/misc..."; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
$(INSTALL_DATA) $(srcdir)/mtx.pcf /usr/X11R6/lib/X11/fonts/misc; \
echo " Running mkfontdir /usr/X11R6/lib/X11/fonts/misc..."; \
$(MKFONTDIR) /usr/X11R6/lib/X11/fonts/misc; \
echo " Done. If this is the first time you have installed CMatrix you will"; \
echo " probably have to restart X window in order to use the mtx.pcf font."; \
fi \
echo "Not installing matrix fonts"; \
fi

# Tell versions [3.59,3.63) of GNU make to not export all variables.
Expand Down
35 changes: 27 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
CURSES_LIB
MATRIX_FONTS_FALSE
MATRIX_FONTS_TRUE
MKFONTDIR
SETFONT
CONSOLECHARS
Expand Down Expand Up @@ -721,7 +723,7 @@ ac_user_opts='
enable_option_checking
enable_silent_rules
enable_dependency_tracking
enable_fonts
with_fonts
enable_debug
'
ac_precious_vars='build_alias
Expand Down Expand Up @@ -1364,9 +1366,13 @@ Optional Features:
do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
--disable-fonts Disable the cmatrix font
--enable-debug Enable debugging (def disabled)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--without-fonts Install cmatrix without cmatrix font
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
Expand Down Expand Up @@ -4635,14 +4641,16 @@ if test "$ac_cv_prog_CC" = gcc -o "$ac_cv_prog_CC" = g++; then
CFLAGS="$CFLAGS -Wall -Wno-comment"
fi

# Check whether --enable-fonts was given.
if test "${enable_fonts+set}" = set; then :
enableval=$enable_fonts;
fi

# Check whether --with-fonts was given.
if test "${with_fonts+set}" = set; then :
withval=$with_fonts; enable_fonts=false
else
enable_fonts=true
fi

if test "x$enable_fonts" != "xno"; then :

if test "x$enable_fonts" != xfalse; then
# Extract the first word of "consolechars", so it can be a program name with args.
set dummy consolechars; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
Expand Down Expand Up @@ -4941,7 +4949,6 @@ $as_echo "$as_me: WARNING:
" >&2;}
fi
fi

fi


Expand All @@ -4951,6 +4958,14 @@ if test "${enable_debug+set}" = set; then :
enableval=$enable_debug;
fi

if test x$enable_fonts = xtrue; then
MATRIX_FONTS_TRUE=
MATRIX_FONTS_FALSE='#'
else
MATRIX_FONTS_TRUE='#'
MATRIX_FONTS_FALSE=
fi




Expand Down Expand Up @@ -5088,6 +5103,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MATRIX_FONTS_TRUE}" && test -z "${MATRIX_FONTS_FALSE}"; then
as_fn_error $? "conditional \"MATRIX_FONTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
Expand Down
7 changes: 4 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ if test "$ac_cv_prog_CC" = gcc -o "$ac_cv_prog_CC" = g++; then
fi

dnl cmatrix terminal font disable option (default enabled)
AC_ARG_ENABLE([fonts], AS_HELP_STRING([--disable-fonts], [Disable the cmatrix font]))
AC_ARG_WITH([fonts], AS_HELP_STRING([--without-fonts], [Install cmatrix without cmatrix font]), [enable_fonts=false], [enable_fonts=true])

AS_IF([test "x$enable_fonts" != "xno"], [
if test "x$enable_fonts" != xfalse; then
dnl Check for consolechars and setfonts
AC_PATH_PROG(CONSOLECHARS, consolechars, "", $PATH:/usr/bin:/usr/local/bin/sbin:/usr/sbin)
AC_PATH_PROG(SETFONT, setfont, "", $PATH:/usr/bin:/usr/local/bin/sbin:/usr/sbin)
Expand Down Expand Up @@ -121,12 +121,13 @@ AS_IF([test "x$enable_fonts" != "xno"], [
])
fi
fi
])
fi

dnl Parse any configure options

LIBS="$LIBS $CURSES_LIB"
AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging (def disabled)],)
AM_CONDITIONAL([MATRIX_FONTS], [test x$enable_fonts = xtrue])

AC_SUBST(CURSES_LIB)

Expand Down

0 comments on commit c85f375

Please sign in to comment.