| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2007.06.29 11:04 "Suggested Source Changes for Building libtiff Under Windows", by Kevin MyersDear libtiff maintainers, I've just spent most of the past two days struggling with getting libtiff to build successfully under Windows. During the process, I came across what I believe to be a number of deficiencies in the present source code that could be addressed in order to simplify builds under Windows. Following below are a number of specific suggestions that I believe would be helpful in this regard. Note that I have successfully built libtiff under Windows using the MSVC compiler with all of the changes in place that are suggested below. I hope that someone will be able to implement these changes. There are both standard libtiff and GnuWin32 specific issues. I believe that addressing these issues would make builds under Windows a lot easier, especially for folks like me who don't do this kind of thing on an everyday basis. Hope these suggestions are helpful. Kevin M. 1. Expand handling for HAVE_GETOPT to additional modules. For each of the following modules in the tools directory: tiffdump.c, rgb2ycbcr.c, tiff2pdf.c, tiff2ps.c, tiffmedian.c, tiffinfo.c, tiff2bw.c, tiffdither.c, tiff2rgba.c, fax2ps.c, tiffcp.c, ras2tiff.c, bmp2tiff.c, fax2tiff.c, gif2tiff.c, pal2rgb.c Add the following block of code near the top of each file: #ifndef HAVE_GETOPT extern int getopt(int, char**, char*); #endif Adding this code will avoid unnecessary compiler warnings under Windows, and make these modules consistent with others in the tools directory for which this block of code is already in place. 2. Expand handling for HAVE_IO to additional modules. For the following module in the tools directory: tiff2pdf.c Add the following block of code near the top of the file: #ifdef HAVE_IO_H # include <io.h> #endif Adding this code will avoid unnecessary compiler warnings under Windows, and make this module consistent with others in the tools directory for which this block of code is already in place. 3. Expand handling for HAVE_STRCASECMP to additional modules. For the following module in the tools directory: tiffinfo.c Add the following block of code near the top of the file: #ifndef HAVE_STRCASECMP extern int strcasecmp(const char *s1, const char *s2); #endif Adding this code will avoid unnecessary compiler warnings under Windows, and make these modules consistent with others in the tools directory for which equivalent blocks of code are already in place. 4. Expand handling for additional configuration settings under Windows. Replace the following module in the libtiff directory (currently this file only exists in the GnuWin32 port): tif_config.h.vc Note: Much of the following was generated by running configure under MinGW. However, configure can't be used directly with most Windows developers default command shells, and some of the settings used for the MinGW configuration aren't appropriate when using the MSVC compiler (nmake). Therefore attempting to customize the content of this file *after* it has already been downloaded by the user may be a poor option. Also, there are a number of specific settings in this file that I found to be needed in addition to the much more limited set that is included in the current GnuWin32 version. Use the following code: /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support C++ stream API (requires C++ compiler) */ #define CXX_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Use the Apple OpenGL framework. */ /* #undef HAVE_APPLE_OPENGL_FRAMEWORK */ /* Define to 1 if you have the <assert.h> header file. */ #define HAVE_ASSERT_H 1 /* Define to 1 if you have the <dlfcn.h> header file. */ /* #undef HAVE_DLFCN_H */ /* Define to 1 if you have the <fcntl.h> header file. */ #define HAVE_FCNTL_H 1 /* Define to 1 if you have the `floor' function. */ #define HAVE_FLOOR 1 /* Define to 1 if you have the `getopt' function. */ /*#define HAVE_GETOPT 1*/ /* Define as 0 or 1 according to the floating point format suported by the machine */ #define HAVE_IEEEFP 1 /* Define to 1 if the system has the type `int16'. */ /* #undef HAVE_INT16 */ /* Define to 1 if the system has the type `int32'. */ /* #undef HAVE_INT32 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Define to 1 if you have the <io.h> header file. */ #define HAVE_IO_H 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 /* Define to 1 if you have the `isascii' function. */ #define HAVE_ISASCII 1 /* Define to 1 if you have the `lfind' function. */ #define HAVE_LFIND 1 /* Define to 1 if you have the `c' library (-lc). */ /* #undef HAVE_LIBC */ /* Define to 1 if you have the `m' library (-lm). */ /* #undef HAVE_LIBM */ /* Define to 1 if you have the <limits.h> header file. */ #define HAVE_LIMITS_H 1 /* Define to 1 if you have the <malloc.h> header file. */ #define HAVE_MALLOC_H 1 /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the `memset' function. */ #define HAVE_MEMSET 1 /* Define to 1 if you have the `mmap' function. */ /* #undef HAVE_MMAP */ /* Define to 1 if you have the `pow' function. */ #define HAVE_POW 1 /* Define if you have POSIX threads libraries and header files. */ /* #undef HAVE_PTHREAD */ /* Define to 1 if you have the <search.h> header file. */ #define HAVE_SEARCH_H 1 /* Define to 1 if you have the `sqrt' function. */ #define HAVE_SQRT 1 /* Define to 1 if you have the <stdint.h> header file. */ #define HAVE_STDINT_H 1 /* Define to 1 if you have the <stdlib.h> header file. */ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `strcasecmp' function. */ /*#define HAVE_STRCASECMP 1*/ /* Define to 1 if you have the `strchr' function. */ #define HAVE_STRCHR 1 /* Define to 1 if you have the <strings.h> header file. */ /*#define HAVE_STRINGS_H 1*/ /* Define to 1 if you have the <string.h> header file. */ #define HAVE_STRING_H 1 /* Define to 1 if you have the `strrchr' function. */ #define HAVE_STRRCHR 1 /* Define to 1 if you have the `strstr' function. */ #define HAVE_STRSTR 1 /* Define to 1 if you have the `strtol' function. */ #define HAVE_STRTOL 1 /* Define to 1 if you have the `strtoul' function. */ #define HAVE_STRTOUL 1 /* Define to 1 if you have the <sys/stat.h> header file. */ #define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the <sys/time.h> header file. */ #define HAVE_SYS_TIME_H 1 /* Define to 1 if you have the <sys/types.h> header file. */ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the <unistd.h> header file. */ /*#define HAVE_UNISTD_H 1*/ /* Define to 1 if you have the <windows.h> header file. */ #define HAVE_WINDOWS_H 1 /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel) */ #define HOST_BIGENDIAN 0 /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Support JPEG compression (requires IJG JPEG library) */ #define JPEG_SUPPORT 1 /* Support LogLuv high dynamic range encoding */ #define LOGLUV_SUPPORT 1 /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support Microsoft Document Imaging format */ #define MDI_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* #undef NO_MINUS_C_MINUS_O */ /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ /* #undef OJPEG_SUPPORT */ /* Name of package */ #define PACKAGE "tiff" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT tiff@lists.maptools.org /* Define to the full name of this package. */ #define PACKAGE_NAME "LibTIFF Software" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "LibTIFF Software 3.8.2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "tiff" /* Define to the version of this package. */ #define PACKAGE_VERSION "3.8.2" /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Define to necessary symbol if this constant uses a non-standard name on your system. */ /* #undef PTHREAD_CREATE_JOINABLE */ /* The size of a `int', as computed by sizeof. */ #define SIZEOF_INT 4 /* The size of a `long', as computed by sizeof. */ #define SIZEOF_LONG 4 /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of specified size to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Default size of the strip in bytes (when strip chopping enabled) */ #define STRIP_SIZE_DEFAULT 8192 /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 /* Define to 1 if your <sys/time.h> declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ #define VERSION "3.8.2" /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ /* #undef WORDS_BIGENDIAN */ /* Define to 1 if the X Window System is missing or not being used. */ #define X_DISPLAY_MISSING 1 /* Support Deflate compression */ #define ZIP_SUPPORT 1 /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus # ifndef inline # define inline __inline # endif #endif /* Define to `long' if <sys/types.h> does not define. */ /* #undef off_t */ /* Define to `unsigned' if <sys/types.h> does not define. */ /* #undef size_t */ /* lfind is deprecated, use _lfind as replacement */ #define lfind _lfind 5. Choose a better default installation directory (GnuWin32 port, executable setup versions only). While a directory underneath %Program Files% is the standard location for software installations under Windows, this location works out very poorly for many *nix-based utilities, and especially for any kind of development work, because many *nix-based utilities don't correctly handle the blank in the middle of "Program Files" as part of a path. Therefore, a default installation path should be chosen that does NOT include embedded blanks. 6. Add code for building the contrib directory to Makefile.vc , and add related files to the corresponding subdirectories. 7. Improve cross-package handling for HAVE_STD_LIB_H. The jpeg library developers should be asked to replace their current handling in jconfig.h for HAVE_STDLIB_H with the following: #ifndef HAVE_STDLIB_H #define HAVE_STDLIB_H #endif Until this change can be implemented, GnuWin32 documentation for building libtiff using MSVC should advise that it may be necessary for the developer to replace the existing line in jconfig.h that defines HAVE_STDLIB_H with the above block of code in order to avoid problems building libtiff due to a difference in the definition of this item. 8. Add a port.h header file for modules located in the port subdirectory. Since configuration level handling of header files are already required for any module that makes use of a function that may be compiled under the port directory, it might make sense to consider adding a port.h header file, and putting logic in the individual files that reference these functions to reference port.h rather than the corresponding standard header file when appropriate. Might be cleaner than using the currently implemented external function reference approach. Just something to consider... 9. Explain in documentation or eliminate the two separate source tree branches that are created when using the libtiff source installer from GnuWin32. One branch is created under GnuWin32/src/tiff/3.8.2/tiff-3.8.2, and another more or less parallel branch is created under GnuWin32/src/tiff/3.8.2/tiff-3.8.2-src. About the only thing in the first branch that appears to be useful is the res subdirectory. |
|||||||