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