-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure.ac
1464 lines (1274 loc) · 42.2 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Mahogany, 0.67)
rm -f conftestdata
if ln -s X conftestdata 2>/dev/null
then rm -f conftestdata
else AC_MSG_ERROR([Sorry, this build system will not work on a
system without symbolic links. It depends on the ability
to create links to directories, so this is not something
that can be worked around.])
fi
dnl OSTYPE may be set by the user to override the default which is just uname
if test "x$OSTYPE" = "x"; then
OSTYPE=`uname`
fi
case "$OSTYPE" in
darwin* | Darwin*)
USE_MAC=1
MAKE_USE_MAC="USE_MAC=yes"
USE_MINGW=0
MAKE_USE_MINGW=""
USE_RESOURCES=0
MAKE_USE_RESOURCES=""
;;
cygwin* | CYGWIN*)
USE_MAC=0
MAKE_USE_MAC=""
USE_MINGW=0
MAKE_USE_MINGW=""
USE_RESOURCES=1
MAKE_USE_RESOURCES="USE_RESOURCES=yes"
;;
mingw* | MINGW*)
USE_MAC=0
MAKE_USE_MAC=""
USE_MINGW=1
MAKE_USE_MINGW="USE_MINGW=yes"
USE_RESOURCES=1
MAKE_USE_RESOURCES="USE_RESOURCES=yes"
;;
*)
USE_MAC=0
MAKE_USE_MAC=""
USE_MINGW=0
MAKE_USE_MINGW=""
USE_RESOURCES=0
MAKE_USE_RESOURCES=""
;;
esac
AC_SUBST(MAKE_USE_MAC)
AC_SUBST(MAKE_USE_MINGW)
AC_SUBST(MAKE_USE_RESOURCES)
echo ""
echo "*** Configuring Mahogany for $OSTYPE ***"
echo ""
AC_CONFIG_HEADER(include/config.h)
AC_CONFIG_AUX_DIR(extra/scripts)
AC_CONFIG_MACRO_DIR([extra/m4])
### HACK: unfortunately, the Makefiles in subdirectories can use this
### install program without qualification. We really shouldn't do it
### this way, but we force the install-sh found here to be a full path.
case "$ac_install_sh" in
/*) ;;
../*) ac_install_sh=`cd .; exec pwd``expr "$ac_install_sh" : '\.\.\(.*\)'` ;;
*) ac_install_sh=`cd $srcdir; exec pwd`/$ac_install_sh ;;
esac
dnl --------------------------------------------------------------------------
dnl Mahogany parameter evaluation
dnl Usage: M_OVERRIDES(package,message,variable,default,help)
dnl --------------------------------------------------------------------------
M_OVERRIDES(debug,debugging,USE_DEBUG,0,
--enable-debug generate code with debugging information)
case "$USE_DEBUG" in
dnl options which are incompatible with debugging
0|'')
M_OVERRIDES(optimize,optimization,USE_OPT,1,
--disable-optimize disable optimization (automatic if debugging))
debug_option="no"
;;
dnl options which only make sense if debug was given
*)
M_OVERRIDES(wxdebug,wxWin debug libs,USE_WXDEBUG,0,
--with-wxdebug use debug wxWidgets libraries)
M_OVERRIDES(dmalloc,dmalloc library,USE_DMALLOC,0,
--with-dmalloc use dmalloc (http://dmalloc.com/) for debugging)
M_OVERRIDES(leaktracer,LeakTracer,USE_LEAKTRACER,0,
--with-leaktracer use LeakTracer for debugging)
M_OVERRIDES(efence,ElectricFence,USE_EFENCE,0,
--with-efence use ElectricFence for debugging)
debug_option="yes"
esac
M_OVERRIDES(profile,profiling,USE_PROFILER,0,
--enable-profile generate code for profiling)
M_OVERRIDES(strict,strict compiler options,USE_STRICT,0,
--enable-strict strict compiler flags - may not work on all systems)
M_OVERRIDES(nls,i18n support,USE_I18N,1,
--disable-nls no internationalization support)
M_OVERRIDES(python,Python scripting,USE_PYTHON,1,
--with-python use Python scripting)
M_OVERRIDES(dspam,DSPAM spam filter,USE_DSPAM,1,
--with-dspam use DSPAM for spam filtering)
if test "$USE_PYTHON" = 1; then
M_OVERRIDES(swig,whether we should use SWIG,USE_SWIG,1,
--without-swig do not use swig even if it is available)
fi
dnl dialup is not currently supported under Mac OS X
if test "$USE_MAC" = 0; then
M_OVERRIDES(dialup,special dial-up support,USE_DIALUP,1,
--disable-dialup disable dial-up support for modem users)
fi
M_OVERRIDES(experimental,experimental code,USE_EXPERIMENTAL,0,
--with-experimental compile experimental code)
M_OVERRIDES(threads,multi-threading,USE_THREADS,0,
--with-threads multi-threaded version (DOES NOT WORK))
M_OVERRIDES(palm,Palm Pilot support,USE_PISOCK,0,
--with-palm include support for Palm Pilot)
M_OVERRIDES(ccostype,c-client OS type,USE_CCOSTYPE,,
--with-ccostype=xxx use OS type xxx for c-client compilation)
M_OVERRIDES(modules,modules,USE_MODULES,auto,
--with-modules=xxx one of none/static/dynamic)
M_OVERRIDES(ssl,SSL support,USE_SSL,1,
--with-ssl=ssldir specify path where OpenSSL is installed)
AC_MSG_CHECKING(for install location)
case "$prefix" in
NONE) AC_CACHE_VAL(m_cv_prefix,m_cv_prefix=$ac_default_prefix);;
*) m_cv_prefix=$prefix ;;
esac
AC_MSG_RESULT($m_cv_prefix)
case "$m_cv_prefix" in /*) ;; *)
AC_MSG_WARN([--prefix=$prefix must be an absolute path name, using $ac_default_prefix])
m_cv_prefix=$ac_default_prefix
esac
prefix=$m_cv_prefix
WX_CONFIG_OPTIONS
dnl save parameter settings in case stuff below aborts
AC_CACHE_SAVE
dnl --------------------------------------------------------------------------
dnl testing operating system and compilers
dnl --------------------------------------------------------------------------
AC_CANONICAL_HOST
dnl setting the OS type for information
AC_DEFINE_UNQUOTED(M_CANONICAL_HOST,"$host")
AC_DEFINE_UNQUOTED(M_OSINFO,_T("`uname -s -r -m`"))
AC_DEFINE_UNQUOTED(M_PREFIX,"$prefix")
dnl set the top level directories
dnl use "exec pwd" to avoid shell built-in
dnl use "cd ." so FreeBSD shell will fork subshell
SOURCEDIR=`cd $srcdir; exec pwd`
AC_SUBST(SOURCEDIR)
AC_DEFINE_UNQUOTED(M_TOP_SOURCEDIR, _T("$SOURCEDIR"))
BUILDDIR=`cd .; exec pwd`
AC_SUBST(BUILDDIR)
AC_DEFINE_UNQUOTED(M_TOP_BUILDDIR, _T("$BUILDDIR"))
dnl C-compiler checks
dnl =================
dnl use what compiler?
CFLAGS=${CFLAGS=} # magic incantation so CFLAGS not set by AC_PROG_CC
AC_PROG_CC
dnl defines CC with the compiler to use
dnl defines GCC with yes if using gcc, else empty
dnl defines CFLAGS
dnl fixups for UNIX variants
AC_ISC_POSIX
dnl does compiler support -c and -o simultaniously?
dnl defines NO_MINUS_C_MINUS_O if compiler does not accept
dnl both switches simultaniously
AC_PROG_CC_C_O
# I dislike delving so deeply into autoconf's internal values, but this
# seems to be the only accurate way of finding out what it determined.
case `eval echo '$'{ac_cv_prog_cc_${ac_cc}_c_o}` in yes) ;; *)
AC_MSG_ERROR([Sorry, this capability is used extensively by the build
system, including third-party code that we do not control. You'll
have to use a compiler that supports this.]) ;;
esac
dnl what is the c-preprocessor?
AC_PROG_CPP
dnl defines CPP with the c-preprocessor
dnl is -traditional needed for correct compilations?
AC_PROG_GCC_TRADITIONAL
dnl adds -traditional for gcc if needed
dnl Checks for compiler characteristics.
AC_C_CONST
AC_C_INLINE
dnl C++-compiler checks
dnl ===================
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl use what compiler?
CXXFLAGS=${CXXFLAGS=} # magic incantation so CXXFLAGS not set by AC_PROG_CXX
dnl AC_PROG_CXX macro
dnl defines CXX with the compiler to use
dnl defines GXX with yes if using gxx, else empty
dnl defines CXXFLAGS
AC_PROG_CXX
dnl We need C++11 support, so check for it.
AX_CXX_CHECK_FLAG([-std=c++11],,,[CXXFLAGS="$CXXFLAGS -std=c++11"], [
AC_MSG_ERROR([
Sorry, $CXX doesn't support -std=c++11 option and can't be used to compile this program.
])
])
dnl disable support for exceptions if the compiler is g++ and
dnl new enough to support it.
M_ADD_CXXFLAGS_IF_SUPPORTED([-fno-exceptions])
dnl check whether the C++ supports the new logical operator names
dnl c-client library uses some of them as field names
AC_CACHE_CHECK(if ${CXX} supports logical operator names,
m_cv_cxx_opernames,
[echo 'int f(int a, int b){return not a or b;}' >conftest.cc
if ${CXX} -c conftest.cc >/dev/null 2>&1
then m_cv_cxx_opernames=yes
else m_cv_cxx_opernames=no
fi
rm -f conftest*])
dnl really a subroutine to avoid nesting source lines too deeply
AC_DEFUN([M_OPER_NAMES],
[AC_CACHE_CHECK(if logical operator names can be disabled,
m_cv_cxx_disableopernames,
[case "$GXX" in
yes) echo 'void f(){}' >conftest.cc
case "`${CXX-g++} -c -fno-operator-names conftest.cc 2>&1`" in
'') m_cv_cxx_disableopernames="-fno-operator-names"
esac
rm -f conftest* ;;
esac
### other tests here???
case "$m_cv_cxx_disableopernames" in '')
m_cv_cxx_disableopernames="none supported"
esac])])
dnl really a subroutine to avoid nesting source lines too deeply
AC_DEFUN([M_GCC_BUGGY_NO_OPERATOR_NAMES],
[AC_CACHE_CHECK(if disabling the logical operator names is buggy,
m_cv_gcc_buggy_fno_operator_names,
[case "$GCC" in
yes) echo '#define TEST 1
#if defined(TEST)
#undef TEST
#endif' >conftest.cc
case "`${CXX-g++} -c -fno-operator-names conftest.cc 2>&1`" in
'') m_cv_gcc_buggy_fno_operator_names="no" ;;
*) m_cv_gcc_buggy_fno_operator_names="yes" ;;
esac
rm -f conftest* ;;
esac])])
dnl if the compiler treats "or" and "not" as keywords, we must to get a
dnl workaround for compiling the c-client header files
case "$m_cv_cxx_opernames" in yes)
dnl check whether is possible to redefine the logical operator
dnl names. cclient headers will not compile if the compiler
dnl understands them as keywords.
AC_CACHE_CHECK(if ${CXX} can redefine logical operator names,
m_cv_cxx_redefineopernames,
[echo '#define or m_or' >conftest.cc
if ${CXX} -c conftest.cc >/dev/null 2>&1
then m_cv_cxx_redefineopernames=yes
else m_cv_cxx_redefineopernames=no
fi
rm -f conftest*])
dnl if the operator names can't be redefined try to check
dnl whether the compiler accepts some flag to disable them
case "$m_cv_cxx_redefineopernames" in
yes) AC_DEFINE(M_LOGICAL_OP_NAMES) ;;
no) M_OPER_NAMES
case "$m_cv_cxx_disableopernames" in
"none supported") dnl Houston, we have a problem
AC_MSG_ERROR([Sorry, the c-client library used by Mahogany uses some
names which your compiler treats as keywords (the new logical
operator names: and, or, not, etc.). We currently don't know a
workaround for your compiler. If it does accept some flag for
disabling them, please go to http://mahogany.sourceforge.net/bugz
and submit a bug against the Build component telling us which
flag will work.]) ;;
*) M_GCC_BUGGY_NO_OPERATOR_NAMES
case "$m_cv_gcc_buggy_fno_operator_names" in
yes)
if test -f /etc/redhat-release -a ! grep "7\.0" /etc/redhat-release
then workarroundmsg="
It seems you are using Red Hat Linux 7.0. A workaround for your
problem is to use egcs to compile wxWidgets and Mahogany:
- at your bash prompt type:
export CC=egcs
export CXX=egcs++
- reconfigure and rebuild wxWidgets and Mahogany
(don't forget to remove the config.cache files
located in the source code directories of
wxWidgets and Mahogany before reconfiguring them."
else workarroundmsg=""
fi
AC_MSG_ERROR([Sorry, it seems that you have a buggy gcc version which is
not able to compile Mahogany (gcc-2.96-69 shipped by Red Hat with Red
Hat Linux 7.0 is one of them). Please upgrade it.$workaroundmsg]) ;;
no)
CXXFLAGS="$CXXFLAGS $m_cv_cxx_disableopernames"
esac ;;
esac ;;
esac
esac
dnl PCH support is currently for gcc 3.4+ only
MAKE_USE_PCH=
if test "$GXX" = "yes"; then
AC_CACHE_CHECK(if ${CXX} supports precompiled headers,
m_cv_cxx_pch,
[
AC_TRY_COMPILE([],
[
#if !defined(__GNUC__) || !defined(__GNUC_MINOR__)
There is no PCH support
#endif
#if (__GNUC__ < 3)
There is no PCH support
#endif
#if (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
There is no PCH support
#endif
],
m_cv_cxx_pch=yes,
m_cv_cxx_pch=no
)
]
)
if test "$m_cv_cxx_pch" = "yes"; then
AC_DEFINE(USE_PCH)
MAKE_USE_PCH="USE_PCH=1"
fi
fi
AC_SUBST(MAKE_USE_PCH)
AC_LANG_RESTORE
dnl Various other commands needed
dnl =============================
dnl set RANLIB to ranlib location or nothing
AC_PROG_RANLIB
dnl check for M4
AC_PATH_PROG(M4, m4)
dnl set YACC to yacc location: don't use AC_PROG_YACC as it does *not* fail if
dnl yacc is not available (!)
AC_CHECK_PROGS(YACC, byacc yacc 'bison -y', none)
if test "$YACC" = "none"; then
AC_MSG_WARN([yacc not found, you will not be able to modify *.y files.])
YACC=
fi
AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl --------------------------------------------------------------------------
dnl check for features and functions
dnl --------------------------------------------------------------------------
dnl we use C++ so we always have prototypes - Python.h needs this
AC_DEFINE(HAVE_PROTOTYPES)
dnl used by python
AC_CACHE_CHECK(for variable length prototypes and stdarg.h,
m_cv_stdarg_prototypes,
[AC_TRY_COMPILE(
[#include <stdarg.h>
int foo(int x, ...) {
va_list va;
va_start(va, x);
va_arg(va, int);
va_arg(va, char *);
va_arg(va, double);
return 0;
}], [return foo(10, "", 3.14);],
m_cv_stdarg_prototypes=yes, m_cv_stdarg_prototypes=no)])
case "$m_cv_stdarg_prototypes" in yes)
AC_DEFINE(HAVE_STDARG_PROTOTYPES)dnl
esac
AC_CACHE_CHECK(for bad exec* prototypes, m_cv_bad_exec,
[AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);],
m_cv_bad_exec=yes, m_cv_bad_exec=no)])
case "$m_cv_bad_exec" in yes)
AC_DEFINE(BAD_EXEC_PROTOTYPES)dnl
esac
dnl Checks for typedefs and structures.
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_CHECK_FUNCS(strsep)
dnl --------------------------------------------------------------------------
dnl check for the debugging options
dnl --------------------------------------------------------------------------
dnl memory debug libraries get tested last to make sure they are linked last
dnl electric fence
case "$USE_EFENCE" in 1)
AC_CHECK_LIB(efence,main,
LIB_EFENCE="-lefence",
AC_MSG_WARN(efence library configured but not available.))
esac
dnl dmalloc debugging lib
case "$USE_DMALLOC" in
1) M_CHECK_MYLIB(dmalloc, main,
[ /usr/lib /usr/local/lib $prefix/lib ],
[
LIB_DMALLOC="-ldmalloc"
AC_DEFINE(USE_DMALLOC)
],
AC_MSG_WARN(dmalloc library not available, get it from http://dmalloc.com/.)
)
esac
dnl LeakTracer debugging lib
case "$USE_LEAKTRACER" in
1) MAKE_USE_LEAKTRACER="USE_LEAKTRACER=yes" ;;
*) MAKE_USE_LEAKTRACER="" ;;
esac
AC_SUBST(MAKE_USE_LEAKTRACER)
dnl set debug/optimisation flags
case "$USE_DEBUG" in
0|'') DEBUG_OPTS="" ;;
1) DEBUG_OPTS="${USER-$LOGNAME}" ;;
*) DEBUG_OPTS="`echo $USE_DEBUG | tr -s -- '-,/:+ ' '_ '`" ;;
esac
MAKE_DEBUG='DEBUG :='
case "$DEBUG_OPTS" in '') ;; *)
AC_DEFINE(DEBUG)
CPPFLAGS="$CPPFLAGS -DDEBUG"
for i in $DEBUG_OPTS
do CPPFLAGS="$CPPFLAGS -DDEBUG_$i"
MAKE_DEBUG="$MAKE_DEBUG $i"
done
USE_DEBUG_INFO=1
esac
AC_SUBST(MAKE_DEBUG)
if test "$USE_WXDEBUG" = 1; then
USE_OPT=0
dnl FIXME: shouldn't hard code wxWin version here!
fi
case "$USE_DEBUG_INFO.$GXX.$ac_cv_prog_cc_g" in
1.yes.*) CODE_GEN_FLAGS="$CODE_GEN_FLAGS -g3"
USE_OPT=0 ;;
1.no.yes) CODE_GEN_FLAGS="$CODE_GEN_FLAGS -g" ;;
esac
dnl i18n support
if test "$USE_I18N" = 1; then
AC_DEFINE(USE_I18N)
fi
dnl --------------------------------------------------------------------------
dnl check for misc other compilation options
dnl --------------------------------------------------------------------------
case "$USE_OPT" in
1) CODE_GEN_FLAGS="$CODE_GEN_FLAGS -O2" ;;
*) CODE_GEN_FLAGS="$CODE_GEN_FLAGS -O0" ;;
esac
case "$USE_PROFILER" in 1)
CODE_GEN_FLAGS="$CODE_GEN_FLAGS -pg"
LDFLAGS="$LDFLAGS -pg"
esac
case "$USE_EXPERIMENTAL" in
0|'') EXPERIMENTAL="" ;;
1) EXPERIMENTAL="${USER-$LOGNAME}" ;;
*) EXPERIMENTAL="`echo $USE_EXPERIMENTAL | tr -s -- '-,/:+ ' '_ '`" ;;
esac
MAKE_EXPERIMENTAL='EXPERIMENTAL :='
case "$EXPERIMENTAL" in '') ;; *)
# including this on the command line interferes
# with its usage in wxMDialogs.cpp
#CPPFLAGS="$CPPFLAGS -DEXPERIMENTAL"
for i in $EXPERIMENTAL
do CPPFLAGS="$CPPFLAGS -DEXPERIMENTAL_$i"
MAKE_EXPERIMENTAL="$MAKE_EXPERIMENTAL $i"
done
esac
AC_SUBST(MAKE_EXPERIMENTAL)
if test "x$USE_DIALUP" = "x1"; then
AC_DEFINE(USE_DIALUP)
fi
dnl Find pkg-config outside of any conditional. Done before any PKG_* call.
PKG_PROG_PKG_CONFIG
dnl --------------------------------------------------------------------------
dnl check for SSL
dnl --------------------------------------------------------------------------
case "$USE_SSL" in
0) ssl_option=no
;;
1|/*) dnl be smart: if --with-ssl value already ends in include, don't do
dnl anything, but if it doesn't then add it
case "$USE_SSL" in
/*/include) ssl_inc="$USE_SSL" ;;
/*) ssl_inc="$USE_SSL/include" ;;
*) # explicitly using -/usr/local/include is a bad idea with gcc,
# it complains about it ("changing the order of system
# directories search")
if test "$prefix" != "/usr/local"; then
ssl_inc="$prefix/include"
fi
;;
esac
dnl there is a subtlety here: we have to look for ssl.h and not for
dnl openssl/ssl.h directly because if the latter is in a standard
dnl location (e.g. /usr/include) we have no way of knowing which -I
dnl option we should use for c-client which wants to directly include
dnl <ssl.h> and not <openssl/ssl.h> -- using /usr/include/openssl
dnl as we used to do doesn't work in case when the SSL headers live
dnl under /usr/local
dnl
dnl OTOH, in the newer versions of OpenSSL ssl.h itself includes the
dnl other files as <openssl/foo.h> so when testing the headers
dnl existence with -Iprefix/openssl we must *also* have -Iprefix or it
dnl doesn't risk to work.
dnl
dnl also, RH9 install of OpenSSL is broken and krb5.h file included by
dnl ssl.h is in a non standard directory and this breaks compilation.
dnl Luckily we don't need it anyhow so we can just disable using
dnl Kerberos completely.
dnl
dnl the others -DNO_XXX don't seem to exist any more in the new
dnl OpenSSL versions anyhow but we keep them here as apparently they
dnl were needed for the older versions, for whatever reasons...
SSL_CPPFLAGS="-DNO_IDEA -DNO_DSA -DOPENSSL_NO_KRB5"
CPPFLAGS_OLD=$CPPFLAGS
CPPFLAGS="${CPPFLAGS} ${SSL_CPPFLAGS} -I${ssl_inc} -I/usr/ssl/include -I/usr/local/ssl/include"
M_CHECK_MYHEADER(ssl.h,
[ \
$ssl_inc/openssl \
/usr/include/openssl \
/usr/ssl/include/openssl \
/usr/local/include/openssl \
/usr/local/ssl/include/openssl \
],
[
ssl_option=yes
ssl_inc=$m_cv_header_ssl_h
],
ssl_option=no
)
CPPFLAGS=$CPPFLAGS_OLD
if test "$ssl_option" != "no"; then
dnl remove the openssl suffix now
ssl_inc=`echo $ssl_inc | sed 's@/openssl$@@'`
ssl_lib=`echo $ssl_inc | sed 's@include$@lib@'`
LIBS_SSL=""
dnl check for -lcrypto first as libssl needs it under some
dnl platforms (notably FreeBSD)
M_CHECK_MYLIB(crypto, main,
[ \
$ssl_lib \
/usr/lib \
/usr/local/lib \
/home/local/lib \
],
LIBS_SSL="$libpath_crypto_main -lcrypto"
)
dnl now we can check for -lssl itself
M_CHECK_MYLIB(ssl, main,
[ \
$ssl_lib \
/usr/lib \
/usr/local/lib \
/home/local/lib \
],
LIBS_SSL="$LIBS_SSL $libpath_ssl_main -lssl",
ssl_option=no,
$LIBS_SSL
)
fi
dnl only test for other functions if ssl.h was found
if test "$ssl_option" != "no"; then
AC_CHECK_FUNC(socket,,
AC_CHECK_LIB(socket,socket,, ssl_option=no))
AC_CHECK_FUNC(gethostname,,
AC_CHECK_LIB(resolv,gethostname,, ssl_option=no))
AC_CHECK_FUNC(gethostbyname,,
AC_CHECK_LIB(nsl,gethostbyname,, ssl_option=no))
fi
case "$ssl_option" in
no*) AC_MSG_WARN([Cannot find libraries for SSL - SSL support disabled])
;;
esac
;;
*) AC_MSG_WARN([--with-ssl=$USE_SSL ignored, you must specify absolute path])
ssl_option=no ;;
esac
if test "$ssl_option" = "yes"; then
AC_DEFINE(USE_SSL)
dnl have to give the location of SSL headers to cclient if it is in a
dnl non standard place: note that imap2000 includes <ssl.h> and not
dnl <openssl/ssl.h> but SSL headers themselves use the second form, so
dnl we need both
case "$ssl_inc" in
/usr/include)
dnl no need to -I/usr/include to the compiler options
;;
*)
SSL_CPPFLAGS="-I$ssl_inc $SSL_CPPFLAGS"
esac
IMAP_CFLAGS="-I$ssl_inc/openssl $SSL_CPPFLAGS $IMAP_CFLAGS"
CPPFLAGS="$SSL_CPPFLAGS $CPPFLAGS"
dnl c-client default is "nopwd" which means that plain text authentication
dnl is disabled for non encrypted session, we prefer traditional Unix
dnl behaviour (which can be less safe but let's people do what they want)
IMAP_SSLTYPE="unix"
else
dnl tell c-client that we don't want to use SSL
IMAP_SSLTYPE="none"
fi
AC_SUBST(IMAP_SSLTYPE)
dnl --------------------------------------------------------------------------
dnl check for other libraries
dnl --------------------------------------------------------------------------
dnl we might need dl (depending on wxGTK and python config),
dnl so link with it if it is available
AC_CHECK_LIB(dl,main)
dnl c-client library needs the crypt() function which is either in the
dnl c library or in libcrypt
AC_CHECK_FUNC(crypt,,
[AC_CHECK_LIB(crypt,crypt,,
[AC_MSG_ERROR([Cannot find crypt function.
It appears that the c library does not contain it, nor is libcrypt
installed on your system. It is needed for password authentication,
so before compiling Mahogany, you need to install libcrypt. You
can download the source for a suitable libcrypt from the Mahogany
ftp server (ftp://ronnie.phy.hw.ac.uk/pub/Mahogany/Libraries).])])])
dnl If we have a libshadow, link with it. I am not sure whether we
dnl really need this.
AC_CHECK_LIB(shadow,main)
dnl libresolv or libbind (or simply libc under FreeBSD)
USE_RBL=1
AC_CHECK_FUNC(res_query,,
AC_CHECK_LIB(resolv,res_query,,
AC_CHECK_LIB(bind,res_query,,
[AC_MSG_WARN(cannot use RBL spam checker.); USE_RBL=0])))
case "$USE_RBL" in 1) AC_DEFINE(USE_RBL) ;; esac
dnl --------------------------------------------------------------------------
dnl check for python
dnl --------------------------------------------------------------------------
dnl which Python version are we going to use?
PYTHON_VER=
if test "$USE_PYTHON" = 1; then
PKG_CHECK_MODULES(PYTHON, [python2],
[
CXXFLAGS="$PYTHON_CFLAGS $CXXFLAGS"
PYTHON_VER=`$PKG_CONFIG --modversion python2`
],
[
USE_PYTHON=0
]
)
fi
case "$USE_PYTHON" in
0) MAKE_USE_PYTHON=''
AC_MSG_WARN([Mahogany will be built without embedded Python interpreter])
;;
*) AC_DEFINE(USE_PYTHON)
MAKE_USE_PYTHON="USE_PYTHON=yes"
if test "x$USE_SWIG" = "x1"; then
dnl We used to have rather elaborate checks for SWIG version
dnl because it used to change a lot in not always backwards
dnl compatible ways but this seems to not be the case any more
dnl now, at least for the simple ways we use it in. So now we just
dnl assume that everything newer the oldest knowing to work
dnl version is ok until the next major version number change.
dnl if this changes, don't forget to change the tests for swig_ver
dnl below as well
swig_min_ver=1.3.25
AC_PATH_PROG(SWIG, swig)
if test "x$SWIG" = "x"; then
AC_MSG_WARN([
*** Cannot find SWIG -- will use precompiled files for Python support.
*** If you want to modify the interface files, please install SWIG >= $swig_min_ver.])
USE_SWIG=0
else
AC_MSG_CHECKING([for swig version])
swig_ver=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/SWIG Version //'`
AC_MSG_RESULT([$swig_ver])
case "$swig_ver" in
1.1.* | 1.2.* )
swig_ver_status="old"
;;
1.3.*)
swig_ver_micro=`echo $swig_ver | sed 's/1\.3\.//'`
if test $swig_ver_micro -lt 25; then
swig_ver_status="old"
fi
;;
2.*.*)
;;
[[3-9]]*.[[0-9]]*.[[0-9]]*)
swig_ver_status="new"
;;
*)
AC_MSG_WARN([Unrecognized swig version format "$swig_ver"])
swig_ver_status="bad"
;;
esac
case "$swig_ver_status" in
bad )
AC_MSG_WARN([
*** Version of your swig program ($SWIG) couldn't be determined, please report
*** this to us. Assuming it does not work and continuing without swig.])
USE_SWIG=0
;;
old )
AC_MSG_WARN([
*** Your swig program ($SWIG) is version $swig_ver but at least $swig_min_ver is required.])
USE_SWIG=0
;;
new )
AC_MSG_WARN([
*** Your swig program ($SWIG) is version $swig_ver but the last tested
*** version is 1.3.36 -- still continuing hoping that it is going to work,
*** but if it doesn't, please rerun configure with --without-swig option.])
;;
esac
fi
fi
;;
esac
AC_SUBST(MAKE_USE_PYTHON)
dnl check for xgettext/msgmerge
MAKE_XLATE='TRANSLATIONS := yes'
AC_PATH_PROG(XGETTEXT,xgettext)
AC_PATH_PROG(MSGMERGE,msgmerge)
case ".$XGETTEXT.$MSGMERGE." in *..*)
AC_MSG_WARN([cannot rebuild message translations.
You must install xgettext/msgmerge in order to do it.])
MAKE_XLATE='TRANSLATIONS := no'
esac
AC_SUBST(MAKE_XLATE)
# compile/install binary translations
AC_PATH_PROG(MSGFMT,msgfmt)
case "$MSGFMT" in '')
AC_MSG_WARN([cannot compile message translations.
Binary translations will not be installed. You need the
'msgfmt' program to compile message translations.]) ;;
esac
dnl --------------------------------------------------------------------------
dnl check for (wx)gtk libraries
dnl --------------------------------------------------------------------------
dnl check for wxWidgets installation
MIN_WX_VERSION=2.9.4
dnl notice that libraries option should use correct order, otherwise statically
dnl linking won't work!
wxlibs=html,adv,qa,core,xml,net,base
WX_CONFIG_CHECK($MIN_WX_VERSION, [wxOK=1],[wxOK=0],[$wxlibs], [--debug=$debug_option])
if test "$wxOK" != 1; then
if test $debug_option = "yes"; then
wxkind=debug
else
wxkind=release
fi
AC_MSG_ERROR([
Mahogany requires wxWidgets to be installed on your system
but the required wxWidgets version couldn't be found.
Please check that wx-config is in PATH, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' command) is in LD_LIBRARY_PATH or
equivalent variable and wxWidgets version is $MIN_WX_VERSION or above
and is available in $wxkind version.
])
fi
dnl set all flags: notice that currently (as of version 2.5.1)
dnl WX_CXXFLAGS_ONLY does not include C flags but we do need them for C++
dnl files compilation as well
CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
CXXFLAGS="$CXXFLAGS $WX_CFLAGS_ONLY $WX_CXXFLAGS_ONLY"
dnl normal linking mode is fully dynamic
GUI_LIBS="$WX_LIBS"
AC_SUBST(GUI_LIBS)
dnl 1/4 static means link wxWin statically, the rest dynamically
GUI_LIBS_QUARTSTATIC="$WX_LIBS_STATIC"
AC_SUBST(GUI_LIBS_QUARTSTATIC)
dnl 1/2 static means to link GTK+ statically as well
GUI_LIBS_SEMISTATIC=`echo $GUI_LIBS_QUARTSTATIC | sed '
s/-lgtk/-Wl,-Bstatic &/g
s/-lglib/& -Wl,-Bdynamic/g
'`
AC_SUBST(GUI_LIBS_SEMISTATIC)
dnl finally, fully static
GUI_LIBS_STATIC=`echo $WX_LIBS_STATIC | sed 's/-rdynamic//g'`
AC_SUBST(GUI_LIBS_STATIC)
dnl Mac-specific post-link step
if test "$USE_MAC" = 1; then
AC_PATH_PROG(SETFILE, SetFile, true, [$PATH:/Developer/Tools])
REZFLAGS=`$WX_CONFIG_WITH_ARGS --rezflags`
AC_SUBST(REZFLAGS)
fi
dnl we want to have a user-readable wxWidgets port name
WX_NAME=`$WX_CONFIG_WITH_ARGS --basename | sed 's/^wx_//'`
WX_NAME_NO_DEBUG=`echo $WX_NAME | sed 's/d$//'`
if test "$WX_NAME_NO_DEBUG" != "$WX_NAME"; then
WX_NAME="$WX_NAME_NO_DEBUG (debug build)"
fi
case "$USE_THREADS" in 1)
AC_CACHE_CHECK(if wxWidgets was compiled with threads,
m_cv_wx_threads,
[AC_TRY_RUN([#include "wx/setup.h"
int main(){
#ifdef wxUSE_THREADS
return 0;
#else
return 1;
#endif
}],
m_cv_wx_threads=yes,
m_cv_wx_threads=no,
m_cv_wx_threads=x)])
case "$m_cv_wx_threads" in
yes) AC_DEFINE(USE_THREADS) ;;
no) m_cv_USE_THREADS=0 # turn off our option
AC_MSG_WARN([Threads configured but not available]) ;;
x) AC_MSG_WARN([Cross-compiling are we?
Geeze, I hope you know what you're doing...])
m_cv_wx_threads=yes
AC_DEFINE(USE_THREADS) ;;
esac
esac
dnl --------------------------------------------------------------------------
dnl c-client library: set the proper OSTYPE and compiler variables
dnl --------------------------------------------------------------------------
dnl we need to distinguish between different Linux versions before guessing
dnl CCOSTYPE
case "$OSTYPE" in
linux* | Linux*)
AC_CHECK_LIB(pam, pam_end, CCOSTYPE=lnp, CCOSTYPE=slx)
;;
esac
dnl we need to set the target for c-client library except for mingw, for which
dnl we use separate makefile
case "$USE_MINGW" in
0)
case "$USE_CCOSTYPE" in
''|0|1) AC_MSG_CHECKING(for c-client library OS type)
case "$OSTYPE" in
linux* | Linux*)
;; dnl CCOSTYPE already set above
Solaris* | solaris* | SunOS*)
case "$GXX" in
yes) CCOSTYPE=gso ;;
*) CCOSTYPE=sol ;;
esac ;;
freebsd* | FreeBSD*)
CCOSTYPE=bsf ;;
hpux_9*)
CCOSTYPE=hpp ;;
hpux_10*)
CCOSTYPE=hpx ;;
OSF1*)
case "$GXX" in
yes) CCOSTYPE=gof ;;
*) CCOSTYPE=osf ;;
esac ;;
IRIX*)
case "$GXX" in
yes) CCOSTYPE=gsg ;;
*) dnl should use sg6 for IRIX 6.5, sgi otherwise
case `uname -r` in
6.5*) CCOSTYPE=sg6 ;;
*) CCOSTYPE=sgi ;;
esac
esac ;;
darwin* | Darwin*)
CCOSTYPE=osx ;;
OpenBSD*)
CCOSTYPE=bso ;;
NetBSD*)
CCOSTYPE=neb ;;
cygwin* | CYGWIN*)
CCOSTYPE=cyg ;;
*)
AC_MSG_RESULT(unknown)
AC_MSG_ERROR([cannot guess c-client OS type for $OSTYPE,
please have a look at lib/imap/Makefile and use --with-ccostype=xxx
with xxx being the most appropriate system type from this file.])
;;