[1.5] Man page syntax fixes. Thanks to vskytta for patch.
[openjpeg.git] / configure.ac
index a7ab3c44251b7a04bd51b207985a2e1a36242dc9..317ffa236a62f4872a2b70ffb977203908fe8449 100644 (file)
@@ -6,21 +6,13 @@
 # 3) if API or ABI is broken (this case should (must) never happen as it's very bad for a library), or a new designed library, increase MAJOR and set MINOR and MICRO to 0
 
 m4_define([OPJ_MAJOR], [1])
-m4_define([OPJ_MINOR], [4])
+m4_define([OPJ_MINOR], [5])
 m4_define([OPJ_MICRO], [0])
 
-m4_define([JP3D_MAJOR], [1])
-m4_define([JP3D_MINOR], [3])
-m4_define([JP3D_MICRO], [0])
-
 m4_define([lt_cur], m4_eval(OPJ_MAJOR + OPJ_MINOR))
 m4_define([lt_rev], OPJ_MICRO)
 m4_define([lt_age], OPJ_MINOR)
 
-m4_define([lt_cur_jp3d], m4_eval(JP3D_MAJOR + JP3D_MINOR))
-m4_define([lt_rev_jp3d], JP3D_MICRO)
-m4_define([lt_age_jp3d], JP3D_MINOR)
-
 AC_PREREQ([2.62])
 AC_INIT([OpenJPEG],
    [OPJ_MAJOR.OPJ_MINOR.OPJ_MICRO],
@@ -34,31 +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)
-
-JP3D_MAJOR_NR=JP3D_MAJOR
-JP3D_MINOR_NR=JP3D_MINOR
-JP3D_MICRO_NR=JP3D_MICRO
-AC_SUBST(JP3D_MAJOR_NR)
-AC_SUBST(JP3D_MINOR_NR)
-AC_SUBST(JP3D_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)
-
-lt_version_jp3d=lt_cur_jp3d:lt_rev_jp3d:lt_age_jp3d
-AC_SUBST(lt_version_jp3d)
+AC_SUBST([lt_version])
 
 
 ### Needed information
@@ -134,33 +116,37 @@ 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"])
 
-# JP3D
+# JPIP
 
-AC_ARG_ENABLE([jp3d],
-   [AC_HELP_STRING([--enable-jp3d], [build jp3d library @<:@default=disabled@:>@])],
+AC_ARG_ENABLE([jpip],
+   [AC_HELP_STRING([--enable-jpip], [build jpip library @<:@default=disabled@:>@])],
    [
     if test "x${enableval}" = "xyes" ; then
-       want_jp3d="yes"
+       want_jpip="yes"
     else
-       want_jp3d="no"
+       want_jpip="no"
     fi
    ],
-   [want_jp3d="no"])
+   [want_jpip="no"])
 
-AC_MSG_CHECKING([whether to build the JP3D library])
-AC_MSG_RESULT([${want_jp3d}])
+AC_MSG_CHECKING([whether to build the JPIP library])
+AC_MSG_RESULT([${want_jpip}])
 
-if test "x${want_jp3d}" = "xyes" ; then
-   AC_DEFINE(USE_JP3D, [1], [define to 1 if you use jp3d])
-fi
+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"])
 
-AM_CONDITIONAL([WANT_JP3D], [test "x${want_jp3d}" = "xyes"])
+AC_MSG_CHECKING([whether to build the JPIP server])
+AC_MSG_RESULT([${want_jpip_server}])
 
 
 ### Checks for programs
@@ -177,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
 
@@ -211,16 +197,16 @@ AC_MSG_RESULT([${want_png}])
 
 if test "x${want_png}" = "xyes" ; then
 
-   PKG_CHECK_MODULES([PNG], [libpng14],
+   PKG_CHECK_MODULES([PNG], [libpng15 zlib],
       [have_libpng="yes"],
       [
-       PKG_CHECK_MODULES([PNG], [libpng12],
+       PKG_CHECK_MODULES([PNG], [libpng14 zlib],
           [have_libpng="yes"],
           [
-           PKG_CHECK_MODULES([PNG], [libpng10],
+           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"])
               ])
@@ -228,30 +214,23 @@ 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"],
+      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}" = "xyes" ; then
-      OPJ_CHECK_LIB([/opt],
-         [png.h],
-         [png],
-         [png_create_write_struct],
-         [have_libpng="yes"],
-         [have_libpng="no"])
    fi
 
    if test "x${have_libpng}" = "xno" ; then
@@ -269,7 +248,7 @@ fi
 
 AM_CONDITIONAL([with_libpng], [test x${have_libpng} = "xyes"])
 
-#libtiff
+# libtiff
 
 have_libtiff="no"
 
@@ -289,31 +268,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
@@ -328,14 +289,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@:>@])],
@@ -353,10 +310,7 @@ AC_MSG_RESULT([${want_lcms2}])
 
 if test "x${want_lcms2}" = "xyes" ; then
    PKG_CHECK_MODULES([LCMS2], [lcms2],
-      [
-       have_lcms2="yes"
-       requirements="lcms2"
-      ],
+      [have_lcms2="yes"],
       [have_lcms2="no"])
 fi
 
@@ -388,15 +342,9 @@ if test "x${have_lcms2}" = "xno" ; then
 
    if test "x${want_lcms1}" = "xyes" ; then
       PKG_CHECK_MODULES([LCMS1], [lcms1],
-         [
-          have_lcms1="yes"
-          requirements="lcms1"
-         ],
+         [have_lcms1="yes"],
          [PKG_CHECK_MODULES([LCMS1], [lcms],
-            [
-             have_lcms1="yes"
-             requirements="lcms"
-            ],
+            [have_lcms1="yes"],
             [have_lcms1="no"])])
    fi
 
@@ -410,7 +358,98 @@ 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.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 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_server}" = "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 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
+
+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"])
+
+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
 
@@ -426,6 +465,7 @@ AC_HEADER_DIRENT
 
 ### Checks for compiler characteristics
 
+AM_PROG_CC_C_O
 AC_C_BIGENDIAN
 
 #OPJ_COMPILER_FLAG([-Wall])
@@ -447,17 +487,26 @@ 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
+libopenjpeg-jpwl.pc
 libopenjpeg/Makefile
-jpwl/Makefile
-codec/Makefile
-mj2/Makefile
+libopenjpeg/jpwl/Makefile
+applications/Makefile
+applications/codec/Makefile
+applications/mj2/Makefile
+applications/jpip/Makefile
+applications/jpip/libopenjpip/Makefile
+applications/jpip/util/Makefile
 doc/Makefile
-jp3d/Makefile
-jp3d/libjp3dvm/Makefile
-jp3d/codec/Makefile
 ])
 
 AC_OUTPUT
@@ -486,5 +535,6 @@ echo "    Build.............: make doc"
 echo
 echo "  mj2.................: ${want_mj2}"
 echo "  jpwl................: ${want_jpwl}"
-echo "  jp3d................: ${want_jp3d}"
+echo "  jpip................: ${want_jpip}"
+echo "  jpip server.........: ${want_jpip_server}"
 echo