backport r868 to openjpeg-1.5 branch

This commit is contained in:
Antonin Descampe 2011-08-15 13:25:58 +00:00
parent 9c7899372b
commit 61e0ed6a96
6 changed files with 134 additions and 102 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPEG
! : changed
+ : added
August 15, 2011
* [antonin] fixed a bug in autotools files that prevented libfcgi to be correctly found in some cases (patch from V.Torri).
August 12, 2011
+ [antonin] added cmake support to openjpip

View File

@ -8,6 +8,8 @@ opj_dec_server_CPPFLAGS = \
-I$(top_builddir)/applications/jpip/opj_server \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
@FCGI_CFLAGS@ \
-DSERVER
opj_dec_server_CFLAGS =

View File

@ -94,8 +94,11 @@ int main(int argc,char *argv[])
delete_msgqueue( &msgqueue);
free( jpipstream);
#ifdef _WIN32
if(( outfd = open( argv[2], O_WRONLY|O_CREAT, _S_IREAD | _S_IWRITE)) == -1){
#else
if(( outfd = open( argv[2], O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG)) == -1){
#endif
fprintf( stderr, "file %s open error\n", argv[2]);
return -1;
}

View File

@ -101,8 +101,12 @@ int main(int argc,char *argv[])
printf("NC: %d, bpc: %d\n", ihdrbox->nc, ihdrbox->bpc);
jp2stream = recons_jp2( msgqueue, jpipstream, msgqueue->first->csn, &jp2len);
#ifdef _WIN32
if(( outfd = open( argv[2], O_WRONLY|O_CREAT, _S_IREAD | _S_IWRITE)) == -1){
#else
if(( outfd = open( argv[2], O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG)) == -1){
#endif
fprintf( stderr, "file %s open error\n", argv[2]);
return -1;
}

View File

@ -138,41 +138,6 @@ AC_ARG_ENABLE([jpip],
AC_MSG_CHECKING([whether to build the JPIP library])
AC_MSG_RESULT([${want_jpip}])
if test "x${want_jpip}" = "xyes" ; then
AC_DEFINE(USE_JPIP, [1], [define to 1 if you use jpip])
fi
# libfcgi
if test "x${want_jpip}" = "xyes" ; then
OPJ_CHECK_LIB([/usr],
[fcgi_stdio.h],
[fcgi],
[FCGI_printf],
[want_jpip="yes"],
[want_jpip="no"])
fi
if test "x${want_jpip}" = "xno" ; then
OPJ_CHECK_LIB([/usr/local],
[fcgi_stdio.h],
[fcgi],
[FCGI_printf],
[want_jpip="yes"],
[want_jpip="no"])
fi
if test "x${want_jpip}" = "xno" ; then
OPJ_CHECK_LIB([/opt],
[fcgi_stdio.h],
[fcgi],
[FCGI_printf],
[want_jpip="yes"],
[want_jpip="no"])
fi
AM_CONDITIONAL([WANT_JPIP], [test "x${want_jpip}" = "xyes"])
### Checks for programs
@ -239,26 +204,7 @@ if test "x${want_png}" = "xyes" ; then
])
if ! test "x${have_libpng}" = "xyes" ; then
OPJ_CHECK_LIB([/usr],
[png.h],
[png],
[png_create_write_struct],
[have_libpng="yes"],
[have_libpng="no"])
fi
if ! test "x${have_libpng}" = "xyes" ; then
OPJ_CHECK_LIB([/usr/local],
[png.h],
[png],
[png_create_write_struct],
[have_libpng="yes"],
[have_libpng="no"])
fi
if ! test "x${have_libpng}" = "xyes" ; then
OPJ_CHECK_LIB([/opt],
[png.h],
OPJ_CHECK_LIB([png.h],
[png],
[png_create_write_struct],
[have_libpng="yes"],
@ -300,31 +246,13 @@ AC_MSG_RESULT([${want_tiff}])
if test "x${want_tiff}" = "xyes" ; then
OPJ_CHECK_LIB([/usr],
OPJ_CHECK_LIB(
[tiff.h],
[tiff],
[TIFFOpen],
[have_libtiff="yes"],
[have_libtiff="no"])
if ! test "x${have_libtiff}" = "xyes" ; then
OPJ_CHECK_LIB([/usr/local],
[tiff.h],
[tiff],
[TIFFOpen],
[have_libtiff="yes"],
[have_libtiff="no"])
fi
if ! test "x${have_libtiff}" = "xyes" ; then
OPJ_CHECK_LIB([/opt],
[tiff.h],
[tiff],
[TIFFOpen],
[have_libtiff="yes"],
[have_libtiff="no"])
fi
if test "x${have_libtiff}" = "xno" ; then
AC_MSG_WARN([Can not find a usuable TIFF library. Make sure that CPPFLAGS and LDFLAGS are correctly set.])
fi
@ -339,11 +267,6 @@ fi
AM_CONDITIONAL([with_libtiff], [test "x${have_libtiff}" = "xyes"])
AC_ARG_VAR([TIFF_CFLAGS], [preprocessor flags for libtiff])
AC_SUBST(TIFF_CFLAGS)
AC_ARG_VAR([TIFF_LIBS], [linker flags for libtiff])
AC_SUBST(TIFF_LIBS)
# libcms2
lcms_output="no"
@ -413,6 +336,31 @@ if test "x${have_lcms2}" = "xno" ; then
fi
# libfcgi
if test "x${want_jpip}" = "xyes" ; then
have_fcgi="no"
OPJ_CHECK_LIB(
[fcgi_stdio.h],
[fcgi],
[FCGI_Accept],
[have_fcgi="yes"],
[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"
fi
fi
if test "x${want_jpip}" = "xyes" ; then
AC_DEFINE(USE_JPIP, [1], [define to 1 if you use jpip])
fi
AM_CONDITIONAL([WANT_JPIP], [test "x${want_jpip}" = "xyes"])
### Checks for header files
## FIXME: declarations must be fixed in source code. See autoconf manual

View File

@ -3,12 +3,12 @@ dnl That code is public domain and can be freely used or copied.
dnl Macro that check if a library is in a specified directory.
dnl Usage: OPJ_CHECK_LIB(prefix, header, lib, func [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Usage: OPJ_CHECK_LIB_WITH_PREFIX(prefix, header, lib, func [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Call AC_SUBST(THELIB_CFLAGS)
dnl Call AC_SUBST(THELIB_LIBS)
dnl where THELIB is the uppercase value of 'lib'
AC_DEFUN([OPJ_CHECK_LIB],
AC_DEFUN([OPJ_CHECK_LIB_WITH_PREFIX],
[
m4_pushdef([UP], m4_toupper([$3]))
@ -21,36 +21,108 @@ __opj_func=$4
__opj_have_dep="no"
save_CPPFLAGS=${CPPFLAGS}
CPPFLAGS="${CPPFLAGS} -I${__opj_prefix}/include"
AC_CHECK_HEADER([${__opj_header}], [__opj_have_dep="yes"], [__opj_have_dep="no"])
CPPFLAGS=${save_CPPFLAGS}
save_LDFLAGS=${LDFLAGS}
save_LIBS=${LIBS}
if test "x${__opj_have_dep}" = "xyes" ; then
save_LDFLAGS=${LDFLAGS}
if test "x${__opj_prefix}" = "x" ; then
CPPFLAGS="${CPPFLAGS} $UP[_CFLAGS]"
LDFLAGS="${LDFLAGS} $UP[_LIBS]"
else
CPPFLAGS="${CPPFLAGS} -I${__opj_prefix}/include"
LDFLAGS="${LDFLAGS} -L${__opj_prefix}/lib"
AC_CHECK_LIB([${__opj_lib}],
[${__opj_func}],
[__opj_have_dep="yes"],
[__opj_have_dep="no"])
LDFLAGS=${save_LDFLAGS}
LIBS="${LIBS} -l${__opj_lib}"
fi
if test "x${__opj_have_dep}" = "xyes" ; then
if ! test "x$1" = "x/usr" ; then
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <${__opj_header}>
]],
[[
${__opj_func}();
]])],
[__opj_have_dep="yes"],
[__opj_have_dep="no"])
CPPFLAGS=${save_CPPFLAGS}
LDFLAGS=${save_LDFLAGS}
LIBS=${save_LIBS}
if test "x${__opj_prefix}" = "x" ; then
AC_MSG_CHECKING([whether ]UP[ library is available in standard or predefined directories])
else
AC_MSG_CHECKING([whether ]UP[ library is available in ${__opj_prefix}])
fi
AC_MSG_RESULT([${__opj_have_dep}])
if test "x${__opj_have_dep}" = "xyes" && ! test "x${__opj_prefix}" = "x"; then
if test "x${UP[]_CFLAGS}" = "x" ; then
UP[]_CFLAGS="-I${__opj_prefix}/include"
UP[]_LIBS="-L${__opj_prefix}/lib"
fi
UP[]_LIBS="${UP[]_LIBS} -l${__opj_lib}"
if test "x${UP[]_LIBS}" = "x" ; then
UP[]_LIBS="-L${__opj_prefix}/lib -l${__opj_lib}"
fi
fi
AC_ARG_VAR(UP[_CFLAGS], [preprocessor flags for lib$3])
AC_SUBST(UP[_CFLAGS])
AC_ARG_VAR(UP[_LIBS], [linker flags for lib$3])
AC_SUBST(UP[_LIBS])
AS_IF([test "x${__opj_have_dep}" = "xyes"], [$5], [$6])
m4_popdef([UP])
m4_popdef([DOWN])
])
dnl Macro that check if a library is in a set of directories.
dnl Usage: OPJ_CHECK_LIB(header, lib, func [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
AC_DEFUN([OPJ_CHECK_LIB],
[
m4_pushdef([UP], m4_toupper([$2]))
__opj_have_dep="no"
OPJ_CHECK_LIB_WITH_PREFIX([],
[$1],
[$2],
[$3],
[__opj_have_dep="yes"],
[__opj_have_dep="no"])
if ! test "x${__opj_have_dep}" = "xyes" ; then
OPJ_CHECK_LIB_WITH_PREFIX([/usr],
[$1],
[$2],
[$3],
[__opj_have_dep="yes"],
[__opj_have_dep="no"])
fi
if ! test "x${__opj_have_dep}" = "xyes" ; then
OPJ_CHECK_LIB_WITH_PREFIX([/usr/local],
[$1],
[$2],
[$3],
[__opj_have_dep="yes"],
[__opj_have_dep="no"])
fi
if ! test "x${__opj_have_dep}" = "xyes" ; then
OPJ_CHECK_LIB_WITH_PREFIX([/opt/local],
[$1],
[$2],
[$3],
[__opj_have_dep="yes"],
[__opj_have_dep="no"])
fi
AC_ARG_VAR(UP[_CFLAGS], [preprocessor flags for lib$2])
AC_SUBST(UP[_CFLAGS])
AC_ARG_VAR(UP[_LIBS], [linker flags for lib$2])
AC_SUBST(UP[_LIBS])
AS_IF([test "x${__opj_have_dep}" = "xyes"], [$4], [$5])
m4_popdef([UP])
])