-
Notifications
You must be signed in to change notification settings - Fork 10
/
configure.ac
1638 lines (1447 loc) · 47.7 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 1999-2021 Wizards Toolkit Studio LLC, a non-profit organization
# dedicated to making software imaging solutions freely available.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# https://urban-warrior.org/WizardsToolkit/script/license.php
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
AC_PREREQ([2.69])
# ==============================================================================
# Initalize Automake
# ==============================================================================
m4_include([m4/version.m4])
m4_define([wizard_base_version],
[wizard_major_version.wizard_minor_version.wizard_micro_version])
m4_define([wizard_version],
[wizard_base_version-wizard_patchlevel_version])
m4_define([wizard_lib_version_number],
[wizard_major_version,wizard_minor_version,wizard_micro_version,wizard_patchlevel_version])
m4_define([wizard_git_revision],
m4_esyscmd([
h=$(git rev-parse --short HEAD)
d=$(git log -1 --format=:%cd --date=format:%Y%m%d || date -u +%Y%m%d -r ./ChangeLog.md)
printf %s "$h$d"
]))
m4_define([wizard_release_date],
m4_esyscmd([
d=$(git log -1 --format=%cd --date=format:%Y-%m-%d || date -u +%F -r ./ChangeLog.md)
printf %s "$d"
]))
AC_INIT([wizard_name],[wizard_version],[wizard_bugreport],[wizard_tarname],[wizard_url])
AC_CONFIG_SRCDIR([wizard/WizardsToolkit.h])
AC_CONFIG_AUX_DIR([config])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config/config.h])
AC_CONFIG_LIBOBJ_DIR([wizard])
AX_PREFIX_CONFIG_H([wizard/wizard-baseconfig.h],[WizardsToolkit])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([foreign no-define color-tests parallel-tests -Wall -Wno-portability subdir-objects dist-bzip2 dist-lzip dist-xz dist-zip tar-ustar])
AM_SILENT_RULES([yes])
AC_SUBST([CONFIGURE_DEPENDENCIES],["$CONFIGURE_DEPENDENCIES \$(top_srcdir)/ChangeLog.md \$(top_srcdir)/m4/version.m4"])
#
# Save initial user-tunable values
#
USER_LIBS=$LIBS
for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS LIBS ; do
eval isset=\${$var+set}
if test "$isset" = 'set'; then
eval val=$`echo $var`
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' "
fi
done
AC_SUBST(DISTCHECK_CONFIG_FLAGS)
CONFIGURE_ARGS="$0 ${ac_configure_args}"
AC_SUBST(CONFIGURE_ARGS)
# Ensure that make can run correctly
AM_SANITY_CHECK
echo "Configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"
#
# Enable OS features.
#
AC_USE_SYSTEM_EXTENSIONS
# Check for programs
AC_PROG_CC
AC_PROG_CPP
LT_PATH_LD
AC_SUBST(LD)
AM_PROG_CC_C_O
AX_CFLAGS_WARN_ALL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_PROG_AWK
AC_PROG_MKDIR_P
AM_WITH_DMALLOC
AX_C___ATTRIBUTE__
AX_GCC_ARCHFLAG([yes])
PKG_PROG_PKG_CONFIG([0.20])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AX_COMPILER_VENDOR
#AX_COMPILER_FLAGS
WIZARD_TARGET_CPU=$host_cpu
AC_SUBST(WIZARD_TARGET_CPU)
AC_DEFINE_UNQUOTED(WIZARD_TARGET_CPU,$WIZARD_TARGET_CPU,[Target Host CPU])
WIZARD_TARGET_VENDOR=$host_vendor
AC_SUBST(WIZARD_TARGET_VENDOR)
AC_DEFINE_UNQUOTED(WIZARD_TARGET_VENDOR,$WIZARD_TARGET_VENDOR,[Target Host Vendor])
WIZARD_TARGET_OS=$host_os
AC_SUBST(WIZARD_TARGET_OS)
AC_DEFINE_UNQUOTED(WIZARD_TARGET_OS,$WIZARD_TARGET_OS,[Target Host OS])
# Substitute versioning
AC_SUBST([WIZARD_MAJOR_VERSION],[wizard_major_version])
AC_SUBST([WIZARD_MINOR_VERSION],[wizard_minor_version])
AC_SUBST([WIZARD_MICRO_VERSION],[wizard_micro_version])
AC_SUBST([WIZARD_PATCHLEVEL_VERSION],[wizard_patchlevel_version])
AC_SUBST([WIZARD_VERSION],[wizard_version])
AC_SUBST([WIZARD_GIT_REVISION],[wizard_git_revision])
# Substitute library versioning
AC_SUBST([WIZARD_LIBRARY_CURRENT],[wizard_library_current])dnl
AC_SUBST([WIZARD_LIBRARY_REVISION],[wizard_library_revision])dnl
AC_SUBST([WIZARD_LIBRARY_AGE],[wizard_library_age])dnl
AC_SUBST([WIZARD_LIBRARY_CURRENT_MIN],
[`expr $WIZARD_LIBRARY_CURRENT - $WIZARD_LIBRARY_AGE`])
AC_SUBST([WIZARD_LIBRARY_VERSION_INFO],
[$WIZARD_LIBRARY_CURRENT:$WIZARD_LIBRARY_REVISION:$WIZARD_LIBRARY_AGE])
AC_SUBST([PACKAGE_BASE_VERSION],[wizard_base_version])
AC_SUBST([PACKAGE_PATCHLEVEL_VERSION],[wizard_patchlevel_version])
AC_SUBST([PACKAGE_VERSION_ADDENDUM],[-wizard_patchlevel_version])
AC_SUBST([PACKAGE_LIB_VERSION],[wizard_lib_version])
AC_SUBST([PACKAGE_LIB_VERSION_NUMBER],[wizard_lib_version_number])
AC_SUBST([PACKAGE_RELEASE_DATE],[wizard_release_date])
# Substitute CVS branch tag
AC_SUBST(CVS_BRANCH_TAG)dnl
WIZARD_LIB_VERSION="0x"
if test ${WIZARD_LIBRARY_CURRENT} -lt 10 ; then
WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}0
fi
WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}${WIZARD_LIBRARY_CURRENT}
if test ${WIZARD_LIBRARY_AGE} -lt 10 ; then
WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}0
fi
WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}${WIZARD_LIBRARY_AGE}
if test ${WIZARD_LIBRARY_REVISION} -lt 10 ; then
WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}0
fi
WIZARD_LIB_VERSION=${WIZARD_LIB_VERSION}${WIZARD_LIBRARY_REVISION}
AC_SUBST(WIZARD_LIB_VERSION)
# Definition used to define WizardLibVersionText in version.h
WIZARD_LIB_VERSION_TEXT="${PACKAGE_BASE_VERSION}"
AC_SUBST(WIZARD_LIB_VERSION_TEXT)
# Definition used to define WizardLibVersionNumber in version.h
WIZARD_LIB_VERSION_NUMBER="${WIZARD_LIBRARY_CURRENT},${WIZARD_LIBRARY_AGE},${WIZARD_LIBRARY_REVISION}"
AC_SUBST(WIZARD_LIB_VERSION_NUMBER)
WIZARD_CFLAGS=''
WIZARD_CPPFLAGS=$CPPFLAGS_USER
WIZARD_PCFLAGS=$CPPFLAGS_USER
WIZARD_LDFLAGS=''
WIZARD_LIBS=''
#
# Evaluate shell variable equivalents to Makefile directory variables
#
if test "x$prefix" = xNONE; then
prefix=$ac_default_prefix
fi
# Let make expand exec_prefix.
if test "x$exec_prefix" = xNONE; then
exec_prefix='${prefix}'
fi
#
eval "eval PREFIX_DIR=${prefix}"
AC_SUBST(PREFIX_DIR)
eval "eval EXEC_PREFIX_DIR=${exec_prefix}"
AC_SUBST(EXEC_PREFIX_DIR)
eval "eval BIN_DIR=$bindir"
AC_SUBST(BIN_DIR)
eval "eval SBIN_DIR=$sbindir"
AC_SUBST(SBIN_DIR)
eval "eval LIBEXEC_DIR=$libexecdir"
AC_SUBST(LIBEXEC_DIR)
eval "eval DATA_DIR=$datadir"
AC_SUBST(DATA_DIR)
eval "eval DOC_DIR=$docdir"
AC_SUBST(DOC_DIR)
eval "eval SYSCONF_DIR=$sysconfdir"
AC_SUBST(SYSCONF_DIR)
eval "eval SHAREDSTATE_DIR=$sharedstatedir"
AC_SUBST(SHAREDSTATE_DIR)
eval "eval LOCALSTATE_DIR=$localstatedir"
AC_SUBST(LOCALSTATE_DIR)
eval "eval LIB_DIR=$libdir"
AC_SUBST(LIB_DIR)
eval "eval INCLUDE_DIR=$includedir"
AC_SUBST(INCLUDE_DIR)
eval "eval OLDINCLUDE_DIR=$oldincludedir"
AC_SUBST(OLDINCLUDE_DIR)
eval "eval INFO_DIR=$infodir"
AC_SUBST(INFO_DIR)
eval "eval MAN_DIR=$mandir"
AC_SUBST(MAN_DIR)
# Get full paths to source and build directories
srcdirfull="`cd $srcdir && pwd`"
builddir="`pwd`"
#
# Compute variables useful for running uninstalled software.
#
WIZARD_CONFIGURE_SRC_PATH="${srcdirfull}/config"
WIZARD_CONFIGURE_BUILD_PATH="${builddir}/config"
DIRSEP=':'
case "${build_os}" in
mingw* )
WIZARD_CONFIGURE_SRC_PATH=`$WinPathScript "${WIZARD_CONFIGURE_SRC_PATH}" 0`
WIZARD_CONFIGURE_BUILD_PATH=`$WinPathScript "${WIZARD_CONFIGURE_BUILD_PATH}" 0`
DIRSEP=';'
;;
esac
case "${host_os}" in
mingw* )
DIRSEP=';'
;;
esac
AC_SUBST(WIZARD_CONFIGURE_SRC_PATH)
AC_SUBST(WIZARD_CONFIGURE_BUILD_PATH)
AC_SUBST(DIRSEP)
# Check for linker script support
gl_LD_VERSION_SCRIPT
#
# Tests for Windows
#
AC_EXEEXT
AC_OBJEXT
GDI32_LIBS=''
native_win32_build='no'
cygwin_build='no'
case "${host_os}" in
cygwin* )
cygwin_build='yes'
GDI32_LIBS='-lgdi32'
;;
mingw* )
native_win32_build='yes'
GDI32_LIBS='-lgdi32'
;;
esac
if test "${GDI32_LIBS}x" != 'x'; then
AC_DEFINE(HasWINGDI32,1,Define to use the Windows GDI32 library)
fi
AC_SUBST(GDI32_LIBS)
AM_CONDITIONAL(HasWINGDI32, test "${GDI32_LIBS}x" != 'x' )
AM_CONDITIONAL(WIN32_NATIVE_BUILD, test "${native_win32_build}" = 'yes' )
AM_CONDITIONAL(CYGWIN_BUILD, test "${cygwin_build}" = 'yes' )
AM_CONDITIONAL(USING_CL, test "x${CC}" = 'xcl.exe' )
WinPathScript="${srcdirfull}/winpath.sh"
AC_SUBST(WinPathScript)
#
# Compiler flags tweaks
#
if test "${GCC}" != "yes"; then
case "${host}" in
*-*-hpux* )
# aCC: HP ANSI C++ B3910B A.03.34
CFLAGS="${CFLAGS} -Wp,-H30000"
if test -n "${CXXFLAGS}"; then
CXXFLAGS='-AA'
else
CXXFLAGS="${CXXFLAGS} -AA"
fi
;;
*-dec-osf5.* )
# Compaq alphaev68-dec-osf5.1 compiler
if test -n "${CXXFLAGS}"; then
CXXFLAGS='-std strict_ansi -noimplicit_include'
else
CXXFLAGS="${CXXFLAGS} -std strict_ansi -noimplicit_include"
fi
esac
fi
# Check for lazy-loading.
AC_CACHE_CHECK([for linker lazyload option],[wt_cv_ld_lazyload],
[
wt_cv_ld_lazyload='none'
case "${host}" in
*-*-solaris2.8 | *-*-solaris2.9 | *-*-solaris2.1? )
if test "$lt_cv_prog_gnu_ld" != 'yes' ; then
wt_cv_ld_lazyload='-Wl,-zlazyload'
fi
;;
esac
])
if test "${wt_cv_ld_lazyload}" != 'none' ; then
if test -z "${LDFLAGS}" ; then
LDFLAGS="${wt_cv_ld_lazyload}"
else
LDFLAGS="${wt_cv_ld_lazyload} ${LDFLAGS}"
fi
fi
dnl Platform-specific stuff
case "$host" in
*-darwin* | *-macos10*)
if test -d /opt/local ; then
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
LDFLAGS="$LDFLAGS -L/opt/local/lib"
elif test -d /sw ; then
CPPFLAGS="$CPPFLAGS -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
fi
dnl OS X universal binary support, requires --disable-dependency-tracking
AC_ARG_ENABLE(osx-universal-binary,
AS_HELP_STRING([--enable-osx-universal-binary],[build universal binary on OS X [[default=no]]]),
[build_osxuniversal="${enableval}"], [build_osxuniversal=no])
if test "${build_osxuniversal}" != no ; then
if test "$enable_dependency_tracking" != no ; then
AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
Please re-run configure with these options:
--disable-dependency-tracking --enable-osx-universal-binary
])
fi
CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -arch ppc -arch i386"
fi
;;
esac
#
# ARCH specific include directory
#
AC_ARG_WITH([includearch-dir],
[AS_HELP_STRING([--includearch-dir=DIR],[ARCH specific include directory])],
[includearch_dir=$withval],
[includearch_dir=$INCLUDE_DIR])
eval "eval INCLUDEARCH_DIR=$includearch_dir"
AC_SUBST(INCLUDEARCH_DIR)
#
# ARCH specific configuration directory
#
AC_ARG_WITH([sharearch-dir],
[AS_HELP_STRING([--sharearch-dir=DIR],[ARCH specific config directory])],
[sharearch_dir=$withval],
[sharearch_dir="${LIB_DIR}"])
eval "eval SHAREARCH_DIR=$sharearch_dir"
SHAREARCH_DIR="$sharearch_dir"
AC_SUBST(SHAREARCH_DIR)
# Path to the pkgconfig folder
AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR],
[Path to the pkgconfig directory @<:@LIBDIR/pkgconfig@:>@]),
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST([pkgconfigdir])
# Enable support for threads
AC_ARG_WITH([threads],
[AS_HELP_STRING([--without-threads],[disable threads support])],
[with_threads=$withval],
[with_threads='yes'])
have_threads=no
if test "$with_threads" != 'no'; then
AX_PTHREAD()
if test "$ax_pthread_ok" = yes; then
have_threads=yes
DEF_THREAD="$PTHREAD_CFLAGS"
CFLAGS="$CFLAGS $DEF_THREAD"
CXXFLAGS="$CXXFLAGS $DEF_THREAD"
THREAD_LIBS="$PTHREAD_LIBS"
if test "$CC" != "$PTHREAD_CC"; then
AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
CC="$PTHREAD_CC"
fi
AC_DEFINE(THREAD_SUPPORT,1,[Define if you have POSIX threads libraries and header files.])
fi
fi
LIBS="$LIBS $THREAD_LIBS"
AC_SUBST(THREAD_LIBS)
# Enable support for OpenMP
if test "$have_threads" != 'yes'; then
ac_cv_prog_c_openmp=unsupported
fi
AC_OPENMP([C])
CFLAGS="$OPENMP_CFLAGS $CFLAGS"
WIZARD_PCFLAGS="$WIZARD_PCFLAGS $OPENMP_CFLAGS"
AC_SUBST(OPENMP_CFLAGS)
AC_CHECK_DECL([_OPENMP],[OPENMP_ENABLED='yes'],[OPENMP_ENABLED='yes'],[])
########
#
# Check for large file support
#
########
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
LFS_CPPFLAGS=''
if test "$enable_largefile" != no; then
case $ac_cv_sys_file_offset_bits in
no)
# nothing to do here as the host supports LFS fine
;;
unknown)
AC_MSG_CHECKING([for native large file support])
AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>
main () {
exit(!(sizeof(off_t) == 8));
}])],
[ac_cv_sys_file_offset_bits=64; AC_DEFINE(_FILE_OFFSET_BITS,64)
AC_MSG_NOTICE([yes])],
[AC_MSG_NOTICE([no])])
;;
*)
LFS_CPPFLAGS="$LFS_CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
;;
esac
if test "$ac_cv_sys_large_files" != 'no'; then
LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGE_FILES=1"
fi
if test "$ac_cv_sys_largefile_source" != 'no'; then
LFS_CPPFLAGS="$LFS_CPPFLAGS -D_LARGEFILE_SOURCE=1"
fi
fi
AC_SUBST(LFS_CPPFLAGS)
# Configure libtool
LT_INIT([win32-dll dlopen])
LT_LANG([C++])
AC_SUBST(LIBTOOL_DEPS)
# Check to see if building shared libraries
libtool_build_shared_libs='no'
if test "$enable_shared" = 'yes'; then
libtool_build_shared_libs='yes'
fi
# Check to see if building static libraries
libtool_build_static_libs='no'
if test "$enable_static" = 'yes'; then
libtool_build_static_libs='yes'
fi
AM_CONDITIONAL(WITH_SHARED_LIBS, test "${libtool_build_shared_libs}" = 'yes')
# Enable build using delegate libraries built in subdirectories rather than installed
# delegate libraries (bzlib lzma zlib)
AC_ARG_ENABLE([delegate-build],
[AS_HELP_STRING([--enable-delegate-build],[look for delegate libraries in build directory])],
[enable_delegate_build=$enableval],
[enable_delegate_build='yes'])
# Build a version of Wizard which operates uninstalled.
# Used to build distributions located via WIZARD_HOME / executable path
AC_ARG_ENABLE([installed],
[AS_HELP_STRING([--disable-installed],[Formally install Wizard's Toolkit under PREFIX])],
[enable_installed=$enableval],
[enable_installed='yes'])
if test "$enable_installed" = 'yes'; then
AC_DEFINE(INSTALLED_SUPPORT,1,[Wizard's Toolkit is formally installed under prefix])
else
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --disable-installed "
fi
LIBS="$LIBS $THREAD_LIBS"
AC_SUBST(THREAD_LIBS)
# Build an embeddable version of Wizard's Toolkit.
AC_ARG_ENABLE([embeddable],
[AS_HELP_STRING([--enable-embeddable],[enable self-contained, embeddable, zero-configuration Wizard's Toolkit])],
[enable_embeddable=$enableval],
[enable_embeddable='no'])
if test "$with_embeddable" = 'yes'; then
AC_DEFINE(EMBEDDABLE_SUPPORT,1,[Build self-contained, embeddable, zero-configuration Wizards Toolkit (experimental)])
fi
# Build a version of Wizard with assert statements.
AC_ARG_ENABLE([assert],
[AS_HELP_STRING([--disable-assert],[disable assert() statements in build])],
[enable_assert=$enableval],
[enable_assert='yes'])
if test "$enable_assert" = 'no'; then
AC_DEFINE(NDEBUG,1,[Turn off assert statements])
fi
# Add configure option --enable-maintainer-mode which enables dependency
# checking and generation useful to package maintainers. This is made an
# option to avoid confusing end users.
AM_MAINTAINER_MODE
# Enable hugepages support
AC_ARG_ENABLE([hugepages],
[AS_HELP_STRING([--enable-hugepages],[enable 'huge pages' support])],
[enable_hugepages=$enableval],
[enable_hugepages='no'])
# Enable Wizard Debugging
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--disable-debug],[disable Wizard Executable Environment debugging])],
[enable_debug=$enableval],
[enable_debug='yes'])
if test "$enable_debug" = 'yes'; then
AC_DEFINE(Debug,1,[Enable Wizard Executable Environment debugging])
fi
# Enable ccmalloc memory debugging support
AC_ARG_ENABLE([ccmalloc],
[AS_HELP_STRING([--enable-ccmalloc],[enable 'ccmalloc' memory debug support])],
[enable_ccmalloc=$enableval],
[enable_ccmalloc='no'])
# Enable Electric Fence memory debugging support
AC_ARG_ENABLE([efence],
[AS_HELP_STRING([--enable-efence],[enable 'efence' memory debug support])],
[enable_efence=$enableval],
[enable_efence='no'])
# Enable prof-based profiling support
AC_ARG_ENABLE([prof],
[AS_HELP_STRING([--enable-prof],[enable 'prof' profiling support])],
[enable_prof=$enableval],
[enable_prof='no'])
# Enable gprof-based profiling support
AC_ARG_ENABLE([gprof],
[AS_HELP_STRING([--enable-gprof],[enable 'gprof' profiling support])],
[enable_gprof=$enableval],
[enable_gprof='no'])
# Enable gcov-based profiling support
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],[enable 'gcov' profiling support])],
[enable_gcov=$enableval],
[enable_gcov='no'])
with_profiling='no'
if test "$enable_prof" = 'yes' || test "$enable_gprof" = 'yes' || test "$enable_gcov" = 'yes'; then
with_profiling='yes'
if test "$libtool_build_shared_libs" = 'yes'; then
echo "Warning: Can not profile code using shared libraries"
fi
fi
# Wizard API method prefix
AC_ARG_WITH([method-prefix],
[AS_HELP_STRING([--with-method-prefix=PREFIX],[prefix WizardsToolkit API methods])],
[with_method_prefix=$withval],
[with_method_prefix='no'])
if test "$with_method_prefix" != 'no'; then
AC_DEFINE_UNQUOTED([WizardMethodPrefix],[$with_method_prefix],[Wizard API method prefix])
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-method-prefix "
fi
# Enable jemalloc, object-caching memory allocation library.
AC_ARG_WITH(jemalloc,
[ --with-jemalloc enable jemalloc memory allocation library support],
[with_jemalloc=$withval],
[with_jemalloc='no'])
if test "$with_jemalloc" != 'yes' ; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jemalloc=$with_jemalloc "
fi
# Enable umem, object-caching memory allocation library.
AC_ARG_WITH(umem,
[ --with-umem enable umem memory allocation library support],
[with_umem=$withval],
[with_umem='no'])
if test "$with_umem" != 'yes' ; then
DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-umem=$with_umem "
fi
#
# Specify path to shared libstdc++ if not in normal location
#
AC_ARG_WITH([libstdc],
[AS_HELP_STRING([--with-libstdc=DIR],[ use libstdc++ in DIR (for GNU C++)])],
[with_libstdc=$withval],
[with_libstdc=''])
if test "$with_libstdc" != ''; then
if test -d "$with_libstdc"; then
LIBSTDCLDFLAGS="-L$with_libstdc"
fi
fi
AC_SUBST(LIBSTDCLDFLAGS)
########
#
# Set defines required to build DLLs and modules using MinGW
#
########
# These options are set for multi-thread DLL module build
# libWizard: _DLL _WIZARDMOD_ _WIZARDLIB_
# module: _DLL
# executable/Wizard++: _DLL _WIZARDMOD_
MODULE_EXTRA_CPPFLAGS=''
LIBRARY_EXTRA_CPPFLAGS=''
if test "${native_win32_build}" = 'yes'; then
if test "${libtool_build_shared_libs}" = 'yes'; then
CPPFLAGS="$CPPFLAGS -D_DLL"
WIZARD_CPPFLAGS="$WIZARD_CPPFLAGS -D_DLL"
WIZARD_PCFLAGS="$WIZARD_PCFLAGS -D_DLL"
LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_WIZARDLIB_"
if test "$with_modules" = 'yes'; then
LIBRARY_EXTRA_CPPFLAGS="$LIBRARY_EXTRA_CPPFLAGS -D_WIZARDMOD_"
else
MODULE_EXTRA_CPPFLAGS="$MODULE_EXTRA_CPPFLAGS -D_WIZARDLIB_"
fi
else
CPPFLAGS="$CPPFLAGS -D_LIB"
WIZARD_CPPFLAGS="$WIZARD_CPPFLAGS -D_LIB"
WIZARD_PCFLAGS="$WIZARD_PCFLAGS -D_LIB"
fi
if test "$with_threads" = 'yes'; then
CPPFLAGS="$CPPFLAGS -D_MT"
WIZARD_CPPFLAGS="$WIZARD_CPPFLAGS -D_MT"
WIZARD_PCFLAGS="$WIZARD_PCFLAGS -D_MT"
fi
fi
AC_SUBST(MODULE_EXTRA_CPPFLAGS)
AC_SUBST(LIBRARY_EXTRA_CPPFLAGS)
# Check standard headers
AC_HEADER_ASSERT
AC_HEADER_DIRENT
# Check additional headers
AC_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 process.h sun_prefetch.h stdarg.h sys/mman.h sys/syslimits.h sys/resource.h sys/time.h sys/timeb.h sys/times.h sys/utime.h termios.h utime.h xlocale.h)
########
#
# Checks for typedefs, structures, and compiler characteristics.
#
########
AC_HEADER_STDBOOL
AC_C_VOLATILE
AC_C_STRINGIZE
AC_HEADER_STAT
AC_STRUCT_TM
AC_SYS_INTERPRETER
#
# Checks for language qualifiers and semantics.
#
AC_C_CHAR_UNSIGNED
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_C_VOLATILE
# If words are stored with the most significant byte first (like
# Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'.
AC_C_BIGENDIAN
# Define to a suitable type, if standard headers do not define it.
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INTMAX_T
AC_TYPE_INTPTR_T
AC_TYPE_LONG_DOUBLE
AC_TYPE_LONG_DOUBLE_WIDER
AC_TYPE_LONG_LONG_INT
AC_TYPE_MBSTATE_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINTMAX_T
AC_TYPE_UINTPTR_T
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_CHECK_TYPES([locale_t], [], [], [[#include <xlocale.h>]])
# Obtain size of an 'signed short' and define as SIZEOF_SIGNED_SHORT
AC_CHECK_SIZEOF(signed short)
# Obtain size of an 'unsigned short' and define as SIZEOF_UNSIGNED_SHORT
AC_CHECK_SIZEOF(unsigned short)
# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
AC_CHECK_SIZEOF(signed int)
# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
AC_CHECK_SIZEOF(unsigned int)
# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
AC_CHECK_SIZEOF(signed long)
# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
AC_CHECK_SIZEOF(unsigned long)
# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG. If
# 'signed long long' is not supported then the value defined is zero.
AC_CHECK_SIZEOF(signed long long)
# Obtain size of a 'unsigned long long' and define as
# SIZEOF_UNSIGNED_LONG_LONG. If 'unsigned long long' is not
# supported then the value defined is zero.
AC_CHECK_SIZEOF(unsigned long long)
# Obtain size of off_t and define as SIZEOF_OFF_T
AC_CHECK_SIZEOF(off_t)
# Obtain size of size_t and define as SIZEOF_SIZE_T
AC_CHECK_SIZEOF(size_t)
# Obtain size of an unsigned int pointer and define as SIZEOF_UNSIGNED_INTP
AC_CHECK_SIZEOF(unsigned int*)
#
# Compute sized types for current CPU and compiler options.
#
AC_MSG_CHECKING(for signed 8-bit type)
INT8_T='signed char'
AC_MSG_NOTICE($INT8_T)
AC_SUBST(INT8_T)
AC_MSG_CHECKING(for unsigned 8-bit type)
UINT8_T='unsigned char'
AC_MSG_NOTICE($UINT8_T)
AC_SUBST(UINT8_T)
AC_MSG_CHECKING(for signed 16-bit type)
INT16_T='signed short'
AC_MSG_NOTICE($INT16_T)
AC_SUBST(INT16_T)
AC_MSG_CHECKING(for unsigned 16-bit type)
UINT16_T='unsigned short'
AC_MSG_NOTICE($UINT16_T)
AC_SUBST(UINT16_T)
AC_MSG_CHECKING(for signed 32-bit type)
INT32_T='none'
INT32_F='none'
if test $ac_cv_sizeof_signed_int -eq 4; then
INT32_T='signed int'
INT32_F='""'
elif test $ac_cv_sizeof_signed_long -eq 4; then
INT32_T='signed long'
INT32_F='"l"'
fi
AC_MSG_NOTICE($INT32_T)
AC_SUBST(INT32_T)
AC_SUBST(INT32_F)
AC_MSG_CHECKING(for unsigned 32-bit type)
UINT32_T='none'
UINT32_F='none'
if test $ac_cv_sizeof_unsigned_int -eq 4; then
UINT32_T='unsigned int'
UINT32_F='""'
elif test $ac_cv_sizeof_unsigned_long -eq 4; then
UINT32_T='unsigned long'
UINT32_F='"l"'
fi
AC_MSG_NOTICE($UINT32_T)
AC_SUBST(UINT32_T)
AC_SUBST(UINT32_F)
AC_MSG_CHECKING(for signed 64-bit type)
INT64_T='none'
INT64_F='none'
if test $ac_cv_sizeof_signed_long -eq 8; then
INT64_T='signed long'
INT64_F='"l"'
elif test $ac_cv_sizeof_signed_long_long -eq 8; then
INT64_T='signed long long'
INT64_F='"ll"'
fi
case "${host_os}" in
mingw* )
INT64_F='"I64"'
;;
esac
AC_MSG_NOTICE($INT64_T)
AC_SUBST(INT64_T)
AC_SUBST(INT64_F)
AC_MSG_CHECKING(for unsigned 64-bit type)
UINT64_T='none'
UINT64_F='none'
if test $ac_cv_sizeof_unsigned_long -eq 8; then
UINT64_T='unsigned long'
UINT64_F='"l"'
elif test $ac_cv_sizeof_unsigned_long_long -eq 8; then
UINT64_T='unsigned long long'
UINT64_F='"ll"'
fi
case "${host_os}" in
mingw* )
UINT64_F='"I64"'
;;
esac
AC_MSG_NOTICE($UINT64_T)
AC_SUBST(UINT64_T)
AC_SUBST(UINT64_F)
AC_MSG_CHECKING(for unsigned maximum type)
UINTMAX_T='none'
UINTMAX_F='none'
if test "$UINT64_T" != 'none'; then
UINTMAX_T=$UINT64_T
UINTMAX_F=$UINT64_F
elif test "$UINT32_T" != 'none'; then
UINTMAX_T=$UINT32_T
UINTMAX_F=$UINT32_F
fi
AC_MSG_NOTICE($UINTMAX_T)
AC_SUBST(UINTMAX_T)
AC_SUBST(UINTMAX_F)
AC_MSG_CHECKING(for pointer difference type)
UINTPTR_T='none'
UINTPTR_F='none'
if test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_unsigned_intp; then
UINTPTR_T='unsigned long'
UINTPTR_F='"l"'
elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_unsigned_intp; then
UINTPTR_T='unsigned long long'
UINTPTR_F='"ll"'
fi
AC_MSG_NOTICE($UINTPTR_T)
AC_SUBST(UINTPTR_T)
AC_SUBST(UINTPTR_F)
#
# Check for __func__ support
#
########
########
#
# Check for functions
#
########
AC_FUNC_VPRINTF
AC_FUNC_STRTOD
AC_FUNC_MMAP
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_STAT
AC_FUNC_STRERROR_R
#
# Check for clock_gettime().
#
AC_SEARCH_LIBS(clock_gettime, rt,
[
AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Define to 1 if you have clock_gettime.])
AC_MSG_CHECKING([whether clock_gettime supports CLOCK_REALTIME])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[#include <time.h>]],
[[clockid_t clockType = CLOCK_REALTIME;]]))],
[
AC_MSG_NOTICE(yes)
AC_DEFINE([HAVE_CLOCK_REALTIME],[1],
[Define to 1 if clock_gettime supports CLOCK_REALTIME.])
],
AC_MSG_NOTICE(no)
)
],
[
AC_CHECK_FUNCS([gettimeofday ftime], [break])
]
)
########
#
# Check for function prototypes
#
########
AC_CHECK_DECLS([pread, pwrite],[],[],[
#include <unistd.h>])
AC_CHECK_DECLS([strlcpy],[],[],[
#include <strings.h>])
AC_CHECK_DECLS([vsnprintf],[],[],[
#include <stdio.h>
#include <stdarg.h>])
########
#
# C++ Support Tests (For Wizard++)
#
########
have_wizard_plus_plus='no'
if test "$with_wizard_plus_plus" = 'yes'; then
OLIBS="$LIBS"
LIBS=''
AC_LANG_PUSH(C++)
# Full set of headers used ...
# algorithm cctype cerrno cmath cstdio cstdlib cstring ctime exception
# functional iomanip iosfwd iostream iterator list string strstream utility
AC_LANG([C++])
AC_PROG_CXX
AX_CXX_BOOL
AX_CXX_NAMESPACES
AX_CXX_NAMESPACE_STD
AC_OPENMP([C++])
AC_LANG_POP
AC_MSG_CHECKING([whether C++ compiler is sufficient for the Wizard's Toolkit])
if \
test $ac_cv_cxx_have_bool = 'yes' && \
test $ac_cv_cxx_have_lstring = 'yes' && \
test $ac_cv_cxx_have_namespaces = 'yes' && \
test $ac_cv_cxx_have_std_libs = 'yes' && \
test $ac_cv_cxx_have_std_namespace = 'yes'; then
have_wizard_plus_plus='yes'
else
have_wizard_plus_plus='no (failed tests)'
fi
AC_MSG_NOTICE([$have_wizard_plus_plus])
LIBS="$OLIBS"
fi
AM_CONDITIONAL(WITH_WIZARD_PLUS_PLUS, test "$have_wizard_plus_plus" = 'yes')
# Only check for delegate libraries in subdirectories if requested.
if test "$with_delegate_build" != 'no'; then
# Check for delegate sub-directories and add -I & -L options as required.
# This presumes that delegates are installed as detailed in the Wizard's
# Toolkit README. If delegates are installed in a standard location where the
# compiler will automatically find them then these options should not be
# required.
#
# Most delegates have includes in the same directory as the library, but not all ...
#
# Includes
for dir in bzlib lcms zlib
do
if test -d "$builddir/$dir"; then
CPPFLAGS="$CPPFLAGS -I$builddir/$dir"
else
if test -d "$srcdirfull/$dir"; then
CPPFLAGS="$CPPFLAGS -I$srcdirfull/$dir"
fi
fi
done
# Libraries
for dir in bzlib lcms zlib
do
if test -d "$builddir/$dir/.libs"; then
LDFLAGS="$LDFLAGS -L$builddir/$dir/.libs"
else
if test -d "$srcdirfull/$dir/.libs"; then
LDFLAGS="$LDFLAGS -L$srcdirfull/$dir/.libs"
fi
fi
if test -d "$builddir/$dir"; then