-
Notifications
You must be signed in to change notification settings - Fork 1
/
aclocal.m4
7452 lines (6670 loc) · 237 KB
/
aclocal.m4
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 ----------------------------------------------------
dnl Platform specific autoconf tests
dnl
dnl This is part of the input for the ./configure script of
dnl the deal.II libraries. All options and paths are stored in
dnl the file common/Make.global_options.
dnl
dnl In doc/Makefile some information on the kind of documentation
dnl is stored.
dnl
dnl
dnl Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors
dnl
dnl $Id: aclocal.m4 24558 2011-10-07 21:11:11Z heister $
dnl -------------------------------------------------------------
dnl Helper macros to add libpaths to LIBS
dnl
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL, dnl
[
LIBS="$LIBS $1"
])
AC_DEFUN(DEAL_II_ADD_EXTERNAL_LIBS_AT_FRONT, dnl
[
LIBS="$1 $LIBS"
])
AC_DEFUN(DEAL_II_EXTERNAL_LIBS_SAVE_VAL, dnl Not reentrant, of course
[
OLD_LIBS="$LIBS"
])
AC_DEFUN(DEAL_II_EXTERNAL_LIBS_RESTORE_VAL, dnl
[
LIBS="$OLD_LIBS"
])
dnl -------------------------------------------------------------
dnl Like AC_PATH_PROG, but do not discard arguments given to the
dnl program. In other words, while
dnl AC_PATH_PROG(CXX, [g++ -pg])
dnl results in CXX=/usr/bin/g++, the result of the current
dnl macro would be CXX="/usr/bin/g++ -pg".
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_PATH_PROG, dnl
[
dnl First get at the name and arguments of the program in $2. Do
dnl so by having a loop over all components of $2 and putting the
dnl components either into $testprog or into $testargs
testprog=""
testargs=""
processingargs="no"
for i in $2 ; do
if test "$processingargs" = "no" ; then
testprog="$i" ;
processingargs="yes" ;
else
testargs="$testargs $i" ;
fi
done
AC_PATH_PROG([$1],[$testprog])
eval "$1=\"${$1} $testargs\""
])
dnl -------------------------------------------------------------
dnl Determine the C++ compiler in use. Return the name and possibly
dnl version of this compiler in GXX_VERSION.
dnl
dnl Usage: DEAL_II_DETERMINE_CXX_BRAND
dnl
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_DETERMINE_CXX_BRAND, dnl
[
dnl It used to be the case that AC_PROG_CXX could properly detect
dnl whether we are working with gcc or not, but then Intel came across
dnl the brilliant idea to disguise it's compiler as gcc by setting
dnl GCC preprocessor variables for versions etc. So we have to figure
dnl out again whether this is really gcc
if test "$GXX" = "yes" ; then
GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "gcc version"`
if test "x$GXX_VERSION_STRING" = "x" ; then
GXX=no
fi
fi
dnl And because it is so convenient, the PathScale compiler also identifies
dnl itself as GCC...
if test "$GXX" = "yes" ; then
GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "PathScale"`
if test "x$GXX_VERSION_STRING" != "x" ; then
GXX=no
fi
fi
if test "$GXX" = yes ; then
dnl find out the right version
GXX_VERSION_STRING=`($CXX -v 2>&1) | grep "gcc version"`
full_version=`echo "$GXX_VERSION_STRING" | perl -pi -e 's/.*version (\d\.\d\.\d).*/\1/g;'`
GXX_BRAND=GNU
GXX_VERSION=gcc`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'`
GXX_VERSION_DETAILED=gcc$full_version
AC_MSG_RESULT([C++ compiler is $GXX_VERSION (subversion $GXX_VERSION_DETAILED)])
else
dnl Check other (non-gcc) compilers
dnl Check for IBM xlC. For some reasons, depending on some environment
dnl variables, moon position, and other reasons unknown to me, the
dnl compiler displays different names in the first line of output, so
dnl check various possibilities
is_ibm_xlc="`($CXX -qversion 2>&1) | grep IBM`"
if test "x$is_ibm_xlc" != "x" ; then
dnl Ah, this is IBM's C++ compiler. Unfortunately, we don't presently
dnl know how to check the version number, so assume that is sufficiently
dnl high...
AC_MSG_RESULT(C++ compiler is IBM xlC)
GXX_BRAND=IBM
GXX_VERSION=ibm_xlc
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Check whether we are dealing with the MIPSpro C++ compiler
mips_pro="`($CXX -version 2>&1) | grep MIPSpro`"
if test "x$mips_pro" != "x" ; then
GXX_BRAND=MIPSpro
case "$mips_pro" in
*7.0* | *7.1* | *7.2* | *7.3*)
dnl MIPSpro 7.3 does not support standard C++, therefore it is not
dnl able to compile deal.II. Previous compiler versions neither.
AC_MSG_RESULT(C++ compiler is $mips_pro)
AC_MSG_ERROR(This compiler is not supported)
GXX_VERSION=MIPSpro7.3
GXX_VERSION_DETAILED="$GXX_VERSION"
;;
*7.4)
AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.4)
AC_MSG_ERROR(This compiler is not supported. Use MIPSPro compiler 7.4x)
GXX_VERSION=MIPSpro7.4
GXX_VERSION_DETAILED="$GXX_VERSION"
;;
*7.41* | *7.42* | *7.43* | *7.44*)
AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.4x)
GXX_VERSION=MIPSpro7.4x
GXX_VERSION_DETAILED="$GXX_VERSION"
;;
*"7.5"*)
AC_MSG_RESULT(C++ compiler is MIPSpro compiler 7.5)
GXX_VERSION=MIPSpro7.5
GXX_VERSION_DETAILED="$GXX_VERSION"
;;
*)
AC_MSG_RESULT(C++ compiler is unknown version but accepted MIPSpro compiler version)
GXX_VERSION=MIPSpro-other
GXX_VERSION_DETAILED="$GXX_VERSION"
;;
esac
else
dnl Intel's ICC C++ compiler? On Linux, it uses -V, on Windows
dnl it is -help
is_intel_icc1="`($CXX -V 2>&1) | grep 'Intel'`"
is_intel_icc2="`($CXX -help 2>&1) | grep 'Intel'`"
is_intel_icc="$is_intel_icc1$is_intel_icc2"
dnl When calling the Portland Group compiler, it also
dnl outputs the string 'Intel' in its help text, so make
dnl sure we're not confused
is_pgi="`($CXX -V 2>&1) | grep 'Portland'`"
if test "x$is_intel_icc" != "x" -a "x$is_pgi" = "x" ; then
GXX_BRAND=Intel
version_string="`($CXX -V 2>&1) | grep 'Version'` `($CXX -help 2>&1) | grep 'Version'`"
version5="`echo $version_string | grep 'Version 5'`"
version6="`echo $version_string | grep 'Version 6'`"
version7="`echo $version_string | grep 'Version 7'`"
version8="`echo $version_string | grep 'Version 8'`"
version9="`echo $version_string | grep 'Version 9'`"
version10="`echo $version_string | grep 'Version 10'`"
version11="`echo $version_string | grep 'Version 11'`"
if test "x$version5" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-5)
GXX_VERSION=intel_icc5
else if test "x$version6" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-6)
GXX_VERSION=intel_icc6
else if test "x$version7" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-7)
GXX_VERSION=intel_icc7
else if test "x$version8" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-8)
GXX_VERSION=intel_icc8
else if test "x$version9" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-9)
GXX_VERSION=intel_icc9
else if test "x$version10" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-10)
GXX_VERSION=intel_icc10
else if test "x$version11" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-11)
GXX_VERSION=intel_icc11
else if test "x$version12" != "x" ; then
AC_MSG_RESULT(C++ compiler is icc-12)
GXX_VERSION=intel_icc12
else
AC_MSG_RESULT(C++ compiler is icc)
GXX_VERSION=intel_icc
fi fi fi fi fi fi fi fi
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Or DEC's cxx compiler?
is_dec_cxx="`($CXX -V 2>&1) | grep 'Compaq C++'`"
if test "x$is_dec_cxx" != "x" ; then
AC_MSG_RESULT(C++ compiler is Compaq-cxx)
GXX_BRAND=Compaq
GXX_VERSION=compaq_cxx
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Sun Workshop/Studio?
is_sun_cc_1="`($CXX -V 2>&1) | grep 'Sun WorkShop'`"
is_sun_cc_2="`($CXX -V 2>&1) | grep 'Sun C++'`"
if test "x$is_sun_cc_1$is_sun_cc_2" != "x" ; then
AC_MSG_RESULT(C++ compiler is Sun Workshop compiler)
GXX_BRAND=SunWorkshop
GXX_VERSION=sun_workshop
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Sun Forte?
is_sun_forte_cc="`($CXX -V 2>&1) | grep 'Forte'`"
if test "x$is_sun_forte_cc" != "x" ; then
AC_MSG_RESULT(C++ compiler is Sun Forte compiler)
GXX_BRAND=SunForte
GXX_VERSION=sun_forte
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Portland Group C++?
is_pgcc="`($CXX -V 2>&1) | grep 'Portland Group'`"
if test "x$is_pgcc" != "x" ; then
GXX_VERSION_STRING=`($CXX -V 2>&1) | grep "^pgCC"`
full_version=`echo "$GXX_VERSION_STRING" | perl -pi -e 's/.*pgCC\s+(\S+).*/\1/g;'`
GXX_BRAND=PortlandGroup
GXX_VERSION=pgCC`echo $full_version | perl -pi -e 's/(\d\.\d).*/\1/g;'`
GXX_VERSION_DETAILED=pgCC"$full_version"
AC_MSG_RESULT(C++ compiler is Portland Group C++ $full_version)
else
dnl HP aCC?
is_aCC="`($CXX -V 2>&1) | grep 'aCC'`"
if test "x$is_aCC" != "x" ; then
AC_MSG_RESULT(C++ compiler is HP aCC)
GXX_BRAND=HP
GXX_VERSION=hp_aCC
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Borland C++
is_bcc="`($CXX -h 2>&1) | grep 'Borland'`"
if test "x$is_bcc" != "x" ; then
AC_MSG_RESULT(C++ compiler is Borland C++)
GXX_BRAND=Borland
GXX_VERSION=borland_bcc
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl KAI C++? It seems as if the documented options
dnl -V and --version are not always supported, so give
dnl the whole thing a second try by looking for /KCC/
dnl somewhere in the paths that are output by -v. This
dnl is risky business, since this combination of
dnl characters might appear on other installations
dnl of other compilers as well, so put this test to
dnl the very end of the detection chain for the
dnl various compilers
is_kai_cc="`($CXX --version 2>&1) | grep 'KAI C++'`"
is_kai_cc="$is_kai_cc`($CXX -v 2>&1) | grep /KCC/`"
if test "x$is_kai_cc" != "x" ; then
AC_MSG_RESULT(C++ compiler is KAI C++)
GXX_BRAND=KAI
GXX_VERSION=kai_cc
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Maybe PathScale's compiler?
is_pathscale="`($CXX -v 2>&1) | grep PathScale`"
if test "x$is_pathscale" != "x" ; then
AC_MSG_RESULT(C++ compiler is PathScale C++)
GXX_BRAND=PathScale
GXX_VERSION=pathscale_cc
GXX_VERSION_DETAILED="$GXX_VERSION"
else
is_clang="`($CXX --version 2>&1) | grep clang`"
if test "x$is_clang" != x ; then
AC_MSG_RESULT(C++ compiler is clang)
GXX_BRAND=clang
GXX_VERSION=clang
GXX_VERSION_DETAILED="$GXX_VERSION"
else
dnl Aw, nothing suitable found...
AC_MSG_RESULT(Unrecognized C++ compiler -- Try to go ahead and get help from [email protected])
GXX_BRAND=Unknown
GXX_VERSION=unknown_cc
GXX_VERSION_DETAILED="$GXX_VERSION"
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
fi
])
dnl -------------------------------------------------------------
dnl See whether the compiler we have has MPI built in (e.g. if it
dnl is actually mpiCC, etc)
dnl
dnl Usage: DEAL_II_DETERMINE_IF_SUPPORTS_MPI
dnl
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_DETERMINE_IF_SUPPORTS_MPI, dnl
[
AC_MSG_CHECKING(if the compiler is built for MPI)
AC_TRY_LINK(
[
#include <mpi.h>
],
[
MPI_Init (0,0);
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(DEAL_II_COMPILER_SUPPORTS_MPI, 1,
[Defined if the compiler supports including <mpi.h>])
DEAL_II_COMPILER_SUPPORTS_MPI=1
DEAL_II_USE_MPI=yes
],
[
AC_MSG_RESULT(no)
])
])
dnl -------------------------------------------------------------
dnl Set C++ compiler flags to their default values. They will be
dnl modified according to other options in later steps of
dnl configuration
dnl
dnl CXXFLAGSO : flags for optimized mode
dnl CXXFLAGSG : flags for debug mode
dnl CXXFLAGSPIC: flags for generation of object files that are suitable
dnl for shared libs
dnl LDFLAGSPIC : flags needed for linking of object files to shared
dnl libraries
dnl
dnl Usage: DEAL_II_SET_CXX_FLAGS
dnl
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_SET_CXX_FLAGS, dnl
[
dnl If CXXFLAGSG or CXXFLAGSO are not set, then initialize them with
dnl CXXFLAGS
if test "x$CXXFLAGSG" = "x" ; then
CXXFLAGSG="$CXXFLAGS" ;
fi
if test "x$CXXFLAGSO" = "x" ; then
CXXFLAGSO="$CXXFLAGS" ;
fi
dnl In no case do we want to induce BOOST to use deprecated header files
CXXFLAGSG="$CXXFLAGSG -DBOOST_NO_HASH -DBOOST_NO_SLIST"
CXXFLAGSO="$CXXFLAGSO -DBOOST_NO_HASH -DBOOST_NO_SLIST"
dnl First the flags for gcc compilers
if test "$GXX" = yes ; then
CXXFLAGSO="$CXXFLAGSO -O2 -funroll-loops -funroll-all-loops -fstrict-aliasing -Wuninitialized -felide-constructors -ftemplate-depth-128"
CXXFLAGSG="$CXXFLAGSG -DDEBUG -Wall -W -Wpointer-arith -Wwrite-strings -Wsynth -Wsign-compare -Wswitch -ftemplate-depth-128"
dnl gcc 4.4 has an interesting problem in that it doesn't
dnl care for one of BOOST signals2's header files and produces
dnl dozens of pages of error messages of the form
dnl warning: invoking macro BOOST_PP_CAT argument 1: empty macro arguments are undefined in ISO C90 and ISO C++98
dnl This can be avoided by not using -pedantic for this compiler.
dnl For all other versions, we use this flag, however.
if test $GXX_VERSION != gcc4.4 ; then
CXXFLAGS="$CXXFLAGS -pedantic"
fi
dnl BOOST uses long long, so don't warn about this
CXXFLAGSG="$CXXFLAGSG -Wno-long-long"
dnl See whether the gcc we use already has a flag for C++1x features.
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-std=c++0x
AC_MSG_CHECKING(whether compiler has a flag to support C++1x)
AC_TRY_COMPILE([], [;],
[
AC_MSG_RESULT(yes)
test_cxx1x=yes
],
[
AC_MSG_RESULT(no)
test_cxx1x=no
])
CXXFLAGS="${OLD_CXXFLAGS}"
if test "x$test_cxx1x" = "xyes" ; then
DEAL_II_CHECK_CXX1X_COMPONENTS("-std=c++0x")
fi
dnl On some gcc 4.3 snapshots, a 'const' qualifier on a return type triggers a
dnl warning. This is unfortunate, since we happen to stumble on this
dnl in some of our template trickery with iterator classes. If necessary,
dnl do not use the relevant warning flag
CXXFLAGS="-Wreturn-type -Werror"
AC_MSG_CHECKING(whether qualifiers in return types lead to a warning)
AC_TRY_COMPILE(
[
const double foo() { return 1.; }
],
[;],
[
AC_MSG_RESULT(no)
],
[
AC_MSG_RESULT(yes)
CXXFLAGSG="$CXXFLAGSG -Wno-return-type"
])
dnl Newer versions of gcc can pass a flag to the assembler to
dnl compress debug sections. At the time of writing this test,
dnl this can save around 230 MB of disk space on the object
dnl files we produce (810MB down to 570MB for the debug versions
dnl of object files). Unfortunately, the sections have to be
dnl unpacked again when they are put into the shared libs, so
dnl no savings there.
CXXFLAGS="-Wa,--compress-debug-sections"
AC_MSG_CHECKING([whether the assembler understands -Wa,--compress-debug-sections])
AC_TRY_LINK(
[
],
[;],
[
AC_MSG_RESULT(yes)
CXXFLAGSG="$CXXFLAGSG -Wa,--compress-debug-sections"
],
[
AC_MSG_RESULT(no)
])
dnl Set PIC flags. On some systems, -fpic/PIC is implied, so don't set
dnl anything to avoid a warning. on AIX make sure we always pass -lpthread
dnl because this seems to be somehow required to make things work. Likewise
dnl DEC OSF and linux on x86_64.
case "$target" in
*aix* )
CXXFLAGSPIC=
LDFLAGSPIC=
LDFLAGS="$LDFLAGS -lpthread"
;;
*dec-osf* )
CXXFLAGSPIC="-fPIC"
LDFLAGSPIC="-fPIC"
LDFLAGS="$LDFLAGS -lpthread"
;;
*x86_64*)
CXXFLAGSPIC="-fPIC"
LDFLAGSPIC="-fPIC"
LDFLAGS="$LDFLAGS -lpthread"
;;
*cygwin* )
dnl On Cygwin, when using shared libraries, there might occur
dnl difficulties when linking libraries for several dimensions,
dnl as some symbols are defined in all of them. This leads to a
dnl linker error. We force the linker to ignore multiple symbols,
dnl but of course this might lead to strange program behaviour if
dnl you accidentally defined one symbol multiple times...
dnl (added 2005/07/13, Ralf B. Schulz)
dnl (modified 2005/12/20, Ralf B. Schulz)
CXXFLAGSPIC=
LDFLAGS="$LDFLAGS -Xlinker --allow-multiple-definition"
SHLIBFLAGS="$SHLIBFLAGS -Xlinker --allow-multiple-definition"
;;
*)
CXXFLAGSPIC="-fPIC"
LDFLAGSPIC="-fPIC"
;;
esac
dnl Some gcc compiler versions have a problem when using an unsigned count
dnl in the std::advance function. Unfortunately, this also happens
dnl occasionally from within the standard library, so we can't prevent the
dnl warning messages. Since this is annoying, switch of the flag -W which
dnl causes this.
DEAL_II_CHECK_ADVANCE_WARNING
if test "x$DEAL_II_ADVANCE_WARNING" = "xyes" ; then
CXXFLAGSG="`echo $CXXFLAGSG | perl -pi -e 's/-W //g;'`"
fi
if test "x$DEAL_II_USE_MPI" = "xyes" ; then
AC_MSG_CHECKING(whether MPI headers have unused parameters)
CXXFLAGS="-Wunused-parameter -Werror"
AC_TRY_COMPILE(
[
#include <mpi.h>
],
[;],
[
AC_MSG_RESULT(no)
],
[
AC_MSG_RESULT(yes)
CXXFLAGSG="$CXXFLAGSG -Wno-unused-parameter"
CXXFLAGSO="$CXXFLAGSO -Wno-unused-parameter"
])
fi
dnl Some system specific things
case "$target" in
dnl Use -Wno-long-long on Apple Darwin to avoid some unnecessary
dnl warnings. However, newer gccs on that platform do not have
dnl this flag any more, so check whether we can indeed do this
dnl
dnl Also, the TBB tries to determine whether the system is
dnl 64-bit enabled and if so, it builds the object files in 64bit.
dnl In order to be able to link with these files, we then have to
dnl link with -m64 as well
*apple-darwin*)
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=-Wno-long-double
AC_MSG_CHECKING(whether we can use -Wno-long-double)
AC_TRY_COMPILE([], [;],
[
AC_MSG_RESULT(yes)
CXXFLAGSG="$CXXFLAGSG -Wno-long-double"
CXXFLAGSO="$CXXFLAGSO -Wno-long-double"
],
[
AC_MSG_RESULT(no)
])
if test "`/usr/sbin/sysctl -n hw.optional.x86_64`" = "1" ; then
CXXFLAGS="$CXXFLAGS -m64"
CXXFLAGSG="$CXXFLAGSG -m64"
CXXFLAGSO="$CXXFLAGSO -m64"
LDFLAGS="$LDFLAGS -m64"
fi
CXXFLAGS="${OLD_CXXFLAGS}"
;;
dnl On DEC OSF, including both stdio.h and unistd.h causes a warning
dnl from the preprocessor that cuserid is redefined as a preprocessor
dnl variable. Suppress this if necessary by switching off warnings
dnl from the preprocessor
*dec-osf*)
AC_MSG_CHECKING(for preprocessor warning with cuserid)
CXXFLAGS="$CXXFLAGSG -Werror"
AC_TRY_COMPILE(
[
# include <stdio.h>
# include <unistd.h>
],
[;],
[
AC_MSG_RESULT(no)
],
[
AC_MSG_RESULT(yes)
CXXFLAGSG="$CXXFLAGSG -Wp,-w"
CXXFLAGSO="$CXXFLAGSO -Wp,-w"
])
;;
esac
SHLIBLD="$CXX"
else
dnl Non-gcc compilers. By default, use the C++ compiler also for linking
dnl shared libraries. If some compiler cannot do that and needs something
dnl different, then this must be specified in the respective section
dnl below, overriding this define:
SHLIBLD="$CXX"
case "$GXX_VERSION" in
ibm_xlc)
dnl Set flags for IBM's xlC compiler. As of version 11.1, it still
dnl doesn't grok all of deal.II, but it's getting closer. The
dnl -qxflag=EnableIssue214PartialOrdering flag is necessary to
dnl resolve code like this that we have in the MemoryConsumption
dnl namespace:
dnl ----------------------------------------------
dnl template <typename T> void f (T* const);
dnl template <typename T> void f (const T &);
dnl
dnl void g() {
dnl int *p;
dnl f(p);
dnl }
dnl ----------------------------------------------
CXXFLAGSG="$CXXFLAGSG -DDEBUG -check=bounds -info=all -qrtti=all -qsuppress=1540-2907 -qsuppress=1540-2909 -qxflag=EnableIssue214PartialOrdering"
CXXFLAGSO="$CXXFLAGSO -O2 -w -qansialias -qrtti=all -qsuppress=1540-2907 -qsuppress=1540-2909 -qxflag=EnableIssue214PartialOrdering"
CXXFLAGSPIC="-qpic"
LDFLAGSPIC="-qpic"
;;
MIPSpro*)
dnl Disable some compiler warnings, as they trigger some warnings in
dnl system and compiler include files
dnl cc-1429 CC: WARNING File = /usr/include/internal/stdlib_core.h, Line = 128
dnl The type "long long" is nonstandard.
dnl cc-1066 CC: WARNING File = /usr/include/CC/stl_ctype.h, Line = 28
dnl The indicated enumeration value is out of "int" range.
dnl cc-1485 CC: WARNING File = /usr/include/CC/iomanip, Line = 122
dnl This form for taking the address of a member function is nonstandard.
CXXFLAGSG="$CXXFLAGSG -DDEBUG -D__sgi__ -no_auto_include -ansiW -woff 1429,1066,1485"
dnl Disable some compiler warnings, that warn about variables
dnl which are used in Assert templates but not in optimized mode
dnl cc-1174 CC: full_matrix.templates.h, Line = 1461
dnl The variable "typical_diagonal_element" was declared but never referenced.
dnl cc-1552 CC: WARNING File = source/data_out_base.cc, Line = 3493
dnl The variable "ierr" is set but never used.
CXXFLAGSO="$CXXFLAGSO -D__sgi__ -O2 -no_auto_include -woff 1174,1552"
CXXFLAGSPIC="-KPIC"
LDFLAGSPIC="-KPIC"
dnl Avoid output of prelinker (-quiet_prelink)
dnl Disable compiler warning:
dnl ld32: WARNING 131: Multiply defined weak symbol:
dnl (_M_acquire_lock__Q2_3std15_STL_mutex_lockGv) in auto_derivative_function.g.o
dnl and convergence_table.g.o (2nd definition ignored)
LDFLAGS="$LDFLAGS -quiet_prelink -woff 131"
dnl
dnl Always link with math library: The -lm option must be at the end of the
dnl linker command, therefore it cannot be included into LDFLAGS
DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lm)
;;
clang*)
dnl Like many other compilers, clang produces warnings for array
dnl accesses out of bounds, even if they are in code that's dead
dnl for this dimension. Suppress this.
dnl
dnl There are a number of other warnings we get that can't easily
dnl be worked around and that are definitely not useful. Suppress
dnl those too.
CXXFLAGSG="$CXXFLAGS -DDEBUG -g -Wall -Wno-array-bounds -Wno-parentheses -Wno-delete-non-virtual-dtor -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-variable"
CXXFLAGSO="$CXXFLAGS -O2 -Wno-array-bounds -Wno-parentheses -Wno-delete-non-virtual-dtor -Wno-unneeded-internal-declaration -Wno-unused-function -Wno-unused-variable"
CXXFLAGSPIC="-fPIC"
LDFLAGSPIC="-fPIC"
;;
intel_icc*)
dnl Earlier icc versions used -Kxxx for flags. Later versions use
dnl the gcc convention -fxxx. Also, at least since icc11, the
dnl flag -inline_debug_info has been deprecated, so don't use
dnl it any more
dnl
dnl Exception handling is also standard in later versions, as is rtti
case "$GXX_VERSION" in
intel_icc5 | intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9)
CXXFLAGSG="$CXXFLAGSG -Kc++eh -Krtti -DDEBUG -inline_debug_info"
CXXFLAGSO="$CXXFLAGSO -Kc++eh -Krtti -O2 -unroll"
CXXFLAGSPIC="-KPIC"
LDFLAGSPIC="-KPIC"
;;
intel_icc*)
CXXFLAGSG="$CXXFLAGSG -DDEBUG"
CXXFLAGSO="$CXXFLAGSO -O2 -unroll"
CXXFLAGSPIC="-fPIC"
LDFLAGS="$LDFLAGS -lstdc++ -lpthread"
LDFLAGSPIC="-fPIC"
;;
esac
dnl Disable some compiler warnings, as they often are wrong on
dnl our code:
dnl #11: ` unrecognized preprocessing directive" (we use
dnl #warning at one place)
dnl #175: `subscript out of range' (doesn't take into account that
dnl some code is only reachable for some dimensions)
dnl #327: `NULL reference is not allowed' (this happens when we
dnl write "*static_cast<double*>(0)" or some such thing,
dnl which we do to create invalid references)
dnl #424: `extra ";" ignored'
dnl #525: `type "DataOutBase::DataOutBase" is an inaccessible type
dnl (allowed for compatibility)' (I don't understand what the
dnl compiler means)
dnl #734: `X::X(const X&), required for copy that was eliminated, is
dnl inaccessible'
dnl (valid, but annoying and sometimes hard to work around)
dnl #858: `type qualifier on return type is meaningless'
dnl (on conversion operators to types that are already const)
CXXFLAGSG="$CXXFLAGSG -w1 -wd175 -wd525 -wd327 -wd424 -wd11 -wd734 -wd858"
CXXFLAGSO="$CXXFLAGSO -w0 -wd424 -wd11"
dnl To reduce output, use -opt_report_levelmin where possible,
dnl i.e. post icc5. from icc10 onwards, this flag is called
dnl -opt-report, and -vec-report controls output of the
dnl autovectorizer (to make things simpler, one of the two options
dnl wants a space between option and level, whereas the other does
dnl not)
dnl
dnl Since only the x86 and x86_64 compilers can vectorize, this
dnl flag needs to be suppressed on ia64 (itanium)
case "$GXX_VERSION" in
intel_icc5)
;;
intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9)
CXXFLAGSO="$CXXFLAGSO -opt_report_levelmin"
;;
*)
case "$target" in
*ia64*)
CXXFLAGSO="$CXXFLAGSO -opt-report 0"
;;
*)
CXXFLAGSO="$CXXFLAGSO -opt-report 0 -vec-report0"
;;
esac
;;
esac
dnl Some versions of icc on some platforms issue a lot of warnings
dnl about the unreliability of floating point comparisons. Check
dnl whether we can switch that off
DEAL_II_ICC_WD_1572
dnl We would really like to use -ansi -Xc, since that
dnl is _very_ picky about standard C++, and is thus very efficient
dnl in detecting slight standard violations, but these flags are
dnl also very efficient in crashing the compiler (it generates a
dnl segfault), at least with versions prior to 7.0. So only
dnl use these flags with versions we know are safe
dnl
dnl Second thing: icc7 allows using alias information for
dnl optimization. Use this.
if test "x$GXX_VERSION" = "xintel_icc7"; then
CXXFLAGSG="$CXXFLAGSG -Xc -ansi"
CXXFLAGSO="$CXXFLAGSO -ansi_alias"
dnl For icc8:
dnl avoid the annoying `LOOP WAS VECTORIZED' remarks
dnl use -vec_report0 for reducing output
else if test "x$GXX_VERSION" = "xintel_icc8" ; then
CXXFLAGSO="$CXXFLAGSO -ansi_alias -vec_report0"
fi fi
dnl If we are on an x86 platform, add -tpp6 to optimization
dnl flags (for version <10), or the equivalent for later
dnl processors
case "$target" in
*x86_64*)
LDFLAGS="$LDFLAGS -lpthread"
;;
*86*)
case "$GXX_VERSION" in
intel_icc5)
;;
intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9)
CXXFLAGSO="$CXXFLAGSO -tpp6"
;;
*)
CXXFLAGSO="$CXXFLAGSO -mcpu=pentium4"
;;
esac
;;
esac
;;
compaq_cxx)
dnl Disable some warning messages:
dnl #11: ` unrecognized preprocessing directive" (we use
dnl #warning at one place)
dnl #175: `subscript out of range' (detected when instantiating a
dnl template and looking at the indices of an array of
dnl template dependent size, this error is triggered in a
dnl branch that is not taken for the present space dimension)
dnl #236 and
dnl #237: `controlling expression is constant' (in while(true), or
dnl switch(dim))
dnl #381: `extra ";" ignored' (at function or namespace closing
dnl brace)
dnl #487: `Inline function ... cannot be explicitly instantiated'
dnl (also reported when we instantiate the entire class)
dnl #1136:`conversion to integral type of smaller size could lose data'
dnl (occurs rather often in addition of int and x.size(),
dnl because the latter is size_t=long unsigned int on Alpha)
dnl #1156:`meaningless qualifiers not compatible with "..." and "..."'
dnl (cause unknown, happens when taking the address of a
dnl template member function)
dnl #111 and
dnl #1182:`statement either is unreachable or causes unreachable code'
dnl (happens in switch(dim) clauses for other dimensions than
dnl the present one)
dnl #450:`the type "long long" is nonstandard'
dnl BOOST uses long long, unfortunately
dnl
dnl Also disable the following error:
dnl #265: `class "..." is inaccessible' (happens when we try to
dnl initialize a static member variable in terms of another
dnl static member variable of the same class if the latter is
dnl not public and therefore not accessible at global scope in
dnl general. I nevertheless think that this is valid.)
dnl
dnl Besides this, choose the most standard conforming mode of the
dnl compiler, i.e. -model ansi and -std strict_ansi. Unfortunately,
dnl we have to also add the flag -implicit_local (generating implicit
dnl instantiations of template with the `weak' link flag) since
dnl otherwise not all templates are instantiated (also some from the
dnl standards library are missing).
CXXFLAGSG="$CXXFLAGSG -model ansi -std strict_ansi -w1 -msg_display_number -timplicit_local -DDEBUG"
CXXFLAGSO="$CXXFLAGSO -model ansi -std strict_ansi -w2 -msg_display_number -timplicit_local -fast"
for i in 11 175 236 237 381 487 1136 1156 111 1182 265 450 ; do
CXXFLAGSG="$CXXFLAGSG -msg_disable $i"
CXXFLAGSO="$CXXFLAGSO -msg_disable $i"
done
dnl If we use -model ansi to compile the files, we also have to
dnl specify it for linking
LDFLAGS="$LDFLAGS -model ansi"
dnl For some reason, cxx also forgets to add the math lib to the
dnl linker line, so we do that ourselves
LDFLAGS="$LDFLAGS -lm"
CXXFLAGSPIC="-shared"
LDFLAGSPIC=""
;;
sun_workshop | sun_forte)
CXXFLAGSG="$CXXFLAGSG -DDEBUG -w"
CXXFLAGSO="$CXXFLAGSO -w"
CXXFLAGSPIC="-KPIC"
LDFLAGSPIC="-G"
dnl See if the flag -library=stlport4 is available, and if so use it
CXXFLAGS="$CXXFLAGSG -library=stlport4"
AC_MSG_CHECKING(whether -library=stlport4 works)
AC_TRY_COMPILE(
[
],
[
;
],
[
AC_MSG_RESULT(yes)
CXXFLAGSG="$CXXFLAGSG -library=stlport4"
CXXFLAGSO="$CXXFLAGSO -library=stlport4"
],
[
AC_MSG_RESULT(no)
])
;;
pgCC*)
dnl Suppress warnings:
dnl #68: "integer conversion resulted in a change of sign". This
dnl is what we get every time we use
dnl numbers::invalid_unsigned_int
dnl #111: "Statement unreachable": we use return statements
dnl occasionally after case-switches where you cannot
dnl fall though, but other compilers sometimes complain
dnl that the function might not return with a value, if
dnl it can't figure out that the function always uses
dnl one case. Also: a return statement after a failing
dnl assertion
dnl #128: a similar case -- code not reachable because there's
dnl a return that's active for a particular space dimension
dnl #155: no va_start() seen -- happens alwas in lines 138 and 891
dnl and seems to be spurious
dnl #177: "function declared but not used": might happen with
dnl templates and conditional compilation
dnl #175: "out-of-bounds array indices": the same reason as
dnl for Compaq cxx
dnl #185: "dynamic initialization in unreachable code". similar to
dnl the case #128 above
dnl #236: "controlling expression is constant". this triggers
dnl somewhere in BOOST with BOOST_ASSERT. I have no idea
dnl what happens here
dnl #284: "NULL references not allowed"
CXXFLAGSG="$CXXFLAGSG -DDEBUG -g --display_error_number --diag_suppress 68 --diag_suppress 111 --diag_suppress 128 --diag_suppress 155 --diag_suppress 177 --diag_suppress 175 --diag_suppress 185 --diag_suppress 236 --diag_suppress 284"
CXXFLAGSO="$CXXFLAGSO -fast -O2 --display_error_number --diag_suppress 68 --diag_suppress 111 --diag_suppress 128 --diag_suppress 155 --diag_suppress 177 --diag_suppress 175 --diag_suppress 185 --diag_suppress 236 --diag_suppress 284"
CXXFLAGSPIC="-Kpic"
;;
kai_cc)
CXXFLAGSG="$CXXFLAGSG --strict -D__KAI_STRICT --max_pending_instantiations 32 --display_error_number -g +K0 --no_implicit_typename"
CXXFLAGSO="$CXXFLAGSO +K3 -O2 --abstract_float --abstract_pointer -w --display_error_number --max_pending_instantiations 32 --display_error_number"
CXXFLAGSPIC="-fPIC"
;;
hp_aCC)
dnl ??? disable warning 655 (about all-inlined functions) which
dnl triggers for each and every of our DeclExceptionX calls ???
CXXFLAGSG="$CXXFLAGSG -g1 -AA +p"
CXXFLAGSO="$CXXFLAGSO -z +O2 -AA"
CXXFLAGSPIC="+Z"
# for linking shared libs, -b is also necessary...
;;
borland_bcc)
CXXFLAGSG="$CXXFLAGSG -q -DDEBUG -w -w-use -w-amp -w-prc"
CXXFLAGSO="$CXXFLAGSO -q -O2"
CXXFLAGSPIC=""
LDFLAGSPIC=""
AC_MSG_ERROR(Attention! deal.II is not known to work with Borland C++!
If you intend to port it to Borland C++, please remove this message from aclocal.m4 and call autoconf and configure. If you do not understand this, you will NOT want to do it!)
;;
pathscale_cc)
CXXFLAGSG="$CXXFLAGSG -DDEBUG -g"
CXXFLAGSO="$CXXFLAGSO -O3"
;;
*)
CXXFLAGSG="$CXXFLAGSG -DDEBUG"
CXXFLAGSO="$CXXFLAGSO -O2"
AC_MSG_RESULT(Unknown C++ compiler - using generic options)
;;
esac
fi
])
dnl -------------------------------------------------------------
dnl Depending on what compiler we use, set the flag necessary to
dnl obtain debug output. We will usually use -ggdb, but on DEC Alpha
dnl OSF1, this leads to stabs symbols that are too long for the system
dnl assembler. We will therefore check whether the assembler can handle
dnl these symbols by a rather perverse function with many templates,
dnl and if the assembler can't handle them, then use -gstabs
dnl instead. This reduces debugging possibilities, but no other
dnl way is known at present.
dnl
dnl For all compilers other than gcc, use -g instead and don't check.
dnl
dnl Usage: DEAL_II_SET_CXX_DEBUG_FLAG
dnl
dnl -------------------------------------------------------------
AC_DEFUN(DEAL_II_SET_CXX_DEBUG_FLAG, dnl
[
if test "$GXX" = yes ; then
case "$target" in
dnl On Alpha, use the special treatment
alpha*-osf*)
AC_MSG_CHECKING(whether -ggdb works for long symbols)
CXXFLAGS="-ggdb $CXXFLAGSG"
AC_TRY_COMPILE(
[
# include <string>
# include <map>
using namespace std;
typedef map<string,map<string,pair<string,string> > > T;
bool f(T& t1, const T* t2) {
t1["s"] = map<string,pair<string,string> >();
map<string,map<string,pair<string,string> > >
::const_iterator i2=t1.begin();
map<string,map<string,pair<string,string> > >
::const_iterator i1=t2->begin();
return (i1==i2);