2 # LittleCMS 2 configure script
8 # Set the package name and version
12 # Specify directory where m4 macros may be found.
13 AC_CONFIG_MACRO_DIR([m4])
16 # Libtool library revision control info
22 AC_SUBST(LIBRARY_CURRENT)dnl
23 AC_SUBST(LIBRARY_REVISION)dnl
24 AC_SUBST(LIBRARY_AGE)dnl
26 # Obtain system type by running config.guess
29 AM_INIT_AUTOMAKE([foreign 1.9 tar-ustar no-define dist-zip subdir-objects])
56 AC_SUBST(LIBTOOL_DEPS)
60 # Add configure option --enable-maintainer-mode which enables dependency
61 # checking and generation useful to package maintainers. This is made an
62 # option to avoid confusing end users.
65 # If the C compiler supports the keyword inline, do nothing. Otherwise
66 # define inline to __inline__ or __inline if it accepts one of those,
67 # otherwise define inline to be empty.
71 # Check if the C compiler supports the "visibility" function attribute
72 # If supported, defines HAVE_FUNC_ATTRIBUTE_VISIBILITY
73 AX_GCC_FUNC_ATTRIBUTE(visibility)
75 # Check if the compiler supports "-fvisibility=hidden" and if yes, add it to CFLAGS
76 # This means that symbols that are not marked explicitly for export (CMSAPI)
77 # will not be reachable in the shared library.
78 AX_APPEND_COMPILE_FLAGS(["-fvisibility=hidden"])
80 # If words are stored with the most significant byte first (like
81 # Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
84 # Check for threadsafe variants of gmtime
85 # Note: check for gmtime_s is a bit more complex as it is implemented as a macro
86 AC_CHECK_FUNCS(gmtime_r, [], [
87 AC_MSG_CHECKING([for gmtime_s])
89 AC_LANG_PROGRAM([[#include <time.h>]], [[
96 AC_DEFINE([HAVE_GMTIME_S], [1], [gmtime_s can be used])],
100 # Point to JPEG installed in DIR or disable JPEG with --without-jpeg.
102 AS_HELP_STRING([--with-jpeg=DIR],[use jpeg installed in DIR]),
104 if [ test "x$withval" = "xno" ]; then
107 if [ test "x$withval" != "xyes" ]; then
110 CPPFLAGS="$CPPFLAGS -I$JPEG_DIR/include"
111 LDFLAGS="$LDFLAGS -L$JPEG_DIR/lib"
118 # Point to TIFF installed in DIR or disable TIFF with --without-tiff.
120 AS_HELP_STRING([--with-tiff=DIR], [use tiff installed in DIR]),
122 if [ test "x$withval" = "xno" ]; then
125 if [ test "x$withval" != "xyes" ]; then
128 CPPFLAGS="$CPPFLAGS -I$TIFF_DIR/include"
129 LDFLAGS="$LDFLAGS -L$TIFF_DIR/lib"
138 [ --without-zlib disable ZLIB support],
139 [with_zlib=$withval],
143 AC_ARG_WITH(fastfloat,
144 AS_HELP_STRING([--with-fastfloat],
145 [build and install fast_float plugin, use only if GPL 3.0 is acceptable]),
147 with_fastfloat=$withval
152 if test "x$with_fastfloat" = "xyes"
154 LIB_PLUGINS="$LIB_PLUGINS -llcms2_fast_float"
157 #multi threaded plugin:
158 AC_ARG_WITH(threaded,
159 AS_HELP_STRING([--with-threaded],
160 [build and install multi threaded plugin, use only if GPL 3.0 is acceptable]),
162 with_threaded=$withval
167 if test "x$with_threaded" = "xyes"
169 LIB_PLUGINS="$LIB_PLUGINS -llcms2_threaded"
173 # Determine POSIX threads settings
175 # Enable support for POSIX thread APIs
177 AS_HELP_STRING([--without-pthreads],
178 [disable POSIX pthreads API support]),
179 [with_threads=$withval],
180 [with_threads='yes'])
183 if test "$with_threads" != 'no'
188 if test "$ax_pthread_ok" = yes
192 DEF_THREAD="$PTHREAD_CFLAGS"
193 CFLAGS="$CFLAGS $DEF_THREAD"
194 CXXFLAGS="$CXXFLAGS $DEF_THREAD"
196 if test "$CC" != "$PTHREAD_CC"
198 AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
201 if test "$CXX" != "$PTHREAD_CXX"
203 AC_MSG_WARN([Replacing compiler $CXX with compiler $PTHREAD_CXX to support pthreads.])
209 # check if compiler supports SSE2 intrinsics
212 AC_MSG_CHECKING([whether compiler supports SSE2])
213 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
214 #include <emmintrin.h>
215 int main() { __m128i n = _mm_set1_epi8(42); }]])],
216 [ac_compiler_supports_sse2=yes], [ac_compiler_supports_sse2=no])
217 AC_MSG_RESULT([$ac_compiler_supports_sse2])
218 AS_IF([test "x$ac_compiler_supports_sse2" != "xyes"],
219 [AC_DEFINE([CMS_DONT_USE_SSE2], [1], [Define if compiler does not support SSE2 intrinsics])])
227 AC_CHECK_LIB(m,sqrt,LIB_MATH="-lm",,)
228 LIBS="$LIB_MATH $LIBS"
232 # Find Posix threads library
235 if test "$with_threads" != 'no' && test "$have_threads" = 'yes'
237 for lib in pthread pthreads
239 if test "x$PTHREAD_LIBS" = "x" ; then
240 AC_CHECK_LIB([$lib],pthread_mutex_lock,[PTHREAD_LIBS=-l$lib],,)
244 LIB_THREAD="$PTHREAD_LIBS"
245 LIBS="$LIBS $LIB_THREAD"
246 AC_DEFINE(HasTHREADS,1,[Define if you have pthreads library])
248 AC_DEFINE(HasTHREADS,0,[Define if you don't have pthreads library])
257 if test ! "$with_jpeg" = 'no'
259 AC_MSG_CHECKING([for JPEG support])
263 AC_CHECK_HEADER(jconfig.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
264 AC_CHECK_HEADER(jerror.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
265 AC_CHECK_HEADER(jmorecfg.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,[#include <jconfig.h>])
266 AC_CHECK_HEADER(jpeglib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
267 AC_CHECK_LIB(jpeg,jpeg_read_header,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
269 # Test for compatible JPEG library
270 if test ! "$ac_cv_jpeg_version_ok" = 'yes' ; then
271 AC_CACHE_CHECK(for JPEG library is version 6b or later, ac_cv_jpeg_version_ok,
277 changequote(<<, >>)dnl
279 #if JPEG_LIB_VERSION < 62
280 #error IJG JPEG library must be version 6b or newer!
285 ac_cv_jpeg_version_ok='yes',
286 ac_cv_jpeg_version_ok='no')])
287 if test "$ac_cv_jpeg_version_ok" = 'yes' ; then
289 passed=`expr $passed + 1`
292 failed=`expr $failed + 1`
295 AC_MSG_CHECKING(if JPEG package is complete)
296 if test $passed -gt 0
298 if test $failed -gt 0
300 AC_MSG_RESULT(no -- some components failed test)
301 have_jpeg='no (failed tests)'
304 LIBS="$LIB_JPEG $LIBS"
305 AC_DEFINE(HasJPEG,1,Define if you have JPEG library)
313 AM_CONDITIONAL(HasJPEG, test "$have_jpeg" = 'yes')
320 dnl TIFF may require zlib so enable zlib check if TIFF is requested
321 if test ! "$with_zlib" = 'no' || test ! "$with_tiff" = 'no'
324 AC_MSG_CHECKING(for ZLIB support )
328 AC_CHECK_HEADER(zconf.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
329 AC_CHECK_HEADER(zlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
330 AC_CHECK_LIB(z,compress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
331 AC_CHECK_LIB(z,uncompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
332 AC_CHECK_LIB(z,deflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
333 AC_CHECK_LIB(z,inflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
334 AC_CHECK_LIB(z,gzseek,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
335 AC_CHECK_LIB(z,gztell,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
336 AC_MSG_CHECKING(if ZLIB package is complete)
337 if test $passed -gt 0
339 if test $failed -gt 0
341 AC_MSG_RESULT(no -- some components failed test)
342 have_zlib='no (failed tests)'
345 LIBS="$LIB_ZLIB $LIBS"
346 AC_DEFINE(HasZLIB,1,Define if you have zlib compression library)
354 AM_CONDITIONAL(HasZLIB, test "$have_zlib" = 'yes')
362 if test ! "$with_tiff" = 'no'
364 AC_MSG_CHECKING([for TIFF support])
368 AC_CHECK_HEADER(tiff.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
369 AC_CHECK_HEADER(tiffio.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
370 AC_CHECK_LIB(tiff,TIFFOpen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
371 AC_CHECK_LIB(tiff,TIFFClientOpen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
372 AC_CHECK_LIB(tiff,TIFFIsByteSwapped,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
373 AC_MSG_CHECKING(if TIFF package is complete)
374 if test $passed -gt 0
376 if test $failed -gt 0
378 AC_MSG_RESULT(no -- some components failed test)
379 have_tiff='no (failed tests)'
382 LIBS="$LIB_TIFF $LIBS"
383 AC_DEFINE(HasTIFF,1,Define if you have TIFF library)
386 AC_CHECK_HEADERS(tiffconf.h)
392 AM_CONDITIONAL(HasTIFF, test "$have_tiff" = 'yes')
396 # Libraries that the LCMS library depends on
397 LCMS_LIB_DEPLIBS="$LIB_MATH $LIB_THREAD"
398 LCMS_LIB_DEPLIBS=`echo $LCMS_LIB_DEPLIBS | sed -e 's/ */ /g'`
399 AC_SUBST(LCMS_LIB_DEPLIBS)
401 AC_SUBST(LIB_PLUGINS)
403 # Libraries that the jpegicc program depends on
404 JPEGICC_DEPLIBS="$LIB_JPEG $LIB_MATH $LIB_THREAD"
405 JPEGICC_DEPLIBS=`echo $JPEGICC_DEPLIBS | sed -e 's/ */ /g'`
406 AC_SUBST(JPEGICC_DEPLIBS)
408 # Libraries that the tifficc program depends on
409 TIFFICC_DEPLIBS="$LIB_TIFF $LIB_JPEG $LIB_ZLIB $LIB_MATH $LIB_THREAD"
410 TIFFICC_DEPLIBS=`echo $TIFFICC_DEPLIBS | sed -e 's/ */ /g'`
411 AC_SUBST(TIFFICC_DEPLIBS)
416 # Perform substitutions
418 AC_CONFIG_FILES([Makefile])
419 AC_CONFIG_FILES([lcms2.pc])
420 AC_CONFIG_FILES([include/Makefile])
421 AC_CONFIG_FILES([src/Makefile])
422 AC_CONFIG_FILES([utils/tificc/Makefile])
423 AC_CONFIG_FILES([utils/transicc/Makefile])
424 AC_CONFIG_FILES([utils/linkicc/Makefile])
425 AC_CONFIG_FILES([utils/jpgicc/Makefile])
426 AC_CONFIG_FILES([utils/psicc/Makefile])
427 AC_CONFIG_FILES([testbed/Makefile])
428 AM_CONDITIONAL([COND_FASTFLOAT], [test "x$with_fastfloat" = "xyes" ])
429 AM_CONDITIONAL([COND_THREADED], [test "x$with_threaded" = "xyes" ])
430 AC_CONFIG_FILES([plugins/Makefile])
431 AC_CONFIG_FILES([plugins/fast_float/Makefile])
432 AC_CONFIG_FILES([plugins/fast_float/src/Makefile])
433 AC_CONFIG_FILES([plugins/fast_float/include/Makefile])
434 AC_CONFIG_FILES([plugins/fast_float/testbed/Makefile])
435 AC_CONFIG_FILES([plugins/threaded/Makefile])
436 AC_CONFIG_FILES([plugins/threaded/src/Makefile])
437 AC_CONFIG_FILES([plugins/threaded/include/Makefile])
438 AC_CONFIG_FILES([plugins/threaded/testbed/Makefile])