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