configure.in 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT
  3. AC_CONFIG_SRCDIR([libmng.h])
  4. AC_PREREQ(2.52)
  5. dnl this call will define PACKAGE and VERSION
  6. dnl please use this as the primary reference for the version number
  7. AM_INIT_AUTOMAKE(libmng, 1.0.9)
  8. dnl pass the version string on the the makefiles
  9. AC_SUBST(PACKAGE)
  10. AC_SUBST(VERSION)
  11. dnl Checks for programs.
  12. AC_PROG_CC
  13. AC_ISC_POSIX
  14. AM_C_PROTOTYPES
  15. if test "x$U" != "x"; then
  16. AC_MSG_ERROR(Compiler not ANSI compliant)
  17. fi
  18. AM_PROG_LIBTOOL
  19. AC_PROG_INSTALL
  20. dnl support for files >2GB
  21. AC_SYS_LARGEFILE
  22. dnl Check for required header files
  23. AC_HEADER_STDC
  24. dnl Checks for typedefs, structures, and compiler characteristics.
  25. AC_C_CONST
  26. dnl need pow and fabs
  27. AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow, LIBS="$LIBS -lm"))
  28. dnl what functionality we want to add (read, write, display).
  29. dnl all on by default. see libmng_conf.h for full descriptions
  30. dnl not building a standard shared object?
  31. AC_ARG_ENABLE(buildso,
  32. [ --disable-buildso disable building standard shared object])
  33. if test "x$enable_buildso" != "xno"; then
  34. AC_DEFINE(MNG_BUILD_SO)
  35. fi
  36. dnl we only support the full mng spec for now (no LC or VLC)
  37. AC_DEFINE(MNG_SUPPORT_FULL)
  38. dnl remove support in library to read images?
  39. AC_ARG_ENABLE(read,
  40. [ --disable-read remove read support from library])
  41. if test "x$enable_read" != "xno"; then
  42. AC_DEFINE(MNG_SUPPORT_READ)
  43. fi
  44. dnl remove support in library to write images?
  45. AC_ARG_ENABLE(write,
  46. [ --disable-write remove write support from library])
  47. if test "x$enable_write" != "xno"; then
  48. AC_DEFINE(MNG_SUPPORT_WRITE)
  49. fi
  50. dnl remove support in library to display images?
  51. AC_ARG_ENABLE(display,
  52. [ --disable-display remove display support from library])
  53. if test "x$enable_display" != "xno"; then
  54. AC_DEFINE(MNG_SUPPORT_DISPLAY)
  55. fi
  56. dnl remove support for 'dynamic' MNG?
  57. AC_ARG_ENABLE(dynamic,
  58. [ --disable-dynamic remove dynamic MNG support from library])
  59. if test "x$enable_dynamic" != "xno"; then
  60. AC_DEFINE(MNG_SUPPORT_DYNAMICMNG)
  61. fi
  62. dnl remove support in library to access chunks?
  63. AC_ARG_ENABLE(chunks,
  64. [ --disable-chunks remove support for chunk access])
  65. if test "x$enable_chunks" != "xno"; then
  66. AC_DEFINE(MNG_ACCESS_CHUNKS)
  67. fi
  68. dnl disable support for accessing chunks that have been previously read?
  69. AC_ARG_ENABLE(storechunks,
  70. [ --disable-storechunks remove support for access of previous chunks])
  71. if test "x$enable_storechunks" != "xno"; then
  72. AC_DEFINE(MNG_STORE_CHUNKS)
  73. fi
  74. dnl enable support for debug tracing callbacks and messages?
  75. AC_ARG_ENABLE(trace,
  76. [ --enable-trace include support for debug tracing callbacks],[
  77. if test "x$enable_trace" = "xyes"; then
  78. AC_DEFINE(MNG_SUPPORT_TRACE)
  79. AC_DEFINE(MNG_TRACE_TELLTALE)
  80. fi
  81. ])
  82. dnl verbose error text
  83. dnl this should always be on
  84. AC_DEFINE(MNG_ERROR_TELLTALE)
  85. dnl libz is required.
  86. AC_ARG_WITH(zlib,
  87. [ --with-zlib[=DIR] use zlib include/library files in DIR],[
  88. if test -d "$withval"; then
  89. CPPFLAGS="$CPPFLAGS -I$withval/include"
  90. LDFLAGS="$LDFLAGS -L$withval/lib"
  91. fi
  92. ])
  93. AC_CHECK_HEADER(zlib.h,
  94. AC_CHECK_LIB(z, gzread, , AC_MSG_ERROR(zlib library not found)),
  95. AC_MSG_ERROR(zlib header not found)
  96. )
  97. dnl check for jpeg library
  98. AC_ARG_WITH(jpeg,
  99. [ --with-jpeg[=DIR] use jpeg include/library files in DIR],
  100. [with_jpeg=$withval],[with_jpeg=_auto])
  101. if test "x$with_jpeg" != "xno" -a "x$with_jpeg" != "xyes" -a \
  102. "x$with_jpeg" != "x_auto"; then
  103. # Save in case test with directory specified fails
  104. _cppflags=${CPPFLAGS}
  105. _ldflags=${LDFLAGS}
  106. _restore=1
  107. CPPFLAGS="${CPPFLAGS} -I$withval/include"
  108. LDFLAGS="${LDFLAGS} -L$withval/lib"
  109. else
  110. _restore=0
  111. fi
  112. if test "x$with_jpeg" != "xno"; then
  113. AC_CHECK_HEADER(jpeglib.h,
  114. AC_CHECK_LIB(jpeg, jpeg_read_header, [
  115. LIBS="$LIBS -ljpeg"
  116. AC_DEFINE(HAVE_LIBJPEG)
  117. _restore=0
  118. ],
  119. AC_MSG_WARN(jpeg library not found)),
  120. AC_MSG_WARN(jpeg header not found)
  121. )
  122. fi
  123. test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags
  124. dnl check for lcms library
  125. AC_ARG_WITH(lcms,
  126. [ --with-lcms[=DIR] use lcms include/library files in DIR],
  127. [with_lcms=$withval],[with_lcms=_auto])
  128. if test "x$with_lcms" != "xno" -a "x$with_lcms" != "xyes" -a \
  129. "x$with_lcms" != "x_auto"; then
  130. # Save in case test with directory specified fails
  131. _cppflags=$CPPFLAGS
  132. _ldflags=$LDFLAGS
  133. _restore=1
  134. CPPFLAGS="$CPPFLAGS -I$withval/include"
  135. LDFLAGS="$LDFLAGS -L$withval/lib"
  136. else
  137. _restore=0
  138. fi
  139. if test "x$with_lcms" != "xno"; then
  140. AC_CHECK_HEADER(lcms.h, [
  141. have_lcms=yes
  142. AC_CHECK_LIB(lcms, cmsCreateRGBProfile, [
  143. LIBS="$LIBS -llcms"
  144. AC_DEFINE(HAVE_LIBLCMS)
  145. dnl for now this implies MNG_INCLUDE_LCMS in the headers:
  146. AC_DEFINE(MNG_FULL_CMS)
  147. _restore=0
  148. have_lcms=yes
  149. ],[
  150. have_lcms=no
  151. ])
  152. ])
  153. dnl give feedback only if the user asked specifically for lcms
  154. if test "x$with_lcms" != "x_auto" -a "x$have_lcms" != "xyes"; then
  155. AC_MSG_WARN([lcms not found... disabling CMS support])
  156. fi
  157. fi
  158. test $_restore -eq 1 && CPPFLAGS=$_cppflags LDFLAGS=$_ldflags
  159. AC_CONFIG_FILES([Makefile])
  160. AC_OUTPUT