summaryrefslogtreecommitdiff
path: root/port
diff options
context:
space:
mode:
authorBob Friesenhahn <bfriesen@simple.dallas.tx.us>2015-06-25 02:27:58 +0000
committerBob Friesenhahn <bfriesen@simple.dallas.tx.us>2015-06-25 02:27:58 +0000
commit5b90af247ea3801ce93ec0922b8b81396caa885d (patch)
tree59c2be6a595ee4a0d14dd093d95040263a87d8b3 /port
parent0319952da29b7b6504b7af800c1ee8b22c9dd6da (diff)
downloadlibtiff-git-5b90af247ea3801ce93ec0922b8b81396caa885d.tar.gz
* CMakeLists.txt: Add CMake patchset by Roger Leigh as posted to
libtiff mailing list on Mon, 22 Jun 2015 21:21:01 +0100. Several corrections to ensure that the autotools build still works were added by me. I have not yet tested the build using 'cmake' or MSVC with 'nmake'.
Diffstat (limited to 'port')
-rw-r--r--port/CMakeLists.txt60
-rw-r--r--port/Makefile.am2
-rw-r--r--port/Makefile.in5
-rw-r--r--port/libport.h6
4 files changed, 69 insertions, 4 deletions
diff --git a/port/CMakeLists.txt b/port/CMakeLists.txt
new file mode 100644
index 00000000..354ed4d7
--- /dev/null
+++ b/port/CMakeLists.txt
@@ -0,0 +1,60 @@
+# CMake build for libtiff
+#
+# Copyright © 2015 Open Microscopy Environment / University of Dundee
+# Written by Roger Leigh <rleigh@codelibre.net>
+#
+# Permission to use, copy, modify, distribute, and sell this software and
+# its documentation for any purpose is hereby granted without fee, provided
+# that (i) the above copyright notices and this permission notice appear in
+# all copies of the software and related documentation, and (ii) the names of
+# Sam Leffler and Silicon Graphics may not be used in any advertising or
+# publicity relating to the software without the specific, prior written
+# permission of Sam Leffler and Silicon Graphics.
+#
+# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+#
+# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+
+set(port_HEADERS libport.h)
+set(port_SOURCES dummy.c)
+set(port_optional_SOURCES
+ getopt.c
+ lfind.c
+ strcasecmp.c
+ strtoul.c
+ strtoull.c)
+
+set(port_USED_FILES ${port_SOURCES} ${port_HEADERS})
+
+if(NOT HAVE_GETOPT)
+ list(APPEND port_USED_FILES getopt.c)
+endif()
+if(NOT HAVE_LFIND)
+ list(APPEND port_USED_FILES lfind.c)
+endif()
+if(NOT HAVE_SNPRINTF AND NOT HAVE__SNPRINTF)
+ list(APPEND port_USED_FILES snprintf.c)
+endif()
+if(NOT HAVE_STRCASECMP)
+ list(APPEND port_USED_FILES strcasecmp.c)
+endif()
+if(NOT HAVE_STRTOUL)
+ list(APPEND port_USED_FILES strtoul.c)
+endif()
+if(NOT HAVE_STRTOULL)
+ list(APPEND port_USED_FILES strtoull.c)
+endif()
+
+add_library(port STATIC ${port_USED_FILES})
+
+foreach(file ${port_USED_FILES})
+ list(APPEND tiff_port_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
+endforeach()
+set(tiff_port_SOURCES ${tiff_port_SOURCES} PARENT_SCOPE)
diff --git a/port/Makefile.am b/port/Makefile.am
index 94504fd8..e8253455 100644
--- a/port/Makefile.am
+++ b/port/Makefile.am
@@ -23,7 +23,7 @@
# Process this file with automake to produce Makefile.in.
-EXTRA_DIST = Makefile.vc libport.h
+EXTRA_DIST = Makefile.vc libport.h snprintf.c
noinst_LTLIBRARIES = libport.la
libport_la_SOURCES = dummy.c libport.h
diff --git a/port/Makefile.in b/port/Makefile.in
index 7e6e93ed..394f69b7 100644
--- a/port/Makefile.in
+++ b/port/Makefile.in
@@ -196,7 +196,7 @@ am__define_uniq_tagged_files = \
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \
- $(top_srcdir)/config/mkinstalldirs getopt.c lfind.c \
+ $(top_srcdir)/config/mkinstalldirs getopt.c lfind.c snprintf.c \
strcasecmp.c strtoul.c strtoull.c
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -345,7 +345,7 @@ tiff_libs_private = @tiff_libs_private@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-EXTRA_DIST = Makefile.vc libport.h
+EXTRA_DIST = Makefile.vc libport.h snprintf.c
noinst_LTLIBRARIES = libport.la
libport_la_SOURCES = dummy.c libport.h
libport_la_LIBADD = @LTLIBOBJS@
@@ -405,6 +405,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/lfind.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/snprintf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strcasecmp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoul.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strtoull.Plo@am__quote@
diff --git a/port/libport.h b/port/libport.h
index 802f478b..909ae1fc 100644
--- a/port/libport.h
+++ b/port/libport.h
@@ -1,4 +1,4 @@
-/* $Id: libport.h,v 1.2 2009-11-02 14:44:13 bfriesen Exp $ */
+/* $Id: libport.h,v 1.3 2015-06-25 02:28:01 bfriesen Exp $ */
/*
* Copyright (c) 2009 Frank Warmerdam
@@ -48,4 +48,8 @@ lfind(const void *key, const void *base, size_t *nmemb, size_t size,
int(*compar)(const void *, const void *));
#endif
+#if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF)
+int snprintf(char* str, size_t size, const char* format, ...);
+#endif
+
#endif /* ndef _LIBPORT_ */