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 \
@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)
-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
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
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)
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
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
else
pkgconfig_requires_private="Requires"
fi
-AC_SUBST(pkgconfig_requires_private)
-AC_SUBST(requirements)
+AC_SUBST([pkgconfig_requires_private])
+AC_SUBST([requirements])
# doxygen
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.h>
+ ]],
+ [[
+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(
[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
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
echo " mj2.................: ${want_mj2}"
echo " jpwl................: ${want_jpwl}"
echo " jpip................: ${want_jpip}"
+echo " jpip server.........: ${want_jpip_server}"
echo