source: ImageMagick/branches/ImageMagick-6/configure.ac @ 7288

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