BUG: 26 Fix issue with memory consumption.
[openjpeg.git] / configure.ac
index acd998c9a5d17f414590f353cf1d84548fe405d9..cef24a518d6cf7f17a7e19408b899db357fe9634 100644 (file)
@@ -26,7 +26,7 @@ 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])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 MAJOR_NR=OPJ_MAJOR
@@ -116,10 +116,6 @@ AC_ARG_ENABLE([jpwl],
 AC_MSG_CHECKING([whether to build the JPWL library])
 AC_MSG_RESULT([${want_jpwl}])
 
-if test "x${want_jpwl}" = "xyes" ; then
-   AC_DEFINE(USE_JPWL, [1], [define to 1 if you use jpwl])
-fi
-
 AM_CONDITIONAL([WANT_JPWL], [test "x${want_jpwl}" = "xyes"])
 
 # JPIP
@@ -138,41 +134,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
 
@@ -222,13 +183,13 @@ AC_MSG_RESULT([${want_png}])
 
 if test "x${want_png}" = "xyes" ; then
 
-   PKG_CHECK_MODULES([PNG], [libpng14],
+   PKG_CHECK_MODULES([PNG], [libpng15],
       [have_libpng="yes"],
       [
-       PKG_CHECK_MODULES([PNG], [libpng12],
+       PKG_CHECK_MODULES([PNG], [libpng14],
           [have_libpng="yes"],
           [
-           PKG_CHECK_MODULES([PNG], [libpng10],
+           PKG_CHECK_MODULES([PNG], [libpng12],
               [have_libpng="yes"],
               [
                PKG_CHECK_MODULES([PNG], [libpng],
@@ -239,26 +200,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 +242,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,14 +263,10 @@ 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"
+have_lcms2="no"
 
 AC_ARG_ENABLE([lcms2],
    [AC_HELP_STRING([--disable-lcms2], [disable LCMS-2 support @<:@default=enabled@:>@])],
@@ -412,6 +332,46 @@ 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
+
+# libcurl
+
+if test "x${want_jpip}" = "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"
+   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
@@ -426,6 +386,7 @@ AC_HEADER_DIRENT
 
 ### Checks for compiler characteristics
 
+AM_PROG_CC_C_O
 AC_C_BIGENDIAN
 
 #OPJ_COMPILER_FLAG([-Wall])
@@ -447,6 +408,13 @@ fi
 
 ### Checks for library functions
 
+
+### Post configuration
+
+AM_CONDITIONAL([BUILD_SHARED], [test "x${enable_shared}" = "xyes"])
+AM_CONDITIONAL([BUILD_STATIC], [test "x${enable_static}" = "xyes"])
+
+
 AC_CONFIG_FILES([
 Makefile
 libopenjpeg1.pc
@@ -458,11 +426,7 @@ applications/codec/Makefile
 applications/mj2/Makefile
 applications/jpip/Makefile
 applications/jpip/libopenjpip/Makefile
-applications/jpip/opj_server/Makefile
-applications/jpip/opj_client/Makefile
-applications/jpip/opj_client/opj_dec_server/Makefile
-applications/jpip/tools/Makefile
-applications/jpip/tools/indexer/Makefile
+applications/jpip/util/Makefile
 doc/Makefile
 ])