summaryrefslogtreecommitdiff
blob: 8de8580cfe38649a749e7e57fe95f14b1e28b08e (plain)
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
--- configure.ac
+++ configure.ac
@@ -74,44 +74,23 @@
 
 ###########################################################################
 
-# Only build h5fromh4 if we are using a version of HDF5 prior to 1.4, and
-# thus don't have the superior h4toh5 utility.  Similarly for h5toh4.
-AC_CHECK_PROG(H4TOH5, h4toh5, h4toh5)
-AC_CHECK_PROG(H5TOH4, h5toh4, h5toh4)
-
-AC_ARG_WITH(hdf4,
-	[AC_HELP_STRING([--with-hdf4], [build hdf4 utils even if h4toh5 and h5toh4 are present])],
-	ok=$withval, ok=maybe)
-if test "x$ok" = xyes; then
-	H4TOH5=""
-	H5TOH4=""
-elif test "x$ok" = xno; then
-	H4TOH5="h4toh5"
-	H5TOH4="h5toh4"
-fi
-
-HDF4=no
-if test "x$H4TOH5" != xh4toh5 -o "x$H5TOH4" != xh5toh4; then
-	AC_CHECK_LIB(jpeg, jpeg_start_compress,
-		[AC_CHECK_LIB(df, DFSDgetdata,
-			[H4_LIBS="-ldf -ljpeg"; HDF4=yes],
-			[AC_MSG_WARN([can't find libdf (HDF4): won't be able to compile h5fromh4 or h4fromh5])], -ljpeg)],
-		[AC_MSG_WARN([can't find libjpeg: won't be able to compile h5fromh4 or h4fromh5])])
-
-	if test $HDF4 = yes; then
-		if test "x$H4TOH5" != xh4toh5; then
-		   MORE_H5UTILS="h5fromh4\$(EXEEXT) $MORE_H5UTILS"
-		   MORE_H5UTILS_MANS="h5fromh4.1 $MORE_H5UTILS_MANS"
-		fi
-		if test "x$H5TOH4" != xh5toh4; then
-		   MORE_H5UTILS="h4fromh5\$(EXEEXT) $MORE_H5UTILS"
-		   # MORE_H5UTILS_MANS="h4fromh5.1 $MORE_H5UTILS_MANS"
-		fi
-	fi
-fi
-AC_CHECK_HEADERS(hdf.h hdf/hdf.h)
+AC_ARG_WITH([hdf], AS_HELP_STRING([--with-hdf], [build hdf4 utils even if h4toh5 and h5toh4 are present]))
 
-AC_SUBST(H4_LIBS)
+AS_IF([test "x$with_hdf" = "xyes"], [
+  AC_CHECK_HEADERS(hdf.h hdf/hdf.h)
+  AC_CHECK_LIB(jpeg, jpeg_start_compress,
+      [AC_CHECK_LIB(df, DFSDgetdata,
+         [H4_LIBS="-ldf -ljpeg"; HDF4=yes],
+         [AC_MSG_WARN([can't find libdf (HDF4): won't be able to compile h5fromh4 or h4fromh5])], -ljpeg)],
+      [AC_MSG_WARN([can't find libjpeg: won't be able to compile h5fromh4 or h4fromh5])])
+  if test $HDF4 = yes; then
+      MORE_H5UTILS="h5fromh4\$(EXEEXT) $MORE_H5UTILS"
+      MORE_H5UTILS_MANS="h5fromh4.1 $MORE_H5UTILS_MANS"
+      MORE_H5UTILS="h4fromh5\$(EXEEXT) $MORE_H5UTILS"
+  fi
+
+  AC_SUBST(H4_LIBS)
+])
 
 ###########################################################################