diff options
author | Biswapriyo Nath <nathbappai@gmail.com> | 2021-12-29 18:40:37 +0530 |
---|---|---|
committer | Biswapriyo Nath <nathbappai@gmail.com> | 2021-12-29 18:40:37 +0530 |
commit | 0784472a58374c7559c5dc74344c56df49ddeb18 (patch) | |
tree | 3c2303b37eb9c4a9e41facb4309390bf595d901f | |
parent | 794790068951b5de272f2ac959679f9e4cd7836c (diff) | |
download | libtiff-git-0784472a58374c7559c5dc74344c56df49ddeb18.tar.gz |
build: Fix static library imports in mingw
This defines LERC_STATIC while creating libtiff static library
in Win32 platform in presence of lerc library. Otherwise, the
static library import lerc APIs with dllimport attribute and
thus linked with shared lerc library.
-rw-r--r-- | configure.ac | 8 | ||||
-rwxr-xr-x | libtiff/CMakeLists.txt | 3 | ||||
-rw-r--r-- | libtiff/Makefile.am | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index bfa395a1..248c14fa 100644 --- a/configure.ac +++ b/configure.ac @@ -649,6 +649,14 @@ dnl Check for liblerc. dnl --------------------------------------------------------------------------- HAVE_LERC=no +STATIC_LERC=no + +if test "$enable_static" = "no"; then + static_lerc=no +else + static_lerc=yes +fi +AM_CONDITIONAL([STATIC_LERC], [ test "$static_lerc" = yes ]) AC_ARG_ENABLE(lerc, AS_HELP_STRING([--disable-lerc], diff --git a/libtiff/CMakeLists.txt b/libtiff/CMakeLists.txt index 905f52ca..cf9d80c3 100755 --- a/libtiff/CMakeLists.txt +++ b/libtiff/CMakeLists.txt @@ -132,6 +132,9 @@ endif() if(LERC_SUPPORT) target_link_libraries(tiff PRIVATE LERC::LERC) list(APPEND tiff_libs_private_list "${LERC_LIBRARY}") + if(NOT BUILD_SHARED_LIBS) + set_target_properties(tiff PROPERTIES COMPILE_DEFINITIONS LERC_STATIC) + endif() endif() if(LZMA_SUPPORT) target_link_libraries(tiff PRIVATE LibLZMA::LibLZMA) diff --git a/libtiff/Makefile.am b/libtiff/Makefile.am index 44522b62..3988da76 100644 --- a/libtiff/Makefile.am +++ b/libtiff/Makefile.am @@ -147,4 +147,10 @@ mkg3states_LDADD = $(LIBPORT) faxtable: mkg3states (rm -f tif_fax3sm.c && ./mkg3states -b -c const tif_fax3sm.c) -AM_CPPFLAGS = -I$(top_srcdir)/libtiff -I$(top_srcdir)/port +if STATIC_LERC +extra_CPPFLAGS = -DLERC_STATIC +else +extra_CPPFLAGS = +endif + +AM_CPPFLAGS = -I$(top_srcdir)/libtiff -I$(top_srcdir)/port $(extra_CPPFLAGS) |