VIDEO: Add display of versions of dependent libraries (libpng, zlib)

Add specific makefile check for zlib being available
This commit is contained in:
Mark Pizzolato 2019-07-30 22:30:03 -07:00
parent 9662d7f4d1
commit 354a1e42ea
2 changed files with 35 additions and 6 deletions

View file

@ -553,6 +553,13 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
OS_CCDEFS += -DHAVE_LIBPNG
OS_LDFLAGS += -lpng
$(info using libpng: $(call find_lib,png) $(call find_include,png))
ifneq (,$(call find_include,zlib))
ifneq (,$(call find_lib,z))
OS_CCDEFS += -DHAVE_ZLIB
OS_LDFLAGS += -lz
$(info using zlib: $(call find_lib,z) $(call find_include,zlib))
endif
endif
endif
endif
ifneq (,$(call find_include,glob))
@ -634,21 +641,21 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
ifeq (Darwin,$(OSTYPE))
$(info *** Info *** Install the MacPorts libSDL2 package to provide this)
$(info *** Info *** functionality for your OS X system:)
$(info *** Info *** # port install libsdl2)
$(info *** Info *** # port install libsdl2 libpng zlib)
ifeq (/usr/local/bin/brew,$(shell which brew))
$(info *** Info ***)
$(info *** Info *** OR)
$(info *** Info ***)
$(info *** Info *** Install the HomeBrew libSDL2 package to provide this)
$(info *** Info *** functionality for your OS X system:)
$(info *** Info *** $$ brew install sdl2)
$(info *** Info *** $$ brew install sdl2 libpng zlib)
endif
else
ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get)))
$(info *** Info *** Install the development components of libSDL or libSDL2)
$(info *** Info *** packaged for your operating system distribution for)
$(info *** Info *** your Linux system:)
$(info *** Info *** $$ sudo apt-get install libsdl2-dev)
$(info *** Info *** $$ sudo apt-get install libsdl2-dev libpng-dev)
$(info *** Info *** or)
$(info *** Info *** $$ sudo apt-get install libsdl-dev)
else
@ -985,6 +992,8 @@ else
VIDEO_FEATURES = - video capabilities provided by libSDL2 (Simple Directmedia Layer)
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/sim_ws.c
DISPLAYVT = ${DISPLAYD}/vt11.c
DISPLAY340 = ${DISPLAYD}/type340.c
DISPLAYNG = ${DISPLAYD}/ng.c
DISPLAY_OPT += -DUSE_DISPLAY $(VIDEO_CCDEFS) $(VIDEO_LDFLAGS)
else
$(info ***********************************************************************)

View file

@ -104,6 +104,7 @@ static char tmp_key_name[40];
*/
#include <SDL.h>
#include <png.h>
#include <zlib.h>
#define SUCCESS 0
#define ERROR -1
@ -1835,7 +1836,7 @@ return 0;
const char *vid_version(void)
{
static char SDLVersion[80];
static char SDLVersion[160];
SDL_version compiled, running;
#if SDL_MAJOR_VERSION == 1
@ -1848,15 +1849,34 @@ SDL_GetVersion(&running);
#endif
SDL_VERSION(&compiled);
SDLVersion[sizeof (SDLVersion) - 1] = '\0';
if ((compiled.major == running.major) &&
(compiled.minor == running.minor) &&
(compiled.patch == running.patch))
sprintf(SDLVersion, "SDL Version %d.%d.%d",
snprintf(SDLVersion, sizeof (SDLVersion) - 1, "SDL Version %d.%d.%d",
compiled.major, compiled.minor, compiled.patch);
else
sprintf(SDLVersion, "SDL Version (Compiled: %d.%d.%d, Runtime: %d.%d.%d)",
snprintf(SDLVersion, sizeof (SDLVersion) - 1, "SDL Version (Compiled: %d.%d.%d, Runtime: %d.%d.%d)",
compiled.major, compiled.minor, compiled.patch,
running.major, running.minor, running.patch);
#if defined (HAVE_LIBPNG)
if (1) {
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (strcmp (PNG_LIBPNG_VER_STRING, png_get_libpng_ver (png)))
snprintf(&SDLVersion[strlen (SDLVersion)], sizeof (SDLVersion) - (strlen (SDLVersion) + 1),
", PNG Version (Compiled: %s, Runtime: %s)",
PNG_LIBPNG_VER_STRING, png_get_libpng_ver (png));
else
snprintf(&SDLVersion[strlen (SDLVersion)], sizeof (SDLVersion) - (strlen (SDLVersion) + 1),
", PNG Version %s", PNG_LIBPNG_VER_STRING);
png_destroy_read_struct(&png, NULL, NULL);
#if defined (HAVE_ZLIB)
snprintf(&SDLVersion[strlen (SDLVersion)], sizeof (SDLVersion) - (strlen (SDLVersion) + 1),
", zlib: %s", zlibVersion());
#endif
}
#endif
return (const char *)SDLVersion;
}