]> granicus.if.org Git - imagemagick/blob - configure.ac
https://github.com/ImageMagick/ImageMagick/issues/15
[imagemagick] / configure.ac
1 #  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization
2 #  dedicated to making software imaging solutions freely available.
3 #
4 #  You may not use this file except in compliance with the License.  You may
5 #  obtain a copy of the License at
6 #
7 #    http://www.imagemagick.org/script/license.php
8 #
9 #  Unless required by applicable law or agreed to in writing, software
10 #  distributed under the License is distributed on an "AS IS" BASIS,
11 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 #  See the License for the specific language governing permissions and
13 #  limitations under the License.
14 #
15 #  Copyright (C) 2003 - 2008 GraphicsMagick Group
16 #
17 #  Copying and distribution of this file, with or without modification,
18 #  are permitted in any medium without royalty provided the copyright
19 #  notice and this notice are preserved.
20
21 # Process this file with autoconf to create configure script.
22 AC_PREREQ(2.69)
23
24 # ==============================================================================
25 # ImageMagick release.
26 # ==============================================================================
27 m4_define([magick_major_version], [7])
28 m4_define([magick_minor_version], [0])
29 m4_define([magick_micro_version], [0])
30 m4_define([magick_patchlevel_version], [0])
31 m4_define([magick_version],
32           [magick_major_version.magick_minor_version.magick_micro_version-magick_patchlevel_version])
33 m4_define([magick_svn_revision], esyscmd([sh -c "(svnversion .) | awk '{ print \$1 }' | tr -d '\n'"]))
34
35 # ==============================================================================
36 # Initalize Automake
37 # ==============================================================================
38 AC_INIT([ImageMagick],[magick_version],[http://www.imagemagick.org],[ImageMagick])
39 AC_CONFIG_SRCDIR([MagickCore/MagickCore.h])
40 AC_CONFIG_AUX_DIR([config])
41 AC_REQUIRE_AUX_FILE([tap-driver.sh])
42 AC_CONFIG_MACRO_DIR([m4])
43 AC_CONFIG_HEADERS([config/config.h])
44 AX_PREFIX_CONFIG_H([MagickCore/magick-baseconfig.h],[MagickCore])
45 AC_CANONICAL_SYSTEM
46 AC_CANONICAL_TARGET
47 AM_INIT_AUTOMAKE([1.12 nostdinc color-tests foreign parallel-tests silent-rules subdir-objects dist-bzip2 dist-lzip dist-xz dist-zip])
48 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
49
50 #
51 # Save initial user-tunable values
52 #
53 USER_LIBS=$LIBS
54 for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS LIBS ; do
55   eval isset=\${$var+set}
56     if test "$isset" = 'set'; then
57         eval val=$`echo $var`
58         DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' "
59     fi
60 done
61 AC_SUBST(DISTCHECK_CONFIG_FLAGS)
62
63 CONFIGURE_ARGS="$0 ${ac_configure_args}"
64 AC_SUBST(CONFIGURE_ARGS)
65
66 AC_ARG_ENABLE([reproducible-build],
67     [AC_HELP_STRING([--enable-reproducible-build],
68                     [enable reproducible build])],
69     [enable_reproducible_build=$enableval],
70     [enable_reproducible_build='no'])
71
72 # Source file containing package/library versioning information.
73 . ${srcdir}/version.sh
74
75 echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}${PACKAGE_VERSION_ADDENDUM}"
76
77 MAGICK_TARGET_CPU=$host_cpu
78 AC_SUBST(MAGICK_TARGET_CPU)
79 AC_DEFINE_UNQUOTED(MAGICK_TARGET_CPU,$MAGICK_TARGET_CPU,[Target Host CPU])
80
81 MAGICK_TARGET_VENDOR=$host_vendor
82 AC_SUBST(MAGICK_TARGET_VENDOR)
83 AC_DEFINE_UNQUOTED(MAGICK_TARGET_VENDOR,$MAGICK_TARGET_VENDOR,[Target Host Vendor])
84
85 MAGICK_TARGET_OS=$host_os
86 AC_SUBST(MAGICK_TARGET_OS)
87 AC_DEFINE_UNQUOTED(MAGICK_TARGET_OS,$MAGICK_TARGET_OS,[Target Host OS])
88
89
90 # Substitute versioning
91 AC_SUBST([MAGICK_MAJOR_VERSION],[magick_major_version])
92 AC_SUBST([MAGICK_MINOR_VERSION],[magick_minor_version])
93 AC_SUBST([MAGICK_MICRO_VERSION],[magick_micro_version])
94 AC_SUBST([MAGICK_PATCHLEVEL_VERSION],[magick_patchlevel_version])
95 AC_SUBST([MAGICK_VERSION],[magick_version])
96 AC_SUBST([MAGICK_SVN_REVISION],[magick_svn_revision])
97
98 # Substitute library versioning
99 AC_SUBST(MAGICK_LIBRARY_CURRENT)dnl
100 AC_SUBST(MAGICK_LIBRARY_REVISION)dnl
101 AC_SUBST(MAGICK_LIBRARY_AGE)dnl
102 AC_SUBST([MAGICK_LIBRARY_CURRENT_MIN],
103          [`expr $MAGICK_LIBRARY_CURRENT - $MAGICK_LIBRARY_AGE`])
104 AC_SUBST([MAGICK_LIBRARY_VERSION_INFO],
105          [$MAGICK_LIBRARY_CURRENT:$MAGICK_LIBRARY_REVISION:$MAGICK_LIBRARY_AGE])
106
107 AC_SUBST(MAGICKPP_LIBRARY_CURRENT)dnl
108 AC_SUBST(MAGICKPP_LIBRARY_REVISION)dnl
109 AC_SUBST(MAGICKPP_LIBRARY_AGE)dnl
110 AC_SUBST([MAGICKPP_LIBRARY_CURRENT_MIN],
111          [`expr $MAGICKPP_LIBRARY_CURRENT - $MAGICKPP_LIBRARY_AGE`])
112 AC_SUBST([MAGICKPP_LIBRARY_VERSION_INFO],
113          [$MAGICKPP_LIBRARY_CURRENT:$MAGICKPP_LIBRARY_REVISION:$MAGICKPP_LIBRARY_AGE])
114
115 AC_SUBST(PACKAGE_NAME)dnl
116 AC_SUBST(PACKAGE_VERSION)dnl
117 AC_SUBST(PACKAGE_PERL_VERSION)dnl
118 AC_SUBST(PACKAGE_RELEASE)dnl
119 AC_SUBST(PACKAGE_CHANGE_DATE)dnl
120 AC_SUBST(PACKAGE_LIB_VERSION)dnl
121 AC_SUBST(PACKAGE_LIB_VERSION_NUMBER)dnl
122 AS_IF([test X$enable_reproducible_build = Xyes],
123  [PACKAGE_RELEASE_DATE=$PACKAGE_RELEASE_DATE_REPRODUCIBLE],
124  [PACKAGE_RELEASE_DATE=$PACKAGE_RELEASE_DATE_RAW],
125 )
126 AC_SUBST(PACKAGE_RELEASE_DATE)dnl
127
128 AC_SUBST(PACKAGE_VERSION_ADDENDUM)dnl
129
130 # Ensure that make can run correctly
131 AM_SANITY_CHECK
132
133 # versioning of library
134 MAGICK_LIB_VERSION="0x"
135 if test ${MAGICK_LIBRARY_CURRENT} -lt 10 ; then
136   MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
137 fi
138 MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_CURRENT}
139 if test ${MAGICK_LIBRARY_AGE} -lt 10 ; then
140   MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
141 fi
142 MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_AGE}
143 if test ${MAGICK_LIBRARY_REVISION} -lt 10 ; then
144   MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}0
145 fi
146 MAGICK_LIB_VERSION=${MAGICK_LIB_VERSION}${MAGICK_LIBRARY_REVISION}
147 AC_SUBST(MAGICK_LIB_VERSION)
148
149 # Definition used to define MagickLibVersionText in version.h
150 MAGICK_LIB_VERSION_TEXT="${PACKAGE_VERSION}"
151 AC_SUBST(MAGICK_LIB_VERSION_TEXT)
152
153 # Definition used to define MagickLibVersionNumber in version.h
154 MAGICK_LIB_VERSION_NUMBER="${MAGICK_LIBRARY_CURRENT},${MAGICK_LIBRARY_AGE},${MAGICK_LIBRARY_REVISION}"
155 AC_SUBST(MAGICK_LIB_VERSION_NUMBER)
156
157 MAGICKPP_LIB_VERSION="0x"
158 if test ${MAGICKPP_LIBRARY_CURRENT} -lt 10 ; then
159   MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}0
160 fi
161 MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}${MAGICKPP_LIBRARY_CURRENT}
162 if test ${MAGICKPP_LIBRARY_AGE} -lt 10 ; then
163   MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}0
164 fi
165 MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}${MAGICKPP_LIBRARY_AGE}
166 if test ${MAGICKPP_LIBRARY_REVISION} -lt 10 ; then
167   MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}0
168 fi
169 MAGICKPP_LIB_VERSION=${MAGICKPP_LIB_VERSION}${MAGICKPP_LIBRARY_REVISION}
170 AC_SUBST(MAGICKPP_LIB_VERSION)
171
172 # Definition used to define MagickLibVersionText in version.h
173 MAGICKPP_LIB_VERSION_TEXT="${PACKAGE_VERSION}"
174 AC_SUBST(MAGICKPP_LIB_VERSION_TEXT)
175
176 # Definition used to define MagickLibVersionNumber in version.h
177 MAGICK_LIB_VERSION_NUMBER="${MAGICK_LIBRARY_CURRENT},${MAGICK_LIBRARY_AGE},${MAGICK_LIBRARY_REVISION}"
178 AC_SUBST(MAGICK_LIB_VERSION_NUMBER)
179
180
181
182 # Regenerate config.status if ChangeLog or version.sh is updated.
183 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/version.sh'])
184
185 PERLMAINCC=$CC
186
187 MAGICK_CFLAGS=''
188 MAGICK_CPPFLAGS=$CPPFLAGS_USER
189 MAGICK_PCFLAGS=$CPPFLAGS_USER
190 MAGICK_LDFLAGS=''
191 MAGICK_LIBS=''
192 MAGICK_FEATURES=''
193
194 #
195 # Evaluate shell variable equivalents to Makefile directory variables
196 #
197 if test "x$prefix" = xNONE; then
198     prefix=$ac_default_prefix
199 fi
200 # Let make expand exec_prefix.
201 if test "x$exec_prefix" = xNONE; then
202     exec_prefix='${prefix}'
203 fi
204
205 #
206 eval "eval PREFIX_DIR=${prefix}"
207 AC_SUBST(PREFIX_DIR)
208 eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
209 AC_SUBST(EXEC_PREFIX_DIR)
210 eval "eval BIN_DIR=$bindir"
211 AC_SUBST(BIN_DIR)
212 eval "eval SBIN_DIR=$sbindir"
213 AC_SUBST(SBIN_DIR)
214 eval "eval LIBEXEC_DIR=$libexecdir"
215 AC_SUBST(LIBEXEC_DIR)
216 eval "eval DATA_DIR=$datadir"
217 AC_SUBST(DATA_DIR)
218 eval "eval DOC_DIR=$datadir/doc"
219 AC_SUBST(DOC_DIR)
220 eval "eval SYSCONF_DIR=$sysconfdir"
221 AC_SUBST(SYSCONF_DIR)
222 eval "eval SHAREDSTATE_DIR=$sharedstatedir"
223 AC_SUBST(SHAREDSTATE_DIR)
224 eval "eval LOCALSTATE_DIR=$localstatedir"
225 AC_SUBST(LOCALSTATE_DIR)
226 eval "eval LIB_DIR=$libdir"
227 AC_SUBST(LIB_DIR)
228 eval "eval INCLUDE_DIR=$includedir"
229 AC_SUBST(INCLUDE_DIR)
230 eval "eval PERSISTINCLUDE_DIR=$oldincludedir"
231 AC_SUBST(PERSISTINCLUDE_DIR)
232 eval "eval INFO_DIR=$infodir"
233 AC_SUBST(INFO_DIR)
234 eval "eval MAN_DIR=$mandir"
235 AC_SUBST(MAN_DIR)
236
237 # Get full paths to source and build directories
238 srcdirfull="`cd $srcdir && pwd`"
239 builddir="`pwd`"
240
241 #
242 # Compute variables useful for running uninstalled software.
243 #
244 MAGICK_CODER_MODULE_PATH="${builddir}/coders"
245 MAGICK_CONFIGURE_SRC_PATH="${srcdirfull}/config"
246 MAGICK_CONFIGURE_BUILD_PATH="${builddir}/config"
247 MAGICK_FILTER_MODULE_PATH="${builddir}/filters"
248 DIRSEP=':'
249 case "${build_os}" in
250     mingw* )
251         MAGICK_CODER_MODULE_PATH=`$WinPathScript "${MAGICK_CODER_MODULE_PATH}" 0`
252         MAGICK_CONFIGURE_SRC_PATH=`$WinPathScript "${MAGICK_CONFIGURE_SRC_PATH}" 0`
253         MAGICK_CONFIGURE_BUILD_PATH=`$WinPathScript "${MAGICK_CONFIGURE_BUILD_PATH}" 0`
254         MAGICK_FILTER_MODULE_PATH=`$WinPathScript "${MAGICK_FILTER_MODULE_PATH}" 0`
255         DIRSEP=';'
256     ;;
257 esac
258 case "${host_os}" in
259   mingw* )
260     DIRSEP=';'
261     ;;
262 esac
263 AC_SUBST(MAGICK_CODER_MODULE_PATH)
264 AC_SUBST(MAGICK_CONFIGURE_SRC_PATH)
265 AC_SUBST(MAGICK_CONFIGURE_BUILD_PATH)
266 AC_SUBST(MAGICK_FILTER_MODULE_PATH)
267 AC_SUBST(DIRSEP)
268
269
270 #
271 # Enable OS features.
272 #
273 AC_USE_SYSTEM_EXTENSIONS
274
275 # ==============================================================================
276 # Find required base packages
277 # ==============================================================================
278 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
279 AC_PROG_CC
280 AC_PROG_CXX
281 AC_PROG_CC_STDC
282 AC_PROG_CPP
283 AC_PROG_LD
284 AC_SUBST(LD)
285 AC_PROG_CC_C99
286 AM_PROG_CC_C_O
287 AX_CFLAGS_WARN_ALL
288 AC_PROG_INSTALL
289 AC_PROG_MAKE_SET
290 AC_PROG_LN_S
291 AC_PROG_SED
292 AC_PROG_AWK
293 AM_WITH_DMALLOC
294 AX_C___ATTRIBUTE__
295 AX_GCC_ARCHFLAG([yes])
296 PKG_PROG_PKG_CONFIG
297 AC_CANONICAL_BUILD
298 AC_CANONICAL_HOST
299
300 # Test for 64-bit build.
301 AC_CHECK_SIZEOF([size_t])
302
303 AX_COMPILER_VENDOR
304 # The AX_CFLAGS_WARN_ALL macro doesn't currently work for sunpro
305 # compiler.
306 if test "$ax_cv_c_compiler_vendor" != "sun"; then
307   AX_CFLAGS_WARN_ALL
308 fi
309
310 if test "x$GCC" = "xyes"; then
311   CFLAGS="$CFLAGS -fexceptions"
312   touch local.exp
313 else
314   cat > local.exp <<EOF
315 set CC_FOR_TARGET "$CC"
316 EOF
317 fi
318
319 # Check for linker script support
320 gl_LD_VERSION_SCRIPT
321
322 #
323 # Enable run-time checking.
324 #
325 AC_ARG_ENABLE([bounds-checking],
326     [AC_HELP_STRING([--enable-bounds-checking],
327                     [enable run-time bounds-checking])],
328     [enable_bounds_checking=$enableval],
329     [enable_bounds_checking='no'])
330
331 if test "$enable_bounds_checking" = yes; then
332   AC_DEFINE([_FORTIFY_SOURCE], [2],
333     [enable run-time bounds-checking])
334 fi
335
336 #
337 # Tests for Windows
338 #
339 AC_EXEEXT
340 AC_OBJEXT
341
342 GDI32_LIBS=''
343 native_win32_build='no'
344 cygwin_build='no'
345 case "${host_os}" in
346     cygwin* )
347         cygwin_build='yes'
348         GDI32_LIBS='-lgdi32'
349     ;;
350     mingw* )
351         native_win32_build='yes'
352         GDI32_LIBS='-lgdi32'
353     ;;
354 esac
355 if test "${GDI32_LIBS}x" != 'x'; then
356     AC_DEFINE(WINGDI32_DELEGATE,1,Define to use the Windows GDI32 library)
357 fi
358 AC_SUBST(GDI32_LIBS)
359 AM_CONDITIONAL(WINGDI32_DELEGATE, test "${GDI32_LIBS}x" != 'x' )
360 AM_CONDITIONAL(WIN32_NATIVE_BUILD, test "${native_win32_build}" = 'yes' )
361 AM_CONDITIONAL(CYGWIN_BUILD, test "${cygwin_build}" = 'yes' )
362 AM_CONDITIONAL(USING_CL, test "x${CC}" = 'xcl.exe' )
363
364 WinPathScript="${srcdirfull}/winpath.sh"
365 AC_SUBST(WinPathScript)
366
367 #
368 # Compiler flags tweaks
369 #
370 if test "${GCC}" != "yes"; then
371     case "${host}" in
372         *-*-hpux* )
373             # aCC: HP ANSI C++ B3910B A.03.34
374             CFLAGS="${CFLAGS} -Wp,-H30000"
375             if test -n "${CXXFLAGS}"; then
376                 CXXFLAGS='-AA'
377             else
378                 CXXFLAGS="${CXXFLAGS} -AA"
379             fi
380         ;;
381         *-dec-osf5.* )
382             # Compaq alphaev68-dec-osf5.1 compiler
383             if test -n "${CXXFLAGS}"; then
384                 CXXFLAGS='-std strict_ansi -noimplicit_include'
385             else
386                 CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
387             fi
388   esac
389 fi
390
391 # Check for lazy-loading.
392 AC_CACHE_CHECK([for linker lazyload option],[im_cv_ld_lazyload],
393 [
394 im_cv_ld_lazyload='none'
395 case "${host}" in
396   *-*-solaris2.8 | *-*-solaris2.9 | *-*-solaris2.1? )
397     if test "$lt_cv_prog_gnu_ld" != 'yes' ; then
398        im_cv_ld_lazyload='-Wl,-zlazyload'
399     fi
400     ;;
401 esac
402 ])
403 if test "${im_cv_ld_lazyload}" != 'none' ; then
404   if test -z "${LDFLAGS}" ; then
405     LDFLAGS="${im_cv_ld_lazyload}"
406   else
407     LDFLAGS="${im_cv_ld_lazyload} ${LDFLAGS}"
408   fi
409 fi
410
411 dnl Platform-specific stuff
412 case "$host" in
413   *darwin* | *-macos10*)
414     dnl Disable FORTIFY_SOURCE to fix a bug in LVVM / OpenMP support
415     CFLAGS="${CFLAGS} -D_FORTIFY_SOURCE=0"
416     dnl OS X universal binary support, requires --disable-dependency-tracking
417     AC_ARG_ENABLE([osx-universal-binary],
418         AC_HELP_STRING([--enable-osx-universal-binary],
419            [build universal binary on OS X [[default=no]]]),
420         [build_osxuniversal="${enableval}"], [build_osxuniversal=no])
421
422     if test "${build_osxuniversal}" != no ; then
423       if test "$enable_dependency_tracking" != no ; then
424         AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
425 Please re-run configure with these options:
426   --disable-dependency-tracking --enable-osx-universal-binary
427         ])
428       fi
429       CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
430       CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
431       LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
432   fi
433   ;;
434 esac
435
436 #
437 # ARCH specific include directory
438 #
439 AC_ARG_WITH([includearch-dir],
440     [AC_HELP_STRING([--includearch-dir=DIR],
441                     [ARCH specific include directory])],
442                     [includearch_dir=$withval],
443                     [includearch_dir=$INCLUDE_DIR])
444
445 eval "eval INCLUDEARCH_DIR=$includearch_dir"
446 AC_SUBST(INCLUDEARCH_DIR)
447
448 #
449 # ARCH specific configuration directory
450 #
451 AC_ARG_WITH([sharearch-dir],
452     [AC_HELP_STRING([--sharearch-dir=DIR],
453                     [ARCH specific config directory])],
454                     [sharearch_dir=$withval],
455                     [sharearch_dir="${LIB_DIR}"])
456
457 eval "eval SHAREARCH_DIR=$sharearch_dir"
458 AC_SUBST(SHAREARCH_DIR)
459
460 # Path to the pkgconfig folder
461 AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR],
462             [Path to the pkgconfig directory @<:@LIBDIR/pkgconfig@:>@]),
463             [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
464 AC_SUBST([pkgconfigdir])
465
466 #
467 # Enable support for threads
468 #
469 # Find Posix threads library
470 #
471 AC_ARG_WITH([threads],
472     [AC_HELP_STRING([--without-threads], [disable threads support])],
473     [with_threads=$withval],
474     [with_threads='yes'])
475
476 THREAD_LIBS=''
477 have_threads=no
478 if test "$with_threads" != 'no'; then
479     AX_PTHREAD()
480     if test "$ax_pthread_ok" = yes; then
481         have_threads=yes
482         DEF_THREAD="$PTHREAD_CFLAGS"
483         CFLAGS="$CFLAGS $DEF_THREAD"
484         CXXFLAGS="$CXXFLAGS $DEF_THREAD"
485         THREAD_LIBS="$PTHREAD_LIBS"
486         if test "$CC" != "$PTHREAD_CC"; then
487             AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
488             CC="$PTHREAD_CC"
489         fi
490         AC_DEFINE(THREAD_SUPPORT,1,[Define if you have POSIX threads libraries and header files.])
491     fi
492 fi
493 LIBS="$LIBS $THREAD_LIBS"
494 AC_SUBST(THREAD_LIBS)
495
496 # Enable support for OpenMP
497 if test "$have_threads" != 'yes'; then
498   ac_cv_prog_c_openmp=unsupported
499 fi
500 AC_OPENMP([C])
501 CFLAGS="$OPENMP_CFLAGS $CFLAGS"
502 MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS"
503 AC_SUBST(OPENMP_CFLAGS)
504 if test "$enable_openmp" != no; then
505   if test "$ac_cv_prog_c_openmp" != 'unsupported'; then
506     MAGICK_FEATURES="OpenMP $MAGICK_FEATURES"
507   fi
508 fi
509
510 # Enable support for OpenCL
511 AX_OPENCL([C])
512 CFLAGS="$CL_CFLAGS $CFLAGS"
513 CPPFLAGS="$CL_CFLAGS $CPPFLAGS"
514 LIBS="$CL_LIBS $LIBS"
515 AC_SUBST(CL_CFLAGS)
516 if test "$enable_opencl" != no; then
517   if test "X$ax_cv_check_cl_libcl" != Xno; then :
518     MAGICK_FEATURES="OpenCL $MAGICK_FEATURES"
519   fi
520 fi
521
522 ########
523 #
524 # Check for large file support
525 #
526 ########
527 AC_SYS_LARGEFILE
528 AC_FUNC_FSEEKO
529 LFS_CPPFLAGS=''
530 if test "$enable_largefile" != no; then
531     case $ac_cv_sys_file_offset_bits in
532     no)
533         # nothing to do here as the host supports LFS fine
534         ;;
535     unknown)
536         AC_MSG_CHECKING([for native large file support])
537         AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>
538           main () {
539           exit(!(sizeof(off_t) == 8));
540         }])],
541         [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
542          AC_MSG_RESULT([yes])],
543         [AC_MSG_RESULT([no])])
544         ;;
545     *)
546         LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
547         ;;
548     esac
549     if test "$ac_cv_sys_large_files" != 'no'; then
550         LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
551     fi
552     if test "$ac_cv_sys_largefile_source" != 'no'; then
553         LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
554     fi
555 fi
556 AC_SUBST(LFS_CPPFLAGS)
557
558 # Configure libtool
559 AC_LIBTOOL_DLOPEN
560 LT_INIT([win32-dll])
561 LT_LANG([C++])
562 AC_SUBST(LIBTOOL_DEPS)
563
564 # Check to see if building shared libraries
565 libtool_build_shared_libs='no'
566 if test "$enable_shared" = 'yes'; then
567     libtool_build_shared_libs='yes'
568 fi
569
570 # Check to see if building static libraries
571 libtool_build_static_libs='no'
572 if test "$enable_static" = 'yes'; then
573     libtool_build_static_libs='yes'
574 fi
575
576 AM_CONDITIONAL(WITH_SHARED_LIBS, test "${libtool_build_shared_libs}" = 'yes')
577 #
578 # Enable support for building loadable modules
579 #
580 build_modules='no'
581 AC_ARG_WITH([modules],
582     [AC_HELP_STRING([--with-modules],
583                     [enable building dynamically loadable modules])],
584     [with_modules=$withval],
585     [with_modules='no'])
586
587 # Only allow building loadable modules if we are building shared libraries
588 if test "$with_modules" != 'no' ; then
589     if test "$libtool_build_shared_libs" = 'no'; then
590         AC_MSG_WARN([Modules may only be built if building shared libraries is enabled.])
591     build_modules='no'
592   else
593     build_modules='yes'
594   fi
595 fi
596 if test "$build_modules" != 'no' ; then
597     AC_DEFINE(BUILD_MODULES,1,Define if coders and filters are to be built as modules.)
598     MAGICK_FEATURES="$MAGICK_FEATURES Modules"
599 fi
600 AM_CONDITIONAL(WITH_MODULES, test "$build_modules" != 'no')
601
602 # Enable build using delegate libraries built in subdirectories rather than installed
603 # delegate libraries (bzlib fftw fpx gslib jp2 jbig jpeg lcms lzma png tiff ttf wmf xml zlib)
604 AC_ARG_ENABLE([delegate-build],
605     [AC_HELP_STRING([--enable-delegate-build],
606                     [look for delegate libraries in build directory])],
607     [enable_delegate_build=$enableval],
608     [enable_delegate_build='no'])
609
610 AC_ARG_ENABLE([deprecated],
611     [AC_HELP_STRING([--disable-deprecated],
612                     [exclude deprecated methods in MagickCore and MagickWand APIs])],
613     [enable_deprecated=$enableval],
614     [enable_deprecated='no'])
615
616 if test "$enable_deprecated" = 'yes'; then
617   AC_DEFINE(EXCLUDE_DEPRECATED,1,[exclude deprecated methods in MagickCore API])
618 else
619   DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-deprecated "
620 fi
621
622 # Build a version of ImageMagick which operates uninstalled.
623 # Used to build distributions located via MAGICK_HOME / executable path
624 AC_ARG_ENABLE([installed],
625     [AC_HELP_STRING([--disable-installed],
626                     [Formally install ImageMagick under PREFIX])],
627     [enable_installed=$enableval],
628     [enable_installed='yes'])
629
630 if test "$enable_installed" = 'yes'; then
631     AC_DEFINE(INSTALLED_SUPPORT,1,[ImageMagick is formally installed under prefix])
632 else
633     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
634 fi
635
636 # Permit enciphering and deciphering image pixels.
637 AC_ARG_ENABLE([cipher],
638     [AC_HELP_STRING([--disable-cipher],
639                     [disable enciphering and deciphering image pixels])],
640     [enable_cipher=$enableval],
641     [enable_cipher='yes'])
642
643 if test "$enable_cipher" = 'yes'; then
644     AC_DEFINE(CIPHER_SUPPORT,1,[permit enciphering and deciphering image pixels])
645     MAGICK_FEATURES="Cipher $MAGICK_FEATURES"
646 fi
647
648 # Build a zero-configuration version of ImageMagick.
649 AC_ARG_ENABLE([zero-configuration],
650     [AC_HELP_STRING([--enable-zero-configuration],
651                     [enable self-contained, embeddable, zero-configuration ImageMagick])],
652     [enable_zero_configuration=$enableval],
653     [enable_zero_configuration='no'])
654
655 if test "$enable_zero_configuration" = 'yes'; then
656     AC_DEFINE(ZERO_CONFIGURATION_SUPPORT,1,[Build self-contained, embeddable, zero-configuration ImageMagick])
657     MAGICK_FEATURES="Zero-configuration $MAGICK_FEATURES"
658 fi
659
660 # Build a high dynamic range version of ImageMagick.
661 AC_ARG_ENABLE([hdri],
662     [AC_HELP_STRING([--enable-hdri],
663                     [accurately represent the wide range of intensity levels found in real scenes])],
664     [enable_hdri=$enableval],
665     [enable_hdri='yes'])
666
667 MAGICK_HDRI=""
668 if test "$enable_hdri" = 'yes'; then
669     MAGICK_HDRI="HDRI"
670     magick_hdri_enable='1';
671     MAGICK_FEATURES="HDRI $MAGICK_FEATURES"
672 else
673     magick_hdri_enable='0'
674 fi
675 AC_DEFINE_UNQUOTED(HDRI_ENABLE_OBSOLETE_IN_H,$magick_hdri_enable,[Whether hdri is enabled or not])
676 AC_SUBST(MAGICK_HDRI)dnl
677 MAGICK_PCFLAGS="$MAGICK_PCFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
678 CFLAGS="$CFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
679 CPPFLAGS="$CPPFLAGS -DMAGICKCORE_HDRI_ENABLE=$magick_hdri_enable"
680
681 # Build a version of ImageMagick with assert statements.
682 AC_ARG_ENABLE([assert],
683     [AC_HELP_STRING([--disable-assert],
684                     [disable assert() statements in build])],
685     [enable_assert=$enableval],
686     [enable_assert='yes'])
687
688 if test "$enable_assert" = 'no'; then
689     AC_DEFINE(NDEBUG,1,[Turn off assert statements])
690 fi
691
692 # Don't emit "rebuild rules" for configure, Makefile.ins, etc.
693 AM_MAINTAINER_MODE
694
695 # Enable hugepages support
696 AC_ARG_ENABLE([hugepages],
697     [AC_HELP_STRING([--enable-hugepages],
698                     [enable 'huge pages' support])],
699     [enable_hugepages=$enableval],
700     [enable_hugepages='no'])
701
702 # Enable ccmalloc memory debugging support
703 AC_ARG_ENABLE([ccmalloc],
704     [AC_HELP_STRING([--enable-ccmalloc],
705                     [enable 'ccmalloc' memory debug support])],
706     [enable_ccmalloc=$enableval],
707     [enable_ccmalloc='no'])
708
709 # Enable Electric Fence memory debugging support
710 AC_ARG_ENABLE([efence],
711     [AC_HELP_STRING([--enable-efence],
712                     [enable 'efence' memory debug support])],
713     [enable_efence=$enableval],
714     [enable_efence='no'])
715
716 # Enable prof-based profiling support
717 AC_ARG_ENABLE([prof],
718     [AC_HELP_STRING([--enable-prof],
719                     [enable 'prof' profiling support])],
720     [enable_prof=$enableval],
721     [enable_prof='no'])
722
723 # Enable gprof-based profiling support
724 AC_ARG_ENABLE([gprof],
725     [AC_HELP_STRING([--enable-gprof],
726                     [enable 'gprof' profiling support])],
727     [enable_gprof=$enableval],
728     [enable_gprof='no'])
729
730 # Enable gcov-based profiling support
731 AC_ARG_ENABLE([gcov],
732     [AC_HELP_STRING([--enable-gcov],
733                     [enable 'gcov' profiling support])],
734     [enable_gcov=$enableval],
735     [enable_gcov='no'])
736
737 enable_profiling='no'
738 if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
739     enable_profiling='yes'
740     if test "$libtool_build_shared_libs" = 'yes'; then
741         echo "Warning: Can not profile code using shared libraries"
742     fi
743 fi
744
745 # Magick API method prefix
746 AC_ARG_WITH([method-prefix],
747     [AC_HELP_STRING([--with-method-prefix=PREFIX],
748                     [prefix MagickCore API methods])],
749     [with_method_prefix=$withval],
750     [with_method_prefix='no'])
751
752 if test "$with_method_prefix" != 'no'; then
753     AC_DEFINE_UNQUOTED(NAMESPACE_PREFIX,$with_method_prefix,[Magick API method prefix])
754     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-method-prefix "
755 fi
756
757 # Enable legacy support (default no)
758 AC_ARG_ENABLE(legacy-support,
759               [  --enable-legacy-support  install legacy command-line utilities (default disabled)],
760               [with_legacy_support=$enableval],
761               [with_legacy_support='no'])
762 AM_CONDITIONAL(LEGACY_SUPPORT, test "$with_legacy_support" != 'no')
763
764 # Number of bits in a Quantum
765 AC_ARG_WITH([quantum-depth],
766     [AC_HELP_STRING([--with-quantum-depth=DEPTH],
767                     [number of bits in a pixel quantum (default 16)])],
768     [with_quantum_depth=$withval],
769     [with_quantum_depth=16])
770
771 if test "$with_quantum_depth" != '8'; then
772     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-quantum-depth=$with_quantum_depth "
773 fi
774
775 case "${with_quantum_depth}" in
776     8 ) ;;
777     16 ) ;;
778     32 ) ;;
779     64 ) ;;
780     * ) AC_MSG_ERROR("Pixel quantum depth must have value of 8, 16, 32, or 64") ;;
781 esac
782 QUANTUM_DEPTH="$with_quantum_depth"
783 AC_DEFINE_UNQUOTED(QUANTUM_DEPTH_OBSOLETE_IN_H,$QUANTUM_DEPTH,[Number of bits in a pixel Quantum (8/16/32/64)])
784 AC_SUBST(QUANTUM_DEPTH)dnl
785 MAGICK_PCFLAGS="$MAGICK_PCFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
786 CFLAGS="$CFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
787 CPPFLAGS="$CPPFLAGS -DMAGICKCORE_QUANTUM_DEPTH=$QUANTUM_DEPTH"
788
789 # define a lib suffix for abi purpose
790 MAGICK_ABI_SUFFIX="Q${QUANTUM_DEPTH}"
791 if test "$enable_hdri" = 'yes'; then
792   MAGICK_ABI_SUFFIX="Q${QUANTUM_DEPTH}${MAGICK_HDRI}"
793 fi
794 AC_SUBST(MAGICK_ABI_SUFFIX)
795
796 # Set pixel cache threshold
797 AC_ARG_WITH([cache],
798     [AC_HELP_STRING([--with-cache=THRESHOLD],
799                     [set pixel cache threshhold in MB (default available memory)])],
800     [with_cache=$withval],
801     [with_cache=''])
802
803 if test "$with_cache" != ''; then
804     AC_DEFINE_UNQUOTED(PixelCacheThreshold,$with_cache,[Pixel cache threshold in MB (defaults to available memory)])
805     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
806 fi
807
808 # Disable/Enable support for full delegate paths
809 AC_ARG_WITH([frozenpaths],
810     [AC_HELP_STRING([--with-frozenpaths],
811                     [freeze delegate paths])],
812     [with_frozenpaths=$withval],
813     [with_frozenpaths='no'])
814
815 # Enable build/install of Magick++
816 AC_ARG_WITH([magick-plus-plus],
817     [AC_HELP_STRING([--without-magick-plus-plus],
818                     [disable build/install of Magick++])],
819     [with_magick_plus_plus=$withval],
820     [with_magick_plus_plus='yes'])
821
822 # Encode the this name into the shared library.
823 AC_ARG_WITH([package-release-name],
824     [AC_HELP_STRING([--with-package-release-name=NAME],
825                     [encode this name into the shared library])],
826 [MAGICK_LT_RELEASE_OPTS="-release $withval"])
827 AC_SUBST(MAGICK_LT_RELEASE_OPTS)
828
829 # Disable build/install of PerlMagick.
830 AC_ARG_WITH([perl],
831     [AC_HELP_STRING([--with-perl],
832                     [enable build/install of PerlMagick])],
833     [with_perl=$withval],
834     [with_perl='no'])
835
836 # Options to pass when configuring PerlMagick
837 AC_ARG_WITH([perl-options],
838     [AC_HELP_STRING([--with-perl-options=OPTIONS],
839                     [options to pass on command-line when generating PerlMagick build file])],
840 PERL_MAKE_OPTIONS=$withval)
841 AC_SUBST(PERL_MAKE_OPTIONS)
842
843 # Enable jemalloc, object-caching memory allocation library.
844 AC_ARG_WITH(jemalloc,
845         [  --with-jemalloc         enable jemalloc memory allocation library support],
846         [with_jemalloc=$withval],
847         [with_jemalloc='no'])
848 if test "$with_jemalloc" != 'yes' ; then
849     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jemalloc=$with_jemalloc "
850 fi
851
852 # Enable umem, object-caching memory allocation library.
853 AC_ARG_WITH(umem,
854         [  --with-umem             enable umem memory allocation library support],
855         [with_umem=$withval],
856         [with_umem='no'])
857 if test "$with_umem" != 'yes' ; then
858     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-umem=$with_umem "
859 fi
860
861 #
862 # Specify path to shared libstdc++ if not in normal location
863 #
864 AC_ARG_WITH([libstdc],
865     [AC_HELP_STRING([--with-libstdc=DIR],
866                     [ use libstdc++ in DIR (for GNU C++)])],
867     [with_libstdc=$withval],
868     [with_libstdc=''])
869
870 if test "$with_libstdc" != ''; then
871     if test -d "$with_libstdc"; then
872         LIBSTDCLDFLAGS="-L$with_libstdc"
873     fi
874 fi
875 AC_SUBST(LIBSTDCLDFLAGS)
876
877 # Does gcc required -traditional?
878 AC_PROG_GCC_TRADITIONAL
879
880 ########
881 #
882 # Set defines required to build DLLs and modules using MinGW
883 #
884 ########
885 # These options are set for multi-thread DLL module build
886 #  libMagickCore:           _DLL _MAGICKMOD_ _MAGICKLIB_
887 #  module:              _DLL
888 #  executable/Magick++: _DLL _MAGICKMOD_
889 MODULE_EXTRA_CPPFLAGS=''
890 LIBRARY_EXTRA_CPPFLAGS=''
891 if test "${native_win32_build}" = 'yes'; then
892     if test "${libtool_build_shared_libs}" = 'yes'; then
893         CPPFLAGS="$CPPFLAGS -D_DLL"
894         MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_DLL"
895         MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_DLL"
896         LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKLIB_"
897         if test "$build_modules" = 'yes'; then
898             LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKMOD_"
899         else
900             MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_MAGICKLIB_"
901         fi
902     else
903         CPPFLAGS="$CPPFLAGS -D_LIB"
904         MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_LIB"
905         MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_LIB"
906     fi
907     if test "$with_threads" = 'yes'; then
908          CPPFLAGS="$CPPFLAGS -D_MT"
909          MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_MT"
910          MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_MT"
911     fi
912 fi
913 AC_SUBST(MODULE_EXTRA_CPPFLAGS)
914 AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
915
916 # Check standard headers
917 AC_HEADER_STDC
918 if ! test x"$ac_cv_header_stdc" = x"yes"; then
919     AC_MSG_WARN([configure has detected that you do not have the ANSI standard C
920     header files.  Compilation cannot proceed.  Please install the ANSI C
921     headers and rerun this script.]);
922 fi
923 AC_HEADER_ASSERT
924 AC_HEADER_DIRENT
925
926 # Check additional headers
927 AC_CHECK_HEADERS(arm/limits.h arpa/inet.h complex.h errno.h fcntl.h limits.h linux/unistd.h locale.h machine/param.h mach-o/dyld.h netinet/in.h OS.h process.h sun_prefetch.h stdarg.h sys/ipc.h sys/mman.h sys/resource.h sys/sendfile.h sys/socket.h sys/syslimits.h sys/time.h sys/timeb.h sys/times.h sys/wait.h wchar.h xlocale.h)
928
929 ########
930 #
931 # Checks for typedefs, structures, and compiler characteristics.
932 #
933 ########
934
935 AC_HEADER_STDBOOL
936 AC_C_VOLATILE
937 AC_C_STRINGIZE
938 AC_HEADER_STAT
939 AC_HEADER_TIME
940 AC_STRUCT_TM
941 AC_STRUCT_TIMEZONE
942 AC_SYS_INTERPRETER
943
944 #
945 # Checks for language qualifiers and semantics.
946 #
947 AC_C_CHAR_UNSIGNED
948 AC_C_CONST
949 AC_C_INLINE
950 AC_C_RESTRICT
951 AC_C_VOLATILE
952
953 # If words are stored with the most significant byte first (like
954 # Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
955 AC_C_BIGENDIAN
956
957 # Define to a suitable type, if standard headers do not define it.
958 AC_TYPE_INT8_T
959 AC_TYPE_INT16_T
960 AC_TYPE_INT32_T
961 AC_TYPE_INT64_T
962 AC_TYPE_INTMAX_T
963 AC_TYPE_INTPTR_T
964 AC_TYPE_LONG_DOUBLE
965 AC_TYPE_LONG_DOUBLE_WIDER
966 AC_TYPE_LONG_LONG_INT
967 AC_TYPE_MBSTATE_T
968 AC_TYPE_MODE_T
969 AC_TYPE_OFF_T
970 AC_TYPE_PID_T
971 AC_TYPE_SIZE_T
972 AC_TYPE_SSIZE_T
973 AC_TYPE_UID_T
974 AC_TYPE_UINT8_T
975 AC_TYPE_UINT16_T
976 AC_TYPE_UINT32_T
977 AC_TYPE_UINT64_T
978 AC_TYPE_UINTMAX_T
979 AC_TYPE_UINTPTR_T
980 AC_TYPE_UNSIGNED_LONG_LONG_INT
981
982 AC_CHECK_TYPES([locale_t], [], [], [[#include <xlocale.h>]])
983
984 # Float_t and double_t are intended to be the the most efficient type.
985 AC_CHECK_TYPES([float_t], [], [], [[#include <math.h>]])
986 AC_CHECK_TYPES([double_t], [], [], [[#include <math.h>]])
987 AC_CHECK_SIZEOF([float_t], [], [[#include <math.h>]])
988 AC_CHECK_SIZEOF([double_t], [], [[#include <math.h>]])
989
990 # Get size of float, double and long double for comparaison.
991 AC_CHECK_SIZEOF([float])
992 AC_CHECK_SIZEOF([double])
993 AC_CHECK_SIZEOF([long double])
994
995 # Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
996 AC_CHECK_SIZEOF(signed short)
997
998 # Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
999 AC_CHECK_SIZEOF(unsigned short)
1000
1001 # Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
1002 AC_CHECK_SIZEOF(signed int)
1003
1004 # Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
1005 AC_CHECK_SIZEOF(unsigned int)
1006
1007 # Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
1008 AC_CHECK_SIZEOF(signed long)
1009
1010 # Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
1011 AC_CHECK_SIZEOF(unsigned long)
1012
1013 # Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.  If
1014 # 'signed long long' is not supported then the value defined is zero.
1015 AC_CHECK_SIZEOF(signed long long)
1016
1017 # Obtain size of a 'unsigned long long' and define as
1018 # SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
1019 # supported then the value defined is zero.
1020 AC_CHECK_SIZEOF(unsigned long long)
1021
1022 # Obtain size of off_t and define as SIZEOF_OFF_T
1023 AC_CHECK_SIZEOF(off_t)
1024
1025 # Obtain size of size_t and define as SIZEOF_SIZE_T
1026 AC_CHECK_SIZEOF(size_t)
1027
1028 # Obtain size of ssize_t and define as SIZEOF_SSIZE_T
1029 AC_CHECK_SIZEOF(ssize_t)
1030
1031 # Obtain size of an unsigned int pointer and define as SIZEOF_UNSIGNED_INTP
1032 AC_CHECK_SIZEOF(unsigned int*)
1033
1034 #
1035 # Compute sized types for current CPU and compiler options.
1036 #
1037
1038 AC_MSG_CHECKING(for signed 8-bit type)
1039 INT8_T='signed char'
1040 AC_MSG_RESULT($INT8_T)
1041 AC_SUBST(INT8_T)
1042
1043 AC_MSG_CHECKING(for unsigned 8-bit type)
1044 UINT8_T='unsigned char'
1045 AC_MSG_RESULT($UINT8_T)
1046 AC_SUBST(UINT8_T)
1047
1048 AC_MSG_CHECKING(for signed 16-bit type)
1049 INT16_T='signed short'
1050 AC_MSG_RESULT($INT16_T)
1051 AC_SUBST(INT16_T)
1052
1053 AC_MSG_CHECKING(for unsigned 16-bit type)
1054 UINT16_T='unsigned short'
1055 AC_MSG_RESULT($UINT16_T)
1056 AC_SUBST(UINT16_T)
1057
1058 AC_MSG_CHECKING(for signed 32-bit type)
1059 INT32_T='none'
1060 INT32_F='none'
1061 if test $ac_cv_sizeof_signed_int -eq 4; then
1062   INT32_T='signed int'
1063   INT32_F='""'
1064 elif test $ac_cv_sizeof_signed_long -eq 4; then
1065   INT32_T='signed long'
1066   INT32_F='"l"'
1067 fi
1068 AC_MSG_RESULT($INT32_T)
1069 AC_SUBST(INT32_T)
1070 AC_SUBST(INT32_F)
1071
1072 AC_MSG_CHECKING(for unsigned 32-bit type)
1073 UINT32_T='none'
1074 UINT32_F='none'
1075 if test $ac_cv_sizeof_unsigned_int -eq 4; then
1076   UINT32_T='unsigned int'
1077   UINT32_F='""'
1078 elif test $ac_cv_sizeof_unsigned_long -eq 4; then
1079   UINT32_T='unsigned long'
1080   UINT32_F='"l"'
1081 fi
1082 AC_MSG_RESULT($UINT32_T)
1083 AC_SUBST(UINT32_T)
1084 AC_SUBST(UINT32_F)
1085
1086 AC_MSG_CHECKING(for signed 64-bit type)
1087 INT64_T='none'
1088 INT64_F='none'
1089 if test $ac_cv_sizeof_signed_long -eq 8; then
1090   INT64_T='signed long'
1091   INT64_F='"l"'
1092 elif test $ac_cv_sizeof_signed_long_long -eq 8; then
1093   INT64_T='signed long long'
1094   INT64_F='"ll"'
1095 fi
1096 case "${host_os}" in
1097   mingw* )
1098     INT64_F='"I64"'
1099     ;;
1100 esac
1101 AC_MSG_RESULT($INT64_T)
1102 AC_SUBST(INT64_T)
1103 AC_SUBST(INT64_F)
1104
1105 AC_MSG_CHECKING(for unsigned 64-bit type)
1106 UINT64_T='none'
1107 UINT64_F='none'
1108 if test $ac_cv_sizeof_unsigned_long -eq 8; then
1109   UINT64_T='unsigned long'
1110   UINT64_F='"l"'
1111 elif test $ac_cv_sizeof_unsigned_long_long -eq 8; then
1112   UINT64_T='unsigned long long'
1113   UINT64_F='"ll"'
1114 fi
1115 case "${host_os}" in
1116   mingw* )
1117     UINT64_F='"I64"'
1118     ;;
1119 esac
1120 AC_MSG_RESULT($UINT64_T)
1121 AC_SUBST(UINT64_T)
1122 AC_SUBST(UINT64_F)
1123
1124 AC_MSG_CHECKING(for unsigned maximum type)
1125 UINTMAX_T='none'
1126 UINTMAX_F='none'
1127 if test "$UINT64_T" != 'none'; then
1128   UINTMAX_T=$UINT64_T
1129   UINTMAX_F=$UINT64_F
1130 elif test "$UINT32_T" != 'none'; then
1131   UINTMAX_T=$UINT32_T
1132   UINTMAX_F=$UINT32_F
1133 fi
1134 AC_MSG_RESULT($UINTMAX_T)
1135 AC_SUBST(UINTMAX_T)
1136 AC_SUBST(UINTMAX_F)
1137
1138 AC_MSG_CHECKING(for pointer difference type)
1139 UINTPTR_T='none'
1140 UINTPTR_F='none'
1141 if test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_unsigned_intp; then
1142   UINTPTR_T='unsigned long'
1143   UINTPTR_F='"l"'
1144 elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_unsigned_intp; then
1145   UINTPTR_T='unsigned long long'
1146   UINTPTR_F='"ll"'
1147 fi
1148 AC_MSG_RESULT($UINTPTR_T)
1149 AC_SUBST(UINTPTR_T)
1150 AC_SUBST(UINTPTR_F)
1151
1152 AC_MSG_CHECKING([whether our compiler supports __func__])
1153 AC_TRY_COMPILE([],
1154  [{ const char *func = __func__; return(func != 0 ? 0 : 1); }],
1155  AC_MSG_RESULT([yes]),
1156  AC_MSG_RESULT([no])
1157  AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
1158  AC_TRY_COMPILE([],
1159    [{ const char *func = __FUNCTION__; return(func != 0 ? 0 : 1); }],
1160    AC_MSG_RESULT([yes])
1161    AC_DEFINE(__func__, __FUNCTION__,
1162      [Define to appropriate substitue if compiler does not have __func__]),
1163    AC_MSG_RESULT([no])
1164    AC_DEFINE(__func__, __FILE__,
1165      [Define to appropriate substitue if compiler does not have __func__])))
1166
1167 ########
1168 #
1169 # Check for functions
1170 #
1171 ########
1172 AC_FUNC_CLOSEDIR_VOID
1173 AC_FUNC_MMAP
1174 AC_FUNC_FORK
1175 AC_FUNC_MEMCMP
1176 AC_FUNC_SELECT_ARGTYPES
1177 AC_FUNC_SETVBUF_REVERSED
1178 AC_TYPE_SIGNAL
1179 AC_FUNC_STRTOD
1180 AC_FUNC_STRERROR_R
1181 AC_FUNC_VPRINTF
1182
1183 #
1184 # Find math library
1185 #
1186 MATH_LIBS=''
1187 AC_CHECK_LIB(m,sqrt,MATH_LIBS="-lm",,)
1188 LIBS="$MATH_LIBS $LIBS"
1189 AC_SUBST(MATH_LIBS)
1190
1191 #
1192 # Find socket library
1193 #
1194 AC_SEARCH_LIBS(gethostbyname, resolv nsl)
1195 AC_SEARCH_LIBS(socket, socket,
1196 [
1197   AC_DEFINE([HAVE_SOCKET],[1],[Define to 1 if you have socket support.])
1198   MAGICK_FEATURES="DPC $MAGICK_FEATURES"
1199 ])
1200
1201 AC_CHECK_FUNCS([acosh _aligned_malloc asinh atanh atoll atexit cabs carg cimag creal clock ctime_r directio _exit execvp fchmod floor fork ftime ftruncate getc_unlocked getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r isnan j0 j1 lltostr localtime_r lstat memmove memset mkstemp munmap nanosleep newlocale _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_memalign posix_spawnp pow pread pwrite qsort_r raise rand_r readlink readdir_r realpath select seekdir sendfile setlocale socket sqrt setvbuf stat strchr strrchr strcspn strdup strpbrk strspn strstr strtod strtod_l strtol strtoul symlink sysconf sigemptyset sigaction spawnvp strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times ulltostr uselocale usleep utime vfprintf vfprintf_l vsprintf vsnprintf vsnprintf_l waitpid _wfopen _wstat])
1202
1203 #
1204 # Check for clock_gettime().
1205 #
1206 AC_SEARCH_LIBS(clock_gettime, rt,
1207 [
1208   AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define to 1 if you have clock_gettime.])
1209   AC_MSG_CHECKING([whether clock_gettime supports CLOCK_REALTIME])
1210   AC_COMPILE_IFELSE([
1211     AC_LANG_PROGRAM(
1212       [[#include <time.h>]],
1213        [[clockid_t clockType = CLOCK_REALTIME;]])],
1214       [
1215         AC_MSG_RESULT(yes)
1216         AC_DEFINE([HAVE_CLOCK_REALTIME],[1],
1217           [Define to 1 if clock_gettime supports CLOCK_REALTIME.])
1218       ],
1219       AC_MSG_RESULT(no)
1220     )
1221   ],
1222   [
1223     AC_CHECK_FUNCS([gettimeofday ftime], [break])
1224   ]
1225 )
1226
1227 ########
1228 #
1229 # Check for function prototypes
1230 #
1231 ########
1232
1233 AC_CHECK_DECLS([pread, pwrite],[],[],[
1234 #include <unistd.h>])
1235
1236 AC_CHECK_DECLS([strlcpy],[],[],[
1237 #include <strings.h>])
1238
1239 AC_CHECK_DECLS([vsnprintf],[],[],[
1240 #include <stdio.h>
1241 #include <stdarg.h>])
1242
1243 ########
1244 #
1245 # C++ Support Tests (For Magick++)
1246 #
1247 ########
1248 have_magick_plus_plus='no'
1249 if test "$with_magick_plus_plus" = 'yes'; then
1250     OLIBS="$LIBS"
1251     LIBS=''
1252     AC_LANG_PUSH(C++)
1253
1254     # Full set of headers used...
1255     # algorithm cctype cerrno cmath cstdio cstdlib cstring ctime exception
1256     # functional iomanip iosfwd iostream iterator list string strstream utility
1257     AC_LANG([C++])
1258     AC_PROG_CXX
1259     AX_CXX_BOOL
1260     AX_CXX_NAMESPACES
1261     AX_CXX_NAMESPACE_STD
1262     AC_CXX_HAVE_STD_LIBS
1263     AC_OPENMP([C++])
1264     AC_LANG_POP
1265
1266     AC_MSG_CHECKING([whether C++ compiler is sufficient for Magick++])
1267     if \
1268         test $ax_cv_cxx_bool = 'yes' && \
1269         test $ax_cv_cxx_namespaces = 'yes' && \
1270         test $ac_cv_cxx_have_std_libs = 'yes' && \
1271         test $ax_cv_cxx_have_std_namespace = 'yes'; then
1272         have_magick_plus_plus='yes'
1273     else
1274         have_magick_plus_plus='no (failed tests)'
1275     fi
1276     AC_MSG_RESULT([$have_magick_plus_plus])
1277     LIBS="$OLIBS"
1278 fi
1279 AM_CONDITIONAL(WITH_MAGICK_PLUS_PLUS, test "$have_magick_plus_plus" = 'yes')
1280
1281 # Only check for delegate libraries in subdirectories if requested.
1282 if test "$enable_delegate_build" != 'no'; then
1283     # Check for delegate sub-directories and add -I & -L options as required.
1284     # This presumes that delegates are installed as detailed in the ImageMagick
1285     # README. If delegates are installed in a standard location where the
1286     # compiler will automatically find them then these options should not be
1287     # required.
1288
1289     #
1290     # Most delegates have includes in the same directory as the library, but not all...
1291     #
1292     # Includes
1293     for dir in bzlib fftw fpx gslib/src jp2 jbig/libjbig jpeg lcms/include lzma magick openjp2/include png tiff/libtiff ttf/include wand webp/src wmf/include xml/include zlib; do
1294         if test -d "$builddir/$dir"; then
1295             CPPFLAGS="$CPPFLAGS -I$builddir/$dir"
1296         else
1297             if test -d "$srcdirfull/$dir"; then
1298                 CPPFLAGS="$CPPFLAGS -I$srcdirfull/$dir"
1299             fi
1300         fi
1301     done
1302
1303     # Libraries
1304     for dir in bzlib fftw fpx gslib/src jbig/libjbig jpeg lcms/src lzma magick openjp2 png tiff/libtiff ttf/objs wand webp wmf/src xml zlib; do
1305     if test -d "$builddir/$dir/.libs"; then
1306         LDFLAGS="$LDFLAGS -L$builddir/$dir/.libs"
1307     else
1308         if test -d "$srcdirfull/$dir/.libs"; then
1309             LDFLAGS="$LDFLAGS -L$srcdirfull/$dir/.libs"
1310         fi
1311     fi
1312     if test -d "$builddir/$dir"; then
1313         LDFLAGS="$LDFLAGS -L$builddir/$dir"
1314     else
1315         if test -d "$srcdirfull/$dir"; then
1316             LDFLAGS="$LDFLAGS -L$srcdirfull/$dir"
1317         fi
1318     fi
1319   done
1320 fi
1321
1322 # Assume that delegate headers reside under same directory as ImageMagick
1323 # installation prefix.
1324 MAGICK_CPPFLAGS="-I$INCLUDE_DIR/${PACKAGE_NAME}-$MAGICK_MAJOR_VERSION $MAGICK_CPPFLAGS"
1325
1326 #
1327 # Find the X11 RGB database
1328 #
1329 AC_CACHE_CHECK(for X11 configure files,im_cv_x_configure,
1330 [# Look for the header file in a standard set of common directories.
1331 # Check X11 before X11Rn because it is often a symlink to the current release.
1332     for ac_dir in          \
1333     /lib/usr/lib/X11       \
1334     /usr/X11/lib           \
1335     /usr/X11R4/lib         \
1336     /usr/X11R5/lib         \
1337     /usr/X11R6/lib         \
1338     /usr/X11R7/lib         \
1339     /usr/X386/lib          \
1340     /usr/XFree86/lib/X11   \
1341     /usr/athena/lib        \
1342     /usr/lib               \
1343     /usr/lib/X11           \
1344     /usr/lib/X11R4         \
1345     /usr/lib/X11R5         \
1346     /usr/lib/X11R6         \
1347     /usr/lib/X11R7         \
1348     /usr/local/X11/lib     \
1349     /usr/local/X11R4/lib   \
1350     /usr/local/X11R5/lib   \
1351     /usr/local/X11R6/lib   \
1352     /usr/local/lib         \
1353     /usr/local/lib/X11     \
1354     /usr/local/lib/X11R4   \
1355     /usr/local/lib/X11R5   \
1356     /usr/local/lib/X11R6   \
1357     /usr/local/lib/X11R7   \
1358     /usr/local/x11r5/lib   \
1359     /usr/lpp/Xamples/lib   \
1360     /usr/openwin/lib       \
1361     /usr/openwin/share/lib \
1362     /usr/unsupported/lib   \
1363     /usr/x386/lib          \
1364     ; do
1365     if test -f "$ac_dir/X11/rgb.txt"; then
1366       im_cv_x_configure="$ac_dir/X11/"
1367       break
1368     elif test -f "$ac_dir/rgb.txt"; then
1369       im_cv_x_configure="$ac_dir/"
1370       break
1371     fi
1372
1373   done])
1374 X11_CONFIGURE_PATH="$im_cv_x_configure"
1375 case "${build_os}" in
1376   mingw* )
1377     X11ConfigurePath=`$WinPathScript "$X11ConfigurePath=" 1`
1378   ;;
1379 esac
1380 AC_DEFINE_UNQUOTED(X11_CONFIGURE_PATH,"$X11ConfigurePath",[Location of X11 configure files])
1381
1382 #
1383 # Find OpenMP library
1384 #
1385 GOMP_LIBS=''
1386 if test "$enable_openmp" != 'no'; then
1387   if test "${GCC}" = "yes"; then
1388     # Open64 (passes for GCC but uses different OpenMP implementation)
1389     if test "x$GOMP_LIBS" = x ; then
1390       if $CC --version 2>&1 | grep Open64 > /dev/null ; then
1391         AC_CHECK_LIB(openmp,omp_get_num_procs,GOMP_LIBS="-lopenmp",,)
1392       fi
1393     fi
1394     # GCC
1395     if test "x$GOMP_LIBS" = x ; then
1396       AC_CHECK_LIB(gomp,GOMP_parallel_start,GOMP_LIBS="-lgomp",,)
1397     fi
1398   else
1399     # Sun CC
1400     if test "x$GOMP_LIBS" = x ; then
1401       AC_CHECK_LIB(mtsk,sunw_mp_register_warn,GOMP_LIBS="-lmtsk",,)
1402     fi
1403     # AIX xlc
1404     if test "x$GOMP_LIBS" = x ; then
1405     AC_CHECK_LIB(xlsmp,_xlsmpFlush,GOMP_LIBS="-lxlsmp",,)
1406     fi
1407     # SGI IRIX 6.5 MIPSpro C/C++
1408     if test "x$GOMP_LIBS" = x ; then
1409     AC_CHECK_LIB(mp,mp_destroy,GOMP_LIBS="-lmp",,)
1410     fi
1411   fi
1412   LIBS="$GOMP_LIBS $LIBS"
1413 fi
1414 AC_SUBST(GOMP_LIBS)
1415
1416 #
1417 # Check for jemalloc.
1418 #
1419 have_jemalloc='no'
1420 JEMALLOC_LIBS=''
1421 if test "$with_jemalloc" != 'no'; then
1422   AC_MSG_CHECKING(for JEMALLOC support )
1423   AC_MSG_RESULT()
1424   failed=0
1425   passed=0
1426   AC_CHECK_HEADER([jemalloc/jemalloc.h],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`])
1427   AC_CHECK_LIB(jemalloc,[malloc_stats_print],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`],)
1428   AC_MSG_CHECKING(if jemalloc memory allocation library is complete)
1429   if test $passed -gt 0; then
1430     if test $failed -gt 0; then
1431       AC_MSG_RESULT(no -- some components failed test)
1432       have_jemalloc='no (failed tests)'
1433     else
1434       JEMALLOC_LIBS='-ljemalloc'
1435       LIBS="$JEMALLOC_LIBS $LIBS"
1436       AC_DEFINE(HasJEMALLOC,1,Define if you have jemalloc memory allocation library)
1437       AC_MSG_RESULT(yes)
1438       have_jemalloc='yes'
1439     fi
1440   else
1441     AC_MSG_RESULT(no)
1442   fi
1443 fi
1444 AM_CONDITIONAL(HasJEMALLOC, test "$have_jemalloc" = 'yes')
1445 AC_SUBST(JEMALLOC_LIBS)
1446
1447 #
1448 # Check for umem.
1449 #
1450 have_umem='no'
1451 UMEM_LIBS=''
1452 if test "$with_umem" != 'no'; then
1453   AC_MSG_CHECKING(for UMEM support )
1454   AC_MSG_RESULT()
1455   failed=0
1456   passed=0
1457   AC_CHECK_HEADER(umem.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1458   AC_CHECK_LIB(umem,umem_alloc,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1459   AC_CHECK_LIB(umem,umem_free,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1460   AC_MSG_CHECKING(if umem memory allocation library is complete)
1461   if test $passed -gt 0; then
1462     if test $failed -gt 0; then
1463       AC_MSG_RESULT(no -- some components failed test)
1464       have_umem='no (failed tests)'
1465     else
1466       UMEM_LIBS='-lumem'
1467       LIBS="$UMEM_LIBS $LIBS"
1468       AC_DEFINE(HasUMEM,1,Define if you have umem memory allocation library)
1469       AC_MSG_RESULT(yes)
1470       have_umem='yes'
1471     fi
1472   else
1473     AC_MSG_RESULT(no)
1474   fi
1475 fi
1476 AM_CONDITIONAL(HasUMEM, test "$have_umem" = 'yes')
1477 AC_SUBST(UMEM_LIBS)
1478
1479 #
1480 # Add support for ccmalloc memory debugging library if requested
1481 #
1482 have_ccmalloc='no'
1483 CCMALLOC_LIBS=''
1484 if test "$enable_ccmalloc" = 'yes'; then
1485     AC_PATH_PROG(CCMALLOCDelegate,ccmalloc,)
1486     if test -n "$CCMALLOCDelegate"; then
1487         eval `grep PREFIX= $CCMALLOCDelegate | sed -e 's/PREFIX/CCMALLOC_PREFIX/'`
1488         OLIBS="$LIBS"
1489         # Assume that gcc is used with ccmalloc.
1490         LIBS="$LIBS $CCMALLOC_PREFIX/lib/ccmalloc-gcc.o"
1491        AC_CHECK_LIB(ccmalloc,ccmalloc_malloc,CCMALLOC_LIBS="$CCMALLOC_PREFIX/lib/ccmalloc-gcc.o -lccmalloc -ldl",,-ldl)
1492         if test -n "$CCMALLOC_LIBS"; then
1493             LIBS="$OLIBS"
1494             LIBS="$LIBS $CCMALLOC_LIBS"
1495             have_ccmalloc='yes'
1496         else
1497             LIBS="$OLIBS"
1498         fi
1499     fi
1500 fi
1501
1502 #
1503 # Add support for 'huge pages' if requested
1504 #
1505 AS_IF([test "x$enable_hugepages" != "xno"],[
1506   AC_DEFINE(HAVE_HUGEPAGES, 1, [Compile with hugepage support])
1507 ])
1508
1509 #
1510 # Add support for efence memory debugging library if requested
1511 #
1512 if test "$enable_efence" = 'yes'; then
1513     EFENCE_LIBS='-lefence'
1514     LIBS="$EFENCE_LIBS $LIBS"
1515 fi
1516
1517 dnl ===========================================================================
1518
1519 #
1520 # Check for BZLIB
1521 #
1522
1523 AC_ARG_WITH([bzlib],
1524     [AC_HELP_STRING([--without-bzlib],
1525                     [disable BZLIB support])],
1526     [with_bzlib=$withval],
1527     [with_bzlib='yes'])
1528
1529 if test "$with_bzlib" != 'yes'; then
1530     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-bzlib=$with_bzlib "
1531 fi
1532
1533 have_bzlib='no'
1534 if test "$with_bzlib" != 'no'; then
1535     BZLIB_LIBS=''
1536     AC_MSG_RESULT([-------------------------------------------------------------])
1537     AC_MSG_CHECKING([for BZLIB])
1538     AC_MSG_RESULT([])
1539     failed=0
1540     passed=0
1541     found_libbz=0
1542     AC_CHECK_HEADER(bzlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1543     AC_CHECK_LIB(bz2,BZ2_bzDecompress,found_libbz=`expr $found_libbz + 1`,,)
1544     if test "$native_win32_build" = 'yes'; then
1545       AC_CHECK_LIB(bz2,_imp__BZ2_decompress,found_libbz=`expr $found_libbz + 1`,,)
1546     fi
1547     if test $found_libbz -gt 0; then
1548       passed=`expr $passed + 1`
1549     else
1550       failed=`expr $failed + 1`
1551     fi
1552     AC_MSG_CHECKING(if BZLIB package is complete)
1553     if test $passed -gt 0; then
1554       if test $failed -gt 0; then
1555         AC_MSG_RESULT(no -- some components failed test)
1556         have_bzlib='no (failed tests)'
1557       else
1558         BZLIB_LIBS='-lbz2'
1559         LIBS="$BZLIB_LIBS $LIBS"
1560         AC_DEFINE(BZLIB_DELEGATE,1,Define if you have the bzip2 library)
1561         AC_MSG_RESULT(yes)
1562         have_bzlib='yes'
1563       fi
1564     else
1565       AC_MSG_RESULT(no)
1566     fi
1567 fi
1568 AM_CONDITIONAL(BZLIB_DELEGATE, test "$have_bzlib" = 'yes')
1569 AC_SUBST(BZLIB_LIBS)
1570
1571 #
1572 # Find the X11 include and library directories.
1573 #
1574 IPC_LIBS=''
1575 X11_LIBS=''
1576 XEXT_LIBS=''
1577 XT_LIBS=''
1578 AC_PATH_XTRA
1579 if test "$no_x" != 'yes'; then
1580     AC_MSG_RESULT([-------------------------------------------------------------])
1581     AC_MSG_CHECKING([for X11])
1582     AC_MSG_RESULT([])
1583     LDFLAGS="$LDFLAGS $X_LIBS"
1584     X11_LIBS="$X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
1585     LIBS="$X11_LIBS $LIBS"
1586     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1587
1588     AC_DEFINE(X11_DELEGATE,1,Define if you have X11 library)dnl
1589
1590     #
1591     # Check for X11 shared memory extension
1592     #
1593     # shmctl is required to support the shared memory extension
1594     AC_CHECK_FUNC([shmctl],[have_shmctl='yes'],[])
1595     if test "$have_shmctl" != 'yes'; then
1596         PERSIST_LIBS=$LIBS
1597         LIBS="$LIBS -lcygipc"
1598         AC_TRY_LINK_FUNC([shmctl],[have_shmctl='yes'; IPC_LIBS='-lcygipc'],[])
1599         LIBS=$PERSIST_LIBS
1600     fi
1601
1602     if test "$have_shmctl" = 'yes'; then
1603         AC_CHECK_LIB([Xext],[XShmAttach],[XEXT_LIBS='-lXext' ; AC_DEFINE(HAVE_SHARED_MEMORY,1,X11 server supports shared memory extension)],[],[])
1604     fi
1605
1606     #
1607     # Check for X11 shape extension
1608     #
1609     AC_CHECK_LIB([Xext],[XShapeCombineMask],[XEXT_LIBS='-lXext' ; AC_DEFINE(HAVE_SHAPE,1,X11 server supports shape extension)],[],[])
1610     AC_CHECK_LIB(Xt,XtSetEventDispatcher,XT_LIBS='-lXt',,)
1611     LIBS="$XEXT_LIBS $XT_LIBS $LIBS"
1612 fi
1613 if test "$no_x" != 'yes'; then
1614   have_x='yes'
1615 else
1616   have_x='no'
1617 fi
1618 AM_CONDITIONAL(X11_DELEGATE, test "$have_x" = 'yes')
1619 AC_SUBST(X11_LIBS)
1620 AC_SUBST(XEXT_LIBS)
1621
1622 dnl ===========================================================================
1623
1624 #
1625 # Check for ZLIB
1626 #
1627 AC_ARG_WITH([zlib],
1628     [AC_HELP_STRING([--without-zlib],
1629                     [disable ZLIB support])],
1630     [with_zlib=$withval],
1631     [with_zlib='yes'])
1632
1633 if test "$with_zlib" != 'yes'; then
1634     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-zlib=$with_zlib "
1635 fi
1636
1637 have_zlib='no'
1638 ZLIB_CFLAGS=""
1639 ZLIB_LIBS=""
1640 ZLIB_PKG=""
1641 if test "x$with_zlib" = "xyes"; then
1642   AC_MSG_RESULT([-------------------------------------------------------------])
1643   PKG_CHECK_MODULES(ZLIB,[zlib >= 1.0.0], have_zlib=yes, have_zlib=no)
1644   AC_MSG_RESULT([])
1645 fi
1646
1647 if test "$have_zlib" = 'yes'; then
1648   AC_DEFINE(ZLIB_DELEGATE,1,Define if you have ZLIB library)
1649   CFLAGS="$ZLIB_CFLAGS $CFLAGS"
1650 fi
1651
1652 AM_CONDITIONAL(ZLIB_DELEGATE, test "$have_zlib" = 'yes')
1653 AC_SUBST(ZLIB_CFLAGS)
1654 AC_SUBST(ZLIB_LIBS)
1655
1656 dnl ===========================================================================
1657
1658 # whether modules are built or not.
1659 with_ltdl='yes'
1660 have_ltdl='no'
1661 LTDL_LIBS=''
1662 if test "$build_modules" != 'no' ; then
1663   AC_MSG_RESULT([-------------------------------------------------------------])
1664   AC_MSG_CHECKING([for libltdl])
1665   AC_MSG_RESULT([])
1666   failed=0
1667   passed=0
1668   AC_CHECK_HEADER([ltdl.h],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`])
1669   AC_CHECK_LIB([ltdl],[lt_dlinit],[passed=`expr $passed + 1`],[failed=`expr $failed + 1`],)
1670   AC_MSG_CHECKING([if libltdl package is complete])
1671   if test $passed -gt 0 ; then
1672     if test $failed -gt 0 ; then
1673       AC_MSG_RESULT([no -- some components failed test])
1674       have_ltdl='no (failed tests)'
1675     else
1676       LTDL_LIBS='-lltdl'
1677       LIBS="$LTDL_LIBS $LIBS"
1678       AC_DEFINE(LTDL_DELEGATE,1,[Define if using libltdl to support dynamically loadable modules])
1679       AC_MSG_RESULT([yes])
1680       have_ltdl='yes'
1681     fi
1682   else
1683     AC_MSG_RESULT([no])
1684   fi
1685   if test "$have_ltdl" != 'yes' ; then
1686     AC_MSG_FAILURE([libltdl is required for modules build],[1])
1687   fi
1688 fi
1689 AM_CONDITIONAL(WITH_LTDL, test "$have_ltdl" != 'no')
1690
1691 #
1692 # If profiling, then check for -ldl and dlopen (required for Solaris & gcc)
1693 #
1694 LIB_DL=''
1695 if test "$enable_profiling" = 'yes'; then
1696     AC_CHECK_LIB(dl,dlopen,LIB_DL='-ldl',,)
1697     LIBS="$LIB_DL $LIBS"
1698 fi
1699 AC_SUBST(LIB_DL)
1700
1701 dnl ===========================================================================
1702
1703 #
1704 # Set Apple font directory.
1705 #
1706 AC_ARG_WITH([apple-font-dir],
1707     [AC_HELP_STRING([--with-apple-font-dir=DIR],
1708                     [Apple font directory])],
1709     [with_apple_font_dir=$withval],
1710     [with_apple_font_dir='default'])
1711
1712 if test "$with_apple_font_dir" != 'default'; then
1713     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-apple-font-dir=$with_apple_font_dir "
1714 fi
1715
1716 dnl ===========================================================================
1717
1718 #
1719 # Check for Autotrace delegate library.
1720 #
1721 AC_ARG_WITH([autotrace],
1722     [AC_HELP_STRING([--with-autotrace],
1723                     [enable autotrace support])],
1724         [with_autotrace=$withval],
1725         [with_autotrace='no'])
1726
1727 if test "$with_autotrace" != 'yes'; then
1728     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-autotrace=$with_autotrace "
1729 fi
1730
1731 have_autotrace='no'
1732 AUTOTRACE_CFLAGS=""
1733 AUTOTRACE_LIBS=""
1734 AUTOTRACE_PKG=""
1735 if test "x$with_autotrace" = "xyes"; then
1736   AC_MSG_RESULT([-------------------------------------------------------------])
1737   PKG_CHECK_MODULES(AUTOTRACE,[autotrace >= 0.31.1], have_autotrace=yes, have_autotrace=no)
1738   AC_MSG_RESULT([])
1739 fi
1740
1741 if test "$have_autotrace" = 'yes'; then
1742   AC_DEFINE(AUTOTRACE_DELEGATE,1,Define if you have AUTOTRACE library)
1743   CFLAGS="$AUTOTRACE_CFLAGS $CFLAGS"
1744 fi
1745
1746 AM_CONDITIONAL(AUTOTRACE_DELEGATE,test "$have_autotrace" = 'yes')
1747 AC_SUBST(AUTOTRACE_CFLAGS)
1748 AC_SUBST(AUTOTRACE_LIBS)
1749
1750 dnl ===========================================================================
1751
1752 #
1753 # Check for Display Postscript delegate library.
1754 #
1755 AC_ARG_WITH([dps],
1756     [AC_HELP_STRING([--without-dps],
1757                     [disable Display Postscript support])],
1758     [with_dps=$withval],
1759     [with_dps='yes'])
1760
1761 if test "$with_dps" != 'yes'; then
1762     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-dps=$with_dps "
1763 fi
1764
1765 have_dps='no'
1766 DPS_LIBS=''
1767 if test "$with_dps" != 'no' && test "$with_x" != 'no'; then
1768     AC_MSG_RESULT([-------------------------------------------------------------])
1769     AC_MSG_CHECKING([for DPS])
1770     AC_MSG_RESULT([])
1771     failed=0
1772     passed=0
1773     PERSIST_CPPFLAGS="$CPPFLAGS"
1774     CPPFLAGS="$CPPFLAGS -I${ac_x_includes}/X11"
1775     AC_CHECK_HEADER(DPS/dpsXclient.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1776     # DPS issues:
1777     # XFree86-4.x needs -lXt to provide XtMalloc for -ldps.
1778     # Cygwin doesn't deliver -lXt as a DLL, which prevents a DLL build.
1779     # Adobe DPS (as delivered on Solaris) doesn't require -lXt.
1780     # ImageMagick itself doesn't use -lXt.
1781     have_libdps='no'
1782     LIBDPS_XT=''
1783     AC_CHECK_LIB(dps,DPSInitialize,have_libdps='yes',have_libdps='no',)
1784     if test "$have_libdps" != 'yes'; then
1785         # Unset cache variable so we can try again.
1786         unset ac_cv_lib_dps_DPSInitialize
1787         AC_CHECK_LIB(dps,DPSInitialize,have_libdps='yes',have_libdps='no',-lXt)
1788         if test "$have_libdps" = 'yes'; then
1789             LIBDPS_XT='-lXt'
1790         fi
1791     fi
1792     if test "$have_libdps" = 'yes'; then
1793         passed=`expr $passed + 1`
1794     else
1795         failed=`expr $failed + 1`
1796     fi
1797     AC_CHECK_LIB(dpstk,XDPSPixelsPerPoint,passed=`expr $passed + 1`,failed=`expr $failed + 1`,-ldps $LIBDPS_XT)
1798     AC_MSG_CHECKING([if DPS package is complete])
1799     if test $passed -gt 0; then
1800         if test $failed -gt 0; then
1801             AC_MSG_RESULT([no -- some components failed test])
1802             have_dps='no (failed tests)'
1803             CPPFLAGS="$PERSIST_CPPFLAGS"
1804         else
1805             DPS_LIBS="-ldpstk -ldps ${LIBDPS_XT}"
1806             LIBS="$DPS_LIBS $LIBS"
1807             AC_DEFINE(DPS_DELEGATE,1,Define if you have Display Postscript)
1808             AC_MSG_RESULT([yes])
1809             have_dps='yes'
1810         fi
1811     else
1812         AC_MSG_RESULT([no])
1813         CPPFLAGS=$PERSIST_CPPFLAGS
1814     fi
1815 fi
1816 AM_CONDITIONAL(DPS_DELEGATE, test "$have_dps" = 'yes')
1817 AC_SUBST(DPS_LIBS)
1818
1819 dnl ===========================================================================
1820
1821 #
1822 # Set DejaVu font directory.
1823 #
1824 AC_ARG_WITH([dejavu-font-dir],
1825     [AC_HELP_STRING([--with-dejavu-font-dir=DIR],
1826                     [DejaVu font directory])],
1827     [with_dejavu_font_dir=$withval],
1828     [with_dejavu_font_dir='default'])
1829
1830 if test "$with_dejavu_font_dir" != 'default'; then
1831     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-dejavu-font-dir=$with_dejavu_font_dir "
1832 fi
1833
1834 dnl ===========================================================================
1835
1836 #
1837 # Check for FFTW delegate library.
1838 #
1839 AC_ARG_WITH([fftw],
1840     [AC_HELP_STRING([--without-fftw],
1841                     [disable FFTW support])],
1842     [with_fftw=$withval],
1843     [with_fftw='yes'])
1844
1845 if test "$with_fftw" != 'yes'; then
1846     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fftw=$with_fftw "
1847 fi
1848
1849 have_fftw='no'
1850 FFTW_CFLAGS=""
1851 FFTW_LIBS=""
1852 FFTW_PKG=""
1853 if test "x$with_fftw" = "xyes"; then
1854   AC_MSG_RESULT([-------------------------------------------------------------])
1855   PKG_CHECK_MODULES(fftw3,[fftw3 >= 3.0.0], have_fftw=yes, have_fftw=no)
1856   AC_MSG_RESULT([])
1857 fi
1858
1859 if test "$have_fftw" = 'yes'; then
1860   AC_DEFINE(FFTW_DELEGATE,1,Define if you have FFTW library)
1861   FFTW_CFLAGS="$fftw3_CFLAGS"
1862   FFTW_LIBS="$fftw3_LIBS"
1863   CFLAGS="$fftw3_CFLAGS $CFLAGS"
1864 fi
1865
1866 AM_CONDITIONAL(FFTW_DELEGATE, test "$have_fftw" = 'yes')
1867 AC_SUBST(FFTW_CFLAGS)
1868 AC_SUBST(FFTW_LIBS)
1869
1870 dnl ===========================================================================
1871
1872 #
1873 # Check for FlashPIX delegate library.
1874 #
1875 AC_ARG_WITH([fpx],
1876     [AC_HELP_STRING([--without-fpx],
1877                     [disable FlashPIX support])],
1878     [with_fpx=$withval],
1879     [with_fpx='yes'])
1880
1881 if test "$with_fpx" != 'yes'; then
1882     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fpx=$with_fpx "
1883 fi
1884
1885 have_fpx='no'
1886 FPX_LIBS=''
1887 if test "$with_fpx" != 'no'; then
1888     AC_MSG_RESULT([-------------------------------------------------------------])
1889     AC_MSG_CHECKING([for FlashPIX])
1890     AC_MSG_RESULT([])
1891     failed=0
1892     passed=0
1893     AC_LANG_PUSH(C++)
1894     AC_CHECK_HEADER(fpxlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1895     AC_CHECK_LIB(fpx,FPX_OpenImageByFilename,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1896     AC_LANG_POP
1897     AC_MSG_CHECKING([if FlashPIX package is complete])
1898     if test $passed -gt 0; then
1899         if test $failed -gt 0; then
1900             AC_MSG_RESULT([no -- some components failed test])
1901             have_fpx='no (failed tests)'
1902         else
1903             FPX_LIBS='-lfpx'
1904             AC_DEFINE(FPX_DELEGATE,1,Define if you have FlashPIX library)
1905             AC_MSG_RESULT([yes])
1906             have_fpx='yes'
1907             PERLMAINCC="$CXX"
1908         fi
1909     else
1910         AC_MSG_RESULT([no])
1911     fi
1912 fi
1913 AM_CONDITIONAL(FPX_DELEGATE, test "$have_fpx" = 'yes')
1914 AC_SUBST(FPX_LIBS)
1915
1916 dnl ===========================================================================
1917
1918 #
1919 # Check for DJVU delegate library.
1920 #
1921 AC_ARG_WITH([djvu],
1922     [AC_HELP_STRING([--without-djvu],
1923                     [disable DjVu support])],
1924     [with_djvu=$withval],
1925     [with_djvu='yes'])
1926
1927 if test "$with_djvu" != 'yes'; then
1928     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-djvu=$with_djvu "
1929 fi
1930
1931 have_djvu='no'
1932 DJVU_CFLAGS=""
1933 DJVU_LIBS=""
1934 DJVU_PKG=""
1935 if test "x$with_djvu" = "xyes"; then
1936   AC_MSG_RESULT([-------------------------------------------------------------])
1937   PKG_CHECK_MODULES(ddjvuapi,[ddjvuapi >= 3.5.0], have_djvu=yes, have_djvu=no)
1938   AC_MSG_RESULT([])
1939 fi
1940
1941 if test "$have_djvu" = 'yes'; then
1942   AC_DEFINE(DJVU_DELEGATE,1,Define if you have DJVU library)
1943   DJVU_CFLAGS="$ddjvuapi_CFLAGS"
1944   DJVU_LIBS="$ddjvuapi_LIBS"
1945   CFLAGS="$ddjvuapi_CFLAGS $CFLAGS"
1946 fi
1947
1948 AM_CONDITIONAL(DJVU_DELEGATE, test "$have_djvu" = 'yes')
1949 AC_SUBST(DJVU_CFLAGS)
1950 AC_SUBST(DJVU_LIBS)
1951
1952 dnl ===========================================================================
1953
1954 #
1955 # Check for fontconfig delegate library.
1956 #
1957 AC_ARG_WITH([fontconfig],
1958     [AC_HELP_STRING([--without-fontconfig],
1959                     [disable fontconfig support])],
1960         [with_fontconfig=$withval],
1961         [with_fontconfig='yes'])
1962
1963 if test "$with_fontconfig" != 'yes'; then
1964     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fontconfig=$with_fontconfig "
1965 fi
1966
1967 have_fontconfig='no'
1968 FONTCONFIG_CFLAGS=""
1969 FONTCONFIG_LIBS=""
1970 FONTCONFIG_PKG=""
1971 if test "x$with_fontconfig" = "xyes"; then
1972   AC_MSG_RESULT([-------------------------------------------------------------])
1973   PKG_CHECK_MODULES(FONTCONFIG,[fontconfig >= 2.1.0], have_fontconfig=yes, have_fontconfig=no)
1974   AC_MSG_RESULT([])
1975 fi
1976
1977 if test "$have_fontconfig" = 'yes'; then
1978   AC_DEFINE(FONTCONFIG_DELEGATE,1,Define if you have FONTCONFIG library)
1979   CFLAGS="$FONTCONFIG_CFLAGS $CFLAGS"
1980 fi
1981
1982 AM_CONDITIONAL(FONTCONFIG_DELEGATE,test "$have_fontconfig" = 'yes')
1983 AC_SUBST(FONTCONFIG_CFLAGS)
1984 AC_SUBST(FONTCONFIG_LIBS)
1985
1986 dnl ===========================================================================
1987
1988 #
1989 # Check for the Freetype delegate library.
1990 #
1991 AC_ARG_WITH([freetype],
1992     [AC_HELP_STRING([--without-freetype],
1993                     [disable Freetype support])],
1994     [with_freetype=$withval],
1995     [with_freetype='yes'])
1996
1997 if test "$with_freetype" != 'yes'; then
1998     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-freetype=$with_freetype "
1999 fi
2000
2001 have_freetype='no'
2002 FREETYPE_CFLAGS=""
2003 FREETYPE_LIBS=""
2004 FREETYPE_PKG=""
2005 if test "x$with_freetype" = "xyes"; then
2006   AC_MSG_RESULT([-------------------------------------------------------------])
2007   PKG_CHECK_MODULES(FREETYPE,[freetype2], have_freetype=yes, have_freetype=no)
2008   AC_MSG_RESULT([])
2009 fi
2010
2011 if test "$have_freetype" = 'yes'; then
2012   AC_DEFINE(FREETYPE_DELEGATE,1,Define if you have FREETYPE library)
2013   CFLAGS="$FREETYPE_CFLAGS $CFLAGS"
2014 fi
2015
2016 AM_CONDITIONAL(FREETYPE_DELEGATE, test "$have_freetype" = 'yes')
2017 AC_SUBST(FREETYPE_CFLAGS)
2018 AC_SUBST(FREETYPE_LIBS)
2019
2020 dnl ===========================================================================
2021
2022 #
2023 # Check for Ghostscript library or framework.
2024 #
2025 # Test for iapi.h & test for gsapi_new_instance in -lgs
2026 # or -framework Ghostscript
2027
2028 AC_ARG_WITH([gslib],
2029     [AC_HELP_STRING([--with-gslib],
2030                     [enable Ghostscript library support])],
2031     [with_gslib=$withval],
2032     [with_gslib='no'])
2033
2034 gslib_framework='no'
2035 if test "$with_gslib" != 'yes'; then
2036     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gslib=$with_gslib "
2037 fi
2038
2039 have_gslib='no'
2040 GS_LIBS=''
2041 if test "$with_gslib" != 'no'; then
2042     AC_MSG_RESULT([-------------------------------------------------------------])
2043     AC_MSG_CHECKING([for Ghostscript])
2044     AC_MSG_RESULT([])
2045     framework=0
2046     failed=0
2047     passed=0
2048     AC_CHECK_HEADER(ghostscript/iapi.h,passed=`expr $passed + 1`,
2049         failed=`expr $failed + 1`,)
2050     AC_CHECK_HEADER(ghostscript/ierrors.h,passed=`expr $passed + 1`,
2051         failed=`expr $failed + 1`,)
2052     AC_CHECK_FRAMEWORK(Ghostscript,gsapi_new_instance,framework=`expr $framework + 1`,
2053     AC_CHECK_LIB(gs,gsapi_new_instance,passed=`expr $passed + 1`,failed=`expr $failed + 1`,),)
2054     AC_MSG_CHECKING([if Ghostscript package is complete])
2055     if test $passed -gt 0; then
2056         if test $failed -gt 0; then
2057             AC_MSG_RESULT([no -- some components failed test])
2058             have_gslib='no (failed tests)'
2059         else
2060             if test $framework -gt 0; then
2061                 GS_LIBS='-framework Ghostscript'
2062                 gslib_framework='yes'
2063                 AC_MSG_RESULT([yes, using framework.])
2064             else
2065                 AC_MSG_RESULT([yes, using library.])
2066                 GS_LIBS='-lgs'
2067             fi
2068             LIBS="$GS_LIBS $LIBS"
2069             AC_DEFINE(GS_DELEGATE,1,Define if you have Ghostscript library or framework)
2070             have_gslib='yes'
2071         fi
2072     else
2073         AC_MSG_RESULT([no])
2074     fi
2075 fi
2076 AM_CONDITIONAL(GS_DELEGATE, test "$have_gslib" = 'yes')
2077 AC_SUBST(GS_LIBS)
2078
2079 # Set default font search path
2080 AC_ARG_WITH([fontpath],
2081     [AC_HELP_STRING([--with-fontpath=DIR],
2082                     [prepend to default font search path])],
2083     [with_fontpath=$withval],
2084     [with_fontpath=''])
2085
2086 if test "$with_fontpath" != "yes" && test -z "$with_fontpath"; then
2087     with_fontpath=''
2088 else
2089     AC_DEFINE_UNQUOTED(MAGICK_FONT_PATH,"$with_fontpath",[Define to prepend to default font search path.])
2090 fi
2091 if test "$with_fontpath=" != ''; then
2092     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fontpath=$with_fontpath "
2093 fi
2094
2095 # Set Ghostscript font directory
2096 AC_ARG_WITH([gs-font-dir],
2097     [AC_HELP_STRING([--with-gs-font-dir=DIR],
2098                     [Ghostscript font directory])],
2099     [with_gs_font_dir=$withval],
2100     [with_gs_font_dir='default'])
2101
2102 if test "$with_gs_font_dir" != 'default'; then
2103     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gs-font-dir=$with_gs_font_dir "
2104 fi
2105
2106 dnl ===========================================================================
2107
2108 #
2109 # Check for GVC delegate library.
2110 #
2111 AC_ARG_WITH(gvc,
2112     [AC_HELP_STRING([--with-gvc],
2113                     [enable GVC support])],
2114     [with_gvc=$withval],
2115     [with_gvc='yes'])
2116
2117 if test "$with_gvc" != 'yes'; then
2118     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gvc=$with_gvc "
2119 fi
2120
2121 GVC_PKG=""
2122 if test "x$with_gvc" = "xyes"; then
2123   AC_MSG_RESULT([-------------------------------------------------------------])
2124   PKG_CHECK_MODULES(GVC,[libgvc >= 2.9.0], have_gvc=yes, have_gvc=no)
2125   AC_MSG_RESULT([])
2126 fi
2127
2128 if test "$have_gvc" = 'yes'; then
2129   AC_DEFINE(GVC_DELEGATE,1,Define if you have GVC library)
2130   CFLAGS="$GVC_CFLAGS $CFLAGS"
2131 fi
2132
2133 AM_CONDITIONAL(GVC_DELEGATE, test "$have_gvc" = 'yes')
2134 AC_SUBST(GVC_CFLAGS)
2135 AC_SUBST(GVC_LIBS)
2136
2137 dnl ===========================================================================
2138
2139 #
2140 # Check for JBIG delegate library.
2141 #
2142
2143 AC_ARG_WITH([jbig],
2144     [AC_HELP_STRING([--without-jbig],
2145                     [disable JBIG support])],
2146     [with_jbig=$withval],
2147     [with_jbig='yes'])
2148
2149 have_jbig='no'
2150 JBIG_LIBS=''
2151 if test "$with_jbig" != 'no'; then
2152     AC_MSG_RESULT([-------------------------------------------------------------])
2153     AC_MSG_CHECKING([for JBIG])
2154     AC_MSG_RESULT([])
2155     failed=0
2156     passed=0
2157     AC_CHECK_HEADER(jbig.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2158     AC_CHECK_LIB(jbig,jbg_dec_init,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2159     AC_MSG_CHECKING([if JBIG package is complete])
2160     if test $passed -gt 0; then
2161         if test $failed -gt 0; then
2162             AC_MSG_RESULT([no -- some components failed test])
2163             have_jbig='no (failed tests)'
2164         else
2165             JBIG_LIBS='-ljbig'
2166             LIBS="$JBIG_LIBS $LIBS"
2167             AC_DEFINE(JBIG_DELEGATE,1,Define if you have JBIG library)
2168             AC_MSG_RESULT([yes])
2169             have_jbig='yes'
2170         fi
2171     else
2172         AC_MSG_RESULT([no])
2173     fi
2174 fi
2175 AM_CONDITIONAL(JBIG_DELEGATE, test "$have_jbig" = 'yes')
2176 AC_SUBST(JBIG_LIBS)
2177
2178 dnl ===========================================================================
2179
2180 #
2181 # Check for JPEG delegate library.
2182 #
2183 AC_ARG_WITH([jpeg],
2184     [AC_HELP_STRING([--without-jpeg],
2185                     [disable JPEG support])],
2186     [with_jpeg=$withval],
2187     [with_jpeg='yes'])
2188
2189 if test "$with_jpeg" != 'yes'; then
2190     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jpeg=$with_jpeg "
2191 fi
2192
2193 have_jpeg='no'
2194 JPEG_LIBS=''
2195 if test "$with_jpeg" != 'no'; then
2196     AC_MSG_RESULT([-------------------------------------------------------------])
2197     AC_MSG_CHECKING([for JPEG])
2198     AC_MSG_RESULT([])
2199     failed=0
2200     passed=0
2201     AC_CHECK_HEADER(jconfig.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2202     AC_CHECK_HEADER(jerror.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2203     AC_CHECK_HEADER(jmorecfg.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2204     AC_CHECK_HEADER(jpeglib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2205     AC_CHECK_LIB(jpeg,jpeg_read_header,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2206
2207 # Test for compatible JPEG library
2208 if test "$ac_cv_jpeg_version_ok" != 'yes'; then
2209 AC_CACHE_CHECK(for JPEG library is version 6b or later, ac_cv_jpeg_version_ok,
2210 [AC_TRY_COMPILE(
2211 #include <stdio.h>
2212 #include <stdlib.h>
2213 #include <jpeglib.h>
2214 ,
2215 changequote(<<, >>)dnl
2216 <<
2217 #if JPEG_LIB_VERSION < 62
2218 #error IJG JPEG library must be version 6b or newer!
2219 #endif
2220 return 0;
2221 >>,
2222 changequote([, ])dnl
2223 ac_cv_jpeg_version_ok='yes'; passed=`expr $passed + 1`,
2224 ac_cv_jpeg_version_ok='no'; failed=`expr $failed + 1`)])
2225 fi
2226     AC_MSG_CHECKING([if JPEG package is complete])
2227     if test $passed -gt 0; then
2228         if test $failed -gt 0; then
2229             AC_MSG_RESULT([no -- some components failed test])
2230             have_jpeg='no (failed tests)'
2231         else
2232             JPEG_LIBS='-ljpeg'
2233             LIBS="$JPEG_LIBS $LIBS"
2234             AC_DEFINE(JPEG_DELEGATE,1,Define if you have JPEG library)
2235             AC_MSG_RESULT([yes])
2236             have_jpeg='yes'
2237         fi
2238     else
2239         AC_MSG_RESULT([no])
2240     fi
2241 fi
2242 AM_CONDITIONAL(JPEG_DELEGATE, test "$have_jpeg" = 'yes')
2243 AC_SUBST(JPEG_LIBS)
2244
2245 dnl ===========================================================================
2246
2247 #
2248 # Check for LCMS delegate library.
2249 #
2250 AC_ARG_WITH(lcms,
2251         [  --without-lcms          disable lcms (v1.1X) support],
2252         [with_lcms=$withval],
2253         [with_lcms='yes'])
2254 if test "$with_lcms" != 'yes' ; then
2255     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lcms=$with_lcms "
2256 fi
2257
2258 have_lcms='no'
2259 LCMS_CFLAGS=""
2260 LCMS_LIBS=""
2261 LCMS_PKG=""
2262 if test "x$with_lcms" = "xyes"; then
2263   AC_MSG_RESULT([-------------------------------------------------------------])
2264   PKG_CHECK_MODULES(LCMS2,[lcms2 >= 2.0.0], have_lcms=yes, have_lcms=no)
2265   AC_MSG_RESULT([])
2266 fi
2267
2268 if test "$have_lcms" = 'yes'; then
2269   AC_DEFINE(LCMS_DELEGATE,1,Define if you have LCMS library)
2270   LCMS_CFLAGS="$LCMS2_CFLAGS"
2271   LCMS_LIBS="$LCMS2_LIBS"
2272   CFLAGS="$LCMS2_CFLAGS $CFLAGS"
2273   AC_CHECK_HEADER(lcms2/lcms2.h,have_lcms_header='yes',,)
2274   if test "$have_lcms_header" = 'yes'; then
2275     AC_DEFINE(HAVE_LCMS2_LCMS2_H,1,Define if you have the <lcms2/lcms2.h> header file.)
2276   else
2277     AC_DEFINE(HAVE_LCMS2_H,1,Define if you have the <lcms2.h> header file.)
2278   fi
2279 fi
2280
2281 AM_CONDITIONAL(LCMS_DELEGATE, test "$have_lcms" = 'yes')
2282 AC_SUBST(LCMS_CFLAGS)
2283 AC_SUBST(LCMS_LIBS)
2284
2285 dnl ===========================================================================
2286
2287 #
2288 # Check for the OpenJP2 delegate library.
2289 #
2290 AC_ARG_WITH([openjp2],
2291     [AC_HELP_STRING([--without-openjp2],
2292                     [disable OpenJP2 support])],
2293     [with_openjp2=$withval],
2294     [with_openjp2='yes'])
2295
2296 if test "$with_openjp2" != 'yes'; then
2297     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-openjp2=$with_openjp2 "
2298 fi
2299
2300 have_openjp2='no'
2301 LIBOPENJP2_CFLAGS=""
2302 LIBOPENJP2_LIBS=""
2303 LIBOPENJP2_PKG=""
2304 if test "x$with_openjp2" = "xyes"; then
2305   AC_MSG_RESULT([-------------------------------------------------------------])
2306   PKG_CHECK_MODULES(LIBOPENJP2,[libopenjp2 >= 2.1.0], have_openjp2=yes, have_openjp2=no)
2307   AC_MSG_RESULT([])
2308 fi
2309
2310 if test "$have_openjp2" = 'yes'; then
2311   AC_DEFINE(LIBOPENJP2_DELEGATE,1,Define if you have OPENJP2 library)
2312   CFLAGS="$LIBOPENJP2_CFLAGS $CFLAGS"
2313 fi
2314
2315 AM_CONDITIONAL(LIBOPENJP2_DELEGATE, test "$have_openjp2" = 'yes')
2316 AC_SUBST(LIBOPENJP2_CFLAGS)
2317 AC_SUBST(LIBOPENJP2_LIBS)
2318
2319
2320 dnl ===========================================================================
2321
2322 #
2323 # Check for the LQR (Liquid Rescale) delegate library.
2324 #
2325 AC_ARG_WITH([lqr],
2326     [AC_HELP_STRING([--without-lqr],
2327                     [disable Liquid Rescale support])],
2328     [with_lqr=$withval],
2329     [with_lqr='yes'])
2330
2331 if test "$with_lqr" != 'yes'; then
2332     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lqr=$with_lqr "
2333 fi
2334
2335 have_lqr='no'
2336 LQR_CFLAGS=""
2337 LQR_LIBS=""
2338 LQR_PKG=""
2339 if test "x$with_lqr" = "xyes"; then
2340   AC_MSG_RESULT([-------------------------------------------------------------])
2341   PKG_CHECK_MODULES(LQR,[lqr-1 >= 0.1.0], have_lqr=yes, have_lqr=no)
2342   AC_MSG_RESULT([])
2343 fi
2344
2345 if test "$have_lqr" = 'yes'; then
2346   AC_DEFINE(LQR_DELEGATE,1,Define if you have LQR library)
2347   CFLAGS="$LQR_CFLAGS $CFLAGS"
2348 fi
2349
2350 AM_CONDITIONAL(LQR_DELEGATE, test "$have_lqr" = 'yes')
2351 AC_SUBST(LQR_CFLAGS)
2352 AC_SUBST(LQR_LIBS)
2353
2354 dnl ===========================================================================
2355
2356 # Disable LZMA (lzma library)
2357 AC_ARG_WITH(lzma,
2358             [  --without-lzma          disable LZMA support],
2359             [with_lzma=$withval],
2360             [with_lzma='yes'])
2361 if test "$with_lzma" != 'yes' ; then
2362     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-lzma=$with_lzma "
2363 fi
2364
2365 LZMA_PKG=""
2366 if test "x$with_lzma" = "xyes"; then
2367   AC_MSG_RESULT([-------------------------------------------------------------])
2368   PKG_CHECK_MODULES(LZMA,[liblzma >= 2.9.0], have_lzma=yes, have_lzma=no)
2369   AC_MSG_RESULT([])
2370 fi
2371
2372 if test "$have_lzma" = 'yes'; then
2373   AC_DEFINE(LZMA_DELEGATE,1,Define if you have LZMA library)
2374   CFLAGS="$LZMA_CFLAGS $CFLAGS"
2375 fi
2376
2377 AM_CONDITIONAL(LZMA_DELEGATE, test "$have_lzma" = 'yes')
2378 AC_SUBST(LZMA_CFLAGS)
2379 AC_SUBST(LZMA_LIBS)
2380
2381 dnl ===========================================================================
2382
2383 #
2384 # Check for the OpenEXR delegate library.
2385 #
2386 AC_ARG_WITH([openexr],
2387     [AC_HELP_STRING([--without-openexr],
2388                     [disable OpenEXR support])],
2389     [with_openexr=$withval],
2390     [with_openexr='yes'])
2391
2392 if test "$with_openexr" != 'yes'; then
2393     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-openexr=$with_openexr "
2394 fi
2395
2396 have_openexr='no'
2397 OPENEXR_CFLAGS=""
2398 OPENEXR_LIBS=""
2399 OPENEXR_PKG=""
2400 if test "x$with_openexr" = "xyes"; then
2401   AC_MSG_RESULT([-------------------------------------------------------------])
2402   PKG_CHECK_MODULES(OPENEXR,[OpenEXR >= 1.0.6], have_openexr=yes, have_openexr=no)
2403   AC_MSG_RESULT([])
2404 fi
2405
2406 if test "$have_openexr" = 'yes'; then
2407   AC_DEFINE(OPENEXR_DELEGATE,1,Define if you have OPENEXR library)
2408   CFLAGS="$OPENEXR_CFLAGS $CFLAGS"
2409 fi
2410
2411 AM_CONDITIONAL(OPENEXR_DELEGATE, test "$have_openexr" = 'yes')
2412 AC_SUBST(OPENEXR_CFLAGS)
2413 AC_SUBST(OPENEXR_LIBS)
2414
2415 dnl ===========================================================================
2416
2417 #
2418 # Check for PANGO delegate library.
2419 #
2420 AC_ARG_WITH([pango],
2421     [AC_HELP_STRING([--without-pango],
2422                     [disable PANGO support])],
2423     [with_pango=$withval],
2424     [with_pango='yes'])
2425
2426 if test "$with_pango" != 'yes'; then
2427     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-pango=$with_pango "
2428 fi
2429
2430 have_pango='no'
2431 have_pangocairo='no'
2432 PANGO_CFLAGS=""
2433 PANGO_LIBS=""
2434 PANGO_PKG=""
2435 if test "x$with_pango" = "xyes"; then
2436   AC_MSG_RESULT([-------------------------------------------------------------])
2437   PKG_CHECK_MODULES(PANGO, [pangocairo >= 1.28.1], have_pangocairo=yes, have_pangocairo=no)
2438   AC_MSG_RESULT([])
2439   PKG_CHECK_MODULES(PANGO, [pango >= 1.28.1], have_pango=yes, have_pango=no)
2440   AC_MSG_RESULT([])
2441 fi
2442
2443 if test "$have_pango" = 'yes'; then
2444   AC_DEFINE(PANGO_DELEGATE,1,Define if you have PANGO library)
2445   CFLAGS="$PANGO_CFLAGS $CFLAGS"
2446 fi
2447
2448 if test "$have_pangocairo" = 'yes'; then
2449   AC_DEFINE(PANGOCAIRO_DELEGATE,1,Define if you have PANGOCAIRO library)
2450   CFLAGS="$PANGOCAIRO_CFLAGS $CFLAGS"
2451 fi
2452
2453 AM_CONDITIONAL(PANGO_DELEGATE, test "$have_pango" = 'yes')
2454 AM_CONDITIONAL(PANGOCAIRO_DELEGATE, test "$have_pangocairo" = 'yes')
2455 AC_SUBST(PANGO_CFLAGS)
2456 AC_SUBST(PANGO_LIBS)
2457
2458 dnl ===========================================================================
2459
2460 #
2461 # Check for PNG delegate library.
2462 #
2463 AC_ARG_WITH(png,
2464     [AC_HELP_STRING([--without-png],
2465                     [disable PNG support])],
2466     [with_png=$withval],
2467     [with_png='yes'])
2468
2469 if test "$with_png" != 'yes'; then
2470     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-png=$with_png "
2471 fi
2472
2473 have_png='no'
2474 PNG_CFLAGS=""
2475 PNG_LIBS=""
2476 PNG_PKG=""
2477 if test "x$with_png" = "xyes"; then
2478   AC_MSG_RESULT([-------------------------------------------------------------])
2479   PKG_CHECK_MODULES(PNG,[libpng >= 1.0.0], have_png=yes, have_png=no)
2480   AC_MSG_RESULT([])
2481 fi
2482
2483 if test "$have_png" = 'yes'; then
2484   AC_DEFINE(PNG_DELEGATE,1,Define if you have PNG library)
2485   CFLAGS="$PNG_CFLAGS $CFLAGS"
2486 fi
2487
2488 AM_CONDITIONAL(PNG_DELEGATE, test "$have_png" = 'yes')
2489 AC_SUBST(PNG_CFLAGS)
2490 AC_SUBST(PNG_LIBS)
2491
2492 dnl ===========================================================================
2493
2494 #
2495 # Check for RSVG delegate library.
2496 #
2497 AC_ARG_WITH([rsvg],
2498     [AC_HELP_STRING([--with-rsvg],
2499                     [enable RSVG support])],
2500     [with_rsvg=$withval],
2501     [with_rsvg='no'])
2502
2503 if test "$with_rsvg" != 'yes'; then
2504     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-rsvg=$with_rsvg "
2505 fi
2506
2507 have_rsvg='no'
2508 have_cairo='no'
2509 RSVG_CFLAGS=""
2510 RSVG_LIBS=""
2511 RSVG_PKG=""
2512 if test "x$with_rsvg" = "xyes"; then
2513   AC_MSG_RESULT([-------------------------------------------------------------])
2514   PKG_CHECK_MODULES(RSVG,[librsvg-2.0 >= 2.9.0], have_rsvg=yes, have_rsvg=no)
2515   AC_MSG_RESULT([])
2516   PKG_CHECK_MODULES(CAIRO_SVG, cairo-svg, have_cairo=yes, have_cairo=no)
2517   AC_MSG_RESULT([])
2518 fi
2519
2520 if test "$have_rsvg" = 'yes'; then
2521   AC_DEFINE(RSVG_DELEGATE,1,Define if you have RSVG library)
2522   CFLAGS="$RSVG_CFLAGS $CFLAGS"
2523 fi
2524
2525 if test "$have_cairo" = 'yes'; then
2526   AC_DEFINE(CAIRO_DELEGATE,1,Define if you have CAIRO library)
2527   CFLAGS="$CAIRO_SVG_CFLAGS $CFLAGS"
2528 fi
2529
2530 AM_CONDITIONAL(RSVG_DELEGATE, test "$have_rsvg" = 'yes')
2531 AM_CONDITIONAL(CAIRO_DELEGATE, test "$have_cairo" = 'yes')
2532 AC_SUBST(RSVG_CFLAGS)
2533 AC_SUBST(RSVG_LIBS)
2534
2535 dnl ===========================================================================
2536
2537 #
2538 # Check for TIFF delegate library.
2539 #
2540 AC_ARG_WITH([tiff],
2541     [AC_HELP_STRING([--without-tiff],
2542                     [disable TIFF support])],
2543     [with_tiff=$withval],
2544     [with_tiff='yes'])
2545
2546 if test "$with_tiff" != 'yes'; then
2547     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-tiff=$with_tiff "
2548 fi
2549
2550 have_tiff='no'
2551 TIFF_LIBS=''
2552 if test "$with_tiff" != 'no'; then
2553     AC_MSG_RESULT([-------------------------------------------------------------])
2554     AC_MSG_CHECKING([for TIFF])
2555     AC_MSG_RESULT([])
2556     failed=0
2557     passed=0
2558     AC_CHECK_HEADER(tiff.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2559     AC_CHECK_HEADER(tiffio.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
2560     AC_CHECK_LIB(tiff,TIFFOpen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2561     AC_CHECK_LIB(tiff,TIFFClientOpen,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2562     AC_CHECK_LIB(tiff,TIFFIsByteSwapped,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2563     AC_CHECK_LIB(tiff,TIFFReadRGBATile,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2564     AC_CHECK_LIB(tiff,TIFFReadRGBAStrip,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2565     AC_MSG_CHECKING([if TIFF package is complete])
2566     if test $passed -gt 0; then
2567         if test $failed -gt 0; then
2568             AC_MSG_RESULT([no -- some components failed test])
2569             have_tiff='no (failed tests)'
2570         else
2571             TIFF_LIBS='-ltiff'
2572             LIBS="$TIFF_LIBS $LIBS"
2573             AC_DEFINE(TIFF_DELEGATE,1,Define if you have TIFF library)
2574             AC_MSG_RESULT([yes])
2575             have_tiff='yes'
2576             AC_CHECK_HEADERS(tiffconf.h)
2577             AC_CHECK_FUNCS([TIFFIsCODECConfigured TIFFMergeFieldInfo \
2578               TIFFIsBigEndian TIFFReadEXIFDirectory TIFFSetErrorHandlerExt \
2579               TIFFSetTagExtender TIFFSetWarningHandlerExt \
2580               TIFFSwabArrayOfTriples])
2581         fi
2582     else
2583         AC_MSG_RESULT([no])
2584     fi
2585 fi
2586 AM_CONDITIONAL(TIFF_DELEGATE, test "$have_tiff" = 'yes')
2587 AC_SUBST(TIFF_LIBS)
2588
2589 dnl ===========================================================================
2590
2591 #
2592 # Check for WEBP delegate library.
2593 #
2594 AC_ARG_WITH(webp,
2595     [AC_HELP_STRING([--without-webp],
2596                     [disable WEBP support])],
2597     [with_webp=$withval],
2598     [with_webp='yes'])
2599
2600 if test "$with_webp" != 'yes'; then
2601     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-webp=$with_webp "
2602 fi
2603
2604 have_webp='no'
2605 WEBP_LIBS=''
2606 if test "$with_webp" != 'no'; then
2607     AC_MSG_RESULT([-------------------------------------------------------------])
2608     AC_MSG_CHECKING([for WEBP])
2609     AC_MSG_RESULT([])
2610     failed=0
2611     passed=0
2612     AC_CHECK_HEADER(webp/decode.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2613     AC_CHECK_LIB(webp,WebPPictureInitInternal,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
2614     AC_MSG_CHECKING([if WEBP package is complete])
2615     if test $passed -gt 0; then
2616         if test $failed -gt 0; then
2617             AC_MSG_RESULT([no -- some components failed test])
2618             have_webp='no (failed tests)'
2619         else
2620             WEBP_LIBS='-lwebp'
2621             LIBS="$WEBP_LIBS $LIBS"
2622             AC_DEFINE(WEBP_DELEGATE,1,Define if you have WEBP library)
2623             AC_MSG_RESULT([yes])
2624             have_webp='yes'
2625         fi
2626     else
2627         AC_MSG_RESULT([no])
2628     fi
2629 fi
2630 AM_CONDITIONAL(WEBP_DELEGATE,test "$have_webp" = 'yes')
2631 AC_SUBST(WEBP_LIBS)
2632
2633 dnl ===========================================================================
2634
2635 #
2636 # Set Windows font directory.
2637 #
2638 AC_ARG_WITH([windows-font-dir],
2639     [AC_HELP_STRING([--with-windows-font-dir=DIR],
2640                     [Windows font directory])],
2641     [with_windows_font_dir=$withval],
2642     [with_windows_font_dir='default'])
2643
2644 if test "$with_windows_font_dir" != 'default'; then
2645     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-windows-font-dir=$with_windows_font_dir "
2646 fi
2647
2648 dnl ===========================================================================
2649
2650 #
2651 # Check for WMF delegate library.
2652 #
2653 AC_ARG_WITH([wmf],
2654     [AC_HELP_STRING([--with-wmf],
2655                     [enable WMF support])],
2656     [with_wmf=$withval],
2657     [with_wmf='yes'])
2658
2659 if test "$with_wmf" != 'yes'; then
2660     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-wmf=$with_wmf "
2661 fi
2662
2663 have_wmf='no'
2664 WMF_LIBS=''
2665 WMF_CFLAGS=''
2666 OLIBS="$LIBS"
2667 if test "$with_wmf" != 'no'; then
2668   AC_MSG_CHECKING([for WMF support ])
2669   AC_MSG_RESULT([])
2670
2671   have_libwmflite='no'
2672   have_libwmf_ipa_h='no'
2673
2674   AC_CHECK_HEADER([libwmf/ipa.h],[have_libwmf_ipa_h='yes'],[],[$FT2BUILD_H])
2675   if test "$have_libwmf_ipa_h" = 'yes'; then
2676     AC_CHECK_LIB([wmflite],[wmf_lite_create],[have_libwmflite='yes'],[],[])
2677     if test "$have_libwmflite" = 'yes'; then
2678       AC_DEFINE(WMF_DELEGATE,1,Define if you have WMF library)
2679       WMF_LIBS='-lwmflite'
2680       LIBS="$WMF_LIBS $LIBS"
2681       have_wmf='yes'
2682     else
2683       AC_MSG_RESULT([no -- some components failed test])
2684       have_wmf='no (failed tests)'
2685       have_wmflite='no (failed tests)'
2686       LIBS="$OLIBS"
2687       WMF_LIBS=''
2688     fi
2689   fi
2690 fi
2691 AC_MSG_CHECKING([if WMF package is complete ])
2692 if test "$have_wmf" = 'yes'; then
2693   AC_MSG_RESULT([yes])
2694 else
2695   AC_MSG_RESULT([no])
2696 fi
2697 AM_CONDITIONAL([WMF_DELEGATE], [test "$have_wmf" = 'yes'])
2698 AC_SUBST([WMF_CFLAGS])
2699 AC_SUBST([WMF_LIBS])
2700
2701 dnl ===========================================================================
2702
2703 #
2704 # Check for XML delegate library.
2705 #
2706 AC_ARG_WITH([xml],
2707     [AC_HELP_STRING([--without-xml],
2708                     [disable XML support])],
2709     [with_xml=$withval],
2710     [with_xml='yes'])
2711
2712 if test "$with_xml" != 'yes' ; then
2713     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-xml=$with_xml "
2714 fi
2715
2716 have_xml='no'
2717 XML_CFLAGS=""
2718 XML_LIBS=""
2719 XML_PKG=""
2720 if test "x$with_xml" = "xyes"; then
2721   AC_MSG_RESULT([-------------------------------------------------------------])
2722   PKG_CHECK_MODULES(XML,[libxml-2.0 >= 2.0.0], have_xml=yes, have_xml=no)
2723   AC_MSG_RESULT([])
2724 fi
2725
2726 if test "$have_xml" = 'yes'; then
2727   AC_DEFINE(XML_DELEGATE,1,Define if you have XML library)
2728   CFLAGS="$XML_CFLAGS $CFLAGS"
2729 fi
2730
2731 AM_CONDITIONAL(XML_DELEGATE, test "$have_xml" = 'yes')
2732 AC_SUBST(XML_CFLAGS)
2733 AC_SUBST(XML_LIBS)
2734
2735 dnl ===========================================================================
2736
2737 # Substitute compiler name to build/link PerlMagick
2738 #
2739 AC_SUBST([PERLMAINCC])
2740
2741 #
2742 # Configure install Paths
2743 #
2744
2745 # Path to ImageMagick header files
2746 INCLUDE_RELATIVE_PATH="${PACKAGE_NAME}-${MAGICK_MAJOR_VERSION}"
2747 INCLUDE_PATH="${INCLUDE_DIR}/${INCLUDE_RELATIVE_PATH}"
2748 DEFINE_INCLUDE_PATH="${INCLUDE_DIR}/${INCLUDE_RELATIVE_PATH}/"
2749 case "${build_os}" in
2750   mingw* )
2751     DEFINE_INCLUDE_PATH=`$WinPathScript "$DEFINE_INCLUDE_PATH" 1`
2752     ;;
2753 esac
2754 AC_DEFINE_UNQUOTED(INCLUDE_PATH,"$DEFINE_INCLUDE_PATH",[Directory where ImageMagick headers live.])
2755 AC_SUBST(INCLUDE_PATH)
2756
2757 # Path to ImageMagick header files (arch part)
2758 INCLUDEARCH_PATH="${INCLUDEARCH_DIR}/${INCLUDE_RELATIVE_PATH}"
2759 DEFINE_INCLUDEARCH_PATH="${INCLUDEARCH_DIR}/${INCLUDE_RELATIVE_PATH}/"
2760 case "${build_os}" in
2761   mingw* )
2762     DEFINE_INCLUDEARCH_PATH=`$WinPathScript "$DEFINE_INCLUDEARCH_PATH" 1`
2763     ;;
2764 esac
2765 AC_DEFINE_UNQUOTED(INCLUDEARCH_PATH,"$DEFINE_INCLUDE_PATH",[Directory where ImageMagick architecture headers live.])
2766 AC_SUBST(INCLUDEARCH_PATH)
2767
2768 # Subdirectory under lib to place ImageMagick lib files
2769 LIBRARY_RELATIVE_PATH="${PACKAGE_NAME}-${PACKAGE_VERSION}"
2770 AC_DEFINE_UNQUOTED(LIBRARY_RELATIVE_PATH,"$LIBRARY_RELATIVE_PATH",[Subdirectory of lib where ImageMagick architecture dependent files are installed.])
2771
2772 # Path to ImageMagick bin directory
2773 EXECUTABLE_PATH="${BIN_DIR}"
2774 DEFINE_EXECUTABLE_PATH="${BIN_DIR}/"
2775 case "${build_os}" in
2776   mingw* )
2777     DEFINE_EXECUTABLE_PATH=`$WinPathScript "$DEFINE_EXECUTABLE_PATH" 1`
2778     ;;
2779 esac
2780 AC_DEFINE_UNQUOTED(EXECUTABLE_PATH,"$DEFINE_EXECUTABLE_PATH",[Directory where executables are installed.])
2781 AC_SUBST(EXECUTABLE_PATH)
2782
2783 # Path to ImageMagick lib
2784 LIBRARY_PATH="${LIB_DIR}/${LIBRARY_RELATIVE_PATH}"
2785 DEFINE_LIBRARY_PATH="${LIB_DIR}/${LIBRARY_RELATIVE_PATH}/"
2786 case "${build_os}" in
2787   mingw* )
2788     DEFINE_LIBRARY_PATH=`$WinPathScript "$DEFINE_LIBRARY_PATH" 1`
2789     ;;
2790 esac
2791 AC_DEFINE_UNQUOTED(LIBRARY_PATH,"$DEFINE_LIBRARY_PATH",[Directory where architecture-dependent files live.])
2792 AC_SUBST(LIBRARY_PATH)
2793
2794 #
2795 # path to local binaries
2796 if test "x$LIB_BIN_BASEDIRNAME" = "x"; then
2797    LIB_BIN_BASEDIRNAME="bin"
2798 fi
2799 AC_DEFINE_UNQUOTED(LIB_BIN_BASEDIRNAME,"$LIB_BIN_BASEDIRNAME",[Binaries in libraries path base name (will be during install linked to bin)])
2800 AC_SUBST(LIB_BIN_BASEDIRNAME)
2801
2802 if test "x$LIB_BIN_DIR" = "x"; then
2803    LIB_BIN_DIR=${LIB_BIN_BASEDIRNAME}-${MAGICK_ABI_SUFFIX}
2804 fi
2805 AC_SUBST(LIB_BIN_DIR)
2806
2807 LIB_BIN_DIR_RELATIVE_PATH=$LIB_BIN_DIR
2808 AC_SUBST(LIB_BIN_DIR_RELATIVE_PATH)
2809 LIB_BIN_DIR_PATH="${LIBRARY_PATH}/${LIB_BIN_DIR_RELATIVE_PATH}"
2810 AC_SUBST(LIB_BIN_DIR_PATH)
2811
2812 #
2813 # path to modules lib
2814 if test "x$MODULES_BASEDIRNAME" = "x"; then
2815    MODULES_BASEDIRNAME="modules"
2816 fi
2817 AC_DEFINE_UNQUOTED(MODULES_BASEDIRNAME,"$MODULES_BASEDIRNAME",[Module directory name without ABI part.])
2818 AC_SUBST(MODULES_BASEDIRNAME)
2819
2820 if test "x$MODULES_DIRNAME" = "x"; then
2821   MODULES_DIRNAME=${MODULES_BASEDIRNAME}-${MAGICK_ABI_SUFFIX}
2822 else
2823   AC_DEFINE_UNQUOTED(MODULES_DIRNAME,"$MODULES_DIRNAME",[Module directory dirname])
2824 fi
2825 AC_SUBST(MODULES_DIRNAME)
2826
2827 MODULES_RELATIVE_PATH="${MODULES_DIRNAME}"
2828 AC_SUBST(MODULES_RELATIVE_PATH)
2829 MODULES_PATH="${LIBRARY_PATH}/${MODULES_RELATIVE_PATH}"
2830 AC_SUBST(MODULES_PATH)
2831
2832 #
2833 # path to coders lib
2834 if test "x$CODER_DIRNAME" = "x"; then
2835    CODER_DIRNAME="coders"
2836 fi
2837 AC_DEFINE_UNQUOTED(CODER_DIRNAME,"$CODER_DIRNAME",[coders subdirectory.])
2838 AC_SUBST(CODER_DIRNAME)
2839
2840 CODER_RELATIVE_PATH="${CODER_DIRNAME}"
2841 CODER_PATH="${MODULES_PATH}/${CODER_DIRNAME}"
2842 AC_SUBST(CODER_PATH)
2843
2844 #
2845 # Subdirectory under lib to place ImageMagick filter module files
2846 #
2847 # path to coders lib
2848 if test "x$FILTER_DIRNAME" = "x"; then
2849    FILTER_DIRNAME="filters"
2850 fi
2851 AC_DEFINE_UNQUOTED(FILTER_DIRNAME,"$FILTER_DIRNAME",[filter subdirectory.])
2852 AC_SUBST(FILTER_DIRNAME)
2853
2854 FILTER_RELATIVE_PATH="${FILTER_DIRNAME}"
2855 FILTER_PATH="${MODULES_PATH}/${FILTER_DIRNAME}"
2856 AC_SUBST(FILTER_PATH)
2857
2858 #
2859 # Path to ImageMagick documentation files
2860 DOCUMENTATION_RELATIVE_PATH="${PACKAGE_NAME}-${MAGICK_MAJOR_VERSION}"
2861 DOCUMENTATION_PATH="${DOC_DIR}/${DOCUMENTATION_RELATIVE_PATH}"
2862 DEFINE_DOCUMENTATION_PATH="${DOC_DIR}/${DOCUMENTATION_RELATIVE_PATH}/"
2863 case "${build_os}" in
2864   mingw* )
2865     DEFINE_DOCUMENTATION_PATH=`$WinPathScript "$DEFINE_DOCUMENTATION_PATH" 1`
2866     ;;
2867 esac
2868 AC_DEFINE_UNQUOTED(DOCUMENTATION_PATH,"$DEFINE_DOCUMENTATION_PATH",[Directory where ImageMagick documents live.])
2869 AC_SUBST(DOCUMENTATION_PATH)
2870
2871 #
2872 # Enable/Disable documentation
2873 AC_ARG_ENABLE([docs],
2874   [AS_HELP_STRING([--disable-docs],
2875     [disable building of documentation])],
2876   wantdocs=$enableval, wantdocs=yes)
2877 AM_CONDITIONAL([INSTALL_DOC], [test "$wantdocs" = "yes"])
2878
2879 # Subdirectory to place architecture-dependent configuration files
2880 CONFIGURE_RELATIVE_PATH="${PACKAGE_NAME}-${MAGICK_MAJOR_VERSION}"
2881 AC_DEFINE_UNQUOTED(CONFIGURE_RELATIVE_PATH,"$CONFIGURE_RELATIVE_PATH",[Subdirectory of lib where architecture-dependent configuration files live.])
2882 CONFIGURE_PATH="${SYSCONF_DIR}/${CONFIGURE_RELATIVE_PATH}/"
2883 DEFINE_CONFIGURE_PATH="${SYSCONF_DIR}/${CONFIGURE_RELATIVE_PATH}/"
2884 case "${build_os}" in
2885   mingw* )
2886     DEFINE_CONFIGURE_PATH=`$WinPathScript "$DEFINE_CONFIGURE_PATH" 1`
2887     ;;
2888 esac
2889 AC_DEFINE_UNQUOTED(CONFIGURE_PATH,"$DEFINE_CONFIGURE_PATH",[Directory where architecture-dependent configuration files live.])
2890 AC_SUBST(CONFIGURE_PATH)
2891
2892 # Subdirectory to place architecture-independent configuration files
2893 SHARE_RELATIVE_PATH="${PACKAGE_NAME}-${MAGICK_MAJOR_VERSION}"
2894 AC_DEFINE_UNQUOTED(SHARE_RELATIVE_PATH,"$SHARE_RELATIVE_PATH",[Subdirectory of lib where architecture-independent configuration files live.])
2895 SHARE_PATH="${DATA_DIR}/${SHARE_RELATIVE_PATH}"
2896 DEFINE_SHARE_PATH="${DATA_DIR}/${SHARE_RELATIVE_PATH}/"
2897 case "${build_os}" in
2898   mingw* )
2899     DEFINE_SHARE_PATH=`$WinPathScript "$DEFINE_SHARE_PATH" 1`
2900     ;;
2901 esac
2902 AC_DEFINE_UNQUOTED(SHARE_PATH,"$DEFINE_SHARE_PATH",[Directory where architecture-independent configuration files live.])
2903 AC_SUBST(SHARE_PATH)
2904
2905 #
2906 # Subdirectory to place architecture-dependent configuration files.
2907 if test "x$SHAREARCH_BASEDIRNAME" = "x"; then
2908    SHAREARCH_BASEDIRNAME="config"
2909 fi
2910 AC_DEFINE_UNQUOTED(SHAREARCH_BASEDIRNAME,"$SHAREARCH_BASEDIRNAME",[Sharearch directory name without ABI part.])
2911 AC_SUBST(SHAREARCH_BASEDIRNAME)
2912
2913 if test "x$SHAREARCH_DIRNAME" = "x"; then
2914   SHAREARCH_DIRNAME=${SHAREARCH_BASEDIRNAME}-${MAGICK_ABI_SUFFIX}
2915 else
2916   AC_DEFINE_UNQUOTED(SHAREARCH_DIRNAME,"$SHAREARCH_DIRNAME",[Sharearch directory dirname])
2917 fi
2918 AC_SUBST(SHAREARCH_DIRNAME)
2919
2920 SHAREARCH_RELATIVE_PATH="${SHAREARCH_DIRNAME}"
2921 AC_SUBST(SHAREARCH_RELATIVE_PATH)
2922 SHAREARCH_PATH="${LIBRARY_PATH}/${SHAREARCH_RELATIVE_PATH}"
2923 AC_SUBST(SHAREARCH_PATH)
2924
2925 #
2926 # program_transform_name is formed for use in a Makefile, so create a
2927 # modified version for use in a shell script.
2928 configure_transform_name=`echo ${program_transform_name} | sed 's,\\$\\$,$,'`
2929
2930 # Default delegate definitions
2931 AC_MSG_RESULT([-------------------------------------------------------------])
2932 AC_MSG_CHECKING([for ImageMagick delegate programs])
2933 AC_MSG_RESULT([])
2934 AutotraceDecodeDelegateDefault='autotrace'
2935 BPGDecodeDelegateDefault='bpgdec'
2936 BPGEncodeDelegateDefault='bpgenc'
2937 BlenderDecodeDelegateDefault='blender'
2938 BZIPDelegateDefault='bzip2'
2939 BrowseDelegateDefault='xdg-open'
2940 CatDelegateDefault='cat'
2941 DNGDecodeDelegateDefault='ufraw-batch'
2942 DOCDecodeDelegateDefault='soffice'
2943 GVCDecodeDelegateDefault='dot'
2944 DVIDecodeDelegateDefault='dvips'
2945 EchoDelegateDefault='echo'
2946 EditorDelegateDefault='xterm'
2947 ConvertDelegateDefault=`echo convert | sed ${configure_transform_name}`
2948 DisplayDelegateDefault=`echo display | sed ${configure_transform_name}`
2949 MogrifyDelegateDefault=`echo mogrify | sed ${configure_transform_name}`
2950 GnuplotDecodeDelegateDefault='gnuplot'
2951 HPGLDecodeDelegateDefault='hp2xx'
2952 HTMLDecodeDelegateDefault='html2ps'
2953 ILBMDecodeDelegateDefault='ilbmtoppm'
2954 ILBMEncodeDelegateDefault='ppmtoilbm'
2955 JXRDecodeDelegateDefault='JxrDecApp'
2956 JXREncodeDelegateDefault='JxrEncApp'
2957 LPDelegateDefault='lp'
2958 LPRDelegateDefault='lpr'
2959 LaunchDelegateDefault='gimp'
2960 MANDelegateDefault='groff'
2961 MPEGDecodeDelegateDefault='avconv'
2962 MPEGEncodeDelegateDefault='avconv'
2963 MrSIDDecodeDelegateDefault='mrsidgeodecode'
2964 MVDelegateDefault='mv'
2965 PCLDelegateDefault='pcl6'
2966 PGPDecodeDelegateDefault='pgpv'
2967 POVDelegateDefault='povray'
2968 if test "$native_win32_build" = 'yes'; then
2969     PSDelegateDefault='gswin32c'
2970 elif test "$gslib_framework" = 'yes'; then
2971     PSDelegateDefault='gsc'
2972 else
2973     PSDelegateDefault='gs'
2974 fi
2975 RLEEncodeDelegateDefault='rawtorle'
2976 RMDelegateDefault='rm'
2977 RSVGDecodeDelegateDefault='rsvg-convert'
2978 SCANDecodeDelegateDefault='scanimage'
2979 SVGDecodeDelegateDefault='inkscape'
2980 TXTDelegateDefault='enscript'
2981 UniconvertorDelegateDefault='uniconvertor'
2982 WebPDecodeDelegateDefault='dwebp'
2983 WebPEncodeDelegateDefault='cwebp'
2984 WMFDecodeDelegateDefault='wmf2eps'
2985 WWWDecodeDelegateDefault='curl'
2986 XPSDelegateDefault='gxps'
2987 ZipDelegateDefault='gzip'
2988
2989 # Search for delegates
2990 AC_PATH_PROG(AutotraceDecodeDelegate, "$AutotraceDecodeDelegateDefault", "$AutotraceDecodeDelegateDefault")
2991 AC_PATH_PROG(BGPDecodeDelegate, "$BGPDecodeDelegateDefault", "$BGPDecodeDelegateDefault")
2992 AC_PATH_PROG(BGPEncodeDelegate, "$BGPEncodeDelegateDefault", "$BGPEncodeDelegateDefault")
2993 AC_PATH_PROG(BlenderDecodeDelegate, "$BlenderDecodeDelegateDefault", "$BlenderDecodeDelegateDefault")
2994 AC_PATH_PROG(BZIPDelegate, "$BZIPDelegateDefault", "$BZIPDelegateDefault")
2995 AC_PATH_PROGS(BrowseDelegate, "$BrowseDelegateDefault" google-chrome firefox konqueror mozilla lynx, "$BrowseDelegateDefault")
2996 AC_PATH_PROG(CatDelegate, "$CatDelegateDefault", "$CatDelegateDefault")
2997 AC_PATH_PROG(DNGDecodeDelegate, "$DNGDecodeDelegateDefault", "$DNGDecodeDelegateDefault")
2998 AC_PATH_PROG(DOCDecodeDelegate, "$DOCDecodeDelegateDefault", "$DOCDecodeDelegateDefault")
2999 AC_PATH_PROG(DVIDecodeDelegate, "$DVIDecodeDelegateDefault", "$DVIDecodeDelegateDefault")
3000 AC_PATH_PROG(ConvertDelegate, "$ConvertDelegateDefault", "$ConvertDelegateDefault")
3001 AC_PATH_PROG(DisplayDelegate, "$DisplayDelegateDefault", "$DisplayDelegateDefault")
3002 AC_PATH_PROG(EchoDelegate, "$EchoDelegateDefault", "$EchoDelegateDefault")
3003 AC_PATH_PROG(EditorDelegate, "$EditorDelegateDefault", "$EditorDelegateDefault")
3004 AC_PATH_PROG(GnuplotDecodeDelegate, "$GnuplotDecodeDelegateDefault", "$GnuplotDecodeDelegateDefault")
3005 AC_PATH_PROG(GVCDecodeDelegate, "$GVCDecodeDelegateDefault", "$GVCDecodeDelegateDefault")
3006 AC_PATH_PROG(HPGLDecodeDelegate, "$HPGLDecodeDelegateDefault", "$HPGLDecodeDelegateDefault")
3007 AC_PATH_PROG(HTMLDecodeDelegate, "$HTMLDecodeDelegateDefault", "$HTMLDecodeDelegateDefault")
3008 AC_PATH_PROG(ILBMDecodeDelegate, "$ILBMDecodeDelegateDefault", "$ILBMDecodeDelegateDefault")
3009 AC_PATH_PROG(ILBMEncodeDelegate, "$ILBMEncodeDelegateDefault", "$ILBMEncodeDelegateDefault")
3010 AC_PATH_PROG(JXRDecodeDelegate, "$JXRDecodeDelegateDefault", "$JXRDecodeDelegateDefault")
3011 AC_PATH_PROG(JXREncodeDelegate, "$JXREncodeDelegateDefault", "$JXREncodeDelegateDefault")
3012 AC_PATH_PROG(LPDelegate, "$LPDelegateDefault", no)
3013 AC_PATH_PROG(LPRDelegate, "$LPRDelegateDefault", "$LPRDelegateDefault")
3014 AC_PATH_PROG(LaunchDelegate, "$LaunchDelegateDefault", "$LaunchDelegateDefault")
3015 AC_PATH_PROG(MANDelegate, "$MANDelegateDefault", "$MANDelegateDefault")
3016 AC_PATH_PROG(MogrifyDelegate, "$MogrifyDelegateDefault", "$MogrifyDelegateDefault")
3017 AC_PATH_PROG(MPEGDecodeDelegate, "$MPEGDecodeDelegateDefault", "$MPEGDecodeDelegateDefault")
3018 if test "$MPEGDecodeDelegate" = "$MPEGDecodeDelegateDefault" ; then
3019   MPEGDecodeDelegateDefault='ffmpeg'
3020   AC_PATH_PROG(MPEGDecodeDelegate, "$MPEGDecodeDelegateDefault", "$MPEGDecodeDelegateDefault")
3021 fi;
3022 AC_PATH_PROG(MPEGEncodeDelegate, "$MPEGEncodeDelegateDefault", "$MPEGEncodeDelegateDefault")
3023 if test "$MPEGEncodeDelegate" = "$MPEGEncodeDelegateDefault" ; then
3024   MPEGEncodeDelegateDefault='ffmpeg'
3025   AC_PATH_PROG(MPEGEncodeDelegate, "$MPEGEncodeDelegateDefault", "$MPEGEncodeDelegateDefault")
3026 fi;
3027 AC_PATH_PROG(MrSIDDecodeDelegate, "$MrSIDDecodeDelegateDefault", "$MrSIDDecodeDelegateDefault")
3028 AC_PATH_PROG(MVDelegate, "$MVDelegateDefault", "$MVDelegateDefault")
3029 AC_PATH_PROG(PCLDelegate, "$PCLDelegateDefault", "$PCLDelegateDefault")
3030 AC_PATH_PROG(PGPDecodeDelegate, "$PGPDecodeDelegateDefault", "$PGPDecodeDelegateDefault")
3031 AC_PATH_PROG(POVDelegate, "$POVDelegateDefault", "$POVDelegateDefault")
3032 AC_PATH_PROGS(PSDelegate, gsx gsc "$PSDelegateDefault", "$PSDelegateDefault")
3033 AC_PATH_PROG(RLEEncodeDelegate, "$RLEEncodeDelegateDefault", "$RLEEncodeDelegateDefault")
3034 AC_PATH_PROG(RMDelegate, "$RMDelegateDefault", "$RMDelegateDefault")
3035 AC_PATH_PROG(RSVGDecodeDelegate, "$RSVGDecodeDelegateDefault", "$RSVGDecodeDelegateDefault")
3036 AC_PATH_PROG(SCANDecodeDelegate, "$SCANDecodeDelegateDefault", "$SCANDecodeDelegateDefault")
3037 AC_PATH_PROG(SVGDecodeDelegate, "$SVGDecodeDelegateDefault", "$SVGDecodeDelegateDefault")
3038 AC_PATH_PROG(TXTDelegate, "$TXTDelegateDefault", "$TXTDelegateDefault")
3039 AC_PATH_PROG(UniconvertorDelegate, "$UniconvertorDelegateDefault", "$UniconvertorDelegateDefault")
3040 AC_PATH_PROG(WebPDecodeDelegate, "$WebPDecodeDelegateDefault", "$WebPDecodeDelegateDefault")
3041 AC_PATH_PROG(WebPEncodeDelegate, "$WebPEncodeDelegateDefault", "$WebPEncodeDelegateDefault")
3042 AC_PATH_PROG(WMFDecodeDelegate, "$WMFDecodeDelegateDefault", "$WMFDecodeDelegateDefault")
3043 AC_PATH_PROG(WWWDecodeDelegate, "$WWWDecodeDelegateDefault", "$WWWDecodeDelegateDefault")
3044 AC_PATH_PROG(XPSDelegate, "$XPSDelegateDefault", "$XPSDelegateDefault")
3045 AC_PATH_PROG(ZipDelegate, "$ZipDelegateDefault", "$ZipDelegateDefault")
3046
3047 # Prefer lpr to lp; lp needs options tacked on.
3048 if test "$LPRDelegate" != no; then
3049     PrintDelegate="$LPRDelegate"
3050 else
3051     PrintDelegate="$LPDelegate -c -s"
3052 fi
3053 AC_SUBST(PrintDelegate)
3054
3055 # Installed ImageMagick utiltity paths
3056 ConvertDelegate="${BIN_DIR}/${ConvertDelegateDefault}"
3057 DisplayDelegate="${BIN_DIR}/${DisplayDelegateDefault}"
3058 MogrifyDelegate="${BIN_DIR}/${MogrifyDelegateDefault}"
3059
3060 # Set delegate booleans
3061 have_avconv='no'; if test "$MPEGDecodeDelegate" != "$MPEGDecodeDelegateDefault" ; then have_avconv='yes'; fi
3062 have_gs='no'         ; if test "$PSDelegate" != "$PSDelegateDefault"; then have_gs='yes'; fi
3063 have_hp2xx='no'      ; if test "$HPGLDecodeDelegate" !=  "$HPGLDecodeDelegateDefault" ; then have_hp2xx='yes'; fi
3064 have_ilbmtoppm='no'  ; if test "$ILBMDecodeDelegate" != "$ILBMDecodeDelegateDefault" ; then have_ilbmtoppm='yes'; fi
3065 have_mrsid='no'; if test "$MrSIDDecodeDelegate" != "$MrSIDDecodeDelegateDefault" ; then have_mrsid='yes'; fi
3066 have_pcl='no'        ; if test "$PCLDelegate" != "$PCLDelegateDefault"; then have_pcl='yes'; fi
3067 have_ppmtoilbm='no'  ; if test "$ILBMEncodeDelegate" != "$ILBMEncodeDelegateDefault" ; then have_ppmtoilbm='yes'; fi
3068 have_xps='no'        ; if test "$XPSDelegate" != "$XPSDelegateDefault"; then have_xps='yes'; fi
3069
3070 #
3071 # Test for font directories
3072 #
3073 type_include_files=''
3074
3075  Apple fonts.
3076 AC_MSG_CHECKING(for Apple fonts directory)
3077 apple_font_dir=''
3078 if test "${with_apple_font_dir}" != 'default'; then
3079   apple_font_dir="${with_apple_font_dir}/"
3080 else
3081   for font_dir in '/Library/Fonts/'; do
3082     if test -f "${font_dir}Arial.ttf"; then
3083       apple_font_dir="${font_dir}"
3084       break 1
3085     fi
3086   done
3087 fi
3088 if test "${apple_font_dir}x" != 'x'; then
3089   type_include_files="${type_include_files} "'<include file="type-apple.xml" />'
3090   AC_MSG_RESULT([$apple_font_dir])
3091 else
3092   AC_MSG_RESULT([not found!]);
3093 fi
3094 AC_SUBST(apple_font_dir)
3095
3096 # Dejavu fonts.
3097 AC_MSG_CHECKING(for Dejavu fonts directory)
3098 dejavu_font_dir=''
3099 if test "${with_dejavu_font_dir}" != 'default'; then
3100   dejavu_font_dir="${with_dejavu_font_dir}/"
3101 else
3102   for font_dir in "${prefix}/share/dejavu/fonts/" '/usr/share/fonts/dejavu/'; do
3103     if test -f "${font_dir}DejaVuSerif.ttf"; then
3104       dejavu_font_dir="${font_dir}"
3105       break 1
3106     fi
3107   done
3108 fi
3109 if test "${dejavu_font_dir}x" != 'x'; then
3110   type_include_files="${type_include_files} "'<include file="type-dejavu.xml" />'
3111   AC_MSG_RESULT([$dejavu_font_dir])
3112 else
3113   AC_MSG_RESULT([not found!]);
3114 fi
3115 AC_SUBST(dejavu_font_dir)
3116
3117 # Ghostscript
3118 AC_MSG_CHECKING(for Ghostscript fonts directory)
3119 ghostscript_font_dir=''
3120 if test "${with_gs_font_dir}" != 'default'; then
3121   ghostscript_font_dir="${with_gs_font_dir}/"
3122 else
3123   if test "${native_win32_build}" = 'yes'; then
3124     # Native Windows Build
3125     for font_dir in "c:\\Program Files\\gs\\fonts\\" "c:\\Program Files \(x86\)\\gs\\fonts\\" "c:\\gs\\fonts\\"; do
3126       if test -f "${font_dir}a010013l.pfb"; then
3127         ghostscript_font_dir="$font_dir"
3128         break 1
3129       fi
3130     done
3131     if test "${PSDelegate}" != 'gswin32c'; then
3132       ghostscript_font_dir=`echo "${PSDelegate}" | sed -e 's:/gs/.*:/gs:;s:^/::;s/./&:/;s:/:\\\\:g'`"\\fonts\\"
3133     fi
3134   else
3135     # Linux / Mac OS X / Unix Build
3136     for font_dir in "${prefix}/share/ghostscript/fonts/" '/usr/share/fonts/default/Type1/' '/usr/share/ghostscript/fonts/' '/usr/share/fonts/ghostscript/' '/usr/share/fonts/type1/gsfonts/' '/opt/local/share/ghostscript/fonts/' '/sw/share/ghostscript/fonts/' '/System/Library/Frameworks/Ghostscript.framework/Resources/fonts/'; do
3137       if test -f "${font_dir}a010013l.pfb"; then
3138         ghostscript_font_dir="${font_dir}"
3139         break 1
3140       fi
3141     done
3142     if test "${ghostscript_font_dir}x" = 'x'; then
3143       if test "$PSDelegate" != 'gs'; then
3144         ghostscript_font_dir=`echo "$PSDelegate" | sed -e 's:/bin/gs:/share/ghostscript/fonts:'`"/"
3145       fi
3146     fi
3147   fi
3148 fi
3149 if test "${ghostscript_font_dir}x" != 'x'; then
3150   type_include_files="${type_include_files} "'<include file="type-ghostscript.xml" />'
3151   AC_MSG_RESULT([$ghostscript_font_dir])
3152 else
3153   AC_MSG_RESULT([not found!]);
3154 fi
3155 AC_SUBST(ghostscript_font_dir)
3156 case "${build_os}" in
3157   mingw* )
3158     PSDelegate=`$WinPathScript "$PSDelegate" 1`
3159     ;;
3160 esac
3161
3162 # Windows fonts.
3163 AC_MSG_CHECKING(for Windows fonts directory)
3164 windows_font_dir=''
3165 if test "${with_windows_font_dir}" != 'default'; then
3166   windows_font_dir="${with_windows_font_dir}/"
3167 else
3168   for font_dir in '/usr/X11R6/lib/X11/fonts/truetype/' '/usr/X11R7/lib/X11/fonts/truetype/' '/usr/share/fonts/msttcore/'; do
3169     if test -f "${font_dir}arial.ttf"; then
3170       windows_font_dir="${font_dir}"
3171       break 1
3172     fi
3173   done
3174 fi
3175 if test "${windows_font_dir}x" != 'x'; then
3176   type_include_files="${type_include_files} "'<include file="type-windows.xml" />'
3177   AC_MSG_RESULT([$windows_font_dir])
3178 else
3179   AC_MSG_RESULT([not found!]);
3180 fi
3181 AC_SUBST(windows_font_dir)
3182
3183 AC_SUBST(type_include_files)
3184
3185 #
3186 # Handle case where user doesn't want frozen paths
3187 #
3188 if test "$with_frozenpaths" != 'yes'; then
3189   # Re-set delegate definitions to default (no paths)
3190   AutotraceDecodeDelegate="$AutotraceDecodeDelegateDefault"
3191   BGPDecodeDelegate="$BGPDecodeDelegateDefault"
3192   BGPEncodeDelegate="$BGPEncodeDelegateDefault"
3193   BlenderDecodeDelegate="$BlenderDecodeDelegateDefault"
3194   BZIPDelegate="$BZIPDelegateDefault"
3195   BrowseDelegate="$BrowseDelegateDefault"
3196   CatDelegate="$CatDelegateDefault"
3197   ConvertDelegate="$ConvertDelegateDefault"
3198   DisplayDelegate="$DisplayDelegateDefault"
3199   DNGDecodeDelegate="$DNGDecodeDelegateDefault"
3200   DOCDecodeDelegate="$DOCDecodeDelegateDefault"
3201   DVIDecodeDelegate="$DVIDecodeDelegateDefault"
3202   EchoDelegate="$EchoDelegateDefault"
3203   EditorDelegate="$EditorDelegateDefault"
3204   GnuplotDecodeDelegate="$GnuplotDecodeDelegateDefault"
3205   GVCDecodeDelegate="$GVCDecodeDelegateDefault"
3206   HPGLDecodeDelegate="$HPGLDecodeDelegateDefault"
3207   HTMLDecodeDelegate="$HTMLDecodeDelegateDefault"
3208   ILBMDecodeDelegate="$ILBMDecodeDelegateDefault"
3209   ILBMEncodeDelegate="$ILBMEncodeDelegateDefault"
3210   JXRDecodeDelegate="$JXRDecodeDelegateDefault"
3211   JXREncodeDelegate="$JXREncodeDelegateDefault"
3212   LPDelegate="$LPDelegateDefault"
3213   LaunchDelegate="$LaunchDelegateDefault"
3214   MANDelegate="$MANDelegateDefault"
3215   MPEGDecodeDelegate="$MPEGDecodeDelegateDefault"
3216   MPEGEncodeDelegate="$MPEGEncodeDelegateDefault"
3217   MogrifyDelegate="$MogrifyDelegateDefault"
3218   MrSIDDecodeDelegate="$MrSIDDecodeDelegateDefault"
3219   MVDelegate="$MVDelegateDefault"
3220   PCLDelegate="$PCLDelegateDefault"
3221   PGPDecodeDelegate="$PGPDecodeDelegateDefault"
3222   POVDelegate="$POVDelegateDefault"
3223   PSDelegate="$PSDelegateDefault"
3224   RLEEncodeDelegate="$RLEEncodeDelegateDefault"
3225   RMDelegate="$RMDelegateDefault"
3226   RSVGDecodeDelegate="$RSVGDecodeDelegateDefault"
3227   SCANDecodeDelegate="$SCANDecodeDelegateDefault"
3228   SVGDecodeDelegate="$SVGDecodeDelegateDefault"
3229   ShowImageDelegate="$ShowImageDelegateDefault"
3230   TXTDelegate="$TXTDelegateDefault"
3231   UniconvertorDelegate="$UniconvertorDelegateDefault"
3232   WebPDecodeDelegate="$WebPDecodeDelegateDefault"
3233   WebPEncodeDelegate="$WebPEncodeDelegateDefault"
3234   WMFDecodeDelegate="$WMFDecodeDelegateDefault"
3235   WWWDecodeDelegate="$WWWDecodeDelegateDefault"
3236   XPSDelegate="$XPSDelegateDefault"
3237   ZipDelegate="$ZipDelegateDefault"
3238 fi
3239
3240 # Delegate substitutions
3241 AC_SUBST(AutotraceDecodeDelegate)
3242 AC_SUBST(BGPDecodeDelegate)
3243 AC_SUBST(BGPEncodeDelegate)
3244 AC_SUBST(BlenderDecodeDelegate)
3245 AC_SUBST(BZIPDelegate)
3246 AC_SUBST(BrowseDelegate)
3247 AC_SUBST(CatDelegate)
3248 AC_SUBST(ConvertDelegate)
3249 AC_SUBST(GVCDecodeDelegate)
3250 AC_SUBST(DVIDecodeDelegate)
3251 AC_SUBST(EchoDelegate)
3252 AC_SUBST(EditorDelegate)
3253 AC_SUBST(GnuplotDecodeDelegate)
3254 AC_SUBST(HPGLDecodeDelegate)
3255 AC_SUBST(HTMLDecodeDelegate)
3256 AC_SUBST(ILBMDecodeDelegate)
3257 AC_SUBST(ILBMEncodeDelegate)
3258 AC_SUBST(JXRDecodeDelegate)
3259 AC_SUBST(JXREncodeDelegate)
3260 AC_SUBST(LPDelegate)
3261 AC_SUBST(LaunchDelegate)
3262 AC_SUBST(MANDelegate)
3263 AC_SUBST(MPEGDecodeDelegate)
3264 AC_SUBST(MPEGEncodeDelegate)
3265 AC_SUBST(MogrifyDelegate)
3266 AC_SUBST(MrSIDDecodeDelegate)
3267 AC_SUBST(MVDelegate)
3268 AC_SUBST(PCLDelegate)
3269 AC_SUBST(PGPDecodeDelegate)
3270 AC_SUBST(POVDelegate)
3271 AC_SUBST(PSDelegate)
3272 AC_SUBST(RLEEncodeDelegate)
3273 AC_SUBST(RMDelegate)
3274 AC_SUBST(SCANDecodeDelegate)
3275 AC_SUBST(ShowImageDelegate)
3276 AC_SUBST(TXTDelegate)
3277 AC_SUBST(UniconvertorDelegate)
3278 AC_SUBST(WMFDecodeDelegate)
3279 AC_SUBST(WebPDecodeDelegate)
3280 AC_SUBST(WebPEncodeDelegate)
3281 AC_SUBST(WWWDecodeDelegate)
3282 AC_SUBST(XPSDelegate)
3283 AC_SUBST(ZipDelegate)
3284
3285 #
3286 # RPM support.
3287 #
3288 RPM=''
3289 AC_CHECK_PROGS(TAR,gnutar gtar tar)
3290 AC_CHECK_PROGS(PERL,perl)
3291 AC_CHECK_PROGS(RPM,rpmbuild rpm)
3292 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
3293 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
3294 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
3295 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
3296 AC_SUBST(RPM)
3297 AM_CONDITIONAL(RPM_DELEGATE, test "x$RPM" != "x" )
3298
3299 #
3300 # 7ZIP support (http://p7zip.sourceforge.net/)
3301 #
3302 P7ZIP=''
3303 AC_CHECK_PROGS(P7ZIP,[7za])
3304 AC_SUBST(P7ZIP)
3305 AM_CONDITIONAL(P7ZIP_DELEGATE, test "x$P7ZIP" != "x" )
3306
3307 #
3308 # ZIP support (http://www.info-zip.org/Zip.html)
3309 #
3310 ZIP=''
3311 AC_CHECK_PROGS(ZIP,[zip])
3312 AC_SUBST(ZIP)
3313 AM_CONDITIONAL(ZIP_DELEGATE, test "x$ZIP" != "x" )
3314
3315 #
3316 # GhostPCL related configuration.
3317 #
3318 PCLColorDevice=ppmraw
3319 PCLCMYKDevice=pamcmyk32
3320 PCLMonoDevice=pbmraw
3321 if test -z "$PCLVersion"; then
3322     PCLVersion='unknown'
3323 fi
3324 if test $have_pcl = 'yes'; then
3325     AC_MSG_RESULT([-------------------------------------------------------------])
3326     AC_MSG_CHECKING([for PCL])
3327     AC_MSG_RESULT([])
3328     # PCLColorDevice
3329     AC_MSG_CHECKING([for pcl color device])
3330     if $PCLDelegate -dBATCH -sDEVICE=$PCLColorDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3331         :
3332     else
3333         PCLColorDevice=ppmraw
3334     fi
3335     AC_MSG_RESULT([$PCLColorDevice])
3336
3337     # PCLCMYKDevice
3338     AC_MSG_CHECKING([for pcl CMYK device])
3339     if $PCLDelegate -dBATCH -sDEVICE=$PCLColorDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3340         :
3341     else
3342         PCLCMYKDevice=$PCLColorDevice
3343     fi
3344     AC_MSG_RESULT([$PCLCMYKDevice])
3345
3346     # PCLMonoDevice
3347     AC_MSG_CHECKING([for pcl mono device])
3348     if $PCLDelegate -dBATCH -sDEVICE=$PCLMonoDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3349         :
3350     else
3351         PCLMonoDevice=$PCLColorDevice
3352     fi
3353     AC_MSG_RESULT([$PCLMonoDevice])
3354 fi
3355
3356 AC_SUBST(PCLMonoDevice)
3357 AC_SUBST(PCLColorDevice)
3358 AC_SUBST(PCLCMYKDevice)
3359 AC_SUBST(PCLVersion)
3360
3361 #
3362 # GhostXPS related configuration.
3363 #
3364 XPSColorDevice=ppmraw
3365 XPSCMYKDevice=bmpsep8
3366 XPSMonoDevice=pbmraw
3367 if test -z "$XPSVersion"; then
3368     XPSVersion='unknown'
3369 fi
3370 if test $have_xps = 'yes'; then
3371     AC_MSG_RESULT([-------------------------------------------------------------])
3372     AC_MSG_CHECKING([for XPS])
3373     AC_MSG_RESULT([])
3374     # XPSColorDevice
3375     AC_MSG_CHECKING([for xps color device])
3376     if $XPSDelegate -dBATCH -sDEVICE=$XPSColorDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3377         :
3378     else
3379         XPSColorDevice=ppmraw
3380     fi
3381     AC_MSG_RESULT([$XPSColorDevice])
3382
3383     # XPSCMYKDevice
3384     AC_MSG_CHECKING([for xps CMYK device])
3385     if $XPSDelegate -dBATCH -sDEVICE=$XPSColorDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3386         :
3387     else
3388         XPSCMYKDevice=$XPSColorDevice
3389     fi
3390     AC_MSG_RESULT([$XPSCMYKDevice])
3391
3392     # XPSMonoDevice
3393     AC_MSG_CHECKING([for xps mono device])
3394     if $XPSDelegate -dBATCH -sDEVICE=$XPSMonoDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3395         :
3396     else
3397         XPSMonoDevice=$XPSColorDevice
3398     fi
3399     AC_MSG_RESULT([$XPSMonoDevice])
3400 fi
3401
3402 AC_SUBST(XPSMonoDevice)
3403 AC_SUBST(XPSColorDevice)
3404 AC_SUBST(XPSCMYKDevice)
3405 AC_SUBST(XPSVersion)
3406
3407 #
3408 # Ghostscript related configuration.
3409 #
3410 GSAlphaDevice=pngalpha
3411 GSColorDevice=pnmraw
3412 GSCMYKDevice=pamcmyk32
3413 GSMonoDevice=pbmraw
3414 GSPDFDevice=pdfwrite
3415 GSPSDevice=ps2write
3416 GSEPSDevice=eps2write
3417 GSVersion='unknown'
3418 if test $have_gs = 'yes'; then
3419     AC_MSG_RESULT([-------------------------------------------------------------])
3420     AC_MSG_CHECKING([for Ghostscript])
3421     AC_MSG_RESULT([])
3422     AC_MSG_CHECKING([for Ghostscript version])
3423     if GSVersion=`$PSDelegate --version`; then
3424         :
3425     else
3426         GSVersion=`$PSDelegate --help | sed -e '1q' | awk '{ print $3 }'`
3427     fi
3428     AC_MSG_RESULT([$GSVersion])
3429
3430     # GSColorDevice
3431     AC_MSG_CHECKING([for gs color device])
3432     if $PSDelegate -q -dBATCH -sDEVICE=$GSColorDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3433         :
3434     else
3435         GSColorDevice=ppmraw
3436     fi
3437     AC_MSG_RESULT([$GSColorDevice])
3438
3439     # GSAlphaDevice
3440     AC_MSG_CHECKING([for gs alpha device])
3441     if $PSDelegate -q -dBATCH -sDEVICE=$GSAlphaDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3442         :
3443     else
3444         GSAlphaDevice=$GSColorDevice
3445     fi
3446     AC_MSG_RESULT([$GSAlphaDevice])
3447
3448     # GSCMYKDevice
3449     AC_MSG_CHECKING([for gs CMYK device])
3450     if $PSDelegate -q -dBATCH -sDEVICE=$GSCMYKDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3451         :
3452     else
3453         GSCMYKDevice=pam
3454     fi
3455     AC_MSG_RESULT([$GSCMYKDevice])
3456
3457     # GSMonoDevice
3458     AC_MSG_CHECKING([for gs mono device])
3459     if $PSDelegate -q -dBATCH -sDEVICE=$GSMonoDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3460         :
3461     else
3462         GSMonoDevice=$GSColorDevice
3463     fi
3464     AC_MSG_RESULT([$GSMonoDevice])
3465
3466     # GSPDFDevice
3467     AC_MSG_CHECKING([for gs PDF writing device])
3468     if $PSDelegate -q -dBATCH -sDEVICE=$GSPDFDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3469         :
3470     else
3471         GSPDFDevice=nodevice
3472     fi
3473     AC_MSG_RESULT([$GSPDFDevice])
3474
3475     # GSPSDevice
3476     AC_MSG_CHECKING([for gs PS writing device])
3477     if $PSDelegate -q -dBATCH -sDEVICE=$GSPSDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3478         :
3479     else
3480         GSPSDevice=pswrite
3481     fi
3482     AC_MSG_RESULT([$GSPSDevice])
3483
3484     # GSEPSDevice
3485     AC_MSG_CHECKING([for gs EPS writing device])
3486     if $PSDelegate -q -dBATCH -sDEVICE=$GSEPSDevice -sOutputFile=/dev/null < /dev/null 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
3487         :
3488     else
3489         GSEPSDevice=epswrite
3490     fi
3491     AC_MSG_RESULT([$GSEPSDevice])
3492 fi
3493
3494 AC_SUBST(GSAlphaDevice)
3495 AC_SUBST(GSCMYKDevice)
3496 AC_SUBST(GSColorDevice)
3497 AC_SUBST(GSEPSDevice)
3498 AC_SUBST(GSMonoDevice)
3499 AC_SUBST(GSPDFDevice)
3500 AC_SUBST(GSPSDevice)
3501 AC_SUBST(GSVersion)
3502
3503 #
3504 # PerlMagick-related configuration
3505 #
3506
3507 # Look for PERL if PerlMagick requested
3508 # If name/path of desired PERL interpreter is specified, look for that one first
3509 have_perl='no'
3510 if test "$with_perl" != 'no'; then
3511     AC_MSG_RESULT([-------------------------------------------------------------])
3512     AC_MSG_CHECKING([for Perl])
3513     AC_MSG_RESULT([])
3514     if test "$with_perl" != 'yes'; then
3515         AC_CACHE_CHECK(for perl,ac_cv_path_PERL,ac_cv_path_PERL="$with_perl");
3516         PERL=$ac_cv_path_PERL
3517         AC_SUBST(PERL)dnl
3518         have_perl="$ac_cv_path_PERL"
3519     else
3520         AC_PATH_PROGS(PERL,perl perl5,)dnl
3521         if test "$ac_cv_path_PERL"; then
3522             have_perl="$ac_cv_path_PERL"
3523         fi
3524     fi
3525 fi
3526
3527 if test "$with_perl" != 'yes' ; then
3528     DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-perl=$with_perl "
3529 fi
3530
3531 PERL_SUPPORTS_DESTDIR='no'
3532
3533 with_perl_static='no'
3534 with_perl_dynamic='no'
3535 if test "$have_perl" != 'no'; then
3536     if test "$with_perl" != 'no' && test "$libtool_build_shared_libs" = 'no'; then
3537         with_perl_static='yes'
3538     fi
3539     if test "$with_perl" != 'no' && test "$libtool_build_shared_libs" = 'yes'; then
3540         with_perl_dynamic='yes'
3541     fi
3542     # Is PERL's MakeMaker new enough to support DESTDIR?
3543     AX_PROG_PERL_VERSION(5.8.1,[PERL_SUPPORTS_DESTDIR='yes'],[PERL_SUPPORTS_DESTDIR='no'])
3544 fi
3545 AM_CONDITIONAL(WITH_PERL, test "$have_perl" != 'no')
3546 AM_CONDITIONAL(WITH_PERL_STATIC, test $with_perl_static = 'yes')
3547 AM_CONDITIONAL(WITH_PERL_DYNAMIC, test $with_perl_dynamic = 'yes')
3548 AC_SUBST(PERL_SUPPORTS_DESTDIR)
3549
3550 # Determine path to pick up MagickCore library from for use with building PerlMagick
3551 MAGICKCORE_PATH="${LIB_DIR}"
3552 if test $with_perl_static = 'yes'; then
3553     # Find out where libtool hides its uninstalled libraries (as libtool_objdir)
3554     libtool_objdir=$objdir
3555
3556     # Linker search path to library, followed by -lMagickCore
3557     MAGICKCORE_PATH="${builddir}/MagickCore/${libtool_objdir}"
3558 fi
3559 AC_SUBST(MAGICKCORE_PATH)
3560
3561 # Create a simple string containing format names for all delegate libraries.
3562 MAGICK_DELEGATES=''
3563 if test "$have_autotrace"  = 'yes' ; then
3564    MAGICK_DELEGATES="$MAGICK_DELEGATES autotrace"
3565 fi
3566 if test "$have_bzlib"  = 'yes' ; then
3567    MAGICK_DELEGATES="$MAGICK_DELEGATES bzlib"
3568 fi
3569 if test "$have_dps"    = 'yes' ; then
3570    MAGICK_DELEGATES="$MAGICK_DELEGATES dps"
3571 fi
3572 if test "$have_djvu"    = 'yes' ; then
3573    MAGICK_DELEGATES="$MAGICK_DELEGATES djvu"
3574 fi
3575 if test "$have_avconv"   = 'yes' ; then
3576    MAGICK_DELEGATES="$MAGICK_DELEGATES mpeg"
3577 fi
3578 if test "$have_fftw"    = 'yes' ; then
3579    MAGICK_DELEGATES="$MAGICK_DELEGATES fftw"
3580 fi
3581 if test "$have_fpx"    = 'yes' ; then
3582    MAGICK_DELEGATES="$MAGICK_DELEGATES fpx"
3583 fi
3584 if test "$have_fontconfig"    = 'yes' ; then
3585    MAGICK_DELEGATES="$MAGICK_DELEGATES fontconfig"
3586 fi
3587 if test "$have_freetype"    = 'yes' ; then
3588    MAGICK_DELEGATES="$MAGICK_DELEGATES freetype"
3589 fi
3590 if test "$have_gslib"    = 'yes' ; then
3591    MAGICK_DELEGATES="$MAGICK_DELEGATES gslib"
3592 fi
3593 if test "$have_jbig"    = 'yes' ; then
3594    MAGICK_DELEGATES="$MAGICK_DELEGATES jbig"
3595 fi
3596 if test "$have_png$have_jpeg" = 'yesyes' ; then
3597    MAGICK_DELEGATES="$MAGICK_DELEGATES jng"
3598 fi
3599 if test "$have_jpeg"   = 'yes' ; then
3600    MAGICK_DELEGATES="$MAGICK_DELEGATES jpeg"
3601 fi
3602 if test "$have_lcms" = 'yes' || test "$have_lcms2" = 'yes' ; then
3603    MAGICK_DELEGATES="$MAGICK_DELEGATES lcms"
3604 fi
3605 if test "$have_lqr"    = 'yes' ; then
3606    MAGICK_DELEGATES="$MAGICK_DELEGATES lqr"
3607 fi
3608 if test "$have_lzma"    = 'yes' ; then
3609    MAGICK_DELEGATES="$MAGICK_DELEGATES lzma"
3610 fi
3611 if test "$have_openexr"    = 'yes' ; then
3612    MAGICK_DELEGATES="$MAGICK_DELEGATES openexr"
3613 fi
3614 if test "$have_openjp2"    = 'yes' ; then
3615    MAGICK_DELEGATES="$MAGICK_DELEGATES openjp2"
3616 fi
3617 if test "$have_pango"    = 'yes' ; then
3618    MAGICK_DELEGATES="$MAGICK_DELEGATES pango"
3619 fi
3620 if test "$have_png"    = 'yes' ; then
3621    MAGICK_DELEGATES="$MAGICK_DELEGATES png"
3622 fi
3623 have_ps='no'
3624 if test "$have_dps"    = 'yes' || \
3625    test "$have_gs" = 'yes' || \
3626    test "${native_win32_build}" = 'yes' ; then
3627    have_ps='yes'
3628 fi
3629 if test "$have_ps"     = 'yes' ; then
3630    MAGICK_DELEGATES="$MAGICK_DELEGATES ps"
3631 fi
3632 if test "$have_ra_ppm" = 'yes' ; then
3633    MAGICK_DELEGATES="$MAGICK_DELEGATES rad"
3634 fi
3635 if test "$have_rsvg"   = 'yes' ; then
3636    MAGICK_DELEGATES="$MAGICK_DELEGATES rsvg"
3637 fi
3638 if test "$have_tiff"   = 'yes' ; then
3639    MAGICK_DELEGATES="$MAGICK_DELEGATES tiff"
3640 fi
3641 if test "$have_ttf"    = 'yes' ; then
3642    MAGICK_DELEGATES="$MAGICK_DELEGATES ttf"
3643 fi
3644 if test "$have_webp"    = 'yes' ; then
3645    MAGICK_DELEGATES="$MAGICK_DELEGATES webp"
3646 fi
3647 if test "$have_wmf"    = 'yes' ; then
3648    MAGICK_DELEGATES="$MAGICK_DELEGATES wmf"
3649 fi
3650 if test "$have_x"      = 'yes' ; then
3651    MAGICK_DELEGATES="$MAGICK_DELEGATES x"
3652 fi
3653 if test "$have_xml"      = 'yes' ; then
3654    MAGICK_DELEGATES="$MAGICK_DELEGATES xml"
3655 fi
3656 if test "$have_zlib"   = 'yes' ; then
3657    MAGICK_DELEGATES="$MAGICK_DELEGATES zlib"
3658 fi
3659
3660 # Remove extraneous spaces from output variables (asthetic)
3661 MAGICK_DELEGATES=`echo $MAGICK_DELEGATES | sed -e 's/  */ /g'`
3662 MAGICK_FEATURES=`echo $MAGICK_FEATURES | sed -e 's/  */ /g'`
3663 AC_SUBST(MAGICK_DELEGATES)
3664 AC_SUBST(MAGICK_FEATURES)
3665
3666 #
3667 # Handle special compiler flags
3668 #
3669
3670 # Add '-p' if prof source profiling support enabled
3671 if test "$enable_prof" = 'yes'; then
3672     CFLAGS="-p $CFLAGS"
3673     CXXFLAGS="-p $CXXFLAGS"
3674     LDFLAGS="-p $LDFLAGS"
3675 fi
3676
3677 # Add '-pg' if gprof source profiling support enabled
3678 if test "$enable_gprof" = 'yes'; then
3679     CFLAGS="-pg $CFLAGS"
3680     CXXFLAGS="-pg $CXXFLAGS"
3681     LDFLAGS="-pg $LDFLAGS"
3682 fi
3683
3684 # Add '-ftest-coverage -fprofile-arcs' if gcov source profiling support enabled
3685 # This is a gcc-specific feature
3686 if test "$enable_gcov" = 'yes'; then
3687     AC_CHECK_LIB(gcov,_gcov_init)
3688     AC_CHECK_LIB(gcov,__gcov_init)
3689     case "$target_os" in
3690         darwin*)
3691             OSX_GCOV_LDFLAG="-Wl,-single_module"
3692         ;;
3693         *)
3694             OSX_GCOV_LDFLAG=""
3695         ;;
3696     esac
3697     AC_SUBST(OSX_GCOV_LDFLAG)
3698     CFLAGS="-ftest-coverage -fprofile-arcs  $CFLAGS"
3699     CXXFLAGS="-ftest-coverage -fprofile-arcs  $CXXFLAGS"
3700     LDFLAGS="-ftest-coverage -fprofile-arcs $LDFLAGS"
3701 fi
3702
3703 #
3704 # Build library dependency list for libMagickCore
3705 #
3706
3707 if test "$build_modules" != 'no'; then
3708     MAGICK_DEP_LIBS="$USER_LIBS $LCMS_LIBS $FREETYPE_LIBS $LQR_LIBS $FFTW_LIBS $FONTCONFIG_LIBS $XEXT_LIBS $IPC_LIBS $X11_LIBS $XT_LIBS $LZMA_LIBS $BZLIB_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
3709 else
3710     MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
3711 fi
3712 AC_SUBST(MAGICK_DEP_LIBS)
3713
3714 # Pass only user-provided LIBS as "global" libraries
3715 LIBS=$USER_LIBS
3716
3717 #AC_SUBST(CPPFLAGS)
3718 AC_SUBST(X_CFLAGS)
3719 #AC_SUBST(LDFLAGS)
3720 #AC_SUBST(X_PRE_LIBS)
3721 #AC_SUBST(X_LIBS)
3722 #AC_SUBST(X_EXTRA_LIBS)
3723
3724 MAGICK_CFLAGS=$CFLAGS
3725 MAGICK_CXXFLAGS="$CXXFLAGS"
3726 MAGICK_CPPFLAGS=`echo $MAGICK_CPPFLAGS | sed -e 's/  */ /g'`
3727 MAGICK_PCFLAGS=`echo $MAGICK_PCFLAGS | sed -e 's/  */ /g'`
3728 MAGICK_LDFLAGS="-L$LIB_DIR $LDFLAGS"
3729 MAGICK_LIBS="$MAGICK_DEP_LIBS"
3730
3731 AC_SUBST(MAGICK_CFLAGS)
3732 AC_SUBST(MAGICK_CXXFLAGS)
3733 AC_SUBST(MAGICK_CPPFLAGS)
3734 AC_SUBST(MAGICK_PCFLAGS)
3735 AC_SUBST(MAGICK_LDFLAGS)
3736 AC_SUBST(MAGICK_LIBS)
3737
3738 # Set configured scripts to executable.
3739 AC_CONFIG_COMMANDS([default],[],[])
3740 AC_CONFIG_COMMANDS([magick.sh.in],[chmod +x magick.sh])
3741 AC_CONFIG_COMMANDS([MagickCore-config.in],[chmod +x MagickCore/MagickCore-config])
3742 AC_CONFIG_COMMANDS([MagickWand-config.in],[chmod +x MagickWand/MagickWand-config])
3743 AC_CONFIG_COMMANDS([Magick++-config.in],[chmod +x Magick++/bin/Magick++-config])
3744 AC_CONFIG_COMMANDS([PerlMagick/check.sh.in],[chmod +x PerlMagick/check.sh])
3745
3746 AC_MSG_RESULT([-------------------------------------------------------------])
3747 AC_MSG_RESULT([Update ImageMagick configuration])
3748
3749 rm -f magick-version
3750
3751 result_dejavu_font_dir='none'
3752 if test "${dejavu_font_dir}x" != 'x'; then
3753     result_dejavu_font_dir=$dejavu_font_dir
3754 fi
3755
3756 result_ghostscript_font_dir='none'
3757 if test "${ghostscript_font_dir}x" != 'x'; then
3758     result_ghostscript_font_dir=$ghostscript_font_dir
3759 fi
3760
3761 result_windows_font_dir='none'
3762 if test "${windows_font_dir}x" != 'x'; then
3763     result_windows_font_dir=${windows_font_dir}
3764 fi
3765
3766 # ==============================================================================
3767 # Generate build environment
3768 # ==============================================================================
3769 AC_CONFIG_FILES([\
3770     common.shi \
3771     config/configure.xml \
3772     config/delegates.xml \
3773     config/ImageMagick.rdf \
3774     config/MagickCore.dox \
3775     config/MagickWand.dox \
3776     config/Magick++.dox \
3777     config/type-apple.xml \
3778     config/type-dejavu.xml \
3779     config/type-ghostscript.xml \
3780     config/type-windows.xml \
3781     config/type.xml \
3782     ImageMagick.spec \
3783     Magick++/bin/Magick++-config \
3784     MagickCore/ImageMagick.pc \
3785     Magick++/lib/Magick++.pc \
3786     MagickCore/MagickCore-config \
3787     MagickCore/MagickCore.pc \
3788     MagickCore/version.h \
3789     Makefile \
3790     magick.sh \
3791     PerlMagick/check.sh \
3792     PerlMagick/default/Magick.pm \
3793     PerlMagick/Makefile.PL \
3794     PerlMagick/default/Makefile.PL \
3795     PerlMagick/quantum/Makefile.PL \
3796     PerlMagick/quantum/quantum.pm \
3797     PerlMagick/quantum/quantum.xs \
3798     PerlMagick/quantum/typemap \
3799     utilities/animate.1 \
3800     utilities/compare.1 \
3801     utilities/composite.1 \
3802     utilities/conjure.1 \
3803     utilities/convert.1 \
3804     utilities/display.1 \
3805     utilities/identify.1 \
3806     utilities/ImageMagick.1 \
3807     utilities/import.1 \
3808     utilities/mogrify.1 \
3809     utilities/montage.1 \
3810     utilities/stream.1 \
3811     MagickWand/MagickWand-config \
3812     MagickWand/MagickWand.pc ])
3813 AC_OUTPUT
3814
3815 # ==============================================================================
3816 # ImageMagick Configuration
3817 # ==============================================================================
3818 AC_MSG_NOTICE([
3819 ==============================================================================
3820 ImageMagick is configured as follows. Please verify that this configuration
3821 matches your expectations.
3822
3823   Host system type: $host
3824   Build system type: $build
3825
3826                   Option                        Value
3827   ------------------------------------------------------------------------------
3828   Shared libraries  --enable-shared=$enable_shared              $libtool_build_shared_libs
3829   Static libraries  --enable-static=$enable_static              $libtool_build_static_libs
3830   Module support    --with-modules=$build_modules               $build_modules
3831   GNU ld            --with-gnu-ld=$with_gnu_ld          $lt_cv_prog_gnu_ld
3832   Quantum depth     --with-quantum-depth=$with_quantum_depth    $with_quantum_depth
3833   High Dynamic Range Imagery
3834                     --enable-hdri=$enable_hdri          $enable_hdri
3835
3836   Install documentation:        $wantdocs
3837
3838   Delegate Library Configuration:
3839   BZLIB             --with-bzlib=$with_bzlib            $have_bzlib
3840   Autotrace         --with-autotrace=$with_autotrace            $have_autotrace
3841   DJVU              --with-djvu=$with_djvu              $have_djvu
3842   DPS               --with-dps=$with_dps                $have_dps
3843   FFTW              --with-fftw=$with_fftw              $have_fftw
3844   FlashPIX          --with-fpx=$with_fpx                $have_fpx
3845   FontConfig        --with-fontconfig=$with_fontconfig  $have_fontconfig
3846   FreeType          --with-freetype=$with_freetype              $have_freetype
3847   Ghostscript lib   --with-gslib=$with_gslib            $have_gslib
3848   Graphviz          --with-gvc=$with_gvc                $have_gvc
3849   JBIG              --with-jbig=$with_jbig              $have_jbig
3850   JPEG v1           --with-jpeg=$with_jpeg              $have_jpeg
3851   LCMS              --with-lcms=$with_lcms              $have_lcms
3852   LIBJPEG2          --with-openjp2=$with_openjp2                $have_openjp2
3853   LQR               --with-lqr=$with_lqr                $have_lqr
3854   LTDL              --with-ltdl=$with_ltdl              $have_ltdl
3855   LZMA              --with-lzma=$with_lzma              $have_lzma
3856   Magick++          --with-magick-plus-plus=$with_magick_plus_plus      $have_magick_plus_plus
3857   OpenEXR           --with-openexr=$with_openexr                $have_openexr
3858   PANGO             --with-pango=$with_pango            $have_pango
3859   PERL              --with-perl=$with_perl              $have_perl
3860   PNG               --with-png=$with_png                $have_png
3861   RSVG              --with-rsvg=$with_rsvg              $have_rsvg
3862   TIFF              --with-tiff=$with_tiff              $have_tiff
3863   WEBP              --with-webp=$with_webp              $have_webp
3864   WMF               --with-wmf=$with_wmf                $have_wmf
3865   X11               --with-x=$with_x                    $have_x
3866   XML               --with-xml=$with_xml                $have_xml
3867   ZLIB              --with-zlib=$with_zlib              $have_zlib
3868
3869   Delegate Program Configuration:
3870   GhostPCL          None                                $PCLDelegate ($PCLVersion)
3871   GhostXPS          None                                $XPSDelegate ($XPSVersion)
3872   Ghostscript       None                                $PSDelegate ($GSVersion)
3873
3874   Font Configuration:
3875   Apple fonts       --with-apple-font-dir=$with_apple_font_dir  $result_apple_font_dir
3876   Dejavu fonts      --with-dejavu-font-dir=$with_dejavu_font_dir        $result_dejavu_font_dir
3877   Ghostscript fonts --with-gs-font-dir=$with_gs_font_dir        $result_ghostscript_font_dir
3878   Windows fonts     --with-windows-font-dir=$with_windows_font_dir      $result_windows_font_dir
3879
3880   X11 Configuration:
3881         X_CFLAGS        = $X_CFLAGS
3882         X_PRE_LIBS      = $X_PRE_LIBS
3883         X_LIBS          = $X_LIBS
3884         X_EXTRA_LIBS    = $X_EXTRA_LIBS
3885
3886   Options used to compile and link:
3887     PREFIX          = $PREFIX_DIR
3888     EXEC-PREFIX     = $EXEC_PREFIX_DIR
3889     VERSION         = $PACKAGE_VERSION
3890     CC              = $CC
3891     CFLAGS          = $CFLAGS
3892     CPPFLAGS        = $CPPFLAGS
3893     PCFLAGS         = $PCFLAGS
3894     DEFS            = $DEFS
3895     LDFLAGS         = $LDFLAGS
3896     LIBS            = $LIBS
3897     CXX             = $CXX
3898     CXXFLAGS        = $CXXFLAGS
3899     FEATURES        = $MAGICK_FEATURES
3900     DELEGATES       = $MAGICK_DELEGATES
3901 ==============================================================================
3902 ])