2011-03-04 11:53:27 +01:00
2011-03-10 18:08:50 +01:00
# According to http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info :
#
# 1) when bugs are fixed or internal code is changed: increase MICRO
# 2) if API is added, increase MINOR and set MICRO to 0
# 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
2011-03-04 11:53:27 +01:00
m4_define([OPJ_MAJOR], [1])
m4_define([OPJ_MINOR], [4])
2011-07-13 18:29:22 +02:00
m4_define([OPJ_MICRO], [99])
2011-03-04 11:53:27 +01:00
2011-03-10 18:08:50 +01:00
m4_define([lt_cur], m4_eval(OPJ_MAJOR + OPJ_MINOR))
m4_define([lt_rev], OPJ_MICRO)
2011-03-04 11:53:27 +01:00
m4_define([lt_age], OPJ_MINOR)
AC_PREREQ([2.62])
AC_INIT([OpenJPEG],
[OPJ_MAJOR.OPJ_MINOR.OPJ_MICRO],
[openjpeg@googlegroups.com],
[openjpeg],
[http://www.openjpeg.org])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([opj_config.h])
2010-10-05 12:33:15 +02:00
AC_CANONICAL_SYSTEM
2011-03-04 11:53:27 +01:00
AC_CANONICAL_HOST
2011-08-27 14:53:38 +02:00
AM_INIT_AUTOMAKE([1.11 foreign dist-bzip2])
2011-03-04 11:53:27 +01:00
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
2010-10-05 12:33:15 +02:00
MAJOR_NR=OPJ_MAJOR
MINOR_NR=OPJ_MINOR
2011-03-04 11:53:27 +01:00
MICRO_NR=OPJ_MICRO
2010-10-05 12:33:15 +02:00
AC_SUBST(MAJOR_NR)
AC_SUBST(MINOR_NR)
2011-03-04 11:53:27 +01:00
AC_SUBST(MICRO_NR)
LT_PREREQ([2.0])
LT_INIT([win32-dll])
2011-03-10 18:08:50 +01:00
lt_version=lt_cur:lt_rev:lt_age
2011-03-04 11:53:27 +01:00
AC_SUBST(lt_version)
### Needed information
have_win32=no
have_darwin="no"
case "$host_os" in
mingw*)
have_win32="yes"
;;
darwin*)
have_darwin="yes"
;;
esac
AM_CONDITIONAL([HAVE_WIN32], [test "x${have_win32}" = "xyes"])
AM_CONDITIONAL([HAVE_DARWIN], [test "x${have_darwin}" = "xyes"])
### Additional options to configure
# debug
AC_ARG_ENABLE([debug],
[AC_HELP_STRING([--enable-debug], [build with debug symbols @<:@default=disabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_debug="yes"
2010-10-13 16:49:39 +02:00
else
2011-03-04 11:53:27 +01:00
want_debug="no"
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
],
[want_debug="no"])
AC_MSG_CHECKING([whether to build in debug mode])
AC_MSG_RESULT([${want_debug}])
# MJ2
AC_ARG_ENABLE([mj2],
[AC_HELP_STRING([--enable-mj2], [build mj2 binaries @<:@default=disabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_mj2="yes"
else
want_mj2="no"
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
],
[want_mj2="no"])
AC_MSG_CHECKING([whether to build the MJ2 binaries])
AC_MSG_RESULT([${want_mj2}])
if test "x${want_mj2}" = "xyes" ; then
AC_DEFINE(USE_MJ2, [1], [define to 1 if you use mj2])
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
AM_CONDITIONAL([WANT_MJ2], [test "x${want_mj2}" = "xyes"])
# JPWL
AC_ARG_ENABLE([jpwl],
[AC_HELP_STRING([--enable-jpwl], [build JPWL library @<:@default=disabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_jpwl="yes"
else
want_jpwl="no"
fi
],
[want_jpwl="no"])
AC_MSG_CHECKING([whether to build the JPWL library])
AC_MSG_RESULT([${want_jpwl}])
AM_CONDITIONAL([WANT_JPWL], [test "x${want_jpwl}" = "xyes"])
2011-05-23 22:30:20 +02:00
# JPIP
2011-03-04 11:53:27 +01:00
2011-05-23 22:30:20 +02:00
AC_ARG_ENABLE([jpip],
[AC_HELP_STRING([--enable-jpip], [build jpip library @<:@default=disabled@:>@])],
2011-03-04 11:53:27 +01:00
[
if test "x${enableval}" = "xyes" ; then
2011-05-23 22:30:20 +02:00
want_jpip="yes"
2011-03-04 11:53:27 +01:00
else
2011-05-23 22:30:20 +02:00
want_jpip="no"
2011-03-04 11:53:27 +01:00
fi
],
2011-05-23 22:30:20 +02:00
[want_jpip="no"])
AC_MSG_CHECKING([whether to build the JPIP library])
AC_MSG_RESULT([${want_jpip}])
2011-03-04 11:53:27 +01:00
### Checks for programs
AC_PROG_CC
# pkg-config
PKG_PROG_PKG_CONFIG
# Check whether pkg-config supports Requires.private
if $PKG_CONFIG --atleast-pkgconfig-version 0.22 ; then
pkgconfig_requires_private="Requires.private"
else
pkgconfig_requires_private="Requires"
fi
AC_SUBST(pkgconfig_requires_private)
2011-04-12 18:18:51 +02:00
AC_SUBST(requirements)
2011-03-04 11:53:27 +01:00
# doxygen
OPJ_CHECK_DOXYGEN
# ln -s
AC_PROG_LN_S
### Checks for libraries
# libpng
2011-03-05 18:36:08 +01:00
have_libpng="no"
2011-03-04 11:53:27 +01:00
AC_ARG_ENABLE([png],
[AC_HELP_STRING([--disable-png], [disable PNG support @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_png="yes"
else
want_png="no"
fi
],
[want_png="yes"])
AC_MSG_CHECKING([whether to build with PNG support])
AC_MSG_RESULT([${want_png}])
if test "x${want_png}" = "xyes" ; then
2011-07-23 10:32:09 +02:00
PKG_CHECK_MODULES([PNG], [libpng15],
2011-03-04 11:53:27 +01:00
[have_libpng="yes"],
[
2011-07-23 10:32:09 +02:00
PKG_CHECK_MODULES([PNG], [libpng14],
2011-03-04 11:53:27 +01:00
[have_libpng="yes"],
[
2011-07-23 10:32:09 +02:00
PKG_CHECK_MODULES([PNG], [libpng12],
2011-03-04 11:53:27 +01:00
[have_libpng="yes"],
[
PKG_CHECK_MODULES([PNG], [libpng],
[have_libpng="yes"],
[have_libpng="no"])
])
])
])
if ! test "x${have_libpng}" = "xyes" ; then
2011-08-15 15:25:58 +02:00
OPJ_CHECK_LIB([png.h],
2011-03-04 11:53:27 +01:00
[png],
[png_create_write_struct],
[have_libpng="yes"],
[have_libpng="no"])
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
if test "x${have_libpng}" = "xno" ; then
AC_MSG_WARN([Can not find a usuable PNG library. Make sure that CPPFLAGS and LDFLAGS are correctly set.])
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
AC_MSG_CHECKING([whether PNG is available])
AC_MSG_RESULT([${have_libpng}])
if test "x${have_libpng}" = "xyes" ; then
AC_DEFINE(HAVE_LIBPNG, [1], [define to 1 if you have libpng])
fi
AM_CONDITIONAL([with_libpng], [test x${have_libpng} = "xyes"])
2011-05-23 22:30:20 +02:00
# libtiff
2011-03-04 11:53:27 +01:00
2011-03-05 18:36:08 +01:00
have_libtiff="no"
2011-03-04 11:53:27 +01:00
AC_ARG_ENABLE([tiff],
[AC_HELP_STRING([--disable-tiff], [disable TIFF support @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_tiff="yes"
else
want_tiff="no"
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
],
[want_tiff="yes"])
AC_MSG_CHECKING([whether to build with TIFF support])
AC_MSG_RESULT([${want_tiff}])
if test "x${want_tiff}" = "xyes" ; then
2011-08-15 15:25:58 +02:00
OPJ_CHECK_LIB(
2011-03-04 11:53:27 +01:00
[tiff.h],
[tiff],
[TIFFOpen],
[have_libtiff="yes"],
[have_libtiff="no"])
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.])
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
fi
AC_MSG_CHECKING([whether TIFF is available])
AC_MSG_RESULT([${have_libtiff}])
if test "x${have_libtiff}" = "xyes" ; then
AC_DEFINE(HAVE_LIBTIFF, [1], [define to 1 if you have libtiff])
fi
AM_CONDITIONAL([with_libtiff], [test "x${have_libtiff}" = "xyes"])
# libcms2
lcms_output="no"
2011-08-11 14:22:31 +02:00
have_lcms2="no"
2011-03-04 11:53:27 +01:00
AC_ARG_ENABLE([lcms2],
[AC_HELP_STRING([--disable-lcms2], [disable LCMS-2 support @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_lcms2="yes"
else
want_lcms2="no"
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
],
[want_lcms2="yes"])
AC_MSG_CHECKING([whether to build with LCMS-2 support])
AC_MSG_RESULT([${want_lcms2}])
if test "x${want_lcms2}" = "xyes" ; then
PKG_CHECK_MODULES([LCMS2], [lcms2],
2011-07-13 18:29:22 +02:00
[have_lcms2="yes"],
2011-03-04 11:53:27 +01:00
[have_lcms2="no"])
fi
AC_MSG_CHECKING([whether LCMS-2 is available])
AC_MSG_RESULT([${have_lcms2}])
if test "x${have_lcms2}" = "xyes" ; then
AC_DEFINE(HAVE_LIBLCMS2, [1], [define to 1 if you have lcms version 2.x])
lcms_output="lcms version 2.x"
fi
# libcms1
AC_ARG_ENABLE([lcms1],
[AC_HELP_STRING([--disable-lcms1], [disable LCMS-1 support @<:@default=enabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_lcms1="yes"
else
want_lcms1="no"
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
],
[want_lcms1="yes"])
AC_MSG_CHECKING([whether to build with LCMS-1 support])
AC_MSG_RESULT([${want_lcms1}])
if test "x${have_lcms2}" = "xno" ; then
if test "x${want_lcms1}" = "xyes" ; then
PKG_CHECK_MODULES([LCMS1], [lcms1],
2011-07-13 18:29:22 +02:00
[have_lcms1="yes"],
2011-03-04 11:53:27 +01:00
[PKG_CHECK_MODULES([LCMS1], [lcms],
2011-07-13 18:29:22 +02:00
[have_lcms1="yes"],
2011-03-04 11:53:27 +01:00
[have_lcms1="no"])])
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
AC_MSG_CHECKING([whether LCMS-1 is available])
AC_MSG_RESULT([${have_lcms1}])
if test "x${have_lcms1}" = "xyes" ; then
AC_DEFINE(HAVE_LIBLCMS1, [1], [define to 1 if you have lcms version 1.x])
lcms_output="lcms version 1.x"
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
2011-08-15 15:25:58 +02:00
# 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.])
2011-11-16 20:20:50 +01:00
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.])
2011-08-15 15:25:58 +02:00
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"])
2011-03-04 11:53:27 +01:00
### Checks for header files
## FIXME: declarations must be fixed in source code. See autoconf manual
AC_HEADER_DIRENT
### Checks for types
### Checks for structures
### Checks for compiler characteristics
2011-08-16 15:23:36 +02:00
AM_PROG_CC_C_O
2011-03-04 11:53:27 +01:00
AC_C_BIGENDIAN
#OPJ_COMPILER_FLAG([-Wall])
#OPJ_COMPILER_FLAG([-Wextra])
#OPJ_COMPILER_FLAG([-Wshadow])
#OPJ_COMPILER_FLAG([-Wpointer-arith])
OPJ_COMPILER_FLAG([-Wno-unused-result])
if test "x${want_debug}" = "xyes" ; then
OPJ_COMPILER_FLAG([-g])
OPJ_COMPILER_FLAG([-O0])
else
OPJ_COMPILER_FLAG([-O3])
2010-10-05 12:33:15 +02:00
fi
2011-03-04 11:53:27 +01:00
### Checks for linker characteristics
### Checks for library functions
2011-10-01 06:55:00 +02:00
### Post configuration
AM_CONDITIONAL([BUILD_SHARED], [test "x${enable_shared}" = "xyes"])
AM_CONDITIONAL([BUILD_STATIC], [test "x${enable_static}" = "xyes"])
2011-03-04 11:53:27 +01:00
AC_CONFIG_FILES([
Makefile
libopenjpeg1.pc
2011-07-13 18:29:22 +02:00
libopenjpeg-jpwl.pc
2011-03-04 11:53:27 +01:00
libopenjpeg/Makefile
2011-05-23 22:30:20 +02:00
libopenjpeg/jpwl/Makefile
applications/Makefile
applications/codec/Makefile
applications/mj2/Makefile
applications/jpip/Makefile
applications/jpip/libopenjpip/Makefile
2011-11-02 01:49:20 +01:00
applications/jpip/util/Makefile
2011-03-04 11:53:27 +01:00
doc/Makefile
])
2010-10-05 12:33:15 +02:00
AC_OUTPUT
2011-03-04 11:53:27 +01:00
### Summary
echo
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo
echo "Configuration Options Summary:"
echo
echo " Debug...............: ${want_debug}"
echo
echo " Optional support:"
echo " libpng............: ${have_libpng}"
echo " libtiff...........: ${have_libtiff}"
echo " libcms............: ${lcms_output}"
echo
echo " Documentation.......: ${opj_have_doxygen}"
echo " Build.............: make doc"
echo
echo " mj2.................: ${want_mj2}"
echo " jpwl................: ${want_jpwl}"
2011-05-23 22:30:20 +02:00
echo " jpip................: ${want_jpip}"
2011-03-04 11:53:27 +01:00
echo