mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
configure.ac: add some helper macros
library check related variable maintenance -> *_INCLUDES / *_LIBS
CLEAR_LIBVARS / LIBCHECK_PROLOGUE / LIBCHECK_EPILOGUE
Change-Id: I72e292dc1f69b02f69a26639308f247db0471e2b
(cherry picked from commit 4ef1447792
)
This commit is contained in:
parent
980e7ae951
commit
b8307cc08b
82
configure.ac
82
configure.ac
@ -19,6 +19,10 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR],
|
|||||||
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
|
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
|
||||||
AC_SUBST([pkgconfigdir])
|
AC_SUBST([pkgconfigdir])
|
||||||
|
|
||||||
|
dnl === CLEAR_LIBVARS([var_pfx])
|
||||||
|
dnl === Clears <var_pfx>_{INCLUDES,LIBS}.
|
||||||
|
AC_DEFUN([CLEAR_LIBVARS], [$1_INCLUDES=""; $1_LIBS=""])
|
||||||
|
|
||||||
dnl === WITHLIB_OPTION([opt_pfx], [outvar_pfx])
|
dnl === WITHLIB_OPTION([opt_pfx], [outvar_pfx])
|
||||||
dnl === Defines --with-<opt_pfx>{include,lib}dir options which set
|
dnl === Defines --with-<opt_pfx>{include,lib}dir options which set
|
||||||
dnl === the variables <outvar_pfx>_{INCLUDES,LIBS}.
|
dnl === the variables <outvar_pfx>_{INCLUDES,LIBS}.
|
||||||
@ -32,6 +36,24 @@ AC_DEFUN([WITHLIB_OPTION],
|
|||||||
[use $2 libraries from DIR]),
|
[use $2 libraries from DIR]),
|
||||||
[$2_LIBS="-L$withval"])])
|
[$2_LIBS="-L$withval"])])
|
||||||
|
|
||||||
|
dnl === LIBCHECK_PROLOGUE([var_pfx])
|
||||||
|
dnl === Caches the current values of CPPFLAGS/LIBS in SAVED_* then
|
||||||
|
dnl === prepends the current values with <var_pfx>_{INCLUDES,LIBS}.
|
||||||
|
AC_DEFUN([LIBCHECK_PROLOGUE],
|
||||||
|
[SAVED_CPPFLAGS=$CPPFLAGS
|
||||||
|
SAVED_LIBS=$LIBS
|
||||||
|
CPPFLAGS="$$1_INCLUDES $CPPFLAGS"
|
||||||
|
LIBS="$$1_LIBS $LIBS"])
|
||||||
|
|
||||||
|
dnl === LIBCHECK_EPILOGUE([var_pfx])
|
||||||
|
dnl === Restores the values of CPPFLAGS/LIBS from SAVED_* and exports
|
||||||
|
dnl === <var_pfx>_{INCLUDES,LIBS} with AC_SUBST.
|
||||||
|
AC_DEFUN([LIBCHECK_EPILOGUE],
|
||||||
|
[AC_SUBST($1_LIBS)
|
||||||
|
AC_SUBST($1_INCLUDES)
|
||||||
|
CPPFLAGS=$SAVED_CPPFLAGS
|
||||||
|
LIBS=$SAVED_LIBS])
|
||||||
|
|
||||||
dnl === Check for pthread support
|
dnl === Check for pthread support
|
||||||
AC_ARG_ENABLE([threading],
|
AC_ARG_ENABLE([threading],
|
||||||
AS_HELP_STRING([--disable-threading],
|
AS_HELP_STRING([--disable-threading],
|
||||||
@ -51,8 +73,7 @@ AC_MSG_NOTICE([checking if threading is enabled... ${enable_threading-no}])
|
|||||||
|
|
||||||
dnl === check for PNG support ===
|
dnl === check for PNG support ===
|
||||||
|
|
||||||
PNG_INCLUDES=""
|
CLEAR_LIBVARS([PNG])
|
||||||
PNG_LIBS=""
|
|
||||||
AC_PATH_PROGS(LIBPNG_CONFIG,
|
AC_PATH_PROGS(LIBPNG_CONFIG,
|
||||||
[libpng-config libpng15-config libpng14-config libpng12-config])
|
[libpng-config libpng15-config libpng14-config libpng12-config])
|
||||||
if test -n "$LIBPNG_CONFIG"; then
|
if test -n "$LIBPNG_CONFIG"; then
|
||||||
@ -66,11 +87,7 @@ fi
|
|||||||
|
|
||||||
WITHLIB_OPTION([png], [PNG])
|
WITHLIB_OPTION([png], [PNG])
|
||||||
|
|
||||||
SAVED_CPPFLAGS=$CPPFLAGS
|
LIBCHECK_PROLOGUE([PNG])
|
||||||
SAVED_LIBS=$LIBS
|
|
||||||
CPPFLAGS="$PNG_INCLUDES $CPPFLAGS"
|
|
||||||
LIBS="$PNG_LIBS $LIBS"
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(png.h,
|
AC_CHECK_HEADER(png.h,
|
||||||
AC_SEARCH_LIBS(png_get_libpng_ver, [png],
|
AC_SEARCH_LIBS(png_get_libpng_ver, [png],
|
||||||
[test "$ac_cv_search_png_get_libpng_ver" = "none required" \
|
[test "$ac_cv_search_png_get_libpng_ver" = "none required" \
|
||||||
@ -90,23 +107,14 @@ AC_CHECK_HEADER(png.h,
|
|||||||
PNG_INCLUDES=""
|
PNG_INCLUDES=""
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
AC_SUBST(PNG_LIBS)
|
LIBCHECK_EPILOGUE([PNG])
|
||||||
AC_SUBST(PNG_INCLUDES)
|
|
||||||
|
|
||||||
CPPFLAGS=$SAVED_CPPFLAGS
|
|
||||||
LIBS=$SAVED_LIBS
|
|
||||||
|
|
||||||
dnl === check for JPEG support ===
|
dnl === check for JPEG support ===
|
||||||
|
|
||||||
JPEG_INCLUDES=""
|
CLEAR_LIBVARS([JPEG])
|
||||||
JPEG_LIBS=""
|
|
||||||
WITHLIB_OPTION([jpeg], [JPEG])
|
WITHLIB_OPTION([jpeg], [JPEG])
|
||||||
|
|
||||||
SAVED_CPPFLAGS=$CPPFLAGS
|
LIBCHECK_PROLOGUE([JPEG])
|
||||||
SAVED_LIBS=$LIBS
|
|
||||||
CPPFLAGS="$JPEG_INCLUDES $CPPFLAGS"
|
|
||||||
LIBS="$JPEG_LIBS $LIBS"
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(jpeglib.h,
|
AC_CHECK_HEADER(jpeglib.h,
|
||||||
AC_CHECK_LIB(jpeg, jpeg_set_defaults,
|
AC_CHECK_LIB(jpeg, jpeg_set_defaults,
|
||||||
[JPEG_LIBS="$JPEG_LIBS -ljpeg"
|
[JPEG_LIBS="$JPEG_LIBS -ljpeg"
|
||||||
@ -119,23 +127,14 @@ AC_CHECK_HEADER(jpeglib.h,
|
|||||||
[$MATH_LIBS]),
|
[$MATH_LIBS]),
|
||||||
AC_MSG_WARN(jpeg library not available - no jpeglib.h)
|
AC_MSG_WARN(jpeg library not available - no jpeglib.h)
|
||||||
)
|
)
|
||||||
AC_SUBST(JPEG_LIBS)
|
LIBCHECK_EPILOGUE([JPEG])
|
||||||
AC_SUBST(JPEG_INCLUDES)
|
|
||||||
|
|
||||||
CPPFLAGS=$SAVED_CPPFLAGS
|
|
||||||
LIBS=$SAVED_LIBS
|
|
||||||
|
|
||||||
dnl === check for TIFF support ===
|
dnl === check for TIFF support ===
|
||||||
|
|
||||||
TIFF_INCLUDES=""
|
CLEAR_LIBVARS([TIFF])
|
||||||
TIFF_LIBS=""
|
|
||||||
WITHLIB_OPTION([tiff], [TIFF])
|
WITHLIB_OPTION([tiff], [TIFF])
|
||||||
|
|
||||||
SAVED_CPPFLAGS=$CPPFLAGS
|
LIBCHECK_PROLOGUE([TIFF])
|
||||||
SAVED_LIBS=$LIBS
|
|
||||||
CPPFLAGS="$TIFF_INCLUDES $CPPFLAGS"
|
|
||||||
LIBS="$TIFF_LIBS $LIBS"
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(tiffio.h,
|
AC_CHECK_HEADER(tiffio.h,
|
||||||
AC_CHECK_LIB(tiff, TIFFGetVersion,
|
AC_CHECK_LIB(tiff, TIFFGetVersion,
|
||||||
[TIFF_LIBS="$TIFF_LIBS -ltiff"
|
[TIFF_LIBS="$TIFF_LIBS -ltiff"
|
||||||
@ -148,23 +147,14 @@ AC_CHECK_HEADER(tiffio.h,
|
|||||||
[$MATH_LIBS]),
|
[$MATH_LIBS]),
|
||||||
AC_MSG_WARN(tiff library not available - no tiffio.h)
|
AC_MSG_WARN(tiff library not available - no tiffio.h)
|
||||||
)
|
)
|
||||||
AC_SUBST(TIFF_LIBS)
|
LIBCHECK_EPILOGUE([TIFF])
|
||||||
AC_SUBST(TIFF_INCLUDES)
|
|
||||||
|
|
||||||
CPPFLAGS=$SAVED_CPPFLAGS
|
|
||||||
LIBS=$SAVED_LIBS
|
|
||||||
|
|
||||||
dnl === check for GIF support ===
|
dnl === check for GIF support ===
|
||||||
|
|
||||||
GIF_INCLUDES=""
|
CLEAR_LIBVARS([GIF])
|
||||||
GIF_LIBS=""
|
|
||||||
WITHLIB_OPTION([gif], [GIF])
|
WITHLIB_OPTION([gif], [GIF])
|
||||||
|
|
||||||
SAVED_CPPFLAGS=$CPPFLAGS
|
LIBCHECK_PROLOGUE([GIF])
|
||||||
SAVED_LIBS=$LIBS
|
|
||||||
CPPFLAGS="$GIF_INCLUDES $CPPFLAGS"
|
|
||||||
LIBS="$GIF_LIBS $LIBS"
|
|
||||||
|
|
||||||
AC_CHECK_HEADER(gif_lib.h,
|
AC_CHECK_HEADER(gif_lib.h,
|
||||||
AC_CHECK_LIB([gif], [DGifOpenFileHandle],
|
AC_CHECK_LIB([gif], [DGifOpenFileHandle],
|
||||||
[GIF_LIBS="$GIF_LIBS -lgif"
|
[GIF_LIBS="$GIF_LIBS -lgif"
|
||||||
@ -174,11 +164,7 @@ AC_CHECK_HEADER(gif_lib.h,
|
|||||||
[$MATH_LIBS]),
|
[$MATH_LIBS]),
|
||||||
AC_MSG_WARN(gif library not available - no gif_lib.h)
|
AC_MSG_WARN(gif library not available - no gif_lib.h)
|
||||||
)
|
)
|
||||||
AC_SUBST(GIF_LIBS)
|
LIBCHECK_EPILOGUE([GIF])
|
||||||
AC_SUBST(GIF_INCLUDES)
|
|
||||||
|
|
||||||
CPPFLAGS=$SAVED_CPPFLAGS
|
|
||||||
LIBS=$SAVED_LIBS
|
|
||||||
|
|
||||||
if test "$gif_support" = "yes" -a \
|
if test "$gif_support" = "yes" -a \
|
||||||
"$enable_libwebpmux" = "yes"; then
|
"$enable_libwebpmux" = "yes"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user