File: configure.ac

package info (click to toggle)
hdf5-filter-plugin 0.0~git20221111.49e3b65-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,848 kB
  • sloc: ansic: 14,374; sh: 11,445; cpp: 1,463; makefile: 100; python: 19; xml: 6
file content (375 lines) | stat: -rw-r--r-- 11,202 bytes parent folder | download | duplicates (2)
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
##                                               -*- Autoconf -*-
## Process this file with autoconf to produce a configure script.
##
## 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 files COPYING and Copyright.html.  COPYING can be found at the root
## of the source code distribution tree; Copyright.html can be found at the
## root level of an installed copy of the electronic HDF5 document set and
## is linked from the top-level documents page.  It can also be found at
## http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have
## access to either file, you may request a copy from help@hdfgroup.org.

AC_PREREQ(2.59)
AC_INIT(H5BZ2, 0.1, help@hdfgroup.org)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([bin])
## AM_INIT_AUTOMAKE takes a list of options that should be applied to
## every Makefile.am when automake is run.
AM_INIT_AUTOMAKE([foreign serial-tests])
AM_CONFIG_HEADER(config.h)

## Turn off automake rebuild rules so make doesn't try to run automake
## (which probably won't work).
AM_MAINTAINER_MODE

# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL

AC_CANONICAL_HOST
AC_PREFIX_DEFAULT([`pwd`/plugins])

LT_INIT

## 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"     ;;
  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

## Fix up the INSTALL macro if its a relative path. We want the
## full-path to the binary instead.
case "$INSTALL" in
  *install-sh*)
    INSTALL='\${top_srcdir}/bin/install-sh -c'
    ;;
esac

## ----------------------------------------------------------------------
## Check which archiving tool to use. This needs to be done before
## the AC_PROG_LIBTOOL macro.
##
if test -z "$AR"; then
  AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH])
fi

AC_SUBST([AR])

## Export the AR macro so that it will be placed in the libtool file
## correctly.
export AR

AC_PROG_MAKE_SET
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL

## Post processing to patch up some deficiencies in libtool
case $host_os in
  linux*)
    # 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

## HDF5 compile commands.
AC_SUBST([H5CC])
AC_SUBST([H5CC_PP])
AC_SUBST([H5FC])
AC_SUBST([H5FC_PP])
AC_SUBST([H5CPP])

## Make sure they are set to something.
H5CC="${H5CC:-h5cc}"
H5CC_PP="${H5CC_PP:-h5pcc}"
H5FC="${H5FC:-h5fc}"
H5FC_PP="${H5FC_PP:-h5pfc}"
H5CPP="${H5CPP:-h5c++}"

## ----------------------------------------------------------------------
## 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 blosc library present? It has a header file `blosc.h' and a library
## `-lblosc' and their locations might be specified with the `--with-blosclib' 
## 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([blosclib],
            [AS_HELP_STRING([--with-blosclib=DIR],
                            [Use blosclib library for compressed I/O
                             filter [default=yes]])],,)

case $withval in
  yes)
    HAVE_BLOSCLIB="yes"
    AC_CHECK_HEADER([blosc.h], [HAVE_BLOSCLIB_H="yes"], [unset HAVE_BLOSCLIB])
    if test "x$HAVE_BLOSCLIB" = "xyes" -a "x$HAVE_BLOSCLIB_H" = "xyes"; then
      AC_CHECK_LIB([blosc], [blosc_compress],, [unset HAVE_BLOSCLIB])
    fi
    if test -z "$HAVE_BLOSCLIB"; then
      AC_MSG_ERROR([couldn't find blosc library])
    else
      AC_CHECK_FUNC([blosc_compress], [HAVE_BLOSC_COMPRESS="yes"])
    fi
    ;;
  no)
    HAVE_BLOSCLIB="no"
    AC_MSG_ERROR([blosc library needed for compilation.])
    ;;
  *)
    HAVE_BLOSCLIB="yes"
    case "$withval" in
      *,*)
        blosclib_inc="`echo $withval | cut -f1 -d,`"
        blosclib_lib="`echo $withval | cut -f2 -d, -s`"
        ;;
      *)
        if test -n "$withval"; then
          blosclib_inc="$withval/include"
          blosclib_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$blosclib_inc" = "X/usr/include"; then
      blosclib_inc=""
    fi
    if test "X$blosclib_lib" = "X/usr/lib"; then
      blosclib_lib=""
    fi

    saved_CPPFLAGS="$CPPFLAGS"
    saved_AM_CPPFLAGS="$AM_CPPFLAGS"
    saved_LDFLAGS="$LDFLAGS"
    saved_AM_LDFLAGS="$AM_LDFLAGS"

    if test -n "$blosclib_inc"; then
      CPPFLAGS="$CPPFLAGS -I$blosclib_inc"
      AM_CPPFLAGS="$AM_CPPFLAGS -I$blosclib_inc"
    fi

    AC_CHECK_HEADER([blosc.h],
                     [HAVE_BLOSCLIB_H="yes"],
                     [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_BLOSCLIB])

    if test -n "$blosclib_lib"; then
      LDFLAGS="$LDFLAGS -L$blosclib_lib"
      AM_LDFLAGS="$AM_LDFLAGS -L$blosclib_lib"
    fi

    if test "x$HAVE_BLOSCLIB" = "xyes" -a "x$HAVE_BLOSCLIB_H" = "xyes"; then
      AC_CHECK_LIB([blosc], [blosc_compress],,
                   [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_BLOSCLIB])
    fi

    if test -z "$HAVE_BLOSCLIB"; then
      AC_MSG_ERROR([couldn't find blosclib library])
    else
      AC_CHECK_FUNC([blosc_compress], [HAVE_BLOSC_COMPRESS="yes"])
    fi
    ;;
esac

## ----------------------------------------------------------------------
## Where's HDF5? We need to find out where the HDF5 library
## and header files are if they aren't in system library/include places.
##
AC_SUBST(LIBHDF5) LIBHDF5=""
AC_SUBST(HDF5PATH) HDF5PATH=""
AC_ARG_WITH([hdf5],
            [AC_HELP_STRING([--with-hdf5=DIR],
                            [Where to find the HDF5 library])],,)

case "$withval" in
  yes)
    AC_CHECK_HEADER([hdf5.h],,
                     [AC_MSG_ERROR([cannot find HDF5 header files.])])
    AC_CHECK_LIB([hdf5], [H5open],,
                 [AC_MSG_ERROR([cannot find the HDF5 library.])])
    ;;
  no)
    AC_MSG_ERROR([HDF5 library needed for compilation.])
    ;;
  *)
    case "$withval" in
      *,*)
        hdf5_inc="`echo $withval | cut -f1 -d,`"
        hdf5_lib="`echo $withval | cut -f2 -d, -s`"
        ;;
      *)
        if test -n "$withval"; then
          hdf5_inc="$withval/include"
          hdf5_lib="$withval/lib"
        fi
        ;;
    esac

    if test -n "$hdf5_inc"; then
      CPPFLAGS="$CPPFLAGS -I$hdf5_inc"
    fi

    AC_CHECK_HEADER([hdf5.h],,
                     [AC_MSG_ERROR([cannot find HDF5 header files!])])

    HDF5PATH="$hdf5_lib,"
    HDF5PATH="`echo $HDF5PATH | sed -e "s/lib,/bin/"`"

    if test -n "$hdf5_lib"; then
      LDFLAGS="$LDFLAGS -L$hdf5_lib"

      ## We want to use the ``.la'' version of the HDF5 library which
      ## is the thing libtool creates and has in it all of the neat
      ## stuff like where to find the libraries libhdf5 depends upon.
      if test -f "$hdf5_lib/libhdf5.la"; then
        libdir_saved=$libdir
        . $hdf5_lib/libhdf5.la
        libdir=$libdir_saved
        for lib in X $dependency_libs; do
          case "$lib" in
            *libhdf5.la*)
              ;;
            *)
              if test "$lib" != "X"; then
                LIBHDF5="$LIBHDF5 $lib"
              fi
              ;;
          esac
        done
      fi
    fi

    AC_CHECK_LIB([hdf5], [H5open],,
                 [AC_MSG_ERROR([cannot find HDF5 library.])])
    ;;
esac

H5CC=${HDF5PATH}/h5cc
H5FC=${HDF5PATH}/h5fc

## Add the suffix to CC for shared linking.  Cannot just set as an option
## because it must be first.
if test "$shared_suffix" && test ! `echo $CC | grep "$shared_suffix"`; then
    CC=${CC}${shared_suffix}
fi

## ======================================================================
## Checks for library functions
## ======================================================================

AC_MSG_CHECKING([for math library support])
AC_TRY_LINK([#include <math.h>], [volatile x = 37.927; k=1.2; sinh(x*k/cosh(x/k)],
            [AC_MSG_RESULT([yes])],
            [AC_MSG_RESULT([no]); LIBS="$LIBS -lm"])


## Checks for libraries.

## Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h])

## Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T

## Checks for library functions.
AC_FUNC_ERROR_AT_LINE
##AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([memset])

## Check which plugins to build, if no environmental variables are set, build
## all.
if test ! "$PLUGIN_H5BLOSC"
then
  PLUGIN_H5BLOSC=1
fi
AM_CONDITIONAL(H5BLOSC, test "$PLUGIN_H5BLOSC")

LT_OUTPUT

## Set subdirectories
AC_CONFIG_FILES([makefile src/makefile example/makefile example/test.sh])

## Configure
AC_OUTPUT