[hdf4] 01/10: Imported Upstream version 4.2.12

Bas Couwenberg sebastic at debian.org
Thu Jun 30 23:23:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository hdf4.

commit 61cb233736e931e6df50862ab99b24c8290b578d
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Jun 30 19:38:15 2016 +0200

    Imported Upstream version 4.2.12
---
 CMakeFilters.cmake                                 |   45 +-
 CMakeInstallation.cmake                            |  257 +-
 CMakeLists.txt                                     |  197 +-
 COPYING                                            |    2 +-
 CTestConfig.cmake                                  |    4 +-
 MANIFEST                                           |  119 +-
 Makefile.am                                        |    8 +-
 Makefile.in                                        |   39 +-
 README.txt                                         |   59 +-
 aclocal.m4                                         |   13 +
 bin/chkmanifest                                    |   48 +-
 bin/cmakehdf4                                      |    4 +-
 bin/h4_release_check.sh                            |  231 ++
 bin/h4vers                                         |    2 +-
 config/apple                                       |   14 +-
 config/cmake/CPack.Info.plist.in                   |   26 +
 config/cmake/ConfigureChecks.cmake                 |    1 -
 config/cmake/FindJNI.cmake                         |  342 +++
 config/cmake/HDF4Macros.cmake                      |   16 +-
 config/cmake/HDF4UseFortran.cmake                  |   97 +-
 config/cmake/HDF4_Examples.cmake.in                |  157 +-
 config/cmake/README.txt.cmake.in                   |   29 +-
 config/cmake/UseJava.cmake                         | 1350 +++++++++
 config/cmake/UseJavaClassFilelist.cmake            |   58 +
 config/cmake/UseJavaSymlinks.cmake                 |   38 +
 config/cmake/cacheinit.cmake                       |    8 +-
 config/cmake/h4config.h.in                         |    6 -
 config/cmake/hdf4-config-version.cmake.in          |   52 +-
 config/cmake/hdf4-config.cmake.build.in            |   61 -
 config/cmake/hdf4-config.cmake.in                  |  148 +
 config/cmake/hdf4-config.cmake.install.in          |   71 -
 .../runTest.cmake => cmake/jrunTest.cmake}         |  199 +-
 config/cmake/libhdf4.settings.cmake.in             |    5 +-
 config/cmake/patch.xml                             |   11 +
 config/cmake_ext_mod/CPack.Info.plist.in           |   32 -
 config/cmake_ext_mod/ConfigureChecks.cmake         |  152 +-
 config/cmake_ext_mod/FindSZIP.cmake                |    7 -
 config/cmake_ext_mod/HDFLibMacros.cmake            |  145 +-
 config/cmake_ext_mod/HDFMacros.cmake               |  133 +-
 config/cmake_ext_mod/HDFTests.c                    |   44 +-
 config/cmake_ext_mod/HDFUseFortran.cmake           |   36 +-
 config/cmake_ext_mod/grepTest.cmake                |   12 +-
 config/cmake_ext_mod/prunTest.cmake                |   34 +-
 config/cmake_ext_mod/runTest.cmake                 |   86 +-
 configure                                          | 1156 ++++++-
 configure.ac                                       |   98 +-
 hdf/CMakeLists.txt                                 |    2 +-
 hdf/Makefile.in                                    |   33 +-
 hdf/examples/CMakeLists.txt                        |   14 +-
 hdf/examples/CMakeTests.cmake                      |   16 +-
 hdf/examples/Makefile.am                           |    4 +-
 hdf/examples/Makefile.in                           |   37 +-
 hdf/fortran/CMakeLists.txt                         |  135 +-
 hdf/fortran/CMakeTests.cmake                       |   18 +-
 hdf/fortran/Makefile.in                            |   33 +-
 hdf/fortran/examples/CMakeLists.txt                |   40 +-
 hdf/fortran/examples/Makefile.am                   |    2 +-
 hdf/fortran/examples/Makefile.in                   |   35 +-
 hdf/src/CMakeLists.txt                             |   50 +-
 hdf/src/H4api_adpt.h                               |  113 +-
 hdf/src/Makefile.in                                |   33 +-
 hdf/src/atom.c                                     |    7 +-
 hdf/src/bitvect.c                                  |    6 +-
 hdf/src/cdeflate.c                                 |    6 +-
 hdf/src/cnbit.c                                    |    6 +-
 hdf/src/cnone.c                                    |    6 +-
 hdf/src/crle.c                                     |    6 +-
 hdf/src/cskphuff.c                                 |    6 +-
 hdf/src/cszip.c                                    |    6 +-
 hdf/src/df24.c                                     |    6 +-
 hdf/src/df24f.c                                    |    6 +-
 hdf/src/dfan.c                                     |    6 +-
 hdf/src/dfanf.c                                    |    6 +-
 hdf/src/dfcomp.c                                   |    6 +-
 hdf/src/dfconv.c                                   |    6 +-
 hdf/src/dff.c                                      |    6 +-
 hdf/src/dfgr.c                                     |    6 +-
 hdf/src/dfgroup.c                                  |    6 +-
 hdf/src/dfimcomp.c                                 |    6 +-
 hdf/src/dfjpeg.c                                   |    6 +-
 hdf/src/dfknat.c                                   |    6 +-
 hdf/src/dfkswap.c                                  |    7 +-
 hdf/src/dfp.c                                      |    6 +-
 hdf/src/dfpf.c                                     |    6 +-
 hdf/src/dfr8.c                                     |    6 +-
 hdf/src/dfr8f.c                                    |    6 +-
 hdf/src/dfrle.c                                    |    6 +-
 hdf/src/dfsd.c                                     |    6 +-
 hdf/src/dfsdf.c                                    |    6 +-
 hdf/src/dfstubs.c                                  |    6 +-
 hdf/src/dfufp2i.c                                  |    6 +-
 hdf/src/dfufp2i.h                                  |    6 +-
 hdf/src/dfunjpeg.c                                 |    6 +-
 hdf/src/dfutil.c                                   |    6 +-
 hdf/src/dfutilf.c                                  |    6 +-
 hdf/src/dynarray.c                                 |    6 +-
 hdf/src/glist.c                                    |    4 -
 hdf/src/hbitio.c                                   |    6 +-
 hdf/src/hblocks.c                                  |    6 +-
 hdf/src/hbuffer.c                                  |    6 +-
 hdf/src/hchunks.c                                  |    6 +-
 hdf/src/hcomp.c                                    |   10 +-
 hdf/src/hcompri.c                                  |    6 +-
 hdf/src/hdfalloc.c                                 |   20 +-
 hdf/src/hdfi.h                                     |   10 +-
 hdf/src/herr.c                                     |    6 +-
 hdf/src/herr.h                                     |   72 +-
 hdf/src/herrf.c                                    |    6 +-
 hdf/src/hextelt.c                                  |   97 +-
 hdf/src/hfile.c                                    |    6 +-
 hdf/src/hfile.h                                    |    6 +-
 hdf/src/hfiledd.c                                  |    6 +-
 hdf/src/hfilef.c                                   |    6 +-
 hdf/src/hkit.c                                     |    6 +-
 hdf/src/hproto.h                                   |    5 +-
 hdf/src/linklist.c                                 |    6 +-
 hdf/src/maldebug.c                                 |    6 +-
 hdf/src/mcache.c                                   |    6 +-
 hdf/src/mfan.c                                     |    6 +-
 hdf/src/mfanf.c                                    |    6 +-
 hdf/src/mfgr.c                                     | 1430 +++++----
 hdf/src/mfgrf.c                                    |    6 +-
 hdf/src/mstdio.c                                   |    6 +-
 hdf/src/tbbt.c                                     |    6 +-
 hdf/src/vattr.c                                    |    6 +-
 hdf/src/vattr.h                                    |    6 +-
 hdf/src/vattrf.c                                   |    6 +-
 hdf/src/vconv.c                                    |    6 +-
 hdf/src/vg.c                                       |    4 -
 hdf/src/vgf.c                                      |    6 +-
 hdf/src/vhi.c                                      |    6 +-
 hdf/src/vio.c                                      |    6 +-
 hdf/src/vparse.c                                   |    5 -
 hdf/src/vrw.c                                      |    6 +-
 hdf/src/vsfld.c                                    |    6 +-
 hdf/test/CMakeLists.txt                            |   34 +-
 hdf/test/CMakeTests.cmake                          |  337 ++-
 hdf/test/Makefile.in                               |   33 +-
 hdf/test/an.c                                      |    6 +-
 hdf/test/anfile.c                                  |    6 +-
 hdf/test/bitio.c                                   |    6 +-
 hdf/test/blocks.c                                  |    6 +-
 hdf/test/buffer.c                                  |   16 +-
 hdf/test/chunks.c                                  |    6 +-
 hdf/test/comp.c                                    |    6 +-
 hdf/test/conv.c                                    |    6 +-
 hdf/test/extelt.c                                  |    6 +-
 hdf/test/file.c                                    |    6 +-
 hdf/test/file1.c                                   |    6 +-
 hdf/test/forsupf.c                                 |    6 +-
 hdf/test/fortest.c                                 |    7 +-
 hdf/test/gentest.c                                 |    6 +-
 hdf/test/litend.c                                  |    6 +-
 hdf/test/man.c                                     |    6 +-
 hdf/test/mgr.c                                     |    6 +-
 hdf/test/nbit.c                                    |    6 +-
 hdf/test/rig.c                                     |    6 +-
 hdf/test/sdmms.c                                   |    6 +-
 hdf/test/sdnmms.c                                  |    6 +-
 hdf/test/sdstr.c                                   |    6 +-
 hdf/test/slab.c                                    |    4 -
 hdf/test/tbv.c                                     |    6 +-
 hdf/test/testhdf.c                                 |    6 +-
 hdf/test/tree.c                                    |    6 +-
 hdf/test/tvattr.c                                  |    6 +-
 hdf/test/tvset.c                                   |    6 +-
 hdf/test/vers.c                                    |    6 +-
 hdf/util/CMakeLists.txt                            |  130 +-
 hdf/util/CMakeTests.cmake                          |   22 +-
 hdf/util/Makefile.in                               |   33 +-
 hdf/util/gif2hdf.c                                 |   14 +-
 hdf/util/gif2mem.c                                 |    2 +-
 hdf/util/h4cc.in                                   |    2 +-
 hdf/util/h4fc.in                                   |    2 +-
 hdf/util/hdf24to8.c                                |    6 +-
 hdf/util/hdf2jpeg.c                                |    6 +-
 hdf/util/hdf8to24.c                                |    6 +-
 hdf/util/hdfcomp.c                                 |    6 +-
 hdf/util/hdfls.c                                   |    6 +-
 hdf/util/hdfpack.c                                 |    6 +-
 hdf/util/hdftopal.c                                |    6 +-
 hdf/util/hdftor8.c                                 |    6 +-
 hdf/util/hdfunpac.c                                |    6 +-
 hdf/util/he_cntrl.c                                |    6 +-
 hdf/util/he_disp.c                                 |    6 +-
 hdf/util/he_file.c                                 |    6 +-
 hdf/util/he_main.c                                 |    6 +-
 hdf/util/jpeg2hdf.c                                |    6 +-
 hdf/util/paltohdf.c                                |    6 +-
 hdf/util/r8tohdf.c                                 |    6 +-
 hdf/util/ristosds.c                                |    6 +-
 hdf/util/vmake.c                                   |    6 +-
 hdf/util/vshow.c                                   |    6 +-
 hdf/util/writehdf.c                                |    4 +-
 java/CMakeLists.txt                                |   75 +
 java/Makefile.am                                   |   16 +
 {mfhdf/fortran => java}/Makefile.in                |  343 +--
 java/examples/CMakeLists.txt                       |   89 +
 java/examples/HDF4DatasetCreate.java               |  203 ++
 java/examples/HDF4FileCreate.java                  |   52 +
 java/examples/HDF4GroupCreate.java                 |  108 +
 java/examples/Makefile.am                          |   48 +
 {mfhdf/nctest => java/examples}/Makefile.in        |  358 +--
 java/lib/ext/slf4j-nop-1.7.5.jar                   |  Bin 0 -> 4091 bytes
 java/lib/ext/slf4j-simple-1.7.5.jar                |  Bin 0 -> 10680 bytes
 java/lib/hamcrest-core.jar                         |  Bin 0 -> 45024 bytes
 java/lib/junit.jar                                 |  Bin 0 -> 245039 bytes
 java/lib/simplelogger.properties                   |   36 +
 java/lib/slf4j-api-1.7.5.jar                       |  Bin 0 -> 26084 bytes
 java/src/CMakeLists.txt                            |    8 +
 java/src/Makefile.am                               |   73 +
 {hdf => java/src}/Makefile.in                      |  235 +-
 java/src/hdf/CMakeLists.txt                        |    4 +
 java/src/hdf/hdflib/CMakeLists.txt                 |   74 +
 java/src/hdf/hdflib/HDFArray.java                  |  854 ++++++
 java/src/hdf/hdflib/HDFChunkInfo.java              |   52 +
 java/src/hdf/hdflib/HDFCompInfo.java               |   33 +
 java/src/hdf/hdflib/HDFConstants.java              |  419 +++
 java/src/hdf/hdflib/HDFDeflateCompInfo.java        |   39 +
 java/src/hdf/hdflib/HDFException.java              |   67 +
 java/src/hdf/hdflib/HDFIMCOMPCompInfo.java         |   29 +
 java/src/hdf/hdflib/HDFJPEGCompInfo.java           |   49 +
 java/src/hdf/hdflib/HDFJavaException.java          |   40 +
 java/src/hdf/hdflib/HDFLibrary.java                | 3172 ++++++++++++++++++++
 java/src/hdf/hdflib/HDFLibraryException.java       |  108 +
 java/src/hdf/hdflib/HDFNBITChunkInfo.java          |   47 +
 java/src/hdf/hdflib/HDFNBITCompInfo.java           |   47 +
 java/src/hdf/hdflib/HDFNativeData.java             |  166 +
 java/src/hdf/hdflib/HDFNewCompInfo.java            |   33 +
 .../src/hdf/hdflib/HDFNotImplementedException.java |   44 +
 java/src/hdf/hdflib/HDFOldCompInfo.java            |   33 +
 java/src/hdf/hdflib/HDFOldRLECompInfo.java         |   30 +
 java/src/hdf/hdflib/HDFRLECompInfo.java            |   29 +
 java/src/hdf/hdflib/HDFSKPHUFFCompInfo.java        |   32 +
 java/src/hdf/hdflib/HDFSZIPCompInfo.java           |   53 +
 java/src/hdf/overview.html                         |   94 +
 java/src/jni/CMakeLists.txt                        |   68 +
 java/src/jni/Makefile.am                           |   32 +
 {mfhdf/xdr => java/src/jni}/Makefile.in            |  215 +-
 java/src/jni/h4jni.h                               |  176 ++
 java/src/jni/hdfImp.c                              |  430 +++
 java/src/jni/hdfanImp.c                            |  393 +++
 java/src/jni/hdfdfpalImp.c                         |  221 ++
 java/src/jni/hdfdfuImp.c                           |   44 +
 java/src/jni/hdfexceptionImp.c                     |  186 ++
 java/src/jni/hdfgrImp.c                            | 1044 +++++++
 java/src/jni/hdfheImp.c                            |   52 +
 java/src/jni/hdfhxImp.c                            |   88 +
 java/src/jni/hdfnativeImp.c                        | 1200 ++++++++
 java/src/jni/hdfr24Imp.c                           |  360 +++
 java/src/jni/hdfr8Imp.c                            |  426 +++
 java/src/jni/hdfsdsImp.c                           | 1980 ++++++++++++
 java/src/jni/hdfstructsutil.c                      |  639 ++++
 java/src/jni/hdfvdataImp.c                         | 1077 +++++++
 java/src/jni/hdfvfImp.c                            |  115 +
 java/src/jni/hdfvgroupImp.c                        |  893 ++++++
 java/src/jni/hdfvhImp.c                            |  151 +
 java/src/jni/hdfvqImp.c                            |   58 +
 java/src/jni/hdfvsqImp.c                           |  282 ++
 java/test/CMakeLists.txt                           |  100 +
 java/test/JUnit-interface.ert                      |    2 +
 java/test/JUnit-interface.txt                      |  367 +++
 java/test/Makefile.am                              |   62 +
 {mfhdf/nctest => java/test}/Makefile.in            |  373 +--
 java/test/TestAll.java                             |   32 +
 java/test/TestH4.java                              |  268 ++
 java/test/TestH4ANparams.java                      |  195 ++
 java/test/TestH4DFPparams.java                     |  110 +
 java/test/TestH4DFRparams.java                     |  139 +
 java/test/TestH4DFparams.java                      |  130 +
 java/test/TestH4GRparams.java                      |  535 ++++
 java/test/TestH4HCparams.java                      |   52 +
 java/test/TestH4SDparams.java                      |  746 +++++
 java/test/TestH4VSparams.java                      |  476 +++
 java/test/TestH4Vparams.java                       |  404 +++
 java/test/junit.sh.in                              |  260 ++
 libhdf4.settings.in                                |    3 +
 m4/ax_check_class.m4                               |  144 +
 m4/ax_check_classpath.m4                           |   60 +
 m4/ax_check_java_home.m4                           |   80 +
 m4/ax_check_junit.m4                               |   70 +
 m4/ax_check_rqrd_class.m4                          |   62 +
 m4/ax_java_check_class.m4                          |   85 +
 m4/ax_java_options.m4                              |   48 +
 m4/ax_jni_include_dir.m4                           |  132 +
 m4/ax_prog_jar.m4                                  |   49 +
 m4/ax_prog_java.m4                                 |  115 +
 m4/ax_prog_java_cc.m4                              |  104 +
 m4/ax_prog_java_works.m4                           |  134 +
 m4/ax_prog_javac.m4                                |   79 +
 m4/ax_prog_javac_works.m4                          |   72 +
 m4/ax_prog_javadoc.m4                              |   50 +
 m4/ax_prog_javah.m4                                |   64 +
 m4/ax_try_compile_java.m4                          |   55 +
 m4/ax_try_run_java.m4                              |   56 +
 man/Makefile.in                                    |   33 +-
 man/hdf.1                                          |    6 +-
 mfhdf/CMakeLists.txt                               |    2 +-
 mfhdf/Makefile.in                                  |   33 +-
 mfhdf/dumper/CMakeLists.txt                        |   17 +-
 mfhdf/dumper/Makefile.in                           |   33 +-
 mfhdf/dumper/hdp.c                                 |    6 +-
 mfhdf/dumper/hdp.h                                 |    6 +-
 mfhdf/dumper/hdp_dump.c                            |    6 +-
 mfhdf/dumper/hdp_gr.c                              |    6 +-
 mfhdf/dumper/hdp_list.c                            |    6 +-
 mfhdf/dumper/hdp_rig.c                             |    6 +-
 mfhdf/dumper/hdp_sds.c                             |   13 +-
 mfhdf/dumper/hdp_util.c                            |    4 -
 mfhdf/dumper/hdp_vd.c                              |    6 +-
 mfhdf/dumper/hdp_vg.c                              |    6 +-
 mfhdf/dumper/show.c                                |    4 -
 mfhdf/dumper/testfiles/Roy-64.nc                   |  Bin 0 -> 4021 bytes
 mfhdf/dumper/testfiles/dumpsds-19.out              |    1 +
 mfhdf/dumper/testhdp.sh.in                         |    5 +-
 mfhdf/examples/CMakeLists.txt                      |   10 +-
 mfhdf/examples/CMakeTests.cmake                    |    8 +-
 mfhdf/examples/Makefile.am                         |    2 +-
 mfhdf/examples/Makefile.in                         |   35 +-
 mfhdf/examples/SD_chunking_example.c               |   24 +-
 mfhdf/examples/SD_find_sds_by_name.c               |    2 +-
 mfhdf/examples/SD_get_attr.c                       |    3 +-
 mfhdf/examples/SD_mv_sds_to_external.c             |    2 +-
 mfhdf/examples/SD_read_from_sds.c                  |    2 +-
 mfhdf/fortran/CMakeLists.txt                       |  131 +-
 mfhdf/fortran/CMakeTests.cmake                     |   32 +-
 mfhdf/fortran/Makefile.in                          |   33 +-
 mfhdf/fortran/examples/CMakeLists.txt              |   30 +-
 mfhdf/fortran/examples/Makefile.am                 |    2 +-
 mfhdf/fortran/examples/Makefile.in                 |   35 +-
 mfhdf/fortran/mfsdf.c                              |    5 +-
 mfhdf/hdfimport/CMakeLists.txt                     |   17 +-
 mfhdf/hdfimport/CMakeTests.cmake                   |  208 +-
 mfhdf/hdfimport/Makefile.in                        |   33 +-
 mfhdf/hdiff/CMakeLists.txt                         |   17 +-
 mfhdf/hdiff/CMakeTests.cmake                       |   26 +-
 mfhdf/hdiff/Makefile.in                            |   33 +-
 mfhdf/hdiff/hdiff_dim.c                            |   36 +-
 mfhdf/hdiff/hdiff_gr.c                             |    8 +-
 mfhdf/hdiff/hdiff_list.c                           |   76 +-
 mfhdf/hdiff/hdiff_mattbl.c                         |   18 +-
 mfhdf/hdiff/hdiff_sds.c                            |   22 +-
 mfhdf/hdiff/hdiff_vs.c                             |   10 +-
 mfhdf/hrepack/CMakeLists.txt                       |   23 +-
 mfhdf/hrepack/CMakeTests.cmake                     |  165 +-
 mfhdf/hrepack/Makefile.in                          |   33 +-
 mfhdf/hrepack/hrepack.c                            |   12 +-
 mfhdf/hrepack/hrepack_an.c                         |   12 +-
 mfhdf/hrepack/hrepack_dim.c                        |   40 +-
 mfhdf/hrepack/hrepack_gr.c                         |   14 +-
 mfhdf/hrepack/hrepack_list.c                       |   54 +-
 mfhdf/hrepack/hrepack_lsttable.c                   |   14 +-
 mfhdf/hrepack/hrepack_opttable.c                   |   32 +-
 mfhdf/hrepack/hrepack_parse.c                      |   16 +-
 mfhdf/hrepack/hrepack_sds.c                        |   20 +-
 mfhdf/hrepack/hrepack_vg.c                         |    6 +-
 mfhdf/hrepack/hrepack_vs.c                         |   26 +-
 mfhdf/hrepack/hrepacktst.c                         |   32 +-
 mfhdf/libsrc/CMakeLists.txt                        |   67 +-
 mfhdf/libsrc/Makefile.in                           |   33 +-
 mfhdf/libsrc/array.c                               |   25 +-
 mfhdf/libsrc/cdf.c                                 |  196 +-
 mfhdf/libsrc/hdfnctest.c                           |    4 -
 mfhdf/libsrc/hdfsds.c                              |  422 ++-
 mfhdf/libsrc/local_nc.h                            |  484 +--
 mfhdf/libsrc/mfsd.c                                | 1070 +++----
 mfhdf/libsrc/string.c                              |    4 +-
 mfhdf/libsrc/var.c                                 |    8 +-
 mfhdf/ncdump/CMakeLists.txt                        |   17 +-
 mfhdf/ncdump/Makefile.in                           |   33 +-
 mfhdf/ncgen/CMakeLists.txt                         |   17 +-
 mfhdf/ncgen/Makefile.in                            |   33 +-
 mfhdf/nctest/CMakeLists.txt                        |   12 +-
 mfhdf/nctest/Makefile.in                           |   33 +-
 mfhdf/test/CMakeLists.txt                          |   91 +-
 mfhdf/test/CMakeTests.cmake                        |  269 +-
 mfhdf/test/Makefile.am                             |    2 +-
 mfhdf/test/Makefile.in                             |   44 +-
 mfhdf/test/Roy-64.nc                               |  Bin 0 -> 4021 bytes
 mfhdf/test/Roy.nc                                  |  Bin 0 -> 4020 bytes
 mfhdf/test/hdfnctest.c                             |    4 -
 mfhdf/test/hdftest.c                               |  235 +-
 mfhdf/test/hdftest.h                               |   29 +
 mfhdf/test/tcoordvar.c                             |    2 +-
 mfhdf/test/texternal.c                             |  814 +++++
 mfhdf/test/tfile.c                                 |  327 +-
 mfhdf/test/tsdsprops.c                             |    2 +-
 mfhdf/test/tunlim.c                                |    2 +-
 mfhdf/test/tutils.c                                |  315 +-
 mfhdf/xdr/CMakeLists.txt                           |   58 +-
 mfhdf/xdr/Makefile.in                              |   33 +-
 release_notes/HISTORY.txt                          |  352 +++
 release_notes/INSTALL                              |    4 +-
 release_notes/INSTALL_CMake.txt                    |  346 +--
 release_notes/INSTALL_CYGWIN.txt                   |    4 +-
 release_notes/RELEASE.txt                          |  344 +--
 release_notes/USING_CMake_Examples.txt             |   84 +-
 release_notes/USING_HDF4_CMake.txt                 |  172 +-
 release_notes/USING_HDF4_VS.txt                    |    4 +-
 release_notes/misc_docs.txt                        |   12 +-
 400 files changed, 33114 insertions(+), 6656 deletions(-)

diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index 0fd994f..0114f7f 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -36,9 +36,13 @@ option (HDF4_ENABLE_JPEG_LIB_SUPPORT "Enable libjpeg" ON)
 if (HDF4_ENABLE_JPEG_LIB_SUPPORT)
   if (NOT H4_JPEGLIB_HEADER)
     if (NOT JPEG_USE_EXTERNAL)
-      find_package (JPEG NAMES ${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+      find_package (JPEG NAMES ${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
       if (NOT JPEG_FOUND)
         find_package (JPEG) # Legacy find
+        if (JPEG_FOUND)
+          set (LINK_LIBS ${LINK_LIBS} ${JPEG_LIBRARIES})
+          set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${JPEG_LIBRARIES})
+        endif (JPEG_FOUND)
       endif (NOT JPEG_FOUND)
     endif (NOT JPEG_USE_EXTERNAL)
     if (JPEG_FOUND)
@@ -46,7 +50,7 @@ if (HDF4_ENABLE_JPEG_LIB_SUPPORT)
       set (H4_HAVE_LIBJPEG 1)
       set (H4_JPEGLIB_HEADER "jpeglib.h")
       set (JPEG_INCLUDE_DIR_GEN ${JPEG_INCLUDE_DIR})
-      set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR})
+      set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR})
     else (JPEG_FOUND)
       if (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
         # May need to build JPEG with PIC on x64 machines with gcc
@@ -61,7 +65,7 @@ if (HDF4_ENABLE_JPEG_LIB_SUPPORT)
           endif (DEFINED CMAKE_ANSI_CFLAGS)
         endif (BUILD_JPEG_WITH_PIC)
 
-        EXTERNAL_JPEG_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE} ${JPEG_CMAKE_C_FLAGS})
+        EXTERNAL_JPEG_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${JPEG_CMAKE_C_FLAGS})
         set (H4_HAVE_JPEGLIB_H 1)
         set (H4_HAVE_LIBJPEG 1)
         set (H4_JPEGLIB_HEADER "jpeglib.h")
@@ -74,7 +78,10 @@ if (HDF4_ENABLE_JPEG_LIB_SUPPORT)
     # This project is being called from within another and JPEGLib is already configured
     set (H4_HAVE_JPEGLIB_H 1)
   endif (NOT H4_JPEGLIB_HEADER)
-  set (LINK_LIBS ${LINK_LIBS} ${JPEG_LIBRARY})
+  if (BUILD_SHARED_LIBS) 
+    set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${JPEG_SHARED_LIBRARY})
+  endif (BUILD_SHARED_LIBS) 
+  set (LINK_LIBS ${LINK_LIBS} ${JPEG_STATIC_LIBRARY})
   INCLUDE_DIRECTORIES (${JPEG_INCLUDE_DIRS})
   message (STATUS "JPEGLIB is ON")
 endif (HDF4_ENABLE_JPEG_LIB_SUPPORT)
@@ -86,9 +93,13 @@ option (HDF4_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" ON)
 if (HDF4_ENABLE_Z_LIB_SUPPORT)
   if (NOT H4_ZLIB_HEADER)
     if (NOT ZLIB_USE_EXTERNAL)
-      find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+      find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
       if (NOT ZLIB_FOUND)
         find_package (ZLIB) # Legacy find
+        if (ZLIB_FOUND)
+          set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
+          set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_LIBRARIES})
+        endif (ZLIB_FOUND)
       endif (NOT ZLIB_FOUND)
     endif (NOT ZLIB_USE_EXTERNAL)
     if (ZLIB_FOUND)
@@ -97,10 +108,10 @@ if (HDF4_ENABLE_Z_LIB_SUPPORT)
       set (H4_HAVE_LIBZ 1)
       set (H4_ZLIB_HEADER "zlib.h")
       set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
-      set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
+      set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
     else (ZLIB_FOUND)
       if (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
-        EXTERNAL_ZLIB_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
+        EXTERNAL_ZLIB_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT})
         set (H4_HAVE_FILTER_DEFLATE 1)
         set (H4_HAVE_ZLIB_H 1)
         set (H4_HAVE_LIBZ 1)
@@ -115,7 +126,10 @@ if (HDF4_ENABLE_Z_LIB_SUPPORT)
     set (H4_HAVE_ZLIB_H 1)
     set (H4_HAVE_LIBZ 1)
   endif (NOT H4_ZLIB_HEADER)
-  set (LINK_LIBS ${LINK_LIBS} ${ZLIB_LIBRARIES})
+  if (BUILD_SHARED_LIBS) 
+    set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${ZLIB_SHARED_LIBRARY})
+  endif (BUILD_SHARED_LIBS) 
+  set (LINK_LIBS ${LINK_LIBS} ${ZLIB_STATIC_LIBRARY})
   INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
   message (STATUS "Filter ZLIB is ON")
 endif (HDF4_ENABLE_Z_LIB_SUPPORT)
@@ -128,9 +142,13 @@ set (SZIP_INFO "disabled")
 if (HDF4_ENABLE_SZIP_SUPPORT)
   option (HDF4_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF)
   if (NOT SZIP_USE_EXTERNAL)
-    find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT})
+    find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
     if (NOT SZIP_FOUND)
       find_package (SZIP) # Legacy find
+      if (SZIP_FOUND)
+        set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
+        set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_LIBRARIES})
+      endif (SZIP_FOUND)
     endif (NOT SZIP_FOUND)
   endif (NOT SZIP_USE_EXTERNAL)
   if (SZIP_FOUND)
@@ -138,10 +156,10 @@ if (HDF4_ENABLE_SZIP_SUPPORT)
     set (H4_HAVE_SZLIB_H 1)
     set (H4_HAVE_LIBSZ 1)
     set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
-    set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR})
+    set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR})
   else (SZIP_FOUND)
     if (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
-      EXTERNAL_SZIP_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE} ${HDF4_ENABLE_SZIP_ENCODING})
+      EXTERNAL_SZIP_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT} ${HDF4_ENABLE_SZIP_ENCODING})
       set (H4_HAVE_FILTER_SZIP 1)
       set (H4_HAVE_SZLIB_H 1)
       set (H4_HAVE_LIBSZ 1)
@@ -150,7 +168,10 @@ if (HDF4_ENABLE_SZIP_SUPPORT)
       message (FATAL_ERROR "SZIP is Required for SZIP support in HDF4")
     endif (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
   endif (SZIP_FOUND)
-  set (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES})
+  if (BUILD_SHARED_LIBS) 
+    set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${SZIP_SHARED_LIBRARY})
+  endif (BUILD_SHARED_LIBS) 
+  set (LINK_LIBS ${LINK_LIBS} ${SZIP_STATIC_LIBRARY})
   INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS})
   message (STATUS "Filter SZIP is ON")
   if (HDF4_ENABLE_SZIP_ENCODING)
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
index 8d3e4f8..20113e1 100644
--- a/CMakeInstallation.cmake
+++ b/CMakeInstallation.cmake
@@ -1,3 +1,4 @@
+include (CMakePackageConfigHelpers)
 
 #-----------------------------------------------------------------------------
 # Check for Installation Utilities
@@ -28,7 +29,7 @@ endif (NOT HDF4_INSTALL_NO_DEVELOPMENT)
 if (NOT HDF4_EXTERNALLY_CONFIGURED)
   install (
       EXPORT ${HDF4_EXPORTED_TARGETS}
-      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}
       FILE ${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-targets.cmake
       COMPONENT configinstall
   )
@@ -45,7 +46,7 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED)
 endif (NOT HDF4_EXTERNALLY_CONFIGURED)
 
 #-----------------------------------------------------------------------------
-# Configure the hdf4-config.cmake file for the build directory
+# Set includes needed for build
 #-----------------------------------------------------------------------------
 set (HDF4_INCLUDES_BUILD_TIME
     ${HDF4_HDF_SOURCE_DIR}
@@ -53,13 +54,26 @@ set (HDF4_INCLUDES_BUILD_TIME
     ${HDF4_MFHDF_XDR_DIR}
     ${HDF4_BINARY_DIR}
 )
+
+#-----------------------------------------------------------------------------
+# Set variables needed for installation
+#-----------------------------------------------------------------------------
 set (HDF4_VERSION_STRING ${HDF4_PACKAGE_VERSION})
 set (HDF4_VERSION_MAJOR  ${HDF4_PACKAGE_VERSION_MAJOR})
 set (HDF4_VERSION_MINOR  ${HDF4_PACKAGE_VERSION_MINOR})
 
-configure_file (
-    ${HDF_RESOURCES_DIR}/hdf4-config.cmake.build.in 
-    ${HDF4_BINARY_DIR}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY
+#-----------------------------------------------------------------------------
+# Configure the hdf4-config.cmake file for the build directory
+#-----------------------------------------------------------------------------
+set (INCLUDE_INSTALL_DIR ${HDF4_INSTALL_INCLUDE_DIR})
+set (SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/${HDF4_INSTALL_CMAKE_DIR}" )
+set (CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
+configure_package_config_file (
+    ${HDF_RESOURCES_DIR}/hdf4-config.cmake.in
+    "${HDF4_BINARY_DIR}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake"
+    INSTALL_DESTINATION "${HDF4_INSTALL_CMAKE_DIR}"
+    PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
+    INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
 )
 
 #-----------------------------------------------------------------------------
@@ -67,28 +81,32 @@ configure_file (
 #-----------------------------------------------------------------------------
 if (NOT HDF4_EXTERNALLY_CONFIGURED)
   configure_file (
-      ${HDF_RESOURCES_DIR}/FindHDF4.cmake.in 
-      ${HDF4_BINARY_DIR}/CMakeFiles/FindHDF4${HDF_PACKAGE_EXT}.cmake @ONLY
+      ${HDF_RESOURCES_DIR}/FindHDF4.cmake.in
+      ${HDF4_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindHDF4${HDF_PACKAGE_EXT}.cmake @ONLY
   )
   install (
-      FILES ${HDF4_BINARY_DIR}/CMakeFiles/FindHDF4${HDF_PACKAGE_EXT}.cmake
-      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      FILES ${HDF4_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FindHDF4${HDF_PACKAGE_EXT}.cmake
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}
       COMPONENT configinstall
   )
 endif (NOT HDF4_EXTERNALLY_CONFIGURED)
 
-
 #-----------------------------------------------------------------------------
 # Configure the hdf4-config.cmake file for the install directory
 #-----------------------------------------------------------------------------
+set (INCLUDE_INSTALL_DIR ${HDF4_INSTALL_INCLUDE_DIR})
+set (SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${HDF4_INSTALL_CMAKE_DIR}" )
+set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" )
+configure_package_config_file (
+    ${HDF_RESOURCES_DIR}/hdf4-config.cmake.in
+    "${HDF4_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake"
+    INSTALL_DESTINATION "${HDF4_INSTALL_CMAKE_DIR}"
+    PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
+)
 if (NOT HDF4_EXTERNALLY_CONFIGURED)
-  configure_file (
-      ${HDF_RESOURCES_DIR}/hdf4-config.cmake.install.in
-      ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY
-  )
   install (
-      FILES ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake
-      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      FILES ${HDF4_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}
       COMPONENT configinstall
   )
 endif (NOT HDF4_EXTERNALLY_CONFIGURED)
@@ -99,11 +117,11 @@ endif (NOT HDF4_EXTERNALLY_CONFIGURED)
 if (NOT HDF4_EXTERNALLY_CONFIGURED)
   configure_file (
       ${HDF_RESOURCES_DIR}/hdf4-config-version.cmake.in
-      ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
+      ${HDF4_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake @ONLY
   )
   install (
-      FILES ${HDF4_BINARY_DIR}/CMakeFiles/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
-      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+      FILES ${HDF4_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${HDF4_PACKAGE}${HDF_PACKAGE_EXT}-config-version.cmake
+      DESTINATION ${HDF4_INSTALL_CMAKE_DIR}
       COMPONENT configinstall
   )
 endif (NOT HDF4_EXTERNALLY_CONFIGURED)
@@ -117,12 +135,12 @@ else (H4_WORDS_BIGENDIAN)
   set (BYTESEX little-endian)
 endif (H4_WORDS_BIGENDIAN)
 configure_file (
-    ${HDF_RESOURCES_DIR}/libhdf4.settings.cmake.in 
+    ${HDF_RESOURCES_DIR}/libhdf4.settings.cmake.in
     ${HDF4_BINARY_DIR}/libhdf4.settings @ONLY
 )
 install (
     FILES ${HDF4_BINARY_DIR}/libhdf4.settings
-    DESTINATION ${HDF4_INSTALL_CMAKE_DIR}/${HDF4_PACKAGE}
+    DESTINATION ${HDF4_INSTALL_LIB_DIR}
     COMPONENT libraries
 )
 
@@ -132,7 +150,7 @@ install (
 option (HDF4_PACK_EXAMPLES  "Package the HDF4 Library Examples Compressed File" OFF)
 if (HDF4_PACK_EXAMPLES)
   configure_file (
-      ${HDF_RESOURCES_DIR}/HDF4_Examples.cmake.in 
+      ${HDF_RESOURCES_DIR}/HDF4_Examples.cmake.in
       ${HDF4_BINARY_DIR}/HDF4_Examples.cmake @ONLY
   )
   install (
@@ -141,9 +159,17 @@ if (HDF4_PACK_EXAMPLES)
       COMPONENT hdfdocuments
   )
   if (EXISTS "${HDF4_EXAMPLES_COMPRESSED_DIR}/${HDF4_EXAMPLES_COMPRESSED}")
+    execute_process(
+        COMMAND ${CMAKE_COMMAND} -E tar xzf ${HDF4_EXAMPLES_COMPRESSED_DIR}/${HDF4_EXAMPLES_COMPRESSED}
+    )
+    install (
+      DIRECTORY ${HDF4_BINARY_DIR}/HDF4Examples
+      DESTINATION ${HDF4_INSTALL_DATA_DIR}
+      USE_SOURCE_PERMISSIONS
+      COMPONENT hdfdocuments
+    )
     install (
         FILES
-            ${HDF4_EXAMPLES_COMPRESSED_DIR}/${HDF4_EXAMPLES_COMPRESSED}
             ${HDF4_SOURCE_DIR}/release_notes/USING_CMake_Examples.txt
         DESTINATION ${HDF4_INSTALL_DATA_DIR}
         COMPONENT hdfdocuments
@@ -245,16 +271,20 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
     set (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_notes/RELEASE.txt")
   endif (EXISTS "${HDF4_SOURCE_DIR}/release_notes")
   set (CPACK_PACKAGE_RELOCATABLE TRUE)
-  set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
+  if (OVERRIDE_INSTALL_VERSION)
+    set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${OVERRIDE_INSTALL_VERSION}")
+  else (OVERRIDE_INSTALL_VERSION)
+    set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}/${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}")
+  endif (OVERRIDE_INSTALL_VERSION)
   set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp")
 
-  set (CPACK_GENERATOR "TGZ") 
+  set (CPACK_GENERATOR "TGZ")
   if (WIN32)
-    set (CPACK_GENERATOR "ZIP") 
+    set (CPACK_GENERATOR "ZIP")
 
-    if (NSIS_EXECUTABLE)    
-      list (APPEND CPACK_GENERATOR "NSIS") 
-    endif (NSIS_EXECUTABLE)    
+    if (NSIS_EXECUTABLE)
+      list (APPEND CPACK_GENERATOR "NSIS")
+    endif (NSIS_EXECUTABLE)
     # Installers for 32- vs. 64-bit CMake:
     #  - Root install directory (displayed to end user at installer-run time)
     #  - "NSIS package/display name" (text used in the installer GUI)
@@ -274,14 +304,17 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
     # set the package header icon for MUI
     set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}\\\\hdf.bmp")
     set (CPACK_NSIS_DISPLAY_NAME "${CPACK_NSIS_PACKAGE_NAME}")
-    set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}")
-    set (CPACK_MONOLITHIC_INSTALL ON)
+    if (OVERRIDE_INSTALL_VERSION)
+      set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${OVERRIDE_INSTALL_VERSION}")
+    else (OVERRIDE_INSTALL_VERSION)
+      set (CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_VENDOR}\\\\${CPACK_PACKAGE_NAME}\\\\${CPACK_PACKAGE_VERSION}")
+    endif (OVERRIDE_INSTALL_VERSION)
     set (CPACK_NSIS_CONTACT "${HDF4_PACKAGE_BUGREPORT}")
     set (CPACK_NSIS_MODIFY_PATH ON)
-    
-    if (WIX_EXECUTABLE)    
-      list (APPEND CPACK_GENERATOR "WIX") 
-    endif (WIX_EXECUTABLE)    
+
+    if (WIX_EXECUTABLE)
+      list (APPEND CPACK_GENERATOR "WIX")
+    endif (WIX_EXECUTABLE)
 #WiX variables
     set (CPACK_WIX_UNINSTALL "1")
 # .. variable:: CPACK_WIX_LICENSE_RTF
@@ -319,30 +352,31 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
 #
 #  This image must be 493 by 312 pixels.
 #
+    set(CPACK_WIX_PROPERTY_ARPCOMMENTS "Hierarchical Data Format (HDF) Software Library and Utilities")
+    set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "${HDF4_PACKAGE_URL}")
+    set(CPACK_WIX_PROPERTY_ARPHELPLINK "${HDF4_PACKAGE_BUGREPORT}")
+    if (BUILD_SHARED_LIBS)
+      set(CPACK_WIX_PATCH_FILE "${HDF_RESOURCES_DIR}/patch.xml")
+    endif (BUILD_SHARED_LIBS)
   elseif (APPLE)
-    list (APPEND CPACK_GENERATOR "DragNDrop") 
+    list (APPEND CPACK_GENERATOR "DragNDrop")
     set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
     set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}")
     set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns")
 
-    if (HDF4_PACK_MACOSX_BUNDLE)
-      list (APPEND CPACK_GENERATOR "Bundle")
+    option (HDF4_PACK_MACOSX_FRAMEWORK  "Package the HDF Library in a Framework" OFF)
+    if (HDF4_PACK_MACOSX_FRAMEWORK AND HDF4_BUILD_FRAMEWORKS)
       set (CPACK_BUNDLE_NAME "${HDF4_PACKAGE_STRING}")
       set (CPACK_BUNDLE_LOCATION "/")    # make sure CMAKE_INSTALL_PREFIX ends in /
       set (CMAKE_INSTALL_PREFIX "/${CPACK_BUNDLE_NAME}.framework/Versions/${CPACK_PACKAGE_VERSION}/${CPACK_PACKAGE_NAME}/")
       set (CPACK_BUNDLE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.icns")
       set (CPACK_BUNDLE_PLIST "${HDF4_BINARY_DIR}/CMakeFiles/Info.plist")
-      set (CPACK_APPLE_GUI_INFO_STRING "Hierarchical Data Format (HDF) Software Library and Utilities")
-      set (CPACK_APPLE_GUI_COPYRIGHT "Copyright © 2006-2014 by The HDF Group. All rights reserved.")
       set (CPACK_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}")
-      set (CPACK_APPLE_GUI_BUNDLE_NAME "${HDF4_PACKAGE_STRING}")
-      set (CPACK_APPLE_GUI_VERSION_STRING "${CPACK_PACKAGE_VERSION_STRING}")
-      set (CPACK_APPLE_GUI_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION}")
       #-----------------------------------------------------------------------------
       # Configure the Info.plist file for the install bundle
       #-----------------------------------------------------------------------------
       configure_file (
-          ${HDF_RESOURCES_EXT_DIR}/CPack.Info.plist.in
+          ${HDF_RESOURCES_DIR}/CPack.Info.plist.in
           ${HDF4_BINARY_DIR}/CMakeFiles/Info.plist @ONLY
       )
       configure_file (
@@ -355,25 +389,49 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
       )
       install (
           FILES ${HDF4_BINARY_DIR}/CMakeFiles/PkgInfo
-                ${HDF4_BINARY_DIR}/CMakeFiles/version.plist
           DESTINATION ..
       )
-    endif (HDF4_PACK_MACOSX_BUNDLE)
+    endif (HDF4_PACK_MACOSX_FRAMEWORK AND HDF4_BUILD_FRAMEWORKS)
   else (WIN32)
-    list (APPEND CPACK_GENERATOR "STGZ") 
+    list (APPEND CPACK_GENERATOR "STGZ")
     set (CPACK_PACKAGING_INSTALL_PREFIX "/${CPACK_PACKAGE_INSTALL_DIRECTORY}")
     set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON)
 
     set (CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
     set (CPACK_DEBIAN_PACKAGE_MAINTAINER "${HDF4_PACKAGE_BUGREPORT}")
-    
+
+#    list (APPEND CPACK_GENERATOR "RPM")
+    set (CPACK_RPM_PACKAGE_RELEASE "1")
     set (CPACK_RPM_COMPONENT_INSTALL ON)
     set (CPACK_RPM_PACKAGE_RELOCATABLE ON)
     set (CPACK_RPM_PACKAGE_LICENSE "BSD-style")
     set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
     set (CPACK_RPM_PACKAGE_URL "${HDF4_PACKAGE_URL}")
+    set (CPACK_RPM_PACKAGE_SUMMARY "HDF is a unique technology suite that makes possible the management of extremely large and complex data collections.")
+    set (CPACK_RPM_PACKAGE_DESCRIPTION
+        "The HDF technology suite includes:
+
+    * A versatile data model that can represent very complex data objects and a wide variety of metadata.
+
+    * A completely portable file format with no limit on the number or size of data objects in the collection.
+
+    * A software library that runs on a range of computational platforms, from laptops to massively parallel systems, and implements a high-level API with C, C++, Fortran 90, and Java interfaces.
+
+    * A rich set of integrated performance features that allow for access time and storage space optimizations.
+
+    * Tools and applications for managing, manipulating, viewing, and analyzing the data in the collection.
+
+The HDF data model, file format, API, library, and tools are open and distributed without charge.
+"
+    )
+
+    #-----------------------------------------------------------------------------
+    # Configure the spec file for the install RPM
+    #-----------------------------------------------------------------------------
+#    configure_file ("${HDF5_RESOURCES_DIR}/hdf5.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec" @ONLY IMMEDIATE)
+#    set (CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/${HDF5_PACKAGE_NAME}.spec")
   endif (WIN32)
-  
+
   # By default, do not warn when built on machines using only VS Express:
   if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
     set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
@@ -381,88 +439,113 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
   include (InstallRequiredSystemLibraries)
 
   set (CPACK_INSTALL_CMAKE_PROJECTS "${HDF4_BINARY_DIR};HDF4;ALL;/")
-  
+
   if (HDF4_PACKAGE_EXTLIBS)
     if (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
       if (JPEG_FOUND AND JPEG_USE_EXTERNAL)
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;libraries;/")
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;headers;/")
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;configinstall;/")
+        if (WIN32)
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;ALL;/")
+        else (WIN32)
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;libraries;/")
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;headers;/")
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${JPEG_INCLUDE_DIR_GEN};JPEG;configinstall;/")
+        endif (WIN32)
       endif (JPEG_FOUND AND JPEG_USE_EXTERNAL)
       if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/")
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;headers;/")
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;configinstall;/")
+        if (WIN32)
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;ALL;/")
+        else (WIN32)
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/")
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;headers;/")
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;configinstall;/")
+        endif (WIN32)
       endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
       if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/")
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;headers;/")
-        set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/")
+        if (WIN32)
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/")
+        else (WIN32)
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/")
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;headers;/")
+          set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;configinstall;/")
+        endif (WIN32)
       endif (SZIP_FOUND AND SZIP_USE_EXTERNAL)
     endif (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
   endif (HDF4_PACKAGE_EXTLIBS)
 
   include (CPack)
 
+  cpack_add_install_type(Full DISPLAY_NAME "Everything")
+  cpack_add_install_type(Developer)
+
+  cpack_add_component_group(Runtime)
+
+  cpack_add_component_group(Documents
+      EXPANDED
+      DESCRIPTION "Release notes for developing HDF applications"
+  )
+
+  cpack_add_component_group(Development
+      EXPANDED
+      DESCRIPTION "All of the tools you'll need to develop HDF applications"
+  )
+
+  cpack_add_component_group(Applications
+      EXPANDED
+      DESCRIPTION "Tools for HDF4 files"
+  )
+
   #-----------------------------------------------------------------------------
   # Now list the cpack commands
   #-----------------------------------------------------------------------------
-  cpack_add_component (applications 
-      DISPLAY_NAME "HDF4 Applications" 
-      DEPENDS libraries
-      GROUP Applications
-  )
-  cpack_add_component (libraries 
+  cpack_add_component (libraries
       DISPLAY_NAME "HDF4 Libraries"
+      REQUIRED
       GROUP Runtime
+      INSTALL_TYPES Full Developer User
   )
-  cpack_add_component (headers 
-      DISPLAY_NAME "HDF4 Headers" 
+  cpack_add_component (headers
+      DISPLAY_NAME "HDF4 Headers"
       DEPENDS libraries
       GROUP Development
+      INSTALL_TYPES Full Developer
   )
-  cpack_add_component (hdfdocuments 
+  cpack_add_component (hdfdocuments
       DISPLAY_NAME "HDF4 Documents"
       GROUP Documents
+      INSTALL_TYPES Full Developer
   )
-  cpack_add_component (configinstall 
-      DISPLAY_NAME "HDF4 CMake files" 
+  cpack_add_component (configinstall
+      DISPLAY_NAME "HDF4 CMake files"
+      HIDDEN
       DEPENDS libraries
       GROUP Development
+      INSTALL_TYPES Full Developer User
   )
 
   if (HDF4_BUILD_FORTRAN)
-    cpack_add_component (fortlibraries 
-        DISPLAY_NAME "HDF4 Fortran Libraries" 
+    cpack_add_component (fortlibraries
+        DISPLAY_NAME "HDF4 Fortran Libraries"
         DEPENDS libraries
         GROUP Runtime
+        INSTALL_TYPES Full Developer User
     )
   endif (HDF4_BUILD_FORTRAN)
 
   if (HDF4_BUILD_TOOLS)
-    cpack_add_component (toolsapplications 
-        DISPLAY_NAME "HDF4 Tools Applications" 
+    cpack_add_component (toolsapplications
+        DISPLAY_NAME "HDF4 Tools Applications"
         DEPENDS libraries
         GROUP Applications
-    )
-    cpack_add_component (toolsheaders 
-        DISPLAY_NAME "HDF4 Tools Headers" 
-        DEPENDS libraries
-        GROUP Development
+        INSTALL_TYPES Full Developer User
     )
   endif (HDF4_BUILD_TOOLS)
 
   if (HDF4_BUILD_UTILS)
-    cpack_add_component (utilsapplications 
-        DISPLAY_NAME "HDF4 Utility Applications" 
+    cpack_add_component (utilsapplications
+        DISPLAY_NAME "HDF4 Utility Applications"
         DEPENDS libraries
         GROUP Applications
-    )
-    cpack_add_component (utilsheaders 
-        DISPLAY_NAME "HDF4 Utility Headers" 
-        DEPENDS libraries
-        GROUP Development
+        INSTALL_TYPES Full Developer User
     )
   endif (HDF4_BUILD_UTILS)
 endif (NOT HDF4_EXTERNALLY_CONFIGURED AND NOT HDF4_NO_PACKAGES)
-  
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3209dce..63312d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,19 +1,37 @@
-cmake_minimum_required (VERSION 2.8.11)
+cmake_minimum_required (VERSION 3.1.0)
 PROJECT (HDF4 C CXX)
 
 #-----------------------------------------------------------------------------
 # Instructions for use : Normal Build
 #
-# For standard build of HDF4 libraries,tests and tools. 
+# For standard build of HDF4 libraries,tests and tools.
 # Run cmake using the HDF4 source tree to generate a build tree.
 # Enable/Disable options according to requirements and
 # set CMAKE_INSTALL_PREFIX to the required install path.
 # Make install can be used to install all components for system-wide use.
 #
+if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+    MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
+      "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+      " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n"
+      "NEXT STEPS:\n"
+      "(1) Delete the CMakeCache.txt file and the CMakeFiles/ directory\n"
+      "     under the source directory for ${PROJECT_NAME}, otherwise you\n"
+      "     will not be able to configure ${PROJECT_NAME} correctly!\n"
+      "      * For example, on linux machines do:\n"
+      "        $ rm -r CMakeCache.txt CMakeFiles/\n"
+      "(2) Create a different directory and configure ${PROJECT_NAME} in that directory.\n"
+      "      * For example, on linux machines do:\n"
+      "        $ mkdir MY_BUILD\n"
+      "        $ cd MY_BUILD\n"
+      "        $ cmake [OPTIONS] ..\n"
+      )
+endif ()
+
 #-----------------------------------------------------------------------------
 # Instructions for use : Sub-Project Build
 #
-# To include HDF4 as a sub-project within another project. 
+# To include HDF4 as a sub-project within another project.
 # Set HDF4_EXTERNALLY_CONFIGURED to 1 in the parent project and
 # supply values for the following variables...
 #
@@ -29,10 +47,16 @@ PROJECT (HDF4 C CXX)
 #   dependencies to this variable so that external projects pick them up
 #
 # HDF4_EXTERNAL_LIB_PREFIX :
-#   If the parent project needs to install hdf libraries, but avoid 
+#   If the parent project needs to install hdf libraries, but avoid
 #   name conflicts with system versions, then a prefix may be added
 #   to ensure that the correct versions configured are used.
 #
+# HDF4_INSTALL_BIN_DIR, HDF4_INSTALL_LIB_DIR, HDF4_INSTALL_INCLUDE_DIR, HDF4_INSTALL_DATA_DIR :
+#   Customize the 'bin', 'lib', 'include', and 'share' installation directories.
+#
+# HDF4_INSTALL_NO_DEVELOPMENT :
+#   Set to true to skip installation of headers and CMake package files.
+#
 # Consider this example, it builds its own zlib
 # library and tells HDF4 to add it as a dependency - this ensures that
 # any project making use of this build of HDF4 will use the correct zlib
@@ -52,8 +76,8 @@ PROJECT (HDF4 C CXX)
 #   # Setup all necessary overrides for zlib so that HDF4 uses our
 #   # internally compiled zlib rather than any other version
 #   if (HDF4_ENABLE_Z_LIB_SUPPORT)
-#    # We must tell the main HDF4 library that it depends on our zlib 
-#     set (HDF4_LIB_DEPENDENCIES prjzlib)    
+#    # We must tell the main HDF4 library that it depends on our zlib
+#     set (HDF4_LIB_DEPENDENCIES prjzlib)
 #     # Override the zlib header file
 #     if (PRJ_USE_SYSTEM_ZLIB)
 #       set (H4_ZLIB_HEADER "zlib.h")
@@ -64,17 +88,18 @@ PROJECT (HDF4 C CXX)
 #       set (ZLIB_LIBRARIES prjzlib)
 #     endif (PRJ_USE_SYSTEM_ZLIB)
 #  endif (HDF4_ENABLE_Z_LIB_SUPPORT)
-#   
+#
 #   # Add the sub project
 #   add_subdirectory (Utilities/hdf4.2.5)
 #   # Add the HDF4 dirs to our include path
-#   set (HDF4_INCLUDE_DIR 
+#   set (HDF4_INCLUDE_DIR
 #       ${PROJECT_SOURCE_DIR}/Utilities/hdf4.2.5/hdf/src
 #       ${PROJECT_BINARY_DIR}/Utilities/hdf4.2.5
 #       ${PROJECT_SOURCE_DIR}/Utilities/hdf4.2.5/mfhdf/libsrc
 #   )
 #
 #-----------------------------------------------------------------------------
+string(TIMESTAMP CONFIG_DATE "%Y-%m-%d")
 
 #-----------------------------------------------------------------------------
 # Allow Visual Studio solution directories
@@ -94,7 +119,6 @@ mark_as_advanced (HDF4_NO_PACKAGES)
 #-----------------------------------------------------------------------------
 # Set the core names of all the libraries
 #-----------------------------------------------------------------------------
-set (HDF4_LIB_CORENAME              "hdf4")
 set (HDF4_SRC_LIB_CORENAME          "hdf")
 set (HDF4_SRC_FCSTUB_LIB_CORENAME   "hdf_fcstub")
 set (HDF4_SRC_FORTRAN_LIB_CORENAME  "hdf_fortran")
@@ -106,11 +130,13 @@ set (HDF4_MF_FCSTUB_LIB_CORENAME    "mfhdf_fcstub")
 set (HDF4_MF_FORTRAN_LIB_CORENAME   "mfhdf_fortran")
 set (HDF4_MF_TEST_LIB_CORENAME      "mf_test")
 set (HDF4_TOOLS_LIB_CORENAME        "h4tools")
+set (HDF4_JAVA_JNI_LIB_CORENAME     "hdf_java")
+set (HDF4_JAVA_HDF_LIB_CORENAME     "jarhdf")
+set (HDF4_JAVA_TEST_LIB_CORENAME    "jartest4")
 
 #-----------------------------------------------------------------------------
 # Set the true names of all the libraries if customized by external project
 #-----------------------------------------------------------------------------
-set (HDF4_LIB_NAME              "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_LIB_CORENAME}")
 set (HDF4_SRC_LIB_NAME          "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_LIB_CORENAME}")
 set (HDF4_SRC_FCSTUB_LIB_NAME   "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FCSTUB_LIB_CORENAME}")
 set (HDF4_SRC_FORTRAN_LIB_NAME  "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_SRC_FORTRAN_LIB_CORENAME}")
@@ -122,22 +148,38 @@ set (HDF4_MF_FCSTUB_LIB_NAME    "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_FCSTUB_LIB
 set (HDF4_MF_FORTRAN_LIB_NAME   "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_FORTRAN_LIB_CORENAME}")
 set (HDF4_MF_TEST_LIB_NAME      "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_MF_TEST_LIB_CORENAME}")
 set (HDF4_TOOLS_LIB_NAME        "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_TOOLS_LIB_CORENAME}")
+set (HDF4_JAVA_JNI_LIB_NAME     "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_JAVA_JNI_LIB_CORENAME}")
+set (HDF4_JAVA_HDF_LIB_NAME     "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_JAVA_HDF_LIB_CORENAME}")
+set (HDF4_JAVA_TEST_LIB_NAME    "${HDF4_EXTERNAL_LIB_PREFIX}${HDF4_JAVA_TEST_LIB_CORENAME}")
 
 #-----------------------------------------------------------------------------
 # Set the target names of all the libraries
 #-----------------------------------------------------------------------------
-set (HDF4_LIB_TARGET              ${HDF4_LIB_CORENAME})
-set (HDF4_SRC_LIB_TARGET          ${HDF4_SRC_LIB_CORENAME})
-set (HDF4_SRC_FCSTUB_LIB_TARGET   ${HDF4_SRC_FCSTUB_LIB_CORENAME})
-set (HDF4_SRC_FORTRAN_LIB_TARGET  ${HDF4_SRC_FORTRAN_LIB_CORENAME})
-set (HDF4_MF_LIB_TARGET           ${HDF4_MF_LIB_CORENAME})
-set (HDF4_MF_XDR_LIB_TARGET       ${HDF4_MF_XDR_LIB_CORENAME})
-set (HDF4_HDF_TEST_LIB_TARGET     ${HDF4_HDF_TEST_LIB_CORENAME})
-set (HDF4_HDF_TEST_FCSTUB_LIB_TARGET     ${HDF4_HDF_TEST_FCSTUB_LIB_CORENAME})
-set (HDF4_MF_FCSTUB_LIB_TARGET    ${HDF4_MF_FCSTUB_LIB_CORENAME})
-set (HDF4_MF_FORTRAN_LIB_TARGET   ${HDF4_MF_FORTRAN_LIB_CORENAME})
-set (HDF4_MF_TEST_LIB_TARGET      ${HDF4_MF_TEST_LIB_CORENAME})
-set (HDF4_TOOLS_LIB_TARGET        ${HDF4_TOOLS_LIB_CORENAME})
+set (HDF4_SRC_LIB_TARGET          "${HDF4_SRC_LIB_CORENAME}-static")
+set (HDF4_SRC_FCSTUB_LIB_TARGET   "${HDF4_SRC_FCSTUB_LIB_CORENAME}-static")
+set (HDF4_SRC_FORTRAN_LIB_TARGET  "${HDF4_SRC_FORTRAN_LIB_CORENAME}-static")
+set (HDF4_MF_LIB_TARGET           "${HDF4_MF_LIB_CORENAME}-static")
+set (HDF4_MF_XDR_LIB_TARGET       "${HDF4_MF_XDR_LIB_CORENAME}-static")
+set (HDF4_HDF_TEST_LIB_TARGET     "${HDF4_HDF_TEST_LIB_CORENAME}-static")
+set (HDF4_HDF_TEST_FCSTUB_LIB_TARGET     "${HDF4_HDF_TEST_FCSTUB_LIB_CORENAME}-static")
+set (HDF4_MF_FCSTUB_LIB_TARGET    "${HDF4_MF_FCSTUB_LIB_CORENAME}-static")
+set (HDF4_MF_FORTRAN_LIB_TARGET   "${HDF4_MF_FORTRAN_LIB_CORENAME}-static")
+set (HDF4_MF_TEST_LIB_TARGET      "${HDF4_MF_TEST_LIB_CORENAME}-static")
+set (HDF4_TOOLS_LIB_TARGET        "${HDF4_TOOLS_LIB_CORENAME}-static")
+set (HDF4_JAVA_JNI_LIB_TARGET     "${HDF4_JAVA_JNI_LIB_CORENAME}")
+set (HDF4_JAVA_HDF_LIB_TARGET     "${HDF4_JAVA_HDF_LIB_CORENAME}")
+set (HDF4_JAVA_TEST_LIB_TARGET    "${HDF4_JAVA_TEST_LIB_CORENAME}")
+set (HDF4_SRC_LIBSH_TARGET          "${HDF4_SRC_LIB_CORENAME}-shared")
+set (HDF4_SRC_FCSTUB_LIBSH_TARGET   "${HDF4_SRC_FCSTUB_LIB_CORENAME}-shared")
+set (HDF4_SRC_FORTRAN_LIBSH_TARGET  "${HDF4_SRC_FORTRAN_LIB_CORENAME}-shared")
+set (HDF4_MF_LIBSH_TARGET           "${HDF4_MF_LIB_CORENAME}-shared")
+set (HDF4_MF_XDR_LIBSH_TARGET       "${HDF4_MF_XDR_LIB_CORENAME}-shared")
+set (HDF4_HDF_TEST_LIBSH_TARGET     "${HDF4_HDF_TEST_LIB_CORENAME}-shared")
+set (HDF4_HDF_TEST_FCSTUB_LIBSH_TARGET     "${HDF4_HDF_TEST_FCSTUB_LIB_CORENAME}-shared")
+set (HDF4_MF_FCSTUB_LIBSH_TARGET    "${HDF4_MF_FCSTUB_LIB_CORENAME}-shared")
+set (HDF4_MF_FORTRAN_LIBSH_TARGET   "${HDF4_MF_FORTRAN_LIB_CORENAME}-shared")
+set (HDF4_MF_TEST_LIBSH_TARGET      "${HDF4_MF_TEST_LIB_CORENAME}-shared")
+set (HDF4_TOOLS_LIBSH_TARGET        "${HDF4_TOOLS_LIB_CORENAME}-shared")
 
 #-----------------------------------------------------------------------------
 # Define some CMake variables for use later in the project
@@ -150,13 +192,34 @@ set (HDF4_MFHDFSOURCE_DIR     ${HDF4_SOURCE_DIR}/mfhdf/libsrc)
 set (HDF4_MFHDF_TEST_DIR      ${HDF4_SOURCE_DIR}/mfhdf/test)
 set (HDF4_MFHDF_FORTRAN_DIR   ${HDF4_SOURCE_DIR}/mfhdf/fortran)
 set (HDF4_MFHDF_XDR_DIR       ${HDF4_SOURCE_DIR}/mfhdf/xdr)
+set (HDF4_JAVA_JNI_SRC_DIR         ${HDF4_SOURCE_DIR}/java/src/jni)
+set (HDF4_JAVA_HDF_SRC_DIR         ${HDF4_SOURCE_DIR}/java/src/hdf)
+set (HDF4_JAVA_TEST_SRC_DIR        ${HDF4_SOURCE_DIR}/java/test)
+set (HDF4_JAVA_LIB_DIR             ${HDF4_SOURCE_DIR}/java/lib)
+set (HDF4_JAVA_LOGGING_JAR         ${HDF4_SOURCE_DIR}/java/lib/slf4j-api-1.7.5.jar)
+set (HDF4_JAVA_LOGGING_NOP_JAR     ${HDF4_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.5.jar)
+set (HDF4_JAVA_LOGGING_SIMPLE_JAR  ${HDF4_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.5.jar)
+
+if (APPLE)
+  option (HDF4_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE)
+endif (APPLE)
 
 if (NOT HDF4_INSTALL_BIN_DIR)
   set (HDF4_INSTALL_BIN_DIR bin)
-  set (HDF4_INSTALL_UTILS_BIN_DIR ${HDF4_INSTALL_BIN_DIR}) #${HDF4_INSTALL_BIN_DIR}/utils
-  set (HDF4_INSTALL_TOOLS_BIN_DIR ${HDF4_INSTALL_BIN_DIR}) #${HDF4_INSTALL_BIN_DIR}/tools
+  set (HDF4_INSTALL_UTILS_BIN_DIR ${HDF4_INSTALL_BIN_DIR})
+  set (HDF4_INSTALL_TOOLS_BIN_DIR ${HDF4_INSTALL_BIN_DIR})
 endif (NOT HDF4_INSTALL_BIN_DIR)
 if (NOT HDF4_INSTALL_LIB_DIR)
+  if (APPLE)
+    if (HDF4_BUILD_FRAMEWORKS)
+      set (HDF4_INSTALL_JAR_DIR ../Java)
+    else (HDF4_BUILD_FRAMEWORKS)
+      set (HDF4_INSTALL_JAR_DIR lib)
+    endif (HDF4_BUILD_FRAMEWORKS)
+    set (HDF4_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+  else (APPLE)
+    set (HDF4_INSTALL_JAR_DIR lib)
+  endif (APPLE)
   set (HDF4_INSTALL_LIB_DIR lib)
 endif (NOT HDF4_INSTALL_LIB_DIR)
 if (NOT HDF4_INSTALL_INCLUDE_DIR)
@@ -164,6 +227,14 @@ if (NOT HDF4_INSTALL_INCLUDE_DIR)
 endif (NOT HDF4_INSTALL_INCLUDE_DIR)
 if (NOT HDF4_INSTALL_DATA_DIR)
   if (NOT WIN32)
+    if (APPLE)
+      if (HDF4_BUILD_FRAMEWORKS)
+        set (HDF4_INSTALL_EXTRA_DIR ../SharedSupport)
+      else (HDF4_BUILD_FRAMEWORKS)
+        set (HDF4_INSTALL_EXTRA_DIR share)
+      endif (HDF4_BUILD_FRAMEWORKS)
+      set (HDF4_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+    endif (APPLE)
     set (HDF4_INSTALL_DATA_DIR share)
     set (HDF4_INSTALL_CMAKE_DIR share/cmake)
   else (NOT WIN32)
@@ -172,6 +243,10 @@ if (NOT HDF4_INSTALL_DATA_DIR)
   endif (NOT WIN32)
 endif (NOT HDF4_INSTALL_DATA_DIR)
 
+if(DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
+  set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
+endif(DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
+
 #-----------------------------------------------------------------------------
 # parse the full version number from hfile.h and include in H4_VERS_INFO
 #-----------------------------------------------------------------------------
@@ -226,6 +301,11 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED)
   set (CMAKE_Fortran_MODULE_DIRECTORY
       ${PROJECT_BINARY_DIR}/bin/fortran CACHE PATH "Single Directory for all fortran modules."
   )
+  if (WIN32)
+    set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE})
+  else (WIN32)
+    set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+  endif (WIN32)
 else (NOT HDF4_EXTERNALLY_CONFIGURED)
   # if we are externally configured, but the project uses old cmake scripts
   # this may not be set and utilities like Hdetect will fail
@@ -260,21 +340,23 @@ include (${HDF_RESOURCES_DIR}/ConfigureChecks.cmake)
 set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
 
 #-----------------------------------------------------------------------------
-# Option to Build Shared/Static libs, default is static
+# Mac OS X Options
+#-----------------------------------------------------------------------------
+if (HDF4_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
+  set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries")
+endif (HDF4_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# Option to Build Shared and Static libs, default is static
 #-----------------------------------------------------------------------------
 option (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
-set (LIB_TYPE STATIC)
 set (H4_ENABLE_SHARED_LIB NO)
-set (H4_ENABLE_STATIC_LIB NO)
 if (BUILD_SHARED_LIBS)
-  set (LIB_TYPE SHARED)
-  set (H4_BUILT_AS_DYNAMIC_LIB 1)
   set (H4_ENABLE_SHARED_LIB YES)
-else (BUILD_SHARED_LIBS)
-  set (H4_BUILT_AS_STATIC_LIB 1)
-  set (H4_ENABLE_STATIC_LIB YES)
-  set (CMAKE_POSITION_INDEPENDENT_CODE ON)
+  set (LINK_SHARED_LIBS ${LINK_LIBS})
 endif (BUILD_SHARED_LIBS)
+set (H4_ENABLE_STATIC_LIB YES)
+set (CMAKE_POSITION_INDEPENDENT_CODE ON)
 
 add_definitions (-DBIG_LONGS -DSWAP)
 add_definitions (-DHAVE_CONFIG_H)
@@ -301,7 +383,7 @@ option (HDF4_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" O
 if (HDF4_ENABLE_COVERAGE)
     set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
     set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
-    set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")   
+    set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")
 endif (HDF4_ENABLE_COVERAGE)
 
 #-----------------------------------------------------------------------------
@@ -309,18 +391,18 @@ endif (HDF4_ENABLE_COVERAGE)
 #-----------------------------------------------------------------------------
 option (HDF4_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON)
 if (HDF4_ENABLE_DEPRECATED_SYMBOLS)
-  set (H4_NO_DEPRECATED_SYMBOLS 0)   
+  set (H4_NO_DEPRECATED_SYMBOLS 0)
 else (HDF4_ENABLE_DEPRECATED_SYMBOLS)
-  set (H4_NO_DEPRECATED_SYMBOLS 1)   
+  set (H4_NO_DEPRECATED_SYMBOLS 1)
 endif (HDF4_ENABLE_DEPRECATED_SYMBOLS)
 
 #-----------------------------------------------------------------------------
 # Include the main src and config directories
 #-----------------------------------------------------------------------------
 set (HDF4_INCLUDE_DIRECTORIES
-    ${HDF4_HDFSOURCE_DIR} 
-    ${HDF4_MFHDFSOURCE_DIR} 
-    ${HDF4_SOURCE_DIR} 
+    ${HDF4_HDFSOURCE_DIR}
+    ${HDF4_MFHDFSOURCE_DIR}
+    ${HDF4_SOURCE_DIR}
     ${HDF4_BINARY_DIR}
     ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
 )
@@ -440,7 +522,7 @@ if (HDF4_ENABLE_PARALLEL)
     # MPI checks, only do these if MPI_C_FOUND is true, otherwise they always fail
     # and once set, they are cached as false and not regenerated
     set (CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" )
-    CHECK_FUNCTION_EXISTS (MPI_File_get_size H4_HAVE_MPI_GET_SIZE) 
+    CHECK_FUNCTION_EXISTS (MPI_File_get_size H4_HAVE_MPI_GET_SIZE)
     # Used by Fortran + MPI
     CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h"  H4_HAVE_MPI_MULTI_LANG_Comm)
     CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h"  H4_HAVE_MPI_MULTI_LANG_Info)
@@ -462,6 +544,9 @@ endif (H4_HAVE_PARALLEL)
 #-----------------------------------------------------------------------------
 include (UserMacros.cmake)
 
+#-----------------------------------------------------------------------------
+# Include filter (zlib, szip, etc.) macros
+#-----------------------------------------------------------------------------
 include (CMakeFilters.cmake)
 
 #-----------------------------------------------------------------------------
@@ -478,7 +563,7 @@ if (NOT HDF4_EXTERNALLY_CONFIGURED)
     if (HDF4_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
       PACKAGE_ZLIB_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT})
     endif (HDF4_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND)
-    
+
     if (HDF4_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
       PACKAGE_SZIP_LIBRARY (${HDF4_ALLOW_EXTERNAL_SUPPORT})
     endif (HDF4_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
@@ -506,23 +591,35 @@ add_subdirectory (${HDF4_SOURCE_DIR}/mfhdf/libsrc   ${PROJECT_BINARY_DIR}/mfhdf/
 if (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
   if (JPEG_FOUND AND JPEG_USE_EXTERNAL)
     add_dependencies (${HDF4_SRC_LIB_TARGET} JPEG)
+    if (BUILD_SHARED_LIBS)
+      add_dependencies (${HDF4_SRC_LIBSH_TARGET} JPEG)
+    endif (BUILD_SHARED_LIBS)
   endif (JPEG_FOUND AND JPEG_USE_EXTERNAL)
   if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
     add_dependencies (${HDF4_SRC_LIB_TARGET} ZLIB)
+    if (BUILD_SHARED_LIBS)
+      add_dependencies (${HDF4_SRC_LIBSH_TARGET} ZLIB)
+    endif (BUILD_SHARED_LIBS)
   endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
   if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
     add_dependencies (${HDF4_SRC_LIB_TARGET} SZIP)
+    if (BUILD_SHARED_LIBS)
+      add_dependencies (${HDF4_SRC_LIBSH_TARGET} SZIP)
+    endif (BUILD_SHARED_LIBS)
   endif (SZIP_FOUND AND SZIP_USE_EXTERNAL)
 endif (HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF4_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
 
 if (HDF4_BUILD_XDR_LIB)
   add_dependencies (${HDF4_MF_LIB_TARGET} ${HDF4_MF_XDR_LIB_TARGET})
+  if (BUILD_SHARED_LIBS)
+    add_dependencies (${HDF4_MF_LIBSH_TARGET} ${HDF4_MF_XDR_LIBSH_TARGET})
+  endif (BUILD_SHARED_LIBS)
 endif (HDF4_BUILD_XDR_LIB)
 
 #-----------------------------------------------------------------------------
 # Dashboard and Testing Settings
 #-----------------------------------------------------------------------------
-option (BUILD_TESTING "Build HDF4 Unit Testing" OFF)
+option (BUILD_TESTING "Build HDF4 Unit Testing" ON)
 if (BUILD_TESTING)
   set (DART_TESTING_TIMEOUT 1200
       CACHE INTEGER
@@ -530,6 +627,10 @@ if (BUILD_TESTING)
   )
   enable_testing ()
   include (CTest)
+
+  include (${HDF4_SOURCE_DIR}/CTestConfig.cmake)
+  configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF4_BINARY_DIR}/CTestCustom.ctest @ONLY)
+
   if (NOT HDF4_EXTERNALLY_CONFIGURED)
     if (EXISTS "${HDF4_SOURCE_DIR}/hdf/test" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/hdf/test")
       add_subdirectory (${HDF4_SOURCE_DIR}/hdf/test   ${PROJECT_BINARY_DIR}/hdf/test)
@@ -538,8 +639,6 @@ if (BUILD_TESTING)
       add_subdirectory (${HDF4_SOURCE_DIR}/mfhdf/test ${PROJECT_BINARY_DIR}/mfhdf/test)
     endif (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/test" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/test")
   endif (NOT HDF4_EXTERNALLY_CONFIGURED)
-  include (${HDF4_SOURCE_DIR}/CTestConfig.cmake)
-  configure_file (${HDF_RESOURCES_DIR}/CTestCustom.cmake ${HDF4_BINARY_DIR}/CTestCustom.ctest @ONLY)
 endif (BUILD_TESTING)
 
 #-----------------------------------------------------------------------------
@@ -596,6 +695,16 @@ if (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/examples" AND IS_DIRECTORY "${HDF4_SOURCE_D
 endif (EXISTS "${HDF4_SOURCE_DIR}/mfhdf/examples" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/mfhdf/examples")
 
 #-----------------------------------------------------------------------------
+# Option to build HDF4 Java Library
+#-----------------------------------------------------------------------------
+if (EXISTS "${HDF4_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/java")
+  option (HDF4_BUILD_JAVA  "Build Java HDF Library" OFF)
+  if (HDF4_BUILD_JAVA)
+    add_subdirectory (${HDF4_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java)
+  endif (HDF4_BUILD_JAVA)
+endif (EXISTS "${HDF4_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF4_SOURCE_DIR}/java")
+
+#-----------------------------------------------------------------------------
 # Generate the H4config.h file containing user settings needed by compilation
 #-----------------------------------------------------------------------------
 configure_file (${HDF_RESOURCES_DIR}/h4config.h.in      ${PROJECT_BINARY_DIR}/h4config.h @ONLY)
diff --git a/COPYING b/COPYING
index 825f1ce..ecd09c0 100644
--- a/COPYING
+++ b/COPYING
@@ -4,7 +4,7 @@ Hierarchical Data Format (HDF) Software Library and Utilities
 ---------------------------------------------------------------------------
 
 Hierarchical Data Format (HDF) Software Library and Utilities
-Copyright 2006-2015 by The HDF Group.
+Copyright 2006-2016 by The HDF Group.
 
 NCSA Hierarchical Data Format (HDF) Software Library and Utilities
 Copyright 1988-2006 by the Board of Trustees of the University of Illinois.
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 6bc8702..ae5da48 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -9,10 +9,10 @@ set (CTEST_NIGHTLY_START_TIME "18:00:00 CST")
 
 set (CTEST_DROP_METHOD "http")
 if (CDASH_LOCAL)
-  set (CTEST_DROP_SITE "72.36.68.252")
+  set (CTEST_DROP_SITE "10.10.10.82")
   set (CTEST_DROP_LOCATION "/submit.php?project=HDF4")
 else (CDASH_LOCAL)
-  set (CTEST_DROP_SITE "cdash.hdfgroup.uiuc.edu")
+  set (CTEST_DROP_SITE "cdash.hdfgroup.org")
   set (CTEST_DROP_LOCATION "/submit.php?project=HDF4")
 endif (CDASH_LOCAL)
 set (CTEST_DROP_SITE_CDASH TRUE)
diff --git a/MANIFEST b/MANIFEST
index da8c4d8..ee3c6bd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -31,12 +31,31 @@
 ./libhdf4.settings.in
 ./move-if-change
 
+./m4/ax_check_class.m4
+./m4/ax_check_classpath.m4
+./m4/ax_check_java_home.m4
+./m4/ax_check_junit.m4
+./m4/ax_check_rqrd_class.m4
+./m4/ax_java_check_class.m4
+./m4/ax_java_options.m4
+./m4/ax_jni_include_dir.m4
+./m4/ax_prog_jar.m4
+./m4/ax_prog_java_cc.m4
+./m4/ax_prog_java_works.m4
+./m4/ax_prog_java.m4
+./m4/ax_prog_javac_works.m4
+./m4/ax_prog_javac.m4
+./m4/ax_prog_javadoc.m4
+./m4/ax_prog_javah.m4
+./m4/ax_try_compile_java.m4
+./m4/ax_try_run_java.m4
 ./m4/ltsugar.m4
 ./m4/libtool.m4
 ./m4/ltversion.m4
 ./m4/lt~obsolete.m4
 ./m4/ltoptions.m4
 
+./bin/bbrelease       _DO_NOT_DISTRIBUTE_
 ./bin/chkmanifest
 ./bin/cmakehdf4
 ./bin/compile
@@ -44,6 +63,7 @@
 ./bin/config.sub
 ./bin/depcomp
 ./bin/deploy
+./bin/h4_release_check.sh
 ./bin/install-sh
 ./bin/locate_sw
 ./bin/ltmain.sh
@@ -480,6 +500,89 @@
 ./hdf/util/testfiles/fp2hdf/pal.hdf
 ./hdf/util/testfiles/fp2hdf/t100x100
 
+./java/CMakeLists.txt
+./java/Makefile.am
+./java/Makefile.in
+./java/examples/CMakeLists.txt
+./java/examples/Makefile.am
+./java/examples/Makefile.in
+./java/examples/HDF4DatasetCreate.java
+./java/examples/HDF4FileCreate.java
+./java/examples/HDF4GroupCreate.java
+./java/lib/hamcrest-core.jar
+./java/lib/junit.jar
+./java/lib/simplelogger.properties
+./java/lib/slf4j-api-1.7.5.jar
+./java/lib/ext/slf4j-nop-1.7.5.jar
+./java/lib/ext/slf4j-simple-1.7.5.jar
+./java/src/CMakeLists.txt
+./java/src/Makefile.am
+./java/src/Makefile.in
+./java/src/hdf/CMakeLists.txt
+./java/src/hdf/overview.html
+./java/src/hdf/hdflib/CMakeLists.txt
+./java/src/hdf/hdflib/HDFArray.java
+./java/src/hdf/hdflib/HDFChunkInfo.java
+./java/src/hdf/hdflib/HDFCompInfo.java
+./java/src/hdf/hdflib/HDFConstants.java
+./java/src/hdf/hdflib/HDFDeflateCompInfo.java
+./java/src/hdf/hdflib/HDFException.java
+./java/src/hdf/hdflib/HDFIMCOMPCompInfo.java
+./java/src/hdf/hdflib/HDFJavaException.java
+./java/src/hdf/hdflib/HDFJPEGCompInfo.java
+./java/src/hdf/hdflib/HDFLibrary.java
+./java/src/hdf/hdflib/HDFLibraryException.java
+./java/src/hdf/hdflib/HDFNativeData.java
+./java/src/hdf/hdflib/HDFNBITChunkInfo.java
+./java/src/hdf/hdflib/HDFNBITCompInfo.java
+./java/src/hdf/hdflib/HDFNewCompInfo.java
+./java/src/hdf/hdflib/HDFNotImplementedException.java
+./java/src/hdf/hdflib/HDFOldCompInfo.java
+./java/src/hdf/hdflib/HDFOldRLECompInfo.java
+./java/src/hdf/hdflib/HDFRLECompInfo.java
+./java/src/hdf/hdflib/HDFSKPHUFFCompInfo.java
+./java/src/hdf/hdflib/HDFSZIPCompInfo.java
+./java/src/jni/CMakeLists.txt
+./java/src/jni/Makefile.am
+./java/src/jni/Makefile.in
+./java/src/jni/h4jni.h
+./java/src/jni/hdfanImp.c
+./java/src/jni/hdfdfpalImp.c
+./java/src/jni/hdfdfuImp.c
+./java/src/jni/hdfexceptionImp.c
+./java/src/jni/hdfgrImp.c
+./java/src/jni/hdfheImp.c
+./java/src/jni/hdfhxImp.c
+./java/src/jni/hdfImp.c
+./java/src/jni/hdfnativeImp.c
+./java/src/jni/hdfr24Imp.c
+./java/src/jni/hdfr8Imp.c
+./java/src/jni/hdfsdsImp.c
+./java/src/jni/hdfstructsutil.c
+./java/src/jni/hdfvdataImp.c
+./java/src/jni/hdfvfImp.c
+./java/src/jni/hdfvgroupImp.c
+./java/src/jni/hdfvhImp.c
+./java/src/jni/hdfvqImp.c
+./java/src/jni/hdfvsqImp.c
+./java/test/CMakeLists.txt
+./java/test/Makefile.am
+./java/test/Makefile.in
+./java/test/junit.sh.in
+./java/test/JUnit-interface.ert
+./java/test/JUnit-interface.txt
+./java/test/TestAll.java
+./java/test/TestH4.java
+./java/test/TestH4ANparams.java
+./java/test/TestH4DFparams.java
+./java/test/TestH4DFPparams.java
+./java/test/TestH4DFRparams.java
+./java/test/TestH4GRparams.java
+./java/test/TestH4HCparams.java
+./java/test/TestH4SDparams.java
+./java/test/TestH4Vparams.java
+./java/test/TestH4VSparams.java
+
 ./man/Makefile.am
 ./man/Makefile.in
 ./man/gr_chunk.3
@@ -518,6 +621,7 @@
 ./mfhdf/dumper/testfiles/IMCOMP.hdf
 ./mfhdf/dumper/testfiles/LongDataset.hdf
 ./mfhdf/dumper/testfiles/Roy.nc
+./mfhdf/dumper/testfiles/Roy-64.nc
 ./mfhdf/dumper/testfiles/SDSlongname.hdf
 ./mfhdf/dumper/testfiles/Tables.hdf
 ./mfhdf/dumper/testfiles/Tables_External_File
@@ -568,6 +672,7 @@
 ./mfhdf/dumper/testfiles/dumpsds-16.out
 ./mfhdf/dumper/testfiles/dumpsds-17.out
 ./mfhdf/dumper/testfiles/dumpsds-18.out
+./mfhdf/dumper/testfiles/dumpsds-19.out
 ./mfhdf/dumper/testfiles/dumpvd-10.out
 ./mfhdf/dumper/testfiles/dumpvd-11.out
 ./mfhdf/dumper/testfiles/dumpvd-12.out
@@ -931,6 +1036,8 @@
 ./mfhdf/test/hdftest.h
 ./mfhdf/test/sds_szipped.dat
 ./mfhdf/test/smallslice.0000.nc
+./mfhdf/test/Roy.nc
+./mfhdf/test/Roy-64.nc
 ./mfhdf/test/tattdatainfo.c
 ./mfhdf/test/tattributes.c
 ./mfhdf/test/tchunk.c
@@ -940,6 +1047,7 @@
 ./mfhdf/test/tdatasizes.c
 ./mfhdf/test/tdim.c
 ./mfhdf/test/temptySDSs.c
+./mfhdf/test/texternal.c
 ./mfhdf/test/test1.nc
 ./mfhdf/test/testout.sav
 ./mfhdf/test/testmfhdf.sh.in
@@ -1031,24 +1139,29 @@
 
 ./config/cmake/cacheinit.cmake
 ./config/cmake/ConfigureChecks.cmake
+./config/cmake/CPack.Info.plist.in
 ./config/cmake/CTestCustom.cmake
 ./config/cmake/FindHDF4.cmake.in
+./config/cmake/FindJNI.cmake
 ./config/cmake/h4config.h.in
 ./config/cmake/HDF4_Examples.cmake.in
 ./config/cmake/hdf4-config-version.cmake.in
-./config/cmake/hdf4-config.cmake.build.in
-./config/cmake/hdf4-config.cmake.install.in
+./config/cmake/hdf4-config.cmake.in
 ./config/cmake/HDF4Macros.cmake
 ./config/cmake/HDF4UseFortran.cmake
+./config/cmake/jrunTest.cmake
 ./config/cmake/libhdf4.settings.cmake.in
 ./config/cmake/mccacheinit.cmake
 ./config/cmake/NSIS.InstallOptions.ini.in
+./config/cmake/patch.xml
 ./config/cmake/PkgInfo.in
 ./config/cmake/README.txt.cmake.in
+./config/cmake/UseJava.cmake
+./config/cmake/UseJavaClassFilelist.cmake
+./config/cmake/UseJavaSymlinks.cmake
 
 ./config/cmake_ext_mod/CheckTypeSize.cmake
 ./config/cmake_ext_mod/ConfigureChecks.cmake
-./config/cmake_ext_mod/CPack.Info.plist.in
 ./config/cmake_ext_mod/CTestCustom.cmake
 ./config/cmake_ext_mod/FindMPI.cmake      _DO_NOT_DISTRIBUTE_
 ./config/cmake_ext_mod/FindSZIP.cmake
diff --git a/Makefile.am b/Makefile.am
index e146a28..65f7a0f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,13 @@
 
 include $(top_srcdir)/config/commence.am
 
-SUBDIRS = hdf mfhdf man
+if BUILD_JAVA_CONDITIONAL
+   JAVA_DIR=java
+else
+   JAVA_DIR=
+endif
+
+SUBDIRS = hdf mfhdf $(JAVA_DIR) man
 # install libhdf4.settings in lib directory
 settingsdir = $(libdir)
 settings_DATA = libhdf4.settings
diff --git a/Makefile.in b/Makefile.in
index e9a80c1..67dc12b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -92,7 +92,20 @@ DIST_COMMON = $(top_srcdir)/config/commence.am $(srcdir)/Makefile.in \
 	$(top_srcdir)/bin/ltmain.sh $(top_srcdir)/bin/missing
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -185,7 +198,7 @@ am__define_uniq_tagged_files = \
 ETAGS = etags
 CTAGS = ctags
 CSCOPE = cscope
-DIST_SUBDIRS = $(SUBDIRS)
+DIST_SUBDIRS = hdf mfhdf java man
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -270,12 +283,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -318,11 +346,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -396,7 +427,9 @@ ACLOCAL_AMFLAGS = "-I m4"
 # .chkexe files are used to mark tests that have run successfully.
 # .chklog files are output from those tests.
 CHECK_CLEANFILES = *.chkexe *.chklog
-SUBDIRS = hdf mfhdf man
+ at BUILD_JAVA_CONDITIONAL_FALSE@JAVA_DIR = 
+ at BUILD_JAVA_CONDITIONAL_TRUE@JAVA_DIR = java
+SUBDIRS = hdf mfhdf $(JAVA_DIR) man
 # install libhdf4.settings in lib directory
 settingsdir = $(libdir)
 settings_DATA = libhdf4.settings
diff --git a/README.txt b/README.txt
index 6d397d9..4feb53b 100644
--- a/README.txt
+++ b/README.txt
@@ -1,16 +1,25 @@
-HDF version 4.2.11 released on 2015-02-09
+HDF version 4.2.12 released on 2016-06-29
 ===================================================
 
-Obtaining the latest version of HDF4
-------------------------------------
- The most recent version of the distribution can be obtained from
- the The HDF Group's FTP site:
+Information about HDF
+---------------------
 
-     ftp://ftp.hdfgroup.org/HDF/HDF_Current/
+ The HDF (or HDF4) home page is located here:
 
+    https://www.hdfgroup.org/products/hdf4/index.html  
 
+ The most recent version of the software can be obtained from:
+
+    https://www.hdfgroup.org/release4/obtain.html
+
+ The HDF documentation can be found in:
+
+    https://www.hdfgroup.org/release4/doc.html 
+
+     
 Source Distribution Layout
 --------------------------
+
  The top level of the source code distribution contains the following 
  subdirectories:
 
@@ -24,6 +33,8 @@ Source Distribution Layout
              Please see the README in each directory for further 
              information on each package. 
 
+   java   -- The Java HDF JNI library
+
    mfhdf  -- The netCDF(mfhdf) part of the HDF/mfhdf distribution and
              additional HDF utilities, such as hdp, hrepack, hdfimport, etc.
 
@@ -34,20 +45,13 @@ Source Distribution Layout
              Descriptions of new features and bug fixes in this release.
              Files in this sub-directory can be used as supplemental 
              documentation for HDF. 
-             These files are also available on the THG FTP server: 
-             ftp://ftp.hdfgroup.org/HDF/HDF_Current/src/unpacked/release_notes
-
-   windows-- Removed 4/2013.
 
 
 Third Party Software Requirements
 ---------------------------------
- 1. JPEG distribution release 6b(libjpeg.a).  You may download the software
-    from http://www.hdfgroup.org/release4/obtain.html.
-
- 2. ZLIB 1.1.4(libz.a) or later  distribution.  You may download the software
-    from the http://www.gzip.org/ site.
+  * JPEG distribution release 6b or later.
 
+  * ZLIB 1.1.4(libz.a) or later. 
 
 
 System Requirements
@@ -63,28 +67,3 @@ Configuring/Testing/Installing
  See the INSTALL file for instructions on configuring, testing, 
  and installing this software on Unix and non-UNIX systems.
 
-
-DOCUMENTATION/FAQ/HELP
-----------------------
- The HDF documentation can be found on the THG FTP server and on 
- the THG website:
-
-      http://hdfgroup.org/doc.html
-      ftp://ftp.hdfgroup.org/HDF/Documentation  
-
- The HDF home page is at:
-
-      http://hdfgroup.org
-
- An FAQ is available on the FTP server and as under "Information about 
- HDF" on the website.
-
-      http://hdfgroup.org/products/hdf4/index.html
-
- If you have any questions or comments, or would like to be added to 
- or removed from our hdfnews email list, contact information and other 
- resource information can be found on the HDF Support page:
-
-     http://hdfgroup.org/services/support.html
-
-
diff --git a/aclocal.m4 b/aclocal.m4
index 1ecfa26..b9e6632 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1183,6 +1183,19 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([m4/ax_check_class.m4])
+m4_include([m4/ax_check_classpath.m4])
+m4_include([m4/ax_check_java_home.m4])
+m4_include([m4/ax_check_junit.m4])
+m4_include([m4/ax_java_options.m4])
+m4_include([m4/ax_jni_include_dir.m4])
+m4_include([m4/ax_prog_jar.m4])
+m4_include([m4/ax_prog_java.m4])
+m4_include([m4/ax_prog_java_works.m4])
+m4_include([m4/ax_prog_javac.m4])
+m4_include([m4/ax_prog_javac_works.m4])
+m4_include([m4/ax_prog_javadoc.m4])
+m4_include([m4/ax_try_compile_java.m4])
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
diff --git a/bin/chkmanifest b/bin/chkmanifest
index 69cd728..da4a98a 100755
--- a/bin/chkmanifest
+++ b/bin/chkmanifest
@@ -12,6 +12,7 @@
 verbose=yes
 MANIFEST=/tmp/HD_MANIFEST.$$
 SVNENTRY=/tmp/HD_SVNENTRY.$$
+USE_SVN_LS=""
 
 # function definitions
 
@@ -129,28 +130,49 @@ done
 # I don't know what the official svn format is if such a specification exists.
 # Algorithm:
 # If the first line of the file has 'xml version="1.0"' in it, it is created
-# by svn 1.3 or older; else if it has '^file$' in it, it is created by svn 1.4.
+# by svn 1.3 or older; else if it has '^file$' in it, it is created by 
+# svn 1.4 - 1.6.  Otherwise it is assumed to be newer, and 'svn ls -R'
+# will give a list of checked in files.
 svn_entry_file=.svn/entries
 if head -1 $svn_entry_file | grep 'xml version="1.0"' > /dev/null 2>&1;then
     getsvnentries=GETSVNENTRIES_13
 elif grep '^file$' $svn_entry_file > /dev/null 2>&1; then
     getsvnentries=GETSVNENTRIES_14
 else
-    echo "Unknown svn entries format. Aborted"
-    exit 1
+    USE_SVN_LS="yes"
+#    echo "Unknown svn entries format. Aborted"
+#    exit 1
 fi
 
-for svn in `find . -type d -name .svn -print`; do
-    path=`echo $svn |sed 's/\/.svn//'`
-    for file in `$getsvnentries $svn`; do
-	if (grep ^$path/$file$ $MANIFEST >/dev/null); then
-	    :
-	else
-	    echo "+ $path/$file"
-	    fail=yes
-	fi
+if [ -z "${USE_SVN_LS}" ]; then
+    for svn in `find . -type d -name .svn -print`; do
+        path=`echo $svn |sed 's/\/.svn//'`
+        for file in `$getsvnentries $svn`; do
+       	    if (grep ^$path/$file$ $MANIFEST >/dev/null); then
+    	        :
+       	    else
+       	        echo "+ $path/$file"
+                fail=yes
+            fi
+        done
     done
-done
+else
+    # Next check svn ls, which gets a list of all files that are
+    # checked in.
+    svn_ls=`svn ls -R`
+    for file in $svn_ls; do
+        path="./${file}"
+        # Ignore directories
+        if [ ! -d $path ]; then
+            if (grep ^$path$ $MANIFEST >/dev/null); then
+                :
+            else
+                echo "+ $path"
+                fail=yes
+            fi
+        fi
+    done
+fi
 
 if [ "X$fail" = "Xyes" ]; then
     cat 1>&2 <<EOF
diff --git a/bin/cmakehdf4 b/bin/cmakehdf4
index 19f0c47..85174ce 100755
--- a/bin/cmakehdf4
+++ b/bin/cmakehdf4
@@ -114,7 +114,7 @@ fi
 echo Running Cmake for HDF4-${version} ...
 
 #      4. Configure the C library, tools and tests with this command:
-STEP "Configure..." "cmake -C $srcdir/config/cmake/cacheinit.cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH="." -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="SVN" -DHDF4_PACKAGE_EXTLIBS:BOOL=ON -DHDF4_BUILD_TOOLS:BOOL=ON -DHDF4_BUILD_UTILS:BOOL=ON -DBUILD_TESTING:BOOL=ON $srcdir" $configlog
+STEP "Configure..." "cmake -C $srcdir/config/cmake/cacheinit.cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH="$PWD" -DHDF4_ALLOW_EXTERNAL_SUPPORT:STRING="" -DHDF4_PACKAGE_EXTLIBS:BOOL=OFF -DHDF4_BUILD_TOOLS:BOOL=ON -DHDF4_BUILD_UTILS:BOOL=ON -DBUILD_TESTING:BOOL=ON $srcdir" $configlog
       
 #      5. Build the C library, tools and tests with this command:
 STEP "Build the library, tools and tests, ..." "cmake --build . --config Release" $makelog
@@ -190,7 +190,7 @@ EOF
 #==========
 #==========
 cat > $cfgfile <<'EOF'
-cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
 ########################################################
 # This dashboard is maintained by The HDF Group
 # For any comments please contact cdashhelp at hdfgroup.org
diff --git a/bin/h4_release_check.sh b/bin/h4_release_check.sh
new file mode 100755
index 0000000..0bdd439
--- /dev/null
+++ b/bin/h4_release_check.sh
@@ -0,0 +1,231 @@
+#!/bin/bash
+red=$(tput setaf 1)
+green=$(tput setaf 2)
+yellow=$(tput setaf 3)
+magenta=$(tput setaf 5)
+reset=$(tput sgr0)
+pass=0
+fail=1
+
+##################################################
+# TESTING CONTENTS OF lib/libhdf4.settings file.
+##################################################
+
+if [ ! -f ./lib/libhdf4.settings ]; then
+   echo " $red FAILED$reset: ./lib/libhdf4.settings  DOES NOT EXIST"
+   exit 1
+fi
+
+# CHECKING FOR SHARED LIBRARIES
+if grep -q "Shared Libraries: no" ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- Shared Libraries  ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- Shared Libraries  ... $red FAILED$reset"
+   echo "  ... Should be 'Shared Libraries: no'"
+fi
+
+# CHECKING FOR STATIC LIBRARIES
+if grep -q "Static Libraries: yes" ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- Static Libraries  ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- Shared Libraries  ... $red FAILED$reset"
+   echo "  ... Should be 'Static Libraries: yes'"
+fi
+
+# CHECKING FOR FORTRAN ENABLED
+if grep -q "Fortran: yes" ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- Fortran Support   ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- Fortran Support   ... $red FAILED$reset"
+   echo "  ... Should be 'Fortran: yes'"
+fi
+
+# CHECKING COMPILATION MODE
+if grep -q "Compilation Mode: production" ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- Compilation Mode  ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- Compilation Mode  ... $red FAILED$reset"
+   echo "  ... Should be 'Compilation Mode: production'"
+fi
+
+# CHECKING OPTIMIZATION
+if grep -q " -g " ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- Optimization Mode ... $red FAILED$reset"
+   echo "  ... Should be no there is no '-g' flag among compiler flags"
+else
+   echo "Checking ./lib/libhdf4.settings -- Optimization Mode ... $green PASSED$reset"
+fi
+
+#CHECKING COMPRESSION
+if grep -q " -ljpeg " ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- JPEG COMPRESSION  ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- JPEG COMPRESSION  ... $yellow WARNING$reset"
+   echo "  ... JPEG compression was not found"
+fi
+if grep -q " -lz " ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- ZLIB COMPRESSION  ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- ZLIB COMPRESSION  ... $red FAILED$reset"
+   echo "  ... ZLIB compression is required"
+fi
+
+if grep -q "SZIP compression: enabled" ./lib/libhdf4.settings; then
+   echo "Checking ./lib/libhdf4.settings -- SZIP COMPRESSION  ... $green PASSED$reset"
+else
+   echo "Checking ./lib/libhdf4.settings -- SZIP COMPRESSION  ... $red FAILED$reset"
+   echo "  ... SZIP compression should be enabled"
+fi
+
+
+
+#########################
+# TESTING IF FILES EXISTS
+#########################
+
+include_file=(atom.h bitvect.h cdeflate.h cnbit.h cnone.h crle.h cskphuff.h cszip.h dfan.h
+dffunc.f90 dffunc.inc dfgr.h df.h dfi.h dfrig.h dfsd.h dfstubs.h dfufp2i.h dynarray.h H4api_adpt.h
+h4config.h hbitio.h hchunks.h hcomp.h hcompi.h hconv.h hdatainfo.h hdf2netcdf.h hdf.f90
+hdf.h hdfi.h hdf.inc herr.h hfile.h hkit.h hlimits.h hntdefs.h hproto_fortran.h hproto.h
+htags.h linklist.h local_nc.h mfan.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h mfhdf.h
+mfhdfi.h mstdio.h netcdf.f90 netcdf.h netcdf.inc tbbt.h vattr.h vg.h)
+
+lib_file=(libdf.a libdf.la libhdf4.settings libjpeg.a libmfhdf.a libmfhdf.la libsz.a libz.a)
+
+bin_file=(gif2hdf h4cc h4fc h4redeploy hdf24to8 hdf2gif hdf2jpeg hdf8to24 hdfcomp
+hdfed hdfimport hdfls hdfpack hdftopal hdftor8 hdfunpac hdiff hdp hrepack jpeg2hdf
+ncdump ncgen paltohdf r8tohdf ristosds vmake vshow)
+
+# TEST TO MAKE SURE THE DIRECTORIES EXISTS
+
+if [ ! -d ./include ]; then
+   echo " FAILED: ./include DIRECTORY DOES NOT EXIST"
+   exit
+fi
+if [ ! -d ./bin ]; then
+   echo " FAILED: ./bin DIRECTORY DOES NOT EXIST"
+   exit
+fi
+if [ ! -d ./lib ]; then
+   echo " FAILED: ./lib DIRECTORY DOES NOT EXIST"
+   exit
+fi
+
+# TESTING FOR INCLUDE FILES
+
+status=$pass
+for var in "${include_file[@]}"
+do
+  if [ ! -f ./include/$var ]; then
+      echo "FILE$red ./include/${var}$reset DOES NOT EXIST"
+      status=$fail
+  fi
+done
+
+if [ "$status" -eq "$fail" ]; then
+  echo "Testing for include files ... $red FAILED $reset"
+else
+  echo "Testing for include files ... $green PASSED $reset"
+fi
+
+# TESTING FOR LIB FILES
+status=$pass
+for var in "${lib_file[@]}"
+do
+  if [ ! -f ./lib/$var ]; then
+      echo "FILE$red ./lib/${var}$reset DOES NOT EXIST"
+      status=$fail
+  fi
+done
+
+if [ "$status" -eq "$fail" ]; then
+  echo "Testing for lib files     ... $red FAILED $reset"
+else
+  echo "Testing for lib files     ... $green PASSED $reset"
+fi
+
+# TESTING FOR BIN FILES
+status=$pass
+for var in "${bin_file[@]}"
+do
+  if [ ! -f ./bin/$var ]; then
+      echo "FILE$red ./bin/${var}$reset DOES NOT EXIST"
+      status=$fail
+  fi
+done
+
+if [ "$status" -eq "$fail" ]; then
+  echo "Testing for bin files     ... $red FAILED $reset"
+else
+  echo "Testing for bin files     ... $green PASSED $reset"
+fi
+
+# Check settings in libhdf5.settings match what is in RELEASE.txt
+
+# Check the OS type
+
+UnameInfo=`grep -i 'Uname information:' lib/libhdf4.settings`
+OStype=`echo $UnameInfo | cut -d ":" -f 2 | cut -d " " -f 4`
+
+# This code will change the OStype to remove all the code between 
+# the "- first number" and ".el". For example 2.6.32-573.22.1.el6.x86_64 
+# will become 2.6.32-573.el6.x86_64
+#
+#OSsize=`echo ${OStype} | cut -d "e" -f 2`
+#OSsize=`echo .e${OSsize}`
+#
+#kernel=`echo ${OStype} | cut -d "-" -f 1`
+#vendor_kernel=`echo ${OStype} | cut -d "-" -f 2 | cut -d "." -f 1`
+#OStype=`echo ${kernel}-${vendor_kernel}${OSsize}`
+
+libCC=`grep -i 'C compiler' lib/libhdf4.settings`
+libFC=`grep -i 'Fortran Compiler' lib/libhdf4.settings`
+
+IFS='%'
+
+if grep -i -q "$OStype" RELEASE.txt; then
+  echo "Testing for OS type       ... $green PASSED $reset"
+# Check the processor  
+    line_start=`grep -in "$OStype" RELEASE.txt | cut -d : -f 1`
+
+# print to screen to have the user check compiler versions
+ echo "$yellow      __      ________ _____  _____ ________     __ $reset"
+ echo "$yellow      \ \    / /  ____|  __ \|_   _|  ____\ \   / / $reset"
+ echo "$yellow       \ \  / /| |__  | |__) | | | | |__   \ \_/ /  $reset"
+ echo "$yellow        \ \/ / |  __| |  _  /  | | |  __|   \   /   $reset"
+ echo "$yellow         \  /  | |____| | \ \ _| |_| |       | |    $reset"
+ echo "$yellow          \/   |______|_|  \_\_____|_|       |_|    $reset"
+ echo ""
+                                              
+
+    echo "$yellow  (1) VERIFY: C Compiler in libhdf5.settings: $reset"
+    echo "  $libCC"
+    echo "$yellow              should match a compiler listed in RELEASE.txt $reset"
+    line_end=$line_start-2
+    sed -n "$line_start,/^$/p" RELEASE.txt |
+    {
+    while read line; do
+      ((line_end++))
+      ## counter=$[$line_endcounter +1]
+    done
+    sed -n $line_start,${line_end}p RELEASE.txt
+    }
+else
+  echo "Testing for OS type       ... $red FAILED $reset"
+  echo "  Operating system $OStype not found in RELEASE.txt"
+fi
+
+echo ""
+echo "$yellow  (2) VERIFY: Binary executables do not requre any external $reset"
+echo "$yellow      libraries (except system libraries on some machines): $reset"
+
+echo `echo "      Result from ${magenta}ldd bin/hdp${reset}:  "; ldd bin/hdp`
+echo ""
+
+
+echo ""
+echo "$yellow  (3) VERIFY: Binary executables match libhdf5.settings $reset"
+
+echo `echo "    Result from ${magenta}file bin/hdp${reset}:  "; file bin/hdp`
+echo `echo "    Result from lib/libhdf4.settings:  "; echo ${UnameInfo}`
+echo ""
diff --git a/bin/h4vers b/bin/h4vers
index 0daa4bb..ef5f200 100755
--- a/bin/h4vers
+++ b/bin/h4vers
@@ -366,7 +366,7 @@ if ($MANHDF1) {
       # the current month and year and the updated version.
       print FILE $newverline, "\n";
       $man_hdf1_updates += 1;
-    } elsif ($line =~ m/^$verstr\s*$/ || $line =~ m/^$verstr-[a-z]{2,5}\d{1,3}\s*$/ || $line =~ m/^$verstr\scurrently under development\s*$/  || $line =~ m/^$verstr-[a-z]{2,5}\d{1,3}\scurrently under development$\s*/) {
+    } elsif ($line =~ m/^$verstr\s*$/ || $line =~ m/^$verstr-[a-z]{1,5}\d{1,8}\s*$/ || $line =~ m/^$verstr\scurrently under development\s*$/  || $line =~ m/^$verstr-[a-z]{1,5}\d{1,8}\scurrently under development$\s*/) {
       # match the line further down that has just the version string, and replace it with the updated version string.
       # this will match "major.minor.release" or "major.minor.release-subrelease" or  "major.minor.release currently 
       # under development" or "major.minor.release-subrelease currently under development" (all followed by 
diff --git a/config/apple b/config/apple
index e267a35..13ebe0a 100644
--- a/config/apple
+++ b/config/apple
@@ -38,17 +38,17 @@ case $CC_BASENAME in
     DEBUG_CFLAGS="-g -ansi -Wall -pedantic "
     DEBUG_CPPFLAGS=
     # There is a bug somewhere in mfhdf/libsrc that is exposed by compiling
-    # with any optimization in $CC in Lion, Mountain Lion and Mavericks systems.
+    # with any optimization in $CC in Lion (Darwin 11) & up
     # Use -O0 for now.
     case "$host_os" in
-	darwin11.* | darwin12.* | darwin13.*)	# Lion & Mountain Lion & Mavericks
+	darwin1[1-9].*)	# Lion & Mountain Lion & Mavericks & Yosemeti
 	    xOFLAG="-O0"
 	    ;;
 	*)		# Other OSX versions
 	    xOFLAG="-O2"
 	    ;;
     esac
-    PROD_CFLAGS=${PROD_CFLAGS:-"-ansi  -Wall -pedantic $xOFLAG"}
+    PROD_CFLAGS=${PROD_CFLAGS:-"$xOFLAG"}
     PROD_CPPFLAGS=
     PROFILE_CFLAGS="-pg"
     PROFILE_CPPFLAGS=
@@ -59,10 +59,10 @@ case $CC_BASENAME in
     DEBUG_CFLAGS="-g"
     DEBUG_CPPFLAGS=
     # There is a bug somewhere in mfhdf/libsrc that is exposed by compiling
-    # with any optimization in $CC in Lion, Mountain Lion and Mavericks systems.
+    # with any optimization in $CC in Lion, Mountain Lion, Mavericks and Yosemeti systems.
     # Use -O0 for now.
     case "$host_os" in
-	darwin11.* | darwin12.* | darwin13.*)   # Lion & Mountain Lion & Mavericks
+	darwin1[1-9].*)	# Lion & Mountain Lion & Mavericks & Yosemite & 5 more
 	    xOFLAG="-O0"
 	    ;;
 	*)		# Other OSX versions
@@ -80,10 +80,10 @@ case $CC_BASENAME in
     DEBUG_CFLAGS="-g -ansi -Wall -pedantic "
     DEBUG_CPPFLAGS=
     # There is a bug somewhere in mfhdf/libsrc that is exposed by compiling
-    # with any optimization in $CC in Lion, Mountain Lion and Mavericks systems.
+    # with any optimization in $CC in Lion, Mountain Lion, Mavericks and Yosemeti systems.
     # Use -O0 for now.
     case "$host_os" in
-	darwin11.* | darwin12.* | darwin13.*)   # Lion & Mountain Lion & Mavericks
+	darwin1[1-9].*)	# Lion & Mountain Lion & Mavericks & Yosemeti & 5 more
 	    xOFLAG="-O0"
 	    ;;
 	*)		# Other OSX versions
diff --git a/config/cmake/CPack.Info.plist.in b/config/cmake/CPack.Info.plist.in
new file mode 100644
index 0000000..08d371b
--- /dev/null
+++ b/config/cmake/CPack.Info.plist.in
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+  <key>CFBundleDevelopmentRegion</key>
+  <string>English</string>
+  <key>CFBundleExecutable</key>
+  <string>@CPACK_PACKAGE_FILE_NAME@</string>
+  <key>CFBundleIconFile</key>
+  <string>@CPACK_BUNDLE_ICON@</string>
+  <key>CFBundleIdentifier</key>
+  <string>org. at CPACK_PACKAGE_VENDOR@. at CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@</string>
+  <key>CFBundleInfoDictionaryVersion</key>
+  <string>6.0</string>
+  <key>CFBundlePackageType</key>
+  <string>FMWK</string>
+  <key>CFBundleSignature</key>
+  <string>????</string>
+  <key>CFBundleVersion</key>
+  <string>@CPACK_PACKAGE_VERSIO@</string>
+  <key>CFBundleShortVersionString</key>
+  <string>@CPACK_SHORT_VERSION_STRING@</string>
+  <key>CSResourcesFileMapped</key>
+  <true/>
+</dict>
+</plist>
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index fada58b..aa0010c 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -3,7 +3,6 @@
 #-----------------------------------------------------------------------------
 set (HDF_PREFIX "H4")
 include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake)
-include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
 
 #-----------------------------------------------------------------------------
 # Option to Build HDF4 versions of NetCDF-3 APIS
diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake
new file mode 100644
index 0000000..440a988
--- /dev/null
+++ b/config/cmake/FindJNI.cmake
@@ -0,0 +1,342 @@
+#.rst:
+# FindJNI
+# -------
+#
+# Find JNI java libraries.
+#
+# This module finds if Java is installed and determines where the
+# include files and libraries are.  It also determines what the name of
+# the library is.  The caller may set variable JAVA_HOME to specify a
+# Java installation prefix explicitly.
+#
+# This module sets the following result variables:
+#
+# ::
+#
+#   JNI_INCLUDE_DIRS      = the include dirs to use
+#   JNI_LIBRARIES         = the libraries to use
+#   JNI_FOUND             = TRUE if JNI headers and libraries were found.
+#   JAVA_AWT_LIBRARY      = the path to the jawt library
+#   JAVA_JVM_LIBRARY      = the path to the jvm library
+#   JAVA_INCLUDE_PATH     = the include path to jni.h
+#   JAVA_INCLUDE_PATH2    = the include path to jni_md.h
+#   JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var}
+macro(java_append_library_directories _var)
+    # Determine java arch-specific library subdir
+    # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk
+    # 1.6.0_18 + icedtea patches. However, it would be much better to base the
+    # guess on the first part of the GNU config.guess platform triplet.
+    if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+      if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32")
+        set(_java_libarch "x32" "amd64" "i386")
+      else()
+        set(_java_libarch "amd64" "i386")
+      endif()
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
+        set(_java_libarch "i386")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
+        set(_java_libarch "alpha")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+        # Subdir is "arm" for both big-endian (arm) and little-endian (armel).
+        set(_java_libarch "arm")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
+        # mips* machines are bi-endian mostly so processor does not tell
+        # endianess of the underlying system.
+        set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
+        set(_java_libarch "ppc64" "ppc64le")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
+        set(_java_libarch "ppc64" "ppc")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
+        set(_java_libarch "ppc")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
+        # Both flavours can run on the same processor
+        set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
+        set(_java_libarch "parisc" "parisc64")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
+        # s390 binaries can run on s390x machines
+        set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
+    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
+        set(_java_libarch "sh")
+    else()
+        set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}")
+    endif()
+
+    # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or
+    # system is non-Linux (where the code above has not been well tested)
+    if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
+        list(APPEND _java_libarch "i386" "amd64" "ppc")
+    endif()
+
+    # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer
+    # current value to a hardcoded list. Remove possible duplicates.
+    list(REMOVE_DUPLICATES _java_libarch)
+
+    foreach(_path ${ARGN})
+        if(_path MATCHES "{libarch}")
+            foreach(_libarch ${_java_libarch})
+                string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}")
+                list(APPEND ${_var} "${_newpath}")
+            endforeach()
+        else()
+            list(APPEND ${_var} "${_path}")
+        endif()
+    endforeach()
+endmacro()
+
+#include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
+INCLUDE (CMakeFindJavaCommon)
+
+# Save CMAKE_FIND_FRAMEWORK
+if(DEFINED CMAKE_FIND_FRAMEWORK)
+  set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+else()
+  unset(_JNI_CMAKE_FIND_FRAMEWORK)
+endif()
+
+if(_JAVA_HOME_EXPLICIT)
+  set(CMAKE_FIND_FRAMEWORK NEVER)
+endif()
+
+set(JAVA_AWT_LIBRARY_DIRECTORIES)
+if(_JAVA_HOME)
+  JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
+    ${_JAVA_HOME}/jre/lib/{libarch}
+    ${_JAVA_HOME}/jre/lib
+    ${_JAVA_HOME}/lib/{libarch}
+    ${_JAVA_HOME}/lib
+    ${_JAVA_HOME}
+    )
+endif()
+get_filename_component(java_install_version
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
+
+list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
+  )
+JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
+  /usr/java/lib
+  /usr/java/jre/lib
+  /usr/lib
+  /usr/lib64
+  /usr/local/lib
+  /usr/local/lib64
+  /usr/lib/jvm/java/lib
+  /usr/lib64/jvm/java/lib
+  /usr/lib/java/jre/lib/{libarch}
+  /usr/lib64/java/jre/lib/{libarch}
+  /usr/lib/jvm/jre/lib/{libarch}
+  /usr/lib64/jvm/jre/lib/{libarch}
+  /usr/local/lib/java/jre/lib/{libarch}
+  /usr/local/share/java/jre/lib/{libarch}
+  /usr/lib/j2sdk1.4-sun/jre/lib/{libarch}
+  /usr/lib/j2sdk1.5-sun/jre/lib/{libarch}
+  /opt/sun-jdk-1.5.0.04/jre/lib/{libarch}
+  /usr/lib/jvm/java-6-sun/jre/lib/{libarch}
+  /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch}
+  /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch}       # can this one be removed according to #8821 ? Alex
+  /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
+  /usr/lib/jvm/java-7-openjdk/jre/lib/{libarch}
+  /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch}
+  /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch}        # fedora
+  # Debian specific paths for default JVM
+  /usr/lib/jvm/default-java/jre/lib/{libarch}
+  /usr/lib/jvm/default-java/jre/lib
+  /usr/lib/jvm/default-java/lib
+  # OpenBSD specific paths for default JVM
+  /usr/local/jdk-1.7.0/jre/lib/{libarch}
+  /usr/local/jre-1.7.0/lib/{libarch}
+  /usr/local/jdk-1.6.0/jre/lib/{libarch}
+  /usr/local/jre-1.6.0/lib/{libarch}
+  # SuSE specific paths for default JVM
+  /usr/lib64/jvm/java/jre/lib/{libarch}
+  /usr/lib64/jvm/jre/lib/{libarch}
+  )
+
+set(JAVA_JVM_LIBRARY_DIRECTORIES)
+foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
+  list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES
+    "${dir}"
+    "${dir}/client"
+    "${dir}/server"
+    # IBM SDK, Java Technology Edition, specific paths
+    "${dir}/j9vm"
+    "${dir}/default"
+    )
+endforeach()
+
+set(JAVA_AWT_INCLUDE_DIRECTORIES)
+if(_JAVA_HOME)
+  list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include)
+endif()
+list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
+  "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
+  ${_JAVA_HOME}/include
+  /usr/include
+  /usr/java/include
+  /usr/local/include
+  /usr/lib/java/include
+  /usr/lib64/java/include
+  /usr/local/lib/java/include
+  /usr/lib/jvm/java/include
+  /usr/lib64/jvm/java/include
+  /usr/lib/jvm/java-6-sun/include
+  /usr/lib/jvm/java-1.5.0-sun/include
+  /usr/lib/jvm/java-6-sun-1.6.0.00/include       # can this one be removed according to #8821 ? Alex
+  /usr/lib/jvm/java-6-openjdk/include
+  /usr/lib/jvm/java-7-openjdk/include
+  /usr/lib/jvm/java-7-openjdk-i386/include
+  /usr/lib/jvm/java-7-openjdk-amd64/include
+  /usr/lib64/jvm/java-7-openjdk/include
+  /usr/lib64/jvm/java-7-openjdk-amd64/include
+  /usr/local/share/java/include
+  /usr/lib/j2sdk1.4-sun/include
+  /usr/lib/j2sdk1.5-sun/include
+  /opt/sun-jdk-1.5.0.04/include
+  # Debian specific path for default JVM
+  /usr/lib/jvm/default-java/include
+  # OpenBSD specific path for default JVM
+  /usr/local/jdk-1.7.0/include
+  /usr/local/jdk-1.6.0/include
+  # SuSE specific paths for default JVM
+  /usr/lib64/jvm/java/include
+  )
+
+foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
+  get_filename_component(jpath "${JAVA_PROG}" PATH)
+  foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
+    if(EXISTS ${jpath}/${JAVA_INC_PATH})
+      list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}")
+    endif()
+  endforeach()
+  foreach(JAVA_LIB_PATH
+    ../lib ../jre/lib ../jre/lib/i386
+    ../java/lib ../java/jre/lib ../java/jre/lib/i386
+    ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
+    if(EXISTS ${jpath}/${JAVA_LIB_PATH})
+      list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}")
+    endif()
+  endforeach()
+endforeach()
+
+if(APPLE)
+  if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
+    set(_JNI_SEARCHES FRAMEWORK)
+  elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
+    set(_JNI_SEARCHES NORMAL)
+  elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST")
+    set(_JNI_SEARCHES NORMAL FRAMEWORK)
+  else()
+    set(_JNI_SEARCHES FRAMEWORK NORMAL)
+  endif()
+  set(_JNI_FRAMEWORK_JVM NAMES JavaVM)
+  set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}")
+else()
+  set(_JNI_SEARCHES NORMAL)
+endif()
+
+set(_JNI_NORMAL_JVM
+  NAMES jvm
+  PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
+  )
+
+set(_JNI_NORMAL_JAWT
+  NAMES jawt
+  PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
+  )
+
+foreach(search ${_JNI_SEARCHES})
+  find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM})
+  find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT})
+  if(JAVA_JVM_LIBRARY)
+    break()
+  endif()
+endforeach()
+unset(_JNI_SEARCHES)
+unset(_JNI_FRAMEWORK_JVM)
+unset(_JNI_FRAMEWORK_JAWT)
+unset(_JNI_NORMAL_JVM)
+unset(_JNI_NORMAL_JAWT)
+
+# Find headers matching the library.
+if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);")
+  set(CMAKE_FIND_FRAMEWORK ONLY)
+else()
+  set(CMAKE_FIND_FRAMEWORK NEVER)
+endif()
+
+# add in the include path
+find_path(JAVA_INCLUDE_PATH jni.h
+  ${JAVA_AWT_INCLUDE_DIRECTORIES}
+)
+
+find_path(JAVA_INCLUDE_PATH2 jni_md.h
+  ${JAVA_INCLUDE_PATH}
+  ${JAVA_INCLUDE_PATH}/darwin
+  ${JAVA_INCLUDE_PATH}/win32
+  ${JAVA_INCLUDE_PATH}/linux
+  ${JAVA_INCLUDE_PATH}/freebsd
+  ${JAVA_INCLUDE_PATH}/openbsd
+  ${JAVA_INCLUDE_PATH}/solaris
+  ${JAVA_INCLUDE_PATH}/hp-ux
+  ${JAVA_INCLUDE_PATH}/alpha
+)
+
+find_path(JAVA_AWT_INCLUDE_PATH jawt.h
+  ${JAVA_INCLUDE_PATH}
+)
+
+# Restore CMAKE_FIND_FRAMEWORK
+if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
+  set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
+  unset(_JNI_CMAKE_FIND_FRAMEWORK)
+else()
+  unset(CMAKE_FIND_FRAMEWORK)
+endif()
+
+#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+INCLUDE (FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI  DEFAULT_MSG  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
+                                                    JAVA_INCLUDE_PATH  JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
+
+mark_as_advanced(
+  JAVA_AWT_LIBRARY
+  JAVA_JVM_LIBRARY
+  JAVA_AWT_INCLUDE_PATH
+  JAVA_INCLUDE_PATH
+  JAVA_INCLUDE_PATH2
+)
+
+set(JNI_LIBRARIES
+  ${JAVA_AWT_LIBRARY}
+  ${JAVA_JVM_LIBRARY}
+)
+
+set(JNI_INCLUDE_DIRS
+  ${JAVA_INCLUDE_PATH}
+  ${JAVA_INCLUDE_PATH2}
+  ${JAVA_AWT_INCLUDE_PATH}
+)
+
+message ("JNI_LIBRARIES=${JNI_LIBRARIES}")
+message ("JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
diff --git a/config/cmake/HDF4Macros.cmake b/config/cmake/HDF4Macros.cmake
index 5c863c8..2796aa4 100644
--- a/config/cmake/HDF4Macros.cmake
+++ b/config/cmake/HDF4Macros.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-MACRO (H4_SET_LIB_OPTIONS libtarget libname libtype)
+macro (H4_SET_LIB_OPTIONS libtarget libname libtype)
   set (LIB_OUT_NAME "${libname}")
   if (${libtype} MATCHES "SHARED")
     if (WIN32)
@@ -22,6 +22,18 @@ MACRO (H4_SET_LIB_OPTIONS libtarget libname libtype)
           BUILD_WITH_INSTALL_RPATH ${HDF4_BUILD_WITH_INSTALL_NAME}
       )
     endif (HDF4_BUILD_WITH_INSTALL_NAME)
+    if (HDF4_BUILD_FRAMEWORKS)
+      if (${libtype} MATCHES "SHARED")
+        # adapt target to build frameworks instead of dylibs
+        set_target_properties(${libtarget} PROPERTIES
+            XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
+            FRAMEWORK TRUE
+            FRAMEWORK_VERSION ${HDF4_PACKAGE_VERSION_MAJOR}
+            MACOSX_FRAMEWORK_IDENTIFIER org.hdfgroup.${libtarget}
+            MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${HDF4_PACKAGE_VERSION_MAJOR}
+            MACOSX_FRAMEWORK_BUNDLE_VERSION ${HDF4_PACKAGE_VERSION_MAJOR})
+      endif (${libtype} MATCHES "SHARED")
+    endif (HDF4_BUILD_FRAMEWORKS)
   endif (APPLE)
 
-ENDMACRO (H4_SET_LIB_OPTIONS)
+endmacro (H4_SET_LIB_OPTIONS)
diff --git a/config/cmake/HDF4UseFortran.cmake b/config/cmake/HDF4UseFortran.cmake
index febbcbd..6f739ec 100644
--- a/config/cmake/HDF4UseFortran.cmake
+++ b/config/cmake/HDF4UseFortran.cmake
@@ -23,99 +23,4 @@ file (STRINGS ${CMAKE_BINARY_DIR}/F77Mangle.h CONTENTS REGEX "H4_F77_GLOBAL_\\(.
 string (REGEX MATCH "H4_F77_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
 set (H4_F77_FUNC_ "H4_F77_FUNC_(name,NAME) ${CMAKE_MATCH_1}")
 
-#-----------------------------------------------------------------------------
-# The provided CMake Fortran macros don't provide a general check function
-# so this one is used for a sizeof test.
-#-----------------------------------------------------------------------------
-MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
-  if (NOT DEFINED ${VARIABLE})
-    message (STATUS "Testing Fortran ${FUNCTION}")
-    if (CMAKE_REQUIRED_LIBRARIES)
-      set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
-          "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
-    else (CMAKE_REQUIRED_LIBRARIES)
-      set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
-    endif (CMAKE_REQUIRED_LIBRARIES)
-    file (WRITE
-        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
-        "${CODE}"
-    )
-    try_compile (${VARIABLE}
-        ${CMAKE_BINARY_DIR}
-        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
-        CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
-        OUTPUT_VARIABLE OUTPUT
-    )
-
-#    message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
-#    message ( "Test result ${OUTPUT}")
-#    message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
-
-    if (${VARIABLE})
-      set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
-      message (STATUS "Testing Fortran ${FUNCTION} - OK")
-      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-          "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
-          "${OUTPUT}\n\n"
-      )
-    else (${VARIABLE})
-      message (STATUS "Testing Fortran ${FUNCTION} - Fail")
-      set (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}")
-      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-          "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
-          "${OUTPUT}\n\n")
-    endif (${VARIABLE})
-  endif (NOT DEFINED ${VARIABLE})
-ENDMACRO (CHECK_FORTRAN_FEATURE)
-
-#-----------------------------------------------------------------------------
-# Configure Checks which require Fortran compilation must go in here
-# not in the main ConfigureChecks.cmake files, because if the user has
-# no Fortran compiler, problems arise.
-#
-# Be careful with leading spaces here, do not remove them.
-#-----------------------------------------------------------------------------
-CHECK_FORTRAN_FEATURE(sizeof
-  "
-       PROGRAM main
-       i = sizeof(x)
-       END PROGRAM
-  "
-  FORTRAN_HAVE_SIZEOF
-)
-
-CHECK_FORTRAN_FEATURE(RealIsNotDouble
-  "
-       MODULE type_mod
-         INTERFACE h4t
-           MODULE PROCEDURE h4t_real
-           MODULE PROCEDURE h4t_dble
-         END INTERFACE
-       CONTAINS
-         SUBROUTINE h4t_real(r)
-           REAL :: r
-         END SUBROUTINE h4t_real
-         SUBROUTINE h4t_dble(d)
-           DOUBLE PRECISION :: d
-         END SUBROUTINE h4t_dble
-       END MODULE type_mod
-       PROGRAM main
-         USE type_mod
-         REAL :: r
-         DOUBLE PRECISION :: d
-         CALL h4t(r)
-         CALL h4t(d)
-       END PROGRAM main
-  "
-  FORTRAN_DEFAULT_REAL_NOT_DOUBLE
-)
-
-#-----------------------------------------------------------------------------
-# Add debug information (intel Fortran : JB)
-#-----------------------------------------------------------------------------
-if (CMAKE_Fortran_COMPILER MATCHES ifort)
-    if (WIN32)
-        set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE)
-        set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE)
-    endif (WIN32)
-endif (CMAKE_Fortran_COMPILER MATCHES ifort)
+include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake)
diff --git a/config/cmake/HDF4_Examples.cmake.in b/config/cmake/HDF4_Examples.cmake.in
index 373081a..a8b86c3 100644
--- a/config/cmake/HDF4_Examples.cmake.in
+++ b/config/cmake/HDF4_Examples.cmake.in
@@ -1,47 +1,100 @@
-cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
 ###############################################################################################################
-# This script will build and run the examples from a compressed file
+# This script will build and run the examples from a folder
 # Execute from a command line:
-#     ctest -S HDF4_Examples.cmake,HDF4Examples-0.1.1-Source -C Release -V -O test.log
+#     ctest -S HDF4_Examples.cmake,OPTION=VALUE -C Release -V -O test.log
 ###############################################################################################################
 
-set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
 set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
-set(STATICLIBRARIES "@H4_ENABLE_STATIC_LIB@")
-set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG})
 set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
-set(CTEST_BUILD_CONFIGURATION "Release")
-#set(NO_MAC_FORTRAN "true")
-#set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON")
-set(CTEST_USE_TAR_SOURCE "${CTEST_SCRIPT_ARG}")
+
+# handle input parameters to script.
+#INSTALLDIR - HDF4 root folder
+#CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo
+#CTEST_SOURCE_NAME - name of source folder; HDF4Examples
+#STATIC_LIBRARIES - Default is YES
+#FORTRAN_LIBRARIES - Default is NO
+#JAVA_LIBRARIES - Default is NO
+##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac)
+if(DEFINED CTEST_SCRIPT_ARG)
+    # transform ctest script arguments of the form
+    # script.ctest,var1=value1,var2=value2
+    # to variables with the respective names set to the respective values
+    string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
+    foreach(current_var ${script_args})
+        if ("${current_var}" MATCHES "^([^=]+)=(.+)$")
+            set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
+        endif()
+    endforeach()
+endif()
+if(NOT DEFINED INSTALLDIR)
+    set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
+endif()
+if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
+    set(CTEST_BUILD_CONFIGURATION "Release")
+endif()
+if(NOT DEFINED CTEST_SOURCE_NAME)
+    set(CTEST_SOURCE_NAME "HDF4Examples")
+endif()
+if(NOT DEFINED STATIC_LIBRARIES)
+    set(STATICLIBRARIES "YES")
+else(NOT DEFINED STATIC_LIBRARIES)
+    set(STATICLIBRARIES "NO")
+endif()
+if(NOT DEFINED FORTRAN_LIBRARIES)
+    set(FORTRANLIBRARIES "NO")
+else(NOT DEFINED FORTRAN_LIBRARIES)
+    set(FORTRANLIBRARIES "YES")
+endif()
+if(NOT DEFINED JAVA_LIBRARIES)
+    set(JAVALIBRARIES "NO")
+else(NOT DEFINED JAVA_LIBRARIES)
+    set(JAVALIBRARIES "YES")
+endif()
+
+#TAR_SOURCE - name of tarfile
+#if(NOT DEFINED TAR_SOURCE)
+#  set(CTEST_USE_TAR_SOURCE "HDF4Examples-0.3.1-Source")
+#endif()
 
 ###############################################################################################################
 #     Adjust the following SET Commands as needed
 ###############################################################################################################
 if(WIN32)
-  if(STATICLIBRARIES)
-    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DUSE_SHARED_LIBS:BOOL=OFF")
-  endif(STATICLIBRARIES)
-  set(ENV{HDF4_DIR} "${INSTALLDIR}/cmake/hdf4")
+  if(${STATICLIBRARIES})
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF")
+  endif()
+  set(ENV{HDF4_DIR} "${INSTALLDIR}/cmake")
   set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build)
   set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
   set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
 else(WIN32)
-  if(STATICLIBRARIES)
-    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DUSE_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
-  endif(STATICLIBRARIES)
-  set(ENV{HDF4_DIR} "${INSTALLDIR}/share/cmake/hdf4")
+  if(${STATICLIBRARIES})
+    set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
+  endif()
+  set(ENV{HDF4_DIR} "${INSTALLDIR}/share/cmake")
   set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib")
   set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build)
   set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
   set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
 endif(WIN32)
+if(${FORTRANLIBRARIES})
+  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON")
+else()
+  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF")
+endif()
+if(${JAVALIBRARIES})
+  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON")
+else()
+  set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF")
+endif()
+set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF4_PACKAGE_NAME:STRING=@HDF4_PACKAGE@@HDF_PACKAGE_EXT@")
 
 ###############################################################################################################
 # For any comments please contact cdashhelp at hdfgroup.org
 #
 ###############################################################################################################
- 
+
 #-----------------------------------------------------------------------------
 # MAC machines need special option
 #-----------------------------------------------------------------------------
@@ -52,14 +105,14 @@ if(APPLE)
   set(ENV{CC} "${XCODE_CC}")
   set(ENV{CXX} "${XCODE_CXX}")
   if(NOT NO_MAC_FORTRAN)
-    # Shared fortran is not supported, build static 
+    # Shared fortran is not supported, build static
     set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC")
-  else(NOT NO_MAC_FORTRAN)
+  else()
     set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF")
-  endif(NOT NO_MAC_FORTRAN)
+  endif()
   set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
-endif(APPLE)
- 
+endif()
+
 #-----------------------------------------------------------------------------
 set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
 ## --------------------------
@@ -68,28 +121,28 @@ if(CTEST_USE_TAR_SOURCE)
   ## --------------------------
   if(WIN32)
     message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]")
-    execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
-  else(WIN32)
+    execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
+  else()
     message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]")
-    execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
-  endif(WIN32)
- 
+    execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
+  endif()
+
   if(NOT rv EQUAL 0)
     message(STATUS "extracting... [error-(${rv}) clean up]")
     file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
     message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed")
-  endif(NOT rv EQUAL 0)
+  endif()
 endif(CTEST_USE_TAR_SOURCE)
- 
+
 #-----------------------------------------------------------------------------
 ## Clear the build directory
 ## --------------------------
 set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
 if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
   ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
-else (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+else ()
   file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
-endif (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+endif ()
 
 # Use multiple CPU cores to build
 include(ProcessorCount)
@@ -97,28 +150,38 @@ ProcessorCount(N)
 if(NOT N EQUAL 0)
   if(NOT WIN32)
     set(CTEST_BUILD_FLAGS -j${N})
-  endif(NOT WIN32)
+  endif()
   set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
 endif()
 set (CTEST_CONFIGURE_COMMAND
     "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\""
 )
- 
+
 #-----------------------------------------------------------------------------
 ## -- set output to english
 set($ENV{LC_MESSAGES}  "en_EN")
- 
+
 #-----------------------------------------------------------------------------
-  ## NORMAL process
-  ## --------------------------
-  CTEST_START (Experimental)
-  CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}")
-  CTEST_READ_CUSTOM_FILES ("${CTEST_BINARY_DIRECTORY}")
-  CTEST_BUILD (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
-  CTEST_TEST (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
-  if(res GREATER 0)
-    message (FATAL_ERROR "tests FAILED")
-  endif(res GREATER 0)
+configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake)
+ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}")
+## NORMAL process
+## --------------------------
+ctest_start (Experimental)
+ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}")
+if(LOCAL_SUBMIT)
+  ctest_submit (PARTS Configure Notes)
+endif()
+ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
+if(LOCAL_SUBMIT)
+  ctest_submit (PARTS Build)
+endif()
+ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
+if(LOCAL_SUBMIT)
+  ctest_submit (PARTS Test)
+endif()
+if(res GREATER 0)
+  message (FATAL_ERROR "tests FAILED")
+endif()
 #-----------------------------------------------------------------------------
-############################################################################################################## 
+##############################################################################################################
 message(STATUS "DONE")
\ No newline at end of file
diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in
index 5af0de5..bfb3f9e 100644
--- a/config/cmake/README.txt.cmake.in
+++ b/config/cmake/README.txt.cmake.in
@@ -26,22 +26,31 @@ Installation
 
 After Installation
 ===========================================================================
-The compressed examples file HDF4Examples-0.1.1-Source. at BINARY_EXAMPLE_ENDING@, located in the 
+The examples folder, HDF4Examples, located in the 
 HDF4 install folder, can be built and tested with CMake and the supplied
 HDF4_Examples.cmake file. The HDF4_Examples.cmake expects HDF4 to have
-been installed in the default location with above compilers. Also, CMake 
-and unzip utilities should be installed.
+been installed in the default location with above compilers. Also, the CMake 
+utility should be installed.
 
 To test the installation with the examples;
     Create a directory to run the examples.
-    Copy HDF4Examples-0.1.1-Source. at BINARY_EXAMPLE_ENDING@ to this directory, do NOT unzip.
+    Copy HDF4Examples folder to this directory.
     Copy HDF4_Examples.cmake to this directory.
-    Edit HDF4_Examples.cmake line 8 to set INSTALLDIR to where HDF4 is installed.
-    NOTE for Windows: comment line 16 with a '#' character if you do not have a command line 
-              unzip program. Use Windows Explorer to unzip the HDF4Examples-0.1.1-Source. at BINARY_EXAMPLE_ENDING@ file.
-              Edit line 9 for CMake 2.x by removing the 4 digit VS version from the Generator value.
-    Execute from this directory: 
-        ctest -S HDF4_Examples.cmake,HDF4Examples-0.1.1-Source -C Release -O test.log -VV
+    The default source folder is defined as "HDF4Examples". It can be changed
+        with the CTEST_SOURCE_NAME script option.
+    The default installation folder is defined as "@CMAKE_INSTALL_PREFIX@".
+        It can be changed with the INSTALLDIR script option.
+    The default ctest configuration is defined as "Release". It can be changed
+        with the CTEST_BUILD_CONFIGURATION script option. Note that this must
+        be the same as the value used with the -C command line option.
+    The default build configuration is defined to build and use static libraries.
+        Shared libraries can be used with the STATICLIBRARIES script option set to "NO".
+    Other options can be changed by editing the HDF4_Examples.cmake file.
+
+    If the defaults are okay, execute from this directory:
+        ctest -S HDF4_Examples.cmake -C Release -V -O test.log
+    If the defaults need change, execute from this directory:
+        ctest -S HDF4_Examples.cmake,CTEST_SOURCE_NAME=MyExamples,INSTALLDIR=MyLocation -C Release -V -O test.log
 
 When executed, the ctest script will save the results to the log file, test.log, as
 indicated by the ctest command. If you wish the to see more build and test information, 
diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake
new file mode 100644
index 0000000..9b2b1e0
--- /dev/null
+++ b/config/cmake/UseJava.cmake
@@ -0,0 +1,1350 @@
+#.rst:
+# UseJava
+# -------
+#
+# Use Module for Java
+#
+# This file provides functions for Java.  It is assumed that
+# FindJava.cmake has already been loaded.  See FindJava.cmake for
+# information on how to load Java into your CMake project.
+#
+# ::
+#
+#  add_jar(target_name
+#          [SOURCES] source1 [source2 ...] [resource1 ...]
+#          [INCLUDE_JARS jar1 [jar2 ...]]
+#          [ENTRY_POINT entry]
+#          [VERSION version]
+#          [OUTPUT_NAME name]
+#          [OUTPUT_DIR dir]
+#          )
+#
+# This command creates a <target_name>.jar.  It compiles the given
+# source files (source) and adds the given resource files (resource) to
+# the jar file.  Source files can be java files or listing files
+# (prefixed by '@').  If only resource files are given then just a jar file
+# is created.  The list of include jars are added to the classpath when
+# compiling the java sources and also to the dependencies of the target.
+# INCLUDE_JARS also accepts other target names created by add_jar.  For
+# backwards compatibility, jar files listed as sources are ignored (as
+# they have been since the first version of this module).
+#
+# The default OUTPUT_DIR can also be changed by setting the variable
+# CMAKE_JAVA_TARGET_OUTPUT_DIR.
+#
+# Additional instructions:
+#
+# ::
+#
+#    To add compile flags to the target you can set these flags with
+#    the following variable:
+#
+#
+#
+# ::
+#
+#        set(CMAKE_JAVA_COMPILE_FLAGS -nowarn)
+#
+#
+#
+# ::
+#
+#    To add a path or a jar file to the class path you can do this
+#    with the CMAKE_JAVA_INCLUDE_PATH variable.
+#
+#
+#
+# ::
+#
+#        set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar)
+#
+#
+#
+# ::
+#
+#    To use a different output name for the target you can set it with:
+#
+#
+#
+# ::
+#
+#        add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar)
+#
+#
+#
+# ::
+#
+#    To use a different output directory than CMAKE_CURRENT_BINARY_DIR
+#    you can set it with:
+#
+#
+#
+# ::
+#
+#        add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin)
+#
+#
+#
+# ::
+#
+#    To define an entry point in your jar you can set it with the ENTRY_POINT
+#    named argument:
+#
+#
+#
+# ::
+#
+#        add_jar(example ENTRY_POINT com/examples/MyProject/Main)
+#
+#
+#
+# ::
+#
+#    To define a custom manifest for the jar, you can set it with the manifest
+#    named argument:
+#
+#
+#
+# ::
+#
+#        add_jar(example MANIFEST /path/to/manifest)
+#
+#
+#
+# ::
+#
+#    To add a VERSION to the target output name you can set it using
+#    the VERSION named argument to add_jar. This will create a jar file with the
+#    name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar
+#    pointing to the jar with the version information.
+#
+#
+#
+# ::
+#
+#        add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
+#
+#
+#
+# ::
+#
+#     If the target is a JNI library, utilize the following commands to
+#     create a JNI symbolic link:
+#
+#
+#
+# ::
+#
+#        set(CMAKE_JNI_TARGET TRUE)
+#        add_jar(shibboleet shibbotleet.java VERSION 1.2.0)
+#        install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet)
+#        install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR})
+#
+#
+#
+# ::
+#
+#     If a single target needs to produce more than one jar from its
+#     java source code, to prevent the accumulation of duplicate class
+#     files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior
+#     to calling the add_jar() function:
+#
+#
+#
+# ::
+#
+#        set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo)
+#        add_jar(foo foo.java)
+#
+#
+#
+# ::
+#
+#        set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar)
+#        add_jar(bar bar.java)
+#
+#
+#
+# Target Properties:
+#
+# ::
+#
+#    The add_jar() functions sets some target properties. You can get these
+#    properties with the
+#       get_property(TARGET <target_name> PROPERTY <propery_name>)
+#    command.
+#
+#
+#
+# ::
+#
+#    INSTALL_FILES      The files which should be installed. This is used by
+#                       install_jar().
+#    JNI_SYMLINK        The JNI symlink which should be installed.
+#                       This is used by install_jni_symlink().
+#    JAR_FILE           The location of the jar file so that you can include
+#                       it.
+#    CLASSDIR           The directory where the class files can be found. For
+#                       example to use them with javah.
+#
+# ::
+#
+#  find_jar(<VAR>
+#           name | NAMES name1 [name2 ...]
+#           [PATHS path1 [path2 ... ENV var]]
+#           [VERSIONS version1 [version2]]
+#           [DOC "cache documentation string"]
+#           )
+#
+# This command is used to find a full path to the named jar.  A cache
+# entry named by <VAR> is created to stor the result of this command.
+# If the full path to a jar is found the result is stored in the
+# variable and the search will not repeated unless the variable is
+# cleared.  If nothing is found, the result will be <VAR>-NOTFOUND, and
+# the search will be attempted again next time find_jar is invoked with
+# the same variable.  The name of the full path to a file that is
+# searched for is specified by the names listed after NAMES argument.
+# Additional search locations can be specified after the PATHS argument.
+# If you require special a version of a jar file you can specify it with
+# the VERSIONS argument.  The argument after DOC will be used for the
+# documentation string in the cache.
+#
+# ::
+#
+#  install_jar(target_name destination)
+#  install_jar(target_name DESTINATION destination [COMPONENT component])
+#
+# This command installs the TARGET_NAME files to the given DESTINATION.
+# It should be called in the same scope as add_jar() or it will fail.
+#
+# ::
+#
+#  install_jni_symlink(target_name destination)
+#  install_jni_symlink(target_name DESTINATION destination [COMPONENT component])
+#
+# This command installs the TARGET_NAME JNI symlinks to the given
+# DESTINATION.  It should be called in the same scope as add_jar() or it
+# will fail.
+#
+# ::
+#
+#  create_javadoc(<VAR>
+#                 PACKAGES pkg1 [pkg2 ...]
+#                 [SOURCEPATH <sourcepath>]
+#                 [CLASSPATH <classpath>]
+#                 [INSTALLPATH <install path>]
+#                 [DOCTITLE "the documentation title"]
+#                 [WINDOWTITLE "the title of the document"]
+#                 [AUTHOR TRUE|FALSE]
+#                 [USE TRUE|FALSE]
+#                 [VERSION TRUE|FALSE]
+#                 )
+#
+# Create java documentation based on files or packages.  For more
+# details please read the javadoc manpage.
+#
+# There are two main signatures for create_javadoc.  The first signature
+# works with package names on a path with source files:
+#
+# ::
+#
+#    Example:
+#    create_javadoc(my_example_doc
+#      PACKAGES com.exmaple.foo com.example.bar
+#      SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}"
+#      CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+#      WINDOWTITLE "My example"
+#      DOCTITLE "<h1>My example</h1>"
+#      AUTHOR TRUE
+#      USE TRUE
+#      VERSION TRUE
+#    )
+#
+#
+#
+# The second signature for create_javadoc works on a given list of
+# files.
+#
+# ::
+#
+#    create_javadoc(<VAR>
+#                   FILES file1 [file2 ...]
+#                   [CLASSPATH <classpath>]
+#                   [INSTALLPATH <install path>]
+#                   [DOCTITLE "the documentation title"]
+#                   [WINDOWTITLE "the title of the document"]
+#                   [AUTHOR TRUE|FALSE]
+#                   [USE TRUE|FALSE]
+#                   [VERSION TRUE|FALSE]
+#                  )
+#
+#
+#
+# Example:
+#
+# ::
+#
+#    create_javadoc(my_example_doc
+#      FILES ${example_SRCS}
+#      CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+#      WINDOWTITLE "My example"
+#      DOCTITLE "<h1>My example</h1>"
+#      AUTHOR TRUE
+#      USE TRUE
+#      VERSION TRUE
+#    )
+#
+#
+#
+# Both signatures share most of the options.  These options are the same
+# as what you can find in the javadoc manpage.  Please look at the
+# manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION.
+#
+# The documentation will be by default installed to
+#
+# ::
+#
+#    ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR>
+#
+#
+#
+# if you don't set the INSTALLPATH.
+#
+# ::
+#
+#  create_javah(TARGET <target>
+#               GENERATED_FILES <VAR>
+#               CLASSES <class>...
+#               [CLASSPATH <classpath>...]
+#               [DEPENDS <depend>...]
+#               [OUTPUT_NAME <path>|OUTPUT_DIR <path>]
+#               )
+#
+# Create C header files from java classes. These files provide the connective glue
+# that allow your Java and C code to interact.
+#
+# There are two main signatures for create_javah.  The first signature
+# returns generated files throught variable specified by GENERATED_FILES option:
+#
+# ::
+#
+#    Example:
+#    Create_javah(GENERATED_FILES files_headers
+#      CLASSES org.cmake.HelloWorld
+#      CLASSPATH hello.jar
+#    )
+#
+#
+#
+# The second signature for create_javah creates a target which encapsulates
+# header files generation.
+#
+# ::
+#
+#    Example:
+#    Create_javah(TARGET target_headers
+#      CLASSES org.cmake.HelloWorld
+#      CLASSPATH hello.jar
+#    )
+#
+#
+#
+# Both signatures share same options.
+#
+#  ``CLASSES <class>...``
+#    Specifies Java classes used to generate headers.
+#
+#  ``CLASSPATH <classpath>...``
+#    Specifies various paths to look up classes. Here .class files, jar files or targets
+#    created by command add_jar can be used.
+#
+#  ``DEPENDS <depend>...``
+#    Targets on which the javah target depends
+#
+#  ``OUTPUT_NAME <path>``
+#    Concatenates the resulting header files for all the classes listed by option CLASSES
+#    into <path>. Same behavior as option '-o' of javah tool.
+#
+#  ``OUTPUT_DIR <path>``
+#    Sets the directory where the header files will be generated. Same behavior as option
+#    '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory.
+
+#=============================================================================
+# Copyright 2013 OpenGamma Ltd. <graham at opengamma.com>
+# Copyright 2010-2011 Andreas schneider <asn at redhat.com>
+# Copyright 2010-2013 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+include(CMakeParseArguments)
+
+function (__java_copy_file src dest comment)
+    add_custom_command(
+        OUTPUT  ${dest}
+        COMMAND cmake -E copy_if_different
+        ARGS    ${src}
+                ${dest}
+        DEPENDS ${src}
+        COMMENT ${comment})
+endfunction ()
+
+# define helper scripts
+set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake)
+set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake)
+
+function(add_jar _TARGET_NAME)
+
+    cmake_parse_arguments(_add_jar
+      ""
+      "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
+      "SOURCES;INCLUDE_JARS"
+      ${ARGN}
+    )
+
+    # In CMake < 2.8.12, add_jar used variables which were set prior to calling
+    # add_jar for customizing the behavior of add_jar. In order to be backwards
+    # compatible, check if any of those variables are set, and use them to
+    # initialize values of the named arguments. (Giving the corresponding named
+    # argument will override the value set here.)
+    #
+    # New features should use named arguments only.
+    if(NOT DEFINED _add_jar_VERSION AND DEFINED CMAKE_JAVA_TARGET_VERSION)
+        set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}")
+    endif()
+    if(NOT DEFINED _add_jar_OUTPUT_DIR AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR)
+        set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}")
+    endif()
+    if(NOT DEFINED _add_jar_OUTPUT_NAME AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME)
+        set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}")
+        # reset
+        set(CMAKE_JAVA_TARGET_OUTPUT_NAME)
+    endif()
+    if(NOT DEFINED _add_jar_ENTRY_POINT AND DEFINED CMAKE_JAVA_JAR_ENTRY_POINT)
+        set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}")
+    endif()
+
+    set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS})
+
+    if (NOT DEFINED _add_jar_OUTPUT_DIR)
+        set(_add_jar_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+    endif()
+
+    if (_add_jar_ENTRY_POINT)
+        set(_ENTRY_POINT_OPTION e)
+        set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT})
+    endif ()
+
+    if (_add_jar_MANIFEST)
+        set(_MANIFEST_OPTION m)
+        get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE)
+    endif ()
+
+    if (LIBRARY_OUTPUT_PATH)
+        set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
+    else ()
+        set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${_add_jar_OUTPUT_DIR})
+    endif ()
+
+    set(CMAKE_JAVA_INCLUDE_PATH
+        ${CMAKE_JAVA_INCLUDE_PATH}
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_JAVA_OBJECT_OUTPUT_PATH}
+        ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}
+    )
+
+    if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+        set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
+    else ()
+        set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
+    endif()
+
+    foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH})
+       set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
+    endforeach()
+
+    set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
+
+    set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
+    if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION)
+        set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}-${_add_jar_VERSION}.jar")
+        set(_JAVA_TARGET_OUTPUT_LINK "${_add_jar_OUTPUT_NAME}.jar")
+    elseif (_add_jar_VERSION)
+        set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${_add_jar_VERSION}.jar")
+        set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar")
+    elseif (_add_jar_OUTPUT_NAME)
+        set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}.jar")
+    endif ()
+
+    set(_JAVA_CLASS_FILES)
+    set(_JAVA_COMPILE_FILES)
+    set(_JAVA_COMPILE_FILELISTS)
+    set(_JAVA_DEPENDS)
+    set(_JAVA_COMPILE_DEPENDS)
+    set(_JAVA_RESOURCE_FILES)
+    set(_JAVA_RESOURCE_FILES_RELATIVE)
+    foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
+        get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
+        get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE)
+        get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
+        get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
+
+        if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$")
+            get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE)
+            list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL})
+
+        elseif (_JAVA_EXT MATCHES ".java")
+            file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
+            file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
+            string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)
+            string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
+            if (${_BIN_LEN} LESS ${_SRC_LEN})
+                set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
+            else ()
+                set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
+            endif ()
+            get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH)
+
+            list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE})
+            set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class")
+            set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE})
+
+        elseif (_JAVA_EXT MATCHES ".jar"
+                OR _JAVA_EXT MATCHES ".war"
+                OR _JAVA_EXT MATCHES ".ear"
+                OR _JAVA_EXT MATCHES ".sar")
+            # Ignored for backward compatibility
+
+        elseif (_JAVA_EXT STREQUAL "")
+            list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH})
+            list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}})
+
+        else ()
+            __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE}
+                             ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}
+                             "Copying ${_JAVA_SOURCE_FILE} to the build directory")
+            list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE})
+            list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE})
+        endif ()
+    endforeach()
+
+    foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS})
+        if (TARGET ${_JAVA_INCLUDE_JAR})
+            get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE)
+            if (_JAVA_JAR_PATH)
+                set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
+                list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
+                list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR})
+                list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR})
+            else ()
+                message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar")
+            endif ()
+        else ()
+            set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}")
+            list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}")
+            list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}")
+            list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}")
+        endif ()
+    endforeach()
+
+    # create an empty java_class_filelist
+    if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist)
+        file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "")
+    endif()
+
+    if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS)
+        set (_JAVA_SOURCES_FILELISTS)
+
+        if (_JAVA_COMPILE_FILES)
+            # Create the list of files to compile.
+            set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources)
+            string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"")
+            file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING})
+            list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}")
+        endif()
+        if (_JAVA_COMPILE_FILELISTS)
+            foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS)
+                list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}")
+            endforeach()
+        endif()
+
+        # Compile the java files and create a list of class files
+        add_custom_command(
+            # NOTE: this command generates an artificial dependency file
+            OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
+            COMMAND ${Java_JAVAC_EXECUTABLE}
+                ${CMAKE_JAVA_COMPILE_FLAGS}
+                -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
+                -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+                ${_JAVA_SOURCES_FILELISTS}
+            COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
+            DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+            COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
+        )
+        add_custom_command(
+            OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
+            COMMAND ${CMAKE_COMMAND}
+                -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+                -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}"
+                -P ${_JAVA_CLASS_FILELIST_SCRIPT}
+            DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        )
+    endif ()
+
+    # create the jar file
+    set(_JAVA_JAR_OUTPUT_PATH
+      ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME})
+    if (CMAKE_JNI_TARGET)
+        add_custom_command(
+            OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
+            COMMAND ${Java_JAR_EXECUTABLE}
+                -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
+                ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
+            COMMAND ${CMAKE_COMMAND}
+                -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
+                -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
+                -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
+                -P ${_JAVA_SYMLINK_SCRIPT}
+            COMMAND ${CMAKE_COMMAND}
+                -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
+                -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH}
+                -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
+                -P ${_JAVA_SYMLINK_SCRIPT}
+            DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
+            WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+            COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}"
+        )
+    else ()
+        add_custom_command(
+            OUTPUT ${_JAVA_JAR_OUTPUT_PATH}
+            COMMAND ${Java_JAR_EXECUTABLE}
+                -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE}
+                ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist
+            COMMAND ${CMAKE_COMMAND}
+                -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR}
+                -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME}
+                -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK}
+                -P ${_JAVA_SYMLINK_SCRIPT}
+            WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+            DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist
+            COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}"
+        )
+    endif ()
+
+    # Add the target and make sure we have the latest resource files.
+    add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH})
+
+    set_property(
+        TARGET
+            ${_TARGET_NAME}
+        PROPERTY
+            INSTALL_FILES
+                ${_JAVA_JAR_OUTPUT_PATH}
+    )
+
+    if (_JAVA_TARGET_OUTPUT_LINK)
+        set_property(
+            TARGET
+                ${_TARGET_NAME}
+            PROPERTY
+                INSTALL_FILES
+                    ${_JAVA_JAR_OUTPUT_PATH}
+                    ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
+        )
+
+        if (CMAKE_JNI_TARGET)
+            set_property(
+                TARGET
+                    ${_TARGET_NAME}
+                PROPERTY
+                    JNI_SYMLINK
+                        ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK}
+            )
+        endif ()
+    endif ()
+
+    set_property(
+        TARGET
+            ${_TARGET_NAME}
+        PROPERTY
+            JAR_FILE
+                ${_JAVA_JAR_OUTPUT_PATH}
+    )
+
+    set_property(
+        TARGET
+            ${_TARGET_NAME}
+        PROPERTY
+            CLASSDIR
+                ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+    )
+
+endfunction()
+
+function(INSTALL_JAR _TARGET_NAME)
+    if (ARGC EQUAL 2)
+      set (_DESTINATION ${ARGV1})
+    else()
+      cmake_parse_arguments(_install_jar
+        ""
+        "DESTINATION;COMPONENT"
+        ""
+        ${ARGN})
+      if (_install_jar_DESTINATION)
+        set (_DESTINATION ${_install_jar_DESTINATION})
+      else()
+        message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.")
+      endif()
+
+      if (_install_jar_COMPONENT)
+        set (_COMPONENT COMPONENT ${_install_jar_COMPONENT})
+      endif()
+    endif()
+
+    get_property(__FILES
+        TARGET
+            ${_TARGET_NAME}
+        PROPERTY
+            INSTALL_FILES
+    )
+
+    if (__FILES)
+        install(
+            FILES
+                ${__FILES}
+            DESTINATION
+                ${_DESTINATION}
+            ${_COMPONENT}
+        )
+    else ()
+        message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.")
+    endif ()
+endfunction()
+
+function(INSTALL_JNI_SYMLINK _TARGET_NAME)
+    if (ARGC EQUAL 2)
+      set (_DESTINATION ${ARGV1})
+    else()
+      cmake_parse_arguments(_install_jni_symlink
+        ""
+        "DESTINATION;COMPONENT"
+        ""
+        ${ARGN})
+      if (_install_jni_symlink_DESTINATION)
+        set (_DESTINATION ${_install_jni_symlink_DESTINATION})
+      else()
+        message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.")
+      endif()
+
+      if (_install_jni_symlink_COMPONENT)
+        set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT})
+      endif()
+    endif()
+
+    get_property(__SYMLINK
+        TARGET
+            ${_TARGET_NAME}
+        PROPERTY
+            JNI_SYMLINK
+    )
+
+    if (__SYMLINK)
+        install(
+            FILES
+                ${__SYMLINK}
+            DESTINATION
+                ${_DESTINATION}
+            ${_COMPONENT}
+        )
+    else ()
+        message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.")
+    endif ()
+endfunction()
+
+function (find_jar VARIABLE)
+    set(_jar_names)
+    set(_jar_files)
+    set(_jar_versions)
+    set(_jar_paths
+        /usr/share/java/
+        /usr/local/share/java/
+        ${Java_JAR_PATHS})
+    set(_jar_doc "NOTSET")
+
+    set(_state "name")
+
+    foreach (arg ${ARGN})
+        if (${_state} STREQUAL "name")
+            if (${arg} STREQUAL "VERSIONS")
+                set(_state "versions")
+            elseif (${arg} STREQUAL "NAMES")
+                set(_state "names")
+            elseif (${arg} STREQUAL "PATHS")
+                set(_state "paths")
+            elseif (${arg} STREQUAL "DOC")
+                set(_state "doc")
+            else ()
+                set(_jar_names ${arg})
+                if (_jar_doc STREQUAL "NOTSET")
+                    set(_jar_doc "Finding ${arg} jar")
+                endif ()
+            endif ()
+        elseif (${_state} STREQUAL "versions")
+            if (${arg} STREQUAL "NAMES")
+                set(_state "names")
+            elseif (${arg} STREQUAL "PATHS")
+                set(_state "paths")
+            elseif (${arg} STREQUAL "DOC")
+                set(_state "doc")
+            else ()
+                set(_jar_versions ${_jar_versions} ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "names")
+            if (${arg} STREQUAL "VERSIONS")
+                set(_state "versions")
+            elseif (${arg} STREQUAL "PATHS")
+                set(_state "paths")
+            elseif (${arg} STREQUAL "DOC")
+                set(_state "doc")
+            else ()
+                set(_jar_names ${_jar_names} ${arg})
+                if (_jar_doc STREQUAL "NOTSET")
+                    set(_jar_doc "Finding ${arg} jar")
+                endif ()
+            endif ()
+        elseif (${_state} STREQUAL "paths")
+            if (${arg} STREQUAL "VERSIONS")
+                set(_state "versions")
+            elseif (${arg} STREQUAL "NAMES")
+                set(_state "names")
+            elseif (${arg} STREQUAL "DOC")
+                set(_state "doc")
+            else ()
+                set(_jar_paths ${_jar_paths} ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "doc")
+            if (${arg} STREQUAL "VERSIONS")
+                set(_state "versions")
+            elseif (${arg} STREQUAL "NAMES")
+                set(_state "names")
+            elseif (${arg} STREQUAL "PATHS")
+                set(_state "paths")
+            else ()
+                set(_jar_doc ${arg})
+            endif ()
+        endif ()
+    endforeach ()
+
+    if (NOT _jar_names)
+        message(FATAL_ERROR "find_jar: No name to search for given")
+    endif ()
+
+    foreach (jar_name ${_jar_names})
+        foreach (version ${_jar_versions})
+            set(_jar_files ${_jar_files} ${jar_name}-${version}.jar)
+        endforeach ()
+        set(_jar_files ${_jar_files} ${jar_name}.jar)
+    endforeach ()
+
+    find_file(${VARIABLE}
+        NAMES   ${_jar_files}
+        PATHS   ${_jar_paths}
+        DOC     ${_jar_doc}
+        NO_DEFAULT_PATH)
+endfunction ()
+
+function(create_javadoc _target)
+    set(_javadoc_packages)
+    set(_javadoc_files)
+    set(_javadoc_overview)
+    set(_javadoc_sourcepath)
+    set(_javadoc_classpath)
+    set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc")
+    set(_javadoc_doctitle)
+    set(_javadoc_windowtitle)
+    set(_javadoc_author FALSE)
+    set(_javadoc_version FALSE)
+    set(_javadoc_use FALSE)
+
+    set(_state "package")
+
+    foreach (arg ${ARGN})
+        if (${_state} STREQUAL "package")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_packages ${arg})
+                set(_state "packages")
+            endif ()
+        elseif (${_state} STREQUAL "packages")
+            if (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                list(APPEND _javadoc_packages ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "files")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                list(APPEND _javadoc_files ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "sourcepath")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                list(APPEND _javadoc_sourcepath ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "classpath")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                list(APPEND _javadoc_classpath ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "installpath")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_installpath ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "doctitle")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_doctitle ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "windowtitle")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_windowtitle ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "author")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_author ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "use")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_use ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "version")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "OVERVIEW")
+                set(_state "overview")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                set(_javadoc_version ${arg})
+            endif ()
+        elseif (${_state} STREQUAL "overview")
+            if (${arg} STREQUAL "PACKAGES")
+                set(_state "packages")
+            elseif (${arg} STREQUAL "FILES")
+                set(_state "files")
+            elseif (${arg} STREQUAL "SOURCEPATH")
+                set(_state "sourcepath")
+            elseif (${arg} STREQUAL "CLASSPATH")
+                set(_state "classpath")
+            elseif (${arg} STREQUAL "INSTALLPATH")
+                set(_state "installpath")
+            elseif (${arg} STREQUAL "DOCTITLE")
+                set(_state "doctitle")
+            elseif (${arg} STREQUAL "WINDOWTITLE")
+                set(_state "windowtitle")
+            elseif (${arg} STREQUAL "AUTHOR")
+                set(_state "author")
+            elseif (${arg} STREQUAL "USE")
+                set(_state "use")
+            elseif (${arg} STREQUAL "VERSION")
+                set(_state "version")
+            else ()
+                list(APPEND _javadoc_overview ${arg})
+            endif ()
+        endif ()
+    endforeach ()
+
+    set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target})
+    set(_javadoc_options -d ${_javadoc_builddir})
+
+    if (_javadoc_sourcepath)
+        set(_start TRUE)
+        foreach(_path ${_javadoc_sourcepath})
+            if (_start)
+                set(_sourcepath ${_path})
+                set(_start FALSE)
+            else ()
+                set(_sourcepath ${_sourcepath}:${_path})
+            endif ()
+        endforeach()
+        set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath})
+    endif ()
+
+    if (_javadoc_overview)
+        set(_start TRUE)
+        foreach(_path ${_javadoc_overview})
+            if (_start)
+                set(_overview ${_path})
+                set(_start FALSE)
+            else ()
+                set(_overview ${_overview}:${_path})
+            endif ()
+        endforeach()
+        set(_javadoc_options ${_javadoc_options} -overview ${_overview})
+    endif ()
+
+    if (_javadoc_classpath)
+        set(_start TRUE)
+        foreach(_path ${_javadoc_classpath})
+            if (_start)
+                set(_classpath ${_path})
+                set(_start FALSE)
+            else ()
+                set(_classpath ${_classpath}:${_path})
+            endif ()
+        endforeach()
+        set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}")
+    endif ()
+
+    if (_javadoc_doctitle)
+        set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}')
+    endif ()
+
+    if (_javadoc_windowtitle)
+        set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}')
+    endif ()
+
+    if (_javadoc_author)
+        set(_javadoc_options ${_javadoc_options} -author)
+    endif ()
+
+    if (_javadoc_use)
+        set(_javadoc_options ${_javadoc_options} -use)
+    endif ()
+
+    if (_javadoc_version)
+        set(_javadoc_options ${_javadoc_options} -version)
+    endif ()
+
+    add_custom_target(${_target}_javadoc ALL
+        COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options}
+                            ${_javadoc_files}
+                            ${_javadoc_packages}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    )
+
+    install(
+        DIRECTORY ${_javadoc_builddir}
+        DESTINATION ${_javadoc_installpath}
+    )
+endfunction()
+
+function (create_javah)
+    cmake_parse_arguments(_create_javah
+      ""
+      "TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
+      "CLASSES;CLASSPATH;DEPENDS"
+      ${ARGN})
+
+    # ckeck parameters
+    if (NOT _create_javah_TARGET AND NOT _create_javah_GENERATED_FILES)
+      message (FATAL_ERROR "create_javah: TARGET or GENERATED_FILES must be specified.")
+    endif()
+    if (_create_javah_OUTPUT_NAME AND _create_javah_OUTPUT_DIR)
+      message (FATAL_ERROR "create_javah: OUTPUT_NAME and OUTPUT_DIR are mutually exclusive.")
+    endif()
+
+    if (NOT _create_javah_CLASSES)
+      message (FATAL_ERROR "create_javah: CLASSES is a required parameter.")
+    endif()
+
+    set (_output_files)
+    if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
+      set(_classpath_sep "$<SEMICOLON>")
+    else ()
+      set(_classpath_sep ":")
+    endif()
+
+    # handle javah options
+    set (_javah_options)
+
+    if (_create_javah_CLASSPATH)
+      # CLASSPATH can specify directories, jar files or targets created with add_jar command
+      set (_classpath)
+      foreach (_path IN LISTS _create_javah_CLASSPATH)
+        if (TARGET ${_path})
+          get_target_property (_jar_path ${_path} JAR_FILE)
+          if (_jar_path)
+            list (APPEND _classpath "${_jar_path}")
+            list (APPEND _create_javah_DEPENDS "${_path}")
+          else()
+            message(SEND_ERROR "create_javah: CLASSPATH target ${_path} is not a jar.")
+          endif()
+        elseif (EXISTS "${_path}")
+          list (APPEND _classpath "${_path}")
+          if (NOT IS_DIRECTORY "${_path}")
+            list (APPEND _create_javah_DEPENDS "${_path}")
+          endif()
+        else()
+          message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.")
+        endif()
+      endforeach()
+      string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}")
+      list (APPEND _javah_options -classpath "${_classpath}")
+    endif()
+
+    if (_create_javah_OUTPUT_DIR)
+      list (APPEND _javah_options -d "${_create_javah_OUTPUT_DIR}")
+    endif()
+
+    if (_create_javah_OUTPUT_NAME)
+      list (APPEND _javah_options -o "${_create_javah_OUTPUT_NAME}")
+      set (_output_files "${_create_javah_OUTPUT_NAME}")
+
+      get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_NAME}" DIRECTORY)
+      get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_DIR}" ABSOLUTE)
+    endif()
+
+    if (NOT _create_javah_OUTPUT_DIR)
+      set (_create_javah_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+    endif()
+
+    if (NOT _create_javah_OUTPUT_NAME)
+      # compute output names
+      foreach (_class IN LISTS _create_javah_CLASSES)
+        string (REPLACE "." "_" _c_header "${_class}")
+        set (_c_header  "${_create_javah_OUTPUT_DIR}/${_c_header}.h")
+        list (APPEND _output_files "${_c_header}")
+      endforeach()
+    endif()
+
+    # finalize custom command arguments
+    if (_create_javah_DEPENDS)
+      list (INSERT _create_javah_DEPENDS 0 DEPENDS)
+    endif()
+
+    add_custom_command (OUTPUT ${_output_files}
+      COMMAND "${Java_JAVAH_EXECUTABLE}" ${_javah_options} -jni ${_create_javah_CLASSES}
+      ${_create_javah_DEPENDS}
+      WORKING_DIRECTORY ${_create_javah_OUTPUT_DIR}
+      COMMENT "Building C header files from classes...")
+
+    if (_create_javah_TARGET)
+      add_custom_target (${_create_javah_TARGET} ALL DEPENDS ${_output_files})
+    endif()
+    if (_create_javah_GENERATED_FILES)
+      set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE)
+    endif()
+endfunction()
diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake
new file mode 100644
index 0000000..e8e6f01
--- /dev/null
+++ b/config/cmake/UseJavaClassFilelist.cmake
@@ -0,0 +1,58 @@
+#.rst:
+# UseJavaClassFilelist
+# --------------------
+#
+#
+#
+#
+#
+# This script create a list of compiled Java class files to be added to
+# a jar file.  This avoids including cmake files which get created in
+# the binary directory.
+
+#=============================================================================
+# Copyright 2010-2011 Andreas schneider <asn at redhat.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if (CMAKE_JAVA_CLASS_OUTPUT_PATH)
+    if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
+
+        set(_JAVA_GLOBBED_FILES)
+        if (CMAKE_JAR_CLASSES_PREFIX)
+            foreach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX})
+                message(STATUS "JAR_CLASS_PREFIX: ${JAR_CLASS_PREFIX}")
+
+                file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class")
+                if (_JAVA_GLOBBED_TMP_FILES)
+                    list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES})
+                endif ()
+            endforeach()
+        else()
+            file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class")
+        endif ()
+
+        set(_JAVA_CLASS_FILES)
+        # file(GLOB_RECURSE foo RELATIVE) is broken so we need this.
+        foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES})
+            file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE})
+            set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n)
+        endforeach()
+
+        # write to file
+        file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES})
+
+    else ()
+        message(SEND_ERROR "FATAL: Java class output path doesn't exist")
+    endif ()
+else ()
+    message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH")
+endif ()
diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake
new file mode 100644
index 0000000..90ffdd5
--- /dev/null
+++ b/config/cmake/UseJavaSymlinks.cmake
@@ -0,0 +1,38 @@
+#.rst:
+# UseJavaSymlinks
+# ---------------
+#
+#
+#
+#
+#
+# Helper script for UseJava.cmake
+
+#=============================================================================
+# Copyright 2010-2011 Andreas schneider <asn at redhat.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
+    if (_JAVA_TARGET_OUTPUT_NAME)
+        find_program(LN_EXECUTABLE
+            NAMES
+                ln
+        )
+
+        execute_process(
+            COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}"
+            WORKING_DIRECTORY ${_JAVA_TARGET_DIR}
+        )
+    else ()
+        message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME")
+    endif ()
+endif ()
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index 7ca1bd4..0cb96a8 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -8,6 +8,8 @@ set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
 
 set (BUILD_TESTING ON CACHE BOOL "Build HDF4 Unit Testing" FORCE)
 
+set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE)
+
 set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE)
 
 set (HDF4_BUILD_EXAMPLES ON CACHE BOOL "Build HDF4 Library Examples" FORCE)
@@ -49,12 +51,6 @@ set (HDF4_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE)
 set (HDF4_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO SVN TGZ)" FORCE)
 set_property (CACHE HDF4_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)
 
-set (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk" CACHE STRING "Use ZLib from HDF repository" FORCE)
-
-set (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk" CACHE STRING "Use SZip from HDF repository" FORCE)
-
-set (JPEG_SVN_URL "http://svn.hdfgroup.uiuc.edu/jpeg/branches/jpeg8b" CACHE STRING "Use JPEG from HDF repository" FORCE)
-
 set (ZLIB_TGZ_NAME "ZLib.tar.gz" CACHE STRING "Use ZLib from compressed file" FORCE)
 
 set (SZIP_TGZ_NAME "SZip.tar.gz" CACHE STRING "Use SZip from compressed file" FORCE)
diff --git a/config/cmake/h4config.h.in b/config/cmake/h4config.h.in
index cb2caee..6c2fdbf 100644
--- a/config/cmake/h4config.h.in
+++ b/config/cmake/h4config.h.in
@@ -7,12 +7,6 @@
    libraries. */
 #cmakedefine H4_F77_DUMMY_MAIN @H4_F77_DUMMY_MAIN@
 
-/* Defined if HDF4 was built with CMake AND build as a shared library */
-#cmakedefine H4_BUILT_AS_DYNAMIC_LIB @H4_BUILT_AS_DYNAMIC_LIB@
-
-/* Defined if HDF4 was built with CMake AND build as a static library */
-#cmakedefine H4_BUILT_AS_STATIC_LIB @H4_BUILT_AS_STATIC_LIB@
-
 /* Define to a macro mangling the given C identifier (in lower and upper
    case), which must not contain underscores, for linking with Fortran. */
 #define @H4_F77_FUNC@
diff --git a/config/cmake/hdf4-config-version.cmake.in b/config/cmake/hdf4-config-version.cmake.in
index 3dc2aa9..6aa0691 100644
--- a/config/cmake/hdf4-config-version.cmake.in
+++ b/config/cmake/hdf4-config-version.cmake.in
@@ -1,27 +1,47 @@
 #-----------------------------------------------------------------------------
 # HDF4 Version file for install directory
 #-----------------------------------------------------------------------------
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
+# but only if the requested major.minor version is the same as the current one.
+# The variable HDF4_VERSION_STRING must be set before calling configure_file().
 
-set (PACKAGE_VERSION @HDF4_VERSION_STRING@)
+set (PACKAGE_VERSION "@HDF4_VERSION_STRING@")
 
-if ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H4_VERS_MAJOR@)
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  if ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H4_VERS_MAJOR@")
 
-  # exact match for version @H5_VERS_MAJOR at .@H4_VERS_MINOR@
-  if ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H4_VERS_MINOR@)
+    # exact match for version @H5_VERS_MAJOR at .@H4_VERS_MINOR@
+    if ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H4_VERS_MINOR@")
 
-    # compatible with any version @H4_VERS_MAJOR at .@H4_VERS_MINOR at .x
-    set (PACKAGE_VERSION_COMPATIBLE 1) 
+      # compatible with any version @H4_VERS_MAJOR at .@H4_VERS_MINOR at .x
+      set (PACKAGE_VERSION_COMPATIBLE TRUE) 
     
-    if ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H4_VERS_RELEASE@)
-      set (PACKAGE_VERSION_EXACT 1)    
+      if ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H4_VERS_RELEASE@")
+        set (PACKAGE_VERSION_EXACT TRUE)
 
-      if ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H4_VERS_SUBRELEASE@)
-        # not using this yet
-      endif ("${PACKAGE_FIND_VERSION_TWEAK}" EQUAL @H4_VERS_SUBRELEASE@)
-      
-    endif ("${PACKAGE_FIND_VERSION_PATCH}" EQUAL @H4_VERS_RELEASE@)
-    
-  endif ("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @H4_VERS_MINOR@)
-endif ("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @H4_VERS_MAJOR@)
+        if ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H4_VERS_SUBRELEASE@")
+          # not using this yet
+        endif ("${PACKAGE_FIND_VERSION_TWEAK}" STREQUAL "@H4_VERS_SUBRELEASE@")
+      endif ("${PACKAGE_FIND_VERSION_PATCH}" STREQUAL "@H4_VERS_RELEASE@")
+    else ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H4_VERS_MINOR@")
+      set (PACKAGE_VERSION_COMPATIBLE FALSE) 
+    endif ("${PACKAGE_FIND_VERSION_MINOR}" STREQUAL "@H4_VERS_MINOR@")
+  endif ("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "@H4_VERS_MAJOR@")
+endif()
 
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}"  STREQUAL ""  OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+   return()
+endif()
 
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@")
+  math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+  set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+  set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()
diff --git a/config/cmake/hdf4-config.cmake.build.in b/config/cmake/hdf4-config.cmake.build.in
deleted file mode 100644
index a039784..0000000
--- a/config/cmake/hdf4-config.cmake.build.in
+++ /dev/null
@@ -1,61 +0,0 @@
-#-----------------------------------------------------------------------------
-# HDF4 Config file for compiling against hdf4 build directory
-#-----------------------------------------------------------------------------
-GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-
-#-----------------------------------------------------------------------------
-# User Options
-#-----------------------------------------------------------------------------
-set (HDF4_ENABLE_PARALLEL @HDF4_ENABLE_PARALLEL@)
-set (HDF4_BUILD_FORTRAN   @HDF4_BUILD_FORTRAN@)
-set (HDF4_BUILD_XDR_LIB   @HDF4_BUILD_XDR_LIB@)
-set (HDF4_BUILD_TOOLS     @HDF4_BUILD_TOOLS@)
-set (HDF4_BUILD_UTILS     @HDF4_BUILD_UTILS@)
-set (HDF4_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@)
-set (HDF4_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@)
-set (HDF4_ENABLE_SZIP_SUPPORT  @HDF4_ENABLE_SZIP_SUPPORT@)
-set (HDF4_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@)
-set (HDF4_BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
-
-#-----------------------------------------------------------------------------
-# Directories
-#-----------------------------------------------------------------------------
-set (HDF4_INCLUDE_DIR "@HDF4_INCLUDES_BUILD_TIME@")
-
-if (HDF4_BUILD_FORTRAN)
-  set (HDF4_INCLUDE_DIR_FORTRAN "@CMAKE_Fortran_MODULE_DIRECTORY@" )
-endif (HDF4_BUILD_FORTRAN)
-  
-if (HDF4_BUILD_XDR_LIB)
-  set (HDF4_INCLUDE_DIR_XDR ${HDF4_INCLUDE_DIR} )
-endif (HDF4_BUILD_XDR_LIB)
-
-if (HDF4_BUILD_TOOLS)
-  set (HDF4_INCLUDE_DIR_TOOLS ${HDF4_INCLUDE_DIR} )
-endif (HDF4_BUILD_TOOLS)
-
-if (HDF4_BUILD_UTILS)
-  set (HDF4_INCLUDE_DIR_UTILS ${HDF4_INCLUDE_DIR} )
-endif (HDF4_BUILD_UTILS)
-
-if (HDF4_BUILD_SHARED_LIBS)
-  set (H4_BUILT_AS_DYNAMIC_LIB 1 )
-else (HDF4_BUILD_SHARED_LIBS)
-  set (H4_BUILT_AS_STATIC_LIB 1 )
-endif (HDF4_BUILD_SHARED_LIBS)
-
-#-----------------------------------------------------------------------------
-# Version Strings
-#-----------------------------------------------------------------------------
-set (HDF4_VERSION_STRING @HDF4_VERSION_STRING@)
-set (HDF4_VERSION_MAJOR  @HDF4_VERSION_MAJOR@)
-set (HDF4_VERSION_MINOR  @HDF4_VERSION_MINOR@)
-
-#-----------------------------------------------------------------------------
-# Don't include targets if this file is being picked up by another
-# project which has already build hdf4 as a subproject
-#-----------------------------------------------------------------------------
-if (NOT TARGET "@HDF4_PACKAGE@")
-  include (${SELF_DIR}/@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -targets.cmake)
-  set (HDF4_LIBRARIES "@HDF4_LIBRARIES_TO_EXPORT@")
-endif (NOT TARGET "@HDF4_PACKAGE@")
diff --git a/config/cmake/hdf4-config.cmake.in b/config/cmake/hdf4-config.cmake.in
new file mode 100644
index 0000000..df3ad23
--- /dev/null
+++ b/config/cmake/hdf4-config.cmake.in
@@ -0,0 +1,148 @@
+#-----------------------------------------------------------------------------
+# HDF4 Config file for compiling against hdf4 build/install directory
+#-----------------------------------------------------------------------------
+ at PACKAGE_INIT@
+
+string(TOUPPER @HDF4_PACKAGE@ HDF4_PACKAGE_NAME)
+
+set (${HDF4_PACKAGE_NAME}_VALID_COMPONENTS
+    static
+    shared
+    C
+    Fortran
+    Java
+)
+
+#-----------------------------------------------------------------------------
+# User Options
+#-----------------------------------------------------------------------------
+set (${HDF4_PACKAGE_NAME}_ENABLE_PARALLEL @HDF4_ENABLE_PARALLEL@)
+set (${HDF4_PACKAGE_NAME}_BUILD_FORTRAN   @HDF4_BUILD_FORTRAN@)
+set (${HDF4_PACKAGE_NAME}_BUILD_JAVA      @HDF4_BUILD_JAVA@)
+set (${HDF4_PACKAGE_NAME}_BUILD_XDR_LIB   @HDF4_BUILD_XDR_LIB@)
+set (${HDF4_PACKAGE_NAME}_BUILD_TOOLS     @HDF4_BUILD_TOOLS@)
+set (${HDF4_PACKAGE_NAME}_BUILD_UTILS     @HDF4_BUILD_UTILS@)
+set (${HDF4_PACKAGE_NAME}_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@)
+set (${HDF4_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@)
+set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT  @HDF4_ENABLE_SZIP_SUPPORT@)
+set (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@)
+set (${HDF4_PACKAGE_NAME}_BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
+set (${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS      @HDF4_PACKAGE_EXTLIBS@)
+set (${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF4_LIBRARIES_TO_EXPORT@)
+
+#-----------------------------------------------------------------------------
+# Dependencies
+#-----------------------------------------------------------------------------
+if (${HDF4_PACKAGE_NAME}_BUILD_JAVA)
+  set (${HDF4_PACKAGE_NAME}_JAVA_INCLUDE_DIRS
+      @PACKAGE_CURRENT_BUILD_DIR@/lib/jarhdf- at HDF4_VERSION_STRING@.jar
+      @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-1.7.5.jar
+      @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-1.7.5.jar
+  )
+  set (${HDF4_PACKAGE_NAME}_JAVA_LIBRARY "@PACKAGE_CURRENT_BUILD_DIR@/lib")
+  set (${HDF4_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF4_PACKAGE_NAME}_JAVA_LIBRARY}")
+endif()
+
+#-----------------------------------------------------------------------------
+# Directories
+#-----------------------------------------------------------------------------
+set (${HDF4_PACKAGE_NAME}_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" "${${HDF4_PACKAGE_NAME}_MPI_C_INCLUDE_PATH}" )
+
+set (${HDF4_PACKAGE_NAME}_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@")
+set_and_check (${HDF4_PACKAGE_NAME}_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@")
+
+if (${HDF4_PACKAGE_NAME}_BUILD_FORTRAN)
+  set (${HDF4_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@" )
+endif ()
+
+if (${HDF4_PACKAGE_NAME}_BUILD_TOOLS)
+  set (${HDF4_PACKAGE_NAME}_INCLUDE_DIR_TOOLS "@PACKAGE_INCLUDE_INSTALL_DIR@" )
+  set_and_check (${HDF4_PACKAGE_NAME}_TOOLS_DIR "@PACKAGE_CURRENT_BUILD_DIR@/bin" )
+endif ()
+
+
+if (${HDF4_PACKAGE_NAME}_BUILD_UTILS)
+  set (${HDF4_PACKAGE_NAME}_INCLUDE_DIR_UTILS "@PACKAGE_INCLUDE_INSTALL_DIR@" )
+  set_and_check (${HDF4_PACKAGE_NAME}_UTILS_DIR "@PACKAGE_CURRENT_BUILD_DIR@/bin" )
+endif ()
+
+#-----------------------------------------------------------------------------
+# Version Strings
+#-----------------------------------------------------------------------------
+set (HDF4_VERSION_STRING @HDF4_VERSION_STRING@)
+set (HDF4_VERSION_MAJOR  @HDF4_VERSION_MAJOR@)
+set (HDF4_VERSION_MINOR  @HDF4_VERSION_MINOR@)
+
+#-----------------------------------------------------------------------------
+# Don't include targets if this file is being picked up by another
+# project which has already built hdf4 as a subproject
+#-----------------------------------------------------------------------------
+if (NOT TARGET "@HDF4_PACKAGE@")
+  if (${HDF4_PACKAGE_NAME}_ENABLE_JPEG_LIB_SUPPORT AND ${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "jpeg")
+    include (@PACKAGE_SHARE_INSTALL_DIR@/@JPEG_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
+  endif ()
+  if (${HDF4_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
+    include (@PACKAGE_SHARE_INSTALL_DIR@/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
+  endif ()
+  if (${HDF4_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF4_PACKAGE_NAME}_PACKAGE_EXTLIBS AND NOT TARGET "szip")
+    include (@PACKAGE_SHARE_INSTALL_DIR@/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
+  endif ()
+  include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -targets.cmake)
+endif ()
+
+# Handle default component(static) :
+if (NOT ${HDF4_PACKAGE_NAME}_FIND_COMPONENTS)
+    set (${HDF4_PACKAGE_NAME}_LIB_TYPE)
+    set (${HDF4_PACKAGE_NAME}_FIND_COMPONENTS C static)
+    set (${HDF4_PACKAGE_NAME}_FIND_REQUIRED_static_C true)
+endif ()
+
+# Handle requested components:
+list (REMOVE_DUPLICATES ${HDF4_PACKAGE_NAME}_FIND_COMPONENTS)
+foreach (comp IN LISTS ${HDF4_PACKAGE_NAME}_FIND_COMPONENTS)
+  if (${comp} STREQUAL "shared")
+    list (REMOVE_ITEM ${HDF4_PACKAGE_NAME}_FIND_COMPONENTS ${comp})
+    set (${HDF4_PACKAGE_NAME}_LIB_TYPE ${${HDF4_PACKAGE_NAME}_LIB_TYPE} ${comp})
+  elseif (${comp} STREQUAL "static")
+    list (REMOVE_ITEM ${HDF4_PACKAGE_NAME}_FIND_COMPONENTS ${comp})
+    set (${HDF4_PACKAGE_NAME}_LIB_TYPE ${${HDF4_PACKAGE_NAME}_LIB_TYPE} ${comp})
+  endif ()
+endforeach ()
+foreach (libtype IN LISTS ${HDF4_PACKAGE_NAME}_LIB_TYPE)
+  foreach (comp IN LISTS ${HDF4_PACKAGE_NAME}_FIND_COMPONENTS)
+    set (hdf4_comp2)
+    if (${comp} STREQUAL "C")
+      set (hdf4_comp "hdf")
+    elseif (${comp} STREQUAL "Java")
+      set (hdf4_comp "hdf4_java")
+    elseif (${comp} STREQUAL "Fortran")
+      set (hdf4_comp2 "hdf_fcstub")
+      set (hdf4_comp "hdf_fortran")
+    endif ()
+    list (FIND ${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf4_comp}-${libtype}" HAVE_COMP) 
+    list (FIND ${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES "mf${hdf4_comp}-${libtype}" HAVE_MFCOMP) 
+    if (${HAVE_COMP} LESS 0 OR ${HAVE_MFCOMP} LESS 0) 
+      set (${HDF4_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0)
+    else ()
+      if (hdf4_comp2)
+        list (FIND ${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf4_comp2}-${libtype}" HAVE_COMP2) 
+        list (FIND ${HDF4_PACKAGE_NAME}_EXPORT_LIBRARIES "mf${hdf4_comp2}-${libtype}" HAVE_MFCOMP2) 
+        if (${HAVE_COMP2} LESS 0 OR ${HAVE_MFCOMP2} LESS 0)
+          set (${HDF4_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0)
+        else ()
+          set (${HDF4_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1)
+          string(TOUPPER ${HDF4_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY)
+          set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf4_comp2}-${libtype} ${hdf4_comp}-${libtype} mf${hdf4_comp2}-${libtype} mf${hdf4_comp}-${libtype})
+        endif ()
+      else ()
+        set (${HDF4_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1)
+        string(TOUPPER ${HDF4_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY)
+        set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf4_comp}-${libtype} mf${hdf4_comp}-${libtype})
+      endif ()
+    endif ()
+  endforeach ()
+endforeach ()
+
+foreach (libtype IN LISTS ${HDF4_PACKAGE_NAME}_LIB_TYPE)
+  check_required_components(${HDF4_PACKAGE_NAME}_${libtype})
+endforeach ()
diff --git a/config/cmake/hdf4-config.cmake.install.in b/config/cmake/hdf4-config.cmake.install.in
deleted file mode 100644
index 15ce3ec..0000000
--- a/config/cmake/hdf4-config.cmake.install.in
+++ /dev/null
@@ -1,71 +0,0 @@
-#-----------------------------------------------------------------------------
-# HDF4 Config file for compiling against hdf4 install directory
-#-----------------------------------------------------------------------------
-GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
-GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${SELF_DIR}" PATH)
-GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-if (NOT WIN32)
-  GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-endif (NOT WIN32)
-
-#-----------------------------------------------------------------------------
-# User Options
-#-----------------------------------------------------------------------------
-set (HDF4_ENABLE_PARALLEL @HDF4_ENABLE_PARALLEL@)
-set (HDF4_BUILD_FORTRAN   @HDF4_BUILD_FORTRAN@)
-set (HDF4_BUILD_XDR_LIB   @HDF4_BUILD_XDR_LIB@)
-set (HDF4_BUILD_TOOLS     @HDF4_BUILD_TOOLS@)
-set (HDF4_BUILD_UTILS     @HDF4_BUILD_UTILS@)
-set (HDF4_ENABLE_JPEG_LIB_SUPPORT @HDF4_ENABLE_JPEG_LIB_SUPPORT@)
-set (HDF4_ENABLE_Z_LIB_SUPPORT @HDF4_ENABLE_Z_LIB_SUPPORT@)
-set (HDF4_ENABLE_SZIP_SUPPORT  @HDF4_ENABLE_SZIP_SUPPORT@)
-set (HDF4_ENABLE_SZIP_ENCODING @HDF4_ENABLE_SZIP_ENCODING@)
-set (HDF4_BUILD_SHARED_LIBS    @BUILD_SHARED_LIBS@)
-set (HDF4_PACKAGE_EXTLIBS @HDF4_PACKAGE_EXTLIBS@)
-
-#-----------------------------------------------------------------------------
-# Directories
-#-----------------------------------------------------------------------------
-set (HDF4_INCLUDE_DIR "${_IMPORT_PREFIX}/include")
-
-if (HDF4_BUILD_FORTRAN)
-  set (HDF4_INCLUDE_DIR_FORTRAN "${_IMPORT_PREFIX}/include")
-endif (HDF4_BUILD_FORTRAN)
-  
-if (HDF4_BUILD_XDR_LIB)
-  set (HDF4_INCLUDE_DIR_XDR "${_IMPORT_PREFIX}/include")
-endif (HDF4_BUILD_XDR_LIB)
-
-if (HDF4_BUILD_TOOLS)
-  set (HDF4_INCLUDE_DIR_TOOLS "${_IMPORT_PREFIX}/include")
-endif (HDF4_BUILD_TOOLS)
-
-if (HDF4_BUILD_UTILS)
-  set (HDF4_INCLUDE_DIR_UTILS "${_IMPORT_PREFIX}/include")
-  set (HDF4_TOOLS_DIR "${_IMPORT_PREFIX}/bin" )
-endif (HDF4_BUILD_UTILS)
-
-#-----------------------------------------------------------------------------
-# Version Strings
-#-----------------------------------------------------------------------------
-set (HDF4_VERSION_STRING @HDF4_VERSION_STRING@)
-set (HDF4_VERSION_MAJOR  @HDF4_VERSION_MAJOR@)
-set (HDF4_VERSION_MINOR  @HDF4_VERSION_MINOR@)
-
-#-----------------------------------------------------------------------------
-# Don't include targets if this file is being picked up by another
-# project which has already built hdf4 as a subproject
-#-----------------------------------------------------------------------------
-if (NOT TARGET "@HDF4_PACKAGE@")
-  if (HDF4_ENABLE_JPEG_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "jpeg")
-    include (${SELF_DIR}/../JPEG/@JPEG_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
-  endif (HDF4_ENABLE_JPEG_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "jpeg")
-  if (HDF4_ENABLE_Z_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
-    include (${SELF_DIR}/../ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
-  endif (HDF4_ENABLE_Z_LIB_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "zlib")
-  if (HDF4_ENABLE_SZIP_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "szip")
-    include (${SELF_DIR}/../SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT at -targets.cmake)
-  endif (HDF4_ENABLE_SZIP_SUPPORT AND HDF4_PACKAGE_EXTLIBS AND NOT TARGET "szip")
-  include (${SELF_DIR}/@HDF4_PACKAGE@@HDF_PACKAGE_EXT at -targets.cmake)
-  set (HDF4_LIBRARIES "@HDF4_LIBRARIES_TO_EXPORT@")
-endif (NOT TARGET "@HDF4_PACKAGE@")
diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake/jrunTest.cmake
similarity index 50%
copy from config/cmake_ext_mod/runTest.cmake
copy to config/cmake/jrunTest.cmake
index bfaae2b..7e7d1f1 100644
--- a/config/cmake_ext_mod/runTest.cmake
+++ b/config/cmake/jrunTest.cmake
@@ -3,106 +3,95 @@
 cmake_policy(SET CMP0007 NEW)
 
 # arguments checking
+if (NOT TEST_TESTER)
+  message (FATAL_ERROR "Require TEST_TESTER to be defined")
+endif (NOT TEST_TESTER)
 if (NOT TEST_PROGRAM)
   message (FATAL_ERROR "Require TEST_PROGRAM to be defined")
 endif (NOT TEST_PROGRAM)
-#if (NOT TEST_ARGS)
-#  message (STATUS "Require TEST_ARGS to be defined")
-#endif (NOT TEST_ARGS)
+if (NOT TEST_LIBRARY_DIRECTORY)
+  message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined")
+endif (NOT TEST_LIBRARY_DIRECTORY)
 if (NOT TEST_FOLDER)
   message ( FATAL_ERROR "Require TEST_FOLDER to be defined")
 endif (NOT TEST_FOLDER)
 if (NOT TEST_OUTPUT)
   message (FATAL_ERROR "Require TEST_OUTPUT to be defined")
 endif (NOT TEST_OUTPUT)
-if (NOT TEST_EXPECT)
-  message (STATUS "Require TEST_EXPECT to be defined")
-endif (NOT TEST_EXPECT)
-#if (NOT TEST_FILTER)
-#  message (STATUS "Require TEST_FILTER to be defined")
-#endif (NOT TEST_FILTER)
-if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
-  message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
-endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
+if (NOT TEST_CLASSPATH)
+  message (STATUS "Require TEST_CLASSPATH to be defined")
+endif (NOT TEST_CLASSPATH)
+if (NOT TEST_REFERENCE)
+  message (STATUS "Require TEST_REFERENCE to be defined")
+endif (NOT TEST_REFERENCE)
 
 if (NOT TEST_ERRREF)
-  set (ERROR_APPEND 1)
+  if (NOT SKIP_APPEND)
+    # append error file since skip was not defined
+    set (ERROR_APPEND 1)
+  endif(NOT SKIP_APPEND)
 endif (NOT TEST_ERRREF)
 
-message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
-
-if (TEST_ENV_VAR)
-  set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") 
-endif (TEST_ENV_VAR)
-
-if (NOT TEST_INPUT)
-  # run the test program, capture the stdout/stderr and the result var
-  EXECUTE_PROCESS (
-      COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
-      WORKING_DIRECTORY ${TEST_FOLDER}
-      RESULT_VARIABLE TEST_RESULT
-      OUTPUT_FILE ${TEST_OUTPUT}
-      ERROR_FILE ${TEST_OUTPUT}.err
-      OUTPUT_VARIABLE TEST_ERROR
-      ERROR_VARIABLE TEST_ERROR
-  )
-else (NOT TEST_INPUT)
-  # run the test program with stdin, capture the stdout/stderr and the result var
-  EXECUTE_PROCESS (
-      COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
-      WORKING_DIRECTORY ${TEST_FOLDER}
-      RESULT_VARIABLE TEST_RESULT
-      INPUT_FILE ${TEST_INPUT}
-      OUTPUT_FILE ${TEST_OUTPUT}
-      ERROR_FILE ${TEST_OUTPUT}.err
-      OUTPUT_VARIABLE TEST_ERROR
-      ERROR_VARIABLE TEST_ERROR
-  )
-endif (NOT TEST_INPUT)
+if (NOT TEST_LOG_LEVEL)
+  set (LOG_LEVEL "info")
+else (NOT TEST_LOG_LEVEL)
+  set (LOG_LEVEL "${TEST_LOG_LEVEL}")
+endif (NOT TEST_LOG_LEVEL)
+
+message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}")
+
+if (WIN32 AND NOT MINGW)
+  set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}")
+endif (WIN32 AND NOT MINGW)
+
+# run the test program, capture the stdout/stderr and the result var
+execute_process (
+    COMMAND ${TEST_TESTER} -Xmx1024M
+    -Dorg.slf4j.simpleLogger.defaultLogLevel=${LOG_LEVEL}
+    -Djava.library.path=${TEST_LIBRARY_DIRECTORY}
+    -cp "${TEST_CLASSPATH}" ${TEST_ARGS} ${TEST_PROGRAM}
+    ${ARGN}
+    WORKING_DIRECTORY ${TEST_FOLDER}
+    RESULT_VARIABLE TEST_RESULT
+    OUTPUT_FILE ${TEST_OUTPUT}
+    ERROR_FILE ${TEST_OUTPUT}.err
+    ERROR_VARIABLE TEST_ERROR
+)
 
 message (STATUS "COMMAND Result: ${TEST_RESULT}")
 
-if (ERROR_APPEND)
+if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
-  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") 
-endif (ERROR_APPEND)
-
-if (TEST_APPEND)
-  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") 
-endif (TEST_APPEND)
-
-# if the return value is !=${TEST_EXPECT} bail out
-if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
-  message ( FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}")
-endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
-
-message (STATUS "COMMAND Error: ${TEST_ERROR}")
-
-if (TEST_MASK)
-  file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") 
-  file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
-endif (TEST_MASK)
+  if (TEST_MASK_FILE)
+    STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}")
+  endif (TEST_MASK_FILE)
 
-if (TEST_MASK_MOD)
-  file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") 
-  file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
-endif (TEST_MASK_MOD)
+  if (NOT ERROR_APPEND)
+    # append error output to the stdout output file
+    file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}")
+  else (NOT ERROR_APPEND)
+    # write back to original .err file
+    file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+  endif (NOT ERROR_APPEND)
+endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
 
 if (TEST_MASK_ERROR)
   if (NOT TEST_ERRREF)
+    # the error stack has been appended to the output file
     file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
   else (NOT TEST_ERRREF)
+    # the error stack remains in the .err file
     file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
   endif (NOT TEST_ERRREF)
-  STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") 
+  string (REGEX REPLACE "Time:[^\n]+\n" "Time:  XXXX\n" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
+  #string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "HDF5 .[1-9]*[.][0-9]*[.][0-9]*[^)]*" "HDF5 (version (number)" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+  # write back the changes to the original files
   if (NOT TEST_ERRREF)
     file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
   else (NOT TEST_ERRREF)
@@ -110,12 +99,15 @@ if (TEST_MASK_ERROR)
   endif (NOT TEST_ERRREF)
 endif (TEST_MASK_ERROR)
 
-if (TEST_FILTER)
-  file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") 
-  file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
-endif (TEST_FILTER)
+# if the return value is !=0 bail out
+if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
+  message (STATUS "ERROR OUTPUT: ${TEST_STREAM}")
+  message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}")
+endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
 
+message (STATUS "COMMAND Error: ${TEST_ERROR}")
+
+# compare output files to references unless this must be skipped
 if (NOT TEST_SKIP_COMPARE)
   if (WIN32 AND NOT MINGW)
     file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
@@ -123,21 +115,21 @@ if (NOT TEST_SKIP_COMPARE)
   endif (WIN32 AND NOT MINGW)
 
   # now compare the output with the reference
-  EXECUTE_PROCESS (
+  execute_process (
       COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
       RESULT_VARIABLE TEST_RESULT
   )
   if (NOT ${TEST_RESULT} STREQUAL 0)
   set (TEST_RESULT 0)
   file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
-  LIST (LENGTH test_act len_act)
+  list (LENGTH test_act len_act)
   file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
-  LIST (LENGTH test_ref len_ref)
+  list (LENGTH test_ref len_ref)
   if (NOT ${len_act} STREQUAL "0")
     MATH (EXPR _FP_LEN "${len_ref} - 1")
     foreach (line RANGE 0 ${_FP_LEN})
-      LIST (GET test_act ${line} str_act)
-      LIST (GET test_ref ${line} str_ref)
+      list (GET test_act ${line} str_act)
+      list (GET test_ref ${line} str_ref)
       if (NOT "${str_act}" STREQUAL "${str_ref}")
         if (NOT "${str_act}" STREQUAL "")
           set (TEST_RESULT 1)
@@ -157,7 +149,8 @@ if (NOT TEST_SKIP_COMPARE)
   if (NOT ${TEST_RESULT} STREQUAL 0)
     message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
   endif (NOT ${TEST_RESULT} STREQUAL 0)
-  
+
+  # now compare the .err file with the error reference, if supplied
   if (TEST_ERRREF)
     if (WIN32 AND NOT MINGW)
       file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM)
@@ -165,22 +158,22 @@ if (NOT TEST_SKIP_COMPARE)
     endif (WIN32 AND NOT MINGW)
 
     # now compare the error output with the error reference
-    EXECUTE_PROCESS (
+    execute_process (
         COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
         RESULT_VARIABLE TEST_RESULT
     )
     if (NOT ${TEST_RESULT} STREQUAL 0)
     set (TEST_RESULT 0)
     file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
-    LIST (LENGTH test_act len_act)
+    list (LENGTH test_act len_act)
     file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
-    LIST (LENGTH test_ref len_ref)
+    list (LENGTH test_ref len_ref)
     MATH (EXPR _FP_LEN "${len_ref} - 1")
     if (NOT ${len_act} STREQUAL "0")
       MATH (EXPR _FP_LEN "${len_ref} - 1")
       foreach (line RANGE 0 ${_FP_LEN})
-        LIST (GET test_act ${line} str_act)
-        LIST (GET test_ref ${line} str_ref)
+        list (GET test_act ${line} str_act)
+        list (GET test_ref ${line} str_ref)
         if (NOT "${str_act}" STREQUAL "${str_ref}")
           if (NOT "${str_act}" STREQUAL "")
             set (TEST_RESULT 1)
@@ -203,5 +196,27 @@ if (NOT TEST_SKIP_COMPARE)
   endif (TEST_ERRREF)
 endif (NOT TEST_SKIP_COMPARE)
 
+if (TEST_GREP_COMPARE)
+  # now grep the output with the reference
+  file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+
+  # TEST_REFERENCE should always be matched
+  string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
+  string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
+  if (${TEST_RESULT} STREQUAL "0")
+    message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
+  endif (${TEST_RESULT} STREQUAL "0")
+
+  string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
+  if (${TEST_EXPECT} STREQUAL "1")
+    # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match
+    string (LENGTH "${TEST_MATCH}" TEST_RESULT)
+    if (NOT ${TEST_RESULT} STREQUAL "0")
+      message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
+    endif (NOT ${TEST_RESULT} STREQUAL "0")
+  endif (${TEST_EXPECT} STREQUAL "0")
+endif (TEST_GREP_COMPARE)
+
 # everything went fine...
-message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
+message ("${TEST_PROGRAM} Passed")
+
diff --git a/config/cmake/libhdf4.settings.cmake.in b/config/cmake/libhdf4.settings.cmake.in
index 733a2e7..9c5840d 100644
--- a/config/cmake/libhdf4.settings.cmake.in
+++ b/config/cmake/libhdf4.settings.cmake.in
@@ -19,7 +19,7 @@ Compiling Options:
                          CFLAGS: @CMAKE_C_FLAGS@
                        CPPFLAGS: @CMAKE_CXX_FLAGS@
                Shared Libraries: @H4_ENABLE_SHARED_LIB@
-               Static Libraries: @H4_ENABLE_STATIC_LIB@
+               Static Libraries: YES
   Statically Linked Executables: @BUILD_STATIC_EXECS@
                         LDFLAGS: @CMAKE_SHARED_LINKER_FLAGS@
                 Extra libraries: @LINK_LIBS@
@@ -32,6 +32,9 @@ Languages:
 @BUILD_FORTRAN_CONDITIONAL_TRUE@               Fortran Compiler: @CMAKE_Fortran_COMPILER@
 @BUILD_FORTRAN_CONDITIONAL_TRUE@                  Fortran Flags: @CMAKE_Fortran_FLAGS@
 
+                            JAVA: @HDF4_BUILD_JAVA@
+ at BUILD_JAVA_CONDITIONAL_TRUE@                     JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@
+
 Features:
 ---------
                SZIP compression: @SZIP_INFO@
diff --git a/config/cmake/patch.xml b/config/cmake/patch.xml
new file mode 100644
index 0000000..cc086dc
--- /dev/null
+++ b/config/cmake/patch.xml
@@ -0,0 +1,11 @@
+<CPackWiXPatch>
+	<CPackWiXFragment Id="CM_CP_libraries.bin.hdf.dll">
+        <Environment Id="PATH" 
+             Name="PATH" 
+             Value="[CM_DP_libraries.bin]" 
+             Permanent="no" 
+             Part="last" 
+             Action="set" 
+             System="yes"/>
+	</CPackWiXFragment>
+</CPackWiXPatch>
diff --git a/config/cmake_ext_mod/CPack.Info.plist.in b/config/cmake_ext_mod/CPack.Info.plist.in
deleted file mode 100644
index 6cf2a94..0000000
--- a/config/cmake_ext_mod/CPack.Info.plist.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleExecutable</key>
-	<string>@CPACK_PACKAGE_FILE_NAME@</string>
-	<key>CFBundleIconFile</key>
-	<string>@CPACK_BUNDLE_ICON@</string>
-	<key>CFBundleIdentifier</key>
-	<string>org. at CPACK_PACKAGE_VENDOR@. at CPACK_PACKAGE_NAME@@CPACK_MODULE_VERSION_SUFFIX@</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundlePackageType</key>
-	<string>FMWK</string>
-	<key>CFBundleSignature</key>
-	<string>????</string>
-	<key>CFBundleVersion</key>
-	<string>@CPACK_PACKAGE_VERSIO@</string>
-	<key>CFBundleShortVersionString</key>
-	<string>@CPACK_SHORT_VERSION_STRING@</string>
-	<key>CSResourcesFileMapped</key>
-	<true/>
-	<key>CFBundleName</key>
-	<string>@CPACK_BUNDLE_NAME@</string>
-	<key>CFBundleGetInfoString</key>
-	<string>@CPACK_APPLE_GUI_INFO_STRING@</string>
-	<key>NSHumanReadableCopyright</key>
-	<string>@CPACK_APPLE_GUI_COPYRIGHT@</string>
-</dict>
-</plist>
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index d715383..c4fabf1 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -11,7 +11,9 @@ include (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
 include (${CMAKE_ROOT}/Modules/CheckVariableExists.cmake)
 include (${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake)
 include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
-include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+if(CMAKE_CXX_COMPILER)
+  include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
+endif(CMAKE_CXX_COMPILER)
 
 #-----------------------------------------------------------------------------
 # APPLE/Darwin setup
@@ -29,13 +31,13 @@ if (APPLE)
 endif (APPLE)
 
 # Check for Darwin (not just Apple - we also want to catch OpenDarwin)
-if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 
-    set (${HDF_PREFIX}_HAVE_DARWIN 1) 
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+    set (${HDF_PREFIX}_HAVE_DARWIN 1)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 
 # Check for Solaris
-if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") 
-    set (${HDF_PREFIX}_HAVE_SOLARIS 1) 
+if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+    set (${HDF_PREFIX}_HAVE_SOLARIS 1)
 endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
 
 #-----------------------------------------------------------------------------
@@ -90,7 +92,6 @@ if (WINDOWS)
   set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1)
   set (${HDF_PREFIX}_HAVE_TIMEZONE 1)
   set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1)
-  set (${HDF_PREFIX}_LONE_COLON 0)
   if (MINGW)
     set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1)
   endif (MINGW)
@@ -116,13 +117,8 @@ if (NOT WINDOWS)
   CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname ${HDF_PREFIX}_HAVE_LIBWSOCK32)
 endif (NOT WINDOWS)
 
+# UCB (BSD) compatibility library
 CHECK_LIBRARY_EXISTS_CONCAT ("ucb"    gethostname  ${HDF_PREFIX}_HAVE_LIBUCB)
-CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect      ${HDF_PREFIX}_HAVE_LIBSOCKET)
-CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL)
-
-if (NOT NOT_NEED_LIBNSL)
-  CHECK_LIBRARY_EXISTS_CONCAT ("nsl"    gethostbyname  ${HDF_PREFIX}_HAVE_LIBNSL)
-endif (NOT NOT_NEED_LIBNSL)
 
 # For other tests to use the same libraries
 set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS})
@@ -145,10 +141,6 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST)
       set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
     endif (CMAKE_REQUIRED_LIBRARIES)
 
-    foreach (def ${HDF_EXTRA_TEST_DEFINITIONS})
-      set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
-    endforeach (def)
-
     foreach (def
         HAVE_SYS_TIME_H
         HAVE_UNISTD_H
@@ -180,7 +172,7 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST)
     else (${OTHER_TEST})
       message (STATUS "Performing Other Test ${OTHER_TEST} - Failed")
       set (${HDF_PREFIX}_${OTHER_TEST} "" CACHE INTERNAL "Other test ${FUNCTION}")
-      file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
           "Performing Other Test ${OTHER_TEST} failed with the following output:\n"
           "${OUTPUT}\n"
       )
@@ -254,7 +246,6 @@ CHECK_INCLUDE_FILE_CONCAT ("pthread.h"       ${HDF_PREFIX}_HAVE_PTHREAD_H)
 CHECK_INCLUDE_FILE_CONCAT ("srbclient.h"     ${HDF_PREFIX}_HAVE_SRBCLIENT_H)
 CHECK_INCLUDE_FILE_CONCAT ("string.h"        ${HDF_PREFIX}_HAVE_STRING_H)
 CHECK_INCLUDE_FILE_CONCAT ("strings.h"       ${HDF_PREFIX}_HAVE_STRINGS_H)
-CHECK_INCLUDE_FILE_CONCAT ("time.h"          ${HDF_PREFIX}_HAVE_TIME_H)
 CHECK_INCLUDE_FILE_CONCAT ("stdlib.h"        ${HDF_PREFIX}_HAVE_STDLIB_H)
 CHECK_INCLUDE_FILE_CONCAT ("memory.h"        ${HDF_PREFIX}_HAVE_MEMORY_H)
 CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h"         ${HDF_PREFIX}_HAVE_DLFCN_H)
@@ -271,17 +262,24 @@ set (LINUX_LFS 0)
 set (HDF_EXTRA_C_FLAGS)
 set (HDF_EXTRA_FLAGS)
 if (NOT WINDOWS)
-  if (NOT ${HDF_PREFIX}_HAVE_SOLARIS)
+  # Might want to check explicitly for Linux and possibly Cygwin
+  # instead of checking for not Solaris or Darwin.
+  if (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN)
   # Linux Specific flags
   # This was originally defined as _POSIX_SOURCE which was updated to
   # _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
   # functionality so clock_gettime and CLOCK_MONOTONIC are defined
-  # correctly.
+  # correctly. This was later updated to 200112L so that
+  # posix_memalign() is visible for the direct VFD code on Linux
+  # systems.
   # POSIX feature information can be found in the gcc manual at:
   # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
-  set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=199506L)
-  set (HDF_EXTRA_FLAGS -D_BSD_SOURCE)
-  
+  set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L)
+
+  # Need to add this so that O_DIRECT is visible for the direct
+  # VFD on Linux systems.
+  set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE)
+
   option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
   if (HDF_ENABLE_LARGE_FILE)
     set (msg "Performing TEST_LFS_WORKS")
@@ -291,6 +289,11 @@ if (NOT WINDOWS)
         CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
         OUTPUT_VARIABLE OUTPUT
     )
+
+    # The LARGEFILE definitions were from the transition period
+    # and are probably no longer needed. The FILE_OFFSET_BITS
+    # check should be generalized for all POSIX systems as it
+    # is in the Autotools.
     if (TEST_LFS_WORKS_COMPILE)
       if (TEST_LFS_WORKS_RUN  MATCHES 0)
         set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
@@ -300,20 +303,20 @@ if (NOT WINDOWS)
       else (TEST_LFS_WORKS_RUN  MATCHES 0)
         set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
         message (STATUS "${msg}... no")
-        file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+        file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
               "Test TEST_LFS_WORKS Run failed with the following output and exit code:\n ${OUTPUT}\n"
         )
       endif (TEST_LFS_WORKS_RUN  MATCHES 0)
     else (TEST_LFS_WORKS_COMPILE )
       set (TEST_LFS_WORKS "" CACHE INTERNAL ${msg})
       message (STATUS "${msg}... no")
-      file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
           "Test TEST_LFS_WORKS Compile failed with the following output:\n ${OUTPUT}\n"
       )
     endif (TEST_LFS_WORKS_COMPILE)
   endif (HDF_ENABLE_LARGE_FILE)
   set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS})
-  endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS)
+  endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN)
 endif (NOT WINDOWS)
 
 add_definitions (${HDF_EXTRA_FLAGS})
@@ -416,6 +419,19 @@ if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T)
   set (${HDF_PREFIX}_SIZEOF_OFF64_T 0)
 endif (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T)
 
+#-----------------------------------------------------------------------------
+# Extra C99 types
+#-----------------------------------------------------------------------------
+
+# _Bool type support
+CHECK_INCLUDE_FILE_CONCAT (stdbool.h    ${HDF_PREFIX}_HAVE_STDBOOL_H)
+if (HAVE_STDBOOL_H)
+  set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
+  HDF_CHECK_TYPE_SIZE (bool         ${HDF_PREFIX}_SIZEOF_BOOL)
+else (HAVE_STDBOOL_H)
+  HDF_CHECK_TYPE_SIZE (_Bool        ${HDF_PREFIX}_SIZEOF_BOOL)
+endif (HAVE_STDBOOL_H)
+
 if (NOT WINDOWS)
   #-----------------------------------------------------------------------------
   # Check if the dev_t type is a scalar type
@@ -431,6 +447,7 @@ if (NOT WINDOWS)
   #-----------------------------------------------------------------------------
   # Check a bunch of time functions
   #-----------------------------------------------------------------------------
+  CHECK_FUNCTION_EXISTS (gettimeofday      ${HDF_PREFIX}_HAVE_GETTIMEOFDAY)
   foreach (test
       HAVE_TM_GMTOFF
       HAVE___TM_GMTOFF
@@ -491,7 +508,6 @@ CHECK_FUNCTION_EXISTS (longjmp           ${HDF_PREFIX}_HAVE_LONGJMP)
 CHECK_FUNCTION_EXISTS (setjmp            ${HDF_PREFIX}_HAVE_SETJMP)
 CHECK_FUNCTION_EXISTS (siglongjmp        ${HDF_PREFIX}_HAVE_SIGLONGJMP)
 CHECK_FUNCTION_EXISTS (sigsetjmp         ${HDF_PREFIX}_HAVE_SIGSETJMP)
-CHECK_FUNCTION_EXISTS (sigaction         ${HDF_PREFIX}_HAVE_SIGACTION)
 CHECK_FUNCTION_EXISTS (sigprocmask       ${HDF_PREFIX}_HAVE_SIGPROCMASK)
 
 CHECK_FUNCTION_EXISTS (snprintf          ${HDF_PREFIX}_HAVE_SNPRINTF)
@@ -525,15 +541,10 @@ if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP)
 endif (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP)
 
 #-----------------------------------------------------------------------------
-# Check for Symbols
-CHECK_SYMBOL_EXISTS (tzname "time.h" ${HDF_PREFIX}_HAVE_DECL_TZNAME)
-
-#-----------------------------------------------------------------------------
 # Check a bunch of other functions
 #-----------------------------------------------------------------------------
 if (NOT WINDOWS)
   foreach (test
-      LONE_COLON
       HAVE_ATTRIBUTE
       HAVE_C99_FUNC
 #      STDC_HEADERS
@@ -556,10 +567,6 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST)
       set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
     endif (CMAKE_REQUIRED_LIBRARIES)
 
-    foreach (def ${HDF_EXTRA_TEST_DEFINITIONS})
-      set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
-    endforeach (def)
-
     foreach (def
         HAVE_SYS_TIME_H
         HAVE_UNISTD_H
@@ -626,7 +633,7 @@ if (WINDOWS)
           "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
       )
     endif (LARGEFILE)
-    set (MACRO_CHECK_FUNCTION_DEFINITIONS 
+    set (MACRO_CHECK_FUNCTION_DEFINITIONS
       "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}")
     if (CMAKE_REQUIRED_LIBRARIES)
       set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
@@ -658,7 +665,7 @@ if (WINDOWS)
     if ("${HAVE_IOEO_EXITCODE}" EQUAL 0)
       set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce")
       message (STATUS "Performing Test InitOnceExecuteOnce - Success")
-      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 
+      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n"
         "${OUTPUT}\n"
         "Return value: ${HAVE_IOEO}\n")
@@ -670,7 +677,7 @@ if (WINDOWS)
       endif (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES  "FAILED_TO_RUN")
 
       message (STATUS "Performing Test InitOnceExecuteOnce - Failed")
-      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log 
+      file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Performing InitOnceExecuteOnce Test  failed with the following output:\n"
         "${OUTPUT}\n"
         "Return value: ${HAVE_IOEO_EXITCODE}\n")
@@ -682,60 +689,45 @@ endif (WINDOWS)
 #-----------------------------------------------------------------------------
 # Determine how 'inline' is used
 #-----------------------------------------------------------------------------
-set (HDF_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE)
 foreach (inline_test inline __inline__ __inline)
-  set (INLINE_TEST_INLINE ${inline_test})
-  HDF_FUNCTION_TEST (INLINE_TEST_${inline_test})
+  string (TOUPPER ${inline_test} INLINE_TEST_MACRO)
+  HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO})
 endforeach (inline_test)
 
-set (HDF_EXTRA_TEST_DEFINITIONS)
-if (INLINE_TEST___inline__)
-  set (${HDF_PREFIX}_inline __inline__)
-else (INLINE_TEST___inline__)
-  if (INLINE_TEST___inline)
-    set (${HDF_PREFIX}_inline __inline)
-  else (INLINE_TEST___inline)
-    if (INLINE_TEST_inline)
-      set (${HDF_PREFIX}_inline inline)
-    endif (INLINE_TEST_inline)
-  endif (INLINE_TEST___inline)
-endif (INLINE_TEST___inline__)
-
 #-----------------------------------------------------------------------------
 # Check how to print a Long Long integer
 #-----------------------------------------------------------------------------
 if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown")
   set (PRINT_LL_FOUND 0)
   message (STATUS "Checking for appropriate format for 64 bit long:")
-  foreach (HDF5_PRINTF_LL l64 l L q I64 ll)
-    set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}")
-    if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
-      set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
-    endif (${HDF_PREFIX}_SIZEOF_LONG_LONG)
-    TRY_RUN (HDF5_PRINTF_LL_TEST_RUN   HDF5_PRINTF_LL_TEST_COMPILE
-        ${CMAKE_BINARY_DIR}
-        ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
-        CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
-        OUTPUT_VARIABLE OUTPUT
+  set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH")
+  if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
+    set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
+  endif (${HDF_PREFIX}_SIZEOF_LONG_LONG)
+  TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN   ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE
+      ${CMAKE_BINARY_DIR}
+      ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
+      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
+      OUTPUT_VARIABLE OUTPUT
+  )
+  if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
+    if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+      string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}")
+      set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
+      set (PRINT_LL_FOUND 1)
+    else (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+      message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
+    endif (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+  else (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
+    file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+        "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n"
     )
-    if (HDF5_PRINTF_LL_TEST_COMPILE)
-      if (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
-        set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
-        set (PRINT_LL_FOUND 1)
-      else (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
-        message ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}")
-      endif (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
-    else (HDF5_PRINTF_LL_TEST_COMPILE)
-      file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
-          "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n"
-      )
-    endif (HDF5_PRINTF_LL_TEST_COMPILE)
-  endforeach (HDF5_PRINTF_LL)
+  endif (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
 
   if (PRINT_LL_FOUND)
-    message (STATUS "Checking for apropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
+    message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
   else (PRINT_LL_FOUND)
-    message (STATUS "Checking for apropriate format for 64 bit long: not found")
+    message (STATUS "Checking for appropriate format for 64 bit long: not found")
     set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
         "Width for printf for type `long long' or `__int64', us. `ll"
     )
diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake
index e8e7f9f..5f0f031 100644
--- a/config/cmake_ext_mod/FindSZIP.cmake
+++ b/config/cmake_ext_mod/FindSZIP.cmake
@@ -156,12 +156,6 @@ if (SZIP_FOUND)
   # Add SZIP_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
   set (CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${SZIP_INCLUDE_DIRS}")
 
-  CHECK_SYMBOL_EXISTS (SZIP_BUILT_AS_DYNAMIC_LIB "SZconfig.h" HAVE_SZIP_DLL)
-
-  if (HAVE_SZIP_DLL STREQUAL "TRUE")
-    set (HAVE_SZIP_DLL "1")
-  endif (HAVE_SZIP_DLL STREQUAL "TRUE")
-
   # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
   set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
   set (CMAKE_REQUIRED_FLAGS    ${CMAKE_REQUIRED_FLAGS_SAVE})
@@ -174,6 +168,5 @@ if (FIND_SZIP_DEBUG)
   message (STATUS "SZIP_INCLUDE_DIRS: ${SZIP_INCLUDE_DIRS}")
   message (STATUS "SZIP_LIBRARY_DEBUG: ${SZIP_LIBRARY_DEBUG}")
   message (STATUS "SZIP_LIBRARY_RELEASE: ${SZIP_LIBRARY_RELEASE}")
-  message (STATUS "HAVE_SZIP_DLL: ${HAVE_SZIP_DLL}")
   message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
 endif (FIND_SZIP_DEBUG)
diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake
index f499b00..3f91405 100644
--- a/config/cmake_ext_mod/HDFLibMacros.cmake
+++ b/config/cmake_ext_mod/HDFLibMacros.cmake
@@ -1,16 +1,16 @@
 #-------------------------------------------------------------------------------
-MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
+macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
   # May need to build JPEG with PIC on x64 machines with gcc
   # Need to use CMAKE_ANSI_CFLAGS define so that compiler test works
 
   if (${compress_type} MATCHES "SVN")
     EXTERNALPROJECT_ADD (JPEG
         SVN_REPOSITORY ${JPEG_URL}
-        # [SVN_REVISION rev] 
+        # [SVN_REVISION rev]
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -18,14 +18,14 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-    ) 
+    )
   elseif (${compress_type} MATCHES "GIT")
     EXTERNALPROJECT_ADD (JPEG
         GIT_REPOSITORY ${JPEG_URL}
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -33,7 +33,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-    ) 
+    )
   elseif (${compress_type} MATCHES "TGZ")
     EXTERNALPROJECT_ADD (JPEG
         URL ${JPEG_URL}
@@ -41,7 +41,7 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DJPEG_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DJPEG_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -49,27 +49,34 @@ MACRO (EXTERNAL_JPEG_LIBRARY compress_type libtype jpeg_pic)
             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${jpeg_pic}
-    ) 
+    )
   endif (${compress_type} MATCHES "SVN")
-  externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR) 
+  externalproject_get_property (JPEG BINARY_DIR SOURCE_DIR)
 
-  # Create imported target szip
-  add_library (jpeg ${libtype} IMPORTED)
-  HDF_IMPORT_SET_LIB_OPTIONS (jpeg "jpeg" ${libtype} "")
-  add_dependencies (JPEG jpeg)
+##include (${BINARY_DIR}/${JPEG_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
+# Create imported target jpeg-static
+  add_library(jpeg-static STATIC IMPORTED)
+  HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "")
+  add_dependencies (JPEG jpeg-static)
+  set (JPEG_STATIC_LIBRARY "jpeg-static")
+  set (JPEG_LIBRARIES ${JPEG_static_LIBRARY})
+  if (BUILD_SHARED_LIBS)
+    # Create imported target jpeg-shared
+    add_library(jpeg-shared SHARED IMPORTED)
+    HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "")
+    add_dependencies (JPEG jpeg-shared)
+    set (JPEG_SHARED_LIBRARY "jpeg-shared")
+    set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_shared_LIBRARY})
+  endif (BUILD_SHARED_LIBS)
 
-#  include (${BINARY_DIR}/JPEG-targets.cmake)  
-  set (JPEG_LIBRARY "jpeg")
-  
   set (JPEG_INCLUDE_DIR_GEN "${BINARY_DIR}")
   set (JPEG_INCLUDE_DIR "${SOURCE_DIR}/src")
   set (JPEG_FOUND 1)
-  set (JPEG_LIBRARIES ${JPEG_LIBRARY})
   set (JPEG_INCLUDE_DIRS ${JPEG_INCLUDE_DIR_GEN} ${JPEG_INCLUDE_DIR})
-ENDMACRO (EXTERNAL_JPEG_LIBRARY)
+endmacro (EXTERNAL_JPEG_LIBRARY)
 
 #-------------------------------------------------------------------------------
-MACRO (PACKAGE_JPEG_LIBRARY compress_type)
+macro (PACKAGE_JPEG_LIBRARY compress_type)
   add_custom_target (JPEG-GenHeader-Copy ALL
       COMMAND ${CMAKE_COMMAND} -E copy_if_different ${JPEG_INCLUDE_DIR_GEN}/jconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
       COMMENT "Copying ${JPEG_INCLUDE_DIR_GEN}/jconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
@@ -78,18 +85,18 @@ MACRO (PACKAGE_JPEG_LIBRARY compress_type)
   if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
     add_dependencies (JPEG-GenHeader-Copy JPEG)
   endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
-ENDMACRO (PACKAGE_JPEG_LIBRARY)
+endmacro (PACKAGE_JPEG_LIBRARY)
 
 #-------------------------------------------------------------------------------
-MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
+macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
   if (${compress_type} MATCHES "SVN")
     EXTERNALPROJECT_ADD (SZIP
         SVN_REPOSITORY ${SZIP_URL}
-        # [SVN_REVISION rev] 
+        # [SVN_REVISION rev]
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -98,15 +105,15 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
             -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-    ) 
+    )
   elseif (${compress_type} MATCHES "GIT")
     EXTERNALPROJECT_ADD (SZIP
         GIT_REPOSITORY ${SZIP_URL}
-        # [SVN_REVISION rev] 
+        # [SVN_REVISION rev]
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -115,7 +122,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
             -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-    ) 
+    )
   elseif (${compress_type} MATCHES "TGZ")
     EXTERNALPROJECT_ADD (SZIP
         URL ${SZIP_URL}
@@ -123,7 +130,7 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -132,27 +139,34 @@ MACRO (EXTERNAL_SZIP_LIBRARY compress_type libtype encoding)
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
             -DSZIP_ENABLE_ENCODING:BOOL=${encoding}
-    ) 
+    )
   endif (${compress_type} MATCHES "SVN")
-  externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR) 
+  externalproject_get_property (SZIP BINARY_DIR SOURCE_DIR)
 
-  # Create imported target szip
-  add_library (szip ${libtype} IMPORTED)
-  HDF_IMPORT_SET_LIB_OPTIONS (szip "szip" ${libtype} "")
-  add_dependencies (SZIP szip)
-
-#  include (${BINARY_DIR}/SZIP-targets.cmake)  
-  set (SZIP_LIBRARY "szip")
+##include (${BINARY_DIR}/${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
+# Create imported target szip-static
+  add_library(szip-static STATIC IMPORTED)
+  HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "")
+  add_dependencies (SZIP szip-static)
+  set (SZIP_STATIC_LIBRARY "szip-static")
+  set (SZIP_LIBRARIES ${SZIP_static_LIBRARY})
+  if (BUILD_SHARED_LIBS)
+    # Create imported target szip-shared
+    add_library(szip-shared SHARED IMPORTED)
+    HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "")
+    add_dependencies (SZIP szip-shared)
+    set (SZIP_SHARED_LIBRARY "szip-shared")
+    set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_shared_LIBRARY})
+  endif (BUILD_SHARED_LIBS)
 
   set (SZIP_INCLUDE_DIR_GEN "${BINARY_DIR}")
   set (SZIP_INCLUDE_DIR "${SOURCE_DIR}/src")
   set (SZIP_FOUND 1)
-  set (SZIP_LIBRARIES ${SZIP_LIBRARY})
   set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR})
-ENDMACRO (EXTERNAL_SZIP_LIBRARY)
+endmacro (EXTERNAL_SZIP_LIBRARY)
 
 #-------------------------------------------------------------------------------
-MACRO (PACKAGE_SZIP_LIBRARY compress_type)
+macro (PACKAGE_SZIP_LIBRARY compress_type)
   add_custom_target (SZIP-GenHeader-Copy ALL
       COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
       COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
@@ -161,18 +175,18 @@ MACRO (PACKAGE_SZIP_LIBRARY compress_type)
   if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
     add_dependencies (SZIP-GenHeader-Copy SZIP)
   endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
-ENDMACRO (PACKAGE_SZIP_LIBRARY)
+endmacro (PACKAGE_SZIP_LIBRARY)
 
 #-------------------------------------------------------------------------------
-MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
+macro (EXTERNAL_ZLIB_LIBRARY compress_type)
   if (${compress_type} MATCHES "SVN")
     EXTERNALPROJECT_ADD (ZLIB
         SVN_REPOSITORY ${ZLIB_URL}
-        # [SVN_REVISION rev] 
+        # [SVN_REVISION rev]
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -180,15 +194,15 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-    ) 
+    )
   elseif (${compress_type} MATCHES "GIT")
     EXTERNALPROJECT_ADD (ZLIB
         GIT_REPOSITORY ${ZLIB_URL}
-        # [SVN_REVISION rev] 
+        # [SVN_REVISION rev]
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -196,7 +210,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-    ) 
+    )
   elseif (${compress_type} MATCHES "TGZ")
     EXTERNALPROJECT_ADD (ZLIB
         URL ${ZLIB_URL}
@@ -204,7 +218,7 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
         INSTALL_COMMAND ""
         CMAKE_ARGS
             -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
-            -DHDF_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
+            -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT}
             -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF
             -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
             -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
@@ -212,32 +226,39 @@ MACRO (EXTERNAL_ZLIB_LIBRARY compress_type libtype)
             -DCMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
             -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
             -DCMAKE_ANSI_CFLAGS:STRING=${CMAKE_ANSI_CFLAGS}
-    ) 
+    )
   endif (${compress_type} MATCHES "SVN")
-  externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR) 
+  externalproject_get_property (ZLIB BINARY_DIR SOURCE_DIR)
 
-  # Create imported target zlib
-  add_library (zlib ${libtype} IMPORTED)
   if (WIN32)
     set (ZLIB_LIB_NAME "zlib")
   else (WIN32)
     set (ZLIB_LIB_NAME "z")
   endif (WIN32)
-  HDF_IMPORT_SET_LIB_OPTIONS (zlib ${ZLIB_LIB_NAME} ${libtype} "")
-  add_dependencies (ZLIB zlib)
+##include (${BINARY_DIR}/${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT}-targets.cmake)
+# Create imported target zlib-static
+  add_library(zlib-static STATIC IMPORTED)
+  HDF_IMPORT_SET_LIB_OPTIONS (zlib-static ${ZLIB_LIB_NAME} STATIC "")
+  add_dependencies (ZLIB zlib-static)
+  set (ZLIB_STATIC_LIBRARY "zlib-static")
+  set (ZLIB_LIBRARIES ${ZLIB_static_LIBRARY})
+  if (BUILD_SHARED_LIBS)
+    # Create imported target zlib-shared
+    add_library(zlib-shared SHARED IMPORTED)
+    HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "")
+    add_dependencies (ZLIB zlib-shared)
+    set (ZLIB_SHARED_LIBRARY "zlib-shared")
+    set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY})
+  endif (BUILD_SHARED_LIBS)
 
-#  include (${BINARY_DIR}/ZLIB-targets.cmake)  
-  set (ZLIB_LIBRARY "zlib")
-  
   set (ZLIB_INCLUDE_DIR_GEN "${BINARY_DIR}")
   set (ZLIB_INCLUDE_DIR "${SOURCE_DIR}")
   set (ZLIB_FOUND 1)
-  set (ZLIB_LIBRARIES ${ZLIB_LIBRARY})
   set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR})
-ENDMACRO (EXTERNAL_ZLIB_LIBRARY)
+endmacro (EXTERNAL_ZLIB_LIBRARY)
 
 #-------------------------------------------------------------------------------
-MACRO (PACKAGE_ZLIB_LIBRARY compress_type)
+macro (PACKAGE_ZLIB_LIBRARY compress_type)
   add_custom_target (ZLIB-GenHeader-Copy ALL
       COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/
       COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
@@ -246,4 +267,4 @@ MACRO (PACKAGE_ZLIB_LIBRARY compress_type)
   if (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
     add_dependencies (ZLIB-GenHeader-Copy ZLIB)
   endif (${compress_type} MATCHES "SVN" OR ${compress_type} MATCHES "TGZ")
-ENDMACRO (PACKAGE_ZLIB_LIBRARY)
+endmacro (PACKAGE_ZLIB_LIBRARY)
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index f6e9b91..b2c4997 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -1,10 +1,10 @@
 #-------------------------------------------------------------------------------
-MACRO (SET_GLOBAL_VARIABLE name value)
+macro (SET_GLOBAL_VARIABLE name value)
   set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE)
-ENDMACRO (SET_GLOBAL_VARIABLE)
+endmacro (SET_GLOBAL_VARIABLE)
 
 #-------------------------------------------------------------------------------
-MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+macro (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
   #set(source_group_path "Source/AIM/${NAME}")
   string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH})
   source_group (${source_group_path} FILES ${HEADERS} ${SOURCES})
@@ -14,13 +14,13 @@ MACRO (IDE_GENERATED_PROPERTIES SOURCE_PATH HEADERS SOURCES)
   #set_property (SOURCE ${HEADERS}
   #       PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
   #)
-ENDMACRO (IDE_GENERATED_PROPERTIES)
+endmacro (IDE_GENERATED_PROPERTIES)
 
 #-------------------------------------------------------------------------------
-MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
+macro (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
   #  install (FILES ${HEADERS}
   #       DESTINATION include/R3D/${NAME}
-  #       COMPONENT Headers       
+  #       COMPONENT Headers
   #  )
 
   string (REPLACE "/" "\\\\" source_group_path ${SOURCE_PATH}  )
@@ -31,19 +31,17 @@ MACRO (IDE_SOURCE_PROPERTIES SOURCE_PATH HEADERS SOURCES)
   #set_property (SOURCE ${HEADERS}
   #       PROPERTY MACOSX_PACKAGE_LOCATION Headers/${NAME}
   #)
-ENDMACRO (IDE_SOURCE_PROPERTIES)
+endmacro (IDE_SOURCE_PROPERTIES)
 
 #-------------------------------------------------------------------------------
-MACRO (TARGET_NAMING libtarget libtype)
-  if (WIN32)
-    if (${libtype} MATCHES "SHARED")
-      set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}dll")
-    endif (${libtype} MATCHES "SHARED")
-  endif (WIN32)
-ENDMACRO (TARGET_NAMING)
+macro (TARGET_NAMING libtarget libtype)
+  if (${libtype} MATCHES "SHARED")
+    set_target_properties (${libtarget} PROPERTIES OUTPUT_NAME "${libtarget}${ARGN}")
+  endif (${libtype} MATCHES "SHARED")
+endmacro (TARGET_NAMING)
 
 #-------------------------------------------------------------------------------
-MACRO (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
+macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
   if (WIN32 AND MSVC)
     get_target_property (target_name ${libtarget} OUTPUT_NAME_RELWITHDEBINFO)
     install (
@@ -55,10 +53,10 @@ MACRO (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent)
       COMPONENT ${targetcomponent}
   )
   endif (WIN32 AND MSVC)
-ENDMACRO (INSTALL_TARGET_PDB)
+endmacro (INSTALL_TARGET_PDB)
 
 #-------------------------------------------------------------------------------
-MACRO (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent)
+macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent)
   if (WIN32 AND MSVC)
     get_target_property (target_name ${progtarget} OUTPUT_NAME_RELWITHDEBINFO)
     get_target_property (target_prefix ${progtarget} PREFIX)
@@ -71,10 +69,10 @@ MACRO (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent)
       COMPONENT ${targetcomponent}
   )
   endif (WIN32 AND MSVC)
-ENDMACRO (INSTALL_PROGRAM_PDB)
+endmacro (INSTALL_PROGRAM_PDB)
 
 #-------------------------------------------------------------------------------
-MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
+macro (HDF_SET_LIB_OPTIONS libtarget libname libtype)
   if (${libtype} MATCHES "SHARED")
     if (WIN32)
       set (LIB_RELEASE_NAME "${libname}")
@@ -92,7 +90,7 @@ MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
       set (LIB_DEBUG_NAME "${libname}_debug")
     endif (WIN32)
   endif (${libtype} MATCHES "SHARED")
-  
+
   set_target_properties (${libtarget}
       PROPERTIES
       OUTPUT_NAME_DEBUG          ${LIB_DEBUG_NAME}
@@ -100,7 +98,7 @@ MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
       OUTPUT_NAME_MINSIZEREL     ${LIB_RELEASE_NAME}
       OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME}
   )
-  
+
   #----- Use MSVC Naming conventions for Shared Libraries
   if (MINGW AND ${libtype} MATCHES "SHARED")
     set_target_properties (${libtarget}
@@ -111,10 +109,10 @@ MACRO (HDF_SET_LIB_OPTIONS libtarget libname libtype)
     )
   endif (MINGW AND ${libtype} MATCHES "SHARED")
 
-ENDMACRO (HDF_SET_LIB_OPTIONS)
+endmacro (HDF_SET_LIB_OPTIONS)
 
 #-------------------------------------------------------------------------------
-MACRO (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
+macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
   HDF_SET_LIB_OPTIONS (${libtarget} ${libname} ${libtype})
 
   if (${importtype} MATCHES "IMPORT")
@@ -167,83 +165,67 @@ MACRO (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
     endif (WIN32 AND NOT MINGW)
   endif (${libtype} MATCHES "SHARED")
 
-ENDMACRO (HDF_IMPORT_SET_LIB_OPTIONS)
+endmacro (HDF_IMPORT_SET_LIB_OPTIONS)
 
 #-------------------------------------------------------------------------------
-MACRO (TARGET_C_PROPERTIES wintarget addcompileflags addlinkflags)
+macro (TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags)
   if (MSVC)
-    TARGET_MSVC_PROPERTIES (${wintarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
+    TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
   else (MSVC)
-    if (BUILD_SHARED_LIBS)
-      set_target_properties (${wintarget}
-          PROPERTIES
-              COMPILE_FLAGS "${addcompileflags}"
-              LINK_FLAGS "${addlinkflags}"
-      ) 
-    else (BUILD_SHARED_LIBS)
-      set_target_properties (${wintarget}
-          PROPERTIES
-              COMPILE_FLAGS "${addcompileflags}"
-              LINK_FLAGS "${addlinkflags}"
-      ) 
-    endif (BUILD_SHARED_LIBS)
+    set_target_properties (${wintarget}
+        PROPERTIES
+            COMPILE_FLAGS "${addcompileflags}"
+            LINK_FLAGS "${addlinkflags}"
+    )
   endif (MSVC)
-ENDMACRO (TARGET_C_PROPERTIES)
+endmacro (TARGET_C_PROPERTIES)
 
 #-------------------------------------------------------------------------------
-MACRO (TARGET_MSVC_PROPERTIES wintarget addcompileflags addlinkflags)
+macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags)
   if (MSVC)
-    if (BUILD_SHARED_LIBS)
-      set_target_properties (${wintarget}
-          PROPERTIES
-              COMPILE_FLAGS "${addcompileflags}"
-              LINK_FLAGS "${addlinkflags}"
-      ) 
-    else (BUILD_SHARED_LIBS)
-      set_target_properties (${wintarget}
-          PROPERTIES
-              COMPILE_FLAGS "${addcompileflags}"
-              LINK_FLAGS "${addlinkflags}"
-      ) 
-    endif (BUILD_SHARED_LIBS)
+    set_target_properties (${wintarget}
+        PROPERTIES
+            COMPILE_FLAGS "${addcompileflags}"
+            LINK_FLAGS "${addlinkflags}"
+    )
   endif (MSVC)
-ENDMACRO (TARGET_MSVC_PROPERTIES)
+endmacro (TARGET_MSVC_PROPERTIES)
 
 #-------------------------------------------------------------------------------
-MACRO (TARGET_FORTRAN_PROPERTIES forttarget addcompileflags addlinkflags)
+macro (TARGET_FORTRAN_PROPERTIES forttarget libtype addcompileflags addlinkflags)
   if (WIN32)
-    TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
+    TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}")
   endif (WIN32)
-ENDMACRO (TARGET_FORTRAN_PROPERTIES)
+endmacro (TARGET_FORTRAN_PROPERTIES)
 
 #-------------------------------------------------------------------------------
-MACRO (TARGET_FORTRAN_WIN_PROPERTIES forttarget addcompileflags addlinkflags)
+macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkflags)
   if (MSVC)
-    if (BUILD_SHARED_LIBS)
+    if (${libtype} MATCHES "SHARED")
       set_target_properties (${forttarget}
           PROPERTIES
               COMPILE_FLAGS "/dll ${addcompileflags}"
               LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
-      ) 
-    else (BUILD_SHARED_LIBS)
+      )
+    else (${libtype} MATCHES "SHARED")
       set_target_properties (${forttarget}
           PROPERTIES
               COMPILE_FLAGS "${addcompileflags}"
               LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}"
-      ) 
-    endif (BUILD_SHARED_LIBS)
+      )
+    endif (${libtype} MATCHES "SHARED")
   endif (MSVC)
-ENDMACRO (TARGET_FORTRAN_WIN_PROPERTIES)
+endmacro (TARGET_FORTRAN_WIN_PROPERTIES)
 
 #-----------------------------------------------------------------------------
 # Configure the README.txt file for the binary package
 #-----------------------------------------------------------------------------
-MACRO (HDF_README_PROPERTIES target_fortran)
+macro (HDF_README_PROPERTIES target_fortran)
   set (BINARY_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
   set (BINARY_PLATFORM "${CMAKE_SYSTEM_NAME}")
   if (WIN32)
     set (BINARY_EXAMPLE_ENDING "zip")
-    set (BINARY_INSTALL_ENDING "exe")
+    set (BINARY_INSTALL_ENDING "msi")
     if (CMAKE_CL_64)
       set (BINARY_SYSTEM_NAME "win64")
     else (CMAKE_CL_64)
@@ -253,6 +235,8 @@ MACRO (HDF_README_PROPERTIES target_fortran)
       set (BINARY_PLATFORM "${BINARY_PLATFORM} 7")
     elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.2")
       set (BINARY_PLATFORM "${BINARY_PLATFORM} 8")
+    elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.3")
+      set (BINARY_PLATFORM "${BINARY_PLATFORM} 10")
     endif (${CMAKE_SYSTEM_VERSION} MATCHES "6.1")
     set (BINARY_PLATFORM "${BINARY_PLATFORM} ${MSVC_C_ARCHITECTURE_ID}")
     if (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*")
@@ -263,6 +247,8 @@ MACRO (HDF_README_PROPERTIES target_fortran)
       set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2012")
     elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "18.*")
       set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2013")
+    elseif (${CMAKE_C_COMPILER_VERSION} MATCHES "19.*")
+      set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015")
     else (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*")
       set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}")
     endif (${CMAKE_C_COMPILER_VERSION} MATCHES "16.*")
@@ -277,12 +263,19 @@ MACRO (HDF_README_PROPERTIES target_fortran)
     set (BINARY_PLATFORM "${BINARY_PLATFORM} ${CMAKE_SYSTEM_VERSION} ${CMAKE_SYSTEM_PROCESSOR}")
     set (BINARY_PLATFORM "${BINARY_PLATFORM}, using ${CMAKE_C_COMPILER_ID} C ${CMAKE_C_COMPILER_VERSION}")
   endif (WIN32)
+
   if (target_fortran)
     set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran")
   endif (target_fortran)
-    
+
+  if (BUILD_SHARED_LIBS)
+    set (LIB_TYPE "Static and Shared")
+  else (BUILD_SHARED_LIBS)
+    set (LIB_TYPE "Static")
+  endif (BUILD_SHARED_LIBS)
+
   configure_file (
-      ${HDF_RESOURCES_DIR}/README.txt.cmake.in 
+      ${HDF_RESOURCES_DIR}/README.txt.cmake.in
       ${CMAKE_BINARY_DIR}/README.txt @ONLY
   )
-ENDMACRO (HDF_README_PROPERTIES)
+endmacro (HDF_README_PROPERTIES)
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 03aab43..8478d1b 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -213,7 +213,7 @@ SIMPLE_TEST(struct stat sb; sb.st_blocks=0);
 
 int main(void)
 {
-  char *llwidthArgs[] = { "l64", "l", "L", "q", "ll", NULL };
+  char *llwidthArgs[] = { "I64", "l64", "l", "L", "q", "ll", NULL };
   char *s = malloc(128);
   char **currentArg = NULL;
   LL_TYPE x = (LL_TYPE)1048576 * (LL_TYPE)1048576;
@@ -323,6 +323,21 @@ int main(void)
        SIMPLE_TEST(posix_memalign());
 #endif
 
+#ifdef HAVE_DEFAULT_SOURCE
+/* check default source */
+#include <features.h>
+
+int
+main(void)
+{
+#ifdef __GLIBC_PREREQ
+  return __GLIBC_PREREQ(2,19);
+#else
+  return 0;
+#endif /* defined(__GLIBC_PREREQ) */
+}
+#endif
+
 #ifdef TEST_LFS_WORKS
 /* Return 0 when LFS is available and 1 otherwise.  */
 #define _LARGEFILE_SOURCE
@@ -374,13 +389,6 @@ int main(void)
 }
 #endif
 
-#ifdef LONE_COLON
-int main(int argc, char * argv) 
-{
-  return 0;
-}
-#endif
-
 #ifdef CXX_HAVE_OFFSETOF
 
 #include <stdio.h>
@@ -446,13 +454,19 @@ SIMPLE_TEST(struct text_info w; w.screenwidth=0);
 
 #endif /* HAVE_TM_GMTOFF */
 
-
-#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
+#if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE )
 #ifndef __cplusplus
+#if defined( HAVE_INLINE )
+#  define INLINE_KW inline
+#elif defined ( HAVE___INLINE__ )
+#  define INLINE_KW __inline__
+#elif defined ( HAVE___INLINE )
+#  define INLINE_KW __inline
+#endif /* HAVE_INLINE */
 typedef int foo_t;
-static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
-INLINE_TEST_INLINE foo_t foo () {return 0; }
-int main() { return 0; }
-#endif
+static INLINE_KW foo_t static_foo () { return 0; }
+INLINE_KW foo_t foo () {return 0; }
+int main(void) { return 0; }
+#endif /* __cplusplus */
+#endif /* defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) */
 
-#endif /* INLINE_TEST */
diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake
index 4955d20..275f2ea 100644
--- a/config/cmake_ext_mod/HDFUseFortran.cmake
+++ b/config/cmake_ext_mod/HDFUseFortran.cmake
@@ -3,7 +3,7 @@
 #
 #-------------------------------------------------------------------------------
 ENABLE_LANGUAGE (Fortran)
-  
+
 #-----------------------------------------------------------------------------
 # Detect name mangling convention used between Fortran and C
 #-----------------------------------------------------------------------------
@@ -12,7 +12,6 @@ FortranCInterface_HEADER (
     ${CMAKE_BINARY_DIR}/FCMangle.h
     MACRO_NAMESPACE "H5_FC_"
     SYMBOL_NAMESPACE "H5_FC_"
-    SYMBOLS mysub mymod:my_sub
 )
 
 file (STRINGS ${CMAKE_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)")
@@ -28,7 +27,6 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}")
 # so this one is used for a sizeof test.
 #-----------------------------------------------------------------------------
 MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
-  if (NOT DEFINED ${VARIABLE})
     message (STATUS "Testing Fortran ${FUNCTION}")
     if (CMAKE_REQUIRED_LIBRARIES)
       set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
@@ -37,12 +35,12 @@ MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
       set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
     endif (CMAKE_REQUIRED_LIBRARIES)
     file (WRITE
-        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90
         "${CODE}"
     )
-    TRY_COMPILE (${VARIABLE}
+    TRY_COMPILE (RESULT_VAR
         ${CMAKE_BINARY_DIR}
-        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+        ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f90
         CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
         OUTPUT_VARIABLE OUTPUT
     )
@@ -51,21 +49,21 @@ MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
 #    message ( "Test result ${OUTPUT}")
 #    message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
 
-    if (${VARIABLE})
+    if (${RESULT_VAR})
       set (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
       message (STATUS "Testing Fortran ${FUNCTION} - OK")
       file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
           "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
           "${OUTPUT}\n\n"
       )
-    else (${VARIABLE})
+    else ()
       message (STATUS "Testing Fortran ${FUNCTION} - Fail")
-      set (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+      set (${VARIABLE} 0 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
       file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
           "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
           "${OUTPUT}\n\n")
-    endif (${VARIABLE})
-  endif (NOT DEFINED ${VARIABLE})
+    endif ()
+
 ENDMACRO (CHECK_FORTRAN_FEATURE)
 
 #-----------------------------------------------------------------------------
@@ -77,6 +75,7 @@ ENDMACRO (CHECK_FORTRAN_FEATURE)
 #-----------------------------------------------------------------------------
 
 # Check for Non-standard extension intrinsic function SIZEOF
+set(FORTRAN_HAVE_SIZEOF FALSE)
 CHECK_FORTRAN_FEATURE(sizeof
   "
        PROGRAM main
@@ -87,6 +86,7 @@ CHECK_FORTRAN_FEATURE(sizeof
 )
 
 # Check for F2008 standard intrinsic function C_SIZEOF
+set(FORTRAN_HAVE_C_SIZEOF FALSE)
 CHECK_FORTRAN_FEATURE(c_sizeof
   "
        PROGRAM main
@@ -111,7 +111,18 @@ CHECK_FORTRAN_FEATURE(storage_size
   FORTRAN_HAVE_STORAGE_SIZE
 )
 
+# Check for F2008 standard intrinsic module "ISO_FORTRAN_ENV"
+set(HAVE_ISO_FORTRAN_ENV FALSE)
+CHECK_FORTRAN_FEATURE(ISO_FORTRAN_ENV
+  "
+       PROGRAM main
+         USE, INTRINSIC :: ISO_FORTRAN_ENV
+       END PROGRAM
+  "
+  HAVE_ISO_FORTRAN_ENV
+)
 
+set(FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE)
 CHECK_FORTRAN_FEATURE(RealIsNotDouble
   "
        MODULE type_mod
@@ -141,6 +152,7 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble
 #-----------------------------------------------------------------------------
 # Checks if the ISO_C_BINDING module meets all the requirements
 #-----------------------------------------------------------------------------
+set(FORTRAN_HAVE_ISO_C_BINDING FALSE)
 CHECK_FORTRAN_FEATURE(iso_c_binding
   "
        PROGRAM main
@@ -148,7 +160,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding
             IMPLICIT NONE
             TYPE(C_PTR) :: ptr
             TYPE(C_FUNPTR) :: funptr
-            INTEGER(C_INT64_T) :: c_int64_type 
+            INTEGER(C_INT64_T) :: c_int64_type
             CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr
             ptr = C_LOC(ichr(1:1))
        END PROGRAM
diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake
index 579d855..a090057 100644
--- a/config/cmake_ext_mod/grepTest.cmake
+++ b/config/cmake_ext_mod/grepTest.cmake
@@ -27,13 +27,13 @@ endif (NOT TEST_REFERENCE)
 message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
 
 # run the test program, capture the stdout/stderr and the result var
-EXECUTE_PROCESS (
+execute_process (
     COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
     WORKING_DIRECTORY ${TEST_FOLDER}
     RESULT_VARIABLE TEST_RESULT
     OUTPUT_FILE ${TEST_OUTPUT}
     ERROR_FILE ${TEST_OUTPUT}.err
-    OUTPUT_VARIABLE TEST_ERROR
+    OUTPUT_VARIABLE TEST_OUT
     ERROR_VARIABLE TEST_ERROR
 )
 
@@ -44,16 +44,16 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}")
 file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
 
 # TEST_REFERENCE should always be matched
-STRING(REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) 
-STRING(COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) 
+string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
+string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
 if (${TEST_RESULT} STREQUAL "0")
   message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
 endif (${TEST_RESULT} STREQUAL "0")
 
-STRING(REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) 
+string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
 if (${TEST_EXPECT} STREQUAL "1")
   # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match
-  STRING(LENGTH "${TEST_MATCH}" TEST_RESULT) 
+  string (LENGTH "${TEST_MATCH}" TEST_RESULT)
   if (NOT ${TEST_RESULT} STREQUAL "0")
     message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
   endif (NOT ${TEST_RESULT} STREQUAL "0")
diff --git a/config/cmake_ext_mod/prunTest.cmake b/config/cmake_ext_mod/prunTest.cmake
index 3d5ec31..38ecb7e 100644
--- a/config/cmake_ext_mod/prunTest.cmake
+++ b/config/cmake_ext_mod/prunTest.cmake
@@ -30,7 +30,7 @@ set (ERROR_APPEND 1)
 message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
 
 if (TEST_ENV_VAR)
-  set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") 
+  set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}")
 endif (TEST_ENV_VAR)
 
 # run the test program, capture the stdout/stderr and the result var
@@ -40,7 +40,7 @@ EXECUTE_PROCESS (
     RESULT_VARIABLE TEST_RESULT
     OUTPUT_FILE ${TEST_OUTPUT}
     ERROR_FILE ${TEST_OUTPUT}.err
-    OUTPUT_VARIABLE TEST_ERROR
+    OUTPUT_VARIABLE TEST_OUT
     ERROR_VARIABLE TEST_ERROR
 )
 
@@ -49,51 +49,51 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}")
 file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
 file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}")
 
-if (ERROR_APPEND)
+if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
-  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") 
-endif (ERROR_APPEND)
+  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
 
 if (TEST_APPEND)
-  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n") 
+  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n")
 endif (TEST_APPEND)
 
 message (STATUS "COMMAND Error: ${TEST_ERROR}")
 
 if (TEST_MASK)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") 
+  STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_MASK)
 
 if (TEST_MASK_MOD)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") 
+  STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_MASK_MOD)
 
 if (TEST_MASK_ERROR)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") 
+  STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
+  STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
+  STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
+  STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}")
+  STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}")
+  STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+  STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_MASK_ERROR)
 
 if (TEST_FILTER)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") 
+  STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_FILTER)
 
 #if (TEST_REF_FILTER)
 #  message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}")
 #  file (READ ${TEST_FOLDER}/P_${TEST_REFERENCE} TEST_STREAM)
-#  STRING(REGEX REPLACE "${TEST_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}") 
+#  STRING(REGEX REPLACE "${TEST_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}")
 #  file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}")
 #endif (TEST_REF_FILTER)
 
diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake
index bfaae2b..21a65e6 100644
--- a/config/cmake_ext_mod/runTest.cmake
+++ b/config/cmake_ext_mod/runTest.cmake
@@ -25,6 +25,7 @@ if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
   message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
 endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
 
+# if there is not an error reference file add the error output to the stdout file
 if (NOT TEST_ERRREF)
   set (ERROR_APPEND 1)
 endif (NOT TEST_ERRREF)
@@ -32,43 +33,45 @@ endif (NOT TEST_ERRREF)
 message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
 
 if (TEST_ENV_VAR)
-  set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") 
+  set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}")
 endif (TEST_ENV_VAR)
 
 if (NOT TEST_INPUT)
   # run the test program, capture the stdout/stderr and the result var
-  EXECUTE_PROCESS (
+  execute_process (
       COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
       WORKING_DIRECTORY ${TEST_FOLDER}
       RESULT_VARIABLE TEST_RESULT
       OUTPUT_FILE ${TEST_OUTPUT}
       ERROR_FILE ${TEST_OUTPUT}.err
-      OUTPUT_VARIABLE TEST_ERROR
+      OUTPUT_VARIABLE TEST_OUT
       ERROR_VARIABLE TEST_ERROR
   )
 else (NOT TEST_INPUT)
   # run the test program with stdin, capture the stdout/stderr and the result var
-  EXECUTE_PROCESS (
+  execute_process (
       COMMAND ${TEST_PROGRAM} ${TEST_ARGS}
       WORKING_DIRECTORY ${TEST_FOLDER}
       RESULT_VARIABLE TEST_RESULT
       INPUT_FILE ${TEST_INPUT}
       OUTPUT_FILE ${TEST_OUTPUT}
       ERROR_FILE ${TEST_OUTPUT}.err
-      OUTPUT_VARIABLE TEST_ERROR
+      OUTPUT_VARIABLE TEST_OUT
       ERROR_VARIABLE TEST_ERROR
   )
 endif (NOT TEST_INPUT)
 
 message (STATUS "COMMAND Result: ${TEST_RESULT}")
 
-if (ERROR_APPEND)
+# if the .err file exists and ERRROR_APPEND is enabled
+if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
-  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") 
-endif (ERROR_APPEND)
+  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
 
+# append the test result status with a predefined text
 if (TEST_APPEND)
-  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") 
+  file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n")
 endif (TEST_APPEND)
 
 # if the return value is !=${TEST_EXPECT} bail out
@@ -78,44 +81,52 @@ endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT})
 
 message (STATUS "COMMAND Error: ${TEST_ERROR}")
 
+# if the output file needs Storage text removed
 if (TEST_MASK)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}") 
+   string (REGEX REPLACE "Storage:[^\n]+\n" "Storage:   <details removed for portability>\n" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_MASK)
 
+# if the output file needs Modified text removed
 if (TEST_MASK_MOD)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") 
+   string (REGEX REPLACE "Modified:[^\n]+\n" "Modified:  XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_MASK_MOD)
 
+# if the output file or the .err file needs to mask out error stack info
 if (TEST_MASK_ERROR)
   if (NOT TEST_ERRREF)
+    # the error stack has been appended to the output file
     file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  else (NOT TEST_ERRREF)
+  else ()
+    # the error stack remains in the .err file
     file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
-  endif (NOT TEST_ERRREF)
-  STRING(REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") 
-  STRING(REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") 
+  endif ()
+  string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+  string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}")
+  # write back the changes to the original files
   if (NOT TEST_ERRREF)
     file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
-  else (NOT TEST_ERRREF)
+  else ()
     file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}")
-  endif (NOT TEST_ERRREF)
+  endif ()
 endif (TEST_MASK_ERROR)
 
+# remove text from the output file
 if (TEST_FILTER)
   file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
-  STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") 
+  string (REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}")
   file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
 endif (TEST_FILTER)
 
+# compare output files to references unless this must be skipped
 if (NOT TEST_SKIP_COMPARE)
   if (WIN32 AND NOT MINGW)
     file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
@@ -123,21 +134,21 @@ if (NOT TEST_SKIP_COMPARE)
   endif (WIN32 AND NOT MINGW)
 
   # now compare the output with the reference
-  EXECUTE_PROCESS (
+  execute_process (
       COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
       RESULT_VARIABLE TEST_RESULT
   )
   if (NOT ${TEST_RESULT} STREQUAL 0)
   set (TEST_RESULT 0)
   file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
-  LIST (LENGTH test_act len_act)
+  list (LENGTH test_act len_act)
   file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
-  LIST (LENGTH test_ref len_ref)
+  list (LENGTH test_ref len_ref)
   if (NOT ${len_act} STREQUAL "0")
-    MATH (EXPR _FP_LEN "${len_ref} - 1")
+    math (EXPR _FP_LEN "${len_ref} - 1")
     foreach (line RANGE 0 ${_FP_LEN})
-      LIST (GET test_act ${line} str_act)
-      LIST (GET test_ref ${line} str_ref)
+      list (GET test_act ${line} str_act)
+      list (GET test_ref ${line} str_ref)
       if (NOT "${str_act}" STREQUAL "${str_ref}")
         if (NOT "${str_act}" STREQUAL "")
           set (TEST_RESULT 1)
@@ -157,7 +168,8 @@ if (NOT TEST_SKIP_COMPARE)
   if (NOT ${TEST_RESULT} STREQUAL 0)
     message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
   endif (NOT ${TEST_RESULT} STREQUAL 0)
-  
+
+  # now compare the .err file with the error reference, if supplied
   if (TEST_ERRREF)
     if (WIN32 AND NOT MINGW)
       file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM)
@@ -165,22 +177,22 @@ if (NOT TEST_SKIP_COMPARE)
     endif (WIN32 AND NOT MINGW)
 
     # now compare the error output with the error reference
-    EXECUTE_PROCESS (
+    execute_process (
         COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
         RESULT_VARIABLE TEST_RESULT
     )
     if (NOT ${TEST_RESULT} STREQUAL 0)
     set (TEST_RESULT 0)
     file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
-    LIST (LENGTH test_act len_act)
+    list (LENGTH test_act len_act)
     file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
-    LIST (LENGTH test_ref len_ref)
-    MATH (EXPR _FP_LEN "${len_ref} - 1")
+    list (LENGTH test_ref len_ref)
+    math (EXPR _FP_LEN "${len_ref} - 1")
     if (NOT ${len_act} STREQUAL "0")
-      MATH (EXPR _FP_LEN "${len_ref} - 1")
+      math (EXPR _FP_LEN "${len_ref} - 1")
       foreach (line RANGE 0 ${_FP_LEN})
-        LIST (GET test_act ${line} str_act)
-        LIST (GET test_ref ${line} str_ref)
+        list (GET test_act ${line} str_act)
+        list (GET test_ref ${line} str_ref)
         if (NOT "${str_act}" STREQUAL "${str_ref}")
           if (NOT "${str_act}" STREQUAL "")
             set (TEST_RESULT 1)
diff --git a/configure b/configure
index f37d2fa..8954ec4 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.ac Id: configure.ac 6194 2015-02-05 14:17:12Z bmribler .
+# From configure.ac Id: configure.ac 6473 2016-06-24 21:38:14Z bmribler .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for HDF 4.2.11.
+# Generated by GNU Autoconf 2.69 for HDF 4.2.12.
 #
 # Report bugs to <help at hdfgroup.org>.
 #
@@ -591,8 +591,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='HDF'
 PACKAGE_TARNAME='hdf'
-PACKAGE_VERSION='4.2.11'
-PACKAGE_STRING='HDF 4.2.11'
+PACKAGE_VERSION='4.2.12'
+PACKAGE_STRING='HDF 4.2.12'
 PACKAGE_BUGREPORT='help at hdfgroup.org'
 PACKAGE_URL=''
 
@@ -690,6 +690,26 @@ LEX
 YACC
 AR
 LN_S
+BUILD_JAVA_CONDITIONAL_FALSE
+BUILD_JAVA_CONDITIONAL_TRUE
+JAVA_PATH_NAME
+TESTS_JUNIT
+JAVA_JUNIT
+JUNIT
+_ACJNI_JAVAC
+JAVADOC
+JAR
+UUDECODE
+JAVAC
+JAVA
+JAVAFLAGS
+JAVACFLAGS
+JAVAPREFIX
+H4_CLASSPATH
+HDF_JAVA
+H4_JAVAFLAGS
+H4_JAVACFLAGS
+JNIFLAGS
 BUILD_FORTRAN
 HDF_BUILD_FORTRAN_FALSE
 HDF_BUILD_FORTRAN_TRUE
@@ -809,6 +829,10 @@ enable_maintainer_mode
 enable_netcdf
 enable_dependency_tracking
 enable_fortran
+enable_java
+with_java_prefix
+with_javac_flags
+with_java_flags
 enable_shared
 enable_static
 with_pic
@@ -1380,7 +1404,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures HDF 4.2.11 to adapt to many kinds of systems.
+\`configure' configures HDF 4.2.12 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1450,7 +1474,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of HDF 4.2.11:";;
+     short | recursive ) echo "Configuration of HDF 4.2.12:";;
    esac
   cat <<\_ACEOF
 
@@ -1470,6 +1494,7 @@ Optional Features:
   --disable-dependency-tracking
                           speeds up one-time build
   --enable-fortran        Build Fortran into library [default=yes]
+  --enable-java           Compile the Java JNI interface [default=no]
   --enable-shared[=PKGS]  build shared libraries [default=no]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -1486,6 +1511,9 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-java-prefix=PFX  prefix where Java runtime is installed (optional)
+  --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)
+  --with-java-flags=FLAGS flags to pass to the Java VM (optional)
   --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
@@ -1585,7 +1613,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-HDF configure 4.2.11
+HDF configure 4.2.12
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2398,7 +2426,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by HDF $as_me 4.2.11, which was
+It was created by HDF $as_me 4.2.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3268,7 +3296,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='hdf'
- VERSION='4.2.11'
+ VERSION='4.2.12'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -6133,6 +6161,1091 @@ fi
 
 
 
+## ----------------------------------------------------------------------
+## Check if they would like the Java native interface (JNI) compiled
+##
+
+
+
+
+## This needs to be exposed for the library info file even if Java is disabled.
+
+
+## Default is no Java
+HDF_JAVA=no
+
+ H4_CLASSPATH=""
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Java JNI interface enabled" >&5
+$as_echo_n "checking if Java JNI interface enabled... " >&6; }
+
+# Check whether --enable-java was given.
+if test "${enable_java+set}" = set; then :
+  enableval=$enable_java; HDF_JAVA=$enableval
+fi
+
+
+if test "X$HDF_JAVA" = "Xyes"; then
+  if test "X${enable_shared}" != "Xno"; then
+    echo "yes"
+    if test "X$CLASSPATH" = "X"; then
+      H4_CLASSPATH=".:$srcdir/java/lib"
+    else
+      H4_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib"
+    fi
+    ## Checks for programs.
+
+
+# Check whether --with-java-prefix was given.
+if test "${with_java_prefix+set}" = set; then :
+  withval=$with_java_prefix;
+fi
+
+
+# Check whether --with-javac-flags was given.
+if test "${with_javac_flags+set}" = set; then :
+  withval=$with_javac_flags;
+fi
+
+
+# Check whether --with-java-flags was given.
+if test "${with_java_flags+set}" = set; then :
+  withval=$with_java_flags;
+fi
+
+JAVAPREFIX=$with_java_prefix
+JAVACFLAGS=$with_javac_flags
+JAVAFLAGS=$with_java_flags
+
+    H4_JAVACFLAGS=$JAVACFLAGS
+    H4_JAVAFLAGS=$JAVAFLAGS
+
+if test "x$JAVAPREFIX" = x; then :
+  test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVAC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVAC"; then
+  ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVAC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVAC=$ac_cv_prog_JAVAC
+if test -n "$JAVAC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+$as_echo "$JAVAC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVAC" && break
+done
+
+else
+  test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVAC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVAC"; then
+  ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $JAVAPREFIX/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVAC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVAC=$ac_cv_prog_JAVAC
+if test -n "$JAVAC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+$as_echo "$JAVAC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVAC" && break
+done
+
+fi
+test "x$JAVAC" = x && as_fn_error $? "no acceptable Java compiler found in \$PATH" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $JAVAC works" >&5
+$as_echo_n "checking if $JAVAC works... " >&6; }
+if ${ac_cv_prog_javac_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+JAVA_TEST=Test.java
+CLASS_TEST=Test.class
+cat << \EOF > $JAVA_TEST
+/* #line 6320 "configure" */
+public class Test {
+}
+EOF
+if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
+  ac_cv_prog_javac_works=yes
+else
+  as_fn_error $? "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
+  echo "configure: failed program was:" >&5
+  cat $JAVA_TEST >&5
+fi
+rm -f $JAVA_TEST $CLASS_TEST
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_javac_works" >&5
+$as_echo "$ac_cv_prog_javac_works" >&6; }
+
+
+
+if test "x$JAVAPREFIX" = x; then :
+  test x$JAVA = x && for ac_prog in kaffe java
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVA+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVA"; then
+  ac_cv_prog_JAVA="$JAVA" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVA="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVA=$ac_cv_prog_JAVA
+if test -n "$JAVA"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5
+$as_echo "$JAVA" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVA" && break
+done
+
+else
+  test x$JAVA = x && for ac_prog in kaffe java
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVA+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVA"; then
+  ac_cv_prog_JAVA="$JAVA" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $JAVAPREFIX/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVA="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVA=$ac_cv_prog_JAVA
+if test -n "$JAVA"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA" >&5
+$as_echo "$JAVA" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVA" && break
+done
+
+fi
+test x$JAVA = x && as_fn_error $? "no acceptable Java virtual machine found in \$PATH" "$LINENO" 5
+
+# Extract the first word of "uudecode", so it can be a program name with args.
+set dummy uudecode; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_UUDECODE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $UUDECODE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_UUDECODE="$UUDECODE" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_UUDECODE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_UUDECODE" && ac_cv_path_UUDECODE="no"
+  ;;
+esac
+fi
+UUDECODE=$ac_cv_path_UUDECODE
+if test -n "$UUDECODE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UUDECODE" >&5
+$as_echo "$UUDECODE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x$UUDECODE != xno; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if uudecode can decode base 64 file" >&5
+$as_echo_n "checking if uudecode can decode base 64 file... " >&6; }
+if ${ac_cv_prog_uudecode_base64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat << \EOF > Test.uue
+begin-base64 644 Test.class
+yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
+bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
+bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s
+YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG
+aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB
+AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB
+AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ=
+====
+EOF
+if $UUDECODE Test.uue; then
+        ac_cv_prog_uudecode_base64=yes
+else
+        echo "configure: 6495: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
+        echo "configure: failed file was:" >&5
+        cat Test.uue >&5
+        ac_cv_prog_uudecode_base64=no
+fi
+rm -f Test.uue
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_uudecode_base64" >&5
+$as_echo "$ac_cv_prog_uudecode_base64" >&6; }
+fi
+if test x$ac_cv_prog_uudecode_base64 != xyes; then
+        rm -f Test.class
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: I have to compile Test.class from scratch" >&5
+$as_echo "$as_me: WARNING: I have to compile Test.class from scratch" >&2;}
+        if test x$ac_cv_prog_javac_works = xno; then
+                as_fn_error $? "Cannot compile java source. $JAVAC does not work properly" "$LINENO" 5
+        fi
+        if test x$ac_cv_prog_javac_works = x; then
+
+if test "x$JAVAPREFIX" = x; then :
+  test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVAC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVAC"; then
+  ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVAC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVAC=$ac_cv_prog_JAVAC
+if test -n "$JAVAC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+$as_echo "$JAVAC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVAC" && break
+done
+
+else
+  test "x$JAVAC" = x && for ac_prog in "gcj -C" guavac jikes javac
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVAC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVAC"; then
+  ac_cv_prog_JAVAC="$JAVAC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $JAVAPREFIX/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVAC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVAC=$ac_cv_prog_JAVAC
+if test -n "$JAVAC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
+$as_echo "$JAVAC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVAC" && break
+done
+
+fi
+test "x$JAVAC" = x && as_fn_error $? "no acceptable Java compiler found in \$PATH" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $JAVAC works" >&5
+$as_echo_n "checking if $JAVAC works... " >&6; }
+if ${ac_cv_prog_javac_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+JAVA_TEST=Test.java
+CLASS_TEST=Test.class
+cat << \EOF > $JAVA_TEST
+/* #line 6612 "configure" */
+public class Test {
+}
+EOF
+if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
+  ac_cv_prog_javac_works=yes
+else
+  as_fn_error $? "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
+  echo "configure: failed program was:" >&5
+  cat $JAVA_TEST >&5
+fi
+rm -f $JAVA_TEST $CLASS_TEST
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_javac_works" >&5
+$as_echo "$ac_cv_prog_javac_works" >&6; }
+
+
+        fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $JAVA works" >&5
+$as_echo_n "checking if $JAVA works... " >&6; }
+if ${ac_cv_prog_java_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+JAVA_TEST=Test.java
+CLASS_TEST=Test.class
+TEST=Test
+cat << \EOF > $JAVA_TEST
+/* [#]line 6647 "configure" */
+public class Test {
+public static void main (String args[]) {
+        System.exit (0);
+} }
+EOF
+if test x$ac_cv_prog_uudecode_base64 != xyes; then
+        if { ac_try='$JAVAC $JAVACFLAGS $JAVA_TEST'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } && test -s $CLASS_TEST; then
+                :
+        else
+          echo "configure: failed program was:" >&5
+          cat $JAVA_TEST >&5
+          as_fn_error $? "The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
+        fi
+fi
+if { ac_try='$JAVA -classpath . $JAVAFLAGS $TEST'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
+  ac_cv_prog_java_works=yes
+else
+  echo "configure: failed program was:" >&5
+  cat $JAVA_TEST >&5
+  as_fn_error $? "The Java VM $JAVA failed (see config.log, check the CLASSPATH?)" "$LINENO" 5
+fi
+rm -fr $JAVA_TEST $CLASS_TEST Test.uue
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_java_works" >&5
+$as_echo "$ac_cv_prog_java_works" >&6; }
+
+
+
+
+if test "x$JAVAPREFIX" = x; then :
+  test "x$JAR" = x && for ac_prog in jar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAR"; then
+  ac_cv_prog_JAR="$JAR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAR=$ac_cv_prog_JAR
+if test -n "$JAR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5
+$as_echo "$JAR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAR" && break
+done
+
+else
+  test "x$JAR" = x && for ac_prog in jar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAR"; then
+  ac_cv_prog_JAR="$JAR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $JAVAPREFIX/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAR="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAR=$ac_cv_prog_JAR
+if test -n "$JAR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5
+$as_echo "$JAR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAR" && break
+done
+
+fi
+test "x$JAR" = x && as_fn_error $? "no acceptable jar program found in \$PATH" "$LINENO" 5
+
+
+if test "x$JAVAPREFIX" = x; then :
+  test "x$JAVADOC" = x && for ac_prog in javadoc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVADOC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVADOC"; then
+  ac_cv_prog_JAVADOC="$JAVADOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVADOC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVADOC=$ac_cv_prog_JAVADOC
+if test -n "$JAVADOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVADOC" >&5
+$as_echo "$JAVADOC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVADOC" && break
+done
+
+else
+  test "x$JAVADOC" = x && for ac_prog in javadoc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_JAVADOC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$JAVADOC"; then
+  ac_cv_prog_JAVADOC="$JAVADOC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $JAVAPREFIX/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_JAVADOC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+JAVADOC=$ac_cv_prog_JAVADOC
+if test -n "$JAVADOC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVADOC" >&5
+$as_echo "$JAVADOC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$JAVADOC" && break
+done
+
+fi
+test "x$JAVADOC" = x && as_fn_error $? "no acceptable javadoc generator found in \$PATH" "$LINENO" 5
+
+    ## Find the include directories needed for building JNI code
+
+
+JNI_INCLUDE_DIRS=""
+
+if test "x$JAVA_HOME" != x; then
+	_JTOPDIR="$JAVA_HOME"
+else
+	if test "x$JAVAC" = x; then
+		JAVAC=javac
+	fi
+	# Extract the first word of "$JAVAC", so it can be a program name with args.
+set dummy $JAVAC; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path__ACJNI_JAVAC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $_ACJNI_JAVAC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path__ACJNI_JAVAC="$_ACJNI_JAVAC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path__ACJNI_JAVAC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path__ACJNI_JAVAC" && ac_cv_path__ACJNI_JAVAC="no"
+  ;;
+esac
+fi
+_ACJNI_JAVAC=$ac_cv_path__ACJNI_JAVAC
+if test -n "$_ACJNI_JAVAC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_ACJNI_JAVAC" >&5
+$as_echo "$_ACJNI_JAVAC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	if test "x$_ACJNI_JAVAC" = xno; then
+		as_fn_error $? "cannot find JDK; try setting \$JAVAC or \$JAVA_HOME" "$LINENO" 5
+	fi
+
+# find the include directory relative to the javac executable
+_cur=""$_ACJNI_JAVAC""
+while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking symlink for $_cur" >&5
+$as_echo_n "checking symlink for $_cur... " >&6; }
+        _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
+        case "$_slink" in
+        /*) _cur="$_slink";;
+        # 'X' avoids triggering unwanted echo options.
+        *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[^/]*$::'`"$_slink";;
+        esac
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_cur" >&5
+$as_echo "$_cur" >&6; }
+done
+_ACJNI_FOLLOWED="$_cur"
+
+	_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`
+fi
+
+case "$host_os" in
+        darwin*)        # Apple JDK is at /System location and has headers symlinked elsewhere
+                        case "$_JTOPDIR" in
+                        /System/Library/Frameworks/JavaVM.framework/*)
+				_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
+				_JINC="$_JTOPDIR/Headers";;
+			*)      _JINC="$_JTOPDIR/include";;
+                        esac;;
+        *)              _JINC="$_JTOPDIR/include";;
+esac
+$as_echo "$as_me:${as_lineno-$LINENO}: _JTOPDIR=$_JTOPDIR" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: _JINC=$_JINC" >&5
+
+# On Mac OS X 10.6.4, jni.h is a symlink:
+# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h
+# -> ../../CurrentJDK/Headers/jni.h.
+as_ac_File=`$as_echo "ac_cv_file_$_JINC/jni.h" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $_JINC/jni.h" >&5
+$as_echo_n "checking for $_JINC/jni.h... " >&6; }
+if eval \${$as_ac_File+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "$_JINC/jni.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+eval ac_res=\$$as_ac_File
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+  JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"
+else
+  _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'`
+	 as_ac_File=`$as_echo "ac_cv_file_$_JTOPDIR/include/jni.h" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $_JTOPDIR/include/jni.h" >&5
+$as_echo_n "checking for $_JTOPDIR/include/jni.h... " >&6; }
+if eval \${$as_ac_File+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "$_JTOPDIR/include/jni.h"; then
+  eval "$as_ac_File=yes"
+else
+  eval "$as_ac_File=no"
+fi
+fi
+eval ac_res=\$$as_ac_File
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
+  JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"
+else
+  as_fn_error $? "cannot find JDK header files" "$LINENO" 5
+fi
+
+
+fi
+
+
+# get the likely subdirectories for system specific java includes
+case "$host_os" in
+bsdi*)          _JNI_INC_SUBDIRS="bsdos";;
+freebsd*)       _JNI_INC_SUBDIRS="freebsd";;
+darwin*)        _JNI_INC_SUBDIRS="darwin";;
+linux*)         _JNI_INC_SUBDIRS="linux genunix";;
+osf*)           _JNI_INC_SUBDIRS="alpha";;
+solaris*)       _JNI_INC_SUBDIRS="solaris";;
+mingw*)		_JNI_INC_SUBDIRS="win32";;
+cygwin*)	_JNI_INC_SUBDIRS="win32";;
+*)              _JNI_INC_SUBDIRS="genunix";;
+esac
+
+# add any subdirectories that are present
+for JINCSUBDIR in $_JNI_INC_SUBDIRS
+do
+    if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
+         JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
+    fi
+done
+
+    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+    do
+      JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR"
+    done
+    ## Find junit for testing the JNI code
+
+if test "x$CLASSPATH" = x; then
+        echo "You have no CLASSPATH, I hope it is good"
+else
+        echo "You have CLASSPATH $CLASSPATH, hope it is correct"
+fi
+
+    CLASSPATH_ENV=$H4_CLASSPATH
+
+if ${ac_cv_prog_JUNIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+
+
+ac_var_name=`echo junit.textui.TestRunner | sed 's/\./_/g'`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for junit.textui.TestRunner class" >&5
+$as_echo_n "checking for junit.textui.TestRunner class... " >&6; }
+if eval \${ax_cv_class_$ac_var_name+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+if test x$ac_cv_prog_uudecode_base64 = xyes; then
+cat << \EOF > Test.uue
+begin-base64 644 Test.class
+yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
+bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
+bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
+AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
+ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
+ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
+VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
+amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
+AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
+AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
+AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
+uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
+AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
+JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
+JwAAAAIAKA==
+====
+EOF
+                if $UUDECODE Test.uue; then
+                        :
+                else
+                        echo "configure: 7077: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
+                        echo "configure: failed file was:" >&5
+                        cat Test.uue >&5
+                        ac_cv_prog_uudecode_base64=no
+                fi
+        rm -f Test.uue
+        if { ac_try='$JAVA $JAVAFLAGS Test junit.textui.TestRunner'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null 2>&1; then
+                eval "ac_cv_class_$ac_var_name=yes"
+        else
+                eval "ac_cv_class_$ac_var_name=no"
+        fi
+        rm -f Test.class
+else
+
+cat << \EOF > Test.java
+/* #line 7097 "configure" */
+import junit.textui.TestRunner;
+public class Test {
+
+}
+EOF
+if { ac_try='$JAVAC $JAVACFLAGS Test.java'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } && test -s Test.class
+then
+  eval "ac_cv_class_$ac_var_name=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat Test.java >&5
+  rm -fr Test.java Test.class
+  eval "ac_cv_class_$ac_var_name=no"
+fi
+rm -fr Test.java Test.class
+fi
+eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
+eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
+HAVE_LAST_CLASS=$ac_var_val
+if test x$ac_var_val = xyes; then
+        :
+else
+        :
+fi
+
+fi
+
+eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_var_val" >&5
+$as_echo "$ac_var_val" >&6; }
+
+if test x"`eval 'echo $ac_cv_class_junit_textui_TestRunner'`" != xno ; then
+  ac_cv_prog_JUNIT='$(CLASSPATH_ENV) $(JAVA) $(JAVAFLAGS) junit.textui.TestRunner'
+fi
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for junit" >&5
+$as_echo_n "checking for junit... " >&6; }
+if test x"`eval 'echo $ac_cv_prog_JUNIT'`" != x ; then
+  JUNIT="$ac_cv_prog_JUNIT"
+  JAVA_JUNIT='$(JAVA_JUNIT)'
+  TESTS_JUNIT='$(TESTS_JUNIT)'
+else
+  JUNIT=
+  JAVA_JUNIT=
+  TESTS_JUNIT=
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_JUNIT" >&5
+$as_echo "$JAVA_JUNIT" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JAVA_HOME" >&5
+$as_echo_n "checking for JAVA_HOME... " >&6; }
+# We used a fake loop so that we can use "break" to exit when the result
+# is found.
+while true
+do
+  # If the user defined JAVA_HOME, don't touch it.
+  test "${JAVA_HOME+set}" = set && break
+
+  # On Mac OS X 10.5 and following, run /usr/libexec/java_home to get
+  # the value of JAVA_HOME to use.
+  # (http://developer.apple.com/library/mac/#qa/qa2001/qa1170.html).
+  JAVA_HOME=`/usr/libexec/java_home 2>/dev/null`
+  test x"$JAVA_HOME" != x && break
+
+  # See if we can find the java executable, and compute from there.
+  TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1`
+  if test x$TRY_JAVA_HOME != x; then
+    PATH=$PATH:$TRY_JAVA_HOME/bin
+  fi
+  # Extract the first word of "java", so it can be a program name with args.
+set dummy java; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_JAVA_PATH_NAME+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $JAVA_PATH_NAME in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_JAVA_PATH_NAME="$JAVA_PATH_NAME" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_JAVA_PATH_NAME="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+JAVA_PATH_NAME=$ac_cv_path_JAVA_PATH_NAME
+if test -n "$JAVA_PATH_NAME"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_PATH_NAME" >&5
+$as_echo "$JAVA_PATH_NAME" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  if test "x$JAVA_PATH_NAME" != x; then
+    JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[/]bin[/]java.*/\1/"`
+    break
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: Could not compute JAVA_HOME" >&5
+$as_echo "$as_me: Could not compute JAVA_HOME" >&6;}
+  break
+done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_HOME" >&5
+$as_echo "$JAVA_HOME" >&6; }
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  else
+    as_fn_error $? "Java requires shared libraries to be built" "$LINENO" 5
+    HDF_JAVA="no"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+ if test "X$HDF_JAVA" = "Xyes"; then
+  BUILD_JAVA_CONDITIONAL_TRUE=
+  BUILD_JAVA_CONDITIONAL_FALSE='#'
+else
+  BUILD_JAVA_CONDITIONAL_TRUE='#'
+  BUILD_JAVA_CONDITIONAL_FALSE=
+fi
+
+
 ## -------------------------------------------------------------------------
 ## Build static libraries by default. Furthermore, fortran shared libraries
 ## are unsupported. Disallow a user from enabling both shared libraries and
@@ -20260,7 +21373,7 @@ Usage: $0 [OPTIONS]
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-HDF config.lt 4.2.11
+HDF config.lt 4.2.12
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -23752,7 +24865,10 @@ $as_echo "#define NO_DEPRECATED_SYMBOLS 1" >>confdefs.h
     ;;
 esac
 
-ac_config_files="$ac_config_files Makefile libhdf4.settings hdf/Makefile hdf/examples/Makefile hdf/fortran/Makefile hdf/fortran/examples/Makefile hdf/src/Makefile hdf/test/Makefile hdf/util/Makefile hdf/util/h4cc hdf/util/h4fc hdf/util/h4redeploy hdf/util/testutil.sh man/Makefile mfhdf/fortran/ftest.f mfhdf/fortran/jackets.c mfhdf/fortran/netcdf.inc mfhdf/libsrc/netcdf.h mfhdf/Makefile mfhdf/dumper/Makefile mfhdf/dumper/testhdp.sh mfhdf/examples/Makefile mfhdf/examples/testexamples.sh mf [...]
+ac_config_files="$ac_config_files Makefile libhdf4.settings hdf/Makefile hdf/examples/Makefile hdf/fortran/Makefile hdf/fortran/examples/Makefile hdf/src/Makefile hdf/test/Makefile hdf/util/Makefile hdf/util/h4cc hdf/util/h4fc hdf/util/h4redeploy hdf/util/testutil.sh man/Makefile mfhdf/fortran/ftest.f mfhdf/fortran/jackets.c mfhdf/fortran/netcdf.inc mfhdf/libsrc/netcdf.h mfhdf/Makefile mfhdf/dumper/Makefile mfhdf/dumper/testhdp.sh mfhdf/examples/Makefile mfhdf/examples/testexamples.sh mf [...]
+
+
+ac_config_commands="$ac_config_commands .classes"
 
 
 cat >confcache <<\_ACEOF
@@ -23904,6 +25020,10 @@ if test -z "${HDF_BUILD_FORTRAN_TRUE}" && test -z "${HDF_BUILD_FORTRAN_FALSE}";
   as_fn_error $? "conditional \"HDF_BUILD_FORTRAN\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${BUILD_JAVA_CONDITIONAL_TRUE}" && test -z "${BUILD_JAVA_CONDITIONAL_FALSE}"; then
+  as_fn_error $? "conditional \"BUILD_JAVA_CONDITIONAL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${BUILD_SHARED_SZIP_CONDITIONAL_TRUE}" && test -z "${BUILD_SHARED_SZIP_CONDITIONAL_FALSE}"; then
   as_fn_error $? "conditional \"BUILD_SHARED_SZIP_CONDITIONAL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -24314,7 +25434,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by HDF $as_me 4.2.11, which was
+This file was extended by HDF $as_me 4.2.12, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -24380,7 +25500,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-HDF config.status 4.2.11
+HDF config.status 4.2.12
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -24962,6 +26082,9 @@ fi
 ac_aux_dir='$ac_aux_dir'
 
 
+$MKDIR_P java/src/.classes;
+                $MKDIR_P java/test/.classes;
+                $MKDIR_P java/examples/.classes
 
 _ACEOF
 
@@ -25017,6 +26140,13 @@ do
     "mfhdf/test/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/test/Makefile" ;;
     "mfhdf/test/testmfhdf.sh") CONFIG_FILES="$CONFIG_FILES mfhdf/test/testmfhdf.sh" ;;
     "mfhdf/xdr/Makefile") CONFIG_FILES="$CONFIG_FILES mfhdf/xdr/Makefile" ;;
+    "java/Makefile") CONFIG_FILES="$CONFIG_FILES java/Makefile" ;;
+    "java/src/Makefile") CONFIG_FILES="$CONFIG_FILES java/src/Makefile" ;;
+    "java/src/jni/Makefile") CONFIG_FILES="$CONFIG_FILES java/src/jni/Makefile" ;;
+    "java/test/Makefile") CONFIG_FILES="$CONFIG_FILES java/test/Makefile" ;;
+    "java/test/junit.sh") CONFIG_FILES="$CONFIG_FILES java/test/junit.sh" ;;
+    "java/examples/Makefile") CONFIG_FILES="$CONFIG_FILES java/examples/Makefile" ;;
+    ".classes") CONFIG_COMMANDS="$CONFIG_COMMANDS .classes" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
diff --git a/configure.ac b/configure.ac
index 72ec872..9c7e60e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,9 +11,9 @@
 ## of the source code distribution tree; Copyright.html can be found at
 ## http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have
 ## access to either file, you may request a copy from help at hdfgroup.org.
-## 
 ##
-AC_REVISION($Id: configure.ac 6194 2015-02-05 14:17:12Z bmribler $)
+##
+AC_REVISION($Id: configure.ac 6473 2016-06-24 21:38:14Z bmribler $)
 
 ## ======================================================================
 ## Initialize configure.
@@ -25,7 +25,7 @@ AC_REVISION($Id: configure.ac 6194 2015-02-05 14:17:12Z bmribler $)
 ## NOTE: Do not forget to change the version number here when we do a
 ## release!!!
 ##
-AC_INIT([HDF], [4.2.11], [help at hdfgroup.org])
+AC_INIT([HDF], [4.2.12], [help at hdfgroup.org])
 AC_CONFIG_SRCDIR([hdf/src/atom.c])
 AC_CONFIG_AUX_DIR([bin])
 AC_CONFIG_HEADER([hdf/src/h4config.h])
@@ -161,12 +161,12 @@ if test "X$host_config" != "Xnone"; then
 fi
 
 ## ======================================================================
-## Checks for NetCDF-2.3.2 support 
+## Checks for NetCDF-2.3.2 support
 ## ======================================================================
 
 # We disable Fortran netCDF APIs and their testing when --disable-netcdf is used.
-# Let's define a proper variable to be used in mfhdf/testfortran.sh.in to run 
-# the netCDF Fortran APIs test program "ftest". 
+# Let's define a proper variable to be used in mfhdf/testfortran.sh.in to run
+# the netCDF Fortran APIs test program "ftest".
 AC_SUBST(TEST_FORTRAN_NETCDF) TEST_FORTRAN_NETCDF="yes"
 
 AC_ARG_ENABLE([netcdf],
@@ -220,6 +220,66 @@ esac
 AM_CONDITIONAL([HDF_BUILD_FORTRAN], [test "X$BUILD_FORTRAN" = "Xyes"])
 AC_SUBST([BUILD_FORTRAN])
 
+## ----------------------------------------------------------------------
+## Check if they would like the Java native interface (JNI) compiled
+##
+AC_SUBST([JNIFLAGS])
+AC_SUBST([H4_JAVACFLAGS])
+AC_SUBST([H4_JAVAFLAGS])
+
+## This needs to be exposed for the library info file even if Java is disabled.
+AC_SUBST([HDF_JAVA])
+
+## Default is no Java
+HDF_JAVA=no
+
+AC_SUBST([H4_CLASSPATH]) H4_CLASSPATH=""
+AC_MSG_CHECKING([if Java JNI interface enabled])
+
+AC_ARG_ENABLE([java],
+              [AS_HELP_STRING([--enable-java],
+                              [Compile the Java JNI interface [default=no]])],
+              [HDF_JAVA=$enableval])
+
+if test "X$HDF_JAVA" = "Xyes"; then
+  if test "X${enable_shared}" != "Xno"; then
+    echo "yes"
+    if test "X$CLASSPATH" = "X"; then
+      H4_CLASSPATH=".:$srcdir/java/lib"
+    else
+      H4_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib"
+    fi
+    ## Checks for programs.
+    AX_JAVA_OPTIONS
+    H4_JAVACFLAGS=$JAVACFLAGS
+    H4_JAVAFLAGS=$JAVAFLAGS
+    AX_PROG_JAVAC
+    AX_PROG_JAVA
+    AX_PROG_JAR
+    AX_PROG_JAVADOC
+    ## Find the include directories needed for building JNI code
+    AX_JNI_INCLUDE_DIR()
+    for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
+    do
+      JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR"
+    done
+    ## Find junit for testing the JNI code
+    AX_CHECK_CLASSPATH()
+    CLASSPATH_ENV=$H4_CLASSPATH
+    AX_CHECK_JUNIT()
+    AX_CHECK_JAVA_HOME
+
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_ERROR([Java requires shared libraries to be built])
+    HDF_JAVA="no"
+    AC_MSG_RESULT([no])
+  fi
+else
+  AC_MSG_RESULT([no])
+fi
+AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"])
+
 ## -------------------------------------------------------------------------
 ## Build static libraries by default. Furthermore, fortran shared libraries
 ## are unsupported. Disallow a user from enabling both shared libraries and
@@ -533,7 +593,7 @@ case "$withval" in
     ;;
 esac
 
-## Check to see if SZIP has encoder 
+## Check to see if SZIP has encoder
 if test "X$HAVE_SZIP" = "Xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
     ## SZLIB library is available. Check if it can encode.
     AC_MSG_CHECKING([for szlib encoder])
@@ -894,7 +954,7 @@ fi
 
 
 ## ----------------------------------------------------------------------
-## 
+##
 ## If --enable-static-exec and are specified together, there will be ld failures for
 ## "attempted static link of dynamic object" when the tools are built.  This check
 ## will prevent that error during configure instead.  It could go with the other
@@ -939,7 +999,7 @@ if test -n "$fc_version_info"; then
 fi
 
 ## This part doesn't work yet since HDF4 config files do not contain
-## information for fortran_vendor and fortran_version. 
+## information for fortran_vendor and fortran_version.
 ## Needs to be fixed EIP 2010-01-21
 ## if test -n "$fortran_vendor" && test -n "$fortran_version"; then
 ##   F77_VERSION="$F77_VERSION ($fortran_vendor-$fortran_version)"
@@ -983,10 +1043,10 @@ AC_CONFIG_FILES([Makefile
                  hdf/util/h4redeploy
                  hdf/util/testutil.sh
                  man/Makefile
-		 mfhdf/fortran/ftest.f
-		 mfhdf/fortran/jackets.c
-		 mfhdf/fortran/netcdf.inc
-		 mfhdf/libsrc/netcdf.h
+        mfhdf/fortran/ftest.f
+        mfhdf/fortran/jackets.c
+        mfhdf/fortran/netcdf.inc
+        mfhdf/libsrc/netcdf.h
                  mfhdf/Makefile
                  mfhdf/dumper/Makefile
                  mfhdf/dumper/testhdp.sh
@@ -1010,7 +1070,17 @@ AC_CONFIG_FILES([Makefile
                  mfhdf/nctest/Makefile
                  mfhdf/test/Makefile
                  mfhdf/test/testmfhdf.sh
-                 mfhdf/xdr/Makefile])
+                 mfhdf/xdr/Makefile
+                 java/Makefile
+                 java/src/Makefile
+                 java/src/jni/Makefile
+                 java/test/Makefile
+                 java/test/junit.sh
+                 java/examples/Makefile])
+
+AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes;
+                $MKDIR_P java/test/.classes;
+                $MKDIR_P java/examples/.classes])
 
 AC_OUTPUT
 
diff --git a/hdf/CMakeLists.txt b/hdf/CMakeLists.txt
index 85e8bb6..1b4b5b7 100644
--- a/hdf/CMakeLists.txt
+++ b/hdf/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.10)
+cmake_minimum_required (VERSION 3.1.0)
 PROJECT (HDF4_HDF)
 
 #-----------------------------------------------------------------------------
diff --git a/hdf/Makefile.in b/hdf/Makefile.in
index 8a4e0d1..fc6b9d4 100644
--- a/hdf/Makefile.in
+++ b/hdf/Makefile.in
@@ -81,7 +81,20 @@ DIST_COMMON = $(top_srcdir)/config/commence.am $(srcdir)/Makefile.in \
 	$(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs
 subdir = hdf
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -210,12 +223,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -258,11 +286,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/hdf/examples/CMakeLists.txt b/hdf/examples/CMakeLists.txt
index 6f2128b..defffb8 100644
--- a/hdf/examples/CMakeLists.txt
+++ b/hdf/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.10)
+cmake_minimum_required (VERSION 3.1.0)
 PROJECT (HDF4_HDF_EXAMPLES C CXX)
 
 #-----------------------------------------------------------------------------
@@ -36,15 +36,15 @@ set (examples
 )
 
 foreach (example ${examples})
-  ADD_EXECUTABLE (hdf_${example} ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/${example}.c)
-  TARGET_NAMING (hdf_${example} ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdf_${example} " " " ")
+  add_executable (hdf_${example} ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/${example}.c)
+  TARGET_NAMING (hdf_${example} STATIC)
+  TARGET_C_PROPERTIES (hdf_${example} STATIC " " " ")
   target_link_libraries (hdf_${example} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 endforeach (example ${examples})
 
-ADD_EXECUTABLE (hdf_VG_add_sds_to_vgroup ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.c)
-TARGET_NAMING (hdf_VG_add_sds_to_vgroup ${LIB_TYPE})
-TARGET_C_PROPERTIES (hdf_VG_add_sds_to_vgroup " " " ")
+add_executable (hdf_VG_add_sds_to_vgroup ${HDF4_HDF_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.c)
+TARGET_NAMING (hdf_VG_add_sds_to_vgroup STATIC)
+TARGET_C_PROPERTIES (hdf_VG_add_sds_to_vgroup STATIC " " " ")
 target_link_libraries (hdf_VG_add_sds_to_vgroup ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
 if (BUILD_TESTING)
diff --git a/hdf/examples/CMakeTests.cmake b/hdf/examples/CMakeTests.cmake
index 83bd69a..49cad62 100644
--- a/hdf/examples/CMakeTests.cmake
+++ b/hdf/examples/CMakeTests.cmake
@@ -27,19 +27,19 @@ endif (NOT "${last_test}" STREQUAL "")
 set (last_test "HDF_EXAMPLES-clearall-objects")
 
 foreach (example ${examples})
-  add_test (NAME hdftest_${example} COMMAND $<TARGET_FILE:hdf_${example}>)
+  add_test (NAME HDF_EXAMPLES-${example} COMMAND $<TARGET_FILE:hdf_${example}>)
   if (NOT "${last_test}" STREQUAL "")
-    set_tests_properties (hdftest_${example} PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+    set_tests_properties (HDF_EXAMPLES-${example} PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
   else (NOT "${last_test}" STREQUAL "")
-    set_tests_properties (hdftest_${example} PROPERTIES LABELS EXAMPLES)
+    set_tests_properties (HDF_EXAMPLES-${example} PROPERTIES LABELS EXAMPLES)
   endif (NOT "${last_test}" STREQUAL "")
-  set (last_test "hdftest_${example}")
+  set (last_test "HDF_EXAMPLES-${example}")
 endforeach (example ${examples})
 
-add_test (NAME hdftest_VG_add_sds_to_vgroup COMMAND $<TARGET_FILE:hdf_VG_add_sds_to_vgroup>)
+add_test (NAME HDF_EXAMPLES-VG_add_sds_to_vgroup COMMAND $<TARGET_FILE:hdf_VG_add_sds_to_vgroup>)
 if (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (hdftest_VG_add_sds_to_vgroup PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
+  set_tests_properties (HDF_EXAMPLES-VG_add_sds_to_vgroup PROPERTIES DEPENDS ${last_test} LABELS EXAMPLES)
 else (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (hdftest_VG_add_sds_to_vgroup PROPERTIES LABELS EXAMPLES)
+  set_tests_properties (HDF_EXAMPLES-VG_add_sds_to_vgroup PROPERTIES LABELS EXAMPLES)
 endif (NOT "${last_test}" STREQUAL "")
-set (last_test "hdftest_VG_add_sds_to_vgroup")
+set (last_test "HDF_EXAMPLES-VG_add_sds_to_vgroup")
diff --git a/hdf/examples/Makefile.am b/hdf/examples/Makefile.am
index 1222374..75b7a2c 100644
--- a/hdf/examples/Makefile.am
+++ b/hdf/examples/Makefile.am
@@ -46,8 +46,8 @@ INSTALL_TOP_SCRIPT_FILES = run-all-ex.sh
 INSTALL_TOP_FILES = README
 
 # Where to install example files
-EXAMPLEDIR=$(prefix)/examples/c
-EXAMPLETOPDIR=$(prefix)/examples
+EXAMPLEDIR=${DESTDIR}$(prefix)/examples/c
+EXAMPLETOPDIR=${DESTDIR}$(prefix)/examples
 
 # How to build C programs using h4cc
 $(EXTRA_PROG): $(H4CC)
diff --git a/hdf/examples/Makefile.in b/hdf/examples/Makefile.in
index 095b650..b37d819 100644
--- a/hdf/examples/Makefile.in
+++ b/hdf/examples/Makefile.in
@@ -92,7 +92,20 @@ DIST_COMMON = $(top_srcdir)/config/commence.am \
 TESTS = $(TEST_PROG)
 subdir = hdf/examples
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -364,12 +377,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -412,11 +440,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -530,8 +561,8 @@ INSTALL_TOP_SCRIPT_FILES = run-all-ex.sh
 INSTALL_TOP_FILES = README
 
 # Where to install example files
-EXAMPLEDIR = $(prefix)/examples/c
-EXAMPLETOPDIR = $(prefix)/examples
+EXAMPLEDIR = ${DESTDIR}$(prefix)/examples/c
+EXAMPLETOPDIR = ${DESTDIR}$(prefix)/examples
 DISTCLEANFILES = *.chkexe *.chklog
 @BUILD_SHARED_SZIP_CONDITIONAL_TRUE at LD_LIBRARY_PATH = $(LL_PATH)
 
diff --git a/hdf/fortran/CMakeLists.txt b/hdf/fortran/CMakeLists.txt
index a9e575a..3a876ec 100644
--- a/hdf/fortran/CMakeLists.txt
+++ b/hdf/fortran/CMakeLists.txt
@@ -1,21 +1,19 @@
-cmake_minimum_required (VERSION 2.8.10)
+cmake_minimum_required (VERSION 3.1)
 PROJECT (HDF4_HDF_FORTRAN C CXX Fortran)
 
 #-----------------------------------------------------------------------------
 # Make sure generated files and modules are picked up correctly
 #-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES ( 
-    ${CMAKE_Fortran_MODULE_DIRECTORY}
+INCLUDE_DIRECTORIES (
     ${HDF4_HDF_BINARY_DIR}
 )
-  
+
 set (HDF4_HDF_SRC_CSTUB_FSRCS
     ${HDF4_HDFSOURCE_DIR}/dfanf.c
     ${HDF4_HDFSOURCE_DIR}/dff.c
     ${HDF4_HDFSOURCE_DIR}/dfpf.c
     ${HDF4_HDFSOURCE_DIR}/dfr8f.c
     ${HDF4_HDFSOURCE_DIR}/dfsdf.c
-    ${HDF4_HDFSOURCE_DIR}/dfufp2i.c
     ${HDF4_HDFSOURCE_DIR}/dfutilf.c
     ${HDF4_HDFSOURCE_DIR}/df24f.c
     ${HDF4_HDFSOURCE_DIR}/dfufp2if.c
@@ -26,58 +24,110 @@ set (HDF4_HDF_SRC_CSTUB_FSRCS
     ${HDF4_HDFSOURCE_DIR}/vattrf.c
     ${HDF4_HDFSOURCE_DIR}/vgf.c
 )
+set_source_files_properties (${HDF4_HDF_SRC_CSTUB_FSRCS} PROPERTIES LANGUAGE C)
 
 set (HDF4_HDF_SRC_FHDRS
     ${HDF4_HDFSOURCE_DIR}/dffunc.inc
     ${HDF4_HDFSOURCE_DIR}/hdf.inc
 )
 
-SET_SOURCE_FILES_PROPERTIES (${HDF4_HDF_SRC_CSTUB_FSRCS} PROPERTIES LANGUAGE C) 
-
 set (FORTRAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 
 #-----------------------------------------------------------------------------
 # Add Main fortran library
 #-----------------------------------------------------------------------------
-add_library (${HDF4_SRC_FCSTUB_LIB_TARGET} ${LIB_TYPE} ${HDF4_HDF_SRC_CSTUB_FSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h ${HDF4_BINARY_DIR}/h4config.h)
-set_target_properties (${HDF4_SRC_FCSTUB_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C)
-if (WIN32)
-  add_definitions (-DDOS_FS)
-endif (WIN32)
-TARGET_C_PROPERTIES (${HDF4_SRC_FCSTUB_LIB_TARGET} " " " ")
+add_library (${HDF4_SRC_FCSTUB_LIB_TARGET} STATIC ${HDF4_HDF_SRC_CSTUB_FSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h ${HDF4_BINARY_DIR}/h4config.h)
+TARGET_C_PROPERTIES (${HDF4_SRC_FCSTUB_LIB_TARGET} STATIC " " " ")
 target_link_libraries (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
 set_global_variable (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_FCSTUB_LIB_TARGET}")
-H4_SET_LIB_OPTIONS (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_NAME} ${LIB_TYPE})
+H4_SET_LIB_OPTIONS (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_NAME} STATIC)
+set_target_properties (${HDF4_SRC_FCSTUB_LIB_TARGET} PROPERTIES
+    FOLDER libraries/fortran
+    LINKER_LANGUAGE C
+    INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+)
+if (WIN32)
+  set_property (TARGET ${HDF4_SRC_FCSTUB_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS")
+endif (WIN32)
+set (install_targets ${HDF4_SRC_FCSTUB_LIB_TARGET})
 
-set (HDF4_F_FORTRAN_SRCS 
-    ${HDF4_HDFSOURCE_DIR}/df24ff.f  
-    ${HDF4_HDFSOURCE_DIR}/dfanff.f 
-    ${HDF4_HDFSOURCE_DIR}/dfpff.f 
+if (BUILD_SHARED_LIBS)
+  add_library (${HDF4_SRC_FCSTUB_LIBSH_TARGET} SHARED ${HDF4_HDF_SRC_CSTUB_FSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_HDFSOURCE_DIR}/hproto_fortran.h ${HDF4_BINARY_DIR}/h4config.h)
+  TARGET_C_PROPERTIES (${HDF4_SRC_FCSTUB_LIBSH_TARGET} SHARED " " " ")
+  target_link_libraries (${HDF4_SRC_FCSTUB_LIBSH_TARGET} ${HDF4_SRC_LIBSH_TARGET})
+  set_global_variable (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_FCSTUB_LIBSH_TARGET}")
+  H4_SET_LIB_OPTIONS (${HDF4_SRC_FCSTUB_LIBSH_TARGET} ${HDF4_SRC_FCSTUB_LIB_NAME} SHARED)
+  set_target_properties (${HDF4_SRC_FCSTUB_LIBSH_TARGET} PROPERTIES
+      FOLDER libraries/fortran
+      LINKER_LANGUAGE C
+      COMPILE_DEFINITIONS "H4_BUILT_AS_DYNAMIC_LIB"
+      INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+      INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1
+  )
+  if (WIN32)
+    set_property (TARGET ${HDF4_SRC_FCSTUB_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS")
+  endif (WIN32)
+  set (install_targets ${install_targets} ${HDF4_SRC_FCSTUB_LIBSH_TARGET})
+endif (BUILD_SHARED_LIBS)
+
+set (HDF4_F_FORTRAN_SRCS
+    ${HDF4_HDFSOURCE_DIR}/df24ff.f
+    ${HDF4_HDFSOURCE_DIR}/dfanff.f
+    ${HDF4_HDFSOURCE_DIR}/dfpff.f
     ${HDF4_HDFSOURCE_DIR}/dfr8ff.f
-    ${HDF4_HDFSOURCE_DIR}/dfsdff.f 
+    ${HDF4_HDFSOURCE_DIR}/dfsdff.f
     ${HDF4_HDFSOURCE_DIR}/dfufp2iff.f
-    ${HDF4_HDFSOURCE_DIR}/dfff.f 
-    ${HDF4_HDFSOURCE_DIR}/hfileff.f 
+    ${HDF4_HDFSOURCE_DIR}/dfff.f
+    ${HDF4_HDFSOURCE_DIR}/hfileff.f
     ${HDF4_HDFSOURCE_DIR}/mfgrff.f
-    ${HDF4_HDFSOURCE_DIR}/vattrff.f 
-    ${HDF4_HDFSOURCE_DIR}/vgff.f 
+    ${HDF4_HDFSOURCE_DIR}/vattrff.f
+    ${HDF4_HDFSOURCE_DIR}/vgff.f
 )
+set_source_files_properties (${HDF4_F_FORTRAN_SRCS} PROPERTIES LANGUAGE Fortran)
+
 #-----------------------------------------------------------------------------
-add_library (${HDF4_SRC_FORTRAN_LIB_TARGET} ${LIB_TYPE} ${HDF4_F_FORTRAN_SRCS})
+add_library (${HDF4_SRC_FORTRAN_LIB_TARGET} STATIC ${HDF4_F_FORTRAN_SRCS})
 set (SHARED_LINK_FLAGS " ")
-if (WIN32)
-  if (${LIB_TYPE} MATCHES "SHARED")
-    if (MSVC)
-      set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF4_HDF_FORTRAN_SOURCE_DIR}/hdf_fortrandll.def")
-    endif (MSVC)
-  endif (${LIB_TYPE} MATCHES "SHARED")
-endif (WIN32)
-TARGET_FORTRAN_PROPERTIES (${HDF4_SRC_FORTRAN_LIB_TARGET} " " ${SHARED_LINK_FLAGS})
-set_target_properties (${HDF4_SRC_FORTRAN_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_FORTRAN_PROPERTIES (${HDF4_SRC_FORTRAN_LIB_TARGET} STATIC " " " ")
 target_link_libraries (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_TARGET} ${LINK_LIBS})
 set_global_variable (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_FORTRAN_LIB_TARGET}")
-H4_SET_LIB_OPTIONS (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_NAME} ${LIB_TYPE})
-  
+H4_SET_LIB_OPTIONS (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_NAME} STATIC)
+set_target_properties (${HDF4_SRC_FORTRAN_LIB_TARGET} PROPERTIES
+    FOLDER libraries/fortran
+    LINKER_LANGUAGE Fortran
+    INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+    Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
+if (WIN32)
+  set_property (TARGET ${HDF4_SRC_FORTRAN_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS")
+endif (WIN32)
+set (install_targets ${install_targets} ${HDF4_SRC_FORTRAN_LIB_TARGET})
+
+if (BUILD_SHARED_LIBS)
+  add_library (${HDF4_SRC_FORTRAN_LIBSH_TARGET} SHARED ${HDF4_F_FORTRAN_SRCS})
+  set (SHARED_LINK_FLAGS " ")
+  if (WIN32 AND MSVC)
+    set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF4_HDF_FORTRAN_SOURCE_DIR}/hdf_fortrandll.def")
+  endif (WIN32 AND MSVC)
+  TARGET_FORTRAN_PROPERTIES (${HDF4_SRC_FORTRAN_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS})
+  target_link_libraries (${HDF4_SRC_FORTRAN_LIBSH_TARGET} ${HDF4_SRC_FCSTUB_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+  set_global_variable (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_FORTRAN_LIBSH_TARGET}")
+  H4_SET_LIB_OPTIONS (${HDF4_SRC_FORTRAN_LIBSH_TARGET} ${HDF4_SRC_FORTRAN_LIB_NAME} SHARED)
+  set_target_properties (${HDF4_SRC_FORTRAN_LIBSH_TARGET} PROPERTIES
+      FOLDER libraries/fortran
+      LINKER_LANGUAGE Fortran
+      COMPILE_DEFINITIONS "H4_BUILT_AS_DYNAMIC_LIB"
+      INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+      INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1
+      Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+  )
+  if (WIN32)
+    set_property (TARGET ${HDF4_SRC_FORTRAN_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS")
+  endif (WIN32)
+  set (install_targets ${install_targets} ${HDF4_SRC_FORTRAN_LIBSH_TARGET})
+endif (BUILD_SHARED_LIBS)
+
+
 if (BUILD_TESTING)
   include (CMakeTests.cmake)
 endif (BUILD_TESTING)
@@ -105,19 +155,18 @@ INSTALL (
 #-----------------------------------------------------------------------------
 if (HDF4_EXPORTED_TARGETS)
   if (BUILD_SHARED_LIBS)
-    INSTALL_TARGET_PDB (${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} fortlibraries)
-    INSTALL_TARGET_PDB (${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} fortlibraries)
+    INSTALL_TARGET_PDB (${HDF4_SRC_FCSTUB_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} fortlibraries)
+    #INSTALL_TARGET_PDB (${HDF4_SRC_FORTRAN_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} fortlibraries)
   endif (BUILD_SHARED_LIBS)
-  
+
   INSTALL (
-      TARGETS 
-          ${HDF4_SRC_FCSTUB_LIB_TARGET}
-          ${HDF4_SRC_FORTRAN_LIB_TARGET}
+      TARGETS
+          ${install_targets}
       EXPORT
           ${HDF4_EXPORTED_TARGETS}
-      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries 
+      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries
       ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT fortlibraries
       RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT fortlibraries
+      FRAMEWORK DESTINATION ${HDF4_INSTALL_FWRK_DIR} COMPONENT fortlibraries
   )
 endif (HDF4_EXPORTED_TARGETS)
-    
\ No newline at end of file
diff --git a/hdf/fortran/CMakeTests.cmake b/hdf/fortran/CMakeTests.cmake
index 8bd6b7c..123835c 100644
--- a/hdf/fortran/CMakeTests.cmake
+++ b/hdf/fortran/CMakeTests.cmake
@@ -10,19 +10,19 @@
   #-----------------------------------------------------------------------------
   # Add test fortran stub library
   #-----------------------------------------------------------------------------
-  add_library (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${LIB_TYPE} ${HDF4_HDF_TESTSOURCE_DIR}/forsupf.c)
+  add_library (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} STATIC ${HDF4_HDF_TESTSOURCE_DIR}/forsupf.c)
   set_target_properties (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C)
   if (WIN32)
     add_definitions (-DDOS_FS)
   endif (WIN32)
-  TARGET_C_PROPERTIES (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} " " " ")
+  TARGET_C_PROPERTIES (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} STATIC " " " ")
   target_link_libraries (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
-  H4_SET_LIB_OPTIONS (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET}  ${HDF4_HDF_TEST_FCSTUB_LIB_NAME} ${LIB_TYPE})
+  H4_SET_LIB_OPTIONS (${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_HDF_TEST_FCSTUB_LIB_NAME} STATIC)
   
   #-- Adding test for fortest
-  ADD_EXECUTABLE (fortest ${HDF4_HDF_TESTSOURCE_DIR}/fortest.c)
-  TARGET_NAMING (fortest ${LIB_TYPE})
-  TARGET_C_PROPERTIES (fortest " " " ")
+  add_executable (fortest ${HDF4_HDF_TESTSOURCE_DIR}/fortest.c)
+  TARGET_NAMING (fortest STATIC)
+  TARGET_C_PROPERTIES (fortest STATIC " " " ")
   target_link_libraries (fortest ${HDF4_SRC_LIB_TARGET} ${HDF4_MF_LIB_TARGET})
   if (WIN32)
     target_link_libraries (fortest "ws2_32.lib")
@@ -52,9 +52,9 @@
       ${HDF4_HDF_TESTSOURCE_DIR}/tvsetf.f
   )
 
-  ADD_EXECUTABLE (fortestF ${FORTEST_FSRCS} )
-  TARGET_NAMING (fortestF ${LIB_TYPE})
-  TARGET_FORTRAN_PROPERTIES (fortestF " " " ")
+  add_executable (fortestF ${FORTEST_FSRCS} )
+  TARGET_NAMING (fortestF STATIC)
+  TARGET_FORTRAN_PROPERTIES (fortestF STATIC " " " ")
   target_link_libraries (fortestF ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_FCSTUB_LIB_TARGET} ${HDF4_HDF_TEST_FCSTUB_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS} )
   set_target_properties (fortestF PROPERTIES LINKER_LANGUAGE Fortran)
 
diff --git a/hdf/fortran/Makefile.in b/hdf/fortran/Makefile.in
index 6a57fb7..996ddf1 100644
--- a/hdf/fortran/Makefile.in
+++ b/hdf/fortran/Makefile.in
@@ -82,7 +82,20 @@ DIST_COMMON = $(top_srcdir)/config/commence.am $(srcdir)/Makefile.in \
 subdir = hdf/fortran
 SUBDIRS =
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -211,12 +224,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -259,11 +287,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/hdf/fortran/examples/CMakeLists.txt b/hdf/fortran/examples/CMakeLists.txt
index e0436ea..7148fea 100644
--- a/hdf/fortran/examples/CMakeLists.txt
+++ b/hdf/fortran/examples/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.10)
+cmake_minimum_required (VERSION 3.1.0)
 PROJECT (HDF4_HDF_FORTRAN_EXAMPLES C CXX Fortran)
 # --------------------------------------------------------------------
 # Notes: When creating examples they should be prefixed
@@ -19,12 +19,10 @@ endif (CMAKE_Fortran_COMPILER MATCHES ifort)
 # Setup include Directories
 #-----------------------------------------------------------------------------
 INCLUDE_DIRECTORIES (
-    ${CMAKE_Fortran_MODULE_DIRECTORY}
     ${HDF4_HDF_BINARY_DIR}
     ${HDF4_HDFSOURCE_DIR}
 )
 LINK_DIRECTORIES (
-    ${CMAKE_Fortran_MODULE_DIRECTORY}
     ${HDF4_HDF_BINARY_DIR}
     ${HDF4_MFHDF_BINARY_DIR}
     ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
@@ -68,24 +66,36 @@ set (skip_examples
 )
 
 foreach (example ${examples})
-  ADD_EXECUTABLE (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
-  TARGET_NAMING (f_ex_${example} ${LIB_TYPE})
-  TARGET_FORTRAN_PROPERTIES (f_ex_${example} " " " ")
-  set_target_properties (f_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+  add_executable (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
+  TARGET_NAMING (f_ex_${example} STATIC)
+  TARGET_FORTRAN_PROPERTIES (f_ex_${example} STATIC " " " ")
+  target_include_directories (f_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
+  set_target_properties (f_ex_${example} PROPERTIES
+      LINKER_LANGUAGE Fortran
+      Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+  )
   target_link_libraries (f_ex_${example} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 endforeach (example ${examples})
 
-ADD_EXECUTABLE (f_ex_VG_add_sds_to_vgroup ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.f)
-TARGET_NAMING (f_ex_VG_add_sds_to_vgroup ${LIB_TYPE})
-TARGET_FORTRAN_PROPERTIES (f_ex_VG_add_sds_to_vgroup " " " ")
-set_target_properties (f_ex_VG_add_sds_to_vgroup PROPERTIES LINKER_LANGUAGE Fortran)
+add_executable (f_ex_VG_add_sds_to_vgroup ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/VG_add_sds_to_vgroup.f)
+TARGET_NAMING (f_ex_VG_add_sds_to_vgroup STATIC)
+TARGET_FORTRAN_PROPERTIES (f_ex_VG_add_sds_to_vgroup STATIC " " " ")
+target_include_directories (f_ex_VG_add_sds_to_vgroup PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
+set_target_properties (f_ex_VG_add_sds_to_vgroup PROPERTIES
+    LINKER_LANGUAGE Fortran
+    Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
 target_link_libraries (f_ex_VG_add_sds_to_vgroup ${HDF4_MF_FORTRAN_LIB_TARGET} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
 foreach (example ${skip_examples})
-  ADD_EXECUTABLE (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
-  TARGET_NAMING (f_ex_${example} ${LIB_TYPE})
-  TARGET_FORTRAN_PROPERTIES (f_ex_${example} " " " ")
-  set_target_properties (f_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+  add_executable (f_ex_${example} ${HDF4_HDF_FORTRAN_EXAMPLES_SOURCE_DIR}/${example}.f)
+  TARGET_NAMING (f_ex_${example} STATIC)
+  TARGET_FORTRAN_PROPERTIES (f_ex_${example} STATIC " " " ")
+  target_include_directories (f_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
+  set_target_properties (f_ex_${example} PROPERTIES
+      LINKER_LANGUAGE Fortran
+      Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+  )
   target_link_libraries (f_ex_${example} ${HDF4_SRC_FORTRAN_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 endforeach (example ${skip_examples})
 
diff --git a/hdf/fortran/examples/Makefile.am b/hdf/fortran/examples/Makefile.am
index aa48f92..b9a969f 100644
--- a/hdf/fortran/examples/Makefile.am
+++ b/hdf/fortran/examples/Makefile.am
@@ -41,7 +41,7 @@ INSTALL_FILES= VD_read_from_vdata.f VD_read_mixed_vdata.f \
 INSTALL_SCRIPT_FILES = run-fortran-ex.sh
 
 # Where to install Fortran example files
-EXAMPLEDIR=$(prefix)/examples/fortran
+EXAMPLEDIR=${DESTDIR}$(prefix)/examples/fortran
 
 # How to build Fortran programs using h4fc
 $(EXTRA_PROG): $(H4FC)
diff --git a/hdf/fortran/examples/Makefile.in b/hdf/fortran/examples/Makefile.in
index e255fac..d8f0f92 100644
--- a/hdf/fortran/examples/Makefile.in
+++ b/hdf/fortran/examples/Makefile.in
@@ -92,7 +92,20 @@ DIST_COMMON = $(top_srcdir)/config/commence.am \
 TESTS = $(TEST_PROG)
 subdir = hdf/fortran/examples
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -364,12 +377,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -412,11 +440,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -525,7 +556,7 @@ INSTALL_FILES = VD_read_from_vdata.f VD_read_mixed_vdata.f \
 INSTALL_SCRIPT_FILES = run-fortran-ex.sh
 
 # Where to install Fortran example files
-EXAMPLEDIR = $(prefix)/examples/fortran
+EXAMPLEDIR = ${DESTDIR}$(prefix)/examples/fortran
 DISTCLEANFILES = *.chkexe *.chklog
 @BUILD_SHARED_SZIP_CONDITIONAL_TRUE at LD_LIBRARY_PATH = $(LL_PATH)
 
diff --git a/hdf/src/CMakeLists.txt b/hdf/src/CMakeLists.txt
index e684424..717b41d 100644
--- a/hdf/src/CMakeLists.txt
+++ b/hdf/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.10)
+cmake_minimum_required (VERSION 3.1)
 PROJECT (HDF4_HDF_SRC C CXX)
 
 #-----------------------------------------------------------------------------
@@ -6,7 +6,7 @@ PROJECT (HDF4_HDF_SRC C CXX)
 #-----------------------------------------------------------------------------
 INCLUDE_DIRECTORIES (
     ${HDF4_HDF_BINARY_DIR}
-    ${HDF4_HDFSOURCE_DIR}
+    ${HDF4_HDF_SOURCE_DIR}
 )
 LINK_DIRECTORIES (
     ${HDF4_HDF_BINARY_DIR}
@@ -120,14 +120,37 @@ set (HDF4_HDF_SRC_CHDRS
     ${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h
 )
 
-add_library (${HDF4_SRC_LIB_TARGET} ${LIB_TYPE} ${HDF4_HDF_SRC_CSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_BINARY_DIR}/h4config.h)
-if (WIN32)
-  add_definitions (-DDOS_FS)
-endif (WIN32)
-TARGET_C_PROPERTIES (${HDF4_SRC_LIB_TARGET} " " " ")
+add_library (${HDF4_SRC_LIB_TARGET} STATIC ${HDF4_HDF_SRC_CSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_BINARY_DIR}/h4config.h)
+TARGET_C_PROPERTIES (${HDF4_SRC_LIB_TARGET} STATIC " " " ")
 target_link_libraries (${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 set_global_variable (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_LIB_TARGET}")
-H4_SET_LIB_OPTIONS (${HDF4_SRC_LIB_TARGET} ${HDF4_SRC_LIB_NAME} ${LIB_TYPE})
+H4_SET_LIB_OPTIONS (${HDF4_SRC_LIB_TARGET} ${HDF4_SRC_LIB_NAME} STATIC)
+set_target_properties (${HDF4_SRC_LIB_TARGET} PROPERTIES
+    FOLDER libraries
+    INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+)
+if (WIN32)
+  set_property (TARGET ${HDF4_SRC_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS")
+endif (WIN32)
+set (install_targets ${HDF4_SRC_LIB_TARGET})
+
+if (BUILD_SHARED_LIBS)
+  add_library (${HDF4_SRC_LIBSH_TARGET} SHARED ${HDF4_HDF_SRC_CSRCS} ${HDF4_HDF_SRC_CHDRS} ${HDF4_BINARY_DIR}/h4config.h)
+  TARGET_C_PROPERTIES (${HDF4_SRC_LIBSH_TARGET} SHARED " " " ")
+  target_link_libraries (${HDF4_SRC_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+  set_global_variable (HDF4_LIBRARIES_TO_EXPORT "${HDF4_LIBRARIES_TO_EXPORT};${HDF4_SRC_LIBSH_TARGET}")
+  H4_SET_LIB_OPTIONS (${HDF4_SRC_LIBSH_TARGET} ${HDF4_SRC_LIB_NAME} SHARED)
+  set_target_properties (${HDF4_SRC_LIBSH_TARGET} PROPERTIES
+      FOLDER libraries
+      COMPILE_DEFINITIONS "H4_BUILT_AS_DYNAMIC_LIB"
+      INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+      INTERFACE_COMPILE_DEFINITIONS H4_BUILT_AS_DYNAMIC_LIB=1
+  )
+  if (WIN32)
+    set_property (TARGET ${HDF4_SRC_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS "DOS_FS")
+  endif (WIN32)
+  set (install_targets ${install_targets} ${HDF4_SRC_LIBSH_TARGET})
+endif (BUILD_SHARED_LIBS)
 
 #-----------------------------------------------------------------------------
 # Add file(s) to CMake Install
@@ -146,17 +169,18 @@ INSTALL (
 #-----------------------------------------------------------------------------
 if (HDF4_EXPORTED_TARGETS)
   if (BUILD_SHARED_LIBS)
-    INSTALL_TARGET_PDB (${HDF4_SRC_LIB_TARGET} ${HDF4_INSTALL_LIB_DIR} libraries)
+    INSTALL_TARGET_PDB (${HDF4_SRC_LIBSH_TARGET} ${HDF4_INSTALL_BIN_DIR} libraries)
   endif (BUILD_SHARED_LIBS)
-  
+
   INSTALL (
-      TARGETS 
-          ${HDF4_SRC_LIB_TARGET}
+      TARGETS
+          ${install_targets}
       EXPORT
           ${HDF4_EXPORTED_TARGETS}
-      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries 
+      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
       ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
       RUNTIME DESTINATION ${HDF4_INSTALL_BIN_DIR} COMPONENT libraries
+      FRAMEWORK DESTINATION ${HDF4_INSTALL_FWRK_DIR} COMPONENT libraries
   )
 endif (HDF4_EXPORTED_TARGETS)
 
diff --git a/hdf/src/H4api_adpt.h b/hdf/src/H4api_adpt.h
index 4ce355a..c80f9c6 100644
--- a/hdf/src/H4api_adpt.h
+++ b/hdf/src/H4api_adpt.h
@@ -28,15 +28,15 @@
 /* This will only be defined if HDF4 was built with CMake */
 #if defined(H4_BUILT_AS_DYNAMIC_LIB)
 
-#if defined(xdr_EXPORTS)
+#if defined(xdr_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__) /* MSVC Compiler Case */
     #define XDRLIBAPI extern __declspec(dllexport)
   #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
     #define XDRLIBAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* xdr_EXPORTS */
+#endif /* xdr_shared_EXPORTS */
 
-#if defined(hdf_EXPORTS)
+#if defined(hdf_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFERRPUBLIC __declspec(dllimport)
     #define HDFPUBLIC __declspec(dllexport)
@@ -48,9 +48,9 @@
     #define HDFLIBAPI extern __attribute__ ((visibility("default")))
     #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* hdf_EXPORTS */
+#endif /* hdf_shared_EXPORTS */
 
-#if defined(hdf_fcstub_EXPORTS)
+#if defined(hdf_fcstub_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFPUBLIC __declspec(dllexport)
     #define HDFLIBAPI extern __declspec(dllimport)
@@ -60,9 +60,9 @@
     #define HDFLIBAPI extern __attribute__ ((visibility("default")))
     #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* hdf_fcstub_EXPORTS */
+#endif /* hdf_fcstub_shared_EXPORTS */
 
-#if defined(mfhdf_EXPORTS)
+#if defined(mfhdf_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFERRPUBLIC extern __declspec(dllimport)
     #define HDFPUBLIC __declspec(dllimport)
@@ -74,9 +74,9 @@
     #define HDFLIBAPI extern __attribute__ ((visibility("default")))
     #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* mfhdf_EXPORTS */
+#endif /* mfhdf_shared_EXPORTS */
 
-#if defined(mfhdf_fcstub_EXPORTS)
+#if defined(mfhdf_fcstub_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFPUBLIC __declspec(dllimport)
     #define HDFLIBAPI extern __declspec(dllimport)
@@ -86,17 +86,17 @@
     #define HDFLIBAPI extern __attribute__ ((visibility("default")))
     #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* mfhdf_fcstub_EXPORTS */
+#endif /* mfhdf_shared_fcstub_EXPORTS */
 
-#if defined(hdf_test_fcstub_EXPORTS)
+#if defined(hdf_test_fcstub_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFFCLIBAPI extern __declspec(dllexport)
   #elif (__GNUC__ >= 4)  /* GCC 4.x has support for visibility options */
     #define HDFFCLIBAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif/* hdf_test_fcstub_EXPORTS */
+#endif/* hdf_test_fcstub_shared_EXPORTS */
 
-#if defined(mfhdf_hdiff_EXPORTS)
+#if defined(mfhdf_hdiff_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFPUBLIC __declspec(dllimport)
     #define HDFLIBAPI extern __declspec(dllimport)
@@ -106,9 +106,9 @@
     #define HDFLIBAPI extern __attribute__ ((visibility("default")))
     #define HDFTOOLSAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* mfhdf_hdiff_EXPORTS */
+#endif /* mfhdf_hdiff_shared_EXPORTS */
 
-#if defined(mfhdf_hrepack_EXPORTS)
+#if defined(mfhdf_hrepack_shared_EXPORTS)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
     #define HDFPUBLIC __declspec(dllimport)
     #define HDFLIBAPI extern __declspec(dllimport)
@@ -118,7 +118,7 @@
     #define HDFLIBAPI extern __attribute__ ((visibility("default")))
     #define HDFTOOLSAPI extern __attribute__ ((visibility("default")))
   #endif
-#endif /* mfhdf_hrepack_EXPORTS */
+#endif /* mfhdf_hrepack_shared_EXPORTS */
 
 #if !defined(XDRLIBAPI)
   #if defined (_MSC_VER) || defined(__MINGW32__)  /* MSVC Compiler Case */
@@ -163,94 +163,13 @@
   #endif
 #endif
 
-#elif defined(H4_BUILT_AS_STATIC_LIB)
-  #define XDRLIBAPI extern
-  #define HDFERRPUBLIC extern
-  #define HDFPUBLIC
-  #define HDFLIBAPI extern
-  #define HDFFCLIBAPI extern
-  #define HDFTOOLSAPI extern
-
 #else
-/* This is the original HDFGroup defined preprocessor code which should still work
- * with the VS projects that are maintained by "The HDF Group"
- * This will be removed after the next release.
- */
-
-#ifdef _WIN32
-/**
- * Under _WIN32 we have single threaded static libraries, or
- * mutli-threaded DLLs using the multithreaded runtime DLLs.
- **/
-#  if defined(_MT) &&  defined(_DLL) &&!defined(_HDFDLL_)
-/*     If the user really meant to use _HDFDLL_, but he forgot, just define it. */
-#      define _HDFDLL_
-#  endif
-
-#  if !defined(_MT) && defined(_HDFDLL_)
-#      error To use the HDF libraries from a single-threaded project, you must use static HDF libraries
-#      error Undefine the macro "_HDFDLL_"
-#  endif
-
-#  if defined(xdr_EXPORTS)
-#      define XDRLIBAPI extern __declspec(dllexport)
-#  endif /* xdr_EXPORTS */
-
-#  if defined(_HDFDLL_)
-#    pragma warning( disable: 4273 ) /* Disable the stupid dll linkage warnings */
-#    if defined(_HDFLIB_)
-#      define HDFPUBLIC __declspec(dllexport)
-#      define HDFLIBAPI extern __declspec(dllexport)
-#    endif
-
-#    if defined(_MFHDFLIB_)
-#      define HDFLIBAPI extern __declspec(dllexport)
-#    endif
-
-#    if defined(_HDFLIB_C_STUB_EXPORTS) || defined(_MFHDFLIB_C_STUB_EXPORTS) || defined(_DLLLIBTEST_FCSTUB_EXPORTS)
-#      define HDFFCLIBAPI extern __declspec(dllexport)
-#    endif 
-
-#    if defined(_HDFLIB_C_STUB_EXPORTS)
-#      define HDFPUBLIC __declspec(dllexport)
-#    endif
-
-#    if !defined(XDRLIBAPI)
-#      define XDRLIBAPI extern __declspec(dllimport)
-#    endif
-#    if !defined(HDFERRPUBLIC)
-       #define HDFERRPUBLIC extern __declspec(dllimport)
-#    endif
-#    if !defined(HDFPUBLIC)
-#      define HDFPUBLIC __declspec(dllimport)
-#    endif
-#    if !defined(HDFLIBAPI)
-#      define HDFLIBAPI extern __declspec(dllimport)
-#    endif
-#    if !defined(HDFFCLIBAPI)
-#      define HDFFCLIBAPI extern __declspec(dllimport)
-#    endif
-#    if !defined(HDFTOOLSAPI)
-#      define HDFTOOLSAPI extern __declspec(dllimport)
-#    endif
-
-#  else
-#    define XDRLIBAPI extern
-#    define HDFERRPUBLIC extern
-#    define HDFPUBLIC
-#    define HDFLIBAPI extern
-#    define HDFFCLIBAPI extern
-#    define HDFTOOLSAPI extern
-#  endif
-#else  /* !defined( _WIN32 ) */
 #  define XDRLIBAPI extern
 #  define HDFERRPUBLIC extern
 #  define HDFPUBLIC
 #  define HDFLIBAPI extern
 #  define HDFFCLIBAPI extern
 #  define HDFTOOLSAPI extern
-#endif
-
 #endif /*H4_BUILT_AS_DYNAMIC_LIB  */
 
 
diff --git a/hdf/src/Makefile.in b/hdf/src/Makefile.in
index 300567b..10e7dda 100644
--- a/hdf/src/Makefile.in
+++ b/hdf/src/Makefile.in
@@ -91,7 +91,20 @@ F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 subdir = hdf/src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -289,12 +302,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -337,11 +365,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/hdf/src/atom.c b/hdf/src/atom.c
index 135e1e2..72e17bc 100644
--- a/hdf/src/atom.c
+++ b/hdf/src/atom.c
@@ -11,12 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6140 $";
-#endif
-
-
-/* $Id: atom.c 6140 2014-10-10 02:24:32Z acheng $ */
+/* $Id: atom.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/bitvect.c b/hdf/src/bitvect.c
index 83cbc40..5efba61 100644
--- a/hdf/src/bitvect.c
+++ b/hdf/src/bitvect.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Revision: 6111 $";
-#endif
-
-/* $Id: bitvect.c 6111 2014-06-02 20:52:09Z bmribler $ */
+/* $Id: bitvect.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/cdeflate.c b/hdf/src/cdeflate.c
index d02b771..1a9648d 100644
--- a/hdf/src/cdeflate.c
+++ b/hdf/src/cdeflate.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Revision: 5489 $";
-#endif
-
-/* $Id: cdeflate.c 5489 2010-10-23 06:52:48Z bmribler $ */
+/* $Id: cdeflate.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/src/cnbit.c b/hdf/src/cnbit.c
index e91e8f7..ccf3b2e 100644
--- a/hdf/src/cnbit.c
+++ b/hdf/src/cnbit.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: cnbit.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: cnbit.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/src/cnone.c b/hdf/src/cnone.c
index cd8e91a..cb917b5 100644
--- a/hdf/src/cnone.c
+++ b/hdf/src/cnone.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: cnone.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: cnone.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/src/crle.c b/hdf/src/crle.c
index 9284046..d24f89d 100644
--- a/hdf/src/crle.c
+++ b/hdf/src/crle.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5705 $";
-#endif
-
-/* $Id: crle.c 5705 2011-10-26 12:45:21Z bmribler $ */
+/* $Id: crle.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/src/cskphuff.c b/hdf/src/cskphuff.c
index 1e289ad..56897ef 100644
--- a/hdf/src/cskphuff.c
+++ b/hdf/src/cskphuff.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6032 $";
-#endif
-
-/* $Id: cskphuff.c 6032 2014-01-17 18:13:52Z acheng $ */
+/* $Id: cskphuff.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/src/cszip.c b/hdf/src/cszip.c
index cf3e2b2..5e54da1 100644
--- a/hdf/src/cszip.c
+++ b/hdf/src/cszip.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6066 $";
-#endif
-
-/* $Id: cszip.c 6066 2014-02-03 16:30:04Z derobins $ */
+/* $Id: cszip.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* General HDF includes */
 
diff --git a/hdf/src/df24.c b/hdf/src/df24.c
index a1567b3..4158fa2 100644
--- a/hdf/src/df24.c
+++ b/hdf/src/df24.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4924 $";
-#endif
-
-/* $Id: df24.c 4924 2007-09-05 21:55:40Z fbaker $ */
+/* $Id: df24.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     df24.c
diff --git a/hdf/src/df24f.c b/hdf/src/df24f.c
index a2b7cbb..8884b81 100644
--- a/hdf/src/df24f.c
+++ b/hdf/src/df24f.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: df24f.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: df24f.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     df24F.c
diff --git a/hdf/src/dfan.c b/hdf/src/dfan.c
index 5de6e82..df69616 100644
--- a/hdf/src/dfan.c
+++ b/hdf/src/dfan.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5322 $";
-#endif
-
-/* $Id: dfan.c 5322 2010-01-19 06:26:11Z brtnfld $ */
+/* $Id: dfan.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     dfan.c
diff --git a/hdf/src/dfanf.c b/hdf/src/dfanf.c
index 635ac6f..a8b3b3a 100644
--- a/hdf/src/dfanf.c
+++ b/hdf/src/dfanf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5322 $";
-#endif
-
-/* $Id: dfanf.c 5322 2010-01-19 06:26:11Z brtnfld $ */
+/* $Id: dfanf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfanF.c
diff --git a/hdf/src/dfcomp.c b/hdf/src/dfcomp.c
index 89c6785..34cc3da 100644
--- a/hdf/src/dfcomp.c
+++ b/hdf/src/dfcomp.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfcomp.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfcomp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfcomp.c
diff --git a/hdf/src/dfconv.c b/hdf/src/dfconv.c
index 184d8c5..f6617f4 100644
--- a/hdf/src/dfconv.c
+++ b/hdf/src/dfconv.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6032 $";
-#endif
-
-/* $Id: dfconv.c 6032 2014-01-17 18:13:52Z acheng $ */
+/* $Id: dfconv.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*------------------------------------------------------------------
  File:  dfconv.c
diff --git a/hdf/src/dff.c b/hdf/src/dff.c
index f9813d7..3e1ca2e 100644
--- a/hdf/src/dff.c
+++ b/hdf/src/dff.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dff.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dff.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfF.c
diff --git a/hdf/src/dfgr.c b/hdf/src/dfgr.c
index 83c9f9a..ca85bf0 100644
--- a/hdf/src/dfgr.c
+++ b/hdf/src/dfgr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfgr.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfgr.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     dfgr.c
diff --git a/hdf/src/dfgroup.c b/hdf/src/dfgroup.c
index 20cc232..e75bae6 100644
--- a/hdf/src/dfgroup.c
+++ b/hdf/src/dfgroup.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfgroup.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfgroup.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfgroup.c
diff --git a/hdf/src/dfimcomp.c b/hdf/src/dfimcomp.c
index 1e049e3..6b57f53 100644
--- a/hdf/src/dfimcomp.c
+++ b/hdf/src/dfimcomp.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: dfimcomp.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: dfimcomp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /************************************************************************/
 /*  Module Name : imcomp                                                */
diff --git a/hdf/src/dfjpeg.c b/hdf/src/dfjpeg.c
index 5bc8ce0..3b8e4f7 100644
--- a/hdf/src/dfjpeg.c
+++ b/hdf/src/dfjpeg.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4951 $";
-#endif
-
-/* $Id: dfjpeg.c 4951 2007-09-11 19:33:41Z epourmal $ */
+/* $Id: dfjpeg.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfjpeg.c
diff --git a/hdf/src/dfknat.c b/hdf/src/dfknat.c
index 4f8f54a..c1069f5 100644
--- a/hdf/src/dfknat.c
+++ b/hdf/src/dfknat.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6032 $";
-#endif
-
-/* $Id: dfknat.c 6032 2014-01-17 18:13:52Z acheng $ */
+/* $Id: dfknat.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*------------------------------------------------------------------
  File:  dfknat.c
diff --git a/hdf/src/dfkswap.c b/hdf/src/dfkswap.c
index 60c5d52..fc42de5 100644
--- a/hdf/src/dfkswap.c
+++ b/hdf/src/dfkswap.c
@@ -11,12 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfkswap.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfkswap.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*------------------------------------------------------------------
  File:  dfkswap.c
diff --git a/hdf/src/dfp.c b/hdf/src/dfp.c
index ef0a09d..48cbae5 100644
--- a/hdf/src/dfp.c
+++ b/hdf/src/dfp.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfp.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     dfp.c
diff --git a/hdf/src/dfpf.c b/hdf/src/dfpf.c
index 5c7f0aa..be63a08 100644
--- a/hdf/src/dfpf.c
+++ b/hdf/src/dfpf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfpf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfpf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfpF.c
diff --git a/hdf/src/dfr8.c b/hdf/src/dfr8.c
index 17c03e6..8320e71 100644
--- a/hdf/src/dfr8.c
+++ b/hdf/src/dfr8.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfr8.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfr8.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     dfr8.c
diff --git a/hdf/src/dfr8f.c b/hdf/src/dfr8f.c
index aac7c82..522654b 100644
--- a/hdf/src/dfr8f.c
+++ b/hdf/src/dfr8f.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfr8f.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfr8f.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfr8F.c
diff --git a/hdf/src/dfrle.c b/hdf/src/dfrle.c
index 44e1181..cb49b24 100644
--- a/hdf/src/dfrle.c
+++ b/hdf/src/dfrle.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfrle.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfrle.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfrle.c
diff --git a/hdf/src/dfsd.c b/hdf/src/dfsd.c
index 5d27ff0..99ded28 100644
--- a/hdf/src/dfsd.c
+++ b/hdf/src/dfsd.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6032 $";
-#endif
-
-/* $Id: dfsd.c 6032 2014-01-17 18:13:52Z acheng $ */
+/* $Id: dfsd.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  File:  dfsd.c
diff --git a/hdf/src/dfsdf.c b/hdf/src/dfsdf.c
index f671942..cd60f35 100644
--- a/hdf/src/dfsdf.c
+++ b/hdf/src/dfsdf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfsdf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfsdf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfsdf.c
diff --git a/hdf/src/dfstubs.c b/hdf/src/dfstubs.c
index c16b50c..ee3103b 100644
--- a/hdf/src/dfstubs.c
+++ b/hdf/src/dfstubs.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6036 $";
-#endif
-
-/* $Id: dfstubs.c 6036 2014-01-20 17:28:01Z acheng $ */
+/* $Id: dfstubs.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    ** FILE
diff --git a/hdf/src/dfufp2i.c b/hdf/src/dfufp2i.c
index d09d068..d4ba24c 100644
--- a/hdf/src/dfufp2i.c
+++ b/hdf/src/dfufp2i.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfufp2i.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfufp2i.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------c
  *    dfufp2i.c
diff --git a/hdf/src/dfufp2i.h b/hdf/src/dfufp2i.h
index 676c653..f3c5289 100644
--- a/hdf/src/dfufp2i.h
+++ b/hdf/src/dfufp2i.h
@@ -11,7 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: dfufp2i.h 5949 2013-06-10 16:16:09Z byrn $ */
+/* $Id: dfufp2i.h 6220 2015-03-05 20:06:46Z byrn $ */
 
 #ifndef DFUFP2IM_H  /* avoid re-inclusion */
 #define DFUFP2IM_H
@@ -79,6 +79,10 @@ extern      "C"
                 (float32 *scale, int32 dim, int32 *offsets, int32 res);
     HDFLIBAPI int  pixrep_simple
                 (Input * in, Output * out);
+    HDFLIBAPI int DFUfptoimage
+                (int32 hdim, int32 vdim, float32 max, float32 min,
+                 float32 *hscale, float32 *vscale, float32 *data, uint8 *palette,
+                 char *outfile, int ct_method, int32 hres, int32 vres, int compress);
 
 #if defined c_plusplus || defined __cplusplus
 }
diff --git a/hdf/src/dfunjpeg.c b/hdf/src/dfunjpeg.c
index f2bfe6a..a2a305f 100644
--- a/hdf/src/dfunjpeg.c
+++ b/hdf/src/dfunjpeg.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfunjpeg.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfunjpeg.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfunjpeg.c
diff --git a/hdf/src/dfutil.c b/hdf/src/dfutil.c
index a1540a4..bd3b51b 100644
--- a/hdf/src/dfutil.c
+++ b/hdf/src/dfutil.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfutil.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfutil.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:  dfutil.c
diff --git a/hdf/src/dfutilf.c b/hdf/src/dfutilf.c
index ed136a7..6745d21 100644
--- a/hdf/src/dfutilf.c
+++ b/hdf/src/dfutilf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dfutilf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dfutilf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    dfutilf.c
diff --git a/hdf/src/dynarray.c b/hdf/src/dynarray.c
index e8e02c2..ee508a0 100644
--- a/hdf/src/dynarray.c
+++ b/hdf/src/dynarray.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: dynarray.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: dynarray.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/glist.c b/hdf/src/glist.c
index 520531a..cac7ad6 100644
--- a/hdf/src/glist.c
+++ b/hdf/src/glist.c
@@ -20,10 +20,6 @@
   1996/06/04 - George V. 
  ************************************************************************/
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Id: glist.c 6043 2014-01-21 21:09:03Z acheng $";
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include "glist.h"
diff --git a/hdf/src/hbitio.c b/hdf/src/hbitio.c
index e8aca1f..a32f5a8 100644
--- a/hdf/src/hbitio.c
+++ b/hdf/src/hbitio.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: hbitio.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: hbitio.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/hblocks.c b/hdf/src/hblocks.c
index b0b04d5..987989f 100644
--- a/hdf/src/hblocks.c
+++ b/hdf/src/hblocks.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6026 $";
-#endif
-
-/* $Id: hblocks.c 6026 2014-01-16 15:16:16Z bmribler $ */
+/* $Id: hblocks.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*LINTLIBRARY */
 /* ------------------------------ hblocks.c -------------------------------
diff --git a/hdf/src/hbuffer.c b/hdf/src/hbuffer.c
index 35aa62d..0270c8c 100644
--- a/hdf/src/hbuffer.c
+++ b/hdf/src/hbuffer.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: hbuffer.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: hbuffer.c 6357 2016-05-13 05:00:06Z bmribler $ */
 /*LINTLIBRARY */
 /* ------------------------------ hbuffer.c -------------------------------
 
diff --git a/hdf/src/hchunks.c b/hdf/src/hchunks.c
index b1aac47..f2fa1ab 100644
--- a/hdf/src/hchunks.c
+++ b/hdf/src/hchunks.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5830 $";
-#endif
-
-/* $Id: hchunks.c 5830 2012-07-19 09:08:48Z bmribler $ */
+/* $Id: hchunks.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*LINTLIBRARY */
 /* ------------------------------ HMCxxx -------------------------------
diff --git a/hdf/src/hcomp.c b/hdf/src/hcomp.c
index 96748d3..e60ae8a 100644
--- a/hdf/src/hcomp.c
+++ b/hdf/src/hcomp.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5887 $";
-#endif
-
-/* $Id: hcomp.c 5887 2012-10-08 04:57:47Z bmribler $ */
+/* $Id: hcomp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
@@ -1980,8 +1976,8 @@ HCPgetdatasize(int32 file_id,
 		  HGOTO_ERROR(DFE_INTERNAL, FAIL);
 	    }
 
-	    /* unlimited dimension falls in here */
-	    else if (sp_tag == SPECIAL_LINKED)
+	    /* unlimited dimension and external data fall in here */
+	    else if (sp_tag == SPECIAL_LINKED || sp_tag == SPECIAL_EXT)
 	    {
 		INT32DECODE(p, len);	/* get total data length */
 		*orig_size = *comp_size = len;	/* set data sizes */
diff --git a/hdf/src/hcompri.c b/hdf/src/hcompri.c
index 39b9016..d0d8a27 100644
--- a/hdf/src/hcompri.c
+++ b/hdf/src/hcompri.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: hcompri.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: hcompri.c 6357 2016-05-13 05:00:06Z bmribler $ */
 /*LINTLIBRARY */
 /* ------------------------------ hcompri.c -------------------------------
 
diff --git a/hdf/src/hdfalloc.c b/hdf/src/hdfalloc.c
index 26fb9ec..4e6cb4d 100644
--- a/hdf/src/hdfalloc.c
+++ b/hdf/src/hdfalloc.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: hdfalloc.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: hdfalloc.c 6427 2016-06-13 21:56:09Z byrn $ */
 
 #ifdef MALDEBUG
 #define __MALDEBUG__
@@ -118,7 +114,7 @@ HDmemfill(void * dest, const void * src, uint32 item_size, uint32 num_items)
  EXAMPLES
  REVISION LOG
     Sep 19, 11 - Changed last argument's type from int32 to intn.  It didn't
-	make sense to have to cast in most places. -BMR
+    make sense to have to cast in most places. -BMR
 --------------------------------------------------------------------------*/
 char *
 HIstrncpy(char *dest, const char *source, intn len)
@@ -258,7 +254,6 @@ HDcalloc(uint32 n, uint32 size)
 }   /* end HDcalloc() */
 #endif /* MALLOC_CHECK */
 
-#if defined IBM6000 || defined ANSISUN || defined IRIX
 /*--------------------------------------------------------------------------
  NAME
     HDstrdup -- in-library replacement for non-ANSI strdup()
@@ -278,13 +273,18 @@ HDcalloc(uint32 n, uint32 size)
 char       *
 HDstrdup(const char *s)
 {
-    char       *ret;
+    char *ret;
+
+    /* Make sure original string is not NULL */
+    if (s == NULL)
+        return(NULL);
 
+    /* Allocate space */
     ret = (char *) HDmalloc((uint32) HDstrlen(s) + 1);
     if (ret == NULL)
         return (NULL);
+
+    /* Copy the original string and return it */
     HDstrcpy(ret, s);
     return (ret);
 }   /* end HDstrdup() */
-
-#endif /* macinosh */
diff --git a/hdf/src/hdfi.h b/hdf/src/hdfi.h
index e645965..bdab3e9 100644
--- a/hdf/src/hdfi.h
+++ b/hdf/src/hdfi.h
@@ -11,7 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: hdfi.h 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: hdfi.h 6446 2016-06-15 16:54:36Z bmribler $ */
 
 #ifndef HDFI_H
 #define HDFI_H
@@ -1273,10 +1273,6 @@ correctly.
 #  define HDstrchr(s,c)         (strchr((s),(c)))
 #  define HDstrrchr(s,c)        (strrchr((s),(c)))
 #  define HDstrtol(s,e,b)       (strtol((s),(e),(b)))
-/* non-standard function, not defined on the following machines - */
-#if !(defined IBM6000 || defined ANSISUN )
-#  define HDstrdup(s)      ((char *)strdup((const char *)(s)))
-#endif /* !(etc..) */
 
 
 /**************************************************************************
@@ -1302,7 +1298,9 @@ correctly.
 #endif /* !SUN & GCC */
 
 /* Compatibility #define for V3.3, should be taken out by v4.0 - QAK */
-#define DFSDnumber DFSDndatasets
+/* Commented out only, just in case any legacy code is still using it out there.
+   Will be removed in a few maintenance releases.  -BMR, Jun 5, 2016
+#define DFSDnumber DFSDndatasets */
 
 #endif /* HDFI_H */
 
diff --git a/hdf/src/herr.c b/hdf/src/herr.c
index 83aa918..99f7f29 100644
--- a/hdf/src/herr.c
+++ b/hdf/src/herr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: herr.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: herr.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*LINTLIBRARY */
 /* -------------------------------- herr.c -------------------------------- */
diff --git a/hdf/src/herr.h b/hdf/src/herr.h
index 52d7dae..1df813e 100644
--- a/hdf/src/herr.h
+++ b/hdf/src/herr.h
@@ -11,7 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: herr.h 5759 2012-01-19 22:34:47Z byrn $ */
+/* $Id: herr.h 6443 2016-06-15 02:10:31Z bmribler $ */
 
 /*+ herr.h
    ***  header file for using error routines
@@ -92,34 +92,26 @@
 
 /* always points to the next available slot; the last error record is in slot (top-1) */
 #if defined(H4_BUILT_AS_DYNAMIC_LIB)
-#ifdef _H_ERR_MASTER_
-#if defined _WIN32 && defined hdf_EXPORTS
+# ifdef _H_ERR_MASTER_
+#  if defined _WIN32 && defined hdf_shared_EXPORTS
 __declspec(dllexport)
-#endif
-#else
+#  endif
+# else
 HDFERRPUBLIC
-#endif /* _H_ERR_MASTER_ */
+# endif /* _H_ERR_MASTER_ */
 int32       error_top
-#ifdef _H_ERR_MASTER_
+# ifdef _H_ERR_MASTER_
 = 0
-#endif /* _H_ERR_MASTER_ */
+# endif /* _H_ERR_MASTER_ */
 ;
 #else /* defined(H4_BUILT_AS_DYNAMIC_LIB) */
-#ifndef _H_ERR_MASTER_
-#if defined _WIN32 && defined HDFAPDLL
-__declspec(dllimport)
-#else
+# ifndef _H_ERR_MASTER_
 HDFERRPUBLIC
-#endif
-#else
-#if defined _WIN32 && defined HDFLIBDLL
-__declspec(dllexport)
-#endif
-#endif /* _H_ERR_MASTER_ */
+# endif /* _H_ERR_MASTER_ */
 int32       error_top
-#ifdef _H_ERR_MASTER_
+# ifdef _H_ERR_MASTER_
 = 0
-#endif /* _H_ERR_MASTER_ */
+# endif /* _H_ERR_MASTER_ */
 ;
 #endif /* defined(H4_BUILT_AS_DYNAMIC_LIB) */
 
@@ -153,6 +145,7 @@ typedef enum
       DFE_SEEKERROR,            /* There was a seek error */
       DFE_RDONLY,               /* The DF is read only */
       DFE_BADSEEK,              /* Attempt to seek past end of element */
+      DFE_INVFILE,              /* File is neither hdf, cdf, netcdf */
 
 /* Low-level HDF I/O errors */
       DFE_PUTELEM,              /* Hputelement failed in some way */
@@ -207,6 +200,7 @@ typedef enum
       DFE_ARGS,                 /* bad arguments to routine */
       DFE_INTERNAL,             /* serious internal error */
       DFE_NORESET,              /* Too late to modify this value */
+      DFE_EXCEEDMAX,            /* Value exceeds max allowed */
       DFE_GENAPP,               /* Generic application,level error */
 
 /* Generic interface errors */
@@ -224,6 +218,7 @@ typedef enum
       DFE_RANGE,                /* improper range for attempted acess */
       DFE_BADCONV,              /* Don't know how to convert data type */
       DFE_BADTYPE,              /* Incompatible types specified */
+      DFE_BADDIMNAME,           /* Dimension name not valid or already taken */
       DFE_NOVGREP,              /* No Vgroup representation for SDS and dim */
 
 /* Compression errors */
@@ -284,6 +279,7 @@ typedef enum
       DFE_VSREAD,               /* Error reading from VData */
       DFE_BADVH,                /* Error in VData Header */
       DFE_FIELDSSET,            /* Fields already set for vdata */
+
 /* High-level Vdata/Vset errors */
       DFE_VSCANTCREATE,         /* Cannot create VData */
       DFE_VGCANTCREATE,         /* Cannot create VGroup */
@@ -292,6 +288,9 @@ typedef enum
       DFE_CANTATTACH,           /* Cannot attach to a VData/Vset */
       DFE_CANTDETACH,           /* Cannot detach a VData/Vset with access 'w' */
 
+/* XDR level errors */
+      DFE_XDRERROR,             /* Error occur in XDR and/or CDF level */
+
 /* bit I/O errors */
       DFE_BITREAD,              /* There was a bit-read error */
       DFE_BITWRITE,             /* There was a bit-write error */
@@ -304,7 +303,14 @@ typedef enum
       DFE_BVNEW,                /* Failed to create a bit-vector */
       DFE_BVSET,                /* Failed when setting a bit in a bit-vector */
       DFE_BVGET,                /* Failed when getting a bit in a bit-vector */
-      DFE_BVFIND                /* Failed when finding a bit in a bit-vector */
+      DFE_BVFIND,               /* Failed when finding a bit in a bit-vector */
+
+/* General to all interfaces */
+      DFE_CANTSETATTR,          /* Failed to add an attribute */
+      DFE_CANTGETATTR,          /* Failed to find or get an attribute */
+
+/* Annotation interface errors */
+      DFE_ANAPIERROR		/* Failed in annotation interface */
   }
 hdf_err_code_t;
 
@@ -339,6 +345,7 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_SEEKERROR,     "Error performing seek operation"},
     {DFE_RDONLY,        "Attempt to write to read-only HDF file"},
     {DFE_BADSEEK,       "Attempt to seek past end of element"},
+    {DFE_INVFILE,       "File is supported, must be either hdf, cdf, netcdf"},
 
 /* Low-level HDF I/O errors */
     {DFE_PUTELEM,       "Hputelement failed in some way"},
@@ -393,6 +400,7 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_ARGS,          "Invalid arguments to routine"},
     {DFE_INTERNAL,      "HDF Internal error"},
     {DFE_NORESET,       "Can not reset this value"},
+    {DFE_EXCEEDMAX,     "Value exceeds max allowed"},
     {DFE_GENAPP,        "Generic application-level error"},
 
 /* Generic interface errors */
@@ -410,6 +418,8 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_RANGE,         "Improper range for attempted access"},
     {DFE_BADCONV,       "Don't know how to convert data type"},
     {DFE_BADTYPE,       "Incompatible type specified"},
+    {DFE_BADDIMNAME,    "Dimension name not valid or already taken"},
+    {DFE_NOVGREP,       "No Vgroup representation for SDS and dim"},
 
 /* Compression errors */
     {DFE_BADSCHEME,     "Unknown compression scheme specified"},
@@ -427,13 +437,17 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_CANTCOMP,      "Can't compress an object"},
     {DFE_CANTDECOMP,    "Can't de-compress an object"},
     {DFE_NOENCODER,     "Encoder not available"},
+    {DFE_NOSZLIB,       "SZIP library not available"},
+    {DFE_COMPVERSION,   "Z_VERSION_ERROR (-6) returned from zlib"},
+    {DFE_READCOMP,      "Error in reading compressed data"},
 
 /* Raster errors */
-    {DFE_NODIM,         "No dimension record associated with image"},
+    {DFE_NODIM,         "No dimension record associated with image or data set"},
     {DFE_BADRIG,        "Error processing a RIG"},
     {DFE_RINOTFOUND,    "Can't find raster image"},
     {DFE_BADATTR,       "Bad Attribute"},
     {DFE_LUTNOTFOUND,   "No palette information for RIG"},
+    {DFE_GRNOTFOUND,    "Can't find specified GR"},
 
 /* SDG/NDG errors */
     {DFE_BADTABLE,      "The nsdg table is wrong"},
@@ -456,6 +470,7 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_BADVSCLASS,    "Cannot set VData class"},
     {DFE_VSWRITE,       "Error writing to VData"},
     {DFE_VSREAD,        "Error reading from VData"},
+    {DFE_BADVH,         "Error in VData Header"},
     {DFE_FIELDSSET,     "Fields already set for vdata"},
 
 /* High-level Vdata/Vset errors */
@@ -466,6 +481,9 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_CANTATTACH,    "Cannot attach to a VData"},
     {DFE_CANTDETACH,    "Cannot detach a VData with access 'w'"},
 
+/* XDR level errors */
+    {DFE_XDRERROR,      "Error from XDR and/or CDF level"},
+
 /* bit I/O errors */
     {DFE_BITREAD,       "There was a bit-read error"},
     {DFE_BITWRITE,      "There was a bit-write error"},
@@ -478,7 +496,15 @@ PRIVATE const struct error_messages_t error_messages[] =
     {DFE_BVNEW,         "Failed to create a bit-vector"},
     {DFE_BVSET,         "Failed when setting a bit in a bit-vector"},
     {DFE_BVGET,         "Failed when getting a bit in a bit-vector"},
-    {DFE_BVFIND,        "Failed when finding a bit in a bit-vector"}
+    {DFE_BVFIND,        "Failed when finding a bit in a bit-vector"},
+
+/* General to all interfaces */
+    {DFE_CANTSETATTR,   "Cannot set an attribute"},
+    {DFE_CANTGETATTR,   "Cannot find or get an attribute"},
+
+/* Annotation interface errors */
+    {DFE_ANAPIERROR,	"Failed in annotation interface"}
+
 };
 #endif /* _H_ERR_MASTER_ */
 
diff --git a/hdf/src/herrf.c b/hdf/src/herrf.c
index 6151676..a84d7ae 100644
--- a/hdf/src/herrf.c
+++ b/hdf/src/herrf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: herrf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: herrf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    herrf.c
diff --git a/hdf/src/hextelt.c b/hdf/src/hextelt.c
index cc05323..37b38e9 100644
--- a/hdf/src/hextelt.c
+++ b/hdf/src/hextelt.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: hextelt.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: hextelt.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*LINTLIBRARY */
 /* ------------------------------ hextelt.c -------------------------------
@@ -65,7 +61,7 @@ static char RcsId[] = "@(#)$Revision: 6043 $";
    HXPcloseAID      -- close file but keep AID active
    HXPendacess      -- close file, free AID
    HXPinfo          -- return info about an external element
-   HXPinquire       -- retreive information about an external element
+   HXPinquire       -- retrieve information about an external element
    HXPread          -- read some data out of an external file
    HXPreset         -- replace the current external info with new info
    HXPseek          -- set the seek position
@@ -180,6 +176,12 @@ DESCRIPTION
    successful execution.  FAIL is returned if any error is encountered.
 FORTRAN
    None
+MODIFICATION
+   Previously, the data_len used was incorrect when the element is
+   already special, either linked-block or external data, in which
+   case, the data_len was the length of the special info, not the data.
+   Changed to use correct data_len when the element is already special.
+   (HDFFR-1516) -BMR, Sep 5, 2015
 
 --------------------------------------------------------------------------*/
 int32
@@ -206,57 +208,72 @@ HXcreate(int32 file_id, uint16 tag, uint16 ref, const char *extern_file_name, in
         || (special_tag = MKSPECIALTAG(tag)) == DFTAG_NULL)
         HGOTO_ERROR(DFE_ARGS, FAIL);
 
+    /* Make sure file has write access */
     if (!(file_rec->access & DFACC_WRITE))
         HGOTO_ERROR(DFE_DENIED, FAIL);
 
-    /* get a access records */
-    access_rec = HIget_access_rec();
-    if (access_rec == NULL)
-        HGOTO_ERROR(DFE_TOOMANY, FAIL);
-
-    /* search for identical dd */
+    /* Get access to the DD of this tag/ref */
     if ((data_id=HTPselect(file_rec,tag,ref))!=FAIL)
       {
-          /* Check if the element is already special */
+          /* If element is already special, proceed according to special type */
           if (HTPis_special(data_id)==TRUE)
             {
                 sp_info_block_t sp_info;
                 int32	aid, retcode;
 
-                aid = Hstartread(file_id, tag, ref);
+                /* Get read access on the tag/ref */
+                if ((aid = Hstartread(file_id, tag, ref)) == FAIL)
+                    HGOTO_ERROR(DFE_NOMATCH, FAIL);
+
+                /* Get the special info structure */
                 retcode = HDget_special_info(aid, &sp_info);
-                Hendaccess(aid);
+
                 if ((retcode == FAIL) || (sp_info.key == FAIL))
                     HGOTO_ERROR(DFE_CANTMOD, FAIL);
 		
+                /* We can proceed with linked-block and external, but
+                   not compression special element */
                 switch(sp_info.key)
-                  {
-                    /* we can proceed with these types of special elements */
+                {
                     case SPECIAL_LINKED:
+                        if (HDinqblockinfo(aid, &data_len, NULL, NULL, NULL) == FAIL)
+                        {
+                            Hendaccess(aid);
+                            HRETURN_ERROR(DFE_INTERNAL, FAIL);
+                        }
+                        break;
                     case SPECIAL_EXT:
+                        data_len = sp_info.length;
                         break;
-
-                    /* abort since we cannot convert the data element to an external data element */
                     case SPECIAL_COMP:
                     default:
                         HTPendaccess(data_id);
+                        Hendaccess(aid);
                         HGOTO_ERROR(DFE_CANTMOD, FAIL);
-                  } /* switch */
-            }   /* end if */
-
-          /* get the info for the dataset */
-          if(HTPinquire(data_id,NULL,NULL,NULL,&data_len)==FAIL)
-            {
-                HTPendaccess(data_id);
-                HGOTO_ERROR(DFE_INTERNAL, FAIL);
-            } /* end if */
+                } /* switch */
+                /* Close access on this special element */
+                Hendaccess(aid);
+            }   /* end if data_id is special */
+
+            else
+            { /* not special */
+            /* Then use HTPinquire to get the length of the data. Note: when
+               this tag is special, this length is the length of the special
+                info only, not data. */ 
+                if (HTPinquire(data_id,NULL,NULL,NULL,&data_len)==FAIL)
+                {
+                    HTPendaccess(data_id);
+                    HGOTO_ERROR(DFE_INTERNAL, FAIL);
+                } /* end if */
+            }
       } /* end if */
 
     /* build the customized external file name. */
     if (!(fname = HXIbuildfilename(extern_file_name, DFACC_CREATE)))
         HGOTO_ERROR(DFE_BADOPEN, FAIL);
 
-    /* create the external file */
+    /* Try to open the external file with write access first, if that fails,
+       create it */
     file_external = (hdf_file_t)HI_OPEN(fname, DFACC_WRITE);
     if (OPENERR(file_external))
     {
@@ -266,12 +283,18 @@ HXcreate(int32 file_id, uint16 tag, uint16 ref, const char *extern_file_name, in
     }
     HDfree(fname);
 
-    /* set up the special element information and write it to file */
+    /* Get a bare access record and special info structure */
+    access_rec = HIget_access_rec();
+    if (access_rec == NULL)
+        HGOTO_ERROR(DFE_TOOMANY, FAIL);
+
     access_rec->special_info = HDmalloc((uint32) sizeof(extinfo_t));
     info = (extinfo_t *) access_rec->special_info;
     if (!info)
         HGOTO_ERROR(DFE_NOSPACE, FAIL);
 
+    /* If there is data, either regular or special, read the data then write
+       it to the external file, otherwise, do nothing */
     if (data_id!=FAIL && data_len>0)
       {
           if ((buf = HDmalloc((uint32) data_len)) == NULL)
@@ -287,15 +310,15 @@ HXcreate(int32 file_id, uint16 tag, uint16 ref, const char *extern_file_name, in
     else
       info->length = start_len;
 
+    /* Set up the special element information and write it to file */
     info->attached         = 1;
     info->file_open        = TRUE;
     info->file_external    = file_external;
     info->extern_offset    = offset;
     info->extern_file_name = (char *) HDstrdup(extern_file_name);
     if (!info->extern_file_name)
-      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+        HGOTO_ERROR(DFE_NOSPACE, FAIL);
 
-    /* Getting ready to write out special info struct */
     info->length_file_name = (int32)HDstrlen(extern_file_name);
     {
         uint8      *p = local_ptbuf;
@@ -306,19 +329,25 @@ HXcreate(int32 file_id, uint16 tag, uint16 ref, const char *extern_file_name, in
         INT32ENCODE(p, info->length_file_name);
         HDstrcpy((char *) p, extern_file_name);
     }
+
+    /* Free up the current DD */
     if(data_id!=FAIL)
         if (HTPdelete(data_id) == FAIL)
             HGOTO_ERROR(DFE_CANTDELDD, FAIL);
 
-    /* write the special info structure to file */
+    /* Write the special info structure to file */
     if((dd_aid=Hstartaccess(file_id,special_tag,ref,DFACC_ALL))==FAIL)
         HGOTO_ERROR(DFE_CANTACCESS, FAIL);
     if (Hwrite(dd_aid, 14+info->length_file_name, local_ptbuf) == FAIL)
+    {
+        Hendaccess(dd_aid);
         HGOTO_ERROR(DFE_WRITEERROR, FAIL);
+    }
     if(Hendaccess(dd_aid)==FAIL)
         HGOTO_ERROR(DFE_CANTENDACCESS, FAIL);
+    dd_aid = FAIL;
 
-    /* update access record and file record */
+    /* Update access record and file record */
     if((access_rec->ddid=HTPselect(file_rec,special_tag,ref))==FAIL)
         HGOTO_ERROR(DFE_INTERNAL, FAIL);
     access_rec->special_func = &ext_funcs;
diff --git a/hdf/src/hfile.c b/hdf/src/hfile.c
index d992a4c..688895a 100644
--- a/hdf/src/hfile.c
+++ b/hdf/src/hfile.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: hfile.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: hfile.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*LINTLIBRARY */
 /*+
diff --git a/hdf/src/hfile.h b/hdf/src/hfile.h
index fb9146e..476ca40 100644
--- a/hdf/src/hfile.h
+++ b/hdf/src/hfile.h
@@ -11,7 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: hfile.h 6194 2015-02-05 14:17:12Z bmribler $ */
+/* $Id: hfile.h 6473 2016-06-24 21:38:14Z bmribler $ */
 
 /*+ hfile.h
    *** Header for hfile.c, routines for low level data element I/O
@@ -51,10 +51,10 @@
 
 #define LIBVER_MAJOR    4
 #define LIBVER_MINOR    2 
-#define LIBVER_RELEASE  11 
+#define LIBVER_RELEASE  12 
 #define LIBVER_SUBRELEASE ""   /* For pre-releases like snap0       */
                                 /* Empty string for real releases.           */
-#define LIBVER_STRING   "HDF Version 4.2 Release 11, February 5, 2015"
+#define LIBVER_STRING   "HDF Version 4.2 Release 12, June 24, 2016"
 #define LIBVSTR_LEN    80   /* length of version string  */
 #define LIBVER_LEN  92      /* 4+4+4+80 = 92 */
 /* end of version tags */
diff --git a/hdf/src/hfiledd.c b/hdf/src/hfiledd.c
index 03bf40b..fbfc014 100644
--- a/hdf/src/hfiledd.c
+++ b/hdf/src/hfiledd.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5584 $";
-#endif
-
-/* $Id: hfiledd.c 5584 2011-04-13 18:25:06Z bmribler $ */
+/* $Id: hfiledd.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/hfilef.c b/hdf/src/hfilef.c
index c4c7b24..9a58d19 100644
--- a/hdf/src/hfilef.c
+++ b/hdf/src/hfilef.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: hfilef.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: hfilef.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    hfilef.c
diff --git a/hdf/src/hkit.c b/hdf/src/hkit.c
index 9bea081..e62ad67 100644
--- a/hdf/src/hkit.c
+++ b/hdf/src/hkit.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: hkit.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: hkit.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include <ctype.h>
 #include "hkit.h"
diff --git a/hdf/src/hproto.h b/hdf/src/hproto.h
index 54c7424..4e96271 100644
--- a/hdf/src/hproto.h
+++ b/hdf/src/hproto.h
@@ -11,7 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: hproto.h 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: hproto.h 6427 2016-06-13 21:56:09Z byrn $ */
 
 #ifndef _H_PROTO
 #define _H_PROTO
@@ -401,12 +401,9 @@ HDFLIBAPI intn Hdeldd(int32 file_id,      /* IN: File ID the tag/refs are in */
 
 #endif /* defined MALLOC_CHECK */
 
-#if defined IBM6000 || defined SUN
     HDFPUBLIC extern char *HDstrdup
                 (const char *s);
 
-#endif
-
     HDFLIBAPI intn HDc2fstr
                 (char * str, intn len);
 
diff --git a/hdf/src/linklist.c b/hdf/src/linklist.c
index 7249309..e4163b8 100644
--- a/hdf/src/linklist.c
+++ b/hdf/src/linklist.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: linklist.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: linklist.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/maldebug.c b/hdf/src/maldebug.c
index 4d6673f..24bafe3 100644
--- a/hdf/src/maldebug.c
+++ b/hdf/src/maldebug.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: maldebug.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: maldebug.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*----------------------------------------------------------------------
  *
diff --git a/hdf/src/mcache.c b/hdf/src/mcache.c
index 4fa04e6..7212a94 100644
--- a/hdf/src/mcache.c
+++ b/hdf/src/mcache.c
@@ -39,11 +39,7 @@
  * AUTHOR - George V.- 1996/08/22
  *****************************************************************************/ 
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5146 $";
-#endif
-
-/* $Id: mcache.c 5146 2009-01-14 17:46:57Z fbaker $ */
+/* $Id: mcache.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
  *  NOTE:
diff --git a/hdf/src/mfan.c b/hdf/src/mfan.c
index b8c11e6..e424d72 100644
--- a/hdf/src/mfan.c
+++ b/hdf/src/mfan.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5454 $";
-#endif
-
-/* $Id: mfan.c 5454 2010-08-27 17:24:55Z bmribler $ */
+/* $Id: mfan.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     mfan.c
diff --git a/hdf/src/mfanf.c b/hdf/src/mfanf.c
index 2682512..097fbee 100644
--- a/hdf/src/mfanf.c
+++ b/hdf/src/mfanf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: mfanf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: mfanf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:     mfanf.c
diff --git a/hdf/src/mfgr.c b/hdf/src/mfgr.c
index 4b9b052..5f506ca 100644
--- a/hdf/src/mfgr.c
+++ b/hdf/src/mfgr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Revision: 6135 $";
-#endif
-
-/* $Id: mfgr.c 6135 2014-09-12 00:13:35Z acheng $ */
+/* $Id: mfgr.c 6369 2016-05-24 05:25:11Z bmribler $ */
 
 /*
 FILE
@@ -189,6 +185,13 @@ static TBBT_TREE *gr_tree=NULL;
 /* Whether we've installed the library termination function yet for this interface */
 PRIVATE intn library_terminate = FALSE;
 
+typedef struct image_info_struct {
+    uint16 grp_tag,grp_ref;         /* tag/ref of the group the image is in */
+    uint16 img_tag,img_ref;         /* tag/ref of the image itself */
+    uint16 aux_ref;                 /* ref of aux. info about an image */
+    int32 offset;                   /* offset of the image data */
+} imginfo_t;
+
 PRIVATE intn GRIupdatemeta(int32 hdf_file_id,ri_info_t *img_ptr);
 
 PRIVATE intn GRIupdateRIG(int32 hdf_file_id,ri_info_t *img_ptr);
@@ -437,6 +440,107 @@ New_grfile(HFILEID f)
     return(g);
 } /* end New_grfile() */
 
+/* -------------------------- Store_imginfo ------------------------ */
+/*
+   Stores information into the image_info_struct.
+
+   Added to refactor repeated code. -BMR, Jun 7, 2015
+ */
+PRIVATE void
+Store_imginfo(
+        imginfo_t *imginfo,
+        uint16 grp_tag,
+        uint16 grp_ref,
+        uint16 img_tag,
+        uint16 img_ref)
+{
+    imginfo->grp_tag=(uint16)grp_tag;
+    imginfo->grp_ref=(uint16)grp_ref;
+    imginfo->img_tag=(uint16)img_tag;
+    imginfo->img_ref=(uint16)img_ref;
+} /* end Store_imginfo() */
+
+/* -------------------------- Get_oldimgs ------------------------ */
+/*
+   Find all images of tag searched_tag in the file and store their
+   information in the list of image_info_structs.  The stored information
+   include the image's tag/ref, DFTAG_NULL/DFREF_WILDCARD for the group's
+   tag/ref, and the image's offset in the file.
+
+   Returns the number of images on success, or NULL, otherwise.
+
+   Added to refactor repeated code. -BMR, Jul 13, 2015
+ */
+PRIVATE intn
+Get_oldimgs(int32 file_id, imginfo_t *img_info, uint16 searched_tag)
+{
+    uint16 find_tag, find_ref;
+    int32 find_off, find_len;
+    intn num_imgs = 0;
+    imginfo_t *ptr = img_info;
+
+    find_tag = find_ref = 0;
+    find_off = find_len = 0;
+
+    while (Hfind(file_id, searched_tag, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
+    {
+        /* DFTAG_NULL is passed in for parent group because old images don't
+           have group structure. */
+        Store_imginfo(ptr, DFTAG_NULL, DFREF_WILDCARD, find_tag, find_ref);
+        ptr->offset = find_off;   /* store offset */
+        num_imgs++;
+        ptr++;
+    }   /* end while */
+    return num_imgs;
+} /* end Get_oldimgs() */
+
+/* -------------------------- Init_diminfo ------------------------ */
+/*
+   Initializes the dimension information.
+
+   Added to refactor repeated code. -BMR, Apr 23, 2015
+ */
+PRIVATE void
+Init_diminfo(dim_info_t *dim_info)
+{ /* Init_diminfo */
+    dim_info->dim_ref = DFREF_WILDCARD;
+    dim_info->xdim = 256;
+    dim_info->ydim = 1;
+    dim_info->ncomps = 3;
+    dim_info->nt = DFNT_UINT8;
+    dim_info->file_nt_subclass = DFNTF_HDFDEFAULT;
+    dim_info->il = MFGR_INTERLACE_PIXEL;
+    dim_info->nt_tag = DFTAG_NULL;
+    dim_info->nt_ref = DFREF_WILDCARD;
+    dim_info->comp_tag = DFTAG_NULL;
+    dim_info->comp_ref = DFREF_WILDCARD;
+} /* end Init_diminfo */
+
+/* -------------------------- Decode_diminfo ------------------------ */
+/*
+   Decodes dimension information.
+
+   The parameter *p points to a buffer containing the data read from the
+   file.  The data is the previously encoded dimension information.
+
+   Added to refactor repeated code. -BMR, Apr 23, 2015
+ */
+PRIVATE void
+Decode_diminfo(uint8 *p, dim_info_t *dim_info)
+{
+    int16 int16var;  /* temp var */
+
+    INT32DECODE(p, dim_info->xdim);
+    INT32DECODE(p, dim_info->ydim);
+    UINT16DECODE(p, dim_info->nt_tag);
+    UINT16DECODE(p, dim_info->nt_ref);
+    INT16DECODE(p, int16var);
+    dim_info->ncomps = (int32)int16var;
+    INT16DECODE(p, dim_info->il);
+    UINT16DECODE(p, dim_info->comp_tag);
+    UINT16DECODE(p, dim_info->comp_ref);
+} /* Decode_diminfo */
+
 /*--------------------------------------------------------------------------
  NAME
     GRIget_image_list
@@ -470,16 +574,11 @@ static intn GRIget_image_list(int32 file_id,gr_info_t *gr_ptr)
     uint16      gr_ref;         /* ref # of the Vgroup containing new-style RIs */
     intn        curr_image;     /* current image gathering information about */
     intn        nimages;        /* total number of potential images */
+    intn        noldimages;     /* count of old imgs returned by Get_oldimgs */
     int32       nri, nci, nri8, nci8, nii8, nvg;   /* number of RIs, CIs, RI8s, CI8s & II8s & Vgroups */
-    struct image_info {
-        uint16 grp_tag,grp_ref;         /* tag/ref of the group the image is in */
-        uint16 img_tag,img_ref;         /* tag/ref of the image itself */
-        uint16 aux_ref;                 /* ref of aux. info about an image */
-        int32 offset;                   /* offset of the image data */
-  uint16 orig_tag;    /* original tag before the elimination of duplicates */
-    } *img_info;
     uint16      find_tag, find_ref;     /* storage for tag/ref pairs found */
     int32       find_off, find_len;     /* storage for offset/lengths of tag/refs found */
+    imginfo_t *img_info;        /* image info list */
     intn        i, j;           /* local counting variable */
     intn        ret_value = SUCCEED;
 
@@ -516,127 +615,133 @@ static intn GRIget_image_list(int32 file_id,gr_info_t *gr_ptr)
       }
 
     /* Get space to store the image offsets */
-    if ((img_info = (struct image_info *) HDmalloc(nimages * sizeof(struct image_info))) == NULL)
+    if ((img_info = (imginfo_t *) HDmalloc(nimages * sizeof(imginfo_t))) == NULL)
         HGOTO_ERROR(DFE_NOSPACE, FAIL);
-    HDmemset(img_info,0,(size_t)nimages*sizeof(struct image_info));    
+    HDmemset(img_info, 0, (size_t)nimages * sizeof(imginfo_t));
 
     /* search through the GR group for raster images & global attributes */
     curr_image = 0;
     if((gr_ref=(uint16)Vfind(file_id,GR_NAME))!=0)
-      {
-          int32       gr_key;         /* Vgroup key of the GR Vgroup */
+    {
+        int32       gr_key;         /* Vgroup key of the GR Vgroup */
 
-          gr_ptr->gr_ref=gr_ref; /* squirrel this away for later use */
-          if((gr_key=Vattach(file_id,(int32)gr_ref,"r"))!=FAIL)
-            {
-                int32 nobjs=Vntagrefs(gr_key); /* The number of objects in the Vgroup */
-                int32 img_key;  /* Vgroup key of an image */
-                int32 grp_tag,grp_ref;  /* a tag/ref in the Vgroup */
-                int32 img_tag,img_ref;  /* image tag/ref in the Vgroup */
-                char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+        gr_ptr->gr_ref=gr_ref; /* squirrel this away for later use */
+        if((gr_key=Vattach(file_id,(int32)gr_ref,"r"))!=FAIL)
+        {
+            int32 nobjs=Vntagrefs(gr_key); /* The number of objects in the Vgroup */
+            int32 img_key;  /* Vgroup key of an image */
+            int32 grp_tag,grp_ref;  /* a tag/ref in the Vgroup */
+            int32 img_tag,img_ref;  /* image tag/ref in the Vgroup */
+            char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
                 
-                for(i=0; i<nobjs; i++)
-                  {
-                      if(Vgettagref(gr_key,i,&grp_tag,&grp_ref)==FAIL)
-                          continue;
+            for(i=0; i<nobjs; i++)
+            {
+                if(Vgettagref(gr_key,i,&grp_tag,&grp_ref)==FAIL)
+                    continue;
                       
-                      switch(grp_tag)
+                switch(grp_tag)
+                {
+                    case DFTAG_VG:  /* should be an image */
+                        if((img_key=Vattach(file_id,grp_ref,"r"))!=FAIL)
                         {
-                            case DFTAG_VG:  /* should be an image */
-                                if((img_key=Vattach(file_id,grp_ref,"r"))!=FAIL)
-                                  {
-                                    if(Vgetclass(img_key,textbuf)!=FAIL)
-                                      {
-                                        if(!HDstrcmp(textbuf,RI_NAME))
-                                          { /* found an image, whew! */
-                                            for(j=0; j<Vntagrefs(img_key); j++)
-                                              {
-                                                  if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
-                                                      continue;
-                                                  if(img_tag==DFTAG_RI || img_tag==DFTAG_CI)
-                                                    {
-                                                        img_info[curr_image].grp_tag=(uint16)grp_tag;
-                                                        img_info[curr_image].grp_ref=(uint16)grp_ref;
-                                                        img_info[curr_image].img_tag=(uint16)img_tag;
-                                                        img_info[curr_image].img_ref=(uint16)img_ref;
-                                                        img_info[curr_image].offset = Hoffset(file_id, (uint16)img_tag, (uint16)img_ref);     /* store offset */
-                                                        curr_image++;
-                                                        break;
-                                                    } /* end if */
-                                              } /* end for */
-                                          } /* end if */
-                                      } /* end if */
-                                    Vdetach(img_key);
-                                  } /* end if */
+                            if(Vgetclass(img_key,textbuf)!=FAIL)
+                            {
+                                if(!HDstrcmp(textbuf,RI_NAME))
+                                { /* it is an image, get the image's tag/ref */
+                                    for(j=0; j<Vntagrefs(img_key); j++)
+                                    {
+                                        if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
+                                            continue;
+                                        /* Make sure the tag is correct, then
+                                           store the image's info and the
+                                           tag/ref of the vgroup that represents
+                                           the image into image_info_struct and
+                                           increment image count */
+                                        if(img_tag==DFTAG_RI || img_tag==DFTAG_CI)
+                                        {
+                                            Store_imginfo(&img_info[curr_image], grp_tag, grp_ref, img_tag, img_ref);
+                                            img_info[curr_image].offset = Hoffset(file_id, (uint16)img_tag, (uint16)img_ref);     /* store offset */
+                                            curr_image++;
+                                            break;
+                                        } /* end if */
+                                    } /* end for */
+                                } /* end if */
+                            } /* end if */
+                            Vdetach(img_key);
+                        } /* end if */
+                        break; /* case DFTAG_VG, an image */
+
+                    case DFTAG_VH:  /* must be a "global" attribute */
+                    {
+                        at_info_t *new_attr;  /* attr to add to the set of global attrs */
+                        int32 at_key;         /* VData key for the attribute */
+
+                        if((new_attr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
+                            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                        new_attr->ref=(uint16)grp_ref;
+                        new_attr->index=gr_ptr->gattr_count;
+                        new_attr->data_modified=FALSE;
+                        new_attr->new_at=FALSE;
+                        new_attr->data=NULL;
+
+                        /* Open the vdata to read the attr's info */
+                        if((at_key=VSattach(file_id,(int32)grp_ref,"r"))!=FAIL)
+                        {
+                            char *fname;
+
+                            /* Make certain the attribute only has one field */
+                            if(VFnfields(at_key)!=1)
+                            {
+                                VSdetach(at_key);
+                                HDfree(new_attr);
                                 break;
+                            } /* end if */
+                            new_attr->nt=VFfieldtype(at_key,0);
+                            new_attr->len=VFfieldorder(at_key,0);
+                            if(new_attr->len==1)
+                                new_attr->len=VSelts(at_key);
 
-                            case DFTAG_VH:  /* must be a "global" attaribute */
-                                  {
-                                      at_info_t *new_attr;  /* attribute to add to the set of local attributes */
-                                      int32 at_key;         /* VData key for the attribute */
-
-                                      if((new_attr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
-                                          HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                      new_attr->ref=(uint16)grp_ref;
-                                      new_attr->index=gr_ptr->gattr_count;
-                                      new_attr->data_modified=FALSE;
-                                      new_attr->new_at=FALSE;
-                                      new_attr->data=NULL;
-                                      if((at_key=VSattach(file_id,(int32)grp_ref,"r"))!=FAIL)
-                                        {
-                                            char *fname;
-
-                                            /* Make certain the attribute only has one field */
-                                            if(VFnfields(at_key)!=1)
-                                              {
-                                                VSdetach(at_key);
-                                                HDfree(new_attr);
-                                                break;
-                                              } /* end if */
-                                            new_attr->nt=VFfieldtype(at_key,0);
-                                            new_attr->len=VFfieldorder(at_key,0);
-                                            if(new_attr->len==1)
-                                                new_attr->len=VSelts(at_key);
-
-                                            /* Get the name of the attribute */
-                                            if((fname=VFfieldname(at_key,0))==NULL)
-                                              {
-                                                sprintf(textbuf,"Attribute #%d",(int)new_attr->index);
-                                                if((new_attr->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
-                                                  {
-                                                    VSdetach(at_key);
-                                                    HDfree(new_attr);
-                                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                                  } /* end if */
-                                                HDstrcpy(new_attr->name,textbuf);
-                                              } /* end if */
-                                            else
-                                              {
-                                                if((new_attr->name=(char *)HDmalloc(HDstrlen(fname)+1))==NULL)
-                                                  {
-                                                    VSdetach(at_key);
-                                                    HDfree(new_attr);
-                                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                                  } /* end if */
-                                                HDstrcpy(new_attr->name,fname);
-                                              } /* end else */
+                            /* Get the name of the attribute */
+                            if((fname=VFfieldname(at_key,0))==NULL)
+                            {
+                                sprintf(textbuf,"Attribute #%d",(int)new_attr->index);
+                                if((new_attr->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                                {
+                                    VSdetach(at_key);
+                                    HDfree(new_attr);
+                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                } /* end if */
+                                HDstrcpy(new_attr->name,textbuf);
+                            } /* end if */
+                            else
+                            {
+                                if((new_attr->name=(char *)HDmalloc(HDstrlen(fname)+1))==NULL)
+                                {
+                                    VSdetach(at_key);
+                                    HDfree(new_attr);
+                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                } /* end if */
+                                HDstrcpy(new_attr->name,fname);
+                            } /* end else */
                                                 
-                                            tbbtdins(gr_ptr->gattree, new_attr, NULL);    /* insert the attr instance in B-tree */ 
+                            /* insert the attr instance in B-tree */ 
+                            tbbtdins(gr_ptr->gattree, new_attr, NULL);
 
-                                            VSdetach(at_key);
-                                        } /* end if */
+                            VSdetach(at_key);
+                        } /* end if */
 
-                                      gr_ptr->gattr_count++;
-                                  } /* end case */
-                                break;
+                        /* increment the number of GR global attributes */
+                        gr_ptr->gattr_count++;
+                    } /* end case DFTAG_VH, a global attribute */
+                    break;
 
-                            default:
-                                break;
-                        } /* end switch */
-                  } /* end for */
-              Vdetach(gr_key);
-            } /* end if */
-      } /* end if */
+                    default:
+                        break;
+                } /* end switch */
+            } /* end for */
+            Vdetach(gr_key);
+        } /* end if */
+    } /* end if */
 
     /* Get information about the RIGs in the file */
     find_tag = find_ref = 0;
@@ -655,10 +760,7 @@ static intn GRIget_image_list(int32 file_id,gr_info_t *gr_ptr)
                   {   
                       if (elt_tag != DFTAG_NULL && elt_ref != DFREF_NONE) /* make certain we found an image */
                         {     /* store the information about the image */
-                            img_info[curr_image].grp_tag=DFTAG_RIG;
-                            img_info[curr_image].grp_ref=find_ref;
-                            img_info[curr_image].img_tag=elt_tag;
-                            img_info[curr_image].img_ref=elt_ref;
+                            Store_imginfo(&img_info[curr_image], DFTAG_RIG, find_ref, elt_tag, elt_ref);
                             img_info[curr_image].offset = Hoffset(file_id, elt_tag, elt_ref);     /* store offset */
                             curr_image++;
                         }     /* end if */
@@ -667,40 +769,16 @@ static intn GRIget_image_list(int32 file_id,gr_info_t *gr_ptr)
       } /* end while */
 
     /* go through the RI8s */
-    find_tag = find_ref = 0;
-    while (Hfind(file_id, DFTAG_RI8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
-      {
-          img_info[curr_image].grp_tag=DFTAG_NULL;
-          img_info[curr_image].grp_ref=DFREF_WILDCARD;
-          img_info[curr_image].img_tag=find_tag;
-          img_info[curr_image].img_ref=find_ref;
-          img_info[curr_image].offset = find_off;   /* store offset */
-          curr_image++;
-      }     /* end while */
+    noldimages = Get_oldimgs(file_id, &img_info[curr_image], DFTAG_RI8);
+    curr_image = curr_image + noldimages;
 
     /* go through the CI8s */
-    find_tag = find_ref = 0;
-    while (Hfind(file_id, DFTAG_CI8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
-      {
-          img_info[curr_image].grp_tag=DFTAG_NULL;
-          img_info[curr_image].grp_ref=DFREF_WILDCARD;
-          img_info[curr_image].img_tag=find_tag;
-          img_info[curr_image].img_ref=find_ref;
-          img_info[curr_image].offset = find_off;   /* store offset */
-          curr_image++;
-      } /* end while */
+    noldimages = Get_oldimgs(file_id, &img_info[curr_image], DFTAG_CI8);
+    curr_image = curr_image + noldimages;
 
     /* go through the II8s */
-    find_tag = find_ref = 0;
-    while (Hfind(file_id, DFTAG_II8, DFREF_WILDCARD, &find_tag, &find_ref, &find_off, &find_len, DF_FORWARD) == SUCCEED)
-      {
-          img_info[curr_image].grp_tag=DFTAG_NULL;
-          img_info[curr_image].grp_ref=DFREF_WILDCARD;
-          img_info[curr_image].img_tag=find_tag;
-          img_info[curr_image].img_ref=find_ref;
-          img_info[curr_image].offset = find_off;   /* store offset */
-          curr_image++;
-      } /* end while */
+    noldimages = Get_oldimgs(file_id, &img_info[curr_image], DFTAG_II8);
+    curr_image = curr_image + noldimages;
 
     /* Eliminate duplicate images by using the offset of the image data */
     /* Here's a table for how the images will be eliminated: */
@@ -718,614 +796,532 @@ static intn GRIget_image_list(int32 file_id,gr_info_t *gr_ptr)
                                +-----------------+-----------------+--------+
     */
 
-    nimages = curr_image;   /* reset the number of images we really have */
     for (i = 0; i < curr_image; i++)
-      {     /* go through the images looking for duplicates */
-          if(img_info[i].img_tag!=DFTAG_NULL)
-              for (j = i+1; j < curr_image; j++)
-                {
-      /* if their refs are different, they're not duplicate, skip */
-      if(img_info[i].img_ref == img_info[j].img_ref)
+    {     /* go through the images looking for duplicates */
+        if(img_info[i].img_tag!=DFTAG_NULL)
+            for (j = i+1; j < curr_image; j++)
+            {
+                /* if their refs are different, they're not duplicate, skip */
+                if(img_info[i].img_ref == img_info[j].img_ref)
                     if(img_info[j].img_tag!=DFTAG_NULL)
-          {
+                    {
                         /* If the element is special, get its type, to allow
                            linked block or chunked images to go into the if
                            statement below in order for the duplicate image be
                            eliminated - bug #814, BMR Feb, 2005 */
                         intn special_type = GRIisspecial_type(file_id,img_info[i].img_tag,img_info[i].img_ref);
 
-                        if (((img_info[i].offset!= INVALID_OFFSET && img_info[i]
-.offset!=0)
+                        if (((img_info[i].offset!= INVALID_OFFSET && img_info[i].offset!=0)
                                 && img_info[i].offset == img_info[j].offset) ||
                              (img_info[i].offset==0
                                 && (special_type == SPECIAL_LINKED ||
                                     special_type == SPECIAL_CHUNKED)))
-                          {
-                              /* eliminate the oldest tag from the match */
-                              switch(img_info[i].img_tag) {
-                                  case DFTAG_RI:
-                                  case DFTAG_CI: /* Newer style raster image, found in RIG & Vgroup */
-                                      if(img_info[j].grp_tag==DFTAG_RIG)
-                                        {
-            img_info[j].orig_tag = img_info[j].img_tag;
+                        {
+                            /* eliminate the oldest tag from the match */
+                            switch(img_info[i].img_tag)
+                            {
+                              case DFTAG_RI:
+                              case DFTAG_CI: /* Newer style raster image, found in RIG & Vgroup */
+                                  if(img_info[j].grp_tag==DFTAG_RIG)
+                                  {
+                                      img_info[j].img_tag=DFTAG_NULL;
+                                      if(img_info[i].grp_tag==DFTAG_VG)
+                                          img_info[i].aux_ref=img_info[j].grp_ref;
+                                  } /* end if */
+                                  else
+                                  {
+                                      if(img_info[i].grp_tag==DFTAG_VG)
                                           img_info[j].img_tag=DFTAG_NULL;
-                                          if(img_info[i].grp_tag==DFTAG_VG)
-                                              img_info[i].aux_ref=img_info[j].grp_ref;
-                                        } /* end if */
-                                      else
-                                          if(img_info[i].grp_tag==DFTAG_VG)
-            {
-                img_info[j].orig_tag = img_info[j].img_tag;
-                                              img_info[j].img_tag=DFTAG_NULL;
-            }
-                                          else
-                                            {
-                img_info[j].orig_tag = img_info[j].img_tag;
-                                              img_info[j].img_tag=DFTAG_NULL;
-                                              if(img_info[i].grp_tag==DFTAG_RIG)
-                                                  img_info[j].aux_ref=img_info[i].grp_ref;
-                                            } /* end else */
-                                      break;
-
-                                  case DFTAG_RI8:
-                                  case DFTAG_CI8:
-                                  case DFTAG_II8: /* Eldest style raster image, no grouping */
-                                      if(img_info[j].img_tag!=DFTAG_RI8 && img_info[j].img_tag!=DFTAG_CI8 && img_info[j].img_tag!=DFTAG_II8)
-                                          img_info[i].img_tag=DFTAG_NULL;
                                       else
+                                      {
                                           img_info[j].img_tag=DFTAG_NULL;
-                                      break;
-
-                                  default: /* an image which was eliminated from the list of images */
-                                    break;
-                                } /* end switch */
-                              nimages--;  /* if duplicate found, decrement the number of images */
-                          } /* end if */
-                     } /* end if */
-                } /* end for */
-      } /* end for */
+                                          if(img_info[i].grp_tag==DFTAG_RIG)
+                                              img_info[j].aux_ref=img_info[i].grp_ref;
+                                      } /* end else */
+                                  } /* end else */
+                                  break;
+
+                              case DFTAG_RI8:
+                              case DFTAG_CI8:
+                              case DFTAG_II8: /* Eldest style raster image, no grouping */
+                                  if(img_info[j].img_tag!=DFTAG_RI8 && img_info[j].img_tag!=DFTAG_CI8 && img_info[j].img_tag!=DFTAG_II8)
+                                      img_info[i].img_tag=DFTAG_NULL;
+                                  else
+                                      img_info[j].img_tag=DFTAG_NULL;
+                                  break;
+
+                              default:
+                                  /* an image which was eliminated from the list of images */
+                                  break;
+                            } /* end switch */
+                        } /* end if */
+                    } /* end if */
+            } /* end for */
+    } /* end for go through the images looking for duplicates */
 
     /* Ok, now sort through the file for information about each image found */
     for(i=0; i<curr_image; i++)
-      {
-          if(img_info[i].img_tag!=DFTAG_NULL)
+    {
+        if(img_info[i].img_tag!=DFTAG_NULL)
+        {
+            switch(img_info[i].grp_tag)
             {
-              switch(img_info[i].grp_tag) {
-                  case DFTAG_VG: /* New style raster image, found in a Vgroup */
+              case DFTAG_VG: /* New style raster image, found in a Vgroup */
+              {
+                  ri_info_t *new_image; /* ptr to the image to read in */
+                  int32 img_key;            /* Vgroup key of an image */
+                  int32 img_tag,img_ref;    /* image tag/ref in the Vgroup */
+                  char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                  uint8 ntstring[4];        /* buffer to store NT info */
+                  uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+
+                  if((img_key=Vattach(file_id,(int32)img_info[i].grp_ref,"r"))!=FAIL)
+                  {
+                      uint16 name_len;
+                      if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
                       {
-                          ri_info_t *new_image; /* ptr to the image to read in */
-                          int32 img_key;            /* Vgroup key of an image */
-                          int32 img_tag,img_ref;    /* image tag/ref in the Vgroup */
-                          char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
-                          uint8 ntstring[4];        /* buffer to store NT info */
-                          uint8 GRtbuf[64];         /* local buffer for reading RIG info */
-
-                          if((img_key=Vattach(file_id,(int32)img_info[i].grp_ref,"r"))!=FAIL)
-                            {
-        uint16 name_len;
-                                if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
-                                  {
-                                    HDfree(img_info);   /* free offsets */
-                                    Hclose(file_id);
-                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                  } /* end if */
+                          HDfree(img_info);   /* free offsets */
+                          Hclose(file_id);
+                          HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                      } /* end if */
 
-                                /* Initialize all the fields in the image structure to zeros */
-                                HDmemset(new_image,0,sizeof(ri_info_t));
+                      /* Initialize all the fields in the image structure to zeros */
+                      HDmemset(new_image,0,sizeof(ri_info_t));
 
-                                /* Get the name of the image */
-        if(Vgetnamelen(img_key,&name_len)==FAIL)
-            name_len = 20; /* for "Raster Image #%d" */
-                                if((new_image->name=(char *)HDmalloc(name_len+1))==NULL)
-                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                if(Vgetname(img_key,new_image->name)==FAIL)
-                                    sprintf(new_image->name,"Raster Image #%d",(int)i);
-
-                                /* Initialize the local attribute tree */
-                                new_image->lattr_count = 0;
-                                new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
-                                if (new_image->lattree == NULL)
-                                    HGOTO_ERROR(DFE_NOSPACE, FAIL);
-                                new_image->ri_ref=img_info[i].grp_ref;
-                                if(img_info[i].aux_ref!=0)
-                                    new_image->rig_ref=img_info[i].aux_ref;
+                      /* Get the name of the image */
+                      if(Vgetnamelen(img_key,&name_len)==FAIL)
+                          name_len = 20; /* for "Raster Image #%d" */
+                      if((new_image->name=(char *)HDmalloc(name_len+1))==NULL)
+                          HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                      if(Vgetname(img_key,new_image->name)==FAIL)
+                          sprintf(new_image->name,"Raster Image #%d",(int)i);
+
+                      /* Initialize the local attribute tree */
+                      new_image->lattr_count = 0;
+                      new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+                      if (new_image->lattree == NULL)
+                          HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                      new_image->ri_ref=img_info[i].grp_ref;
+                      if(img_info[i].aux_ref!=0)
+                          new_image->rig_ref=img_info[i].aux_ref;
+                      else
+                          new_image->rig_ref=DFREF_WILDCARD;
+
+                      for(j=0; j<Vntagrefs(img_key); j++)
+                      {
+                          if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
+                              continue;
+
+                          /* parse this tag/ref pair */
+                          switch(img_tag)
+                          {
+                            case DFTAG_RI:    /* Regular image data */
+                                new_image->img_tag=(uint16)img_tag;
+                                new_image->img_ref=(uint16)img_ref;
+                                if(SPECIALTAG(new_image->img_tag)==TRUE)
+                                {
+                                    new_image->use_buf_drvr=1;
+                                }
+                                break;
+
+                            case DFTAG_CI:    /* Compressed image data */
+                                new_image->img_tag=(uint16)img_tag;
+                                new_image->img_ref=(uint16)img_ref;
+                                new_image->use_buf_drvr=1;
+                                new_image->use_cr_drvr=1;
+                                break;
+
+                            case DFTAG_LUT:   /* Palette */
+                                new_image->lut_tag=(uint16)img_tag;
+                                new_image->lut_ref=(uint16)img_ref;
+
+                                /* Fill in some default palette dimension info, in case there isn't a DFTAG_LD for this palette */
+                                if(new_image->lut_dim.dim_ref==0)
+				    Init_diminfo(&(new_image->lut_dim));
+                                break;
+
+                            case DFTAG_LD:    /* Palette dimensions */
+{
+                                uint8 *p = GRtbuf;
+                                if (Hgetelement(file_id, (uint16)img_tag, (uint16)img_ref, GRtbuf) != FAIL)
+				    Decode_diminfo(p, &(new_image->lut_dim));
                                 else
-                                    new_image->rig_ref=DFREF_WILDCARD;
+                                    HGOTO_ERROR(DFE_READERROR, FAIL);
 
-                                for(j=0; j<Vntagrefs(img_key); j++)
-                                  {
-                                      if(Vgettagref(img_key,j,&img_tag,&img_ref)==FAIL)
-                                          continue;
-
-                                      /* parse this tag/ref pair */
-                                      switch(img_tag) {
-                                          case DFTAG_RI:    /* Regular image data */
-                                              new_image->img_tag=(uint16)img_tag;
-                                              new_image->img_ref=(uint16)img_ref;
- /*  fprintf(stderr, "SPECIALTAG(%d/%d) = %d\n", new_image->img_tag, new_image->img_ref, SPECIALTAG(new_image->img_tag));
- */ 
-                                              if(SPECIALTAG(new_image->img_tag)==TRUE) {
-                                                  new_image->use_buf_drvr=1;
-                                              } /* end if */
-                                              break;
-
-                                          case DFTAG_CI:    /* Compressed image data */
-                                              new_image->img_tag=(uint16)img_tag;
-                                              new_image->img_ref=(uint16)img_ref;
-                                              new_image->use_buf_drvr=1;
-                                              new_image->use_cr_drvr=1;
-                                              break;
-
-                                          case DFTAG_LUT:   /* Palette */
-                                              new_image->lut_tag=(uint16)img_tag;
-                                              new_image->lut_ref=(uint16)img_ref;
-
-                                              /* Fill in some default palette dimension info, in case there isn't a DFTAG_LD for this palette */
-                                              if(new_image->lut_dim.dim_ref==0)
-                                                {
-                                                  new_image->lut_dim.dim_ref = DFREF_WILDCARD;
-                                                  new_image->lut_dim.xdim=256;
-                                                  new_image->lut_dim.ydim=1;
-                                                  new_image->lut_dim.ncomps=3;
-                                                  new_image->lut_dim.nt=DFNT_UINT8;
-                                                  new_image->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
-                                                  new_image->lut_dim.il=MFGR_INTERLACE_PIXEL;
-                                                  new_image->lut_dim.nt_tag=DFTAG_NULL;
-                                                  new_image->lut_dim.nt_ref=DFREF_WILDCARD;
-                                                  new_image->lut_dim.comp_tag=DFTAG_NULL;
-                                                  new_image->lut_dim.comp_ref=DFREF_WILDCARD;
-                                                } /* end if */
-                                              break;
-
-                                          case DFTAG_LD:    /* Palette dimensions */
-                                              if (Hgetelement(file_id, (uint16)img_tag, (uint16)img_ref, GRtbuf) != FAIL)
-                                                {
-                                                    int16       int16var;
-                                                    uint8      *p;
-
-                                                    p = GRtbuf;
-                                                    INT32DECODE(p, new_image->lut_dim.xdim);
-                                                    INT32DECODE(p, new_image->lut_dim.ydim);
-                                                    UINT16DECODE(p, new_image->lut_dim.nt_tag);
-                                                    UINT16DECODE(p, new_image->lut_dim.nt_ref);
-                                                    INT16DECODE(p, int16var);
-                                                    new_image->lut_dim.ncomps=(int32)int16var;
-                                                    INT16DECODE(p, new_image->lut_dim.il);
-                                                    UINT16DECODE(p, new_image->lut_dim.comp_tag);
-                                                    UINT16DECODE(p, new_image->lut_dim.comp_ref);
-                                                }
-                                              else
-                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
-                                               
-                                               /* read NT */
-                                              if (Hgetelement(file_id, new_image->lut_dim.nt_tag, new_image->lut_dim.nt_ref, ntstring) == FAIL)
-                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
-
-                                              /* check for any valid NT */
-                                              if (ntstring[1] == DFNT_NONE)
-                                                  break;
-                                              
-                                              /* set NT info */
-                                              new_image->lut_dim.dim_ref = (uint16)img_ref;
-                                              new_image->lut_dim.nt = (int32)ntstring[1];
-                                              new_image->lut_dim.file_nt_subclass = (int32)ntstring[3];
-                                              if ((new_image->lut_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
-                                                    && (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)
-                                                    && (new_image->lut_dim.file_nt_subclass!= DFKgetPNSC(new_image->lut_dim.nt, DF_MT)))
-                                                  break; /* unknown subclass */
-                                              if (new_image->lut_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
-                                                {     /* if native or little endian */
-                                                    if (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)   /* native */
-                                                        new_image->lut_dim.nt |= DFNT_NATIVE;
-                                                    else  /* little endian */
-                                                        new_image->lut_dim.nt |= DFNT_LITEND;
-                                                }     /* end if */
-                                              break;
-
-                                          case DFTAG_ID:    /* Image description info */
-                                              if (Hgetelement(file_id, (uint16)img_tag, (uint16)img_ref, GRtbuf) != FAIL)
-                                                {
-                                                    int16       int16var;
-                                                    uint8      *p;
-
-                                                    p = GRtbuf;
-                                                    INT32DECODE(p, new_image->img_dim.xdim);
-                                                    INT32DECODE(p, new_image->img_dim.ydim);
-                                                    UINT16DECODE(p, new_image->img_dim.nt_tag);
-                                                    UINT16DECODE(p, new_image->img_dim.nt_ref);
-                                                    INT16DECODE(p, int16var);
-                                                    new_image->img_dim.ncomps=(int32)int16var;
-                                                    INT16DECODE(p, new_image->img_dim.il);
-                                                    UINT16DECODE(p, new_image->img_dim.comp_tag);
-                                                    UINT16DECODE(p, new_image->img_dim.comp_ref);
-                                                }
-                                              else
-                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
-                                               
-                                               /* read NT */
-                                              if (Hgetelement(file_id, new_image->img_dim.nt_tag, new_image->img_dim.nt_ref, ntstring) == FAIL)
-                                                  HGOTO_ERROR(DFE_READERROR, FAIL);
-
-                                              /* check for any valid NT */
-                                              if (ntstring[1] == DFNT_NONE)
-                                                  break;
-                                              
-                                              /* set NT info */
-                                              new_image->img_dim.dim_ref=(uint16)img_ref;
-                                              new_image->img_dim.nt = (int32)ntstring[1];
-                                              new_image->img_dim.file_nt_subclass = (int32)ntstring[3];
-                                              if ((new_image->img_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
-                                                    && (new_image->img_dim.file_nt_subclass!= DFNTF_PC)
-                                                    && (new_image->img_dim.file_nt_subclass!= DFKgetPNSC(new_image->img_dim.nt, DF_MT)))
-                                                  break; /* unknown subclass */
-                                              if (new_image->img_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
-                                                {     /* if native or little endian */
-                                                    if (new_image->img_dim.file_nt_subclass!= DFNTF_PC)   /* native */
-                                                        new_image->img_dim.nt |= DFNT_NATIVE;
-                                                    else  /* little endian */
-                                                        new_image->img_dim.nt |= DFNT_LITEND;
-                                                }     /* end if */
-                                              break;
-
-                                          case DFTAG_VH:    /* Attribute information */
-                                              {
-                                                  at_info_t *new_attr;  /* attribute to add to the set of local attributes */
-                                                  int32 at_key;         /* VData key for the attribute */
-
-                                                  if((new_attr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
-                                                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                                  new_attr->ref=(uint16)img_ref;
-                                                  new_attr->index=new_image->lattr_count;
-                                                  new_attr->data_modified=FALSE;
-                                                  new_attr->new_at=FALSE;
-                                                  new_attr->data=NULL;
-                                                  if((at_key=VSattach(file_id,(int32)img_ref,"r"))!=FAIL)
-                                                    {
-                                                        char *fname;
-
-                                                        /* Make certain the attribute only has one field */
-                                                        if(VFnfields(at_key)!=1)
-                                                          {
-                                                            VSdetach(at_key);
-                                                            HDfree(new_attr);
-                                                            break;
-                                                          } /* end if */
-                                                        new_attr->nt=VFfieldtype(at_key,0);
-                                                        new_attr->len=VFfieldorder(at_key,0);
-                                                        if(new_attr->len==1)
-                                                            new_attr->len=VSelts(at_key);
-
-                                                        /* Get the name of the attribute */
-                                                        if((fname=VFfieldname(at_key,0))==NULL)
-                                                          {
-                                                            sprintf(textbuf,"Attribute #%d",(int)new_attr->index);
-                                                            if((new_attr->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
-                                                              {
-                                                                VSdetach(at_key);
-                                                                HDfree(new_attr);
-                                                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                                              } /* end if */
-                                                            HDstrcpy(new_attr->name,textbuf);
-                                                          } /* end if */
-                                                        else
-                                                          {
-                                                            if((new_attr->name=(char *)HDmalloc(HDstrlen(fname)+1))==NULL)
-                                                              {
-                                                                VSdetach(at_key);
-                                                                HDfree(new_attr);
-                                                                HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                                                              } /* end if */
-                                                            HDstrcpy(new_attr->name,fname);
-                                                          } /* end else */
-                                                
-                                                        tbbtdins(new_image->lattree, new_attr, NULL);    /* insert the attr instance in B-tree */ 
+                                /* read NT */
+                                if (Hgetelement(file_id, new_image->lut_dim.nt_tag, new_image->lut_dim.nt_ref, ntstring) == FAIL)
+                                    HGOTO_ERROR(DFE_READERROR, FAIL);
 
-                                                        VSdetach(at_key);
-                                                    } /* end if */
+                                /* check for any valid NT */
+                                if (ntstring[1] == DFNT_NONE)
+                                    break;
 
-                                                  new_image->lattr_count++;
-                                              } /* end case */
-                                              break;
+                                /* set NT info */
+                                new_image->lut_dim.dim_ref = (uint16)img_ref;
+                                new_image->lut_dim.nt = (int32)ntstring[1];
+                                new_image->lut_dim.file_nt_subclass = (int32)ntstring[3];
+                                if ((new_image->lut_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                    && (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)
+                                    && (new_image->lut_dim.file_nt_subclass!= DFKgetPNSC(new_image->lut_dim.nt, DF_MT)))
+                                    break; /* unknown subclass */
+                                if (new_image->lut_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                                {     /* if native or little endian */
+                                    if (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                        new_image->lut_dim.nt |= DFNT_NATIVE;
+                                    else  /* little endian */
+                                        new_image->lut_dim.nt |= DFNT_LITEND;
+                                }     /* end if */
+}
+                                break;
 
-                                          default:          /* Unknown tag */
-                                              break;
-                                        } /* end switch */
-                                  } /* end for */
-                              new_image->index=gr_ptr->gr_count;
-                              new_image->gr_ptr=gr_ptr; /* point up the tree */
-                              tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
-                              gr_ptr->gr_count++;
-                              Vdetach(img_key);
-                            } /* end if */
-                      } /* end case */
-                      break;
+                            case DFTAG_ID:    /* Image description info */
+                            {
+                                uint8 *p = GRtbuf;
+                                at_info_t *new_attr;  /* attr to add to the local attr set */
+                                if (Hgetelement(file_id, (uint16)img_tag, (uint16)img_ref, GRtbuf) != FAIL)
+				    Decode_diminfo(p, &(new_image->img_dim));
+                                else
+                                    HGOTO_ERROR(DFE_READERROR, FAIL);
 
-                  case DFTAG_RIG:   /* Older style raster image, found in RIG */
-                      {
-                          int32       GroupID;
-                          uint16      elt_tag, elt_ref;
-                          ri_info_t *new_image; /* ptr to the image to read in */
-                          char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
-                          uint8 ntstring[4];        /* buffer to store NT info */
-                          uint8 GRtbuf[64];         /* local buffer for reading RIG info */
-
-                          /* read RIG into memory */
-                          if ((GroupID = DFdiread(file_id, DFTAG_RIG, img_info[i].grp_ref)) == FAIL)
-                              HGOTO_ERROR(DFE_READERROR, FAIL);
-
-                          if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+                                /* read NT */
+                                if (Hgetelement(file_id, new_image->img_dim.nt_tag, new_image->img_dim.nt_ref, ntstring) == FAIL)
+                                    HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                                /* check for any valid NT */
+                                if (ntstring[1] == DFNT_NONE)
+                                    break;
+
+                                /* set NT info */
+                                new_image->img_dim.dim_ref=(uint16)img_ref;
+                                new_image->img_dim.nt = (int32)ntstring[1];
+                                new_image->img_dim.file_nt_subclass = (int32)ntstring[3];
+                                if ((new_image->img_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                    && (new_image->img_dim.file_nt_subclass!= DFNTF_PC)
+                                    && (new_image->img_dim.file_nt_subclass!= DFKgetPNSC(new_image->img_dim.nt, DF_MT)))
+                                    break; /* unknown subclass */
+                                if (new_image->img_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                                {     /* if native or little endian */
+                                    if (new_image->img_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                        new_image->img_dim.nt |= DFNT_NATIVE;
+                                    else  /* little endian */
+                                        new_image->img_dim.nt |= DFNT_LITEND;
+                                }     /* end if */
+                            } /* end case DFTAG_ID */
+
+                            case DFTAG_VH:    /* Attribute information */
                             {
-                              HDfree(img_info);   /* free offsets */
-                              Hclose(file_id);
-                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                            } /* end if */
+                                at_info_t *new_attr;  /* attr to add to the local attr set */
+                                int32 at_key;         /* VData key for the attribute */
 
-                          /* Initialize all the fields in the image structure to zeros */
-                          HDmemset(new_image,0,sizeof(ri_info_t));
+                                if((new_attr=(at_info_t *)HDmalloc(sizeof(at_info_t)))==NULL)
+                                    HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                new_attr->ref=(uint16)img_ref;
+                                new_attr->index=new_image->lattr_count;
+                                new_attr->data_modified=FALSE;
+                                new_attr->new_at=FALSE;
+                                new_attr->data=NULL;
+                                if((at_key=VSattach(file_id,(int32)img_ref,"r"))!=FAIL)
+                                {
+                                    char *fname;
+
+                                    /* Make certain the attribute only has one field */
+                                    if(VFnfields(at_key)!=1)
+                                    {
+                                        VSdetach(at_key);
+                                        HDfree(new_attr);
+                                        break;
+                                    } /* end if */
+                                    new_attr->nt=VFfieldtype(at_key,0);
+                                    new_attr->len=VFfieldorder(at_key,0);
+                                    if(new_attr->len==1)
+                                        new_attr->len=VSelts(at_key);
+
+                                    /* Get the name of the attribute */
+                                    if((fname=VFfieldname(at_key,0))==NULL)
+                                    {
+                                        sprintf(textbuf,"Attribute #%d",(int)new_attr->index);
+                                        if((new_attr->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                                        {
+                                            VSdetach(at_key);
+                                            HDfree(new_attr);
+                                            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                        } /* end if */
+                                        HDstrcpy(new_attr->name,textbuf);
+                                    } /* end if */
+                                    else
+                                    {
+                                        if((new_attr->name=(char *)HDmalloc(HDstrlen(fname)+1))==NULL)
+                                        {
+                                            VSdetach(at_key);
+                                            HDfree(new_attr);
+                                            HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                                        } /* end if */
+                                        HDstrcpy(new_attr->name,fname);
+                                    } /* end else */
+                                                
+                                    tbbtdins(new_image->lattree, new_attr, NULL);    /* insert the attr instance in B-tree */ 
 
-                          /* Get the name of the image */
-                          sprintf(textbuf,"Raster Image #%d",(int)i);
-                          if((new_image->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
-                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                          HDstrcpy(new_image->name,textbuf);
-        new_image->name_generated = TRUE;
-
-                          /* Initialize the local attribute tree */
-                          new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
-                          if (new_image->lattree == NULL)
-                              HGOTO_ERROR(DFE_NOSPACE, FAIL);
-                          new_image->ri_ref=DFREF_WILDCARD;
-                          new_image->rig_ref=img_info[i].grp_ref;
-
-                          while (DFdiget(GroupID, &elt_tag, &elt_ref)!=FAIL)
-                            {     /* get next tag/ref */
-                                switch (elt_tag)
-                                  {   /* process tag/ref */
-                                      case DFTAG_RI:    /* regular image data */
-                                          new_image->img_tag=elt_tag;
-                                          new_image->img_ref=elt_ref;
-                                          if(SPECIALTAG(new_image->img_tag)==TRUE) {
-                                              new_image->use_buf_drvr=1;
-                                          } /* end if */
-                                          break;
-
-                                      case DFTAG_CI:    /* compressed image data */
-                                          new_image->img_tag=elt_tag;
-                                          new_image->img_ref=elt_ref;
-                                          new_image->use_buf_drvr=1;
-                                          new_image->use_cr_drvr=1;
-                                          break;
-
-                                      case DFTAG_LUT:   /* Palette */
-                                          new_image->lut_tag=elt_tag;
-                                          new_image->lut_ref=elt_ref;
-
-                                          /* Fill in some default palette dimension info, in case there isn't a DFTAG_LD for this palette */
-                                          if(new_image->lut_dim.dim_ref==0)
-                                            {
-                                              new_image->lut_dim.dim_ref = DFREF_WILDCARD;
-                                              new_image->lut_dim.xdim=256;
-                                              new_image->lut_dim.ydim=1;
-                                              new_image->lut_dim.ncomps=3;
-                                              new_image->lut_dim.nt=DFNT_UINT8;
-                                              new_image->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
-                                              new_image->lut_dim.il=MFGR_INTERLACE_PIXEL;
-                                              new_image->lut_dim.nt_tag=DFTAG_NULL;
-                                              new_image->lut_dim.nt_ref=DFREF_WILDCARD;
-                                              new_image->lut_dim.comp_tag=DFTAG_NULL;
-                                              new_image->lut_dim.comp_ref=DFREF_WILDCARD;
-                                            } /* end if */
-                                          break;
-
-                                      case DFTAG_LD:    /* Palette dimensions */
-                                          if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
-                                            {
-                                                int16       int16var;
-                                                uint8      *p;
-
-                                                p = GRtbuf;
-                                                INT32DECODE(p, new_image->lut_dim.xdim);
-                                                INT32DECODE(p, new_image->lut_dim.ydim);
-                                                UINT16DECODE(p, new_image->lut_dim.nt_tag);
-                                                UINT16DECODE(p, new_image->lut_dim.nt_ref);
-                                                INT16DECODE(p, int16var);
-                                                new_image->lut_dim.ncomps=(int32)int16var;
-                                                INT16DECODE(p, new_image->lut_dim.il);
-                                                UINT16DECODE(p, new_image->lut_dim.comp_tag);
-                                                UINT16DECODE(p, new_image->lut_dim.comp_ref);
-                                            }
-                                          else
-                                            {
-                        DFdifree( GroupID );
-                                              HGOTO_ERROR(DFE_READERROR, FAIL);
-                                            }
-                                               
-                                           /* read NT */
-                                          if (Hgetelement(file_id, new_image->lut_dim.nt_tag, new_image->lut_dim.nt_ref, ntstring) == FAIL)
-                                            {
-                        DFdifree( GroupID );
-                                              HGOTO_ERROR(DFE_READERROR, FAIL);
-                                            }
-
-                                          /* check for any valid NT */
-                                          if (ntstring[1] == DFNT_NONE)
-                                              break;
-                                              
-                                          /* set NT info */
-                                          new_image->lut_dim.dim_ref = elt_ref;
-                                          new_image->lut_dim.nt = (int32)ntstring[1];
-                                          new_image->lut_dim.file_nt_subclass = (int32)ntstring[3];
-                                          if ((new_image->lut_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
-                                                && (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)
-                                                && (new_image->lut_dim.file_nt_subclass!= DFKgetPNSC(new_image->lut_dim.nt, DF_MT)))
-                                              break; /* unknown subclass */
-                                          if (new_image->lut_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
-                                            {     /* if native or little endian */
-                                                if (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)   /* native */
-                                                    new_image->lut_dim.nt |= DFNT_NATIVE;
-                                                else  /* little endian */
-                                                    new_image->lut_dim.nt |= DFNT_LITEND;
-                                            }     /* end if */
-                                          break;
-
-                                        case DFTAG_ID:    /* Image description info */
-                                            if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
-                                              {
-                                                  int16       int16var;
-                                                  uint8      *p;
-
-                                                  p = GRtbuf;
-                                                  INT32DECODE(p, new_image->img_dim.xdim);
-                                                  INT32DECODE(p, new_image->img_dim.ydim);
-                                                  UINT16DECODE(p, new_image->img_dim.nt_tag);
-                                                  UINT16DECODE(p, new_image->img_dim.nt_ref);
-                                                  INT16DECODE(p, int16var);
-                                                  new_image->img_dim.ncomps=(int32)int16var;
-                                                  INT16DECODE(p, new_image->img_dim.il);
-                                                  UINT16DECODE(p, new_image->img_dim.comp_tag);
-                                                  UINT16DECODE(p, new_image->img_dim.comp_ref);
-                                              }
-                                            else
-                                              {
-                          DFdifree( GroupID );
-                                                HGOTO_ERROR(DFE_GETELEM, FAIL);
-                                              }
-                                               
-                                             /* read NT */
-                                            if (Hgetelement(file_id, new_image->img_dim.nt_tag, new_image->img_dim.nt_ref, ntstring) == FAIL)
-                                              {
-                          DFdifree( GroupID );
-                                                HGOTO_ERROR(DFE_GETELEM, FAIL);
-                                              }
-
-                                            /* check for any valid NT */
-                                            if (ntstring[1] == DFNT_NONE)
-                                                break;
-                                              
-                                            /* set NT info */
-                                            new_image->img_dim.dim_ref=elt_ref;
-                                            new_image->img_dim.nt = (int32)ntstring[1];
-                                            new_image->img_dim.file_nt_subclass = (int32)ntstring[3];
-                                            if ((new_image->img_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
-                                                  && (new_image->img_dim.file_nt_subclass!= DFNTF_PC)
-                                                  && (new_image->img_dim.file_nt_subclass!= DFKgetPNSC(new_image->img_dim.nt, DF_MT)))
-                                                break; /* unknown subclass */
-                                            if (new_image->img_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
-                                              {     /* if native or little endian */
-                                                  if (new_image->img_dim.file_nt_subclass!= DFNTF_PC)   /* native */
-                                                      new_image->img_dim.nt |= DFNT_NATIVE;
-                                                  else  /* little endian */
-                                                      new_image->img_dim.nt |= DFNT_LITEND;
-                                              }     /* end if */
-                                            break;
+                                    VSdetach(at_key);
+                                } /* end if */
 
-                                      default:    /* ignore unknown tags */
-                                          break;
-                                  } /* end switch */
-                            } /* end while */
-                        new_image->index=gr_ptr->gr_count;
-                        new_image->gr_ptr=gr_ptr; /* point up the tree */
-                        tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
-                        gr_ptr->gr_count++;
-                      } /* end case */
-                      break;
-
-                  case DFTAG_NULL:  /* Eldest style raster image, no grouping */
-                      {
-                          ri_info_t *new_image; /* ptr to the image to read in */
-                          char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
-                          uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+                                new_image->lattr_count++;
 
-                          if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
-                            {
-                              HDfree(img_info);   /* free offsets */
-                              Hclose(file_id);
-                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                            } /* end if */
+                                break;
+                            } /* end case DFTAG_VH */
 
-                          /* Initialize all the fields in the image structure to zeros */
-                          HDmemset(new_image,0,sizeof(ri_info_t));
+                            default:          /* Unknown tag */
+                                break;
+                          } /* end switch */
+                      } /* end for */
 
-                          /* Get the name of the image */
-                          sprintf(textbuf,"Raster Image #%d",(int)i);
-                          if((new_image->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
-                              HGOTO_ERROR(DFE_NOSPACE,FAIL);
-                          HDstrcpy(new_image->name,textbuf);
-        new_image->name_generated = TRUE;
-
-                          /* Initialize the local attribute tree */
-                          new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
-                          if (new_image->lattree == NULL)
-                              HGOTO_ERROR(DFE_NOSPACE, FAIL);
-                          new_image->ri_ref=DFREF_WILDCARD;
-                          new_image->rig_ref=DFREF_WILDCARD;
+                      new_image->index=gr_ptr->gr_count;
+                      new_image->gr_ptr=gr_ptr; /* point up the tree */
+                      tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
+                      gr_ptr->gr_count++;
+                      Vdetach(img_key);
+                  } /* end if */
+              } /* end case DFTAG_VG */
+              break;
+
+              case DFTAG_RIG:   /* Older style raster image, found in RIG */
+              {
+                  int32       GroupID;
+                  uint16      elt_tag, elt_ref;
+                  ri_info_t *new_image; /* ptr to the image to read in */
+                  char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                  uint8 ntstring[4];        /* buffer to store NT info */
+                  uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+
+                  /* read RIG into memory */
+                  if ((GroupID = DFdiread(file_id, DFTAG_RIG, img_info[i].grp_ref)) == FAIL)
+                      HGOTO_ERROR(DFE_READERROR, FAIL);
+
+                  if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+                  {
+                      HDfree(img_info);   /* free offsets */
+                      Hclose(file_id);
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                  } /* end if */
 
-                          /* Get tag/ref for image */
-                          new_image->img_tag=img_info[i].img_tag;
-                          new_image->img_ref=img_info[i].img_ref;
+                  /* Initialize all the fields in the image structure to zeros */
+                  HDmemset(new_image,0,sizeof(ri_info_t));
 
-                          /* Get dimension information */
-                          if (Hgetelement(file_id, DFTAG_ID8, new_image->img_ref, GRtbuf) != FAIL)
+                  /* Get the name of the image */
+                  sprintf(textbuf,"Raster Image #%d",(int)i);
+                  if((new_image->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                  HDstrcpy(new_image->name,textbuf);
+                  new_image->name_generated = TRUE;
+
+                  /* Initialize the local attribute tree */
+                  new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+                  if (new_image->lattree == NULL)
+                      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                  new_image->ri_ref=DFREF_WILDCARD;
+                  new_image->rig_ref=img_info[i].grp_ref;
+
+                  while (DFdiget(GroupID, &elt_tag, &elt_ref)!=FAIL)
+                  {     /* get next tag/ref */
+                      switch (elt_tag)
+                      {   /* process tag/ref */
+                        case DFTAG_RI:    /* regular image data */
+                            new_image->img_tag=elt_tag;
+                            new_image->img_ref=elt_ref;
+                            if(SPECIALTAG(new_image->img_tag)==TRUE)
                             {
-                                uint8      *p;
-                                uint16      u;
-
-                                p = GRtbuf;
-                                UINT16DECODE(p, u);
-                                new_image->img_dim.xdim=(int32)u;
-                                UINT16DECODE(p, u);
-                                new_image->img_dim.ydim=(int32)u;
-                            }   /* end if */
-                          else
-                              HGOTO_ERROR(DFE_GETELEM, FAIL);
-
-                          /* only 8-bit images, so fill in rest of dim info */
-                          new_image->img_dim.dim_ref=DFREF_WILDCARD;
-                          new_image->img_dim.ncomps=1;
-                          new_image->img_dim.nt=DFNT_UINT8;
-                          new_image->img_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
-                          new_image->img_dim.il=MFGR_INTERLACE_PIXEL;
-                          new_image->img_dim.nt_tag=DFTAG_NULL;
-                          new_image->img_dim.nt_ref=DFREF_WILDCARD;
-                          new_image->img_dim.comp_tag=DFTAG_NULL;
-                          new_image->img_dim.comp_ref=DFREF_WILDCARD;
-
-                          /* Get palette information */
-                          if(Hexist(file_id, DFTAG_IP8, new_image->img_ref)==SUCCEED)
+                                new_image->use_buf_drvr=1;
+                            } /* end if */
+                            break;
+
+                        case DFTAG_CI:    /* compressed image data */
+                            new_image->img_tag=elt_tag;
+                            new_image->img_ref=elt_ref;
+                            new_image->use_buf_drvr=1;
+                            new_image->use_cr_drvr=1;
+                            break;
+
+                        case DFTAG_LUT:   /* Palette */
+                            new_image->lut_tag=elt_tag;
+                            new_image->lut_ref=elt_ref;
+
+                            /* Fill in some default palette dimension info, in
+			       case there isn't a DFTAG_LD for this palette */
+                            if(new_image->lut_dim.dim_ref==0)
                             {
-                                new_image->lut_tag=DFTAG_IP8;
-                                new_image->lut_ref=new_image->img_ref;
-
-                                /* set palette dimensions too */
-                                new_image->lut_dim.dim_ref = DFREF_WILDCARD;
-                                new_image->lut_dim.xdim=256;
-                                new_image->lut_dim.ydim=1;
-                                new_image->lut_dim.ncomps=3;
-                                new_image->lut_dim.nt=DFNT_UINT8;
-                                new_image->lut_dim.file_nt_subclass=DFNTF_HDFDEFAULT;
-                                new_image->lut_dim.il=MFGR_INTERLACE_PIXEL;
-                                new_image->lut_dim.nt_tag=DFTAG_NULL;
-                                new_image->lut_dim.nt_ref=DFREF_WILDCARD;
-                                new_image->lut_dim.comp_tag=DFTAG_NULL;
-                                new_image->lut_dim.comp_ref=DFREF_WILDCARD;
+				    Init_diminfo(&(new_image->lut_dim));
                             } /* end if */
-                          else
-                                new_image->lut_tag=new_image->lut_ref=DFREF_WILDCARD;
+                            break;
 
-                        new_image->index=gr_ptr->gr_count;
-                        new_image->gr_ptr=gr_ptr; /* point up the tree */
-                        tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
-                        gr_ptr->gr_count++;
-                      } /* end case */
-                      break;
+                        case DFTAG_LD:    /* Palette dimensions */
+{
+                            uint8 *p = GRtbuf;
+                            if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+				Decode_diminfo(p, &(new_image->lut_dim));
+                            else
+                            {
+                                DFdifree(GroupID);
+                                HGOTO_ERROR(DFE_READERROR, FAIL);
+                            }
 
-                  default: /* an image which was eliminated from the list of images */
-                    break;
-                } /* end switch */
-            } /* end if */
-      } /* end for */
+                            /* read NT */
+                            if (Hgetelement(file_id, new_image->lut_dim.nt_tag, new_image->lut_dim.nt_ref, ntstring) == FAIL)
+                            {
+                                DFdifree( GroupID );
+                                HGOTO_ERROR(DFE_READERROR, FAIL);
+                            }
+
+                            /* check for any valid NT */
+                            if (ntstring[1] == DFNT_NONE)
+                                break;
+                                              
+                            /* set NT info */
+                            new_image->lut_dim.dim_ref = elt_ref;
+                            new_image->lut_dim.nt = (int32)ntstring[1];
+                            new_image->lut_dim.file_nt_subclass = (int32)ntstring[3];
+                            if ((new_image->lut_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                && (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)
+                                && (new_image->lut_dim.file_nt_subclass!= DFKgetPNSC(new_image->lut_dim.nt, DF_MT)))
+                                break; /* unknown subclass */
+                            if (new_image->lut_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                            {     /* if native or little endian */
+                                if (new_image->lut_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                    new_image->lut_dim.nt |= DFNT_NATIVE;
+                                else  /* little endian */
+                                    new_image->lut_dim.nt |= DFNT_LITEND;
+                            }     /* end if */
+                            break;
+}
+                        case DFTAG_ID:    /* Image description info */
+                          {
+                            uint8 *p = GRtbuf;
+                            if (Hgetelement(file_id, elt_tag, elt_ref, GRtbuf) != FAIL)
+				Decode_diminfo(p, &(new_image->img_dim));
+                            else
+                            {
+                                DFdifree( GroupID );
+                                HGOTO_ERROR(DFE_GETELEM, FAIL);
+                            }
+
+                            /* read NT */
+                            if (Hgetelement(file_id, new_image->img_dim.nt_tag, new_image->img_dim.nt_ref, ntstring) == FAIL)
+                            {
+                                DFdifree( GroupID );
+                                HGOTO_ERROR(DFE_GETELEM, FAIL);
+                            }
+
+                            /* check for any valid NT */
+                            if (ntstring[1] == DFNT_NONE)
+                                break;
+
+                            /* set NT info */
+                            new_image->img_dim.dim_ref=elt_ref;
+                            new_image->img_dim.nt = (int32)ntstring[1];
+                            new_image->img_dim.file_nt_subclass = (int32)ntstring[3];
+                            if ((new_image->img_dim.file_nt_subclass != DFNTF_HDFDEFAULT)
+                                && (new_image->img_dim.file_nt_subclass!= DFNTF_PC)
+                                && (new_image->img_dim.file_nt_subclass!= DFKgetPNSC(new_image->img_dim.nt, DF_MT)))
+                                break; /* unknown subclass */
+                            if (new_image->img_dim.file_nt_subclass!= DFNTF_HDFDEFAULT)
+                            {     /* if native or little endian */
+                                if (new_image->img_dim.file_nt_subclass!= DFNTF_PC)   /* native */
+                                    new_image->img_dim.nt |= DFNT_NATIVE;
+                                else  /* little endian */
+                                    new_image->img_dim.nt |= DFNT_LITEND;
+                            }     /* end if */
+                            break;
+                          }
+                        default:    /* ignore unknown tags */
+                            break;
+                      } /* end switch */
+                  } /* end while */
+                  new_image->index=gr_ptr->gr_count;
+                  new_image->gr_ptr=gr_ptr; /* point up the tree */
+                  tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
+                  gr_ptr->gr_count++;
+              } /* end case DFTAG_RIG */
+              break;
+
+              case DFTAG_NULL:  /* Eldest style raster image, no grouping */
+              {
+                  ri_info_t *new_image; /* ptr to the image to read in */
+                  char textbuf[VGNAMELENMAX + 1];    /* buffer to store the name in */
+                  uint8 GRtbuf[64];         /* local buffer for reading RIG info */
+
+                  if((new_image=(ri_info_t *)HDmalloc(sizeof(ri_info_t)))==NULL)
+                  {
+                      HDfree(img_info);   /* free offsets */
+                      Hclose(file_id);
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                  } /* end if */
+
+                  /* Initialize all the fields in the image structure to zeros */
+                  HDmemset(new_image,0,sizeof(ri_info_t));
+
+                  /* Get the name of the image */
+                  sprintf(textbuf,"Raster Image #%d",(int)i);
+                  if((new_image->name=(char *)HDmalloc(HDstrlen(textbuf)+1))==NULL)
+                      HGOTO_ERROR(DFE_NOSPACE,FAIL);
+                  HDstrcpy(new_image->name,textbuf);
+                  new_image->name_generated = TRUE;
+
+                  /* Initialize the local attribute tree */
+                  new_image->lattree = tbbtdmake(rigcompare, sizeof(int32), TBBT_FAST_INT32_COMPARE);
+                  if (new_image->lattree == NULL)
+                      HGOTO_ERROR(DFE_NOSPACE, FAIL);
+                  new_image->ri_ref=DFREF_WILDCARD;
+                  new_image->rig_ref=DFREF_WILDCARD;
+
+                  /* Get tag/ref for image */
+                  new_image->img_tag=img_info[i].img_tag;
+                  new_image->img_ref=img_info[i].img_ref;
+
+                  /* Get dimension information for this 8-bit image */
+
+		  /* Initialize dim info to default */
+		  Init_diminfo(&(new_image->img_dim));
+
+		  /* Reassign valid values */
+                  if (Hgetelement(file_id, DFTAG_ID8, new_image->img_ref, GRtbuf) != FAIL)
+                  {
+                      uint8      *p;
+                      uint16      u;
+
+                      p = GRtbuf;
+                      UINT16DECODE(p, u);
+                      new_image->img_dim.xdim=(int32)u;
+                      UINT16DECODE(p, u);
+                      new_image->img_dim.ydim=(int32)u;
+                      new_image->img_dim.ncomps=1;
+                  }   /* end if */
+                  else
+                      HGOTO_ERROR(DFE_GETELEM, FAIL);
+
+                  /* Get palette information */
+                  if(Hexist(file_id, DFTAG_IP8, new_image->img_ref)==SUCCEED)
+                  {
+                      new_image->lut_tag=DFTAG_IP8;
+                      new_image->lut_ref=new_image->img_ref;
+
+                      /* set palette dimensions too */
+		      Init_diminfo(&(new_image->lut_dim));
+                  } /* end if */
+                  else
+                      new_image->lut_tag=new_image->lut_ref=DFREF_WILDCARD;
+
+                  new_image->index=gr_ptr->gr_count;
+                  new_image->gr_ptr=gr_ptr; /* point up the tree */
+                  tbbtdins(gr_ptr->grtree, new_image, NULL);    /* insert the new image into B-tree */ 
+                  gr_ptr->gr_count++;
+              } /* end case DFTAG_NULL */
+              break;
+
+              default: /* an image which was eliminated from the list of images */
+                  break;
+            } /* end switch */
+        } /* end if */
+    } /* end for */
 
-    HDfree(img_info);   /* free offsets */
+    HDfree(img_info);   /* free image info structures */
 
 done:
   if(ret_value == FAIL)   
diff --git a/hdf/src/mfgrf.c b/hdf/src/mfgrf.c
index 6123210..a03fdce 100644
--- a/hdf/src/mfgrf.c
+++ b/hdf/src/mfgrf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5700 $";
-#endif
-
-/* $Id: mfgrf.c 5700 2011-10-10 04:32:38Z bmribler $ */
+/* $Id: mfgrf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
  * File:    mfsdf.c
diff --git a/hdf/src/mstdio.c b/hdf/src/mstdio.c
index 8306844..5d8ae14 100644
--- a/hdf/src/mstdio.c
+++ b/hdf/src/mstdio.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: mstdio.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: mstdio.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 FILE
diff --git a/hdf/src/tbbt.c b/hdf/src/tbbt.c
index 091c37f..2cc165f 100644
--- a/hdf/src/tbbt.c
+++ b/hdf/src/tbbt.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: tbbt.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: tbbt.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* "tbbt.c" -- Routines for using threaded, balanced, binary trees. */
 /* Extended from (added threads to) Knuth 6.2.3, Algorithm A (AVL trees) */
diff --git a/hdf/src/vattr.c b/hdf/src/vattr.c
index d8c8c82..9c0d9b6 100644
--- a/hdf/src/vattr.c
+++ b/hdf/src/vattr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5899 $";
-#endif
-
-/* $Id: vattr.c 5899 2013-01-09 21:18:13Z bmribler $ */
+/* $Id: vattr.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /**************************************************************
 *
diff --git a/hdf/src/vattr.h b/hdf/src/vattr.h
index 22002e9..7e77a11 100644
--- a/hdf/src/vattr.h
+++ b/hdf/src/vattr.h
@@ -11,16 +11,12 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $ "
-#endif
-
 /***********************************************************
  * vattr.h - vdata/vgroup attribute interface
  *
  ***********************************************************  */
 
-/* $Id: vattr.h 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: vattr.h 6358 2016-05-13 15:12:20Z bmribler $ */
 
 #ifndef _VATTR_H
 #define _VATTR_H
diff --git a/hdf/src/vattrf.c b/hdf/src/vattrf.c
index a9b5add..02795cf 100644
--- a/hdf/src/vattrf.c
+++ b/hdf/src/vattrf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: vattrf.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: vattrf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 /*
    *
    * vattrf.c
diff --git a/hdf/src/vconv.c b/hdf/src/vconv.c
index a136706..486f6d6 100644
--- a/hdf/src/vconv.c
+++ b/hdf/src/vconv.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5691 $";
-#endif
-
-/* $Id: vconv.c 5691 2011-09-19 16:02:14Z bmribler $ */
+/* $Id: vconv.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* obsolete code for HDF 3.2. 26/march/92 jason ng */
 /* except for the following routines:
diff --git a/hdf/src/vg.c b/hdf/src/vg.c
index bf598d0..6d96c6c 100644
--- a/hdf/src/vg.c
+++ b/hdf/src/vg.c
@@ -11,10 +11,6 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5697 $";
-#endif
-/* vg.c,v 1.15.4.1 1993/10/26 19:25:07 georgev Exp */
 
 /*
 FILE  
diff --git a/hdf/src/vgf.c b/hdf/src/vgf.c
index c193781..f961157 100644
--- a/hdf/src/vgf.c
+++ b/hdf/src/vgf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5737 $";
-#endif
-
-/* $Id: vgf.c 5737 2012-01-06 04:52:28Z brtnfld $ */
+/* $Id: vgf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*-----------------------------------------------------------------------------
   FUNCTION NAMEING CONVENTION:(For the most part true)
diff --git a/hdf/src/vhi.c b/hdf/src/vhi.c
index 3e3234f..ddc9a45 100644
--- a/hdf/src/vhi.c
+++ b/hdf/src/vhi.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: vhi.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: vhi.c 6357 2016-05-13 05:00:06Z bmribler $ */
 /*
    * File
    *       vhi.c
diff --git a/hdf/src/vio.c b/hdf/src/vio.c
index 6758ee7..ad9df9c 100644
--- a/hdf/src/vio.c
+++ b/hdf/src/vio.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6026 $";
-#endif
-
-/* $Id: vio.c 6026 2014-01-16 15:16:16Z bmribler $ */
+/* $Id: vio.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*****************************************************************************
  file - vio.c
diff --git a/hdf/src/vparse.c b/hdf/src/vparse.c
index 2ba3c58..bce374e 100644
--- a/hdf/src/vparse.c
+++ b/hdf/src/vparse.c
@@ -11,11 +11,6 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-/* $Id: vparse.c 6043 2014-01-21 21:09:03Z acheng $ */
-
 /*****************************************************************************
 
  file - vparse.c
diff --git a/hdf/src/vrw.c b/hdf/src/vrw.c
index e705fb6..34bdcaf 100644
--- a/hdf/src/vrw.c
+++ b/hdf/src/vrw.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6026 $";
-#endif
-
-/* $Id: vrw.c 6026 2014-01-16 15:16:16Z bmribler $ */
+/* $Id: vrw.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /***********************************************************************
 *
diff --git a/hdf/src/vsfld.c b/hdf/src/vsfld.c
index bb30116..ef93ebc 100644
--- a/hdf/src/vsfld.c
+++ b/hdf/src/vsfld.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5760 $";
-#endif
-
-/* $Id: vsfld.c 5760 2012-01-20 12:53:37Z bmribler $ */
+/* $Id: vsfld.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*****************************************************************************
 * vsetf.c
diff --git a/hdf/test/CMakeLists.txt b/hdf/test/CMakeLists.txt
index 81d2bbf..1ea5570 100644
--- a/hdf/test/CMakeLists.txt
+++ b/hdf/test/CMakeLists.txt
@@ -1,16 +1,14 @@
-cmake_minimum_required (VERSION 2.8.10)
-PROJECT (HDF4_HDF_TEST C CXX)
+cmake_minimum_required (VERSION 3.1.0)
+project (HDF4_HDF_TEST C CXX)
 
 #-----------------------------------------------------------------------------
 # Setup include Directories
 #-----------------------------------------------------------------------------
 INCLUDE_DIRECTORIES (
-    ${CMAKE_Fortran_MODULE_DIRECTORY}
     ${HDF4_HDF_BINARY_DIR}
     ${HDF4_HDFSOURCE_DIR}
 )
 LINK_DIRECTORIES (
-    ${CMAKE_Fortran_MODULE_DIRECTORY}
     ${HDF4_HDF_BINARY_DIR}
     ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
 )
@@ -60,17 +58,33 @@ if (WIN32)
 endif (WIN32)
 
 #-- Adding test for testhdf
-ADD_EXECUTABLE (testhdf ${testhdf_SRCS})
-TARGET_NAMING (testhdf ${LIB_TYPE})
-TARGET_C_PROPERTIES (testhdf " " " ")
+add_executable (testhdf ${testhdf_SRCS})
+TARGET_NAMING (testhdf STATIC)
+TARGET_C_PROPERTIES (testhdf STATIC " " " ")
 target_link_libraries (testhdf ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+set_target_properties (testhdf PROPERTIES FOLDER test)
+if (BUILD_SHARED_LIBS)
+  add_executable (testhdf-shared ${testhdf_SRCS})
+  TARGET_NAMING (testhdf-shared SHARED)
+  TARGET_C_PROPERTIES (testhdf-shared SHARED " " " ")
+  target_link_libraries (testhdf-shared ${HDF4_SRC_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+  set_target_properties (testhdf-shared PROPERTIES FOLDER test)
+endif (BUILD_SHARED_LIBS)
 
 #-- Adding test for buffer
 if (NOT WIN32)
-  ADD_EXECUTABLE (buffer ${HDF4_HDF_TEST_SOURCE_DIR}/buffer.c)
-  TARGET_NAMING (buffer ${LIB_TYPE})
-  TARGET_C_PROPERTIES (buffer " " " ")
+  add_executable (buffer ${HDF4_HDF_TEST_SOURCE_DIR}/buffer.c)
+  TARGET_NAMING (buffer STATIC)
+  TARGET_C_PROPERTIES (buffer STATIC " " " ")
   target_link_libraries (buffer ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
+  set_target_properties (buffer PROPERTIES FOLDER test)
+  if (BUILD_SHARED_LIBS)
+    add_executable (buffer-shared ${HDF4_HDF_TEST_SOURCE_DIR}/buffer.c)
+    TARGET_NAMING (buffer-shared SHARED)
+    TARGET_C_PROPERTIES (buffer-shared SHARED " " " ")
+    target_link_libraries (buffer-shared ${HDF4_SRC_LIBSH_TARGET} ${LINK_SHARED_LIBS})
+    set_target_properties (buffer-shared PROPERTIES FOLDER test)
+  endif (BUILD_SHARED_LIBS)
 endif (NOT WIN32)
 
 ##############################################################################
diff --git a/hdf/test/CMakeTests.cmake b/hdf/test/CMakeTests.cmake
index aae0932..e6c4110 100644
--- a/hdf/test/CMakeTests.cmake
+++ b/hdf/test/CMakeTests.cmake
@@ -5,7 +5,14 @@
 ##############################################################################
 ##############################################################################
   
-FILE (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/testdir)
+file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST")
+file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST/testdir")
+file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST/testfiles")
+if (BUILD_SHARED_LIBS)
+  file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST-shared")
+  file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST-shared/testdir")
+  file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/TEST-shared/testfiles")
+endif (BUILD_SHARED_LIBS)
 
 #-- Copy all the dat files from the test directory into the source directory
 set (HDF4_REFERENCE_TEST_FILES
@@ -22,120 +29,136 @@ set (HDF4_REFERENCE_TEST_FILES
 )
 
 foreach (h4_file ${HDF4_REFERENCE_TEST_FILES})
-   set (dest "${PROJECT_BINARY_DIR}/test_files/${h4_file}")
-   #MESSAGE(STATUS " Copying ${h4_file}")
-   ADD_CUSTOM_COMMAND (
-       TARGET     testhdf 
-       POST_BUILD
-       COMMAND    ${CMAKE_COMMAND}
-       ARGS       -E copy_if_different ${HDF4_HDF_TEST_SOURCE_DIR}/test_files/${h4_file} ${dest}
-   )
+  set (dest "${PROJECT_BINARY_DIR}/TEST/test_files/${h4_file}")
+  add_custom_command (
+      TARGET     testhdf 
+      POST_BUILD
+      COMMAND    ${CMAKE_COMMAND}
+      ARGS       -E copy_if_different ${HDF4_HDF_TEST_SOURCE_DIR}/test_files/${h4_file} ${dest}
+  )
+  if (BUILD_SHARED_LIBS)
+    set (dest "${PROJECT_BINARY_DIR}/TEST-shared/test_files/${h4_file}")
+    add_custom_command (
+        TARGET     testhdf-shared 
+        POST_BUILD
+        COMMAND    ${CMAKE_COMMAND}
+        ARGS       -E copy_if_different ${HDF4_HDF_TEST_SOURCE_DIR}/test_files/${h4_file} ${dest}
+    )
+  endif (BUILD_SHARED_LIBS)
 endforeach (h4_file ${HDF4_REFERENCE_TEST_FILES})
 
 # Remove any output file left over from previous test run
+set (HDF4_TESTHDF_FILES
+    Block_info.hdf
+    ChunkedGR.hdf
+    ChunkedGR_DF.hdf
+    ChunkedGR_NO.hdf
+    ChunkedGR_RL.hdf
+    ChunkedGR_SK.hdf
+    datainfo_annot.hdf
+    datainfo_dfri.hdf
+    datainfo_images.hdf
+    datainfo_linkblock.hdf
+    datainfo_simple.hdf
+    gr2.hdf
+    gr_chunkcomp.hdf
+    gr_comp.hdf
+    gr_double_test.hdf
+    gr_gzip.hdf
+    gr_jpeg.hdf
+    gr_r8.hdf
+    nntcheck.hdf
+    ntcheck.hdf
+    RI_8.hdf
+    RI_16.hdf
+    RI_32.hdf
+    RI_fl32.hdf
+    RI_fl64.hdf
+    RIchunkedziped.hdf
+    s1w.hdf
+    s3w.hdf
+    s4w.hdf
+    sdstrings.hdf
+    swf32.hdf
+    swf64.hdf
+    swi8.hdf
+    swi16.hdf
+    swi32.hdf
+    swin.hdf
+    swui8.hdf
+    swui16.hdf
+    swui32.hdf
+    swuin.hdf
+    t.hdf
+    t1.hdf
+    t2.hdf
+    t3.hdf
+    t4.hdf
+    tbitio.hdf
+    tblocks.hdf
+    tchunks.hdf
+    tcomp.hdf
+    tdf24.hdf
+    tdfan.hdf
+    temp.hdf
+    thf.hdf
+    tjpeg.hdf
+    tlongnames.hdf
+    tman.hdf
+    tmgr.hdf
+    tmgratt.hdf
+    tmgrchk.hdf
+    tnbit.hdf
+    tref.hdf
+    tuservds.hdf
+    tuservgs.hdf
+    tvattr.hdf
+    tvpack.hdf
+    tvsempty.hdf
+    tvset.hdf
+    tvsetext.hdf
+    tx.hdf
+    Tables_External_File
+)
 add_test (
-    NAME testhdf-clearall-objects
+    NAME HDF_TEST-testhdf-clearall-objects
     COMMAND    ${CMAKE_COMMAND}
         -E remove 
-        Block_info.hdf
-        ChunkedGR.hdf
-        ChunkedGR_DF.hdf
-        ChunkedGR_NO.hdf
-        ChunkedGR_RL.hdf
-        ChunkedGR_SK.hdf
-        datainfo_annot.hdf
-        datainfo_dfri.hdf
-        datainfo_images.hdf
-        datainfo_linkblock.hdf
-        datainfo_simple.hdf
-        gr2.hdf
-        gr_chunkcomp.hdf
-        gr_comp.hdf
-        gr_double_test.hdf
-        gr_gzip.hdf
-        gr_jpeg.hdf
-        gr_r8.hdf
-        nntcheck.hdf
-        ntcheck.hdf
-        RI_8.hdf
-        RI_16.hdf
-        RI_32.hdf
-        RI_fl32.hdf
-        RI_fl64.hdf
-        RIchunkedziped.hdf
-        s1w.hdf
-        s3w.hdf
-        s4w.hdf
-        sdstrings.hdf
-        swf32.hdf
-        swf64.hdf
-        swi8.hdf
-        swi16.hdf
-        swi32.hdf
-        swin.hdf
-        swui8.hdf
-        swui16.hdf
-        swui32.hdf
-        swuin.hdf
-        t.hdf
-        t1.hdf
-        t2.hdf
-        t3.hdf
-        t4.hdf
-        tbitio.hdf
-        tblocks.hdf
-        tchunks.hdf
-        tcomp.hdf
-        tdf24.hdf
-        tdfan.hdf
-        temp.hdf
-        thf.hdf
-        tjpeg.hdf
-        tlongnames.hdf
-        tman.hdf
-        tmgr.hdf
-        tmgratt.hdf
-        tmgrchk.hdf
-        tnbit.hdf
-        tref.hdf
-        tuservds.hdf
-        tuservgs.hdf
-        tvattr.hdf
-        tvpack.hdf
-        tvsempty.hdf
-        tvset.hdf
-        tvsetext.hdf
-        tx.hdf
-        Tables_External_File
+        ${HDF4_TESTHDF_FILES}
+    WORKING_DIRECTORY
+        ${PROJECT_BINARY_DIR}/TEST
 )
+set_tests_properties (HDF_TEST-testhdf-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
 if (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (testhdf-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
-else (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (testhdf-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  set_tests_properties (HDF_TEST-testhdf-clearall-objects PROPERTIES DEPENDS ${last_test})
 endif (NOT "${last_test}" STREQUAL "")
-set (last_test "testhdf-clearall-objects")
+set (last_test "HDF_TEST-testhdf-clearall-objects")
 
+set (HDF4_TESTHDF_THF0_FILES
+    thf0.hdf
+    thf1.hdf
+    thf2.hdf
+    thf3.hdf
+    thf4.hdf
+    thf5.hdf
+    thf6.hdf
+    thf7.hdf
+    thf8.hdf
+    thf9.hdf
+)
 add_test (
-    NAME testhdf_thf0-clearall-objects
+    NAME HDF_TEST-testhdf_thf0-clearall-objects
     COMMAND    ${CMAKE_COMMAND}
         -E remove 
-        thf0.hdf
-        thf1.hdf
-        thf2.hdf
-        thf3.hdf
-        thf4.hdf
-        thf5.hdf
-        thf6.hdf
-        thf7.hdf
-        thf8.hdf
-        thf9.hdf
+        ${HDF4_TESTHDF_THF0_FILES}
+    WORKING_DIRECTORY
+        ${PROJECT_BINARY_DIR}/TEST
 )
+set_tests_properties (HDF_TEST-testhdf_thf0-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
 if (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (testhdf_thf0-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
-else (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (testhdf_thf0-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  set_tests_properties (HDF_TEST-testhdf_thf0-clearall-objects PROPERTIES DEPENDS ${last_test})
 endif (NOT "${last_test}" STREQUAL "")
-set (last_test "testhdf_thf0-clearall-objects")
+set (last_test "HDF_TEST-testhdf_thf0-clearall-objects")
 
 set (thf_decade
     1 2 3 4 5 6 7 8 9 10
@@ -147,7 +170,7 @@ set (thf_decade
 )
 foreach (decade ${thf_decade}) 
   add_test (
-      NAME testhdf_thf${decade}-clearall-objects
+      NAME HDF_TEST-testhdf_thf${decade}-clearall-objects
       COMMAND    ${CMAKE_COMMAND}
           -E remove 
           thf${decade}0.hdf
@@ -160,34 +183,118 @@ foreach (decade ${thf_decade})
           thf${decade}7.hdf
           thf${decade}8.hdf
           thf${decade}9.hdf
+    WORKING_DIRECTORY
+        ${PROJECT_BINARY_DIR}/TEST
   )
+  set_tests_properties (HDF_TEST-testhdf_thf${decade}-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
   if (NOT "${last_test}" STREQUAL "")
-    set_tests_properties (testhdf_thf${decade}-clearall-objects PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
-  else (NOT "${last_test}" STREQUAL "")
-    set_tests_properties (testhdf_thf${decade}-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+    set_tests_properties (HDF_TEST-testhdf_thf${decade}-clearall-objects PROPERTIES DEPENDS ${last_test})
   endif (NOT "${last_test}" STREQUAL "")
-  set (last_test "testhdf_thf${decade}-clearall-objects")
+  set (last_test "HDF_TEST-testhdf_thf${decade}-clearall-objects")
 endforeach (decade ${thf_decade}) 
 
-add_test (NAME testhdf COMMAND $<TARGET_FILE:testhdf>)
+add_test (NAME HDF_TEST-testhdf COMMAND $<TARGET_FILE:testhdf>)
 set (passRegex "All tests were successful")
-SET_PROPERTY (TEST testhdf PROPERTY PASS_REGULAR_EXPRESSION "${passRegex}")
+set_tests_properties (HDF_TEST-testhdf PROPERTIES
+    PASS_REGULAR_EXPRESSION "${passRegex}" 
+    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
+    LABELS ${PROJECT_NAME}
+)
 if (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (testhdf PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
-else (NOT "${last_test}" STREQUAL "")
-  set_tests_properties (testhdf PROPERTIES LABELS ${PROJECT_NAME})
+  set_tests_properties (HDF_TEST-testhdf PROPERTIES DEPENDS ${last_test})
 endif (NOT "${last_test}" STREQUAL "")
-set (last_test "testhdf")
+set (last_test "HDF_TEST-testhdf")
 
 #-- Adding test for buffer
 if (NOT WIN32)
-  add_test (NAME buffer COMMAND $<TARGET_FILE:buffer>)
+  add_test (NAME HDF_TEST-buffer COMMAND $<TARGET_FILE:buffer>)
+  set_tests_properties (HDF_TEST-buffer PROPERTIES
+      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST
+      LABELS ${PROJECT_NAME}
+  )
   if (NOT "${last_test}" STREQUAL "")
-    set_tests_properties (buffer PROPERTIES DEPENDS ${last_test} LABELS ${PROJECT_NAME})
-  else (NOT "${last_test}" STREQUAL "")
-    set_tests_properties (buffer PROPERTIES LABELS ${PROJECT_NAME})
+    set_tests_properties (HDF_TEST-buffer PROPERTIES DEPENDS ${last_test})
   endif (NOT "${last_test}" STREQUAL "")
-  set (last_test "buffer")
+  set (last_test "HDF_TEST-buffer")
 endif (NOT WIN32)
 
+if (BUILD_SHARED_LIBS)
+  # Remove any output file left over from previous test run
+  add_test (
+      NAME HDF_TEST-testhdf-shared-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          ${HDF4_TESTHDF_FILES}
+      WORKING_DIRECTORY
+          ${PROJECT_BINARY_DIR}/TEST-shared
+  )
+  set_tests_properties (HDF_TEST-testhdf-shared-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  if (NOT "${last_test}" STREQUAL "")
+    set_tests_properties (HDF_TEST-testhdf-shared-clearall-objects PROPERTIES DEPENDS ${last_test})
+  endif (NOT "${last_test}" STREQUAL "")
+  set (last_test "HDF_TEST-testhdf-shared-clearall-objects")
+
+  add_test (
+      NAME HDF_TEST-testhdf_thf0-shared-clearall-objects
+      COMMAND    ${CMAKE_COMMAND}
+          -E remove 
+          ${HDF4_TESTHDF_THF0_FILES}
+      WORKING_DIRECTORY
+          ${PROJECT_BINARY_DIR}/TEST-shared
+  )
+  set_tests_properties (HDF_TEST-testhdf_thf0-shared-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+  if (NOT "${last_test}" STREQUAL "")
+    set_tests_properties (HDF_TEST-testhdf_thf0-shared-clearall-objects PROPERTIES DEPENDS ${last_test})
+  endif (NOT "${last_test}" STREQUAL "")
+  set (last_test "HDF_TEST-testhdf_thf0-shared-clearall-objects")
+
+  foreach (decade ${thf_decade}) 
+    add_test (
+        NAME HDF_TEST-testhdf_thf${decade}-shared-clearall-objects
+        COMMAND    ${CMAKE_COMMAND}
+            -E remove 
+            thf${decade}0.hdf
+            thf${decade}1.hdf
+            thf${decade}2.hdf
+            thf${decade}3.hdf
+            thf${decade}4.hdf
+            thf${decade}5.hdf
+            thf${decade}6.hdf
+            thf${decade}7.hdf
+            thf${decade}8.hdf
+            thf${decade}9.hdf
+      WORKING_DIRECTORY
+          ${PROJECT_BINARY_DIR}/TEST-shared
+    )
+    set_tests_properties (HDF_TEST-testhdf_thf${decade}-shared-clearall-objects PROPERTIES LABELS ${PROJECT_NAME})
+    if (NOT "${last_test}" STREQUAL "")
+      set_tests_properties (HDF_TEST-testhdf_thf${decade}-shared-clearall-objects PROPERTIES DEPENDS ${last_test})
+    endif (NOT "${last_test}" STREQUAL "")
+    set (last_test "HDF_TEST-testhdf_thf${decade}-shared-clearall-objects")
+  endforeach (decade ${thf_decade}) 
+
+  add_test (NAME HDF_TEST-testhdf-shared COMMAND $<TARGET_FILE:testhdf-shared>)
+  set (passRegex "All tests were successful")
+  set_tests_properties (HDF_TEST-testhdf-shared PROPERTIES
+      PASS_REGULAR_EXPRESSION "${passRegex}" 
+      WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST-shared
+      LABELS ${PROJECT_NAME}
+  )
+  if (NOT "${last_test}" STREQUAL "")
+    set_tests_properties (HDF_TEST-testhdf-shared PROPERTIES DEPENDS ${last_test})
+  endif (NOT "${last_test}" STREQUAL "")
+  set (last_test "HDF_TEST-testhdf-shared")
 
+  #-- Adding test for buffer
+  if (NOT WIN32)
+    add_test (NAME HDF_TEST-buffer-shared COMMAND $<TARGET_FILE:buffer-shared>)
+    set_tests_properties (HDF_TEST-buffer-shared PROPERTIES
+        WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/TEST-shared
+        LABELS ${PROJECT_NAME}
+    )
+    if (NOT "${last_test}" STREQUAL "")
+      set_tests_properties (HDF_TEST-buffer-shared PROPERTIES DEPENDS ${last_test})
+    endif (NOT "${last_test}" STREQUAL "")
+    set (last_test "HDF_TEST-buffer-shared")
+  endif (NOT WIN32)
+endif (BUILD_SHARED_LIBS)
diff --git a/hdf/test/Makefile.in b/hdf/test/Makefile.in
index addade0..897c9ce 100644
--- a/hdf/test/Makefile.in
+++ b/hdf/test/Makefile.in
@@ -92,7 +92,20 @@ DIST_COMMON = $(top_srcdir)/config/commence.am \
 TESTS = $(am__EXEEXT_1)
 subdir = hdf/test
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -462,12 +475,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -510,11 +538,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/hdf/test/an.c b/hdf/test/an.c
index 69f153a..8c95afc 100644
--- a/hdf/test/an.c
+++ b/hdf/test/an.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: an.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: an.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /***********************************************************
 *
diff --git a/hdf/test/anfile.c b/hdf/test/anfile.c
index 4c60425..bea4b08 100644
--- a/hdf/test/anfile.c
+++ b/hdf/test/anfile.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: anfile.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: anfile.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 #define TESTFILE "tdfan.hdf"
diff --git a/hdf/test/bitio.c b/hdf/test/bitio.c
index b601ac2..48fa26d 100644
--- a/hdf/test/bitio.c
+++ b/hdf/test/bitio.c
@@ -31,11 +31,7 @@
    10/19/93 - Started coding.
  */
 
-/* $Id: bitio.c 5210 2009-08-21 20:27:12Z brtnfld $ */
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5210 $";
-#endif
+/* $Id: bitio.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 #include <time.h>
diff --git a/hdf/test/blocks.c b/hdf/test/blocks.c
index 9f60f5e..8902b51 100644
--- a/hdf/test/blocks.c
+++ b/hdf/test/blocks.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: blocks.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: blocks.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 #define TESTFILE_NAME "tblocks.hdf"
diff --git a/hdf/test/buffer.c b/hdf/test/buffer.c
index a6908d6..c2d95ab 100644
--- a/hdf/test/buffer.c
+++ b/hdf/test/buffer.c
@@ -42,11 +42,7 @@
 
  */
 
-/* $Id: buffer.c 6013 2014-01-10 21:19:02Z acheng $ */
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
+/* $Id: buffer.c 6427 2016-06-13 21:56:09Z byrn $ */
 
 #define TESTMASTER
 
@@ -452,9 +448,9 @@ main(int argc, char *argv[])
         exit(1);
     }
 
-    out_buf = malloc(elemsize * sizeof(uint8));
-    in_buf = malloc(elemsize * sizeof(uint8));    
-        
+    out_buf = HDmalloc(elemsize * sizeof(uint8));
+    in_buf = HDmalloc(elemsize * sizeof(uint8));
+
     Verbosity = 4;  /* Default Verbosity is Low */
 
     Hgetlibversion(&lmajor, &lminor, &lrelease, lstring);
@@ -557,8 +553,8 @@ main(int argc, char *argv[])
         remove(hfilename);
     }
 
-    free(out_buf);
-    free(in_buf);
+    HDfree(out_buf);
+    HDfree(in_buf);
 
     MESSAGE(6, printf("Finished buffered element test\n");
         )
diff --git a/hdf/test/chunks.c b/hdf/test/chunks.c
index 22763c6..5ded443 100644
--- a/hdf/test/chunks.c
+++ b/hdf/test/chunks.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6032 $";
-#endif
-
-/* $Id: chunks.c 6032 2014-01-17 18:13:52Z acheng $ */
+/* $Id: chunks.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
  * This file tests the Special Chunking Element(HMCxxx) layer of the HDF library.
diff --git a/hdf/test/comp.c b/hdf/test/comp.c
index 6bb6a6a..a75b684 100644
--- a/hdf/test/comp.c
+++ b/hdf/test/comp.c
@@ -30,11 +30,7 @@
        10/19/93 - Through this header in.
  */
 
-/* $Id: comp.c 4932 2007-09-07 17:17:23Z bmribler $ */
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
+/* $Id: comp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include <time.h>
 #include "tproto.h"
diff --git a/hdf/test/conv.c b/hdf/test/conv.c
index bda4c39..8aa07dc 100644
--- a/hdf/test/conv.c
+++ b/hdf/test/conv.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: conv.c 6036 2014-01-20 17:28:01Z acheng $ */
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6036 $";
-#endif
+/* $Id: conv.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/test/extelt.c b/hdf/test/extelt.c
index e43562d..8007d74 100644
--- a/hdf/test/extelt.c
+++ b/hdf/test/extelt.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5201 $";
-#endif
-
-/* $Id: extelt.c 5201 2009-06-18 14:11:06Z bmribler $ */
+/* $Id: extelt.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
  * These is a first pass at rewriting how these tests for exteranl 
diff --git a/hdf/test/file.c b/hdf/test/file.c
index e645bd3..d0896ce 100644
--- a/hdf/test/file.c
+++ b/hdf/test/file.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: file.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: file.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    * Hopen
diff --git a/hdf/test/file1.c b/hdf/test/file1.c
index e5bbefa..24f1b8c 100644
--- a/hdf/test/file1.c
+++ b/hdf/test/file1.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: file1.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: file1.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    test opening files and access elements until limits are reached
diff --git a/hdf/test/forsupf.c b/hdf/test/forsupf.c
index 5cbe6b5..f17d41e 100644
--- a/hdf/test/forsupf.c
+++ b/hdf/test/forsupf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Revision: 6036 $";
-#endif
-
-/* $Id: forsupf.c 6036 2014-01-20 17:28:01Z acheng $ */
+/* $Id: forsupf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "hdf.h"
 #include "fortest.h"
diff --git a/hdf/test/fortest.c b/hdf/test/fortest.c
index 35133ab..bf2f05c 100644
--- a/hdf/test/fortest.c
+++ b/hdf/test/fortest.c
@@ -9,12 +9,9 @@
  * of the source code distribution tree; Copyright.html can be found at      *
  * http://hdfgroup.org/products/hdf4/doc/Copyright.html.  If you do not have *
  * access to either file, you may request a copy from help at hdfgroup.org.     *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6036 $";
-#endif
-
-/* $Id: fortest.c 6036 2014-01-20 17:28:01Z acheng $ */
+/* $Id: fortest.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #define TESTMASTER
 
diff --git a/hdf/test/gentest.c b/hdf/test/gentest.c
index e164add..1e5fb4c 100644
--- a/hdf/test/gentest.c
+++ b/hdf/test/gentest.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-/* $Id: gentest.c 5210 2009-08-21 20:27:12Z brtnfld $ */
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5210 $";
-#endif
+/* $Id: gentest.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/test/litend.c b/hdf/test/litend.c
index b094e8f..ee0780d 100644
--- a/hdf/test/litend.c
+++ b/hdf/test/litend.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5210 $";
-#endif
-
-/* $Id: litend.c 5210 2009-08-21 20:27:12Z brtnfld $ */
+/* $Id: litend.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 
diff --git a/hdf/test/man.c b/hdf/test/man.c
index 54a8074..52bf38b 100644
--- a/hdf/test/man.c
+++ b/hdf/test/man.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: man.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: man.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /***********************************************************
 *
diff --git a/hdf/test/mgr.c b/hdf/test/mgr.c
index f718524..df680d9 100644
--- a/hdf/test/mgr.c
+++ b/hdf/test/mgr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Revision: 5584 $";
-#endif
-
-/* $Id: mgr.c 5584 2011-04-13 18:25:06Z bmribler $ */
+/* $Id: mgr.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /***********************************************************
 *
diff --git a/hdf/test/nbit.c b/hdf/test/nbit.c
index b155ae8..b05bdff 100644
--- a/hdf/test/nbit.c
+++ b/hdf/test/nbit.c
@@ -33,11 +33,7 @@
    1/19/94 - Started coding
  */
 
-/* $Id: nbit.c 5210 2009-08-21 20:27:12Z brtnfld $ */
-
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5210 $";
-#endif
+/* $Id: nbit.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 #define TESTFILE_NAME "tnbit.hdf"
diff --git a/hdf/test/rig.c b/hdf/test/rig.c
index aa16f5e..2340414 100644
--- a/hdf/test/rig.c
+++ b/hdf/test/rig.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5830 $";
-#endif
-
-/* $Id: rig.c 5830 2012-07-19 09:08:48Z bmribler $ */
+/* $Id: rig.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 
diff --git a/hdf/test/sdmms.c b/hdf/test/sdmms.c
index b902dde..de74725 100644
--- a/hdf/test/sdmms.c
+++ b/hdf/test/sdmms.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6035 $";
-#endif
-
-/* $Id: sdmms.c 6035 2014-01-19 07:19:17Z bmribler $ */
+/* $Id: sdmms.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 
diff --git a/hdf/test/sdnmms.c b/hdf/test/sdnmms.c
index a88e472..2394333 100644
--- a/hdf/test/sdnmms.c
+++ b/hdf/test/sdnmms.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: sdnmms.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: sdnmms.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 #include "tproto.h"
 
diff --git a/hdf/test/sdstr.c b/hdf/test/sdstr.c
index 8715c54..a2a09c2 100644
--- a/hdf/test/sdstr.c
+++ b/hdf/test/sdstr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: sdstr.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: sdstr.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /***************************************************************
 **
diff --git a/hdf/test/slab.c b/hdf/test/slab.c
index 0ff1321..4b88d98 100644
--- a/hdf/test/slab.c
+++ b/hdf/test/slab.c
@@ -11,10 +11,6 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Id: slab.c 4932 2007-09-07 17:17:23Z bmribler $";
-#endif
-
 /* $Id */
 
 /***************************************************************************
diff --git a/hdf/test/tbv.c b/hdf/test/tbv.c
index 3aa5db5..ebb52e9 100644
--- a/hdf/test/tbv.c
+++ b/hdf/test/tbv.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5201 $";
-#endif
-
-/* $Id: tbv.c 5201 2009-06-18 14:11:06Z bmribler $ */
+/* $Id: tbv.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/test/testhdf.c b/hdf/test/testhdf.c
index 2ad115a..95dafbc 100644
--- a/hdf/test/testhdf.c
+++ b/hdf/test/testhdf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6036 $";
-#endif
-
-/* $Id: testhdf.c 6036 2014-01-20 17:28:01Z acheng $ */
+/* $Id: testhdf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/test/tree.c b/hdf/test/tree.c
index 8424879..03d707f 100644
--- a/hdf/test/tree.c
+++ b/hdf/test/tree.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: tree.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: tree.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    FILE
diff --git a/hdf/test/tvattr.c b/hdf/test/tvattr.c
index b6b6e5f..657c158 100644
--- a/hdf/test/tvattr.c
+++ b/hdf/test/tvattr.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 5912 $";
-#endif
-
-/* $Id: tvattr.c 5912 2013-01-24 23:30:00Z bmribler $ */
+/* $Id: tvattr.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /**************************************************************
 *
diff --git a/hdf/test/tvset.c b/hdf/test/tvset.c
index ae07d26..642a028 100644
--- a/hdf/test/tvset.c
+++ b/hdf/test/tvset.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: tvset.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: tvset.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
  *
diff --git a/hdf/test/vers.c b/hdf/test/vers.c
index f8ee58e..c036178 100644
--- a/hdf/test/vers.c
+++ b/hdf/test/vers.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4932 $";
-#endif
-
-/* $Id: vers.c 4932 2007-09-07 17:17:23Z bmribler $ */
+/* $Id: vers.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    ***********************************************************************
diff --git a/hdf/util/CMakeLists.txt b/hdf/util/CMakeLists.txt
index fa1e5fc..20578d0 100644
--- a/hdf/util/CMakeLists.txt
+++ b/hdf/util/CMakeLists.txt
@@ -1,5 +1,5 @@
-cmake_minimum_required (VERSION 2.8.10)
-PROJECT (HDF4_HDF_UTIL C CXX)
+cmake_minimum_required (VERSION 3.1.0)
+project (HDF4_HDF_UTIL C CXX)
 
 INCLUDE_DIRECTORIES (${HDF4_HDFSOURCE_DIR})
 
@@ -9,9 +9,9 @@ endif (WIN32)
 
 if (HDF4_BUILD_TOOLS)
   #-- Adding tool hdfls
-  ADD_EXECUTABLE (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c)
-  TARGET_NAMING (hdfls ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdfls " " " ")
+  add_executable (hdfls ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfls.c)
+  TARGET_NAMING (hdfls STATIC)
+  TARGET_C_PROPERTIES (hdfls STATIC " " " ")
   target_link_libraries (hdfls ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdfed
@@ -21,10 +21,10 @@ if (HDF4_BUILD_TOOLS)
       ${HDF4_HDF_UTIL_SOURCE_DIR}/he_file.c
       ${HDF4_HDF_UTIL_SOURCE_DIR}/he_main.c
   )
-  
-  ADD_EXECUTABLE (hdfed ${hdfed_SRCS})
-  TARGET_NAMING (hdfed ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdfed " " " ")
+
+  add_executable (hdfed ${hdfed_SRCS})
+  TARGET_NAMING (hdfed STATIC)
+  TARGET_C_PROPERTIES (hdfed STATIC " " " ")
   target_link_libraries (hdfed ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 endif (HDF4_BUILD_TOOLS)
 
@@ -34,10 +34,10 @@ if (HDF4_BUILD_UTILS)
       ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2gif.c
       ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfgifwr.c
   )
-  
-  ADD_EXECUTABLE (hdf2gif ${hdf2gif_SRCS})
-  TARGET_NAMING (hdf2gif ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdf2gif " " " ")
+
+  add_executable (hdf2gif ${hdf2gif_SRCS})
+  TARGET_NAMING (hdf2gif STATIC)
+  TARGET_C_PROPERTIES (hdf2gif STATIC " " " ")
   target_link_libraries (hdf2gif ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility gif2hdf
@@ -48,94 +48,94 @@ if (HDF4_BUILD_UTILS)
       ${HDF4_HDF_UTIL_SOURCE_DIR}/decompress.c
       ${HDF4_HDF_UTIL_SOURCE_DIR}/writehdf.c
  )
-  
-  ADD_EXECUTABLE (gif2hdf ${gif2hdf_SRCS})
-  TARGET_NAMING (gif2hdf ${LIB_TYPE})
-  TARGET_C_PROPERTIES (gif2hdf " " " ")
+
+  add_executable (gif2hdf ${gif2hdf_SRCS})
+  TARGET_NAMING (gif2hdf STATIC)
+  TARGET_C_PROPERTIES (gif2hdf STATIC " " " ")
   target_link_libraries (gif2hdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdf24to8
-  ADD_EXECUTABLE (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c)
-  TARGET_NAMING (hdf24to8 ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdf24to8 " " " ")
+  add_executable (hdf24to8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf24to8.c)
+  TARGET_NAMING (hdf24to8 STATIC)
+  TARGET_C_PROPERTIES (hdf24to8 STATIC " " " ")
   target_link_libraries (hdf24to8 ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdftor8
-  ADD_EXECUTABLE (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c)
-  TARGET_NAMING (hdftor8 ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdftor8 " " " ")
+  add_executable (hdftor8 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftor8.c)
+  TARGET_NAMING (hdftor8 STATIC)
+  TARGET_C_PROPERTIES (hdftor8 STATIC " " " ")
   target_link_libraries (hdftor8 ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility ristosds
-  ADD_EXECUTABLE (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c)
-  TARGET_NAMING (ristosds ${LIB_TYPE})
-  TARGET_C_PROPERTIES (ristosds " " " ")
+  add_executable (ristosds ${HDF4_HDF_UTIL_SOURCE_DIR}/ristosds.c)
+  TARGET_NAMING (ristosds STATIC)
+  TARGET_C_PROPERTIES (ristosds STATIC " " " ")
   target_link_libraries (ristosds ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdfpack
-  ADD_EXECUTABLE (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c)
-  TARGET_NAMING (hdfpack ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdfpack " " " ")
+  add_executable (hdfpack ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfpack.c)
+  TARGET_NAMING (hdfpack STATIC)
+  TARGET_C_PROPERTIES (hdfpack STATIC " " " ")
   target_link_libraries (hdfpack ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility paltohdf
-  ADD_EXECUTABLE (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c)
-  TARGET_NAMING (paltohdf ${LIB_TYPE})
-  TARGET_C_PROPERTIES (paltohdf " " " ")
+  add_executable (paltohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/paltohdf.c)
+  TARGET_NAMING (paltohdf STATIC)
+  TARGET_C_PROPERTIES (paltohdf STATIC " " " ")
   target_link_libraries (paltohdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdftopal
-  ADD_EXECUTABLE (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c)
-  TARGET_NAMING (hdftopal ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdftopal " " " ")
+  add_executable (hdftopal ${HDF4_HDF_UTIL_SOURCE_DIR}/hdftopal.c)
+  TARGET_NAMING (hdftopal STATIC)
+  TARGET_C_PROPERTIES (hdftopal STATIC " " " ")
   target_link_libraries (hdftopal ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility r8tohdf
-  ADD_EXECUTABLE (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c)
-  TARGET_NAMING (r8tohdf ${LIB_TYPE})
-  TARGET_C_PROPERTIES (r8tohdf " " " ")
+  add_executable (r8tohdf ${HDF4_HDF_UTIL_SOURCE_DIR}/r8tohdf.c)
+  TARGET_NAMING (r8tohdf STATIC)
+  TARGET_C_PROPERTIES (r8tohdf STATIC " " " ")
   target_link_libraries (r8tohdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdfcomp
-  ADD_EXECUTABLE (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c)
-  TARGET_NAMING (hdfcomp ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdfcomp " " " ")
+  add_executable (hdfcomp ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfcomp.c)
+  TARGET_NAMING (hdfcomp STATIC)
+  TARGET_C_PROPERTIES (hdfcomp STATIC " " " ")
   target_link_libraries (hdfcomp ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility jpeg2hdf
-  ADD_EXECUTABLE (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c)
-  TARGET_NAMING (jpeg2hdf ${LIB_TYPE})
-  TARGET_C_PROPERTIES (jpeg2hdf " " " ")
+  add_executable (jpeg2hdf ${HDF4_HDF_UTIL_SOURCE_DIR}/jpeg2hdf.c)
+  TARGET_NAMING (jpeg2hdf STATIC)
+  TARGET_C_PROPERTIES (jpeg2hdf STATIC " " " ")
   target_link_libraries (jpeg2hdf ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdf2jpeg
-  ADD_EXECUTABLE (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c)
-  TARGET_NAMING (hdf2jpeg ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdf2jpeg " " " ")
+  add_executable (hdf2jpeg ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf2jpeg.c)
+  TARGET_NAMING (hdf2jpeg STATIC)
+  TARGET_C_PROPERTIES (hdf2jpeg STATIC " " " ")
   target_link_libraries (hdf2jpeg ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdf8to24
-  ADD_EXECUTABLE (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c)
-  TARGET_NAMING (hdf8to24 ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdf8to24 " " " ")
+  add_executable (hdf8to24 ${HDF4_HDF_UTIL_SOURCE_DIR}/hdf8to24.c)
+  TARGET_NAMING (hdf8to24 STATIC)
+  TARGET_C_PROPERTIES (hdf8to24 STATIC " " " ")
   target_link_libraries (hdf8to24 ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility hdfunpac
-  ADD_EXECUTABLE (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c)
-  TARGET_NAMING (hdfunpac ${LIB_TYPE})
-  TARGET_C_PROPERTIES (hdfunpac " " " ")
+  add_executable (hdfunpac ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfunpac.c)
+  TARGET_NAMING (hdfunpac STATIC)
+  TARGET_C_PROPERTIES (hdfunpac STATIC " " " ")
   target_link_libraries (hdfunpac ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility vmake
-  ADD_EXECUTABLE (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c)
-  TARGET_NAMING (vmake ${LIB_TYPE})
-  TARGET_C_PROPERTIES (vmake " " " ")
+  add_executable (vmake ${HDF4_HDF_UTIL_SOURCE_DIR}/vmake.c)
+  TARGET_NAMING (vmake STATIC)
+  TARGET_C_PROPERTIES (vmake STATIC " " " ")
   target_link_libraries (vmake ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 
   #-- Adding utility vshow
-  ADD_EXECUTABLE (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c)
-  TARGET_NAMING (vshow ${LIB_TYPE})
-  TARGET_C_PROPERTIES (vshow " " " ")
+  add_executable (vshow ${HDF4_HDF_UTIL_SOURCE_DIR}/vshow.c)
+  TARGET_NAMING (vshow STATIC)
+  TARGET_C_PROPERTIES (vshow STATIC " " " ")
   target_link_libraries (vshow ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} ${LINK_LIBS})
 endif (HDF4_BUILD_UTILS)
 
@@ -160,10 +160,7 @@ if (HDF4_BUILD_TOOLS)
       TARGETS
           hdfls
           hdfed
-      RUNTIME DESTINATION
-          ${HDF4_INSTALL_TOOLS_BIN_DIR}
-      COMPONENT
-          toolsapplications
+      RUNTIME DESTINATION ${HDF4_INSTALL_TOOLS_BIN_DIR} COMPONENT toolsapplications
   )
 endif (HDF4_BUILD_TOOLS)
 
@@ -184,7 +181,7 @@ if (HDF4_BUILD_UTILS)
   INSTALL_PROGRAM_PDB (ristosds ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
   INSTALL_PROGRAM_PDB (vmake ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
   INSTALL_PROGRAM_PDB (vshow ${HDF4_INSTALL_UTILS_BIN_DIR} utilsapplications)
-  
+
   INSTALL (
       TARGETS
           gif2hdf
@@ -203,9 +200,6 @@ if (HDF4_BUILD_UTILS)
           ristosds
           vmake
           vshow
-      RUNTIME DESTINATION
-          ${HDF4_INSTALL_UTILS_BIN_DIR}
-      COMPONENT
-          utilsapplications
+      RUNTIME DESTINATION ${HDF4_INSTALL_UTILS_BIN_DIR} COMPONENT utilsapplications
   )
 endif (HDF4_BUILD_UTILS)
diff --git a/hdf/util/CMakeTests.cmake b/hdf/util/CMakeTests.cmake
index 5a4fc70..6546a68 100644
--- a/hdf/util/CMakeTests.cmake
+++ b/hdf/util/CMakeTests.cmake
@@ -4,7 +4,7 @@
 ###           T E S T I N G                                                ###
 ##############################################################################
 ##############################################################################
-  
+
 ##############################################################################
 # --------------------------------------------------------------------
 # Copy all the files from the test directory into the source directory
@@ -25,7 +25,7 @@ if (HDF4_BUILD_TOOLS)
       ristosds.input1
       ristosds.out1
   )
-  
+
   foreach (h4_file ${HDF4_LS_TEST_FILES})
     set (dest "${PROJECT_BINARY_DIR}/${h4_file}")
     #message (STATUS " Copying ${HDF4_HDF_UTIL_SOURCE_DIR}/${h4_file} to ${PROJECT_BINARY_DIR}/")
@@ -36,22 +36,22 @@ if (HDF4_BUILD_TOOLS)
         ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/${h4_file} ${dest}
     )
   endforeach (h4_file ${HDF4_LS_TEST_FILES})
-  
-  if (WIN32)
+
+  if (WIN32 AND MSVC_VERSION LESS 1900)
     ADD_CUSTOM_COMMAND (
         TARGET     hdfls
         POST_BUILD
         COMMAND    ${CMAKE_COMMAND}
         ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfed-w.out1 ${PROJECT_BINARY_DIR}/hdfed.out1
     )
-  else (WIN32)
+  else (WIN32 AND MSVC_VERSION LESS 1900)
     ADD_CUSTOM_COMMAND (
         TARGET     hdfls
         POST_BUILD
         COMMAND    ${CMAKE_COMMAND}
         ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/hdfed.out1 ${PROJECT_BINARY_DIR}/hdfed.out1
     )
-  endif (WIN32)
+  endif (WIN32 AND MSVC_VERSION LESS 1900)
 
   #-- Copy all the hdfed data files from the source directory into the test directory
   set (HDF4_HDFED_TEST_FILES
@@ -213,7 +213,7 @@ endif (HDF4_BUILD_TOOLS)
         ARGS       -E copy_if_different ${HDF4_HDF_UTIL_SOURCE_DIR}/testfiles/${h4_file} ${dest}
     )
   endforeach (h4_file ${HDF4_JPEG2HDF_TEST_FILES})
-  
+
 ##############################################################################
 ##############################################################################
 ###           T H E   T E S T S  M A C R O S                               ###
@@ -337,7 +337,7 @@ endif (HDF4_BUILD_TOOLS)
   add_test (
       NAME hdfgif-clear-refs
       COMMAND    ${CMAKE_COMMAND}
-          -E remove 
+          -E remove
           skull.gif
           SunWheel.hdf
           bttrfly.hdf
@@ -377,7 +377,7 @@ endif (HDF4_BUILD_TOOLS)
   add_test (
       NAME hdfpack-clear-refs
       COMMAND    ${CMAKE_COMMAND}
-          -E remove 
+          -E remove
           test.pck
           test.blk
           test.hdf.tmp
@@ -403,7 +403,7 @@ endif (HDF4_BUILD_TOOLS)
   add_test (
       NAME hdfpalette-clear-refs
       COMMAND    ${CMAKE_COMMAND}
-          -E remove 
+          -E remove
           pal001
           pal005
           palette.hdf
@@ -457,7 +457,7 @@ endif (HDF4_BUILD_TOOLS)
   add_test (
       NAME hdfjpeg-clear-refs
       COMMAND    ${CMAKE_COMMAND}
-          -E remove 
+          -E remove
           jpeg.hdf
           jpeg.hdf.tmp
           jpeg.hdf.tmp.err
diff --git a/hdf/util/Makefile.in b/hdf/util/Makefile.in
index 39fac97..ce45357 100644
--- a/hdf/util/Makefile.in
+++ b/hdf/util/Makefile.in
@@ -97,7 +97,20 @@ bin_PROGRAMS = gif2hdf$(EXEEXT) hdf2gif$(EXEEXT) hdf2jpeg$(EXEEXT) \
 TESTS = $(TEST_SCRIPT)
 subdir = hdf/util
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -517,12 +530,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -565,11 +593,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
diff --git a/hdf/util/gif2hdf.c b/hdf/util/gif2hdf.c
index 59175f6..54fbfa3 100644
--- a/hdf/util/gif2hdf.c
+++ b/hdf/util/gif2hdf.c
@@ -50,8 +50,8 @@ char *argc[];
 	
 	
 
-	strncpy(GIFFileName , argc[1] , VSNAMELENMAX - 1);
-	strncpy(HDFFileName , argc[2] , VSNAMELENMAX - 1);
+    HDstrncpy(GIFFileName , argc[1] , VSNAMELENMAX - 1);
+    HDstrncpy(HDFFileName , argc[2] , VSNAMELENMAX - 1);
 	GIFFileName[VSNAMELENMAX - 1] = '\0';
 	HDFFileName[VSNAMELENMAX - 1] = '\0';
 
@@ -102,18 +102,18 @@ char *argc[];
 	{
 		gifImageDesc = *(GifMemoryStruct.GifImageDesc[i]);
 		if (gifImageDesc.Image != NULL)
-			free(gifImageDesc.Image);
+            HDfree(gifImageDesc.Image);
 	
 		if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL)
-			free(GifMemoryStruct.GifGraphicControlExtension[i]);
+            HDfree(GifMemoryStruct.GifGraphicControlExtension[i]);
 		
 	}
-	free(StartPos);
+    HDfree(StartPos);
 
-	free (GifMemoryStruct.GifHeader);
+    HDfree (GifMemoryStruct.GifHeader);
 	
 	if (GifMemoryStruct.GifApplicationExtension != NULL)
-		free (GifMemoryStruct.GifApplicationExtension);
+        HDfree (GifMemoryStruct.GifApplicationExtension);
 
 	return (0);
 }
diff --git a/hdf/util/gif2mem.c b/hdf/util/gif2mem.c
index 688ffca..610bd2d 100644
--- a/hdf/util/gif2mem.c
+++ b/hdf/util/gif2mem.c
@@ -200,7 +200,7 @@ BYTE *MemGif;
 			** Decompress the Image
 			*/
 			gifImageDesc[ImageCount-1]->Image = Decompress(gifImageDesc[ImageCount-1] , gifHead);
-			free(gifImageDesc[ImageCount-1]->GIFImage);
+            HDfree(gifImageDesc[ImageCount-1]->GIFImage);
 
 			/* 
 			** Convert the local palette into an HDF compatible palette
diff --git a/hdf/util/h4cc.in b/hdf/util/h4cc.in
index 4864234..30b3c08 100644
--- a/hdf/util/h4cc.in
+++ b/hdf/util/h4cc.in
@@ -113,7 +113,7 @@ for arg in $@ ; do
       compile_args="$compile_args $arg"
 
       if test "x$do_link" = "xyes" -a -n "$output_file"; then
-        compile_args="$compile_args -o $outputfile"
+        compile_args="$compile_args -o $output_file"
       fi
 
       do_link="no"
diff --git a/hdf/util/h4fc.in b/hdf/util/h4fc.in
index 2eb5929..ae893b1 100644
--- a/hdf/util/h4fc.in
+++ b/hdf/util/h4fc.in
@@ -95,7 +95,7 @@ for arg in $@ ; do
       compile_args="$compile_args $arg"
 
       if test "x$do_link" = "xyes" -a -n "$output_file"; then
-        compile_args="$compile_args -o $outputfile"
+        compile_args="$compile_args -o $output_file"
       fi
 
       do_link="no"
diff --git a/hdf/util/hdf24to8.c b/hdf/util/hdf24to8.c
index 823c25a..179222b 100644
--- a/hdf/util/hdf24to8.c
+++ b/hdf/util/hdf24to8.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdf24to8.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdf24to8.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /**************************************************************************
 * hdf24hdf8 Quantizes a HDF RGB 24 bit "pixel" image into a 8 bit image
diff --git a/hdf/util/hdf2jpeg.c b/hdf/util/hdf2jpeg.c
index 683be7a..97e6ac5 100644
--- a/hdf/util/hdf2jpeg.c
+++ b/hdf/util/hdf2jpeg.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdf2jpeg.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdf2jpeg.c 6357 2016-05-13 05:00:06Z bmribler $ */
 #include "hdf.h"
 #include "hfile.h"
 
diff --git a/hdf/util/hdf8to24.c b/hdf/util/hdf8to24.c
index fe156cc..7c154a5 100644
--- a/hdf/util/hdf8to24.c
+++ b/hdf/util/hdf8to24.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdf8to24.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdf8to24.c 6357 2016-05-13 05:00:06Z bmribler $ */
 #include "hdf.h"
 #ifndef I860
 #include <stdlib.h>
diff --git a/hdf/util/hdfcomp.c b/hdf/util/hdfcomp.c
index ea69982..3827710 100644
--- a/hdf/util/hdfcomp.c
+++ b/hdf/util/hdfcomp.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "$Revision: 6013 $";
-#endif
-
-/* $Id: hdfcomp.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdfcomp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
 *  hdfcomp.c
diff --git a/hdf/util/hdfls.c b/hdf/util/hdfls.c
index 08f8447..673abbf 100644
--- a/hdf/util/hdfls.c
+++ b/hdf/util/hdfls.c
@@ -12,11 +12,7 @@
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdfls.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdfls.c 6357 2016-05-13 05:00:06Z bmribler $ */
 #include "hdf.h"
 #include "hfile.h"
 
diff --git a/hdf/util/hdfpack.c b/hdf/util/hdfpack.c
index dbe6197..c9571c5 100644
--- a/hdf/util/hdfpack.c
+++ b/hdf/util/hdfpack.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdfpack.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdfpack.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    ** FILE
diff --git a/hdf/util/hdftopal.c b/hdf/util/hdftopal.c
index 9115103..6b695d4 100644
--- a/hdf/util/hdftopal.c
+++ b/hdf/util/hdftopal.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdftopal.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdftopal.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    *  hdftopal.c
diff --git a/hdf/util/hdftor8.c b/hdf/util/hdftor8.c
index 3855a91..45ff6bf 100644
--- a/hdf/util/hdftor8.c
+++ b/hdf/util/hdftor8.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdftor8.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdftor8.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
  * hdftor8.c
diff --git a/hdf/util/hdfunpac.c b/hdf/util/hdfunpac.c
index 07a79fc..bca26fb 100644
--- a/hdf/util/hdfunpac.c
+++ b/hdf/util/hdfunpac.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: hdfunpac.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: hdfunpac.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    ** FILE
diff --git a/hdf/util/he_cntrl.c b/hdf/util/he_cntrl.c
index 0b6e49d..ae0524c 100644
--- a/hdf/util/he_cntrl.c
+++ b/hdf/util/he_cntrl.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4937 $";
-#endif
-
-/* $Id: he_cntrl.c 4937 2007-09-10 16:36:16Z pvn $ */
+/* $Id: he_cntrl.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* ------ he-cntrl.c ------
    This file contains much of the contol mechanisms for HDFed
diff --git a/hdf/util/he_disp.c b/hdf/util/he_disp.c
index 98da557..132f438 100644
--- a/hdf/util/he_disp.c
+++ b/hdf/util/he_disp.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 4937 $";
-#endif
-
-/* $Id: he_disp.c 4937 2007-09-10 16:36:16Z pvn $ */
+/* $Id: he_disp.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* display.c -- contains code for displaying an image using ICR
  * this code is plucked from hdfrseq.c
diff --git a/hdf/util/he_file.c b/hdf/util/he_file.c
index a2a1aff..49ca896 100644
--- a/hdf/util/he_file.c
+++ b/hdf/util/he_file.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: he_file.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: he_file.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* --- he-file.c  --- file and annotation manipulation routines */
 #include "he.h"
diff --git a/hdf/util/he_main.c b/hdf/util/he_main.c
index 74e40bc..237cda2 100644
--- a/hdf/util/he_main.c
+++ b/hdf/util/he_main.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6036 $";
-#endif
-
-/* $Id: he_main.c 6036 2014-01-20 17:28:01Z acheng $ */
+/* $Id: he_main.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /******************************************************************************
  * he - HDF editor
diff --git a/hdf/util/jpeg2hdf.c b/hdf/util/jpeg2hdf.c
index 802d885..051b5f6 100644
--- a/hdf/util/jpeg2hdf.c
+++ b/hdf/util/jpeg2hdf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char *RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: jpeg2hdf.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: jpeg2hdf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 #include "hdf.h"
 #ifndef I860
 #include <stdlib.h>
diff --git a/hdf/util/paltohdf.c b/hdf/util/paltohdf.c
index fa99c7e..da7102b 100644
--- a/hdf/util/paltohdf.c
+++ b/hdf/util/paltohdf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#) $Revision: 6013 $"
-#endif
-
-/* $Id: paltohdf.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: paltohdf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    *  paltohdf.c
diff --git a/hdf/util/r8tohdf.c b/hdf/util/r8tohdf.c
index 8d6bb69..eefd3d4 100644
--- a/hdf/util/r8tohdf.c
+++ b/hdf/util/r8tohdf.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: r8tohdf.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: r8tohdf.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*
    *  r8tohdf.c
diff --git a/hdf/util/ristosds.c b/hdf/util/ristosds.c
index ddb1cf2..be2d47b 100644
--- a/hdf/util/ristosds.c
+++ b/hdf/util/ristosds.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: ristosds.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: ristosds.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /* This program converts a series raster image hdf files into   */
 /* a single 3D sds hdf file. Each ris hdf file contains one     */
diff --git a/hdf/util/vmake.c b/hdf/util/vmake.c
index 01e34bf..69cbe07 100644
--- a/hdf/util/vmake.c
+++ b/hdf/util/vmake.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char *RcsId[] = "@(#)$Revision: 6013 $";
-#endif
-
-/* $Id: vmake.c 6013 2014-01-10 21:19:02Z acheng $ */
+/* $Id: vmake.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*****************************************************************************
 *
diff --git a/hdf/util/vshow.c b/hdf/util/vshow.c
index bf7aea5..74a28b3 100644
--- a/hdf/util/vshow.c
+++ b/hdf/util/vshow.c
@@ -11,11 +11,7 @@
  * access to either file, you may request a copy from help at hdfgroup.org.     *
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-#ifdef RCSID
-static char *RcsId[] = "@(#)$Revision: 6043 $";
-#endif
-
-/* $Id: vshow.c 6043 2014-01-21 21:09:03Z acheng $ */
+/* $Id: vshow.c 6357 2016-05-13 05:00:06Z bmribler $ */
 
 /*****************************************************************************
 *
diff --git a/hdf/util/writehdf.c b/hdf/util/writehdf.c
index 82b58e1..39fecef 100644
--- a/hdf/util/writehdf.c
+++ b/hdf/util/writehdf.c
@@ -105,9 +105,9 @@ char     *GIFFileName;
 	for (i = 0 ; i < CommentCount ; i++) {
 		sprintf(CommentName , "Comment Extension Data %d" , (int)i);
 		status = Vsetattr (vgroup_id , CommentName , DFNT_CHAR8 , (int32)(GifMemoryStruct.GifCommentExtension[i])->DataSize , (VOIDP)(GifMemoryStruct.GifCommentExtension[i])->CommentData);
-		free(GifMemoryStruct.GifCommentExtension[i]);
+        HDfree(GifMemoryStruct.GifCommentExtension[i]);
 	}
-	free(GifMemoryStruct.GifCommentExtension);
+    HDfree(GifMemoryStruct.GifCommentExtension);
 	
 	for (i = 0 ; i < ApplicationCount ; i++) {
 		sprintf(ApplicationName , "Application Extension Data %d", (int)i);
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
new file mode 100644
index 0000000..fb0ab1c
--- /dev/null
+++ b/java/CMakeLists.txt
@@ -0,0 +1,75 @@
+cmake_minimum_required(VERSION 3.1.0)
+PROJECT ( HDF4_JAVA C Java )
+
+set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}")
+find_package (Java)
+#-----------------------------------------------------------------------------
+# Include some macros for reusable code
+#-----------------------------------------------------------------------------
+include (${HDF_RESOURCES_DIR}/UseJava.cmake)
+
+message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}")
+find_package (JNI)
+
+INCLUDE_DIRECTORIES ( ${JNI_INCLUDE_DIRS} )
+
+if (WIN32)
+  set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8")
+else (WIN32)
+  set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre")
+endif (WIN32)
+
+#-----------------------------------------------------------------------------
+# Include the main src and config directories
+#-----------------------------------------------------------------------------
+set (HDF4_JAVA_INCLUDE_DIRECTORIES
+    ${HDF4_JAVA_JNI_SRC_DIR}
+    ${JAVA_INCLUDE_PATH}
+    ${JAVA_INCLUDE_PATH2}
+)
+INCLUDE_DIRECTORIES (${HDF4_JAVA_INCLUDE_DIRECTORIES})
+set (CMAKE_JAVA_INCLUDE_PATH "")
+
+
+#-----------------------------------------------------------------------------
+# Traverse source subdirectory
+#-----------------------------------------------------------------------------
+add_subdirectory (${HDF4_JAVA_SOURCE_DIR}/src ${HDF4_JAVA_BINARY_DIR}/src)
+
+#-----------------------------------------------------------------------------
+# Build the Java Examples
+#-----------------------------------------------------------------------------
+if (HDF4_BUILD_EXAMPLES)
+  add_subdirectory (${HDF4_JAVA_SOURCE_DIR}/examples ${HDF4_JAVA_BINARY_DIR}/examples)
+endif (HDF4_BUILD_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Testing
+#-----------------------------------------------------------------------------
+if (BUILD_TESTING)
+  add_subdirectory (${HDF4_JAVA_SOURCE_DIR}/test ${HDF4_JAVA_BINARY_DIR}/test)
+endif (BUILD_TESTING)
+
+#-----------------------------------------------------------------------------
+# Add Required Jar(s)
+#-----------------------------------------------------------------------------
+install (
+    FILES
+        ${HDF4_JAVA_LOGGING_JAR}
+        ${HDF4_JAVA_LOGGING_NOP_JAR}
+        ${HDF4_JAVA_LOGGING_SIMPLE_JAR}
+    DESTINATION ${HDF4_INSTALL_JAR_DIR}
+    COMPONENT libraries
+)
+
+#-----------------------------------------------------------------------------
+# Option to include jre
+#-----------------------------------------------------------------------------
+option (HDF4_JAVA_PACK_JRE  "Package a JRE installer directory" OFF)
+if (HDF4_JAVA_PACK_JRE)
+  install (
+      DIRECTORY ${HDF_JRE_DIRECTORY}
+      DESTINATION ${HDF4_INSTALL_BIN_DIR}
+      USE_SOURCE_PERMISSIONS
+  )
+endif (HDF4_JAVA_PACK_JRE)
diff --git a/java/Makefile.am b/java/Makefile.am
new file mode 100644
index 0000000..8588d8d
--- /dev/null
+++ b/java/Makefile.am
@@ -0,0 +1,16 @@
+#
+# HDF Java native interface (JNI) Library Makefile(.in)
+
+include $(top_srcdir)/config/commence.am
+
+## Only recurse into subdirectories if the Java (JNI) interface is enabled.
+if BUILD_JAVA_CONDITIONAL
+
+# Mark this directory as part of the JNI API
+JAVA_API=yes
+
+SUBDIRS=src test examples
+
+endif
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/fortran/Makefile.in b/java/Makefile.in
similarity index 80%
copy from mfhdf/fortran/Makefile.in
copy to java/Makefile.in
index fe1d7fd..842dd98 100644
--- a/mfhdf/fortran/Makefile.in
+++ b/java/Makefile.in
@@ -14,9 +14,8 @@
 
 @SET_MAKE@
 
-#############################################################################
-#############################################################################
-
+#
+# HDF Java native interface (JNI) Library Makefile(.in)
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -84,38 +83,30 @@ host_triplet = @host@
 DIST_COMMON = $(top_srcdir)/config/commence.am \
 	$(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \
 	$(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \
-	$(srcdir)/ftest.f.in $(srcdir)/jackets.c.in \
-	$(srcdir)/netcdf.inc.in $(srcdir)/testfortran.sh.in \
-	$(am__include_HEADERS_DIST) $(top_srcdir)/bin/test-driver
- at HDF_BUILD_NETCDF_FALSE@check_PROGRAMS = hdftest$(EXEEXT) \
- at HDF_BUILD_NETCDF_FALSE@	tszip$(EXEEXT) hdftest1$(EXEEXT)
- at HDF_BUILD_NETCDF_TRUE@check_PROGRAMS = ftest$(EXEEXT) \
- at HDF_BUILD_NETCDF_TRUE@	hdftest$(EXEEXT) tszip$(EXEEXT) \
- at HDF_BUILD_NETCDF_TRUE@	hdftest1$(EXEEXT)
-TESTS = $(TEST_SCRIPT)
-subdir = mfhdf/fortran
-SUBDIRS =
+	$(top_srcdir)/bin/test-driver
+TESTS =
+subdir = java
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
-CONFIG_CLEAN_FILES = ftest.f jackets.c netcdf.inc testfortran.sh
+CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am__ftest_SOURCES_DIST = ftest.f
- at HDF_BUILD_NETCDF_TRUE@am_ftest_OBJECTS = ftest.$(OBJEXT)
-ftest_OBJECTS = $(am_ftest_OBJECTS)
-AM_V_lt = $(am__v_lt_ at AM_V@)
-am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
-am_hdftest_OBJECTS = hdftest.$(OBJEXT)
-hdftest_OBJECTS = $(am_hdftest_OBJECTS)
-am_hdftest1_OBJECTS = hdftest1.$(OBJEXT)
-hdftest1_OBJECTS = $(am_hdftest1_OBJECTS)
-am_tszip_OBJECTS = tszip.$(OBJEXT)
-tszip_OBJECTS = $(am_tszip_OBJECTS)
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -128,26 +119,8 @@ AM_V_at = $(am__v_at_ at AM_V@)
 am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
 am__v_at_0 = @
 am__v_at_1 = 
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
-F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
-LTF77COMPILE = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(F77) $(AM_FFLAGS) $(FFLAGS)
-AM_V_F77 = $(am__v_F77_ at AM_V@)
-am__v_F77_ = $(am__v_F77_ at AM_DEFAULT_V@)
-am__v_F77_0 = @echo "  F77     " $@;
-am__v_F77_1 = 
-F77LD = $(F77)
-F77LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(F77LD) $(AM_FFLAGS) $(FFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_F77LD = $(am__v_F77LD_ at AM_V@)
-am__v_F77LD_ = $(am__v_F77LD_ at AM_DEFAULT_V@)
-am__v_F77LD_0 = @echo "  F77LD   " $@;
-am__v_F77LD_1 = 
-SOURCES = $(ftest_SOURCES) $(hdftest_SOURCES) $(hdftest1_SOURCES) \
-	$(tszip_SOURCES)
-DIST_SOURCES = $(am__ftest_SOURCES_DIST) $(hdftest_SOURCES) \
-	$(hdftest1_SOURCES) $(tszip_SOURCES)
+SOURCES =
+DIST_SOURCES =
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
 	ctags-recursive dvi-recursive html-recursive info-recursive \
 	install-data-recursive install-dvi-recursive \
@@ -161,36 +134,6 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-am__include_HEADERS_DIST = mffunc.inc mffunc.f90 netcdf.inc netcdf.f90
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
-  test -z "$$files" \
-    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
-    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
-         $(am__cd) "$$dir" && rm -f $$files; }; \
-  }
-am__installdirs = "$(DESTDIR)$(includedir)"
-HEADERS = $(include_HEADERS)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -240,6 +183,33 @@ am__tty_colors = { \
     std=''; \
   fi; \
 }
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__recheck_rx = ^[ 	]*:recheck:[ 	]*
 am__global_test_result_rx = ^[ 	]*:global-test-result:[ 	]*
 am__copy_in_global_log_rx = ^[ 	]*:copy-in-global-log:[ 	]*
@@ -390,6 +360,7 @@ am__set_b = \
     *) \
       b='$*';; \
   esac
+DIST_SUBDIRS = src test examples
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -458,12 +429,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -506,11 +492,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -583,44 +572,11 @@ ACLOCAL_AMFLAGS = "-I m4"
 
 # .chkexe files are used to mark tests that have run successfully.
 # .chklog files are output from those tests.
+CHECK_CLEANFILES = *.chkexe *.chklog
 
-#############################################################################
-#############################################################################
-CHECK_CLEANFILES = *.chkexe *.chklog test.nc copy.nc *.hdf \
-	testdir/testext.hdf
-fort_INCLUDES = -I$(top_srcdir)/hdf/src        \
-         -I$(top_srcdir)/hdf/test       \
-         -I$(top_srcdir)/mfhdf/libsrc   \
-         -I$(top_builddir)/mfhdf/libsrc
-
-DEFINES = -DNDEBUG -DHDF
-AM_CPPFLAGS = $(fort_INCLUDES) $(DEFINES)
-DIST_SUBDIRS = examples
- at HDF_BUILD_NETCDF_FALSE@include_HEADERS = mffunc.inc mffunc.f90
-
-#############################################################################
-#############################################################################
- at HDF_BUILD_NETCDF_TRUE@include_HEADERS = netcdf.inc netcdf.f90 mffunc.inc mffunc.f90
-TEST_SCRIPT = testfortran.sh
-check_SCRIPTS = testfortran.sh
- at HDF_BUILD_NETCDF_TRUE@ftest_SOURCES = ftest.f
- at HDF_BUILD_NETCDF_TRUE@ftest_LDADD = $(top_builddir)/hdf/test/forsupff.o $(top_builddir)/hdf/test/forsupf.o \
- at HDF_BUILD_NETCDF_TRUE@              $(LIBMFHDF) $(LIBHDF) @LIBS@
-
- at HDF_BUILD_NETCDF_TRUE@ftest_DEPENDENCIES = $(top_builddir)/hdf/test/forsupff.o $(top_builddir)/hdf/test/forsupf.o \
- at HDF_BUILD_NETCDF_TRUE@                     $(LIBMFHDF) $(LIBHDF)
-
-hdftest_SOURCES = hdftest.f
-hdftest_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
-hdftest_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
-hdftest1_SOURCES = hdftest1.f
-hdftest1_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
-hdftest1_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
-tszip_SOURCES = tszip.f
-tszip_LDADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
-tszip_DEPENDENCIES = testdir $(LIBMFHDF) $(LIBHDF)
-SUFFIXES = .inc .f90
-DISTCLEANFILES = ftest.f jackets.c netcdf.inc mffunc.f90 netcdf.f90
+# Mark this directory as part of the JNI API
+ at BUILD_JAVA_CONDITIONAL_TRUE@JAVA_API = yes
+ at BUILD_JAVA_CONDITIONAL_TRUE@SUBDIRS = src test examples
 
 # Automake needs to be taught how to build lib, progs, and tests targets.
 # These will be filled in automatically for the most part (e.g.,
@@ -642,7 +598,7 @@ TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
 all: all-recursive
 
 .SUFFIXES:
-.SUFFIXES: .inc .f90 .f .lo .log .o .obj .sh .sh$(EXEEXT) .trs
+.SUFFIXES: .log .sh .sh$(EXEEXT) .trs
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -652,9 +608,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/fortran/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign java/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mfhdf/fortran/Makefile
+	  $(AUTOMAKE) --foreign java/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -674,81 +630,12 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-ftest.f: $(top_builddir)/config.status $(srcdir)/ftest.f.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-jackets.c: $(top_builddir)/config.status $(srcdir)/jackets.c.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-netcdf.inc: $(top_builddir)/config.status $(srcdir)/netcdf.inc.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-testfortran.sh: $(top_builddir)/config.status $(srcdir)/testfortran.sh.in
-	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-
-clean-checkPROGRAMS:
-	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
-	echo " rm -f" $$list; \
-	rm -f $$list || exit $$?; \
-	test -n "$(EXEEXT)" || exit 0; \
-	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-	echo " rm -f" $$list; \
-	rm -f $$list
-
-ftest$(EXEEXT): $(ftest_OBJECTS) $(ftest_DEPENDENCIES) $(EXTRA_ftest_DEPENDENCIES) 
-	@rm -f ftest$(EXEEXT)
-	$(AM_V_F77LD)$(F77LINK) $(ftest_OBJECTS) $(ftest_LDADD) $(LIBS)
-
-hdftest$(EXEEXT): $(hdftest_OBJECTS) $(hdftest_DEPENDENCIES) $(EXTRA_hdftest_DEPENDENCIES) 
-	@rm -f hdftest$(EXEEXT)
-	$(AM_V_F77LD)$(F77LINK) $(hdftest_OBJECTS) $(hdftest_LDADD) $(LIBS)
-
-hdftest1$(EXEEXT): $(hdftest1_OBJECTS) $(hdftest1_DEPENDENCIES) $(EXTRA_hdftest1_DEPENDENCIES) 
-	@rm -f hdftest1$(EXEEXT)
-	$(AM_V_F77LD)$(F77LINK) $(hdftest1_OBJECTS) $(hdftest1_LDADD) $(LIBS)
-
-tszip$(EXEEXT): $(tszip_OBJECTS) $(tszip_DEPENDENCIES) $(EXTRA_tszip_DEPENDENCIES) 
-	@rm -f tszip$(EXEEXT)
-	$(AM_V_F77LD)$(F77LINK) $(tszip_OBJECTS) $(tszip_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
-.f.o:
-	$(AM_V_F77)$(F77COMPILE) -c -o $@ $<
-
-.f.obj:
-	$(AM_V_F77)$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.f.lo:
-	$(AM_V_F77)$(LTF77COMPILE) -c -o $@ $<
 
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
-install-includeHEADERS: $(include_HEADERS)
-	@$(NORMAL_INSTALL)
-	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
-	fi; \
-	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  echo "$$d$$p"; \
-	done | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
-	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
-	done
-
-uninstall-includeHEADERS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
@@ -968,7 +855,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	  echo "$$col$$br$$std";					\
 	fi;								\
 	$$success || exit 1
-recheck: all $(check_PROGRAMS) $(check_SCRIPTS)
+recheck: all 
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 	@set +e; $(am__set_TESTS_bases); \
 	bases=`for i in $$bases; do echo $$i; done \
@@ -1050,15 +937,11 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-recursive
-all-am: Makefile $(HEADERS) all-local
+all-am: Makefile all-local
 installdirs: installdirs-recursive
 installdirs-am:
-	for dir in "$(DESTDIR)$(includedir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -1088,20 +971,17 @@ clean-generic:
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-recursive
 
-clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
-	mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
 
 distclean: distclean-recursive
 	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-local distclean-tags
+distclean-am: clean-am distclean-generic distclean-tags
 
 dvi: dvi-recursive
 
@@ -1115,7 +995,7 @@ info: info-recursive
 
 info-am:
 
-install-data-am: install-includeHEADERS
+install-data-am:
 
 install-dvi: install-dvi-recursive
 
@@ -1141,7 +1021,7 @@ install-ps: install-ps-recursive
 
 install-ps-am:
 
-installcheck-am: installcheck-local
+installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
 	-rm -f Makefile
@@ -1149,8 +1029,8 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-recursive
 
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool mostlyclean-local
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local
 
 pdf: pdf-recursive
 
@@ -1160,55 +1040,24 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am: uninstall-includeHEADERS
+uninstall-am:
 
 .MAKE: $(am__recursive_targets) check-am install-am install-strip
 
 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am all-local \
-	check check-TESTS check-am clean clean-checkPROGRAMS \
-	clean-generic clean-libtool cscopelist-am ctags ctags-am \
-	distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-local distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
-	install-data install-data-am install-dvi install-dvi-am \
-	install-exec install-exec-am install-html install-html-am \
-	install-includeHEADERS install-info install-info-am \
-	install-man install-pdf install-pdf-am install-ps \
-	install-ps-am install-strip installcheck installcheck-am \
-	installcheck-local installdirs installdirs-am maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
-	pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \
-	uninstall-includeHEADERS
-
-
-testdir:
-	-mkdir testdir
-.inc.f90:
-	sed -e 's/^[cC]/!/' -e 's/^     [^ ]/     \&/' < $< > $*.f90
-
-# Recurse into examples directory for examples tests.
-installcheck-local:
-	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
-
-# 'make install-all' also installs examples
-install-all:
-	@$(MAKE) $(AM_MAKEFLAGS) install
-	@$(MAKE) $(AM_MAKEFLAGS) install-examples
-uninstall-all:
-	@$(MAKE) $(AM_MAKEFLAGS) uninstall
-	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
-
-# Install examples recursively
-install-examples uninstall-examples:
-	@@SETX@; for d in examples; do \
-	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
-	done
+	check check-TESTS check-am clean clean-generic clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am \
+	recheck tags tags-am uninstall uninstall-am
 
-# Automake's distclean won't remove directories, so we can add an additional
-# hook target which will do so during 'make distclean'.
-distclean-local:
-	-rm -rf testdir
 
 # lib/progs/tests targets recurse into subdirectories. build-* targets
 # build files in this directory.
diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt
new file mode 100644
index 0000000..e6e4afc
--- /dev/null
+++ b/java/examples/CMakeLists.txt
@@ -0,0 +1,89 @@
+cmake_minimum_required (VERSION 3.1.0)
+project (HDF4_JAVA_Examples Java)
+
+set (CMAKE_VERBOSE_MAKEFILE 1)
+
+INCLUDE_DIRECTORIES (
+    ${HDF4_JAVA_JNI_BINARY_DIR}
+    ${HDF4_JAVA_HDF_LIB_DIR}
+)
+
+set (HDFJNI_EXAMPLES
+    HDF4FileCreate
+    HDF4GroupCreate
+    HDF4DatasetCreate
+)
+
+set (CMAKE_JAVA_INCLUDE_PATH "${HDF4_JAVA_JARS};${HDF4_JAVA_LOGGING_JAR};${HDF4_JAVA_LOGGING_SIMPLE_JAR}")
+
+if (WIN32 AND NOT CYGWIN)
+  set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";")
+else (WIN32 AND NOT CYGWIN)
+  set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":")
+endif (WIN32 AND NOT CYGWIN)
+
+set (CMAKE_JAVA_CLASSPATH ".")
+foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH})
+  set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}")
+endforeach (CMAKE_INCLUDE_PATH)
+
+foreach (HCP_JAR ${CMAKE_JAVA_INCLUDE_PATH})
+  get_filename_component (_HCP_FILE ${HCP_JAR} NAME)
+  set (HDFJNI_CLASSJARS "${_HCP_FILE} ${HDFJNI_CLASSJARS}")
+endforeach (HCP_JAR ${CMAKE_JAVA_INCLUDE_PATH})
+
+foreach (example ${HDFJNI_EXAMPLES})
+  file (WRITE ${HDF4_JAVA_Examples_BINARY_DIR}/Manifest.txt
+  "Main-Class: examples.${example}
+Class-Path: ${HDFJNI_CLASSJARS}
+"
+  )
+  add_jar (${example} MANIFEST ${HDF4_JAVA_Examples_BINARY_DIR}/Manifest.txt ${example}.java)
+  get_target_property (${example}_JAR_FILE ${example} JAR_FILE)
+  add_dependencies (${example} ${HDF4_JAVA_HDF_LIB_TARGET})
+  set_target_properties (${example} PROPERTIES FOLDER examples/java)
+endforeach (example ${HDFJNI_EXAMPLES})
+
+if (CMAKE_BUILD_TYPE MATCHES Debug)
+  set (CMD_ARGS "-Dhdf.hdflib.HDFLibrary.loadLibraryName=hdf_java_debug;")
+endif(CMAKE_BUILD_TYPE MATCHES Debug)
+
+if (BUILD_TESTING)
+  macro (ADD_H4_TEST resultfile resultcode)
+    add_test (
+        NAME JAVAEX-${resultfile}
+        COMMAND "${CMAKE_COMMAND}"
+            -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}"
+            -D "TEST_PROGRAM=examples.${resultfile}"
+            -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}"
+            -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}"
+            -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
+            -D "TEST_FOLDER=${HDF4_JAVA_Examples_BINARY_DIR}"
+            -D "TEST_OUTPUT=${HDF4_JAVA_Examples_BINARY_DIR}/${resultfile}.out"
+            -D "TEST_EXPECT=${resultcode}"
+            -D "TEST_SKIP_COMPARE=TRUE"
+            -P "${HDF_RESOURCES_DIR}/jrunTest.cmake"
+    )
+    if (NOT "${last_test}" STREQUAL "")
+      set_tests_properties (JAVAEX-${resultfile} PROPERTIES DEPENDS ${last_test})
+    endif (NOT "${last_test}" STREQUAL "")
+    set (last_test "JAVAEX-${resultfile}")
+  endmacro (ADD_H4_TEST file)
+
+  foreach (example ${HDFJNI_EXAMPLES})
+    add_test (
+        NAME JAVAEX-${example}-clearall-objects
+        COMMAND    ${CMAKE_COMMAND}
+            -E remove
+            ${HDF4_JAVA_Examples_BINARY_DIR}/${example}.hdf
+            ${example}.out
+            ${example}.out.err
+    )
+    if (NOT "${last_test}" STREQUAL "")
+      set_tests_properties (JAVAEX-${example}-clearall-objects PROPERTIES DEPENDS ${last_test})
+    endif (NOT "${last_test}" STREQUAL "")
+    set (last_test "JAVAEX-${example}-clearall-objects")
+    ADD_H4_TEST (${example} 0)
+  endforeach (example ${HDFJNI_EXAMPLES})
+
+endif (BUILD_TESTING)
diff --git a/java/examples/HDF4DatasetCreate.java b/java/examples/HDF4DatasetCreate.java
new file mode 100644
index 0000000..c4e4f96
--- /dev/null
+++ b/java/examples/HDF4DatasetCreate.java
@@ -0,0 +1,203 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Products. The full HDF copyright                 *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package examples;
+
+import hdf.hdflib.HDFConstants;
+import hdf.hdflib.HDFLibrary;
+
+/**
+ * <p>
+ * Title: HDF Native Package (Java) Example
+ * </p>
+ * <p>
+ * Description: this example shows how to create HDF4 datasets using the
+ * "HDF Native Package (Java)". The example creates the group structure and
+ * datasets:
+ *
+ * <pre>
+ *     "/" (root)
+ *         integer arrays
+ *             2D 32-bit integer 20x10
+ *             3D unsigned 8-bit integer 20x10x5
+ *         float arrays
+ *             2D 64-bit double 20x10
+ *             3D 32-bit float  20x10x5
+ * </pre>
+ *
+ * Reference the C Example, VG_add_sds_to_vgroup.
+ * </p>
+ */
+public class HDF4DatasetCreate {
+    private static String fname  = "HDF4DatasetCreate.hdf";
+    private static int[] dims2D = { 20, 10 };
+    private static int[] dims3D = { 20, 10, 5 };
+
+    public static void main(String args[]) throws Exception {
+        long file_id = -1;
+        long vgroup_id1 = -1;
+        long vgroup_id2 = -1;
+        long sd_id = -1;
+        long sds_id = -1;
+        int sds_ref = -1;
+
+        // Create a new file using default properties.
+        try {
+            file_id = HDFLibrary.Hopen(fname, HDFConstants.DFACC_CREATE);
+            // Initialize the V interface.
+            HDFLibrary.Vstart(file_id);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            System.err.println("Failed to create file:" + fname);
+            return;
+        }
+
+        // Create two vgroups and set their name and class.
+        try {
+            // Create the vgroup.  Note that the vgroup reference number is set
+            // to -1 for creating and the access mode is "w" for writing.
+            vgroup_id1 = HDFLibrary.Vattach (file_id, -1, "w");
+            if (vgroup_id1 >= 0) {
+                HDFLibrary.Vsetname(vgroup_id1, "integer arrays");
+                HDFLibrary.Vsetclass (vgroup_id1, "Common Vgroups");
+            }
+            vgroup_id2 = HDFLibrary.Vattach (file_id, -1, "w");
+            if (vgroup_id2 >= 0) {
+                HDFLibrary.Vsetname(vgroup_id2, "float arrays");
+                HDFLibrary.Vsetclass (vgroup_id2, "Common Vgroups");
+            }
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // Initialize the SD interface.
+        try {
+            sd_id = HDFLibrary.SDstart (fname, HDFConstants.DFACC_WRITE);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        if (sd_id > 0) {
+            // create the SDS, 2D 32-bit (4 bytes) integer dataset of 20 by 10
+            try {
+                sds_id = HDFLibrary.SDcreate (sd_id, "2D 32-bit integer 20x10", (long)HDFConstants.DFNT_INT32, 2, dims2D);
+                if (sds_id >= 0) {
+                    // Obtain the reference number of the SDS using its identifier.
+                    sds_ref = HDFLibrary.SDidtoref(sds_id);
+                    System.out.println("sds_ref:" + sds_ref);
+                    // Add the SDS to the vgroup.  Note: the tag DFTAG_NDG is used
+                    // when adding an SDS.  Refer to Appendix A for the entire list of tags.
+                    HDFLibrary.Vaddtagref(vgroup_id1, HDFConstants.DFTAG_NDG, sds_ref);
+                    // Terminate access to the data set.
+                    HDFLibrary.SDendaccess(sds_id);
+                }
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            try {
+                // create 3D 8-bit (1 byte) unsigned integer dataset of 20 by 10 by 5
+                sds_id = HDFLibrary.SDcreate (sd_id, "3D 8-bit unsigned integer 20x10x5", (long)HDFConstants.DFNT_INT8, 3, dims3D);
+                if (sds_id >= 0) {
+                    // Obtain the reference number of the SDS using its identifier.
+                    sds_ref = HDFLibrary.SDidtoref(sds_id);
+                    System.out.println("sds_ref:" + sds_ref);
+                    // Add the SDS to the vgroup.  Note: the tag DFTAG_NDG is used
+                    // when adding an SDS.  Refer to Appendix A for the entire list of tags.
+                    HDFLibrary.Vaddtagref(vgroup_id1, HDFConstants.DFTAG_NDG, sds_ref);
+                    // Terminate access to the data set.
+                    HDFLibrary.SDendaccess(sds_id);
+                }
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            try {
+                // create 2D 64-bit (8 bytes) double dataset of 20 by 10
+                sds_id = HDFLibrary.SDcreate (sd_id, "2D 64-bit double 20x10", HDFConstants.DFNT_FLOAT64, 2, dims2D);
+                if (sds_id >= 0) {
+                    // Obtain the reference number of the SDS using its identifier.
+                    sds_ref = HDFLibrary.SDidtoref(sds_id);
+                    System.out.println("sds_ref:" + sds_ref);
+                    // Add the SDS to the vgroup.  Note: the tag DFTAG_NDG is used
+                    // when adding an SDS.  Refer to Appendix A for the entire list of tags.
+                    HDFLibrary.Vaddtagref(vgroup_id2, HDFConstants.DFTAG_NDG, sds_ref);
+                    // Terminate access to the data set.
+                    HDFLibrary.SDendaccess(sds_id);
+                }
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            try {
+                // create 3D 32-bit (4 bytes) float dataset of 20 by 10 by 5
+                sds_id = HDFLibrary.SDcreate (sd_id, "3D 32-bit float  20x10x5", HDFConstants.DFNT_FLOAT32, 3, dims3D);
+                if (sds_id >= 0) {
+                    // Obtain the reference number of the SDS using its identifier.
+                    sds_ref = HDFLibrary.SDidtoref(sds_id);
+                    System.out.println("sds_ref:" + sds_ref);
+                    // Add the SDS to the vgroup.  Note: the tag DFTAG_NDG is used
+                    // when adding an SDS.  Refer to Appendix A for the entire list of tags.
+                    HDFLibrary.Vaddtagref(vgroup_id2, HDFConstants.DFTAG_NDG, sds_ref);
+                    // Terminate access to the data set.
+                    HDFLibrary.SDendaccess(sds_id);
+                }
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            // Terminate access to the SD interface and close the file.
+            try {
+                HDFLibrary.SDend(sd_id);
+            }
+            catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        else {
+            System.err.println("Could not initialize SDS interface");
+        }
+        // Close the groups.
+        try {
+            if (vgroup_id2 >= 0)
+                HDFLibrary.Vdetach(vgroup_id2);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+        try {
+            if (vgroup_id1 >= 0)
+                HDFLibrary.Vdetach(vgroup_id1);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // Close the file.
+        try {
+            if (file_id >= 0) {
+                HDFLibrary.Vend (file_id);
+                HDFLibrary.Hclose(file_id);
+            }
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/java/examples/HDF4FileCreate.java b/java/examples/HDF4FileCreate.java
new file mode 100644
index 0000000..782fbf3
--- /dev/null
+++ b/java/examples/HDF4FileCreate.java
@@ -0,0 +1,52 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Products. The full HDF copyright                 *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package examples;
+
+import hdf.hdflib.HDFConstants;
+import hdf.hdflib.HDFLibrary;
+
+/**
+ * <p>
+ * Title: HDF Native Package (Java) Example
+ * </p>
+ * <p>
+ * Description: this example shows how to create an empty HDF4 file using the
+ * "HDF Native Package (Java)".
+ * </p>
+ */
+public class HDF4FileCreate {
+    private static String fname = "HDF4FileCreate.hdf";
+
+    public static void main(String args[]) throws Exception {
+        long file_id = -1;
+
+        // Create a new file using default properties.
+        try {
+            file_id = HDFLibrary.Hopen(fname, HDFConstants.DFACC_CREATE);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            System.err.println("Failed to create file:" + fname);
+            return;
+        }
+
+        // Close the file.
+        try {
+            if (file_id >= 0)
+                HDFLibrary.Hclose(file_id);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/java/examples/HDF4GroupCreate.java b/java/examples/HDF4GroupCreate.java
new file mode 100644
index 0000000..225e788
--- /dev/null
+++ b/java/examples/HDF4GroupCreate.java
@@ -0,0 +1,108 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group.                                               *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Products. The full HDF copyright                 *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+package examples;
+
+import hdf.hdflib.HDFConstants;
+import hdf.hdflib.HDFLibrary;
+
+/**
+ * <p>
+ * Title: HDF Native Package (Java) Example
+ * </p>
+ * <p>
+ * Description: this example shows how to create HDF4 groups using the
+ * "HDF Native Package (Java)". The example creates the group structure:
+ *
+ * <pre>
+ *     "/" (root)
+ *         g1
+ *             g11
+ *             g12
+ *         g2
+ *             g21
+ *             g22
+ * </pre>
+ *
+ * </p>
+ */
+public class HDF4GroupCreate {
+    private static String fname = "HDF4GroupCreate.hdf";
+
+    public static void main(String args[]) throws Exception {
+        long file_id = -1;
+        long subvgroup_id = -1;
+        long vgroup_id1 = -1;
+        long vgroup_id2 = -1;
+
+        // Create a new file using default properties.
+        try {
+            file_id = HDFLibrary.Hopen(fname, HDFConstants.DFACC_CREATE);
+            // Initialize the V interface.
+            if (file_id >= 0)
+                HDFLibrary.Vstart(file_id);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+            System.err.println("Failed to create file:" + fname);
+            return;
+        }
+
+        try {
+            // Create the vgroup.  Note that the vgroup reference number is set
+            // to -1 for creating and the access mode is "w" for writing.
+            if (file_id >= 0) {
+                vgroup_id1 = HDFLibrary.VSattach (file_id, -1, "w");
+                if (vgroup_id1 >= 0) {
+                    HDFLibrary.VSsetname(vgroup_id1, "g1");
+                    HDFLibrary.VSsetclass (vgroup_id1, "Empty Vdatas");
+                }
+                vgroup_id2 = HDFLibrary.VSattach (file_id, -1, "w");
+                if (vgroup_id2 >= 0) {
+                    HDFLibrary.VSsetname(vgroup_id2, "g2");
+                    HDFLibrary.VSsetclass (vgroup_id2, "Empty Vdatas");
+                }
+            }
+
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // Close the groups.
+        try {
+            if (vgroup_id2 >= 0)
+                HDFLibrary.VSdetach(vgroup_id2);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+        try {
+            if (vgroup_id1 >= 0)
+                HDFLibrary.VSdetach(vgroup_id1);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // Close the file.
+        try {
+            if (file_id >= 0) {
+                HDFLibrary.Vend (file_id);
+                HDFLibrary.Hclose(file_id);
+            }
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/java/examples/Makefile.am b/java/examples/Makefile.am
new file mode 100644
index 0000000..56d422e
--- /dev/null
+++ b/java/examples/Makefile.am
@@ -0,0 +1,48 @@
+#
+# HDF Java native interface (JNI) Library Examples Makefile(.in)
+
+include $(top_srcdir)/config/commence.am
+
+# Mark this directory as part of the JNI API
+JAVA_API=yes
+
+JAVAROOT = .classes
+
+classes:
+	test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT)
+
+pkgpath = examples
+hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
+jarfile = jar$(PACKAGE_TARNAME)examples.jar
+
+CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
+AM_JAVACFLAGS = $(H4_JAVACFLAGS) -deprecation
+
+noinst_JAVA = \
+	HDF4FileCreate.java \
+	HDF4GroupCreate.java \
+	HDF4DatasetCreate.java
+
+$(jarfile): classnoinst.stamp classes
+	$(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath)
+
+noinst_DATA = $(jarfile)
+
+.PHONY: classes
+
+check_SCRIPTS = 
+TEST_SCRIPT = $(check_SCRIPTS)
+
+CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class
+
+#JAVA_JUNIT  = $(JAVA_SRCS)
+#noinst_JAVA = @JAVA_JUNIT@
+#EXTRA_JAVA  = $(JAVA_JUNIT)
+#EXTRA_TEST  = $(TESTS_JUNIT)
+
+clean:
+	rm -rf $(JAVAROOT)/*
+	rm -f $(jarfile)
+	rm -f classnoinst.stamp
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/nctest/Makefile.in b/java/examples/Makefile.in
similarity index 76%
copy from mfhdf/nctest/Makefile.in
copy to java/examples/Makefile.in
index 4e60508..2c5094e 100644
--- a/mfhdf/nctest/Makefile.in
+++ b/java/examples/Makefile.in
@@ -14,8 +14,9 @@
 
 @SET_MAKE@
 
-#############################################################################
-#############################################################################
+#
+# HDF Java native interface (JNI) Library Examples Makefile(.in)
+
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -83,30 +84,30 @@ host_triplet = @host@
 DIST_COMMON = $(top_srcdir)/config/commence.am \
 	$(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \
 	$(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \
-	$(top_srcdir)/bin/depcomp $(top_srcdir)/bin/test-driver README
-check_PROGRAMS = nctest$(EXEEXT)
-TESTS = $(am__EXEEXT_1)
-subdir = mfhdf/nctest
+	$(top_srcdir)/bin/test-driver
+TESTS = $(am__EXEEXT_2)
+subdir = java/examples
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/hdf/src/h4config.h
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
-am_nctest_OBJECTS = add.$(OBJEXT) atttests.$(OBJEXT) \
-	cdftests.$(OBJEXT) dimtests.$(OBJEXT) driver.$(OBJEXT) \
-	emalloc.$(OBJEXT) error.$(OBJEXT) misctest.$(OBJEXT) \
-	rec.$(OBJEXT) slabs.$(OBJEXT) val.$(OBJEXT) \
-	varget_unlim.$(OBJEXT) varget.$(OBJEXT) vargetg.$(OBJEXT) \
-	varput.$(OBJEXT) varputg.$(OBJEXT) vardef.$(OBJEXT) \
-	vartests.$(OBJEXT) vputget.$(OBJEXT) vputgetg.$(OBJEXT)
-nctest_OBJECTS = $(am_nctest_OBJECTS)
-AM_V_lt = $(am__v_lt_ at AM_V@)
-am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
-am__v_lt_0 = --silent
-am__v_lt_1 = 
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -119,54 +120,16 @@ AM_V_at = $(am__v_at_ at AM_V@)
 am__v_at_ = $(am__v_at_ at AM_DEFAULT_V@)
 am__v_at_0 = @
 am__v_at_1 = 
-DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)/hdf/src
-depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
-	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
-	$(AM_CFLAGS) $(CFLAGS)
-AM_V_CC = $(am__v_CC_ at AM_V@)
-am__v_CC_ = $(am__v_CC_ at AM_DEFAULT_V@)
-am__v_CC_0 = @echo "  CC      " $@;
-am__v_CC_1 = 
-CCLD = $(CC)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
-	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
-am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
-am__v_CCLD_0 = @echo "  CCLD    " $@;
-am__v_CCLD_1 = 
-SOURCES = $(nctest_SOURCES)
-DIST_SOURCES = $(nctest_SOURCES)
+SOURCES =
+DIST_SOURCES =
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+am__java_sources = $(noinst_JAVA)
+DATA = $(noinst_DATA)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates.  Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
-  BEGIN { nonempty = 0; } \
-  { items[$$0] = 1; nonempty = 1; } \
-  END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique.  This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
-  list='$(am__tagged_files)'; \
-  unique=`for i in $$list; do \
-    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-  done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
 am__tty_colors_dummy = \
   mgn= red= grn= lgn= blu= brg= std=; \
   am__color_tests=no
@@ -351,10 +314,14 @@ am__set_TESTS_bases = \
   bases=`echo $$bases`
 RECHECK_LOGS = $(TEST_LOGS)
 AM_RECURSIVE_TARGETS = check recheck
-am__EXEEXT_1 = nctest$(EXEEXT)
+am__EXEEXT_1 =
+am__EXEEXT_2 = $(am__EXEEXT_1)
 TEST_SUITE_LOG = test-suite.log
-LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
-LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
+TEST_LOGS = $(am__test_logs2:.sh.log=.log)
+SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
+SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
 am__set_b = \
   case '$@' in \
     */*) \
@@ -365,11 +332,6 @@ am__set_b = \
     *) \
       b='$*';; \
   esac
-am__test_logs1 = $(TESTS:=.log)
-am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
-TEST_LOGS = $(am__test_logs2:.sh.log=.log)
-SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
-SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -413,12 +375,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -461,11 +438,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -538,30 +518,25 @@ ACLOCAL_AMFLAGS = "-I m4"
 
 # .chkexe files are used to mark tests that have run successfully.
 # .chklog files are output from those tests.
-
-#############################################################################
-#############################################################################
-CHECK_CLEANFILES = *.chkexe *.chklog test2.nc test.nc
-nctest_INCLUDES = -I$(top_srcdir)/hdf/src        \
-         -I$(top_srcdir)/mfhdf/libsrc   \
-         -I$(top_builddir)/mfhdf/libsrc
-
-DEFINES = -DNDEBUG -DHDF
-AM_CPPFLAGS = $(nctest_INCLUDES) $(DEFINES)
-
-#############################################################################
-#############################################################################
-TEST_PROG = nctest
-
-# Information for building the "ncgen" program
-nctest_SOURCES = add.c atttests.c cdftests.c dimtests.c driver.c emalloc.c  \
-                 error.c misctest.c rec.c slabs.c val.c varget_unlim.c      \
-                 varget.c vargetg.c varput.c varputg.c vardef.c vartests.c  \
-                 vputget.c vputgetg.c
-
-nctest_LDADD = $(LIBMFHDF) $(LIBHDF)
-nctest_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
-DISTCLEANFILES = 
+CHECK_CLEANFILES = *.chkexe *.chklog
+
+# Mark this directory as part of the JNI API
+JAVA_API = yes
+JAVAROOT = .classes
+pkgpath = examples
+hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
+jarfile = jar$(PACKAGE_TARNAME)examples.jar
+CLASSPATH_ENV = CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH
+AM_JAVACFLAGS = $(H4_JAVACFLAGS) -deprecation
+noinst_JAVA = \
+	HDF4FileCreate.java \
+	HDF4GroupCreate.java \
+	HDF4DatasetCreate.java
+
+noinst_DATA = $(jarfile)
+check_SCRIPTS = 
+TEST_SCRIPT = $(check_SCRIPTS)
+CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class
 
 # Automake needs to be taught how to build lib, progs, and tests targets.
 # These will be filled in automatically for the most part (e.g.,
@@ -583,7 +558,7 @@ TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .c .lo .log .o .obj .sh .sh$(EXEEXT) .trs
+.SUFFIXES: .log .sh .sh$(EXEEXT) .trs
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -593,9 +568,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/nctest/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign java/examples/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mfhdf/nctest/Makefile
+	  $(AUTOMAKE) --foreign java/examples/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -616,124 +591,31 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
 
-clean-checkPROGRAMS:
-	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
-	echo " rm -f" $$list; \
-	rm -f $$list || exit $$?; \
-	test -n "$(EXEEXT)" || exit 0; \
-	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-	echo " rm -f" $$list; \
-	rm -f $$list
-
-nctest$(EXEEXT): $(nctest_OBJECTS) $(nctest_DEPENDENCIES) $(EXTRA_nctest_DEPENDENCIES) 
-	@rm -f nctest$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(nctest_OBJECTS) $(nctest_LDADD) $(LIBS)
-
-mostlyclean-compile:
-	-rm -f *.$(OBJEXT)
-
-distclean-compile:
-	-rm -f *.tab.c
-
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/add.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/atttests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cdftests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dimtests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/driver.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/emalloc.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/misctest.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rec.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/slabs.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/val.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vardef.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varget_unlim.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vargetg.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varput.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/varputg.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vartests.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputget.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vputgetg.Po at am__quote@
-
-.c.o:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ $<
-
-.c.obj:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-.c.lo:
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
 clean-libtool:
 	-rm -rf .libs _libs
 
-ID: $(am__tagged_files)
-	$(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-am
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	set x; \
-	here=`pwd`; \
-	$(am__define_uniq_tagged_files); \
-	shift; \
-	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  if test $$# -gt 0; then \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      "$$@" $$unique; \
-	  else \
-	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	      $$unique; \
-	  fi; \
-	fi
-ctags: ctags-am
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
-	$(am__define_uniq_tagged_files); \
-	test -z "$(CTAGS_ARGS)$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && $(am__cd) $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) "$$here"
-cscopelist: cscopelist-am
-
-cscopelist-am: $(am__tagged_files)
-	list='$(am__tagged_files)'; \
-	case "$(srcdir)" in \
-	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
-	  *) sdir=$(subdir)/$(srcdir) ;; \
-	esac; \
-	for i in $$list; do \
-	  if test -f "$$i"; then \
-	    echo "$(subdir)/$$i"; \
-	  else \
-	    echo "$$sdir/$$i"; \
-	  fi; \
-	done >> $(top_builddir)/cscope.files
+classnoinst.stamp: $(am__java_sources)
+	@list1='$?'; list2=; if test -n "$$list1"; then \
+	  for p in $$list1; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    list2="$$list2 $$d$$p"; \
+	  done; \
+	  echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \
+	  $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \
+	else :; fi
+	echo timestamp > $@
+
+clean-noinstJAVA:
+	-rm -f *.class classnoinst.stamp
+tags TAGS:
+
+ctags CTAGS:
+
+cscope cscopelist:
 
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 # Recover from deleted '.trs' file; this should ensure that
 # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
@@ -854,7 +736,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	  echo "$$col$$br$$std";					\
 	fi;								\
 	$$success || exit 1
-recheck: all $(check_PROGRAMS)
+recheck: all $(check_SCRIPTS)
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 	@set +e; $(am__set_TESTS_bases); \
 	bases=`for i in $$bases; do echo $$i; done \
@@ -865,13 +747,6 @@ recheck: all $(check_PROGRAMS)
 	        am__force_recheck=am--force-recheck \
 	        TEST_LOGS="$$log_list"; \
 	exit $$?
-nctest.log: nctest$(EXEEXT)
-	@p='nctest$(EXEEXT)'; \
-	b='nctest'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .sh.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -918,10 +793,10 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+	$(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile all-local
+all-am: Makefile classnoinst.stamp $(DATA) all-local
 installdirs:
 install: install-am
 install-exec: install-exec-am
@@ -948,25 +823,20 @@ mostlyclean-generic:
 	-test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
-	mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstJAVA mostlyclean-am
 
 distclean: distclean-am
-	-rm -rf ./$(DEPDIR)
 	-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-	distclean-tags
+distclean-am: clean-am distclean-generic
 
 dvi: dvi-am
 
@@ -1009,14 +879,13 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-	-rm -rf ./$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-	mostlyclean-libtool mostlyclean-local
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool \
+	mostlyclean-local
 
 pdf: pdf-am
 
@@ -1030,20 +899,37 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \
-	check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
-	cscopelist-am ctags ctags-am distclean distclean-compile \
-	distclean-generic distclean-libtool distclean-tags distdir dvi \
-	dvi-am html html-am info info-am install install-am \
+.PHONY: all all-am all-local check check-TESTS check-am clean \
+	clean-generic clean-libtool clean-noinstJAVA cscopelist-am \
+	ctags-am distclean distclean-generic distclean-libtool distdir \
+	dvi dvi-am html html-am info info-am install install-am \
 	install-data install-data-am install-dvi install-dvi-am \
 	install-exec install-exec-am install-html install-html-am \
 	install-info install-info-am install-man install-pdf \
 	install-pdf-am install-ps install-ps-am install-strip \
 	installcheck installcheck-am installdirs maintainer-clean \
-	maintainer-clean-generic mostlyclean mostlyclean-compile \
-	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
-	pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool mostlyclean-local pdf pdf-am ps ps-am \
+	recheck tags-am uninstall uninstall-am
+
+
+classes:
+	test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT)
+
+$(jarfile): classnoinst.stamp classes
+	$(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath)
+
+.PHONY: classes
+
+#JAVA_JUNIT  = $(JAVA_SRCS)
+#noinst_JAVA = @JAVA_JUNIT@
+#EXTRA_JAVA  = $(JAVA_JUNIT)
+#EXTRA_TEST  = $(TESTS_JUNIT)
 
+clean:
+	rm -rf $(JAVAROOT)/*
+	rm -f $(jarfile)
+	rm -f classnoinst.stamp
 
 # lib/progs/tests targets recurse into subdirectories. build-* targets
 # build files in this directory.
diff --git a/java/lib/ext/slf4j-nop-1.7.5.jar b/java/lib/ext/slf4j-nop-1.7.5.jar
new file mode 100644
index 0000000..e55bdd8
Binary files /dev/null and b/java/lib/ext/slf4j-nop-1.7.5.jar differ
diff --git a/java/lib/ext/slf4j-simple-1.7.5.jar b/java/lib/ext/slf4j-simple-1.7.5.jar
new file mode 100644
index 0000000..9dece31
Binary files /dev/null and b/java/lib/ext/slf4j-simple-1.7.5.jar differ
diff --git a/java/lib/hamcrest-core.jar b/java/lib/hamcrest-core.jar
new file mode 100644
index 0000000..9d5fe16
Binary files /dev/null and b/java/lib/hamcrest-core.jar differ
diff --git a/java/lib/junit.jar b/java/lib/junit.jar
new file mode 100644
index 0000000..aaf7444
Binary files /dev/null and b/java/lib/junit.jar differ
diff --git a/java/lib/simplelogger.properties b/java/lib/simplelogger.properties
new file mode 100644
index 0000000..119ee92
--- /dev/null
+++ b/java/lib/simplelogger.properties
@@ -0,0 +1,36 @@
+# SLF4J's SimpleLogger configuration file
+# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
+
+org.slf4j.simpleLogger.logFile=slf4j.simpleLogger.log
+
+# Default logging detail level for all instances of SimpleLogger.
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, defaults to "info".
+org.slf4j.simpleLogger.defaultLog=trace
+
+# Logging detail level for a SimpleLogger instance named "xxxxx".
+# Must be one of ("trace", "debug", "info", "warn", or "error").
+# If not specified, the default logging detail level is used.
+#org.slf4j.simpleLogger.log.xxxxx=
+
+# Set to true if you want the current date and time to be included in output messages.
+# Default is false, and will output the number of milliseconds elapsed since startup.
+#org.slf4j.simpleLogger.showDateTime=false
+
+# The date and time format to be used in the output messages.
+# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
+# If the format is not specified or is invalid, the default format is used.
+# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
+org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
+
+# Set to true if you want to output the current thread name.
+# Defaults to true.
+org.slf4j.simpleLogger.showThreadName=true
+
+# Set to true if you want the Logger instance name to be included in output messages.
+# Defaults to true.
+org.slf4j.simpleLogger.showLogName=true
+
+# Set to true if you want the last component of the name to be included in output messages.
+# Defaults to false.
+org.slf4j.simpleLogger.showShortLogName=false
diff --git a/java/lib/slf4j-api-1.7.5.jar b/java/lib/slf4j-api-1.7.5.jar
new file mode 100644
index 0000000..8766455
Binary files /dev/null and b/java/lib/slf4j-api-1.7.5.jar differ
diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt
new file mode 100644
index 0000000..e79f6e5
--- /dev/null
+++ b/java/src/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.1.0)
+PROJECT ( HDF4_JAVA_SRC C Java )
+
+#-----------------------------------------------------------------------------
+# Traverse source subdirectory
+#-----------------------------------------------------------------------------
+add_subdirectory (${HDF4_JAVA_SRC_SOURCE_DIR}/jni ${HDF4_JAVA_SRC_BINARY_DIR}/jni)
+add_subdirectory (${HDF4_JAVA_SRC_SOURCE_DIR}/hdf ${HDF4_JAVA_SRC_BINARY_DIR}/hdf)
diff --git a/java/src/Makefile.am b/java/src/Makefile.am
new file mode 100644
index 0000000..12310fc
--- /dev/null
+++ b/java/src/Makefile.am
@@ -0,0 +1,73 @@
+#
+# HDF Java native interface (JNI) Library Makefile(.in)
+
+include $(top_srcdir)/config/commence.am
+
+# Mark this directory as part of the JNI API
+JAVA_API=yes
+
+SUBDIRS=jni
+
+JAVAROOT = .classes
+
+classes:
+	test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT)
+
+jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
+hdf_javadir = $(libdir)
+
+pkgpath = hdf/hdflib
+CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH
+
+AM_JAVACFLAGS = $(H4_JAVACFLAGS) -deprecation
+
+hdf_java_JAVA =  \
+	${pkgpath}/HDFException.java \
+    ${pkgpath}/HDFJavaException.java \
+    ${pkgpath}/HDFArray.java \
+    ${pkgpath}/HDFChunkInfo.java \
+    ${pkgpath}/HDFCompInfo.java \
+    ${pkgpath}/HDFConstants.java \
+    ${pkgpath}/HDFDeflateCompInfo.java \
+    ${pkgpath}/HDFIMCOMPCompInfo.java \
+    ${pkgpath}/HDFJPEGCompInfo.java \
+    ${pkgpath}/HDFLibrary.java \
+    ${pkgpath}/HDFLibraryException.java \
+    ${pkgpath}/HDFNativeData.java \
+    ${pkgpath}/HDFNewCompInfo.java \
+    ${pkgpath}/HDFNBITChunkInfo.java \
+    ${pkgpath}/HDFNBITCompInfo.java \
+    ${pkgpath}/HDFNotImplementedException.java \
+    ${pkgpath}/HDFOldCompInfo.java \
+    ${pkgpath}/HDFOldRLECompInfo.java \
+    ${pkgpath}/HDFRLECompInfo.java \
+    ${pkgpath}/HDFSKPHUFFCompInfo.java \
+    ${pkgpath}/HDFSZIPCompInfo.java
+
+
+$(jarfile): classhdf_java.stamp classes docs
+	$(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath)
+
+hdf_java_DATA = $(jarfile)
+
+.PHONY: docs classes
+
+WINDOWTITLE = 'HDF Java'
+DOCTITLE = '<h1>HDF Java Wrapper</h1>'
+SRCDIR = '$(pkgpath)'
+
+docs:
+	$(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview $(top_srcdir)/java/src/hdf/overview.html -classpath $(CLASSPATH_ENV) hdf.hdflib
+
+CLEANFILES = classhdf_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class
+
+clean:
+	rm -rf $(JAVAROOT)/*
+	rm -f $(jarfile)
+	rm -f classhdf_java.stamp
+
+
+# Clean examples when check-clean is invoked
+check-clean :: ;
+
+#include $(top_srcdir)/config/conclude.am
diff --git a/hdf/Makefile.in b/java/src/Makefile.in
similarity index 71%
copy from hdf/Makefile.in
copy to java/src/Makefile.in
index 8a4e0d1..685d1ba 100644
--- a/hdf/Makefile.in
+++ b/java/src/Makefile.in
@@ -13,6 +13,10 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
+
+#
+# HDF Java native interface (JNI) Library Makefile(.in)
+
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -79,9 +83,22 @@ build_triplet = @build@
 host_triplet = @host@
 DIST_COMMON = $(top_srcdir)/config/commence.am $(srcdir)/Makefile.in \
 	$(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs
-subdir = hdf
+subdir = java/src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -115,6 +132,37 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+am__installdirs = "$(DESTDIR)$(hdf_javadir)" \
+	"$(DESTDIR)$(hdf_javadir)"
+am__java_sources = $(hdf_java_JAVA)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+DATA = $(hdf_java_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -142,6 +190,7 @@ am__define_uniq_tagged_files = \
   done | $(am__uniquify_input)`
 ETAGS = etags
 CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 am__relativize = \
   dir0=`pwd`; \
@@ -210,12 +259,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -258,11 +322,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -336,12 +403,44 @@ ACLOCAL_AMFLAGS = "-I m4"
 # .chkexe files are used to mark tests that have run successfully.
 # .chklog files are output from those tests.
 CHECK_CLEANFILES = *.chkexe *.chklog
- at HDF_BUILD_FORTRAN_FALSE@FORTRAN_DIR = 
- at HDF_BUILD_FORTRAN_TRUE@FORTRAN_DIR = fortran
 
-# src folder in root Makefile, build other folders now
-SUBDIRS = src $(FORTRAN_DIR) test util
-DIST_SUBDIRS = src fortran test util examples
+# Mark this directory as part of the JNI API
+JAVA_API = yes
+SUBDIRS = jni
+JAVAROOT = .classes
+jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar
+hdf_javadir = $(libdir)
+pkgpath = hdf/hdflib
+CLASSPATH_ENV = CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH
+AM_JAVACFLAGS = $(H4_JAVACFLAGS) -deprecation
+hdf_java_JAVA = \
+	${pkgpath}/HDFException.java \
+    ${pkgpath}/HDFJavaException.java \
+    ${pkgpath}/HDFArray.java \
+    ${pkgpath}/HDFChunkInfo.java \
+    ${pkgpath}/HDFCompInfo.java \
+    ${pkgpath}/HDFConstants.java \
+    ${pkgpath}/HDFDeflateCompInfo.java \
+    ${pkgpath}/HDFIMCOMPCompInfo.java \
+    ${pkgpath}/HDFJPEGCompInfo.java \
+    ${pkgpath}/HDFLibrary.java \
+    ${pkgpath}/HDFLibraryException.java \
+    ${pkgpath}/HDFNativeData.java \
+    ${pkgpath}/HDFNewCompInfo.java \
+    ${pkgpath}/HDFNBITChunkInfo.java \
+    ${pkgpath}/HDFNBITCompInfo.java \
+    ${pkgpath}/HDFNotImplementedException.java \
+    ${pkgpath}/HDFOldCompInfo.java \
+    ${pkgpath}/HDFOldRLECompInfo.java \
+    ${pkgpath}/HDFRLECompInfo.java \
+    ${pkgpath}/HDFSKPHUFFCompInfo.java \
+    ${pkgpath}/HDFSZIPCompInfo.java
+
+hdf_java_DATA = $(jarfile)
+WINDOWTITLE = 'HDF Java'
+DOCTITLE = '<h1>HDF Java Wrapper</h1>'
+SRCDIR = '$(pkgpath)'
+CLEANFILES = classhdf_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class
 all: all-recursive
 
 .SUFFIXES:
@@ -354,9 +453,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hdf/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign java/src/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign hdf/Makefile
+	  $(AUTOMAKE) --foreign java/src/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -383,6 +482,56 @@ mostlyclean-libtool:
 clean-libtool:
 	-rm -rf .libs _libs
 
+classhdf_java.stamp: $(am__java_sources)
+	@list1='$?'; list2=; if test -n "$$list1"; then \
+	  for p in $$list1; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    list2="$$list2 $$d$$p"; \
+	  done; \
+	  echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) '"$$list2"; \
+	  $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) $(JAVACFLAGS) $$list2; \
+	else :; fi
+	echo timestamp > $@
+install-hdf_javaJAVA: classhdf_java.stamp
+	@$(NORMAL_INSTALL)
+	@test -n "$(hdf_java_JAVA)" && test -n "$(hdf_javadir)" || exit 0; \
+	echo " $(MKDIR_P) '$(DESTDIR)$(hdf_javadir)'"; \
+	$(MKDIR_P) "$(DESTDIR)$(hdf_javadir)"; \
+	set x *.class; shift; test "$$1" != "*.class" || exit 0; \
+	echo " $(INSTALL_DATA)" "$$@" "'$(DESTDIR)$(hdf_javadir)/$$p'"; \
+	$(INSTALL_DATA) "$$@" "$(DESTDIR)$(hdf_javadir)"
+
+uninstall-hdf_javaJAVA:
+	@$(NORMAL_UNINSTALL)
+	@test -n "$(hdf_java_JAVA)" && test -n "$(hdf_javadir)" || exit 0; \
+	set x *.class; shift; test "$$1" != "*.class" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(hdf_javadir)' && rm -f" "$$@" ")"; \
+	cd "$(DESTDIR)$(hdf_javadir)" && rm -f "$$@"
+
+clean-hdf_javaJAVA:
+	-rm -f *.class classhdf_java.stamp
+install-hdf_javaDATA: $(hdf_java_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(hdf_java_DATA)'; test -n "$(hdf_javadir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(hdf_javadir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(hdf_javadir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(hdf_javadir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(hdf_javadir)" || exit $$?; \
+	done
+
+uninstall-hdf_javaDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(hdf_java_DATA)'; test -n "$(hdf_javadir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(hdf_javadir)'; $(am__uninstall_files_from_dir)
+
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
 # To change the values of 'make' variables: instead of editing Makefiles,
@@ -539,9 +688,12 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-recursive
-all-am: Makefile
+all-am: Makefile classhdf_java.stamp $(DATA)
 installdirs: installdirs-recursive
 installdirs-am:
+	for dir in "$(DESTDIR)$(hdf_javadir)" "$(DESTDIR)$(hdf_javadir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -564,6 +716,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -572,9 +725,8 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
+clean-am: clean-generic clean-hdf_javaJAVA clean-libtool \
+	mostlyclean-am
 
 distclean: distclean-recursive
 	-rm -f Makefile
@@ -592,7 +744,7 @@ info: info-recursive
 
 info-am:
 
-install-data-am:
+install-data-am: install-hdf_javaDATA install-hdf_javaJAVA
 
 install-dvi: install-dvi-recursive
 
@@ -618,7 +770,7 @@ install-ps: install-ps-recursive
 
 install-ps-am:
 
-installcheck-am: installcheck-local
+installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
 	-rm -f Makefile
@@ -636,41 +788,46 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-hdf_javaDATA uninstall-hdf_javaJAVA
 
 .MAKE: $(am__recursive_targets) install-am install-strip
 
 .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
-	check-am clean clean-generic clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-generic distclean-libtool \
-	distclean-tags distdir dvi dvi-am html html-am info info-am \
-	install install-am install-data install-data-am install-dvi \
-	install-dvi-am install-exec install-exec-am install-html \
-	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installcheck-local \
+	check-am clean clean-generic clean-hdf_javaJAVA clean-libtool \
+	cscopelist-am ctags ctags-am distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-hdf_javaDATA install-hdf_javaJAVA \
+	install-html install-html-am install-info install-info-am \
+	install-man install-pdf install-pdf-am install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
 	installdirs installdirs-am maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-generic \
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
-	uninstall-am
+	uninstall-am uninstall-hdf_javaDATA uninstall-hdf_javaJAVA
 
 
-installcheck-local:
-	@(cd examples && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1;
+classes:
+	test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT)
 
-# 'make install-all' also installs examples
-install-all:
-	@$(MAKE) $(AM_MAKEFLAGS) install
-	@$(MAKE) $(AM_MAKEFLAGS) install-examples
-uninstall-all:
-	@$(MAKE) $(AM_MAKEFLAGS) uninstall
-	@$(MAKE) $(AM_MAKEFLAGS) uninstall-examples
+$(jarfile): classhdf_java.stamp classes docs
+	$(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath)
 
-# Install examples recursively
-install-examples uninstall-examples:
-	@@SETX@; for d in examples $(FORTRAN_DIR); do \
-	    (cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \
-	done
+.PHONY: docs classes
+
+docs:
+	$(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview $(top_srcdir)/java/src/hdf/overview.html -classpath $(CLASSPATH_ENV) hdf.hdflib
+
+clean:
+	rm -rf $(JAVAROOT)/*
+	rm -f $(jarfile)
+	rm -f classhdf_java.stamp
+
+# Clean examples when check-clean is invoked
+check-clean :: ;
+
+#include $(top_srcdir)/config/conclude.am
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt
new file mode 100644
index 0000000..1bfc617
--- /dev/null
+++ b/java/src/hdf/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF4_JAVA_HDF)
+
+add_subdirectory (${HDF4_JAVA_HDF_SOURCE_DIR}/hdflib      hdflib)
diff --git a/java/src/hdf/hdflib/CMakeLists.txt b/java/src/hdf/hdflib/CMakeLists.txt
new file mode 100644
index 0000000..3ddeffa
--- /dev/null
+++ b/java/src/hdf/hdflib/CMakeLists.txt
@@ -0,0 +1,74 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF4_JAVA_HDF_HDF4 Java)
+
+set (CMAKE_VERBOSE_MAKEFILE 1)
+
+INCLUDE_DIRECTORIES (
+    ${HDF4_JAVA_HDF_HDF4_SOURCE_DIR}
+    ${HDF4_JAVA_HDF_HDF4_BINARY_DIR}
+    ${HDF4_JAVA_LIB_DIR}
+    ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${HDF4_JAVA_HDF_LIB_CORENAME}.dir/hdf/hdflib
+)
+
+SET_GLOBAL_VARIABLE (HDF4_JAVA_SOURCE_PACKAGES
+    "${HDF4_JAVA_SOURCE_PACKAGES};hdf.hdflib"
+)
+
+set (HDF4_JAVA_HDF_HDF4_SRCS
+    HDFException.java
+    HDFJavaException.java
+    HDFArray.java
+    HDFChunkInfo.java
+    HDFCompInfo.java
+    HDFConstants.java
+    HDFDeflateCompInfo.java
+    HDFIMCOMPCompInfo.java
+    HDFJPEGCompInfo.java
+    HDFLibrary.java
+    HDFLibraryException.java
+    HDFNativeData.java
+    HDFNewCompInfo.java
+    HDFNBITChunkInfo.java
+    HDFNBITCompInfo.java
+    HDFNotImplementedException.java
+    HDFOldCompInfo.java
+    HDFOldRLECompInfo.java
+    HDFRLECompInfo.java
+    HDFSKPHUFFCompInfo.java
+    HDFSZIPCompInfo.java
+)
+
+set (CMAKE_JNI_TARGET TRUE)
+
+file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt
+"
+"
+)
+
+set (CMAKE_JAVA_INCLUDE_PATH "${HDF4_JAVA_LOGGING_JAR}")
+
+add_jar (${HDF4_JAVA_HDF_LIB_TARGET} OUTPUT_NAME "${HDF4_JAVA_HDF_LIB_TARGET}-${HDF4_PACKAGE_VERSION}" OUTPUT_DIR ${CMAKE_JAVA_TARGET_OUTPUT_DIR} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF4_JAVA_HDF_HDF4_SRCS})
+install_jar (${HDF4_JAVA_HDF_LIB_TARGET} LIBRARY DESTINATION ${HDF4_INSTALL_JAR_DIR} COMPONENT libraries)
+#if (NOT WIN32)
+#  install_jni_symlink (${HDF4_JAVA_HDF_LIB_TARGET} ${HDF4_INSTALL_JAR_DIR} libraries)
+#endif (NOT WIN32)
+
+get_target_property (${HDF4_JAVA_HDF_LIB_TARGET}_JAR_FILE ${HDF4_JAVA_HDF_LIB_TARGET} JAR_FILE)
+SET_GLOBAL_VARIABLE (HDF4_JAVA_JARS_TO_EXPORT "${HDF4_JAVA_JARS_TO_EXPORT};${${HDF4_JAVA_HDF_LIB_TARGET}_JAR_FILE}")
+SET_GLOBAL_VARIABLE (HDF4_JAVA_JARS ${${HDF4_JAVA_HDF_LIB_TARGET}_JAR_FILE})
+
+add_dependencies (${HDF4_JAVA_HDF_LIB_TARGET} ${HDF4_JAVA_JNI_LIB_TARGET})
+set_target_properties (${HDF4_JAVA_HDF_LIB_TARGET} PROPERTIES FOLDER libraries/java)
+
+create_javadoc(hdf4_java_doc
+    FILES ${HDF4_JAVA_HDF_HDF4_SRCS}
+    OVERVIEW ${HDF4_JAVA_HDF_SRC_DIR}/overview.html
+    CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH}
+    WINDOWTITLE "HDF Java"
+    DOCTITLE "<h1>HDF Java Wrapper</h1>"
+    INSTALLPATH ${HDF4_INSTALL_DATA_DIR}
+    AUTHOR TRUE
+    USE TRUE
+    VERSION TRUE
+)
+
diff --git a/java/src/hdf/hdflib/HDFArray.java b/java/src/hdf/hdflib/HDFArray.java
new file mode 100644
index 0000000..51f39f5
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFArray.java
@@ -0,0 +1,854 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ *  This is a class for handling multidimensional arrays for
+ *  HDF.
+ *  <p>
+ *  The purpose is to allow the storage and retrieval of
+ *  arbitrary array types containing scientific data.
+ *  <p>
+ *  The methods support the conversion of an array to and
+ *  from Java to a one-dimensional array of bytes suitable
+ *  for I/O by the C library.
+ *  <p>
+ *  This class heavily uses the <a href="./hdf.hdflib.HDFNativeData.html">HDFNativeData</a>
+ *  class to convert between Java and C representations.
+ */
+
+public class HDFArray {
+
+private Object _theArray = null;
+private ArrayDescriptor _desc = null;
+private byte [] _barray = null;
+
+public HDFArray(Object anArray) throws HDFException {
+
+    if (anArray == null) {
+        HDFException ex =
+        new HDFJavaException("HDFArray: array is null?: ");
+ex.printStackTrace();
+    }
+    Class tc = anArray.getClass();
+        if (tc.isArray() == false) {
+                /* exception: not an array */
+        HDFException ex =
+        new HDFJavaException("HDFArray: not an array?: ");
+ex.printStackTrace();
+        throw(ex);
+        }
+    _theArray = anArray;
+    _desc = new ArrayDescriptor( _theArray );
+
+    /* extra error checking -- probably not needed */
+    if (_desc == null ) {
+        HDFException ex =
+        new HDFJavaException("HDFArray: internal error: array description failed?: ");
+        throw(ex);
+    }
+}
+
+/**
+ *  @return the allocated a one-dimensional array of bytes sufficient to store
+ *  the array.
+ *  @exception HDFException .
+ */
+
+public byte[] emptyBytes()
+throws HDFException
+{
+    byte[] b = null;
+    if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) {
+        b = (byte [])_theArray;
+    } else {
+        b = new byte[ArrayDescriptor.totalSize];
+    }
+    if (b == null) {
+                System.out.println("Error:  HDFArray can't allocate bytes for array");
+ HDFException ex =
+        new HDFJavaException("HDFArray: emptyBytes: allocation failed");
+                        throw(ex);
+    }
+    return (b);
+    //return (new byte[ArrayDescriptor.totalSize]);
+}
+
+/**
+ *  @return convert of a Java array of numbers to a one-dimensional
+ *  array of bytes in correct native order.
+ *
+ *  @exception hdf.hdflib.HDFException
+ *             thrown for errors:
+ *        object is not array:  HDFJavaException
+ */
+public byte[] byteify() throws HDFException{
+
+    if (_barray != null) {
+        return _barray;
+    }
+    if (_theArray == null) {
+                /* exception: not an array */
+         HDFException ex =
+        new HDFJavaException("HDFArray: byteify not an array?: ");
+        throw(ex);
+        }
+
+    if (ArrayDescriptor.dims == 1) {
+        /* special case */
+        if (ArrayDescriptor.NT == 'B') {
+            /* really special case! */
+            _barray = (byte [])_theArray;
+            return _barray;
+        } else {
+            try {
+            _barray = new byte[ArrayDescriptor.totalSize];
+
+            byte [] therow;
+            if (ArrayDescriptor.NT == 'I') {
+                therow = hdf.hdflib.HDFNativeData.intToByte(0,ArrayDescriptor.dimlen[1],(int [])_theArray);
+            } else if (ArrayDescriptor.NT == 'S') {
+                therow = hdf.hdflib.HDFNativeData.shortToByte(0,ArrayDescriptor.dimlen[1],(short [])_theArray);
+            } else if (ArrayDescriptor.NT == 'F') {
+                therow = hdf.hdflib.HDFNativeData.floatToByte(0,ArrayDescriptor.dimlen[1],(float [])_theArray);
+            } else if (ArrayDescriptor.NT == 'J') {
+                therow = hdf.hdflib.HDFNativeData.longToByte(0,ArrayDescriptor.dimlen[1],(long [])_theArray);
+            } else if (ArrayDescriptor.NT == 'D') {
+                therow = hdf.hdflib.HDFNativeData.doubleToByte(0,ArrayDescriptor.dimlen[1],(double [])_theArray);
+            } else if (ArrayDescriptor.NT == 'L') {
+                if (ArrayDescriptor.className.equals("java.lang.Byte")) {
+                    therow = ByteObjToByte((Byte[])_theArray);
+                } else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
+                    therow = IntegerToByte((Integer[])_theArray);
+                } else if (ArrayDescriptor.className.equals("java.lang.Short")) {
+                    therow = ShortToByte((Short[])_theArray);
+                } else if (ArrayDescriptor.className.equals("java.lang.Float")) {
+                    therow = FloatObjToByte((Float[])_theArray);
+                } else if (ArrayDescriptor.className.equals("java.lang.Double")) {
+                    therow = DoubleObjToByte((Double[])_theArray);
+                } else if (ArrayDescriptor.className.equals("java.lang.Long")) {
+                    therow = LongObjToByte((Long[])_theArray);
+                } else {
+                     HDFJavaException ex =
+                        new HDFJavaException("HDFArray: unknown type of Object?");
+                     throw(ex);
+                }
+            } else {
+                HDFJavaException ex =
+                    new HDFJavaException("HDFArray: unknown type of Object?");
+                throw(ex);
+            }
+            System.arraycopy(therow,0,_barray,0,(ArrayDescriptor.dimlen[1] * ArrayDescriptor.NTsize));
+            return _barray;
+            } catch (OutOfMemoryError err) {
+                 HDFException ex =
+                new HDFJavaException("HDFArray: byteify array too big?");
+                ex.printStackTrace();
+                throw(ex);
+            }
+        }
+    }
+
+    try {
+        _barray = new byte[ArrayDescriptor.totalSize];
+        } catch (OutOfMemoryError err) {
+     HDFException ex =
+        new HDFJavaException("HDFArray: byteify array too big?");
+        ex.printStackTrace();
+                        throw(ex);
+    }
+
+
+    Object oo = _theArray;
+    int n = 0;  /* the current byte */
+    int index = 0;
+    int i;
+    while ( n < ArrayDescriptor.totalSize ) {
+        oo = ArrayDescriptor.objs[0];
+        index = n / ArrayDescriptor.bytetoindex[0];
+                index %= ArrayDescriptor.dimlen[0];
+        for (i = 0 ; i < (ArrayDescriptor.dims); i++) {
+            index = n / ArrayDescriptor.bytetoindex[i];
+            index %= ArrayDescriptor.dimlen[i];
+
+            if (index == ArrayDescriptor.currentindex[i]) {
+                /* then use cached copy */
+                oo = ArrayDescriptor.objs[i];
+            } else {
+                /* check range of index */
+                if (index > (ArrayDescriptor.dimlen[i] - 1)) {
+                    System.out.println("out of bounds?");
+                    return null;
+                }
+                oo = java.lang.reflect.Array.get(oo,index);
+                ArrayDescriptor.currentindex[i] = index;
+                ArrayDescriptor.objs[i] = oo;
+            }
+        }
+
+        /* byte-ify */
+        byte arow[];
+        try {
+        if (ArrayDescriptor.NT == 'J') {
+            arow = hdf.hdflib.HDFNativeData.longToByte(0,ArrayDescriptor.dimlen[ArrayDescriptor.dims],(long [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            arow = hdf.hdflib.HDFNativeData.longToByte(0,ArrayDescriptor.dimlen[ArrayDescriptor.dims],(long [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+        } else if (ArrayDescriptor.NT == 'I') {
+            arow = hdf.hdflib.HDFNativeData.intToByte(0,ArrayDescriptor.dimlen[ArrayDescriptor.dims],(int [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+        } else if (ArrayDescriptor.NT == 'S') {
+            arow = hdf.hdflib.HDFNativeData.shortToByte(0,ArrayDescriptor.dimlen[ArrayDescriptor.dims],(short [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+        } else if (ArrayDescriptor.NT == 'B') {
+            arow = (byte [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1];
+        } else if (ArrayDescriptor.NT == 'F') {
+            /* 32 bit float */
+            arow = hdf.hdflib.HDFNativeData.floatToByte(0,ArrayDescriptor.dimlen[ArrayDescriptor.dims],(float [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+        } else if (ArrayDescriptor.NT == 'D') {
+            /* 64 bit float */
+            arow = hdf.hdflib.HDFNativeData.doubleToByte(0,ArrayDescriptor.dimlen[ArrayDescriptor.dims],(double [])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+        } else if (ArrayDescriptor.NT == 'L') {
+            if (ArrayDescriptor.className.equals("java.lang.Byte")) {
+                arow = ByteObjToByte((Byte[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            } else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
+                arow = IntegerToByte((Integer[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            } else if (ArrayDescriptor.className.equals("java.lang.Short")) {
+                arow = ShortToByte((Short[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            } else if (ArrayDescriptor.className.equals("java.lang.Float")) {
+                arow = FloatObjToByte((Float[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            } else if (ArrayDescriptor.className.equals("java.lang.Double")) {
+                arow = DoubleObjToByte((Double[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            } else if (ArrayDescriptor.className.equals("java.lang.Long")) {
+                arow = LongObjToByte((Long[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
+            } else {
+                HDFJavaException ex =
+                new HDFJavaException("HDFArray: byteify Object type not implemented?");
+                throw(ex);
+            }
+        } else {
+            HDFJavaException ex =
+            new HDFJavaException("HDFArray: byteify Object type not implemented?");
+            throw(ex);
+        }
+        System.arraycopy(arow,0,_barray,n,(ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize));
+        n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+        } catch (OutOfMemoryError err) {
+         HDFException ex =
+            new HDFJavaException("HDFArray: byteify array too big?");
+            ex.printStackTrace();
+            throw(ex);
+        }
+    }
+/* assert:  the whole array is completed--currentindex should == len - 1 */
+
+    /* error checks */
+
+    if (n < ArrayDescriptor.totalSize) {
+        throw new java.lang.InternalError(
+        new String("HDFArray:::byteify: Panic didn't complete all input data: n=  "+n+" size = "+ArrayDescriptor.totalSize));
+    }
+    for (i = 0;i < ArrayDescriptor.dims; i++) {
+        if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) {
+            throw new java.lang.InternalError(
+            new String("Panic didn't complete all data: currentindex["+i+"] = "+ArrayDescriptor.currentindex[i]+" (should be "+(ArrayDescriptor.dimlen[i] - 1)+" ?)"));
+        }
+    }
+    return _barray;
+}
+
+/**
+ *  @param bytes a one-dimensional array of numbers
+ *  @return convert it to a java array of the shape and size passed to the constructor.
+ *
+ *  @exception hdf.hdflib.HDFException
+ *             thrown for errors:
+ *        object not an array:  HDFJavaException
+ */
+public Object arrayify(byte[] bytes) throws HDFException {
+
+    if (_theArray == null) {
+                /* exception: not an array */
+         HDFException ex =
+        new HDFJavaException("arrayify: not an array?: ");
+        throw(ex);
+    }
+
+    if (java.lang.reflect.Array.getLength(bytes) != ArrayDescriptor.totalSize) {
+        /* exception: array not right size */
+         HDFException ex =
+        new HDFJavaException("arrayify: array is wrong size?: ");
+    }
+    _barray = bytes; /* hope that the bytes are correct.... */
+    if (ArrayDescriptor.dims == 1) {
+        /* special case */
+        /* 2 data copies here! */
+        try {
+        if (ArrayDescriptor.NT == 'I') {
+            int [] x = hdf.hdflib.HDFNativeData.byteToInt(_barray);
+            System.arraycopy(x,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+            return _theArray;
+        } else if (ArrayDescriptor.NT == 'S') {
+            short [] x = hdf.hdflib.HDFNativeData.byteToShort(_barray);
+            System.arraycopy(x,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+            return _theArray;
+        } else if (ArrayDescriptor.NT == 'F') {
+            float x[] = hdf.hdflib.HDFNativeData.byteToFloat(_barray);
+            System.arraycopy(x,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+            return _theArray;
+        } else if (ArrayDescriptor.NT == 'J') {
+            long x[] = hdf.hdflib.HDFNativeData.byteToLong(_barray);
+            System.arraycopy(x,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+            return _theArray;
+        } else if (ArrayDescriptor.NT == 'D') {
+            double x[] = hdf.hdflib.HDFNativeData.byteToDouble(_barray);
+            System.arraycopy(x,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+            return _theArray;
+        } else if (ArrayDescriptor.NT == 'B') {
+            System.arraycopy(_barray,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+            return _theArray;
+        } else if (ArrayDescriptor.NT == 'L') {
+            if (ArrayDescriptor.className.equals("java.lang.Byte")) {
+                Byte I[] = ByteToByteObj(_barray);
+                System.arraycopy(I,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+                return _theArray;
+            } else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
+                Integer I[] = ByteToInteger(_barray);
+                System.arraycopy(I,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+                return _theArray;
+            } else if (ArrayDescriptor.className.equals("java.lang.Short")) {
+                Short I[] = ByteToShort(_barray);
+                System.arraycopy(I,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+                return _theArray;
+            } else if (ArrayDescriptor.className.equals("java.lang.Float")) {
+                Float I[] = ByteToFloatObj(_barray);
+                System.arraycopy(I,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+                return _theArray;
+            } else if (ArrayDescriptor.className.equals("java.lang.Double")) {
+                Double I[] = ByteToDoubleObj(_barray);
+                System.arraycopy(I,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+                return _theArray;
+            } else if (ArrayDescriptor.className.equals("java.lang.Long")) {
+                Long I[] = ByteToLongObj(_barray);
+                System.arraycopy(I,0,_theArray,0,ArrayDescriptor.dimlen[1]);
+                return _theArray;
+            } else {
+            HDFJavaException ex =
+            new HDFJavaException("arrayify:  Object type not implemented yet...");
+            throw(ex);
+            }
+        } else {
+            HDFJavaException ex =
+            new HDFJavaException("arrayify:  Object type not implemented yet...");
+            throw(ex);
+        }
+        } catch (OutOfMemoryError err) {
+         HDFException ex =
+            new HDFJavaException("HDFArray: arrayify array too big?");
+            ex.printStackTrace();
+            throw(ex);
+        }
+    }
+    /* Assert dims >= 2 */
+
+    Object oo = _theArray;
+    int n = 0;  /* the current byte */
+    int index = 0;
+    int i;
+    while ( n < ArrayDescriptor.totalSize ) {
+        oo = ArrayDescriptor.objs[0];
+        index = n / ArrayDescriptor.bytetoindex[0];
+        index %= ArrayDescriptor.dimlen[0];
+        for (i = 0 ; i < (ArrayDescriptor.dims); i++) {
+            index = n / ArrayDescriptor.bytetoindex[i];
+            index %= ArrayDescriptor.dimlen[i];
+
+            if (index == ArrayDescriptor.currentindex[i]) {
+                /* then use cached copy */
+                oo = ArrayDescriptor.objs[i];
+            } else {
+                /* check range of index */
+                if (index > (ArrayDescriptor.dimlen[i] - 1)) {
+                    System.out.println("out of bounds?");
+                    return null;
+                }
+                oo = java.lang.reflect.Array.get((Object) oo,index);
+                ArrayDescriptor.currentindex[i] = index;
+                ArrayDescriptor.objs[i] = oo;
+            }
+        }
+
+        /* array-ify */
+        try {
+        if (ArrayDescriptor.NT == 'J') {
+            long [] arow = hdf.hdflib.HDFNativeData.byteToLong(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), (Object)arow);
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+        } else if (ArrayDescriptor.NT == 'I') {
+            int [] arow = hdf.hdflib.HDFNativeData.byteToInt(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), (Object)arow);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+        } else if (ArrayDescriptor.NT == 'S') {
+            short [] arow = hdf.hdflib.HDFNativeData.byteToShort(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), (Object)arow);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+        } else if (ArrayDescriptor.NT == 'B') {
+            System.arraycopy( _barray, n, ArrayDescriptor.objs[ArrayDescriptor.dims - 1], 0, ArrayDescriptor.dimlen[ArrayDescriptor.dims]);
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+        } else if (ArrayDescriptor.NT == 'F') {
+            float arow[] = hdf.hdflib.HDFNativeData.byteToFloat(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), (Object)arow);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+        } else if (ArrayDescriptor.NT == 'D') {
+            double [] arow = hdf.hdflib.HDFNativeData.byteToDouble(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), (Object)arow);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+        } else if (ArrayDescriptor.NT == 'L') {
+            if (ArrayDescriptor.className.equals("java.lang.Byte")) {
+                Byte I[] = ByteToByteObj(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+        java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+            (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
+            (Object)I);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+            } else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
+                Integer I[] = ByteToInteger(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+        java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+            (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
+            (Object)I);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+            } else if (ArrayDescriptor.className.equals("java.lang.Short")) {
+                Short I[] = ByteToShort(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
+                (Object)I);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+            } else if (ArrayDescriptor.className.equals("java.lang.Float")) {
+                Float I[] = ByteToFloatObj(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
+                (Object)I);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+            } else if (ArrayDescriptor.className.equals("java.lang.Double")) {
+                Double I[] = ByteToDoubleObj(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
+                (Object)I);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+            } else if (ArrayDescriptor.className.equals("java.lang.Long")) {
+                Long I[] = ByteToLongObj(n,ArrayDescriptor.dimlen[ArrayDescriptor.dims],_barray);
+            java.lang.reflect.Array.set(ArrayDescriptor.objs[ArrayDescriptor.dims - 2] ,
+                (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
+                (Object)I);
+
+            n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1];
+            ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++;
+            } else {
+            HDFJavaException ex =
+            new HDFJavaException("HDFArray: unsupported Object type: "+ArrayDescriptor.NT);
+            throw(ex);
+            }
+        } else {
+            HDFJavaException ex =
+            new HDFJavaException("HDFArray: unsupported Object type: "+ArrayDescriptor.NT);
+            throw(ex);
+        }
+        } catch (OutOfMemoryError err) {
+         HDFException ex =
+            (HDFException)new HDFJavaException("HDFArray: arrayify array too big?");
+            ex.printStackTrace();
+            throw(ex);
+        }
+
+    }
+
+/* assert:  the whole array is completed--currentindex should == len - 1 */
+
+    /* error checks */
+
+    if (n < ArrayDescriptor.totalSize) {
+        throw new java.lang.InternalError(
+           new String("HDFArray::arrayify Panic didn't complete all input data: n=  "+n+" size = "+ArrayDescriptor.totalSize));
+    }
+    for (i = 0;i <= ArrayDescriptor.dims-2; i++) {
+        if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) {
+        throw new java.lang.InternalError(
+            new String("HDFArray::arrayify Panic didn't complete all data: currentindex["+i+"] = "+ArrayDescriptor.currentindex[i]+" (should be "+(ArrayDescriptor.dimlen[i] - 1)+"?"));
+        }
+    }
+    if (ArrayDescriptor.NT != 'B') {
+    if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) {
+        throw new java.lang.InternalError(
+        new String("HDFArray::arrayify Panic didn't complete all data: currentindex["+i+"] = "+ArrayDescriptor.currentindex[i]+" (should be "+(ArrayDescriptor.dimlen[i])+"?"));
+    }
+    } else {
+    if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != (ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1] - 1)) {
+        throw new java.lang.InternalError(
+        new String("HDFArray::arrayify Panic didn't complete all data: currentindex["+i+"] = "+ArrayDescriptor.currentindex[i]+" (should be "+(ArrayDescriptor.dimlen[i] - 1)+"?"));
+    }
+    }
+
+    return _theArray;
+}
+
+private byte[] IntegerToByte( Integer in[] ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    int[] out = new int[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = in[i].intValue();
+    }
+    return  HDFNativeData.intToByte(0,nelems,out);
+}
+
+private Integer[] ByteToInteger( byte[] bin ) {
+    int in[] = (int [])HDFNativeData.byteToInt(bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Integer[] out = new Integer[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Integer(in[i]);
+    }
+    return  out;
+}
+private Integer[] ByteToInteger( int start, int len, byte[] bin ) {
+    int in[] = (int [])HDFNativeData.byteToInt(start,len,bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Integer[] out = new Integer[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Integer(in[i]);
+    }
+    return  out;
+}
+
+
+private byte[] ShortToByte( Short in[] ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    short[] out = new short[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = in[i].shortValue();
+    }
+    return  HDFNativeData.shortToByte(0,nelems,out);
+}
+
+private Short[] ByteToShort( byte[] bin ) {
+    short in[] = (short [])HDFNativeData.byteToShort(bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Short[] out = new Short[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Short(in[i]);
+    }
+    return  out;
+}
+
+private Short[] ByteToShort( int start, int len, byte[] bin ) {
+    short in[] = (short [])HDFNativeData.byteToShort(start,len,bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Short[] out = new Short[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Short(in[i]);
+    }
+    return  out;
+}
+
+private byte[] ByteObjToByte( Byte in[] ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    byte[] out = new byte[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = in[i].byteValue();
+    }
+    return out;
+}
+
+private Byte[] ByteToByteObj( byte[] bin ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)bin);
+    Byte[] out = new Byte[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Byte(bin[i]);
+    }
+    return  out;
+}
+
+private Byte[] ByteToByteObj( int start, int len, byte[] bin ) {
+    Byte[] out = new Byte[len];
+
+    for (int i = 0; i < len; i++) {
+        out[i] = new Byte(bin[i]);
+    }
+    return  out;
+}
+
+private byte[] FloatObjToByte( Float in[] ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    float[] out = new float[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = in[i].floatValue();
+    }
+    return  HDFNativeData.floatToByte(0,nelems,out);
+}
+
+private Float[] ByteToFloatObj( byte[] bin ) {
+    float in[] = (float [])HDFNativeData.byteToFloat(bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Float[] out = new Float[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Float(in[i]);
+    }
+    return  out;
+}
+
+private Float[] ByteToFloatObj( int start, int len, byte[] bin ) {
+    float in[] = (float [])HDFNativeData.byteToFloat(start,len,bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Float[] out = new Float[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Float(in[i]);
+    }
+    return  out;
+}
+
+private byte[] DoubleObjToByte( Double in[] ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    double[] out = new double[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = in[i].doubleValue();
+    }
+    return  HDFNativeData.doubleToByte(0,nelems,out);
+}
+
+private Double[] ByteToDoubleObj( byte[] bin ) {
+    double in[] = (double [])HDFNativeData.byteToDouble(bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Double[] out = new Double[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Double(in[i]);
+    }
+    return  out;
+}
+
+private Double[] ByteToDoubleObj( int start, int len, byte[] bin ) {
+    double in[] = (double [])HDFNativeData.byteToDouble(start,len,bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Double[] out = new Double[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Double(in[i]);
+    }
+    return  out;
+}
+
+private byte[] LongObjToByte( Long in[] ) {
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    long[] out = new long[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = in[i].longValue();
+    }
+    return  HDFNativeData.longToByte(0,nelems,out);
+}
+
+private Long[] ByteToLongObj( byte[] bin ) {
+    long in[] = (long [])HDFNativeData.byteToLong(bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Long[] out = new Long[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Long(in[i]);
+    }
+    return  out;
+}
+
+private Long[] ByteToLongObj( int start, int len, byte[] bin ) {
+    long in[] = (long [])HDFNativeData.byteToLong(start,len,bin);
+    int nelems = java.lang.reflect.Array.getLength((Object)in);
+    Long[] out = new Long[nelems];
+
+    for (int i = 0; i < nelems; i++) {
+        out[i] = new Long(in[i]);
+    }
+    return  out;
+}
+
+}
+
+
+/**
+  * This class is used by HDFArray to discover the shape and type of an
+  * arbitrary array.
+  */
+
+class ArrayDescriptor {
+
+    static String theType = "";
+    static Class theClass = null;
+        static int [] dimlen = null;
+        static int [] dimstart = null;
+        static int [] currentindex = null;
+        static int [] bytetoindex = null;
+    static int totalSize = 0;
+        static Object [] objs = null;
+    static char NT = ' ';  /*  must be B,S,I,L,F,D, else error */
+        static int NTsize = 0;
+    static int dims = 0;
+    static String className;
+
+    public ArrayDescriptor ( Object anArray ) throws HDFException {
+
+        Class tc = anArray.getClass();
+        if (tc.isArray() == false) {
+            /* exception: not an array */
+             HDFException ex =
+        (HDFException)new HDFJavaException("ArrayDescriptor: not an array?: ");
+            throw(ex);
+        }
+
+        theClass = tc;
+
+        /* parse the type descriptor to discover the
+            shape of the array */
+        String ss = tc.toString();
+        theType = ss;
+        int n = 6;
+        dims = 0;
+        char c = ' ';
+        while (n < ss.length()) {
+            c = ss.charAt(n);
+            n++;
+            if (c == '[') {
+                dims++;
+            }
+        }
+
+        String css = ss.substring(ss.lastIndexOf('[')+1);
+        Class compC = tc.getComponentType();
+        String cs = compC.toString();
+        NT = c;
+        if (NT == 'B') {
+            NTsize = 1;
+        } else if (NT == 'S') {
+            NTsize = 2;
+        } else if ((NT == 'I') || (NT == 'F')) {
+            NTsize = 4;
+        } else if ((NT == 'J') || (NT == 'D')){
+            NTsize = 8;
+        } else if (css.startsWith("Ljava.lang.Byte")) {
+            NT='L';
+            className = "java.lang.Byte";
+            NTsize = 1;
+        } else if (css.startsWith("Ljava.lang.Short")) {
+            NT='L';
+            className = "java.lang.Short";
+            NTsize = 2;
+        } else if (css.startsWith("Ljava.lang.Integer")) {
+            NT='L';
+            className = "java.lang.Integer";
+            NTsize = 4;
+        } else if (css.startsWith("Ljava.lang.Float")) {
+            NT='L';
+            className = "java.lang.Float";
+            NTsize = 4;
+        } else if (css.startsWith("Ljava.lang.Double")) {
+            NT='L';
+            className = "java.lang.Double";
+            NTsize = 8;
+        } else if (css.startsWith("Ljava.lang.Long")) {
+            NT='L';
+            className = "java.lang.Long";
+            NTsize = 8;
+        } else if (css.startsWith("Ljava.lang.String")) {
+throw new HDFJavaException(new String("ArrayDesciptor: Error:  String array not supported yet"));
+        } else {
+            /* exception:  not a numeric type */
+throw new HDFJavaException(new String("Error:  array is not numeric? (type is "+css+")"));
+        }
+
+        /* fill in the table */
+        dimlen = new int [dims+1];
+        dimstart = new int [dims+1];
+        currentindex = new int [dims+1];
+        bytetoindex = new int [dims+1];
+        objs = new Object [dims+1];
+
+        Object o = anArray;
+        objs[0] = o;
+        dimlen[0]= 1;
+        dimstart[0] = 0;
+        currentindex[0] = 0;
+        int i;
+        for ( i = 1; i <= dims; i++) {
+            dimlen[i]= java.lang.reflect.Array.getLength((Object) o);
+            o = java.lang.reflect.Array.get((Object) o,0);
+            objs [i] = o;
+            dimstart[i] = 0;
+            currentindex[i] = 0;
+        }
+
+        int j;
+        int dd;
+        bytetoindex[dims] = NTsize;
+        for ( i = dims; i >= 0; i--) {
+            dd = NTsize;
+            for (j = i; j < dims; j++) {
+                dd *= dimlen[j + 1];
+            }
+            bytetoindex[i] = dd;
+        }
+
+        totalSize = bytetoindex[0];
+    }
+
+    public void dumpInfo()
+    {
+        System.out.println("Type: "+theType);
+        System.out.println("Class: "+theClass);
+        System.out.println("NT: "+NT+" NTsize: "+NTsize);
+        System.out.println("Array has "+dims+" dimensions ("+totalSize+" bytes)");
+        int i;
+        for (i = 0; i <= dims; i++) {
+            Class tc = objs[i].getClass();
+            String ss = tc.toString();
+            System.out.println(i+":  start "+dimstart[i]+": len "+dimlen[i]+" current "+currentindex[i]+" bytetoindex "+bytetoindex[i]+" object "+objs[i]+" otype "+ss);
+        }
+    }
+}
diff --git a/java/src/hdf/hdflib/HDFChunkInfo.java b/java/src/hdf/hdflib/HDFChunkInfo.java
new file mode 100644
index 0000000..c8e7466
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFChunkInfo.java
@@ -0,0 +1,52 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *   This is a generic class to represent the HDF chunk_info
+ *   union, which contains parameters for the different
+ *   chunking schemes.
+ * <p>
+ * The variant parameters are expressed as sub-classes of this
+ * class.
+ */
+
+
+public class HDFChunkInfo {
+	public int ctype;
+	public int[] chunk_lengths = new int[HDFConstants.MAX_VAR_DIMS];
+	public int comp_type = HDFConstants.COMP_CODE_NONE;
+	public HDFCompInfo cinfo = null;
+
+	public HDFChunkInfo() {
+		ctype = HDFConstants.HDF_NONE;
+	}
+
+	public HDFChunkInfo( int[] cl, int ct, HDFCompInfo ci ) {
+		if (ct == HDFConstants.COMP_CODE_NONE) {
+			ctype = HDFConstants.HDF_CHUNK;
+		} else {
+			ctype = HDFConstants.HDF_COMP | HDFConstants.HDF_CHUNK;
+		}
+		chunk_lengths = cl;
+		comp_type = ct;
+		cinfo = ci;
+	}
+
+	public HDFChunkInfo(int[] cl) {
+		ctype = HDFConstants.HDF_CHUNK;
+		chunk_lengths = cl;
+	}
+}
diff --git a/java/src/hdf/hdflib/HDFCompInfo.java b/java/src/hdf/hdflib/HDFCompInfo.java
new file mode 100644
index 0000000..0081d3c
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFCompInfo.java
@@ -0,0 +1,33 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  comp_info union.
+ * <p>
+ * The parameters for different compression schemes are
+ *  represented as sub-classes of this class
+ */
+
+
+public class HDFCompInfo {
+    public int ctype;
+    public HDFCompInfo() {
+        ctype = HDFConstants.COMP_CODE_NONE;
+    } ;
+}
+
+
diff --git a/java/src/hdf/hdflib/HDFConstants.java b/java/src/hdf/hdflib/HDFConstants.java
new file mode 100644
index 0000000..60d66ef
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFConstants.java
@@ -0,0 +1,419 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ *  <p>
+ *  This interface defines the values of constants defined
+ *  by the HDF 4.2 API.
+ */
+public class HDFConstants
+{
+    /** FAIL */
+    public static final int FAIL = -1;
+
+    // file access code definitions
+    public static final int     DFACC_READ = 1;
+    public static final int     DFACC_WRITE= 2;
+    public static final int     DFACC_RDWR = 3;
+    public static final int     DFACC_CREATE=4;
+    public static final int     DFACC_RDONLY=DFACC_READ;
+    public static final int     DFACC_DEFAULT=000;
+    public static final int     DFACC_SERIAL=001;
+    public static final int     DFACC_PARALLEL=011;
+
+    // annotation type in HDF
+    public static final int     AN_DATA_LABEL  = 0;
+    public static final int     AN_DATA_DESC   = AN_DATA_LABEL + 1;
+    public static final int     AN_FILE_LABEL  = AN_DATA_LABEL + 2;
+    public static final int     AN_FILE_DESC   = AN_DATA_LABEL + 3;
+
+    // HDF Tag Definations
+
+    public static final int DFREF_WILDCARD     = 0;
+    public static final int DFTAG_WILDCARD     = 0;
+
+    public static final int DFREF_NONE         = 0;  // used by mfhdf/libsrc/putget.c
+
+    // tags and refs
+    public static final int DFTAG_NULL         = 1;
+    public static final int DFTAG_LINKED       = 20;  // linked-block special element
+    public static final int DFTAG_VERSION      = 30;
+    public static final int DFTAG_COMPRESSED   = 40;  // compressed special element
+    public static final int DFTAG_VLINKED      = 50;  // variable-len linked-block header
+    public static final int DFTAG_VLINKED_DATA = 51;  // variable-len linked-block data
+    public static final int DFTAG_CHUNKED      = 60;  // chunked special element header
+    public static final int DFTAG_CHUNK        = 61;  // chunk element
+
+    // utility set
+    public static final int DFTAG_FID   = 100;   // File identifier
+    public static final int DFTAG_FD    = 101;   // File description
+    public static final int DFTAG_TID   = 102;   // Tag identifier
+    public static final int DFTAG_TD    = 103;   // Tag descriptor
+    public static final int DFTAG_DIL   = 104;   // data identifier label
+    public static final int DFTAG_DIA   = 105;   // data identifier annotation
+    public static final int DFTAG_NT    = 106;   // number type
+    public static final int DFTAG_MT    = 107;   // machine type
+    public static final int DFTAG_FREE  = 108;   // free space in the file
+
+    // raster-8 set
+    public static final int DFTAG_ID8   = 200;   // 8-bit Image dimension
+    public static final int DFTAG_IP8   = 201;   // 8-bit Image palette
+    public static final int DFTAG_RI8   = 202;   // Raster-8 image
+    public static final int DFTAG_CI8   = 203;   // RLE compressed 8-bit image
+    public static final int DFTAG_II8   = 204;   // IMCOMP compressed 8-bit image
+
+    // Raster Image set
+    public static final int DFTAG_ID    = 300;   // Image DimRec
+    public static final int DFTAG_LUT   = 301;   // Image Palette
+    public static final int DFTAG_RI    = 302;   // Raster Image
+    public static final int DFTAG_CI    = 303;   // Compressed Image
+    public static final int DFTAG_NRI   = 304;   // New-format Raster Image
+
+    public static final int DFTAG_RIG   = 306;   // Raster Image Group
+    public static final int DFTAG_LD    = 307;   // Palette DimRec
+    public static final int DFTAG_MD    = 308;   // Matte DimRec
+    public static final int DFTAG_MA    = 309;   // Matte Data
+    public static final int DFTAG_CCN   = 310;   // color correction
+    public static final int DFTAG_CFM   = 311;   // color format
+    public static final int DFTAG_AR    = 312;   // aspect ratio
+
+    public static final int DFTAG_DRAW  = 400;   // Draw these images in sequence
+    public static final int DFTAG_RUN   = 401;   // run this as a program/script
+
+    public static final int DFTAG_XYP   = 500;   // x-y position
+    public static final int DFTAG_MTO   = 501;   // machine-type override
+
+    // Tektronix
+    public static final int DFTAG_T14   = 602;   // TEK 4014 data
+    public static final int DFTAG_T105  = 603;   // TEK 4105 data
+
+    // Scientific Data set
+    // Objects of tag 721 are never actually written to the file.  The tag is
+    // needed to make things easier mixing DFSD and SD style objects in the
+    // same file
+
+    public static final int DFTAG_SDG   = 700;   // Scientific Data Group
+    public static final int DFTAG_SDD   = 701;   // Scientific Data DimRec
+    public static final int DFTAG_SD    = 702;   // Scientific Data
+    public static final int DFTAG_SDS   = 703;   // Scales
+    public static final int DFTAG_SDL   = 704;   // Labels
+    public static final int DFTAG_SDU   = 705;   // Units
+    public static final int DFTAG_SDF   = 706;   // Formats
+    public static final int DFTAG_SDM   = 707;   // Max/Min
+    public static final int DFTAG_SDC   = 708;   // Coord sys
+    public static final int DFTAG_SDT   = 709;   // Transpose
+    public static final int DFTAG_SDLNK = 710;   // Links related to the dataset
+    public static final int DFTAG_NDG   = 720;   // Numeric Data Group
+    public static final int DFTAG_CAL   = 731;   // Calibration information
+    public static final int DFTAG_FV    = 732;   // Fill Value information
+    public static final int DFTAG_BREQ  = 799;   // Beginning of required tags
+    public static final int DFTAG_SDRAG = 781;   // List of ragged array line lengths
+    public static final int DFTAG_EREQ  = 780;   // Current end of the range
+
+    // VSets
+    public static final int DFTAG_VG     = 1965;   // Vgroup
+    public static final int DFTAG_VH     = 1962;   // Vdata Header
+    public static final int DFTAG_VS     = 1963;   // Vdata Storage
+
+    // compression schemes
+    public static final int DFTAG_RLE       = 11;   // run length encoding
+    public static final int DFTAG_IMC       = 12;   // IMCOMP compression alias
+    public static final int DFTAG_IMCOMP    = 12;   // IMCOMP compression
+    public static final int DFTAG_JPEG      = 13;   // JPEG compression (24-bit data)
+    public static final int DFTAG_GREYJPEG  = 14;   // JPEG compression (8-bit data)
+    public static final int DFTAG_JPEG5     = 15;   // JPEG compression (24-bit data)
+    public static final int DFTAG_GREYJPEG5 = 16;   // JPEG compression (8-bit data)
+
+    /** pixel interlacing scheme */
+    public static final int MFGR_INTERLACE_PIXEL = 0;
+
+    /** line interlacing scheme */
+    public static final int MFGR_INTERLACE_LINE = MFGR_INTERLACE_PIXEL +1;
+
+    /** component interlacing scheme */
+    public static final int MFGR_INTERLACE_COMPONENT = MFGR_INTERLACE_PIXEL +2;
+
+    /** interlacing supported by the vset.*/
+    public static final int FULL_INTERLACE = 0;
+    public static final int NO_INTERLACE   = 1;
+
+    /** unsigned char */
+    public static final int DFNT_UCHAR8 = 3;
+    public static final int DFNT_UCHAR  = 3;
+
+    /** char */
+    public static final int DFNT_CHAR8  = 4;
+    public static final int DFNT_CHAR   = 4;
+
+    /** No supported by HDF */
+    public static final int DFNT_CHAR16 = 42;
+    public static final int DFNT_UCHAR16= 43;
+
+
+    /** float */
+    public static final int  DFNT_FLOAT32   =  5;
+    public static final int  DFNT_FLOAT     =  5 ;
+
+    //** double */
+    public static final int  DFNT_FLOAT64   =  6;
+    public static final int  DFNT_FLOAT128  =  7 ;
+    public static final int  DFNT_DOUBLE    =  6  ;
+
+    /** 8-bit integer */
+    public static final int  DFNT_INT8      =  20;
+
+    /** unsigned 8-bit interger */
+    public static final int  DFNT_UINT8    =  21;
+
+    /** short */
+    public static final int  DFNT_INT16    =  22;
+
+    /** unsigned interger */
+    public static final int  DFNT_UINT16   =  23;
+
+    /** interger */
+    public static final int  DFNT_INT32    =  24;
+
+    /** unsigned interger */
+    public static final int  DFNT_UINT32   =  25;
+
+    /** No supported */
+    public static final int  DFNT_INT64    =  26;
+    public static final int  DFNT_UINT64   =  27;
+    public static final int  DFNT_INT128   =  28;
+    public static final int  DFNT_UINT128  =  30;
+
+    public static final int  DFNT_HDF    =  0x00000000;
+    public static final int  DFNT_NATIVE =  0x00001000;
+    public static final int  DFNT_CUSTOM =  0x00002000;
+    public static final int  DFNT_LITEND =  0x00004000;
+    public static final int  DFNT_MASK   =  0x00000fff;
+
+    public static final int DF_FORWARD  = 1;
+    public static final int  DFS_MAXLEN = 255;
+
+    public static final int COMP_NONE     =  0;
+    public static final int COMP_JPEG     =  2;
+    public static final int COMP_RLE      =  11;
+    public static final int COMP_IMCOMP   =  12;
+    public static final int COMP_CODE_NONE     =  0;
+    public static final int COMP_CODE_RLE     =  1;
+    public static final int COMP_CODE_NBIT     =  2;
+    public static final int COMP_CODE_SKPHUFF  =  3;
+    public static final int COMP_CODE_DEFLATE  =  4;
+    public static final int COMP_CODE_SZIP  =  5;
+    public static final int COMP_CODE_INVALID  =  6;
+    public static final int COMP_CODE_JPEG  =  7;
+
+    // Interlace schemes
+    public static final int DFIL_PIXEL  = 0;  /* Pixel Interlacing */
+    public static final int DFIL_LINE   = 1;  /* Scan Line Interlacing */
+    public static final int DFIL_PLANE  = 2;  /* Scan Plane Interlacing */
+
+    public static final int SD_UNLIMITED  = 0;
+    public static final int SD_FILL  = 0;
+    public static final int SD_NOFILL  = 0x100;
+    public static final int SD_DIMVAL_BW_COMP  = 1;
+    public static final int SD_DIMVAL_BW_INCOMP  = 0;
+
+    public static final int HDF_NONE  = 0x0;
+    public static final int HDF_CHUNK  = 0x1;
+    public static final int HDF_COMP  = 0x3;
+    public static final int HDF_NBIT  = 0x5;
+    public static final int MAX_VAR_DIMS =32;
+
+    //the names of the Vgroups created by the GR interface
+    public static final String GR_NAME = "RIG0.0";
+    public static final String RI_NAME = "RI0.0";
+    public static final String RIGATTRNAME = "RIATTR0.0N";
+    public static final String RIGATTRCLASS = "RIATTR0.0C";
+
+    // names of classes of the Vdatas/Vgroups created by the SD interface
+    public static final String  HDF_ATTRIBUTE = "Attr0.0";
+    public static final String  HDF_VARIABLE = "Var0.0";
+    public static final String  HDF_DIMENSION = "Dim0.0";
+    public static final String  HDF_UDIMENSION = "UDim0.0";
+    public static final String  DIM_VALS = "DimVal0.0";
+    public static final String  DIM_VALS01 = "DimVal0.1";
+    public static final String  HDF_CHK_TBL = "_HDF_CHK_TBL_";
+    public static final String  HDF_SDSVAR = "SDSVar";
+    public static final String  HDF_CRDVAR ="CoordVar";
+
+    public static final String  HDF_CDF = "CDF0.0";
+
+    // names of data object types
+    public static final String ANNOTATION = "HDF_ANNOTATION";
+    public static final String RI8 = "HDF_RI8";
+    public static final String RI24 = "HDF_RI24";
+    public static final String GR = "HDF_GR";
+    public static final String SDS = "HDF_SDS";
+    public static final String VDATA = "HDF_VDATA";
+    public static final String VGROUP = "HDF_GROUP";
+
+    // data types represented by Strings
+    public static final String UCHAR8   = "UCHAR8";
+    public static final String CHAR8    = "CHAR8";
+    public static final String UCHAR16  = "UCHAR16";
+    public static final String CHAR16   = "CHAR16";
+    public static final String FLOAT32  = "FLOAT32";
+    public static final String FLOAT64  = "FLOAT64";
+    public static final String FLOAT128 = "FLOAT128";
+    public static final String INT8     = "INT8";
+    public static final String UINT8    = "UINT8";
+    public static final String INT16    = "INT16";
+    public static final String UINT16   = "UINT16";
+    public static final String INT32    = "INT32";
+    public static final String UINT32   = "UINT32";
+    public static final String INT64    = "INT64";
+    public static final String UINT64   = "UINT64";
+    public static final String INT128   = "INT128";
+    public static final String UINT128  = "UINT128";
+
+
+    /**
+     *  convert number type to string type
+     *  @param type  the number representing the data type
+     *  @return the string representing the data type
+     */
+    public static String getType(int type)
+    {
+        if   (type == HDFConstants.DFNT_UCHAR8) {
+            return HDFConstants.UCHAR8;
+        } else if (type == HDFConstants.DFNT_CHAR8) {
+            return HDFConstants.CHAR8;
+        } else if (type == HDFConstants.DFNT_UCHAR16) {
+            return HDFConstants.UCHAR16;
+        } else if (type == HDFConstants.DFNT_CHAR16) {
+            return HDFConstants.CHAR16;
+        } else if (type == HDFConstants.DFNT_FLOAT32) {
+            return HDFConstants.FLOAT32;
+        } else if (type == HDFConstants.DFNT_FLOAT64) {
+            return HDFConstants.FLOAT64;
+        } else if (type == HDFConstants.DFNT_FLOAT128) {
+            return HDFConstants.FLOAT128;
+        } else if (type == HDFConstants.DFNT_INT8) {
+            return HDFConstants.INT8;
+        } else if (type == HDFConstants. DFNT_UINT8) {
+            return HDFConstants.UINT8;
+        } else if (type == HDFConstants.DFNT_INT16) {
+            return HDFConstants.INT16;
+        } else if (type == HDFConstants.DFNT_UINT16) {
+            return HDFConstants.UINT16;
+        } else if (type == HDFConstants.DFNT_INT32) {
+            return HDFConstants.INT32;
+        } else if (type == HDFConstants.DFNT_UINT32) {
+            return HDFConstants.UINT32;
+        } else if (type == HDFConstants.DFNT_INT64) {
+            return HDFConstants.INT64;
+        } else if (type == HDFConstants.DFNT_UINT64) {
+            return HDFConstants.UINT64;
+        } else if (type == HDFConstants.DFNT_INT128) {
+            return HDFConstants.INT128;
+        } else if (type == HDFConstants.DFNT_UINT128) {
+            return HDFConstants.UINT128;
+        } else {
+            return "Undefined Data Type";
+        }
+    }
+
+    /**
+     *  convert string type to number type
+     *  @param type  the string representing the data type
+     *  @return the integer representing the data type
+     */
+    public static int getType(String type)
+    {
+        if   (type.equalsIgnoreCase(HDFConstants.UCHAR8)) {
+            return HDFConstants.DFNT_UCHAR8;
+        } else if (type.equalsIgnoreCase(HDFConstants.CHAR8)) {
+            return HDFConstants.DFNT_CHAR8;
+        } else if (type.equalsIgnoreCase(HDFConstants.UCHAR16)) {
+            return HDFConstants.DFNT_UCHAR16;
+        } else if (type.equalsIgnoreCase(HDFConstants.CHAR16)) {
+            return HDFConstants.DFNT_CHAR16;
+        } else if (type.equalsIgnoreCase(HDFConstants.FLOAT32)) {
+            return HDFConstants.DFNT_FLOAT32;
+        } else if (type.equalsIgnoreCase(HDFConstants.FLOAT64)) {
+            return HDFConstants.DFNT_FLOAT64;
+        } else if (type.equalsIgnoreCase(HDFConstants.FLOAT128)) {
+            return HDFConstants.DFNT_FLOAT128;
+        } else if (type.equalsIgnoreCase(HDFConstants.INT8)) {
+            return HDFConstants.DFNT_INT8;
+        } else if (type.equalsIgnoreCase(HDFConstants. UINT8)) {
+            return HDFConstants.DFNT_UINT8;
+        } else if (type.equalsIgnoreCase(HDFConstants.INT16)) {
+            return HDFConstants.DFNT_INT16;
+        } else if (type.equalsIgnoreCase(HDFConstants.UINT16)) {
+            return HDFConstants.DFNT_UINT16;
+        } else if (type.equalsIgnoreCase(HDFConstants.INT32)) {
+            return HDFConstants.DFNT_INT32;
+        } else if (type.equalsIgnoreCase(HDFConstants.UINT32)) {
+            return HDFConstants.DFNT_UINT32;
+        } else if (type.equalsIgnoreCase(HDFConstants.INT64)) {
+            return HDFConstants.DFNT_INT64;
+        } else if (type.equalsIgnoreCase(HDFConstants.UINT64)) {
+            return HDFConstants.DFNT_UINT64;
+        } else if (type.equalsIgnoreCase(HDFConstants.INT128)) {
+            return HDFConstants.DFNT_INT128;
+        } else if (type.equalsIgnoreCase(HDFConstants.UINT128)) {
+            return HDFConstants.DFNT_UINT128;
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     *  gets the size of the data type in bytes,
+     *  e.g size of DFNT_FLOAT32 = 4
+     *
+     *  @param type  the number representing the data type
+     *  @return the size of the data type
+     */
+    public static int getTypeSize(int type)
+    {
+        int size = 0;
+
+        switch(type)
+        {
+            case HDFConstants.DFNT_UCHAR16:
+            case HDFConstants.DFNT_CHAR16:
+            case HDFConstants.DFNT_INT16:
+            case HDFConstants.DFNT_UINT16:
+                size = 2;
+                break;
+            case HDFConstants.DFNT_FLOAT32:
+            case HDFConstants.DFNT_INT32:
+            case HDFConstants.DFNT_UINT32:
+                size = 4;
+                break;
+            case HDFConstants.DFNT_FLOAT64:
+            case HDFConstants.DFNT_INT64:
+            case HDFConstants.DFNT_UINT64:
+                size = 8;
+                break;
+            case HDFConstants.DFNT_FLOAT128:
+            case HDFConstants.DFNT_INT128:
+            case HDFConstants.DFNT_UINT128:
+                size = 16;
+                break;
+            default:
+                size = 1;
+                break;
+        }
+
+        return size;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFDeflateCompInfo.java b/java/src/hdf/hdflib/HDFDeflateCompInfo.java
new file mode 100644
index 0000000..1730bb9
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFDeflateCompInfo.java
@@ -0,0 +1,39 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  DEFLATION compression algorithm.
+ * <p>
+ * In this case, the only parameter is the ``level'' of deflation.
+ */
+
+
+public class HDFDeflateCompInfo extends HDFNewCompInfo {
+
+    public int level;
+
+    public HDFDeflateCompInfo() {
+        ctype = HDFConstants.COMP_CODE_DEFLATE;
+    } 
+    
+    public HDFDeflateCompInfo(int l) {
+        ctype = HDFConstants.COMP_CODE_DEFLATE;
+        level = l;
+    } 
+}
+
+
diff --git a/java/src/hdf/hdflib/HDFException.java b/java/src/hdf/hdflib/HDFException.java
new file mode 100644
index 0000000..bd5ccfc
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFException.java
@@ -0,0 +1,67 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ *  <p>
+ *  The class HDFException returns errors from the HDF
+ *  library.
+ *  <p>
+ *  Two sub-classes of HDFException are defined:
+ *  <ol>
+ *  <li>
+ *   HDFLibraryException -- errors raised the HDF library code
+ *  <li>
+ *   HDFJavaException -- errors raised the HDF Java wrapper code
+ *  </ol>
+ *  <p>
+ *  These exceptions will be sub-classed to represent specific
+ *  error conditions, as needed.
+ *  <p>
+ *  The only specific exception currently defined is
+ *  HDFNotImplementedException, indicating a function that is part
+ *  of the HDF API, but which cannot or will not be implemented
+ *  for Java.
+ */
+public class HDFException extends Exception
+{
+    static public final String OutOfMemoryMessage="ERROR: HDF Library: Out of memory";
+    static public final String HDFExceptionMessage="ERROR: HDF Library Error";
+    static public final String HDFMessage="ERROR: Unknown HDF Error";
+
+    protected int HDFerror;
+    protected String msg;
+
+    public HDFException() {
+        super();
+        HDFerror = 0;
+        msg = null;
+    }
+
+    public HDFException(String s) {
+        super();
+        msg = s;
+    }
+
+    public HDFException(int err) {
+        super();
+        HDFerror = err;
+        msg = null;
+    }
+
+    @Override
+    public String getMessage() {
+        return msg;
+    }
+}
diff --git a/java/src/hdf/hdflib/HDFIMCOMPCompInfo.java b/java/src/hdf/hdflib/HDFIMCOMPCompInfo.java
new file mode 100644
index 0000000..52752dc
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFIMCOMPCompInfo.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  ``Image compression'' compression class.
+ * <p>
+ * In this case, no auxilliary information is needed.
+ */
+public class HDFIMCOMPCompInfo extends HDFOldCompInfo {
+
+    public HDFIMCOMPCompInfo () {
+        ctype = HDFConstants.COMP_IMCOMP;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFJPEGCompInfo.java b/java/src/hdf/hdflib/HDFJPEGCompInfo.java
new file mode 100644
index 0000000..90dae6d
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFJPEGCompInfo.java
@@ -0,0 +1,49 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  JPEG compression class.
+ * <p>
+ * In this case, the parameters are the quality and baseline.
+ */
+
+
+public class HDFJPEGCompInfo extends HDFOldCompInfo {
+
+    /* Struct to contain information about how to compress */
+     /* or decompress a JPEG encoded 24-bit image */
+
+     public int    quality;    /* Quality factor for JPEG compression, should be from */
+     /* 0 (terrible) to 100 (very good) */
+
+     public int    force_baseline;     /* If force_baseline is set to TRUE then */
+     /* quantization tables are limited to */
+     /* 0..255 for JPEG baseline compability */
+     /* This is only an issue for quality */
+     /* settings below 24 */
+
+    public HDFJPEGCompInfo() {
+    	ctype = HDFConstants.COMP_JPEG;
+    }
+
+    public HDFJPEGCompInfo(int qual, int fb) {
+    	ctype = HDFConstants.COMP_JPEG;
+        quality = qual;
+        force_baseline = fb;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFJavaException.java b/java/src/hdf/hdflib/HDFJavaException.java
new file mode 100644
index 0000000..80869a1
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFJavaException.java
@@ -0,0 +1,40 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ *  <p>
+ *  The class HDFJavaException returns errors from the Java
+ *  wrapper of theHDF library.
+ *  <p>
+ *  These errors include Java configuration errors, security
+ *  violations, and resource exhaustion.
+ */
+public class HDFJavaException extends HDFException 
+{
+    String msg;
+
+    public HDFJavaException() {
+        HDFerror = 0;
+    }
+
+    public HDFJavaException(String s) {
+        msg = "HDFLibraryException: "+s;
+    }
+
+    @Override
+	public String getMessage() {
+        return msg;
+    }
+}
diff --git a/java/src/hdf/hdflib/HDFLibrary.java b/java/src/hdf/hdflib/HDFLibrary.java
new file mode 100644
index 0000000..5396455
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFLibrary.java
@@ -0,0 +1,3172 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+import java.io.File;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *  This is the Java interface for the HDF 4.2 library.
+ *  <p>
+ *  This code is the called by Java programs to access the
+ *  entry points of the HDF 4.2 library.
+ *  Each routine wraps a single HDF entry point, generally with the
+ *  arguments and return codes analogous to the C interface.
+ *  <hr>
+ * <p>
+ *  These routines use the class <a href="./hdf.hdflib.HDFArray.html">HDFArray</a>
+ *  to handle arrays of arbitrary type and shape.
+ *  <hr>
+ *  <p>
+ *  <b>Mapping of arguments for Java</b>
+ *
+ *  <p>
+ *  In general, arguments to the HDF Java API are straightforward
+ *  translations from the 'C' API described in the HDF Reference
+ *  Manual.
+ *
+ *  <center>
+ *  <table border=2 cellpadding=4>
+ *  <caption>
+ *  <b>C types to Java types</b>
+ *  </caption>
+ *  <tr>
+ *  <td>
+ *  C
+ *  </td>
+ *  <td>
+ *  Java
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  int, intn, int32, uint32
+ *  </td>
+ *  <td>
+ *  int
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  short, uint16, int16
+ *  </td>
+ *  <td>
+ *  short
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  float, float32
+ *  </td>
+ *  <td>
+ *  float
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  double, float64
+ *  </td>
+ *  <td>
+ *  double
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  char, uchar, int8, uint8
+ *  </td>
+ *  <td>
+ *  byte
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  char * (<em>i.e.</em>, string)
+ *  </td>
+ *  <td>
+ *  java.lang.String
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  void
+ *  </td>
+ *  <td>
+ *  void
+ *  </td>
+ *  </tr>
+ *  <tr>
+ *  <td>
+ *  void *, VOIDP, char * (meaning ``any'')
+ *  </td>
+ *  <td>
+ *  Special -- see HDFArray
+ *  </td>
+ *  </tr>
+ *  </table>
+ *  </center>
+ *  <center>
+ *  <b>General Rules for Passing Arguments and Results</b>
+ *  </center>
+ *  <p>
+ *  In general, arguments passed <b>IN</b> to Java are the analogous
+ *  basic types, as above.
+ *  The exception is for arrays, which are discussed below.
+ *  <p>
+ *  The <i>return value</i> of Java methods is also the analogous
+ *  type, as above.
+ *  A major exception to that rule is that all HDF functions that
+ *  return SUCCEED/FAIL are declared <i>boolean</i> in the
+ *  Java version, rather than
+ *  <i>intn</i> or whatever.
+ *  (Functions that return a value or else FAIL are declared
+ *  the equivalent to the C function.)
+ *  <p>
+ *  Java does not support pass by reference of arguments, so
+ *  arguments that are returned through <b>OUT</b> parameters
+ *  must be wrapped in an object or array.
+ *  The Java API for HDF consistently wraps arguments in
+ *  arrays.
+ *  <p>
+ *  For instance, a function that returns two integers is
+ *  declared:
+ *  <pre>
+ *       void HDFdummy( int32* a1, int32* a2)
+ *  </pre>
+ *  For the Java interface, this would be declared:
+ *  <pre>
+ *       public static native void HDFdummy( int args[] );
+ *  </pre>
+ *  where <i>a1</i> is <i>args[0]</i>
+ *  and <i>a2</i> is <i>args[1]</i>.
+ *  <p>
+ *  All the routines where this convention is used will have
+ *  specific documentation of the details, given below.
+ *  <p>
+ *  <b>Arrays</b>
+ *  <p>
+ *  HDF needs to read and write multi-dimensional arrays
+ *  of many types.
+ *  The HDF API is self-describing, with the data for the
+ *  array passed as a block of bytes, for instance,
+ *  <pre>
+ *      int SDreaddata(int sdsid, int32 *start, int32 * stride,
+ *             int32 *count, VOIDP data);
+ *  </pre>
+ *  <p>
+ *  where ``VOIDP'' means that the data may be any valid numeric
+ *  type, and is a contiguous block of bytes that is the data
+ *  for a multi-dimensional array.
+ *  <p>
+ *  For Java, this is a problem, as the type of data must
+ *  be declared.  Furthermore, multidimensional arrays
+ *  are definitely <i>not</i> layed out contiguously
+ *  in memory.
+ *  It would be infeasible to declare a separate routine for
+ *  every combination of number type and dimensionality.
+ *  For that reason, the <b>HDFArray</b> class is used to
+ *  discover the type, shape, and size of the data array
+ *  at run time, and to convert to and from contigous
+ *  bytes.
+ *  The upshot is that the data can be passed as an ``Object'',
+ *  and the Java API will translate to and from the appropriate
+ *  bytes.
+ *  So the function above would be declared:
+ *  <pre>
+ *      int SDreaddata(int sdsid, int[] start, int[] stride,
+ *             int[] count, Object data);
+ *  </pre>
+ *  and the parameter <i>data</i> can be any multi-dimensional
+ *  array of numbers, such as float[][], or int[][][].
+ *  <center>
+ *  <b>Compression and Chunk Information</b>
+ *  </center>
+ *  <p>
+ *  The HDF library passes the parameters needed by compression
+ *  and chunking through  C structures (actually, unions).
+ *  The Java interface passes these as instances of subclasses
+ *  of class HDFCompInfo and HDFChunkInfo respectively.
+ *
+ *  <p><b> See: </b><a href="hdf.hdflib.HDFChunkInfo.html">
+ *  hdf.hdflib.HDFChunkInfo</a>,
+ *  and
+ *  <p><a href="hdf.hdflib.HDFCompInfo.html">
+ *  hdf.hdflib.HDFCompInfo</a>.
+ *  <hr>
+ */
+public class HDFLibrary implements java.io.Serializable
+{
+    /**
+     *
+     */
+    private static final long serialVersionUID = -1695429510319126910L;
+
+    public final static String HDFPATH_PROPERTY_KEY = "hdf.hdflib.HDFLibrary.hdflib";
+
+    private final static Logger log = LoggerFactory.getLogger(HDFLibrary.class);
+
+    private final static String JHI_VERSION= "3.99";
+    private static boolean isLibraryLoaded = false;
+
+    static { loadH4Lib(); }
+
+    public static void loadH4Lib()
+    {
+        if (isLibraryLoaded) // load only once
+            return;
+
+        // first try loading library via full path
+        String filename = System.getProperty(HDFPATH_PROPERTY_KEY, null);
+        if ((filename != null) && (filename.length() > 0)) {
+            File h4dll = new File(filename);
+            if (h4dll.exists() && h4dll.canRead() && h4dll.isFile()) {
+                try {
+                    System.load(filename);
+                    isLibraryLoaded = true;
+                    }
+                catch (Throwable err) {
+                    isLibraryLoaded = false;
+                }
+                finally {
+                    log.info("HDF4 library: ");
+                    log.debug(filename);
+                    log.info((isLibraryLoaded ? "" : " NOT")
+                            + " successfully loaded.");
+                }
+            }
+            else {
+                isLibraryLoaded = false;
+                throw (new UnsatisfiedLinkError("Invalid HDF4 library, "+filename));
+            }
+        }
+
+        // else load standard library
+        if (!isLibraryLoaded) {
+            String mappedName = null;
+            String s_libraryName = "hdf_java";
+            try {
+                mappedName = System.mapLibraryName(s_libraryName);
+                System.loadLibrary("hdf_java");
+                isLibraryLoaded = true;
+            }
+            catch (Throwable err) {
+                isLibraryLoaded = false;
+            }
+            finally {
+                log.info("HDF4 library: " + s_libraryName);
+                log.debug(" resolved to: " + mappedName + "; ");
+                log.info((isLibraryLoaded ? "" : " NOT")
+                        + " successfully loaded from java.library.path");
+            }
+        }
+
+        try {
+            HDFLibrary.HDdont_atexit();
+        }
+        catch (HDFException e) {
+            System.exit(1);
+        }
+
+        /* Important!  Exit quietly */
+    }
+
+    @Deprecated
+    public static final String getJHIVersion() { return JHI_VERSION; }
+
+    public  static long Hopen(String filename) throws HDFException {
+        return Hopen(filename, HDFConstants.DFACC_RDONLY, 0);
+    }
+
+    public  static long Hopen(String filename, int access) throws HDFException {
+        return Hopen(filename, access, 0);
+    }
+
+    public static native long Hopen(String filename, int access, int ndds) throws HDFException;
+
+    public static native  boolean Hclose(long fid) throws HDFException;
+
+    public static native int HDdont_atexit() throws HDFException;
+
+    public static native boolean Hishdf(String fileName) throws HDFException;
+
+    public static int Hnumber(long fid) throws HDFException {
+        return Hnumber(fid, HDFConstants.DFTAG_WILDCARD);
+    }
+
+    public static native int Hnumber(long fid, int tagtype) throws HDFException;
+
+    public static native int DFKNTsize(long numbertype) throws HDFException;
+
+    public static native String HDgetNTdesc(int nt) throws HDFException;
+
+    public static native boolean Hcache(long file_id, int cache_switch) throws HDFException;
+
+/*  not yet implemented
+    public static native boolean Hflushdd(long file_id) throws HDFException;
+*/
+
+    /**
+     *
+     *  <b>Note:</b> the version of an HDF file is not well defined,
+     *  it is not recommended that programs rely on these numbers.
+     *  <p>
+     *  @param file_id <b>IN</b>: long, the file descriptor returned by Hopen
+     *  @param vers <b>OUT</b>: int[3], the major version, minor version,
+     *  and release number of the file.
+     *  @param string <b>OUT</b>: String[1], the version string
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call, but is not yet implemented.
+     *
+     *  @return the major, minor, and release number are returned
+     * in the array of ints, and a string is returned in the string.
+     */
+    public static native boolean Hgetfileversion(long file_id, int[] vers,
+            String []string) throws HDFException;
+
+    /**
+     *  @param vers <b>OUT</b>: int[3], the major version, minor version,
+     *  and release number of the HDF library.
+     *  @param string <b>OUT</b>: String[1], the version string
+     *
+     *  @return the major, minor, and release number are returned
+     * in the array of ints, and a string is returned in the string.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call, but is not yet implemented.
+     */
+    public static native boolean Hgetlibversion(int[] vers, String[] string) throws HDFException;
+
+    public static native boolean Hsetaccesstype(long h_id, int access_type) throws HDFException;
+
+    public static native boolean Hsync(long file_id) throws HDFException;
+
+    public static native int ANstart(long fid) throws HDFException;
+
+    public static native boolean ANend(long an_id) throws HDFException;
+
+    public static native boolean ANendaccess(long an_id) throws HDFException;
+
+    /**
+     *  @param an_id <b>IN</b>: the AN interface id, returned by ANstart
+     *  @param info <b>OUT</b>: int[4], n_file_label, n_file_desc,
+     *  n_data_label, n_data_desc
+     *
+     *  @return four integer parameters:
+     *  info[0] = n_file_label, info[1] = n_file_desc,
+     *  info[2] = n_data_label, info[3] = n_data_desc
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     */
+    public static native boolean ANfileinfo(long an_id, int[] info) throws HDFException;
+
+    public static native int ANselect(long an_id, int index, int anntype) throws HDFException;
+
+    public static native int ANnumann(long an_id, int anntype, short tag, short ref) throws HDFException;
+
+    public static native short ANatype2tag(int antag) throws HDFException;
+
+    public static native int ANtag2atype(short anttype) throws HDFException;
+
+    /**
+     *  @param an_id <b>IN</b>: the AN interface id, returned by ANstart
+     *  @param anntype <b>IN</b>: the number type, as defined in HDFConstants
+     *  @param tag <b>IN</b>: the HDF tag
+     *  @param ref <b>IN</b>: the HDF ref
+     *  @param ann_list <b>OUT</b>: int[], an array of annotation identifiers.
+     *  The array must be long enough to hold the number of annotations
+     *  returned by ANnumann
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return an array of integers, which are the identifiers of
+     *  the annotations
+     */
+    public static native int ANannlist(long an_id, int anntype, short tag, short ref,
+                int[] ann_list) throws HDFException;
+
+    public static native int ANannlen(long ann_id) throws HDFException;
+
+    /**
+     *  @param ann_id <b>IN</b>: the AN interface id, returned by ANstart
+     *  @param annbuf <b>OUT</b>: String[1], the annotation is returned as annbuf[0].
+     *  @param maxlen <b>IN</b>: int, the maximum length of the string.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return an annotation string: annbuf[0] = the annotation
+     */
+    public static native boolean ANreadann(long ann_id, String[] annbuf, int maxlen) throws HDFException;
+
+    public static native int ANcreate(long an_id, short tag, short ref, int type) throws HDFException;
+
+    public static native int ANcreatef(long an_id, int type) throws HDFException;
+
+    /**
+     *  @param an_id <b>IN</b>: the AN interface id, returned by ANstart
+     *  @param index <b>IN</b>: the index of the annotation
+     *  @param type <b>IN</b>: the type of the annotation
+     *  @param tagref <b>OUT</b>: short[2], the tag and ref of the annotation
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the tag and ref:  tagref[0] = tag, tagref[1] = ref
+     */
+    public static native int ANget_tagref(long an_id, int index, int type, short[] tagref) throws HDFException;
+
+    /**
+     *  @param an_id <b>IN</b>: the AN interface id, returned by ANstart
+     *  @param tagref <b>OUT</b>: short[2], the tag and ref of the annotation
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the tag and ref:  tagref[0] = tag, tagref[1] = ref
+     */
+    public static native boolean ANid2tagref(long an_id, short[] tagref) throws HDFException;
+
+    public static native long ANtagref2id(long an_id, short tag, short ref) throws HDFException;
+
+    public static native boolean ANwriteann(long ann_id, String label, int ann_length) throws HDFException;
+
+    public static native boolean DFPaddpal(String filename, byte[] palette) throws HDFException;
+
+    public static native boolean DFPgetpal(String filename, byte[] palette) throws HDFException;
+
+    public static native short DFPlastref() throws HDFException;
+
+    public static native int DFPnpals(String filename) throws HDFException;
+
+    public static native boolean DFPputpal(String filename, byte[] palette, int overwrite, String filemode) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the name of the HDF file
+     *  @param palette <b>IN</b>: byte[] the palette
+     *  @param overwrite <b>IN</b>: boolean, converted to 1 == true, 0 == false
+     *                              to call the HDF library
+     *  @param filemode <b>IN</b>: if "a" append palette to file, "w" create new file
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return true on success
+     */
+    public static boolean DFPputpal(String filename, byte[] palette, boolean overwrite, String filemode) throws HDFException
+    {
+        if (overwrite) {
+            return DFPputpal(filename, palette, 1, filemode);
+        }
+        else {
+            return DFPputpal(filename, palette, 0, filemode);
+        }
+    }
+
+
+    public static native boolean DFPreadref(String filename, short ref) throws HDFException;
+
+    public static native short DFPrestart() throws HDFException;
+
+    public static native boolean DFPwriteref(String filename, short ref) throws HDFException;
+
+    public static native int GRstart(long fid) throws HDFException;
+
+
+    public static native boolean GRend(long grid) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by GRstart
+     *  @param args <b>OUT</b>: int[2], n_datasets and n_file_attrs
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the file info:  args[0] = n_datasets, args[1] = n_file_attrs
+     */
+    public static native boolean GRfileinfo(long grid, int [] args) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD identifier returned by SDselect
+     *  @param chunk_def <b>OUT</b>: HDFChunkInfo, the chunking info
+     *  @param flag <b>OUT</b>: int[1], the type of chunking
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return c_info contains information about the chunking method,
+     *  flags[0] == the chunking flags
+     *
+     *  <p><b>NOTE:</b>The chunking algorithm-specific information is
+     *  passed in an appropriate sub-class of HDFChunkInfo.
+     */
+    public static native boolean GRgetchunkinfo(long sdsid, HDFChunkInfo chunk_def, int[] flag) throws HDFException;
+
+    public static native int GRselect(long grid, int index) throws HDFException;
+
+    public static native int GRnametoindex(long grid, String name) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by GRstart
+     *  @param gr_name <b>OUT</b>: name of raster image
+     *  @param args <b>OUT</b>: int[4], image info:
+     *          number of components in the image,
+     *          data type of the image data,
+     *          interlace mode of the stored image data,
+     *          number of attributes assigned to the image
+     *  @param dim_sizes <b>OUT</b>: int[2], dim_sizes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *
+     *  @return the file info:  String[0] = gr_name, args[0] = ncomp,
+     *  args[1] = data_type, args[2] = interlace, args[3] = num_attrs
+     *
+     *  <p><b>NOTE:</b> the parameters for the Java interface are not in
+     *  the same order as the C interface.
+     */
+    public static native boolean GRgetiminfo(long grid, String[] gr_name, int[] args, int[] dim_sizes) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by GRstart
+     *  @param start <b>IN</b>: int[2], start
+     *  @param stride <b>IN</b>: int[2], stride. If the stride parameter is set to NULL,
+     *                                           a stride of 1 will be assumed.
+     *                                           strides of 0 are illegal.
+     *  @param count <b>IN</b>: int[2], count
+     *  @param data <b>OUT</b>: byte[], data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the form of a continous array of
+     *  bytes.
+     *
+     *  <p><b>NOTE:</b> to read into a Java 2D array use the alternative
+     *  routine below.
+     */
+    public static native boolean GRreadimage(long grid, int[] start, int[] stride,
+                       int[] count, byte[] data) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by GRstart
+     *  @param start <b>IN</b>: int[2], start
+     *  @param stride <b>IN</b>: int[2], stride. If the stride parameter is set to NULL,
+     *                                           a stride of 1 will be assumed.
+     *                                           strides of 0 are illegal.
+     *  @param count <b>IN</b>: int[2], count
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the Java array.
+     *
+     *  <p><b>Note:</b> reads the data as bytes and converts to
+     *  the Java array.
+     */
+    public static boolean GRreadimage(long grid, int[] start, int[] stride,
+                       int[] count, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = GRreadimage(grid, start, stride, count, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    public static native boolean GRendaccess(long riid) throws HDFException;
+
+/*
+   "[Later]"
+    public static native int  GRgetdimid(long riid, int index) throws HDFException;
+*/
+
+/*
+   "[Later]"
+    public static native boolean  GRdiminfo(long dimid, char[] name, int[] diminfo[]) throws HDFException;
+*/
+
+    public static native short GRidtoref(long riid) throws HDFException;
+
+    public static native int GRreftoindex(long grid, short ref) throws HDFException;
+
+    public static native boolean GRreqlutil(long riid, int interlace) throws HDFException;
+
+    public static native boolean GRreqimageil(long rrid, int interlace) throws HDFException;
+
+    public static native int GRgetlutid(long rrid, int index) throws HDFException;
+
+    public static native int GRgetnluts(long rrid) throws HDFException;
+
+    /**
+     *  @param lutid <b>IN</b>: the palette identifier returned by GRgetlutid
+     *  @param args <b>OUT</b>: int[4], palette info:
+     *            Number of components in the palette,
+     *            Data type of the palette data,
+     *            Interlace mode of the stored palette data,
+     *            Number of color lookup table entries in the palette.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the palette info:  args[0] = ncomp, args[1] = data_type,
+     *  args[2] = interlace, args[3] = num_entries
+     *
+     */
+    public static native boolean GRgetlutinfo(long lutid, int[] args) throws HDFException;
+
+    /**
+     *  @param lutid <b>IN</b>: the palette identifier returned by GRgetlutid
+     *  @param data <b>OUT</b>: byte[], palette data, in bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the palette data:  as bytes
+     *
+     *  <p><b>NOTE:</b> to read into a Java 1D array use the alternative
+     *  routine below.
+     */
+    public static native boolean GRreadlut(long lutid, byte[] data) throws HDFException;
+
+    /**
+     *  @param lutid <b>IN</b>: the palette identifier returned by GRgetlutid
+     *  @param theData <b>OUT</b>: Object, palette data, an Java array
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the palette data:  as a Java array
+     *
+     *  <p><b>Note:</b> reads the data as bytes and converts to
+     *  the Java array.
+     */
+    public static boolean GRreadlut(long lutid, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = GRreadlut(lutid, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    /**
+     *  @param id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param index <b>IN</b>: the index of the attribute
+     *  @param name <b>OUT</b>: String[1], the name of the attribute
+     *  @param argv <b>OUT</b>: int[2], the type and length of the
+     *  attribute
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the name, type, and lenght of the attribute:
+     *  name[0] = name, argv[0] = data_type, argv[1] = length
+     */
+    public static native boolean GRattrinfo(long id, int index, String[] name, int[] argv) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param index <b>IN</b>: index of the attribute for info
+     *  @param data <b>OUT</b>: byte[], attribute data, in bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the attribute data:  as bytes
+     *
+     *  <p><b>NOTE:</b> to read into a Java 1D array use the alternative
+     *  routine below.
+     */
+    public static native boolean GRgetattr(long id, int index, byte[] data) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param index <b>IN</b>: index of the attribute for info
+     *  @param theData <b>OUT</b>: Object, attribute data, an Java array
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the attribute data:  as a Java array
+     *
+     *  <p><b>Note:</b> reads the data as bytes and converts to
+     *  the Java array.
+     */
+    public static boolean GRgetattr(long id, int index, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = GRgetattr(id, index, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    public static native int GRfindattr(long id, String name) throws HDFException;
+
+    public static native int GRcreate(long gr_id, String name, int ncomp,
+                long data_type, int interlace_mode, int[] dim_sizes) throws HDFException;
+
+    public static native short GRluttoref(long pal_id) throws HDFException;
+
+    /**
+     *  @param gr_id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param attr_name <b>IN</b>: the name of the attribute
+     *  @param data_type <b>IN</b>: the number type of the data (should
+     *  be DFNT_CHAR)
+     *  @param count <b>IN</b>: the length the data (lenght of 'values')
+     *  @param values <b>IN</b>: the the attribute to write -- A String
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>This routine writes a attribute that is
+     *  a String.  Alternative methods write data of other types.
+     *
+     *  @return true on success
+     */
+    public static native boolean GRsetattr(long gr_id, String attr_name,
+                long data_type, int count, String values) throws HDFException;
+
+    /**
+     *  @param gr_id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param attr_name <b>IN</b>: the name of the attribute
+     *  @param data_type <b>IN</b>: the number type of the data
+     *  @param count <b>IN</b>: the length the data (lenght of 'values')
+     *  @param values <b>IN</b>: the the attribute to write -- in an
+     *  array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>This routine writes the attribute as an array
+     *  of bytes.  <b>DO NOT USE THIS TO WRITE A STRING.</b>  This
+     *  is intended for numeric data that has been flattened into
+     *  bytes.
+     *
+     *  @return true on success
+     */
+    public static native boolean GRsetattr(long gr_id, String attr_name,
+            long data_type, int count, byte[] values) throws HDFException;
+
+    /**
+     *  @param gr_id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param attr_name <b>IN</b>: the name of the attribute
+     *  @param data_type <b>IN</b>: the number type of the data
+     *  @param count <b>IN</b>: the length the data (lenght of 'values')
+     *  @param theData <b>IN</b>: Object -- the value to be written,
+     *  a Java array of numbers.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>This routine converts the Java array to bytes
+     *  then writes it.
+     *  <b>DO NOT USE THIS TO WRITE A STRING.</b>
+     *
+     *  @return true on success
+     */
+    public static boolean GRsetattr(long gr_id, String attr_name,
+                long data_type, int count, Object theData) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return GRsetattr(gr_id, attr_name, data_type, count, data);
+    }
+    /**
+     *  @param sdsid <b>IN</b>: the SD identifier returned by SDselect
+     *  @param chunk_def <b>IN</b>: HDFChunkInfo, the chunking info
+     *  @param flags <b>IN</b>: the type of chunking
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>The chunking algorithm-specific information is
+     *  passed in an appropriate sub-class of HDFChunkInfo.
+     *
+     *  @return true on success
+     */
+    public static native boolean GRsetchunk(long sdsid, HDFChunkInfo chunk_def, int flags) throws HDFException;
+
+    public static native int GRsetchunkcache(long sdsid, int maxcache, int flags) throws HDFException;
+    /**
+     *  @param ri_id <b>IN</b>: the GR identifier returned by GRstart
+     *  @param comp_type <b>IN</b>: the type of compression
+     *  @param c_info <b>IN</b>: HDFCompInfo, the compression info
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>The compression algorithm specific information is
+     *  passed in an appropriate sub-class of HDFCompInfo.
+     *
+     *  @return true on success
+     */
+    public static native boolean GRsetcompress(long ri_id, int comp_type, HDFCompInfo c_info) throws HDFException;
+
+    public static native boolean GRgetcompress(long ri_id, HDFCompInfo c_info) throws HDFException;
+
+    public static native boolean GRgetcompinfo(long ri_id, HDFCompInfo c_info) throws HDFException;
+
+    public static native boolean GRsetexternalfile(long ri_id, String filename, int offset) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by GRstart
+     *  @param start <b>IN</b>: int[2], start
+     *  @param stride <b>IN</b>: int[2], stride. If the stride parameter is set to NULL,
+     *                                           a stride of 1 will be assumed.
+     *                                           strides of 0 are illegal.
+     *  @param edge <b>IN</b>: int[2], count
+     *  @param data <b>IN</b>: byte[], data to be written
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to write from a Java 2D array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+
+    public static native boolean GRwriteimage(long grid, int[] start, int[] stride,
+                int[] edge, byte[] data) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by GRstart
+     *  @param start <b>IN</b>: int[2], start
+     *  @param stride <b>IN</b>: int[2], stride. If the stride parameter is set to NULL,
+     *                                           a stride of 1 will be assumed.
+     *                                           strides of 0 are illegal.
+     *  @param edge <b>IN</b>: int[2], count
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts the Java array to a contiguous
+     *  block of bytes appropriate for C, and then writes the bytes.
+     *
+     *  @return true on success
+     */
+    public static boolean GRwriteimage(long grid, int[] start, int[] stride,
+                int[] edge, Object theData) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return GRwriteimage(grid, start, stride, edge, data);
+    }
+
+    /**
+     *  @param pal_id <b>IN</b>: the palette identifier returned by GRgetlutid
+     *  @param ncomp <b>IN</b>: int, number of components
+     *  @param data_type <b>IN</b>: int, number type
+     *  @param interlace <b>IN</b>: int, interlace
+     *  @param num_entries <b>IN</b>: int, number of entries
+     *  @param pal_data <b>IN</b>: byte[], palette data to be written--as bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *
+     *  <p><b>NOTE:</b> to write from a Java array of numbers use
+     *  the alternative routine below.
+     *
+     *  @return true on success
+     */
+
+    public static native boolean GRwritelut(long pal_id, int ncomp, int data_type,
+            int interlace, int num_entries, byte[] pal_data) throws HDFException;
+
+    /**
+     *  @param pal_id <b>IN</b>: the palette identifier returned by GRgetlutid
+     *  @param ncomp <b>IN</b>: int, number of components
+     *  @param data_type <b>IN</b>: int, number type
+     *  @param interlace <b>IN</b>: int, interlace
+     *  @param num_entries <b>IN</b>: int, number of entries
+     *  @param theData <b>IN</b>: Object, palette data to be written, any
+     *  number type.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *
+     *  <p><b>Note:</b> converts the Java array to a contiguous
+     *  block of bytes appropriate for C, and then writes the bytes.
+     *
+     *  @return true on success
+     */
+    public static boolean GRwritelut(long pal_id, int ncomp, int data_type,
+            int interlace, int num_entries, Object theData) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return GRwritelut(pal_id, ncomp, data_type, interlace, num_entries, data);
+    }
+
+    /**
+     *  @param sdsid <b>IN</b>: the GR interface id, returned by SDselect
+     *  @param origin <b>IN</b>: int[], origin
+     *  @param theData <b>OUT</b>: byte[], the data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean GRreadchunk(long sdsid, int[] origin, byte[] theData) throws HDFException;
+
+    /**
+     *  @param grid <b>IN</b>: the GR interface id, returned by SDselect
+     *  @param origin <b>IN</b>: int[], origin
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return true on success
+     */
+    public static boolean GRreadchunk(long grid, int[] origin, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = GRreadchunk(grid, origin, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    public static native boolean HDFclose(long file_id) throws HDFException;
+
+    public static native long HDFopen(String filename, int access, short n_dds) throws HDFException;
+
+    public static native short HEvalue(int level) throws HDFException;
+
+    public static native String HEstring(int error_code) throws HDFException;
+
+    public static native void HEprint(Object stream, int level) throws HDFException;
+
+    public static native boolean HXsetcreatedir(String dir) throws HDFException;
+
+    public static native boolean HXsetdir(String dir) throws HDFException ;
+
+    public static native long SDstart(String filename, int accessmode) throws HDFException;
+
+    public static native boolean SDend(long sdid) throws HDFException;
+
+    /**
+     *  @param sdid <b>IN</b>: the SD interface id, returned by SDstart
+     *  @param argv <b>OUT</b>: int[2],
+     *          Number of datasets in the file,
+     *          Number of global attributes in the file
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the file info:  argv[0] = n_datasets, argv[1] = n_file_attrs
+     */
+    public static native boolean SDfileinfo(long sdid, int[] argv) throws HDFException;
+
+    public static native long SDselect(long sdid, int index) throws HDFException;
+
+    public static native int SDnametoindex(long sdid, String name) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param name <b>OUT</b>: String[1], the name of the dataset
+     *  @param args <b>OUT</b>: int[3], dataset info:
+     *         number of dimensions (rank),
+     *         data type for the data stored in the dataset,
+     *         number of "netCDF-style" attributes for this dataset
+     *  @param dimsizes <b>OUT</b>: int[(rank)], sizes of dimensions
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the file info:  name[0] = gr_name, args[0] = rank,
+     *  args[1] = data_type, args[2] = nattrs, dim_sizes[] = dimensions
+     *
+     *  <p><b>NOTE:</b> the parameters for the Java interface are not in
+     *  the same order as the C interface.
+     */
+    public static native boolean SDgetinfo(long sdsid, String[ ]name,
+            int[] dimsizes, int[] args) throws HDFException;
+
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param emptySDS <b>OUT</b>: int[1], 1 if the SDS is empty, 0 if has data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDcheckempty(long sdsid, int[] emptySDS) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param start <b>IN</b>: int[], start
+     *  @param stride <b>IN</b>: int[], stride
+     *  @param count <b>IN</b>: int[], count
+     *  @param data <b>OUT</b>: byte[], data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the form of a continous array of
+     *  bytes.
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     */
+    public static native boolean SDreaddata(long sdsid, int[] start, int[] stride,
+                       int[] count, byte[] data) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param start <b>IN</b>: int[], start
+     *  @param stride <b>IN</b>: int[], stride
+     *  @param count <b>IN</b>: int[], count
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the Java array.
+     *
+     *  <p><b>Note:</b> reads the data as bytes and converts to
+     *  the Java array.
+     */
+    public static boolean SDreaddata(long sdsid, int[] start, int[] stride,
+                       int[] count, Object theData) throws HDFException
+    {
+        boolean status = false;
+        boolean is1D = false;
+
+        Class dataClass = theData.getClass();
+        if (!dataClass.isArray()) {
+            throw (new HDFJavaException("SDreaddata: data is not an array"));
+        }
+
+        String cname = dataClass.getName();
+        is1D = (cname.lastIndexOf('[') ==cname.indexOf('['));
+        char dname = cname.charAt(cname.lastIndexOf("[")+1);
+
+        if (is1D && (dname == 'B')) {
+            status = SDreaddata(sdsid, start, stride, count, (byte[])theData);
+        }
+        else if (is1D && (dname == 'S')) {
+            status = SDreaddata_short(sdsid, start, stride, count, (short[])theData);
+        }
+        else if (is1D && (dname == 'I')) {
+            status = SDreaddata_int(sdsid, start, stride, count, (int[])theData);
+        }
+        else if (is1D && (dname == 'J')) {
+            status = SDreaddata_long(sdsid, start, stride, count, (long[])theData);
+        }
+        else if (is1D && (dname == 'F')) {
+            status = SDreaddata_float(sdsid, start, stride, count, (float[])theData);
+        }
+        else if (is1D && (dname == 'D')) {
+            status = SDreaddata_double(sdsid, start, stride, count, (double[])theData);
+        }
+        else {
+            byte[] data;
+            HDFArray theArray = new HDFArray(theData);
+            data = theArray.emptyBytes();
+            status = SDreaddata(sdsid, start, stride, count, data);
+            theData = theArray.arrayify(data);
+        }
+
+        return status;
+    }
+
+    ////////////////////////////////////////////////////////////////////
+    //                                                                //
+    //         New APIs for read data from library                    //
+    //  Using SDreaddata(..., Object buf) requires function calls     //
+    //  theArray.emptyBytes() and theArray.arrayify( buf), which      //
+    //  triples the actual memory needed by the data set.             //
+    //  Using the following APIs solves the problem.                  //
+    //                                                                //
+    ////////////////////////////////////////////////////////////////////
+
+    public static native boolean SDreaddata_short(long sdsid, int[] start, int[] stride,
+                       int[] count, short[] theData) throws HDFException;
+
+    public static native boolean SDreaddata_int(long sdsid, int[] start, int[] stride,
+                       int[] count, int[] theData) throws HDFException;
+
+    public static native boolean SDreaddata_long(long sdsid, int[] start, int[] stride,
+                       int[] count, long[] theData) throws HDFException;
+
+    public static native boolean SDreaddata_float(long sdsid, int[] start, int[] stride,
+                       int[] count, float[] theData) throws HDFException;
+
+    public static native boolean SDreaddata_double(long sdsid, int[] start, int[] stride,
+                       int[] count, double[] theData) throws HDFException;
+
+    public static native boolean SDendaccess(long sdsid) throws HDFException;
+
+    public static native long SDgetdimid(long sdsid, int index) throws HDFException;
+
+    /**
+     *  @param dimid <b>IN</b>: the dimension id, returned by SDgetdimid
+     *  @param name <b>OUT</b>: String[1], the dimension name
+     *  @param argv <b>OUT</b>: int[3], size of the name string,
+     *  number type of data in the array, # attributes for the dimension
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return name[0] = name, argv[0] = count, argv[1] = data_type, argv[2] = nattr
+     */
+    public static native boolean SDdiminfo(long dimid, String[] name, int[] argv) throws HDFException;
+
+    public static native int SDidtoref(long sdsid) throws HDFException;
+
+    public static native int SDreftoindex(long sdid, int ref) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: id of a file, SDS, or dimension
+     *  @param index <b>IN</b>: index of the attribute
+     *  @param name <b>OUT</b>: String[1], the name of the attribute
+     *  @param argv <b>OUT</b>: int[2],  number type of the attribute,
+     *  number of values in the attribute
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return name[0] = attr_name, argv[0] = data_type, argv[1] = count
+     */
+    public static native boolean SDattrinfo(long id, int index, String[] name, int[] argv) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: id of a file, SDS, or dimension
+     *  @param index <b>IN</b>: index of the attribute
+     *  @param data <b>OUT</b>: byte[], data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the form of a continous array of
+     *  bytes.
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     */
+    public static native boolean SDreadattr(long id, int index, byte[] data) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: id of a file, SDS, or dimension
+     *  @param index <b>IN</b>: index of the attribute
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the Java array.
+     *
+     *  <p><b>Note:</b> reads the data as bytes and converts to
+     *  the Java array.
+     */
+    public static boolean SDreadattr(long id, int index, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        Class theClass = theData.getClass();
+        String name = theClass.getName();
+        if (name.equals("java.lang.String")) {
+            data = ((String)theData).getBytes();
+            rval = SDreadattr(id, index, data);
+            theData = new String(data);
+        }
+        else {
+            HDFArray theArray = new HDFArray(theData);
+            data = theArray.emptyBytes();
+            rval = SDreadattr(id, index, data);
+            theData = theArray.arrayify(data);
+        }
+        return rval;
+    }
+
+    public static native long SDfindattr(long id, String name) throws HDFException;
+
+    public static native boolean SDiscoordvar(long sdsid) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param argv <b>OUT</b>: double[4], calibration information:
+     *          calibration factor
+     *          calibration error
+     *          offset
+     *          offset error
+     *  @param NT <b>OUT</b>: int[1],  number type of uncalibrated data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return argv[0] = cal, argv[1] = cal_err,
+     *  argv[2] = offset, argv[3] = offset_err,
+     *  NT[0] = data_type
+     */
+    public static native boolean SDgetcal(long sdsid, double[] argv, int[] NT) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param strings <b>OUT</b>: String[4], data information strings:
+     *            label
+     *            unit
+     *            print format
+     *            coordinate system
+     *  @param len <b>IN</b>: int,  max len of string (not needed by
+     *  Java -- the HDFLibrary interface will handle this)
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return strings[0] = label, strings[1] = unit,
+     *  strings[2] = format, strings[3] = coordsys,
+     */
+    public static native boolean SDgetdatastrs(long sdsid, String[] strings, int len) throws HDFException;
+
+    /**
+     *  @param dimid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param args <b>OUT</b>: String[3], data information strings:
+     *            label
+     *            unit
+     *            print format
+     *  @param len <b>IN</b>: int,  max len of string (not needed by
+     *  Java -- the HDFLibrary interface will handle this)
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return strings[0] = label, strings[1] = unit, strings[2] = format
+     */
+    public static native boolean SDgetdimstrs(long dimid, String[] args, int len) throws HDFException;
+
+    /**
+     *  @param dimid <b>IN</b>: id of a dimension as returned by SDgetdimid
+     *  @param data <b>OUT</b>: byte[], data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the form of a continous array of bytes.
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     */
+    public static native boolean SDgetdimscale(long dimid, byte[] data) throws HDFException;
+
+    /**
+     *  @param dimid <b>IN</b>: id of a dimension as returned by SDgetdimid
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the Java array.
+     *
+     *  <p><b>Note:</b> reads the data as bytes and converts to
+     *  the Java array.
+     */
+    public static boolean SDgetdimscale(long dimid, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = SDgetdimscale(dimid, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    /**
+     *  @param sdsid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param fillValue <b>OUT</b>: byte[], data
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the fill value in the form of a continous array of bytes.
+     *
+     *  <p><b>NOTE:</b> to read into a Java variable use the alternative
+     *  routine below.
+     */
+    public static native boolean SDgetfillvalue(long sdsid, byte[] fillValue) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param theFillValue <b>OUT</b>: Object[1], one object of
+     *  appropriate type
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the Java array: theFillValue[0] = fillValue
+     *
+     *  <p><b>Note:</b> the routine calls SDgetinfo to determine the
+     *  correct type, reads the data as bytes, and converts to the
+     *  appropriate Java object.
+     */
+    public static boolean SDgetfillvalue(long sdsid, Object[] theFillValue) throws HDFException
+    {
+        int[] SDInfo = new int[3];
+        int NT;
+        String datasetname = new String(" ");
+        String ss[] = new String[1];
+        ss[0] = datasetname;
+        int dimsize[] = new int[16];
+        SDgetinfo(sdsid, ss, dimsize, SDInfo);
+        datasetname = ss[0];
+        byte[] d1 = new byte[8];
+        boolean rval;
+        rval = SDgetfillvalue(sdsid, d1);
+        if (rval == false) {
+            return(rval);
+        }
+        NT = SDInfo[1];
+        if ((NT & HDFConstants.DFNT_LITEND) != 0) {
+            NT -= HDFConstants.DFNT_LITEND;
+        }
+        if ((NT == HDFConstants.DFNT_INT8) || (NT == HDFConstants.DFNT_CHAR8) || (NT == HDFConstants.DFNT_CHAR)) {
+            theFillValue[0] = new Byte(d1[0]);
+        }
+        else if ((NT == HDFConstants.DFNT_UINT8) || (NT == HDFConstants.DFNT_UCHAR8) || (NT == HDFConstants.DFNT_UCHAR8)) {
+             Byte f = new Byte(d1[0]);
+             if (f.shortValue() < 0) {
+                theFillValue[0] = new Short((short)(f.intValue() + 256));
+             }
+             else {
+                 theFillValue[0] = new Short(f.shortValue());
+             }
+        }
+        else if ((NT == HDFConstants.DFNT_INT16) || (NT == HDFConstants.DFNT_CHAR16)) {
+            short [] fx = HDFNativeData.byteToShort(0,1,d1);
+            theFillValue[0] = new Short(fx[0]);
+        }
+        else if ((NT == HDFConstants.DFNT_UINT16) || (NT == HDFConstants.DFNT_UCHAR16)) {
+            short[] fmx = HDFNativeData.byteToShort(0,1,d1);
+            Short f = new Short(fmx[0]);
+            if (f.intValue() < 0) {
+                theFillValue[0] = new Integer(f.intValue() + 65536);
+            }
+            else {
+                theFillValue[0] = new Integer(f.intValue());
+            }
+        }
+        else if ((NT == HDFConstants.DFNT_INT32)) {
+            int [] fx = HDFNativeData.byteToInt(0,1,d1);
+            theFillValue[0] = new Integer(fx[0]);
+        }
+        else if ((NT == HDFConstants.DFNT_UINT32)) {
+            int[] fmx = HDFNativeData.byteToInt(0,1,d1);
+            Integer i = new Integer(fmx[0]);
+            if (i.floatValue() < 0) {
+                theFillValue[0] = new Float((float)(i.floatValue() + 4294967296.0));
+            }
+            else {
+                theFillValue[0] = new Float(i.floatValue());
+            }
+        }
+        else if (NT == HDFConstants.DFNT_FLOAT32) {
+            float [] fx = HDFNativeData.byteToFloat(0,1,d1);
+            theFillValue[0] = new Float(fx[0]);
+        }
+        else if (NT == HDFConstants.DFNT_FLOAT64) {
+            double [] fx = HDFNativeData.byteToDouble(0,1,d1);
+            theFillValue[0] = new Double(fx[0]);
+        }
+        else {
+            System.out.println("Error: SDgetfillvalue not converting, type "+NT);
+        }
+        return rval;
+    }
+
+    /**
+     *  @param sdsid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param max <b>OUT</b>: byte[], max value, as bytes
+     *  @param min <b>OUT</b>: byte[], min value, as bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the max and min values in the form of a continous array of
+     *  bytes.
+     *
+     *  <p><b>NOTE:</b> to read into Java doubles, use the alternative
+     *  routine below.
+     */
+    public static native boolean SDgetrange(long sdsid, byte[] max, byte[] min) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: id of the SDS as returned by SDselect
+     *  @param maxmin <b>OUT</b>: double[2], the max and min values
+     *  converted to doubles
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return the the data in the Java array: maxmin[0] = max,
+     *  maxmin[1] = min
+     *
+     *  <p><b>Note:</b> the routine calls SDgetinfo to determine the
+     *  correct type, reads the data as bytes, and converts to the
+     *  double.
+     */
+    public static boolean SDgetrange(long sdsid, double maxmin[]) throws HDFException
+    {
+        int[] SDInfo = new int[3];
+        int NT;
+        String datasetname = new String(" ");
+        String ss[] = new String[1];
+        ss[0] = datasetname;
+        int dimsize[] = new int[16];
+        SDgetinfo(sdsid, ss, dimsize, SDInfo);
+        datasetname = ss[0];
+        byte[] max = new byte[8];
+        byte[] min = new byte[8];
+        boolean rval;
+        rval = SDgetrange(sdsid, max, min);
+        if (rval == false) {
+            return (rval);
+        }
+        NT = SDInfo[1];
+        if ((NT & HDFConstants.DFNT_LITEND) != 0) {
+            NT -= HDFConstants.DFNT_LITEND;
+        }
+        if ((NT == HDFConstants.DFNT_INT8) || (NT == HDFConstants.DFNT_CHAR8) || (NT == HDFConstants.DFNT_CHAR)) {
+            Byte f = new Byte(max[0]);
+            maxmin[0] = (f.doubleValue());
+            f = new Byte(min[0]);
+            maxmin[1] = (f.doubleValue());
+        }
+        else if ((NT == HDFConstants.DFNT_UINT8) || (NT == HDFConstants.DFNT_UCHAR8) || (NT == HDFConstants.DFNT_UCHAR8)) {
+            Byte f = new Byte(max[0]);
+            Short fmx;
+            if (f.shortValue() < 0) {
+                fmx = new Short((short) (f.intValue() + 256));
+            }
+            else {
+                fmx = new Short(f.shortValue());
+            }
+            maxmin[0] = (fmx.doubleValue());
+            f = new Byte(min[0]);
+            fmx = new Short(f.shortValue());
+            maxmin[1] = (fmx.doubleValue());
+        }
+        else if ((NT == HDFConstants.DFNT_INT16) || (NT == HDFConstants.DFNT_CHAR16)) {
+            short[] fmx = HDFNativeData.byteToShort(0, 1, max);
+            short[] fmn = HDFNativeData.byteToShort(0, 1, min);
+            Short f = new Short(fmx[0]);
+            maxmin[0] = (f.doubleValue());
+            f = new Short(fmn[0]);
+            maxmin[1] = (f.doubleValue());
+        }
+        else if ((NT == HDFConstants.DFNT_UINT16) || (NT == HDFConstants.DFNT_UINT16)) {
+            short[] fmx = HDFNativeData.byteToShort(0, 1, max);
+            Short f = new Short(fmx[0]);
+            Integer i;
+            if (f.intValue() < 0) {
+                i = new Integer(f.intValue() + 65536);
+            }
+            else {
+                i = new Integer(f.intValue());
+            }
+            maxmin[0] = (i.doubleValue());
+            fmx = HDFNativeData.byteToShort(0, 1, min);
+            f = new Short(fmx[0]);
+            if (f.intValue() < 0) {
+                i = new Integer(f.intValue() + 65536);
+            }
+            else {
+                i = new Integer(f.intValue());
+            }
+            maxmin[1] = (i.doubleValue());
+        }
+        else if ((NT == HDFConstants.DFNT_INT32)) {
+            int[] fmx = HDFNativeData.byteToInt(0, 1, max);
+            int[] fmn = HDFNativeData.byteToInt(0, 1, min);
+            Integer f = new Integer(fmx[0]);
+            maxmin[0] = (f.doubleValue());
+            f = new Integer(fmn[0]);
+            maxmin[1] = (f.doubleValue());
+        }
+        else if ((NT == HDFConstants.DFNT_UINT32)) {
+            int[] fmx = HDFNativeData.byteToInt(0, 1, max);
+            Integer i = new Integer(fmx[0]);
+            Float f;
+            if (i.floatValue() < 0) {
+                f = new Float((float) (i.floatValue() + 4294967296.0));
+            }
+            else {
+                f = new Float(i.floatValue());
+            }
+            maxmin[0] = (f.doubleValue());
+            fmx = HDFNativeData.byteToInt(0, 1, max);
+            i = new Integer(fmx[0]);
+            if (i.floatValue() < 0) {
+                f = new Float((float) (i.floatValue() + 4294967296.0));
+            }
+            else {
+                f = new Float(i.floatValue());
+            }
+            maxmin[1] = (f.doubleValue());
+        }
+        else if (NT == HDFConstants.DFNT_FLOAT32) {
+            float[] fmx = HDFNativeData.byteToFloat(0, 1, max);
+            float[] fmn = HDFNativeData.byteToFloat(0, 1, min);
+            Float f = new Float(fmx[0]);
+            maxmin[0] = (f.doubleValue());
+            f = new Float(fmn[0]);
+            maxmin[1] = (f.doubleValue());
+        }
+        else if (NT == HDFConstants.DFNT_FLOAT64) {
+            double[] fmx = HDFNativeData.byteToDouble(0, 1, max);
+            double[] fmn = HDFNativeData.byteToDouble(0, 1, min);
+            Double f = new Double(fmx[0]);
+            maxmin[0] = (f.doubleValue());
+            f = new Double(fmn[0]);
+            maxmin[1] = (f.doubleValue());
+
+        }
+        else {
+            System.out.println("Error: SDgetrange not converting, type " + NT);
+        }
+        return rval;
+    }
+
+    public static native long SDcreate(long sd_id, String name, long number_type, int rank, int[] dimsizes) throws HDFException;
+
+    public static native boolean SDisrecord(long sdsid) throws HDFException;
+
+    public static native boolean SDsetattr(long s_id, String attr_name, long num_type, int count,
+            byte[] values) throws HDFException;
+
+    public static boolean SDsetattr(long s_id, String attr_name, long num_type, int count, Object theValues) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theValues);
+        data = theArray.byteify();
+        return SDsetattr(s_id, attr_name, num_type, count, data);
+    }
+
+   public static native boolean SDsetcal(long sds_id, double cal, double cal_err,
+        double offset, double offset_err, int number_type) throws HDFException;
+
+   public static native boolean SDsetdatastrs(long sds_id, String label, String unit, String format,
+        String coordsys) throws HDFException;
+
+   public static native boolean SDsetdimname(long dim_id, String dim_name) throws HDFException;
+
+    /**
+     *  @param dim_id <b>IN</b>: id of a dimension
+     *  @param count <b>IN</b>: number of values
+     *  @param number_type <b>IN</b>: number type of the values
+     *  @param data <b>IN</b>: byte[], the values, in an array of
+     *  bytes.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> the calling program must assure that the
+     *  data is correctly formatted for C.  To write an array
+     *  of Java objects, use the alternative routine below.
+     *
+     *  @return true on success
+     */
+   public static native boolean SDsetdimscale(long dim_id, int count, int number_type, byte[] data) throws HDFException;
+
+    /**
+     *  @param dim_id <b>IN</b>: id of a dimension
+     *  @param count <b>IN</b>: number of values
+     *  @param number_type <b>IN</b>: number type of the values
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts the Java array to an array of
+     *  bytes, and writes the bytes.
+     *
+     *  @return true on success
+     */
+   public static boolean SDsetdimscale(long dim_id, int count, int number_type, Object theData) throws HDFException
+   {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return SDsetdimscale(dim_id, count, number_type, data);
+   }
+
+   public static native boolean SDsetdimstrs(long dim_id, String label, String unit, String format) throws HDFException;
+
+   public static native boolean SDsetexternalfile(long sds_id, String filename, int offset) throws HDFException;
+
+    /**
+     *  @param sds_id <b>IN</b>: id of a dataset
+     *  @param fill_val <b>IN</b>: byte[], the fill values in an array of
+     *  bytes.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> the calling program must assure that the
+     *  data is correctly formatted for C.  To set the fill value
+     *  with a Java object, use the alternative routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDsetfillvalue(long sds_id, byte[] fill_val)  throws HDFException;
+
+    /**
+     *  @param sds_id <b>IN</b>: id of a dataset
+     *  @param the_fill_val <b>IN</b>: Object, a Java object of appropriate
+     *  type
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts the Java array to an array of
+     *  bytes, and writes the bytes.
+     *
+     *  @return true on success
+     */
+    public static boolean SDsetfillvalue(long sds_id, Object the_fill_val) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(the_fill_val);
+        data = theArray.byteify();
+        return SDsetfillvalue(sds_id, data);
+    }
+
+    /**
+     *  @param sdsid <b>IN</b>: id of a dataset
+     *  @param max <b>IN</b>: byte[], the max value in an array of bytes
+     *  @param min <b>IN</b>: byte[], the min value in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> the calling program must assure that the
+     *  data is correctly formatted for C.  To set the max and min value
+     *  with Java objects, use the alternative routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDsetrange(long sdsid, byte[] max, byte[] min) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: id of a dataset
+     *  @param max <b>IN</b>: Object, a Java object of appropriate type
+     *  @param min <b>IN</b>: Object, a Java object of appropriate type
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts the Java array to an array of
+     *  bytes, and writes the bytes.
+     *
+     *  @return true on success
+     */
+    public static boolean SDsetrange(long sdsid, Object max, Object min) throws HDFException
+    {
+        byte[] d1;
+        byte[] d2;
+        HDFArray theArray1 = new HDFArray(max);
+        d1 = theArray1.byteify();
+        HDFArray theArray2 = new HDFArray(min);
+        d2 = theArray2.byteify();
+        return  SDgetrange(sdsid, d1, d2);
+    }
+
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param start <b>IN</b>: int[], start
+     *  @param stride <b>IN</b>: int[], stride
+     *  @param count <b>IN</b>: int[], count
+     *  @param data <b>IN</b>: byte[], data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDwritedata(long sdsid, int[] start, int[] stride,
+                       int[] count, byte[] data) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param start <b>IN</b>: int[], start
+     *  @param stride <b>IN</b>: int[], stride
+     *  @param count <b>IN</b>: int[], count
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts to the Java array to a contiguous
+     *  array of bytes and then writes to the file.
+     *
+     *  @return true on success
+     */
+    public static boolean SDwritedata(long sdsid, int[] start, int[] stride,
+                       int[] count, Object theData ) throws HDFException
+    {
+        byte[] data;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return SDwritedata(sdsid, start, stride, count, data);
+    }
+
+    public static native boolean SDsetnbitdataset(long id, int start_bit, int bit_len,
+            int sign_ext, int fill_one) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the SD identifier returned by SDselect
+     *  @param type <b>IN</b>: the type of compression
+     *  @param cinfo <b>IN</b>: HDFCompInfo, the compression info
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>The compression algorithm specific information is
+     *  passed in an appropriate sub-class of HDFCompInfo.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDsetcompress(long id, int type, HDFCompInfo cinfo) throws HDFException;
+
+    /**
+     *  @deprecated As of HDF 4.2.9, replaced by {@link #SDgetcompinfo(long, HDFCompInfo)}
+     *  @param id <b>IN</b>: the SD identifier returned by SDselect
+     *  @param cinfo <b>IN</b>: HDFCompInfo, the compression info
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>The compression algorithm specific information is
+     *  passed in an appropriate sub-class of HDFCompInfo.
+     *
+     *  @return true on success
+     */
+
+    public static native boolean SDgetcompinfo(long id, HDFCompInfo cinfo) throws HDFException;
+
+    public static native boolean SDsetaccesstype(long id, int accesstype) throws HDFException;
+
+    public static native boolean SDsetblocksize(long sdsid, int block_size) throws HDFException;
+
+    /**
+     *  @param sdsid  <b>IN</b>: the SD id
+     *  @param fill_enable  <b>IN</b>:  boolean, true calls library with
+     *  SD_FILL, false calls library with SD_NOFILL
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return true on success
+     */
+    public static boolean SDsetfillmode(long sdsid, boolean fill_enable) throws HDFException
+    {
+        int fm;
+
+        if (fill_enable) {
+            fm = HDFConstants.SD_FILL;
+        }
+        else {
+            fm = HDFConstants.SD_NOFILL;
+        }
+        return SDsetfillmode(sdsid, fm);
+    }
+
+    public static native boolean SDsetfillmode(long sdsid, int fillmode) throws HDFException;
+
+    public static native boolean SDsetdimval_comp(long dimid, int comp_mode) throws HDFException;
+
+    public static native boolean SDisdimval_bwcomp(long dimid)  throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD identifier returned by SDselect
+     *  @param chunk_def <b>IN</b>: HDFChunkInfo, the chunking info
+     *  @param flags <b>IN</b>: the type of chunking
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b>The chunking algorithm-specific information is
+     *  passed in an appropriate sub-class of HDFChunkInfo.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDsetchunk(long sdsid, HDFChunkInfo chunk_def, int flags) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD identifier returned by SDselect
+     *  @param chunk_def <b>OUT</b>: HDFChunkInfo, the chunking info
+     *  @param clflags <b>OUT</b>: int[1], the type of chunking
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  @return c_info contains information about the chunking method,
+     *  clflags[0] == the chunking flags
+     *
+     *  <p><b>NOTE:</b>The chunking algorithm-specific information is
+     *  passed in an appropriate sub-class of HDFChunkInfo.
+     */
+    public static native boolean SDgetchunkinfo(long sdsid, HDFChunkInfo chunk_def,
+            int[] clflags) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param origin <b>IN</b>: int[], origin
+     *  @param theData <b>OUT</b>: byte[], the data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDreadchunk(long sdsid, int[] origin, byte[] theData) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param origin <b>IN</b>: int[], origin
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return true on success
+     */
+    public static boolean SDreadchunk(long sdsid, int[] origin, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = SDreadchunk(sdsid, origin,  data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    public static native int SDsetchunkcache(long sdsid, int maxcache, int flags) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param origin <b>IN</b>: int[], origin
+     *  @param data <b>IN</b>: byte[], data to be written, in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean SDwritechunk(long sdsid, int[] origin, byte[] data) throws HDFException;
+
+    /**
+     *  @param sdsid <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param origin <b>IN</b>: int[], origin
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts to the Java array to a contiguous
+     *  array of bytes and then writes to the file.
+     *
+     *  @return true on success
+     */
+    public static boolean SDwritechunk(long sdsid, int[] origin, Object theData) throws HDFException
+    {
+        byte[] data;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return SDwritechunk(sdsid, origin, data);
+    }
+
+    public static native int VFfieldesize(long vdata_id,  int field_index) throws HDFException;
+
+    public static native int VFfieldisize(long vdata_id,  int field_index) throws HDFException;
+
+    public static native String VFfieldname(long vdata_id,  int field_index) throws HDFException;
+
+    public static native int VFfieldorder(long vdata_id,  int field_index) throws HDFException;
+
+    public static native long VFfieldtype(long vdata_id,  int field_index) throws HDFException;
+
+    public static native int VFnfields(long vkey) throws HDFException;
+
+    public static native int VHmakegroup(long file_id, int[] tag_array,
+            int[] ref_array, int n_objects, String vgroup_name,
+            String vgroup_class) throws HDFException;
+
+    /**
+     *  @param file_id <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param fieldname <b>IN</b>: String, the name of the field to be filled
+     *  @param buf <b>IN</b>: byte[], data to be written, in an array of bytes
+     *  @param n_records <b>IN</b>: int, the number of records being written
+     *  @param data_type <b>IN</b>: int, the number type of the data
+     *  @param vdata_name <b>IN</b>: String, the name of the Vdata
+     *  @param vdata_class <b>IN</b>: String, the class of the Vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return negative on failure
+     */
+    public static native int VHstoredata(long file_id, String fieldname,
+            byte[] buf, int n_records, int data_type, String vdata_name,
+            String vdata_class) throws HDFException;
+    /**
+     *  @param file_id <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param fieldname <b>IN</b>: String, the name of the field to be filled
+     *  @param thebuf <b>IN</b>: Object, data to be written, in a Java array
+     *  of appropriate type and size
+     *  @param n_records <b>IN</b>: int, the number of records being written
+     *  @param data_type <b>IN</b>: int, the number type of the data
+     *  @param vdata_name <b>IN</b>: String, the name of the Vdata
+     *  @param vdata_class <b>IN</b>: String, the class of the Vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts to the Java array to a contiguous
+     *  array of bytes and then writes to the file.
+     *
+     *  @return negative on failure
+    */
+    public static int VHstoredata(long file_id, String fieldname,
+            Object thebuf, int n_records, int data_type, String vdata_name,
+            String vdata_class) throws HDFException
+    {
+        byte[] data;
+
+        HDFArray theArray = new HDFArray(thebuf);
+        data = theArray.byteify();
+        return VHstoredata(file_id, fieldname, data, n_records, data_type, vdata_name, vdata_class);
+    }
+
+    /**
+     *  @param file_id <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param fieldname <b>IN</b>: String, the name of the field to be filled
+     *  @param buf <b>IN</b>: byte[], data to be written, in an array of bytes
+     *  @param n_records <b>IN</b>: int, the number of records being written
+     *  @param data_type <b>IN</b>: int, the number type of the data
+     *  @param vdata_name <b>IN</b>: String, the name of the Vdata
+     *  @param vdata_class <b>IN</b>: String, the class of the Vdata
+     *  @param order <b>IN</b>: int, the number of components per field
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return negative on failure
+     */
+    public static native int VHstoredatam(long file_id, String fieldname, byte[] buf,
+            int n_records, int data_type, String vdata_name, String vdata_class,
+            int order) throws HDFException;
+
+    /**
+     *  @param file_id <b>IN</b>: the SD interface id, returned by SDselect
+     *  @param fieldname <b>IN</b>: String, the name of the field to be filled
+     *  @param buf <b>IN</b>: Object, data to be written, in a Java array
+     *  of appropriate type, dimension, and size
+     *  @param n_records <b>IN</b>: int, the number of records being written
+     *  @param data_type <b>IN</b>: int, the number type of the data
+     *  @param vdata_name <b>IN</b>: String, the name of the Vdata
+     *  @param vdata_class <b>IN</b>: String, the class of the Vdata
+     *  @param order <b>IN</b>: int, the number of components per field
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors.
+     *
+     *  <p><b>Note:</b> converts to the Java array to a contiguous
+     *  array of bytes and then writes to the file.
+     *
+     *  @return negative on failure
+     */
+    public static int VHstoredatam(long file_id, String fieldname, Object buf,
+            int n_records, int data_type, String vdata_name,
+            String vdata_class, int order) throws HDFException
+    {
+        byte[] data;
+
+        HDFArray theArray = new HDFArray(buf);
+        data = theArray.byteify();
+        return VHstoredatam(file_id, fieldname, data, n_records, data_type, vdata_name, vdata_class, order);
+    }
+
+    public static native int VQueryref(long vkey) throws HDFException;
+    public static native int VQuerytag(long vkey) throws HDFException;
+
+    public static native boolean Vstart(long fid)  throws HDFException;
+
+    public static native int Vattach(long fid, int vgroup_ref, String access) throws HDFException;
+
+    public static native void Vdetach(long vgroup_id) throws HDFException;
+
+    public static native void Vend(long file_id) throws HDFException;
+
+    public static native int Vgetid(long file_id, int vgroup_ref) throws HDFException;
+
+    /**
+     *  @param vgroup_id <b>IN</b>: the Vgroup id
+     *  @param hdfclassname <b>OUT</b>: String[1], the HDF class of
+     *  the vgroup.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     */
+    public static native void Vgetclass(long vgroup_id, String[] hdfclassname) throws HDFException;
+
+    /**
+     *  @param vgroup_id <b>IN</b>: the Vgroup id
+     *  @param hdfname <b>OUT</b>: String[1], the name of
+     *  the vgroup.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     */
+    public static native void Vgetname(long vgroup_id, String[] hdfname) throws HDFException;
+
+    public static native boolean Visvg(long vgroup_id, int vgroup_ref) throws HDFException;
+
+    public static native boolean Visvs(long vgroup_id, int vdata_ref) throws HDFException;
+
+    /**
+     *  @param vgroup_id <b>IN</b>: the Vgroup id
+     *  @param tags <b>OUT</b>: int[arraysize], the tags
+     *  @param refs <b>OUT</b>: int[arraysize], the refs
+     *  @param arraysize <b>IN</b>: int, the number of tags/refs to
+     *  return
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  tags[] = tags for objects 0 - n, refs[] = refs for
+     *  objects 0 - n
+     */
+    public static native int Vgettagrefs(long vgroup_id, int[] tags, int[] refs,
+            int arraysize) throws HDFException;
+
+    /**
+     *  @param vgroup_id - IN: the Vgroup id
+     *  @param index - IN: the index of the object
+     *  @param tagref - OUT: tagref[0]=tag, tagref[1]=ref
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  tags[0] = tag for object #index, refs[0] = ref for
+     *  objects #index
+     */
+    public static native boolean Vgettagref(long vgroup_id, int index, int[] tagref) throws HDFException;
+
+    public static native int Vntagrefs(long vgroup_id) throws HDFException;
+
+    public static native boolean Vinqtagref(long vgroup_id, int tag, int ref) throws HDFException;
+
+    /**
+     *  @param fid <b>IN</b>: the file identifier returned by Hopen
+     *  @param ref_array <b>OUT</b>: int[], the refs for Vdata not part
+     *  of Vgroups
+     *  @param buffersize <b>IN</b>: the max size of the ref_array
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  ref_array[] = refs 0 - ...
+     */
+    public static native int Vlone(long fid, int[] ref_array, int buffersize) throws HDFException;
+
+    public static native int Vaddtagref(long vgroup_id, int tag, int ref) throws HDFException;
+
+    public static native int Vdeletetagref(long vgroup_id, int tag, int ref) throws HDFException;
+
+    public static native int Vfind(long file_id, String vgroup_name) throws HDFException;
+
+    public static native int Vfindclass(long file_id, String vgclassname) throws HDFException;
+
+    public static native int Vflocate(int key, String vgclassname) throws HDFException;
+
+    public static native int Vgetnext(int key, int ref) throws HDFException;
+
+    /**
+     *  @param vgroup_id <b>IN</b>: the Vgroup id
+     *  @param n_entries <b>OUT</b>: int[1], the number of objects in the Vgroup
+     *  @param vgroup_name <b>OUT</b>: String[1], the name of the Vgroup
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return n_entries[0] = number of entries, vgroup_name[0] = the name
+     */
+    public static native boolean Vinquire(long vgroup_id, int[] n_entries, String[] vgroup_name) throws HDFException;
+
+    public static native int Vinsert(long vgroup_id, long v_id) throws HDFException;
+
+    public static native int Vnrefs(int key, int ref) throws HDFException;
+
+    public static native boolean Vsetclass(long vgroup_id, String vgclassname) throws HDFException;
+
+    public static native boolean Vsetname(long vgroup_id, String vgname) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: Vgroup identifier returned by Vattach
+     *  @param index <b>IN</b>: the index of the attribute
+     *  @param name <b>OUT</b>: String[1], the name of the attribute
+     *  @param argv <b>OUT</b>: int[5],
+     *         Data type of the target attribute,
+     *         Number of values in the target attribute,
+     *         Size, in bytes, of the values of the target attribute,
+     *         ,
+     *
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call, but is not yet implemented.
+     *
+     *
+     *  @return name[0] = name, argv[0] = data_type, argv[1] = count,
+     *  argv[2] = size, argv[3] = nfields, argv[4] = refnum
+     */
+    public static native boolean Vattrinfo(long id, int index, String[] name, int[] argv) throws HDFException;
+
+
+    public static native long Vfindattr(long id,  String name) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the attribute
+     *  @param data <b>OUT</b>: byte[], the data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return data = the value of the attribute, in an array of bytes
+     */
+    public static native boolean Vgetattr(long id, int index, byte[] data) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the attribute
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return data = the value of the attribute, in an array of Java
+     *  objects
+     */
+    public static boolean  Vgetattr(long id, int index, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = Vgetattr(id, index, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+
+    public static native int Vgetversion(long id) throws HDFException;
+
+    public static native int Vnattrs(long id) throws HDFException;
+
+    public static native boolean Vsetattr(long id, String attr_name,
+            long data_type, int count, String values) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param attr_name <b>IN</b>: String, the name of the attribute
+     *  @param data_type <b>IN</b>: int, the number_type of the attribute
+     *  @param count <b>IN</b>: the number of values
+     *  @param data <b>IN</b>: byte[], the data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean Vsetattr(long id, String attr_name,
+            long data_type, int count, byte[] data) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param attr_name <b>IN</b>: String, the name of the attribute
+     *  @param data_type <b>IN</b>: int, the number_type of the attribute
+     *  @param count <b>IN</b>: the number of values
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> converts the data to a contiguous
+     *  array of bytes and then converts writes it.
+     *
+     *  @return true on success
+     */
+   public static boolean Vsetattr(long id, String attr_name,
+        long data_type, int count, Object theData) throws HDFException
+   {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return Vsetattr(id, attr_name, data_type, count, data);
+   }
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param n_records <b>OUT</b>, int[1], the number of records in the vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  n_records[0] == the number of records
+     */
+    public static native boolean VSQuerycount(long vdata_id, int[] n_records) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param fields <b>OUT</b>, String[1], the names of the fields
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  fields[0] == a comma delimited string with the names
+     *  of the fields.
+     */
+    public static native boolean VSQueryfields(long vdata_id, String[] fields) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param interlace <b>OUT</b>, int[1], the interlace mode,
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  interlace[0] == the number of records,
+     *  HDFConstants.FULL_INTERLACE or HDFConstants.NO_INTERLACE
+     */
+    public static native boolean VSQueryinterlace(long vdata_id, int[] interlace) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param vdata_name <b>OUT</b>, String[1], the name of the vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  vdata_name[0] == the name
+     */
+    public static native boolean VSQueryname(long vdata_id, String[] vdata_name) throws HDFException;
+
+    public static native int VSQueryref(long vdata_id) throws HDFException;
+
+    public static native int VSQuerytag(long vdata_id) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param vdata_size <b>OUT</b>, int[1], the size of the vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  vdata_size[0] == Native size, in bytes, of a record in the vdata
+     */
+    public static native boolean VSQueryvsize(long vdata_id, int[] vdata_size) throws HDFException;
+
+    public static  native int VSattach(long fid, int vdata_ref, String access) throws HDFException;
+
+    public static  native void VSdetach(long vdata_id) throws HDFException;
+
+    public  static native  long VSgetid(long file_id, int vdata_ref) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param hdfclassname <b>OUT</b>, String[1], the class name of the vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     */
+    public  static native  void VSgetclass(long vdata_id, String[] hdfclassname) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param hdfname <b>OUT</b>, String[1], the name of the vdata
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     */
+    public  static native  void VSgetname(long vdata_id, String[] hdfname) throws HDFException;
+
+    public static native int VSelts(long vdata_id) throws HDFException;
+
+    public static native boolean VSfdefine(long vdata_id, String fieldname,
+                    int numbertype, int order) throws HDFException;
+
+    public static native boolean VSfexist(long vdata_id, String fields) throws HDFException;
+
+    public static native int VSfind(long file_id, String vdataname) throws HDFException;
+
+    public static native int VSsetblocksize(long vdata_id, int blocksize) throws HDFException;
+
+    public static native int VSsetnumblocks(long vdata_id, int numblocks) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param fieldname <b>OUT</b>, String[1], the names of the fields
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return  fieldname[0] == a comma delimited string with the names
+     *  of the fields.
+     */
+    public static native int VSgetfields(long vdata_id, String[] fieldname) throws HDFException;
+
+    public static native int VSgetinterlace(long vdata_id) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param iargs <b>OUT</b>, int[3], n_records, interlace, vdata_size
+     *  @param sargs <b>OUT</b>, String[2], names the dataset, fields
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return iargs[0] = n_records, iargs[1] = interlace, iargs[2] = vdata_size,
+     *  sargs[0] = vdata_name, sargs[1] = comma delimited list of fields
+     *
+     *  <p><b>NOTE:</b> the parameters for the Java interface are not in
+     *  the same order as the C interface.
+     */
+    public static native boolean VSinquire(long vdata_id, int[] iargs, String[] sargs) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>, vdata id  as returned by VSattach
+     *  @param iargs <b>OUT</b>, int[2], block_size, num_blocks
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return iargs[0] = blocksize, iargs[1] = num_blocks
+     *
+     *  <p><b>NOTE:</b> the parameters for the Java interface are not in
+     *  the same order as the C interface.
+     */
+    public static native boolean VSinquire(long vdata_id, int[] iargs ) throws HDFException;
+
+    /**
+     *  @param fid <b>IN</b>, File identifier returned by Hopen
+     *  @param ref_array <b>OUT</b>, int[?], the refs
+     *  @param buffersize <b>IN</b>, int, the max number of refs to
+     *  return.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return ref_array contains refs.  The Java API ignores the buffersize
+     *  argument, returns as many as possible.
+     */
+    public  static native  int VSlone(long fid, int[] ref_array, int buffersize) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>: the Vdata id
+     *  @param databuf <b>OUT</b>: byte[], the data in an array of bytes
+     *  @param nrecord <b>IN</b>: int, number of records
+     *  @param interlace <b>IN</b>: int, interlace
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return the number of elements read (0 or a +ve integer)
+     */
+    public  static native int VSread(long vdata_id, byte[] databuf, int nrecord, int interlace) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>: the Vdata id
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *  @param nrecord <b>IN</b>: int, number of records
+     *  @param interlace <b>IN</b>: int, interlace
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return the number of elements read (0 or a +ve integer)
+     */
+    public  static int VSread(long vdata_id, Object theData, int nrecord, int interlace) throws HDFException
+    {
+        byte[] data;
+        int rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+                rval = VSread(vdata_id, data, nrecord, interlace);
+        theData = theArray.arrayify( data );
+        return rval;
+    }
+
+    public static native int VSseek(long vdata_id, int record) throws HDFException;
+
+    public static native boolean VSsetfields(long vdata_id, String fields) throws HDFException;
+
+    public static native boolean  VSsetinterlace(long vdata_id, int interlace) throws HDFException;
+
+    public static native int VSsizeof(long vdata_id, String fields) throws HDFException;
+
+    public static native boolean VSappendable(int vkey, int block_size) throws HDFException;
+
+    public static native int VSfindclass(long file_id, String vgclass) throws HDFException;
+
+    public static native int VSgetversion(int vkey) throws HDFException;
+
+    public static native void VSsetclass(long vdata_id, String vdata_class) throws HDFException;
+
+    public static native boolean VSsetexternalfile(int vkey, String filename, int offset) throws HDFException;
+
+    public static native void VSsetname(long vdata_id, String vdata_name) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>: the Vdata id
+     *  @param databuf <b>IN</b>: byte[], the data in an array of bytes
+     *  @param n_records <b>IN</b>: int, number of records
+     *  @param interlace <b>IN</b>: int, interlace
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write a Java array use the alternative
+     *  routine below.
+     *
+     *  @return the number of elements written (0 or a +ve integer)
+     */
+    public static native int VSwrite(long vdata_id, byte [] databuf, int n_records, int interlace) throws HDFException;
+
+    /**
+     *  @param vdata_id <b>IN</b>: the Vdata id
+     *  @param databuf <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *  @param n_records <b>IN</b>: int, number of records
+     *  @param interlace <b>IN</b>: int, interlace
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Important Note:</b> This interface only supports
+     *  records which are all of the same numeric type, with
+     *  no character fields.  Heterogeneous fields can be
+     *  written as bytes (see above), but the calling program
+     *  must make sure the data is in proper order to
+     *  write to the HDF library.
+     *
+     *  <p><b>Note:</b> converts the data into a contiguous
+     *  array of bytes and then writes it
+     *
+     *  @return the number of elements written (0 or a +ve integer)
+     */
+    public static int VSwrite(long vdata_id, Object databuf, int n_records, int interlace) throws HDFException
+    {
+        byte[] data;
+
+        HDFArray theArray = new HDFArray(databuf);
+        data = theArray.byteify();
+            return VSwrite( vdata_id, data, n_records, interlace);
+    }
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: int, the index of the attribute
+     *  @param attr_index <b>IN</b>: int, the index of the attribute
+     *  @param name <b>OUT</b>: String[1], the name of the attribute
+     *  @param argv <b>OUT</b>: int[3],
+     *         Data type of the target attribute,
+     *         Number of values in the target attribute,
+     *         Size, in bytes, of the values of the target attribute,
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return name[0] = name, argv[0] = data_type, argv[1] = count,
+     *  argv[2] = size
+     */
+    public static native boolean VSattrinfo(long id, int index, int attr_index, String[] name, int[] argv) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param name <b>IN</b>: the name of the attribute
+     *  @param findex <b>IN</b>: int[1], the index of the attribute
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return findex[0] = the index
+     */
+    public static native int VSfindex(long id, String name, int[] findex) throws HDFException;
+
+    public static native int VSfindattr(long id, int index, String name) throws HDFException;
+
+    public static native int VSfnattrs(long id, int fnattrs) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the vdata
+     *  @param attr_index <b>IN</b>: the index of the attribute
+     *  @param data <b>OUT</b>: byte[], the data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return data = the value of the attribute, in an array of bytes
+     */
+    public static native boolean VSgetattr(long id, int index, int attr_index, byte[] data) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the vdata
+     *  @param attr_index <b>IN</b>: the index of the attribute
+     *  @param theData <b>OUT</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return data = the value of the attribute, in an array of Java
+     *  objects
+     */
+    public static boolean VSgetattr(long id, int index, int attr_index, Object theData) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.emptyBytes();
+        rval = VSgetattr(id, index, attr_index, data);
+        theData = theArray.arrayify(data);
+        return rval;
+    }
+    public static native boolean VSisattr(long id) throws HDFException;
+
+    public static native int VSnattrs(long id) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the vdata
+     *  @param attr_name <b>IN</b>: String, the name of the attribute
+     *  @param data_type <b>IN</b>: int, the number_type of the attribute
+     *  @param count <b>IN</b>: the number of values
+     *  @param values <b>IN</b>: String, the data in an String
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean VSsetattr(long id, int index, String attr_name,
+            long data_type, int count, String values) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the vdata
+     *  @param attr_name <b>IN</b>: String, the name of the attribute
+     *  @param data_type <b>IN</b>: int, the number_type of the attribute
+     *  @param count <b>IN</b>: the number of values
+     *  @param values <b>IN</b>: byte[], the data in an array of bytes
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+    public static native boolean VSsetattr(long id, int index, String attr_name,
+            long data_type, int count, byte[] values) throws HDFException;
+
+    /**
+     *  @param id <b>IN</b>: the Vdata id
+     *  @param index <b>IN</b>: the index of the vdata
+     *  @param attr_name <b>IN</b>: String, the name of the attribute
+     *  @param data_type <b>IN</b>: int, the number_type of the attribute
+     *  @param count <b>IN</b>: the number of values
+     *  @param theData <b>IN</b>: Object, a Java array of appropriate
+     *  type, dimensions, and size.
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> converts the data to a contiguous
+     *  array of bytes and then converts writes it.
+     *
+     *  @return true on success
+     */
+    public static boolean VSsetattr(long id, int index, String attr_name,
+            long data_type, int count, Object theData) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theData);
+        data = theArray.byteify();
+        return VSsetattr(id, index, attr_name, data_type, count, data);
+    }
+
+    /**
+     *  @param fileName <b>IN</b>: String, the file
+     *  @param argv <b>OUT</b>: int[3], the width, height, and interlace mode
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return argv[0] = width, argv[1] = height, argv[2] = interlace
+     */
+    public static native boolean DF24getdims(String fileName, int[] argv) throws HDFException;
+
+    public static native boolean DF24reqil(int il) throws HDFException;
+
+    /**
+     *  @param fileName <b>IN</b>: String, the file
+     *  @param imagedata <b>OUT</b>: byte[], the image, in an array of
+     *  bytes
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return data = the image in an array of bytes
+     */
+    public static native boolean DF24getimage(String fileName, byte[] imagedata,
+            int width, int height) throws HDFException;
+
+    /**
+     *  @param fileName <b>IN</b>: String, the file
+     *  @param theImagedata <b>OUT</b>: Object, the image, in a java
+     *  array of appropriate size and type
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return data = the value of the attribute, in an array of Java
+     *  objects
+     */
+     public static boolean DF24getimage(String fileName, Object theImagedata, int width, int height) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theImagedata);
+        data = theArray.emptyBytes();
+        rval = DF24getimage(fileName, data, width, height);
+        theImagedata = theArray.arrayify(data);
+        return rval;
+    }
+
+     public static native short DF24lastref() throws HDFException;
+
+     public static native boolean DF24restart() throws HDFException;
+
+     public static native boolean DF24readref(String filename, int ref) throws HDFException;
+
+     public static native int DF24nimages(String fileName) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param image <b>IN</b>: byte[], the image, in an array of
+     *  bytes
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+     public static native boolean DF24addimage(String filename, byte[] image,
+            int width, int height) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param theImage <b>IN</b>: Object, the image, in a java
+     *  array of appropriate size and type
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> converts the data into a contiguous
+     *  array of bytes and then writes it to the file
+     *
+     *  @return true on success
+     */
+     public static boolean DF24addimage(String filename, Object theImage, int width,
+            int height) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theImage);
+        data = theArray.byteify();
+        return DF24addimage(filename, data, width, height);
+    }
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param image <b>IN</b>: byte[], the image, in an array of
+     *  bytes
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+     public static native boolean DF24putimage(String filename, byte[] image,
+            int width, int height) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param theImage <b>IN</b>: Object, the image, in a java
+     *  array of appropriate size and type
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> converts the data into a contiguous
+     *  array of bytes and then writes it to the file
+     *
+     *  @return true on success
+     */
+     public static boolean DF24putimage(String filename, Object theImage, int width, int height) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theImage);
+        data = theArray.byteify();
+        return DF24putimage(filename, data, width, height);
+    }
+
+    /**
+     *  @param type <b>IN</b>: int, the type of compression
+     *  @param cinfo <b>IN</b>: HDFCompInfo, the compression parameters
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *  @return true on success
+     */
+     public static native boolean DF24setcompress(int type, HDFCompInfo cinfo) throws HDFException;
+
+     public static native boolean DF24setdims(int width, int height) throws HDFException;
+
+     public static native boolean DF24setil(int il) throws HDFException;
+
+    /**
+     *  @param fileName <b>IN</b>: String, the file
+     *  @param argv <b>OUT</b>: int[2], the width and height
+     *  @param haspalette <b>OUT</b>: boolean[1], has a palette
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  @return argv[0] = width, argv[1] = height, haspalette[0] = palette
+     */
+     public static native boolean DFR8getdims(String fileName, int[] argv, boolean[] haspalette) throws HDFException;
+
+    /**
+     *  @param fileName <b>IN</b>: String, the file
+     *  @param imagedata <b>OUT</b>: byte[], the image, in an array of
+     *  bytes
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *  @param palette <b>OUT</b>: byte[], the color look up table
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to read into a Java array use the alternative
+     *  routine below.
+     *
+     *  @return data = imagedata: the image in an array of bytes,
+     *  palette:  the look up table, in an array of bytes
+     */
+    public static native boolean DFR8getimage(String fileName, byte[] imagedata,
+                int width, int height, byte[] palette) throws HDFException;
+
+    /**
+     *  @param fileName <b>IN</b>: String, the file
+     *  @param theImagedata <b>OUT</b>: Object, the image, in a java
+     *  array of appropriate size and type
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *  @param palette <b>OUT</b>: byte[], the color look up table
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> reads the data as a contiguous
+     *  array of bytes and then converts it to an appropriate Java object.
+     *
+     *  @return data = theImagedata: the value of the attribute,
+     *  in an array of Java objects
+     *  palette:  the look up table, in an array of bytes
+     */
+     public static boolean DFR8getimage(String fileName, Object theImagedata,int width,
+            int height, byte[] palette) throws HDFException
+    {
+        byte[] data;
+        boolean rval;
+
+        HDFArray theArray = new HDFArray(theImagedata);
+        data = theArray.emptyBytes();
+        rval = DFR8getimage(fileName, data, width, height, palette);
+        theImagedata = theArray.arrayify(data);
+        return rval;
+    }
+
+     public static native short DFR8lastref() throws HDFException;
+
+     public static native boolean DFR8restart() throws HDFException;
+
+     public static native boolean DFR8readref(String filename, int ref) throws HDFException;
+
+     public static native int DFR8nimages(String fileName) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param image <b>IN</b>: byte[], the image, in an array of
+     *  bytes
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *  @param compress <b>IN</b>: short, the type of compression
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+     public static native boolean DFR8addimage(String filename, byte[] image,
+            int width, int height, short compress) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param theImage <b>IN</b>: Object, the image, in a java
+     *  array of appropriate size and type
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *  @param compress <b>IN</b>: short, the type of compression
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> converts the data into a contiguous
+     *  array of bytes and then writes it to the file
+     *
+     *  @return true on success
+     */
+     public static boolean DFR8addimage(String filename, Object theImage, int width, int height,
+            short compress) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theImage);
+        data = theArray.byteify();
+        return DFR8addimage(filename, data, width, height, compress);
+    }
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param image <b>IN</b>: byte[], the image, in an array of
+     *  bytes
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *  @param compress <b>IN</b>: short, the type of compression
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>NOTE:</b> to write from a Java array use the alternative
+     *  routine below.
+     *
+     *  @return true on success
+     */
+     public static native boolean DFR8putimage(String filename, byte[] image,
+            int width, int height, short compress) throws HDFException;
+
+    /**
+     *  @param filename <b>IN</b>: String, the file
+     *  @param theImage <b>IN</b>: Object, the image, in a java
+     *  array of appropriate size and type
+     *  @param width <b>IN</b>: int, the width of the image
+     *  @param height <b>IN</b>: int, the height of the image
+     *  @param compress <b>IN</b>: short, the type of compression
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *
+     *  <p><b>Note:</b> converts the data into a contiguous
+     *  array of bytes and then writes it to the file
+     *
+     *  @return true on success
+     */
+     public static boolean DFR8putimage(String filename, Object theImage, int width, int height,
+            short compress) throws HDFException
+    {
+        byte[] data;
+        HDFArray theArray = new HDFArray(theImage);
+        data = theArray.byteify();
+        return DFR8putimage(filename, data, width, height, compress);
+    }
+
+    /**
+     * DFR8setcompress sets compression scheme for 8-bit image
+     *
+     *  @param type <b>IN</b>: int, the type of compression
+     *  @param cinfo <b>IN</b>: HDFCompInfo, the compression parameters
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *  @return true on success
+     */
+     public static native boolean DFR8setcompress(int type, HDFCompInfo cinfo) throws HDFException;
+
+    /**
+     *  @param palref <b>OUT</b>: short[1], the HDF ref of the palette
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call.
+     *
+     *  @return palref[0] = the ref of the palette
+     */
+     public static native boolean DFR8getpalref(short[] palref) throws HDFException;
+
+     public static native boolean DFR8setpalette(byte[] palette) throws HDFException;
+
+     public static native boolean DFR8writeref(String filename, short ref) throws HDFException;
+
+    /**
+     *  New API for hdf-42r1
+     *
+     *  @param coder_type comp_coder_t enum for determining which type of encoding is being done
+     *
+     *  @exception hdf.hdflib.HDFException
+     *             should be thrown for errors in the
+     *             HDF library call, but is not yet implemented.
+     *
+     *
+     *  @return the compression config info value
+     */
+    public static native int HCget_config_info(int coder_type) throws HDFException;
+
+}
diff --git a/java/src/hdf/hdflib/HDFLibraryException.java b/java/src/hdf/hdflib/HDFLibraryException.java
new file mode 100644
index 0000000..6e0a262
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFLibraryException.java
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+
+/**
+ *  <p>
+ *  The class HDFException returns errors raised by the HDF
+ *  library.
+ *  <p>
+ *  In principle, this includes any and all errors possible
+ *  from the HDF library.  However, most error conditions
+ *  are not yet detected in this version of the Java
+ *  interface.  This will be added in future releases.
+ *
+ *  The only HDF library error currently raised are errors
+ *  in Hopen, such as ``file not found''.
+ */
+
+
+public class HDFLibraryException extends HDFException
+{
+
+    public HDFLibraryException() {
+        super();
+    }
+
+    public HDFLibraryException(String s) {
+        super("HDFLibraryException: "+s);
+    }
+
+    public HDFLibraryException(int err) {
+        super(err);
+    }
+
+    @Override
+    public String getMessage() {
+        if (msg != null) {
+            return msg;
+        }
+
+        String s;
+        try {
+            s = HDFLibrary.HEstring(HDFerror);
+        }
+        catch (HDFException e) {
+            s = new String("HDF error number: "+HDFerror+", HEstring failed");
+        }
+        msg = "HDFLibraryException: "+s;
+        return msg;
+    }
+
+    /**
+     * Prints this <code>HDFLibraryException</code>, the HDF Library error
+     * stack, and and the Java stack trace to the standard error stream.
+     */
+    @Override
+    public void printStackTrace() {
+        System.err.println(this);
+        printStackTrace0(null); // the HDF Library error stack
+        super.printStackTrace(); // the Java stack trace
+    }
+
+    /**
+     * Prints this <code>HDFLibraryException</code> the HDF Library error
+     * stack, and and the Java stack trace to the specified print stream.
+     *
+     * @param f
+     *            the file print stream.
+     */
+    public void printStackTrace(java.io.File f) {
+        if ((f == null) || !f.exists() || f.isDirectory() || !f.canWrite()) {
+            printStackTrace();
+        }
+        else {
+            try {
+                java.io.FileOutputStream o = new java.io.FileOutputStream(f);
+                java.io.PrintWriter p = new java.io.PrintWriter(o);
+                p.println(this);
+                p.close();
+            }
+            catch (Exception ex) {
+                System.err.println(this);
+            }
+            ;
+            // the HDF Library error stack
+            printStackTrace0(f.getPath());
+            super.printStackTrace(); // the Java stack trace
+        }
+    }
+
+    /*
+     * This private method calls the HDF library to extract the error codes
+     * and error stack.
+     */
+    private native void printStackTrace0(String s);
+}
diff --git a/java/src/hdf/hdflib/HDFNBITChunkInfo.java b/java/src/hdf/hdflib/HDFNBITChunkInfo.java
new file mode 100644
index 0000000..9cabaf2
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFNBITChunkInfo.java
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  NBIT compressed chunked class.
+ * <p>
+ * In this case, the information is the start bit, len, sign extension
+ * and fill.
+ */
+
+
+public class HDFNBITChunkInfo extends HDFChunkInfo {
+
+    public int[] chunk_lengths = new int[HDFConstants.MAX_VAR_DIMS];
+    public int start_bit = 0;
+    public int bit_len = 0;
+    public int sign_ext = 0;
+    public int fill_one = 0;
+
+    public HDFNBITChunkInfo() {
+        ctype = HDFConstants.HDF_NBIT;
+    };
+
+    public HDFNBITChunkInfo( int[] cl, int sb, int bl, int se, int fo) {
+        ctype = HDFConstants.HDF_NBIT;
+        chunk_lengths = cl;
+        start_bit = sb;
+        bit_len = bl;
+        sign_ext = se;
+        fill_one = fo;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFNBITCompInfo.java b/java/src/hdf/hdflib/HDFNBITCompInfo.java
new file mode 100644
index 0000000..b6796a3
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFNBITCompInfo.java
@@ -0,0 +1,47 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  ``NBIT'' compression class.
+ * <p>
+ * In this case, the information needed is the number type,
+ * the sign extension, the fill bit, the start bit, and the
+ * number of bits to store.
+ */
+
+public class HDFNBITCompInfo extends HDFNewCompInfo {
+
+    public int   nt;          /* number type of the data to encode */
+    public int    sign_ext;   /* whether to sign extend or not */
+    public int    fill_one;   /* whether to fill with 1's or 0's */
+    public int    start_bit;  /* offset of the start bit in the data */
+    public int    bit_len;    /* number of bits to store */
+
+    public HDFNBITCompInfo() {
+        ctype = HDFConstants.COMP_CODE_NBIT;
+    }
+
+    public HDFNBITCompInfo(
+            int   Nt,
+            int    Sign_ext,
+            int    Fill_one,
+            int    Start_bit,
+            int    Bit_len) {
+        ctype = HDFConstants.COMP_CODE_NBIT;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFNativeData.java b/java/src/hdf/hdflib/HDFNativeData.java
new file mode 100644
index 0000000..b17d788
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFNativeData.java
@@ -0,0 +1,166 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+public class HDFNativeData
+{
+    public HDFNativeData() {}
+    public static native int[] byteToInt( byte[] data );
+    public static native float[] byteToFloat( byte[] data );
+    public static native short[] byteToShort( byte[] data );
+    public static native long[] byteToLong( byte[] data );
+    public static native double[] byteToDouble( byte[] data );
+
+    public static native int[] byteToInt( int start, int len, byte[] data );
+    public static int byteToInt( byte[] data, int start)
+    {
+        int []ival = new int[1];
+        ival = byteToInt(start,1,data);
+        return(ival[0]);
+    }
+
+    public static native short[] byteToShort( int start, int len, byte[] data );
+    public static short byteToShort( byte[] data, int start)
+    {
+        short []sval = new short[1];
+        sval = byteToShort(start,1,data);
+        return(sval[0]);
+    }
+
+    public static native float[] byteToFloat( int start, int len, byte[] data );
+    public static float byteToFloat( byte[] data, int start)
+    {
+        float []fval = new float[1];
+        fval = byteToFloat(start,1,data);
+        return(fval[0]);
+    }
+
+    public static native long[] byteToLong( int start, int len, byte[] data );
+    public static long byteToLong( byte[] data, int start)
+    {
+        long []lval = new long[1];
+        lval = byteToLong(start,1,data);
+        return(lval[0]);
+    }
+
+    public static native double[] byteToDouble( int start, int len, byte[] data );
+    public static double byteToDouble( byte[] data, int start)
+    {
+        double []dval = new double[1];
+        dval = byteToDouble(start,1,data);
+        return(dval[0]);
+    }
+
+    public static native byte[] intToByte( int start, int len, int[] data);
+    public static native byte[] shortToByte( int start, int len, short[] data);
+    public static native byte[] floatToByte( int start, int len, float[] data);
+    public static native byte[] longToByte( int start, int len, long[] data);
+    public static native byte[] doubleToByte( int start, int len, double[] data);
+
+    public static native byte[] byteToByte( byte data);
+    static byte[] byteToByte( Byte data){return byteToByte(data.byteValue());}
+    public static native byte[] intToByte( int data);
+    static byte[] intToByte( Integer data){return intToByte(data.intValue());}
+    public static native byte[] shortToByte(short data);
+    static byte[] shortToByte( Short data){return shortToByte(data.shortValue());}
+    public static native byte[] floatToByte( float data);
+    static byte[] floatToByte( Float data){return floatToByte(data.floatValue());};
+    public static native byte[] longToByte( long data);
+    static byte[] longToByte(Long data){ return longToByte(data.longValue());}
+    public static native byte[] doubleToByte( double data);
+    static byte[] doubleToByte( Double data){return doubleToByte(data.doubleValue());}
+
+    public Object byteToNumber( byte[] barray, Object obj)
+        throws HDFException
+    {
+        Class theClass = obj.getClass();
+        String type = theClass.getName();
+        Object retobj = null;
+
+        if (type.equals("java.lang.Integer")) {
+            int[] i = hdf.hdflib.HDFNativeData.byteToInt(0,1,barray);
+            retobj = new Integer(i[0]);
+        } else  if (type.equals("java.lang.Byte")) {
+            retobj = new Byte(barray[0]);
+        } else  if (type.equals("java.lang.Short")) {
+            short[] f = hdf.hdflib.HDFNativeData.byteToShort(0,1,barray);
+            retobj = new Short(f[0]) ;
+        } else  if (type.equals("java.lang.Float")) {
+            float[] f = hdf.hdflib.HDFNativeData.byteToFloat(0,1,barray);
+            retobj = new Float(f[0]) ;
+        } else  if (type.equals("java.lang.Long")) {
+            long[] f = hdf.hdflib.HDFNativeData.byteToLong(0,1,barray);
+            retobj = new Long(f[0]) ;
+        } else  if (type.equals("java.lang.Double")) {
+            double[] f = hdf.hdflib.HDFNativeData.byteToDouble(0,1,barray);
+            retobj = new Double(f[0] );
+        } else {
+            /* exception: unsupprted type */
+            HDFException ex =
+            new HDFJavaException("byteToNumber: setfield bad type: "+obj+" "+type);
+            throw(ex);
+        }
+        return(retobj);
+    }
+
+    /**
+     *  Allocate a 1D array large enough to hold a multidimensional
+     *  array of 'datasize' elements of 'dataType' numbers.
+     *  This is called from hdf.hdfobject.HDFGR and
+     *  hdf.hdfobject.HDFSDS, and hdf.io.ASCII2HDF
+     *
+     *  @param dataType  the type of the iamge data
+     *  @param datasize  the size of the image data array
+     *  @return         an array of 'datasize' numbers of 'dataType
+     *
+     */
+public static Object defineDataObject(int dataType, int datasize)
+    {
+        Object data = null;
+
+        if ((dataType & HDFConstants.DFNT_LITEND) != 0) {
+          dataType -= HDFConstants.DFNT_LITEND;
+        }
+
+        switch(dataType)
+        {
+            case HDFConstants.DFNT_INT16:
+            case HDFConstants.DFNT_UINT16:
+                data = new short[datasize];
+                break;
+            case HDFConstants.DFNT_INT32:
+            case HDFConstants.DFNT_UINT32:
+                data = new int[datasize];
+                break;
+            case HDFConstants.DFNT_INT64:
+            case HDFConstants.DFNT_UINT64:
+                data = new long[datasize];
+                break;
+            case HDFConstants.DFNT_FLOAT32:
+                data = new float[datasize];
+                break;
+            case HDFConstants.DFNT_FLOAT64:
+                data = new double[datasize];
+                break;
+            default:
+            case HDFConstants.DFNT_CHAR:
+            case HDFConstants.DFNT_UCHAR8:
+            case HDFConstants.DFNT_UINT8:
+            case HDFConstants.DFNT_INT8:
+                data = new byte[datasize];
+                break;
+        }
+        return data;
+    }
+}
diff --git a/java/src/hdf/hdflib/HDFNewCompInfo.java b/java/src/hdf/hdflib/HDFNewCompInfo.java
new file mode 100644
index 0000000..96f5bae
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFNewCompInfo.java
@@ -0,0 +1,33 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a generic container for the parameters to the HDF
+ *  compressed classes, with the ``new'' encoding.
+ * <p>
+ *  Compression parameters are expressed as instances of sub-classes
+ *  of this type.
+ */
+
+
+public class HDFNewCompInfo extends HDFCompInfo {
+    public int ctype;   /* from COMP_CODE_ENUM */
+    public HDFNewCompInfo() {
+        ctype = HDFConstants.COMP_CODE_NONE;
+    } ;
+}
+
+
diff --git a/java/src/hdf/hdflib/HDFNotImplementedException.java b/java/src/hdf/hdflib/HDFNotImplementedException.java
new file mode 100644
index 0000000..db5a00c
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFNotImplementedException.java
@@ -0,0 +1,44 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ *  <p>
+ *  HDFNotImplementedException indicates a function that is part
+ *  of the HDF API, but which cannot or will not be implemented
+ *  for Java.
+ *  <p>
+ *  For instance, C routines which take Unix FILE objects
+ *  as parameters are not appropriate for the Java interface
+ *  and will not be implemented.  These routines will raise
+ *  an HDFNotImplementedException.
+ */
+
+public class HDFNotImplementedException  extends HDFJavaException 
+{
+    String msg;
+
+    public HDFNotImplementedException() {
+        HDFerror = 0;
+    }
+
+    public HDFNotImplementedException(String s) {
+        msg = "HDFJavaException: HDF function not implmented (yet): "+s;
+    }
+
+    @Override
+	public String getMessage() {
+        return msg;
+    }
+}
diff --git a/java/src/hdf/hdflib/HDFOldCompInfo.java b/java/src/hdf/hdflib/HDFOldCompInfo.java
new file mode 100644
index 0000000..aeba904
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFOldCompInfo.java
@@ -0,0 +1,33 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a generic container for the parameters to the HDF
+ *  compressed classes, with the ``ole'' encoding.
+ * <p>
+ *  Compression parameters are expressed as instances of sub-classes
+ *  of this type.
+ */
+
+
+public class HDFOldCompInfo extends HDFCompInfo {
+    public int ctype; /* from COMP_NONE defines */
+    public HDFOldCompInfo() {
+        ctype = HDFConstants.COMP_NONE;
+    } ;
+}
+
+
diff --git a/java/src/hdf/hdflib/HDFOldRLECompInfo.java b/java/src/hdf/hdflib/HDFOldRLECompInfo.java
new file mode 100644
index 0000000..8c580ad
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFOldRLECompInfo.java
@@ -0,0 +1,30 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a generic container for the parameters to the HDF
+ *  RLE compressed classes, with the ``old'' type encoding.
+ * <p>
+ *  In this case, there is no auxilliary information.
+ */
+
+public class HDFOldRLECompInfo extends HDFOldCompInfo {
+
+    public HDFOldRLECompInfo () {
+        ctype = HDFConstants.COMP_RLE;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFRLECompInfo.java b/java/src/hdf/hdflib/HDFRLECompInfo.java
new file mode 100644
index 0000000..83d9d05
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFRLECompInfo.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a generic container for the parameters to the HDF
+ *  RLE compressed classes, with the ``new'' type encoding.
+ * <p>
+ *  In this case, there is no auxilliary information.
+ */
+public class HDFRLECompInfo extends HDFNewCompInfo {
+
+    public HDFRLECompInfo () {
+        ctype = HDFConstants.COMP_CODE_RLE;
+    }
+
+}
diff --git a/java/src/hdf/hdflib/HDFSKPHUFFCompInfo.java b/java/src/hdf/hdflib/HDFSKPHUFFCompInfo.java
new file mode 100644
index 0000000..fcf3f69
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFSKPHUFFCompInfo.java
@@ -0,0 +1,32 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a generic container for the parameters to the HDF
+ *  ``Skipping Huffman'' compression classes.
+ * <p>
+ *  In this case, the information is the skip size
+ */
+public class HDFSKPHUFFCompInfo extends HDFNewCompInfo {
+
+    public int skp_size;
+
+    public HDFSKPHUFFCompInfo() {
+        ctype = HDFConstants.COMP_CODE_SKPHUFF;
+    } ;
+}
+
+
diff --git a/java/src/hdf/hdflib/HDFSZIPCompInfo.java b/java/src/hdf/hdflib/HDFSZIPCompInfo.java
new file mode 100644
index 0000000..70ceb83
--- /dev/null
+++ b/java/src/hdf/hdflib/HDFSZIPCompInfo.java
@@ -0,0 +1,53 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+package hdf.hdflib;
+
+/**
+ * <p>
+ *  This class is a container for the parameters to the HDF
+ *  SZIP compression algorithm.
+ * <p>
+ * In this case, the only parameter is the ``level'' of deflation.
+ */
+
+
+public class HDFSZIPCompInfo extends HDFNewCompInfo {
+
+    public int bits_per_pixel;
+    public int options_mask;
+    public int pixels;
+    public int pixels_per_block;
+    public int pixels_per_scanline;
+
+    public HDFSZIPCompInfo() {
+        ctype = HDFConstants.COMP_CODE_SZIP;
+    }
+
+    public HDFSZIPCompInfo(
+    int bits_per_pixel_in,
+    int options_mask_in,
+    int pixels_in,
+    int pixels_per_block_in,
+    int pixels_per_scanline_in) {
+        ctype = HDFConstants.COMP_CODE_SZIP;
+        bits_per_pixel =     bits_per_pixel_in;
+        options_mask =     options_mask_in;
+        pixels =     pixels_in;
+        pixels_per_block =     pixels_per_block_in;
+        pixels_per_scanline =     pixels_per_scanline_in;
+        
+    }
+}
+
+
diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html
new file mode 100644
index 0000000..641227a
--- /dev/null
+++ b/java/src/hdf/overview.html
@@ -0,0 +1,94 @@
+<body>
+
+<h1>Java HDF Interface (JHI4)</h1>
+
+<h2><u>What it is</u></h2>
+The <b>Java HDF Interface (JHI4)</b> is a Java package
+(<a href="../../hdf-java-html/javadocs/hdf/hdflib/package-summary.html">hdf.hdflib</a>)
+that ``wraps around'' the HDF library.
+<p />There are a large number of functions in the HDF
+library (version 4.2). Some of the functions are not supported in JHI4.
+
+<center><table BORDER=1 COLS=1 WIDTH="71%" BGCOLOR="#dbeaf5" >
+<tr>
+<td>
+<center>Note: The JHI4 only supports HDF4.</center>
+</td>
+</tr>
+</table></center>
+
+<p>The JHI4 may be used by any Java application that needs to access HDF
+files. It is extremely important to emphasize that <i>this package is not
+a pure Java implementation of the HDF library.</i> The JHI4 calls the
+same HDF library that is used by C or FORTRAN programs. (Note that this
+product cannot be used in most network browsers because it accesses the
+local disk using native code.)
+<p>The Java HDF Interface consists of Java classes and a dynamically
+linked native library. The Java classes declare native methods, and the
+library contains C functions which implement the native methods. The C
+functions call the standard HDF library, which is linked as part of the
+same library on most platforms.
+<p>The central part of the JHI4 is the Java class <i>
+<a href="../../hdf-java-html/javadocs/hdf/hdflib/HDFLibrary.html">hdf.hdflib.HDFLibrary</a></i>.
+The <i>HDFLibrary</i> class calls the standard (<i>i.e.</i>, `native' code) HDF
+library, with native methods for most of the HDF5functions.
+
+<h3>
+<u>How to use it</u></h3>
+The JHI4 is used by Java classes to call the HDF library, in order to
+create HDF files, and read and write data in existing HDF files.
+<p>For example, the HDF library has the function <b>Hopen</b> to open
+an HDF file. The Java interface is the class <i>
+<a href="../../hdf-java-html/javadocs/hdf/hdflib/HDFLibrary.html">hdf.hdflib.HDFLibrary</a></i>,
+which has a method:
+<pre><b>static native int Hopen(String filename, int flags, int access );</b></pre>
+The native method is implemented in C using the
+<a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/index.html">Java
+Native Method Interface </a>(JNI). This is written something like the following:
+<pre><b>JNIEXPORT jint
+JNICALL Java_hdf_hdflib_HDFLibrary_Hopen
+(
+ JNIEnv *env,
+ jclass class,
+ jstring hdfFile,
+ jint flags,
+ jint access)
+ {
+
+ /* ...convert Java String to (char *) */
+
+ /* call the HDF library */
+ retVal = Hopen((char *)file, (unsigned)flags, (hid_t)access );
+
+ /* ... */
+}</b></pre>
+This C function calls the HDF library and returns the result appropriately.
+<p>There is one native method for each HDF entry point (several hundred
+in all), which are compiled with the HDF library into a dynamically loaded
+library (<i>libhdf_java</i>). Note that this library must be built for each
+platform.
+<p>To call the HDF `<b><i>Hopen</i></b>' function, a Java program would
+import the package '<i><b>hdf.hdflib.*</b>'</i>, and invoke the method
+on the class '<b><i>HDFLibrary</i></b>'. The Java program would look something
+like this:
+<pre><b>import hdf.hdflib.*;
+
+{
+ /* ... */
+
+ try {
+ file = HDFLibrary.Hopen("myFile.hdf", flags, access );
+ } catch (HDFException ex) {
+ //...
+ }
+
+ /* ... */
+}</b></pre>
+The <i><b>HDFLibrary</b> </i>class automatically loads the native method implementations
+and the HDF library.
+
+<h3>
+<a NAME="DOWNLOAD"></a>To Obtain</h3>
+The JHI4 is included with the <a href="http://www.hdfgroup.org/HDF/index.html">HDF</a> library.
+
+</body>
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
new file mode 100644
index 0000000..aa6dc60
--- /dev/null
+++ b/java/src/jni/CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required (VERSION 3.1.0)
+PROJECT (HDF4_JAVA_JNI C)
+
+set (HDF4_JAVA_JNI_CSRCS
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfanImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfdfpalImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfdfuImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfexceptionImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfgrImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfheImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfhxImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfnativeImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfr24Imp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfr8Imp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfsdsImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfstructsutil.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfvdataImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfvfImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfvgroupImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfvhImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfvqImp.c
+    ${HDF4_JAVA_JNI_SOURCE_DIR}/hdfvsqImp.c
+)
+
+INCLUDE_DIRECTORIES ( ${HDF4_JAVA_JNI_SOURCE_DIR} )
+
+set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
+
+########### JNI libraries always must be built shared  ###############
+add_library (${HDF4_JAVA_JNI_LIB_TARGET} SHARED ${HDF4_JAVA_JNI_CSRCS})
+TARGET_C_PROPERTIES (${HDF4_JAVA_JNI_LIB_TARGET} SHARED " " " ")
+if (WIN32)
+  TARGET_LINK_LIBRARIES (${HDF4_JAVA_JNI_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET} "ws2_32.lib")
+else (WIN32)
+  TARGET_LINK_LIBRARIES (${HDF4_JAVA_JNI_LIB_TARGET} ${HDF4_MF_LIB_TARGET} ${HDF4_SRC_LIB_TARGET})
+endif (WIN32)
+set_target_properties (${HDF4_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
+SET_GLOBAL_VARIABLE (HDF4_JAVA_LIBRARIES_TO_EXPORT "${HDF4_JAVA_LIBRARIES_TO_EXPORT};${HDF4_JAVA_JNI_LIB_TARGET}")
+H4_SET_LIB_OPTIONS (${HDF4_JAVA_JNI_LIB_TARGET} ${HDF4_JAVA_JNI_LIB_NAME} SHARED)
+if (WIN32)
+  get_filename_component (HDF4_JAVA_JNI_DLL_NAME ${HDF4_JAVA_JNI_LIB_TARGET} NAME_WE)
+  # message (STATUS "HDF4_JAVA_JNI_DLL_NAME: ${HDF4_JAVA_JNI_DLL_NAME}")
+  if (BUILD_TESTING)
+    add_custom_target (HDF4_JAVA_JNI-Test-Copy ALL
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF4_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF4_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
+        COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF4_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/"
+    )
+    add_dependencies (HDF4_JAVA_JNI-Test-Copy ${HDF4_JAVA_JNI_LIB_TARGET})
+  endif (BUILD_TESTING)
+endif (WIN32)
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+if (HDF4_EXPORTED_TARGETS)
+  INSTALL_TARGET_PDB (${HDF4_JAVA_JNI_LIB_TARGET} ${HDF4_INSTALL_BIN_DIR} libraries)
+  install (
+      TARGETS
+          ${HDF4_JAVA_JNI_LIB_TARGET}
+      EXPORT
+          ${HDF4_JAVA_EXPORTED_TARGETS}
+      LIBRARY DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+      ARCHIVE DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+      RUNTIME DESTINATION ${HDF4_INSTALL_LIB_DIR} COMPONENT libraries
+      FRAMEWORK DESTINATION ${HDF4_INSTALL_FWRK_DIR} COMPONENT libraries
+  )
+endif (HDF4_EXPORTED_TARGETS)
diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am
new file mode 100644
index 0000000..196612d
--- /dev/null
+++ b/java/src/jni/Makefile.am
@@ -0,0 +1,32 @@
+#
+# HDF Java native interface (JNI) Library Makefile(.in)
+#
+
+include $(top_srcdir)/config/commence.am
+
+# Mark this directory as part of the JNI API
+JAVA_API=yes
+AM_CFLAGS=-DNDEBUG -fPIC
+
+# Include src directory and JNI flags
+AM_CPPFLAGS=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc -I$(top_srcdir)/java/src/jni $(JNIFLAGS)
+
+# This is our main target
+lib_LTLIBRARIES=libhdf_java.la
+
+# Source files for the library
+libhdf_java_la_SOURCES=hdfanImp.c hdfdfpalImp.c \
+   hdfdfuImp.c hdfexceptionImp.c hdfgrImp.c hdfheImp.c hdfhxImp.c hdfImp.c hdfnativeImp.c \
+   hdfr24Imp.c hdfr8Imp.c hdfsdsImp.c hdfstructsutil.c hdfvdataImp.c hdfvfImp.c hdfvgroupImp.c \
+   hdfvhImp.c hdfvqImp.c hdfvsqImp.c
+
+# HDF Java (JNI) library depends on HDF Library.
+libhdf_java_la_LIBADD=$(LIBMFHDF) $(LIBHDF) @LIBS@
+libhdf_java_la_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+libhdf_java_la_INCLUDES=-I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
+include $(top_srcdir)/config/conclude.am
diff --git a/mfhdf/xdr/Makefile.in b/java/src/jni/Makefile.in
similarity index 88%
copy from mfhdf/xdr/Makefile.in
copy to java/src/jni/Makefile.in
index 2385193..a406428 100644
--- a/mfhdf/xdr/Makefile.in
+++ b/java/src/jni/Makefile.in
@@ -15,10 +15,9 @@
 @SET_MAKE@
 
 #
-# XDR Library Makefile(.in)
+# HDF Java native interface (JNI) Library Makefile(.in)
 #
 
-
 VPATH = @srcdir@
 am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
 am__make_running_with_option = \
@@ -86,13 +85,24 @@ host_triplet = @host@
 DIST_COMMON = $(top_srcdir)/config/commence.am \
 	$(top_srcdir)/config/conclude.am $(srcdir)/Makefile.in \
 	$(srcdir)/Makefile.am $(top_srcdir)/bin/mkinstalldirs \
-	$(top_srcdir)/bin/depcomp $(include_HEADERS) \
-	$(top_srcdir)/bin/test-driver README
-check_PROGRAMS = xdrtest$(EXEEXT)
-TESTS = $(am__EXEEXT_1)
-subdir = mfhdf/xdr
+	$(top_srcdir)/bin/depcomp $(top_srcdir)/bin/test-driver
+TESTS =
+subdir = java/src/jni
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_class.m4 \
+	$(top_srcdir)/m4/ax_check_classpath.m4 \
+	$(top_srcdir)/m4/ax_check_java_home.m4 \
+	$(top_srcdir)/m4/ax_check_junit.m4 \
+	$(top_srcdir)/m4/ax_java_options.m4 \
+	$(top_srcdir)/m4/ax_jni_include_dir.m4 \
+	$(top_srcdir)/m4/ax_prog_jar.m4 \
+	$(top_srcdir)/m4/ax_prog_java.m4 \
+	$(top_srcdir)/m4/ax_prog_java_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javac.m4 \
+	$(top_srcdir)/m4/ax_prog_javac_works.m4 \
+	$(top_srcdir)/m4/ax_prog_javadoc.m4 \
+	$(top_srcdir)/m4/ax_try_compile_java.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
@@ -126,18 +136,18 @@ am__uninstall_files_from_dir = { \
     || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
          $(am__cd) "$$dir" && rm -f $$files; }; \
   }
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+am__installdirs = "$(DESTDIR)$(libdir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
-libxdr_la_LIBADD =
-am_libxdr_la_OBJECTS = xdr.lo xdrfloat.lo xdrstdio.lo xdrarray.lo
-libxdr_la_OBJECTS = $(am_libxdr_la_OBJECTS)
+am_libhdf_java_la_OBJECTS = hdfanImp.lo hdfdfpalImp.lo hdfdfuImp.lo \
+	hdfexceptionImp.lo hdfgrImp.lo hdfheImp.lo hdfhxImp.lo \
+	hdfImp.lo hdfnativeImp.lo hdfr24Imp.lo hdfr8Imp.lo \
+	hdfsdsImp.lo hdfstructsutil.lo hdfvdataImp.lo hdfvfImp.lo \
+	hdfvgroupImp.lo hdfvhImp.lo hdfvqImp.lo hdfvsqImp.lo
+libhdf_java_la_OBJECTS = $(am_libhdf_java_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
 am__v_lt_0 = --silent
 am__v_lt_1 = 
-am_xdrtest_OBJECTS = xdrtest.$(OBJEXT)
-xdrtest_OBJECTS = $(am_xdrtest_OBJECTS)
-xdrtest_LDADD = $(LDADD)
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -172,14 +182,13 @@ AM_V_CCLD = $(am__v_CCLD_ at AM_V@)
 am__v_CCLD_ = $(am__v_CCLD_ at AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD    " $@;
 am__v_CCLD_1 = 
-SOURCES = $(libxdr_la_SOURCES) $(xdrtest_SOURCES)
-DIST_SOURCES = $(libxdr_la_SOURCES) $(xdrtest_SOURCES)
+SOURCES = $(libhdf_java_la_SOURCES)
+DIST_SOURCES = $(libhdf_java_la_SOURCES)
 am__can_run_installinfo = \
   case $$AM_UPDATE_INFO_DIR in \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
-HEADERS = $(include_HEADERS)
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
 # Read a list of newline-separated strings from the standard input,
 # and print each of them once, without duplicates.  Input order is
@@ -356,10 +365,12 @@ am__set_TESTS_bases = \
   bases=`echo $$bases`
 RECHECK_LOGS = $(TEST_LOGS)
 AM_RECURSIVE_TARGETS = check recheck
-am__EXEEXT_1 = xdrtest$(EXEEXT)
 TEST_SUITE_LOG = test-suite.log
-LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
-LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
+TEST_LOGS = $(am__test_logs2:.sh.log=.log)
+SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
+SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
 am__set_b = \
   case '$@' in \
     */*) \
@@ -370,11 +381,6 @@ am__set_b = \
     *) \
       b='$*';; \
   esac
-am__test_logs1 = $(TESTS:=.log)
-am__test_logs2 = $(am__test_logs1:@EXEEXT at .log=.log)
-TEST_LOGS = $(am__test_logs2:.sh.log=.log)
-SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
-SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -418,12 +424,27 @@ FFLAGS = @FFLAGS@
 FGREP = @FGREP@
 FLIBS = @FLIBS@
 GREP = @GREP@
+H4_CLASSPATH = @H4_CLASSPATH@
+H4_JAVACFLAGS = @H4_JAVACFLAGS@
+H4_JAVAFLAGS = @H4_JAVAFLAGS@
 H4_VERSION = @H4_VERSION@
+HDF_JAVA = @HDF_JAVA@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVACFLAGS = @JAVACFLAGS@
+JAVADOC = @JAVADOC@
+JAVAFLAGS = @JAVAFLAGS@
+JAVAPREFIX = @JAVAPREFIX@
+JAVA_JUNIT = @JAVA_JUNIT@
+JAVA_PATH_NAME = @JAVA_PATH_NAME@
+JNIFLAGS = @JNIFLAGS@
+JUNIT = @JUNIT@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
@@ -466,11 +487,14 @@ STRIP = @STRIP@
 SZIP_HAS_ENCODER = @SZIP_HAS_ENCODER@
 SZIP_INFO = @SZIP_INFO@
 TBL = @TBL@
+TESTS_JUNIT = @TESTS_JUNIT@
 TEST_FORTRAN_NETCDF = @TEST_FORTRAN_NETCDF@
 UNAME_INFO = @UNAME_INFO@
 USE_COMP_SZIP = @USE_COMP_SZIP@
+UUDECODE = @UUDECODE@
 VERSION = @VERSION@
 YACC = @YACC@
+_ACJNI_JAVAC = @_ACJNI_JAVAC@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
@@ -544,14 +568,34 @@ ACLOCAL_AMFLAGS = "-I m4"
 # .chkexe files are used to mark tests that have run successfully.
 # .chklog files are output from those tests.
 CHECK_CLEANFILES = *.chkexe *.chklog
-AM_CPPFLAGS = -I$(top_srcdir)/hdf/src
 
-# XDR Library
-lib_LTLIBRARIES = libxdr.la
-libxdr_la_SOURCES = xdr.c xdrfloat.c xdrstdio.c xdrarray.c
-include_HEADERS = xdr.h types.h
-TEST_PROG = xdrtest
-xdrtest_SOURCES = xdrtest.c
+# Mark this directory as part of the JNI API
+JAVA_API = yes
+AM_CFLAGS = -DNDEBUG -fPIC
+
+# Include src directory and JNI flags
+AM_CPPFLAGS = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc -I$(top_srcdir)/java/src/jni $(JNIFLAGS)
+
+
+# This is our main target
+lib_LTLIBRARIES = libhdf_java.la
+
+# Source files for the library
+libhdf_java_la_SOURCES = hdfanImp.c hdfdfpalImp.c \
+   hdfdfuImp.c hdfexceptionImp.c hdfgrImp.c hdfheImp.c hdfhxImp.c hdfImp.c hdfnativeImp.c \
+   hdfr24Imp.c hdfr8Imp.c hdfsdsImp.c hdfstructsutil.c hdfvdataImp.c hdfvfImp.c hdfvgroupImp.c \
+   hdfvhImp.c hdfvqImp.c hdfvsqImp.c
+
+
+# HDF Java (JNI) library depends on HDF Library.
+libhdf_java_la_LIBADD = $(LIBMFHDF) $(LIBHDF) @LIBS@
+libhdf_java_la_DEPENDENCIES = $(LIBMFHDF) $(LIBHDF)
+libhdf_java_la_INCLUDES = -I$(top_srcdir)/hdf/src        \
+         -I$(top_srcdir)/mfhdf/libsrc   \
+         -I$(top_builddir)/mfhdf/libsrc
+
 
 # Automake needs to be taught how to build lib, progs, and tests targets.
 # These will be filled in automatically for the most part (e.g.,
@@ -583,9 +627,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mfhdf/xdr/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign java/src/jni/Makefile'; \
 	$(am__cd) $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign mfhdf/xdr/Makefile
+	  $(AUTOMAKE) --foreign java/src/jni/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -641,21 +685,8 @@ clean-libLTLIBRARIES:
 	  rm -f $${locs}; \
 	}
 
-libxdr.la: $(libxdr_la_OBJECTS) $(libxdr_la_DEPENDENCIES) $(EXTRA_libxdr_la_DEPENDENCIES) 
-	$(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libxdr_la_OBJECTS) $(libxdr_la_LIBADD) $(LIBS)
-
-clean-checkPROGRAMS:
-	@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
-	echo " rm -f" $$list; \
-	rm -f $$list || exit $$?; \
-	test -n "$(EXEEXT)" || exit 0; \
-	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
-	echo " rm -f" $$list; \
-	rm -f $$list
-
-xdrtest$(EXEEXT): $(xdrtest_OBJECTS) $(xdrtest_DEPENDENCIES) $(EXTRA_xdrtest_DEPENDENCIES) 
-	@rm -f xdrtest$(EXEEXT)
-	$(AM_V_CCLD)$(LINK) $(xdrtest_OBJECTS) $(xdrtest_LDADD) $(LIBS)
+libhdf_java.la: $(libhdf_java_la_OBJECTS) $(libhdf_java_la_DEPENDENCIES) $(EXTRA_libhdf_java_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libhdf_java_la_OBJECTS) $(libhdf_java_la_LIBADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -663,11 +694,25 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdr.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrarray.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrfloat.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrstdio.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/xdrtest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfanImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfdfpalImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfdfuImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfexceptionImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfgrImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfheImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfhxImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfnativeImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfr24Imp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfr8Imp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfsdsImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfstructsutil.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfvdataImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfvfImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfvgroupImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfvhImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfvqImp.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/hdfvsqImp.Plo at am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -695,27 +740,6 @@ mostlyclean-libtool:
 
 clean-libtool:
 	-rm -rf .libs _libs
-install-includeHEADERS: $(include_HEADERS)
-	@$(NORMAL_INSTALL)
-	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-	if test -n "$$list"; then \
-	  echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
-	  $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
-	fi; \
-	for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  echo "$$d$$p"; \
-	done | $(am__base_list) | \
-	while read files; do \
-	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
-	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
-	done
-
-uninstall-includeHEADERS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
-	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-	dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
 
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -888,7 +912,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
 	  echo "$$col$$br$$std";					\
 	fi;								\
 	$$success || exit 1
-recheck: all $(check_PROGRAMS)
+recheck: all 
 	@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 	@set +e; $(am__set_TESTS_bases); \
 	bases=`for i in $$bases; do echo $$i; done \
@@ -899,13 +923,6 @@ recheck: all $(check_PROGRAMS)
 	        am__force_recheck=am--force-recheck \
 	        TEST_LOGS="$$log_list"; \
 	exit $$?
-xdrtest.log: xdrtest$(EXEEXT)
-	@p='xdrtest$(EXEEXT)'; \
-	b='xdrtest'; \
-	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
-	--log-file $$b.log --trs-file $$b.trs \
-	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
-	"$$tst" $(AM_TESTS_FD_REDIRECT)
 .sh.log:
 	@p='$<'; \
 	$(am__set_b); \
@@ -952,12 +969,11 @@ distdir: $(DISTFILES)
 	  fi; \
 	done
 check-am: all-am
-	$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
 	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
 check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS) all-local
+all-am: Makefile $(LTLIBRARIES) all-local
 installdirs:
-	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+	for dir in "$(DESTDIR)$(libdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -995,8 +1011,8 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-checkPROGRAMS clean-generic clean-libLTLIBRARIES \
-	clean-libtool mostlyclean-am
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -rf ./$(DEPDIR)
@@ -1016,7 +1032,7 @@ info: info-am
 
 info-am:
 
-install-data-am: install-includeHEADERS
+install-data-am:
 
 install-dvi: install-dvi-am
 
@@ -1062,26 +1078,25 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+uninstall-am: uninstall-libLTLIBRARIES
 
 .MAKE: check-am install-am install-strip
 
 .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \
-	check-am clean clean-checkPROGRAMS clean-generic \
-	clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \
-	ctags-am distclean distclean-compile distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am \
-	install-includeHEADERS install-info install-info-am \
+	check-am clean clean-generic clean-libLTLIBRARIES \
+	clean-libtool cscopelist-am ctags ctags-am distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am \
 	install-libLTLIBRARIES install-man install-pdf install-pdf-am \
 	install-ps install-ps-am install-strip installcheck \
 	installcheck-am installdirs maintainer-clean \
 	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
 	pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am \
-	uninstall-includeHEADERS uninstall-libLTLIBRARIES
+	uninstall-libLTLIBRARIES
 
 
 # lib/progs/tests targets recurse into subdirectories. build-* targets
diff --git a/java/src/jni/h4jni.h b/java/src/jni/h4jni.h
new file mode 100644
index 0000000..51ede40
--- /dev/null
+++ b/java/src/jni/h4jni.h
@@ -0,0 +1,176 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+
+/*
+ *  For details of the HDF libraries, see the HDF Documentation at:
+ *    http://hdfdfgroup.org/HDF/doc/
+ *
+ */
+
+#include <jni.h>
+
+#ifndef _Included_h4jni
+#define _Included_h4jni
+
+#ifdef __cplusplus
+  #define ENVPTR (env)
+  #define ENVPAR
+  #define ENVONLY
+#else /* __cplusplus */
+  #define ENVPTR (*env)
+  #define ENVPAR env,
+  #define ENVONLY env
+#endif /* __cplusplus */
+
+/* Macros for class access */
+/* Calling code must define ret_obj as jobject */
+#define CALL_CONSTRUCTOR(classname,classsig,args) {                              \
+    jclass     cls;                                                              \
+    jmethodID  constructor;                                                      \
+    cls = ENVPTR->FindClass(ENVPAR (classname));                                 \
+    if (cls == 0) {                                                              \
+        h4JNIFatalError(env, "JNI error: GetObjectClass\n");                     \
+        ret_obj = NULL;                                                          \
+    }                                                                            \
+    constructor = ENVPTR->GetMethodID(ENVPAR cls, "<init>", (classsig));         \
+    if (constructor == 0) {                                                      \
+        h4JNIFatalError(env, "JNI error: GetMethodID failed\n");                 \
+        ret_obj = NULL;                                                          \
+    }                                                                            \
+    ret_obj = ENVPTR->NewObjectA(ENVPAR cls, constructor, (args));               \
+}
+
+/* Macros for error check */
+/* for now:  use top of exception stack:  fix this to do whole stack */
+#define CALL_ERROR_CHECK() {                                                     \
+    int16 errval;                                                                \
+    jclass jc;                                                                   \
+    errval = HEvalue((int32)1);                                                  \
+    if (errval != DFE_NONE) {                                                    \
+        h4buildException(env, errval);                                           \
+        jc = ENVPTR->FindClass(ENVPAR  "hdf/hdflib/HDFLibraryException");        \
+        if (jc != NULL)                                                          \
+            ENVPTR->ThrowNew(ENVPAR jc,HEstring((hdf_err_code_t)errval));        \
+    }                                                                            \
+}
+
+
+/* Macros for string access */
+#define PIN_JAVA_STRING(javastr,localstr) {                                      \
+    jboolean isCopy;                                                             \
+    if ((javastr) == NULL) {                                                     \
+        (localstr) = NULL;                                                      \
+        h4nullArgument(env, "java string is NULL");                              \
+    }                                                                            \
+    else {                                                                       \
+        (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy);       \
+        if ((localstr) == NULL) {                                                \
+            h4JNIFatalError(env, "local c string is not pinned");                \
+        }                                                                        \
+    }                                                                            \
+}
+
+#define UNPIN_JAVA_STRING(javastr,localstr) {                                    \
+     ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr));                \
+}
+
+#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) {               \
+    jboolean isCopy;                                                             \
+    if ((javastr) == NULL) {                                                     \
+        (localstr) = NULL;                                                      \
+        h4nullArgument(env, "java string is NULL");                              \
+    }                                                                            \
+    else if ((java2str) == NULL) {                                               \
+        (local2str) = NULL;                                                      \
+        h4nullArgument(env, "second java string is NULL");                       \
+    }                                                                            \
+    else {                                                                       \
+        (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy);       \
+        if ((localstr) == NULL) {                                                \
+            h4JNIFatalError(env, "local c string is not pinned");                \
+        }                                                                        \
+        else {                                                                   \
+            (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
+            if ((local2str) == NULL) {                                           \
+                ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr));     \
+                h4JNIFatalError(env, "second local c string is not pinned");     \
+            }                                                                    \
+        }                                                                        \
+    }                                                                            \
+}
+
+#define UNPIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) {             \
+     ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr));                \
+     ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str));              \
+}
+
+#define PIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) {       \
+    jboolean isCopy;                                                             \
+    if ((javastr) == NULL) {                                                     \
+        (localstr) = NULL;                                                      \
+        h4nullArgument(env, "java string is NULL");                              \
+    }                                                                            \
+    else if ((java2str) == NULL) {                                               \
+        (local2str) = NULL;                                                      \
+        h4nullArgument(env, "second java string is NULL");                       \
+    }                                                                            \
+    else if ((java3str) == NULL) {                                               \
+        (local3str) = NULL;                                                      \
+        h4nullArgument(env, "third java string is NULL");                        \
+    }                                                                            \
+    else {                                                                       \
+        (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy);       \
+        if ((localstr) == NULL) {                                                \
+            h4JNIFatalError(env, "local c string is not pinned");                \
+        }                                                                        \
+        else {                                                                   \
+            (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
+            if ((local2str) == NULL) {                                           \
+                ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr));     \
+                h4JNIFatalError(env, "second local c string is not pinned");     \
+            }                                                                    \
+            else {                                                               \
+                (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy);   \
+                if ((local3str) == NULL) {                                       \
+                    ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
+                    ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str));     \
+                    h4JNIFatalError(env, "third local c string is not pinned");  \
+                }                                                                \
+            }                                                                    \
+        }                                                                        \
+    }                                                                            \
+}
+
+#define UNPIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) {        \
+     ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr));                \
+     ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str));              \
+     ENVPTR->ReleaseStringUTFChars(ENVPAR (java3str), (local3str));              \
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern jboolean h4JNIFatalError(JNIEnv *, const char *);
+extern jboolean h4buildException(JNIEnv *, jint);
+extern jboolean h4badArgument (JNIEnv *, const char *);
+extern jboolean h4nullArgument(JNIEnv *, const char *);
+extern jboolean h4NotImplemented (JNIEnv *, const char *);
+extern jboolean h4outOfMemory (JNIEnv *, const char *);
+extern jboolean h4raiseException(JNIEnv *, const char *);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_h4jni */
diff --git a/java/src/jni/hdfImp.c b/java/src/jni/hdfImp.c
new file mode 100644
index 0000000..a7e59a8
--- /dev/null
+++ b/java/src/jni/hdfImp.c
@@ -0,0 +1,430 @@
+
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+/*
+ *  This code is the C-interface called by Java programs to access the
+ *  HDF 4 library.
+ *
+ *  Each routine wraps a single HDF entry point, generally with the
+ *  analogous arguments and return codes.
+ *
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hdf.h"
+#include "hfile.h"
+#include "jni.h"
+#include "h4jni.h"
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hopen
+ * Signature: (Ljava/lang/String;II)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdflib_HDFLibrary_Hopen
+(JNIEnv *env, jclass clss, jstring hdfFile, jint access, jint ndds)
+{
+    const char *file;
+    int32  retVal;
+    jclass jc;
+
+    PIN_JAVA_STRING(hdfFile, file);
+    if (file != NULL) {
+        /* open HDF file specified by hdf_HDF_file */
+        retVal = Hopen(file, (intn)access, (int16)ndds);
+
+        UNPIN_JAVA_STRING(hdfFile, file);
+
+        if (retVal == FAIL)
+            CALL_ERROR_CHECK();
+    }
+    return (jlong)retVal;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hclose
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hclose
+(JNIEnv *env, jclass clss, jlong fid)
+{
+    intn status = 0;
+
+    if (fid < 0) {
+        /* maybe not an exception -- the file is already closed? */
+        return JNI_FALSE;
+    }
+    /* close the HDF file */
+    status = Hclose((int32)fid);
+    if (status == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    HDdont_atexit
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_HDdont_1atexit
+(JNIEnv *env, jclass clss)
+{
+    intn ret_value = SUCCEED;
+    ret_value = HDdont_atexit();
+    return (jint)ret_value;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hishdf
+ * Signature: (Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hishdf
+(JNIEnv *env, jclass clss, jstring hdfFile)
+{
+
+    const char *hfile;
+    intn  retVal;
+
+    PIN_JAVA_STRING(hdfFile, hfile);
+    if (hfile != NULL) {
+        /* open HDF file specified by hdf_HDF_file */
+        retVal = Hishdf(hfile);
+
+        UNPIN_JAVA_STRING(hdfFile, hfile);
+
+        if (retVal == FALSE)
+            CALL_ERROR_CHECK();
+    }
+
+    return JNI_TRUE;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hnumber
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_Hnumber
+(JNIEnv *env, jclass clss, jlong fid, jint tagtype)
+{
+    int32  retVal;
+
+    retVal = Hnumber((int32)fid, (uint16)tagtype);
+
+    if (retVal == FAIL)
+        CALL_ERROR_CHECK();
+
+    return (jint)retVal;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    DFKNTsize
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_DFKNTsize
+(JNIEnv *env, jclass clss, jlong numbertype)
+{
+    int  retVal;
+
+    retVal = DFKNTsize((int32)numbertype);
+
+    if (retVal == FAIL)
+        CALL_ERROR_CHECK();
+
+    return (jint)retVal;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hcache
+ * Signature: (JI)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hcache
+(JNIEnv *env, jclass clss, jlong file_id, jint cache_switch)
+{
+
+    intn rval;
+    rval =  Hcache((int32)file_id, (intn)cache_switch);
+
+    if (rval == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hgetfileversion
+ * Signature: (J[I[Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hgetfileversion
+(JNIEnv *env, jclass clss, jlong file_id, jintArray vers, jobjectArray string)
+{
+    intn rval;
+    jclass Sjc;
+    char s[LIBVSTR_LEN+1];
+    jstring name;
+    jint *theArgs;
+    jboolean bb;
+    jobject o;
+
+    theArgs = ENVPTR->GetIntArrayElements(ENVPAR vers, &bb);
+
+    rval = Hgetfileversion((int32) file_id, (uint32 *)&(theArgs[0]),
+        (uint32 *)&(theArgs[1]), (uint32 *)&(theArgs[2]), s);
+    s[LIBVSTR_LEN] = '\0';
+
+    if (rval == FAIL) {
+        ENVPTR->ReleaseIntArrayElements(ENVPAR vers, theArgs, JNI_ABORT);
+        CALL_ERROR_CHECK();
+    }
+    else {
+        ENVPTR->ReleaseIntArrayElements(ENVPAR vers, theArgs, 0);
+        o = ENVPTR->GetObjectArrayElement(ENVPAR string, 0);
+        if (o == NULL) {
+            CALL_ERROR_CHECK();
+        }
+        else {
+            Sjc = ENVPTR->FindClass(ENVPAR  "java/lang/String");
+            if (Sjc == NULL) {
+                CALL_ERROR_CHECK();
+            }
+            else  if (ENVPTR->IsInstanceOf(ENVPAR o, Sjc) == JNI_FALSE) {
+                CALL_ERROR_CHECK();
+            }
+            else {
+                name = ENVPTR->NewStringUTF(ENVPAR s);
+                if (name != NULL) {
+                    ENVPTR->SetObjectArrayElement(ENVPAR string, 0, (jobject)name);
+                }
+            }
+            ENVPTR->DeleteLocalRef(ENVPAR o);
+        }
+    }
+    return JNI_TRUE;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hgetlibversion
+ * Signature: ([I[Ljava/lang/String;)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hgetlibversion
+(JNIEnv *env, jclass clss, jintArray vers, jobjectArray string)
+{
+    intn rval;
+    jclass Sjc;
+    char s[LIBVSTR_LEN+1] ;
+    jint *theArgs;
+    jstring name;
+    jobject o;
+    jboolean bb;
+
+    s[LIBVSTR_LEN] = '\0';
+    if (string == NULL) {
+        h4nullArgument(env, "Hgetlibversion:  string is NULL");
+    } /* end if */
+    else if (vers == NULL) {
+        h4nullArgument(env, "Hgetlibversion:  vers is NULL");
+    } /* end if */
+    else if (ENVPTR->GetArrayLength(ENVPAR vers) < 3) {
+        h4badArgument(env, "Hgetlibversion:  vers input array < order 3");
+    } /* end else if */
+    else {
+        theArgs = ENVPTR->GetIntArrayElements(ENVPAR vers, &bb);
+        if (theArgs == NULL) {
+            h4JNIFatalError(env, "Hgetlibversion:  vers not pinned");
+        } /* end if */
+        else {
+            rval = Hgetlibversion((uint32 *)&(theArgs[0]),
+                (uint32 *)&(theArgs[1]), (uint32 *)&(theArgs[2]), s);
+
+            if (rval == FAIL) {
+                ENVPTR->ReleaseIntArrayElements(ENVPAR vers, theArgs, JNI_ABORT);
+                CALL_ERROR_CHECK();
+            }
+            else {
+                ENVPTR->ReleaseIntArrayElements(ENVPAR vers, theArgs, 0);
+                Sjc = ENVPTR->FindClass(ENVPAR  "java/lang/String");
+                if (Sjc == NULL) {
+                    CALL_ERROR_CHECK();
+                }
+                else {
+                    o = ENVPTR->GetObjectArrayElement(ENVPAR string, 0);
+                    if (o == NULL) {
+                        CALL_ERROR_CHECK();
+                    }
+                    else {
+                        bb = ENVPTR->IsInstanceOf(ENVPAR o, Sjc);
+                        if (bb == JNI_FALSE) {
+                            CALL_ERROR_CHECK();
+                        }
+                        else {
+                            ENVPTR->DeleteLocalRef(ENVPAR o);
+                            name = ENVPTR->NewStringUTF(ENVPAR s);
+                            if (name != NULL) {
+                                ENVPTR->SetObjectArrayElement(ENVPAR string, 0, (jobject)name);
+                            }
+                        }
+                    }
+                }
+            }
+        } /* end else */
+    } /* end else */
+    return JNI_TRUE;
+}
+
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hsetaccesstype
+ * Signature: (JI)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hsetaccesstype
+(JNIEnv *env, jclass clss, jlong h_id, jint  access_type)
+{
+    intn rval;
+
+    rval = Hsetaccesstype((int32)h_id, (uintn)access_type);
+    if (rval == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    Hsync
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_Hsync
+(JNIEnv *env, jclass clss, jlong file_id)
+{
+    intn rval;
+
+    rval = Hsync((int32)file_id);
+    if (rval == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    HDFclose
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_HDFclose
+(JNIEnv *env, jclass clss, jlong file_id)
+{
+    intn rval;
+
+    rval = Hclose((int32)file_id);
+
+    if (rval == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    HDFopen
+ * Signature: (Ljava/lang/String;IS)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_HDFopen
+(JNIEnv *env, jclass clss, jstring filename, jint access, jshort n_dds)
+{
+    int32 rval;
+    const char *str;
+
+    PIN_JAVA_STRING(filename, str);
+    if (str != NULL) {
+        rval = HDFopen((char *)str, (intn)access, (int16)n_dds);
+
+        UNPIN_JAVA_STRING(filename, str);
+        if (rval == FAIL)
+            CALL_ERROR_CHECK();
+    }
+    return rval;
+}
+
+
+#ifdef not_yet_implemented
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    HDFflusdd
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_HDFflusdd
+(JNIEnv *env, jclass clss, jlong file_id)
+{
+    intn rval;
+
+    rval = Hflushdd((int32)file_id);
+
+    if (rval == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+#endif
+
+/*
+ * Class:     hdf_hdflib_HDFLibrary
+ * Method:    HDgetNTdesc
+ * Signature: (I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdflib_HDFLibrary_HDgetNTdesc
+(JNIEnv *env, jclass clss, jint nt)
+{
+    char *rval;
+    jstring rstring;
+
+    rval = HDgetNTdesc((int32)nt);
+
+    if (rval != NULL) {
+        rstring = ENVPTR->NewStringUTF(ENVPAR  rval);
+        HDfree(rval);
+    }
+    else
+        rstring = NULL;
+
+    return rstring;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/java/src/jni/hdfanImp.c b/java/src/jni/hdfanImp.c
new file mode 100644
index 0000000..968b720
--- /dev/null
+++ b/java/src/jni/hdfanImp.c
@@ -0,0 +1,393 @@
+
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+/*
+ *  This code is the C-interface called by Java programs to access the
+ *  HDF 4.2 library.
+ *
+ *  Each routine wraps a single HDF entry point, generally with the
+ *  analogous arguments and return codes.
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hdf.h"
+#include "jni.h"
+#include "h4jni.h"
+
+JNIEXPORT jlong JNICALL
+Java_hdf_hdflib_HDFLibrary_ANstart
+(JNIEnv *env, jclass clss, jlong file_id)
+{
+    int32       retVal = -1;
+
+    retVal = ANstart((int32)file_id);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jlong)retVal;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_ANend
+(JNIEnv *env, jclass clss, jlong anid)
+{
+    int32 retVal;
+
+    retVal = ANend((int32)anid);
+
+    if (retVal == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_ANfileinfo
+(JNIEnv *env, jclass clss, jlong anid, jintArray info)
+{
+    intn retVal;
+    jint *theArgs;
+    jboolean isCopy;
+
+    if (info == NULL) {
+        h4nullArgument(env, "ANfileinfo:  info is NULL");
+    } /* end if */
+    else if (ENVPTR->GetArrayLength(ENVPAR info) < 4) {
+        h4badArgument(env, "ANfileinfo:  info input array < order 4");
+    } /* end else if */
+    else {
+        theArgs = ENVPTR->GetIntArrayElements(ENVPAR info, &isCopy);
+        if (theArgs == NULL) {
+            h4JNIFatalError(env, "ANfileinfo:  info not pinned");
+        } /* end if */
+        else {
+            retVal = ANfileinfo((int32)anid, (int32 *)&(theArgs[0]),
+                (int32 *)&(theArgs[1]), (int32 *)&(theArgs[2]),
+                (int32 *)&(theArgs[3]));
+
+            if (retVal == FAIL) {
+                ENVPTR->ReleaseIntArrayElements(ENVPAR info, theArgs, JNI_ABORT);
+                CALL_ERROR_CHECK();
+            } /* end if */
+            else {
+                ENVPTR->ReleaseIntArrayElements(ENVPAR info, theArgs, 0);
+            } /* end else */
+        } /* end else */
+    } /* end else */
+    return JNI_TRUE;
+}
+
+
+JNIEXPORT jlong JNICALL
+Java_hdf_hdflib_HDFLibrary_ANselect
+(JNIEnv *env, jclass clss, jlong anid, jint index, jint anntype)
+{
+    int32 retVal;
+
+    retVal = ANselect((int32)anid, (int32)index, (ann_type)anntype);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jlong)retVal;
+}
+
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_ANendaccess
+(JNIEnv *env, jclass clss, jlong ann_id)
+{
+    intn retVal;
+
+    retVal = ANendaccess((int32)ann_id);
+    if (retVal == FAIL)
+        CALL_ERROR_CHECK();
+
+    return JNI_TRUE;
+}
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_ANnumann
+(JNIEnv *env, jclass clss, jlong an_id, jint anntype, jshort tag, jshort ref)
+{
+    int32 retVal;
+
+    retVal = ANnumann((int32)an_id, (ann_type)anntype, (uint16)tag, (uint16)ref);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jint)retVal;
+}
+
+JNIEXPORT jshort JNICALL
+Java_hdf_hdflib_HDFLibrary_ANatype2tag
+(JNIEnv *env, jclass clss, jint antype)
+{
+    uint16 retVal;
+
+    retVal = ANatype2tag((ann_type)antype);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jshort)retVal;
+}
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_ANtag2atype
+(JNIEnv *env, jclass clss, jint antag)
+{
+    int32 retVal;
+
+    retVal = ANtag2atype((uint16)antag);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jint)retVal;
+}
+
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_ANannlist
+(JNIEnv *env, jclass clss, jlong an_id, jint anntype, jshort tag, jshort ref, jintArray annlist)
+{
+    intn retVal;
+    jint *iarr;
+    jboolean isCopy;
+
+    if (annlist == NULL) {
+        h4nullArgument(env, "ANannlist:  annlist is NULL");
+    } /* end if */
+    else {
+        iarr = ENVPTR->GetIntArrayElements(ENVPAR annlist, &isCopy);
+        if (iarr == NULL) {
+            h4JNIFatalError(env, "ANannlist:  annlist not pinned");
+        } /* end if */
+        else {
+            retVal = ANannlist((int32)an_id, (ann_type)anntype, (uint16)tag,(uint16)ref,(int32 *)iarr);
+
+            if (retVal == FAIL) {
+                ENVPTR->ReleaseIntArrayElements(ENVPAR annlist, iarr, JNI_ABORT);
+                CALL_ERROR_CHECK();
+            } /* end if */
+            else {
+                ENVPTR->ReleaseIntArrayElements(ENVPAR annlist, iarr, 0);
+            } /* end else */
+        } /* end else */
+    } /* end else */
+    return (jint)retVal;
+}
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_ANannlen
+(JNIEnv *env, jclass clss, jlong ann_id)
+{
+    int32 retVal;
+
+    retVal = ANannlen((int32)ann_id);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jint)retVal;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_ANreadann
+(JNIEnv *env, jclass clss, jlong ann_id, jobjectArray annbuf, jint maxlen)
+{
+    int32 retVal;
+    char  *data;
+    jclass Sjc;
+    jstring rstring;
+    jobject o;
+    jboolean bb;
+
+    data = (char *)HDmalloc((maxlen+1)*sizeof(char));
+    if (data == NULL) {
+        /* Exception */
+        h4outOfMemory(env, "ANreadan");
+    }
+    else {
+        /* read annotation from HDF */
+        retVal = ANreadann((int32)ann_id, data, (int32)maxlen);
+
+        if (retVal == FAIL) {
+            CALL_ERROR_CHECK();
+        }
+        else {
+            o = ENVPTR->GetObjectArrayElement(ENVPAR annbuf, 0);
+            if (o == NULL) {
+                CALL_ERROR_CHECK();
+            }
+            else {
+                Sjc = ENVPTR->FindClass(ENVPAR  "java/lang/String");
+                if (Sjc == NULL) {
+                    CALL_ERROR_CHECK();
+                }
+                else if (ENVPTR->IsInstanceOf(ENVPAR o, Sjc) == JNI_FALSE) {
+                        CALL_ERROR_CHECK();
+                }
+                else {
+                    data[maxlen] = '\0';
+                    rstring = ENVPTR->NewStringUTF(ENVPAR data);
+                    if (rstring != NULL)
+                        ENVPTR->SetObjectArrayElement(ENVPAR annbuf, 0, (jobject)rstring);
+                }
+                ENVPTR->DeleteLocalRef(ENVPAR o);
+            }
+        }
+        HDfree((char *)data);
+    } /* end else */
+    return JNI_TRUE;
+}
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_ANcreate
+(JNIEnv *env, jclass clss, jlong an_id, jshort tag, jshort ref, jint type)
+{
+    int32 retVal;
+
+    retVal = ANcreate((int32) an_id, (uint16) tag, (uint16) ref, (ann_type) type);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jint)retVal;
+}
+
+JNIEXPORT jlong JNICALL
+Java_hdf_hdflib_HDFLibrary_ANcreatef
+(JNIEnv *env, jclass clss, jlong an_id, jint type)
+{
+    int32 retVal;
+
+    retVal = ANcreatef((int32) an_id, (ann_type) type);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jlong)retVal;
+}
+
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_ANget_1tagref
+(JNIEnv *env, jclass clss, jlong an_id, jint index, jint type, jshortArray tagref)
+{
+    int32 rval;
+    short *theArgs;
+    jboolean isCopy;
+
+    if (tagref == NULL) {
+        h4nullArgument(env, "ANget_tagref:  tagref is NULL");
+    } /* end if */
+    else if (ENVPTR->GetArrayLength(ENVPAR tagref) < 2) {
+        h4badArgument(env, "ANget_tagref:  tagref input array < order 2");
+    } /* end else if */
+    else {
+        theArgs = ENVPTR->GetShortArrayElements(ENVPAR tagref, &isCopy);
+        if (theArgs == NULL) {
+            h4JNIFatalError(env, "ANget_tagref:  tagref not pinned");
+        } /* end if */
+        else {
+            rval = ANget_tagref((int32)an_id, (int32)index, (ann_type)type, (uint16 *)&(theArgs[0]), (uint16 *)&(theArgs[1]));
+
+            if (rval == FAIL) {
+                ENVPTR->ReleaseShortArrayElements(ENVPAR tagref, theArgs, JNI_ABORT);
+                CALL_ERROR_CHECK();
+            } /* end if */
+            else {
+                ENVPTR->ReleaseShortArrayElements(ENVPAR tagref, theArgs, 0);
+            } /* end else */
+        } /* end else */
+    } /* end else */
+
+    return rval;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_ANid2tagref
+(JNIEnv *env, jclass clss, jlong an_id, jshortArray tagref)
+{
+    int32 rval;
+    short *theArgs;
+    jboolean isCopy;
+
+    if (tagref == NULL) {
+        h4nullArgument(env, "ANid2tagref:  tagref is NULL");
+    } /* end if */
+    else if (ENVPTR->GetArrayLength(ENVPAR tagref) < 2) {
+        h4badArgument(env, "ANid2tagref:  tagref input array < order 2");
+    } /* end else if */
+    else {
+        theArgs = ENVPTR->GetShortArrayElements(ENVPAR tagref, &isCopy);
+        if (theArgs == NULL) {
+            h4JNIFatalError(env, "ANid2tagref:  tagref not pinned");
+        } /* end if */
+        else {
+            rval = ANid2tagref((int32)an_id, (uint16 *)&(theArgs[0]), (uint16 *)&(theArgs[1]));
+
+            if (rval == FAIL) {
+                ENVPTR->ReleaseShortArrayElements(ENVPAR tagref, theArgs, JNI_ABORT);
+                CALL_ERROR_CHECK();
+            }
+            else {
+                ENVPTR->ReleaseShortArrayElements(ENVPAR tagref, theArgs, 0);
+            } /* end else */
+        } /* end else */
+    } /* end else */
+    return JNI_TRUE;
+}
+
+JNIEXPORT jlong JNICALL
+Java_hdf_hdflib_HDFLibrary_ANtagref2id
+(JNIEnv *env, jclass clss, jlong an_id, jshort tag, jshort ref)
+{
+    int32 retVal;
+
+    retVal = ANtagref2id((int32)an_id, (uint16)tag, (uint16)ref);
+    if (retVal < 0)
+        CALL_ERROR_CHECK();
+
+    return (jlong)retVal;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_ANwriteann
+(JNIEnv *env, jclass clss, jlong ann_id, jstring label, jint ann_length)
+{
+
+    intn         rval;
+    const char *str;
+
+    PIN_JAVA_STRING(label, str);
+
+    if (str != NULL) {
+        /* should check that str is as long as ann_length.... */
+
+        rval = ANwriteann((int32)ann_id, str, (int32)ann_length);
+
+        UNPIN_JAVA_STRING(label, str);
+
+        if (rval == FAIL)
+            CALL_ERROR_CHECK();
+    }
+
+    return JNI_TRUE;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/java/src/jni/hdfdfpalImp.c b/java/src/jni/hdfdfpalImp.c
new file mode 100644
index 0000000..a4b6895
--- /dev/null
+++ b/java/src/jni/hdfdfpalImp.c
@@ -0,0 +1,221 @@
+
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+/*
+ *  This code is the C-interface called by Java programs to access the
+ *  HDF 4.2 library.
+ *
+ *  Each routine wraps a single HDF entry point, generally with the
+ *  analogous arguments and return codes.
+ *
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "hdf.h"
+#include "h4jni.h"
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPaddpal
+(JNIEnv *env, jclass clss, jstring filename, jbyteArray palette)
+{
+    intn         rval;
+    const char  *f;
+    jbyte       *dat;
+    jboolean     bb;
+
+    rval = FAIL;
+
+    if (palette == NULL) {
+        h4nullArgument(env, "DFPaddpal:  palette is NULL");
+    } /* end if */
+    else {
+        PIN_JAVA_STRING(filename, f);
+        if (f != NULL) {
+            dat = ENVPTR->GetByteArrayElements(ENVPAR palette, &bb);
+            if (dat == NULL) {
+                h4JNIFatalError(env, "DFPaddpal:  palette not pinned");
+            } /* end if */
+            else {
+                rval = DFPaddpal(f, (VOIDP)dat);
+                ENVPTR->ReleaseByteArrayElements(ENVPAR palette, dat, JNI_ABORT);
+            } /* end else */
+            UNPIN_JAVA_STRING(filename, f);
+
+            if (rval == FAIL)
+                CALL_ERROR_CHECK();
+        }
+    } /* end else */
+    return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPgetpal
+(JNIEnv *env, jclass clss, jstring filename, jbyteArray palette)
+{
+    intn         rval;
+    const char  *f;
+    jbyte       *dat;
+    jboolean     bb;
+    int copyMode = JNI_ABORT;
+
+    if (palette == NULL) {
+        h4nullArgument(env, "DFPgetpal:  palette is NULL");
+    } /* end if */
+    else {
+        dat = ENVPTR->GetByteArrayElements(ENVPAR palette, &bb);
+
+        if (dat == NULL) {
+            h4JNIFatalError(env, "DFPgetpal:  palette not pinned");
+        } /* end if */
+        else {
+            PIN_JAVA_STRING(filename, f);
+            if (f != NULL) {
+                rval = DFPgetpal(f, (VOIDP)dat);
+
+                UNPIN_JAVA_STRING(filename, f);
+
+                if (rval == FAIL) {
+                    CALL_ERROR_CHECK();
+                } /* end if */
+                else {
+                    copyMode = 0;
+                } /* end else */
+            } /* end if */
+
+            ENVPTR->ReleaseByteArrayElements(ENVPAR palette, dat, copyMode);
+        } /* end else */
+    } /* end else */
+
+    return JNI_TRUE;
+}
+
+JNIEXPORT jshort JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPlastref
+(JNIEnv *env, jclass clss)
+{
+    return (DFPlastref());
+}
+
+JNIEXPORT jint JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPnpals
+(JNIEnv *env, jclass clss, jstring filename)
+{
+    intn         rval;
+    const char  *f;
+
+    PIN_JAVA_STRING(filename, f);
+    if (f != NULL) {
+        rval = DFPnpals(f);
+
+        UNPIN_JAVA_STRING(filename, f);
+
+        if (rval == FAIL)
+            CALL_ERROR_CHECK();
+    }
+
+    return rval;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPputpal
+(JNIEnv *env, jclass clss, jstring filename, jbyteArray palette, jint overwrite, jstring filemode)
+{
+    intn         rval;
+    const char  *f;
+    const char  *m;
+    jbyte       *dat;
+    jboolean     bb;
+
+    rval = FAIL;
+
+    if (palette == NULL) {
+        h4nullArgument(env, "DFPputpal:  palette is NULL");
+    } /* end if */
+    else {
+        PIN_JAVA_STRING_TWO(filename, f, filemode, m);
+        if (f != NULL && m != NULL) {
+            if (dat == NULL) {
+                h4JNIFatalError(env, "DFPputpal:  palette not pinned");
+            } /* end if */
+            else {
+                dat = ENVPTR->GetByteArrayElements(ENVPAR palette, &bb);
+
+                rval = DFPputpal (f, (VOIDP)dat, (intn)overwrite, m);
+
+                ENVPTR->ReleaseByteArrayElements(ENVPAR palette, dat, JNI_ABORT);
+            } /* end else */
+
+            UNPIN_JAVA_STRING_TWO(filename, f, filemode, m);
+
+            if (rval == FAIL)
+                CALL_ERROR_CHECK();
+        }
+    } /* end else */
+
+    return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPreadref
+(JNIEnv *env, jclass clss, jstring filename, jshort ref)
+{
+    intn         rval;
+    const char  *f;
+
+    PIN_JAVA_STRING(filename, f);
+    if (f != NULL) {
+        rval = DFPreadref((char *)f, (uint16) ref);
+
+        UNPIN_JAVA_STRING(filename, f);
+
+        if (rval == FAIL)
+            CALL_ERROR_CHECK();
+    }
+
+    return JNI_TRUE;
+}
+
+JNIEXPORT jshort JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPrestart
+(JNIEnv *env, jclass clss)
+{
+    return (DFPrestart());
+}
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_DFPwriteref
+(JNIEnv *env, jclass clss, jstring filename, jshort ref)
+{
+    intn         rval;
+    const char  *f;
+
+    PIN_JAVA_STRING(filename, f);
+    if (f != NULL) {
+        rval = DFPwriteref((char *)f, (uint16) ref);
+
+        UNPIN_JAVA_STRING(filename, f);
+
+        if (rval == FAIL)
+            CALL_ERROR_CHECK();
+    }
+
+    return JNI_TRUE;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/java/src/jni/hdfdfuImp.c b/java/src/jni/hdfdfuImp.c
new file mode 100644
index 0000000..9e55441
--- /dev/null
+++ b/java/src/jni/hdfdfuImp.c
@@ -0,0 +1,44 @@
+
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+/*
+ *  This code is the C-interface called by Java programs to access the
+ *  HDF 4.2 library.
+ *
+ *  Each routine wraps a single HDF entry point, generally with the
+ *  analogous arguments and return codes.
+ *
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "hdf.h"
+#include "jni.h"
+#include "h4jni.h"
+
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdflib_HDFLibrary_DFUfptoimage
+(JNIEnv *env, jclass clss, jint hdim, jint vdim,
+        jfloat max, jfloat min, jfloatArray hscale, jfloatArray vscale, jfloatArray data,
+        jbyteArray palette, jstring outfile, jint ct_method, jint hres, jint vres, jint compress)
+{
+    h4NotImplemented(env, "DFUfptoimage (windows)");
+    return JNI_TRUE;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/java/src/jni/hdfexceptionImp.c b/java/src/jni/hdfexceptionImp.c
new file mode 100644
index 0000000..9491a47
--- /dev/null
+++ b/java/src/jni/hdfexceptionImp.c
@@ -0,0 +1,186 @@
+/****************************************************************************
+ * Copyright by The HDF Group.                                               *
+ * Copyright by the Board of Trustees of the University of Illinois.         *
+ * All rights reserved.                                                      *
+ *                                                                           *
+ * This file is part of HDF Java Products. The full HDF Java copyright       *
+ * notice, including terms governing use, modification, and redistribution,  *
+ * is contained in the file, COPYING.  COPYING can be found at the root of   *
+ * the source code distribution tree. You can also access it online  at      *
+ * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
+ * access to the file, you may request a copy from help at hdfgroup.org.        *
+ ****************************************************************************/
+/*
+ *  This is a utility program used by the HDF Java-C wrapper layer to
+ *  generate exceptions.  This may be called from any part of the
+ *  Java-C interface.
+ *
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "hdf.h"
+#include "h4jni.h"
+#include <stdlib.h>
+
+/********************/
+/* Local Macros     */
+/********************/
+
+#define THROWEXCEPTION(className,args) {                                    \
+    jclass     jc;                                                          \
+    jmethodID  jm;                                                          \
+    jobject    ex;                                                          \
+    jc = ENVPTR->FindClass(ENVPAR (className));                             \
+    if (jc == NULL) {