Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. #AC_PREREQ([2.65])
  2. define([OPJ_MAJOR], [1])
  3. define([OPJ_MINOR], [4])
  4. define([OPJ_BUILD], [0])
  5. #
  6. define([JP3D_MAJOR], [1])
  7. define([JP3D_MINOR], [3])
  8. define([JP3D_BUILD], [0])
  9. #
  10. #
  11. #AC_INIT (PACKAGE, VERSION, [BUG-REPORT], [TARNAME], [URL])
  12. AC_INIT(OpenJPEG,
  13. OPJ_MAJOR.OPJ_MINOR.OPJ_BUILD,
  14. http://code.google.com/p/openjpeg/,
  15. openjpeg-OPJ_MAJOR.OPJ_MINOR.OPJ_BUILD,
  16. http://www.openjpeg.org/)
  17. AC_CONFIG_SRCDIR([libopenjpeg/openjpeg.c])
  18. AC_CONFIG_HEADERS(opj_config.h)
  19. #
  20. AC_CANONICAL_SYSTEM
  21. #foreign:package will not follow the GNU Standards
  22. AM_INIT_AUTOMAKE(foreign)
  23. #
  24. MAJOR_NR=OPJ_MAJOR
  25. MINOR_NR=OPJ_MINOR
  26. BUILD_NR=OPJ_BUILD
  27. AC_SUBST(MAJOR_NR)
  28. AC_SUBST(MINOR_NR)
  29. AC_SUBST(BUILD_NR)
  30. #
  31. JP3D_MAJOR_NR=JP3D_MAJOR
  32. JP3D_MINOR_NR=JP3D_MINOR
  33. JP3D_BUILD_NR=JP3D_BUILD
  34. AC_SUBST(JP3D_MAJOR_NR)
  35. AC_SUBST(JP3D_MINOR_NR)
  36. AC_SUBST(JP3D_BUILD_NR)
  37. #
  38. # Checks for programs.
  39. AC_PROG_CC
  40. AC_PROG_CXX
  41. AC_PROG_INSTALL
  42. AC_PROG_LN_S
  43. AC_PROG_SED
  44. AC_SYS_LARGEFILE
  45. AC_FUNC_FSEEKO
  46. AC_PROG_MAKE_SET
  47. #AC_HEADER_DIRENT
  48. #
  49. # Tests for Windows
  50. #
  51. AC_EXEEXT
  52. AC_OBJEXT
  53. #
  54. # Configure libtool
  55. AC_ENABLE_SHARED
  56. AC_LIBTOOL_WIN32_DLL
  57. AC_LIBTOOL_SETUP
  58. AC_PROG_LIBTOOL
  59. #
  60. AC_C_BIGENDIAN
  61. #
  62. LIB_MATH=""
  63. AC_CHECK_LIB(m,sqrt,LIB_MATH="-lm",,)
  64. LIB_Z=""
  65. AC_CHECK_LIB(z,inflate,LIB_Z="-lz",,)
  66. #
  67. LIBS="$LIBS $LIB_MATH $LIB_Z"
  68. #
  69. AC_PATH_PROG([PKGCONFIG], [pkg-config])
  70. #
  71. # ------------------------------
  72. # Test for PNG
  73. # ------------------------------
  74. AC_MSG_CHECKING(whether to build with PNG support)
  75. pngincludes=""
  76. pnglibs=""
  77. png_header_found="no"
  78. with_libpng="yes"
  79. #
  80. AC_ARG_ENABLE(png,
  81. [  --enable-png[=[yes|no]]          Build with PNG support [ [default=yes] ]],
  82. test "$enable_png" = "no"  && with_libpng="no")
  83. #
  84. if test "x$with_libpng" = xyes ; then
  85.   with_libpng="no"
  86.   AC_PATH_PROG([LIBPNG_CONFIG], [libpng-config])
  87. #
  88.   pngheader=""
  89.   AC_ARG_WITH(png_includes,
  90.  [  --with-png-includes=DIR         PNG includes in nonstandard DIR])
  91.   if test -n "$with_png_includes" ; then
  92.    pngheader="$with_png_includes"
  93.    pngincludes="-I$with_png_includes"
  94.   else
  95.    if test -n "$PKGCONFIG" ; then
  96.      pngincludes="`$PKGCONFIG --variable=includedir libpng`"
  97.      if test -n "$pngincludes" ; then
  98.       pngheader="$pngincludes"
  99.       pngincludes="-I$pngincludes"
  100.      fi
  101.    else
  102.      if test -n "$LIBPNG_CONFIG" ; then
  103.       pngincludes="`$LIBPNG_CONFIG --I_opts`"
  104.       pngheader="`$LIBPNG_CONFIG --I_opts | $SED 's/-I//'`"
  105.      fi
  106.    fi
  107.   fi
  108.   if test -n "$pngheader" ; then
  109.    pngheader="$pngheader/png.h"
  110.   else
  111.    pngheader="png.h"
  112.   fi
  113. #
  114.   AC_CHECK_HEADER($pngheader,png_header_found="yes",,)
  115. #
  116.   AC_ARG_WITH(png_libraries,
  117.  [  --with-png-libraries=DIR        PNG library in nonstandard DIR])
  118.   if [[ -n "$with_png_libraries" ]] ; then
  119.    pnglibs="-L$with_png_libraries -lpng"
  120.   else
  121.     if test -n "$LIBPNG_CONFIG" ; then
  122.      pnglibs="`$LIBPNG_CONFIG --ldflags`"
  123.     else
  124.       if test -n "$PKGCONFIG" ; then
  125.         pnglibs="`$PKGCONFIG --libs libpng`"
  126.       fi
  127.     fi
  128.   fi
  129.   savedLIBS="$LIBS"
  130.   LIBS="$pnglibs $LIB_Z $LIB_MATH"
  131. #
  132.   AC_CHECK_LIB(png,png_create_read_struct,,pnglibs="",)
  133. #
  134.   LIBS="$savedLIBS"
  135.   if test -n "$pnglibs" ; then
  136.     if test -n "$pngincludes" ; then
  137.       with_libpng="yes"
  138.       png_header_found="yes"
  139.       LIBS="$LIBS $pnglibs"
  140.       AC_DEFINE(HAVE_LIBPNG, [1], [define to 1 if you have libpng])
  141.     fi
  142.   fi
  143. fi
  144. #
  145. AC_MSG_RESULT(png is usable:$with_libpng)
  146. AM_CONDITIONAL([with_libpng], [test x$with_libpng = xyes])
  147. AC_SUBST(pngincludes)
  148. AC_SUBST(pnglibs)
  149. # -------------------------------
  150. # Test for TIFF
  151. # -------------------------------
  152. AC_MSG_CHECKING(whether to build with TIFF support)
  153. tifflibs=""
  154. tiffincludes=""
  155. with_libtiff="yes"
  156. tiff_header_found="no"
  157. #
  158. AC_ARG_ENABLE(tiff,
  159. [  --enable-tiff[=[yes|no]]         Build with TIFF support [ [default=yes] ]],
  160. test "$enable_tiff" = "no"  && with_libtiff="no")
  161. #
  162. if test "x$with_libtiff" = xyes ; then
  163. #TIFF compiled with JPEG and JBIG support?
  164.  libjpeg=""
  165.  AC_CHECK_LIB(jpeg,jpeg_read_header,libjpeg=-ljpeg,,)
  166.  libjbig=""
  167.  AC_CHECK_LIB(jbig,jbg_enc_init,libjbig=-ljbig,,)
  168.  libjbig85=""
  169.  AC_CHECK_LIB(jbig85,jbg85_enc_init,libjbig85=-ljbig85,,)
  170. #standard path
  171.  with_libtiff="no"
  172.  savedLIBS="$LIBS"
  173.  LIBS="-ltiff $libjpeg $libjbig $libjbig85 $LIB_Z $LIB_MATH"
  174.  AC_CHECK_LIB(tiff, TIFFOpen, tifflibs=-ltiff)
  175.  LIBS="$savedLIBS"
  176.  if test -n "$tifflibs" ; then
  177.   AC_CHECK_HEADER(tiff.h,tiff_header_found="yes",,)
  178.   if test "$tiff_header_found" = "yes" ; then
  179.    with_libtiff="yes"
  180.    LIBS="$LIBS -ltiff $libjpeg $libjbig $libjbig85"
  181.    AC_DEFINE(HAVE_LIBTIFF, [1], [define to 1 if you have libtiff])
  182.   fi
  183.  fi
  184. #
  185.  if test "x$with_libtiff" = xno ; then
  186. #non-standard path
  187.   AC_ARG_WITH(tiff_includes,
  188.   [  --with-tiff-includes=DIR        TIFF includes in nonstandard DIR])
  189.   if test -n "$with_tiff_includes" ; then
  190.    tiffheader="$with_tiff_includes/tiff.h"
  191.    AC_CHECK_HEADER($tiffheader,tiff_header_found="yes",,)
  192.    if test "$tiff_header_found" = "yes" ; then
  193.      tiffincludes="-I$with_tiff_includes"
  194.    fi
  195.   fi
  196.   AC_ARG_WITH(tiff_libraries,
  197.   [  --with-tiff-libraries=DIR       TIFF library in nonstandard DIR])
  198.   if test -n "$with_tiff_libraries" ; then
  199.    tifflibs="-L$with_tiff_libraries"
  200.   fi
  201.   tifflibs="$tifflibs -ltiff"
  202.   savedLIBS="$LIBS"
  203.   LIBS="$tifflibs $libjpeg $libjbig $libjbig85 $LIB_Z $LIB_MATH"
  204.   with_libtiff="no"
  205. #
  206.   AC_CHECK_LIB(tiff, TIFFOpen, , tifflibs="",)
  207. #
  208.   if test -n "$tifflibs" ; then
  209.    if test "$tiff_header_found" = "yes" ; then
  210.     with_libtiff="yes"
  211.     AC_DEFINE(HAVE_LIBTIFF, [1], [define to 1 if you have libtiff])
  212.    fi
  213.   fi
  214.   LIBS="$savedLIBS $tifflibs $libjpeg $libjbig $libjbig85"
  215.  fi
  216. fi
  217. #
  218. AC_MSG_RESULT(tiff is usable:$with_libtiff)
  219. AM_CONDITIONAL([with_libtiff], [test x$with_libtiff = xyes])
  220. AC_SUBST(tiffincludes)
  221. AC_SUBST(tifflibs)
  222. # -------------------------------
  223. # Test for LCMS version 2.x
  224. # -------------------------------
  225. AC_MSG_CHECKING(whether to build with LCMS support)
  226. lcms1includes=""
  227. lcms1libs=""
  228. lcms2includes=""
  229. lcms2libs=""
  230. with_liblcms1="no"
  231. lcms1_header_found="no"
  232. lcms2_header_found="no"
  233. have_lcms1_version=""
  234. have_lcms2_version=""
  235. with_liblcms2="yes"
  236. #
  237. AC_ARG_ENABLE(lcms2,
  238. [  --enable-lcms2[=[yes|no]]        Build with LCMS-2 support [ [default=yes] ]],
  239. test "$enable_lcms2" = "no"  && with_liblcms2="no")
  240. #
  241. if test "x$with_liblcms2" = xyes ; then
  242.   with_liblcms2="no"
  243.   lcms2header=""
  244.   AC_ARG_WITH(lcms2_includes,
  245.  [  --with-lcms2-includes=DIR       LCMS-2 includes in nonstandard DIR])
  246.   if test -n "$with_lcms2_includes" ; then
  247.    lcms2header="$with_lcms2_includes"
  248.    lcms2includes="-I$with_lcms2_includes"
  249.   else
  250.    if test -n "$PKGCONFIG" ; then
  251.      lcms2includes="`$PKGCONFIG --variable=prefix lcms2`"
  252.    fi
  253.    if test -n "$lcms2includes" ; then
  254.     lcms2header="$lcms2_includes"
  255.     lcms2includes="-I$lcms2includes/include"
  256.    fi
  257.   fi
  258.   if test -n "$lcms2header" ; then
  259.    lcms2header="$lcms2header/lcms2.h"
  260.   else
  261.    lcms2header="lcms2.h"
  262.   fi
  263.   AC_CHECK_HEADER($lcms2header,lcms2_header_found="yes",,)
  264. #
  265.   AC_ARG_WITH(lcms2_libraries,
  266.  [  --with-lcms2-libraries=DIR      LCMS-2 library in nonstandard DIR])
  267.   if test -n "$with_lcms2_libraries" ; then
  268.    lcms2libs="-L$with_lcms2_libraries -llcms2"
  269.   else
  270.    if test -n "$PKGCONFIG" ; then
  271.      lcms2libs="`$PKGCONFIG --libs lcms2`"
  272.    fi
  273.    if test -z "$lcms2libs" ; then
  274.     lcms2libs="-llcms2"
  275.    fi
  276.    lcms2libs="$lcms2libs"
  277.   fi
  278.   savedLIBS="$LIBS"
  279.   LIBS="$lcms2libs $LIB_MATH"
  280.   with_liblcms2="no"
  281. #
  282.   AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile, ,lcms2libs="",)
  283. #
  284.   if test -n "$lcms2libs" ; then
  285.    if test "$lcms2_header_found" = "yes" ; then
  286.     with_liblcms2="yes"
  287.     AC_DEFINE(HAVE_LIBLCMS2, [1], [define to 1 if you have lcms version 2.x])
  288.     if test -n "$PKGCONFIG" ; then
  289.       have_lcms2_version="`$PKGCONFIG --modversion lcms2`"
  290.     fi
  291.    fi
  292.   fi
  293.   if test "$with_liblcms2" = "no" ; then
  294.     lcms2libs=""
  295.     lcms2includes=""
  296.     lcms2libs=""
  297.   fi
  298.   LIBS="$savedLIBS $lcms2libs"
  299. fi
  300. #
  301. AC_MSG_RESULT(lcms2 is usable:$with_liblcms2)
  302. AM_CONDITIONAL([with_liblcms2], [test x$with_liblcms2 = xyes])
  303. AC_SUBST(lcms2includes)
  304. AC_SUBST(lcms2libs)
  305. AC_MSG_RESULT(lcms2libs:$lcms2libs)
  306. # ----------------------------
  307. # Test for LCMS version 1.x
  308. # ----------------------------
  309. if [[ -z "$lcms2libs" ]] ; then
  310.  with_liblcms1="yes"
  311.  AC_ARG_ENABLE(lcms1,
  312.  [  --enable-lcms1[=[yes|no]]        Build with LCMS-1 support [ [default=yes] ]],
  313.  test "$enable_lcms1" = "no"  && with_liblcms1="no")
  314. #
  315.  if test "x$with_liblcms1" = xyes ; then
  316.    with_liblcms1="no"
  317.    lcms1header=""
  318.    AC_ARG_WITH(lcms1_includes,
  319.   [  --with-lcms1-includes=DIR       LCMS-1 includes in nonstandard DIR])
  320.    if test -n "$with_lcms1_includes" ; then
  321.     lcms1header="$with_lcms1_includes"
  322.     lcms1includes="-I$with_lcms1_includes"
  323.    else
  324.     if test -n "$PKGCONFIG" ; then
  325.       lcms1includes="`$PKGCONFIG --variable=includedir lcms`"
  326.     fi
  327.     if test -n "$lcms1includes" ; then
  328.      lcms1header="$lcms1includes"
  329.      lcms1includes="-I$lcms1includes"
  330.     fi
  331.    fi
  332.    if test -n "$lcms1header" ; then
  333.     lcms1header="$lcms1header/lcms.h"
  334.    else
  335.     lcms1header="lcms.h"
  336.    fi
  337.    AC_CHECK_HEADER($lcms1header,lcms1_header_found="yes",,)
  338. #
  339.    AC_ARG_WITH(lcms1_libraries,
  340.   [  --with-lcms1-libraries=DIR      LCMS-1 library in nonstandard DIR])
  341.    if test -n "$with_lcms1_libraries" ; then
  342.     lcms1libs="-L$with_lcms1_libraries -llcms"
  343.    else
  344.     if test -n "$PKGCONFIG" ; then
  345.       lcms1libs="`$PKGCONFIG --libs lcms`"
  346.     fi
  347.     if test -z "$lcms1libs" ; then
  348.      lcms1libs="-llcms"
  349.     fi
  350.     lcms1libs="$lcms1libs"
  351.    fi
  352.    savedLIBS="$LIBS"
  353.    LIBS="$lcms1libs $LIB_MATH"
  354.    with_liblcms1="no"
  355. #
  356.    AC_CHECK_LIB(lcms, cmsOpenProfileFromFile, ,lcms1libs="",)
  357. #
  358.    if test -n "$lcms1libs" ; then
  359.     if test "$lcms1_header_found" = "yes" ; then
  360.      with_liblcms1="yes"
  361.      AC_DEFINE(HAVE_LIBLCMS1, [1], [define to 1 if you have lcms version 1.x])
  362.      if test -n "$PKGCONFIG" ; then
  363.        have_lcms1_version="`$PKGCONFIG --modversion lcms`"
  364.      fi
  365.     fi
  366.    fi
  367.    if test "$with_liblcms1" = "no" ; then
  368.      lcms1libs=""
  369.      lcms1includes=""
  370.      lcms1libs=""
  371.    fi
  372.    LIBS="$savedLIBS $lcms1libs"
  373.  fi
  374. AC_MSG_RESULT(lcms is usable:$with_liblcms1)
  375. fi
  376. #
  377. AM_CONDITIONAL([with_liblcms1], [test x$with_liblcms1 = xyes])
  378. AC_SUBST(lcms1includes)
  379. AC_SUBST(lcms1libs)
  380. #
  381. # -------------------------------
  382. # Test for USE_JPWL
  383. # -------------------------------
  384. AC_MSG_CHECKING(whether to build with JPWL support)
  385. with_libjpwl="no"
  386. jpwl_dir=""
  387. AC_ARG_ENABLE(jpwl,
  388.  [  --enable-jpwl[=[yes|no]]         Build with JPWL support [ [default=no] ]],
  389.  test "$enable_jpwl" = "yes" && with_libjpwl="yes")
  390. #
  391. AC_MSG_RESULT($with_libjpwl)
  392. AM_CONDITIONAL([with_libjpwl], [test x$with_libjpwl = xyes])
  393. if test "$with_libjpwl" = "yes" ; then
  394.  jpwl_dir="jpwl"
  395. fi
  396. AC_SUBST(jpwl_dir)
  397. #
  398. # -------------------------------
  399. # Test for creating SHARED LIBS
  400. # wanted result: shared xor static
  401. # -------------------------------
  402. with_sharedlibs="yes"
  403. AC_MSG_CHECKING(whether to build shared libraries)
  404. AC_ARG_ENABLE(shared,
  405. [  --enable-shared[=[yes|no]]       Build shared libs [ [default=yes] ]],
  406. test "$enable_shared" = "no" && with_sharedlibs="no")
  407. #
  408. AC_MSG_RESULT($with_sharedlibs)
  409. AM_CONDITIONAL([with_sharedlibs], [test x$with_sharedlibs = xyes])
  410. #
  411. # -------------------------------
  412. # Test for creating JP3D
  413. # -------------------------------
  414. with_jp3d="no"
  415. jp3d_dir=""
  416. AC_MSG_CHECKING(whether to build the JP3D library)
  417. AC_ARG_ENABLE(jp3d,
  418.  [  --enable-jp3d[=[yes|no]]         Build jp3d libs [ [default=no] ]],
  419.  test "$enable_jp3d" = "yes" && with_jp3d="yes")
  420. #
  421. AC_MSG_RESULT($with_jp3d)
  422. if test "$with_jp3d" = "yes" ; then
  423.  jp3d_dir="jp3d"
  424. fi
  425. AC_SUBST(jp3d_dir)
  426. #
  427. AC_CHECK_PROG(with_doxygen, doxygen, [yes],[no],,)
  428. AM_CONDITIONAL([with_doxygen], [test x$with_doxygen = xyes])
  429. #
  430. AC_CONFIG_FILES([Makefile])
  431. AC_CONFIG_FILES([libopenjpeg.pc])
  432. AC_CONFIG_FILES([libopenjpeg/Makefile])
  433. AC_CONFIG_FILES([jpwl/Makefile])
  434. AC_CONFIG_FILES([codec/Makefile])
  435. AC_CONFIG_FILES([mj2/Makefile])
  436. AC_CONFIG_FILES([doc/Makefile])
  437. AC_CONFIG_FILES([jp3d/Makefile])
  438. AC_CONFIG_FILES([jp3d/libjp3dvm/Makefile])
  439. AC_CONFIG_FILES([jp3d/codec/Makefile])
  440. AC_OUTPUT
  441. #
  442. echo "----------------------------------------------"
  443. echo "           your configuration"
  444. echo ""
  445. echo "--with-png-libraries: $with_libpng"
  446. echo "libpng header       : $png_header_found"
  447. echo "--enable-tiff       : $with_libtiff"
  448. echo "libtiff header      : $tiff_header_found"
  449. echo "--enable-lcms2      : $with_liblcms2"
  450. echo "lcms2 header        : $lcms2_header_found"
  451. echo "lcms2 version       : $have_lcms2_version"
  452. echo "--enable-lcms1      : $with_liblcms1"
  453. echo "lcms1 header        : $lcms1_header_found"
  454. echo "lcms1 version       : $have_lcms1_version"
  455. echo "--enable-jpwl       : $with_libjpwl"
  456. echo "--enable-jp3d       : $with_jp3d"
  457. echo "--enable-shared     : $with_sharedlibs"
  458. echo "----------------------------------------------"
  459.