From c433c2f2e230fdbb41e66ab2080d7beb72a00efa Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Fri, 2 Mar 2012 09:26:15 +0000 Subject: [PATCH] [trunk] Backport toplevel files from 1.5 --- CMake/CTestCustom.cmake.in | 2 + LICENSE | 8 +-- Makefile.am | 6 +- NEWS | 3 +- README | 4 +- configure.ac | 139 ++++++++++++++++++++++++++++++------- libopenjpeg1.pc.cmake | 8 +-- libopenjpeg1.pc.in | 7 +- opj_config.h.cmake.in | 6 +- 9 files changed, 138 insertions(+), 45 deletions(-) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index b3c4931e..487f8b99 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -29,4 +29,6 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION ".*warning,.* is deprecated" # supress warnings caused by 3rd party libs: ".*/thirdparty/.*" + "libtiff.*has no symbols" + "libpng.*has no symbols" ) diff --git a/LICENSE b/LICENSE index 48469dff..f7b3b662 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ /* - * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium - * Copyright (c) 2002-2011, Professor Benoit Macq - * Copyright (c) 2003-2011, Antonin Descampe + * Copyright (c) 2002-2012, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2012, Professor Benoit Macq + * Copyright (c) 2003-2012, Antonin Descampe * Copyright (c) 2003-2009, Francois-Olivier Devaux * Copyright (c) 2005, Herve Drolon, FreeImage Team * Copyright (c) 2002-2003, Yannick Verschueren @@ -28,4 +28,4 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - */ \ No newline at end of file + */ diff --git a/Makefile.am b/Makefile.am index 7e5dc5c8..6ed452f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpwl=yes --enable-mj2=yes +DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpip-server=yes --enable-jpwl=yes --enable-mj2=yes ACLOCAL_AMFLAGS = -I m4 @@ -12,7 +12,6 @@ pkgconfig_DATA += libopenjpeg-jpwl.pc endif - MAINTAINERCLEANFILES = \ Makefile.in \ aclocal.m4 \ @@ -66,6 +65,9 @@ else endif @echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt @echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt +if WANT_JPWL + @echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg-jpwl.pc" >> $(top_builddir)/report.txt +endif @cat $(top_builddir)/report.txt @rm $(top_builddir)/report.txt diff --git a/NEWS b/NEWS index e774c75b..462ff2db 100644 --- a/NEWS +++ b/NEWS @@ -30,4 +30,5 @@ Misc: - results are submitted to the OpenJPEG dashboard (http://my.cdash.org/index.php?project=OPENJPEG) - images are located in 'http://openjpeg.googlecode.com/svn/data' folder. - configuration files and utilities are located in 'tests' folder. - * Many bug fixes. See CHANGES for details. \ No newline at end of file + * OPJViewer re-activated (need wxWidgets) + * Huge amount of bug fixes. See CHANGES for details. diff --git a/README b/README index 05a280c2..018ba2da 100644 --- a/README +++ b/README @@ -13,7 +13,7 @@ Details on folders hierarchy: * JavaOpenJPEG: java jni to use openjpeg in a java program * jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details. * OPJViewer: gui for displaying j2k files (based on wxWidget) -* thirdparty: thirdparty libraries used by some applications. These libraries will be build only if there are not found on the system. Note that libopenjpeg itself does not have any dependency. +* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency. * doc: doxygen documentation setup file and man pages * tests: configuration files and utilities for the openjpeg test suite. All test images are located in 'http://openjpeg.googlecode.com/svn/data' folder. * CMake: cmake related files @@ -22,4 +22,4 @@ Details on folders hierarchy: see LICENSE for license and copyright information. see INSTALL for installation procedures. see NEWS for user visible changes in successive releases. -see CHANGES for per-revision changes. \ No newline at end of file +see CHANGES for per-revision changes. diff --git a/configure.ac b/configure.ac index 142e31f8..283123e3 100644 --- a/configure.ac +++ b/configure.ac @@ -26,21 +26,21 @@ AC_CONFIG_HEADERS([opj_config.h]) AC_CANONICAL_SYSTEM AC_CANONICAL_HOST -AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2]) +AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2 dist-xz dist-zip]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) MAJOR_NR=OPJ_MAJOR MINOR_NR=OPJ_MINOR MICRO_NR=OPJ_MICRO -AC_SUBST(MAJOR_NR) -AC_SUBST(MINOR_NR) -AC_SUBST(MICRO_NR) +AC_SUBST([MAJOR_NR]) +AC_SUBST([MINOR_NR]) +AC_SUBST([MICRO_NR]) LT_PREREQ([2.0]) LT_INIT([win32-dll]) lt_version=lt_cur:lt_rev:lt_age -AC_SUBST(lt_version) +AC_SUBST([lt_version]) ### Needed information @@ -60,14 +60,6 @@ AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"]) AM_CONDITIONAL([HAVE_DARWIN], [test "x${have_darwin}" = "xyes"]) -# Define the necessary macros to make off_t a 64 bits type -AC_SYS_LARGEFILE - -# If the `fseeko' function is available, define `HAVE_FSEEKO'. Define -# `_LARGEFILE_SOURCE' if necessary. -AC_FUNC_FSEEKO - - ### Additional options to configure # debug @@ -142,6 +134,20 @@ AC_ARG_ENABLE([jpip], AC_MSG_CHECKING([whether to build the JPIP library]) AC_MSG_RESULT([${want_jpip}]) +AC_ARG_ENABLE([jpip-server], + [AC_HELP_STRING([--enable-jpip-server], [build jpip server @<:@default=disabled@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + want_jpip_server="yes" + else + want_jpip_server="no" + fi + ], + [want_jpip_server="no"]) + +AC_MSG_CHECKING([whether to build the JPIP server]) +AC_MSG_RESULT([${want_jpip_server}]) + ### Checks for programs @@ -157,8 +163,8 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.22 ; then else pkgconfig_requires_private="Requires" fi -AC_SUBST(pkgconfig_requires_private) -AC_SUBST(requirements) +AC_SUBST([pkgconfig_requires_private]) +AC_SUBST([requirements]) # doxygen @@ -191,16 +197,16 @@ AC_MSG_RESULT([${want_png}]) if test "x${want_png}" = "xyes" ; then - PKG_CHECK_MODULES([PNG], [libpng15], + PKG_CHECK_MODULES([PNG], [libpng15 zlib], [have_libpng="yes"], [ - PKG_CHECK_MODULES([PNG], [libpng14], + PKG_CHECK_MODULES([PNG], [libpng14 zlib], [have_libpng="yes"], [ - PKG_CHECK_MODULES([PNG], [libpng12], + PKG_CHECK_MODULES([PNG], [libpng12 zlib], [have_libpng="yes"], [ - PKG_CHECK_MODULES([PNG], [libpng], + PKG_CHECK_MODULES([PNG], [libpng zlib], [have_libpng="yes"], [have_libpng="no"]) ]) @@ -208,11 +214,23 @@ if test "x${want_png}" = "xyes" ; then ]) if ! test "x${have_libpng}" = "xyes" ; then - OPJ_CHECK_LIB([png.h], - [png], - [png_create_write_struct], - [have_libpng="yes"], + + OPJ_CHECK_LIB([zlib.h], + [z], + [zlibVersion], + [ + OPJ_CHECK_LIB([png.h], + [png], + [png_access_version_number], + [ + have_libpng="yes" + PNG_CFLAGS="${PNG_CFLAGS} ${Z_CFLAGS}" + PNG_LIBS="${PNG_LIBS} ${Z_LIBS}" + ], + [have_libpng="no"]) + ], [have_libpng="no"]) + fi if test "x${have_libpng}" = "xno" ; then @@ -340,9 +358,54 @@ if test "x${have_lcms2}" = "xno" ; then fi +# threads + +if test "x${want_jpip_server}" = "xyes" ; then + + if test "x${have_win32}" = "xno" ; then + + SAVE_CFLAGS=${CFLAGS} + CFLAGS="${CFLAGS} -pthread" + SAVE_LIBS=${LIBS} + LIBS="${LIBS} -pthread" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include + ]], + [[ +pthread_t id; +id = pthread_self(); + ]])], + [have_pthread="yes"], + [have_pthread="no"]) + CFLAGS=${SAVE_CFLAGS} + LIBS=${SAVE_LIBS} + + AC_MSG_CHECKING([whether Pthread library is available]) + AC_MSG_RESULT([${have_pthread}]) + + if ! test "x${have_pthread}" = "xyes" ; then + AC_MSG_WARN([Pthread library not found. OpenJPIP server will not be compiled.]) + want_jpip_server="no" + else + THREAD_CFLAGS="-pthread" + THREAD_LIBS="-pthread" + fi + + else + THREAD_LIBS="-lws2_32" + fi + +fi + +AC_ARG_VAR([THREAD_CFLAGS], [compiler flag for the thread library]) +AC_SUBST([THREAD_CFLAGS]) +AC_ARG_VAR([THREAD_LIBS], [linker flags for thread library]) +AC_SUBST([THREAD_LIBS]) + # libfcgi -if test "x${want_jpip}" = "xyes" ; then +if test "x${want_jpip_server}" = "xyes" ; then have_fcgi="no" OPJ_CHECK_LIB( @@ -353,8 +416,23 @@ if test "x${want_jpip}" = "xyes" ; then [have_fcgi="no"]) if ! test "x${have_fcgi}" = "xyes" ; then - AC_MSG_WARN([FastCGI library not found. OpenJPIP will not be compiled.]) - want_jpip="no" + AC_MSG_WARN([FastCGI library not found. OpenJPIP server will not be compiled.]) + want_jpip_server="no" + fi + +fi + +# libcurl + +if test "x${want_jpip_server}" = "xyes" ; then + + PKG_CHECK_MODULES([LIBCURL], [libcurl], + [have_libcurl="yes"], + [have_libcurl="no"]) + + if ! test "x${have_libcurl}" = "xyes" ; then + AC_MSG_WARN([libcurl library not found. OpenJPIP server will not be compiled.]) + want_jpip_server="no" fi fi @@ -365,6 +443,14 @@ fi AM_CONDITIONAL([WANT_JPIP], [test "x${want_jpip}" = "xyes"]) +if test "x${want_jpip_server}" = "xyes" ; then + AC_DEFINE(USE_JPIP_SERVER, [1], [define to 1 if you use jpip server]) +fi + +AM_CONDITIONAL([WANT_JPIP_SERVER], [test "x${want_jpip_server}" = "xyes"]) + +AM_CONDITIONAL([WANT_JPIP_CODE], [test "x${want_jpip}" = "xyes" || test "x${want_jpip_server}" = "xyes"]) + ### Checks for header files ## FIXME: declarations must be fixed in source code. See autoconf manual @@ -450,4 +536,5 @@ echo echo " mj2.................: ${want_mj2}" echo " jpwl................: ${want_jpwl}" echo " jpip................: ${want_jpip}" +echo " jpip server.........: ${want_jpip_server}" echo diff --git a/libopenjpeg1.pc.cmake b/libopenjpeg1.pc.cmake index 9da820b5..962d8b21 100644 --- a/libopenjpeg1.pc.cmake +++ b/libopenjpeg1.pc.cmake @@ -1,8 +1,8 @@ prefix=@CMAKE_INSTALL_PREFIX@ -bindir=@OPENJPEG_INSTALL_BIN_DIR@ -datadir=@OPENJPEG_INSTALL_DATA_DIR@ -libdir=@OPENJPEG_INSTALL_LIB_DIR@ -includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@ +bindir=${prefix}/@OPENJPEG_INSTALL_BIN_DIR@ +datadir=${prefix}/@OPENJPEG_INSTALL_DATA_DIR@ +libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@ +includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@ Name: openjpeg Description: JPEG2000 files library diff --git a/libopenjpeg1.pc.in b/libopenjpeg1.pc.in index 2951608f..a8205fc8 100644 --- a/libopenjpeg1.pc.in +++ b/libopenjpeg1.pc.in @@ -1,12 +1,13 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@includedir@ +includedir=@includedir@/openjpeg-@MAJOR_NR@.@MINOR_NR@ Name: openjpeg -Description: JPEG2000 files library +Description: JPEG2000 library URL: http://www.openjpeg.org/ Version: @VERSION@ -pkgconfig_requires_private: @requirements@ +@pkgconfig_requires_private@: @requirements@ Libs: -L${libdir} -lopenjpeg +Libs.private: -lm Cflags: -I${includedir} diff --git a/opj_config.h.cmake.in b/opj_config.h.cmake.in index 9cb485f1..e64b5e8f 100644 --- a/opj_config.h.cmake.in +++ b/opj_config.h.cmake.in @@ -9,9 +9,9 @@ #cmakedefine HAVE_STRING_H #cmakedefine HAVE_SYS_STAT_H #cmakedefine HAVE_SYS_TYPES_H -#cmakedefine HAVE_UNISTD_H -#cmakedefine HAVE_LIBPNG -#cmakedefine HAVE_PNG_H +#cmakedefine HAVE_UNISTD_H +#cmakedefine HAVE_LIBPNG +#cmakedefine HAVE_PNG_H #cmakedefine HAVE_LIBTIFF #cmakedefine HAVE_TIFF_H