Check for liblzma headers in configure too and add wxUSE_LIBLZMA

Prepare for using liblzma in wxWidgets code by adding the necessary
option and updating the configure check for it (which had been already
present due to libtiff possible dependency on liblzma).

No real changes yet.
This commit is contained in:
Vadim Zeitlin 2018-03-29 00:26:38 +02:00
parent 677989bd8f
commit 311b2aee5f
12 changed files with 260 additions and 89 deletions

View File

@ -67,6 +67,12 @@ wx_add_thirdparty_library(wxUSE_LIBJPEG JPEG "use libjpeg (JPEG file format)")
wx_add_thirdparty_library(wxUSE_LIBPNG PNG "use libpng (PNG image format)")
wx_add_thirdparty_library(wxUSE_LIBTIFF TIFF "use libtiff (TIFF file format)")
wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF)
if(wxUSE_LIBLZMA)
find_package(LibLZMA REQUIRED)
endif()
set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression")
wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)")
if(NOT WIN32)

View File

@ -275,6 +275,8 @@
#cmakedefine01 wxUSE_ZLIB
#cmakedefine01 wxUSE_LIBLZMA
#cmakedefine01 wxUSE_APPLE_IEEE
#cmakedefine01 wxUSE_JOYSTICK

184
configure vendored
View File

@ -1092,7 +1092,6 @@ with_libpng
with_libjpeg
with_libtiff
with_libjbig
with_liblzma
with_libxpm
with_libiconv
with_libmspack
@ -1104,6 +1103,7 @@ with_xtest
with_dmalloc
with_sdl
with_regex
with_liblzma
with_zlib
with_expat
with_macosx_sdk
@ -2329,7 +2329,6 @@ Optional Packages:
--with-libjpeg use libjpeg (JPEG file format)
--with-libtiff use libtiff (TIFF file format)
--without-libjbig don't use libjbig in libtiff even if available)
--without-liblzma don't use liblzma in libtiff even if available)
--with-libxpm use libxpm (XPM file format)
--with-libiconv use libiconv (character conversion)
--with-libmspack use libmspack (CHM help files loading)
@ -2341,6 +2340,7 @@ Optional Packages:
--with-dmalloc use dmalloc library (http://dmalloc.com/)
--with-sdl use SDL for audio on Unix
--with-regex enable support for wxRegEx class
--with-liblzma use LZMA compression)
--with-zlib use zlib for LZW compression
--with-expat enable XML support using expat parser
--with-macosx-sdk=PATH use an OS X SDK at PATH
@ -3177,48 +3177,6 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_type
# ac_fn_cxx_try_run LINENO
# ------------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_cxx_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_run
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
@ -3309,6 +3267,48 @@ fi
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
# ac_fn_cxx_try_run LINENO
# ------------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_cxx_try_run ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
{ { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then :
ac_retval=0
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_cxx_try_run
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@ -4751,7 +4751,6 @@ fi
if test "$wxUSE_LIBTIFF" = "builtin" ; then
wxUSE_LIBJBIG=no
wxUSE_LIBLZMA=no
else
withstring=without
@ -4782,35 +4781,6 @@ fi
eval "$wx_cv_use_libjbig"
withstring=without
defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then
if test x"$withstring" = xwithout; then
defaultval=yes
else
defaultval=no
fi
fi
# Check whether --with-liblzma was given.
if test "${with_liblzma+set}" = set; then :
withval=$with_liblzma;
if test "$withval" = yes; then
wx_cv_use_liblzma='wxUSE_LIBLZMA=yes'
else
wx_cv_use_liblzma='wxUSE_LIBLZMA=no'
fi
else
wx_cv_use_liblzma='wxUSE_LIBLZMA=${'DEFAULT_wxUSE_LIBLZMA":-$defaultval}"
fi
eval "$wx_cv_use_liblzma"
fi
@ -5150,6 +5120,35 @@ fi
eval "$wx_cv_use_regex"
withstring=
defaultval=$wxUSE_ALL_FEATURES
if test -z "$defaultval"; then
if test x"$withstring" = xwithout; then
defaultval=yes
else
defaultval=no
fi
fi
# Check whether --with-liblzma was given.
if test "${with_liblzma+set}" = set; then :
withval=$with_liblzma;
if test "$withval" = yes; then
wx_cv_use_liblzma='wxUSE_LIBLZMA=yes'
else
wx_cv_use_liblzma='wxUSE_LIBLZMA=no'
fi
else
wx_cv_use_liblzma='wxUSE_LIBLZMA=${'DEFAULT_wxUSE_LIBLZMA":-$defaultval}"
fi
eval "$wx_cv_use_liblzma"
# Check whether --with-zlib was given.
if test "${with_zlib+set}" = set; then :
@ -23317,9 +23316,16 @@ fi
fi
LZMA_LINK=
if test "$wxUSE_LIBLZMA" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_code in -llzma" >&5
if test "$wxUSE_LIBLZMA" != "no"; then
ac_fn_c_check_header_mongrel "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
if test "x$ac_cv_header_lzma_h" = xyes; then :
fi
if test "$ac_cv_header_lzma_h" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzma_code in -llzma" >&5
$as_echo_n "checking for lzma_code in -llzma... " >&6; }
if ${ac_cv_lib_lzma_lzma_code+:} false; then :
$as_echo_n "(cached) " >&6
@ -23356,10 +23362,22 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lzma_lzma_code" >&5
$as_echo "$ac_cv_lib_lzma_lzma_code" >&6; }
if test "x$ac_cv_lib_lzma_lzma_code" = xyes; then :
LZMA_LINK=" -llzma"
LZMA_LINK="-llzma"
LIBS="$LZMA_LINK $LIBS"
$as_echo "#define wxUSE_LIBLZMA 1" >>confdefs.h
fi
else
fi
if test -z "$LZMA_LINK"; then
wxUSE_LIBLZMA=no
fi
fi
if test "$HAVE_LZMA" = "no" -o "$wxUSE_LIBTIFF" = "builtin"; then
ac_configure_args="$ac_configure_args --disable-lzma"
fi
@ -23424,7 +23442,7 @@ if test "$wxUSE_LIBTIFF" != "no" ; then
if test "$wxUSE_ZLIB" = "sys"; then
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
fi
if test "$wxUSE_LIBLZMA" = "yes"; then
if test -n "$LZMA_LINK"; then
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $LZMA_LINK"
fi
if test "$wxUSE_LIBJBIG" = "yes"; then
@ -38925,6 +38943,11 @@ case "$wxUSE_EXPAT" in
WXCONFIG_LIBS="$EXPAT_LINK $WXCONFIG_LIBS"
;;
esac
if test "$wxUSE_LIBLZMA" = "yes"; then
if test "$wxUSE_GUI" != "yes" -o "$wxUSE_LIBTIFF" != "sys"; then
WXCONFIG_LIBS="$LZMA_LINK $WXCONFIG_LIBS"
fi
fi
case "$wxUSE_ZLIB" in
builtin)
wxconfig_3rdparty="zlib $wxconfig_3rdparty"
@ -43251,6 +43274,7 @@ echo " tiff ${wxUSE_LIBTIFF-
if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
echo " xpm ${wxUSE_LIBXPM-none}"
fi
echo " lzma ${wxUSE_LIBLZMA}"
echo " zlib ${wxUSE_ZLIB}"
echo " expat ${wxUSE_EXPAT}"
echo " libmspack ${wxUSE_LIBMSPACK}"

View File

@ -525,14 +525,12 @@ WX_ARG_SYS_WITH(libpng, [ --with-libpng use libpng (PNG image form
WX_ARG_SYS_WITH(libjpeg, [ --with-libjpeg use libjpeg (JPEG file format)], wxUSE_LIBJPEG)
WX_ARG_SYS_WITH(libtiff, [ --with-libtiff use libtiff (TIFF file format)], wxUSE_LIBTIFF)
dnl We don't provide built-in versions of these libraries, so if the use of
dnl system libraries is explicitly disabled, we can't use them at all.
dnl We don't provide built-in version of this library, so if the use of system
dnl libraries is explicitly disabled, we can't use it at all.
if test "$wxUSE_LIBTIFF" = "builtin" ; then
wxUSE_LIBJBIG=no
wxUSE_LIBLZMA=no
else
WX_ARG_WITHOUT(libjbig, [ --without-libjbig don't use libjbig in libtiff even if available)], wxUSE_LIBJBIG)
WX_ARG_WITHOUT(liblzma, [ --without-liblzma don't use liblzma in libtiff even if available)], wxUSE_LIBLZMA)
fi
WX_ARG_SYS_WITH(libxpm, [ --with-libxpm use libxpm (XPM file format)], wxUSE_LIBXPM)
@ -550,6 +548,7 @@ dnl for GUI only
WX_ARG_WITH(dmalloc, [ --with-dmalloc use dmalloc library (http://dmalloc.com/)], wxUSE_DMALLOC)
WX_ARG_WITH(sdl, [ --with-sdl use SDL for audio on Unix], wxUSE_LIBSDL)
WX_ARG_SYS_WITH(regex, [ --with-regex enable support for wxRegEx class], wxUSE_REGEX)
WX_ARG_WITH(liblzma, [ --with-liblzma use LZMA compression)], wxUSE_LIBLZMA)
WX_ARG_SYS_WITH(zlib, [ --with-zlib use zlib for LZW compression], wxUSE_ZLIB)
WX_ARG_SYS_WITH(expat, [ --with-expat enable XML support using expat parser], wxUSE_EXPAT)
@ -2556,10 +2555,28 @@ dnl ------------------------------------------------------------------------
dnl Check for lzma library
dnl ------------------------------------------------------------------------
LZMA_LINK=
if test "$wxUSE_LIBLZMA" = "yes"; then
AC_CHECK_LIB(lzma, lzma_code, LZMA_LINK=" -llzma")
else
if test "$wxUSE_LIBLZMA" != "no"; then
AC_CHECK_HEADER(lzma.h,,,[])
if test "$ac_cv_header_lzma_h" = "yes"; then
AC_CHECK_LIB(lzma, lzma_code,
[
LZMA_LINK="-llzma"
LIBS="$LZMA_LINK $LIBS"
AC_DEFINE(wxUSE_LIBLZMA)
])
fi
if test -z "$LZMA_LINK"; then
wxUSE_LIBLZMA=no
fi
fi
dnl We need to disable the use of lzma in built-in libtiff explicitly, as
dnl otherwise we'd depend on the system lzma library, which is typically
dnl undesirable when using builtin libraries. We also disable the use of lzma
dnl if it's not available anyhow, just to speed up libtiff configure a little.
if test "$HAVE_LZMA" = "no" -o "$wxUSE_LIBTIFF" = "builtin"; then
ac_configure_args="$ac_configure_args --disable-lzma"
fi
@ -2592,7 +2609,7 @@ if test "$wxUSE_LIBTIFF" != "no" ; then
if test "$wxUSE_ZLIB" = "sys"; then
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $ZLIB_LINK"
fi
if test "$wxUSE_LIBLZMA" = "yes"; then
if test -n "$LZMA_LINK"; then
TIFF_PREREQ_LINKS="$TIFF_PREREQ_LINKS $LZMA_LINK"
fi
if test "$wxUSE_LIBJBIG" = "yes"; then
@ -7908,6 +7925,13 @@ case "$wxUSE_EXPAT" in
WXCONFIG_LIBS="$EXPAT_LINK $WXCONFIG_LIBS"
;;
esac
if test "$wxUSE_LIBLZMA" = "yes"; then
dnl It could be already present in WXCONFIG_LIBS as tiff dependency, avoid
dnl adding it again in this case:
if test "$wxUSE_GUI" != "yes" -o "$wxUSE_LIBTIFF" != "sys"; then
WXCONFIG_LIBS="$LZMA_LINK $WXCONFIG_LIBS"
fi
fi
case "$wxUSE_ZLIB" in
builtin)
wxconfig_3rdparty="zlib $wxconfig_3rdparty"
@ -8389,6 +8413,7 @@ echo " tiff ${wxUSE_LIBTIFF-
if test "$wxUSE_X11" = 1 -o "$wxUSE_MOTIF" = 1; then
echo " xpm ${wxUSE_LIBXPM-none}"
fi
echo " lzma ${wxUSE_LIBLZMA}"
echo " zlib ${wxUSE_ZLIB}"
echo " expat ${wxUSE_EXPAT}"
echo " libmspack ${wxUSE_LIBMSPACK}"

View File

@ -610,6 +610,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -611,6 +611,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -611,6 +611,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -611,6 +611,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -617,6 +617,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -607,6 +607,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -610,6 +610,22 @@
// wxUSE_LIBPNG
#define wxUSE_ZLIB 1
// Set to 1 if liblzma is available to enable wxLZMA{Input,Output}Stream
// classes.
//
// Notice that if you enable this build option when not using configure or
// CMake, you need to ensure that liblzma headers and libraries are available
// (i.e. by building the library yourself or downloading its binaries) and can
// be found, either by copying them to one of the locations searched by the
// compiler/linker by default (e.g. any of the directories in the INCLUDE or
// LIB environment variables, respectively, when using MSVC) or modify the
// make- or project files to add references to these directories.
//
// Default is 0 under MSW, auto-detected by configure.
//
// Recommended setting: 1 if you need LZMA compression.
#define wxUSE_LIBLZMA 0
// If enabled, the code written by Apple will be used to write, in a portable
// way, float on the disk. See extended.c for the license which is different
// from wxWidgets one.

View File

@ -287,6 +287,8 @@
#define wxUSE_ZLIB 0
#define wxUSE_LIBLZMA 0
#define wxUSE_APPLE_IEEE 0
#define wxUSE_JOYSTICK 0