File: configure.ac

package info (click to toggle)
alberta 3.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,176 kB
  • sloc: ansic: 135,836; cpp: 6,601; makefile: 2,801; sh: 333; fortran: 180; lisp: 177; xml: 30
file content (978 lines) | stat: -rw-r--r-- 36,218 bytes parent folder | download
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
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([alberta],[3.1.1],[alberta-fem@math.tu-dortmund.de])
AC_CONFIG_SRCDIR([alberta/src/Common/alberta.h])
AC_CONFIG_MACRO_DIR([m4])

AM_MAINTAINER_MODE
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

AS_SHELL_SANITIZE
AS_CASE([${target}],[*apple-darwin*],[OSX=true],[OSX=false])

AM_INIT_AUTOMAKE([1.15 tar-pax subdir-objects])
AC_CONFIG_HEADERS([config.h])

pkglibexecdir="${libexecdir}/${PACKAGE_NAME}-${PACKAGE_VERSION}"
AC_SUBST([pkglibexecdir])

ALBERTA_SET_PREFIX

#
# pkgconfig stuff with greetings to Christoph
#
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR

#
# all CONFIG_FILES for the ALBERTA libraries are added through the
# ALBERT_DIMENSION_ENABLE/DISABLE() macros
#
AC_CONFIG_FILES([alberta-utilities.pctmpl:alberta-utilities.pc.in
                 alberta-fem.pctmpl:alberta-fem.pc.in
                 alberta-grid.pctmpl:alberta-grid.pc.in
                 alberta-gfx.pctmpl:alberta-gfx.pc.in
                 Makefile
                 alberta_util/Makefile alberta_util/src/Makefile
                 alberta_util/src/alberta_util_inlines.h.in
                 alberta_util/src/alberta_util.h.in
		 add_ons/Makefile
		 add_ons/libalbas/Makefile
		 add_ons/libalbas/src/Makefile
                 add_ons/libalbas/tests/Makefile
                 add_ons/block_solve/Makefile
		 add_ons/block_solve/src/Makefile
		 add_ons/block_solve/demo/Makefile
		 add_ons/block_solve/demo/2d/Makefile
		 add_ons/geomview/Makefile
		 add_ons/grape/Makefile
		 add_ons/grape/mesh/Makefile
                 add_ons/grape/mesh/2d/Makefile
                 add_ons/grape/mesh/3d/Makefile
		 add_ons/meshtv/Makefile
		 add_ons/meshtv/1d/Makefile
		 add_ons/meshtv/2d/Makefile
		 add_ons/meshtv/3d/Makefile
		 add_ons/gmv/Makefile
		 add_ons/gmv/1d/Makefile
		 add_ons/gmv/2d/Makefile
		 add_ons/gmv/3d/Makefile
		 add_ons/paraview/Makefile
		 add_ons/paraview/2d/Makefile
		 add_ons/paraview/3d/Makefile
                 add_ons/bamg2alberta/Makefile
		 add_ons/static_condensation/Makefile
		 add_ons/static_condensation/src/Makefile
		 add_ons/static_condensation/demo/Makefile
		 add_ons/static_condensation/demo/2d/Makefile
		 add_ons/static_condensation/demo/3d/Makefile
		 add_ons/triangle2alberta/Makefile
                 alberta/tests/book-demo/Makefile
                 alberta/tests/book-demo/1d/Makefile
                 alberta/tests/book-demo/2d/Makefile
                 alberta/tests/book-demo/3d/Makefile
                 alberta/tests/book-demo/4d/Makefile
                 alberta/tests/book-demo/5d/Makefile
		 alberta/Makefile
		 alberta/tests/Makefile
		 alberta/src/Makefile
		 alberta/src/Common/Makefile
		 alberta/src/Common/Makefile.alberta
		 alberta/src/alberta_Nd/Makefile
		 alberta/src/alberta_Nd_debug/Makefile
                 alberta/src/alberta_Nd_profile/Makefile
                 gnu-compat/Makefile])

# create symbolic links for init and macro files, so tests can find them in case of out-of-source builds
AC_CONFIG_LINKS([
  alberta/tests/book-demo/1d/INIT/ellipt-periodic.dat:alberta/tests/book-demo/1d/INIT/ellipt-periodic.dat
  alberta/tests/book-demo/1d/INIT/ellipt.dat:alberta/tests/book-demo/1d/INIT/ellipt.dat
  alberta/tests/book-demo/1d/INIT/heat.dat:alberta/tests/book-demo/1d/INIT/heat.dat
  alberta/tests/book-demo/1d/INIT/nonlin.dat:alberta/tests/book-demo/1d/INIT/nonlin.dat
  alberta/tests/book-demo/1d/Macro/macro-big_2d.amc:alberta/tests/book-demo/1d/Macro/macro-big_2d.amc
  alberta/tests/book-demo/1d/Macro/macro-big.amc:alberta/tests/book-demo/1d/Macro/macro-big.amc
  alberta/tests/book-demo/1d/Macro/macro.amc:alberta/tests/book-demo/1d/Macro/macro.amc
  alberta/tests/book-demo/1d/Macro/periodic.amc:alberta/tests/book-demo/1d/Macro/periodic.amc
  alberta/tests/book-demo/2d/INIT/ellipt-dg.dat:alberta/tests/book-demo/2d/INIT/ellipt-dg.dat
  alberta/tests/book-demo/2d/INIT/ellipt-isoparam.dat:alberta/tests/book-demo/2d/INIT/ellipt-isoparam.dat
  alberta/tests/book-demo/2d/INIT/ellipt-periodic.dat:alberta/tests/book-demo/2d/INIT/ellipt-periodic.dat
  alberta/tests/book-demo/2d/INIT/ellipt-sphere.dat:alberta/tests/book-demo/2d/INIT/ellipt-sphere.dat
  alberta/tests/book-demo/2d/INIT/ellipt-torus.dat:alberta/tests/book-demo/2d/INIT/ellipt-torus.dat
  alberta/tests/book-demo/2d/INIT/ellipt.dat:alberta/tests/book-demo/2d/INIT/ellipt.dat
  alberta/tests/book-demo/2d/INIT/heat.dat:alberta/tests/book-demo/2d/INIT/heat.dat
  alberta/tests/book-demo/2d/INIT/nonlin.dat:alberta/tests/book-demo/2d/INIT/nonlin.dat
  alberta/tests/book-demo/2d/INIT/quasi-stokes-slip.dat:alberta/tests/book-demo/2d/INIT/quasi-stokes-slip.dat
  alberta/tests/book-demo/2d/INIT/quasi-stokes.dat:alberta/tests/book-demo/2d/INIT/quasi-stokes.dat
  alberta/tests/book-demo/2d/INIT/stokes.dat:alberta/tests/book-demo/2d/INIT/stokes.dat
  alberta/tests/book-demo/2d/Macro/embedded-sphere.amc:alberta/tests/book-demo/2d/Macro/embedded-sphere.amc
  alberta/tests/book-demo/2d/Macro/embedded-torus.amc:alberta/tests/book-demo/2d/Macro/embedded-torus.amc
  alberta/tests/book-demo/2d/Macro/macro_3d.amc:alberta/tests/book-demo/2d/Macro/macro_3d.amc
  alberta/tests/book-demo/2d/Macro/macro-1.amc:alberta/tests/book-demo/2d/Macro/macro-1.amc
  alberta/tests/book-demo/2d/Macro/macro-2.amc:alberta/tests/book-demo/2d/Macro/macro-2.amc
  alberta/tests/book-demo/2d/Macro/macro-34circ.amc:alberta/tests/book-demo/2d/Macro/macro-34circ.amc
  alberta/tests/book-demo/2d/Macro/macro-44circ.amc:alberta/tests/book-demo/2d/Macro/macro-44circ.amc
  alberta/tests/book-demo/2d/Macro/macro-big.amc:alberta/tests/book-demo/2d/Macro/macro-big.amc
  alberta/tests/book-demo/2d/Macro/macro-circ-two.amc:alberta/tests/book-demo/2d/Macro/macro-circ-two.amc
  alberta/tests/book-demo/2d/Macro/macro-circ.amc:alberta/tests/book-demo/2d/Macro/macro-circ.amc
  alberta/tests/book-demo/2d/Macro/macro-neum.amc:alberta/tests/book-demo/2d/Macro/macro-neum.amc
  alberta/tests/book-demo/2d/Macro/macro-small-neum.amc:alberta/tests/book-demo/2d/Macro/macro-small-neum.amc
  alberta/tests/book-demo/2d/Macro/macro.amc:alberta/tests/book-demo/2d/Macro/macro.amc
  alberta/tests/book-demo/2d/Macro/periodic-torus.amc:alberta/tests/book-demo/2d/Macro/periodic-torus.amc
  alberta/tests/book-demo/2d/Macro/tower.amc:alberta/tests/book-demo/2d/Macro/tower.amc
  alberta/tests/book-demo/3d/INIT/ellipt-dg.dat:alberta/tests/book-demo/3d/INIT/ellipt-dg.dat
  alberta/tests/book-demo/3d/INIT/ellipt-isoparam.dat:alberta/tests/book-demo/3d/INIT/ellipt-isoparam.dat
  alberta/tests/book-demo/3d/INIT/ellipt-moebius.dat:alberta/tests/book-demo/3d/INIT/ellipt-moebius.dat
  alberta/tests/book-demo/3d/INIT/ellipt-periodic.dat:alberta/tests/book-demo/3d/INIT/ellipt-periodic.dat
  alberta/tests/book-demo/3d/INIT/ellipt-sphere.dat:alberta/tests/book-demo/3d/INIT/ellipt-sphere.dat
  alberta/tests/book-demo/3d/INIT/ellipt-torus.dat:alberta/tests/book-demo/3d/INIT/ellipt-torus.dat
  alberta/tests/book-demo/3d/INIT/ellipt.dat:alberta/tests/book-demo/3d/INIT/ellipt.dat
  alberta/tests/book-demo/3d/INIT/ellipt2.dat:alberta/tests/book-demo/3d/INIT/ellipt2.dat
  alberta/tests/book-demo/3d/INIT/heat.dat:alberta/tests/book-demo/3d/INIT/heat.dat
  alberta/tests/book-demo/3d/INIT/nonlin.dat:alberta/tests/book-demo/3d/INIT/nonlin.dat
  alberta/tests/book-demo/3d/INIT/quasi-stokes-slip.dat:alberta/tests/book-demo/3d/INIT/quasi-stokes-slip.dat
  alberta/tests/book-demo/3d/INIT/quasi-stokes.dat:alberta/tests/book-demo/3d/INIT/quasi-stokes.dat
  alberta/tests/book-demo/3d/INIT/stokes.dat:alberta/tests/book-demo/3d/INIT/stokes.dat
  alberta/tests/book-demo/3d/Macro/18-sphere.amc:alberta/tests/book-demo/3d/Macro/18-sphere.amc
  alberta/tests/book-demo/3d/Macro/embedded-sphere.amc:alberta/tests/book-demo/3d/Macro/embedded-sphere.amc
  alberta/tests/book-demo/3d/Macro/embedded-torus.amc:alberta/tests/book-demo/3d/Macro/embedded-torus.amc
  alberta/tests/book-demo/3d/Macro/halfsphere.amc:alberta/tests/book-demo/3d/Macro/halfsphere.amc
  alberta/tests/book-demo/3d/Macro/macro-big.amc:alberta/tests/book-demo/3d/Macro/macro-big.amc
  alberta/tests/book-demo/3d/Macro/macro-simple.amc:alberta/tests/book-demo/3d/Macro/macro-simple.amc
  alberta/tests/book-demo/3d/Macro/macro-small-neum.amc:alberta/tests/book-demo/3d/Macro/macro-small-neum.amc
  alberta/tests/book-demo/3d/Macro/macro.amc:alberta/tests/book-demo/3d/Macro/macro.amc
  alberta/tests/book-demo/3d/Macro/moebius.amc:alberta/tests/book-demo/3d/Macro/moebius.amc
  alberta/tests/book-demo/3d/Macro/periodic.amc:alberta/tests/book-demo/3d/Macro/periodic.amc
  alberta/tests/book-demo/3d/Macro/periodic2.amc:alberta/tests/book-demo/3d/Macro/periodic2.amc
  alberta/tests/book-demo/3d/Macro/tower.amc:alberta/tests/book-demo/3d/Macro/tower.amc
  alberta/tests/book-demo/4d/INIT/ellipt-klein-bottle.dat:alberta/tests/book-demo/4d/INIT/ellipt-klein-bottle.dat
  alberta/tests/book-demo/4d/INIT/ellipt-sphere.dat:alberta/tests/book-demo/4d/INIT/ellipt-sphere.dat
  alberta/tests/book-demo/4d/INIT/ellipt-torus.dat:alberta/tests/book-demo/4d/INIT/ellipt-torus.dat
  alberta/tests/book-demo/4d/Macro/embedded-sphere.amc:alberta/tests/book-demo/4d/Macro/embedded-sphere.amc
  alberta/tests/book-demo/4d/Macro/embedded-torus.amc:alberta/tests/book-demo/4d/Macro/embedded-torus.amc
  alberta/tests/book-demo/4d/Macro/klein-bottle.amc:alberta/tests/book-demo/4d/Macro/klein-bottle.amc
  alberta/tests/book-demo/5d/INIT/ellipt-klein-3-bottle.dat:alberta/tests/book-demo/5d/INIT/ellipt-klein-3-bottle.dat
  alberta/tests/book-demo/5d/Macro/klein-3-bottle.amc:alberta/tests/book-demo/5d/Macro/klein-3-bottle.amc
])

AC_CONFIG_COMMANDS([dof_free_bit.h],
[AS_TMPDIR([alberta])
TMPDIR=${tmp}
TARGET_NEW=${TMPDIR}/dof_free_bit.h
TARGET=alberta/src/Common/dof_free_bit.h
${SHELL} ${srcdir}/mkdoffreemasks.sh ${BITS} 1 > ${TARGET_NEW}
if test -f ${TARGET} && cmp ${TARGET} ${TARGET_NEW} > /dev/null 2>&1 ; then
    AC_MSG_NOTICE([${TARGET} is unchanged])
else
    AC_MSG_NOTICE([Creating ${TARGET}])
    mv -f ${TARGET_NEW} ${TARGET}
fi
rm -rf ${TMPDIR}
unset TMPDIR],
[BITS=$(( ${ac_cv_sizeof_long} * 8 ))])

#
# A special command that checks whether alberta_util_inlines.h exists
# and is identical to alberta_util_inlines.h.in. Then do nothing. If
# something has changed, copy albert_util_inlines.h.in to
# alberta_util_inlines.h
#
# This somewhat complicated stuff is meant primarily for use during
# development to avoid rebuilding of the library just because a header
# file was touched (but not changed).
#
AC_CONFIG_COMMANDS([alberta_util/src/alberta_util_inlines.h],
[if test -f alberta_util/src/alberta_util_inlines.h && \
    cmp alberta_util/src/alberta_util_inlines.h \
        alberta_util/src/alberta_util_inlines.h.in > /dev/null 2>&1; then
	AC_MSG_NOTICE([alberta_util/src/alberta_util_inlines.h is unchanged])
else
	AC_MSG_NOTICE([Creating alberta_util/src/alberta_util_inlines.h])
	cp \
		alberta_util/src/alberta_util_inlines.h.in \
		alberta_util/src/alberta_util_inlines.h
fi])

AC_CONFIG_COMMANDS([alberta_util/src/alberta_util.h],
[if test -f alberta_util/src/alberta_util.h && \
    cmp alberta_util/src/alberta_util.h \
        alberta_util/src/alberta_util.h.in > /dev/null 2>&1; then
	AC_MSG_NOTICE([alberta_util/src/alberta_util.h is unchanged])
else
	AC_MSG_NOTICE([Creating alberta_util/src/alberta_util.h])
	cp \
		alberta_util/src/alberta_util.h.in \
		alberta_util/src/alberta_util.h
fi])

# Control of features which may be disabled/enabled as needed

AC_ARG_ENABLE([dim-of-world],
[AS_HELP_STRING([--enable-dim-of-world="DIM1 ... DIMk"],[Compile ALBERTA libraries for DIM_OF_WORLD=DIM1,
   ..., DIM_OF_WORLD=DIMk. Supported dimensions range from 4 to 9.
   Dimensions are separated by spaces.
   Note that this does not change the maximal mesh dimension which remains
   at 3. The default is NOT to compile for any dimension > 3.])],
[case "${enableval}" in
    no|yes)
    AC_MSG_ERROR([Option "--enable-dim-of-world" needs an argument])
      ;;
    *)
    for dim in $enableval; do
      if test "$dim" -gt 9 -o "$dim" -lt 4; then
	AC_MSG_ERROR([Supported dimensions range from 4 to 9, you specified ${dim}])
      fi
      eval BUILD_ALBERTA_${dim}=1
    done
    EXTRA_DIMENSIONS="${enableval}"
      ;;
esac])

AC_ARG_ENABLE([waiting-in-tests],
              [AS_HELP_STRING([--disable-waiting-in-tests],
                              [No waiting in tests for make check or in a continuous integration pipeline])],
              [],
              [enable_waiting_in_tests=yes])
AS_IF([test "x$enable_waiting_in_tests" != xyes],
      [AC_DEFINE([NO_WAITING_IN_TESTS],[1],[suppress waiting in tests])
       AC_MSG_NOTICE([disabled waiting in tests])])

ALBERTA_ENABLE_FLAG([vector-basis-functions],
  [Disable support for vector-valued basis functions. If you leave this enabled
  ALBERTA supports DIM_OF_WORLD-valued basis functions and scalar basis
  functions. If you disable this feature ALBERTA only supports scalar valued
  basis functions. DIM_OF_WORLD-valued
  basis functions play an important role, e.g. for the discretisation of
  problems involving H(div) (Maxwell equations ...) and, e.g., for stable
  mixed discretisations for the Stokes-problem. Building ALBERTA with
  support for vector valued basis functions increases the compile-time,
  otherwise it should not have any measureable performance impact, therefore
  this feature is normally ENABLED. Disable it to reduce the compile time
  if you do not need this feature.],
  [enabled],
  [VECTOR_BASIS_FUNCTIONS],
  [DEFINE SUBST COND])

ALBERTA_ENABLE_FLAG([chained-basis-functions],
  [Disable support for chains of basis-functions. ALBERTA has support for
  forming direct sums of FE-spaces. This is useful, e.g., to
  implement certain stable mixed discretisations for the Stokes-problem
  (P1+Bubble = Mini, P1+FaceBubble = Bernardi-Raugel, weak slip b.c.).
  Keeping this feature enabled will have a slight performance impact,
  you may disable it if you do not need this feature.],
  [enabled],
  [CHAINED_BASIS_FUNCTIONS],
  [DEFINE SUBST COND])

################################################################################

# Checks for programs.
AC_PROG_INSTALL
AC_PROG_LN_S
AC_CHECK_PROGS([GZIP_PROGRAM],[gzip])
AC_CHECK_PROGS([TAR_PROGRAM],[gtar tar])
AC_ARG_VAR([GZIP_PROGRAM],[name of gzip program])
AC_ARG_VAR([TAR_PROGRAM],[name of tar program (need _not_ be GNU-tar)])

# Compiler characteristics
#
#
# now check for compilers
#
ALBERTA_ENABLE_FLAG([gcc-attribute-flatten],
  [The GNU C-compiler gcc knows about a special function attribute which
  forces the compiler to "flatten" a specific function, i.e. to forcibly
  inline all functions called from the function which carries the "flatten"
  attribute. ALBERTA can use this feature on selected functions to produce
  faster code at the expense of compile time. The extra time needed to compile
  the library is quite large, so use of the "flatten" attribute is normally
  disabled.],
  [disabled],
  [GCC_ATTRIBUTE_FLATTEN],
  [DEFINE SUBST COND])

#
# remember the user override, if any.
#
if test "${CFLAGS+set}" = set; then
    alberta_save_CFLAGS="$CFLAGS"
fi
if test "${CXXFLAGS+set}" = set; then
    alberta_save_CXXFLAGS="$CXXFLAGS"
fi
if test "${FFLAGS+set}" = set; then
    alberta_save_FFLAGS="$FFLAGS"
fi

AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_C_INLINE
AC_PROG_CPP
AC_PATH_PROG([CPP], [cpp])
AC_DEFINE_UNQUOTED([CPP],["$CPP"],["Command which runs the C preprecessor"])

#
# Support for FORTRAN code in ALBERTA. Fortran is optional, but it is
# easier to run the test for the compiler anyway.
#
AC_PROG_F77
if test -z "${F77}"; then
  AC_MSG_RESULT([The Fortran compiler cannot be found. DON'T PANIC:
this simply means that you cannot use the GPSKCA band-width/profile
reduction library, but otherwise has no measurable impact.])
fi

if test -n "${F77}"; then
  AC_F77_LIBRARY_LDFLAGS
  if test -z "${FLIBS}"; then
# cannot be, some run-time stuff is needed, so this means F77 cannot
# compile anything. This is a mis-feature in autoconf: we actually
# only want to determine whether or not the bloody Fortran f*ck is
# able to compile anyting.
    AC_MSG_RESULT([Unable to determine how to link against the Fortran
run-time libraries. For this reason, we assume that "${F77}" either
is no Fortran compiler or that its installation is broken. DON'T PANIC:
this simply means that you cannot use the GPSKCA band-width/profile
reduction library, but otherwise has no measurable impact.])
    F77=""
  fi
fi

if test -n "${F77}"; then
    AC_F77_WRAPPERS
    AC_F77_FUNC([dnrm2],[DNRM2_F77_FUNC])
    AC_F77_FUNC([daxpy],[DAXPY_F77_FUNC])
    AC_F77_FUNC([dcopy],[DCOPY_F77_FUNC])
    AC_F77_FUNC([ddot],[DDOT_F77_FUNC])
    AC_F77_FUNC([dscal],[DSCAL_F77_FUNC])
    AC_F77_FUNC([dswap],[DSWAP_F77_FUNC])
    AC_SUBST([DNRM2_F77_FUNC])
    AC_SUBST([DAXPY_F77_FUNC])
    AC_SUBST([DCOPY_F77_FUNC])
    AC_SUBST([DDOT_F77_FUNC])
    AC_SUBST([DSCAL_F77_FUNC])
    AC_SUBST([DSWAP_F77_FUNC])
    AC_F77_FUNC([gpskca],[GPSKCA_F77_FUNC])
else
    with_gpskca=no
    with_blas=no
fi

# Check if __attribute__((unused)) is supported
ALBERTA_CHECK_UNUSED

#
# Debugging. Should come first because if not set we can forget about
# ALBERTA_DEBUG_CFLAGS
#
ALBERTA_ENABLE_FLAG([debug],
  [disable building of ALBERTA libraries with debugging information.],
  [enabled],
  BUILD_DEBUG_LIBS)

#
# Profiling. Should come first because if not set we can forget about
# ALBERTA_PROFILE_CFLAGS
#
ALBERTA_ENABLE_FLAG([profiling],
  [disable building of ALBERTA libraries with profiling information.],
  [disabled],
  BUILD_PROFILE_LIBS)

################################################################################
#
# Set useful default flags for debugging, profiling and optimization,
# but allow for user override.
#

if test "${BUILD_DEBUG_LIBS}" = "1"; then
#
# ****************************************************************************
#
# set default debugging flags, but allow for user-override
#
    if ! test "${ALBERTA_DEBUG_CFLAGS+set}" = set; then
	if test "${alberta_save_CFLAGS+set}" = set; then
	    if test "$GCC" = yes; then
		ALBERTA_DEBUG_CFLAGS="${alberta_save_CFLAGS} -O0 -ggdb3 -fno-inline -fno-builtin"
	    else
		ALBERTA_DEBUG_CFLAGS="${alberta_save_CFLAGS} -g"
	    fi
	else # CFLAGS not set, use our defaults.
	    if test "$GCC" = yes; then
		ALBERTA_DEBUG_CFLAGS="-Wall -pedantic -std=c11 -O0 -ggdb3 -fno-inline -fno-builtin"
	    else # use autoconf default
		ALBERTA_DEBUG_CFLAGS="${CFLAGS}"
	    fi
	fi
    fi
    AC_ARG_VAR([ALBERTA_DEBUG_CFLAGS],
	[Compiler-flags used to create the debug-enabled libraries])
    ALBERTA_ISO_C99_CHECK([${ALBERTA_DEBUG_CFLAGS}])

    if ! test "${ALBERTA_DEBUG_CXXFLAGS+set}" = set; then
	if test "${alberta_save_CXXFLAGS+set}" = set; then
	    if test "$GCC" = yes; then
		ALBERTA_DEBUG_CXXFLAGS="${alberta_save_CXXFLAGS} -fno-rtti -fno-exceptions -O0 -ggdb3 -fno-inline -fno-builtin"
	    else
		ALBERTA_DEBUG_CFLAGS="${alberta_save_CXXFLAGS} -g"
	    fi
	else # CXXFLAGS not set, use our defaults.
	    if test "$GCC" = yes; then
		ALBERTA_DEBUG_CXXFLAGS="-Wall -fno-rtti -fno-exceptions -O0 -ggdb3 -fno-inline -fno-builtin"
	    else # use autoconf default
		ALBERTA_DEBUG_CFXXLAGS="${CXXFLAGS}"
	    fi
	fi
    fi
    AC_ARG_VAR([ALBERTA_DEBUG_CXXFLAGS],
	[C++ Compiler-flags used to create the debug-enabled libraries])
fi

#
# ****************************************************************************
#
# Set default optimizing flags, but allow for user-override.
# With gcc, provide basic debugging facilities even with optimized
# code.
#
if ! test "${ALBERTA_OPTIMIZE_CFLAGS+set}" = set; then
    if test "${alberta_save_CFLAGS+set}" = set; then
	ALBERTA_OPTIMIZE_CFLAGS="${alberta_save_CFLAGS}"
    else
	if test "$GCC" = yes; then
	    ALBERTA_OPTIMIZE_CFLAGS="-Wall -pedantic -std=c11 -O3"
	else # use autoconf default
	    ALBERTA_OPTIMIZE_CFLAGS="${CFLAGS}"
	fi
    fi
fi

AC_ARG_VAR([ALBERTA_OPTIMIZE_CFLAGS],
    [C compiler-flags used to create the optimised libraries])
ALBERTA_ISO_C99_CHECK([${ALBERTA_OPTIMIZE_CFLAGS}])

if ! test "${ALBERTA_OPTIMIZE_CXXFLAGS+set}" = set; then
    if test "${alberta_save_CXXFLAGS+set}" = set; then
	ALBERTA_OPTIMIZE_CXXFLAGS="${alberta_save_CXXFLAGS}"
    else
	if test "$GCC" = yes; then
	    ALBERTA_OPTIMIZE_CXXFLAGS="-Wall -fno-rtti -fno-exceptions -O3"
	else # use autoconf defaults
	    ALBERTA_OPTIMIZE_CXXFLAGS="${CXXFLAGS}"
	fi
    fi
fi
AC_ARG_VAR([ALBERTA_OPTIMIZE_CXXFLAGS],
    [C++ compiler-flags used to create the optimised libraries])

if ! test "${ALBERTA_FFLAGS+set}" = set; then
    if test "${alberta_save_FFLAGS+set}" = set; then
	ALBERTA_FFLAGS="${alberta_save_FFLAGS}"
    else
	if test "$GCC" = yes; then
	    ALBERTA_FFLAGS="${FFLAGS} -O3"
	else
	    ALBERTA_FFLAGS="-O"
	fi
    fi
fi
AC_ARG_VAR([ALBERTA_FFLAGS], [Fortran compiler-flags])

if test "${BUILD_PROFILE_LIBS}" = "1"; then
#
# ****************************************************************************
#
# set default profiling flags, but allow for user-override
#
    if ! test "${ALBERTA_PROFILE_CFLAGS+set}" = set; then
	if test "${alberta_save_CFLAGS+set}" = set; then
	    if test "$GCC" = yes; then
		ALBERTA_PROFILE_CFLAGS="${alberta_save_CFLAGS} -pg -ggdb3"
	    else
		ALBERTA_PROFILE_CFLAGS="${alberta_save_CFLAGS} -p"
	    fi
	else
	    if test "$GCC" = yes; then
		ALBERTA_PROFILE_CFLAGS="-Wall -pedantic -std=c11 -O3 -pg -ggdb3"
	    else # use autoconf default
		ALBERTA_PROFILE_CFLAGS="${CFLAGS}"
	    fi
	fi
    fi
    
    AC_ARG_VAR([ALBERTA_PROFILE_CFLAGS],
	[C compiler-flags used to create the profiling libraries])
    ALBERTA_ISO_C99_CHECK([${ALBERTA_PROFILE_CFLAGS}])
    
    if ! test "${ALBERTA_PROFILE_CXXFLAGS+set}" = set; then
	if test "${alberta_save_CXXFLAGS+set}" = set; then
	    if test "$GCC" = yes; then
		ALBERTA_PROFILE_CXXFLAGS="${alberta_save_CXXFLAGS} -pg -ggdb3"
	    else
		ALBERTA_PROFILE_CXXFLAGS="${alberta_save_CXXFLAGS} -p"
	    fi
	else
	    if test "$GCC" = yes; then
		ALBERTA_PROFILE_CXXFLAGS="-Wall -fno-rtti -fno-exceptions -O3 -pg -ggdb3"
	    else # use autoconf defaults
		ALBERTA_PROFILE_CXXFLAGS="${CXXFLAGS}"
	    fi
	fi
    fi
    AC_ARG_VAR([ALBERTA_PROFILE_CXXFLAGS],
	[C++ compiler-flags used to create the profiling libraries])

    if ! test "${ALBERTA_PROFILE_FFLAGS+set}" = set; then
	if test "${alberta_save_FFLAGS+set}" = set; then
	    if test "$GCC" = yes; then
		ALBERTA_PROFILE_FFLAGS="${alberta_save_FFLAGS} -pg -ggdb3"
	    else
		ALBERTA_PROFILE_FFLAGS="${alberta_save_FFLAGS} -p"
	    fi
	else
	    if test "$GCC" = yes; then
		ALBERTA_FFLAGS="${FFLAGS} -O3 -pg -ggdb3"
	    else
		ALBERTA_PROFILE_FFLAGS="-O -p"
	    fi
	fi
    fi
    AC_ARG_VAR([ALBERTA_PROFILE_FFLAGS],
	[Fortran compiler-flags for profiling enabled libraries])

fi

#
# Now set the XXFLAGS to the set of flags we will likely use for the
# actual build. Later we will zap them.
#
CFLAGS="${ALBERTA_OPTIMIZE_CFLAGS}"
CXXFLAGS="${ALBERTA_OPTIMIZE_CFLAGS}"
FFLAGS="${ALBERTA_FFLAGS}"

#                                                                              #
############################### end flags fiddling #############################

# Configure libtool
LT_INIT

# Checks for libraries, headers, functions, declarations ...

# Check for libraries
AC_CHECK_LIB([m],[main],,
             [AC_MSG_ERROR([no math library, exiting...!])])

#
# check for rpc / xdr
#
if [ $OSX ]; then
  # on macOS, there is no RPC library, it is part of libc
  # for macOS, use rpc/types.h instead of rpc/xdr.h
  AC_CHECK_HEADER([rpc/types.h],
                  TIRPC_CPPFLAGS='-I/usr/include/tirpc',
                  [AC_MSG_ERROR([Not found tirpc headers rpc/types.h])])
# check rpc / xdr on non-macOS
else
  # check for rpc / xdr library
  AC_CHECK_LIB([tirpc],[rpc_call],,
               [AC_MSG_ERROR([no tirpc library, exiting...!])])
  # check for rpc / xdr header
  AC_CHECK_HEADER([rpc/xdr.h],
                  [AC_CHECK_HEADER([rpc/xdr.h],
                                   TIRPC_CPPFLAGS='',
                                   [AC_MSG_ERROR([Not found tirpc header rpc/xdr.h])])
                  ],
                  [# prevent caching
                   AS_UNSET([ac_cv_header_rpc_xdr_h])
                   # set addition include path and try again
                   CPPFLAGS='-I/usr/include/tirpc'
                   AC_CHECK_HEADER([rpc/xdr.h],
                                    TIRPC_CPPFLAGS='-I/usr/include/tirpc',
                                    [AC_MSG_ERROR([Not found tirpc header rpc/xdr.h])])
                   CPPFLAGS=''
                ])
fi
AC_SUBST(TIRPC_CPPFLAGS)

# xdrrec_create has two signatures, determine the one provided
AC_MSG_CHECKING([for xdrrec_create signature])
saveCFLAGS=$CFLAGS
CFLAGS="$CFLAGS $TIRPC_CPPFLAGS"
AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM(
        [[#include <rpc/xdr.h>]],
        [[void (*ptr)(XDR *, u_int, u_int,
                        void *, int (*)(void *, void *, int),
                        int (*)(void *, void *, int));]
         [ptr = &xdrrec_create;]])
     ],
    [AC_MSG_RESULT([yes])
     AC_DEFINE([HAVE_TIRPC_VOID], 1, [Define for tirpc library with xdrrec_create expecting void pointers])],
    [AC_MSG_RESULT([no])])
CPPFLAGS=$saveCFLAGS

# obstack is part of GNU glic, as macOS' glibc misses obstack it we provide it in gnu-compat
AC_CHECK_HEADER([obstack.h],
                [AM_CONDITIONAL(NO_OBSTACK, false)],
                [OBSTACK_CPPFLAGS='-I$(top_builddir)/gnu-compat/ -I$(top_srcdir)/gnu-compat/'
                 AM_CONDITIONAL(NO_OBSTACK, true)]
               )
AC_SUBST([OBSTACK_CPPFLAGS])

#
# try to pull in some special features (but make sure to supply
# replacements if they are not available)
#
DARWIN_C_SOURCE=0
XOPEN_SOURCE=0
if [ $OSX ]; then
	DARWIN_C_SOURCE=1
fi
if test "x$target_os" = "xlinux-gnu"; then
	XOPEN_SOURCE=600
fi
AC_DEFINE([_SVID_SOURCE], 1, [Define to get SVID stuff, e.g. strdup])
AC_DEFINE([_DEFAULT_SOURCE], 1, [Define to get SVID stuff, e.g. strdup, and avoid warning with glibc>=2.19])
AC_DEFINE_UNQUOTED([_XOPEN_SOURCE], [$XOPEN_SOURCE],
  [Define to get POSIX and XPG stuff])
AC_DEFINE_UNQUOTED([_DARWIN_C_SOURCE], [$DARWIN_C_SOURCE],
  [Define to 1 if compiling for MAC OS/X (Darwin)])

#
# check for some functions we need ... add more as needed.
#
AC_CHECK_FUNCS([strdup \
                xdr_int32_t xdr_int64_t xdr_int],,
               [AC_MSG_ERROR([Sorry, these are needed..])])

#
# functions to aid malloc debugging. Of course, we do not require
# them, but they may be helpful. These functions are available in the
# current glibc, so they are quite GNUish (or Doug Lea-ish)
#
AC_CHECK_FUNCS([mallinfo malloc_usable_size malloc_stats])

#
#  ffsl is not necessarily needed, but helpful.
#
AC_CHECK_FUNCS([ffsl])

#
# check whether we also have declarations for those functions
#
AC_CHECK_DECLS([ffsl, strdup,
                xdr_int32_t, xdr_int64_t, xdr_int],,,
[#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <rpc/types.h>
#include <rpc/xdr.h>])

#
# define replacements and prototypes if necessary
#
AH_VERBATIM([strdup],
[/* missing strdup() prototype */
#if !HAVE_DECL_STRDUP
extern char *strdup(const char *s);
#endif])

AC_FUNC_VPRINTF

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T

AC_CHECK_SIZEOF([long long])

# Check the size of the (presumably) largest native integer type
AC_CHECK_SIZEOF(long)
AC_DEFINE([SIZEOF_DOF_FREE_UNIT],
  [SIZEOF_LONG],
  [size of the integer type used for DOF_FREE_UNIT])

# try do define HAVE_STRUCT_SIGACTION_SA_SIGACTION for SIGFPE-handler.
AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],,,[#include <signal.h>])

# -----------------------
# THESE ARE OUR OWN TESTS
# -----------------------

# check for BLAS library. The BLAS may come under different names. We default
# to -lblas, but other possibilities are sunperf, atlas, cxml (Alpha AXP)
# etc etc etc etc etc etc etc etc etc etc ...........................
# The BLAS library is optional.
#
# Let the user decide what it wants (handled by ALBERTA_CHECK_PACKAGE()
# Note that gpskca does not depend on BLAS at all.
#
ALBERTA_CHECK_PACKAGE([blas],[blas],
 [${DAXPY_F77_FUNC}],[],[${FLIBS}],[],[],[],[optional disabled])
if test -n "${BLAS_LIBS}"; then
	USE_LIBBLAS="1"
else
	USE_LIBBLAS="0"
fi
AC_SUBST([USE_LIBBLAS])
ALBERTA_CHECK_PACKAGE([gpskca],[gpskca],
 ${GPSKCA_F77_FUNC},[],[${FLIBS}],[],[],[],[optional enabled])

#
# Only support linking with fortran stuff if needed.
#
AM_CONDITIONAL(NEED_F77_LINK, [test -n "${BLAS_LIBS}" -o -n "${GPSKCA_LIBS}"])

ALBERTA_ENABLE_FLAG([fem-toolbox],
  [Disable support for actually assembling and solving finite element
  discretizations. What remains is a library which only implements the
  hierarchical grid. This may speed up the compilation time if you
  only need the grid and basic DOF management. This switch implies "--disable-graphics".
  It is rumored that this option is primarily in use on the planet Arrakis.],
  1,
  ALBERTA_FEM_TOOLBOX,
  [SUBST cond define])


if test "${ALBERTA_FEM_TOOLBOX}" = 1; then
ALBERTA_ENABLE_FLAG([graphics],
  [disable support for visualization, including all add-ons which need graphics.],
  1,
  ALBERTA_USE_GRAPHICS,
  [SUBST cond define])
else
  AM_CONDITIONAL(ALBERTA_USE_GRAPHICS, false)
  AC_SUBST(ALBERTA_USE_GRAPHICS)
  AC_DEFINE(ALBERTA_USE_GRAPHICS, 0, [])
fi

# Check for libltdl, only for FEM toolbox
DYLOADER_LIBS=""
if test "${ALBERTA_FEM_TOOLBOX}" = 1; then
  AC_CHECK_LIB([ltdl],[lt_dlinit],
               [AC_DEFINE(HAVE_LIBLTDL, 1, [Define to 1 if libtldl is available])
                AC_CHECK_HEADERS([ltdl.h])
                DYLOADER_LIBS="-lltdl"
               ])
fi
AC_SUBST(DYLOADER_LIBS)

if test "${HAVE_LIBLTDL}" = 1; then
  AM_CONDITIONAL(HAVE_LIBLTDL, true)
else
  AM_CONDITIONAL(HAVE_LIBLTDL, false)
fi

if test "${ALBERTA_USE_GRAPHICS}" = 1; then
#
# check for X11
#
   ALBERTA_X_WINDOW_SYSTEM

   if test "x${no_x}" = "xyes"; then
      AC_MSG_WARN([X window system not found or usage of X disabled, disabling any kind of graphics support])
      ALBERTA_USE_GRAPHICS=0
      AM_CONDITIONAL(ALBERTA_USE_GRAPHICS, false)
      AC_SUBST(ALBERTA_USE_GRAPHICS)
      AC_DEFINE(ALBERTA_USE_GRAPHICS, 0, [])
   fi
fi

if ! test "${ALBERTA_USE_GRAPHICS}" = 1; then
#
# disable the packages, but still run the CHECK_PACKAGE() macros, this
# way the automake conditionals should still be defined (to false),
# but the packages will not be used.
#
    OPENGL_DISABLE=yes
    GLTOOLS_DISABLE=yes
    SILO_DISABLE=yes
    GRAPE_DISABLE=yes
    OPENDX_DISABLE=yes
fi

#
# check for OpenGL
#
ALBERTA_OPENGL_CHECK

#
# check for optional package gltools
#
ALBERTA_GLTOOLS_CHECK

dnl
dnl check for optional package dx
dnl
ALBERTA_OPENDX_CHECK

dnl
dnl GRAPE interface stuff
dnl
ALBERTA_GRAPE_STUFF

#
# MeshTV interface stuff
#
ALBERTA_CHECK_PACKAGE([silo],[silo],[DBPutUcdmesh],
                      [],[],[silo.h],[],[],[optional])

#
# Geomview interface, should not depend on any other installed
# library, just a conversion tool.
#
AM_CONDITIONAL(GEOMVIEW, true)

#
# Malloc debugging and options
#
ALBERTA_ENABLE_FLAG([plain-malloc],
  [Use the system's malloc without any modifications (default). If the option is set,
  ALBERTA will pipe all allocations through small trampoline functions and
  record some meta-data (the size of the allocations) and makes sure that
  malloc(0) returns NULL and stuff like that.],
  1,
  [ALBERTA_ALLOC_MALLOC],
  [DEFINE SUBST COND])

ALBERTA_ENABLE_FLAG([allocrecord],
  [Use some hand-made malloc debugger, which logs allocations in a round-robin
  data-base. The optimized libraries will still use the default allocators.],
  0,
  [ALBERTA_ALLOC_RECORD],
  [DEFINE SUBST COND])

ALBERTA_ENABLE_FLAG([efence],
  [Use the malloc debugger "Electric Fence" for all allocations for the DEBUG
   libraries, the optimized libraries will still use the default allocators.],
  0,
  ALBERTA_EFENCE)
test "$ALBERTA_EFENCE" = "1"        && EFENCE_DISABLE=no
test "${BUILD_ALBERTA_DEBUG}" = "0" && EFENCE_DISABLE=yes
ALBERTA_CHECK_PACKAGE([efence],[efence],[_eff_malloc],[],[],[efence.h],[],[],
                      [optional disabled])
if test "$ALBERTA_EFENCE" = 1 -a -z "$EFENCE_LIBS"; then
	AC_MSG_RESULT(
["EFence" memory debugger not found or disabled, we will not try to use it.])
	ALBERTA_EFENCE=0
fi
if test "$ALBERTA_EFENCE" = 0 -a -n "$EFENCE_LIBS"; then
    AC_MSG_RESULT([using "Electric Fence" memory debugger for debugging libraries.])
    ALBERTA_EFENCE=1
fi

ALBERTA_ENABLE_FLAG([duma],
  [Use the malloc debugger "DUMA" for all allocations for the DEBUG
   libraries, the optimized libraries will still use the default allocators.],
  0,
  ALBERTA_DUMA)
test "$ALBERTA_DUMA" = "1"        && DUMA_DISABLE=no
test "${BUILD_ALBERTA_DEBUG}" = "0" && DUMA_DISABLE=yes
ALBERTA_CHECK_PACKAGE([duma],[duma],[_duma_malloc],[],[],[duma.h],[],[],
                      [optional disabled])
if test "$ALBERTA_DUMA" = 1 -a -z "$DUMA_LIBS"; then
	AC_MSG_RESULT(
["DUMA" memory debugger not found or disabled, we will not try to use it.])
	ALBERTA_DUMA=0
fi
if test "$ALBERTA_DUMA" = 0 -a -n "$DUMA_LIBS"; then
    AC_MSG_RESULT([using "DUMA" memory debugger for debugging libraries.])
    ALBERTA_DUMA=1
fi

#
# OpenMP
#
dnl ALBERTA_OPENMP
dnl if test -n "${OPENMP_CFLAGS}"; then
dnl     ALBERTA_OPTIMIZE_CFLAGS="${ALBERTA_OPTIMIZE_CFLAGS} ${OPENMP_CFLAGS}"
dnl     ALBERTA_DEBUG_CFLAGS="${ALBERTA_DEBUG_CFLAGS} ${OPENMP_CFLAGS}"
dnl     ALBERTA_PROFILE_CFLAGS="${ALBERTA_PROFILE_CFLAGS} ${OPENMP_CFLAGS}"
dnl     ALBERTA_FFLAGS="${ALBERTA_FFLAGS} ${OPENMP_CFLAGS}"
dnl     LDFLAGS="${LDFLAGS} `echo ${OPENMP_CFLAGS}|sed -e 's/-/-XCClinker -/g'`"
dnl fi

#
# Install libtool.alberta for shared libraries?
#
ALBERTA_ENABLE_FLAG([install-libtool],
  [disable installation of libtool.alberta], 1)

# building of all versions is enabled by default, but can be
# disabled using --disable-DOW-dimension switches (the macros
# below do _not_ disable the builds, but simply implement
# AC_ARG_ENABLE() stuff
#
# BIG FAT NOTE: the DIMENSION_DISABLE macro MUST COME LAST, right
# before the AC_OUTPUT
#
ALBERTA_DIMENSION_DISABLE(1)
ALBERTA_DIMENSION_DISABLE(2)
ALBERTA_DIMENSION_DISABLE(3)

#
# Define the necessary conditional unconditionally, so that automake
# can get hold of the default value.
#
ALBERTA_DEFINE_DIMENSION(4)
ALBERTA_DEFINE_DIMENSION(5)
ALBERTA_DEFINE_DIMENSION(6)
ALBERTA_DEFINE_DIMENSION(7)
ALBERTA_DEFINE_DIMENSION(8)
ALBERTA_DEFINE_DIMENSION(9)
AM_CONDITIONAL([ALBERTA_EXTRA_DIMENSIONS], [test -n "${EXTRA_DIMENSIONS}"])

dnl AC_CONFIG_FILES([alberta-grid_1d.pc:alberta-grid.pc])

unset CFLAGS
unset CXXFLAGS
unset FFLAGS

# remove duplicates
CPPFLAGS=`for flag in $CPPFLAGS ; do echo $flag ; done | sort | uniq`
CPPFLAGS=`echo $CPPFLAGS`

if test "z${EXPERIMENTAL}" = "z1"; then
  AC_MSG_RESULT([])
  AC_MSG_NOTICE([The following experimental features are enabled:])
  AC_MSG_RESULT([])
  for dim in $EXTRA_DIMENSIONS; do
    AC_MSG_RESULT(build ALBERTA libraries for DIM_OF_WORLD=${dim})
  done
  if test "z${PERIODIC_MESHES}" = "z1"; then
    AC_MSG_RESULT([support for periodic meshes])
  fi
  if test "z${BOUNDARY_OPERATORS}" = "z1"; then
    AC_MSG_RESULT([support for boundary operators])
  fi
  AC_MSG_RESULT([])
fi

#
# Should come last to make sure we can already use the Makefiles.
#
AC_CONFIG_COMMANDS([packageheaders],
#AC_CONFIG_COMMANDS_POST(
[${RM} -rf include
for m in `find . -name Makefile`
do
#	my_top_srcdir=`cd ${srcdir}; pwd`
#	my_top_builddir=`pwd`
	AS_IF(
	   [${FGREP} -q nodist_pkginclude_HEADERS ${m}],
	      [d=`AS_DIRNAME(["${m}"])`
	      ${MAKE-make} -C "${d}" DESTDIR="" INSTALL_HEADER="${ac_abs_top_srcdir}/install-pkgheader.sh" includedir="${ac_abs_top_builddir}/include" install-nodist_pkgincludeHEADERS],
	   [${FGREP} -q pkginclude_HEADERS ${m}],
	      [d=`AS_DIRNAME(["${m}"])`
	      ${MAKE-make} -C "${d}" DESTDIR="" INSTALL_HEADER="${ac_abs_top_srcdir}/install-pkgheader.sh" includedir="${ac_abs_top_builddir}/include" install-pkgincludeHEADERS],
           [])
done])

#
# flush everything to disk
#
AC_OUTPUT