Added HAVE_GIFLIB macro for optional dependency on giflib
This commit is contained in:
parent
79bd86defb
commit
a4b90aee20
2
Makefile
2
Makefile
|
@ -5,7 +5,7 @@ VERSION = git-20110819
|
||||||
CC = gcc
|
CC = gcc
|
||||||
DESTDIR =
|
DESTDIR =
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
CFLAGS = -Wall -pedantic -O2 -DVERSION=\"$(VERSION)\"
|
CFLAGS = -Wall -pedantic -O2 -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
LIBS = -lX11 -lImlib2 -lgif
|
LIBS = -lX11 -lImlib2 -lgif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.include "Makefile"
|
.include "Makefile"
|
||||||
|
|
||||||
CFLAGS = -Wall -pedantic -DVERSION=\"$(VERSION)\" -I/usr/X11R7/include -I/usr/pkg/include
|
CFLAGS = -Wall -pedantic -O2 -DVERSION=\"$(VERSION)\" -DHAVE_GIFLIB -I/usr/X11R7/include -I/usr/pkg/include
|
||||||
LDFLAGS = -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
|
LDFLAGS = -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
|
||||||
|
|
12
image.c
12
image.c
|
@ -18,11 +18,14 @@
|
||||||
|
|
||||||
#define _IMAGE_CONFIG
|
#define _IMAGE_CONFIG
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GIFLIB
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <gif_lib.h>
|
#include <gif_lib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -55,6 +58,7 @@ void img_init(img_t *img, win_t *win) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GIFLIB
|
||||||
int img_load_gif(img_t *img, const fileinfo_t *file) {
|
int img_load_gif(img_t *img, const fileinfo_t *file) {
|
||||||
GifFileType *gif;
|
GifFileType *gif;
|
||||||
GifRowType *rows = NULL;
|
GifRowType *rows = NULL;
|
||||||
|
@ -208,6 +212,7 @@ int img_load_gif(img_t *img, const fileinfo_t *file) {
|
||||||
|
|
||||||
return !err;
|
return !err;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_GIFLIB */
|
||||||
|
|
||||||
int img_load(img_t *img, const fileinfo_t *file) {
|
int img_load(img_t *img, const fileinfo_t *file) {
|
||||||
const char *fmt;
|
const char *fmt;
|
||||||
|
@ -225,8 +230,13 @@ int img_load(img_t *img, const fileinfo_t *file) {
|
||||||
imlib_context_set_anti_alias(img->aa);
|
imlib_context_set_anti_alias(img->aa);
|
||||||
|
|
||||||
fmt = imlib_image_format();
|
fmt = imlib_image_format();
|
||||||
|
#ifdef HAVE_GIFLIB
|
||||||
if (!strcmp(fmt, "gif"))
|
if (!strcmp(fmt, "gif"))
|
||||||
img_load_gif(img, file);
|
img_load_gif(img, file);
|
||||||
|
#else
|
||||||
|
/* avoid unused-but-set-variable warning */
|
||||||
|
(void) fmt;
|
||||||
|
#endif
|
||||||
|
|
||||||
img->scalemode = options->scalemode;
|
img->scalemode = options->scalemode;
|
||||||
img->re = 0;
|
img->re = 0;
|
||||||
|
|
Loading…
Reference in a new issue