Try to use pkg-config for detecting libtiff in configure
This is more reliable than checking whether we can link with the library manually and may work even if it's installed in a non-standard location. It also allows the user to specify PKG_CONFIG_PATH='pkg-config --static' when running configure to link with all transitional dependencies when linking statically. Closes https://github.com/wxWidgets/wxWidgets/pull/1073 See #18293.
This commit is contained in:
62
configure.in
62
configure.in
@@ -2612,35 +2612,47 @@ dnl Check for tiff library
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
TIFF_LINK=
|
||||
TIFF_PREREQ_LINKS=-lm
|
||||
if test "$wxUSE_LIBTIFF" != "no" ; then
|
||||
AC_DEFINE(wxUSE_LIBTIFF)
|
||||
|
||||
if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
|
||||
dnl libtiff may depend on libjpeg and libz so use them in the test
|
||||
dnl below or it would fail
|
||||
if test "$wxUSE_LIBJPEG" = "sys"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
|
||||
fi
|
||||
if test "$wxUSE_ZLIB" = "sys"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
|
||||
fi
|
||||
if test -n "$LZMA_LINK"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $LZMA_LINK"
|
||||
fi
|
||||
if test "$wxUSE_LIBJBIG" = "yes"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JBIG_LINK"
|
||||
fi
|
||||
AC_CHECK_HEADER(tiffio.h,
|
||||
[
|
||||
AC_CHECK_LIB(tiff, TIFFError,
|
||||
TIFF_LINK=" -ltiff",
|
||||
,
|
||||
$TIFF_PREREQ_LINKS)
|
||||
],
|
||||
[],
|
||||
[ ]
|
||||
)
|
||||
dnl First try using pkg-config as it's the most reliable way to detect
|
||||
dnl libtiff.
|
||||
PKG_CHECK_MODULES(LIBTIFF, [libtiff-4],
|
||||
[
|
||||
TIFF_LINK=$LIBTIFF_LIBS
|
||||
CFLAGS="$LIBTIFF_CFLAGS $CFLAGS"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([not found via pkg-config])
|
||||
|
||||
TIFF_PREREQ_LINKS=-lm
|
||||
|
||||
dnl libtiff may depend on libjpeg and libz so use them in the test
|
||||
dnl below or it would fail
|
||||
if test "$wxUSE_LIBJPEG" = "sys"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
|
||||
fi
|
||||
if test "$wxUSE_ZLIB" = "sys"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
|
||||
fi
|
||||
if test -n "$LZMA_LINK"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $LZMA_LINK"
|
||||
fi
|
||||
if test "$wxUSE_LIBJBIG" = "yes"; then
|
||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JBIG_LINK"
|
||||
fi
|
||||
AC_CHECK_HEADER(tiffio.h,
|
||||
[
|
||||
AC_CHECK_LIB(tiff, TIFFError,
|
||||
TIFF_LINK=" -ltiff",
|
||||
,
|
||||
$TIFF_PREREQ_LINKS)
|
||||
],
|
||||
[],
|
||||
[ ]
|
||||
)
|
||||
])
|
||||
|
||||
if test "x$TIFF_LINK" = "x" ; then
|
||||
if test "$wxUSE_LIBTIFF" = "sys" ; then
|
||||
|
Reference in New Issue
Block a user