File: configure.ac

package info (click to toggle)
hdf-eos4 2.20v1.00-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 34,028 kB
  • sloc: ansic: 46,955; sh: 23,547; fortran: 15,467; csh: 1,098; makefile: 633
file content (639 lines) | stat: -rwxr-xr-x 18,638 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
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

# Prototype configure.ac for HDF-EOS2
# Created 7/18/07 by Mike McGreevy (mcgreevy@hdfgroup.org) 

AC_PREREQ([2.61])
AC_INIT([hdf-eos2], [4.2], [null@bogus.email])
# AC_CONFIG_SRCDIR([src/EHapi.c])
AC_CONFIG_HEADER([include/HE2_config.h])

AC_CONFIG_AUX_DIR([config])

AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE

# Disable shared libraries (for now)
AC_DISABLE_SHARED

AM_PROG_LIBTOOL


dnl --------------------------------------------------
dnl Set prefix default (install directory) to a directory
dnl in the build area.
AC_PREFIX_DEFAULT([`pwd`/hdfeos2])

# Check for the math library that HDF4 needs
AC_CHECK_LIB([m], [ceil])

# Check whether jpeg is enabled.
# Although HDF-EOS2 doesn't use jpeg, HDF4 needs it.
AC_ARG_WITH([jpeg],
	    [AC_HELP_STRING([--with-jpeg=DIR],
			    [Specify path to external jpeg library.
			     Linker must be able to find jpeg if HDF4 was built with jpeg.
			     [default=yes]])],,
	    withval=yes)
case "$withval" in
  yes)
    HAVE_JPEG="yes"
    AC_CHECK_LIB([jpeg],[jpeg_set_defaults],, [unset HAVE_JPEG])
    if test -z "$HAVE_JPEG"; then
      AC_MSG_ERROR([couldn't find jpeg library])
    fi
    ;;
  no)
    HAVE_JPEG="no"
    AC_MSG_CHECKING([for jpeg library])
    AC_MSG_RESULT([suppressed])
    ;;
  *)
    HAVE_JPEG="yes"
    case "$withval" in
      *,*)
	jpeg_lib="`echo $withval |cut -f2 -d, -s`"
	;;
      *)
	if test -n "$withval"; then
	  jpeg_lib="$withval/lib"
	fi
	;;
    esac

    dnl Trying to include -L/usr/lib is redundant and
    dnl can mess some compilers up.
    if test "X$jpeg_lib" = "X/usr/lib"; then
      jpeg_lib=""
    fi

    saved_LDFLAGS="$LDFLAGS"

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

    AC_CHECK_LIB([jpeg],[jpeg_set_defaults],,
		 [LDFLAGS="$saved_LDFLAGS"; unset HAVE_JPEG])
    if test -z "$HAVE_JPEG"; then
      AC_MSG_ERROR([couldn't find jpeg library])
    fi
    ;;
esac

# Check whether zlib is enabled.
# HDF-EOS2 doesn't use zlib, but HDF4 might. If HDF4 does, it needs to be given
# the linker of there will be undefined symbols in HDF4.
AC_ARG_WITH([zlib],
            [AC_HELP_STRING([--with-zlib=DIR],
                            [Specify path to external zlib library.
                             Linker must be able to find zlib if HDF4
                             was built with zlib.
                             [default=yes]])],,
            withval=yes)

case $withval in
  yes)
    HAVE_ZLIB="yes"
    AC_CHECK_HEADERS([zlib.h],)
    AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB])

    if test -z "$HAVE_ZLIB"; then
      AC_MSG_ERROR([couldn't find zlib library])
    fi
    ;;
  no)
    HAVE_ZLIB="no"
    AC_MSG_CHECKING([for GNU zlib])
    AC_MSG_RESULT([suppressed])
    ;;
  *)
    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

    dnl Trying to include -I/usr/include and -L/usr/lib is redundant and
    dnl 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

    saved_CPPFLAGS="$CPPFLAGS"
    saved_LDFLAGS="$LDFLAGS"

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

    AC_CHECK_HEADERS([zlib.h], ,
                     [CPPFLAGS="$saved_CPPFLAGS"])

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

    AC_CHECK_LIB([z], [compress2],,
                 [LDFLAGS="$saved_LDFLAGS"; unset HAVE_ZLIB])

    if test -z "$HAVE_ZLIB"; then
      AC_MSG_ERROR([couldn't find zlib library])
    fi
    ;;
esac

dnl --------------------------------------------------
dnl Check if -Df2cFortran is specified
dnl Running only the preprocessor may not be a good idea
dnl because this can be hard-coded.
AC_MSG_CHECKING([for fc2Fortran macro])
AC_CACHE_VAL([he2_cv_f2cFortran_defined],
    [AC_TRY_RUN([
    int main(void)
    {
    #ifdef f2cFortran
      return 0;
    #else
      return 1;
    #endif
    }
    ], [he2_cv_f2cFortran_defined=yes], [he2_cv_f2cFortran_defined=no],)])
if test ${he2_cv_f2cFortran_defined} = "yes"; then
  F2CFORTRAN_MACRO="yes"
  AC_MSG_RESULT([defined])
else
  F2CFORTRAN_MACRO="no"
  AC_MSG_RESULT([not defined])
fi

if test ${he2_cv_f2cFortran_defined} = "yes"; then

  AC_CHECK_SIZEOF([int*])
  AC_CACHE_VAL([he2_cv_32ptr],
      [AC_TRY_RUN([
      int main(void)
      {
#ifdef SIZEOF_INTP
	return SIZEOF_INTP == 4 ? 0 : 1;
#else
#error SIZEOF_INTP is not defined
#endif
      }
      ], [he2_cv_32ptr=yes], [he2_cv_32ptr=no],)])
  if test ${he2_cv_32ptr} = "yes"; then
    AC_MSG_NOTICE([possibly 32 bit system])
    F2CFORTRAN_32PTR="yes"
  else
    AC_MSG_NOTICE([possibly 64 bit system; some fortran tests will be skipped.])
  fi

  AC_PROG_FC
  if test -n "$FC"; then
    AC_MSG_CHECKING([for fortran compiler $FC])
    AC_LANG_PUSH([Fortran])
    AC_CACHE_VAL([he2_cv_fortran90_compiler], [
    AC_TRY_LINK([], [
	INTEGER :: I
	REAL :: R
	I=TRANSFER(R,I)
	], [he2_cv_fortran90_compiler=yes], [he2_cv_fortran90_compiler=no])
    ])
    AC_LANG_POP([Fortran])
    if test ${he2_cv_fortran90_compiler} = "yes"; then
      AC_MSG_RESULT([Fortran 90 code was successfully compiled; assume f90 or later])
      F2CFORTRAN_90="yes"
    else
      AC_MSG_RESULT([Fortran 90 code format was not compiled; assume f77])
    fi
    if test -n "$F77" -o -n "$FFLAGS"; then
      AC_MSG_NOTICE([$FC, $FCFLAGS will override $F77, $FFLAGS.])
    fi
    F77=$FC
    FFLAGS=$FCFLAGS
  else
    AC_MSG_NOTICE([f90 or compatible was not detected.])
    AC_PROG_F77
    if test -n "$F77"; then
      AC_MSG_NOTICE([f77 or compatible was detected. $F77 will be used to check Fortran testdrivers.])
    else
      AC_MSG_ERROR([couldn't find fortran compiler. You may want to FC environment variable])
    fi
  fi
fi


dnl --------------------------------------------------
dnl Check whether szlib is enabled.
dnl If HDF4 is built with szlib, user should use --with-szlib=DIR option.
dnl If this option is given, whether SZIP is decoder only or decoder plus encoder
dnl should be checked.
AC_ARG_WITH([szlib],
            [AC_HELP_STRING([--with-szlib=DIR],
                            [Use szlib library for external szlib I/O
                             filter.  Linker must be able to find szlib
                             if HDF4 was build with szip. [default=no]])],,
            withval=no)

case $withval in
  yes)
    HAVE_SZLIB="yes"
    AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"])
    AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZLIB])

    if test -z "$HAVE_SZLIB"; then
      AC_MSG_ERROR([couldn't find szlib library, you may need to specify szip library path])
    fi
    ;;
  no)
    HAVE_SZLIB="no"
    AC_MSG_CHECKING([for szlib])
    AC_MSG_RESULT([suppressed])
    ;;
  *)
    HAVE_SZLIB="yes"
    case "$withval" in
      *,*)
        szlib_inc="`echo $withval |cut -f1 -d,`"
        szlib_lib="`echo $withval |cut -f2 -d, -s`"
        ;;
      *)
        if test -n "$withval"; then
          szlib_inc="$withval/include"
          szlib_lib="$withval/lib"
        fi
        ;;
    esac

    dnl Check if szlib.h exists. We cannot use AC_CHECK_HEADERS here
    dnl because it will use preprocessor. Preprocessor always succeeds in
    dnl finding szlib.h because h4cc provides the path to szlib.h.
    AC_CHECK_FILE($szlib_inc/szlib.h, , [unset HAVE_SZLIB])
    if test -z "$HAVE_SZLIB"; then
      AC_MSG_ERROR([couldn't find szlib.h, check szip library path])
    fi
    
    dnl Trying to include -I/usr/include and -L/usr/lib is redundant and
    dnl can mess some compilers up.
    if test "X$szlib_inc" = "X/usr/include"; then
      szlib_inc=""
    fi 
    if test "X$szlib_lib" = "X/usr/lib"; then
      szlib_lib=""
    fi
    
    saved_CPPFLAGS="$CPPFLAGS"
    saved_LDFLAGS="$LDFLAGS"
    
    if test -n "$szlib_inc"; then
      CPPFLAGS="$CPPFLAGS -I$szlib_inc"
    fi
    
    AC_CHECK_HEADERS([szlib.h],
                     [HAVE_SZLIB_H="yes"],
                     [CPPFLAGS="$saved_CPPFLAGS"])
    
    if test -n "$szlib_lib"; then
      LDFLAGS="$LDFLAGS -L$szlib_lib"
    fi
    
    AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],,
                 [LDFLAGS="$saved_LDFLAGS"; unset HAVE_SZLIB])
    
    if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then
      AC_MSG_ERROR([couldn't find szlib library, check if szip library is valid])
    fi
    ;;
esac


if test "X$HAVE_SZLIB" = "Xyes"; then
    dnl SZLIB library is available.  Check if it can encode

    dnl Given that user specifies h4cc, LDFLAGS in h4cc should be overriden; otherwise,
    dnl the encoding test will be performed on the SZIP library linked with HDF4, not
    dnl the SZIP library user specifies. To suppress the SZIP library linked with HDF4,
    dnl we prepend the user-specified SZIP library path to LDFLAGS in h4cc by using awk.

    AC_PROG_AWK

    AC_MSG_CHECKING([for h4cc])
    PURE_CC=""
    if ($CC -show &> /dev/null); then
	dnl Since CC can be "h4cc -Df2cFortran", arguments should be removed
	PURE_CC=`echo "$CC" | $AWK '{ split($1, array, " ") ; printf array[[1]] }'`
	AC_MSG_RESULT([$PURE_CC])
    else
	AC_MSG_RESULT([$CC])
	AC_MSG_ERROR([CC is not h4cc])
    fi

    SZIP_CC=szip_cc
    cat $PURE_CC | $AWK '{ if ( $0 ~ /^LDFLAGS=\"(.*)/ ) { print substr($0, 1, 9) " -L'$szlib_lib' " substr($0, 10) } else  { print } } ' > $SZIP_CC
    chmod 755 $SZIP_CC
    saved_CC="$CC"
    CC=./$SZIP_CC

    AC_MSG_CHECKING([for szlib encoder])

    AC_CACHE_VAL([he2_cv_szlib_functional],
        [AC_TRY_RUN([
	#include <stddef.h>
        #include <szlib.h>

        int main(void)
        {
            SZ_encoder_enabled();
            exit(0);
        }
        ], [he2_cv_szlib_functional=yes], [he2_cv_szlib_functional=no],)])

    AC_CACHE_VAL([he2_cv_szlib_can_encode],
        [AC_TRY_RUN([
	#include <stddef.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);
        }
        ], [he2_cv_szlib_can_encode=yes], [he2_cv_szlib_can_encode=no],)])

    CC="$saved_CC"
    rm -f $SZIP_CC

    if test ${he2_cv_szlib_functional} = "no"; then
        he2_cv_szlib_can_encode=broken
    else
        AC_DEFINE(HAVE_FILTER_SZIP, 1,
                [Define if support for szip filter is enabled])
        USE_FILTER_SZIP="yes"
    fi

    if test ${he2_cv_szlib_can_encode} = "yes"; then
    	AC_DEFINE(HAVE_FILTER_SZIP_ENCODER, 1,
		[Define if support for szip encoder filter is enabled])
	USE_SZIP_ENCODER="yes"
        AC_MSG_RESULT([yes])
    fi
    if test ${he2_cv_szlib_can_encode} = "no"; then
        AC_MSG_RESULT([no])
    fi
    if test ${he2_cv_szlib_can_encode} = "broken"; then
        AC_MSG_RESULT([shared szlib doesn't work. disabling szip.])
    fi

    dnl Add "szip" to external filter list
    if test ${he2_cv_szlib_can_encode} = "yes"; then
        if test "X$EXTERNAL_FILTERS" != "X"; then
            EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
        fi
        EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)"
    fi
    if test ${he2_cv_szlib_can_encode} = "no"; then
        if test "X$EXTERNAL_FILTERS" != "X"; then
            EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
        fi
        EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)"
    fi
fi

dnl ----------------------------------------------------------------
dnl Check for the HDF4 library using the --with argument
HAVE_HDF4="yes"
AC_ARG_WITH([hdf4],
            [AC_HELP_STRING([--with-hdf4=DIR],
                            [Specify path to HDF4 library to use while building
                            [default=yes]])],,
            withval=yes)

case $withval in
  yes)
    ;;
  no)
    AC_MSG_ERROR([HDF4 disabled in configure, but is required to build HDF-EOS2.])
    ;;
  *)
    case "$withval" in
      *,*)
        hdf4_inc="`echo $withval |cut -f1 -d,`"
        hdf4_lib="`echo $withval |cut -f2 -d, -s`"
        ;;
      *)
        if test -n "$withval"; then
          hdf4_inc="$withval/include"
          hdf4_lib="$withval/lib"
        fi
        ;;
    esac

    dnl Trying to include -I/usr/include and -L/usr/ib is redundant and
    dnl can mess some compilers up.
    if test "X$hdf4_inc" = "X/usr/include"; then
      hdf4_inc=
    fi
    if test "X$hdf4_lib" = "X/usr/lib"; then
      hdf4_lib=
    fi

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

    if test -n "$hdf4_lib"; then
      LDFLAGS="$LDFLAGS -L$hdf4_lib"
    fi
    ;;
esac

dnl See if we have a valid linking path to the HDF4 library, either because
dnl it's in the user's path or because they provided the correct path using
dnl --with-hdf4
AC_CHECK_HEADERS([hdf.h], , [HAVE_HDF4="no"])
AC_CHECK_HEADERS([mfhdf.h], , [HAVE_HDF4="no"])
AC_CHECK_LIB(dfalt,main,, [HAVE_HDF4="no"])
AC_CHECK_LIB(mfhdfalt,main,, [HAVE_HDF4="no"])

if test "X$HAVE_HDF4" = "Xno"; then
  AC_MSG_ERROR([can't link against HDF4 library])
fi

if test "x$HAVE_HDF4" = "xyes"; then
  dnl Check if HDF4 is linked with SZIP encoder

  AC_MSG_CHECKING([for hdf4 szip decoding filter])
  AC_CACHE_VAL([he2_cv_hdf4_szip_can_decode],
      [AC_TRY_RUN([
      #include <hdf.h>

      int main(void)
      {
	comp_coder_t codertype = COMP_CODE_SZIP;
	uint32 configinfo;
	int decoder = 0;

	HCget_config_info(codertype, &configinfo);
	decoder = configinfo & COMP_DECODER_ENABLED;
	if (decoder) exit(0);
	else exit(1);
      }
      ], [he2_cv_hdf4_szip_can_decode=yes], [he2_cv_hdf4_szip_can_decode=no],)])
  if test ${he2_cv_hdf4_szip_can_decode} = "yes"; then
    AC_DEFINE(HAVE_HDF4_SZIP_DECODER, 1,
	    [Define if HDF4 has szip decoder filter])
    AC_MSG_RESULT([yes])
  else
    AC_MSG_RESULT([no])
  fi

  AC_MSG_CHECKING([for hdf4 szip encoding filter])
  AC_CACHE_VAL([he2_cv_hdf4_szip_can_encode],
      [AC_TRY_RUN([
      #include <hdf.h>

      int main(void)
      {
	comp_coder_t codertype = COMP_CODE_SZIP;
	uint32 configinfo;
	int encoder = 0;

	HCget_config_info(codertype, &configinfo);
	encoder = configinfo & COMP_ENCODER_ENABLED;
	if (encoder) exit(0);
	else exit(1);
      }
      ], [he2_cv_hdf4_szip_can_encode=yes], [he2_cv_hdf4_szip_can_encode=no],)])

  if test ${he2_cv_hdf4_szip_can_encode} = "yes"; then
    AC_DEFINE(HAVE_HDF4_SZIP_ENCODER, 1,
	    [Define if HDF4 has szip encoder filter])
    AC_MSG_RESULT([yes])
  else
    AC_MSG_RESULT([no])
  fi

  dnl Check if SZIP linked with HDF4 has the same configuration as SZIP given by --with-szlib option has
  if test ${he2_cv_hdf4_szip_can_decode} = "no"; then
    if test "X$HAVE_SZLIB" = "Xyes"; then
      AC_MSG_ERROR([HDF4 was linked without SZIP, but --with-szlib was given])
    fi
  else
    if test "X$HAVE_SZLIB" != "Xyes"; then
      AC_MSG_ERROR([HDF4 was linked with SZIP, but --with-szlib was not given])
    fi
    if test ${he2_cv_szlib_functional} = "no"; then
      AC_MSG_ERROR([SZIP specified in --with-szlib is not functional])
    fi
    if test ${he2_cv_hdf4_szip_can_encode} = "no"; then
      if test ${he2_cv_szlib_can_encode} = "yes"; then
	AC_MSG_ERROR([HDF4 was linked without SZIP encoder, but yours has SZIP encoder])
      fi
    else
      if test ${he2_cv_szlib_can_encode} = "no"; then
	AC_MSG_ERROR([HDF4 was linked with SZIP encoder, but yours does not have SZIP encoder])
      fi
    fi
  fi
fi

CFLAGS=$CFLAGS

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

# Checks for libraries.

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

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

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_ERROR_AT_LINE
AC_CHECK_FUNCS([memchr memmove memset pow sqrt strchr strstr])

# Add a macro to distinguish automatic configuration from 
# the original configuration; this will affect the handling
# of HDFEOSVersion.h file.
AC_DEFINE([EOS2_AUTO_CONFIG], [1],
            [Define the automatic configuration macro.])


# Check whether testdrivers directory is present. The user might have
# downloaded HDF-EOS2 but not the tests.
AC_MSG_CHECKING([for testdrivers directory])
if test -d "${srcdir}/testdrivers"; then
  TESTDRIVERS_DIR="yes"
  AC_MSG_RESULT([present])

  # If the testdrivers directory is present, see if it contains a file
  # named 'makefile'. If so, rename the file so it doesn't cause
  # confusion later on. 
  if test -e "testdrivers/makefile"; then
    mv testdrivers/makefile testdrivers/makefile_orig
  fi

else
  TESTDRIVERS_DIR="no"
  AC_MSG_RESULT([not found])
  AC_MSG_WARN([testdrivers directory is not present. Tests will not be run])
fi

AC_ARG_ENABLE([install-include],
              [AC_HELP_STRING([--enable-install-include],
                              [HDF-EOS2 normally only installs libraries,
                               assuming that users will use the headers in
                               the include directories. Users who want the
                               standard automake behavoior of installing
                               both libraries and header files should
                               enable this option.])],
              [INSTALL_INCLUDE=$enableval])

AM_CONDITIONAL([TESTDRIVERS_CONDITIONAL], [test "X$TESTDRIVERS_DIR" = "Xyes"])
AM_CONDITIONAL([INSTALL_INCLUDE_CONDITIONAL], [test "X$INSTALL_INCLUDE" = "Xyes"])
AM_CONDITIONAL([F2CFORTRAN_CONDITIONAL], [test "X$F2CFORTRAN_MACRO" = "Xyes"])
AM_CONDITIONAL([F2CFORTRAN_90_CONDITIONAL], [test "X$F2CFORTRAN_90" = "Xyes"])
AM_CONDITIONAL([F2CFORTRAN_32PTR_CONDITIONAL], [test "X$F2CFORTRAN_32PTR" = "Xyes"])
AM_CONDITIONAL([SZIP_ENCODER_CONDITIONAL], [test "X$USE_SZIP_ENCODER" = "Xyes"])

AC_CONFIG_FILES([Makefile
                 include/Makefile
                 src/Makefile
                 samples/Makefile
	         hdf-eos4.pc])

if test "X$TESTDRIVERS_DIR" = "Xyes"; then
  AC_CONFIG_FILES([ testdrivers/Makefile
                 testdrivers/grid/Makefile
                 testdrivers/point/Makefile
                 testdrivers/swath/Makefile])
fi

AC_OUTPUT