root/WizardsToolkit/trunk/configure.ac

Revision 511, 41.9 KB (checked in by cristy, 6 days ago)
Line 
1#  Copyright 1999-2009 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.wizards-toolkit.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#  Configure script for building the Wizard Executable Environment.
16
17AC_PREREQ(2.63)
18AC_INIT([WizardsToolkit],[1.0.7],[http://www.wizards-toolkit.org],[WizardsToolkit])
19AC_CONFIG_SRCDIR([wizard/WizardsToolkit.h])
20AC_CONFIG_AUX_DIR([config])
21AC_CONFIG_MACRO_DIR([m4])
22AC_CONFIG_LIBOBJ_DIR([wizard])
23AC_CONFIG_HEADERS([config/config.h])
24AX_PREFIX_CONFIG_H([wizard/wizard-config.h],[WizardsToolkit])
25AC_CONFIG_FILES([\
26  config/configure.xml \
27  config/WizardsToolkit.dox \
28  Makefile \
29  wizard.sh \
30  utilities/cipher-info.1 \
31  utilities/decipher.1 \
32  utilities/digest.1 \
33  utilities/encipher.1 \
34  utilities/keyring.1 \
35  windows/WizardsToolkit.bat \
36  wizard/version.h \
37  wizard/WizardsToolkit-config \
38  wizard/WizardsToolkit.pc \
39  WizardsToolkit.spec ])
40
41#
42# Save initial user-tunable values
43#
44USER_LIBS=$LIBS
45for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS LIBS ; do
46  eval isset=\${$var+set}
47  if test "$isset" = 'set'; then
48    eval val=$`echo $var`
49    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' "
50  fi
51done
52AC_SUBST(DISTCHECK_CONFIG_FLAGS)
53
54CONFIGURE_ARGS="$0 ${ac_configure_args}"
55AC_SUBST(CONFIGURE_ARGS)
56
57# Source file containing package/library versioning information.
58. ${srcdir}/version.sh
59
60echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}${PACKAGE_LIB_SUBVERSION}"
61AC_CANONICAL_TARGET([])
62
63# Substitute library versioning
64AC_SUBST(WIZARD_LIBRARY_CURRENT)dnl
65AC_SUBST(WIZARD_LIBRARY_REVISION)dnl
66AC_SUBST(WIZARD_LIBRARY_AGE)dnl
67
68AC_SUBST(PACKAGE_NAME)dnl
69AC_SUBST(PACKAGE_VERSION)dnl
70AC_SUBST(PACKAGE_RELEASE)dnl
71AC_SUBST(PACKAGE_CHANGE_DATE)dnl
72AC_SUBST(PACKAGE_LIB_VERSION)dnl
73AC_SUBST(PACKAGE_LIB_VERSION_NUMBER)dnl
74AC_SUBST(PACKAGE_RELEASE_DATE)dnl
75AC_SUBST(PACKAGE_LIB_SUBVERSION)dnl
76
77# Substitute CVS branch tag
78AC_SUBST(CVS_BRANCH_TAG)dnl
79
80# Ensure that make can run correctly
81AM_SANITY_CHECK
82
83AM_INIT_AUTOMAKE($PACKAGE_NAME,"${PACKAGE_VERSION}${PACKAGE_LIB_SUBVERSION}", ' ')
84
85# Enable support for silent build rules
86AM_SILENT_RULES([yes])
87
88WIZARD_LIB_VERSION="0x"
89if test ${WIZARD_LIBRARY_CURRENT} -lt 10 ; then
90  WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}0
91fi
92WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}${WIZARD_LIBRARY_CURRENT}
93if test ${WIZARD_LIBRARY_AGE} -lt 10 ; then
94  WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}0
95fi
96WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}${WIZARD_LIBRARY_AGE}
97if test ${WIZARD_LIBRARY_REVISION} -lt 10 ; then
98  WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}0
99fi
100WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}${WIZARD_LIBRARY_REVISION}
101AC_SUBST(WIZARD_LIB_VERSION)
102
103# Definition used to define MagickLibVersionText in version.h
104WIZARD_LIB_VERSION_TEXT="${PACKAGE_VERSION}"
105AC_SUBST(WIZARD_LIB_VERSION_TEXT)
106
107# Definition used to define MagickLibVersionNumber in version.h
108WIZARD_LIB_VERSION_NUMBER="${WIZARD_LIBRARY_CURRENT},${WIZARD_LIBRARY_AGE},${WIZARD_LIBRARY_REVISION}"
109AC_SUBST(WIZARD_LIB_VERSION_NUMBER)
110
111# Regenerate config.status if ChangeLog or version.sh is updated.
112AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/version.sh'])
113
114PERLMAINCC=$CC
115
116WIZARD_CFLAGS=''
117WIZARD_CPPFLAGS=$CPPFLAGS_USER
118WIZARD_PCFLAGS=$CPPFLAGS_USER
119WIZARD_LDFLAGS=''
120WIZARD_LIBS=''
121
122#
123# Evaluate shell variable equivalents to Makefile directory variables
124#
125if test "x$prefix" = xNONE; then
126  prefix=$ac_default_prefix
127fi
128# Let make expand exec_prefix.
129if test "x$exec_prefix" = xNONE; then
130  exec_prefix='${prefix}'
131fi
132
133#
134eval "eval PREFIX_DIR=${prefix}"
135AC_SUBST(PREFIX_DIR)
136eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
137AC_SUBST(EXEC_PREFIX_DIR)
138eval "eval BIN_DIR=$bindir"
139AC_SUBST(BIN_DIR)
140eval "eval SBIN_DIR=$sbindir"
141AC_SUBST(SBIN_DIR)
142eval "eval LIBEXEC_DIR=$libexecdir"
143AC_SUBST(LIBEXEC_DIR)
144eval "eval DATA_DIR=$datadir"
145AC_SUBST(DATA_DIR)
146eval "eval SYSCONF_DIR=$sysconfdir"
147AC_SUBST(SYSCONF_DIR)
148eval "eval SHAREDSTATE_DIR=$sharedstatedir"
149AC_SUBST(SHAREDSTATE_DIR)
150eval "eval LOCALSTATE_DIR=$localstatedir"
151AC_SUBST(LOCALSTATE_DIR)
152eval "eval LIB_DIR=$libdir"
153AC_SUBST(LIB_DIR)
154eval "eval INCLUDE_DIR=$includedir"
155AC_SUBST(INCLUDE_DIR)
156eval "eval OLDINCLUDE_DIR=$oldincludedir"
157AC_SUBST(OLDINCLUDE_DIR)
158eval "eval INFO_DIR=$infodir"
159AC_SUBST(INFO_DIR)
160eval "eval MAN_DIR=$mandir"
161AC_SUBST(MAN_DIR)
162
163# Get full paths to source and build directories
164srcdirfull="`cd $srcdir && pwd`"
165builddir="`pwd`"
166
167#
168# Compute variables useful for running uninstalled software.
169#
170WIZARD_CODER_MODULE_PATH="${builddir}/coders"
171WIZARD_CONFIGURE_SRC_PATH="${srcdirfull}/config"
172WIZARD_CONFIGURE_BUILD_PATH="${builddir}/config"
173WIZARD_FILTER_MODULE_PATH="${builddir}/filters"
174DIRSEP=':'
175case "${build_os}" in
176  mingw* )
177    WIZARD_CODER_MODULE_PATH=`$WinPathScript "${WIZARD_CODER_MODULE_PATH}" 0`
178    WIZARD_CONFIGURE_SRC_PATH=`$WinPathScript "${WIZARD_CONFIGURE_SRC_PATH}" 0`
179    WIZARD_CONFIGURE_BUILD_PATH=`$WinPathScript "${WIZARD_CONFIGURE_BUILD_PATH}" 0`
180    WIZARD_FILTER_MODULE_PATH=`$WinPathScript "${WIZARD_FILTER_MODULE_PATH}" 0`
181    DIRSEP=';'
182    ;;
183esac
184case "${host_os}" in
185  mingw* )
186    DIRSEP=';'
187    ;;
188esac
189AC_SUBST(WIZARD_CODER_MODULE_PATH)
190AC_SUBST(WIZARD_CONFIGURE_SRC_PATH)
191AC_SUBST(WIZARD_CONFIGURE_BUILD_PATH)
192AC_SUBST(WIZARD_FILTER_MODULE_PATH)
193AC_SUBST(DIRSEP)
194
195# Check for programs
196AC_PROG_CC
197AC_PROG_CPP
198AC_PROG_LD
199AC_SUBST(LD)
200AM_PROG_CC_C_O
201AC_PROG_INSTALL
202AC_PROG_MAKE_SET
203AC_PROG_RANLIB
204AC_COMPILE_WARNINGS
205AC_PROG_LN_S
206AM_WITH_DMALLOC
207PKG_PROG_PKG_CONFIG
208
209#
210# Enable OS features.
211#
212AC_GNU_SOURCE
213
214#
215# Tests for Windows
216#
217AC_EXEEXT
218AC_OBJEXT
219
220GDI32_LIBS=''
221StaticCplusPlusLibraries='no'
222native_win32_build='no'
223cygwin_build='no'
224case "${host_os}" in
225  cygwin* )
226    StaticCplusPlusLibraries='yes'
227    cygwin_build='yes'
228    GDI32_LIBS='-lgdi32'
229    ;;
230  mingw* )
231    StaticCplusPlusLibraries='yes'
232    native_win32_build='yes'
233    GDI32_LIBS='-lgdi32'
234    ;;
235esac
236if test "${GDI32_LIBS}x" != 'x'; then
237  AC_DEFINE(HasWINGDI32,1,Define to use the Windows GDI32 library)
238fi
239AC_SUBST(GDI32_LIBS)
240AM_CONDITIONAL(HasWINGDI32, test "${GDI32_LIBS}x" != 'x' )
241AM_CONDITIONAL(WIN32_NATIVE_BUILD, test "${native_win32_build}" = 'yes' )
242AM_CONDITIONAL(CYGWIN_BUILD, test "${cygwin_build}" = 'yes' )
243AM_CONDITIONAL(USING_CL, test "x${CC}" = 'xcl.exe' )
244
245WinPathScript="${srcdirfull}/winpath.sh"
246AC_SUBST(WinPathScript)
247
248#
249# Compiler flags tweaks
250#
251if test "${GCC}" != "yes"; then
252  case "${host}" in
253    *-*-hpux* )
254      # aCC: HP ANSI C++ B3910B A.03.34
255      CFLAGS="${CFLAGS} -Wp,-H30000"
256      if test -n "${CXXFLAGS}"; then
257        CXXFLAGS='-AA'
258      else
259        CXXFLAGS="${CXXFLAGS} -AA"
260      fi
261      ;;
262    *-dec-osf5.* )
263      # Compaq alphaev68-dec-osf5.1 compiler
264      if test -n "${CXXFLAGS}"; then
265        CXXFLAGS='-std strict_ansi -noimplicit_include'
266      else
267        CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
268      fi
269  esac
270fi
271
272# Check for lazy-loading.
273AC_CACHE_CHECK([for linker lazyload option],[wt_cv_ld_lazyload],
274[
275wt_cv_ld_lazyload='none'
276case "${host}" in
277  *-*-solaris2.8 | *-*-solaris2.9 | *-*-solaris2.1? )
278    if test "$lt_cv_prog_gnu_ld" != 'yes' ; then
279       wt_cv_ld_lazyload='-Wl,-zlazyload'
280    fi
281    ;;
282esac
283])
284if test "${wt_cv_ld_lazyload}" != 'none' ; then
285  if test -z "${LDFLAGS}" ; then
286    LDFLAGS="${wt_cv_ld_lazyload}"
287  else
288    LDFLAGS="${wt_cv_ld_lazyload} ${LDFLAGS}"
289  fi
290fi
291
292dnl Platform-specific stuff
293case "$host" in
294*-darwin* | *-macos10*)
295  if test -d /opt/local ; then
296    CPPFLAGS="$CPPFLAGS -I/opt/local/include"
297    LDFLAGS="$LDFLAGS -L/opt/local/lib"
298  elif test -d /sw ; then
299    CPPFLAGS="$CPPFLAGS -I/sw/include"
300    LDFLAGS="$LDFLAGS -L/sw/lib"
301  fi
302  dnl OS X universal binary support, requires --disable-dependency-tracking
303  AC_ARG_ENABLE(osx-universal-binary,
304        AC_HELP_STRING([--enable-osx-universal-binary],
305           [build universal binary on OS X [[default=no]]]),
306        [build_osxuniversal="${enableval}"], [build_osxuniversal=no])
307 
308  if test "${build_osxuniversal}" != no ; then
309    if test "$enable_dependency_tracking" != no ; then
310      AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
311Please re-run configure with these options:
312  --disable-dependency-tracking --enable-osx-universal-binary
313        ])
314    fi
315    CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
316    CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
317    LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
318  fi
319  ;;
320esac
321
322# Enable support for threads
323AC_ARG_WITH([threads],
324    [AC_HELP_STRING([--without-threads],
325                    [disable threads support])],
326    [with_threads=$withval],
327    [with_threads='yes'])
328
329have_threads=no
330if test "$with_threads" != 'no'; then
331    ACX_PTHREAD()
332    if test "$acx_pthread_ok" = yes; then
333        have_threads=yes
334        DEF_THREAD="$PTHREAD_CFLAGS"
335        CFLAGS="$CFLAGS $DEF_THREAD"
336        CXXFLAGS="$CXXFLAGS $DEF_THREAD"
337        if test "$CC" != "$PTHREAD_CC"; then
338            AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
339            CC="$PTHREAD_CC"
340        fi
341    fi
342fi
343
344# Enable support for OpenMP
345if test "$have_threads" != 'yes'; then
346  ac_cv_prog_c_openmp=unsupported
347fi
348AC_OPENMP([C])
349CFLAGS="$OPENMP_CFLAGS $CFLAGS"
350WIZARD_PCFLAGS="$WIZARD_PCFLAGS $OPENMP_CFLAGS"
351AC_SUBST(OPENMP_CFLAGS)
352
353########
354#
355# Check for large file support
356#
357########
358AC_SYS_LARGEFILE
359AC_FUNC_FSEEKO
360LFS_CPPFLAGS=''
361if test "$enable_largefile" != no; then
362  if test "$ac_cv_sys_file_offset_bits" != 'no'; then
363    LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
364  else
365    AC_MSG_CHECKING([for native large file support])
366    AC_RUN_IFELSE([#include <unistd.h>
367      main () {
368      exit(!(sizeof(off_t) == 8));
369    }],
370    [ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
371     AC_MSG_RESULT([yes])],
372    [AC_MSG_RESULT([no])])
373  fi
374  if test "$ac_cv_sys_large_files" != 'no'; then
375    LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
376  fi
377  if test "$ac_cv_sys_largefile_source" != 'no'; then
378    LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
379  fi
380fi
381AC_SUBST(LFS_CPPFLAGS)
382
383# Configure libtool
384AC_LIBTOOL_DLOPEN
385LT_INIT([disable-shared win32-dll])
386LT_LANG([C++])
387AC_SUBST(LIBTOOL_DEPS)
388
389# Check to see if building shared libraries
390libtool_build_shared_libs='no'
391if test "$enable_shared" = 'yes'; then
392  libtool_build_shared_libs='yes'
393fi
394
395# Check to see if building static libraries
396libtool_build_static_libs='no'
397if test "$enable_static" = 'yes'; then
398  libtool_build_static_libs='yes'
399fi
400
401# MinGW and Cygwin can't build C++ DLLs which support exceptions.
402if test "${StaticCplusPlusLibraries}" = 'yes'; then
403  LTCXXLIBOPTS='--static'
404  AC_SUBST(LTCXXLIBOPTS)
405fi
406
407# Enable build using delegate libraries built in subdirectories rather than installed
408# delegate libraries (bzlib fpx jasper jbig jpeg lcms png tiff ttf wmf xml zlib)
409AC_ARG_ENABLE([delegate-build],
410    [AC_HELP_STRING([--enable-delegate-build],
411                    [look for delegate libraries in build directory])],
412    [enable_delegate_build=$enableval],
413    [enable_delegate_build='yes'])
414
415# Build a version of Wizard which operates uninstalled.
416# Used to build distributions located via WIZARD_HOME / executable path
417AC_ARG_ENABLE([installed],
418    [AC_HELP_STRING([--disable-installed],                    [Formally install Wizard's Toolkit under PREFIX])],
419    [enable_installed=$enableval],
420    [enable_installed='yes'])
421
422if test "$enable_installed" = 'yes'; then
423  AC_DEFINE(INSTALLED_SUPPORT,1,[Wizard's Toolkit is formally installed under prefix])
424else
425  DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
426fi
427
428# Build an embeddable version of Wizard's Toolkit.
429AC_ARG_ENABLE([embeddable],
430    [AC_HELP_STRING([--enable-embeddable],
431                    [enable self-contained, embeddable, zero-configuration Wizard's Toolkit])],
432    [enable_embeddable=$enableval],
433    [enable_embeddable='no'])
434
435if test "$with_embeddable" = 'yes'; then
436  AC_DEFINE(EMBEDDABLE_SUPPORT,1,[Build self-contained, embeddable, zero-configuration Wizard's Toolkit (experimental)])
437fi
438
439# Build a version of Wizard with assert statements.
440AC_ARG_ENABLE([assert],
441    [AC_HELP_STRING([--disable-assert],
442                    [disable assert() statements in build])],
443    [enable_assert=$enableval],
444    [enable_assert='yes'])
445
446if test "$enable_assert" = 'no'; then
447  AC_DEFINE(NDEBUG,1,[Turn off assert statements])
448fi
449
450# Add configure option --enable-maintainer-mode which enables dependency
451# checking and generation useful to package maintainers.  This is made an
452# option to avoid confusing end users.
453AM_MAINTAINER_MODE
454
455# Enable Wizard Debugging
456AC_ARG_ENABLE([debug],
457    [AC_HELP_STRING([--disable-debug],
458                    [disable Wizard Executable Environment debugging])],
459    [enable_debug=$enableval],
460    [enable_debug='yes'])
461
462if test "$enable_debug" = 'yes'; then
463  AC_DEFINE(Debug,1,[Enable Wizard Executable Environment debugging])
464fi
465
466# Enable ccmalloc memory debugging support
467AC_ARG_ENABLE([ccmalloc],
468    [AC_HELP_STRING([--enable-ccmalloc],
469                    [enable 'ccmalloc' memory debug support])],
470    [enable_ccmalloc=$enableval],
471    [enable_ccmalloc='no'])
472
473# Enable Electric Fence memory debugging support
474AC_ARG_ENABLE([efence],
475    [AC_HELP_STRING([--enable-efence],
476                    [enable 'efence' memory debug support])],
477    [enable_efence=$enableval],
478    [enable_efence='no'])
479
480# Enable prof-based profiling support
481AC_ARG_ENABLE([prof],
482    [AC_HELP_STRING([--enable-prof],
483                    [enable 'prof' profiling support])],
484    [enable_prof=$enableval],
485    [enable_prof='no'])
486
487# Enable gprof-based profiling support
488AC_ARG_ENABLE([gprof],
489    [AC_HELP_STRING([--enable-gprof],
490                    [enable 'gprof' profiling support])],
491    [enable_gprof=$enableval],
492    [enable_gprof='no'])
493
494# Enable gcov-based profiling support
495AC_ARG_ENABLE([gcov],
496    [AC_HELP_STRING([--enable-gcov],
497                    [enable 'gcov' profiling support])],
498    [enable_gcov=$enableval],
499    [enable_gcov='no'])
500
501with_profiling='no'
502if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
503  with_profiling='yes'
504
505  if test "$libtool_build_shared_libs" = 'yes'; then
506    echo "Warning: Can not profile code using shared libraries"
507  fi
508fi
509
510# Wizard API method prefix
511AC_ARG_WITH([method-prefix],
512    [AC_HELP_STRING([--with-method-prefix=PREFIX],
513                    [prefix Wizard's Toolkit API methods])],
514    [with_method_prefix=$enableval],
515    [with_method_prefix=''])
516
517if test "$with_method_prefix" != ''; then
518  AC_DEFINE_UNQUOTED(WizardMethodPrefix,$with_method_prefix,[Wizard API method prefix])
519fi
520
521# Disable BZLIB (bzip2 library)
522AC_ARG_WITH([bzlib],
523    [AC_HELP_STRING([--without-bzlib],                    [disable BZLIB support])],
524    [with_bzlib=$withval],
525    [with_bzlib='yes'])
526
527if test "$with_bzlib" != 'yes'; then
528    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-bzlib=$with_bzlib "
529fi
530
531# Enable umem, object-caching memory allocation library.
532AC_ARG_WITH(umem,
533        [  --with-umem             enable umem memory allocation library support],
534        [with_umem=$withval],
535        [with_umem='no'])
536if test "$with_umem" != 'yes' ; then
537    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-umem=$with_umem "
538fi
539
540AC_ARG_WITH([zlib],
541    [AC_HELP_STRING([--without-zlib],
542                    [disable ZLIB support])],
543    [with_zlib=$withval],
544    [with_zlib='yes'])
545
546if test "$with_zlib" != 'yes'; then
547    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-zlib=$with_zlib "
548fi
549
550#
551# Specify path to shared libstdc++ if not in normal location
552#
553AC_ARG_WITH([libstdc],
554    [AC_HELP_STRING([--with-libstdc=DIR],
555                    [ use libstdc++ in DIR (for GNU C++)])],
556    [with_libstdc=$withval],
557    [with_libstdc=''])
558
559if test "$with_libstdc" != ''; then
560    if test -d "$with_libstdc"; then
561        LIBSTDCLDFLAGS="-L$with_libstdc"
562    fi
563fi
564AC_SUBST(LIBSTDCLDFLAGS)
565
566# Does gcc required -traditional?
567AC_PROG_GCC_TRADITIONAL
568
569########
570#
571# Set defines required to build DLLs and modules using MinGW
572#
573########
574# These options are set for multi-thread DLL module build
575#  libWizard:           _DLL _WIZARDMOD_ _WIZARDLIB_
576#  module:              _DLL
577#  executable/Wizard++: _DLL _WIZARDMOD_
578MODULE_EXTRA_CPPFLAGS=''
579LIBRARY_EXTRA_CPPFLAGS=''
580if test "${native_win32_build}" = 'yes'; then
581  if test "${libtool_build_shared_libs}" = 'yes'; then
582    CPPFLAGS="$CPPFLAGS -D_DLL"
583    WIZARD_CPPFLAGS="$WIZARD_CPPFLAGS -D_DLL"
584    WIZARD_PCFLAGS="$WIZARD_PCFLAGS -D_DLL"
585    LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_WIZARDLIB_"
586
587    if test "$with_modules" = 'yes'; then
588      LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_WIZARDMOD_"
589    else
590      MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_WIZARDLIB_"
591    fi
592
593  else
594    CPPFLAGS="$CPPFLAGS -D_LIB"
595    WIZARD_CPPFLAGS="$WIZARD_CPPFLAGS -D_LIB"
596    WIZARD_PCFLAGS="$WIZARD_PCFLAGS -D_LIB"
597
598  fi
599  if test "$with_threads" = 'yes'; then
600     CPPFLAGS="$CPPFLAGS -D_MT"
601     WIZARD_CPPFLAGS="$WIZARD_CPPFLAGS -D_MT"
602     WIZARD_PCFLAGS="$WIZARD_PCFLAGS -D_MT"
603  fi
604fi
605AC_SUBST(MODULE_EXTRA_CPPFLAGS)
606AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
607
608# Check standard headers
609AC_HEADER_STDC
610if ! test x"$ac_cv_header_stdc" = x"yes"; then
611  AC_MSG_WARN([configure has detected that you do not have the ANSI standard C
612    header files.  Compilation cannot proceed.  Please install the ANSI C
613    headers and rerun this script.]);
614fi
615AC_HEADER_DIRENT
616
617# Check additional headers
618AC_CHECK_HEADERS(argz.h arm/limits.h fcntl.h limits.h linux/unistd.h locale.h mach-o/dyld.h machine/param.h malloc.h stdarg.h sys/syslimits.h sys/resource.h sys/time.h sys/timeb.h sys/times.h sys/types.h sys/utime.h termios.h unistd.h utime.h)
619
620########
621#
622# Checks for typedefs, structures, and compiler characteristics.
623#
624########
625
626AC_HEADER_STDBOOL
627AC_C_VOLATILE
628AC_C_STRINGIZE
629AC_HEADER_STAT
630AC_HEADER_TIME
631AC_STRUCT_TM
632AC_SYS_INTERPRETER
633
634# If the C compiler does not fully support the ANSI C qualifier const,
635# define const to be empty.
636AC_C_CONST
637
638# If the C compiler supports the keyword inline, do nothing. Otherwise
639# define inline to __inline__ or __inline if it accepts one of those,
640# otherwise define inline to be empty.
641AC_C_INLINE
642
643# If the C compiler supports the keyword restrict, do nothing. Otherwise
644# define restrict to __restrict__ or __restrict if it accepts one of those,
645# otherwise define restrict to be empty.
646AC_C_RESTRICT
647
648# If words are stored with the most significant byte first (like
649# Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
650AC_C_BIGENDIAN
651
652# Define mode_t to a suitable type, if standard headers do not define it.
653AC_TYPE_MODE_T
654
655# Define off_t to a suitable type, if standard headers do not define it.
656AC_TYPE_OFF_T
657
658# Define pid_t to a suitable type, if standard headers do not define it.
659AC_TYPE_PID_T
660
661# Define size_t to a suitable type, if standard headers do not define it.
662AC_TYPE_SIZE_T
663
664# Define ssize_t to a suitable type, if standard headers do not define it.
665AC_TYPE_SSIZE_T
666
667# If the C compiler supports a working long double type with more range
668# or precision than the double type, define HAVE_LONG_DOUBLE.
669AC_TYPE_LONG_DOUBLE_WIDER
670
671# If the C type char is unsigned, define __CHAR_UNSIGNED__, unless the
672# C compiler predefines it.
673AC_C_CHAR_UNSIGNED
674
675# Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
676AC_CHECK_SIZEOF(signed short)
677
678# Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
679AC_CHECK_SIZEOF(unsigned short)
680
681# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
682AC_CHECK_SIZEOF(signed int)
683
684# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
685AC_CHECK_SIZEOF(unsigned int)
686
687# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
688AC_CHECK_SIZEOF(signed long)
689
690# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
691AC_CHECK_SIZEOF(unsigned long)
692
693# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.  If
694# 'signed long long' is not supported then the value defined is zero.
695AC_CHECK_SIZEOF(signed long long)
696
697# Obtain size of a 'unsigned long long' and define as
698# SIZEOF_UNSIGNED_LONG_LONG.  If 'unsigned long long' is not
699# supported then the value defined is zero.
700AC_CHECK_SIZEOF(unsigned long long)
701
702# Obtain size of off_t and define as SIZEOF_OFF_T
703AC_CHECK_SIZEOF(off_t)
704
705# Obtain size of size_t and define as SIZEOF_SIZE_T
706AC_CHECK_SIZEOF(size_t)
707
708# Obtain size of an unsigned int pointer and define as SIZEOF_UNSIGNED_INTP
709AC_CHECK_SIZEOF(unsigned int*)
710
711#
712# Compute sized types for current CPU and compiler options.
713#
714AC_MSG_CHECKING(for signed 8-bit type)
715INT8_T='signed char'
716AC_MSG_RESULT($INT8_T)
717AC_SUBST(INT8_T)
718
719AC_MSG_CHECKING(for unsigned 8-bit type)
720UINT8_T='unsigned char'
721AC_MSG_RESULT($UINT8_T)
722AC_SUBST(UINT8_T)
723
724AC_MSG_CHECKING(for signed 16-bit type)
725INT16_T='signed short'
726AC_MSG_RESULT($INT16_T)
727AC_SUBST(INT16_T)
728
729AC_MSG_CHECKING(for unsigned 16-bit type)
730UINT16_T='unsigned short'
731AC_MSG_RESULT($UINT16_T)
732AC_SUBST(UINT16_T)
733
734AC_MSG_CHECKING(for signed 32-bit type)
735INT32_T='none'
736if test $ac_cv_sizeof_signed_int -eq 4; then
737  INT32_T='signed int'
738elif test $ac_cv_sizeof_signed_long -eq 4; then
739  INT32_T='signed long'
740fi
741AC_MSG_RESULT($INT32_T)
742AC_SUBST(INT32_T)
743
744AC_MSG_CHECKING(for unsigned 32-bit type)
745UINT32_T='none'
746if test $ac_cv_sizeof_unsigned_int -eq 4; then
747  UINT32_T='unsigned int'
748elif test $ac_cv_sizeof_unsigned_long -eq 4; then
749  UINT32_T='unsigned long'
750fi
751AC_MSG_RESULT($UINT32_T)
752AC_SUBST(UINT32_T)
753
754AC_MSG_CHECKING(for signed 64-bit type)
755INT64_T='none'
756if test $ac_cv_sizeof_signed_long -eq 8; then
757  INT64_T='signed long'
758elif test $ac_cv_sizeof_signed_long_long -eq 8; then
759  INT64_T='signed long long'
760fi
761AC_MSG_RESULT($INT64_T)
762AC_SUBST(INT64_T)
763
764AC_MSG_CHECKING(for unsigned 64-bit type)
765UINT64_T='none'
766if test $ac_cv_sizeof_unsigned_long -eq 8; then
767  UINT64_T='unsigned long'
768elif test $ac_cv_sizeof_unsigned_long_long -eq 8; then
769  UINT64_T='unsigned long long'
770fi
771AC_MSG_RESULT($UINT64_T)
772AC_SUBST(UINT64_T)
773
774AC_MSG_CHECKING(for unsigned maximum type)
775UINTMAX_T='none'
776if test "$UINT64_T" != 'none'; then
777  UINTMAX_T=$UINT64_T
778elif test "$UINT32_T" != 'none'; then
779  UINTMAX_T=$UINT32_T
780fi
781AC_MSG_RESULT($UINTMAX_T)
782AC_SUBST(UINTMAX_T)
783
784AC_MSG_CHECKING(for pointer difference type)
785UINTPTR_T='none'
786if test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_unsigned_intp; then
787  UINTPTR_T='unsigned long'
788elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_unsigned_intp; then
789  UINTPTR_T='unsigned long long'
790fi
791AC_MSG_RESULT($UINTPTR_T)
792AC_SUBST(UINTPTR_T)
793
794# Test for C compiler __func__ support
795AC_MSG_CHECKING([whether our compiler supports __func__])
796AC_TRY_COMPILE([],
797 [{ const char *func = __func__; return(func != 0 ? 0 : 1); }],
798 AC_MSG_RESULT([yes]),
799 AC_MSG_RESULT([no])
800 AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
801 AC_TRY_COMPILE([],
802   [{ const char *func = __FUNCTION__; return(func != 0 ? 0 : 1); }],
803   AC_MSG_RESULT([yes])
804   AC_DEFINE(__func__, __FUNCTION__,
805     [Define to appropriate substitue if compiler does not have __func__]),
806   AC_MSG_RESULT([no])
807   AC_DEFINE(__func__, __FILE__,
808     [Define to appropriate substitue if compiler does not have __func__])))
809
810########
811#
812# Check for functions
813#
814########
815WIZARD_FUNC_MMAP_FILEIO
816AC_FUNC_VPRINTF
817AC_FUNC_STRTOD
818AC_FUNC_MMAP
819AC_FUNC_MEMCMP
820AC_FUNC_MKTIME
821AC_FUNC_CLOSEDIR_VOID
822AC_FUNC_STAT
823AC_CHECK_FUNCS([atexit clock ftime getcwd getexecname getdtablesize getpid getpagesize getrusage gettimeofday gmtime_r isascii localtime_r lstat madvise memmove memset mkdir munmap mkstemp _NSGetExecutablePath pclose poll popen posix_fallocate posix_memalign pow pread pwrite raise readdir_r readlink realpath sbrk select strerror_r setvbuf sysconf sigemptyset sigaction strlcat strlcpy strcasecmp strncasecmp setlocale strchr strcspn strdup strrchr strspn strstr strtol times usleep utime vsprintf vsnprintf _wfopen])
824
825#
826# Check for clock_gettime().
827#
828AC_SEARCH_LIBS(clock_gettime, rt,
829[
830  AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define to 1 if you have clock_gettime.])
831  AC_MSG_CHECKING([whether clock_gettime supports CLOCK_REALTIME])
832  AC_COMPILE_IFELSE(
833    AC_LANG_PROGRAM(
834      [[#include <time.h>]],
835       [[clockid_t clockType = CLOCK_REALTIME;]]),
836      [
837        AC_MSG_RESULT(yes)
838        AC_DEFINE([HAVE_CLOCK_REALTIME],[1],
839          [Define to 1 if clock_gettime supports CLOCK_REALTIME.])
840      ],
841      AC_MSG_RESULT(no)
842    )
843  ],
844  [
845    AC_CHECK_FUNCS([gettimeofday ftime], [break])
846  ]
847)
848########
849#       
850# Check for function prototypes
851#
852########
853
854AC_CHECK_DECLS([pread, pwrite],[],[],[
855#include <unistd.h>])
856
857AC_CHECK_DECLS([strlcpy],[],[],[
858#include <strings.h>])
859
860AC_CHECK_DECLS([vsnprintf],[],[],[
861#include <stdio.h>
862#include <stdarg.h>])
863
864########
865#
866# C++ Support Tests (For Wizard++)
867#
868########
869have_wizard_plus_plus='no'
870if test "$with_wizard_plus_plus" = 'yes'; then
871 OLIBS="$LIBS"
872 LIBS=''
873 AC_LANG_PUSH(C++)
874
875# Full set of headers used ...
876# algorithm cctype cerrno cmath cstdio cstdlib cstring ctime exception
877# functional iomanip iosfwd iostream iterator list string strstream utility
878 AC_LANG([C++])
879 AC_PROG_CXX
880 AC_CXX_HAVE_BOOL
881 AC_CXX_HAVE_NAMESPACES
882 AC_CXX_HAVE_STD_NAMESPACE
883 AC_CXX_HAVE_STD_LIBS
884 AC_CXX_HAVE_LSTRING
885 AC_LANG_POP
886
887 AC_MSG_CHECKING([whether C++ compiler is sufficient for the Wizard's Toolkit])
888 if \
889  test $ac_cv_cxx_have_bool = 'yes' && \
890  test $ac_cv_cxx_have_lstring = 'yes' && \
891  test $ac_cv_cxx_have_namespaces = 'yes' && \
892  test $ac_cv_cxx_have_std_libs = 'yes' && \
893  test $ac_cv_cxx_have_std_namespace = 'yes'; then
894    have_wizard_plus_plus='yes'
895 else
896    have_wizard_plus_plus='no (failed tests)'
897 fi
898 AC_MSG_RESULT([$have_wizard_plus_plus])
899 LIBS="$OLIBS"
900fi
901AM_CONDITIONAL(WITH_WIZARD_PLUS_PLUS, test "$have_wizard_plus_plus" = 'yes')
902
903# Only check for delegate libraries in subdirectories if requested.
904if test "$with_delegate_build" != 'no'; then
905  # Check for delegate sub-directories and add -I & -L options as required.
906  # This presumes that delegates are installed as detailed in the ImageMagick
907  # README. If delegates are installed in a standard location where the
908  # compiler will automatically find them then these options should not be
909  # required.
910
911  #
912  # Most delegates have includes in the same directory as the library, but not all ...
913  #
914  # Includes
915  for dir in bzlib zlib
916  do
917    if test -d "$builddir/$dir"; then
918      CPPFLAGS="$CPPFLAGS -I$builddir/$dir"
919    else
920      if test -d "$srcdirfull/$dir"; then
921        CPPFLAGS="$CPPFLAGS -I$srcdirfull/$dir"
922      fi
923    fi
924  done
925
926  # Libraries
927  for dir in bzlib zlib
928  do
929    if test -d "$builddir/$dir/.libs"; then
930      LDFLAGS="$LDFLAGS -L$builddir/$dir/.libs"
931    else
932      if test -d "$srcdirfull/$dir/.libs"; then
933        LDFLAGS="$LDFLAGS -L$srcdirfull/$dir/.libs"
934      fi
935    fi
936    if test -d "$builddir/$dir"; then
937      LDFLAGS="$LDFLAGS -L$builddir/$dir"
938    else
939      if test -d "$srcdirfull/$dir"; then
940        LDFLAGS="$LDFLAGS -L$srcdirfull/$dir"
941      fi
942    fi
943  done
944fi
945
946# Assume that delegate headers reside under same directory as Wizard's
947# Toolkit installation prefix.
948WIZARD_CPPFLAGS="-I$INCLUDE_DIR/WizardsToolkit $WIZARD_CPPFLAGS"
949
950#
951# Find OpenMP library
952#
953GOMP_LIBS=''
954if test "$enable_openmp" != 'no'; then
955  if test "${GCC}" = "yes"; then
956    AC_CHECK_LIB(gomp,GOMP_parallel_start,GOMP_LIBS="-lgomp",,)  # gcc
957  else
958    AC_CHECK_LIB(mtsk,sunw_mp_register_warn,GOMP_LIBS="-lmtsk",,)  # solaris cc
959    AC_CHECK_LIB(xlsmp,_xlsmpFlush,GOMP_LIBS="-lxlsmp",,)  # AIX xlc
960    AC_CHECK_LIB(mp,mp_destroy,GOMP_LIBS="-lmp",,)  # SGI IRIX 6.5 MIPSpro C/C++
961  fi
962  LIBS="$GOMP_LIBS $LIBS"
963fi
964AC_SUBST(GOMP_LIBS)
965
966#
967# Find Posix threads library
968#
969THREAD_LIBS=''
970if test "$with_threads" != 'no' && test "$have_threads" = 'yes'; then
971
972  if test "x$PTHREAD_LIBS" = "x"; then
973    case "${host_cpu}-${host_os}" in
974      *-freebsd*)
975        WIZARD_CHECK_PTHREAD_LIB(c_r,PTHREAD_LIBS=-lc_r) ;;
976    esac
977  fi
978
979  for lib in pthread pthreads
980  do
981    if test "x$PTHREAD_LIBS" = "x"; then
982      WIZARD_CHECK_PTHREAD_LIB([$lib],[PTHREAD_LIBS=-l$lib])
983    fi
984  done
985
986  THREAD_LIBS="$PTHREAD_LIBS"
987  LIBS="$LIBS $THREAD_LIBS"
988fi
989AC_SUBST(THREAD_LIBS)
990
991#
992# Check for umem.
993#
994have_umem='no'
995UMEM_LIBS=''
996if test "$with_umem" != 'no'; then
997  AC_MSG_CHECKING(for UMEM support )
998  AC_MSG_RESULT()
999  failed=0
1000  passed=0
1001  AC_CHECK_HEADER(umem.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1002  AC_CHECK_LIB(umem,umem_alloc,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1003  AC_CHECK_LIB(umem,umem_free,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1004  AC_MSG_CHECKING(if umem memory allocation library is complete)
1005  if test $passed -gt 0; then
1006    if test $failed -gt 0; then
1007      AC_MSG_RESULT(no -- some components failed test)
1008      have_umem='no (failed tests)'
1009    else
1010      UMEM_LIBS='-lumem'
1011      LIBS="$UMEM_LIBS $LIBS"
1012      AC_DEFINE(HasUMEM,1,Define if you have umem memory allocation library)
1013      AC_MSG_RESULT(yes)
1014      have_umem='yes'
1015    fi
1016  else
1017    AC_MSG_RESULT(no)
1018  fi
1019fi
1020AM_CONDITIONAL(HasUMEM, test "$have_umem" = 'yes')
1021AC_SUBST(UMEM_LIBS)
1022
1023#
1024# Add support for ccmalloc memory debugging library if requested
1025#
1026have_ccmalloc='no'
1027CCMALLOC_LIBS=''
1028if test "$enable_ccmalloc" = 'yes'; then
1029  AC_PATH_PROG(CCMALLOCDelegate,ccmalloc,)
1030  if test -n "$CCMALLOCDelegate"; then
1031    eval `grep PREFIX= $CCMALLOCDelegate | sed -e 's/PREFIX/CCMALLOC_PREFIX/'`
1032    OLIBS="$LIBS"
1033    # Assume that gcc is used with ccmalloc.
1034    LIBS="$LIBS $CCMALLOC_PREFIX/lib/ccmalloc-gcc.o"
1035    AC_CHECK_LIB(ccmalloc,ccmalloc_malloc,CCMALLOC_LIBS="$CCMALLOC_PREFIX/lib/ccmalloc-gcc.o -lccmalloc -ldl",,-ldl)
1036    if test -n "$CCMALLOC_LIBS"; then
1037      LIBS="$OLIBS"
1038      LIBS="$LIBS $CCMALLOC_LIBS"
1039      have_ccmalloc='yes'
1040     else
1041      LIBS="$OLIBS"
1042    fi
1043  fi
1044fi
1045
1046#
1047# Add support for efence memory debugging library if requested
1048#
1049if test "$enable_efence" = 'yes'; then
1050  EFENCE_LIBS='-lefence'
1051  LIBS="$EFENCE_LIBS $LIBS"
1052fi
1053
1054#
1055# Find math library
1056#
1057MATH_LIBS=''
1058AC_CHECK_LIB(m,sqrt,MATH_LIBS="-lm",,)
1059LIBS="$MATH_LIBS $LIBS"
1060AC_SUBST(MATH_LIBS)
1061
1062#
1063# Check for ZLIB
1064#
1065have_zlib='no'
1066ZLIB_LIBS=''
1067dnl PNG requires zlib so enable zlib check if PNG is requested
1068if test "$with_zlib" != 'no' || test "$with_png" != 'no'; then
1069  AC_MSG_RESULT([-------------------------------------------------------------])
1070  AC_MSG_CHECKING(for ZLIB)
1071  AC_MSG_RESULT([])
1072  failed=0
1073  passed=0
1074  AC_CHECK_HEADER(zconf.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1075  AC_CHECK_HEADER(zlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1076  AC_CHECK_LIB(z,compress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1077  AC_CHECK_LIB(z,uncompress,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1078  AC_CHECK_LIB(z,deflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1079  AC_CHECK_LIB(z,deflateBound,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1080  AC_CHECK_LIB(z,inflate,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1081  AC_CHECK_LIB(z,gzseek,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1082  AC_CHECK_LIB(z,gztell,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
1083  AC_MSG_CHECKING([if ZLIB package is complete])
1084  if test $passed -gt 0; then
1085    if test $failed -gt 0; then
1086      AC_MSG_RESULT([no -- some components failed test])
1087      have_zlib='no (failed tests)'
1088    else
1089      ZLIB_LIBS='-lz'
1090      LIBS="$ZLIB_LIBS $LIBS"
1091      AC_DEFINE(ZLIB_DELEGATE,1,Define if you have zlib compression library)
1092      AC_MSG_RESULT([yes])
1093      have_zlib='yes'
1094    fi
1095  else
1096    AC_MSG_RESULT([no])
1097  fi
1098fi
1099AM_CONDITIONAL(ZLIB_DELEGATE, test "$have_zlib" = 'yes')
1100AC_SUBST(ZLIB_LIBS)
1101
1102#
1103# Check for BZLIB
1104#
1105have_bzlib='no'
1106if test "$with_bzlib" != 'no'; then
1107    BZLIB_LIBS=''
1108    AC_MSG_RESULT([-------------------------------------------------------------])
1109    AC_MSG_CHECKING(for BZLIB)
1110    AC_MSG_RESULT([])
1111    failed=0
1112    passed=0
1113    found_libbz=0
1114    AC_CHECK_HEADER(bzlib.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`)
1115    AC_CHECK_LIB(bz2,BZ2_bzDecompress,found_libbz=`expr $found_libbz + 1`,,)
1116    if test "$native_win32_build" = 'yes'; then
1117      AC_CHECK_LIB(bz2,_imp__BZ2_decompress,found_libbz=`expr $found_libbz + 1`,,)
1118    fi
1119    if test $found_libbz -gt 0; then
1120      passed=`expr $passed + 1`
1121    else
1122      failed=`expr $failed + 1`
1123    fi
1124    AC_MSG_CHECKING(if BZLIB package is complete)
1125    if test $passed -gt 0; then
1126      if test $failed -gt 0; then
1127        AC_MSG_RESULT(no -- some components failed test)
1128        have_bzlib='no (failed tests)'
1129      else
1130        BZLIB_LIBS='-lbz2'
1131        LIBS="$BZLIB_LIBS $LIBS"
1132        AC_DEFINE(BZLIB_DELEGATE,1,Define if you have the bzip2 library)
1133        AC_MSG_RESULT(yes)
1134        have_bzlib='yes'
1135      fi
1136    else
1137      AC_MSG_RESULT(no)
1138    fi
1139fi
1140AM_CONDITIONAL(BZLIB_DELEGATE, test "$have_bzlib" = 'yes')
1141AC_SUBST(BZLIB_LIBS)
1142
1143#
1144# If profiling, then check for -ldl and dlopen (required for Solaris & gcc)
1145#
1146LIB_DL=''
1147if test "$with_profiling" = 'yes'; then
1148  AC_CHECK_LIB(dl,dlopen,LIB_DL='-ldl',,)
1149  LIBS="$LIB_DL $LIBS"
1150fi
1151AC_SUBST(LIB_DL)
1152
1153#
1154# Find per;.
1155#
1156AC_CACHE_CHECK(for perl,ac_cv_path_PERL,ac_cv_path_PERL="$with_perl");
1157PERL=$ac_cv_path_PERL
1158AC_SUBST(PERL)dnl
1159
1160#
1161# Configure install Paths
1162#
1163
1164# Subdirectory under lib to place Wizard lib files
1165LIBRARY_RELATIVE_PATH="${PACKAGE_NAME}-${PACKAGE_VERSION}"
1166AC_DEFINE_UNQUOTED(LIBRARY_RELATIVE_PATH,"$LIBRARY_RELATIVE_PATH",Subdirectory of lib where Wizard architecture dependent files are installed)
1167
1168# Path to Wizard bin directory
1169EXECUTABLE_PATH="${BIN_DIR}"
1170DEFINE_EXECUTABLE_PATH="${BIN_DIR}/"
1171case "${build_os}" in
1172  mingw* )
1173    DEFINE_EXECUTABLE_PATH=`$WinPathScript "$DEFINE_EXECUTABLE_PATH" 1`
1174    ;;
1175esac
1176AC_DEFINE_UNQUOTED(EXECUTABLE_PATH,"$DEFINE_EXECUTABLE_PATH",Directory where executables are installed.)
1177AC_SUBST(EXECUTABLE_PATH)
1178
1179# Path to Wizard lib
1180LIBRARY_PATH="${LIB_DIR}/${LIBRARY_RELATIVE_PATH}"
1181DEFINE_LIBRARY_PATH="${LIB_DIR}/${LIBRARY_RELATIVE_PATH}/"
1182case "${build_os}" in
1183  mingw* )
1184    DEFINE_LIBRARY_PATH=`$WinPathScript "$DEFINE_LIBRARY_PATH" 1`
1185    ;;
1186esac
1187AC_DEFINE_UNQUOTED(LIBRARY_PATH,"$DEFINE_LIBRARY_PATH",Directory where architecture-dependent files live.)
1188AC_SUBST(LIBRARY_PATH)
1189
1190# Subdirectory under lib to place Wizard configuration files
1191CONFIGURE_RELATIVE_PATH="${LIBRARY_RELATIVE_PATH}/config"
1192AC_DEFINE_UNQUOTED(CONFIGURE_RELATIVE_PATH,"$CONFIGURE_RELATIVE_PATH",Subdirectory of lib where architecture-dependent configuration files live.)
1193CONFIGURE_PATH="${LIB_DIR}/${CONFIGURE_RELATIVE_PATH}"
1194DEFINE_CONFIGURE_PATH="${LIB_DIR}/${CONFIGURE_RELATIVE_PATH}/"
1195case "${build_os}" in
1196  mingw* )
1197    DEFINE_CONFIGURE_PATH=`$WinPathScript "$DEFINE_CONFIGURE_PATH" 1`
1198    ;;
1199esac
1200AC_DEFINE_UNQUOTED(CONFIGURE_PATH,"$DEFINE_CONFIGURE_PATH",Directory where architecture-dependent configuration files live.)
1201AC_SUBST(CONFIGURE_PATH)
1202
1203#         
1204# Path to Wizard document files
1205DOCUMENTATION_RELATIVE_PATH="${PACKAGE_NAME}-${PACKAGE_VERSION}"
1206DOCUMENTATION_PATH="${DATA_DIR}/doc/${DOCUMENTATION_RELATIVE_PATH}"
1207DEFINE_DOCUMENTATION_PATH="${DATA_DIR}/doc/${DOCUMENTATION_RELATIVE_PATH}/"
1208case "${build_os}" in
1209  mingw* )
1210    DEFINE_DOCUMENTATION_PATH=`$WinPathScript "$DEFINE_DOCUMENTATION_PATH" 1`
1211    ;;
1212esac
1213AC_DEFINE_UNQUOTED(DOCUMENTATION_PATH,"$DEFINE_DOCUMENTATION_PATH",Directory where the Wizard's Toolkit documents live.)
1214AC_SUBST(DOCUMENTATION_PATH)
1215
1216# Path to Wizard share files
1217SHARE_RELATIVE_PATH="${PACKAGE_NAME}-${PACKAGE_VERSION}"
1218SHARE_PATH="${DATA_DIR}/${SHARE_RELATIVE_PATH}"
1219DEFINE_SHARE_PATH="${DATA_DIR}/${SHARE_RELATIVE_PATH}/"
1220case "${build_os}" in
1221  mingw* )
1222    DEFINE_SHARE_PATH=`$WinPathScript "$DEFINE_SHARE_PATH" 1`
1223    ;;
1224esac
1225AC_DEFINE_UNQUOTED(SHARE_PATH,"$DEFINE_SHARE_PATH",Directory where architecture-independent files live.)
1226AC_SUBST(SHARE_PATH)
1227
1228# Subdirectory under share to place Wizard configuration files
1229SHARE_CONFIGURE_RELATIVE_PATH="${LIBRARY_RELATIVE_PATH}/config"
1230AC_DEFINE_UNQUOTED(SHARE_CONFIGURE_RELATIVE_PATH,"$SHARE_CONFIGURE_RELATIVE_PATH",Subdirectory of lib where architecture-independent configuration files live.)
1231SHARE_CONFIGURE_PATH="${DATA_DIR}/${SHARE_CONFIGURE_RELATIVE_PATH}"
1232DEFINE_SHARE_CONFIGURE_PATH="${DATA_DIR}/${SHARE_CONFIGURE_RELATIVE_PATH}/"
1233case "${build_os}" in
1234  mingw* )
1235    DEFINE_SHARE_CONFIGURE_PATH=`$WinPathScript "$DEFINE_SHARE_CONFIGURE_PATH" 1`
1236    ;;
1237esac
1238AC_DEFINE_UNQUOTED(SHARE_CONFIGURE_PATH,"$DEFINE_SHARE_CONFIGURE_PATH",Directory where architecture-independent configuration files live.)
1239AC_SUBST(SHARE_CONFIGURE_PATH)
1240
1241#
1242# program_transform_name is formed for use in a Makefile, so create a
1243# modified version for use in a shell script.
1244configure_transform_name=`echo ${program_transform_name} | sed 's,\\$\\$,$,'`
1245
1246# Default delegate definitions
1247BrowseDelegateDefault='mozilla'
1248EchoDelegateDefault='echo'
1249LPDelegateDefault='lp'
1250LPRDelegateDefault='lpr'
1251LZWDecodeDelegateDefault='uncompress'
1252LZWEncodeDelegateDefault='compress'
1253MANDelegateDefault='groff'
1254MVDelegateDefault='mv'
1255RMDelegateDefault='rm'
1256TXTDelegateDefault='enscript'
1257WWWDecodeDelegateDefault='wget'
1258ZipDelegateDefault='gzip'
1259
1260#
1261# Test for font directories
1262#
1263type_include_files=''
1264
1265# Windows
1266windows_font_dir=''
1267if test "$with_windows_font_dir" != "yes" && test -n "$with_windows_font_dir"; then
1268   windows_font_dir="${with_windows_font_dir}/"
1269fi
1270if test -n "$windows_font_dir"; then
1271  if test -f '/usr/X11R6/lib/X11/fonts/truetype/arial.ttf'; then
1272     windows_font_dir='/usr/X11R6/lib/X11/fonts/truetype/'
1273  fi
1274  if test -f '/usr/X11R7/lib/X11/fonts/truetype/arial.ttf'; then
1275     windows_font_dir='/usr/X11R7/lib/X11/fonts/truetype/'
1276  fi
1277  if test -f '/usr/share/fonts/msttcore/arial.ttf'; then
1278     windows_font_dir='/usr/share/fonts/msttcore/truetype/'
1279  fi
1280fi
1281if test -n "$windows_font_dir"; then
1282  type_include_files="$type_include_files "'<include file="type-windows.mgk" />'
1283fi
1284AC_SUBST(windows_font_dir)
1285
1286# Adobe Postscript fonts on various systems
1287case $host_os in
1288  solaris*) type_include_files="$type_include_files "'<include file="type-solaris.mgk" />';;
1289esac
1290
1291#
1292# RPM support.
1293#
1294RPM=''
1295AC_CHECK_PROGS(TAR,gnutar gtar tar)
1296AC_CHECK_PROGS(PERL,perl)
1297AC_CHECK_PROGS(RPM,rpmbuild rpm)
1298AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1299AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1300AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1301AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1302AC_SUBST(RPM)
1303AM_CONDITIONAL(RPM_DELEGATE, test "x$RPM" != "x" )
1304
1305#
1306# 7ZIP support (http://p7zip.sourceforge.net/)
1307#
1308P7ZIP=''
1309AC_CHECK_PROGS(P7ZIP,[7za])
1310AC_SUBST(P7ZIP)
1311AM_CONDITIONAL(P7ZIP_DELEGATE, test "x$P7ZIP" != "x" )
1312
1313#
1314# ZIP support (http://www.info-zip.org/Zip.html)
1315#
1316ZIP=''
1317AC_CHECK_PROGS(ZIP,[zip])
1318AC_SUBST(ZIP)
1319AM_CONDITIONAL(ZIP_DELEGATE, test "x$ZIP" != "x" )
1320
1321#
1322# Handle special compiler flags
1323#
1324
1325# Add '-p' if prof source profiling support enabled
1326if test "$enable_prof" = 'yes'; then
1327  CFLAGS="-p $CFLAGS"
1328  CXXFLAGS="-p $CXXFLAGS"
1329  LDFLAGS="-p $LDFLAGS"
1330fi
1331
1332# Add '-pg' if gprof source profiling support enabled
1333if test "$enable_gprof" = 'yes'; then
1334  CFLAGS="-pg $CFLAGS"
1335  CXXFLAGS="-pg $CXXFLAGS"
1336  LDFLAGS="-pg $LDFLAGS"
1337fi
1338
1339# Add '-ftest-coverage -fprofile-arcs' if gcov source profiling support enabled
1340# This is a gcc-specific feature
1341if test "$enable_gcov" = 'yes'; then
1342  CFLAGS="-ftest-coverage -fprofile-arcs  $CFLAGS"
1343  CXXFLAGS="-ftest-coverage -fprofile-arcs  $CXXFLAGS"
1344  LDFLAGS="-ftest-coverage -fprofile-arcs $LDFLAGS"
1345fi
1346
1347#
1348# Build library dependency list for libWizard
1349#
1350
1351if test "$with_modules" != 'no'; then
1352  WIZARD_DEP_LIBS="$IPC_LIBS $BZLIB_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $CCMALLOC_LIBS $EFENCE_LIBS $UMEM_LIBS $GOMP_LIBS $THREAD_LIBS"
1353else
1354  WIZARD_DEP_LIBS="$IPC_LIBS $BZLIB_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $CCMALLOC_LIBS $EFENCE_LIBS $UMEM_LIBS $GOMP_LIBS $THREAD_LIBS"
1355fi
1356AC_SUBST(WIZARD_DEP_LIBS)
1357
1358#
1359# Remove extraneous spaces from output variables (asthetic)
1360#
1361X_CFLAGS=`echo $X_CFLAGS | sed -e 's/  */ /g'`
1362X_PRE_LIBS=`echo $X_PRE_LIBS | sed -e 's/  */ /g'`
1363X_LIBS=`echo $X_LIBS | sed -e 's/  */ /g'`
1364X_EXTRA_LIBS=`echo $X_EXTRA_LIBS | sed -e 's/  */ /g'`
1365
1366CC=`echo $CC | sed -e 's/  */ /g'`
1367CFLAGS=`echo $CFLAGS | sed -e 's/  */ /g'`
1368CPPFLAGS=`echo $CPPFLAGS | sed -e 's/  */ /g'`
1369CXXFLAGS=`echo $CXXFLAGS | sed -e 's/  */ /g'`
1370LDFLAGS=`echo $LDFLAGS | sed -e 's/  */ /g'`
1371TESTED_LIBS=`echo $LIBS | sed -e 's/  */ /g'`
1372WIZARD_DEP_LIBS=`echo $WIZARD_DEP_LIBS | sed -e 's/  */ /g'`
1373#LIBS=`echo $LIBS | sed -e 's/  */ /g'`
1374
1375# Pass only user-provided LIBS as "global" libraries
1376LIBS=$USER_LIBS
1377
1378#AC_SUBST(CPPFLAGS)
1379AC_SUBST(X_CFLAGS)
1380#AC_SUBST(LDFLAGS)
1381#AC_SUBST(X_PRE_LIBS)
1382#AC_SUBST(X_LIBS)
1383#AC_SUBST(X_EXTRA_LIBS)
1384
1385WIZARD_CFLAGS=$CFLAGS
1386WIZARD_CPPFLAGS=`echo $WIZARD_CPPFLAGS | sed -e 's/  */ /g'`
1387WIZARD_PCFLAGS=`echo $WIZARD_PCFLAGS | sed -e 's/  */ /g'`
1388WIZARD_LDFLAGS="-L$LIB_DIR $LDFLAGS"
1389WIZARD_LIBS="-lWizardsToolkit $WIZARD_DEP_LIBS"
1390
1391AC_SUBST(WIZARD_CFLAGS)
1392AC_SUBST(WIZARD_CPPFLAGS)
1393AC_SUBST(WIZARD_PCFLAGS)
1394AC_SUBST(WIZARD_LDFLAGS)
1395AC_SUBST(WIZARD_LIBS)
1396
1397# Set configured scripts to executable.
1398AC_CONFIG_COMMANDS([WizardsToolkit-config.in],[chmod +x wizard/WizardsToolkit-config])
1399
1400AC_OUTPUT
1401
1402rm -f wizard-version
1403
1404AC_MSG_RESULT([
1405The Wizard's Toolkit is configured as follows. Please verify that
1406this configuration matches your expectations.
1407
1408Host system type: $host
1409Build system type: $build
1410
1411                  Option                        Value
1412-------------------------------------------------------------------------
1413Shared libraries  --enable-shared=$enable_shared                $libtool_build_shared_libs
1414Static libraries  --enable-static=$enable_static                $libtool_build_static_libs
1415GNU ld            --with-gnu-ld=$with_gnu_ld            $lt_cv_prog_gnu_ld
1416
1417Options used to compile and link:
1418  PREFIX      = $PREFIX_DIR
1419  EXEC-PREFIX = $EXEC_PREFIX_DIR
1420  VERSION     = $PACKAGE_VERSION
1421  CC          = $CC
1422  CFLAGS      = $WIZARD_CFLAGS
1423  CPPFLAGS    = $WIZARD_CPPFLAGS
1424  PCFLAGS     = $WIZARD_PCFLAGS
1425  DEFS        = $DEFS
1426  LDFLAGS     = $WIZARD_LDFLAGS
1427  LIBS        = $WIZARD_LIBS
1428  CXX         = $CXX
1429  CXXFLAGS    = $CXXFLAGS
1430])
Note: See TracBrowser for help on using the browser.