1## Process this file with autoconf to produce configure. 2## 3## 4## Copyright by The HDF Group. 5## Copyright by the Board of Trustees of the University of Illinois. 6## All rights reserved. 7## 8## This file is part of HDF. The full HDF copyright notice, including 9## terms governing use, modification, and redistribution, is contained in 10## the COPYING file, which can be found at the root of the source code 11## distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. 12## If you do not have access to either file, you may request a copy from 13## help@hdfgroup.org. 14## 15## 16AC_REVISION($Id$) 17 18## ====================================================================== 19## Initialize configure. 20## ====================================================================== 21## AC_INIT takes the name of the package, the version number, and an 22## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file 23## as its argument. 24## 25## NOTE: Do not forget to change the version number here when we do a 26## release!!! 27## 28AC_INIT([HDF], [4.2.15], [help@hdfgroup.org]) 29AC_CONFIG_SRCDIR([hdf/src/atom.c]) 30AC_CONFIG_AUX_DIR([bin]) 31AC_CONFIG_HEADER([hdf/src/h4config.h]) 32AC_CONFIG_MACRO_DIR([m4]) 33 34## AM_INIT_AUTOMAKE takes a list of options that should be applied to 35## every Makefile.am when automake is run. 36AM_INIT_AUTOMAKE([foreign]) 37 38## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies 39## for Makefiles, configure, etc. If AM_MAINTAINER_MODE 40## is *not* included here, these files will be rebuilt if out of date. 41## This is a problem because if users try to build on a machine with 42## the wrong versions of autoconf and automake, these files will be 43## rebuilt with the wrong versions and bad things can happen. 44## Also, CVS doesn't preserve dependencies between timestamps, so 45## Makefiles will often think rebuilding needs to occur when it doesn't. 46## Developers should './configure --enable-maintainer-mode' to turn on 47## rebuild rules. 48AM_MAINTAINER_MODE 49 50## ---------------------------------------------------------------------- 51## Set prefix default (install directory) to a directory in the build area. 52## This allows multiple src-dir builds within one host. 53AC_PREFIX_DEFAULT([`pwd`/hdf4]) 54 55## Run post processing on files created by configure. 56## src/h4config.h: 57## libhdf4.settings: 58## Remove all lines begun with "#" which are generated by CONDITIONAL's of 59## configure. 60AC_CONFIG_COMMANDS([h4config], [ 61 echo "modifying hdf/src/h4config.h" 62 sed 's/#define /#define H4_/' < hdf/src/h4config.h |\ 63 sed 's/#undef /#undef H4_/' > h4config 64 cp h4config hdf/src/h4config.h 65 rm -f h4config 66 67#if test ! -f hdf/src/h4config.h; then 68# /bin/mv -f h4config hdf/src/h4config.h 69# elif (diff h4config hdf/src/h4config.h >/dev/null); then 70# /bin/rm -f h4config 71# echo "hdf/src/h4config.h is unchanged" 72# else 73# /bin/mv -f h4config hdf/src/h4config.h 74# fi 75 76 echo "Post process libhdf4.settings" 77 sed '/^#/d' < libhdf4.settings > libhdf4.settings.TMP 78 cp libhdf4.settings.TMP libhdf4.settings 79 rm -f libhdf4.settings.TMP 80]) 81 82## ====================================================================== 83## Information on the package 84## ====================================================================== 85 86## Dump all shell variables values. 87AC_MSG_CHECKING([shell variables initial values]) 88set >&AS_MESSAGE_LOG_FD 89AC_MSG_RESULT([done]) 90 91AC_CANONICAL_HOST 92 93## ---------------------------------------------------------------------- 94## Some platforms have broken basename, and/or xargs programs. Check 95## that it actually does what it's supposed to do. Catch this early 96## since configure and scripts relies upon them heavily and there's 97## no use continuing if it's broken. 98## 99AC_MSG_CHECKING([if basename works]) 100BASENAME_TEST="`basename /foo/bar/baz/qux/basename_works`" 101if test $BASENAME_TEST != "basename_works"; then 102 AC_MSG_ERROR([basename program doesn't work]) 103else 104 AC_MSG_RESULT([yes]) 105fi 106 107## xargs basename used in configure to get the CC_BASENAME value 108AC_MSG_CHECKING([if xargs works]) 109XARGS_TEST="`echo /foo/bar/baz/qux/xargs_works | xargs basename`" 110if test $XARGS_TEST != "xargs_works"; then 111 AC_MSG_ERROR([xargs program doesn't work]) 112else 113 AC_MSG_RESULT([yes]) 114fi 115 116## Source any special files that we need. These files normally aren't 117## present but can be used by the maintainers to fine tune things like 118## turning on debug or profiling flags for the compiler. The search order 119## is: 120## 121## CPU-VENDOR-OS 122## VENDOR-OS 123## CPU-OS 124## CPU-VENDOR 125## OS 126## VENDOR 127## CPU 128## 129## If the `OS' ends with a version number then remove it. For instance, 130## `freebsd3.1' would become `freebsd' 131## 132case "$host_os" in 133 aix4.*) host_os_novers="aix4.x" ;; 134 aix5.*) host_os_novers="aix5.x" ;; 135 darwin10.*) host_os_novers="darwin10.x" ;; 136 darwin11.*) host_os_novers="darwin11.x" ;; 137 darwin12.*) host_os_novers="darwin12.x" ;; 138 freebsd*) host_os_novers="freebsd" ;; 139 solaris2.*) host_os_novers="solaris2.x" ;; 140 *) host_os_novers="$host_os" ;; 141esac 142 143host_config="none" 144for f in $host_cpu-$host_vendor-$host_os \ 145 $host_cpu-$host_vendor-$host_os_novers \ 146 $host_vendor-$host_os \ 147 $host_vendor-$host_os_novers \ 148 $host_cpu-$host_os \ 149 $host_cpu-$host_os_novers \ 150 $host_cpu-$host_vendor \ 151 $host_os \ 152 $host_os_novers \ 153 $host_vendor \ 154 $host_cpu ; do 155 AC_MSG_CHECKING([for config $f]) 156 if test -f "$srcdir/config/$f"; then 157 host_config=$srcdir/config/$f 158 AC_MSG_RESULT([found]) 159 break 160 fi 161 AC_MSG_RESULT([no]) 162done 163if test "X$host_config" != "Xnone"; then 164 CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`" 165 F77_BASENAME="`echo $F77 | cut -f1 -d' ' | xargs basename 2>/dev/null`" 166 CXX_BASENAME="`echo $CXX | cut -f1 -d' ' | xargs basename 2>/dev/null`" 167 . $host_config 168fi 169 170## ====================================================================== 171## Checks for NetCDF-2.3.2 support 172## ====================================================================== 173 174# We disable Fortran netCDF APIs and their testing when --disable-netcdf is used. 175# Let's define a proper variable to be used in mfhdf/testfortran.sh.in to run 176# the netCDF Fortran APIs test program "ftest". 177AC_SUBST(TEST_FORTRAN_NETCDF) TEST_FORTRAN_NETCDF="yes" 178 179AC_ARG_ENABLE([netcdf], 180 [AS_HELP_STRING([--enable-netcdf], 181 [Build HDF4 versions of NetCDF APIs (version 2.3.2) [default=yes]])],, 182 [enableval="yes"]) 183 184case "$enableval" in 185 yes) 186 BUILD_NETCDF="yes" 187 AC_DEFINE([HAVE_NETCDF], [1], [Define if we support HDF NetCDF APIs version 2.3.2]) 188 ;; 189 no) 190 BUILD_NETCDF="no" 191 TEST_FORTRAN_NETCDF="no" 192 ;; 193esac 194AM_CONDITIONAL([HDF_BUILD_NETCDF], [test "X$BUILD_NETCDF" = "Xyes"]) 195AC_SUBST([BUILD_NETCDF]) 196 197## ====================================================================== 198## Checks for programs 199## ====================================================================== 200 201AC_PROG_MAKE_SET 202 203AC_PROG_CC 204AC_PROG_CPP 205AC_PROG_CXX 206 207AC_ARG_ENABLE([fortran], 208 [AS_HELP_STRING([--enable-fortran], 209 [Build Fortran into library [default=yes]])],, 210 [enableval="yes"]) 211 212case "$enableval" in 213 yes) 214 BUILD_FORTRAN="yes" 215 AC_PROG_F77 216 AC_F77_WRAPPERS 217 218 if test "X$F77" = "X"; then 219 BUILD_FORTRAN="no" 220 fi 221 ;; 222 no) 223 BUILD_FORTRAN="no" 224 F77="no" 225 ;; 226esac 227AM_CONDITIONAL([HDF_BUILD_FORTRAN], [test "X$BUILD_FORTRAN" = "Xyes"]) 228AC_SUBST([BUILD_FORTRAN]) 229 230## ---------------------------------------------------------------------- 231## Check if they would like the Java native interface (JNI) compiled 232## 233AC_SUBST([JNIFLAGS]) 234AC_SUBST([H4_JAVACFLAGS]) 235AC_SUBST([H4_JAVAFLAGS]) 236 237## This needs to be exposed for the library info file even if Java is disabled. 238AC_SUBST([HDF_JAVA]) 239 240## Default is no Java 241HDF_JAVA=no 242 243AC_SUBST([H4_CLASSPATH]) H4_CLASSPATH="" 244AC_MSG_CHECKING([if Java JNI interface enabled]) 245 246AC_ARG_ENABLE([java], 247 [AS_HELP_STRING([--enable-java], 248 [Compile the Java JNI interface [default=no]])], 249 [HDF_JAVA=$enableval]) 250 251if test "X$HDF_JAVA" = "Xyes"; then 252 if test "X${enable_shared}" != "Xno"; then 253 echo "yes" 254 if test "X$CLASSPATH" = "X"; then 255 H4_CLASSPATH=".:$srcdir/java/lib" 256 else 257 H4_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib" 258 fi 259 ## Checks for programs. 260 AX_JAVA_OPTIONS 261 H4_JAVACFLAGS=$JAVACFLAGS 262 H4_JAVAFLAGS=$JAVAFLAGS 263 AX_PROG_JAVAC 264 AX_PROG_JAVA 265 AX_PROG_JAR 266 AX_PROG_JAVADOC 267 ## Find the include directories needed for building JNI code 268 AX_JNI_INCLUDE_DIR() 269 for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS 270 do 271 JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR" 272 done 273 ## Find junit for testing the JNI code 274 AX_CHECK_CLASSPATH() 275 CLASSPATH_ENV=$H4_CLASSPATH 276 AX_CHECK_JUNIT() 277 AX_CHECK_JAVA_HOME 278 279 AC_MSG_RESULT([yes]) 280 else 281 AC_MSG_ERROR([Java requires shared libraries to be built]) 282 HDF_JAVA="no" 283 AC_MSG_RESULT([no]) 284 fi 285else 286 AC_MSG_RESULT([no]) 287fi 288 289## ------------------------------------------------------------------------- 290## Build static libraries by default. Furthermore, fortran shared libraries 291## are unsupported. Disallow a user from enabling both shared libraries and 292## fortran. 293if test "X${enable_shared}" != "Xyes"; then 294 enable_shared="no" 295fi 296 297if test "X${enable_shared}" = "Xyes"; then 298 if test "X${BUILD_FORTRAN}" = "Xyes"; then 299 AC_MSG_ERROR([Cannot build shared fortran libraries. Please configure with --disable-fortran flag.]) 300 fi 301fi 302 303AC_PROG_INSTALL 304AC_PROG_LN_S 305 306AC_CHECK_PROGS([AR], [ar xar], [:], [$PATH]) 307 308AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [none], []) 309 310if test "$YACC" = "none"; then 311 AC_MSG_ERROR([cannot find yacc utility]) 312fi 313 314AC_CHECK_PROGS([LEX], [flex lex], [none], []) 315 316if test "$LEX" = "none"; then 317 AC_MSG_ERROR([cannot find lex utility]) 318fi 319 320AC_CHECK_PROG([DIFF], [diff], [diff -w]) 321AC_CHECK_PROG([MAKEINFO], [makeinfo], [makeinfo]) 322AC_CHECK_PROG([NEQN], [neqn], [neqn]) 323AC_CHECK_PROG([TBL], [tbl], [tbl]) 324 325AC_SUBST([AR]) 326AC_SUBST([DIFF]) 327AC_SUBST([STATIC_SHARED]) 328AC_SUBST([SHARED_EXTENSION]) 329AC_SUBST([enable_shared]) 330AC_SUBST([enable_static]) 331AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` 332AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no 333AC_SUBST([LT_STATIC_EXEC]) 334 335## ====================================================================== 336## Libtool initialization 337## ====================================================================== 338LT_INIT([dlopen disable-shared]) 339LT_OUTPUT 340 341## ---------------------------------------------------------------------- 342## Check if we should install only statically linked executables. 343## This check needs to occur after libtool is initialized because 344## we check a libtool cache value and may issue a warning based 345## on its result. 346AC_MSG_CHECKING([if we should install only statically linked executables]) 347AC_ARG_ENABLE([static_exec], 348 [AS_HELP_STRING([--enable-static-exec], 349 [Install only statically linked executables 350 [default=no]])], 351 [STATIC_EXEC=$enableval]) 352 353if test "X$STATIC_EXEC" = "Xyes"; then 354 echo "yes" 355 ## Issue a warning if -static flag is not supported. 356 if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then 357 echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." 358 fi 359 LT_STATIC_EXEC="-all-static" 360else 361 echo "no" 362 LT_STATIC_EXEC="" 363fi 364 365AC_SUBST([LT_STATIC_EXEC]) 366 367## ====================================================================== 368## Checks for libraries 369## ====================================================================== 370 371## ---------------------------------------------------------------------- 372## Fake --with-xxx option to allow us to create a help message for the 373## following --with-xxx options which can take either a =DIR or =INC,LIB 374## specifier. 375## 376AC_ARG_WITH([fnord], 377 [ 378 For the following --with-xxx options, you can specify where the header 379 files and libraries are in two different ways: 380 381 --with-xxx=INC,LIB - Specify individually the include directory and 382 library directory separated by a comma 383 --with-xxx=DIR - Specify only the directory which contains the 384 include/ and lib/ subdirectories 385 ]) 386 387## ---------------------------------------------------------------------- 388## Is the GNU zlib present? It has a header file `zlib.h' and a library 389## `-lz' and their locations might be specified with the `--with-zlib' 390## command-line switch. The value is an include path and/or a library path. 391## If the library path is specified then it must be preceded by a comma. 392AC_ARG_WITH([zlib], 393 [AS_HELP_STRING([--with-zlib=DIR], 394 [Use zlib library [default=yes]])],, 395 [withval=yes]) 396 397case "X-$withval" in 398 X-yes) 399 HAVE_ZLIB="yes" 400 AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) 401 if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then 402 AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB]) 403 fi 404 if test -z "$HAVE_ZLIB"; then 405 if test -n "$HDF4_CONFIG_ABORT"; then 406 AC_MSG_ERROR([couldn't find zlib library]) 407 fi 408 else 409 AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) 410 fi 411 ;; 412 X-|X-no|X-none) 413 HAVE_ZLIB="no" 414 AC_MSG_ERROR([zlib library required to build HDF4]) 415 ;; 416 *) 417 HAVE_ZLIB="yes" 418 case "$withval" in 419 *,*) 420 zlib_inc="`echo $withval | cut -f1 -d,`" 421 zlib_lib="`echo $withval | cut -f2 -d, -s`" 422 ;; 423 *) 424 if test -n "$withval"; then 425 zlib_inc="$withval/include" 426 zlib_lib="$withval/lib" 427 fi 428 ;; 429 esac 430 431 ## Trying to include -I/usr/include and -L/usr/lib is redundant and 432 ## can mess some compilers up. 433 if test "X$zlib_inc" = "X/usr/include"; then 434 zlib_inc="" 435 fi 436 if test "X$zlib_lib" = "X/usr/lib"; then 437 zlib_lib="" 438 fi 439 440 if test -n "$zlib_inc"; then 441 CPPFLAGS="$CPPFLAGS -I$zlib_inc" 442 fi 443 444 AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB]) 445 446 if test -n "$zlib_lib"; then 447 LDFLAGS="$LDFLAGS -L$zlib_lib" 448 fi 449 450 if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then 451 AC_CHECK_LIB([z], [compress2],, [unset HAVE_ZLIB]) 452 fi 453 454 if test -z "$HAVE_ZLIB"; then 455 AC_MSG_ERROR([couldn't find zlib library]) 456 else 457 AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) 458 fi 459 ;; 460esac 461 462## ---------------------------------------------------------------------- 463## Is the JPEG library present? 464AC_ARG_WITH([jpeg], 465 [AS_HELP_STRING([--with-jpeg=DIR], 466 [Use jpeg library [default=yes]])],, 467 [withval=yes]) 468 469case "X-$withval" in 470 X-yes) 471 HAVE_JPEG="yes" 472 AC_CHECK_HEADERS([jpeglib.h], [HAVE_JPEG_H="yes"], [unset HAVE_JPEG]) 473 if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then 474 AC_CHECK_LIB([jpeg], [jpeg_start_decompress],, [unset HAVE_JPEG]) 475 fi 476 477 if test -z "$HAVE_JPEG"; then 478 AC_MSG_ERROR([couldn't find jpeg library]) 479 fi 480 ;; 481 X-|X-no|X-none) 482 HAVE_JPEG="no" 483 AC_MSG_ERROR([jpeg library required to build HDF4]) 484 ;; 485 *) 486 HAVE_JPEG="yes" 487 case "$withval" in 488 *,*) 489 jpeg_inc="`echo $withval | cut -f1 -d,`" 490 jpeg_lib="`echo $withval | cut -f2 -d, -s`" 491 ;; 492 *) 493 if test -n "$withval"; then 494 jpeg_inc="$withval/include" 495 jpeg_lib="$withval/lib" 496 fi 497 ;; 498 esac 499 500 ## Trying to include -I/usr/include and -L/usr/lib is redundant and 501 ## can mess some compilers up. 502 if test "X$jpeg_inc" = "X/usr/include"; then 503 jpeg_inc="" 504 fi 505 if test "X$jpeg_lib" = "X/usr/lib"; then 506 jpeg_lib="" 507 fi 508 509 if test -n "$jpeg_inc"; then 510 CPPFLAGS="$CPPFLAGS -I$jpeg_inc" 511 fi 512 513 AC_CHECK_HEADERS([jpeglib.h], [HAVE_JPEG_H="yes"], [unset HAVE_JPEG]) 514 515 if test -n "$jpeg_lib"; then 516 LDFLAGS="$LDFLAGS -L$jpeg_lib" 517 fi 518 519 if test "x$HAVE_JPEG" = "xyes" -a "x$HAVE_JPEG_H" = "xyes"; then 520 AC_CHECK_LIB([jpeg], [jpeg_start_decompress],, [unset HAVE_JPEG]) 521 fi 522 523 if test -z "$HAVE_JPEG"; then 524 AC_MSG_ERROR([couldn't find jpeg library]) 525 fi 526 ;; 527esac 528 529## ---------------------------------------------------------------------- 530## Is the szip library present? 531AC_SUBST(USE_COMP_SZIP) USE_COMP_SZIP="no" 532AC_SUBST(SZIP_HAS_ENCODER) SZIP_HAS_ENCODER="no" 533AC_ARG_WITH([szlib], 534 [AS_HELP_STRING([--with-szlib=DIR], 535 [Use szlib library [default=no]])],, 536 [withval=no]) 537 538case "X-$withval" in 539 X-yes) 540 HAVE_SZIP="yes" 541 AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP]) 542 if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then 543 AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP]) 544 fi 545 546 if test -z "$HAVE_SZIP"; then 547 AC_MSG_ERROR([couldn't find szlib library]) 548 fi 549 ;; 550 X-|X-no|X-none) 551 HAVE_SZIP="no" 552 AC_MSG_CHECKING([for szlib]) 553 AC_MSG_RESULT([suppressed]) 554 SZIP_INFO="${SZIP_INFO}disabled" 555 ;; 556 *) 557 HAVE_SZIP="yes" 558 case "$withval" in 559 *,*) 560 szip_inc="`echo $withval | cut -f1 -d,`" 561 szip_lib="`echo $withval | cut -f2 -d, -s`" 562 ;; 563 *) 564 if test -n "$withval"; then 565 szip_inc="$withval/include" 566 szip_lib="$withval/lib" 567 fi 568 ;; 569 esac 570 571 ## Trying to include -I/usr/include and -L/usr/lib is redundant and 572 ## can mess some compilers up. 573 if test "X$szip_inc" = "X/usr/include"; then 574 szip_inc="" 575 fi 576 if test "X$szip_lib" = "X/usr/lib"; then 577 szip_lib="" 578 fi 579 580 if test -n "$szip_inc"; then 581 CPPFLAGS="$CPPFLAGS -I$szip_inc" 582 fi 583 584 AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZIP]) 585 586 if test -n "$szip_lib"; then 587 LDFLAGS="$LDFLAGS -L$szip_lib" 588 fi 589 590 if test "x$HAVE_SZIP" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then 591 AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [unset HAVE_SZIP]) 592 fi 593 594 if test -z "$HAVE_SZIP"; then 595 AC_MSG_ERROR([couldn't find szlib library]) 596 else 597 USE_COMP_SZIP="yes" 598 fi 599 ;; 600esac 601 602## Check to see if SZIP has encoder 603if test "X$HAVE_SZIP" = "Xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then 604 ## SZLIB library is available. Check if it can encode. 605 AC_MSG_CHECKING([for szlib encoder]) 606 607 ## Set LD_LIBRARY_PATH so encoder test can find the library and run. 608 if test -z "$LD_LIBRARY_PATH"; then 609 export LD_LIBRARY_PATH="$szip_lib" 610 else 611 export LD_LIBRARY_PATH="${szip_lib}:$LD_LIBRARY_PATH" 612 fi 613 614 AC_SUBST([LL_PATH]) LL_PATH="$LD_LIBRARY_PATH" 615 616 AC_TRY_RUN([ 617 #include <stdlib.h> 618 #include <szlib.h> 619 620 int main(void) 621 { 622 /* SZ_encoder_enabled returns 1 if encoder is present */ 623 if (SZ_encoder_enabled() == 1) 624 exit(0); 625 else 626 exit(1); 627 } 628 ], [CAN_ENCODE="yes"], [CAN_ENCODE="no"],) 629 630 ## Report szip encoder test results 631 if test "X$CAN_ENCODE" = "Xyes"; then 632 AC_MSG_RESULT([yes]) 633 fi 634 if test "X$CAN_ENCODE" = "Xno"; then 635 AC_MSG_RESULT([no]) 636 fi 637 638 ## Add "szip" to external filter list 639 if test "X$CAN_ENCODE" = "Xyes"; then 640 if test "X$SZIP_INFO" != "X"; then 641 SZIP_INFO="${SZIP_INFO}" 642 fi 643 SZIP_INFO="${SZIP_INFO}enabled with encoder" 644 fi 645 646 if test "X$CAN_ENCODE" = "Xno"; then 647 if test "X$SZIP_INFO" != "X"; then 648 SZIP_INFO="${SZIP_INFO}" 649 fi 650 SZIP_INFO="${SZIP_INFO}enabled with decoder only" 651 fi 652 653 ## Create macro to specify if encoder is present 654 if test "X$CAN_ENCODE" = "Xyes"; then 655 AC_DEFINE([HAVE_SZIP_ENCODER], [1], 656 [Define if szip has encoder]) 657 SZIP_HAS_ENCODER="yes" 658 fi 659fi 660AC_SUBST([SZIP_INFO]) 661AC_SUBST([SZIP_HAS_ENCODER]) 662 663AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_COMP_SZIP" = "Xyes" && test "X$LL_PATH" != "X"]) 664 665## ---------------------------------------------------------------------- 666## Is XDR support present? The TRY_LINK info was gotten from the 667## mfhdf/libsrc/local_nc.c file. 668AC_MSG_CHECKING([for xdr library support]) 669 670AC_ARG_ENABLE([hdf4-xdr], 671 [AS_HELP_STRING([--enable-hdf4-xdr], 672 [Build xdr library from code in HDF4 source. 673 Not supported for 64 bit mode. [default="no"]])], 674 [enableval="yes"],[enableval="no"]) 675 676case "$enableval" in 677 yes) 678 BUILD_XDR="yes" 679 AC_MSG_RESULT([using HDF4 XDR]); 680 ;; 681 no) 682 BUILD_XDR="no" 683 ;; 684esac 685 686 687## Check headers and add libraries for XDR if the HDF4 XDR library is not used. 688if test "X$BUILD_XDR" != "Xyes"; then 689 ## For Solaris systems, add the -nsl for XDR support 690 ## 691 ## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support 692 ## ====================================================================== 693 ## Checks for header files 694 ## ====================================================================== 695 HAVE_RPC="yes" 696 HAVE_OLDRPC="yes" 697 HAVE_TIRPC="yes" 698 ## save current settings 699 SYSCPPFLAGS="$CPPFLAGS" 700 case "$host" in 701 *-solaris*) 702 LIBS="$LIBS -lnsl" 703 ;; 704 *-pc-cygwin* | *-linux*) 705 CPPFLAGS="$SYSCPPFLAGS" 706 AC_CHECK_HEADER([rpc/rpc.h],[:], [unset HAVE_OLDRPC]) 707 if test -z "$HAVE_OLDRPC" ; then 708 LIBS="$LIBS -ltirpc" 709 CPPFLAGS="$SYSCPPFLAGS -I/usr/include/tirpc" 710 AC_CHECK_HEADER([rpc/rpc.h],[:], [unset HAVE_TIRPC]) 711 if test -z "$HAVE_TIRPC" ; then 712 CPPFLAGS="$SYSCPPFLAGS" 713 AC_MSG_ERROR([couldn't find rpc headers]) 714 fi 715 else 716 HAVE_TIRPC="" 717 fi 718 ;; 719 *) ;; 720 esac 721 722 ## ---------------------------------------------------------------------- 723 ## We're trying to link against the rpc library when building on Cygwin, 724 ## but we need to make sure that it is present on the system. Do that here, 725 ## The SunRPC of the glibc has been replaced by a TI-RPC (Transport Independent RPC) library for IPv6 support 726 case "$host" in 727 *-pc-cygwin* | *-linux*) 728 if test -n "$HAVE_TIRPC"; then 729 AC_CHECK_LIB([tirpc], [xdr_opaque],[:], [unset HAVE_RPC]) 730 if test -z "$HAVE_RPC"; then 731 AC_MSG_ERROR([couldn't find rpc library]) 732 fi 733 fi 734 ;; 735 esac 736 737 AC_TRY_LINK([ 738 #include <rpc/types.h> 739 #include <rpc/xdr.h>], [xdr_int], 740 [AC_MSG_RESULT([yes]); BUILD_XDR="no"], 741 [AC_MSG_RESULT([no]); BUILD_XDR="yes"]) 742fi 743 744if test "X$BUILD_XDR" != "Xno"; then 745 AC_DEFINE([NO_SYS_XDR_INC], [1], [Not using system xdr]) 746fi 747 748AM_CONDITIONAL([HDF_BUILD_XDR], [test "X$BUILD_XDR" = "Xyes"]) 749 750AC_HEADER_STDC 751AC_HEADER_RESOLV 752## ====================================================================== 753## Checks for types 754## ====================================================================== 755 756## ====================================================================== 757## Checks for endianness functions 758## The htons and ntohs functions are available on most systems. 759## These functions convert betweennetwork endiannessand hostendianness. 760## Network endianness is big-endian; because the standard TCP/IP network 761## protocols use big-endian ordering. These functions come in two sizes: 762## htonl and ntohl operate on 4-byte quantities, and 763## htons and ntohs operate on 2-byte quantities. 764## The hton functions convert host endianness to network endianness. 765## The ntoh functions convert network endianness to host endianness 766## ====================================================================== 767AC_CHECK_FUNCS([htonl htons ntohl ntohs __builtin_bswap16 __builtin_bswap32 __builtin_bswap64]) 768 769## ====================================================================== 770## Checks for structures 771## ====================================================================== 772AC_CHECK_HEADERS([sys/time.h sys/file.h sys/resource.h]) 773 774## ====================================================================== 775## Checks for compiler characteristics 776## ====================================================================== 777AC_CHECK_HEADERS([stddef.h io.h]) 778AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h]) 779 780AC_PROG_CC_C_O 781AC_PROG_CXXCPP 782 783if test "X$BUILD_FORTRAN" = "Xyes"; then 784 AC_PROG_F77_C_O 785fi 786 787## This is a bit of a hack. The AC_CHECK_SIZEOF macro is supposed to 788## #define a value in a header file. However, we don't use a generated 789## header file. So I check the value left over from autoconf's test is 790## >= 8. 791AC_CHECK_SIZEOF([int*]) 792 793if test $ac_cv_sizeof_intp -ge 8; then 794# CPPFLAGS="$CPPFLAGS -DBIG_LONGS" 795 AC_DEFINE([BIG_LONGS], [1], [int* greater or equal to 8 bytes]) 796 797 ## Define super secret special flag for AIX machines in 64-bit mode. 798 case "${host}" in 799 *-ibm-aix*) CPPFLAGS="$CPPFLAGS -DAIX5L64" ;; 800 *) ;; 801 esac 802# if test "X$BUILD_XDR" = "Xyes"; then 803# AC_MSG_ERROR([--enable-hdf4-xdr is not supported for 64 bit mode.]) 804# fi 805fi 806 807## ---------------------------------------------------------------------- 808## Set some variables for general configuration information to be saved 809## and installed with the libraries. 810## 811 812## HDF4 version from the first line of the README.txt file. 813H4_VERSION="`cut -d' ' -f3 $srcdir/README.txt | head -1`" 814AC_SUBST([H4_VERSION]) 815 816## Configuration date 817AC_SUBST([CONFIG_DATE]) CONFIG_DATE="`date`" 818 819## User doing the configuration 820AC_SUBST([CONFIG_USER]) CONFIG_USER="`whoami`@`hostname`" 821 822## Configuration mode (production, development, etc) 823AC_SUBST([CONFIG_MODE]) 824 825AC_C_BIGENDIAN([], []) 826 827## Are we building this in debug or production mode? (Remove the -g flag 828## in production mode.) 829AC_MSG_CHECKING([for build mode]) 830AC_ARG_ENABLE([production], 831 [AS_HELP_STRING([--enable-production], 832 [Determines how to run the compiler.])]) 833 834case "X-$enable_production" in 835 X-|X-yes) 836 AC_MSG_RESULT([production]) 837 CONFIG_MODE=production 838 ## Remove the "-g" flag from compile line if it's in there. 839 CFLAGS_temp="" 840 if test -n "$CFLAGS"; then 841 for d in $CFLAGS ; do 842 if test "X$d" != "X-g"; then 843 CFLAGS_temp="$CFLAGS_temp $d" 844 fi 845 done 846 CFLAGS=$CFLAGS_temp 847 fi 848 849 FFLAGS_temp="" 850 if test -n "$FFLAGS"; then 851 for d in $FFLAGS ; do 852 if test "X$d" != "X-g"; then 853 FFLAGS_temp="$FFLAGS_temp $d" 854 fi 855 done 856 FFLAGS=$FFLAGS_temp 857 fi 858 859 CXXFLAGS_temp="" 860 if test -n "$CXXFLAGS"; then 861 for d in $CXXFLAGS ; do 862 if test "X$d" != "X-g"; then 863 CXXFLAGS_temp="$CXXFLAGS_temp $d" 864 fi 865 done 866 CXXFLAGS=$CXXFLAGS_temp 867 fi 868 869 CFLAGS="$CFLAGS $PROD_CFLAGS" 870 CXXFLAGS="$CXXFLAGS $PROD_CXXFLAGS" 871 FFLAGS="$FFLAGS $PROD_FFLAGS" 872 CPPFLAGS="$CPPFLAGS $PROD_CPPFLAGS" 873 ;; 874 X-no) 875 AC_MSG_RESULT([development]) 876 CONFIG_MODE=development 877 CFLAGS="$CFLAGS $DEBUG_CFLAGS" 878 FFLAGS="$FFLAGS $DEBUG_FFLAGS" 879 CXXFLAGS="$CXXFLAGS $DEBUG_CXXFLAGS" 880 CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS" 881 ;; 882 *) 883 AC_MSG_RESULT([user-defined]) 884 ;; 885esac 886 887## ====================================================================== 888## Checks for library functions 889## ====================================================================== 890 891AC_MSG_CHECKING([for math library support]) 892AC_TRY_LINK([#include <math.h>], [sinh(37.927)], 893 [AC_MSG_RESULT([yes])], 894 [AC_MSG_RESULT([no]); LIBS="$LIBS -lm"]) 895 896AC_CHECK_FUNCS([fork system vfork wait]) 897 898 899## ====================================================================== 900## Checks for system services 901## ====================================================================== 902 903## Copy NetCDF header files. 904# 905## FIXME: This is code stolen^Wborrowed from the old HDF4 configure. 906## These header files should probably be generated by autoconf instead 907## of being copied depending upon the host. 908case "$host" in 909 *-linux*) BAR="linux" ;; 910 *-freebsd*) BAR="fbsd" ;; 911 *-ibm-aix*) BAR="aix" ;; 912 sparc64-*-solaris2*) BAR="solaris64" ;; 913 *-*-solaris2*) BAR="solaris" ;; 914 *-apple*) BAR="apple" ;; 915 *-pc-cygwin*) BAR="linux" ;; 916 *) echo "*** unknown host $host!"; exit 1 ;; 917esac 918src_files="" 919src_files="`echo $src_files | sed -e s/FOO/${BAR}/g`" 920 921for config_file in $src_files; do 922 src_file="${srcdir}/`echo $config_file | sed -e s/:.*$//`" 923 target_file="`echo $config_file | sed -e s/^[[^:]]*://g`" 924 925 if test ! -r ${src_file}; then 926 echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2 927 echo '***' "since the file \"${src_file}\" does not exist." 1>&2 928 exit 1 929 fi 930 931 ## this sed command emulates the dirname command 932 dstdir=`echo "$target_file" | sed -e 's,[[^/]]*$,,;s,/$,,;s,^$,.,'` 933 934 ## Create directory for the target_file if it's not there. 935 if test ! -d $dstdir; then 936 ${srcdir}/bin/mkinstalldirs $dstdir 937 fi 938 939 echo "Copying \"${src_file}\" to \"${target_file}\" ." 940 cp ${src_file} ${target_file} 941 942 if test ! -r ${target_file}; then 943 echo '***' "${progname}: cannot copy file \"${target_file}\"," 1>&2 944 exit 1 945 fi 946done 947 948## ------------------------------------------------------------------------ 949## Check to see if libtool has enabled shared libraries. Set a conditional 950## as some Makefiles will build based on availability of shared libraries. 951if (./libtool --features | grep '^enable shared libraries' > /dev/null); then 952 enable_shared=yes 953else 954 enable_shared=no 955fi 956 957## ------------------------------------------------------------------------ 958## Specify shared library extension the host machine should recognize. 959case "$host_os" in 960 darwin*) 961 SHARED_EXTENSION="dylib" 962 ;; 963 *) 964 SHARED_EXTENSION="so" 965 ;; 966esac 967 968## We don't need to say when we're entering directories if we're using 969## GNU make because make does it for us. 970if test "X$GMAKE" = "Xyes"; then 971 AC_SUBST([SETX]) SETX=":" 972else 973 AC_SUBST([SETX]) SETX="set -x" 974fi 975 976AM_CONDITIONAL([HDF_BUILD_SHARED], [test "X$enable_shared" = "Xyes"]) 977 978## Compiler with version information. This consists of the full path 979## name of the compiler and the reported version number. 980AC_SUBST([CC_VERSION]) 981## Strip anything that looks like a flag off of $CC 982CC_NOFLAGS=`echo $CC | sed 's/ -.*//'` 983 984if `echo $CC_NOFLAGS | grep ^/ >/dev/null 2>&1`; then 985 CC_VERSION="$CC" 986else 987 CC_VERSION="$CC"; 988 for x in `echo $PATH | sed -e 's/:/ /g'`; do 989 if test -x $x/$CC_NOFLAGS; then 990 CC_VERSION="$x/$CC" 991 break 992 fi 993 done 994fi 995 996 997## ---------------------------------------------------------------------- 998## 999## If --enable-static-exec and are specified together, there will be ld failures for 1000## "attempted static link of dynamic object" when the tools are built. This check 1001## will prevent that error during configure instead. It could go with the other 1002## --enable-static-exec checks, but since enable_static is set by default later in 1003## the configure process this check has to be delayed. 1004if test "X$STATIC_EXEC" = "Xyes"; then 1005 if test "X${enable_static}" != "Xyes"; then 1006 AC_MSG_ERROR([--enable-static-exec flag to build static executables requires static libraries. Please configure with --enable-static flag.]) 1007 fi 1008fi 1009 1010## This part doesn't work yet since HDF4 config files do not contain 1011## information for cc_vendor and cc_version as HDF4 similar files do. 1012## Needs to be fixed EIP 2010-01-21 1013## if test -n "$cc_vendor" && test -n "$cc_version"; then 1014## CC_VERSION="$CC_VERSION ($cc_vendor-$cc_version)" 1015## fi 1016 1017if test -n "$cc_version_info"; then 1018 CC_VERSION="$CC_VERSION ( $cc_version_info)" 1019fi 1020 1021## Fortran compiler with version information. This consists of the full path 1022## name of the compiler and the reported version number. 1023AC_SUBST([F77_VERSION]) 1024## Strip anything that looks like a flag off of $F77 1025F77_NOFLAGS=`echo $F77 | sed 's/ -.*//'` 1026 1027if `echo $F77_NOFLAGS | grep ^/ >/dev/null 2>&1`; then 1028 F77_VERSION="$F77" 1029else 1030 F77_VERSION="$F77"; 1031 for x in `echo $PATH | sed -e 's/:/ /g'`; do 1032 if test -x $x/$F77_NOFLAGS; then 1033 F77_VERSION="$x/$F77" 1034 break 1035 fi 1036 done 1037fi 1038if test -n "$fc_version_info"; then 1039 F77_VERSION="$F77_VERSION ( $fc_version_info)" 1040fi 1041 1042## This part doesn't work yet since HDF4 config files do not contain 1043## information for fortran_vendor and fortran_version. 1044## Needs to be fixed EIP 2010-01-21 1045## if test -n "$fortran_vendor" && test -n "$fortran_version"; then 1046## F77_VERSION="$F77_VERSION ($fortran_vendor-$fortran_version)" 1047## fi 1048 1049AC_SUBST([JAVA_VERSION]) 1050## Strip anything that looks like a flag off of $JAVA 1051JAVA_NOFLAGS=`echo $JAVA | sed 's/ -.*//'` 1052 1053if `echo $JAVA_NOFLAGS | grep ^/ >/dev/null 2>&1`; then 1054 JAVA_VERSION="$JAVA" 1055else 1056 JAVA_VERSION="$JAVA"; 1057 for x in `echo $PATH | sed -e 's/:/ /g'`; do 1058 if test -x $x/$JAVA_NOFLAGS; then 1059 JAVA_VERSION="$x/$JAVA" 1060 break 1061 fi 1062 done 1063fi 1064java_version_info=`$JAVA -version 2>&1 |\ 1065 grep 'version' | sed -e 's/version "//' | sed -e 's/"//'` 1066if test -n "$java_version_info"; then 1067 JAVA_VERSION="$JAVA_VERSION ($java_version_info)" 1068fi 1069AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"]) 1070 1071## ---------------------------------------------------------------------- 1072## Enable deprecated public API symbols 1073## 1074AC_SUBST([DEPRECATED_SYMBOLS]) 1075AC_MSG_CHECKING([if deprecated public symbols are available]); 1076AC_ARG_ENABLE([deprecated-symbols], 1077 [AS_HELP_STRING([--enable-deprecated-symbols], 1078 [Enable deprecated public API symbols [default=yes]])], 1079 [DEPREC_SYMBOLS=$enableval], 1080 [DEPREC_SYMBOLS=yes]) 1081 1082case "X-$DEPREC_SYMBOLS" in 1083 X-yes) 1084 AC_MSG_RESULT([yes]) 1085 DEPRECATED_SYMBOLS=yes 1086 ;; 1087 X-no|*) 1088 AC_MSG_RESULT([no]) 1089 DEPRECATED_SYMBOLS=no 1090 AC_DEFINE([NO_DEPRECATED_SYMBOLS], [1], 1091 [Define if deprecated public API symbols are disabled]) 1092 ;; 1093esac 1094 1095AC_CONFIG_FILES([Makefile 1096 libhdf4.settings 1097 hdf/Makefile 1098 hdf/examples/Makefile 1099 hdf/fortran/Makefile 1100 hdf/fortran/examples/Makefile 1101 hdf/src/Makefile 1102 hdf/test/Makefile 1103 hdf/util/Makefile 1104 hdf/util/h4cc 1105 hdf/util/h4fc 1106 hdf/util/h4redeploy 1107 hdf/util/testutil.sh 1108 man/Makefile 1109 mfhdf/fortran/ftest.f 1110 mfhdf/fortran/jackets.c 1111 mfhdf/fortran/netcdf.inc 1112 mfhdf/libsrc/netcdf.h 1113 mfhdf/Makefile 1114 mfhdf/dumper/Makefile 1115 mfhdf/dumper/testhdp.sh 1116 mfhdf/examples/Makefile 1117 mfhdf/examples/testexamples.sh 1118 mfhdf/fortran/Makefile 1119 mfhdf/fortran/examples/Makefile 1120 mfhdf/fortran/testfortran.sh 1121 mfhdf/hdfimport/Makefile 1122 mfhdf/hdfimport/testutil.sh 1123 mfhdf/hdiff/Makefile 1124 mfhdf/hdiff/testhdiff.sh 1125 mfhdf/hrepack/Makefile 1126 mfhdf/hrepack/hrepack.sh 1127 mfhdf/hrepack/hrepack_all.sh 1128 mfhdf/libsrc/Makefile 1129 mfhdf/ncdump/Makefile 1130 mfhdf/ncdump/testncdump.sh 1131 mfhdf/ncgen/Makefile 1132 mfhdf/ncgen/testncgen.sh 1133 mfhdf/nctest/Makefile 1134 mfhdf/test/Makefile 1135 mfhdf/test/testmfhdf.sh 1136 mfhdf/xdr/Makefile 1137 java/Makefile 1138 java/src/Makefile 1139 java/src/jni/Makefile 1140 java/test/Makefile 1141 java/test/junit.sh 1142 java/examples/Makefile]) 1143 1144AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes; 1145 $MKDIR_P java/test/.classes; 1146 $MKDIR_P java/examples/.classes]) 1147 1148AC_OUTPUT 1149 1150## A temporary patch. These code were after where it did 1151## cp config/netcdf-XXX.h netcdf.h before. 1152## Moved it here after AC_CONFIG_FILES(... mfhdf/libsrc/netcdf.h ). 1153## Need a better and correct solution. 1154## 1155if test "X$BUILD_NETCDF" != "Xyes"; then 1156 echo "Renaming \"mfhdf/libsrc/netcdf.h\" to \"mfhdf/libsrc/hdf4_netcdf.h\" ." 1157 mv mfhdf/libsrc/netcdf.h mfhdf/libsrc/hdf4_netcdf.h 1158fi 1159 1160chmod 755 hdf/util/h4cc hdf/util/h4redeploy 1161 1162if test "X$BUILD_FORTRAN" = "Xyes"; then 1163 chmod 755 hdf/util/h4fc 1164fi 1165 1166## show the configure settings 1167cat libhdf4.settings 1168 1169