VIDEO: Add display of versions of dependent libraries (libpng, zlib)
Add specific makefile check for zlib being available
This commit is contained in:
parent
9662d7f4d1
commit
354a1e42ea
2 changed files with 35 additions and 6 deletions
15
makefile
15
makefile
|
@ -553,6 +553,13 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
|
||||||
OS_CCDEFS += -DHAVE_LIBPNG
|
OS_CCDEFS += -DHAVE_LIBPNG
|
||||||
OS_LDFLAGS += -lpng
|
OS_LDFLAGS += -lpng
|
||||||
$(info using libpng: $(call find_lib,png) $(call find_include,png))
|
$(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
|
||||||
endif
|
endif
|
||||||
ifneq (,$(call find_include,glob))
|
ifneq (,$(call find_include,glob))
|
||||||
|
@ -634,21 +641,21 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin)
|
||||||
ifeq (Darwin,$(OSTYPE))
|
ifeq (Darwin,$(OSTYPE))
|
||||||
$(info *** Info *** Install the MacPorts libSDL2 package to provide this)
|
$(info *** Info *** Install the MacPorts libSDL2 package to provide this)
|
||||||
$(info *** Info *** functionality for your OS X system:)
|
$(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))
|
ifeq (/usr/local/bin/brew,$(shell which brew))
|
||||||
$(info *** Info ***)
|
$(info *** Info ***)
|
||||||
$(info *** Info *** OR)
|
$(info *** Info *** OR)
|
||||||
$(info *** Info ***)
|
$(info *** Info ***)
|
||||||
$(info *** Info *** Install the HomeBrew libSDL2 package to provide this)
|
$(info *** Info *** Install the HomeBrew libSDL2 package to provide this)
|
||||||
$(info *** Info *** functionality for your OS X system:)
|
$(info *** Info *** functionality for your OS X system:)
|
||||||
$(info *** Info *** $$ brew install sdl2)
|
$(info *** Info *** $$ brew install sdl2 libpng zlib)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get)))
|
ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get)))
|
||||||
$(info *** Info *** Install the development components of libSDL or libSDL2)
|
$(info *** Info *** Install the development components of libSDL or libSDL2)
|
||||||
$(info *** Info *** packaged for your operating system distribution for)
|
$(info *** Info *** packaged for your operating system distribution for)
|
||||||
$(info *** Info *** your Linux system:)
|
$(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 *** or)
|
||||||
$(info *** Info *** $$ sudo apt-get install libsdl-dev)
|
$(info *** Info *** $$ sudo apt-get install libsdl-dev)
|
||||||
else
|
else
|
||||||
|
@ -985,6 +992,8 @@ else
|
||||||
VIDEO_FEATURES = - video capabilities provided by libSDL2 (Simple Directmedia Layer)
|
VIDEO_FEATURES = - video capabilities provided by libSDL2 (Simple Directmedia Layer)
|
||||||
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/sim_ws.c
|
DISPLAYL = ${DISPLAYD}/display.c $(DISPLAYD)/sim_ws.c
|
||||||
DISPLAYVT = ${DISPLAYD}/vt11.c
|
DISPLAYVT = ${DISPLAYD}/vt11.c
|
||||||
|
DISPLAY340 = ${DISPLAYD}/type340.c
|
||||||
|
DISPLAYNG = ${DISPLAYD}/ng.c
|
||||||
DISPLAY_OPT += -DUSE_DISPLAY $(VIDEO_CCDEFS) $(VIDEO_LDFLAGS)
|
DISPLAY_OPT += -DUSE_DISPLAY $(VIDEO_CCDEFS) $(VIDEO_LDFLAGS)
|
||||||
else
|
else
|
||||||
$(info ***********************************************************************)
|
$(info ***********************************************************************)
|
||||||
|
|
26
sim_video.c
26
sim_video.c
|
@ -104,6 +104,7 @@ static char tmp_key_name[40];
|
||||||
*/
|
*/
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
#define SUCCESS 0
|
#define SUCCESS 0
|
||||||
#define ERROR -1
|
#define ERROR -1
|
||||||
|
@ -1835,7 +1836,7 @@ return 0;
|
||||||
|
|
||||||
const char *vid_version(void)
|
const char *vid_version(void)
|
||||||
{
|
{
|
||||||
static char SDLVersion[80];
|
static char SDLVersion[160];
|
||||||
SDL_version compiled, running;
|
SDL_version compiled, running;
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
|
@ -1848,15 +1849,34 @@ SDL_GetVersion(&running);
|
||||||
#endif
|
#endif
|
||||||
SDL_VERSION(&compiled);
|
SDL_VERSION(&compiled);
|
||||||
|
|
||||||
|
SDLVersion[sizeof (SDLVersion) - 1] = '\0';
|
||||||
if ((compiled.major == running.major) &&
|
if ((compiled.major == running.major) &&
|
||||||
(compiled.minor == running.minor) &&
|
(compiled.minor == running.minor) &&
|
||||||
(compiled.patch == running.patch))
|
(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);
|
compiled.major, compiled.minor, compiled.patch);
|
||||||
else
|
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,
|
compiled.major, compiled.minor, compiled.patch,
|
||||||
running.major, running.minor, running.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;
|
return (const char *)SDLVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue