forked from HDFGroup/hdf5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
4322 lines (3797 loc) · 149 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
## Process this file with autoconf to produce configure.
##
## Copyright by The HDF Group.
## Copyright by the Board of Trustees of the University of Illinois.
## All rights reserved.
##
## This file is part of HDF5. The full HDF5 copyright notice, including
## terms governing use, modification, and redistribution, is contained in
## the COPYING file, which can be found at the root of the source code
## distribution tree, or in https://www.hdfgroup.org/licenses.
## If you do not have access to either file, you may request a copy from
## ----------------------------------------------------------------------
## Initialize configure.
##
AC_PREREQ([2.69])
## AC_INIT takes the name of the package, the version number, and an
## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file
## as its argument.
##
## NOTE: Do not forget to change the version number here when we do a
## release!!!
##
AC_INIT([HDF5], [1.13.2-1], [[email protected]])
AC_CONFIG_SRCDIR([src/H5.c])
AC_CONFIG_HEADERS([src/H5config.h])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
## AM_INIT_AUTOMAKE takes a list of options that should be applied to
## every Makefile.am when automake is run.
AM_INIT_AUTOMAKE([foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where available - automake 1.11
## AM_MAINTAINER_MODE determines the behavior of "rebuild rules" that contain
## dependencies for Makefile.in files, configure, src/H5config.h, etc. If
## AM_MAINTAINER_MODE is enabled, these files will be rebuilt if out of date.
## When disabled, the autotools build files can get out of sync and the build
## system will not complain or try to regenerate downstream files.
##
## The AM_MAINTAINER_MODE macro also determines whether the
## --(enable|disable)-maintainer-mode configure option is available. When the
## macro is present, with or without a parameter, the option will be added
## to the generated configure script.
##
## In summary:
##
## AM_MAINTAINER_MODE([enable])
## - Build dependencies ON by default
## - Configure option exists
##
## AM_MAINTAINER_MODE([disable])
## - Build dependencies OFF by default
## - Configure option exists
##
## AM_MAINTAINER_MODE
## - Build dependencies OFF by default
## - Configure option exists
##
## No AM_MAINTAINER_MODE macro
## - Build dependencies ON by default
## - No configure option to control build dependencies
##
## The biggest concern for us is that version control systems like git
## usually don't preserve dependencies between timestamps, so the build
## system will often think that upstream build files like Makefile.am are
## dirty and that rebuilding needs to occur when it doesn't. This is a problem
## in release branches where we provide the autotools-generated files. Users
## who don't have autoconf, automake, etc. will then have difficulty building
## release branches checked out from git.
##
## By default, maintainer mode is enabled in development branches and disabled
## in release branches.
AM_MAINTAINER_MODE([enable])
## ----------------------------------------------------------------------
## Set prefix default (install directory) to a directory in the build area.
## This allows multiple src-dir builds within one host.
AC_PREFIX_DEFAULT([`pwd`/hdf5])
## Run post processing on files created by configure.
## src/H5pubconf.h:
## Generate src/H5pubconf.h from src/H5config.h by prepending H5_ to all
## macro names. This avoid name conflict between HDF5 macro names and those
## generated by another software package that uses the HDF5 library.
## src/libhdf5.settings:
## Remove all lines begun with "#" which are generated by CONDITIONAL's of
## configure.
AC_CONFIG_COMMANDS([pubconf], [
echo "creating src/H5pubconf.h"
sed 's/#define /#define H5_/' <src/H5config.h |\
sed 's/#undef /#undef H5_/' >pubconf
if test ! -f src/H5pubconf.h; then
mv -f pubconf src/H5pubconf.h
elif (diff pubconf src/H5pubconf.h >/dev/null); then
rm -f pubconf
echo "src/H5pubconf.h is unchanged"
else
mv -f pubconf src/H5pubconf.h
fi
echo "Post process src/libhdf5.settings"
sed '/^#/d' < src/libhdf5.settings > libhdf5.settings.TMP
cp libhdf5.settings.TMP src/libhdf5.settings
rm -f libhdf5.settings.TMP
])
## It's possible to configure for a host other than the one on which
## configure is currently running by using the --host=foo flag.
## For machines on which HDF5 is often configured, it can be convenient
## to specify the name of the machine rather than its canonical type.
##
## There are currently no hosts, but if there were they would be
## listed by hostname and the alias would point to a file in
## the config directory:
##
##case $host_alias in
## <some host>)
## host_alias=<config file in config directory>
## ;;
##esac
AC_CANONICAL_HOST
AC_SUBST([CPPFLAGS])
AC_SUBST([JNIFLAGS])
AC_SUBST([AR_FLAGS])
## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
## not exported to h5cc (or h5fc, etc.)
##
AC_SUBST([H5_CFLAGS])
AC_SUBST([H5_CPPFLAGS])
AC_SUBST([H5_FCFLAGS])
AC_SUBST([H5_CXXFLAGS])
AC_SUBST([H5_JNIFLAGS])
AC_SUBST([H5_JAVACFLAGS])
AC_SUBST([H5_JAVAFLAGS])
AC_SUBST([H5_LDFLAGS])
## AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5,
## and WILL be exported to h5cc (or h5fc, etc) if set by configure.
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_FCFLAGS])
AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_JNIFLAGS])
AC_SUBST([AM_JAVACFLAGS])
AC_SUBST([AM_JAVAFLAGS])
AC_SUBST([AM_LDFLAGS])
## Make sure flags are initialized.
AM_CFLAGS="${AM_CFLAGS}"
AM_CXXFLAGS="${AM_CXXFLAGS}"
AM_FCFLAGS="${AM_FCFLAGS}"
AM_CPPFLAGS="${AM_CPPFLAGS}"
AM_JNIFLAGS="${AM_JNIFLAGS}"
AM_JAVACFLAGS="${AM_JAVACFLAGS}"
AM_JAVAFLAGS="${AM_JAVAFLAGS}"
AM_LDFLAGS="${AM_LDFLAGS}"
CFLAGS="${CFLAGS}"
CXXFLAGS="${CXXFLAGS}"
FCFLAGS="${FCFLAGS}"
CPPFLAGS="${CPPFLAGS}"
JNIFLAGS="${JNIFLAGS}"
JAVACFLAGS="${JAVACFLAGS}"
JAVAFLAGS="${JAVAFLAGS}"
LDFLAGS="${LDFLAGS}"
AR_FLAGS="${AR_FLAGS}"
## Configure may need to alter any of the *FLAGS variables in order for
## various checks to work correctly. Save the user's value here so it
## can be restored once all configure checks are complete.
saved_user_CFLAGS="$CFLAGS"
saved_user_CXXFLAGS="$CXXFLAGS"
saved_user_FCFLAGS="$FCFLAGS"
saved_user_JAVACFLAGS="$JAVACFLAGS"
saved_user_JAVAFLAGS="$JAVAFLAGS"
saved_user_LDFLAGS="$LDFLAGS"
saved_user_CPPFLAGS="$CPPFLAGS"
## Support F9X variable to define Fortran compiler if FC variable is
## not used. This should be deprecated in the future.
if test "x" = "x$FC"; then
FC=${F9X}
fi
## ----------------------------------------------------------------------
## Dump all shell variables values.
##
AC_MSG_CHECKING([shell variables initial values])
set >&AS_MESSAGE_LOG_FD
AC_MSG_RESULT([done])
## ----------------------------------------------------------------------
## Save system information for the library settings file.
##
AC_SUBST([UNAME_INFO])
UNAME_INFO=`uname -a`
## ----------------------------------------------------------------------
## Some platforms have broken basename, and/or xargs programs. Check
## that it actually does what it's supposed to do. Catch this early
## since configure and scripts relies upon them heavily and there's
## no use continuing if it's broken.
##
AC_MSG_CHECKING([if basename works])
BASENAME_TEST="`basename /foo/bar/baz/qux/basename_works`"
if test $BASENAME_TEST != "basename_works"; then
AC_MSG_ERROR([basename program doesn't work])
else
AC_MSG_RESULT([yes])
fi
## xargs basename used in configure to get the CC_BASENAME value
AC_MSG_CHECKING([if xargs works])
XARGS_TEST="`echo /foo/bar/baz/qux/xargs_works | xargs basename`"
if test $XARGS_TEST != "xargs_works"; then
AC_MSG_ERROR([xargs program doesn't work])
else
AC_MSG_RESULT([yes])
fi
## ----------------------------------------------------------------------
## Check that the cache file was build on the same host as what we're
## running on now.
##
AC_CACHE_CHECK([for cached host], [hdf5_cv_host], [hdf5_cv_host="none"]);
if test $hdf5_cv_host = "none"; then
hdf5_cv_host=$host
elif test $hdf5_cv_host != $host; then
AC_MSG_ERROR([
The config.cache file was generated on $hdf5_cv_host but
this is $host. Please remove that file and try again.
config.cache file is invalid])
fi
## ----------------------------------------------------------------------
## Check if we should consider certain compiler warnings as errors
##
## We have to set WARNINGS_AS_ERRORS before sourcing a $host_config
## file, below.
##
## These should NOT be on by default as the risk of breakage is high
## when compiling HDF5 on new (or new versions) of platforms and
## compilers. It can also cause failures when header files we have no
## control over (e.g. MPI, HDFS) raise warnings.
##
AC_MSG_CHECKING([enable warnings as errors])
AC_ARG_ENABLE([warnings-as-errors],
[AS_HELP_STRING([--enable-warnings-as-errors],
[Determines whether certain warnings will be
considered errors. This is mainly for use
by HDF5 library developers.
[default=no]
])],
[WARNINGS_AS_ERRORS=$enableval])
## Set default
if test "X-$WARNINGS_AS_ERRORS" = X- ; then
WARNINGS_AS_ERRORS=no
fi
case "X-$WARNINGS_AS_ERRORS" in
X-yes|X-no)
AC_MSG_RESULT([$WARNINGS_AS_ERRORS])
;;
*)
AC_MSG_ERROR([Unrecognized value: $WARNINGS_AS_ERRORS])
;;
esac
## ----------------------------------------------------------------------
## Source any special files that we need. These files normally aren't
## present but can be used by the maintainers to fine tune things like
## turning on debug or profiling flags for the compiler. The search order
## is:
##
## CPU-VENDOR-OS
## VENDOR-OS
## CPU-OS
## CPU-VENDOR
## OS
## VENDOR
## CPU
##
## If the `OS' ends with a version number then remove it. For instance,
## `freebsd3.1' would become `freebsd'
case $host_os in
aix*)
host_os_novers=aix
;;
freebsd*)
host_os_novers=freebsd
;;
netbsd*)
host_os_novers=netbsd
;;
solaris*)
host_os_novers=solaris
;;
*)
host_os_novers=$host_os
;;
esac
host_config="none"
for f in $host_cpu-$host_vendor-$host_os \
$host_cpu-$host_vendor-$host_os_novers \
$host_vendor-$host_os \
$host_vendor-$host_os_novers \
$host_cpu-$host_os \
$host_cpu-$host_os_novers \
$host_cpu-$host_vendor \
$host_os \
$host_os_novers \
$host_vendor \
$host_cpu ; do
AC_MSG_CHECKING([for config $f])
if test -f "$srcdir/config/$f"; then
host_config=$srcdir/config/$f
AC_MSG_RESULT([found])
break
fi
AC_MSG_RESULT([no])
done
if test "X$host_config" != "Xnone"; then
CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
. $host_config
fi
## Source any special site-specific file
hname="`hostname`"
while test -n "$hname"; do
file=$srcdir/config/site-specific/host-$hname
AC_MSG_CHECKING([for config $file])
if test -f "$file"; then
. $file
AC_MSG_RESULT([found])
break
fi
AC_MSG_RESULT([no])
hname_tmp=$hname
hname="`echo $hname | cut -d. -f2-99`"
test "$hname_tmp" = "$hname" && break
done
##
## Enable/disable sanitizer checks for clang compilers, initially address sanitizer
##
AC_MSG_CHECKING([for clang sanitizer checks])
AC_ARG_ENABLE([sanitize-checks],
[AS_HELP_STRING([--enable-sanitize-checks=address],
[(clang/clang++ compilers only) Enable sanitize checks.
Address is useful for detecting issues dealing with
memory. See AddressSanitizer in config/sanitizer/README.md
for more information.
[default=none]
])],
[CLANG_SANITIZE_CHECKS=$enableval])
# Set default
if test "X-$CLANG_SANITIZE_CHECKS" = X- ; then
CLANG_SANITIZE_CHECKS=none
fi
if test "X$CC_BASENAME" = "Xclang"; then
AC_SUBST([CLANG_SANITIZE_CHECKS])
# There are several sanitizer tools. At present we are testing
# and describing only -fsanitizer=address with autotools.
case "X-$CLANG_SANITIZE_CHECKS" in
X-no|X-none)
CLANG_SANITIZE_CHECKS=none
CLANG_SANITIZE_LIST=
;;
*)
CLANG_SANITIZE_LIST=$CLANG_SANITIZE_CHECKS
;;
esac
AC_MSG_RESULT([$CLANG_SANITIZE_CHECKS])
# Other tools can be added to the list of checks
# The clang compiler doesn't support some of them; they should be
# checked before adding them to the list in the help message.
# The sanitizers/sanitizers.cmake file lists these options:
# address, memory, memoryWithOrigins, undefined, thread, leak,
# 'address;undefined'. Which and which combinations of these are
# supported varies by compiler version, but unsupported options
# or combinations will result in configure errors reported in config.log.
# Comma separated lists of sanitize options will be entered intact in
# one -fsanitize=<list> flag. Space separated lists will be entered in
# separate -fsanitize=<item> flags.
# NOTE: No sanity checking done here!
if test -n "$CLANG_SANITIZE_LIST"; then
H5_CFLAGS="$H5_CFLAGS -fno-omit-frame-pointer"
H5_CXXFLAGS="$H5_CXXFLAGS -fno-omit-frame-pointer"
for sanitizer in `echo $CLANG_SANITIZE_LIST`; do
H5_CFLAGS="$H5_CFLAGS -fsanitize=${sanitizer}"
H5_CXXFLAGS="$H5_CXXFLAGS -fsanitize=${sanitizer}"
done
fi
fi
## ----------------------------------------------------------------------
## Determine build mode (debug, production, clean).
## This has to be done early since the build mode is referred to
## frequently.
##
AC_MSG_CHECKING([build mode])
AC_ARG_ENABLE([build-mode],
[AS_HELP_STRING([--enable-build-mode=(debug|production|clean)],
[Sets the build mode. Debug turns on symbols, API
tracing, asserts, and debug optimization,
as well as several other minor configure options
that aid in debugging.
Production turns high optimizations on.
Clean turns nothing on and disables optimization
(i.e.: a 'clean slate' configuration).
All these settings can be overridden by using
specific configure flags.
[default=debug]
])],
[BUILD_MODE=$enableval])
## Set the default
## Depends on branch, set via script at branch creation time
if test "X-$BUILD_MODE" = X- ; then
BUILD_MODE=debug
fi
## Allow this variable to be substituted in
## other files (src/libhdf5.settings.in, etc.)
AC_SUBST([BUILD_MODE])
case "X-$BUILD_MODE" in
X-clean)
AC_MSG_RESULT([clean])
;;
X-debug)
AC_DEFINE([DEBUG_BUILD], [1], [Define if this is a debug build.])
H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS"
H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS"
H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS"
H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS"
AC_MSG_RESULT([debug])
;;
X-production)
H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS"
H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS"
H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS"
H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS"
AC_MSG_RESULT([production])
;;
*)
AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.])
esac
## ----------------------------------------------------------------------
## Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so
## we need to add this in so configure works as intended. We will need to
## reset this value at the end of configure, to preserve the user's settings.
CFLAGS="${AM_CFLAGS} ${CFLAGS}"
FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}"
JAVACFLAGS="${AM_JAVACFLAGS} ${JAVACFLAGS}"
JAVAFLAGS="${AM_JAVAFLAGS} ${JAVAFLAGS}"
CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
## ----------------------------------------------------------------------
## Enable dependency tracking unless the configure options or a
## site-specific file told us not to. This prevents configure from
## silently disabling dependencies for some compilers.
##
if test -z "${enable_dependency_tracking}"; then
enable_dependency_tracking="yes"
fi
## ----------------------------------------------------------------------
## Check for programs.
##
AC_PROG_CC
CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
## ----------------------------------------------------------------------------
## Configure disallows unsupported combinations of options. However, users
## may want to override and build with unsupported combinations for their
## own use. They can use the --enable-unsupported configure flag, which
## ignores any errors from configure due to incompatible flags.
AC_MSG_CHECKING([if unsupported combinations of configure options are allowed])
AC_ARG_ENABLE([unsupported],
[AS_HELP_STRING([--enable-unsupported],
[Allow unsupported combinations of configure options])],
[ALLOW_UNSUPPORTED=$enableval])
case "X-$ALLOW_UNSUPPORTED" in
X-|X-no)
AC_MSG_RESULT([no])
;;
X-yes)
AC_MSG_RESULT([yes])
;;
*)
;;
esac
## ----------------------------------------------------------------------
## Data types and their sizes.
##
AC_TYPE_OFF_T
AC_CHECK_TYPE([ssize_t], [],
[AC_DEFINE_UNQUOTED([ssize_t], [long],
[Define to `long' if <sys/types.h> does not define.])])
AC_C_BIGENDIAN
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([unsigned])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([__int64])
AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([long double])
## ----------------------------------------------------------------------
## Check for non-standard extension __FLOAT128
##
HAVE_FLOAT128=0
HAVE_QUADMATH=0
FLT128_DIG=0
LDBL_DIG=0
AC_CHECK_SIZEOF([__float128])
AC_CHECK_SIZEOF([_Quad])
AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], [])
PAC_FC_LDBL_DIG
AC_SUBST([PAC_C_MAX_REAL_PRECISION])
if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then
AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available])
PAC_C_MAX_REAL_PRECISION=$FLT128_DIG
else
PAC_C_MAX_REAL_PRECISION=$LDBL_DIG
fi
AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C])
AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION])
## ----------------------------------------------------------------------
## Check if they would like the Fortran interface compiled
##
## This needs to be exposed for the library info file even if Fortran is disabled.
AC_SUBST([HDF_FORTRAN])
## Default is no Fortran
HDF_FORTRAN=no
AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES=""
AC_MSG_CHECKING([if Fortran interface enabled])
AC_ARG_ENABLE([fortran],
[AS_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[HDF_FORTRAN=$enableval])
AC_MSG_RESULT([$HDF_FORTRAN])
if test "X$HDF_FORTRAN" = "Xyes"; then
## We will output an include file for Fortran, H5config_f.inc which
## contains various configure definitions used by the Fortran Library.
## Prepend H5_ to all macro names. This avoids name conflict between HDF5 macro
## names and those generated by another software package that uses the HDF5 library.
AC_CONFIG_HEADERS([fortran/src/H5config_f.inc],
[cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc])
AC_SUBST([FC])
HDF5_INTERFACES="$HDF5_INTERFACES fortran"
## --------------------------------------------------------------------
## HDF5 integer variables for the H5fortran_types.f90 file.
##
AC_SUBST([R_LARGE])
AC_SUBST([R_INTEGER])
AC_SUBST([HADDR_T])
AC_SUBST([HSIZE_T])
AC_SUBST([HSSIZE_T])
AC_SUBST([HID_T])
AC_SUBST([SIZE_T])
AC_SUBST([OBJECT_NAMELEN_DEFAULT_F])
## --------------------------------------------------------------------
## Fortran source extension
##
AC_FC_SRCEXT([f90])
AC_SUBST([F9XSUFFIXFLAG])
AC_SUBST([FSEARCH_DIRS])
## --------------------------------------------------------------------
## Check for a Fortran compiler and how to include modules.
##
AC_PROG_FC([PAC_FC_SEARCH_LIST],)
AC_F9X_MODS
## Change to the Fortran 90 language
AC_LANG_PUSH(Fortran)
## Checking if the compiler supports the required Fortran 2003 features and
## stopping if it does not.
PAC_PROG_FC_HAVE_F2003_REQUIREMENTS
if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then
AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran])
fi
## --------------------------------------------------------------------
## Define wrappers for the C compiler to use Fortran function names
##
AC_FC_WRAPPERS
## --------------------------------------------------------------------
## See if the fortran compiler supports the intrinsic function "SIZEOF"
PAC_PROG_FC_SIZEOF
## See if the fortran compiler supports the intrinsic function "C_SIZEOF"
PAC_PROG_FC_C_SIZEOF
## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE"
PAC_PROG_FC_STORAGE_SIZE
## Set the sizeof function for use later in the fortran tests
if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes";then
FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)"
FC_SIZEOF_B="STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)"
FC_SIZEOF_C="STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)"
else
if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes";then
FC_SIZEOF_A="SIZEOF(a)"
FC_SIZEOF_B="SIZEOF(b)"
FC_SIZEOF_C="SIZEOF(c)"
else
## If neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error
AC_MSG_ERROR([Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE])
fi
fi
## See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV"
PAC_PROG_FC_ISO_FORTRAN_ENV
## Check KIND and size of native integer
PAC_FC_NATIVE_INTEGER
## Find all available KINDs
PAC_FC_AVAIL_KINDS
## Find all sizeofs for available KINDs
PAC_FC_SIZEOF_INT_KINDS
PAC_FC_SIZEOF_REAL_KINDS
AC_SUBST([PAC_FC_ALL_REAL_KINDS])
AC_SUBST([PAC_FC_MAX_REAL_PRECISION])
AC_SUBST([PAC_FORTRAN_NUM_INTEGER_KINDS])
AC_SUBST([PAC_FC_ALL_INTEGER_KINDS])
AC_SUBST([PAC_FC_ALL_REAL_KINDS_SIZEOF])
AC_SUBST([PAC_FC_ALL_INTEGER_KINDS_SIZEOF])
AC_SUBST([PAC_FORTRAN_NATIVE_INTEGER_KIND])
AC_SUBST([PAC_FORTRAN_NATIVE_INTEGER_SIZEOF])
AC_SUBST([PAC_FORTRAN_NATIVE_REAL_KIND])
AC_SUBST([PAC_FORTRAN_NATIVE_REAL_SIZEOF])
AC_SUBST([PAC_FORTRAN_NATIVE_DOUBLE_KIND])
AC_SUBST([PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF])
AC_SUBST([HAVE_Fortran_INTEGER_SIZEOF_16])
AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE])
AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE])
AC_SUBST([H5CONFIG_F_NUM_RKIND])
AC_SUBST([H5CONFIG_F_RKIND])
AC_SUBST([H5CONFIG_F_RKIND_SIZEOF])
AC_SUBST([H5CONFIG_F_NUM_IKIND])
AC_SUBST([H5CONFIG_F_IKIND])
AC_SUBST([Fortran_COMPILER_ID])
Fortran_COMPILER_ID=none
AC_DEFINE_UNQUOTED([Fortran_COMPILER_ID], $Fortran_COMPILER_ID, [Define Fortran compiler ID])
## Setting definition if there is a 16 byte fortran integer
if `echo $PAC_FC_ALL_INTEGER_KINDS_SIZEOF | grep '16' >/dev/null`; then
HAVE_Fortran_INTEGER_SIZEOF_16="1"
AC_DEFINE([HAVE_Fortran_INTEGER_SIZEOF_16], [1], [Determine if INTEGER*16 is available])
else
HAVE_Fortran_INTEGER_SIZEOF_16="0"
AC_DEFINE([HAVE_Fortran_INTEGER_SIZEOF_16], [0], [Determine if INTEGER*16 is available])
fi
if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes"; then
AC_DEFINE([FORTRAN_HAVE_STORAGE_SIZE], [1], [Define if we have Fortran intrinsic STORAGE_SIZE])
fi
if test "X$HAVE_C_SIZEOF_FORTRAN" = "Xyes"; then
AC_DEFINE([FORTRAN_HAVE_C_SIZEOF], [1], [Define if we have Fortran intrinsic C_SIZEOF])
fi
if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes"; then
AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF])
fi
## See if C_LONG_DOUBLE is available
PAC_PROG_FC_HAVE_C_LONG_DOUBLE
FORTRAN_HAVE_C_LONG_DOUBLE="0"
if test "X$HAVE_C_LONG_DOUBLE_FORTRAN" = "Xyes"; then
FORTRAN_HAVE_C_LONG_DOUBLE="1"
AC_DEFINE([FORTRAN_HAVE_C_LONG_DOUBLE], [1], [Define if we have Fortran C_LONG_DOUBLE])
fi
## Is C_LONG_DOUBLE different from C_DOUBLE
FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0"
if test "$FORTRAN_HAVE_C_LONG_DOUBLE" = "1"; then
PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
if test "X$C_LONG_DOUBLE_IS_UNIQUE_FORTRAN" = "Xyes"; then
FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="1"
AC_DEFINE([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE], [1], [Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE])
else
FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0"
fi
fi
FORTRAN_SIZEOF_LONG_DOUBLE=${ac_cv_sizeof_long_double}
AC_DEFINE_UNQUOTED([FORTRAN_SIZEOF_LONG_DOUBLE], ["${ac_cv_sizeof_long_double}"], [Determine the size of C long double])
dnl get the largest sizeof for REAL kinds
max_real_fortran_sizeof="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -ne 's/.*,\([[0-9]]*\)}/\1/p'`"
max_real_fortran_kind="`echo $PAC_FC_ALL_REAL_KINDS | sed -ne 's/.*,\([[0-9]]*\)}/\1/p'`"
dnl remove the invalid kind from the list
if test "$ac_cv_sizeof___float128" != 0;then
if test "$ac_cv_sizeof___float128" != "$max_real_fortran_sizeof" &&
test "${ac_cv_sizeof_long_double}" != "$max_real_fortran_sizeof" &&
dnl account for the fact that the C compiler can have 16-byte __float128 and the Fortran compiler only has 8-byte doubles,
dnl so we don't want to remove the 8-byte Fortran doubles. This is sometimes the case if different C and Fortran vendors
dnl are used (for example gnu and pgi).
test "${ac_cv_sizeof_double}" != "$max_real_fortran_sizeof" ; then
AC_MSG_WARN([
Fortran REAL(KIND=$max_real_fortran_kind) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size
!!! Fortran interfaces will not be generated for REAL(KIND=$max_real_fortran_kind) !!!
])
PAC_FC_ALL_REAL_KINDS="`echo $PAC_FC_ALL_REAL_KINDS | sed -e 's/,[[0-9]]\+}/}/g'`"
PAC_FC_ALL_REAL_KINDS_SIZEOF="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/,[[0-9]]\+}/}/g'`"
fi
fi
AC_MSG_CHECKING([for Fortran interoperable KINDS with C])
AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS])
dnl count the number of real kinds
H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `echo \"[$]PAC_FC_ALL_REAL_KINDS\" | tr -d -c ',\n' | awk '{ print length + 1; }'`"
H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $PAC_FC_ALL_REAL_KINDS | sed -e 's/{//g' | sed -e 's/}//g' | sed -e 's/ /,/g'`/)"
H5CONFIG_F_RKIND_SIZEOF="INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/{//g' | sed -e 's/}//g'| sed -e 's/ /,/g'`/)"
AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs])
AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs])
AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND_SIZEOF], $H5CONFIG_F_RKIND_SIZEOF, [Define valid Fortran REAL KINDs Sizeof])
## Change back to the C language
AC_LANG_POP(Fortran)
else
FC="no"
fi
## ----------------------------------------------------------------------
## Check if they would like the C++ interface compiled
##
## This needs to be exposed for the library info file even if C++ is disabled.
AC_SUBST([HDF_CXX])
## Default is no C++
HDF_CXX=no
## We need to check for a C++ compiler unconditionally, since
## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will
## miss even if c++ is not enabled.
AC_PROG_CXX
AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done
AC_MSG_CHECKING([if c++ interface enabled])
AC_ARG_ENABLE([cxx],
[AS_HELP_STRING([--enable-cxx],
[Compile the C++ interface [default=no]])],
[HDF_CXX=$enableval])
AC_MSG_RESULT([$HDF_CXX])
if test "X$HDF_CXX" = "Xyes"; then
HDF5_INTERFACES="$HDF5_INTERFACES c++"
## Expose the compiler for *.in files
AC_SUBST([CXX])
## Change to the C++ language
AC_LANG_PUSH(C++)
else
CXX="no"
fi
## Change back to the C language
AC_LANG_POP(C++)
## ----------------------------------------------------------------------
## Check if they would like the High Level library compiled
##
## This needs to be exposed for the library info file even if the HL
## library is disabled.
AC_SUBST([HDF5_HL])
AC_SUBST([HDF5_HL_TOOLS])
## The high-level library and high-level tools are enabled unless the build mode
## is clean.
if test "X-$BUILD_MODE" = "X-clean" ; then
HDF5_HL=no
HDF5_HL_TOOLS=no
else
HDF5_HL=yes
HDF5_HL_TOOLS=yes
fi
## high-level library directories (set when needed, blank until then)
##
## main high-level library
AC_SUBST(HL)
HL=""
## Fortran high-level library
AC_SUBST(HL_FOR)
HL_FOR=""
## Tools high-level library
AC_SUBST(HL_TOOLS)
HL_TOOLS=""
AC_MSG_CHECKING([if the high-level library is enabled])
AC_ARG_ENABLE([hl],
[AS_HELP_STRING([--enable-hl],
[Enable the high-level library.
[default=yes (unless build mode = clean)]
])],
[HDF5_HL=$enableval])
if test "X-$HDF5_HL" = "X-yes"; then
AC_MSG_RESULT([yes])
HL="hl"
AC_DEFINE([INCLUDE_HL], [1],
[Define if the high-level library headers should be included in hdf5.h])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([if the high-level tools are enabled])
AC_ARG_ENABLE([hltools],
[AS_HELP_STRING([--enable-hltools],
[Enable the high-level tools.
[default=yes)]
])],
[HDF5_HL_TOOLS=$enableval])
if test "X${HDF5_HL}" = "Xyes" -a "X-$HDF5_HL_TOOLS" = "X-yes"; then
AC_MSG_RESULT([yes])
HL_TOOLS="tools"
else
AC_MSG_RESULT([no])
fi
## ----------------------------------------------------------------------
## Enable new references for dimension scales
##
AC_SUBST([DIMENSION_SCALES_WITH_NEW_REF])
AC_MSG_CHECKING([whether to use new references with dimension scales]);
AC_ARG_ENABLE([dimension-scales-with-new-ref],
[AS_HELP_STRING([--enable-dimension-scales-with-new-ref],
[Use new references when creating dimension scales.
[default=no]
])],
[DIMENSION_SCALES_WITH_NEW_REF=$enableval])
## Set the default value to use old references.
if test "X-$DIMENSION_SCALES_WITH_NEW_REF" = X- ; then
DIMENSION_SCALES_WITH_NEW_REF=no
fi
case "X-$DIMENSION_SCALES_WITH_NEW_REF" in
X-yes)
AC_MSG_RESULT([yes])
AC_DEFINE([DIMENSION_SCALES_WITH_NEW_REF], [1],
[Define if new references for dimension scales were requested])
;;
X-no)
AC_MSG_RESULT([no])
;;
*)
AC_MSG_ERROR([Unrecognized value: $DIMENSION_SCALES_WITH_NEW_REF])
;;
esac
## ----------------------------------------------------------------------
## Check which archiving tool to use. This needs to be done before
## the AM_PROG_LIBTOOL macro.
##
if test -z "$AR"; then
AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
fi
AC_SUBST([AR])
# Set the default ar flags to cr
# The Automake default is to use cru and the 'u' causes ar
# to emit warnings on some platforms.
AR_FLAGS=cr
## Export the AR macro so that it will be placed in the libtool file
## correctly.
export AR
AC_PROG_MAKE_SET
AC_PROG_INSTALL
## ----------------------------------------------------------------------
## Set up ${TR} which is used to process the package list for extra
## debugging output in the C library.
AC_PATH_PROG([TR], [tr])
## ----------------------------------------------------------------------
## Check that time can be used with srcdir. This is okay on most systems,
## but seems to cause problems on Cygwin.
## The solution on Cygwin is not to record execution time for tests.
##
## Note: This is still true as of Cygwin 1.7.32 (Aug 2014) on both 32-
## and 64-bit platforms. Given how long this has been true, it seems
## unlikely to change, but we should probably re-test this periodically.
AC_MSG_CHECKING([if srcdir= and time commands work together])
AC_SUBST([TIME])
TIME=time
TIME_TEST=`foo="bar" ${TIME} echo 'baz' 2> /dev/null | grep baz`
if test "X${TIME_TEST}" = "Xbaz"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
TIME=
fi
## The following variables are used to distinguish between building a
## serial and parallel library.
##
## HAVE_PARALLEL -- defined in H5config.h if we are building
## a parallel library even if configure wasn't
## able to find some header file or library that
## might be required. This is defined if the
## user explicitly states
## that a parallel library is being built by supplying
## the `--enable-parallel' configure switch.
##
## PARALLEL -- This variable is set to a non-null value if
## we're building a parallel version of the library.
##
## RUNSERIAL -- This is a command which will be prepended to
## the executable name to run the executable using
## a single process. For serial versions of the
## library this will normally be empty. For parallel
## versions it might be something like `mpiexec -n 1'.
## The value of this variable is substituted in *.in
## files.
##
## RUNPARALLEL -- This is a command which will be prepended to
## the executable name to run the executable on
## multiple processors. For the serial library the
## value will normally be the empty string. For
## parallel library it should be something like
## "mpiexec -n \$\${NPROCS:=6}" where NPROCS will
## eventually contain the number of processors on which
## to run the executable (the double dollarsigns are to
## protect the expansion until make executes the
## command). The value of this variable is
## substituted in *.in files.
##
AC_SUBST([PARALLEL])
AC_SUBST([RUNSERIAL])
AC_SUBST([RUNPARALLEL])
AC_SUBST([TESTPARALLEL])