mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-15 21:45:54 +01:00
configure: Created new macro to perform the repetitive part of Library check
There are a number of steps in the library check procedure that are a bit repetitive, and have been placed into the macro WM_LIB_CHECK to make the code simpler to write. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
da597a4b87
commit
64a95b73c3
@@ -92,23 +92,8 @@ AM_CONDITIONAL([USE_GIF], [test "x$enable_gif" != "xno"])dnl
|
||||
# the variable 'supported_gfx'
|
||||
# When not found, append info to variable 'unsupported'
|
||||
AC_DEFUN_ONCE([WM_IMGFMT_CHECK_JPEG],
|
||||
[AC_REQUIRE([_WM_LIB_CHECK_FUNCTS])
|
||||
AS_IF([test "x$enable_jpeg" = "xno"],
|
||||
[unsupported="$unsupported JPEG"],
|
||||
[AC_CACHE_CHECK([for JPEG support library], [wm_cv_imgfmt_jpeg],
|
||||
[wm_cv_imgfmt_jpeg=no
|
||||
wm_save_LIBS="$LIBS"
|
||||
dnl
|
||||
dnl We check first if one of the known libraries is available
|
||||
AS_IF([wm_fn_lib_try_link "jpeg_destroy_compress" "$XLFLAGS $XLIBS -ljpeg"],
|
||||
[wm_cv_imgfmt_jpeg="-ljpeg"])
|
||||
LIBS="$wm_save_LIBS"
|
||||
AS_IF([test "x$enable_jpeg$wm_cv_imgfmt_jpeg" = "xyesno"],
|
||||
[AC_MSG_ERROR([explicit JPEG support requested but no library found])])
|
||||
AS_IF([test "x$wm_cv_imgfmt_jpeg" != "xno"],
|
||||
[dnl
|
||||
dnl A library was found, now check for the appropriate header
|
||||
AC_COMPILE_IFELSE(
|
||||
[WM_LIB_CHECK([JPEG], [-ljpeg], [jpeg_destroy_compress], [$XLFLAGS $XLIBS],
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[@%:@include <stdlib.h>
|
||||
@%:@include <stdio.h>
|
||||
@@ -118,21 +103,12 @@ AS_IF([test "x$enable_jpeg" = "xno"],
|
||||
jpeg_destroy_decompress(&cinfo);])],
|
||||
[],
|
||||
[AS_ECHO([failed])
|
||||
AS_ECHO(["$as_me: error: found $wm_cv_imgfmt_jpeg but cannot compile header"])
|
||||
AS_ECHO(["$as_me: error: found $CACHEVAR but cannot compile header"])
|
||||
AS_ECHO(["$as_me: error: - does header 'jpeglib.h' exists? (is package 'jpeg-dev' missing?)"])
|
||||
AS_ECHO(["$as_me: error: - version of header is not supported? (report to dev team)"])
|
||||
AC_MSG_ERROR([JPEG library is not usable, cannot continue])])
|
||||
])
|
||||
])
|
||||
AS_IF([test "x$wm_cv_imgfmt_jpeg" = "xno"],
|
||||
[unsupported="$unsupported JPEG"
|
||||
enable_jpeg="no"],
|
||||
[supported_gfx="$supported_gfx JPEG"
|
||||
WM_APPEND_ONCE([$wm_cv_imgfmt_jpeg], [GFXLIBS])
|
||||
AC_DEFINE([USE_JPEG], [1],
|
||||
[defined when valid JPEG library with header was found])])
|
||||
])
|
||||
AM_CONDITIONAL([USE_JPEG], [test "x$enable_jpeg" != "xno"])dnl
|
||||
],
|
||||
[supported_gfx], [GFXLIBS])dnl
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
|
||||
@@ -149,42 +125,16 @@ AM_CONDITIONAL([USE_JPEG], [test "x$enable_jpeg" != "xno"])dnl
|
||||
# the variable 'supported_gfx'
|
||||
# When not found, append info to variable 'unsupported'
|
||||
AC_DEFUN_ONCE([WM_IMGFMT_CHECK_PNG],
|
||||
[AC_REQUIRE([_WM_LIB_CHECK_FUNCTS])
|
||||
AS_IF([test "x$enable_png" = "xno"],
|
||||
[unsupported="$unsupported PNG"],
|
||||
[AC_CACHE_CHECK([for PNG support library], [wm_cv_imgfmt_png],
|
||||
[wm_cv_imgfmt_png=no
|
||||
dnl
|
||||
dnl We check first if one of the known libraries is available
|
||||
wm_save_LIBS="$LIBS"
|
||||
for wm_arg in "-lpng" "-lpng -lz" "-lpng -lz -lm" ; do
|
||||
AS_IF([wm_fn_lib_try_link "png_get_valid" "$XLFLAGS $XLIBS $wm_arg"],
|
||||
[wm_cv_imgfmt_png="$wm_arg" ; break])
|
||||
done
|
||||
LIBS="$wm_save_LIBS"
|
||||
AS_IF([test "x$enable_png$wm_cv_imgfmt_png" = "xyesno"],
|
||||
[AC_MSG_ERROR([explicit PNG support requested but no library found])])
|
||||
AS_IF([test "x$wm_cv_imgfmt_png" != "xno"],
|
||||
[dnl
|
||||
dnl A library was found, now check for the appropriate header
|
||||
wm_save_CFLAGS="$CFLAGS"
|
||||
AS_IF([wm_fn_lib_try_compile "png.h" "" "return 0" ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $wm_cv_imgfmt_png but could not find appropriate header - are you missing libpng-dev package?])])
|
||||
AS_IF([wm_fn_lib_try_compile "png.h" "" "png_get_valid(NULL, NULL, PNG_INFO_tRNS)" ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $wm_cv_imgfmt_png and header, but cannot compile - unsupported version?])])
|
||||
CFLAGS="$wm_save_CFLAGS"])
|
||||
])
|
||||
AS_IF([test "x$wm_cv_imgfmt_png" = "xno"],
|
||||
[unsupported="$unsupported PNG"
|
||||
enable_png="no"],
|
||||
[supported_gfx="$supported_gfx PNG"
|
||||
WM_APPEND_ONCE([$wm_cv_imgfmt_png], [GFXLIBS])
|
||||
AC_DEFINE([USE_PNG], [1],
|
||||
[defined when valid PNG library with header was found])])
|
||||
])
|
||||
AM_CONDITIONAL([USE_PNG], [test "x$enable_png" != "xno"])dnl
|
||||
[WM_LIB_CHECK([PNG], ["-lpng" "-lpng -lz" "-lpng -lz -lm"], [png_get_valid], [$XLFLAGS $XLIBS],
|
||||
[wm_save_CFLAGS="$CFLAGS"
|
||||
AS_IF([wm_fn_lib_try_compile "png.h" "" "return 0" ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $CACHEVAR but could not find appropriate header - are you missing libpng-dev package?])])
|
||||
AS_IF([wm_fn_lib_try_compile "png.h" "" "png_get_valid(NULL, NULL, PNG_INFO_tRNS)" ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $CACHEVAR and header, but cannot compile - unsupported version?])])
|
||||
CFLAGS="$wm_save_CFLAGS"],
|
||||
[supported_gfx], [GFXLIBS])dnl
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
|
||||
@@ -201,50 +151,26 @@ AM_CONDITIONAL([USE_PNG], [test "x$enable_png" != "xno"])dnl
|
||||
# the variable 'supported_gfx'
|
||||
# When not found, append info to variable 'unsupported'
|
||||
AC_DEFUN_ONCE([WM_IMGFMT_CHECK_TIFF],
|
||||
[AC_REQUIRE([_WM_LIB_CHECK_FUNCTS])
|
||||
AS_IF([test "x$enable_tiff" = "xno"],
|
||||
[unsupported="$unsupported TIFF"],
|
||||
[AC_CACHE_CHECK([for TIFF support library], [wm_cv_imgfmt_tiff],
|
||||
[wm_cv_imgfmt_tiff=no
|
||||
dnl
|
||||
dnl We check first if one of the known libraries is available
|
||||
wm_save_LIBS="$LIBS"
|
||||
for wm_arg in "-ltiff" \
|
||||
dnl TIFF can have a dependancy over zlib
|
||||
"-ltiff -lz" "-ltiff -lz -lm" \
|
||||
dnl It may also have a dependancy to jpeg_lib
|
||||
"-ltiff -ljpeg" "-ltiff -ljpeg -lz" "-ltiff -ljpeg -lz -lm" \
|
||||
dnl There is also a possible dependancy on JBIGKit
|
||||
"-ltiff -ljpeg -ljbig -lz" \
|
||||
dnl Probably for historical reasons?
|
||||
"-ltiff34" "-ltiff34 -ljpeg" "-ltiff34 -ljpeg -lm" ; do
|
||||
AS_IF([wm_fn_lib_try_link "TIFFGetVersion" "$XLFLAGS $XLIBS $wm_arg"],
|
||||
[wm_cv_imgfmt_tiff="$wm_arg" ; break])
|
||||
done
|
||||
LIBS="$wm_save_LIBS"
|
||||
AS_IF([test "x$enable_tiff$wm_cv_imgfmt_tiff" = "xyesno"],
|
||||
[AC_MSG_ERROR([explicit TIFF support requested but no library found])])
|
||||
AS_IF([test "x$wm_cv_imgfmt_tiff" != "xno"],
|
||||
[dnl
|
||||
dnl A library was found, now check for the appropriate header
|
||||
wm_save_CFLAGS="$CFLAGS"
|
||||
AS_IF([wm_fn_lib_try_compile "tiffio.h" "" "return 0" ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $wm_cv_imgfmt_tiff but could not find appropriate header - are you missing libtiff-dev package?])])
|
||||
AS_IF([wm_fn_lib_try_compile "tiffio.h" 'const char *filename = "dummy";' 'TIFFOpen(filename, "r")' ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $wm_cv_imgfmt_tiff and header, but cannot compile - unsupported version?])])
|
||||
CFLAGS="$wm_save_CFLAGS"])
|
||||
])
|
||||
AS_IF([test "x$wm_cv_imgfmt_tiff" = "xno"],
|
||||
[unsupported="$unsupported TIFF"
|
||||
enable_tiff="no"],
|
||||
[supported_gfx="$supported_gfx TIFF"
|
||||
WM_APPEND_ONCE([$wm_cv_imgfmt_tiff], [GFXLIBS])
|
||||
AC_DEFINE([USE_TIFF], [1],
|
||||
[defined when valid TIFF library with header was found])])
|
||||
])
|
||||
AM_CONDITIONAL([USE_TIFF], [test "x$enable_tiff" != "xno"])dnl
|
||||
[WM_LIB_CHECK([TIFF],
|
||||
["-ltiff" \
|
||||
dnl TIFF can have a dependancy over zlib
|
||||
"-ltiff -lz" "-ltiff -lz -lm" \
|
||||
dnl It may also have a dependancy to jpeg_lib
|
||||
"-ltiff -ljpeg" "-ltiff -ljpeg -lz" "-ltiff -ljpeg -lz -lm" \
|
||||
dnl There is also a possible dependancy on JBIGKit
|
||||
"-ltiff -ljpeg -ljbig -lz" \
|
||||
dnl Probably for historical reasons?
|
||||
"-ltiff34" "-ltiff34 -ljpeg" "-ltiff34 -ljpeg -lm"],
|
||||
[TIFFGetVersion], [$XLFLAGS $XLIBS],
|
||||
[wm_save_CFLAGS="$CFLAGS"
|
||||
AS_IF([wm_fn_lib_try_compile "tiffio.h" "" "return 0" ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $CACHEVAR but could not find appropriate header - are you missing libtiff-dev package?])])
|
||||
AS_IF([wm_fn_lib_try_compile "tiffio.h" 'const char *filename = "dummy";' 'TIFFOpen(filename, "r")' ""],
|
||||
[],
|
||||
[AC_MSG_ERROR([found $CACHEVAR and header, but cannot compile - unsupported version?])])
|
||||
CFLAGS="$wm_save_CFLAGS"],
|
||||
[supported_gfx], [GFXLIBS])dnl
|
||||
]) dnl AC_DEFUN
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user