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:
180
configure
vendored
180
configure
vendored
@@ -977,6 +977,8 @@ GTK_CONFIG
|
|||||||
GTK_LIBS
|
GTK_LIBS
|
||||||
GTK_CFLAGS
|
GTK_CFLAGS
|
||||||
subdirs
|
subdirs
|
||||||
|
LIBTIFF_LIBS
|
||||||
|
LIBTIFF_CFLAGS
|
||||||
PKG_CONFIG
|
PKG_CONFIG
|
||||||
AR
|
AR
|
||||||
HAVE_CXX17
|
HAVE_CXX17
|
||||||
@@ -1364,6 +1366,8 @@ CXX
|
|||||||
CXXFLAGS
|
CXXFLAGS
|
||||||
CCC
|
CCC
|
||||||
PKG_CONFIG
|
PKG_CONFIG
|
||||||
|
LIBTIFF_CFLAGS
|
||||||
|
LIBTIFF_LIBS
|
||||||
DIRECTFB_CFLAGS
|
DIRECTFB_CFLAGS
|
||||||
DIRECTFB_LIBS
|
DIRECTFB_LIBS
|
||||||
XMKMF
|
XMKMF
|
||||||
@@ -2349,6 +2353,10 @@ Some influential environment variables:
|
|||||||
CXX C++ compiler command
|
CXX C++ compiler command
|
||||||
CXXFLAGS C++ compiler flags
|
CXXFLAGS C++ compiler flags
|
||||||
PKG_CONFIG path to pkg-config utility
|
PKG_CONFIG path to pkg-config utility
|
||||||
|
LIBTIFF_CFLAGS
|
||||||
|
C compiler flags for LIBTIFF, overriding pkg-config
|
||||||
|
LIBTIFF_LIBS
|
||||||
|
linker flags for LIBTIFF, overriding pkg-config
|
||||||
DIRECTFB_CFLAGS
|
DIRECTFB_CFLAGS
|
||||||
C compiler flags for DIRECTFB, overriding pkg-config
|
C compiler flags for DIRECTFB, overriding pkg-config
|
||||||
DIRECTFB_LIBS
|
DIRECTFB_LIBS
|
||||||
@@ -23429,30 +23437,94 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
TIFF_LINK=
|
TIFF_LINK=
|
||||||
TIFF_PREREQ_LINKS=-lm
|
|
||||||
if test "$wxUSE_LIBTIFF" != "no" ; then
|
if test "$wxUSE_LIBTIFF" != "no" ; then
|
||||||
$as_echo "#define wxUSE_LIBTIFF 1" >>confdefs.h
|
$as_echo "#define wxUSE_LIBTIFF 1" >>confdefs.h
|
||||||
|
|
||||||
|
|
||||||
if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
|
if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
|
||||||
if test "$wxUSE_LIBJPEG" = "sys"; then
|
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
|
pkg_failed=no
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBTIFF" >&5
|
||||||
|
$as_echo_n "checking for LIBTIFF... " >&6; }
|
||||||
|
|
||||||
|
if test -n "$PKG_CONFIG"; then
|
||||||
|
if test -n "$LIBTIFF_CFLAGS"; then
|
||||||
|
pkg_cv_LIBTIFF_CFLAGS="$LIBTIFF_CFLAGS"
|
||||||
|
else
|
||||||
|
if test -n "$PKG_CONFIG" && \
|
||||||
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtiff-4\""; } >&5
|
||||||
|
($PKG_CONFIG --exists --print-errors "libtiff-4") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; then
|
||||||
|
pkg_cv_LIBTIFF_CFLAGS=`$PKG_CONFIG --cflags "libtiff-4" 2>/dev/null`
|
||||||
|
else
|
||||||
|
pkg_failed=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pkg_failed=untried
|
||||||
|
fi
|
||||||
|
if test -n "$PKG_CONFIG"; then
|
||||||
|
if test -n "$LIBTIFF_LIBS"; then
|
||||||
|
pkg_cv_LIBTIFF_LIBS="$LIBTIFF_LIBS"
|
||||||
|
else
|
||||||
|
if test -n "$PKG_CONFIG" && \
|
||||||
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libtiff-4\""; } >&5
|
||||||
|
($PKG_CONFIG --exists --print-errors "libtiff-4") 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; then
|
||||||
|
pkg_cv_LIBTIFF_LIBS=`$PKG_CONFIG --libs "libtiff-4" 2>/dev/null`
|
||||||
|
else
|
||||||
|
pkg_failed=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
pkg_failed=untried
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if test $pkg_failed = yes; then
|
||||||
|
|
||||||
|
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||||
|
_pkg_short_errors_supported=yes
|
||||||
|
else
|
||||||
|
_pkg_short_errors_supported=no
|
||||||
|
fi
|
||||||
|
if test $_pkg_short_errors_supported = yes; then
|
||||||
|
LIBTIFF_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libtiff-4"`
|
||||||
|
else
|
||||||
|
LIBTIFF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libtiff-4"`
|
||||||
fi
|
fi
|
||||||
if test "$wxUSE_ZLIB" = "sys"; then
|
# Put the nasty error message in config.log where it belongs
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
|
echo "$LIBTIFF_PKG_ERRORS" >&5
|
||||||
fi
|
|
||||||
if test -n "$LZMA_LINK"; then
|
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $LZMA_LINK"
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found via pkg-config" >&5
|
||||||
fi
|
$as_echo "not found via pkg-config" >&6; }
|
||||||
if test "$wxUSE_LIBJBIG" = "yes"; then
|
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JBIG_LINK"
|
TIFF_PREREQ_LINKS=-lm
|
||||||
fi
|
|
||||||
ac_fn_c_check_header_compile "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "
|
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_fn_c_check_header_compile "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "
|
||||||
|
|
||||||
"
|
"
|
||||||
if test "x$ac_cv_header_tiffio_h" = xyes; then :
|
if test "x$ac_cv_header_tiffio_h" = xyes; then :
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFError in -ltiff" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFError in -ltiff" >&5
|
||||||
$as_echo_n "checking for TIFFError in -ltiff... " >&6; }
|
$as_echo_n "checking for TIFFError in -ltiff... " >&6; }
|
||||||
if ${ac_cv_lib_tiff_TIFFError+:} false; then :
|
if ${ac_cv_lib_tiff_TIFFError+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
@@ -23497,6 +23569,86 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
elif test $pkg_failed = untried; then
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found via pkg-config" >&5
|
||||||
|
$as_echo "not found via pkg-config" >&6; }
|
||||||
|
|
||||||
|
TIFF_PREREQ_LINKS=-lm
|
||||||
|
|
||||||
|
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_fn_c_check_header_compile "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "
|
||||||
|
|
||||||
|
"
|
||||||
|
if test "x$ac_cv_header_tiffio_h" = xyes; then :
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFError in -ltiff" >&5
|
||||||
|
$as_echo_n "checking for TIFFError in -ltiff... " >&6; }
|
||||||
|
if ${ac_cv_lib_tiff_TIFFError+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-ltiff $TIFF_PREREQ_LINKS $LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
char TIFFError ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return TIFFError ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_lib_tiff_TIFFError=yes
|
||||||
|
else
|
||||||
|
ac_cv_lib_tiff_TIFFError=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFError" >&5
|
||||||
|
$as_echo "$ac_cv_lib_tiff_TIFFError" >&6; }
|
||||||
|
if test "x$ac_cv_lib_tiff_TIFFError" = xyes; then :
|
||||||
|
TIFF_LINK=" -ltiff"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
LIBTIFF_CFLAGS=$pkg_cv_LIBTIFF_CFLAGS
|
||||||
|
LIBTIFF_LIBS=$pkg_cv_LIBTIFF_LIBS
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
|
||||||
|
TIFF_LINK=$LIBTIFF_LIBS
|
||||||
|
CFLAGS="$LIBTIFF_CFLAGS $CFLAGS"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$TIFF_LINK" = "x" ; then
|
if test "x$TIFF_LINK" = "x" ; then
|
||||||
if test "$wxUSE_LIBTIFF" = "sys" ; then
|
if test "$wxUSE_LIBTIFF" = "sys" ; then
|
||||||
as_fn_error $? "system tiff library not found! Use --with-libtiff=builtin to use built-in version" "$LINENO" 5
|
as_fn_error $? "system tiff library not found! Use --with-libtiff=builtin to use built-in version" "$LINENO" 5
|
||||||
|
62
configure.in
62
configure.in
@@ -2612,35 +2612,47 @@ dnl Check for tiff library
|
|||||||
dnl ------------------------------------------------------------------------
|
dnl ------------------------------------------------------------------------
|
||||||
|
|
||||||
TIFF_LINK=
|
TIFF_LINK=
|
||||||
TIFF_PREREQ_LINKS=-lm
|
|
||||||
if test "$wxUSE_LIBTIFF" != "no" ; then
|
if test "$wxUSE_LIBTIFF" != "no" ; then
|
||||||
AC_DEFINE(wxUSE_LIBTIFF)
|
AC_DEFINE(wxUSE_LIBTIFF)
|
||||||
|
|
||||||
if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
|
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 First try using pkg-config as it's the most reliable way to detect
|
||||||
dnl below or it would fail
|
dnl libtiff.
|
||||||
if test "$wxUSE_LIBJPEG" = "sys"; then
|
PKG_CHECK_MODULES(LIBTIFF, [libtiff-4],
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
|
[
|
||||||
fi
|
TIFF_LINK=$LIBTIFF_LIBS
|
||||||
if test "$wxUSE_ZLIB" = "sys"; then
|
CFLAGS="$LIBTIFF_CFLAGS $CFLAGS"
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
|
],
|
||||||
fi
|
[
|
||||||
if test -n "$LZMA_LINK"; then
|
AC_MSG_RESULT([not found via pkg-config])
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $LZMA_LINK"
|
|
||||||
fi
|
TIFF_PREREQ_LINKS=-lm
|
||||||
if test "$wxUSE_LIBJBIG" = "yes"; then
|
|
||||||
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JBIG_LINK"
|
dnl libtiff may depend on libjpeg and libz so use them in the test
|
||||||
fi
|
dnl below or it would fail
|
||||||
AC_CHECK_HEADER(tiffio.h,
|
if test "$wxUSE_LIBJPEG" = "sys"; then
|
||||||
[
|
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $JPEG_LINK"
|
||||||
AC_CHECK_LIB(tiff, TIFFError,
|
fi
|
||||||
TIFF_LINK=" -ltiff",
|
if test "$wxUSE_ZLIB" = "sys"; then
|
||||||
,
|
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
|
||||||
$TIFF_PREREQ_LINKS)
|
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 "x$TIFF_LINK" = "x" ; then
|
||||||
if test "$wxUSE_LIBTIFF" = "sys" ; then
|
if test "$wxUSE_LIBTIFF" = "sys" ; then
|
||||||
|
Reference in New Issue
Block a user