-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.in
4462 lines (3922 loc) · 148 KB
/
configure.in
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 Process this file with autoconf to produce configure.
dnl
dnl Copyright by The HDF Group.
dnl Copyright by the Board of Trustees of the University of Illinois.
dnl All rights reserved.
dnl
dnl This file is part of HDF5. The full HDF5 copyright notice, including
dnl terms governing use, modification, and redistribution, is contained in
dnl the files COPYING and Copyright.html. COPYING can be found at the root
dnl of the source code distribution tree; Copyright.html can be found at the
dnl root level of an installed copy of the electronic HDF5 document set and
dnl is linked from the top-level documents page. It can also be found at
dnl http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
dnl access to either file, you may request a copy from help@hdfgroup.org.
dnl ----------------------------------------------------------------------
dnl Initialize configure.
dnl
AC_REVISION($Id: configure.in 20092 2011-02-11 22:30:31Z nfortne2 $)
AC_PREREQ([2.53])
dnl AC_INIT takes the name of the package, the version number, and an
dnl email address to report bugs. AC_CONFIG_SRCDIR takes a unique file
dnl as its argument.
dnl
dnl NOTE: Don't forget to change the version number here when we do a
dnl release!!!
dnl
AC_INIT([HDF5], [1.8.6], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AM_CONFIG_HEADER([src/H5config.h])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
dnl AM_INIT_AUTOMAKE takes a list of options that should be applied to
dnl every Makefile.am when automake is run.
AM_INIT_AUTOMAKE([foreign])
dnl AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies
dnl for Makefiles, configure, src/H5config.h, etc. If AM_MAINTAINER_MODE
dnl is *not* included here, these files will be rebuilt if out of date.
dnl This is a problem because if users try to build on a machine with
dnl the wrong versions of autoconf and automake, these files will be
dnl rebuilt with the wrong versions and bad things can happen.
dnl Also, CVS doesn't preserve dependencies between timestamps, so
dnl Makefiles will often think rebuilding needs to occur when it doesn't.
dnl Developers should './configure --enable-maintainer-mode' to turn on
dnl rebuild rules.
AM_MAINTAINER_MODE
dnl Run post processing on files created by configure.
dnl src/H5pubconf.h:
dnl Generate src/H5pubconf.h from src/H5config.h by prepending H5_ to all
dnl macro names. This avoid name conflict between HDF5 macro names and those
dnl generated by another software package that uses the HDF5 library.
dnl src/libhdf5.settings:
dnl Remove all lines begun with "#" which are generated by CONDITIONAL's of
dnl configure.
AC_OUTPUT_COMMANDS([
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
/bin/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
/bin/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
])
dnl It's possible to configure for a host other than the one on which
dnl configure is currently running by using the --host=foo flag.
dnl For machines on which HDF5 is often configured, it can be convenient
dnl to specify the name of the machine rather than its canonical type.
case $host_alias in
redstorm)
host_alias=x86_64-redstorm-linux-gnu
;;
esac
AC_CANONICAL_HOST
AC_SUBST([CPPFLAGS])
dnl H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
dnl not exported to h5cc (or h5fc, etc.)
AC_SUBST([H5_CFLAGS])
AC_SUBST([H5_CPPFLAGS])
AC_SUBST([H5_FCFLAGS])
AC_SUBST([H5_CXXFLAGS])
dnl AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5,
dnl 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_LDFLAGS])
dnl Make sure flags are set to something (otherwise macros may set them later).
AM_CFLAGS="${AM_CFLAGS}"
AM_CXXFLAGS="${AM_CXXFLAGS}"
AM_FCFLAGS="${AM_FCFLAGS}"
AM_CPPFLAGS="${AM_CPPFLAGS}"
AM_LDFLAGS="${AM_LDFLAGS}"
CFLAGS="${CFLAGS}"
CXXFLAGS="${CXXFLAGS}"
FCFLAGS="${FCFLAGS}"
CPPFLAGS="${CPPFLAGS}"
LDFLAGS="${LDFLAGS}"
dnl Configure may need to alter any of the *FLAGS variables in order for
dnl various checks to work correctly. Save the user's value here so it
dnl can be restored once all configure checks are complete.
saved_user_CFLAGS="$CFLAGS"
saved_user_CXXFLAGS="$CXXFLAGS"
saved_user_FCFLAGS="$FCFLAGS"
saved_user_LDFLAGS="$LDFLAGS"
saved_user_CPPFLAGS="$CPPFLAGS"
dnl Different compilers may need default libraries. They are specified in
dnl the config/* files, so we put this statement here so that it'll be
dnl set by the code which follows...
dnl
DEFAULT_LIBS=""
dnl Support F9X variable to define Fortran compiler if FC variable is
dnl not used. This should be deprecated in the future.
if test "x" = "x$FC"; then
FC=${F9X}
fi
dnl ----------------------------------------------------------------------
dnl Set prefix default (install directory) to a directory in the build area.
dnl This allows multiple src-dir builds within one host.
AC_PREFIX_DEFAULT([`pwd`/hdf5])
dnl ----------------------------------------------------------------------
dnl Dump all shell variables values.
dnl
AC_MSG_CHECKING([shell variables initial values])
set >&AS_MESSAGE_LOG_FD
AC_MSG_RESULT([done])
dnl Define all symbol variables used for configure summary.
dnl EXTERNAL_FILTERS equals all external filters. Default none.
dnl MPE: whether MPE option is enabled. Default no.
dnl STATIC_EXEC: whether static-exec is enabled. Default no.
dnl HDF_FORTRAN: whether Fortran is enabled. Default no.
dnl FC: Fortran compiler.
dnl HDF_CXX: whether C++ is enabled. Default no.
dnl CXX: C++ compiler.
dnl HDF5_HL: whether high-level library is enabled. Default is yes.
dnl GPFS: whether gpfs is enabled. Default no.
dnl LARGEFILE: whether largefile support is enabled. Default yes.
dnl INSTRUMENT: whether INSTRUMENT is enabled. No default set here.
dnl CODESTACK: whether CODESTACK is enabled. Default no.
dnl HAVE_DMALLOC: whether system has dmalloc support. Default no.
dnl DIRECT_VFD: whether DIRECT_VFD is enabled. Default no.
dnl THREADSAFE: whether THREADSAFE is enabled. Default no.
dnl STATIC_SHARED: whether static and/or shared libraries are requested.
dnl enable_shared: whether shared lib is enabled.
dnl enable_static: whether static lib is enabled.
dnl UNAME_INFO: System information.
dnl PACKED_BITS: H5dump packed bits feature is enabled.
AC_SUBST(EXTERNAL_FILTERS)
AC_SUBST(MPE) MPE=no
AC_SUBST(STATIC_EXEC) STATIC_EXEC=no
AC_SUBST(HDF_FORTRAN) HDF_FORTRAN=no
AC_SUBST(FC) HDF_FORTRAN=no
AC_SUBST(HDF_CXX) HDF_CXX=no
AC_SUBST(CXX) HDF_CXX=no
AC_SUBST(HDF5_HL) HDF5_HL=yes
AC_SUBST(GPFS) GPFS=no
AC_SUBST(LARGEFILE) LARGEFILE=yes
AC_SUBST(INSTRUMENT)
AC_SUBST(CODESTACK) CODESTACK=no
AC_SUBST(HAVE_DMALLOC) HAVE_DMALLOC=no
AC_SUBST(DIRECT_VFD) DIRECT_VFD=no
AC_SUBST(THREADSAFE) THREADSAFE=no
AC_SUBST(STATIC_SHARED)
AC_SUBST(enable_shared)
AC_SUBST(enable_static)
AC_SUBST(UNAME_INFO) UNAME_INFO=`uname -a`
AC_SUBST(PACKED_BITS) PACKED_BITS=yes
dnl ----------------------------------------------------------------------
dnl Some platforms have broken basename, and/or xargs programs. Check
dnl that it actually does what it's supposed to do. Catch this early
dnl since configure relies upon them heavily and there's no use continuing
dnl if it's broken.
dnl
dnl Avoid depending upon Character Ranges.
dnl These are defined by autoconf.
dnl as_cr_letters='abcdefghijklmnopqrstuvwxyz'
dnl as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
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
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
dnl ----------------------------------------------------------------------
dnl Check that the cache file was build on the same host as what we're
dnl running on now.
dnl
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
echo "The config.cache file was generated on $hdf5_cv_host but"
echo "this is $host. Please remove that file and try again."
AC_MSG_ERROR(config.cache file is invalid)
fi
dnl ----------------------------------------------------------------------
dnl Source any special files that we need. These files normally aren't
dnl present but can be used by the maintainers to fine tune things like
dnl turning on debug or profiling flags for the compiler. The search order
dnl is:
dnl
dnl CPU-VENDOR-OS
dnl VENDOR-OS
dnl CPU-OS
dnl CPU-VENDOR
dnl OS
dnl VENDOR
dnl CPU
dnl
dnl If the `OS' ends with a version number then remove it. For instance,
dnl `freebsd3.1' would become `freebsd'
case $host_os in
aix4.*)
host_os_novers=aix4.x
;;
aix5.*)
host_os_novers=aix5.x
;;
aix6.*)
host_os_novers=aix6.x
;;
freebsd*)
host_os_novers=freebsd
;;
irix5.*)
host_os_novers=irix5.x
;;
irix6.*)
host_os_novers=irix6.x
;;
osf4.*)
host_os_novers=osf4.x
;;
osf5.*)
host_os_novers=osf5.x
;;
solaris2.*)
host_os_novers=solaris2.x
;;
*)
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
dnl 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
dnl ----------------------------------------------------------------------
dnl Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so
dnl we need to add this in so configure works as intended. We will need to
dnl reset this value at the end of configure, to preserve the user's settings.
CFLAGS="${AM_CFLAGS} ${CFLAGS}"
FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}"
CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}"
LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}"
dnl ----------------------------------------------------------------------
dnl Enable dependency tracking unless the configure options or a
dnl site-specific file told us not to. This prevents configure from
dnl silently disabling dependencies for some compilers.
dnl
if test -z "${enable_dependency_tracking}"; then
enable_dependency_tracking="yes"
fi
dnl ----------------------------------------------------------------------
dnl Check for programs.
dnl
AC_PROG_CC
CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`"
dnl ----------------------------------------------------------------------
dnl Check if they would like the Fortran interface compiled
dnl
AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES=""
AC_MSG_CHECKING([if Fortran interface enabled])
AC_ARG_ENABLE([fortran],
[AC_HELP_STRING([--enable-fortran],
[Compile the Fortran interface [default=no]])],
[HDF_FORTRAN=$enableval])
HAVE_SIZEOF="no"
FORTRAN_DEFAULT_REALisDBLE="no"
if test "X$HDF_FORTRAN" = "Xyes"; then
echo "yes"
HDF5_INTERFACES="$HDF5_INTERFACES fortran"
dnl --------------------------------------------------------------------
dnl HDF5 integer variables for the H5fortran_types.f90 file.
dnl
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])
dnl --------------------------------------------------------------------
dnl General Fortran flags
dnl
AM_FCFLAGS="${AM_FCFLAGS} ${FFLAGS}"
FCFLAGS="${FCFLAGS} ${FFLAGS}"
dnl --------------------------------------------------------------------
dnl Fortran source extention
dnl
AC_FC_SRCEXT([f90])
AC_SUBST([F9XSUFFIXFLAG])
AC_SUBST([FSEARCH_DIRS])
dnl --------------------------------------------------------------------
dnl Check for a Fortran 9X compiler and how to include modules.
dnl
AC_PROG_FC([f90 pgf90 slf90 f95 g95 xlf95 efc ifort ftn],)
AC_F9X_MODS
dnl It seems that libtool (as of Libtool 1.5.14) is trying to
dnl configure itself for Fortran 77.
dnl Tell it that our F77 compiler is $FC (actually a F9X compiler)
F77=$FC
dnl Change to the Fortran 90 language
AC_LANG_PUSH(Fortran)
dnl --------------------------------------------------------------------
dnl Define wrappers for the C compiler to use Fortran function names
dnl
AC_FC_WRAPPERS
dnl --------------------------------------------------------------------
dnl See if the compiler will support the "-I." option
dnl
dnl AM_FCFLAGS_saved=$AM_FCFLAGS
dnl AM_FCFLAGS="${AM_FCFLAGS} -I."
dnl AC_MSG_CHECKING(if compiler supports -I. option)
dnl AC_TRY_FCOMPILE([
dnl program conftest
dnl end
dnl ], AC_MSG_RESULT(yes),
dnl AC_MSG_RESULT(no)
dnl AM_FCFLAGS="$AM_FCFLAGS_saved")
dnl --------------------------------------------------------------------
dnl See if the fortran compiler supports the intrinsic function "SIZEOF"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic SIZEOF])
AC_TRY_RUN([
PROGRAM main
i = sizeof(x)
END PROGRAM
], [AC_MSG_RESULT(yes)
HAVE_SIZEOF="yes"],
AC_MSG_RESULT(no))
dnl Check to see if -r8 was specified to determine if we need to
dnl compile the DOUBLE PRECISION interfaces.
AC_MSG_CHECKING([if Fortran default REAL is DOUBLE PRECISION])
AC_TRY_RUN([
MODULE type_mod
INTERFACE h5t
MODULE PROCEDURE h5t_real
MODULE PROCEDURE h5t_dble
END INTERFACE
CONTAINS
SUBROUTINE h5t_real(r)
REAL :: r
END SUBROUTINE h5t_real
SUBROUTINE h5t_dble(d)
DOUBLE PRECISION :: d
END SUBROUTINE h5t_dble
END MODULE type_mod
PROGRAM main
USE type_mod
REAL :: r
DOUBLE PRECISION :: d
CALL h5t(r)
CALL h5t(d)
END PROGRAM main
],
AC_MSG_RESULT(no),
[AC_MSG_RESULT(yes)
FORTRAN_DEFAULT_REALisDBLE="yes"])
dnl Change back to the C language
AC_LANG_POP(Fortran)
else
echo "no"
FC="no"
fi
AM_CONDITIONAL([FORTRAN_HAVE_SIZEOF], [test "X$HAVE_SIZEOF" = "Xyes"])
AM_CONDITIONAL([FORTRAN_DEFAULT_REALisDBLE_F], [test "X$FORTRAN_DEFAULT_REALisDBLE" = "Xyes"])
dnl ----------------------------------------------------------------------
dnl Check if they would like the C++ interface compiled
dnl
dnl We need to check for a C++ compiler unconditionally, since
dnl AC_PROG_CXX defines some macros that Automake 1.9.x uses and will
dnl miss even if c++ is not enabled.
AC_PROG_CXX
AC_PROG_CXXCPP dnl this is checked for when AC_HEADER_STDC is done
AC_MSG_CHECKING([if c++ interface enabled])
AC_ARG_ENABLE([cxx],
[AC_HELP_STRING([--enable-cxx],
[Compile the C++ interface [default=no]])],
[HDF_CXX=$enableval])
if test "X$HDF_CXX" = "Xyes"; then
echo "yes"
HDF5_INTERFACES="$HDF5_INTERFACES c++"
dnl Change to the C++ language
AC_LANG_PUSH(C++)
AC_MSG_CHECKING([if $CXX needs old style header files in includes])
AC_TRY_RUN([
#include <iostream>
int main(void) { return 0; }
], [
echo no
], [
echo yes
CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME"
AM_CXXFLAGS="${AM_CXXFLAGS} -DOLD_HEADER_FILENAME"
])
AC_MSG_CHECKING([if $CXX can handle namespaces])
AC_TRY_RUN([
namespace H5 {
int fnord;
}
int main(void) {
using namespace H5;
fnord = 37;
return 0;
}
], [
echo yes
], [
echo no
CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE"
AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_NAMESPACE"
])
AC_MSG_CHECKING([if $CXX supports std])
AC_TRY_RUN([
#include <string>
using namespace std;
int main(void) {
string myString("testing namespace std");
return 0;
}
], [
echo yes
], [
echo no
CXXFLAGS="${CXXFLAGS} -DH5_NO_STD"
AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD"
])
AC_MSG_CHECKING([if $CXX supports bool types])
AC_TRY_RUN([
int main(void) {
bool flag;
return 0;
}
], [
echo yes
], [
echo no
CXXFLAGS="${CXXFLAGS} -DBOOL_NOTDEFINED"
AM_CXXFLAGS="${AM_CXXFLAGS} -DBOOL_NOTDEFINED"
])
AC_MSG_CHECKING([if $CXX has offsetof extension])
AC_TRY_COMPILE([
#include <stdio.h>
#include <stddef.h>
],[
struct index_st
{
unsigned char type;
unsigned char num;
unsigned int len;
};
typedef struct index_st index_t;
int x,y;
x = offsetof(struct index_st, len);
y = offsetof(index_t, num)
],
AC_DEFINE([CXX_HAVE_OFFSETOF], [1],
[Define if C++ compiler recognizes offsetof])
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))
AC_MSG_CHECKING([if $CXX can handle static cast])
AC_TRY_RUN([
int main(void) {
float test_float;
int test_int;
test_float = 37.0;
test_int = static_cast <int> (test_float);
return 0;
}
], [
echo yes
], [
echo no
CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST"
AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST"
])
else
echo "no"
CXX="no"
fi
dnl Change back to the C language
AC_LANG_POP(C++)
dnl ----------------------------------------------------------------------
dnl Check if they have Perl installed on their system. We only need Perl
dnl if they're using a GNU compiler.
dnl
AC_SUBST([PERL]) PERL=""
if test "X$GCC" = "Xyes"; then
AC_CHECK_PROGS([PERL], [perl],, [$PATH])
fi
dnl ----------------------------------------------------------------------
dnl Check which archiving tool to use. This needs to be done before
dnl the AM_PROG_LIBTOOL macro.
dnl
if test -z "$AR"; then
AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
fi
AC_SUBST([AR])
dnl Export the AR macro so that it will be placed in the libtool file
dnl correctly.
export AR
AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl ----------------------------------------------------------------------
dnl Check that the tr utility is working properly.
AC_PATH_PROG(TR, tr)
TR_TEST=`echo Test | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`
if test "X${TR_TEST}" != "XTEST"; then
AC_MSG_ERROR([tr program doesn't work])
fi
dnl ----------------------------------------------------------------------
dnl Check that time can be used with srcdir. This is okay on most systems,
dnl but seems to cause problems on Cygwin.
dnl The solution on Cygwin is not to record execution time for tests.
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
dnl The following variables are used to distinguish between building a
dnl serial and parallel library.
dnl
dnl HAVE_PARALLEL -- defined in H5config.h if we are building
dnl a parallel library even if configure wasn't
dnl able to find some header file or library that
dnl might be required. This is defined if the
dnl compiler looks like a parallel compiler (e.g.,
dnl mpicc or mpcc) or if the user explicitly states
dnl that a parallel library is being built by supplying
dnl the `--enable-parallel' configure switch.
dnl
dnl PARALLEL -- This variable is set to a non-null value if
dnl configure thinks we're compiling a parallel
dnl version of the library.
dnl
dnl RUNSERIAL -- This is a command which will be prepended to
dnl the executable name to run the executable using
dnl a single process. For serial versions of the
dnl library this will normally be empty. For parallel
dnl versions it might be something like `mpiexec -n 1'.
dnl The value of this variable is substituted in *.in
dnl files.
dnl
dnl RUNPARALLEL -- This is a command which will be prepended to
dnl the executable name to run the executable on
dnl multiple processors. For the serial library the
dnl value will normally be the empty string. For
dnl parallel library it should be something like
dnl "mpiexec -n \$\${NPROCS:=6}" where NPROCS will
dnl eventually contain the number of processors on which
dnl to run the executable (the double dollarsigns are to
dnl protect the expansion until make executes the
dnl command). The value of this variable is
dnl substituted in *.in files.
dnl
AC_SUBST([PARALLEL])
AC_SUBST([RUNSERIAL])
AC_SUBST([RUNPARALLEL])
AC_SUBST([TESTPARALLEL])
dnl ----------------------------------------------------------------------
dnl If the compiler is obviously a parallel compiler then we're building
dnl a parallel version of hdf5 and should define HAVE_PARALLEL. Furthermore,
dnl the name of the compiler might tell us how to run the resulting
dnl executable. For `mpicc' the executable should be run with `mpiexec' from
dnl the same directory as mpicc if it exists.
dnl
case "$CC_BASENAME" in
mpicc)
dnl The mpich compiler. Use mpiexec from the same directory if it
dnl exists.
PARALLEL=mpicc
AC_MSG_CHECKING([for mpiexec])
dnl Find the path where mpicc is located.
cmd="`echo $CC | cut -f1 -d' '`"
if (echo $cmd | grep / >/dev/null); then
path="`echo $cmd | sed 's/\(.*\)\/.*$/\1/'`"
else
for path in `echo $PATH | ${TR} ":" " "`; do
if test -x $path/$cmd; then
break
fi
done
fi
dnl Is there an mpiexec at that path?
if test -x $path/mpiexec; then
AC_MSG_RESULT([$path/mpiexec])
RUNSERIAL="${RUNSERIAL:-none}"
if test -z "$RUNPARALLEL"; then
RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=6}"
fi
else
AC_MSG_RESULT([none])
fi
;;
mpcc|mpcc_r)
dnl The IBM compiler
PARALLEL="$CC_BASENAME"
;;
*)
dnl Probably not a parallel compiler, but if `--enable-parallel'
dnl is defined below then we're still building a parallel hdf5.
;;
esac
dnl ----------------------------------------------------------------------
dnl If the Fortran compiler is obviously a parallel compiler then we're
dnl building a parallel version of hdf5 and should define HAVE_PARALLEL.
dnl Furthermore, the name of the compiler might tell us how to run the
dnl resulting executable. For `mpif90' the executable should be run with
dnl `mpiexec' from the same directory as mpif90 if it exists.
dnl
if test "X$HDF_FORTRAN" = "Xyes"; then
dnl Change to the Fortran 90 language
AC_LANG_PUSH(Fortran)
case "$FC" in
*mpif90*)
dnl The Fortran mpich compiler. Use mpiexec from the same directory
dnl if it exists.
PARALLEL=mpif90
AC_MSG_CHECKING([for mpiexec])
dnl Find the path where mpif90 is located.
cmd=`echo $FC |cut -f1 -d' '`
if (echo $cmd |grep / >/dev/null); then
path="`echo $cmd |sed 's/\(.*\)\/.*$/\1/'`"
else
for path in `echo $PATH | ${TR} ":" " "`; do
if test -x $path/$cmd; then
break;
fi
done
fi
dnl Is there an mpiexec at that path?
if test -x $path/mpiexec; then
AC_MSG_RESULT([$path/mpiexec])
RUNSERIAL="${RUNSERIAL:-none}"
if test -z "$RUNPARALLEL"; then
RUNPARALLEL="$path/mpiexec -n \$\${NPROCS:=6}"
fi
else
AC_MSG_RESULT([none])
fi
;;
*mpxlf* | *mpxlf_r* | *mpxlf90* | *mpxlf90_r* | *mpxlf95* | *mpxlf95_r*)
dnl The IBM compiler
PARALLEL="$FC"
;;
*)
dnl Probably not a parallel compiler, but if `--enable-parallel'
dnl is defined below then we're still building a parallel hdf5.
;;
esac
dnl Change to the C language
AC_LANG_POP(Fortran)
fi
dnl -----------------------------------------------------------------------------
dnl If shared libraries are being used with parallel, disable them, unless the
dnl user explicity enables them via the '--enable-shared' option.
if test "X${enable_shared}" = "X" -a "X${enable_parallel}" = "Xyes"; then
echo ' shared libraries disabled in parallel'
enable_shared="no"
elif test "X${enable_shared}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then
echo ' shared libraries explicitly enabled by user'
elif test "X${enable_shared}" = "X" -a "X${PARALLEL}" != "X"; then
echo ' shared libraries disabled when a parallel compiler is being used'
enable_shared="no"
elif test "X${enable_shared}" = "Xyes" -a "X${PARALLEL}" != "X"; then
echo ' shared libraries explicitly enabled by user'
fi
dnl ----------------------------------------------------------------------
dnl Many Fortran compilers don't support shared libraries. Some of these
dnl compilers include:
dnl pgf90 version 6.0-4
dnl Absoft 32bit Fortran 95 9.0
dnl HP F90 v2.4
dnl Intel Fortran Compiler 8.1
dnl If any of these compilers is being used, disable shared libraries for
dnl Fortran. This prevents building shared libraries and also prevents
dnl trying to link against shared libraries.
if test "X${HDF_FORTRAN}" = "Xyes"; then
H5_FORTRAN_SHARED="yes"
if (${FC} -V 2>&1 | grep '^pgf90') > /dev/null; then
H5_FORTRAN_SHARED="no"
fi
if (${FC} -V 2>&1 | grep '^Intel(R) Fortran') > /dev/null; then
if (${FC} -v 2>&1 | grep '^Version 8.') > /dev/null; then
H5_FORTRAN_SHARED="no"
else
dnl echo 'adding fortran compiler flag needed for building shared libraries'
FCFLAGS="${FCFLAGS} -fPIC"
AM_FCFLAGS="${AM_FCFLAGS} -fPIC"
fi
fi
if (${FC} +version 2>&1 | grep '^HP F90') > /dev/null; then
H5_FORTRAN_SHARED="no"
fi
if (${FC} -V 2>&1 | grep '^Absoft') > /dev/null; then
H5_FORTRAN_SHARED="no"
fi
if test "X${enable_shared}" != "Xno" && test "X${H5_FORTRAN_SHARED}" = "Xno"; then
AC_MSG_WARN([shared libraries are not supported; disabling shared Fortran libraries])
fi
if test "X${enable_static}" = "Xno" && test "X${H5_FORTRAN_SHARED}" = "Xno"; then
AC_MSG_ERROR([both static and shared Fortran libraries are disabled])
fi
fi
AM_CONDITIONAL([FORTRAN_SHARED_CONDITIONAL], [test "X$H5_FORTRAN_SHARED" = "Xyes"])
dnl Disable C++ shared libraries if shared libraries are disabled.
dnl This prevents Automake from trying to link against shared libraries,
dnl which caused problems on tg-login
H5_CXX_SHARED="no"
if test "X${HDF_CXX}" = "Xyes" && test "X${enable_shared}" != "Xno"; then
H5_CXX_SHARED="yes"
dnl Try to detect the +DD64 flag for HPUX aCC compiler and disable C++ shared libraries if it's
dnl being used.
if (echo dummy ${CXX} ${CXXLD} ${CFLAGS} ${CXXFLAGS} ${LDFLAGS} | grep 'DD64') > /dev/null; then
echo " warning: +DD64 flag detected"
echo " disabling shared C++ libraries"
H5_CXX_SHARED="no"
fi
if test "X${enable_static}" = "Xno" && test "X${H5_CXX_SHARED}" = "Xno"; then
AC_MSG_ERROR([both static and shared C++ libraries are disabled])
fi
fi
AM_CONDITIONAL([CXX_SHARED_CONDITIONAL], [test "X$H5_CXX_SHARED" = "Xyes"])
dnl ----------------------------------------------------------------------
dnl pgcc version 6.0x have optimization (-O, -O2 or -O3) problem. Detect
dnl these versions and add option "-Mx,28,0x8" to the compiler to avoid
dnl the problem if optimization is enabled.
dnl
if (${CC-cc} -V 2>&1 | grep '^pgcc 6.0') > /dev/null && test "X$enable_production" = "Xyes"; then
echo 'adding compiler flag to avoid optimization problem in pgcc'
CC="${CC-cc} -Mx,28,0x8"
fi
dnl ----------------------------------------------------------------------
dnl Shared libraries are not currently supported under Cygwin.
dnl
dnl The GCC compiler on Cygwin running on Windows XP has rounding problem
dnl in the data conversion dt_arith.c from unsigned long long to long
dnl double (see bug #1813). I define a macro here to skip the test for
dnl Cygwin. I'll come back and figure out the problem once I'm available.
dnl 2010/5/5 - SLU
case "`uname`" in
CYGWIN*)
AC_DEFINE([CYGWIN_ULLONG_TO_LDOUBLE_ROUND_PROBLEM], [1], [Define a macro for Cygwin (on XP only) where the compiler has rounding problem converting from unsigned long long to long double])
if test "X${enable_shared}" = "Xyes"; then
echo ' warning: shared libraries are not supported on Cygwin!'
echo ' disabling shared libraries'
fi
enable_shared="no"
;;
esac
dnl ----------------------------------------------------------------------
dnl Create libtool. If shared/static libraries are going to be enabled
dnl or disabled, it should happen before these macros.
LT_PREREQ([2.2])
LT_INIT([dlopen])
dnl Post processing to patch up some deficiencies in libtool (as of
dnl Libtool 1.5.14)
case $host_os in
linux* | freebsd* )
# If gcc is not used, need to set $wl to use "-Wl,"
if $CC -v 2>&1 | grep '^gcc' > /dev/null ; then
: using gcc
else
echo 'fixing $wl in' $ofile
ed - $ofile <<EOF 2> /dev/null
/^wl=""/s//wl="-Wl,"/
w
q
EOF
fi
;;
esac
dnl ----------------------------------------------------------------------
dnl Check if we should install only statically linked executables.
dnl This check needs to occur after libtool is initialized because
dnl we check a libtool cache value and may issue a warning based
dnl on its result.
AC_MSG_CHECKING([if we should install only statically linked executables])
AC_ARG_ENABLE([static_exec],
[AC_HELP_STRING([--enable-static-exec],
[Install only statically linked executables
[default=no]])],
[STATIC_EXEC=$enableval])
if test "X$STATIC_EXEC" = "Xyes"; then
echo "yes"
dnl Issue a warning if -static flag is not supported.
if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then
echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries."
fi
LT_STATIC_EXEC="-all-static"
else
echo "no"
LT_STATIC_EXEC=""
fi
AC_SUBST([LT_STATIC_EXEC])
dnl Fix up the INSTALL macro if it's a relative path. We want the
dnl full-path to the binary instead.
case "$INSTALL" in
*install-sh*)
INSTALL='\${top_srcdir}/bin/install-sh -c'
;;
esac
dnl ----------------------------------------------------------------------
dnl Some users have reported problems with libtool's use of '-Wl,-rpath' to
dnl link shared libraries in nondefulat directories. Allow users to
dnl disable embedding the rpath information in the executables and to
dnl instead solely rely on the information in LD_LIBRARY_PATH.
AC_MSG_CHECKING([if -Wl,-rpath should be used to link shared libs in nondefault directories])
AC_ARG_ENABLE([sharedlib-rpath],
[AC_HELP_STRING([--disable-sharedlib-rpath],
[Disable use of the '=Wl,-rpath' linker option])],
[RPATH=$enableval])
case "X-$RPATH" in
X-no)