Unsetting MAGICKCORE_HAVE_SYS_TIMEB_H

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
webmaster128
Posts: 5
Joined: 2016-12-09T08:32:32-07:00
Authentication code: 1151

Unsetting MAGICKCORE_HAVE_SYS_TIMEB_H

Post by webmaster128 »

I try to compile ImageMagick with an Android/arm64 toolchain from Crystax NDK, that has no <sys/timeb.h>. Now I found MAGICKCORE_HAVE_SYS_TIMEB_H, which should enable me to say this header is not available – I guess.

Greping over the source shows 3 places where MAGICKCORE_HAVE_SYS_TIMEB_H is used:

Code: Select all

./MagickWand/studio.h-# include <sys/types.h>
./MagickWand/studio.h-# include <sys/stat.h>
./MagickWand/studio.h:# if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
./MagickWand/studio.h-# include <sys/timeb.h>
./MagickWand/studio.h-# endif
--
./MagickCore/studio.h-# include <sys/types.h>
./MagickCore/studio.h-# include <sys/stat.h>
./MagickCore/studio.h:# if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
./MagickCore/studio.h-# include <sys/timeb.h>
./MagickCore/studio.h-# endif
--
./MagickCore/magick-baseconfig.h-
./MagickCore/magick-baseconfig.h-/* Define to 1 if you have the <sys/timeb.h> header file. */
./MagickCore/magick-baseconfig.h:#ifndef MAGICKCORE_HAVE_SYS_TIMEB_H
./MagickCore/magick-baseconfig.h:#define MAGICKCORE_HAVE_SYS_TIMEB_H 1
./MagickCore/magick-baseconfig.h-#endif
./MagickCore/magick-baseconfig.h-
Is it true that defining MAGICKCORE_HAVE_SYS_TIMEB_H=0 should disable including <sys/timeb.h>? If so, I think we have the problem that it is still defined because defined(MAGICKCORE_HAVE_SYS_TIMEB_H) is true.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unsetting MAGICKCORE_HAVE_SYS_TIMEB_H

Post by magick »

Comment out #define MAGICKCORE_HAVE_SYS_TIMEB_H 1 in MagickCore/magick-baseconfig.h or simply delete that line.
webmaster128
Posts: 5
Joined: 2016-12-09T08:32:32-07:00
Authentication code: 1151

Re: Unsetting MAGICKCORE_HAVE_SYS_TIMEB_H

Post by webmaster128 »

Okay, but what is the proper fix here? Sould not

Code: Select all

# if defined(MAGICKCORE_HAVE_SYS_TIMEB_H)
# include <sys/timeb.h>
be changed to

Code: Select all

# if MAGICKCORE_HAVE_SYS_TIMEB_H
# include <sys/timeb.h>
? MAGICKCORE_HAVE_SYS_TIMEB_H is always defined, either by the user or with the default 1. I can send a PR if I know how this is supposed to work.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Unsetting MAGICKCORE_HAVE_SYS_TIMEB_H

Post by magick »

The automake / autoconf toolchain sets the value for MAGICKCORE_HAVE_SYS_TIMEB_H. It is likely finding it in your local environment rather than in the Android environment suggesting either you have not properly set up the cross-compile configuration or automake / autoconf has a bug when cross-compiling. We have cross-compiled in the past without any problems, we're not sure why its failing for you.
webmaster128
Posts: 5
Joined: 2016-12-09T08:32:32-07:00
Authentication code: 1151

Re: Unsetting MAGICKCORE_HAVE_SYS_TIMEB_H

Post by webmaster128 »

Thanks for pushing me in the right direction! I was using the x86 toolchain for configuration, which is android-16, which has a <sys/timeb.h>. With the correct toolchain, HAVE_SYS_TIMEB_H is not defined.
Post Reply