From 7831acebe3b5e3a819e344a13a5d68c1526b363f Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 3 Nov 2013 13:08:10 +0100 Subject: [PATCH] wrlib: Use a Conditional for GIF in the makefile instead of #if in source The use of the conditionals provided by autotools provides a better result as they avoid unnecessary compilation. Signed-off-by: Christophe CURIS Signed-off-by: Carlos R. Mafra --- m4/wm_imgfmt_check.m4 | 3 ++- wrlib/Makefile.am | 6 ++++-- wrlib/gif.c | 4 ---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/m4/wm_imgfmt_check.m4 b/m4/wm_imgfmt_check.m4 index 8f7a3a83..1cbb212f 100644 --- a/m4/wm_imgfmt_check.m4 +++ b/m4/wm_imgfmt_check.m4 @@ -64,7 +64,8 @@ AS_IF([test "x$enable_gif" = "xno"], AC_DEFINE_UNQUOTED([USE_GIF], [1], [defined when valid GIF library with header was found])]) - ])dnl + ]) + AM_CONDITIONAL([USE_GIF], [test "x$enable_gif" != "xno"])dnl ]) dnl AC_DEFUN diff --git a/wrlib/Makefile.am b/wrlib/Makefile.am index c98a60ff..dc379a12 100644 --- a/wrlib/Makefile.am +++ b/wrlib/Makefile.am @@ -40,9 +40,11 @@ libwraster_la_SOURCES = \ ppm.c \ png.c \ jpeg.c \ - tiff.c \ - gif.c + tiff.c +if USE_GIF +libwraster_la_SOURCES += gif.c +endif LTCOMPILE2=`echo $(LTCOMPILE) | sed -e s/-fomit-frame-pointer//` COMPILE2=`echo $(COMPILE) | sed -e s/-fomit-frame-pointer//` diff --git a/wrlib/gif.c b/wrlib/gif.c index ebd87296..e1b1a732 100644 --- a/wrlib/gif.c +++ b/wrlib/gif.c @@ -22,8 +22,6 @@ #include -#ifdef USE_GIF - #include #include #include @@ -209,5 +207,3 @@ RImage *RLoadGIF(const char *file, int index) return image; } - -#endif /* USE_GIF */