Bug 2830 - Build problem contrib\iptcutil\iptcutil.c
: Build problem contrib\iptcutil\iptcutil.c
Status: RESOLVED LATER
: libtiff
default
: unspecified
: PC Windows NT
: P2 enhancement
: ---
Assigned To:
:
:
: migrated_to_gitlab
:
:
  Show dependency treegraph
 
Reported: 2018-12-14 11:18 by
Modified: 2019-10-01 14:21 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2018-12-14 11:18:43
When building libtiff on Windows (using Visual Studio supplied compiler) with
CMake I encountered a build problem in contrib\iptcutil\iptcutil.c.  There we
have three preprocessor tests based on WIN32.  This WIN32 preprocessor define
is not defined.  At least this should be changed in _WIN32 (which the Visual
Studio compiler is defining automatically) or __WIN32__ which is defined in
tiffio.h:

--8<--
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
#define __WIN32__
#endif
--8<--
------- Comment #1 From 2019-01-29 05:33:54 -------
#ifdef WIN32
#define STRNICMP strnicmp
#else 
#define STRNICMP strncasecmp
#endif 

I think

#ifdef WIN32
should be changed to
#ifdef MSC_VER

because it is more a MSVC build problem (I think strncasecmp is defined in
MingW)
------- Comment #2 From 2019-01-29 06:37:15 -------
I think you mean _MSC_VER (see
https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2017).

The test should in fact determine if the MS C runtime library is used, not
based on which compiler you're using so I'm not sure _MSC_VER is any better
choice.  After all clang/clang-cl can also use MS C runtime library (and hence
need to use strnicmp, not strncasecmp).

Ideally perhaps check for strnicmp/strncasecmp via a CMake based test ?
------- Comment #3 From 2019-10-01 14:21:26 -------
Bugzilla is no longer used for tracking libtiff issues. Remaining open tickets,
such as this one, have been migrated to the libtiff GitLab instance at
https://gitlab.com/libtiff/libtiff/issues .

The migrated tickets have their summary prefixed with [BZ#XXXX] where XXXX is
the initial Bugzilla issue number.