-
Notifications
You must be signed in to change notification settings - Fork 43
/
configure.ac
914 lines (841 loc) · 27.7 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#
# This file is part of ICTP RegCM.
#
# ICTP RegCM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ICTP RegCM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ICTP RegCM. If not, see <http://www.gnu.org/licenses/>.
#
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AC_INIT([RegCM], [5.0.0], [ggiulian@ictp.it])
AC_SUBST([PACKAGE_URL], ["https://github.com/ICTP/RegCM"])
#AC_PREREQ([2.64])
LT_INIT
AM_INIT_AUTOMAKE([foreign])
AC_PROG_RANLIB
AC_PROG_CC
AC_PROG_FC
AC_LANG([Fortran])
AC_ARG_WITH([netcdf],
AC_HELP_STRING([--with-netcdf],
[Path to NetCDF installation (default: NETCDF environment)]),
[NC_PREFIX="$withval"; NF_PREFIX="$withval"; NFAUTO="no"; NCAUTO="no"],
[FAKE="no"]
)
AC_ARG_WITH([hdf5],
AC_HELP_STRING([--with-hdf5],
[Path to HDF5 installation (default: HDF5 environment)]),
[HDF5_PREFIX="$withval"], [HDF5_PREFIX="${HDF5}"]
)
AC_ARG_WITH([szip],
AC_HELP_STRING([--with-szip],
[Path to SZIP installation (default: SZIP environment)]),
[SZIP_PREFIX="$withval"], [SZIP_PREFIX="${SZIP}"]
)
AC_ARG_WITH([oasis-path],
AC_HELP_STRING([--with-oasis-path],
[Path to OASIS3-MCT installation (require --enable-oasis) [default: ~/oasis3-mct/compile_oa3-mct]]),
[OASIS_PREFIX="$withval"], [OASIS_PREFIX="$HOME/oasis3-mct/compile_oa3-mct"]
)
AC_ARG_WITH([oasis-comm],
AC_HELP_STRING([--with-oasis-comm],
[Communication technique used in OASIS3-MCT (require --enable-oasis) [default: MPI1]]),
[OASIS_CHAN="$withval"], [OASIS_CHAN="MPI1"]
)
PARALLEL="1"
AC_ARG_ENABLE(mpiserial,
AC_HELP_STRING([--enable-mpiserial],
[Use the included MPI replacement library for single processor]),
[DONOTCHECKMPI="DONOTCHECKMPI"; PARALLEL="0"]
)
SP_REAL="0"
AC_ARG_ENABLE(singleprecision,
AC_HELP_STRING([--enable-singleprecision],
[Default real type is real4 single precision.]),
[SP_REAL="1"]
)
if eval "test x"$SP_REAL" = x1"; then
AM_CPPFLAGS="\$(DEFINE)SINGLE_PRECISION_REAL $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USE_KNL="0"
AC_ARG_ENABLE(knl,
AC_HELP_STRING([--enable-knl],
[Compile with Xeon Phi flags.]),
[USE_KNL="1"]
)
if eval "test x"$USE_KNL" = x1"; then
AM_CPPFLAGS="\$(DEFINE)KNL $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USE_ZEN3="0"
AC_ARG_ENABLE(zen3,
AC_HELP_STRING([--enable-zen3],
[Compile with Zen3 processor optimization]),
[USE_ZEN3="1"]
)
if eval "test x"$USE_ZEN3" = x1"; then
AM_CPPFLAGS="\$(DEFINE)ZEN3 $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USE_BDW="0"
AC_ARG_ENABLE(bdw,
AC_HELP_STRING([--enable-bdw],
[Compile with AVX2 flags.]),
[USE_BDW="1"]
)
if eval "test x"$USE_BDW" = x1"; then
AM_CPPFLAGS="\$(DEFINE)BDW $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USE_NHL="0"
AC_ARG_ENABLE(nhl,
AC_HELP_STRING([--enable-nhl],
[Compile with SSE 4.2 flags.]),
[USE_NHL="1"]
)
if eval "test x"$USE_NHL" = x1"; then
AM_CPPFLAGS="\$(DEFINE)NHL $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USE_SKL="0"
AC_ARG_ENABLE(skl,
AC_HELP_STRING([--enable-skl],
[Compile with Sky Lake flags.]),
[USE_SKL="1"]
)
if eval "test x"$USE_SKL" = x1"; then
AM_CPPFLAGS="\$(DEFINE)SKL $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USE_OPENACC="0"
# TODO: make this configurable
PGI_GPU_ARCH="cc80"
AC_ARG_ENABLE(openacc,
AC_HELP_STRING([--enable-openacc],
[Compile OpenACC directives (only for PGI fortran compilation)]),
[USE_OPENACC="1"]
)
if eval "test x"$USE_OPENACC" = x1"; then
AM_CPPFLAGS="\$(DEFINE)OPENACC $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
AC_ARG_ENABLE(openacc-debug,
AC_HELP_STRING([--enable-openacc-debug],
[Compile OpenACC directives with autocompare (only for PGI fortran compilation)]),
[USE_OPENACC="2"]
)
if eval "test x"$USE_OPENACC" = x2"; then
AM_CPPFLAGS="\$(DEFINE)OPENACC $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
AC_ARG_ENABLE(openacc-managed,
AC_HELP_STRING([--enable-openacc-managed],
[Compile OpenACC directives with managed memory (only for PGI fortran compilation)]),
[USE_OPENACC="3"]
)
if eval "test x"$USE_OPENACC" = x3"; then
AM_CPPFLAGS="\$(DEFINE)OPENACC $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
AC_ARG_ENABLE(openacc-stdpar,
AC_HELP_STRING([--enable-openacc-stdpar],
[Compile OpenACC directives with stdpar (only for PGI fortran compilation)]),
[USE_OPENACC="4"]
)
if eval "test x"$USE_OPENACC" = x4"; then
AM_CPPFLAGS="\$(DEFINE)OPENACC $AM_CPPFLAGS -DSTDPAR"
AC_SUBST(AM_CPPFLAGS)
fi
USE_PROF="0"
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],
[Compile with profile flags.]),
[USE_PROF="1"]
)
if eval "test x"$USE_PROF" = x1"; then
AM_CPPFLAGS="\$(DEFINE)PROF $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
AC_ARG_ENABLE(selectedrealkind,
AC_HELP_STRING([--enable-selectedrealkind],
[define single precision and double precision numbers using the selected_real_kind function. Default uses the kind inquiry function.]),
[SRKDEF="SELECTEDREALKIND"]
)
AC_ARG_ENABLE(sequence,
AC_HELP_STRING([--enable-sequence],
[Modify MCT types to make them contiguous in memory.]),
[SRKDEF="SEQUENCE"],
)
USEOASIS="0"
AC_ARG_ENABLE(oasis,
AC_HELP_STRING([--enable-oasis],
[Supply this option if you plan on using OASIS option.]),
[USEOASIS="1"]
)
AM_CONDITIONAL(DO_COMPILE_OASIS, [test x"$USEOASIS" = x1])
if eval "test x"$USEOASIS" = x1"; then
AC_MSG_WARN([Compiling OASIS enabled code])
AC_MSG_WARN([OASIS path: $OASIS_PREFIX])
AC_MSG_WARN([OASIS communication technique: $OASIS_CHAN])
AM_CPPFLAGS="\$(DEFINE)OASIS $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USECLM="0"
USEMEGAN="0"
AC_ARG_ENABLE(clm,
AC_HELP_STRING([--enable-clm],
[Supply this option if you plan on using CLM option.]),
[USECLM="1"],
)
AM_CONDITIONAL(DO_COMPILE_LIBCLM, [test x"$USECLM" = x1])
AC_ARG_ENABLE(megan,
AC_HELP_STRING([--enable-megan],
[Supply this option if you plan on using CLM option with MEGAN.]),
[USEMEGAN="1"],
)
if eval "test x"$USECLM" = x1"; then
AC_MSG_WARN([Compiling CLM enabled code])
AM_CPPFLAGS="\$(DEFINE)CLM $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
if eval "test x"$USEMEGAN" = x1"; then
AC_MSG_WARN([Compiling CLM with MEGAN enabled code])
AM_CPPFLAGS="\$(DEFINE)VOC $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
fi
USECLM45="0"
AC_ARG_ENABLE(clm45,
AC_HELP_STRING([--enable-clm45],
[Supply this option if you plan on using CLM45 option.]),
[USECLM45="1"],
)
AM_CONDITIONAL(DO_COMPILE_LIBCLM45, [test x"$USECLM45" = x1])
if eval "test x"$USECLM45" = x1"; then
AC_MSG_WARN([Compiling CLM45 enabled code])
AM_CPPFLAGS="\$(DEFINE)CLM45 $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
USECPL="0"
AC_ARG_ENABLE(cpl,
AC_HELP_STRING([--enable-cpl],
[Supply this option if you plan on using REGESM.]),
[USECPL="1"],
)
AM_CONDITIONAL(DO_COMPILE_CPL, [test x"$USECPL" = x1])
if eval "test x"$USECPL" = x1"; then
AM_CPPFLAGS="\$(DEFINE)CPL $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
PNETCDF_IN_NETCDF=0
AC_ARG_ENABLE(parallel-nc,
AC_HELP_STRING([--enable-parallel-nc],
[Supply this option if you plan on using NetCDF4 parallel option based upon Parallel Netcdf.]),
[PNETCDF_IN_NETCDF="1"],[PNETCDF_IN_NETCDF="0"]
)
if eval "test x$PNETCDF_IN_NETCDF = x1"; then
AM_CPPFLAGS="\$(DEFINE)PNETCDF_IN_NETCDF $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
PNETCDF="0"
AC_ARG_ENABLE(pnetcdf,
AC_HELP_STRING([--enable-pnetcdf],
[Use Parallel NetCDF from NU-ANL instead of netcdf.]),
[PNETCDF="1"],[PNETCDF="0"]
)
if eval "test x$PNETCDF = x1"; then
NULLOPTION=$( echo $AM_CPPFLAGS | sed -e 's/\$(DEFINE)PNETCDF_IN_NETCDF//')
AM_CPPFLAGS="\$(DEFINE)PNETCDF $NULLOPTION"
AC_SUBST(AM_CPPFLAGS)
fi
AC_ARG_ENABLE(nc4-filters,
AC_HELP_STRING([--enable-nc4-filters],
[Supply this option if you plan on using NetCDF4/HDF5 output filtering option.]),
[NETCDF4_COMPRESS="1"],[NETCDF4_COMPRESS="0"]
)
if eval "test x$NETCDF4_COMPRESS = x1"; then
NULLOPTION=$( echo $AM_CPPFLAGS | sed -e 's/\$(DEFINE)PNETCDF_IN_NETCDF//' \
-e 's/\$(DEFINE)PNETCDF//')
AM_CPPFLAGS="\$(DEFINE)NETCDF4_COMPRESS $NULLOPTION"
AC_SUBST(AM_CPPFLAGS)
fi
NETCDF_CDF5=0
AC_ARG_ENABLE(cdf5,
AC_HELP_STRING([--enable-cdf5],
[Supply this option if you plan on using NetCDF/CDF5 option.]),
[NETCDF_CDF5="1"],[NETCDF_CDF5="0"]
)
DEBUG="0"
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Enable debugging flags and per processor log file]),
[DEBUG="1"]
)
if eval "test x$DEBUG = x1"; then
AM_CPPFLAGS="\$(DEFINE)DEBUG $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
NC_INCLUDES=""
NC_LDFLAGS=""
NC_LIBS=""
AX_PROG_NF_CONFIG([NF_PREFIX=`nf-config --prefix`; NFAUTO="yes"],
[NF_PREFIX="${NETCDF}"; NFAUTO="no"])
AX_PROG_NC_CONFIG([NC_PREFIX=`nc-config --prefix`; NCAUTO="yes"],
[NC_PREFIX="${NETCDF}"; NCAUTO="no"])
if eval "test x$NFAUTO = xyes"; then
if eval "test x$NCAUTO = xyes"; then
NC_INCLUDES="`nc-config --cflags` `nf-config --fflags`"
NC_LDFLAGS="-L`nf-config --prefix`/lib -L`nc-config --prefix`/lib"
NC_LIBS="`nc-config --libs` `nf-config --flibs`"
else
NC_INCLUDES="-I$NC_PREFIX/include `nf-config --fflags`"
NC_LDFLAGS="-L$NC_PREFIX/lib -L`nc-config --prefix`/lib"
NC_LIBS="-L$NC_PREFIX/lib `nf-config --flibs`"
fi
else
if eval "test x$NCAUTO = xno"; then
NC_INCLUDES="-I$NC_PREFIX/include -I$NF_PREFIX/include"
NC_LDFLAGS="-L$NC_PREFIX/lib -L$NF_PREFIX/lib"
NC_LIBS="-lnetcdff -lnetcdf"
else
NCVER=`nc-config --version | cut -d " " -f 2`
if eval "test x$NCVER = x4.0.1"; then
NC_INCLUDES="`nc-config --fflags`"
else
# new netcdf library has this
NC_INCLUDES="-I`nc-config --includedir`"
fi
NC_LDFLAGS="-L`nc-config --prefix`/lib"
NC_LIBS="`nc-config --libs`"
fi
fi
AC_SUBST(NC_PREFIX)
AC_SUBST(NF_PREFIX)
AC_SUBST(NC_INCLUDES)
AC_SUBST(NC_LDFLAGS)
AC_SUBST(NC_LIBS)
if eval "test x$PNETCDF = x1"; then
AX_PROG_PNETCDF_CONFIG([NCP_PREFIX=`pnetcdf-config --prefix`; NCPAUTO="yes"],
[NCP_PREFIX="${NETCDF}"; NCPAUTO="no"])
if eval "test x$NCPAUTO = xyes"; then
CC=`pnetcdf-config --cc`
AC_SUBST(CC)
NCVER=`pnetcdf-config --version | cut -d " " -f 2`
NC_INCLUDES="$NC_INCLUDES -I`pnetcdf-config --includedir`"
NC_LDFLAGS="$NC_LDFLAGS -L`pnetcdf-config --libdir`"
NC_LIBS="$NC_LIBS -L`pnetcdf-config --libdir` -lpnetcdf"
else
NC_INCLUDES="$NC_INCLUDES -I$NCP_PREFIX/include"
NC_LDFLAGS="$NC_LDFLAGS -L$NCP_PREFIX/lib"
NC_LIBS="$NC_LIBS -L$NCP_PREFIX/lib -lpnetcdf"
fi
fi
AC_SUBST(NC_INCLUDES)
AC_SUBST(NC_LDFLAGS)
AC_SUBST(NC_LIBS)
AC_LANG_PUSH([C])
AC_C_BIGENDIAN
AC_LANG_POP([C])
__AC_FC_NAME_MANGLING
case $ac_cv_fc_mangling in
"lower case, underscore, no extra underscore")
name_mangling="FORTRAN_UNDERSCORE_";;
"lower case, no underscore")
name_mangling="FORTRAN_SAME";;
"upper case, no underscore")
name_mangling="FORTRAN_CAPS_";;
"lower case, double underscore")
name_mangling="FORTRAN_GNUF2C";;
"lower case, no underscore, no extra underscore")
name_mangling="FORTRAN_SAME";;
*)
name_mangling="FORTRAN_MANGLING_UNKNOWN"
AC_MSG_WARN([UNKNOWN FORTRAN NAME-MANGLING SCHEME]);;
esac
test "$osname"=NONE && osname=`uname -s`
OSNAME=$osname
AC_SUBST(OSNAME)
test "$machinename"=NONE && machinename=`uname -m`
fullhostname=`hostname -f`
# DEFINE VARIABLES ACCORDING TO OS AND COMPILER
if echo $osname | grep -i aix >/dev/null 2>&1; then
SYSDEF="AIX"
fi
if echo $osname | grep -i darwin >/dev/null 2>&1; then
SYSDEF="DARWIN"
fi
if echo $osname | grep -i unix_system_v >/dev/null 2>&1; then
SYSDEF="UNIXSYSTEMV"
fi
if echo $osname | grep -i irix >/dev/null 2>&1; then
SYSDEF="IRIX"
fi
if echo $osname | grep -i irix64 >/dev/null 2>&1; then
SYSDEF="IRIX64"
fi
if echo $osname | grep -i linux >/dev/null 2>&1; then
SYSDEF="LINUX"
fi
if echo $osname | grep -i osf1 >/dev/null 2>&1; then
SYSDEF="OSF1"
fi
if echo $osname | grep -i super >/dev/null 2>&1; then
SYSDEF="SUPERUX"
fi
if echo $osname | grep -i sun >/dev/null 2>&1; then
SYSDEF="SUNOS"
fi
if echo $osname | grep -i t3e >/dev/null 2>&1; then
SYSDEF="T3E"
fi
if echo $osname | grep -i unicos >/dev/null 2>&1; then
SYSDEF="UNICOS"
fi
if test -z "$SYSDEF"; then
AC_MSG_WARN([OPERATING SYSTEM UNKNOWN])
SYSDEF="UNKNOWNOS"
fi
AM_CONDITIONAL(OSNAME_AIX, [ test -z "${osname##AIX}" ] )
AM_CONDITIONAL(OSNAME_LINUX, [ test -z "${osname##Linux}" ] )
# Cut away flags for this test
FCPROG=`basename $(echo $FC | cut -d " " -f 1)`
AC_SUBST(FCPROG)
AM_CONDITIONAL(COMPILER_IBM, [ test -z "${FCPROG##xlf200*}" -o \
-z "${FCPROG##bgxlf200*}" ] )
AM_CONDITIONAL(COMPILER_CRAY, [ test -z "${FCPROG##ftn*}" ] )
AM_CONDITIONAL(COMPILER_GNU, [ test -z "${FCPROG##gfortran*}" -o \
-z "${FCPROG##\/gfortran*}" -o \
-z "${FCPROG##scorep}" ] )
AM_CONDITIONAL(COMPILER_G95, [ test -z "${FCPROG##g95*}" ] )
AM_CONDITIONAL(COMPILER_SUN, [ test -z "${FCPROG##sunf9*}" ] )
AM_CONDITIONAL(COMPILER_PGI, [ test -z "${FCPROG##pgf9*}" -o \
-z "${FCPROG##nvf9*}" -o \
-z "${FCPROG##pgfortran*}" -o \
-z "${FCPROG##nvfortran*}" ] )
AM_CONDITIONAL(COMPILER_INTEL, [ test -z "${FCPROG##ifort*}" -o \
-z "${FCPROG##impif*}" -o \
-z "${FCPROG##mpiifort*}" ] )
AM_CONDITIONAL(COMPILER_INTEL_LLVM, [ test -z "${FCPROG##ifx*}" -o \
-z "${FCPROG##mpiifx*}" ] )
AM_CONDITIONAL(REGCM_PARALLEL, [ test x"$PARALLEL" = "x1"])
DEFINE="-D"
AC_SUBST(DEFINE)
# Force Big endian I/O for known compilers
if test -z "$COMPILER_GNU_TRUE"; then
# Following check seems not to work on SuSE, need investigation
# GFORTRAN_VERSION="`gfortran --version | head -1 | cut -d " " -f 4`"
# GFORTRAN_MAJOR="`echo $GFORTRAN_VERSION | cut -d "." -f 1`"
# GFORTRAN_MINOR="`echo $GFORTRAN_VERSION | cut -d "." -f 2`"
# echo "gfortran is version $GFORTRAN_VERSION"
# if eval "test "$GFORTRAN_MAJOR" -lt 4"; then
# AC_MSG_WARN([We need at least gfortran 4.6.x.....])
# exit 1
# else
# if eval "test "$GFORTRAN_MINOR" -lt 6"; then
# AC_MSG_WARN([We need at least gfortran 4.6.x.....])
# exit 1
# fi
# fi
FCFLAGS="$FCFLAGS -fconvert=big-endian -fno-range-check -fPIC"
OMPFLAGS="-fopenmp"
CPRDEF="GNU"
AC_SUBST(FCFLAGS)
AC_SUBST(OMPFLAGS)
if eval "test x"$USE_KNL" = x1"; then
FCFLAGS="$FCFLAGS -march=knl"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_ZEN3" = x1"; then
FCFLAGS="$FCFLAGS -march=znver3"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_SKL" = x1"; then
FCFLAGS="$FCFLAGS -march=skylake-avx512"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_BDW" = x1"; then
FCFLAGS="$FCFLAGS -march=broadwell"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_NHL" = x1"; then
FCFLAGS="$FCFLAGS -march=nehalem"
AC_SUBST(FCFLAGS)
fi
fi
if test -z "$COMPILER_INTEL_LLVM_TRUE"; then
OMPFLAGS="-qopenmp -qopt-report"
FCFLAGS="$FCFLAGS -convert big_endian -assume byterecl \
-heap-arrays -fPIC -DSTDPAR $OMPFLAGS"
CPRDEF="INTEL"
AC_SUBST(FCFLAGS)
AC_SUBST(OMPFLAGS)
LIBS=`echo $LIBS | sed -e 's/-Wl,--as-needed//g'`
AC_SUBST(LIBS)
fi
if test -z "$COMPILER_INTEL_TRUE"; then
FCFLAGS="$FCFLAGS -convert big_endian -assume byterecl \
-heap-arrays -fPIC"
IFORTVER=`ifort --version | grep IFORT | cut -d " " -f 3 | cut -d "." -f 1`
if test $IFORTVER -ge 17; then
OMPFLAGS="-qopenmp"
else
OMPFLAGS="-openmp"
fi
CPRDEF="INTEL"
AC_SUBST(FCFLAGS)
AC_SUBST(OMPFLAGS)
LIBS=`echo $LIBS | sed -e 's/-Wl,--as-needed//g'`
AC_SUBST(LIBS)
if eval "test x"$USE_KNL" = x1"; then
FCFLAGS="$FCFLAGS -xMIC-AVX512"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_ZEN3" = x1"; then
FCFLAGS="$FCFLAGS -axCORE-AVX2"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_SKL" = x1"; then
FCFLAGS="$FCFLAGS -xCORE-AVX512"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_BDW" = x1"; then
FCFLAGS="$FCFLAGS -xCORE-AVX2"
AC_SUBST(FCFLAGS)
fi
if eval "test x"$USE_NHL" = x1"; then
FCFLAGS="$FCFLAGS -xSSE4.2"
AC_SUBST(FCFLAGS)
fi
fi
if test -z "$COMPILER_G95_TRUE"; then
FCFLAGS="$FCFLAGS -fendian=big -fmultiple-save"
OMPFLAGS=""
CPRDEF="GNU"
AC_SUBST(FCFLAGS)
AC_SUBST(OMPFLAGS)
fi
if test -z "$COMPILER_PGI_TRUE"; then
FCFLAGS="$FCFLAGS -byteswapio"
OMPFLAGS="-mp"
CPRDEF="PGI"
AC_SUBST(FCFLAGS)
AC_SUBST(OMPFLAGS)
fi
if test -z "$COMPILER_IBM_TRUE"; then
DEFINE="-WF,-D"
FCFLAGS="$FCFLAGS -WF,-DIBM"
OMPFLAGS="-qsmp=omp"
CPRDEF="XLF"
AC_SUBST(FCFLAGS)
AC_SUBST(OMPFLAGS)
AC_SUBST(DEFINE)
fi
if test -x "$COMPILER_SUN_TRUE"; then
CPRDEF="WORKSHOP"
OMPFLAGS="-xopenmp=parallel"
AC_SUBST(OMPFLAGS)
fi
if test -z "$COMPILER_CRAY_TRUE"; then
FCFLAGS="$FCFLAGS"
CPRDEF="GNU"
AC_SUBST(FCFLAGS)
fi
AC_SUBST(CPRDEF)
# Set debug/production flags
if eval "test x$DEBUG = x1"; then
if test -z "$COMPILER_G95_TRUE"; then
FCFLAGS="$FCFLAGS -O0 -g -Wall -Wextra -fbounds-check -ftrace=full"
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_GNU_TRUE"; then
if test -z "${osname##Linux}"; then
FCFLAGS="-O0 -g -pg -fbacktrace \
-fdump-core -Wall -pedantic -Wconversion -Wsurprising -Waliasing \
-Wampersand -Warray-bounds -Wcharacter-truncation -Wuninitialized \
-Wline-truncation -Wintrinsics-std -Wno-tabs -Wunderflow \
-Wunused-parameter -Wno-align-commons $FCFLAGS \
-fno-range-check -fcheck=bounds -Wimplicit-interface \
-Wimplicit-procedure -Wintrinsic-shadow \
-fcheck=array-temps,bounds,do,mem,recursion,pointer"
# -ffpe-trap=zero,invalid,overflow,underflow
else
# Newver Macos versions have a missing library problem for -pg
FCFLAGS="-O0 -g -fbacktrace \
-fdump-core -Wall -pedantic -Wconversion -Wsurprising -Waliasing \
-Wampersand -Warray-bounds -Wcharacter-truncation -Wuninitialized \
-Wline-truncation -Wintrinsics-std -Wno-tabs -Wunderflow \
-Wunused-parameter -Wno-align-commons $FCFLAGS \
-fno-range-check -Wimplicit-interface -Wimplicit-procedure \
-Wintrinsic-shadow -fcheck=array-temps,bounds,do,mem,recursion"
# -ffpe-trap=zero,invalid,overflow,underflow
fi
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_INTEL_LLVM_TRUE"; then
FCFLAGS="-O0 -fpe0 -g -check all -traceback -warn all -ftz \
-fimf-arch-consistency=true -fltconsistency -mieee-fp $FCFLAGS"
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_INTEL_TRUE"; then
FCFLAGS="-O0 -fpe0 -g -check all -traceback -warn all -ftz \
-fimf-arch-consistency=true -fltconsistency -mieee-fp $FCFLAGS"
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_IBM_TRUE"; then
FCFLAGS="-O0 -qsuppress=1501-245 -qcheck -qflttrap=nanq,overflow \
-qxlf2003=polymorphic -qmaxmem=-1 -qzerosize $FCFLAGS"
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_PGI_TRUE"; then
FCFLAGS="-Mbounds -Mcache_align -Mchkstk -Mdalign \
-Miomutex -Mrecursive -Ktrap=divz -O0 -g \
-gopt -traceback $FCFLAGS"
if test "test x$USE_OPENACC = x1"; then
FCFLAGS="$FCFLAGS -acc=gpu -gpu=$PGI_GPU_ARCH,lineinfo -Minfo=accel"
fi
if test "test x$USE_OPENACC = x4"; then
FCFLAGS="$FCFLAGS -acc=gpu \
-gpu=$PGI_GPU_ARCH,managed,ptxinfo,lineinfo -Mnodepchk -Minfo=all"
fi
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_CRAY_TRUE"; then
FCFLAGS="-g $(FCFLAGS)"
NOOPTFC="$FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
CPRDEF="GNU"
fi
else
if test -z "$COMPILER_G95_TRUE"; then
NOOPTFC="$FCFLAGS"
FCFLAGS="-O3 $FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_GNU_TRUE"; then
# The GNU compiler works with -O2
NOOPTFC="-O2 -finline-functions $FCFLAGS" # -fno-var-tracking-assignments
if test -z "${osname##Linux}"; then
FCFLAGS="-O3 -finline-functions -mtune=native -ftree-vectorize \
-march=native $FCFLAGS" # -ftree-parallelize-loops=2"
if eval "test x"$USE_PROF" = x1"; then
FCFLAGS="-g -pg $FCFLAGS"
fi
else
# MacOSX may choke on using AVX extensions...
FCFLAGS="-O3 -finline-functions $FCFLAGS"
# Newer versions of MacOS have problems with pg options
if eval "test x"$USE_PROF" = x1"; then
FCFLAGS="-g $FCFLAGS"
fi
fi
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_INTEL_LLVM_TRUE"; then
AR=xiar
AC_SUBST(AR)
NOOPTFC="-ftz -O0 -fp-model source $FCFLAGS"
if eval "test x"$USE_PROF" = x1"; then
FCFLAGS="-ftz -O2 -g -p -fp-model source $FCFLAGS"
AC_SUBST(FCFLAGS)
else
FCFLAGS="-ftz -O3 -finline-functions -fp-model source $FCFLAGS"
AC_SUBST(FCFLAGS)
fi
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_INTEL_TRUE"; then
AR=xiar
AC_SUBST(AR)
NOOPTFC="-ftz -O0 -fp-model source $FCFLAGS"
if eval "test x"$USE_PROF" = x1"; then
FCFLAGS="-ftz -O2 -g -p -fp-model source $FCFLAGS"
AC_SUBST(FCFLAGS)
else
FCFLAGS="-ftz -ip -O3 -finline-functions -fp-model source $FCFLAGS"
# FCFLAGS="-DF2008 -ftz -fpe0 -O2 -g -traceback -fp-stack-check \
# -check all -fimf-arch-consistency=true -fltconsistency \
# -mieee-fp $FCFLAGS"
AC_SUBST(FCFLAGS)
fi
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_IBM_TRUE"; then
NOOPTFC="$FCFLAGS"
FCFLAGS="-qsuppress=1501-245 -O3 -qstrict -qxlf2003=polymorphic \
-qmaxmem=-1 -qzerosize $FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_SUN_TRUE"; then
NOOPTFC="-xfilebyteorder=big16:%all \
-D__DATE__="'`date +%D`'" -D__TIME__="'`date +%T`'" $FCFLAGS"
FCFLAGS="-O3 -xfilebyteorder=big16:%all \
-D__DATE__="'`date +%D`'" -D__TIME__="'`date +%T`'" $FCFLAGS"
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_PGI_TRUE"; then
NOOPTFC="-O1 $FCFLAGS"
FCFLAGS="-O3 -fast -fastsse $FCFLAGS"
if eval "test x"$USE_OPENACC" = x1"; then
FCFLAGS="$FCFLAGS -acc=gpu -gpu=$PGI_GPU_ARCH,lineinfo -Minfo=accel"
NOOPTFC="$NOOPTFC -acc=gpu -gpu=$PGI_GPU_ARCH,lineinfo -Minfo=accel"
fi
if eval "test x"$USE_OPENACC" = x2"; then
FCFLAGS="$NOOPTFC -acc=gpu \
-gpu="${PGI_GPU_ARCH}",autocompare -Minfo=accel"
NOOPTFC="$NOOPTFC -acc=gpu \
-gpu="${PGI_GPU_ARCH}",autocompare -Minfo=accel"
fi
if eval "test x"$USE_OPENACC" = x3"; then
FCFLAGS="$FCFLAGS -acc=gpu \
-gpu=$PGI_GPU_ARCH,lineinfo,managed -Minfo=accel"
NOOPTFC="$NOOPTFC -acc=gpu \
-gpu=$PGI_GPU_ARCH,lineinfo,managed -Minfo=accel"
fi
if eval "test x"$USE_OPENACC" = x4"; then
FCFLAGS="$FCFLAGS -stdpar=gpu,multicore \
-gpu=$PGI_GPU_ARCH,lineinfo,managed -Minfo=accel"
NOOPTFC="$NOOPTFC -stdpar=gpu,multicore \
-gpu=$PGI_GPU_ARCH,lineinfo,managed -Minfo=accel"
fi
AC_SUBST(FCFLAGS)
AC_SUBST(NOOPTFC)
fi
if test -z "$COMPILER_CRAY_TRUE"; then
NOOPTFC="$FCFLAGS"
FCFLAGS="$(FCFLAGS)"
AC_SUBST(FCFLAGS)
CPRDEF="GNU"
AC_SUBST(NOOPTFC)
fi
fi
RR_PATH_NETCDF
RR_PATH_NETCDF_F90
if eval "test x$PNETCDF = x1"; then
if eval "test x$PNETCDF_IN_NETCDF = x1"; then
RR_NETCDF4
else
RR_PATH_PNETCDF
if eval "test x$NETCDF_CDF5 = x1"; then
RR_CDF5
fi
fi
else
if eval "test x$NETCDF_CDF5 = x1"; then
RR_CDF5
else
RR_NETCDF4
fi
fi
AM_CONDITIONAL(RRTM_NC, [test x"$netcdf" = xyes])
RCM_FC_CHECK_IEEE_ARITHMETIC
RCM_FC_CHECK_QUAD_PRECISION
MCTPATH="${PWD}/external"
if test -z "$COMPILER_SUN_TRUE"; then
MCTFLAGS="-M$MCTPATH"
AM_CPPFLAGS="$MCTFLAGS $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
else
MCTFLAGS="-I$MCTPATH"
AM_CPPFLAGS="$MCTFLAGS $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
AM_LDFLAGS="-L$MCTPATH $AM_LDFLAGS"
AC_SUBST(AM_LDFLAGS)
if eval "test x"$PARALLEL" = x1"; then
ACX_MPI
RCM_MPI_CHECK_MPI3
else
FORT_SIZE="real4double8"
AC_SUBST(FORT_SIZE)
MPIFC=$FC
AC_SUBST(MPIFC)
LIBS="$LIBS -lmpiser"
AC_SUBST(LIBS)
AM_CPPFLAGS="\$(DEFINE)MPI_SERIAL $AM_CPPFLAGS"
AC_SUBST(AM_CPPFLAGS)
fi
MPEUCFLAGS="\$(DEFINE)SYS$SYSDEF \$(DEFINE)CPR$CPRDEF \$(DEFINE)$name_mangling"
MPEUFCFLAGS="\$(DEFINE)SYS$SYSDEF \$(DEFINE)CPR$CPRDEF"
if test -n "$SRKDEF"; then
MPEUCFLAGS="$MPEUCFLAGS \$(DEFINE)$SRKDEF"
MPEUFCFLAGS="$MPEUFCFLAGS \$(DEFINE)$SRKDEF"
fi
AC_SUBST(MPEUCFLAGS)
AC_SUBST(MPEUFCFLAGS)
if eval "test x"$USEOASIS" = x1"; then
if test -z "$COMPILER_SUN_TRUE"; then
AM_CPPFLAGS="$AM_CPPFLAGS -M$OASIS_PREFIX/build/lib/psmile.$OASIS_CHAN"
AM_CPPFLAGS="$AM_CPPFLAGS -M$OASIS_PREFIX/build/lib/scrip"
AM_CPPFLAGS="$AM_CPPFLAGS -M$OASIS_PREFIX/build/lib/mct"
AC_SUBST(AM_CPPFLAGS)
else
AM_CPPFLAGS="$AM_CPPFLAGS -I$OASIS_PREFIX/build/lib/psmile.$OASIS_CHAN"
AM_CPPFLAGS="$AM_CPPFLAGS -I$OASIS_PREFIX/build/lib/scrip"
AM_CPPFLAGS="$AM_CPPFLAGS -I$OASIS_PREFIX/build/lib/mct"
AC_SUBST(AM_CPPFLAGS)
fi
OASIS3_LIBS="-L$OASIS_PREFIX/lib -lpsmile.$OASIS_CHAN -lmct -lmpeu -lscrip"
LIBS="$LIBS $OASIS3_LIBS"
AC_SUBST(LIBS)
fi
F90FLAGS="$FCFLAGS"
AC_SUBST(F90FLAGS)
REGCM_ROOT=${PWD}
AC_SUBST(REGCM_ROOT)
AC_PREFIX_DEFAULT(${PWD})
if test -z "$COMPILER_SUN_TRUE"; then
CPPFLAGS="$AM_CPPFLAGS -M$REGCM_ROOT/Share"
AC_SUBST(CPPFLAGS)
else
CPPFLAGS="$AM_CPPFLAGS -I$REGCM_ROOT/Share"
AC_SUBST(CPPFLAGS)
fi
LIBS="-L$REGCM_ROOT/Share -lrcmlib $LIBS"
SYSLIBS="$LIBS"
AC_SUBST(SYSLIBS)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile external/Makefile Share/Makefile PreProc/Makefile \
PreProc/Terrain/Makefile PreProc/ICBC/cmip6/Makefile \
PreProc/ICBC/Makefile PreProc/CH_EMISSIONS/Makefile \
PreProc/CH_EMISSIONS/interpolation/Makefile \
PreProc/CH_EMISSIONS/interpolation/tools/Makefile \
PreProc/CH_EMISSIONS/interpolation/tools/REGCM_grid/Makefile \
PreProc/CLM/Makefile PreProc/CLM45/Makefile PostProc/Makefile \
Main/mpplib/Makefile Main/netlib/Makefile \
Main/Makefile Main/batslib/Makefile Main/clmlib/Makefile \
Main/ocnlib/Makefile Main/clmlib/clm4.5/Makefile \
Main/chemlib/Makefile Main/chemlib/GAS_CBMZ_NEW/Makefile \
Main/cumlib/Makefile Main/microlib/Makefile \
Main/radlib/Makefile Main/radlib/RRTMG/Makefile \
Main/pbllib/Makefile Main/cloudlib/Makefile \
Main/oasislib/Makefile \
Tools/Programs/CheckSun/Makefile \
Tools/Programs/RegCM_read/Makefile \
Tools/Programs/timeseries/Makefile])
AC_OUTPUT