forked from HDFGroup/hdf4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1202 lines (1054 loc) · 38.7 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
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 HDF. The full HDF 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://support.hdfgroup.org/ftp/HDF/releases/.
## If you do not have access to either file, you may request a copy from
##
## ======================================================================
## Initialize configure.
## ======================================================================
## 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([HDF], [4.2.17-1], [[email protected]])
AC_CONFIG_SRCDIR([hdf/src/atom.c])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_HEADERS([hdf/src/h4config.h])
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.
##
## NOTE: Don't add subdir-objects here just yet. Modern Automake will
## complain that it's missing, but adding it causes failures on
## older systems.
AM_INIT_AUTOMAKE([foreign])
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, config.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`/hdf4])
## Run post processing on files created by configure.
## * src/h4config.h
## * libhdf4.settings
##
## ([[:blank:]])* matches and captures any whitespace and drops it
## where the \1 is located on the right-hand side so the indenting
## doesn't change. ([[:blank:]] is POSIX-compliant \s)
AC_CONFIG_COMMANDS([h4config], [
echo "modifying hdf/src/h4config.h"
sed 's/#\([[:blank:]]\)*define /#\1define H4_/' < hdf/src/h4config.h |\
sed 's/#\([[:blank:]]\)*undef /#\1undef H4_/' > h4config
cp h4config hdf/src/h4config.h
rm -f h4config
echo "Post process libhdf4.settings"
sed '/^#/d' < libhdf4.settings > libhdf4.settings.TMP
cp libhdf4.settings.TMP libhdf4.settings
rm -f libhdf4.settings.TMP
])
## ======================================================================
## Information on the package
## ======================================================================
## Dump all shell variables values.
AC_MSG_CHECKING([shell variables initial values])
set >&AS_MESSAGE_LOG_FD
AC_MSG_RESULT([done])
AC_CANONICAL_HOST
## ----------------------------------------------------------------------
## 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
## 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
aix4.*) host_os_novers="aix4.x" ;;
aix5.*) host_os_novers="aix5.x" ;;
darwin10.*) host_os_novers="darwin10.x" ;;
darwin11.*) host_os_novers="darwin11.x" ;;
darwin12.*) host_os_novers="darwin12.x" ;;
freebsd*) host_os_novers="freebsd" ;;
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`"
F77_BASENAME="`echo $F77 | cut -f1 -d' ' | xargs basename 2>/dev/null`"
. $host_config
fi
## ======================================================================
## Checks for netCDF-2.3.2 support
## ======================================================================
# We disable Fortran netCDF APIs and their testing when --disable-netcdf is used.
# Let's define a proper variable to be used in mfhdf/testfortran.sh.in to run
# the netCDF Fortran APIs test program "ftest".
AC_SUBST(TEST_FORTRAN_NETCDF) TEST_FORTRAN_NETCDF="yes"
AC_ARG_ENABLE([netcdf],
[AS_HELP_STRING([--enable-netcdf],
[HDF4 builds replacement netCDF 2.3.2 API calls that are exported (e.g., ncopen()).
Enabling this option uses the original netCDF names when building these functions.
Disable prefixes them with 'sd_' to avoid name clashes.
This does NOT affect building the HDF4-built netCDF tools ncdump and ncgen,
nor does it disable any HDF4 functionality - this option only affects
API call names.
Disabling this option disables building the netCDF Fortran wrappers (they
will not be built with either the original or sd_ prefixed names).
[default=yes (HDF4-built netCDF API calls will be exported undecorated)]])],,
[enableval="yes"])
case "$enableval" in
yes)
BUILD_NETCDF="yes"
AC_DEFINE([HAVE_NETCDF], [1], [Define if we export HDF4-built unmangled netCDF 2.3.2 API calls])
;;
no)
BUILD_NETCDF="no"
TEST_FORTRAN_NETCDF="no"
;;
esac
AM_CONDITIONAL([HDF_BUILD_NETCDF], [test "X$BUILD_NETCDF" = "Xyes"])
AC_SUBST([BUILD_NETCDF])
# It is also possible to disable building the netCDF tools ncdump and ncgen.
# Some users may want to do this since our tools will conflict with netCDF's
# if they are installed. This will also disable building nctest.
AC_ARG_ENABLE([netcdf-tools],
[AS_HELP_STRING([--enable-netcdf-tools],
[Build HDF4 versions of NetCDF tools (ncgen, ncdump) [default=yes]])],,
[enableval="yes"])
case "$enableval" in
yes)
BUILD_NETCDF_TOOLS="yes"
;;
no)
BUILD_NETCDF_TOOLS="no"
;;
esac
AM_CONDITIONAL([HDF_BUILD_NETCDF_TOOLS], [test "X$BUILD_NETCDF_TOOLS" = "Xyes"])
AC_SUBST([BUILD_NETCDF_TOOLS])
## ======================================================================
## Checks for programs
## ======================================================================
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
## ----------------------------------------------------------------------
## Check if they would like the Fortran interface compiled
##
## This interface is UNSAFE on 64-bit systems as the interface will
## attempt to store pointers in 32-bit integers.
##
AC_ARG_ENABLE([fortran],
[AS_HELP_STRING([--enable-fortran],
[Build Fortran into library. This interface
is unsafe on 64-bit systems. [default=no]])],,
[enableval="no"])
case "$enableval" in
yes)
BUILD_FORTRAN="yes"
AC_PROG_F77
AC_F77_WRAPPERS
if test "X$F77" = "X"; then
BUILD_FORTRAN="no"
fi
;;
no)
BUILD_FORTRAN="no"
F77="no"
;;
esac
AM_CONDITIONAL([HDF_BUILD_FORTRAN], [test "X$BUILD_FORTRAN" = "Xyes"])
AC_SUBST([BUILD_FORTRAN])
## ----------------------------------------------------------------------
## Check if they would like the Java native interface (JNI) compiled
##
AC_SUBST([JNIFLAGS])
AC_SUBST([H4_JAVACFLAGS])
AC_SUBST([H4_JAVAFLAGS])
## This needs to be exposed for the library info file even if Java is disabled.
AC_SUBST([HDF_JAVA])
## Default is no Java
HDF_JAVA=no
AC_SUBST([H4_CLASSPATH]) H4_CLASSPATH=""
AC_MSG_CHECKING([if Java JNI interface enabled])
AC_ARG_ENABLE([java],
[AS_HELP_STRING([--enable-java],
[Compile the Java JNI interface [default=no]])],
[HDF_JAVA=$enableval])
if test "X$HDF_JAVA" = "Xyes"; then
if test "X${enable_shared}" != "Xno"; then
echo "yes"
if test "X$CLASSPATH" = "X"; then
H4_CLASSPATH=".:$srcdir/java/lib"
else
H4_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib"
fi
## Checks for programs.
AX_JAVA_OPTIONS
H4_JAVACFLAGS=$JAVACFLAGS
H4_JAVAFLAGS=$JAVAFLAGS
AX_PROG_JAVAC
AX_PROG_JAVA
AX_PROG_JAR
AX_PROG_JAVADOC
## Find the include directories needed for building JNI code
AX_JNI_INCLUDE_DIR()
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
do
JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR"
done
## Find junit for testing the JNI code
AX_CHECK_CLASSPATH()
CLASSPATH_ENV=$H4_CLASSPATH
AX_CHECK_JUNIT()
AX_CHECK_JAVA_HOME
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([Java requires shared libraries to be built])
HDF_JAVA="no"
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
## -------------------------------------------------------------------------
## Build static libraries by default. Furthermore, fortran shared libraries
## are unsupported. Disallow a user from enabling both shared libraries and
## fortran.
if test "X${enable_shared}" != "Xyes"; then
enable_shared="no"
fi
if test "X${enable_shared}" = "Xyes"; then
if test "X${BUILD_FORTRAN}" = "Xyes"; then
AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.])
fi
fi
AC_PROG_INSTALL
AC_PROG_LN_S
## ----------------------------------------------------------------------
## Check which archiving tool to use. This needs to be done before
## the LT_INIT 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_CHECK_PROG([DIFF], [diff], [diff -w])
AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo])
AC_CHECK_PROG([NEQN], [neqn], [neqn])
AC_CHECK_PROG([TBL], [tbl], [tbl])
AC_SUBST([DIFF])
AC_SUBST([STATIC_SHARED])
AC_SUBST([SHARED_EXTENSION])
AC_SUBST([enable_shared])
AC_SUBST([enable_static])
AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a`
AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no
AC_SUBST([LT_STATIC_EXEC])
## ======================================================================
## Libtool initialization
## ======================================================================
## disable-shared sets the default libtool behavior to disable shared libs
LT_INIT([disable-shared])
LT_OUTPUT
## ----------------------------------------------------------------------
## Check if we should install only statically linked executables.
## This check needs to occur after libtool is initialized because
## we check a libtool cache value and may issue a warning based
## on its result.
AC_MSG_CHECKING([if we should install only statically linked executables])
AC_ARG_ENABLE([static_exec],
[AS_HELP_STRING([--enable-static-exec],
[Install only statically linked executables
[default=no]])],
[STATIC_EXEC=$enableval])
if test "X$STATIC_EXEC" = "Xyes"; then
echo "yes"
## 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])
## ======================================================================
## Checks for libraries
## ======================================================================
## ----------------------------------------------------------------------
## Fake --with-xxx option to allow us to create a help message for the
## following --with-xxx options which can take either a =DIR or =INC,LIB
## specifier.
##
AC_ARG_WITH([fnord],
[
For the following --with-xxx options, you can specify where the header
files and libraries are in two different ways:
--with-xxx=INC,LIB - Specify individually the include directory and
library directory separated by a comma
--with-xxx=DIR - Specify only the directory which contains the
include/ and lib/ subdirectories
])
## ----------------------------------------------------------------------
## Is the GNU zlib present? It has a header file `zlib.h' and a library
## `-lz' and their locations might be specified with the `--with-zlib'
## command-line switch. The value is an include path and/or a library path.
## If the library path is specified then it must be preceded by a comma.
AC_ARG_WITH([zlib],
[AS_HELP_STRING([--with-zlib=DIR],
[Use zlib library [default=yes]])],,
[withval=yes])
case "X-$withval" in
X-yes)
HAVE_ZLIB="yes"
AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
fi
if test -z "$HAVE_ZLIB"; then
if test -n "$HDF4_CONFIG_ABORT"; then
AC_MSG_ERROR([couldn't find zlib library])
fi
else
AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
fi
;;
X-|X-no|X-none)
HAVE_ZLIB="no"
AC_MSG_ERROR([zlib library required to build HDF4])
;;
*)
HAVE_ZLIB="yes"
case "$withval" in
*,*)
zlib_inc="`echo $withval | cut -f1 -d,`"
zlib_lib="`echo $withval | cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
zlib_inc="$withval/include"
zlib_lib="$withval/lib"
fi
;;
esac
## Trying to include -I/usr/include and -L/usr/lib is redundant and
## can mess some compilers up.
if test "X$zlib_inc" = "X/usr/include"; then
zlib_inc=""
fi
if test "X$zlib_lib" = "X/usr/lib"; then
zlib_lib=""
fi
if test -n "$zlib_inc"; then
CPPFLAGS="$CPPFLAGS -I$zlib_inc"
fi
AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
if test -n "$zlib_lib"; then
LDFLAGS="$LDFLAGS -L$zlib_lib"
fi
if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])
fi
if test -z "$HAVE_ZLIB"; then
AC_MSG_ERROR([couldn't find zlib library])
else
AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
fi
;;
esac
## ----------------------------------------------------------------------
## Is the JPEG library present?
AC_ARG_WITH([jpeg],
[AS_HELP_STRING([--with-jpeg=DIR],
[Use jpeg library [default=yes]])],,
[withval=yes])
case "X-$withval" in
X-yes)
HAVE_JPEG="yes"
AC_CHECK_HEADERS([jpeglib.h], [HAVE_JPEG_H="yes"], [unset HAVE_JPEG])
if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then
AC_CHECK_LIB([jpeg], [jpeg_start_decompress],, [unset HAVE_JPEG])
fi
if test -z "$HAVE_JPEG"; then
AC_MSG_ERROR([couldn't find jpeg library])
fi
;;
X-|X-no|X-none)
HAVE_JPEG="no"
AC_MSG_ERROR([jpeg library required to build HDF4])
;;
*)
HAVE_JPEG="yes"
case "$withval" in
*,*)
jpeg_inc="`echo $withval | cut -f1 -d,`"
jpeg_lib="`echo $withval | cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
jpeg_inc="$withval/include"
jpeg_lib="$withval/lib"
fi
;;
esac
## Trying to include -I/usr/include and -L/usr/lib is redundant and
## can mess some compilers up.
if test "X$jpeg_inc" = "X/usr/include"; then
jpeg_inc=""
fi
if test "X$jpeg_lib" = "X/usr/lib"; then
jpeg_lib=""
fi
if test -n "$jpeg_inc"; then
CPPFLAGS="$CPPFLAGS -I$jpeg_inc"
fi
AC_CHECK_HEADERS([jpeglib.h], [HAVE_JPEG_H="yes"], [unset HAVE_JPEG])
if test -n "$jpeg_lib"; then
LDFLAGS="$LDFLAGS -L$jpeg_lib"
fi
if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then
AC_CHECK_LIB([jpeg], [jpeg_start_decompress],, [unset HAVE_JPEG])
fi
if test -z "$HAVE_JPEG"; then
AC_MSG_ERROR([couldn't find jpeg library])
fi
;;
esac
## ----------------------------------------------------------------------
## Is the szip library present?
AC_SUBST(USE_COMP_SZIP) USE_COMP_SZIP="no"
AC_SUBST(SZIP_HAS_ENCODER) SZIP_HAS_ENCODER="no"
AC_ARG_WITH([szlib],
[AS_HELP_STRING([--with-szlib=DIR],
[Use szlib library [default=no]])],,
[withval=no])
case "X-$withval" in
X-yes)
HAVE_SZIP="yes"
AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP])
if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP])
fi
if test -z "$HAVE_SZIP"; then
AC_MSG_ERROR([couldn't find szlib library])
fi
;;
X-|X-no|X-none)
HAVE_SZIP="no"
AC_MSG_CHECKING([for szlib])
AC_MSG_RESULT([suppressed])
SZIP_INFO="${SZIP_INFO}disabled"
;;
*)
HAVE_SZIP="yes"
case "$withval" in
*,*)
szip_inc="`echo $withval | cut -f1 -d,`"
szip_lib="`echo $withval | cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
szip_inc="$withval/include"
szip_lib="$withval/lib"
fi
;;
esac
## Trying to include -I/usr/include and -L/usr/lib is redundant and
## can mess some compilers up.
if test "X$szip_inc" = "X/usr/include"; then
szip_inc=""
fi
if test "X$szip_lib" = "X/usr/lib"; then
szip_lib=""
fi
if test -n "$szip_inc"; then
CPPFLAGS="$CPPFLAGS -I$szip_inc"
fi
AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP])
if test -n "$szip_lib"; then
LDFLAGS="$LDFLAGS -L$szip_lib"
fi
if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP])
fi
if test -z "$HAVE_SZIP"; then
AC_MSG_ERROR([couldn't find szlib library])
else
USE_COMP_SZIP="yes"
fi
;;
esac
## Check to see if SZIP has encoder
if test "X$HAVE_SZIP" = "Xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
## SZLIB library is available. Check if it can encode.
AC_MSG_CHECKING([for szlib encoder])
## Set LD_LIBRARY_PATH so encoder test can find the library and run.
if test -z "$LD_LIBRARY_PATH"; then
export LD_LIBRARY_PATH="$szip_lib"
else
export LD_LIBRARY_PATH="${szip_lib}:$LD_LIBRARY_PATH"
fi
AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
#include <szlib.h>
int main(void)
{
/* SZ_encoder_enabled returns 1 if encoder is present */
if (SZ_encoder_enabled() == 1)
exit(0);
else
exit(1);
}
]])],[CAN_ENCODE="yes"],[CAN_ENCODE="no"],[])
## Report szip encoder test results
if test "X$CAN_ENCODE" = "Xyes"; then
AC_MSG_RESULT([yes])
fi
if test "X$CAN_ENCODE" = "Xno"; then
AC_MSG_RESULT([no])
fi
## Add "szip" to external filter list
if test "X$CAN_ENCODE" = "Xyes"; then
if test "X$SZIP_INFO" != "X"; then
SZIP_INFO="${SZIP_INFO}"
fi
SZIP_INFO="${SZIP_INFO}enabled with encoder"
fi
if test "X$CAN_ENCODE" = "Xno"; then
if test "X$SZIP_INFO" != "X"; then
SZIP_INFO="${SZIP_INFO}"
fi
SZIP_INFO="${SZIP_INFO}enabled with decoder only"
fi
## Create macro to specify if encoder is present
if test "X$CAN_ENCODE" = "Xyes"; then
AC_DEFINE([HAVE_SZIP_ENCODER], [1],
[Define if szip has encoder])
SZIP_HAS_ENCODER="yes"
fi
fi
AC_SUBST([SZIP_INFO])
AC_SUBST([SZIP_HAS_ENCODER])
AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_COMP_SZIP" = "Xyes" && test "X$LL_PATH" != "X"])
## ----------------------------------------------------------------------
## Is XDR support present? The TRY_LINK info was gotten from the
## mfhdf/libsrc/local_nc.c file.
AC_MSG_CHECKING([for xdr library support])
AC_ARG_ENABLE([hdf4-xdr],
[AS_HELP_STRING([--enable-hdf4-xdr],
[Build xdr library from code in HDF4 source.
Not supported for 64 bit mode. [default="no"]])],
[enableval="yes"],[enableval="no"])
case "$enableval" in
yes)
BUILD_XDR="yes"
AC_MSG_RESULT([using HDF4 XDR]);
;;
no)
BUILD_XDR="no"
AC_MSG_RESULT([using system XDR]);
;;
esac
## Check headers and add libraries for XDR if the HDF4 XDR library is not used.
if test "X$BUILD_XDR" != "Xyes"; then
## For Solaris systems, add the -nsl for XDR support
##
## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support
## ======================================================================
## Checks for header files
## ======================================================================
HAVE_RPC="yes"
HAVE_OLDRPC="yes"
HAVE_TIRPC="yes"
## save current settings
SYSCPPFLAGS="$CPPFLAGS"
case "$host" in
*-solaris*)
LIBS="$LIBS -lnsl"
;;
*-pc-cygwin* | *-linux*)
CFLAGS="$SYSCFLAGS"
CPPFLAGS="$SYSCPPFLAGS"
AC_CHECK_HEADER([rpc/rpc.h],[:], [unset HAVE_OLDRPC])
AC_CHECK_HEADER([tirpc/netconfig.h],[:], [unset HAVE_TIRPC])
if test -z "$HAVE_OLDRPC" ; then
LIBS="$LIBS -ltirpc"
CFLAGS="$SYSCFLAGS -I/usr/include/tirpc"
CPPFLAGS="$SYSCPPFLAGS -I/usr/include/tirpc"
if test -z "$HAVE_TIRPC" ; then
CFLAGS="$SYSCFLAGS"
CPPFLAGS="$SYSCPPFLAGS"
AC_MSG_ERROR([couldn't find rpc headers])
fi
else
HAVE_TIRPC=""
fi
;;
*) ;;
esac
## ----------------------------------------------------------------------
## We're trying to link against the rpc library when building on Cygwin,
## but we need to make sure that it is present on the system. Do that here,
## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support
case "$host" in
*-pc-cygwin* | *-linux*)
if test -n "$HAVE_TIRPC"; then
AC_CHECK_LIB([tirpc], [xdr_opaque],[:], [unset HAVE_RPC])
if test -z "$HAVE_RPC"; then
AC_MSG_ERROR([couldn't find rpc library])
fi
fi
;;
esac
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <rpc/types.h>
#include <rpc/xdr.h>]], [[xdr_int]])],[BUILD_XDR="no"],[BUILD_XDR="yes"])
fi
if test "X$BUILD_XDR" != "Xno"; then
AC_DEFINE([NO_SYS_XDR_INC], [1], [Not using system xdr])
fi
AM_CONDITIONAL([HDF_BUILD_XDR], [test "X$BUILD_XDR" = "Xyes"])
## ======================================================================
## Set POSIX level
## ======================================================================
## This is needed so strdup, etc. are exposed properly
##
## POSIX feature information can be found in the gcc manual at:
## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
CPPFLAGS="-D_POSIX_C_SOURCE=200809L $CPPFLAGS"
## ======================================================================
## Checks for endianness functions
## The htons and ntohs functions are available on most systems.
## These functions convert betweennetwork endiannessand hostendianness.
## Network endianness is big-endian; because the standard TCP/IP network
## protocols use big-endian ordering. These functions come in two sizes:
## htonl and ntohl operate on 4-byte quantities, and
## htons and ntohs operate on 2-byte quantities.
## The hton functions convert host endianness to network endianness.
## The ntoh functions convert network endianness to host endianness
## ======================================================================
AC_CHECK_FUNCS([htonl htons ntohl ntohs])
## ======================================================================
## Checks for headers
## ======================================================================
AC_CHECK_HEADERS([fcntl.h unistd.h])
AC_CHECK_HEADERS([sys/file.h sys/resource.h sys/stat.h sys/time.h sys/wait.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([io.h])
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
AC_PROG_CC_C_O
if test "X$BUILD_FORTRAN" = "Xyes"; then
AC_PROG_F77_C_O
fi
## ----------------------------------------------------------------------
## Set some variables for general configuration information to be saved
## and installed with the libraries.
##
## HDF4 version from the first line of the README.md file.
H4_VERSION="`cut -d' ' -f3 $srcdir/README.md | head -1`"
AC_SUBST([H4_VERSION])
## Configuration date
AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`"
## User doing the configuration
AC_SUBST([CONFIG_USER]) CONFIG_USER="`whoami`@`hostname`"
## Configuration mode (production, development, etc)
AC_SUBST([CONFIG_MODE])
AC_C_BIGENDIAN
## Are we building this in debug or production mode?
AC_MSG_CHECKING([for build mode])
AC_ARG_ENABLE([production],
[AS_HELP_STRING([--enable-production],
[Determines how to run the compiler.])])
case "X-$enable_production" in
X-|X-yes)
AC_MSG_RESULT([production])
CONFIG_MODE=production
CFLAGS="$CFLAGS $PROD_CFLAGS"
FFLAGS="$FFLAGS $PROD_FFLAGS"
CPPFLAGS="$CPPFLAGS -DNDEBUG $PROD_CPPFLAGS"
;;
X-no)
AC_MSG_RESULT([development])
CONFIG_MODE=development
CFLAGS="$CFLAGS $DEBUG_CFLAGS"
FFLAGS="$FFLAGS $DEBUG_FFLAGS"
CPPFLAGS="$CPPFLAGS -UNDEBUG $DEBUG_CPPFLAGS"
;;
*)
AC_MSG_RESULT([user-defined])
CONFIG_MODE="user-defined (most CFLAGS, etc. set by user)"
;;
esac
## ======================================================================
## Checks for library functions
## ======================================================================
AC_MSG_CHECKING([for math library support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[sinh(37.927)]])],[AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no]); LIBS="$LIBS -lm"])
AC_CHECK_FUNCS([fork system wait])
## ======================================================================
## Checks for system services
## ======================================================================
## Copy NetCDF header files.
#
## FIXME: This is code stolen^Wborrowed from the old HDF4 configure.
## These header files should probably be generated by autoconf instead
## of being copied depending upon the host.
case "$host" in
*-linux*|*-k*bsd*-gnu|*-gnu*)BAR="linux" ;;
*-freebsd*) BAR="fbsd" ;;
*-ibm-aix*) BAR="aix" ;;
sparc64-*-solaris2*) BAR="solaris64" ;;
*-*-solaris2*) BAR="solaris" ;;
*-apple*) BAR="apple" ;;
*-pc-cygwin*) BAR="linux" ;;
*) echo "*** unknown host $host!"; exit 1 ;;
esac
src_files=""
src_files="`echo $src_files | sed -e s/FOO/${BAR}/g`"
for config_file in $src_files; do
src_file="${srcdir}/`echo $config_file | sed -e s/:.*$//`"
target_file="`echo $config_file | sed -e s/^[[^:]]*://g`"
if test ! -r ${src_file}; then
echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2
echo '***' "since the file \"${src_file}\" does not exist." 1>&2
exit 1
fi
## this sed command emulates the dirname command
dstdir=`echo "$target_file" | sed -e 's,[[^/]]*$,,;s,/$,,;s,^$,.,'`
## Create directory for the target_file if it's not there.
if test ! -d $dstdir; then
${srcdir}/bin/mkinstalldirs $dstdir
fi
echo "Copying \"${src_file}\" to \"${target_file}\" ."
cp ${src_file} ${target_file}
if test ! -r ${target_file}; then
echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2
exit 1
fi
done
## ------------------------------------------------------------------------
## Check to see if libtool has enabled shared libraries. Set a conditional
## as some Makefiles will build based on availability of shared libraries.
if (./libtool --features | grep '^enable shared libraries' > /dev/null); then
enable_shared=yes
else
enable_shared=no
fi
## ------------------------------------------------------------------------
## Specify shared library extension the host machine should recognize.
case "$host_os" in
darwin*)
SHARED_EXTENSION="dylib"
;;
*)
SHARED_EXTENSION="so"
;;
esac
## We don't need to say when we're entering directories if we're using
## GNU make because make does it for us.
if test "X$GMAKE" = "Xyes"; then
AC_SUBST([SETX]) SETX=":"
else
AC_SUBST([SETX]) SETX="set -x"
fi
AM_CONDITIONAL([HDF_BUILD_SHARED], [test "X$enable_shared" = "Xyes"])
## Compiler with version information. This consists of the full path
## name of the compiler and the reported version number.
AC_SUBST([CC_VERSION])
## Strip anything that looks like a flag off of $CC
CC_NOFLAGS=`echo $CC | sed 's/ -.*//'`
if `echo $CC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then
CC_VERSION="$CC"
else
CC_VERSION="$CC";
for x in `echo $PATH | sed -e 's/:/ /g'`; do