root / ImageMagick / branches / ImageMagick-6.3.7 / configure.ac

Revision 9098, 99.6 kB (checked in by cristy, 8 months ago)
  • Property svn:executable set to *
</
Line 
1#  Copyright 1999-2008 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
15AC_PREREQ(2.61)
16AC_INIT([ImageMagick],[6.3.8],[http://www.imagemagick.org],[ImageMagick])
17AC_CONFIG_SRCDIR([magick/MagickCore.h])
18AC_CONFIG_AUX_DIR([config])
19AC_CONFIG_MACRO_DIR([m4])
20AC_CONFIG_LIBOBJ_DIR([ltdl])
21AC_CONFIG_HEADERS([config/config.h])
22AX_PREFIX_CONFIG_H([magick/magick-config.h],[MagickCore])
23AC_CONFIG_FILES( \
24    config/delegates.xml \
25    config/configure.xml \
26    config/ImageMagick.rdf \
27    config/type-ghostscript.xml \
28    config/type.xml \
29    config/type-solaris.xml \
30    config/type-windows.xml \
31    ImageMagick.spec \
32    magick/ImageMagick.pc \
33    magick/Magick-config \
34    magick/version.h \
35    magick.sh \
36    Magick++/bin/Magick++-config \
37    Magick++/lib/ImageMagick++.pc \
38    Makefile \
39    PerlMagick/Magick.pm \
40    PerlMagick/Makefile.PL \
41    utilities/animate.1 \
42    utilities/compare.1 \
43    utilities/composite.1 \
44    utilities/conjure.1 \
45    utilities/convert.1 \
46    utilities/display.1 \
47    utilities/identify.1 \
48    utilities/ImageMagick.1 \
49    utilities/import.1 \
50    utilities/mogrify.1 \
51    utilities/montage.1 \
52    utilities/stream.1 \
53    wand/Wand-config \
54    wand/Wand.pc )
55
56#
57# Save initial user-tunable values
58#
59USER_LIBS=$LIBS
60for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS LIBS ; do
61  eval isset=\${$var+set}
62    if test "$isset" = 'set'; then
63        eval val=$`echo $var`
64        DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' "
65    fi
66done
67AC_SUBST(DISTCHECK_CONFIG_FLAGS)
68
69CONFIGURE_ARGS=`echo "$0 $@" | sed -e 's/  */ /g'`
70AC_SUBST(CONFIGURE_ARGS)
71
72# Source file containing package/library versioning information.
73. ${srcdir}/version.sh
74
75echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}${PACKAGE_VERSION_ADDENDUM}"
76AC_CANONICAL_TARGET([])
77
78# Substitute library versioning
79AC_SUBST(LIBRARY_CURRENT)dnl
80AC_SUBST(LIBRARY_REVISION)dnl
81AC_SUBST(LIBRARY_AGE)dnl
82AC_SUBST(PACKAGE_NAME)dnl
83AC_SUBST(PACKAGE_VERSION)dnl
84AC_SUBST(PACKAGE_LIB_VERSION)dnl
85AC_SUBST(PACKAGE_LIB_VERSION_NUMBER)dnl
86AC_SUBST(PACKAGE_RELEASE_DATE)dnl
87AC_SUBST(PACKAGE_VERSION_ADDENDUM)dnl
88
89# Ensure that make can run correctly
90AM_SANITY_CHECK
91
92AM_INIT_AUTOMAKE([foreign subdir-objects dist-zip dist-bzip2 tar-ustar -Wall])
93AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/ChangeLog $(top_srcdir)/version.sh'])
94
95PERLMAINCC=$CC
96
97MAGICK_CFLAGS=''
98MAGICK_CPPFLAGS=$CPPFLAGS_USER
99MAGICK_PCFLAGS=$CPPFLAGS_USER
100MAGICK_LDFLAGS=''
101MAGICK_LIBS=''
102
103#
104# Evaluate shell variable equivalents to Makefile directory variables
105#
106if test "x$prefix" = xNONE; then
107    prefix=$ac_default_prefix
108fi
109# Let make expand exec_prefix.
110if test "x$exec_prefix" = xNONE; then
111    exec_prefix='${prefix}'
112fi
113
114#
115eval "eval PREFIX_DIR=${prefix}"
116AC_SUBST(PREFIX_DIR)
117eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
118AC_SUBST(EXEC_PREFIX_DIR)
119eval "eval BIN_DIR=$bindir"
120AC_SUBST(BIN_DIR)
121eval "eval SBIN_DIR=$sbindir"
122AC_SUBST(SBIN_DIR)
123eval "eval LIBEXEC_DIR=$libexecdir"
124AC_SUBST(LIBEXEC_DIR)
125eval "eval DATA_DIR=$datadir"
126AC_SUBST(DATA_DIR)
127eval "eval SYSCONF_DIR=$sysconfdir"
128AC_SUBST(SYSCONF_DIR)
129eval "eval SHAREDSTATE_DIR=$sharedstatedir"
130AC_SUBST(SHAREDSTATE_DIR)
131eval "eval LOCALSTATE_DIR=$localstatedir"
132AC_SUBST(LOCALSTATE_DIR)
133eval "eval LIB_DIR=$libdir"
134AC_SUBST(LIB_DIR)
135eval "eval INCLUDE_DIR=$includedir"
136AC_SUBST(INCLUDE_DIR)
137eval "eval PERSISTINCLUDE_DIR=$oldincludedir"
138AC_SUBST(PERSISTINCLUDE_DIR)
139eval "eval INFO_DIR=$infodir"
140AC_SUBST(INFO_DIR)
141eval "eval MAN_DIR=$mandir"
142AC_SUBST(MAN_DIR)
143
144# Get full paths to source and build directories
145srcdirfull="`cd $srcdir && pwd`"
146builddir="`pwd`"
147
148WinPathScript="${srcdirfull}/winpath.sh"
149AC_SUBST(WinPathScript)
150
151#
152# Compute variables useful for running uninstalled software.
153#
154MAGICK_CODER_MODULE_PATH="${builddir}/coders"
155MAGICK_CONFIGURE_SRC_PATH="${srcdirfull}/config"
156MAGICK_CONFIGURE_BUILD_PATH="${builddir}/config"
157MAGICK_FILTER_MODULE_PATH="${builddir}/filters"
158DIRSEP=':'
159case "${host_os}" in
160    mingw* )
161        MAGICK_CODER_MODULE_PATH=`$WinPathScript "${MAGICK_CODER_MODULE_PATH}" 0`
162        MAGICK_CONFIGURE_SRC_PATH=`$WinPathScript "${MAGICK_CONFIGURE_SRC_PATH}" 0`
163        MAGICK_CONFIGURE_BUILD_PATH=`$WinPathScript "${MAGICK_CONFIGURE_BUILD_PATH}" 0`
164        MAGICK_FILTER_MODULE_PATH=`$WinPathScript "${MAGICK_FILTER_MODULE_PATH}" 0`
165        DIRSEP=';'
166    ;;
167esac
168AC_SUBST(MAGICK_CODER_MODULE_PATH)
169AC_SUBST(MAGICK_CONFIGURE_SRC_PATH)
170AC_SUBST(MAGICK_CONFIGURE_BUILD_PATH)
171AC_SUBST(MAGICK_FILTER_MODULE_PATH)
172AC_SUBST(DIRSEP)
173
174# Check for programs
175AC_PROG_CC
176AC_PROG_CPP
177AC_PROG_LD
178AC_SUBST(LD)
179AM_PROG_CC_C_O
180AC_PROG_INSTALL
181AC_PROG_MAKE_SET
182AC_PROG_RANLIB
183AC_COMPILE_WARNINGS
184AC_PROG_LN_S
185AM_WITH_DMALLOC
186
187#
188# Enable OS features.
189#
190AC_GNU_SOURCE
191
192#
193# Tests for Windows
194#
195AC_EXEEXT
196AC_OBJEXT
197
198GDI32_LIBS=''
199StaticCplusPlusLibraries='no'
200native_win32_build='no'
201cygwin_build='no'
202case "${host_os}" in
203    cygwin* )
204        StaticCplusPlusLibraries='yes'
205        cygwin_build='yes'
206        GDI32_LIBS='-lgdi32'
207    ;;
208    mingw* )
209        StaticCplusPlusLibraries='yes'
210        native_win32_build='yes'
211        GDI32_LIBS='-lgdi32'
212    ;;
213esac
214if test "${GDI32_LIBS}x" != 'x'; then
215    AC_DEFINE(WINGDI32_DELEGATE,1,Define to use the Windows GDI32 library)
216fi
217AC_SUBST(GDI32_LIBS)
218AM_CONDITIONAL(WINGDI32_DELEGATE, test "${GDI32_LIBS}x" != 'x' )
219AM_CONDITIONAL(WIN32_NATIVE_BUILD, test "${native_win32_build}" = 'yes' )
220AM_CONDITIONAL(CYGWIN_BUILD, test "${cygwin_build}" = 'yes' )
221
222#
223# Compiler flags tweaks
224#
225if test "${GCC}" != "yes"; then
226    case "${host}" in
227        *-*-hpux* )
228            # aCC: HP ANSI C++ B3910B A.03.34
229            CFLAGS="${CFLAGS} -Wp,-H30000"
230            if test -n "${CXXFLAGS}"; then
231                CXXFLAGS='-AA'
232            else
233                CXXFLAGS="${CXXFLAGS} -AA"
234            fi
235        ;;
236        *-dec-osf5.* )
237            # Compaq alphaev68-dec-osf5.1 compiler
238            if test -n "${CXXFLAGS}"; then
239                CXXFLAGS='-std strict_ansi -noimplicit_include'
240            else
241                CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
242            fi
243  esac
244fi
245
246dnl Platform-specific stuff
247case "$host" in
248*darwin*)
249  dnl OS X universal binary support, requires --disable-dependency-tracking
250  AC_ARG_ENABLE(osx-universal-binary,
251        AC_HELP_STRING([--enable-osx-universal-binary],
252           [build universal binary on OS X [[default=no]]]),
253        [build_osxuniversal="${enableval}"], [build_osxuniversal=no])
254 
255  if test "${build_osxuniversal}" != no ; then
256    if test "$enable_dependency_tracking" != no ; then
257      AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
258Please re-run configure with these options:
259  --disable-dependency-tracking --enable-osx-universal-binary
260        ])
261    fi
262    CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
263    CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
264    LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
265  fi
266 
267esac
268
269# Enable support for threads
270AC_ARG_WITH([threads],
271    [AC_HELP_STRING([--without-threads],
272                    [disable threads support])],
273    [with_threads=$withval],
274    [with_threads='yes'])
275
276have_threads=no
277if test "$with_threads" != 'no'; then
278    ACX_PTHREAD()
279    if test "$acx_pthread_ok" = yes; then
280        have_threads=yes
281        DEF_THREAD="$PTHREAD_CFLAGS"
282        CFLAGS="$CFLAGS $DEF_THREAD"
283        CXXFLAGS="$CXXFLAGS $DEF_THREAD"
284        if test "$CC" != "$PTHREAD_CC"; then
285            AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
286            CC="$PTHREAD_CC"
287        fi
288    fi
289fi
290
291# Enable support for OpenMP
292AC_OPENMP([C])
293CFLAGS="$CFLAGS $OPENMP_CFLAGS"
294LDFLAGS="$LDFLAGS $OPENMP_CFLAGS"
295MAGICK_PCFLAGS="$MAGICK_PCFLAGS $OPENMP_CFLAGS"
296
297########
298#
299# Check for large file support
300#
301########
302AC_SYS_LARGEFILE
303AC_FUNC_FSEEKO
304LFS_CPPFLAGS=''
305if test "$enable_largefile" != no; then
306    if test "$ac_cv_sys_file_offset_bits" != 'no'; then
307        LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
308    else
309        AC_MSG_CHECKING([for native large file support])
310        AC_RUN_IFELSE([#include <unistd.h>
311          main () {
312          exit(!(sizeof(off_t) == 8));
313        }],
314        [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
315         AC_MSG_RESULT([yes])],
316        [AC_MSG_RESULT([no])])
317    fi
318    if test "$ac_cv_sys_large_files" != 'no'; then
319        LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
320    fi
321    if  test "$ac_cv_sys_largefile_source" != 'no'; then
322        LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
323    fi
324fi
325AC_SUBST(LFS_CPPFLAGS)
326
327#
328# Configure libtool & libltdl
329#
330# Configure libtool
331AC_LIBTOOL_DLOPEN
332LT_INIT([win32-dll])
333LT_LANG([C++])
334AC_SUBST(LIBTOOL_DEPS)
335
336
337# Configure libltdl
338LT_CONFIG_LTDL_DIR([ltdl],[nonrecursive])
339AC_LIBLTDL_CONVENIENCE([ltdl])
340AC_LIB_LTDL
341# Substitute INCLTDL and LIBLTDL in the Makefiles
342#AC_SUBST(INCLTDL)
343#AC_SUBST(LIBLTDL)
344
345# Check to see if building shared libraries
346libtool_build_shared_libs='no'
347if test "$enable_shared" = 'yes'; then
348    libtool_build_shared_libs='yes'
349fi
350
351# Check to see if building static libraries
352libtool_build_static_libs='no'
353if test "$enable_static" = 'yes'; then
354    libtool_build_static_libs='yes'
355fi
356
357# MinGW and Cygwin can't build C++ DLLs which support exceptions.
358if test "${StaticCplusPlusLibraries}" = 'yes'; then
359    LTCXXLIBOPTS='--static'
360    AC_SUBST(LTCXXLIBOPTS)
361fi
362
363#
364# Enable support for building loadable modules
365#
366AC_ARG_WITH([modules],
367    [AC_HELP_STRING([--with-modules],
368                    [support dynamically loadable modules])],
369    [with_modules=$withval],
370    [with_modules=$libtool_build_shared_libs])
371
372# Only allow building loadable modules if we are building shared libraries
373if test "$with_modules" != 'no' ; then
374    if test "$libtool_build_shared_libs" = 'no'; then
375        AC_MSG_WARN([Modules may only be built if building shared libraries is enabled.])
376        with_modules='no'
377    fi
378fi
379if test "$with_modules" != 'no'; then
380    AC_DEFINE(BUILD_MODULES,1,Define if coders and filters are to be built as modules.)
381fi
382AM_CONDITIONAL(WITH_MODULES, test "$with_modules" != 'no')
383
384# Enable building/use of libltdl if we are building shared libraries regardless
385# of whether modules are built or not.
386with_ltdl='no'
387if test "$libtool_build_shared_libs" != 'no'; then
388    with_ltdl='yes'
389fi
390
391AM_CONDITIONAL(WITH_LTDL, test "$with_ltdl" != 'no')
392if test "$with_ltdl" != 'no'; then
393    AC_DEFINE(LTDL_DELEGATE,1,Define if using libltdl to support dynamically loadable modules)
394
395    # Set DLLDFLAGS
396    if test X"$enable_shared" = Xyes; then
397        DLLDFLAGS=-export-dynamic
398        AC_SUBST(DLLDFLAGS)
399    fi
400fi
401
402# Enable build using delegate libraries built in subdirectories rather than installed
403# delegate libraries (bzlib fpx jp2 jbig jpeg lcms png tiff ttf wmf xml zlib)
404AC_ARG_ENABLE([delegate-build],
405    [AC_HELP_STRING([--enable-delegate-build],
406                    [look for delegate libraries in build directory])],
407    [enable_delegate_build=$enableval],
408    [enable_delegate_build='no'])
409
410AC_ARG_ENABLE([deprecated],
411    [AC_HELP_STRING([--disable-deprecated],
412                    [exclude deprecated methods in MagickCore and MagickWand API's])],
413    [enable_deprecated=$enableval],
414    [enable_deprecated='no'])
415
416if test "$enable_deprecated" = 'yes'; then
417  AC_DEFINE(EXCLUDE_DEPRECATED,1,[exclude deprecated methods in MagickCore API])
418else
419  DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-deprecate "
420fi
421
422# Build a version of ImageMagick which operates uninstalled.
423# Used to build distributions located via MAGICK_HOME / executable path
424AC_ARG_ENABLE([installed],
425    [AC_HELP_STRING([--disable-installed],
426                    [Formally install ImageMagick under PREFIX])],
427    [enable_installed=$enableval],
428    [enable_installed='yes'])
429
430if test "$enable_installed" = 'yes'; then
431    AC_DEFINE(INSTALLED_SUPPORT,1,[ImageMagick is formally installed under prefix])
432else
433    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
434fi
435
436# Build an embeddable version of ImageMagick.
437AC_ARG_ENABLE([embeddable],
438    [AC_HELP_STRING([--enable-embeddable],
439                    [enable self-contained, embeddable, zero-configuration ImageMagick])],
440    [enable_embeddable=$enableval],
441    [enable_embeddable='no'])
442
443if test "$enable_embeddable" = 'yes'; then
444    AC_DEFINE(EMBEDDABLE_SUPPORT,1,[Build self-contained, embeddable, zero-configuration ImageMagick (experimental)])
445fi
446
447# Build a high dynamic range version of ImageMagick.
448AC_ARG_ENABLE([hdri],
449    [AC_HELP_STRING([--enable-hdri],
450                    [accurately represent the wide range of intensity levels found in real scenes])],
451    [enable_hdri=$enableval],
452    [enable_hdri='no'])
453
454MAGICK_HDRI=""
455if test "$enable_hdri" = 'yes'; then
456    MAGICK_HDRI="HDRI"
457    AC_DEFINE(HDRI_SUPPORT,1,[accurately represent the wide range of intensity levels  in real scenes])
458fi
459AC_SUBST(MAGICK_HDRI)dnl
460
461# Enable verbose output from libtool (enable libtool's default)
462AC_ARG_ENABLE([libtool-verbose],
463    [AC_HELP_STRING([--enable-libtool-verbose],
464                    [enable verbose libtool output])],
465    [enable_libtool_verbose=$enableval],
466    [enable_libtool_verbose='no'])
467
468if test "$enable_libtool_verbose" = 'no'; then
469    LIBTOOL="$LIBTOOL --silent"
470fi
471
472# Build a version of ImageMagick with assert statements.
473AC_ARG_ENABLE([assert],
474    [AC_HELP_STRING([--disable-assert],
475                    [disable assert() statements in build])],
476    [enable_assert=$enableval],
477    [enable_assert='yes'])
478
479if test "$enable_assert" = 'no'; then
480    AC_DEFINE(NDEBUG,1,[Turn off assert statements])
481fi
482
483# Add configure option --enable-maintainer-mode which enables dependency
484# checking and generation useful to package maintainers.  This is made an
485# option to avoid confusing end users.
486AM_MAINTAINER_MODE
487
488
489# Enable ccmalloc memory debugging support
490AC_ARG_ENABLE([ccmalloc],
491    [AC_HELP_STRING([--enable-ccmalloc],
492                    [enable 'ccmalloc' memory debug support])],
493    [enable_ccmalloc=$enableval],
494    [enable_ccmalloc='no'])
495
496# Enable Electric Fence memory debugging support
497AC_ARG_ENABLE([efence],
498    [AC_HELP_STRING([--enable-efence],
499                    [enable 'efence' memory debug support])],
500    [enable_efence=$enableval],
501    [enable_efence='no'])
502
503# Enable prof-based profiling support
504AC_ARG_ENABLE([prof],
505    [AC_HELP_STRING([--enable-prof],
506                    [enable 'prof' profiling support])],
507    [enable_prof=$enableval],
508    [enable_prof='no'])
509
510# Enable gprof-based profiling support
511AC_ARG_ENABLE([gprof],
512    [AC_HELP_STRING([--enable-gprof],
513                    [enable 'gprof' profiling support])],
514    [enable_gprof=$enableval],
515    [enable_gprof='no'])
516
517# Enable gcov-based profiling support
518AC_ARG_ENABLE([gcov],
519    [AC_HELP_STRING([--enable-gcov],
520                    [enable 'gcov' profiling support])],
521    [enable_gcov=$enableval],
522    [enable_gcov='no'])
523
524enable_profiling='no'
525if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
526    enable_profiling='yes'
527    if test "$libtool_build_shared_libs" = 'yes'; then
528        echo "Warning: Can not profile code using shared libraries"
529    fi
530fi
531
532# Magick API method prefix
533AC_ARG_WITH([method-prefix],
534    [AC_HELP_STRING([--with-method-prefix=PREFIX],
535                    [prefix MagickCore API methods])],
536    [with_method_prefix=$enableval],
537    [with_method_prefix=''])
538
539if test "$with_method_prefix" != ''; then
540    AC_DEFINE_UNQUOTED(NAMESPACE_PREFIX,$with_method_prefix,[Magick API method prefix])
541fi
542
543# Number of bits in a Quantum
544AC_ARG_WITH([quantum-depth],
545    [AC_HELP_STRING([--with-quantum-depth=DEPTH],
546                    [number of bits in a pixel quantum (default 16)])],
547    [with_quantum_depth=$withval],
548    [with_quantum_depth=16])
549
550if test "$with_quantum_depth" != '8'; then
551    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-quantum-depth=$with_quantum_depth "
552fi
553
554case "${with_quantum_depth}" in
555    8 )
556    ;;
557    16 )
558    ;;
559    32 )
560    ;;
561    64 )
562    ;;
563    * )
564        AC_MSG_ERROR("Pixel quantum depth must have value of 8, 16, or 32")
565    ;;
566esac
567QUANTUM_DEPTH="$with_quantum_depth"
568AC_DEFINE_UNQUOTED(QUANTUM_DEPTH,$QUANTUM_DEPTH,[Number of bits in a pixel Quantum (8/16/32/64)])
569AC_SUBST(QUANTUM_DEPTH)dnl
570
571# Set pixel cache threshold
572AC_ARG_WITH([cache],
573    [AC_HELP_STRING([--with-cache=THRESHOLD],
574                    [set pixel cache threshhold in MB (default available memory)])],
575    [with_cache=$withval],
576    [with_cache=''])
577
578if test "$with_cache" != ''; then
579    AC_DEFINE_UNQUOTED(PixelCacheThreshold,$with_cache,[Pixel cache threshold in MB (defaults to available memory)])
580    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-cache=$with_cache "
581fi
582
583# Disable/Enable support for full delegate paths
584AC_ARG_WITH([frozenpaths],
585    [AC_HELP_STRING([--with-frozenpaths],
586                    [freeze delegate paths])],
587    [with_frozenpaths=$withval],
588    [with_frozenpaths='no'])
589
590# Enable build/install of Magick++
591AC_ARG_WITH([magick-plus-plus],
592    [AC_HELP_STRING([--without-magick-plus-plus],
593                    [disable build/install of Magick++])],
594    [with_magick_plus_plus=$withval],
595    [with_magick_plus_plus='yes'])
596
597# Disable build/install of PerlMagick.
598AC_ARG_WITH([perl],
599    [AC_HELP_STRING([--with-perl],
600                    [enable build/install of PerlMagick])],
601    [with_perl=$withval],
602    [with_perl=$libtool_build_shared_libs])
603
604# Options to pass when configuring PerlMagick
605AC_ARG_WITH([perl-options],
606    [AC_HELP_STRING([--with-perl-options=OPTIONS],
607                    [options to pass on command-line when generating PerlMagick's build file])])
608
609PERL_MAKE_OPTIONS=$with_perl_options
610AC_SUBST(PERL_MAKE_OPTIONS)
611
612
613# Disable BZLIB (bzip2 library)
614AC_ARG_WITH([bzlib],
615    [AC_HELP_STRING([--without-bzlib],
616                    [disable BZLIB support])],
617    [with_bzlib=$withval],
618    [with_bzlib='yes'])
619
620if test "$with_bzlib" != 'yes'; then
621    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-bzlib=$with_bzlib "
622fi
623
624# Disable Display Postscript.
625AC_ARG_WITH([dps],
626    [AC_HELP_STRING([--without-dps],
627                    [disable Display Postscript support])],
628    [with_dps=$withval],
629    [with_dps='yes'])
630
631if test "$with_dps" != 'yes'; then
632    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-dps=$with_dps "
633fi
634
635# Disable DJVU.
636AC_ARG_WITH([djvu],
637    [AC_HELP_STRING([--with-djvu],
638                    [enable DjVu support])],
639    [with_djvu=$withval],
640    [with_djvu='no'])
641
642if test "$with_djvu" != 'yes'; then
643    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-djvu=$with_djvu "
644fi
645
646# Enable FlashPIX.
647AC_ARG_WITH([fpx],
648    [AC_HELP_STRING([--without-fpx],
649                    [disable FlashPIX support])],
650    [with_fpx=$withval],
651    [with_fpx='yes'])
652
653if test "$with_fpx" != 'yes'; then
654    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fpx=$with_fpx "
655fi
656
657# Enable Ghostscript library support.
658AC_ARG_WITH([gslib],
659    [AC_HELP_STRING([--without-gslib],
660                    [disable Ghostscript library support])],
661    [with_gslib=$withval],
662    [with_gslib='yes'])
663
664if test "$with_gslib" != 'yes'; then
665    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gslib=$with_gslib "
666fi
667
668# Disable JBIG.
669AC_ARG_WITH([jbig],
670    [AC_HELP_STRING([--without-jbig],
671                    [disable JBIG support])],
672    [with_jbig=$withval],
673    [with_jbig='yes'])
674
675if test "$with_jbig" != 'yes'; then
676    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jbig=$with_jbig "
677fi
678
679# Disable JPEG.
680AC_ARG_WITH([jpeg],
681    [AC_HELP_STRING([--without-jpeg],
682                    [disable JPEG support])],
683    [with_jpeg=$withval],
684    [with_jpeg='yes'])
685
686if test "$with_jpeg" != 'yes'; then
687    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jpeg=$with_jpeg "
688fi
689
690# Disable JPEG Version 2.
691AC_ARG_WITH([jp2],
692    [AC_HELP_STRING([--without-jp2],
693                    [disable JPEG-2000 support])],
694    [with_jp2=$withval],
695    [with_jp2='yes'])
696
697if test "$with_jp2" != 'yes'; then
698    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jp2=$with_jp2 "
699fi
700
701# Disable TIFF.
702AC_ARG_WITH([tiff],
703    [AC_HELP_STRING([--without-tiff],
704                    [disable TIFF support])],
705    [with_tiff=$withval],
706    [with_tiff='yes'])
707
708if test "$with_tiff" != 'yes'; then
709    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-tiff=$with_tiff "
710fi
711
712# Disable WMF.
713AC_ARG_WITH([wmf],
714    [AC_HELP_STRING([--without-wmf],
715                    [disable WMF support])],
716    [with_wmf=$withval],
717    [with_wmf=$with_modules])
718
719if test "$with_wmf" != 'yes'; then
720    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-wmf=$with_wmf "
721fi
722
723# Set default font search path
724AC_ARG_WITH([fontpath],
725    [AC_HELP_STRING([--with-fontpath=DIR],
726                    [prepend to default font search path])],
727    [with_fontpath=$withval],
728    [with_fontpath=''])
729
730if test "$with_fontpath" != "yes" && test -z "$with_fontpath"; then
731    with_fontpath=''
732else
733    AC_DEFINE_UNQUOTED(MAGICK_FONT_PATH,"$with_fontpath",Define to prepend to default font search path.)
734fi
735if test "$with_fontpath=" != ''; then
736    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-fontpath=$with_fontpath "   
737fi
738
739# Set Ghostscript font directory
740AC_ARG_WITH([gs-font-dir],
741    [AC_HELP_STRING([--with-gs-font-dir=DIR],
742                    [Ghostscript font directory])],
743    [with_gs_font_dir=$withval],
744    [with_gs_font_dir='default'])
745
746if test "$with_gs_font_dir" != 'default'; then
747    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-gs-font-dir=$with_gs_font_dir "
748fi 
749
750# Set Windows font directory
751AC_ARG_WITH([windows-font-dir],
752    [AC_HELP_STRING([--with-windows-font-dir=DIR],
753                    [MS Windows font directory])],
754    [with_windows_font_dir=$withval],
755    [with_windows_font_dir=''])
756
757if test "x$with_windows_font_dir" = "xno"; then
758    with_windows_font_dir=
759fi
760if test "$with_windows_font_dir" != ''; then
761    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-windows-font-dir=$with_windows_font_dir "
762fi
763
764AC_ARG_WITH([zlib],
765    [AC_HELP_STRING([--without-zlib],
766                    [disable ZLIB support])],
767    [with_zlib=$withval],
768    [with_zlib='yes'])
769
770if test "$with_zlib" != 'yes'; then
771    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-zlib=$with_zlib "
772fi
773
774#
775# Specify path to shared libstdc++ if not in normal location
776#
777AC_ARG_WITH([libstdc],
778    [AC_HELP_STRING([--with-libstdc=DIR],
779                    [ use libstdc++ in DIR (for GNU C++)])],
780    [with_libstdc=$withval],
781    [with_libstdc=''])
782
783if test "$with_libstdc" != ''; then
784    if test -d "$with_libstdc"; then
785        LIBSTDCLDFLAGS="-L$with_libstdc"
786    fi
787fi
788AC_SUBST(LIBSTDCLDFLAGS)
789
790# Does gcc required -traditional?
791AC_PROG_GCC_TRADITIONAL
792
793########
794#
795# Set defines required to build DLLs and modules using MinGW
796#
797########
798# These options are set for multi-thread DLL module build
799#  libMagick:           _DLL _MAGICKMOD_ _MAGICKLIB_
800#  module:              _DLL
801#  executable/Magick++: _DLL _MAGICKMOD_
802MODULE_EXTRA_CPPFLAGS=''
803LIBRARY_EXTRA_CPPFLAGS=''
804if test "${native_win32_build}" = 'yes'; then
805    if test "${libtool_build_shared_libs}" = 'yes'; then
806        CPPFLAGS="$CPPFLAGS -D_DLL"
807        MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_DLL"
808        MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_DLL"
809        LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKLIB_"
810        if test "$with_modules" = 'yes'; then
811            LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_MAGICKMOD_"
812        else
813            MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_MAGICKLIB_"
814        fi
815    else
816        CPPFLAGS="$CPPFLAGS -D_LIB"
817        MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_LIB"
818        MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_LIB"
819    fi
820    if test "$with_threads" = 'yes'; then
821         CPPFLAGS="$CPPFLAGS -D_MT"
822         MAGICK_CPPFLAGS="$MAGICK_CPPFLAGS -D_MT"
823         MAGICK_PCFLAGS="$MAGICK_PCFLAGS -D_MT"
824    fi
825fi
826AC_SUBST(MODULE_EXTRA_CPPFLAGS)
827AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
828
829# Check standard headers
830AC_HEADER_STDC
831if ! test x"$ac_cv_header_stdc" = x"yes"; then
832    AC_MSG_WARN([configure has detected that you do not have the ANSI standard C
833    header files.  Compilation cannot proceed.  Please install the ANSI C
834    headers and rerun this script.]);
835fi
836AC_HEADER_DIRENT
837
838# Check additional headers
839AC_CHECK_HEADERS(errno.h fcntl.h inttypes.h limits.h locale.h machine/param.h mach-o/dyld.h stdarg.h string.h strings.h sys/ipc.h sys/resource.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/wait.h unistd.h)
840
841########
842#
843# Checks for typedefs, structures, and compiler characteristics.
844#
845########
846
847# If the C compiler does not fully support the ANSI C qualifier const,
848# define const to be empty.
849AC_HEADER_STDBOOL
850AC_C_CONST
851AC_C_VOLATILE
852AC_C_STRINGIZE
853AC_HEADER_STAT
854AC_HEADER_TIME
855AC_STRUCT_TM
856
857########
858#
859# Checks for typedefs, structures, and compiler characteristics.
860#
861########
862
863# If the C compiler does not fully support the ANSI C qualifier const,
864# define const to be empty.
865AC_C_CONST
866
867# If the C compiler supports the keyword inline, do nothing. Otherwise
868# define inline to __inline__ or __inline if it accepts one of those,
869# otherwise define inline to be empty.
870AC_C_INLINE
871
872# If the C compiler supports the keyword restrict, do nothing. Otherwise
873# define restrict to __restrict__ or __restrict if it accepts one of those,
874# otherwise define restrict to be empty.
875AC_C_RESTRICT
876
877# If words are stored with the most significant byte first (like
878# Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
879AC_C_BIGENDIAN
880
881# Define mode_t to a suitable type, if standard headers do not define it.
882AC_TYPE_MODE_T
883
884# Define off_t to a suitable type, if standard headers do not define it.
885AC_TYPE_OFF_T
886
887# Define pid_t to a suitable type, if standard headers do not define it.
888AC_TYPE_PID_T
889
890# Define size_t to a suitable type, if standard headers do not define it.
891AC_TYPE_SIZE_T
892
893# Define ssize_t to a suitable type, if standard headers do not define it.
894AC_TYPE_SSIZE_T
895
896# If the C compiler supports a working long double type with more range
897# or precision than the double type, define HAVE_LONG_DOUBLE.
898AC_C_LONG_DOUBLE
899
900# If the C type char is unsigned, define __CHAR_UNSIGNED__, unless the
901# C compiler predefines it.
902AC_C_CHAR_UNSIGNED
903
904# Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
905AC_CHECK_SIZEOF(signed short)
906
907# Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
908AC_CHECK_SIZEOF(unsigned short)
909
910# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
911AC_CHECK_SIZEOF(signed int)
912
913# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
914AC_CHECK_SIZEOF(unsigned int)
915
916# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
917AC_CHECK_SIZEOF(signed long)
918
919# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
920AC_CHECK_SIZEOF(unsigned long)
921
922# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.  If
923# 'signed long long' is not supported then the value defined is zero.
924AC_CHECK_SIZEOF(signed long long)
925
926# Obtain size of a 'unsigned long long' and define as
927# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
928# supported then the value defined is zero.
929AC_CHECK_SIZEOF(unsigned long long)
930
931# Obtain size of off_t and define as SIZEOF_OFF_T
932AC_CHECK_SIZEOF(off_t)
933
934# Obtain size of size_t and define as SIZEOF_SIZE_T
935AC_CHECK_SIZEOF(size_t)
936
937# Obtain size of an unsigned int pointer and define as SIZEOF_UNSIGNED_INTP
938AC_CHECK_SIZEOF(unsigned int*)
939
940# If `signal.h' declares signal as returning a pointer to a function
941# returning void, define RETSIGTYPE to be void; otherwise, define it
942# to be int.
943AC_TYPE_SIGNAL
944
945#
946# Compute sized types for current CPU and compiler options.
947#
948
949AC_MSG_CHECKING(for signed 8-bit type)
950INT8_T='signed char'
951AC_MSG_RESULT($INT8_T)
952AC_SUBST(INT8_T)
953
954AC_MSG_CHECKING(for unsigned 8-bit type)
955UINT8_T='unsigned char'
956AC_MSG_RESULT($UINT8_T)
957AC_SUBST(UINT8_T)
958
959AC_MSG_CHECKING(for signed 16-bit type)
960INT16_T='signed short'
961AC_MSG_RESULT($INT16_T)
962AC_SUBST(INT16_T)
963
964AC_MSG_CHECKING(for unsigned 16-bit type)
965UINT16_T='unsigned short'
966AC_MSG_RESULT($UINT16_T)
967AC_SUBST(UINT16_T)
968
969AC_MSG_CHECKING(for signed 32-bit type)
970INT32_T='none'
971if test $ac_cv_sizeof_signed_int -eq 4; then
972  INT32_T='signed int'
973elif test $ac_cv_sizeof_signed_long -eq 4; then
974  INT32_T='signed long'
975fi
976AC_MSG_RESULT($INT32_T)
977AC_SUBST(INT32_T)
978
979AC_MSG_CHECKING(for unsigned 32-bit type)
980UINT32_T='none'
981if test $ac_cv_sizeof_unsigned_int -eq 4; then
982  UINT32_T='unsigned int'
983elif test $ac_cv_sizeof_unsigned_long -eq 4; then
984  UINT32_T='unsigned long'
985fi
986AC_MSG_RESULT($UINT32_T)
987AC_SUBST(UINT32_T)
988
989AC_MSG_CHECKING(for signed 64-bit type)
990INT64_T='none'
991if test $ac_cv_sizeof_signed_long -eq 8; then
992  INT64_T='signed long'
993elif test $ac_cv_sizeof_signed_long_long -eq 8; then
994  INT64_T='signed long long'
995fi
996AC_MSG_RESULT($INT64_T)
997AC_SUBST(INT64_T)
998
999AC_MSG_CHECKING(for unsigned 64-bit type)
1000UINT64_T='none'
1001if test $ac_cv_sizeof_unsigned_long -eq 8; then
1002  UINT64_T='unsigned long'
1003elif test $ac_cv_sizeof_unsigned_long_long -eq 8; then
1004  UINT64_T='unsigned long long'
1005fi
1006AC_MSG_RESULT($UINT64_T)
1007AC_SUBST(UINT64_T)
1008
1009AC_MSG_CHECKING(for unsigned maximum type)
1010UINTMAX_T='none'
1011if test "$UINT64_T" != 'none'; then
1012  UINTMAX_T=$UINT64_T
1013elif test "$UINT32_T" != 'none'; then
1014  UINTMAX_T=$UINT32_T
1015fi
1016AC_MSG_RESULT($UINTMAX_T)
1017AC_SUBST(UINTMAX_T)
1018
1019AC_MSG_CHECKING(for pointer difference type)
1020UINTPTR_T='none'
1021if test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_unsigned_intp; then
1022  UINTPTR_T='unsigned long'
1023elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_unsigned_intp; then
1024  UINTPTR_T='unsigned long long'
1025fi
1026AC_MSG_RESULT($UINTPTR_T)
1027AC_SUBST(UINTPTR_T)
1028
1029AC_MSG_CHECKING([whether our compiler supports __func__])
1030AC_TRY_COMPILE([],
1031 [{ const char *func = __func__; return(func != 0 ? 0 : 1); }],
1032 AC_MSG_RESULT([yes]),
1033 AC_MSG_RESULT([no])
1034 AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
1035 AC_TRY_COMPILE([],
1036   [{ const char *func = __FUNCTION__; return(func != 0 ? 0 : 1); }],
1037   AC_MSG_RESULT([yes])
1038   AC_DEFINE(__func__, __FUNCTION__,
1039     [Define to appropriate substitue if compiler does not have __func__]),
1040   AC_MSG_RESULT([no])
1041   AC_DEFINE(__func__, __FILE__,
1042     [Define to appropriate substitue if compiler does not have __func__])))
1043
1044########
1045#
1046# Check for functions
1047#
1048########
1049MAGICK_FUNC_MMAP_FILEIO
1050AC_FUNC_CLOSEDIR_VOID
1051AC_FUNC_MMAP
1052AC_FUNC_MEMCMP
1053AC_FUNC_SELECT_ARGTYPES
1054AC_FUNC_SETVBUF_REVERSED
1055AC_TYPE_SIGNAL
1056AC_FUNC_STRTOD
1057AC_FUNC_VPRINTF
1058
1059AC_CHECK_FUNCS([_exit atexit clock_gettime execvp floor fork ftime ftruncate getcwd getpid getexecname getdtablesize getpagesize gettimeofday lstat memset mkstemp munmap _NSGetExecutablePath pclose _pclose poll popen _popen pow pread pwrite raise rand_r readlink realpath select seekdir setlocale sqrt setvbuf stat strcspn strdup strpbrk strspn strstr strtol symlink sysconf sigemptyset sigaction strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times usleep vsprintf vsnprintf waitpid _wfopen])
1060
1061########
1062#       
1063# Check for function prototypes
1064#
1065########
1066
1067AC_CHECK_DECLS([pread, pwrite],[],[],[
1068#include <unistd.h>])
1069
1070AC_CHECK_DECLS([strlcpy],[],[],[
1071#include <strings.h>])
1072
1073AC_CHECK_DECLS([vsnprintf],[],[],[
1074#include <stdio.h>
1075#include <stdarg.h>])
1076
1077########
1078#
1079# C++ Support Tests (For Magick++)
1080#
1081########
1082have_magick_plus_plus='no'
1083if test "$with_magick_plus_plus" = 'yes'; then
1084    OLIBS="$LIBS"
1085    LIBS=''
1086    AC_LANG_PUSH(C++)
1087
1088    # Full set of headers used ...
1089    # algorithm cctype cerrno cmath cstdio cstdlib cstring ctime exception
1090    # functional iomanip iosfwd iostream iterator list string strstream utility
1091    AC_LANG([C++])
1092    AC_PROG_CXX
1093    AC_CXX_HAVE_BOOL
1094    AC_CXX_HAVE_NAMESPACES
1095    AC_CXX_HAVE_STD_NAMESPACE
1096    AC_CXX_HAVE_STD_LIBS
1097    AC_CXX_HAVE_LSTRING
1098    AC_OPENMP([C++])
1099    CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
1100    AC_LANG_POP
1101
1102    AC_MSG_CHECKING([whether C++ compiler is sufficient for Magick++])
1103    if \
1104        test $ac_cv_cxx_have_bool = 'yes' && \
1105        test $ac_cv_cxx_have_lstring = 'yes' && \
1106        test $ac_cv_cxx_have_namespaces = 'yes' && \
1107        test $ac_cv_cxx_have_std_libs = 'yes' && \
1108        test $ac_cv_cxx_have_std_namespace = 'yes'; then
1109        have_magick_plus_plus='yes'
1110    else
1111        have_magick_plus_plus='no (failed tests)'
1112    fi
1113    AC_MSG_RESULT([$have_magick_plus_plus])
1114    LIBS="$OLIBS"
1115fi
1116AM_CONDITIONAL(WITH_MAGICK_PLUS_PLUS, test "$have_magick_plus_plus" = 'yes')
1117
1118# Only check for delegate libraries in subdirectories if requested.
1119if test "$enable_delegate_build" != 'no'; then
1120    # Check for delegate sub-directories and add -I & -L options as required.
1121    # This presumes that delegates are installed as detailed in the ImageMagick
1122    # README. If delegates are installed in a standard location where the
1123    # compiler will automatically find them then these options should not be
1124    # required.
1125
1126    #
1127    # Most delegates have includes in the same directory as the library, but not all ...
1128    #
1129    # Includes
1130    for dir in bzlib fpx jp2 jp2/src/libjasper/include jbig/libjbig jpeg lcms/include magick png tiff/libtiff ttf/include wand wmf/include xml/include zlib; do
1131        if test -d "$builddir/$dir"; then
1132            CPPFLAGS="$CPPFLAGS -I$builddir/$dir"
1133        else
1134            if test -d "$srcdirfull/$dir"; then
1135                CPPFLAGS="$CPPFLAGS -I$srcdirfull/$dir"
1136            fi
1137        fi
1138    done
1139
1140    # Libraries
1141    for dir in bzlib fpx jp2 jp2/src/libjasper jbig/libjbig jpeg lcms/src magick png tiff/libtiff ttf/objs wand wmf/src xml zlib; do
1142    if test -d "$builddir/$dir/.libs"; then
1143        LDFLAGS="$LDFLAGS -L$builddir/$dir/.libs"
1144    else
1145        if test -d "$srcdirfull/$dir/.libs"; then
1146            LDFLAGS="$LDFLAGS -L$srcdirfull/$dir/.libs"
1147        fi
1148    fi
1149    if test -d "$builddir/$dir"; then
1150        LDFLAGS="$LDFLAGS -L$builddir/$dir"
1151    else
1152        if test -d "$srcdirfull/$dir"; then
1153            LDFLAGS="$LDFLAGS -L$srcdirfull/$dir"
1154        fi
1155    fi
1156  done
1157fi
1158
1159# Assume that delegate headers reside under same directory as ImageMagick
1160# installation prefix.
1161MAGICK_CPPFLAGS="-I$INCLUDE_DIR $MAGICK_CPPFLAGS"
1162
1163#
1164# Find the X11 RGB database
1165#
1166AC_CACHE_CHECK(for X11 configure files,im_cv_x_configure,
1167[# Look for the header file in a standard set of common directories.
1168# Check X11 before X11Rn because it is often a symlink to the current release.
1169    for ac_dir in          \
1170    /lib/usr/lib/X11       \
1171    /usr/X11/lib           \
1172    /usr/X11R4/lib         \
1173    /usr/X11R5/lib         \
1174    /usr/X11R6/lib         \
1175    /usr/X386/lib          \
1176    /usr/XFree86/lib/X11   \
1177    /usr/athena/lib        \
1178    /usr/lib               \
1179    /usr/lib/X11           \
1180    /usr/lib/X11R4         \
1181    /usr/lib/X11R5         \
1182    /usr/lib/X11R6         \
1183    /usr/local/X11/lib     \
1184    /usr/local/X11R4/lib   \
1185    /usr/local/X11R5/lib   \
1186    /usr/local/X11R6/lib   \
1187    /usr/local/lib         \
1188    /usr/local/lib/X11     \
1189    /usr/local/lib/X11R4   \
1190    /usr/local/lib/X11R5   \
1191    /usr/local/lib/X11R6   \
1192    /usr/local/x11r5/lib   \
1193    /usr/lpp/Xamples/lib   \
1194    /usr/openwin/lib       \
1195    /usr/openwin/share/lib \
1196    /usr/unsupported/lib   \
1197    /usr/x386/lib          \
1198    ; do
1199    if test -f "$ac_dir/X11/rgb.txt"; then
1200      im_cv_x_configure="$ac_dir/X11/"
1201      break
1202    elif test -f "$ac_dir/rgb.txt"; then
1203      im_cv_x_configure="$ac_dir/"
1204      break
1205    fi
1206
1207  done])
1208X11_CONFIGURE_PATH="$im_cv_x_configure"
1209if test "$native_win32_build" = 'yes'; then
1210    X11_CONFIGURE_PATH=`$WinPathScript "$X11ConfigurePath=" 1`
1211fi
1212AC_DEFINE_UNQUOTED(X11_CONFIGURE_PATH,"$X11ConfigurePath",Location of X11 configure files)
1213
1214#
1215# Find OpenMP library
1216#
1217GOMP_LIBS=''
1218if test "$enable_openmp" != 'no'; then
1219  AC_CHECK_LIB(gomp,GOMP_parallel_start,GOMP_LIBS="-lgomp",,)
1220  LIBS="$GOMP_LIBS $LIBS"
1221fi
1222AC_SUBST(GOMP_LIBS)
1223
1224#
1225# Find Posix threads library
1226#
1227THREAD_LIBS=''
1228if test "$with_threads" != 'no' && test "$have_threads" = 'yes'; then
1229
1230    if test "x$PTHREAD_LIBS" = "x"; then
1231    case "${host_cpu}-${host_os}" in
1232      *-freebsd*)
1233        MAGICK_CHECK_PTHREAD_LIB(c_r,PTHREAD_LIBS=-lc_r) ;;
1234    esac
1235    fi
1236
1237    for lib in pthread pthreads; do
1238        if test "x$PTHREAD_LIBS" = "x"; then
1239            MAGICK_CHECK_PTHREAD_LIB([$lib],[PTHREAD_LIBS=-l$lib])
1240        fi
1241    done
1242
1243    THREAD_LIBS="$PTHREAD_LIBS"
1244    LIBS="$LIBS $THREAD_LIBS"
1245fi
1246AC_SUBST(THREAD_LIBS)
1247
1248#
1249# Add support for ccmalloc memory debugging library if requested
1250#
1251have_ccmalloc='no'
1252CCMALLOC_LIBS=''
1253if test "$enable_ccmalloc" = 'yes'; then
1254    AC_PATH_PROG(CCMALLOCDelegate,ccmalloc,)
1255    if test -n "$CCMALLOCDelegate"; then
1256        eval `grep PREFIX= $CCMALLOCDelegate | sed -e 's/PREFIX/CCMALLOC_PREFIX/'`
1257        OLIBS="$LIBS"
1258        # Assume that gcc is used with ccmalloc.
1259        LIBS="$LIBS $CCMALLOC_PREFIX/lib/ccmalloc-gcc.o"
1260       AC_CHECK_LIB(ccmalloc,ccmalloc_malloc,CCMALLOC_LIBS="$CCMALLOC_PREFIX/lib/ccmalloc-gcc.o -lccmalloc -ldl",,-ldl)
1261        if test -n "$CCMALLOC_LIBS"; then
1262            LIBS="$OLIBS"
1263            LIBS="$LIBS $CCMALLOC_LIBS"
1264            have_ccmalloc='yes'
1265        else
1266            LIBS="$OLIBS"
1267        fi
1268    fi
1269fi
1270
1271#
1272# Add support for efence memory debugging library if requested
1273#
1274if test "$enable_efence" = 'yes'; then
1275    EFENCE_LIBS='-lefence'
1276    LIBS="$EFENCE_LIBS $LIBS"
1277fi
1278
1279#
1280# Find math library
1281#
1282MATH_LIBS=''
1283AC_CHECK_LIB(m,sqrt,MATH_LIBS="-lm",,)
1284LIBS="$MATH_LIBS $LIBS"
1285AC_SUBST(MATH_LIBS)
1286
1287#
1288# Check for ZLIB
1289#
1290have_zlib='no'
1291ZLIB_LIBS=''
1292dnl PNG requires zlib so enable zlib check if PNG is requested
1293if test "$with_zlib" != 'no' || test "$with_png" != 'no'; then
1294    AC_MSG_RESULT([-------------------------------------------------------------])
1295    AC_MSG_RESULT([Checking for ZLIB support])
1296    AC_MSG_RESULT([-------------------------------------------------------------])
1297    ZLIB_LIBS=''
1298    failed=0;
1299    passed=0;
1300    AC_CHECK_HEADER(zconf.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1301    AC_CHECK_HEADER(zlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1302    AC_CHECK_LIB(z,compress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1303    AC_CHECK_LIB(z,uncompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1304    AC_CHECK_LIB(z,deflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1305    AC_CHECK_LIB(z,inflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1306    AC_CHECK_LIB(z,gzseek,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1307    AC_CHECK_LIB(z,gztell,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1308    AC_MSG_CHECKING([if ZLIB package is complete])
1309    if test $passed -gt 0; then
1310        if test $failed -gt 0; then
1311            AC_MSG_RESULT([no -- some components failed test])
1312            have_zlib='no (failed tests)'
1313        else
1314            ZLIB_LIBS='-lz'
1315            LIBS="$ZLIB_LIBS $LIBS"
1316            AC_DEFINE(ZLIB_DELEGATE,1,Define if you have zlib compression library)
1317            AC_MSG_RESULT([yes])
1318            have_zlib='yes'
1319        fi
1320    else
1321        AC_MSG_RESULT([no])
1322    fi
1323fi
1324AM_CONDITIONAL(ZLIB_DELEGATE, test "$have_zlib" = 'yes')
1325AC_SUBST(ZLIB_LIBS)
1326
1327#
1328# Check for BZLIB
1329#
1330have_bzlib='no'
1331if test "$with_bzlib" != 'no'; then
1332    BZLIB_LIBS=''
1333    AC_MSG_RESULT([-------------------------------------------------------------])
1334    AC_MSG_RESULT([Checking for BZLIB support])
1335    AC_MSG_RESULT([-------------------------------------------------------------])
1336    failed=0;
1337    passed=0;
1338    AC_CHECK_HEADER(bzlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1339    AC_CHECK_LIB(bz2,BZ2_bzCompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1340    AC_CHECK_LIB(bz2,BZ2_bzDecompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1341    AC_MSG_CHECKING([if BZLIB package is complete])
1342    if test $passed -gt 0; then
1343        if test $failed -gt 0; then
1344            AC_MSG_RESULT([no -- some components failed test])
1345            have_bzlib='no (failed tests)'
1346        else
1347            BZLIB_LIBS='-lbz2'
1348            LIBS="$BZLIB_LIBS $LIBS"
1349            AC_DEFINE(BZLIB_DELEGATE,1,Define if you have the bzip2 library)
1350            AC_MSG_RESULT([yes])
1351            have_bzlib='yes'
1352        fi
1353    else
1354        AC_MSG_RESULT([no])
1355    fi
1356fi
1357AM_CONDITIONAL(BZLIB_DELEGATE, test "$have_bzlib" = 'yes')
1358AC_SUBST(BZLIB_LIBS)
1359
1360#
1361# Find the X11 include and library directories.
1362#
1363IPC_LIBS=''
1364X11_LIBS=''
1365XEXT_LIBS=''
1366XT_LIBS=''
1367AC_PATH_XTRA
1368if test "$no_x" != 'yes'; then
1369    AC_MSG_RESULT([-------------------------------------------------------------])
1370    AC_MSG_RESULT([Checking for X11 support])
1371    AC_MSG_RESULT([-------------------------------------------------------------])