From 85c63fc98b44a25330032dd55add65341966412c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 16 Feb 2011 18:35:26 +0100 Subject: Make -lcurl optional (enabled by default), rework feature en-/disabling --- config.mk | 37 ++++++++++++++++++++++++++++--------- man/Makefile | 3 +++ man/feh.pre | 3 +++ src/imlib.c | 7 +++++++ 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/config.mk b/config.mk index ff522d7..a563c24 100644 --- a/config.mk +++ b/config.mk @@ -17,18 +17,37 @@ example_dir = ${main_dir}/share/doc/feh/examples CFLAGS ?= -g -O2 CFLAGS += -Wall -Wextra -pedantic -# Comment these out if you don't have libxinerama -xinerama = -DHAVE_LIBXINERAMA -xinerama_ld = -lXinerama - -# Uncomment this for debug mode -# (Use feh -+ or feh --debug to see debug output) -#CFLAGS += -DDEBUG +curl ?= 1 +debug ?= 0 +xinerama ?= 1 + +ifeq (${curl},1) + CFLAGS += -DHAVE_LIBCURL + LDLIBS += -lcurl + MAN_CURL = enabled +else + MAN_CURL = disabled +endif + +ifeq (${debug},1) + CFLAGS += -DDEBUG + MAN_DEBUG = This is a debug build. +else + MAN_DEBUG = +endif + +ifeq (${xinerama},1) + CFLAGS += -DHAVE_LIBXINERAMA + LDLIBS += -lXinerama + MAN_XINERAMA = enabled +else + MAN_XINERAMA = disabled +endif # Uncomment this to use dmalloc #CFLAGS += -DWITH_DMALLOC -CFLAGS += ${xinerama} -DPREFIX=\"${PREFIX}\" \ +CFLAGS += -DPREFIX=\"${PREFIX}\" \ -DPACKAGE=\"${PACKAGE}\" -DVERSION=\"${VERSION}\" -LDLIBS += -lm -lpng -lX11 -lImlib2 -lgiblib -lcurl ${xinerama_ld} +LDLIBS += -lm -lpng -lX11 -lImlib2 -lgiblib diff --git a/man/Makefile b/man/Makefile index 293d2b7..f03b9d7 100644 --- a/man/Makefile +++ b/man/Makefile @@ -9,6 +9,9 @@ all: ${TARGETS} sed \ -e 's/\$$VERSION\$$/${VERSION}/g' \ -e 's/\$$DATE\$$/'"$$(date '+%B %d, %Y')"/g \ + -e 's/\$$MAN_CURL\$$/${MAN_CURL}/' \ + -e 's/\$$MAN_DEBUG\$$/${MAN_DEBUG}/' \ + -e 's/\$$MAN_XINERAMA\$$/${MAN_XINERAMA}/' \ < ${@:.1=.pre} > $@ clean: diff --git a/man/feh.pre b/man/feh.pre index 099c545..95c5cc4 100644 --- a/man/feh.pre +++ b/man/feh.pre @@ -19,6 +19,9 @@ .Sh VERSION . This manual documents feh $VERSION$ +.Pp +Compile-time switches: libcurl support $MAN_CURL$, Xinerama support +$MAN_XINERAMA$. $MAN_DEBUG$ . . .Sh DESCRIPTION diff --git a/src/imlib.c b/src/imlib.c index cc538dd..b125585 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -440,6 +440,7 @@ char *feh_http_load_image(char *url) } /* while read */ close(sockno); fclose(fp); +#ifdef HAVE_LIBCURL } else { CURL *curl; CURLcode res; @@ -492,6 +493,12 @@ char *feh_http_load_image(char *url) curl_easy_cleanup(curl); return NULL; } +#else + } else { + weprintf("Please compile feh with curl=1 to enable http support"); + return NULL; + } +#endif return(tmpname); } -- cgit v1.2.3