1# Process this file with autoconf to produce a configure script. 2AC_INIT(h5utils, 1.13.1, stevenj@alum.mit.edu) 3AM_INIT_AUTOMAKE([foreign silent-rules 1.6]) 4AM_SILENT_RULES(yes) 5AC_CONFIG_SRCDIR([h5topng.c]) 6AM_CONFIG_HEADER(config.h) 7AM_MAINTAINER_MODE 8 9# Checks for programs. 10AC_PROG_CC 11AM_PROG_CC_C_O 12 13# Checks for header files. 14AC_HEADER_STDC 15 16AC_CHECK_LIB(m, sin) 17AC_CHECK_FUNCS(snprintf) 18 19MORE_H5UTILS="" 20MORE_H5UTILS_MANS="" 21 22########################################################################### 23 24dnl override CFLAGS selection when debugging 25if test "${enable_debug}" = "yes"; then 26 CFLAGS="-g" 27fi 28 29dnl add gcc warnings, in debug/maintainer mode only 30if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then 31 if test $ac_cv_prog_gcc = yes; then 32 CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wno-long-long -Wshadow -Wbad-function-cast -Wwrite-strings -Wstrict-prototypes -Wredundant-decls -Wnested-externs" # -Wundef -Wconversion -Wmissing-prototypes -Wmissing-declarations 33 fi 34fi 35 36########################################################################### 37 38H5TOPNG=yes 39PNG_LIBS="" 40 41AC_CHECK_LIB(z, inflate, ok=yes, ok=no) 42if test "$ok" = "yes"; then 43 LIBS="-lz $LIBS" 44 45 AC_CHECK_LIB(png, png_create_write_struct, ok=yes, ok=no) 46 if test "$ok" = "yes"; then 47 PNG_LIBS="-lpng" 48 else 49 AC_MSG_WARN([can't find libpng: won't be able to compile h5topng]) 50 H5TOPNG=no 51 fi 52else 53 AC_MSG_WARN([can't find libz: won't be able to compile h5topng]) 54 H5TOPNG=no 55fi 56 57if test $H5TOPNG = yes; then 58 MORE_H5UTILS="h5topng\$(EXEEXT) $MORE_H5UTILS" 59 H5TOPNG_MAN=doc/man/h5topng.1 60fi 61 62AC_SUBST(H5TOPNG_MAN) 63AC_SUBST(PNG_LIBS) 64 65########################################################################### 66 67AC_CHECK_LIB(matheval, evaluator_get_variables, H5MATH=yes, H5MATH=no) 68 69if test $H5MATH = yes; then 70 MORE_H5UTILS="h5math\$(EXEEXT) $MORE_H5UTILS" 71 MORE_H5UTILS_MANS="doc/man/h5math.1 $MORE_H5UTILS_MANS" 72else 73 AC_MSG_WARN([can't find libmatheval: won't be able to compile h5math]) 74fi 75 76########################################################################### 77 78# Only build h5fromh4 if we are using a version of HDF5 prior to 1.4, and 79# thus don't have the superior h4toh5 utility. Similarly for h5toh4. 80AC_CHECK_PROG(H4TOH5, h4toh5, h4toh5) 81AC_CHECK_PROG(H5TOH4, h5toh4, h5toh4) 82 83AC_ARG_WITH(hdf4, 84 [AC_HELP_STRING([--with-hdf4], [build hdf4 utils even if h4toh5 and h5toh4 are present])], 85 ok=$withval, ok=maybe) 86if test "x$ok" = xyes; then 87 H4TOH5="" 88 H5TOH4="" 89elif test "x$ok" = xno; then 90 H4TOH5="h4toh5" 91 H5TOH4="h5toh4" 92fi 93 94HDF4=no 95if test "x$H4TOH5" != xh4toh5 -o "x$H5TOH4" != xh5toh4; then 96 AC_CHECK_LIB(jpeg, jpeg_start_compress, 97 [AC_CHECK_LIB(df, DFSDgetdata, 98 [H4_LIBS="-ldf -ljpeg"; HDF4=yes], 99 [AC_MSG_WARN([can't find libdf (HDF4): won't be able to compile h5fromh4 or h4fromh5])], -ljpeg)], 100 [AC_MSG_WARN([can't find libjpeg: won't be able to compile h5fromh4 or h4fromh5])]) 101 102 if test $HDF4 = yes; then 103 if test "x$H4TOH5" != xh4toh5; then 104 MORE_H5UTILS="h5fromh4\$(EXEEXT) $MORE_H5UTILS" 105 MORE_H5UTILS_MANS="doc/man/h5fromh4.1 $MORE_H5UTILS_MANS" 106 fi 107 if test "x$H5TOH4" != xh5toh4; then 108 MORE_H5UTILS="h4fromh5\$(EXEEXT) $MORE_H5UTILS" 109 # MORE_H5UTILS_MANS="doc/man/h4fromh5.1 $MORE_H5UTILS_MANS" 110 fi 111 fi 112fi 113AC_CHECK_HEADERS(hdf.h hdf/hdf.h) 114 115AC_SUBST(H4_LIBS) 116 117########################################################################### 118 119AC_CHECK_LIB(hdf5, H5Fopen, [LIBS="-lhdf5 $LIBS"], 120 [AC_MSG_ERROR([hdf5 libraries are required for compilation])]) 121 122########################################################################### 123 124AC_ARG_WITH(octave, [AC_HELP_STRING([--without-octave], [don't compile h5read Octave plugin])], ok=$withval, ok=yes) 125 126H5READ="" 127OCT_INSTALL_DIR="" 128 129if test "x$ok" = xyes; then 130AC_CHECK_PROGS(MKOCTFILE, mkoctfile, echo) 131if test "$MKOCTFILE" = "echo"; then 132 AC_MSG_WARN([can't find mkoctfile: won't be able to compile h5read.oct]) 133else 134 # try to find installation directory 135 AC_CHECK_PROGS(OCTAVE, octave, echo) 136 AC_CHECK_PROGS(OCTAVE_CONFIG, octave-config, echo) 137 AC_MSG_CHECKING(where octave plugins go) 138 OCT_INSTALL_DIR=`octave-config --oct-site-dir 2> /dev/null | grep '/'` 139 if test -z "$OCT_INSTALL_DIR"; then 140 OCT_INSTALL_DIR=`octave-config --print OCTFILEDIR 2> /dev/null | grep '/'` 141 fi 142 if test -z "$OCT_INSTALL_DIR"; then 143 OCT_INSTALL_DIR=`echo "path" | $OCTAVE -q 2> /dev/null | grep "/oct/" | head -1` 144 fi 145 if test -z "$OCT_INSTALL_DIR"; then 146 OCT_INSTALL_DIR=`echo "DEFAULT_LOADPATH" | $OCTAVE -q 2> /dev/null | tr ':' '\n' | grep "site/oct" | head -1` 147 fi 148 if test -n "$OCT_INSTALL_DIR"; then 149 AC_MSG_RESULT($OCT_INSTALL_DIR) 150 H5READ=h5read.oct 151 else 152 AC_MSG_RESULT(unknown) 153 AC_MSG_WARN([can't find where to install octave plugins: won't be able to compile h5read.oct]) 154 fi 155fi 156fi 157 158AC_SUBST(H5READ) 159AC_SUBST(OCT_INSTALL_DIR) 160 161########################################################################### 162 163AC_ARG_WITH(v5d, [AC_HELP_STRING([--with-v5d=<dir>], [use Vis5d in <dir> for h5tov5d])], ok=$withval, ok=yes) 164H5TOV5D=no 165V5D_FILES="" 166V5D_INCLUDES="" 167if test "$ok" = "yes"; then 168 AC_CHECK_LIB(v5d, v5dCreate, V5D_FILES="-lv5d"; H5TOV5D=yes) 169 AC_CHECK_HEADERS(vis5d/v5d.h) 170 AC_CHECK_HEADER(vis5d+/v5d.h, [AC_DEFINE([HAVE_VIS5Dp_V5D_H], 1, [[Define if you have the <vis5d+/v5d.h> header file.]])]) 171elif test "$ok" != "no"; then 172 AC_MSG_CHECKING([for Vis5d object files and headers]) 173 if test -r "$ok/src/v5d.o" -a -r "$ok/src/binio.o" -a -r "$ok/src/v5d.h" -a -r "$ok/src/binio.h"; then 174 V5D_FILES="$ok/src/v5d.o $ok/src/binio.o" 175 V5D_INCLUDES="-I$ok/src" 176 elif test -r "$ok/v5d.o" -a -r "$ok/binio.o" -a -r "$ok/v5d.h" -a -r "$ok/binio.h"; then 177 V5D_FILES="$ok/v5d.o $ok/binio.o" 178 V5D_INCLUDES="-I$ok" 179 fi 180 if test -z "$V5D_FILES"; then 181 AC_MSG_RESULT([not found]) 182 AC_MSG_ERROR([couldn't read Vis5D object files in $ok]) 183 else 184 AC_MSG_RESULT([found]) 185 fi 186 H5TOV5D=yes 187fi 188if test $H5TOV5D = yes; then 189 MORE_H5UTILS="h5tov5d\$(EXEEXT) $MORE_H5UTILS" 190 MORE_H5UTILS_MANS="doc/man/h5tov5d.1 $MORE_H5UTILS_MANS" 191fi 192AC_SUBST(V5D_FILES) 193AC_SUBST(V5D_INCLUDES) 194 195########################################################################### 196 197AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdint.h inttypes.h]) 198AC_CHECK_TYPES([uint16_t, uint32_t]) 199 200AC_MSG_CHECKING([for htons]) 201AC_TRY_LINK([#if defined(HAVE_ARPA_INET_H) 202#include <arpa/inet.h> 203#elif defined(HAVE_NETINET_IN_H) 204#include <netinet/in.h> 205#endif], [unsigned short i; htons(i);], [htons=yes 206 AC_DEFINE([HAVE_HTONS],1,[Define if you have htons.])], htons=no) 207AC_MSG_RESULT($htons) 208 209AC_CHECK_SIZEOF(float) 210 211AC_MSG_CHECKING([for htonl]) 212AC_TRY_LINK([#if defined(HAVE_ARPA_INET_H) 213#include <arpa/inet.h> 214#elif defined(HAVE_NETINET_IN_H) 215#include <netinet/in.h> 216#endif], [unsigned long i; htonl(i);], [htonl=yes 217 AC_DEFINE([HAVE_HTONL],1,[Define if you have htonl.])], htonl=no) 218AC_MSG_RESULT($htonl) 219 220if test "x$htons" != xyes -o "x$htonl" != xyes; then 221 AC_C_BIGENDIAN 222fi 223 224########################################################################### 225 226# Store datadir (e.g. /usr/local/share) in DATADIR #define. 227 228# Requires some hackery to actually get this value... 229save_prefix=$prefix 230test "x$prefix" = xNONE && prefix=$ac_default_prefix 231eval datadir_val=$datadir 232eval datadir_val=$datadir_val 233prefix=$save_prefix 234 235AC_DEFINE_UNQUOTED(DATADIR, "$datadir_val", [datadir installation prefix]) 236AC_SUBST(datadir_val) 237 238########################################################################### 239AC_SUBST(MORE_H5UTILS) 240AC_SUBST(MORE_H5UTILS_MANS) 241########################################################################### 242 243AC_CONFIG_FILES([Makefile doc/man/h5topng.1]) 244AC_OUTPUT 245