diff --git a/CHANGES b/CHANGES index 8c407b2a..5dd83e1b 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,9 @@ What's New for OpenJPEG ! : changed + : added +January 25, 2012 +* [vincent] follow latest JPIP changes in the autotools side (pthread dependency, conditional compilation of JPIP server and client) + December 8, 2011 * [Mathieu Malaterre] Remove 9 warnings (gcc) * [mathieu] remove hack with bash around kdu_expand diff --git a/Makefile.am b/Makefile.am index df76f6aa..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 diff --git a/applications/Makefile.am b/applications/Makefile.am index 113afbe8..63dae6d5 100644 --- a/applications/Makefile.am +++ b/applications/Makefile.am @@ -6,7 +6,7 @@ if WANT_MJ2 SUBDIRS += mj2 endif -if WANT_JPIP +if WANT_JPIP_CODE SUBDIRS += jpip endif diff --git a/applications/jpip/libopenjpip/Makefile.am b/applications/jpip/libopenjpip/Makefile.am index fc79ef6e..293afc63 100644 --- a/applications/jpip/libopenjpip/Makefile.am +++ b/applications/jpip/libopenjpip/Makefile.am @@ -3,7 +3,15 @@ MAINTAINERCLEANFILES = Makefile.in includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR) includes_HEADERS = -lib_LTLIBRARIES = libopenjpip_server.la libopenjpip_local.la +lib_LTLIBRARIES = + +if WANT_JPIP +lib_LTLIBRARIES += libopenjpip_local.la +endif + +if WANT_JPIP_SERVER +lib_LTLIBRARIES += libopenjpip_server.la +endif JPIP_SRC = \ openjpip.c \ @@ -76,8 +84,8 @@ libopenjpip_server_la_CPPFLAGS = \ @FCGI_CFLAGS@ \ @LIBCURL_CFLAGS@ \ -DSERVER -libopenjpip_server_la_CFLAGS = -libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ -lm +libopenjpip_server_la_CFLAGS = @PTHREAD_CFLAGS@ +libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ @PTHREAD_LIBS@ -lm libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@ libopenjpip_server_la_SOURCES = $(JPIP_SRC) @@ -88,12 +96,13 @@ libopenjpip_local_la_CPPFLAGS = \ -I$(top_srcdir)/applications/jpip/libopenjpip \ -I$(top_builddir)/applications/jpip/libopenjpip \ @LIBCURL_CFLAGS@ -libopenjpip_local_la_CFLAGS = -libopenjpip_local_la_LIBADD = @LIBCURL_LIBS@ $(top_builddir)/libopenjpeg/libopenjpeg.la -lm +libopenjpip_local_la_CFLAGS = @PTHREAD_CFLAGS@ +libopenjpip_local_la_LIBADD = @PTHREAD_LIBS@ $(top_builddir)/libopenjpeg/libopenjpeg.la -lm libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@ libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC) install-data-hook: +if WANT_JPIP_SERVER @echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt if BUILD_SHARED @( $(call solist_s) ) >> $(top_builddir)/report.txt @@ -101,6 +110,8 @@ endif if BUILD_STATIC @echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt endif +endif +if WANT_JPIP @echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt if BUILD_SHARED @( $(call solist_c) ) >> $(top_builddir)/report.txt @@ -108,6 +119,7 @@ endif if BUILD_STATIC @echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt endif +endif solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;) get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2) diff --git a/applications/jpip/util/Makefile.am b/applications/jpip/util/Makefile.am index 8be3a627..eac0e6a6 100644 --- a/applications/jpip/util/Makefile.am +++ b/applications/jpip/util/Makefile.am @@ -1,6 +1,14 @@ MAINTAINERCLEANFILES = Makefile.in -bin_PROGRAMS = opj_server opj_dec_server jpip_to_jp2 jpip_to_j2k test_index +bin_PROGRAMS = + +if WANT_JPIP +bin_PROGRAMS += opj_dec_server test_index jpip_to_j2k jpip_to_jp2 +endif + +if WANT_JPIP_SERVER +bin_PROGRAMS += opj_server +endif opj_server_CPPFLAGS = \ @FCGI_CFLAGS@ \ @@ -56,8 +64,12 @@ test_index_SOURCES = test_index.c #------------- install-data-hook: +if WANT_JPIP_SERVER @echo -e " (B)\t$(bindir)/opj_server$(EXEEXT)" >> $(top_builddir)/report.txt +endif +if WANT_JPIP @echo -e " (B)\t$(bindir)/opj_dec_server$(EXEEXT)" >> $(top_builddir)/report.txt @echo -e " (B)\t$(bindir)/jpip_to_jp2$(EXEEXT)" >> $(top_builddir)/report.txt @echo -e " (B)\t$(bindir)/jpip_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt @echo -e " (B)\t$(bindir)/test_index$(EXEEXT)" >> $(top_builddir)/report.txt +endif diff --git a/configure.ac b/configure.ac index cef24a51..e505bdc5 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 @@ -134,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 @@ -149,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 @@ -332,9 +346,47 @@ if test "x${have_lcms2}" = "xno" ; then fi +# pthread + +if test "x${want_jpip}" = "xyes" && 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 library will not be compiled.]) + want_jpip="no" + else + PTHREAD_CFLAGS="-pthread" + AC_ARG_VAR([PTHREAD_CFLAGS], [compiler flag for Pthread]) + AC_SUBST([PTHREAD_CFLAGS]) + PTHREAD_LIBS="-pthread" + AC_ARG_VAR([PTHREAD_LIBS], [linker flags for Pthread]) + AC_SUBST([PTHREAD_LIBS]) + fi + +fi + # libfcgi -if test "x${want_jpip}" = "xyes" ; then +if test "x${want_jpip_server}" = "xyes" ; then have_fcgi="no" OPJ_CHECK_LIB( @@ -345,23 +397,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}" = "xyes" ; then +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 will not be compiled.]) - want_jpip="no" + AC_MSG_WARN([libcurl library not found. OpenJPIP server will not be compiled.]) + want_jpip_server="no" fi fi @@ -372,6 +424,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 @@ -457,4 +517,5 @@ echo echo " mj2.................: ${want_mj2}" echo " jpwl................: ${want_jpwl}" echo " jpip................: ${want_jpip}" +echo " jpip server.........: ${want_jpip_server}" echo