-
Notifications
You must be signed in to change notification settings - Fork 23
/
configure.ac
2889 lines (2634 loc) · 110 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl
dnl Copyright (C) 2017, Northwestern University and Argonne National Laboratory
dnl See COPYRIGHT notice in top-level directory.
dnl
dnl -*- Mode: shell-script-mode; -*-
dnl Process this file with GNU autoconf(1) to produce a configure script.
dnl
AC_REVISION([m4_esyscmd_s([if test -d .git ; then git describe --always ; fi])])
dnl When using svn, we use SVN keyword Revision to copy the unique revision
dnl number as a stamp into configure script.
dnl AC_REVISION([$Revision$])dnl
dnl autoconf v2.70 and later is required. See https://github.com/Parallel-NetCDF/PnetCDF/issues/94
dnl autoconf v2.70 was released in 2021-01-28
AC_PREREQ([2.70])
AC_INIT([PnetCDF],[1.14.0],[[email protected]],[pnetcdf],[https://parallel-netcdf.github.io])
dnl config.h.in will be created by autoreconf (autoheader)
dnl call it right after AC_INIT, as suggested by autoconf
AC_CONFIG_HEADERS([src/include/config.h])
AH_TOP([/*
* Copyright (C) 2003, Northwestern University and Argonne National Laboratory
* See COPYRIGHT notice in top-level directory.
*/
])
AC_CONFIG_SRCDIR([src/include/pnetcdf.h.in])
AC_CONFIG_AUX_DIR([./scripts])
dnl call env or printenv to print all user environment variables in config.log
echo '-------------------------------' >& AS_MESSAGE_LOG_FD
echo ' User environment variables:' >& AS_MESSAGE_LOG_FD
echo '-------------------------------' >& AS_MESSAGE_LOG_FD
env >& AS_MESSAGE_LOG_FD
echo '-------------------------------' >& AS_MESSAGE_LOG_FD
echo '' >& AS_MESSAGE_LOG_FD
dnl Note getting command line should be done before calling AM_INIT_AUTOMAKE
dnl as AM_INIT_AUTOMAKE modifies command line $*
if test "x$ac_configure_args_raw" = x ; then
CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '`
else
CONFIGURE_ARGS_CLEAN=$ac_configure_args_raw
fi
dnl automake version 1.16.5 was released in 2021-10-03
dnl AM_INIT_AUTOMAKE([subdir-objects])
AM_INIT_AUTOMAKE([1.16.5])
dnl enable silent rules by default
AM_SILENT_RULES([yes])
dnl if maintainer mode is disabled, make will *never* attempt to rebuild
dnl configure, Makefile.ins, etc.
AM_MAINTAINER_MODE([enable])
dnl search all local macro files in folder m4
dnl m4_ifdef([AC_CONFIG_MACRO_DIRS], [AC_CONFIG_MACRO_DIRS([m4])], [AC_CONFIG_MACRO_DIR([m4])])
AC_CONFIG_MACRO_DIRS([m4])
dnl AM_EXTRA_RECURSIVE_TARGETS macro was introduced into automake 1.13
dnl m4_ifdef([AM_EXTRA_RECURSIVE_TARGETS], [AM_EXTRA_RECURSIVE_TARGETS([tests])])
AM_EXTRA_RECURSIVE_TARGETS([tests])
dnl parse the version numbers to 4 env variables
PNETCDF_VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
PNETCDF_VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
PNETCDF_VERSION_SUB=`echo ${PACKAGE_VERSION} | cut -d. -f3`
PNETCDF_VERSION_PRE=`echo ${PACKAGE_VERSION} | cut -d. -f4`
dnl Note major, minor, and sub are required, but pre is not.
PNETCDF_VERSION=${PACKAGE_VERSION}
dnl Do not change the following line, It is set by SVN automatically.
dnl It defines PNETCDF_RELEASE_DATE, a string that will be used in
dnl ncmpi_inq_libvers() to generate release date
dnl SVN_DATE="$LastChangedDate$"
dnl PNETCDF_RELEASE_DATE2=`echo $SVN_DATE | cut -d' ' -f2`
dnl PNETCDF_RELEASE_DATE=`echo $SVN_DATE | cut -d' ' -f6,7,8 | cut -d')' -f1`
dnl user defined macro for printing messages for debugging
dnl add "pnc_ac_debug=yes" at command line to enable
AC_DEFUN([UD_MSG_DEBUG],
[if test "x${pnc_ac_debug}" = xyes ; then
AC_MSG_NOTICE([DEBUG: $1])
fi
]
)
UD_MSG_DEBUG([PNETCDF_VERSION_MAJOR=$PNETCDF_VERSION_MAJOR])
UD_MSG_DEBUG([PNETCDF_VERSION_MINOR=$PNETCDF_VERSION_MINOR])
UD_MSG_DEBUG([PNETCDF_VERSION_SUB=$PNETCDF_VERSION_SUB])
UD_MSG_DEBUG([PNETCDF_VERSION_PRE=$PNETCDF_VERSION_PRE])
UD_MSG_DEBUG([PNETCDF_VERSION=$PNETCDF_VERSION])
dnl UD_MSG_DEBUG([PNETCDF_RELEASE_DATE=$PNETCDF_RELEASE_DATE])
dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_MAJOR, $PNETCDF_VERSION_MAJOR, major version number)
dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_MINOR, $PNETCDF_VERSION_MINOR, minor version number)
dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_SUB, $PNETCDF_VERSION_SUB, sub version number)
dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION_PRE, $PNETCDF_VERSION_PRE, pre-release string)
dnl AC_DEFINE_UNQUOTED(PNETCDF_VERSION, ["$PNETCDF_VERSION"], full PnetCDF version string)
dnl AC_DEFINE_UNQUOTED(PNETCDF_RELEASE_DATE, ["$PNETCDF_RELEASE_DATE"], PnetCDF release date string)
dnl AC_DEFINE_UNQUOTED(CONFIGURE_ARGS_CLEAN, ["$CONFIGURE_ARGS_CLEAN"], configure command-line arguments used)
AC_SUBST(PNETCDF_VERSION_MAJOR)
AC_SUBST(PNETCDF_VERSION_MINOR)
AC_SUBST(PNETCDF_VERSION_SUB)
AC_SUBST(PNETCDF_VERSION_PRE)
AC_SUBST(PNETCDF_VERSION)
dnl Note that command 'date' is not portable across Unix platforms.
dnl But release date only matters to PnetCDF developers who make the releases.
PNETCDF_RELEASE_DATE="`date '+%B %-d, %Y'`"
AC_SUBST(PNETCDF_RELEASE_DATE)
PNETCDF_RELEASE_DATE_FULL="`date '+%Y-%m-%d'`"
AC_SUBST(PNETCDF_RELEASE_DATE_FULL)
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(CONFIGURE_ARGS_CLEAN)
dnl autoheader only adds these templates to the first invocation of AC_CONFIG_HEADERS
AH_TEMPLATE([ENABLE_FORTRAN], [Define if to enable Fortran feature])
AH_TEMPLATE([ENABLE_CXX], [Define if to enable C++ feature])
AH_TEMPLATE([NCBYTE_T], [Type of NC_BYTE])
AH_TEMPLATE([NCSHORT_T], [Type of NC_SHORT])
AH_TEMPLATE([NF_DOUBLEPRECISION_IS_C_], [C type for Fortran double])
AH_TEMPLATE([NF_INT1_IS_C_], [C type for Fortran INT1])
AH_TEMPLATE([NF_INT1_T], [Type for Fortran INT1])
AH_TEMPLATE([NF_INT2_IS_C_], [C type for Fortran INT2])
AH_TEMPLATE([NF_INT2_T], [Type for Fortran INT2])
AH_TEMPLATE([NF_INT_IS_C_], [C type for Fortran INT])
AH_TEMPLATE([NF_INT8_IS_C_], [C type for Fortran INT8])
AH_TEMPLATE([NF_INT8_T], [Type for Fortran INT8])
AH_TEMPLATE([NF_REAL_IS_C_], [C type for Fortran REAL])
AH_TEMPLATE([NO_IEEE_FLOAT], [Does system have IEEE FLOAT])
dnl AH_TEMPLATE([ENABLE_IN_PLACE_SWAP], [Define if to enable in-place byte swap])
dnl AH_TEMPLATE([DISABLE_IN_PLACE_SWAP],[Define if to disable in-place byte swap])
AH_TEMPLATE([ENABLE_SUBFILING], [Define if to enable subfiling feature])
AH_TEMPLATE([ENABLE_NETCDF4], [Define if to enable NetCDF-4 support])
AH_TEMPLATE([ENABLE_ADIOS], [Define if to enable ADIOS BP read feature])
AH_TEMPLATE([HDF5_VER_GE_1_10_4], [Define if HDF5 version is at least 1.10.4])
AH_TEMPLATE([NETCDF_GE_4_5_0], [Define if NetCDF version is at least 4.5.0])
AH_TEMPLATE([PNC_MALLOC_TRACE], [Define if to enable malloc tracing])
AH_TEMPLATE([RELAX_COORD_BOUND], [Define if relaxed coordinate check is enabled])
AH_TEMPLATE([ENABLE_NULL_BYTE_HEADER_PADDING], [Define if to enable strict null-byte padding in file header])
AH_TEMPLATE([ENABLE_BURST_BUFFER], [Define if to enable burst buffer feature])
AH_TEMPLATE([PNETCDF_PROFILING], [Define if to enable PnetCDF internal performance profiling])
AH_TEMPLATE([ENABLE_THREAD_SAFE], [Define if to enable thread-safe capability])
AH_TEMPLATE([ENABLE_REQ_AGGREGATION], [Define if able to support request aggregation in nonblocking routines])
dnl AH_TEMPLATE([HAVE_MPI_COUNT], [Define if type MPI_Count is defined])
AH_TEMPLATE([HAVE_MPI_LARGE_COUNT], [Define if required MPI APIs have arguments of type MPI_Count])
AH_TOP([#ifndef H_CONFIG
#define H_CONFIG])
AH_BOTTOM([#include <nctypes.h>
#endif])
dnl an option to use a customized rm command
RM=rm
AC_ARG_VAR(RM, Command for deleting files or directories. @<:@default: rm@:>@)
if test "x${RM}" != x ; then
dnl ${RM} set by user may contain flags
RM_CMD=`echo ${RM} | cut -d' ' -f1`
# use "if ! test" is not portable, according to autoconf user guide
if test -f ${RM_CMD} ; then :; else
AC_CHECK_PROG([rm_cmd], [${RM_CMD}], [yes], [no])
if test "x${rm_cmd}" = xno ; then
RM=rm
fi
fi
fi
UD_MSG_DEBUG([RM=$RM])
dnl AC_PROG_SED and AC_PROG_GREP are only available on autoconf 2.60 and later
AC_PROG_AWK
AC_PROG_GREP
AC_PROG_EGREP
AC_PROG_SED
dnl check sed command option -i and set SED_I (this requires RM defined)
UD_PROG_SED_I
AC_ARG_ENABLE(echo,
[AS_HELP_STRING([--enable-echo],
[Turn on strong echoing. @<:@default: disabled@:>@])],
[set -x]
)
AC_ARG_ENABLE(install-examples,
[AS_HELP_STRING([--enable-install-examples],
[Install example programs under $prefix/examples. @<:@default: disabled@:>@])],
[install_examples=yes], [install_examples=no]
)
AM_CONDITIONAL(INSTALL_EXAMPLES, [test x$install_examples = xyes])
MPI_INSTALL=
AC_ARG_WITH(mpi,
[AS_HELP_STRING([--with-mpi=DIR],
[Provide the MPI installation path in DIR.])],
[ dnl this clause is run when --with-mpi or --without-mpi is used
if test "x${withval}" = xno ; then
AC_MSG_ERROR([
-----------------------------------------------------------------------
PnetCDF is built on top of MPI. Configure option --without-mpi or
--with-mpi=no should not be used. Abort.
-----------------------------------------------------------------------])
elif test "x${withval}" = x ; then
# when "--with-mpi=" is used
AC_MSG_ERROR(--with-mpi is set but the value is NULL)
elif test "x${withval}" != xyes && test ! -d "${withval}" ; then
# user may use --with-mpi without an argument, which results in withval
# being "yes". This case is OK and we simply take no action, as PnetCDF
# requires MPI compilers and will check them.
AC_MSG_ERROR(Directory '${withval}' specified in --with-mpi does not exist or is not a directory)
fi
MPI_INSTALL=${withval}
]
)
if test "x$MPI_INSTALL" = xyes ; then
# when "--with-mpi" is used
MPI_INSTALL=
fi
dnl MPI_INSTALL will be referred in UD_MPI_PATH_PROGS and UD_MPI_PATH_PROG
dnl defined in acinclude.m4
AC_ARG_VAR(MPICC, [MPI C compiler, @<:@default: CC@:>@])
AC_ARG_VAR(MPICXX, [MPI C++ compiler, @<:@default: CXX@:>@])
AC_ARG_VAR(MPIF77, [MPI Fortran 77 compiler, @<:@default: F77@:>@])
AC_ARG_VAR(MPIF90, [MPI Fortran 90 compiler, @<:@default: FC@:>@])
dnl AC_ARG_VAR(CPPFLAGS, [Preprocessor options for C and C++ compilers, e.g. -I<include_dir> if you have headers in a nonstandard directory <include_dir>])
dnl AC_ARG_VAR(CFLAGS, Debugging and optimization options for the C compiler)
dnl AC_ARG_VAR(CXXFLAGS, Debugging and optimization options for the C++ compiler)
dnl AC_ARG_VAR(FFLAGS, Debugging and optimization options for the Fortran 77 compiler)
dnl AC_ARG_VAR(FCFLAGS, Debugging and optimization options for the Fortran 90 compiler)
CANDIDATE_MPICC="mpicc mpicc_r"
CANDIDATE_MPICXX="${MPICXX} mpicxx mpic++ mpiCC mpcxx mpc++ mpicxx_r mpiCC_r mpcxx_r mpic++_r mpc++_r"
CANDIDATE_MPIF77="${MPIF77} mpif77 mpif77_r mpf77 mpf77_r"
CANDIDATE_MPIF90="${MPIF90} mpif90 mpif90_r mpf90 mpf90_r mpif95 mpif95_r mpf95 mpf95_r"
dnl add GNU MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpigcc mpgcc mpigcc_r mpgcc_r"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpig++ mpg++ mpig++_r mpg++_r"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 mpig77 mpig77_r mpg77 mpg77_r"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 mpigfortran mpgfortran mpigfortran_r mpgfortran_r"
dnl add IBM MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpcc_r mpcc mpixlc_r mpixlc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpCC_r mpCC mpixlcxx_r mpixlcxx mpixlC_r mpixlC"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 mpixlf77_r mpixlf77"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 mpixlf90_r mpixlf90"
dnl add IBM BGL MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC blrts_xlc mpxlc_r mpxlc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX blrts_xlC mpxlC_r mpxlC mpixlc++ mpxlcxx mpxlc++ mpxlCC mpixlc++_r mpxlcxx_r mpxlc++_r mpxlCC_r"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 blrts_xlf mpxlf_r mpxlf mpxlf77 mpxlf77_r mpixlf mpixlf_r"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 blrts_xlf90 mpxlf90_r mpxlf90 mpxlf95_r mpxlf95 mpixlf95 mpixlf95_r"
dnl add Fujitsu MPI compilers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpifccpx"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpiFCCpx"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 mpifrtpx"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 mpifrtpx"
dnl add Cray MPI compiler wrappers
CANDIDATE_MPICC="$CANDIDATE_MPICC cc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX CC"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 ftn"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 ftn"
dnl add Intel MPI compiler wrappers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpiicc icc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpiicpc mpiicxx mpiic++ mpiiCC icpc"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 mpiifort mpiifc mpiif77 ifort"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 mpiifort mpiifc mpiif95 mpiif90 ifort"
dnl add PGI MPI compiler wrappers
CANDIDATE_MPICC="$CANDIDATE_MPICC mpipgcc mppgcc"
CANDIDATE_MPICXX="$CANDIDATE_MPICXX mpipgCC mppgCC"
CANDIDATE_MPIF77="$CANDIDATE_MPIF77 mpipgf77 mppgf77"
CANDIDATE_MPIF90="$CANDIDATE_MPIF90 mpipgf90 mpipgf95 mppgf90 mppgf95 "
# save MPICC, MPICXX, MPIF77, MPIF90 set by user before modifying them
ac_user_MPICC=$MPICC
ac_user_MPICXX=$MPICXX
ac_user_MPIF77=$MPIF77
ac_user_MPIF90=$MPIF90
# Logic of checking MPICC (same for MPICXX, MPIF77, MPIF90):
# if MPICC environment variable is set
# then use MPICC
# else if --with-mpi is set
# then use CANDIDATE_MPICC to find MPICC in MPI_INSTALL
# else use CANDIDATE_MPICC to find MPICC in PATH
# if MPICC still not set and CC is set
# then set MPICC to CC
# else MPICC is not found and error out
dnl Obtain full paths of MPICC
if test "x${MPICC}" = x ; then
dnl if MPICC has not been set by users, then search from
dnl CANDIDATE_MPICC, and find the full path of MPICC
dnl UD_MPI_PATH_PROGS also check MPI compilers in MPI_INSTALL
UD_MPI_PATH_PROGS([MPICC], [$CANDIDATE_MPICC])
else
dnl check whether user specified MPICC exists
UD_MPI_PATH_PROG([MPICC], [$MPICC])
fi
dnl If MPICC is still not set and CC is set, then set MPICC to CC.
if test "x$MPICC" = x && test "x$CC" != x ; then
dnl check whether user specified CC exists
UD_MPI_PATH_PROG([MPICC], [$CC])
fi
if test "x${MPICC}" = x ; then
if test "x$ac_user_MPICC" = x ; then
ERR_MSG="No MPI C compiler can be found"
else
ERR_MSG="Specified MPI C compiler \"$ac_user_MPICC\" cannot be found"
fi
if test "x$MPI_INSTALL" != x ; then
ERR_MSG="$ERR_MSG under $MPI_INSTALL"
fi
AC_MSG_ERROR([
-----------------------------------------------------------------------
$ERR_MSG
PnetCDF requires a working MPI C compiler. Please specify the location
of an MPI C compiler, either in the MPICC environment variable
(not CC variable) or through --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
fi
UD_MSG_DEBUG([MPICC=$MPICC])
dnl Now MPICC is configured, do some basic compiler tests
CC=${MPICC}
AC_PROG_CC
dnl AM_PROG_CC_C_O
dnl get compiler vendor in ax_cv_c_compiler_vendor (e.g. gnu, intel)
AX_COMPILER_VENDOR
if test "x${ax_cv_c_compiler_vendor}" = xgnu ; then
dnl gcc command-line option "-dumpversion" can also show version.
AC_MSG_CHECKING([whether gcc version is greater than 10.0.0])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if __GNUC__ < 10
#error gcc version < 10.0.0
#endif
]])], [gcc_ge_10=yes], [gcc_ge_10=no])
AC_MSG_RESULT([$gcc_ge_10])
fi
dnl get base compiler command of MPI C compiler wrapper in
dnl ac_cv_mpi_compiler_base_MPICC (e.g. /usr/bin/gcc)
MPI_COMPILER_BASE(MPICC)
dnl Set output variable CPP to a command that runs the C preprocessor.
dnl Some C compilers require -E to be used as C preprocessor.
AC_PROG_CPP
dnl this call needs at least autoconf version 2.60
dnl AC_USE_SYSTEM_EXTENSIONS
dnl enable large file support
AC_SYS_LARGEFILE
dnl UD_PROG_CC_MAKEDEPEND
dnl AC_HEADER_STDC
dnl AC_CHECK_HEADERS([malloc.h])
dnl check if MPICC works for basic MPI call: MPI_Comm_rank()
AC_CHECK_FUNC([MPI_Comm_rank], [],
dnl maybe -lmpi is needed at link stage
[AC_SEARCH_LIBS([MPI_Comm_rank], [mpi mpich], [],
[AC_MSG_ERROR([
-----------------------------------------------------------------------
Invalid MPI compiler specified or detected: "${MPICC}"
A working MPI C compiler is required. Please specify the location
of one either in the MPICC environment variable (not CC variable) or
through --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
])])
AC_CHECK_FUNC([MPI_File_open], [],
dnl maybe -lmpio is needed at link stage
[AC_SEARCH_LIBS([MPI_File_open], [mpi mpio], [],
[AC_MSG_ERROR([
-----------------------------------------------------------------------
The underneath MPI implementation does not support MPI-IO.
PnetCDF requires MPI-IO support to work properly. Abort.
-----------------------------------------------------------------------])
])])
dnl check the base of MPICC compiler
AM_CONDITIONAL(MPICC_IS_XLC, [test "x${ax_cv_c_compiler_vendor}" = xibm])
AM_CONDITIONAL(MPICC_IS_PGCC, [test "x${ax_cv_c_compiler_vendor}" = xportland])
AM_CONDITIONAL(MPICC_IS_FCCPX,[test "x${ax_cv_c_compiler_vendor}" = xfujitsu])
dnl print out MPI version and vendor information
CHECK_MPI_VERSION
dnl PnetCDF requires MPI-IO support and MPI-IO was first introduced in MPI 2.0
if test "x$mpi_version" = x ; then
AC_MSG_ERROR([
-----------------------------------------------------------------------
PnetCDF requires an MPI library that supports MPI standard version
2.0 and later. However, such information cannot be detected from the
supplied MPI C compiler:
$MPICC
Abort.
-----------------------------------------------------------------------])
fi
if test "$mpi_version" -lt "2" ; then
AC_MSG_ERROR([
-----------------------------------------------------------------------
PnetCDF requires an MPI library that supports MPI standard version
2.0 and later. The supplied MPI library only supports MPI $mpi_version.
Abort.
-----------------------------------------------------------------------])
fi
dnl check whether MPICC is built using a C++ compiler
AC_MSG_CHECKING([whether $MPICC is a wrapper of a C++ compiler])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [int class=0;])],
[AC_MSG_RESULT(no)],
[AC_MSG_ERROR([
-----------------------------------------------------------------------
PnetCDF requires the supplied MPI C compiler is not a wrapper of a
C++ compiler. MPI C compiler is $MPICC
Abort.
-----------------------------------------------------------------------])]
)
dnl compute canonical system types
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl AM_PROG_AR is first recognized/traced in autoconf 2.68
dnl Use it only if we want support for unusual archivers such as Microsoft
dnl lib.. AM_PROG_AR must be called before LT_INIT
AM_PROG_AR
dnl UD_PROG_AR()
dnl UD_PROG_NM()
dnl We could use the PAC check for ranlib (it also makes sure that ranlib
dnl works, which is not always true, particularly when GNU tools are
dnl installed on a system that does not have (or need) ranlib
dnl libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
dnl AC_PROG_RANLIB
dnl libtool v2.4.6 was released in 2015-02-15
dnl Travis CI only has v2.4.2
LT_PREREQ([2.4.6])
dnl LT_INIT([dlopen disable-shared])
dnl LT_INIT([dlopen])
dnl LT_INIT([disable-shared]) # build without shared libraries
LT_INIT
dnl check MPI C++ compiler
AC_ARG_ENABLE(cxx,
[AS_HELP_STRING([--disable-cxx],
[Turn off support for the C++ interface,
if you only need the C interface. @<:@default: enabled@:>@])],
[enable_cxx=${enableval}], [enable_cxx=auto]
)
UD_MSG_DEBUG(enable_cxx=$enable_cxx)
if test "x${enable_cxx}" != xno ; then
dnl Obtain full paths of MPICXX
if test "x${MPICXX}" = x ; then
dnl if MPICXX has not been set by users, then search from
dnl CANDIDATE_MPICXX, and find the full path of MPICXX
dnl UD_MPI_PATH_PROGS also check MPI compilers in MPI_INSTALL
UD_MPI_PATH_PROGS([MPICXX], [$CANDIDATE_MPICXX])
else
dnl check whether user specified MPICXX exists
UD_MPI_PATH_PROG([MPICXX], [$MPICXX])
fi
dnl If MPICXX is still not set and CXX is set, then set MPICXX to CXX.
if test "x$MPICXX" = x && test "x$CXX" != x ; then
dnl check whether user specified CXX exists
UD_MPI_PATH_PROG([MPICXX], [$CXX])
fi
if test "x${MPICXX}" = x ; then
if test "x$ac_user_MPICXX" = x ; then
ERR_MSG="No MPI C++ compiler can be found"
else
ERR_MSG="Specified MPI C++ compiler \"$ac_user_MPICXX\" cannot be found"
fi
if test "x$MPI_INSTALL" != x ; then
ERR_MSG="$ERR_MSG under $MPI_INSTALL"
fi
if test "x${enable_cxx}" = xyes ; then
dnl --enable-cxx is explicitly set at command line
AC_MSG_ERROR([
-----------------------------------------------------------------------
$ERR_MSG.
Please specify the location of the MPI C++ compiler, either in the
MPICXX environment variable or the --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
else
dnl enable_cxx is auto, i.e. --enable-cxx is not set at command line
AC_MSG_WARN([
-----------------------------------------------------------------------
$ERR_MSG.
Thus the C++ feature is disabled.
The location of the MPI C++ compiler can be specified either in the
MPICXX environment variable or through the --with-mpi configure flag.
-----------------------------------------------------------------------])
fi
fi
UD_MSG_DEBUG([MPICXX=$MPICXX])
fi
if test "x${enable_cxx}" = xno || test "x${MPICXX}" = x ; then
dnl when cxx is explicitly disabled or no MPICXX can be found
has_mpicxx=no
else
has_mpicxx=yes
CXX=${MPICXX}
fi
dnl Must invoke AC_PROG_CXX here, because AC_PROG_CXX cannot be called
dnl conditionally in Automake, otherwise got "error: conditional
dnl "am__fastdepCXX" was never defined." So, if has_mpicxx is no, then
dnl AC_PROG_CXX will search for g++. However, g++ will not be used at all.
AC_PROG_CXX
dnl autoconf 2.59 has not yet implemented AC_PROG_CXX_C_O
dnl AC_PROG_CXX_C_O
if test "x${has_mpicxx}" = xyes ; then
dnl test if MPICXX can compile an MPI-IO program
AC_LANG_PUSH(C++)
dnl get compiler vendor in ax_cv_cxx_compiler_vendor (e.g. gnu, intel)
AX_COMPILER_VENDOR
dnl get base compiler command of MPI C++ compiler wrapper in
dnl ac_cv_mpi_compiler_base_MPICXX (e.g. /usr/bin/g++)
MPI_COMPILER_BASE(MPICXX)
AC_CHECK_FUNC([MPI_File_close], [],
dnl maybe -lmpi++ is needed at link stage
[AC_SEARCH_LIBS([MPI_File_close], [mpi mpio mpi++ mpichcxx mpi_cxx], [],
[has_mpicxx=no])])
AC_LANG_POP(C++)
if test "x$has_mpicxx" = xno ; then
if test "x${enable_cxx}" = xyes ; then
AC_MSG_ERROR([
-----------------------------------------------------------------------
Explicitly requesting C++ feature, but "${MPICXX}"
is not a working MPI C++ compiler. Abort.
-----------------------------------------------------------------------])
else dnl in case enable_cxx is auto
AC_MSG_WARN([
-----------------------------------------------------------------------
"${MPICXX}" is not a working MPI C++ compiler.
Thus, the C++ feature is disabled.
-----------------------------------------------------------------------])
fi
else
UD_CHECK_MPI_CPP_SEEK_SET
UD_MSG_DEBUG(ac_cv_CHECK_MPI_CPP_SEEK_SET=$ac_cv_CHECK_MPI_CPP_SEEK_SET)
dnl When using older version Intel compilers 4.x, SEEK_SET will be
dnl reported as redefined. We need to add the following C++ preprocessor
dnl flags. See doc/README.INTEL
if test "x${ac_cv_CHECK_MPI_CPP_SEEK_SET}" = xyes ; then
SEEK_SET_REDEFINED=yes
fi
fi
fi
if test "x${has_mpicxx}" = xyes ; then
ENABLE_CXX=1
AC_DEFINE(ENABLE_CXX)
else
ENABLE_CXX=0
fi
AC_SUBST(ENABLE_CXX)
AC_SUBST(has_mpicxx)dnl for src/utils/pnetcdf-config.in
UD_MSG_DEBUG(has_mpicxx=$has_mpicxx)
AM_CONDITIONAL(HAS_MPICXX, [test x$has_mpicxx = xyes])
AM_CONDITIONAL(SEEK_SET_REDEFINED, [test x$ac_cv_CHECK_MPI_CPP_SEEK_SET = xyes])
dnl Note this must be done after the type of C compiler is determined
AC_ARG_ENABLE(strict,
[AS_HELP_STRING([--enable-strict],
[Turn on strict debugging with gcc. @<:@default: disabled@:>@])],
[enable_strict=${enableval}], [enable_strict=no]
)
if test "x${enable_strict}" = xyes; then
if test "x${GCC}" = xyes; then
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast"
else
AC_MSG_WARN([--enable-strict is for GNU compiler only])
enable_strict=no
fi
fi
AC_ARG_ENABLE(fortran,
[AS_HELP_STRING([--disable-fortran],
[Turn off support for the Fortran interface,
if you only need the C interface. @<:@default: enabled@:>@])],
[enable_fortran=${enableval}], [enable_fortran=auto]
)
if test "x${enable_fortran}" = xno ; then
has_fortran=no
else
has_fortran=yes
dnl Obtain full paths of MPIF77
if test "x${MPIF77}" = x ; then
dnl if MPIF77 has not been set by users, then search from
dnl CANDIDATE_MPIF77, and find the full path of MPIF77
dnl UD_MPI_PATH_PROGS also check MPI compilers in MPI_INSTALL
UD_MPI_PATH_PROGS([MPIF77], [$CANDIDATE_MPIF77])
else
dnl check whether user specified MPIF77 exists
UD_MPI_PATH_PROG([MPIF77], [$MPIF77])
fi
dnl If MPIF77 is still not set and F77 is set, then set MPIF77 to F77.
if test "x$MPIF77" = x && test "x$F77" != x ; then
dnl check whether user specified F77 exists
UD_MPI_PATH_PROG([MPIF77], [$F77])
fi
dnl If MPIF77 is still not set and FC is set, then set MPIF77 to FC.
if test "x$MPIF77" = x && test "x$FC" != x ; then
dnl check whether user specified FC exists
UD_MPI_PATH_PROG([MPIF77], [$FC])
fi
if test "x${MPIF77}" = x ; then
has_fortran=no
if test "x$ac_user_MPIF77" = x ; then
ERR_MSG="No MPI Fortran 77 compiler can be found"
else
ERR_MSG="Specified MPI Fortran 77 compiler \"$ac_user_MPIF77\" cannot be found"
fi
if test "x$MPI_INSTALL" != x ; then
ERR_MSG="$ERR_MSG under $MPI_INSTALL"
fi
if test "x${enable_fortran}" = xyes ; then
dnl --enable-fortran is explicitly set at command line
AC_MSG_ERROR([
-----------------------------------------------------------------------
$ERR_MSG.
Please specify the location of the MPI Fortran 77 compiler, either in the
MPIF77 environment variable or the --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
else
dnl enable_fortran is auto, i.e. --enable-fortran is not set at command line
AC_MSG_WARN([
-----------------------------------------------------------------------
$ERR_MSG.
Thus, the Fortran feature is disabled.
The location of the MPI Fortran 77 compiler can be specified either in the
MPIF77 environment variable or through the --with-mpi configure flag.
-----------------------------------------------------------------------])
fi
fi
fi
if test "x${has_fortran}" = xyes ; then
dnl Obtain full paths of MPIF90
if test "x${MPIF90}" = x ; then
dnl if MPIF90 has not been set by users, then search from
dnl CANDIDATE_MPIF90, and find the full path of MPIF90
dnl UD_MPI_PATH_PROGS also check MPI compilers in MPI_INSTALL
UD_MPI_PATH_PROGS([MPIF90], [$CANDIDATE_MPIF90])
else
dnl check whether user specified MPIF90 exists
UD_MPI_PATH_PROG([MPIF90], [$MPIF90])
fi
dnl If MPIF90 is still not set and F90 is set, then set MPIF90 to F90.
if test "x$MPIF90" = x && test "x$F90" != x ; then
dnl check whether user specified F90 exists
UD_MPI_PATH_PROG([MPIF90], [$F90])
fi
dnl If MPIF90 is still not set and FC is set, then set MPIF90 to FC.
if test "x$MPIF90" = x && test "x$FC" != x ; then
dnl check whether user specified FC exists
UD_MPI_PATH_PROG([MPIF90], [$FC])
fi
if test "x${MPIF90}" = x ; then
has_fortran=no
if test "x$ac_user_MPIF90" = x ; then
ERR_MSG="No MPI Fortran 90 compiler can be found"
else
ERR_MSG="Specified MPI Fortran 90 compiler \"$ac_user_MPIF90\" cannot be found"
fi
if test "x$MPI_INSTALL" != x ; then
ERR_MSG="$ERR_MSG under $MPI_INSTALL"
fi
if test "x${enable_fortran}" = xyes ; then
dnl --enable-fortran is explicitly set at command line
AC_MSG_ERROR([
-----------------------------------------------------------------------
$ERR_MSG.
Please specify the location of the MPI Fortran 90 compiler, either in the
MPIF90 environment variable or the --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
else
dnl enable_fortran is auto, i.e. --enable-fortran is not set at command line
AC_MSG_WARN([
-----------------------------------------------------------------------
$ERR_MSG.
Thus, the Fortran feature is disabled.
The location of the MPI Fortran 90 compiler can be specified either in the
MPIF90 environment variable or through the --with-mpi configure flag.
-----------------------------------------------------------------------])
fi
fi
fi
UD_MSG_DEBUG(has_fortran=${has_fortran})
UD_MSG_DEBUG([MPIF77=$MPIF77])
UD_MSG_DEBUG([MPIF90=$MPIF90])
if test "x${has_fortran}" = xyes ; then
dnl Check if MPIF77 is a valid MPI compiler
F77=${MPIF77}
AC_PROG_F77
dnl FFLAGS is set in AC_PROG_F77
AC_F77_LIBRARY_LDFLAGS
AC_MSG_CHECKING([whether $MPIF77 is a valid MPI compiler])
AC_LANG_PUSH([Fortran 77])
dnl check if can use mpif.h
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
include "mpif.h"
integer err, rank
call MPI_Comm_rank(MPI_COMM_WORLD, rank, err)]])],
[valid_mpif77=yes],[valid_mpif77=no])
AC_LANG_POP([Fortran 77])
AC_MSG_RESULT($valid_mpif77)
if test "x${valid_mpif77}" = xno ; then
has_fortran=no
if test "x${enable_fortran}" = xyes ; then
AC_MSG_ERROR([
-----------------------------------------------------------------------
Invalid MPI Fortran 77 compiler: "${MPIF77}"
A working MPI Fortran 77 compiler is required. Please specify the
location of a valid MPI Fortran 77 compiler, either in the MPIF77
environment variable or through --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
else
AC_MSG_WARN([
-----------------------------------------------------------------------
"${MPIF77}" is not a working MPI Fortran 77 compiler.
Thus, the Fortran feature is disabled.
-----------------------------------------------------------------------])
fi
fi
fi
mpi_mod=no
if test "x${has_fortran}" = xyes ; then
dnl Check if MPIF90 is a valid MPI compiler
FC=${MPIF90}
AC_PROG_FC
dnl FCFLAGS is set in AC_PROG_FC
dnl FCLIBS_save="$FCLIBS"
dnl FCLIBS=""
AC_FC_LIBRARY_LDFLAGS
dnl UD_MSG_DEBUG([before FCLIBS=$FCLIBS])
dnl The autoconf macro for finding FCLIBS sometimes makes mistakes
dnl (particularly with the Fujitsu frt compiler). This next step
dnl first sees if the FCLIBS is valid with the Fortran compiler
dnl This also happens to Solaris Studio Fortran compilers
dnl AC_PROG_FC_FCLIBS_VALID
dnl Now see if FCLIBS works with the C compiler (remove invalid ones)
dnl PAC_PROG_FC_CHECK_FCLIBS
dnl replace FLIBS and F90LIBS with FCLIBS
dnl UD_MSG_DEBUG([after FCLIBS=$FCLIBS])
dnl FLIBS="$FCLIBS"
dnl F90LIBS="$FCLIBS"
AC_MSG_CHECKING([whether mpi.mod is available])
AC_LANG_PUSH([Fortran])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ use mpi]])],
[mpi_mod=yes], [mpi_mod=no]
)
AC_MSG_RESULT($mpi_mod)
AC_MSG_CHECKING([whether $MPIF90 is a valid MPI compiler])
if test "x${mpi_mod}" = xyes ; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
use mpi
integer err, rank
call MPI_Comm_rank(MPI_COMM_WORLD, rank, err)]])],
[valid_mpif90=yes],[valid_mpif90=no]
)
else
AC_MSG_WARN([Fortran module mpi.mod is not available or invalid. Use mpif.h instead.])
dnl mpi.mod is not available, check if can use mpif.h
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
include "mpif.h"
integer err, rank
call MPI_Comm_rank(MPI_COMM_WORLD, rank, err)]])],
[valid_mpif90=yes],[valid_mpif90=no]
)
fi
AC_LANG_POP([Fortran])
AC_MSG_RESULT($valid_mpif90)
if test "x${valid_mpif90}" = xno ; then
has_fortran=no
if test "x${enable_fortran}" = xyes ; then
AC_MSG_ERROR([
-----------------------------------------------------------------------
Invalid MPI Fortran 90 compiler: "${MPIF90}"
A working MPI Fortran 90 compiler is required. Please specify the
location of a valid MPI Fortran 90 compiler, either in the MPIF90
environment variable or through --with-mpi configure flag. Abort.
-----------------------------------------------------------------------])
fi
AC_MSG_WARN([
-----------------------------------------------------------------------
"${MPIF90}" is not a working MPI Fortran 90 compiler.
Thus, the Fortran feature is disabled.
-----------------------------------------------------------------------])
else
if test "x${mpi_mod}" = xyes ; then
USE_MPIF_HEADER="use mpi, only: MPI_OFFSET_KIND"
else
USE_MPIF_HEADER="include \"mpif.h\""
fi
AC_SUBST(USE_MPIF_HEADER)
fi
fi
if test "x${has_fortran}" = xyes ; then
ENABLE_FORTRAN=1
AC_DEFINE(ENABLE_FORTRAN)
else
ENABLE_FORTRAN=0
fi
AC_SUBST(ENABLE_FORTRAN)
AC_SUBST(has_fortran)dnl for src/utils/pnetcdf-config.in
AM_CONDITIONAL(HAS_FORTRAN, [test x$has_fortran = xyes])
AM_CONDITIONAL(HAVE_MPI_MOD, [test x$mpi_mod = xyes])
if test "x${has_fortran}" = xyes ; then
if test "x${enable_strict}" = xyes && test "x${GFC}" = xyes; then
dnl not all Fortran compilers recognize -Wall
FFLAGS="$FFLAGS -Wall"
FCFLAGS="$FCFLAGS -Wall"
fi
dnl AC_SUBST(FLIBS)
dnl AC_SUBST(FCLIBS)
dnl AC_SUBST(F90LIBS)
dnl AC_SUBST(FLDFLAGS)
dnl AC_SUBST(F90LDFLAGS)
fi
ac_f77_support_freeform=no
if test "x${has_fortran}" = xyes ; then
FC_saved=${FC}
FC=${MPIF77}
dnl customized AC_FC_FREEFORM: to just get ac_cv_fc_freeform without
dnl appending ac_cv_fc_freeform to FCFLAGS
dnl ac_cv_fc_freeform is the flag for enabling Fortran free form
dnl we use this flag only in testing programs
UD_FC_FREEFORM
if test "x${ac_cv_fc_freeform}" != xunknown ; then
ac_f77_support_freeform=yes
FFREEFORMFLAG=${ac_cv_fc_freeform}
fi
UD_MSG_DEBUG([FFREEFORMFLAG=$FFREEFORMFLAG])
AC_SUBST(FFREEFORMFLAG)
FC=${FC_saved}
fi
AM_CONDITIONAL(HAVE_F77_SUPPORT_FREEFORM, [test x$ac_f77_support_freeform = xyes])
if test "x${has_fortran}" = xyes ; then
dnl GNU Fortran compiler automatically invokes preprocessor for files with
dnl extension .F and .F90. To manually invoke the preprocessor on any file,
dnl use compiler flag -cpp. To disable, use -nocpp.
dnl For other compilers, we need to find the compile flags for Fortran
dnl preprocessor.
dnl AC_FC_PP_SRCEXT is first introduced in autoconf 2.69
dnl steal AC_FC_PP_SRCEXT from autoconf 2.69 to make UD_FC_PP_SRCEXT
dnl UD_FC_PP_SRCEXT([F]) dnl sets ac_cv_fc_pp_srcext_F
dnl UD_FC_PP_SRCEXT([F90]) dnl sets ac_cv_fc_pp_srcext_F90
AC_FC_PP_SRCEXT([F]) dnl sets ac_cv_fc_pp_srcext_F
AC_FC_PP_SRCEXT([F90]) dnl sets ac_cv_fc_pp_srcext_F90
dnl compiler command-line define preprocessor flag, result in ${FC_DEFINE}
dnl Not all Fortran compilers use -D
dnl UD_FC_PP_DEFINE
dnl AC_FC_PP_DEFINE is first introduced in autoconf 2.69
AC_FC_PP_DEFINE
dnl check compiler flags for file extensions in .f .F .f90 .F90
AC_FC_SRCEXT([f])
AC_FC_SRCEXT([F])
AC_FC_SRCEXT([f90])
AC_FC_SRCEXT([F90])
AC_LANG_PUSH([Fortran])
dnl get compiler vendor in ax_cv_fc_compiler_vendor (e.g. gnu, intel)
AX_COMPILER_VENDOR
AC_LANG_POP([Fortran])
dnl get base compiler command of MPI Fortran compiler wrapper in
dnl ac_cv_mpi_compiler_base_MPIF90 (e.g. /usr/bin/gfortran)
MPI_COMPILER_BASE(MPIF90)
dnl customized AC_FC_FIXEDFORM: to just get ac_cv_fc_fixedform without
dnl appending ac_cv_fc_fixedform to FCFLAGS
dnl ac_cv_fc_fixedform flag is for enabling Fortran fixed form.
dnl we use this flag only in testing programs
UD_FC_FIXEDFORM
FFIXEDFORMFLAG=${ac_cv_fc_fixedform}
UD_MSG_DEBUG([FC=$FC FFIXEDFORMFLAG=$FFIXEDFORMFLAG])
AC_SUBST(FFIXEDFORMFLAG)
dnl Checking for Fortran types also determines the Fortran name mangling
dnl and places the value into FCALLSCSUB as the C name corresponding
dnl to the Fortran name SUB
AC_FC_FUNC(sub, [FCALLSCSUB])
dnl determine the correct name mapping
case $FCALLSCSUB in
SUB)
AC_DEFINE(F77_NAME_UPPER,,[Define if Fortran names are uppercase])
;;
sub_)
dnl This is the hard case. gcc uses one _ unless the name includes
dnl an underscore, in which case it gets two trailing underscores.
dnl Use essentially the same configure code that the original configure
dnl used to determine SUB
AC_MSG_CHECKING([for C-equivalent to Fortran routine "SUB_A"])
dnl "
AC_FC_FUNC(sub_a, [FCALLSCSUBA])
AC_MSG_RESULT($FCALLSCSUBA)
case $FCALLSCSUBA in
sub_a__)
AC_DEFINE(F77_NAME_LOWER_2USCORE,,[Define if Fortran names are lower case with two trailing underscore2])
;;
sub_a_)
AC_DEFINE(F77_NAME_LOWER_USCORE,,[Define if Fortran names are lower case with one trailing underscore])
;;
*)
AC_MSG_WARN([Unrecognized Fortran name mapping])
;;
esac
;;
sub)
AC_DEFINE(F77_NAME_LOWER,,[Define if Fortran names are lower case])
;;
*)
AC_MSG_WARN([Unrecognized Fortran name mapping])
;;
esac
dnl Some Fortran 77 compilers, such as pgf77, do not allow "_8" modifier,
dnl because _8 modifier is a Fortran 90 feature
dnl UD_CHECK_F77_IS_PGF77
dnl UD_MSG_DEBUG([ac_cv_mpif77_is_PGF77=$ac_cv_mpif77_is_PGF77])
dnl check Fortran parameter modifier for 8-byte integer type
dnl We need this to set the max constants for UINT, INT64, and UINT64
UD_FC_CONSTANT_MODIFIER
UD_MSG_DEBUG([ac_cv_fc_constant_modifier=$ac_cv_fc_constant_modifier])
PNF_INT8_MODIFIER=""
if test "x${ac_cv_fc_constant_modifier}" = xnone ; then
PNF_FILL_UINT=4294967295
PNF_FILL_INT64=-9223372036854775806
PNF_FILL_UINT64=18446744073709551614
PNF_X_UINT_MAX=4294967295
PNF_X_INT8_MIN=-9223372036854775807
PNF_X_INT8_MAX=9223372036854775807
PNF_X_UINT8_MAX=18446744073709551615
else
if test "x${ac_cv_fc_constant_modifier}" = xEightByteInt ; then
PNF_INT8_MODIFIER=" integer, parameter :: EightByteInt = selected_int_kind(18)"
fi
PNF_FILL_UINT=4294967295_${ac_cv_fc_constant_modifier}
PNF_FILL_INT64=-9223372036854775806_${ac_cv_fc_constant_modifier}
PNF_FILL_UINT64=18446744073709551614_${ac_cv_fc_constant_modifier}
PNF_X_UINT_MAX=4294967295_${ac_cv_fc_constant_modifier}
PNF_X_INT8_MIN=-9223372036854775807_${ac_cv_fc_constant_modifier}
PNF_X_INT8_MAX=9223372036854775807_${ac_cv_fc_constant_modifier}
PNF_X_UINT8_MAX=18446744073709551615_${ac_cv_fc_constant_modifier}
fi
AC_SUBST(PNF_INT8_MODIFIER)
AC_SUBST(PNF_FILL_UINT)
AC_SUBST(PNF_FILL_INT64)